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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (287) hide show
  1. package/declarations/build-config/babel-macros.d.ts +1 -2
  2. package/declarations/build-config/canary-features.d.ts +1 -2
  3. package/declarations/build-config/debugging.d.ts +1 -2
  4. package/declarations/build-config/deprecations.d.ts +1 -2
  5. package/declarations/build-config/env.d.ts +1 -2
  6. package/declarations/build-config/macros.d.ts +1 -2
  7. package/declarations/build-config.d.ts +1 -2
  8. package/declarations/configure.d.ts +6 -7
  9. package/declarations/graph/-private/-diff.d.ts +21 -22
  10. package/declarations/graph/-private/-edge-definition.d.ts +134 -135
  11. package/declarations/graph/-private/-state.d.ts +93 -7
  12. package/declarations/graph/-private/-utils.d.ts +18 -13
  13. package/declarations/graph/-private/coerce-id.d.ts +6 -1
  14. package/declarations/graph/-private/debug/assert-polymorphic-type.d.ts +15 -4
  15. package/declarations/graph/-private/edges/collection.d.ts +35 -36
  16. package/declarations/graph/-private/edges/implicit.d.ts +28 -29
  17. package/declarations/graph/-private/edges/resource.d.ts +19 -20
  18. package/declarations/graph/-private/graph.d.ts +83 -48
  19. package/declarations/graph/-private/normalize-link.d.ts +7 -2
  20. package/declarations/graph/-private/operations/add-to-related-records.d.ts +3 -4
  21. package/declarations/graph/-private/operations/merge-identifier.d.ts +2 -3
  22. package/declarations/graph/-private/operations/remove-from-related-records.d.ts +3 -4
  23. package/declarations/graph/-private/operations/replace-related-record.d.ts +2 -3
  24. package/declarations/graph/-private/operations/replace-related-records.d.ts +58 -4
  25. package/declarations/graph/-private/operations/update-relationship.d.ts +11 -9
  26. package/declarations/graph/-private.d.ts +9 -10
  27. package/declarations/index.d.ts +11 -12
  28. package/declarations/reactive/-private/document.d.ts +143 -144
  29. package/declarations/reactive/-private/fields/compute.d.ts +31 -28
  30. package/declarations/reactive/-private/fields/extension.d.ts +8 -0
  31. package/declarations/reactive/-private/fields/managed-array.d.ts +19 -20
  32. package/declarations/reactive/-private/fields/managed-object.d.ts +16 -16
  33. package/declarations/reactive/-private/fields/many-array-manager.d.ts +15 -16
  34. package/declarations/reactive/-private/hooks.d.ts +3 -4
  35. package/declarations/reactive/-private/record.d.ts +61 -58
  36. package/declarations/reactive/-private/schema.d.ts +256 -165
  37. package/declarations/reactive/-private/symbols.d.ts +27 -2
  38. package/declarations/reactive/-private.d.ts +1 -2
  39. package/declarations/reactive.d.ts +4 -5
  40. package/declarations/request/-private/context.d.ts +34 -35
  41. package/declarations/request/-private/debug.d.ts +2 -3
  42. package/declarations/request/-private/fetch.d.ts +23 -24
  43. package/declarations/request/-private/future.d.ts +3 -4
  44. package/declarations/request/-private/manager.d.ts +159 -157
  45. package/declarations/request/-private/promise-cache.d.ts +21 -13
  46. package/declarations/request/-private/types.d.ts +124 -124
  47. package/declarations/request/-private/utils.d.ts +8 -9
  48. package/declarations/request.d.ts +5 -6
  49. package/declarations/store/-private/cache-handler/handler.d.ts +57 -52
  50. package/declarations/store/-private/cache-handler/types.d.ts +95 -96
  51. package/declarations/store/-private/cache-handler/utils.d.ts +16 -16
  52. package/declarations/store/-private/caches/cache-utils.d.ts +7 -4
  53. package/declarations/store/-private/caches/identifier-cache.d.ts +234 -246
  54. package/declarations/store/-private/caches/instance-cache.d.ts +47 -47
  55. package/declarations/store/-private/caches/resource-utils.d.ts +3 -4
  56. package/declarations/store/-private/debug/utils.d.ts +6 -7
  57. package/declarations/store/-private/default-cache-policy.d.ts +362 -361
  58. package/declarations/store/-private/legacy-model-support/record-reference.d.ts +154 -159
  59. package/declarations/store/-private/legacy-model-support/shim-model-class.d.ts +14 -14
  60. package/declarations/store/-private/managers/cache-capabilities-manager.d.ts +21 -22
  61. package/declarations/store/-private/managers/cache-manager.d.ts +440 -425
  62. package/declarations/store/-private/managers/notification-manager.d.ts +88 -83
  63. package/declarations/store/-private/managers/record-array-manager.d.ts +89 -90
  64. package/declarations/store/-private/network/request-cache.d.ts +86 -83
  65. package/declarations/store/-private/new-core-tmp/promise-state.d.ts +252 -244
  66. package/declarations/store/-private/new-core-tmp/reactivity/configure.d.ts +155 -72
  67. package/declarations/store/-private/new-core-tmp/reactivity/internal.d.ts +148 -149
  68. package/declarations/store/-private/new-core-tmp/reactivity/signal.d.ts +28 -23
  69. package/declarations/store/-private/new-core-tmp/request-state.d.ts +263 -241
  70. package/declarations/store/-private/new-core-tmp/request-subscription.d.ts +261 -0
  71. package/declarations/store/-private/record-arrays/identifier-array.d.ts +125 -119
  72. package/declarations/store/-private/record-arrays/many-array.d.ts +180 -182
  73. package/declarations/store/-private/record-arrays/native-proxy-type-fix.d.ts +120 -110
  74. package/declarations/store/-private/store-service.d.ts +1594 -1586
  75. package/declarations/store/-private/utils/coerce-id.d.ts +6 -1
  76. package/declarations/store/-private/utils/construct-resource.d.ts +1 -2
  77. package/declarations/store/-private/utils/is-non-empty-string.d.ts +0 -1
  78. package/declarations/store/-private/utils/normalize-model-name.d.ts +0 -1
  79. package/declarations/store/-private/utils/uuid-polyfill.d.ts +0 -1
  80. package/declarations/store/-private.d.ts +31 -27
  81. package/declarations/store/-types/q/cache-capabilities-manager.d.ts +96 -97
  82. package/declarations/store/-types/q/ds-model.d.ts +17 -18
  83. package/declarations/store/-types/q/identifier.d.ts +11 -12
  84. package/declarations/store/-types/q/record-instance.d.ts +16 -17
  85. package/declarations/store/-types/q/schema-service.d.ts +346 -323
  86. package/declarations/store/-types/q/store.d.ts +25 -28
  87. package/declarations/store.d.ts +1 -2
  88. package/declarations/types/-private.d.ts +16 -8
  89. package/declarations/types/cache/aliases.d.ts +11 -1
  90. package/declarations/types/cache/change.d.ts +4 -5
  91. package/declarations/types/cache/mutations.d.ts +51 -28
  92. package/declarations/types/cache/operations.d.ts +60 -47
  93. package/declarations/types/cache/relationship.d.ts +11 -9
  94. package/declarations/types/cache.d.ts +495 -484
  95. package/declarations/types/graph.d.ts +31 -32
  96. package/declarations/types/identifier.d.ts +83 -82
  97. package/declarations/types/json/raw.d.ts +1 -2
  98. package/declarations/types/params.d.ts +4 -5
  99. package/declarations/types/record.d.ts +117 -76
  100. package/declarations/types/request.d.ts +289 -266
  101. package/declarations/types/runtime.d.ts +8 -9
  102. package/declarations/types/schema/concepts.d.ts +19 -13
  103. package/declarations/types/schema/fields.d.ts +1712 -1587
  104. package/declarations/types/schema/fields.type-test.d.ts +0 -1
  105. package/declarations/types/spec/document.d.ts +28 -22
  106. package/declarations/types/spec/error.d.ts +16 -17
  107. package/declarations/types/spec/json-api-raw.d.ts +102 -102
  108. package/declarations/types/symbols.d.ts +74 -75
  109. package/declarations/types/utils.d.ts +5 -5
  110. package/declarations/types.d.ts +10 -11
  111. package/declarations/utils/string.d.ts +43 -40
  112. package/dist/{configure-BgaZESRo.js → configure-B48bFHOl.js} +38 -2
  113. package/dist/configure.js +1 -1
  114. package/dist/graph/-private.js +2 -2
  115. package/dist/{handler-cHghx9Y9.js → handler-C2T-IyJK.js} +1 -1
  116. package/dist/index.js +3 -3
  117. package/dist/reactive/-private.js +1 -1
  118. package/dist/reactive.js +287 -101
  119. package/dist/{request-state-DgwTEXLU.js → request-state-CjLph1LP.js} +1030 -249
  120. package/dist/store/-private.js +3 -3
  121. package/dist/{symbols-BmDcn6hS.js → symbols-SIstXMLI.js} +3 -3
  122. package/dist/types/-private.js +1 -1
  123. package/dist/types/schema/fields.js +4 -4
  124. package/package.json +4 -4
  125. package/declarations/build-config/babel-macros.d.ts.map +0 -1
  126. package/declarations/build-config/canary-features.d.ts.map +0 -1
  127. package/declarations/build-config/debugging.d.ts.map +0 -1
  128. package/declarations/build-config/deprecations.d.ts.map +0 -1
  129. package/declarations/build-config/env.d.ts.map +0 -1
  130. package/declarations/build-config/macros.d.ts.map +0 -1
  131. package/declarations/build-config.d.ts.map +0 -1
  132. package/declarations/configure.d.ts.map +0 -1
  133. package/declarations/graph/-private/-diff.d.ts.map +0 -1
  134. package/declarations/graph/-private/-edge-definition.d.ts.map +0 -1
  135. package/declarations/graph/-private/-state.d.ts.map +0 -1
  136. package/declarations/graph/-private/-utils.d.ts.map +0 -1
  137. package/declarations/graph/-private/coerce-id.d.ts.map +0 -1
  138. package/declarations/graph/-private/debug/assert-polymorphic-type.d.ts.map +0 -1
  139. package/declarations/graph/-private/edges/collection.d.ts.map +0 -1
  140. package/declarations/graph/-private/edges/implicit.d.ts.map +0 -1
  141. package/declarations/graph/-private/edges/resource.d.ts.map +0 -1
  142. package/declarations/graph/-private/graph.d.ts.map +0 -1
  143. package/declarations/graph/-private/normalize-link.d.ts.map +0 -1
  144. package/declarations/graph/-private/operations/add-to-related-records.d.ts.map +0 -1
  145. package/declarations/graph/-private/operations/merge-identifier.d.ts.map +0 -1
  146. package/declarations/graph/-private/operations/remove-from-related-records.d.ts.map +0 -1
  147. package/declarations/graph/-private/operations/replace-related-record.d.ts.map +0 -1
  148. package/declarations/graph/-private/operations/replace-related-records.d.ts.map +0 -1
  149. package/declarations/graph/-private/operations/update-relationship.d.ts.map +0 -1
  150. package/declarations/graph/-private.d.ts.map +0 -1
  151. package/declarations/index.d.ts.map +0 -1
  152. package/declarations/reactive/-private/document.d.ts.map +0 -1
  153. package/declarations/reactive/-private/fields/compute.d.ts.map +0 -1
  154. package/declarations/reactive/-private/fields/managed-array.d.ts.map +0 -1
  155. package/declarations/reactive/-private/fields/managed-object.d.ts.map +0 -1
  156. package/declarations/reactive/-private/fields/many-array-manager.d.ts.map +0 -1
  157. package/declarations/reactive/-private/hooks.d.ts.map +0 -1
  158. package/declarations/reactive/-private/record.d.ts.map +0 -1
  159. package/declarations/reactive/-private/schema.d.ts.map +0 -1
  160. package/declarations/reactive/-private/symbols.d.ts.map +0 -1
  161. package/declarations/reactive/-private.d.ts.map +0 -1
  162. package/declarations/reactive.d.ts.map +0 -1
  163. package/declarations/request/-private/context.d.ts.map +0 -1
  164. package/declarations/request/-private/debug.d.ts.map +0 -1
  165. package/declarations/request/-private/fetch.d.ts.map +0 -1
  166. package/declarations/request/-private/future.d.ts.map +0 -1
  167. package/declarations/request/-private/manager.d.ts.map +0 -1
  168. package/declarations/request/-private/promise-cache.d.ts.map +0 -1
  169. package/declarations/request/-private/types.d.ts.map +0 -1
  170. package/declarations/request/-private/utils.d.ts.map +0 -1
  171. package/declarations/request.d.ts.map +0 -1
  172. package/declarations/store/-private/cache-handler/handler.d.ts.map +0 -1
  173. package/declarations/store/-private/cache-handler/types.d.ts.map +0 -1
  174. package/declarations/store/-private/cache-handler/utils.d.ts.map +0 -1
  175. package/declarations/store/-private/caches/cache-utils.d.ts.map +0 -1
  176. package/declarations/store/-private/caches/identifier-cache.d.ts.map +0 -1
  177. package/declarations/store/-private/caches/instance-cache.d.ts.map +0 -1
  178. package/declarations/store/-private/caches/resource-utils.d.ts.map +0 -1
  179. package/declarations/store/-private/debug/utils.d.ts.map +0 -1
  180. package/declarations/store/-private/default-cache-policy.d.ts.map +0 -1
  181. package/declarations/store/-private/legacy-model-support/record-reference.d.ts.map +0 -1
  182. package/declarations/store/-private/legacy-model-support/shim-model-class.d.ts.map +0 -1
  183. package/declarations/store/-private/managers/cache-capabilities-manager.d.ts.map +0 -1
  184. package/declarations/store/-private/managers/cache-manager.d.ts.map +0 -1
  185. package/declarations/store/-private/managers/notification-manager.d.ts.map +0 -1
  186. package/declarations/store/-private/managers/record-array-manager.d.ts.map +0 -1
  187. package/declarations/store/-private/network/request-cache.d.ts.map +0 -1
  188. package/declarations/store/-private/new-core-tmp/promise-state.d.ts.map +0 -1
  189. package/declarations/store/-private/new-core-tmp/reactivity/configure.d.ts.map +0 -1
  190. package/declarations/store/-private/new-core-tmp/reactivity/internal.d.ts.map +0 -1
  191. package/declarations/store/-private/new-core-tmp/reactivity/signal.d.ts.map +0 -1
  192. package/declarations/store/-private/new-core-tmp/request-state.d.ts.map +0 -1
  193. package/declarations/store/-private/record-arrays/identifier-array.d.ts.map +0 -1
  194. package/declarations/store/-private/record-arrays/many-array.d.ts.map +0 -1
  195. package/declarations/store/-private/record-arrays/native-proxy-type-fix.d.ts.map +0 -1
  196. package/declarations/store/-private/store-service.d.ts.map +0 -1
  197. package/declarations/store/-private/store-service.type-test.d.ts +0 -2
  198. package/declarations/store/-private/store-service.type-test.d.ts.map +0 -1
  199. package/declarations/store/-private/utils/coerce-id.d.ts.map +0 -1
  200. package/declarations/store/-private/utils/construct-resource.d.ts.map +0 -1
  201. package/declarations/store/-private/utils/is-non-empty-string.d.ts.map +0 -1
  202. package/declarations/store/-private/utils/normalize-model-name.d.ts.map +0 -1
  203. package/declarations/store/-private/utils/uuid-polyfill.d.ts.map +0 -1
  204. package/declarations/store/-private.d.ts.map +0 -1
  205. package/declarations/store/-types/q/cache-capabilities-manager.d.ts.map +0 -1
  206. package/declarations/store/-types/q/ds-model.d.ts.map +0 -1
  207. package/declarations/store/-types/q/identifier.d.ts.map +0 -1
  208. package/declarations/store/-types/q/promise-proxies.d.ts +0 -2
  209. package/declarations/store/-types/q/promise-proxies.d.ts.map +0 -1
  210. package/declarations/store/-types/q/record-data-json-api.d.ts +0 -31
  211. package/declarations/store/-types/q/record-data-json-api.d.ts.map +0 -1
  212. package/declarations/store/-types/q/record-instance.d.ts.map +0 -1
  213. package/declarations/store/-types/q/schema-service.d.ts.map +0 -1
  214. package/declarations/store/-types/q/store.d.ts.map +0 -1
  215. package/declarations/store.d.ts.map +0 -1
  216. package/declarations/types/-private.d.ts.map +0 -1
  217. package/declarations/types/cache/aliases.d.ts.map +0 -1
  218. package/declarations/types/cache/change.d.ts.map +0 -1
  219. package/declarations/types/cache/mutations.d.ts.map +0 -1
  220. package/declarations/types/cache/operations.d.ts.map +0 -1
  221. package/declarations/types/cache/relationship.d.ts.map +0 -1
  222. package/declarations/types/cache.d.ts.map +0 -1
  223. package/declarations/types/graph.d.ts.map +0 -1
  224. package/declarations/types/identifier.d.ts.map +0 -1
  225. package/declarations/types/json/raw.d.ts.map +0 -1
  226. package/declarations/types/params.d.ts.map +0 -1
  227. package/declarations/types/record.d.ts.map +0 -1
  228. package/declarations/types/record.type-test.d.ts +0 -2
  229. package/declarations/types/record.type-test.d.ts.map +0 -1
  230. package/declarations/types/request.d.ts.map +0 -1
  231. package/declarations/types/request.type-test.d.ts +0 -2
  232. package/declarations/types/request.type-test.d.ts.map +0 -1
  233. package/declarations/types/runtime.d.ts.map +0 -1
  234. package/declarations/types/schema/concepts.d.ts.map +0 -1
  235. package/declarations/types/schema/fields.d.ts.map +0 -1
  236. package/declarations/types/schema/fields.type-test.d.ts.map +0 -1
  237. package/declarations/types/spec/document.d.ts.map +0 -1
  238. package/declarations/types/spec/error.d.ts.map +0 -1
  239. package/declarations/types/spec/json-api-raw.d.ts.map +0 -1
  240. package/declarations/types/symbols.d.ts.map +0 -1
  241. package/declarations/types/utils.d.ts.map +0 -1
  242. package/declarations/types.d.ts.map +0 -1
  243. package/declarations/utils/string.d.ts.map +0 -1
  244. package/dist/build-config/babel-macros.js.map +0 -1
  245. package/dist/build-config/canary-features.js.map +0 -1
  246. package/dist/build-config/debugging.js.map +0 -1
  247. package/dist/build-config/deprecations.js.map +0 -1
  248. package/dist/build-config/env.js.map +0 -1
  249. package/dist/build-config/macros.js.map +0 -1
  250. package/dist/build-config.js.map +0 -1
  251. package/dist/configure-BgaZESRo.js.map +0 -1
  252. package/dist/configure.js.map +0 -1
  253. package/dist/context-COmAnXUQ.js.map +0 -1
  254. package/dist/graph/-private.js.map +0 -1
  255. package/dist/handler-cHghx9Y9.js.map +0 -1
  256. package/dist/index.js.map +0 -1
  257. package/dist/reactive/-private.js.map +0 -1
  258. package/dist/reactive.js.map +0 -1
  259. package/dist/request-state-DgwTEXLU.js.map +0 -1
  260. package/dist/request.js.map +0 -1
  261. package/dist/store/-private.js.map +0 -1
  262. package/dist/store.js.map +0 -1
  263. package/dist/symbols-BmDcn6hS.js.map +0 -1
  264. package/dist/types/-private.js.map +0 -1
  265. package/dist/types/cache/aliases.js.map +0 -1
  266. package/dist/types/cache/change.js.map +0 -1
  267. package/dist/types/cache/mutations.js.map +0 -1
  268. package/dist/types/cache/operations.js.map +0 -1
  269. package/dist/types/cache/relationship.js.map +0 -1
  270. package/dist/types/cache.js.map +0 -1
  271. package/dist/types/graph.js.map +0 -1
  272. package/dist/types/identifier.js.map +0 -1
  273. package/dist/types/json/raw.js.map +0 -1
  274. package/dist/types/params.js.map +0 -1
  275. package/dist/types/record.js.map +0 -1
  276. package/dist/types/request.js.map +0 -1
  277. package/dist/types/runtime.js.map +0 -1
  278. package/dist/types/schema/concepts.js.map +0 -1
  279. package/dist/types/schema/fields.js.map +0 -1
  280. package/dist/types/schema/fields.type-test.js.map +0 -1
  281. package/dist/types/spec/document.js.map +0 -1
  282. package/dist/types/spec/error.js.map +0 -1
  283. package/dist/types/spec/json-api-raw.js.map +0 -1
  284. package/dist/types/symbols.js.map +0 -1
  285. package/dist/types/utils.js.map +0 -1
  286. package/dist/types.js.map +0 -1
  287. package/dist/utils/string.js.map +0 -1
