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

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 (219) hide show
  1. package/README.md +7 -8
  2. package/declarations/index.d.ts +3 -14
  3. package/declarations/index.d.ts.map +1 -0
  4. package/declarations/request/-private/context.d.ts +35 -34
  5. package/declarations/request/-private/context.d.ts.map +1 -0
  6. package/declarations/request/-private/debug.d.ts +3 -2
  7. package/declarations/request/-private/debug.d.ts.map +1 -0
  8. package/declarations/request/-private/fetch.d.ts +36 -24
  9. package/declarations/request/-private/fetch.d.ts.map +1 -0
  10. package/declarations/request/-private/future.d.ts +4 -3
  11. package/declarations/request/-private/future.d.ts.map +1 -0
  12. package/declarations/request/-private/manager.d.ts +132 -159
  13. package/declarations/request/-private/manager.d.ts.map +1 -0
  14. package/declarations/request/-private/promise-cache.d.ts +13 -21
  15. package/declarations/request/-private/promise-cache.d.ts.map +1 -0
  16. package/declarations/request/-private/types.d.ts +123 -124
  17. package/declarations/request/-private/types.d.ts.map +1 -0
  18. package/declarations/request/-private/utils.d.ts +9 -8
  19. package/declarations/request/-private/utils.d.ts.map +1 -0
  20. package/declarations/request.d.ts +433 -5
  21. package/declarations/request.d.ts.map +1 -0
  22. package/declarations/types/-private.d.ts +8 -16
  23. package/declarations/types/-private.d.ts.map +1 -0
  24. package/declarations/types/cache/aliases.d.ts +1 -11
  25. package/declarations/types/cache/aliases.d.ts.map +1 -0
  26. package/declarations/types/cache/change.d.ts +5 -4
  27. package/declarations/types/cache/change.d.ts.map +1 -0
  28. package/declarations/types/cache/mutations.d.ts +28 -51
  29. package/declarations/types/cache/mutations.d.ts.map +1 -0
  30. package/declarations/types/cache/operations.d.ts +47 -60
  31. package/declarations/types/cache/operations.d.ts.map +1 -0
  32. package/declarations/types/cache/relationship.d.ts +9 -11
  33. package/declarations/types/cache/relationship.d.ts.map +1 -0
  34. package/declarations/types/cache.d.ts +484 -495
  35. package/declarations/types/cache.d.ts.map +1 -0
  36. package/declarations/types/graph.d.ts +40 -31
  37. package/declarations/types/graph.d.ts.map +1 -0
  38. package/declarations/types/identifier.d.ts +82 -83
  39. package/declarations/types/identifier.d.ts.map +1 -0
  40. package/declarations/types/json/raw.d.ts +2 -1
  41. package/declarations/types/json/raw.d.ts.map +1 -0
  42. package/declarations/types/params.d.ts +5 -4
  43. package/declarations/types/params.d.ts.map +1 -0
  44. package/declarations/types/record.d.ts +76 -117
  45. package/declarations/types/record.d.ts.map +1 -0
  46. package/declarations/types/record.type-test.d.ts +2 -0
  47. package/declarations/types/record.type-test.d.ts.map +1 -0
  48. package/declarations/types/request.d.ts +266 -289
  49. package/declarations/types/request.d.ts.map +1 -0
  50. package/declarations/types/request.type-test.d.ts +2 -0
  51. package/declarations/types/request.type-test.d.ts.map +1 -0
  52. package/declarations/types/runtime.d.ts +9 -8
  53. package/declarations/types/runtime.d.ts.map +1 -0
  54. package/declarations/types/schema/concepts.d.ts +13 -19
  55. package/declarations/types/schema/concepts.d.ts.map +1 -0
  56. package/declarations/types/schema/fields.d.ts +1741 -1712
  57. package/declarations/types/schema/fields.d.ts.map +1 -0
  58. package/declarations/types/schema/fields.type-test.d.ts +1 -0
  59. package/declarations/types/schema/fields.type-test.d.ts.map +1 -0
  60. package/declarations/types/spec/document.d.ts +22 -28
  61. package/declarations/types/spec/document.d.ts.map +1 -0
  62. package/declarations/types/spec/error.d.ts +17 -16
  63. package/declarations/types/spec/error.d.ts.map +1 -0
  64. package/declarations/types/spec/json-api-raw.d.ts +102 -102
  65. package/declarations/types/spec/json-api-raw.d.ts.map +1 -0
  66. package/declarations/types/symbols.d.ts +75 -74
  67. package/declarations/types/symbols.d.ts.map +1 -0
  68. package/declarations/types/utils.d.ts +5 -5
  69. package/declarations/types/utils.d.ts.map +1 -0
  70. package/declarations/types.d.ts +7 -10
  71. package/declarations/types.d.ts.map +1 -0
  72. package/dist/{context-COmAnXUQ.js → context-DE5sFezZ.js} +2 -2
  73. package/dist/context-DE5sFezZ.js.map +1 -0
  74. package/dist/index.js +104 -37
  75. package/dist/index.js.map +1 -0
  76. package/dist/request.js +1 -1
  77. package/dist/request.js.map +1 -0
  78. package/dist/types/-private.js +3 -3
  79. package/dist/types/-private.js.map +1 -0
  80. package/dist/types/cache/aliases.js.map +1 -0
  81. package/dist/types/cache/change.js.map +1 -0
  82. package/dist/types/cache/mutations.js.map +1 -0
  83. package/dist/types/cache/operations.js.map +1 -0
  84. package/dist/types/cache/relationship.js.map +1 -0
  85. package/dist/types/cache.js.map +1 -0
  86. package/dist/types/graph.js.map +1 -0
  87. package/dist/types/identifier.js.map +1 -0
  88. package/dist/types/json/raw.js.map +1 -0
  89. package/dist/types/params.js.map +1 -0
  90. package/dist/types/record.js +1 -1
  91. package/dist/types/record.js.map +1 -0
  92. package/dist/types/request.js +2 -2
  93. package/dist/types/request.js.map +1 -0
  94. package/dist/types/runtime.js +1 -1
  95. package/dist/types/runtime.js.map +1 -0
  96. package/dist/types/schema/concepts.js.map +1 -0
  97. package/dist/types/schema/fields.js +41 -8
  98. package/dist/types/schema/fields.js.map +1 -0
  99. package/dist/types/schema/fields.type-test.js.map +1 -0
  100. package/dist/types/spec/document.js.map +1 -0
  101. package/dist/types/spec/error.js.map +1 -0
  102. package/dist/types/spec/json-api-raw.js.map +1 -0
  103. package/dist/types/symbols.js +3 -3
  104. package/dist/types/symbols.js.map +1 -0
  105. package/dist/types/utils.js.map +1 -0
  106. package/dist/types.js.map +1 -0
  107. package/package.json +8 -11
  108. package/cjs-dist/addon-shim.cjs +0 -1
  109. package/cjs-dist/cjs-set-config.cjs +0 -1
  110. package/declarations/build-config/babel-macros.d.ts +0 -1
  111. package/declarations/build-config/canary-features.d.ts +0 -1
  112. package/declarations/build-config/debugging.d.ts +0 -1
  113. package/declarations/build-config/deprecations.d.ts +0 -1
  114. package/declarations/build-config/env.d.ts +0 -1
  115. package/declarations/build-config/macros.d.ts +0 -1
  116. package/declarations/build-config.d.ts +0 -1
  117. package/declarations/configure.d.ts +0 -7
  118. package/declarations/graph/-private/-diff.d.ts +0 -32
  119. package/declarations/graph/-private/-edge-definition.d.ts +0 -148
  120. package/declarations/graph/-private/-state.d.ts +0 -96
  121. package/declarations/graph/-private/-utils.d.ts +0 -31
  122. package/declarations/graph/-private/coerce-id.d.ts +0 -10
  123. package/declarations/graph/-private/debug/assert-polymorphic-type.d.ts +0 -18
  124. package/declarations/graph/-private/edges/collection.d.ts +0 -39
  125. package/declarations/graph/-private/edges/implicit.d.ts +0 -43
  126. package/declarations/graph/-private/edges/resource.d.ts +0 -24
  127. package/declarations/graph/-private/graph.d.ts +0 -90
  128. package/declarations/graph/-private/normalize-link.d.ts +0 -8
  129. package/declarations/graph/-private/operations/add-to-related-records.d.ts +0 -4
  130. package/declarations/graph/-private/operations/merge-identifier.d.ts +0 -3
  131. package/declarations/graph/-private/operations/remove-from-related-records.d.ts +0 -4
  132. package/declarations/graph/-private/operations/replace-related-record.d.ts +0 -3
  133. package/declarations/graph/-private/operations/replace-related-records.d.ts +0 -62
  134. package/declarations/graph/-private/operations/update-relationship.d.ts +0 -13
  135. package/declarations/graph/-private.d.ts +0 -13
  136. package/declarations/reactive/-private/document.d.ts +0 -146
  137. package/declarations/reactive/-private/fields/compute.d.ts +0 -43
  138. package/declarations/reactive/-private/fields/extension.d.ts +0 -8
  139. package/declarations/reactive/-private/fields/managed-array.d.ts +0 -22
  140. package/declarations/reactive/-private/fields/managed-object.d.ts +0 -21
  141. package/declarations/reactive/-private/fields/many-array-manager.d.ts +0 -19
  142. package/declarations/reactive/-private/hooks.d.ts +0 -5
  143. package/declarations/reactive/-private/record.d.ts +0 -64
  144. package/declarations/reactive/-private/schema.d.ts +0 -271
  145. package/declarations/reactive/-private/symbols.d.ts +0 -36
  146. package/declarations/reactive/-private.d.ts +0 -1
  147. package/declarations/reactive.d.ts +0 -4
  148. package/declarations/store/-private/cache-handler/handler.d.ts +0 -62
  149. package/declarations/store/-private/cache-handler/types.d.ts +0 -98
  150. package/declarations/store/-private/cache-handler/utils.d.ts +0 -32
  151. package/declarations/store/-private/caches/cache-utils.d.ts +0 -12
  152. package/declarations/store/-private/caches/identifier-cache.d.ts +0 -304
  153. package/declarations/store/-private/caches/instance-cache.d.ts +0 -65
  154. package/declarations/store/-private/caches/resource-utils.d.ts +0 -9
  155. package/declarations/store/-private/debug/utils.d.ts +0 -6
  156. package/declarations/store/-private/default-cache-policy.d.ts +0 -384
  157. package/declarations/store/-private/legacy-model-support/record-reference.d.ts +0 -159
  158. package/declarations/store/-private/legacy-model-support/shim-model-class.d.ts +0 -17
  159. package/declarations/store/-private/managers/cache-capabilities-manager.d.ts +0 -25
  160. package/declarations/store/-private/managers/cache-manager.d.ts +0 -443
  161. package/declarations/store/-private/managers/notification-manager.d.ts +0 -98
  162. package/declarations/store/-private/managers/record-array-manager.d.ts +0 -97
  163. package/declarations/store/-private/network/request-cache.d.ts +0 -107
  164. package/declarations/store/-private/new-core-tmp/promise-state.d.ts +0 -263
  165. package/declarations/store/-private/new-core-tmp/reactivity/configure.d.ts +0 -176
  166. package/declarations/store/-private/new-core-tmp/reactivity/internal.d.ts +0 -169
  167. package/declarations/store/-private/new-core-tmp/reactivity/signal.d.ts +0 -35
  168. package/declarations/store/-private/new-core-tmp/request-state.d.ts +0 -277
  169. package/declarations/store/-private/new-core-tmp/request-subscription.d.ts +0 -261
  170. package/declarations/store/-private/record-arrays/identifier-array.d.ts +0 -147
  171. package/declarations/store/-private/record-arrays/many-array.d.ts +0 -197
  172. package/declarations/store/-private/record-arrays/native-proxy-type-fix.d.ts +0 -126
  173. package/declarations/store/-private/store-service.d.ts +0 -1605
  174. package/declarations/store/-private/utils/coerce-id.d.ts +0 -10
  175. package/declarations/store/-private/utils/construct-resource.d.ts +0 -6
  176. package/declarations/store/-private/utils/is-non-empty-string.d.ts +0 -1
  177. package/declarations/store/-private/utils/normalize-model-name.d.ts +0 -1
  178. package/declarations/store/-private/utils/uuid-polyfill.d.ts +0 -1
  179. package/declarations/store/-private.d.ts +0 -31
  180. package/declarations/store/-types/q/cache-capabilities-manager.d.ts +0 -99
  181. package/declarations/store/-types/q/ds-model.d.ts +0 -21
  182. package/declarations/store/-types/q/identifier.d.ts +0 -20
  183. package/declarations/store/-types/q/record-instance.d.ts +0 -23
  184. package/declarations/store/-types/q/schema-service.d.ts +0 -354
  185. package/declarations/store/-types/q/store.d.ts +0 -32
  186. package/declarations/store.d.ts +0 -1
  187. package/declarations/utils/string.d.ts +0 -48
  188. package/dist/build-config/babel-macros.js +0 -1
  189. package/dist/build-config/canary-features.js +0 -1
  190. package/dist/build-config/debugging.js +0 -1
  191. package/dist/build-config/deprecations.js +0 -1
  192. package/dist/build-config/env.js +0 -1
  193. package/dist/build-config/macros.js +0 -1
  194. package/dist/build-config.js +0 -1
  195. package/dist/configure-B48bFHOl.js +0 -181
  196. package/dist/configure.js +0 -1
  197. package/dist/graph/-private.js +0 -3372
  198. package/dist/handler-C2T-IyJK.js +0 -339
  199. package/dist/reactive/-private.js +0 -1
  200. package/dist/reactive.js +0 -1988
  201. package/dist/request-state-CjLph1LP.js +0 -8139
  202. package/dist/store/-private.js +0 -3
  203. package/dist/store.js +0 -545
  204. package/dist/symbols-SIstXMLI.js +0 -44
  205. package/dist/utils/string.js +0 -92
  206. package/logos/NCC-1701-a-blue.svg +0 -4
  207. package/logos/NCC-1701-a-gold.svg +0 -4
  208. package/logos/NCC-1701-a-gold_100.svg +0 -1
  209. package/logos/NCC-1701-a-gold_base-64.txt +0 -1
  210. package/logos/NCC-1701-a.svg +0 -4
  211. package/logos/README.md +0 -4
  212. package/logos/docs-badge.svg +0 -2
  213. package/logos/ember-data-logo-dark.svg +0 -12
  214. package/logos/ember-data-logo-light.svg +0 -12
  215. package/logos/github-header.svg +0 -444
  216. package/logos/social1.png +0 -0
  217. package/logos/social2.png +0 -0
  218. package/logos/warp-drive-logo-dark.svg +0 -4
  219. package/logos/warp-drive-logo-gold.svg +0 -4
@@ -1,10 +0,0 @@
1
- // Used by the store to normalize IDs entering the store. Despite the fact
2
- // that developers may provide IDs as numbers (e.g., `store.findRecord('person', 1)`),
3
- // it is important that internally we use strings, since IDs may be serialized
4
- // and lose type information. For example, Ember's router may put a record's
5
- // ID into the URL, and if we later try to deserialize that URL and find the
6
- // corresponding record, we will not know if it is a string or a number.
7
- type Coercable = string | number | boolean | null | undefined | symbol;
8
- export declare function coerceId(id: unknown): string | null;
9
- export declare function ensureStringId(id: Coercable): string;
10
- export {};
@@ -1,6 +0,0 @@
1
- import type { ExistingResourceIdentifierObject, ResourceIdentifierObject } from "../../../types/spec/json-api-raw.js";
2
- export declare function constructResource(type: ResourceIdentifierObject): ResourceIdentifierObject;
3
- export declare function constructResource(type: string, id: string, lid: string): ExistingResourceIdentifierObject;
4
- export declare function constructResource(type: string | undefined, id: null | undefined, lid: string): ExistingResourceIdentifierObject;
5
- export declare function constructResource(type: string, id: string, lid?: string | null): ExistingResourceIdentifierObject;
6
- export declare function constructResource(type: string, id?: string | number | null, lid?: string | null): ResourceIdentifierObject;
@@ -1 +0,0 @@
1
- export declare function isNonEmptyString(str: unknown): str is string;
@@ -1 +0,0 @@
1
- export declare function normalizeModelName(type: string): string;
@@ -1 +0,0 @@
1
- export default function installPolyfill(): void;
@@ -1,31 +0,0 @@
1
- export { Store, storeFor } from "./-private/store-service.js";
2
- export { recordIdentifierFor } from "./-private/caches/instance-cache.js";
3
- export { CacheHandler, type StoreRequestContext } from "./-private/cache-handler/handler.js";
4
- export { type CachePolicy } from "./-private/cache-handler/types.js";
5
- export { isStableIdentifier, isDocumentIdentifier } from "./-private/caches/identifier-cache.js";
6
- export { constructResource } from "./-private/utils/construct-resource.js";
7
- export type { InstanceCache } from "./-private/caches/instance-cache.js";
8
- export type { FindRecordQuery, Request, SaveRecordMutation, RequestCacheRequestState, RequestStateService } from "./-private/network/request-cache.js";
9
- export type { CreateRecordProperties } from "./-private/store-service.js";
10
- // TODO this should be a deprecated helper but we have so much usage of it
11
- // to also eliminate
12
- export { coerceId, ensureStringId } from "./-private/utils/coerce-id.js";
13
- export type { NativeProxy } from "./-private/record-arrays/native-proxy-type-fix.js";
14
- export { IdentifierArray as LiveArray, Collection as CollectionRecordArray, SOURCE, MUTATE } from "./-private/record-arrays/identifier-array.js";
15
- export { RecordArrayManager, fastPush } from "./-private/managers/record-array-manager.js";
16
- // leaked for private use / test use, should investigate removing
17
- export { _clearCaches } from "./-private/caches/instance-cache.js";
18
- export { peekCache, removeRecordDataFor } from "./-private/caches/cache-utils.js";
19
- // @ember-data/model needs these temporarily
20
- export { setRecordIdentifier, StoreMap } from "./-private/caches/instance-cache.js";
21
- export { setCacheFor } from "./-private/caches/cache-utils.js";
22
- export { normalizeModelName as _deprecatingNormalize } from "./-private/utils/normalize-model-name.js";
23
- export type { StoreRequestInput } from "./-private/cache-handler/handler.js";
24
- export { RelatedCollection } from "./-private/record-arrays/many-array.js";
25
- export { log, logGroup } from "./-private/debug/utils.js";
26
- export { getPromiseState, type PromiseState } from "./-private/new-core-tmp/promise-state.js";
27
- export { DISPOSE, createRequestSubscription, type SubscriptionArgs, type RequestSubscription } from "./-private/new-core-tmp/request-subscription.js";
28
- export { getRequestState, type RequestLoadingState, type RequestCacheRequestState as RequestState } from "./-private/new-core-tmp/request-state.js";
29
- export { createMemo, type SignalHooks, waitFor } from "./-private/new-core-tmp/reactivity/configure.js";
30
- export { memoized, gate, entangleSignal, defineSignal, defineNonEnumerableSignal } from "./-private/new-core-tmp/reactivity/signal.js";
31
- export { ARRAY_SIGNAL, OBJECT_SIGNAL, Signals, type WarpDriveSignal, peekInternalSignal, withSignalStore, notifyInternalSignal, consumeInternalSignal, getOrCreateInternalSignal } from "./-private/new-core-tmp/reactivity/internal.js";
@@ -1,99 +0,0 @@
1
- import type { StableDocumentIdentifier, StableRecordIdentifier } from "../../../types/identifier.js";
2
- import type { IdentifierCache } from "../../-private/caches/identifier-cache.js";
3
- import type { NotificationType } from "../../-private/managers/notification-manager.js";
4
- import type { SchemaService } from "./schema-service.js";
5
- /**
6
- * CacheCapabilitiesManager provides encapsulated API access to the minimal
7
- * subset of the Store's functionality that Cache implementations
8
- * should interact with. It is provided to the Store's `createCache` hook.
9
- *
10
- * Cache implementations should not need more than this API provides.
11
- *
12
- * This class cannot be directly instantiated.
13
- *
14
- * @class CacheCapabilitiesManager
15
- * @public
16
- */
17
- export type CacheCapabilitiesManager = {
18
- /**
19
- * Provides access to the IdentifierCache instance
20
- * for this Store instance.
21
- *
22
- * The IdentifierCache can be used to peek, generate or
23
- * retrieve a stable unique identifier for any resource.
24
- *
25
- * @property identifierCache
26
- * @type {IdentifierCache}
27
- * @public
28
- */
29
- identifierCache: IdentifierCache;
30
- /**
31
- * DEPRECATED - use the schema property
32
- *
33
- * Provides access to the SchemaService instance
34
- * for this Store instance.
35
- *
36
- * The SchemaService can be used to query for
37
- * information about the schema of a resource.
38
- *
39
- * @deprecated
40
- * @public
41
- */
42
- getSchemaDefinitionService(): SchemaService;
43
- /**
44
- * Provides access to the SchemaService instance
45
- * for this Store instance.
46
- *
47
- * The SchemaService can be used to query for
48
- * information about the schema of a resource.
49
- *
50
- * @property schema
51
- * @public
52
- */
53
- schema: SchemaService;
54
- /**
55
- * Update the `id` for the record corresponding to the identifier
56
- * This operation can only be done for records whose `id` is `null`.
57
- *
58
- * @param {StableRecordIdentifier} identifier;
59
- * @param {String} id;
60
- * @public
61
- */
62
- setRecordId(identifier: StableRecordIdentifier, id: string): void;
63
- /**
64
- * Signal to the store that the specified record may be considered fully
65
- * removed from the cache. Generally this means that not only does no
66
- * data exist for the identified resource, no known relationships still
67
- * point to it either.
68
- *
69
- * @param {StableRecordIdentifier} identifier
70
- * @public
71
- */
72
- disconnectRecord(identifier: StableRecordIdentifier): void;
73
- /**
74
- * Use this method to determine if the Store has an instantiated record associated
75
- * with an identifier.
76
- *
77
- * @param identifier
78
- * @return {Boolean}
79
- * @public
80
- */
81
- hasRecord(identifier: StableRecordIdentifier): boolean;
82
- /**
83
- * Notify subscribers of the NotificationManager that cache state has changed.
84
- *
85
- * `attributes` and `relationships` do not require a key, but if one is specified it
86
- * is assumed to be the name of the attribute or relationship that has been updated.
87
- *
88
- * No other namespaces currently expect the `key` argument.
89
- *
90
- * @param {StableRecordIdentifier} identifier
91
- * @param {'attributes' | 'relationships' | 'identity' | 'errors' | 'meta' | 'state'} namespace
92
- * @param {string|undefined} key
93
- * @public
94
- */
95
- notifyChange(identifier: StableRecordIdentifier, namespace: "added" | "removed", key: null): void;
96
- notifyChange(identifier: StableDocumentIdentifier, namespace: "added" | "updated" | "removed", key: null): void;
97
- notifyChange(identifier: StableRecordIdentifier, namespace: NotificationType, key: string | null): void;
98
- notifyChange(identifier: StableRecordIdentifier | StableDocumentIdentifier, namespace: NotificationType | "added" | "removed" | "updated", key: string | null): void;
99
- };
@@ -1,21 +0,0 @@
1
- import type { TypedRecordInstance, TypeFromInstance } from "../../../types/record.js";
2
- import type { LegacyAttributeField, LegacyRelationshipField } from "../../../types/schema/fields.js";
3
- export type KeyOrString<T> = keyof T & string extends never ? string : keyof T & string;
4
- /**
5
- * Minimum subset of static schema methods and properties on the
6
- * "model" class.
7
- *
8
- * Only used when using the legacy schema-service implementation
9
- * for @ember-data/model or when wrapping schema for legacy
10
- * Adapters/Serializers.
11
- *
12
- */
13
- export interface ModelSchema<T = unknown> {
14
- modelName: T extends TypedRecordInstance ? TypeFromInstance<T> : string;
15
- fields: Map<KeyOrString<T>, "attribute" | "belongsTo" | "hasMany">;
16
- attributes: Map<KeyOrString<T>, LegacyAttributeField>;
17
- relationshipsByName: Map<KeyOrString<T>, LegacyRelationshipField>;
18
- eachAttribute<K extends KeyOrString<T>>(callback: (this: ModelSchema<T>, key: K, attribute: LegacyAttributeField) => void, binding?: T): void;
19
- eachRelationship<K extends KeyOrString<T>>(callback: (this: ModelSchema<T>, key: K, relationship: LegacyRelationshipField) => void, binding?: T): void;
20
- eachTransformedAttribute<K extends KeyOrString<T>>(callback: (this: ModelSchema<T>, key: K, type: string | null) => void, binding?: T): void;
21
- }
@@ -1,20 +0,0 @@
1
- import type { IdentifierBucket, StableIdentifier, StableRecordIdentifier } from "../../../types/identifier.js";
2
- import type { ImmutableRequestInfo } from "../../../types/request.js";
3
- export interface GenerationMethod {
4
- (data: ImmutableRequestInfo, bucket: "document"): string | null;
5
- (data: unknown | {
6
- type: string;
7
- }, bucket: "record"): string;
8
- (data: unknown, bucket: IdentifierBucket): string | null;
9
- }
10
- export type UpdateMethod = {
11
- (identifier: StableRecordIdentifier, newData: unknown, bucket: "record"): void;
12
- (identifier: StableIdentifier, newData: unknown, bucket: never): void;
13
- };
14
- export type ForgetMethod = (identifier: StableIdentifier | StableRecordIdentifier, bucket: IdentifierBucket) => void;
15
- export type ResetMethod = () => void;
16
- export type KeyInfo = {
17
- id: string | null;
18
- type: string;
19
- };
20
- export type KeyInfoMethod = (resource: unknown, known: StableRecordIdentifier | null) => KeyInfo;
@@ -1,23 +0,0 @@
1
- /**
2
- In WarpDrive, a "record instance" is a class instance used to present the data
3
- for a single resource, transforming the resource's cached raw data into a form
4
- that is useful for the application.
5
-
6
- Since every application's needs are different, WarpDrive does not assume to know
7
- what the shape of the record instance should be. Instead, it provides a way to
8
- define the record instance's via the `instantiateRecord` hook on the store.
9
-
10
- Thus for most purposes the `RecordInstance` type is "opaque" to WarpDrive, and
11
- should be treated as "unknown" by the library.
12
-
13
- Wherever possible, if typing an API that is consumer facing, instead of using
14
- OpaqueRecordInstance, we should prefer to use a generic and check if the generic
15
- extends `TypedRecordInstance`. This allows consumers to define their own record
16
- instance types and not only have their types flow through WarpDrive APIs, but
17
- also allows WarpDrive to provide typechecking and intellisense for the record
18
- based on a special symbol prsent on record instances that implement the
19
- `TypedRecordInstance` interface.
20
-
21
- @internal
22
- */
23
- export type OpaqueRecordInstance = unknown;
@@ -1,354 +0,0 @@
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";
7
- export type AttributesSchema = Record<string, LegacyAttributeField>;
8
- export type RelationshipsSchema = Record<string, LegacyRelationshipField>;
9
- interface ObjectWithStringTypeProperty {
10
- type: string;
11
- }
12
- /**
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
- */
63
- export interface SchemaService {
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"];
353
- }
354
- export {};
@@ -1,32 +0,0 @@
1
- import type { Value } from "../../../types/json/raw.js";
2
- import type { Includes, TypedRecordInstance } from "../../../types/record.js";
3
- export interface BaseFinderOptions<T = unknown> {
4
- reload?: boolean;
5
- backgroundReload?: boolean;
6
- include?: T extends TypedRecordInstance ? Includes<T>[] : string | string[];
7
- adapterOptions?: Record<string, unknown>;
8
- }
9
- export interface FindRecordOptions<T = unknown> extends BaseFinderOptions<T> {
10
- /**
11
- * Data to preload into the store before the request is made.
12
- * This feature is *highly* discouraged and has no corresponding
13
- * feature when using builders and handlers.
14
- *
15
- * Excepting relationships: the data should be in the form of a
16
- * JSON object where the keys are fields on the record and the value
17
- * is the raw value to be added to the cache.
18
- *
19
- * Relationships can either be provided as string IDs from which
20
- * an identifier will be built base upon the relationship's expected
21
- * resource type, or be record instances from which the identifier
22
- * will be extracted.
23
- *
24
- */
25
- preload?: Record<string, Value>;
26
- }
27
- export type QueryOptions = { [K in string | "adapterOptions"]? : K extends "adapterOptions" ? Record<string, unknown> : unknown };
28
- export type FindAllOptions<T = unknown> = BaseFinderOptions<T>;
29
- export type LegacyResourceQuery<T = unknown> = {
30
- include?: T extends TypedRecordInstance ? Includes<T>[] : string | string[];
31
- [key: string]: Value | undefined;
32
- };
@@ -1 +0,0 @@
1
- export { DefaultCachePolicy, type PolicyConfig, type CacheControlValue, parseCacheControl } from "./store/-private/default-cache-policy.js";
@@ -1,48 +0,0 @@
1
- /**
2
- * An LRUCache implementation with upsert semantics.
3
- *
4
- * This implementation is *not* generic, but focuses on
5
- * performance tuning for the string transformation cases
6
- * where the key maps to the value very simply.
7
- *
8
- * It takes a work function that should generate a new value
9
- * for a given key when called. It will be called when the key
10
- * is not found in the cache.
11
- *
12
- * It keeps track of the number of hits, misses, and ejections
13
- * in DEBUG envs, which is useful for tuning the cache size.
14
- *
15
- * This is an internal utility class for use by this module
16
- * and by `@warp-drive/utilities/string`. It is not intended
17
- * for use outside of these modules at this time.
18
- *
19
- * @internal
20
- */
21
- export declare class LRUCache<
22
- T,
23
- V
24
- > {
25
- size: number;
26
- state: Map<T, V>;
27
- doWork: (k: T) => V;
28
- // debug stats
29
- _hits: number;
30
- _misses: number;
31
- _ejected: number;
32
- constructor(doWork: (k: T) => V, size?: number);
33
- get(key: T): V;
34
- set(key: T, value: V): void;
35
- clear(): void;
36
- }
37
- export declare const STRING_DASHERIZE_CACHE: LRUCache<string, string>;
38
- /**
39
- * This is an internal utility function that converts a string
40
- * to a dasherized format. Library consumers should use the
41
- * re-exported version from `@warp-drive/utilities/string` instead.
42
- *
43
- * This version is only in this location to support a deprecated
44
- * behavior in the core package and will be removed in a future.
45
- *
46
- * @internal
47
- */
48
- export declare function dasherize(str: string): string;
@@ -1 +0,0 @@
1
- export { macros } from '@warp-drive/build-config/babel-macros';
@@ -1 +0,0 @@
1
- export * from '@warp-drive/build-config/canary-features';
@@ -1 +0,0 @@
1
- export * from '@warp-drive/build-config/debugging';