@@ -1,331 +1,354 @@
1
- import type { RecordIdentifier, StableRecordIdentifier } from '../../../types/identifier.ts';
2
- import type { ObjectValue } from '../../../types/json/raw.ts';
3
- import type { Derivation, HashFn, Transformation } from '../../../types/schema/concepts.ts';
4
- import type { ArrayField, DerivedField, FieldSchema, GenericField, HashField, LegacyAttributeField, LegacyRelationshipField, ObjectField, Schema } from '../../../types/schema/fields.ts';
1
+ import type { CAUTION_MEGA_DANGER_ZONE_Extension, ProcessedExtension } from "../../../reactive.js";
2
+ import type { ExtensibleField } from "../../../reactive/-private/schema.js";
3
+ import type { RecordIdentifier, StableRecordIdentifier } from "../../../types/identifier.js";
4
+ import type { ObjectValue } from "../../../types/json/raw.js";
5
+ import type { Derivation, HashFn, Transformation } from "../../../types/schema/concepts.js";
6
+ import type { ArrayField, DerivedField, FieldSchema, GenericField, HashField, LegacyAttributeField, LegacyRelationshipField, ObjectField, Schema } from "../../../types/schema/fields.js";
5
7
  export type AttributesSchema = Record<string, LegacyAttributeField>;
6
8
  export type RelationshipsSchema = Record<string, LegacyRelationshipField>;
7
9
  interface ObjectWithStringTypeProperty {
8
- type: string;
10
+ type: string;
9
11
  }
10
12
  /**
11
- * The SchemaService provides the ability to query for information about the structure
12
- * of any resource type.
13
- *
14
- * Applications can provide any implementation of the SchemaService they please so long
15
- * as it conforms to this interface.
16
- *
17
- * The design of the service means that schema information could be lazily populated,
18
- * derived-on-demand, or progressively enhanced during the course of an application's runtime.
19
- * The primary requirement is merely that any information the service needs to correctly
20
- * respond to an inquest is available by the time it is asked.
21
- *
22
- * The `@ember-data/model` package provides an implementation of this service which
23
- * makes use of your model classes as the source of information to respond to queries
24
- * about resource schema. While this is useful, this may not be ideal for your application.
25
- * For instance, Schema information could be sideloaded or pre-flighted for API calls,
26
- * resulting in no need to bundle and ship potentially large and expensive JSON
27
- * or large Javascript based Models to pull information from.
28
- *
29
- * To register a custom schema implementation, implement the store's `createSchemaService`
30
- * hook to return an instance of your service.
31
- *
32
- * ```ts
33
- * import Store from '@ember-data/store';
34
- * import CustomSchemas from './custom-schemas';
35
- *
36
- * export default class extends Store {
37
- * createSchemaService() {
38
- * return new CustomSchemas();
39
- * }
40
- * }
41
- * ```
42
- *
43
- * At runtime, both the `Store` and the `CacheCapabilitiesManager` provide
44
- * access to this service via the `schema` property.
45
- *
46
- * ```ts
47
- * export default class extends Component {
48
- * @service store;
49
- *
50
- * get fields() {
51
- * return this.store
52
- * .schema
53
- * .fields(this.args.dataType);
54
- * }
55
- * }
56
- * ```
57
- *
58
- * @class (Interface) SchemaService
59
- * @public
60
- */
13
+ * The SchemaService provides the ability to query for information about the structure
14
+ * of any resource type.
15
+ *
16
+ * Applications can provide any implementation of the SchemaService they please so long
17
+ * as it conforms to this interface.
18
+ *
19
+ * The design of the service means that schema information could be lazily populated,
20
+ * derived-on-demand, or progressively enhanced during the course of an application's runtime.
21
+ * The primary requirement is merely that any information the service needs to correctly
22
+ * respond to an inquest is available by the time it is asked.
23
+ *
24
+ * The `@ember-data/model` package provides an implementation of this service which
25
+ * makes use of your model classes as the source of information to respond to queries
26
+ * about resource schema. While this is useful, this may not be ideal for your application.
27
+ * For instance, Schema information could be sideloaded or pre-flighted for API calls,
28
+ * resulting in no need to bundle and ship potentially large and expensive JSON
29
+ * or large Javascript based Models to pull information from.
30
+ *
31
+ * To register a custom schema implementation, implement the store's `createSchemaService`
32
+ * hook to return an instance of your service.
33
+ *
34
+ * ```ts
35
+ * import Store from '@ember-data/store';
36
+ * import CustomSchemas from './custom-schemas';
37
+ *
38
+ * export default class extends Store {
39
+ * createSchemaService() {
40
+ * return new CustomSchemas();
41
+ * }
42
+ * }
43
+ * ```
44
+ *
45
+ * At runtime, both the `Store` and the `CacheCapabilitiesManager` provide
46
+ * access to this service via the `schema` property.
47
+ *
48
+ * ```ts
49
+ * export default class extends Component {
50
+ * @service store;
51
+ *
52
+ * get fields() {
53
+ * return this.store
54
+ * .schema
55
+ * .fields(this.args.dataType);
56
+ * }
57
+ * }
58
+ * ```
59
+ *
60
+ * @class (Interface) SchemaService
61
+ * @public
62
+ */
61
63
  export interface SchemaService {
62
- /**
63
- * DEPRECATED - use `hasResource` instead
64
- *
65
- * Queries whether the SchemaService recognizes `type` as a resource type
66
- *
67
- * @public
68
- * @deprecated
69
- * @param {String} type
70
- * @return {Boolean}
71
- */
72
- doesTypeExist?(type: string): boolean;
73
- /**
74
- * Queries whether the SchemaService recognizes `type` as a resource type
75
- *
76
- * @public
77
- * @param {StableRecordIdentifier|ObjectWithStringTypeProperty} resource
78
- * @return {Boolean}
79
- */
80
- hasResource(resource: ObjectWithStringTypeProperty | StableRecordIdentifier): boolean;
81
- /**
82
- * Queries whether the SchemaService recognizes `type` as a resource trait
83
- *
84
- * @public
85
- * @param {String} type
86
- * @return {Boolean}
87
- */
88
- hasTrait(type: string): boolean;
89
- /**
90
- * Queries whether the given resource has the given trait
91
- *
92
- * @public
93
- * @param {StableRecordIdentifier|ObjectWithStringTypeProperty} resource
94
- * @param {String} trait
95
- * @return {Boolean}
96
- */
97
- resourceHasTrait(resource: ObjectWithStringTypeProperty | StableRecordIdentifier, trait: string): boolean;
98
- /**
99
- * Queries for the fields of a given resource type or resource identity.
100
- *
101
- * Should error if the resource type is not recognized.
102
- *
103
- * @public
104
- * @param {StableRecordIdentifier|ObjectWithStringTypeProperty} resource
105
- * @return {Map<string, FieldSchema>}
106
- */
107
- fields(resource: ObjectWithStringTypeProperty | StableRecordIdentifier): Map<string, FieldSchema>;
108
- /**
109
- * Returns the transformation registered with the name provided
110
- * by `field.type`. Validates that the field is a valid transformable.
111
- *
112
- * @public
113
- * @param {TransformableField|ObjectWithStringTypeProperty} field
114
- * @return {Transformation}
115
- */
116
- transformation(field: GenericField | ObjectField | ArrayField | ObjectWithStringTypeProperty): Transformation;
117
- /**
118
- * Returns the hash function registered with the name provided
119
- * by `field.type`. Validates that the field is a valid HashField.
120
- *
121
- * @public
122
- * @param {HashField|ObjectWithStringTypeProperty} field
123
- * @return {HashFn}
124
- */
125
- hashFn(field: HashField | ObjectWithStringTypeProperty): HashFn;
126
- /**
127
- * Returns the derivation registered with the name provided
128
- * by `field.type`. Validates that the field is a valid DerivedField.
129
- *
130
- * @public
131
- * @param {DerivedField|ObjectWithStringTypeProperty} field
132
- * @return {Derivation}
133
- */
134
- derivation(field: DerivedField | ObjectWithStringTypeProperty): Derivation;
135
- /**
136
- * Returns the schema for the provided resource type.
137
- *
138
- * @public
139
- * @param {StableRecordIdentifier|ObjectWithStringTypeProperty} resource
140
- * @return {ResourceSchema}
141
- */
142
- resource(resource: ObjectWithStringTypeProperty | StableRecordIdentifier): Schema;
143
- /**
144
- * Enables registration of multiple Schemas at once.
145
- *
146
- * This can be useful for either pre-loading schema information
147
- * or for registering schema information delivered by API calls
148
- * or other sources just-in-time.
149
- *
150
- * @public
151
- * @param {Schema[]} schemas
152
- */
153
- registerResources(schemas: Schema[]): void;
154
- /**
155
- * Enables registration of a single Schema representing either
156
- * a resource in PolarisMode or LegacyMode or an ObjectSchema
157
- * representing an embedded structure in other schemas.
158
- *
159
- * This can be useful for either pre-loading schema information
160
- * or for registering schema information delivered by API calls
161
- * or other sources just-in-time.
162
- *
163
- * @public
164
- * @param {Schema} schema
165
- */
166
- registerResource(schema: Schema): void;
167
- /**
168
- * Enables registration of a transformation.
169
- *
170
- * The transformation can later be retrieved by the name
171
- * attached to it's `[Type]` property.
172
- *
173
- * @public
174
- * @param {Transformation} transform
175
- */
176
- registerTransformation(transform: Transformation): void;
177
- /**
178
- * Enables registration of a derivation.
179
- *
180
- * The derivation can later be retrieved by the name
181
- * attached to it's `[Type]` property.
182
- *
183
- * @public
184
- * @param {Derivation} derivation
185
- */
186
- registerDerivation<R, T, FM extends ObjectValue | null>(derivation: Derivation<R, T, FM>): void;
187
- /**
188
- * Enables registration of a hashing function
189
- *
190
- * The hashing function can later be retrieved by the name
191
- * attached to it's `[Type]` property.
192
- *
193
- * @public
194
- * @param {HashFn} hashfn
195
- */
196
- registerHashFn(hashFn: HashFn): void;
197
- /**
198
- * DEPRECATED - use `fields` instead
199
- *
200
- * Returns definitions for all properties of the specified resource
201
- * that are considered "attributes". Generally these are properties
202
- * that are not related to book-keeping state on the client and do
203
- * not represent a linkage to another resource.
204
- *
205
- * The return value should be a dictionary of key:value pairs
206
- * where the `key` is the attribute or property's name and `value`
207
- * is an object with at least the property `name` which should also
208
- * match `key`.
209
- *
210
- * Optionally, this object may also specify `type`, which should
211
- * be a string reference to a `transform`, and `options` which
212
- * should be dictionary in which any key:value pairs are permissable.
213
- *
214
- * For instance, when using `@ember-data/model`, the following attribute
215
- * definition:
216
- *
217
- * ```ts
218
- * class extends Model {
219
- * @attr('string', { defaultValue: 'hello' }) greeting;
220
- * @attr('date') birthday;
221
- * @attr firstName;
222
- * }
223
- * ```
224
- *
225
- * Would be returned as:
226
- *
227
- * ```js
228
- * {
229
- * greeting: { name: 'greeting', type: 'string', options: { defaultValue: 'hello' } },
230
- * birthday: { name: 'birthday', type: 'date' },
231
- * firstName: { name: 'firstName' }
232
- * }
233
- * ```
234
- *
235
- * @public
236
- * @deprecated
237
- * @param {RecordIdentifier|ObjectWithStringTypeProperty} identifier
238
- * @return {AttributesSchema}
239
- */
240
- attributesDefinitionFor?(identifier: RecordIdentifier | ObjectWithStringTypeProperty): AttributesSchema;
241
- /**
242
- * DEPRECATED - use `fields` instead
243
- *
244
- * Returns definitions for all properties of the specified resource
245
- * that are considered "relationships". Generally these are properties
246
- * that represent a linkage to another resource.
247
- *
248
- * The return value should be a dictionary of key:value pairs
249
- * where the `key` is the relationship or property's name and `value`
250
- * is an object with at least the following properties:
251
- *
252
- * - `name` which should also match the `key` used in the dictionary.
253
- * - `kind` which should be either `belongsTo` or `hasMany`
254
- * - `type` which should be the related resource's string "type"
255
- * - `options` which should be a dictionary allowing any key but with
256
- * at least the below keys present.
257
- *
258
- * - `options.async` a boolean representing whether data for this relationship is
259
- * typically loaded on-demand.
260
- * - `options.inverse` a string or null representing the field name / key of the
261
- * corresponding relationship on the inverse resource.
262
- *
263
- * Additionally the following options properties are optional. See [Polymorphic Relationships](https://rfcs.emberjs.com/id/0793-polymporphic-relations-without-inheritance)
264
- *
265
- * - `options.polymorphic` a boolean representing whether multiple resource types
266
- * can be used to satisfy this relationship.
267
- * - `options.as` a string representing the abstract type that the concrete side of
268
- * a relationship must specify when fulfilling a polymorphic inverse.
269
- *
270
- * For example, the following Model using @ember-data/model would generate this relationships
271
- * definition by default:
272
- *
273
- * ```js
274
- * class User extends Model {
275
- * @belongsTo('user', { async: false, inverse: null }) bestFriend;
276
- * @hasMany('user', { async: true, inverse: 'friends' }) friends;
277
- * @hasMany('pet', { async: false, polymorphic: true, inverse: 'owner' }) pets;
278
- * }
279
- * ```
280
- *
281
- * Which would be returned as
282
- *
283
- * ```js
284
- * {
285
- * bestFriend: {
286
- * name: 'bestFriend',
287
- * kind: 'belongsTo',
288
- * type: 'user',
289
- * options: {
290
- * async: false,
291
- * inverse: null
292
- * }
293
- * },
294
- * friends: {
295
- * name: 'friends',
296
- * kind: 'hasMany',
297
- * type: 'user',
298
- * options: {
299
- * async: true,
300
- * inverse: 'friends'
301
- * }
302
- * },
303
- * pets: {
304
- * name: 'pets',
305
- * kind: 'hasMany',
306
- * type: 'pet',
307
- * options: {
308
- * async: false,
309
- * polymorphic: true,
310
- * inverse: 'owner'
311
- * }
312
- * },
313
- * }
314
- * ```
315
- *
316
- * @public
317
- * @deprecated
318
- * @param {RecordIdentifier|ObjectWithStringTypeProperty} identifier
319
- * @return {RelationshipsSchema}
320
- */
321
- relationshipsDefinitionFor?(identifier: RecordIdentifier | ObjectWithStringTypeProperty): RelationshipsSchema;
322
- /**
323
- * Returns all known resource types
324
- *
325
- * @public
326
- * @return {String[]}
327
- */
328
- resourceTypes(): Readonly<string[]>;
64
+ /**
65
+ * DEPRECATED - use `hasResource` instead
66
+ *
67
+ * Queries whether the SchemaService recognizes `type` as a resource type
68
+ *
69
+ * @public
70
+ * @deprecated
71
+ * @param {String} type
72
+ * @return {Boolean}
73
+ */
74
+ doesTypeExist?(type: string): boolean;
75
+ /**
76
+ * Queries whether the SchemaService recognizes `type` as a resource type
77
+ *
78
+ * @public
79
+ * @param {StableRecordIdentifier|ObjectWithStringTypeProperty} resource
80
+ * @return {Boolean}
81
+ */
82
+ hasResource(resource: ObjectWithStringTypeProperty | StableRecordIdentifier): boolean;
83
+ /**
84
+ * Queries whether the SchemaService recognizes `type` as a resource trait
85
+ *
86
+ * @public
87
+ * @param {String} type
88
+ * @return {Boolean}
89
+ */
90
+ hasTrait(type: string): boolean;
91
+ /**
92
+ * Queries whether the given resource has the given trait
93
+ *
94
+ * @public
95
+ * @param {StableRecordIdentifier|ObjectWithStringTypeProperty} resource
96
+ * @param {String} trait
97
+ * @return {Boolean}
98
+ */
99
+ resourceHasTrait(resource: ObjectWithStringTypeProperty | StableRecordIdentifier, trait: string): boolean;
100
+ /**
101
+ * Queries for the fields of a given resource type or resource identity.
102
+ *
103
+ * Should error if the resource type is not recognized.
104
+ *
105
+ * @public
106
+ * @param {StableRecordIdentifier|ObjectWithStringTypeProperty} resource
107
+ * @return {Map<string, FieldSchema>}
108
+ */
109
+ fields(resource: ObjectWithStringTypeProperty | StableRecordIdentifier): Map<string, FieldSchema>;
110
+ /**
111
+ * Returns the transformation registered with the name provided
112
+ * by `field.type`. Validates that the field is a valid transformable.
113
+ *
114
+ * @public
115
+ * @param {TransformableField|ObjectWithStringTypeProperty} field
116
+ * @return {Transformation}
117
+ */
118
+ transformation(field: GenericField | ObjectField | ArrayField | ObjectWithStringTypeProperty): Transformation;
119
+ /**
120
+ * Returns the hash function registered with the name provided
121
+ * by `field.type`. Validates that the field is a valid HashField.
122
+ *
123
+ * @public
124
+ * @param {HashField|ObjectWithStringTypeProperty} field
125
+ * @return {HashFn}
126
+ */
127
+ hashFn(field: HashField | ObjectWithStringTypeProperty): HashFn;
128
+ /**
129
+ * Returns the derivation registered with the name provided
130
+ * by `field.type`. Validates that the field is a valid DerivedField.
131
+ *
132
+ * @public
133
+ * @param {DerivedField|ObjectWithStringTypeProperty} field
134
+ * @return {Derivation}
135
+ */
136
+ derivation(field: DerivedField | ObjectWithStringTypeProperty): Derivation;
137
+ /**
138
+ * Returns the schema for the provided resource type.
139
+ *
140
+ * @public
141
+ * @param {StableRecordIdentifier|ObjectWithStringTypeProperty} resource
142
+ * @return {ResourceSchema}
143
+ */
144
+ resource(resource: ObjectWithStringTypeProperty | StableRecordIdentifier): Schema;
145
+ /**
146
+ * Enables registration of multiple Schemas at once.
147
+ *
148
+ * This can be useful for either pre-loading schema information
149
+ * or for registering schema information delivered by API calls
150
+ * or other sources just-in-time.
151
+ *
152
+ * @public
153
+ * @param {Schema[]} schemas
154
+ */
155
+ registerResources(schemas: Schema[]): void;
156
+ /**
157
+ * Enables registration of a single Schema representing either
158
+ * a resource in PolarisMode or LegacyMode or an ObjectSchema
159
+ * representing an embedded structure in other schemas.
160
+ *
161
+ * This can be useful for either pre-loading schema information
162
+ * or for registering schema information delivered by API calls
163
+ * or other sources just-in-time.
164
+ *
165
+ * @public
166
+ * @param {Schema} schema
167
+ */
168
+ registerResource(schema: Schema): void;
169
+ /**
170
+ * Enables registration of a transformation.
171
+ *
172
+ * The transformation can later be retrieved by the name
173
+ * attached to it's `[Type]` property.
174
+ *
175
+ * @public
176
+ * @param {Transformation} transform
177
+ */
178
+ registerTransformation(transform: Transformation): void;
179
+ /**
180
+ * Enables registration of a derivation.
181
+ *
182
+ * The derivation can later be retrieved by the name
183
+ * attached to it's `[Type]` property.
184
+ *
185
+ * @public
186
+ * @param {Derivation} derivation
187
+ */
188
+ registerDerivation<
189
+ R,
190
+ T,
191
+ FM extends ObjectValue | null
192
+ >(derivation: Derivation<R, T, FM>): void;
193
+ /**
194
+ * Enables registration of a hashing function
195
+ *
196
+ * The hashing function can later be retrieved by the name
197
+ * attached to it's `[Type]` property.
198
+ *
199
+ * @public
200
+ * @param {HashFn} hashfn
201
+ */
202
+ registerHashFn(hashFn: HashFn): void;
203
+ /**
204
+ * DEPRECATED - use `fields` instead
205
+ *
206
+ * Returns definitions for all properties of the specified resource
207
+ * that are considered "attributes". Generally these are properties
208
+ * that are not related to book-keeping state on the client and do
209
+ * not represent a linkage to another resource.
210
+ *
211
+ * The return value should be a dictionary of key:value pairs
212
+ * where the `key` is the attribute or property's name and `value`
213
+ * is an object with at least the property `name` which should also
214
+ * match `key`.
215
+ *
216
+ * Optionally, this object may also specify `type`, which should
217
+ * be a string reference to a `transform`, and `options` which
218
+ * should be dictionary in which any key:value pairs are permissable.
219
+ *
220
+ * For instance, when using `@ember-data/model`, the following attribute
221
+ * definition:
222
+ *
223
+ * ```ts
224
+ * class extends Model {
225
+ * @attr('string', { defaultValue: 'hello' }) greeting;
226
+ * @attr('date') birthday;
227
+ * @attr firstName;
228
+ * }
229
+ * ```
230
+ *
231
+ * Would be returned as:
232
+ *
233
+ * ```js
234
+ * {
235
+ * greeting: { name: 'greeting', type: 'string', options: { defaultValue: 'hello' } },
236
+ * birthday: { name: 'birthday', type: 'date' },
237
+ * firstName: { name: 'firstName' }
238
+ * }
239
+ * ```
240
+ *
241
+ * @public
242
+ * @deprecated
243
+ * @param {RecordIdentifier|ObjectWithStringTypeProperty} identifier
244
+ * @return {AttributesSchema}
245
+ */
246
+ attributesDefinitionFor?(identifier: RecordIdentifier | ObjectWithStringTypeProperty): AttributesSchema;
247
+ /**
248
+ * DEPRECATED - use `fields` instead
249
+ *
250
+ * Returns definitions for all properties of the specified resource
251
+ * that are considered "relationships". Generally these are properties
252
+ * that represent a linkage to another resource.
253
+ *
254
+ * The return value should be a dictionary of key:value pairs
255
+ * where the `key` is the relationship or property's name and `value`
256
+ * is an object with at least the following properties:
257
+ *
258
+ * - `name` which should also match the `key` used in the dictionary.
259
+ * - `kind` which should be either `belongsTo` or `hasMany`
260
+ * - `type` which should be the related resource's string "type"
261
+ * - `options` which should be a dictionary allowing any key but with
262
+ * at least the below keys present.
263
+ *
264
+ * - `options.async` a boolean representing whether data for this relationship is
265
+ * typically loaded on-demand.
266
+ * - `options.inverse` a string or null representing the field name / key of the
267
+ * corresponding relationship on the inverse resource.
268
+ *
269
+ * Additionally the following options properties are optional. See [Polymorphic Relationships](https://rfcs.emberjs.com/id/0793-polymporphic-relations-without-inheritance)
270
+ *
271
+ * - `options.polymorphic` a boolean representing whether multiple resource types
272
+ * can be used to satisfy this relationship.
273
+ * - `options.as` a string representing the abstract type that the concrete side of
274
+ * a relationship must specify when fulfilling a polymorphic inverse.
275
+ *
276
+ * For example, the following Model using @ember-data/model would generate this relationships
277
+ * definition by default:
278
+ *
279
+ * ```js
280
+ * class User extends Model {
281
+ * @belongsTo('user', { async: false, inverse: null }) bestFriend;
282
+ * @hasMany('user', { async: true, inverse: 'friends' }) friends;
283
+ * @hasMany('pet', { async: false, polymorphic: true, inverse: 'owner' }) pets;
284
+ * }
285
+ * ```
286
+ *
287
+ * Which would be returned as
288
+ *
289
+ * ```js
290
+ * {
291
+ * bestFriend: {
292
+ * name: 'bestFriend',
293
+ * kind: 'belongsTo',
294
+ * type: 'user',
295
+ * options: {
296
+ * async: false,
297
+ * inverse: null
298
+ * }
299
+ * },
300
+ * friends: {
301
+ * name: 'friends',
302
+ * kind: 'hasMany',
303
+ * type: 'user',
304
+ * options: {
305
+ * async: true,
306
+ * inverse: 'friends'
307
+ * }
308
+ * },
309
+ * pets: {
310
+ * name: 'pets',
311
+ * kind: 'hasMany',
312
+ * type: 'pet',
313
+ * options: {
314
+ * async: false,
315
+ * polymorphic: true,
316
+ * inverse: 'owner'
317
+ * }
318
+ * },
319
+ * }
320
+ * ```
321
+ *
322
+ * @public
323
+ * @deprecated
324
+ * @param {RecordIdentifier|ObjectWithStringTypeProperty} identifier
325
+ * @return {RelationshipsSchema}
326
+ */
327
+ relationshipsDefinitionFor?(identifier: RecordIdentifier | ObjectWithStringTypeProperty): RelationshipsSchema;
328
+ /**
329
+ * Returns all known resource types
330
+ *
331
+ * @public
332
+ * @return {String[]}
333
+ */
334
+ resourceTypes(): Readonly<string[]>;
335
+ /**
336
+ * Register an extension for either objects or arrays
337
+ */
338
+ CAUTION_MEGA_DANGER_ZONE_registerExtension?(extension: CAUTION_MEGA_DANGER_ZONE_Extension): void;
339
+ /**
340
+ * Retrieve the extension map for a resource
341
+ */
342
+ CAUTION_MEGA_DANGER_ZONE_resourceExtensions?(resource: StableRecordIdentifier | {
343
+ type: string;
344
+ }): null | ProcessedExtension["features"];
345
+ /**
346
+ * Retrieve the extension map for an object field
347
+ */
348
+ CAUTION_MEGA_DANGER_ZONE_objectExtensions?(field: ExtensibleField): null | ProcessedExtension["features"];
349
+ /**
350
+ * Retrieve the extension map for an array field
351
+ */
352
+ CAUTION_MEGA_DANGER_ZONE_arrayExtensions?(field: ExtensibleField): null | ProcessedExtension["features"];
329
353
  }
330
354
  export {};
331
- //# sourceMappingURL=schema-service.d.ts.map