@warp-drive/core 5.7.0-alpha.38 → 5.7.0-alpha.39

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 (41) hide show
  1. package/declarations/graph/-private/-state.d.ts +0 -87
  2. package/declarations/graph/-private/-utils.d.ts +0 -6
  3. package/declarations/graph/-private/coerce-id.d.ts +0 -6
  4. package/declarations/graph/-private/debug/assert-polymorphic-type.d.ts +0 -12
  5. package/declarations/graph/-private/graph.d.ts +0 -36
  6. package/declarations/graph/-private/normalize-link.d.ts +0 -6
  7. package/declarations/graph/-private/operations/replace-related-records.d.ts +0 -55
  8. package/declarations/graph/-private/operations/update-relationship.d.ts +0 -4
  9. package/declarations/reactive/-private/fields/managed-array.d.ts +0 -1
  10. package/declarations/reactive/-private/fields/managed-object.d.ts +0 -2
  11. package/declarations/reactive/-private/record.d.ts +0 -1
  12. package/declarations/reactive/-private/schema.d.ts +0 -2
  13. package/declarations/reactive/-private/symbols.d.ts +0 -26
  14. package/declarations/request/-private/types.d.ts +0 -1
  15. package/declarations/store/-private/cache-handler/utils.d.ts +0 -1
  16. package/declarations/store/-private/caches/instance-cache.d.ts +0 -1
  17. package/declarations/store/-private/default-cache-policy.d.ts +0 -2
  18. package/declarations/store/-private/managers/cache-key-manager.d.ts +0 -4
  19. package/declarations/store/-private/managers/cache-manager.d.ts +0 -16
  20. package/declarations/store/-private/managers/notification-manager.d.ts +0 -2
  21. package/declarations/store/-private/network/request-cache.d.ts +0 -1
  22. package/declarations/store/-private/new-core-tmp/request-state.d.ts +0 -1
  23. package/declarations/store/-private/new-core-tmp/request-subscription.d.ts +0 -2
  24. package/declarations/store/-private/record-arrays/resource-array.d.ts +0 -8
  25. package/declarations/store/-private/store-service.d.ts +0 -5
  26. package/declarations/store/-private/utils/coerce-id.d.ts +0 -6
  27. package/declarations/store/-private.d.ts +0 -5
  28. package/declarations/store/deprecated/-private.d.ts +0 -1
  29. package/declarations/store/deprecated/store.d.ts +0 -4
  30. package/declarations/types/cache/aliases.d.ts +0 -11
  31. package/declarations/types/cache/mutations.d.ts +0 -24
  32. package/declarations/types/cache/relationship.d.ts +0 -3
  33. package/declarations/types/cache.d.ts +0 -12
  34. package/declarations/types/identifier.d.ts +0 -2
  35. package/declarations/types/request.d.ts +0 -3
  36. package/declarations/types/spec/document.d.ts +0 -4
  37. package/declarations/types/spec/json-api-raw.d.ts +0 -1
  38. package/declarations/types.d.ts +0 -1
  39. package/declarations/utils/string.d.ts +0 -1
  40. package/dist/types/-private.js +1 -1
  41. package/package.json +6 -6
@@ -1,96 +1,9 @@
1
1
  export interface RelationshipState {
2
- /*
3
- This flag indicates whether we should consider the content
4
- of this relationship "known".
5
-
6
- If we have no relationship knowledge, and the relationship
7
- is `async`, we will attempt to fetch the relationship on
8
- access if it is also stale.
9
-
10
- Snapshot uses this to tell the difference between unknown
11
- (`undefined`) or empty (`null`). The reason for this is that
12
- we wouldn't want to serialize unknown relationships as `null`
13
- as that might overwrite remote state.
14
-
15
- All relationships for a newly created (`store.createRecord()`) are
16
- considered known (`hasReceivedData === true`).
17
-
18
- true when
19
- => we receive a push with either new data or explicit empty (`[]` or `null`)
20
- => the relationship is a belongsTo and we have received data from
21
- the other side.
22
-
23
- false when
24
- => we have received no signal about what data belongs in this relationship
25
- => the relationship is a hasMany and we have only received data from
26
- the other side.
27
- */
28
2
  hasReceivedData: boolean;
29
- /*
30
- Flag that indicates whether an empty relationship is explicitly empty
31
- (signaled by push giving us an empty array or null relationship)
32
- e.g. an API response has told us that this relationship is empty.
33
-
34
- Thus far, it does not appear that we actually need this flag; however,
35
- @runspired has found it invaluable when debugging relationship tests
36
- to determine whether (and why if so) we are in an incorrect state.
37
-
38
- true when
39
- => we receive a push with explicit empty (`[]` or `null`)
40
- => we have received no signal about what data belongs in this relationship
41
- => on initial create (as no signal is known yet)
42
-
43
- false at all other times
44
- */
45
3
  isEmpty: boolean;
46
- /*
47
- This flag indicates whether we should
48
- re-fetch the relationship the next time
49
- it is accessed.
50
-
51
- The difference between this flag and `shouldForceReload`
52
- is in how we treat the presence of partially missing data:
53
- - for a forced reload, we will reload the link or EVERY record
54
- - for a stale reload, we will reload the link (if present) else only MISSING records
55
-
56
- Ideally these flags could be merged, but because we don't give the
57
- request layer the option of deciding how to resolve the data being queried
58
- we are forced to differentiate for now.
59
-
60
- It is also possible for a relationship to remain stale after a forced reload; however,
61
- in this case `state.hasFailedLoadAttempt` ought to be `true`.
62
-
63
- false when
64
- => cache.isNew(resourceKey) on initial setup
65
- => a previously triggered request has resolved
66
- => we get relationship data via push
67
-
68
- true when
69
- => !cache.isNew(resourceKey) on initial setup
70
- => an inverse has been unloaded
71
- => we get a new link for the relationship
72
-
73
- TODO @runspired unskip the acceptance tests and fix these flags
74
- */
75
4
  isStale: boolean;
76
5
  hasFailedLoadAttempt: boolean;
77
- /*
78
- This flag forces fetch. `true` for a single request once `reload()`
79
- has been called `false` at all other times.
80
- */
81
6
  shouldForceReload: boolean;
82
- /*
83
- This flag indicates whether we should
84
- **partially** re-fetch the relationship the
85
- next time it is accessed.
86
-
87
- false when
88
- => initial setup
89
- => a previously triggered request has resolved
90
-
91
- true when
92
- => an inverse has been unloaded
93
- */
94
7
  hasDematerializedInverse: boolean;
95
8
  }
96
9
  export declare function createState(): RelationshipState;
@@ -20,12 +20,6 @@ export declare function isBelongsTo(relationship: GraphEdge): relationship is Re
20
20
  export declare function isImplicit(relationship: GraphEdge): relationship is ImplicitEdge;
21
21
  export declare function isHasMany(relationship: GraphEdge): relationship is CollectionEdge;
22
22
  export declare function forAllRelatedIdentifiers(rel: GraphEdge, cb: (resourceKey: ResourceKey) => void): void;
23
- /*
24
- Removes the given identifier from BOTH remote AND local state.
25
-
26
- This method is useful when either a deletion or a rollback on a new record
27
- needs to entirely purge itself from an inverse relationship.
28
- */
29
23
  export declare function removeIdentifierCompletelyFromRelationship(graph: Graph, relationship: GraphEdge, value: ResourceKey, silenceNotifications?: boolean): void;
30
24
  export declare function notifyChange(graph: Graph, relationship: CollectionEdge | ResourceEdge): void;
31
25
  export declare function assertRelationshipData(store: Store, resourceKey: ResourceKey, data: ResourceIdentifierObject, meta: UpgradedMeta): void;
@@ -1,9 +1,3 @@
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
1
  type Coercable = string | number | boolean | null | undefined | symbol;
8
2
  export declare function coerceId(id: Coercable): string | null;
9
3
  export declare function ensureStringId(id: Coercable): string;
@@ -1,18 +1,6 @@
1
1
  import type { CacheCapabilitiesManager } from "../../../types.js";
2
2
  import type { ResourceKey } from "../../../types/identifier.js";
3
3
  import { type UpgradedMeta } from "../-edge-definition.js";
4
- /*
5
- Assert that `addedRecord` has a valid type so it can be added to the
6
- relationship of the `record`.
7
-
8
- The assert basically checks if the `addedRecord` can be added to the
9
- relationship (specified via `relationshipMeta`) of the `record`.
10
-
11
- This utility should only be used internally, as both record parameters must
12
- be ResourceKeys and the `relationshipMeta` needs to be the meta
13
- information about the relationship, retrieved via
14
- `record.relationshipFor(key)`.
15
- */
16
4
  declare let assertPolymorphicType: (parentIdentifier: ResourceKey, parentDefinition: UpgradedMeta, addedIdentifier: ResourceKey, store: CacheCapabilitiesManager) => void;
17
5
  declare let assertInheritedSchema: (definition: UpgradedMeta, type: string) => void;
18
6
  export { assertPolymorphicType, assertInheritedSchema };
@@ -15,25 +15,6 @@ type PendingOps = {
15
15
  hasMany?: Map<string, Map<string, RemoteRelationshipOperation[]>>;
16
16
  deletions: DeleteRecordOperation[];
17
17
  };
18
- /*
19
- * Graph acts as the cache for relationship data. It allows for
20
- * us to ask about and update relationships for a given Identifier
21
- * without requiring other objects for that Identifier to be
22
- * instantiated (such as `RecordData` or a `Record`)
23
- *
24
- * This also allows for us to make more substantive changes to relationships
25
- * with increasingly minor alterations to other portions of the internals
26
- * over time.
27
- *
28
- * The graph is made up of nodes and edges. Each unique identifier gets
29
- * its own node, which is a dictionary with a list of that node's edges
30
- * (or connections) to other nodes. In `Model` terms, a node represents a
31
- * record instance, with each key (an edge) in the dictionary correlating
32
- * to either a `hasMany` or `belongsTo` field on that record instance.
33
- *
34
- * The value for each key, or `edge` is the identifier(s) the node relates
35
- * to in the graph from that key.
36
- */
37
18
  export declare class Graph {
38
19
  _definitionCache: EdgeCache;
39
20
  _metaCache: Record<string, Record<string, UpgradedMeta>>;
@@ -55,17 +36,6 @@ export declare class Graph {
55
36
  get(resourceKey: ResourceKey, propertyName: string): GraphEdge;
56
37
  getData(resourceKey: ResourceKey, propertyName: string): ResourceRelationship | CollectionRelationship;
57
38
  getRemoteData(resourceKey: ResourceKey, propertyName: string): ResourceRelationship | CollectionRelationship;
58
- /*
59
- * Allows for the graph to dynamically discover polymorphic connections
60
- * without needing to walk prototype chains.
61
- *
62
- * Used by edges when an added `type` does not match the expected `type`
63
- * for that edge.
64
- *
65
- * Currently we assert before calling this. For a public API we will want
66
- * to call out to the schema manager to ask if we should consider these
67
- * types as equivalent for a given relationship.
68
- */
69
39
  registerPolymorphicType(type1: string, type2: string): void;
70
40
  isReleasable(resourceKey: ResourceKey): boolean;
71
41
  unload(resourceKey: ResourceKey, silenceNotifications?: boolean): void;
@@ -74,13 +44,7 @@ export declare class Graph {
74
44
  hasChanged(resourceKey: ResourceKey): boolean;
75
45
  rollback(resourceKey: ResourceKey): string[];
76
46
  remove(resourceKey: ResourceKey): void;
77
- /*
78
- * Remote state changes
79
- */
80
47
  push(op: RemoteRelationshipOperation): void;
81
- /*
82
- * Local state changes
83
- */
84
48
  update(op: RemoteRelationshipOperation | MergeOperation, isRemote: true): void;
85
49
  update(op: LocalRelationshipOperation, isRemote?: false): void;
86
50
  _scheduleLocalSync(relationship: CollectionEdge): void;
@@ -1,8 +1,2 @@
1
1
  import type { Link, LinkObject } from "../../types/spec/json-api-raw.js";
2
- /*
3
- This method normalizes a link to an "links object". If the passed link is
4
- already an object it's returned without any modifications.
5
-
6
- See http://jsonapi.org/format/#document-links for more information.
7
- */
8
2
  export default function _normalizeLink(link: Link): LinkObject | null;
@@ -1,61 +1,6 @@
1
1
  import type { ResourceKey } from "../../../types.js";
2
2
  import type { ReplaceRelatedRecordsOperation } from "../../../types/graph.js";
3
3
  import type { Graph } from "../graph.js";
4
- /*
5
- case many:1
6
- ========
7
- In a bi-directional graph with Many:1 edges, adding a value
8
- results in up-to 3 discrete value transitions, while removing
9
- a value is only 2 transitions.
10
-
11
- For adding C to A
12
- If: A <<-> B, C <->> D is the initial state,
13
- and: B <->> A <<-> C, D is the final state
14
-
15
- then we would undergo the following transitions.
16
-
17
- add C to A
18
- remove C from D
19
- add A to C
20
-
21
- For removing B from A
22
- If: A <<-> B, C <->> D is the initial state,
23
- and: A, B, C <->> D is the final state
24
-
25
- then we would undergo the following transitions.
26
-
27
- remove B from A
28
- remove A from B
29
-
30
- case many:many
31
- ===========
32
- In a bi-directional graph with Many:Many edges, adding or
33
- removing a value requires only 2 value transitions.
34
-
35
- For Adding
36
- If: A<<->>B, C<<->>D is the initial state (double arrows representing the many side)
37
- And: D<<->>C<<->>A<<->>B is the final state
38
-
39
- Then we would undergo two transitions.
40
-
41
- add C to A.
42
- add A to C
43
-
44
- For Removing
45
- If: A<<->>B, C<<->>D is the initial state (double arrows representing the many side)
46
- And: A, B, C<<->>D is the final state
47
-
48
- Then we would undergo two transitions.
49
-
50
- remove B from A
51
- remove A from B
52
-
53
- case many:?
54
- ========
55
- In a uni-directional graph with Many:? edges (modeled in WarpDrive with `inverse:null`) with
56
- artificial (implicit) inverses, replacing a value results in 2 discrete value transitions.
57
- This is because a Many:? relationship is effectively Many:Many.
58
- */
59
4
  export default function replaceRelatedRecords(graph: Graph, op: ReplaceRelatedRecordsOperation, isRemote: boolean): void;
60
5
  export declare function addToInverse(graph: Graph, resourceKey: ResourceKey, key: string, value: ResourceKey, isRemote: boolean): void;
61
6
  export declare function notifyInverseOfPotentialMaterialization(graph: Graph, resourceKey: ResourceKey, key: string, value: ResourceKey, isRemote: boolean): void;
@@ -5,9 +5,5 @@ import type { UpdateRelationshipOperation } from "../../../types/graph.js";
5
5
  import type { ExistingResourceIdentifierObject, NewResourceIdentifierObject } from "../../../types/spec/json-api-raw.js";
6
6
  import type { Graph } from "../graph.js";
7
7
  type CacheKeyManager = Store["cacheKeyManager"];
8
- /*
9
- Updates the "canonical" or "remote" state of a relationship, replacing any existing
10
- state and blowing away any local changes (excepting new records).
11
- */
12
8
  export default function updateRelationshipOperation(graph: Graph, op: UpdateRelationshipOperation | UpdateResourceRelationshipOperation): void;
13
9
  export declare function upgradeIdentifiers(arr: (ExistingResourceIdentifierObject | NewResourceIdentifierObject | ResourceKey)[], cache: CacheKeyManager): ResourceKey[];
@@ -13,7 +13,6 @@ export interface ManagedArray extends Omit<Array<unknown>, "[]"> {
13
13
  [ARRAY_SIGNAL]: WarpDriveSignal;
14
14
  [Context]: KindContext<SchemaArrayField | ArrayField>;
15
15
  }
16
- // eslint-disable-next-line @typescript-eslint/no-extraneous-class
17
16
  export declare class ManagedArray {
18
17
  constructor(context: KindContext<SchemaArrayField | ArrayField>, owner: ReactiveResource, data: unknown[]);
19
18
  }
@@ -4,13 +4,11 @@ import type { KindContext } from "../default-mode.js";
4
4
  import type { ReactiveResource } from "../record.js";
5
5
  import { Context, SOURCE } from "../symbols.js";
6
6
  export declare function notifyObject(obj: ManagedObject): void;
7
- // const ignoredGlobalFields = new Set<string>(['setInterval', 'nodeType', 'nodeName', 'length', 'document', STRUCTURED]);
8
7
  export interface ManagedObject {
9
8
  [SOURCE]: object;
10
9
  [Context]: KindContext<ObjectField>;
11
10
  [OBJECT_SIGNAL]: WarpDriveSignal;
12
11
  }
13
- // eslint-disable-next-line @typescript-eslint/no-extraneous-class
14
12
  export declare class ManagedObject {
15
13
  constructor(context: KindContext<ObjectField>);
16
14
  }
@@ -32,7 +32,6 @@ export interface ReactiveResource {
32
32
  * @hideconstructor
33
33
  * @public
34
34
  */
35
- // eslint-disable-next-line @typescript-eslint/no-extraneous-class
36
35
  export declare class ReactiveResource {
37
36
  constructor(context: ResourceContext | ObjectContext);
38
37
  }
@@ -30,12 +30,10 @@ export interface CAUTION_MEGA_DANGER_ZONE_Extension {
30
30
  * A constructable such as a Function or Class whose prototype
31
31
  * will be iterated with getOwnPropertyNames.
32
32
  */
33
- // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
34
33
  features: Record<string | symbol, unknown> | Function;
35
34
  }
36
35
  export type ExtensionDef = {
37
36
  kind: "method";
38
- // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
39
37
  fn: Function;
40
38
  } | {
41
39
  kind: "readonly-value";
@@ -1,29 +1,3 @@
1
- // Great, got your attention with that warning didn't we?
2
- // Good. Here's the deal: typescript treats symbols as unique types.
3
- // If by accident a module creating a symbol is processed more than
4
- // once, the symbol will be different in each processing. This will
5
- // cause a type error.
6
- // It could also cause a runtime error if the symbol is used innapropriately.
7
- // However, this case is extremely hard to hit and would require other things
8
- // to go wrong first.
9
- //
10
- // So, why do the warning? And why do we lie about the types of the symbols?
11
- //
12
- // Because we intentionally create multiple copies of them within the types
13
- // at build time. This is because we rollup our d.ts files in order to give
14
- // our consumers a better experience.
15
- //
16
- // However, no tool today supports rolling up d.ts files with multiple entry
17
- // points correctly. The tool we use currently (vite-plugin-dts) uses @microsoft/api-extractor
18
- // which creates a fully unique stand-alone types file per-entry-point. Thus
19
- // every entry point that uses one of these symbols somewhere will have accidentally
20
- // created a new symbol type.
21
- //
22
- // This cast allows us to rollup these types using this tool while not encountering
23
- // the unique symbol type issue.
24
- //
25
- // Note that none of these symbols are part of the public API, these are used for
26
- // debugging DX and as a safe way to provide an intimate contract on public objects.
27
1
  export declare const SOURCE: "___(unique) Symbol(SOURCE)";
28
2
  export declare const Destroy: "___(unique) Symbol(Destroy)";
29
3
  export declare const Checkout: "___(unique) Symbol(Checkout)";
@@ -1,4 +1,3 @@
1
- /* eslint-disable no-irregular-whitespace */
2
1
  import type { Store } from "../../store/-private.js";
3
2
  import type { RequestKey } from "../../types/identifier.js";
4
3
  import type { RequestContext, RequestInfo, ResponseInfo, StructuredDataDocument } from "../../types/request.js";
@@ -18,7 +18,6 @@ export type RobustError = Error & {
18
18
  errors?: ApiError[];
19
19
  content?: unknown;
20
20
  };
21
- // TODO @runspired, consider if we should deep freeze errors (potentially only in debug) vs cloning them
22
21
  export declare function cloneError(error: RobustError): RobustError;
23
22
  export declare function isErrorDocument(document: ResourceDataDocument | ResourceErrorDocument): document is ResourceErrorDocument;
24
23
  export declare function getPriority(identifier: RequestKey | null, deduped: Map<RequestKey, {
@@ -53,7 +53,6 @@ export declare class InstanceCache {
53
53
  disconnect(identifier: ResourceKey): void;
54
54
  unloadRecord(identifier: ResourceKey): void;
55
55
  clear(type?: string): void;
56
- // TODO this should move into something coordinating operations
57
56
  setRecordId(identifier: ResourceKey, id: string): void;
58
57
  }
59
58
  export declare function getNewRecord(instances: InstanceCache, identifier: ResourceKey, properties: CreateRecordProperties): OpaqueRecordInstance;
@@ -10,11 +10,9 @@ export interface NotificationCallback {
10
10
  (resourceKey: ResourceKey, notificationType: "errors" | "meta" | "identity" | "state"): void;
11
11
  }
12
12
  interface ResourceOperationCallback {
13
- // resource updates
14
13
  (resourceKey: ResourceKey, notificationType: CacheOperation): void;
15
14
  }
16
15
  interface DocumentOperationCallback {
17
- // document updates
18
16
  (cacheKey: RequestKey, notificationType: DocumentCacheOperation): void;
19
17
  }
20
18
  type NotificationManager = {
@@ -15,8 +15,6 @@ interface KeyOptions {
15
15
  type TypeMap = {
16
16
  [key: string]: KeyOptions;
17
17
  };
18
- // type IdentifierTypeLookup = { all: Set<ResourceKey>; id: Map<string, ResourceKey> };
19
- // type IdentifiersByType = Map<string, IdentifierTypeLookup>;
20
18
  type IdentifierMap = Map<string, ResourceKey>;
21
19
  type StableCache = {
22
20
  resources: IdentifierMap;
@@ -253,7 +251,6 @@ export declare class CacheKeyManager {
253
251
 
254
252
  @public
255
253
  */
256
- // FIXME audit usage
257
254
  updateRecordIdentifier(identifierObject: ResourceKey, data: unknown): ResourceKey;
258
255
  /**
259
256
  Provides the opportunity to eliminate an identifier from secondary lookup tables
@@ -265,7 +262,6 @@ export declare class CacheKeyManager {
265
262
 
266
263
  @public
267
264
  */
268
- // FIXME audit usage
269
265
  forgetRecordIdentifier(identifierObject: ResourceKey): void;
270
266
  }
271
267
  /**
@@ -30,8 +30,6 @@ import type { StoreRequestContext } from "../cache-handler/handler.js";
30
30
  export declare class CacheManager implements Cache {
31
31
  version: "2";
32
32
  constructor(cache: Cache);
33
- // Cache Management
34
- // ================
35
33
  /**
36
34
  * Cache the response to a request
37
35
  *
@@ -124,8 +122,6 @@ export declare class CacheManager implements Cache {
124
122
  * @return if `hasRecord` is true then calculated key changes should be returned
125
123
  */
126
124
  upsert(key: ResourceKey, data: unknown, hasRecord: boolean): void | string[];
127
- // Cache Forking Support
128
- // =====================
129
125
  /**
130
126
  * Create a fork of the cache from the current state.
131
127
  *
@@ -182,8 +178,6 @@ export declare class CacheManager implements Cache {
182
178
  * @public
183
179
  */
184
180
  diff(): Promise<Change[]>;
185
- // SSR Support
186
- // ===========
187
181
  /**
188
182
  * Serialize the entire contents of the Cache into a Stream
189
183
  * which may be fed back into a new instance of the same Cache
@@ -210,10 +204,6 @@ export declare class CacheManager implements Cache {
210
204
  * @public
211
205
  */
212
206
  hydrate(stream: ReadableStream<unknown>): Promise<void>;
213
- // Cache
214
- // =====
215
- // Resource Support
216
- // ================
217
207
  /**
218
208
  * [LIFECYCLE] Signal to the cache that a new record has been instantiated on the client
219
209
  *
@@ -252,8 +242,6 @@ export declare class CacheManager implements Cache {
252
242
  * @public
253
243
  */
254
244
  unloadRecord(key: ResourceKey): void;
255
- // Granular Resource Data APIs
256
- // ===========================
257
245
  /**
258
246
  * Retrieve the data for an attribute from the cache
259
247
  *
@@ -291,8 +279,6 @@ export declare class CacheManager implements Cache {
291
279
  * @return the names of attributes that were restored
292
280
  */
293
281
  rollbackAttrs(key: ResourceKey): string[];
294
- // Relationships
295
- // =============
296
282
  /**
297
283
  * Query the cache for the changes to relationships of a resource.
298
284
  *
@@ -349,8 +335,6 @@ export declare class CacheManager implements Cache {
349
335
  * @return resource relationship object
350
336
  */
351
337
  getRemoteRelationship(key: ResourceKey, propertyName: string): ResourceRelationship | CollectionRelationship;
352
- // Resource State
353
- // ===============
354
338
  /**
355
339
  * Update the cache state for the given resource to be marked as locally deleted,
356
340
  * or remove such a mark.
@@ -10,11 +10,9 @@ export interface NotificationCallback {
10
10
  (cacheKey: ResourceKey, notificationType: CacheOperation): void;
11
11
  }
12
12
  export interface ResourceOperationCallback {
13
- // resource updates
14
13
  (cacheKey: ResourceKey, notificationType: CacheOperation): void;
15
14
  }
16
15
  export interface DocumentOperationCallback {
17
- // document updates
18
16
  (cacheKey: RequestKey, notificationType: DocumentCacheOperation): void;
19
17
  }
20
18
  /**
@@ -26,7 +26,6 @@ export interface RequestCacheRequestState {
26
26
  response?: Response;
27
27
  }
28
28
  export interface Response {
29
- // rawData: unknown;
30
29
  data: unknown;
31
30
  }
32
31
  interface InternalRequest extends RequestCacheRequestState {
@@ -1,6 +1,5 @@
1
1
  import type { Future } from "../../../request.js";
2
2
  import type { ImmutableRequestInfo, ResponseInfo, StructuredErrorDocument } from "../../../types/request.js";
3
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
4
3
  import type { PendingPromise, RejectedPromise, ResolvedPromise } from "./promise-state.js";
5
4
  /**
6
5
  * Lazily consumes the stream of a request, providing a number of
@@ -42,7 +42,6 @@ export interface RequestArgs<
42
42
  */
43
43
  store?: Store | RequestManager;
44
44
  }
45
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
46
45
  export interface SubscriptionArgs<
47
46
  RT,
48
47
  E
@@ -113,7 +112,6 @@ export interface RequestComponentArgs<
113
112
  */
114
113
  store?: Store | RequestManager;
115
114
  }
116
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
117
115
  export interface RequestSubscription<
118
116
  RT,
119
117
  E
@@ -10,17 +10,13 @@ import { NativeProxy } from "./native-proxy-type-fix.js";
10
10
  declare const IS_COLLECTION: "___(unique) Symbol(IS_COLLECTION)";
11
11
  type ProxiedMethod = (...args: unknown[]) => unknown;
12
12
  interface ReactiveResourceArrayCreateOptions {
13
- // passed in
14
13
  store: Store;
15
14
  manager: MinimumManager;
16
15
  editable: boolean;
17
16
  source: ResourceKey[];
18
- // reactive, passed in
19
17
  data: ObjectValue | null;
20
- // non-reactive, passed in
21
18
  features: Record<string | symbol, unknown> | null;
22
19
  extensions: Map<string | symbol, ExtensionDef> | null;
23
- // not-accessible except by the context
24
20
  options: Record<string, unknown> | null;
25
21
  destroy: null | ((this: ReactiveResourceArray, clear: boolean) => void);
26
22
  mutate: null | ((target: ResourceKey[], receiver: typeof NativeProxy<ResourceKey[], unknown[]>, prop: string, args: unknown[], _SIGNAL: WarpDriveSignal) => unknown);
@@ -28,7 +24,6 @@ interface ReactiveResourceArrayCreateOptions {
28
24
  interface ReactiveResourceArrayContext extends ReactiveResourceArrayCreateOptions {
29
25
  destroy: (this: ReactiveResourceArray, clear: boolean) => void;
30
26
  mutate: (target: ResourceKey[], receiver: typeof NativeProxy<ResourceKey[], unknown[]>, prop: string, args: unknown[], _SIGNAL: WarpDriveSignal) => unknown;
31
- // generated
32
27
  signals: SignalStore;
33
28
  signal: WarpDriveSignal;
34
29
  isDestroying: boolean;
@@ -48,7 +43,6 @@ export interface TargetArray extends Array<ResourceKey> {}
48
43
  export declare function createReactiveResourceArray<T>(options: ReactiveResourceArrayCreateOptions): ReactiveResourceArray<T>;
49
44
  export declare function destroy(this: ReactiveResourceArray, clear: boolean): void;
50
45
  export interface ReactiveRequestCollectionCreateArgs {
51
- // passed in
52
46
  store: Store;
53
47
  manager: MinimumManager;
54
48
  source: ResourceKey[];
@@ -58,11 +52,9 @@ export interface ReactiveRequestCollectionCreateArgs {
58
52
  }
59
53
  export declare function createRequestCollection(config: ReactiveRequestCollectionCreateArgs): ReactiveResourceArray;
60
54
  export interface ReactiveRelatedCollectionCreateArgs {
61
- // passed in
62
55
  store: Store;
63
56
  manager: MinimumManager;
64
57
  source: ResourceKey[];
65
- // not-accessible except by the context
66
58
  options: {
67
59
  resourceKey: ResourceKey;
68
60
  path: string[];
@@ -21,12 +21,10 @@ import type { PrivateRequestStateService } from "./network/request-cache.js";
21
21
  import { RequestStateService } from "./network/request-cache.js";
22
22
  import type { LegacyLiveArray } from "./record-arrays/legacy-live-array.js";
23
23
  export { storeFor };
24
- // We inline this list of methods to avoid importing EmberObject
25
24
  type EmberObjectKey = "_debugContainerKey" | "_super" | "addObserver" | "cacheFor" | "concatenatedProperties" | "decrementProperty" | "destroy" | "get" | "getProperties" | "incrementProperty" | "init" | "isDestroyed" | "isDestroying" | "mergedProperties" | "notifyPropertyChange" | "removeObserver" | "reopen" | "set" | "setProperties" | "toggleProperty" | "toString" | "willDestroy";
26
25
  type DSModelKeys = "___(unique) Symbol(Store)" | "___private_notifications" | "___recordState" | "_createSnapshot" | "adapterError" | "attr" | "belongsTo" | "changedAttributes" | "currentState" | "deleteRecord" | "destroyRecord" | "dirtyType" | "eachAttribute" | "eachRelationship" | "errors" | "hasDirtyAttributes" | "hasMany" | "inverseFor" | "isDeleted" | "isEmpty" | "isError" | "isLoaded" | "isLoading" | "isNew" | "isReloading" | "isSaving" | "isValid" | "relationshipFor" | "reload" | "rollbackAttributes" | "save" | "serialize" | "store" | "unloadRecord";
27
26
  type DownlevelArrays<T> = T extends Array<infer U> ? U[] : T;
28
27
  type AwaitedKeys<T> = { [K in keyof T & string] : DownlevelArrays<Awaited<T[K]>> };
29
- // `AwaitedKeys` is needed here to resolve any promise types like `PromiseBelongsTo`.
30
28
  type FilteredKeys<T> = AwaitedKeys<Omit<T, typeof Type | EmberObjectKey | DSModelKeys | "constructor">>;
31
29
  type MaybeHasId = {
32
30
  id?: string | null;
@@ -51,9 +49,7 @@ export type CreateRecordProperties<T = MaybeHasId & Record<string, unknown>> = T
51
49
  export interface CreateContext {
52
50
  lid?: string;
53
51
  }
54
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
55
52
  type ConstructorFunction = new (...args: any[]) => any;
56
- // eslint-disable-next-line @typescript-eslint/no-extraneous-class
57
53
  declare const EmptyClass: ConstructorFunction;
58
54
  declare const BaseClass: typeof EmptyClass;
59
55
  export interface Store {
@@ -81,7 +77,6 @@ export interface Store {
81
77
  * @return A record instance
82
78
  * @public
83
79
  */
84
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
85
80
  instantiateRecord<T>(identifier: ResourceKey, createRecordArgs: {
86
81
  [key: string]: unknown;
87
82
  }): OpaqueRecordInstance;
@@ -1,9 +1,3 @@
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
1
  type Coercable = string | number | boolean | null | undefined | symbol;
8
2
  export declare function coerceId(id: unknown): string | null;
9
3
  export declare function ensureStringId(id: Coercable): string;
@@ -8,20 +8,15 @@ export { constructResource } from "./-private/utils/construct-resource.js";
8
8
  export type { InstanceCache } from "./-private/caches/instance-cache.js";
9
9
  export type { FindRecordQuery, Request, SaveRecordMutation, RequestCacheRequestState, RequestStateService } from "./-private/network/request-cache.js";
10
10
  export type { CreateRecordProperties } from "./-private/store-service.js";
11
- // TODO this should be a deprecated helper but we have so much usage of it
12
- // to also eliminate
13
11
  export { coerceId, ensureStringId } from "./-private/utils/coerce-id.js";
14
12
  export type { NativeProxy } from "./-private/record-arrays/native-proxy-type-fix.js";
15
13
  export { type ReactiveResourceArray, type PrivateReactiveResourceArray } from "./-private/record-arrays/resource-array.js";
16
14
  export { type LegacyLiveArray, type LegacyLiveArray as LiveArray } from "./-private/record-arrays/legacy-live-array.js";
17
15
  export { type LegacyQueryArray, type LegacyQueryArray as CollectionRecordArray } from "./-private/record-arrays/legacy-query.js";
18
16
  export { RecordArrayManager, fastPush } from "./-private/managers/record-array-manager.js";
19
- // leaked for test/legacy use. You will get in trouble for this.
20
17
  export { assertPrivateStore, isPrivateStore, type PrivateStore } from "./-private/store-service.js";
21
18
  export { assertPrivateCapabilities, type PrivateCacheCapabilitiesManager } from "./-private/managers/cache-capabilities-manager.js";
22
- // leaked for private use / test use, should investigate removing
23
19
  export { _clearCaches } from "./-private/caches/instance-cache.js";
24
- // @ember-data/model needs these temporarily
25
20
  export { setRecordIdentifier, StoreMap } from "./-private/caches/instance-cache.js";
26
21
  export { normalizeModelName as _deprecatingNormalize } from "./-private/utils/normalize-model-name.js";
27
22
  export type { StoreRequestInput } from "./-private/cache-handler/handler.js";
@@ -210,7 +210,6 @@ export declare class RecordReference {
210
210
  reload(): Promise<unknown>;
211
211
  }
212
212
  export declare function getShimClass<T>(store: Store, modelName: T extends TypedRecordInstance ? TypeFromInstance<T> : string): ShimModelClass<T>;
213
- // Mimics the static apis of @ember-data/model
214
213
  export declare class ShimModelClass<T = unknown> implements ModelSchema<T> {
215
214
  __store: Store;
216
215
  modelName: T extends TypedRecordInstance ? TypeFromInstance<T> : string;
@@ -4,10 +4,6 @@ import type { LegacyLiveArray, LegacyQueryArray } from "../-private.js";
4
4
  import { Store } from "../-private/store-service.js";
5
5
  import type { FindAllOptions, FindRecordOptions, LegacyResourceQuery, ModelSchema, QueryOptions } from "./-private.js";
6
6
  import { RecordReference } from "./-private.js";
7
- /////////////// IMPORTANT ///////////////////
8
- ///// Move Module Augmentation Into The /////
9
- ///// Legacy Package Once Removed Here /////
10
- /////////////////////////////////////////////
11
7
  declare module "../-private/store-service" {
12
8
  interface Store {
13
9
  /**
@@ -1,12 +1 @@
1
- // The ResourceBlob is an opaque type that must
2
- // satisfy two constraints.
3
- // (1) it should be possible for the CacheKeyManager
4
- // to be able to generate a ResourceKey for it
5
- // whether by default or due to configuration.
6
- // (2) it should be in a format expected by the Cache.
7
- // This format is Cache declared.
8
- //
9
- // this Opaqueness allows arbitrary storage of any
10
- // serializable / transferable state including such things
11
- // as Buffers and Strings.
12
1
  export type ResourceBlob = unknown;
@@ -17,10 +17,7 @@ export interface ReplaceRelatedRecordMutation {
17
17
  op: "replaceRelatedRecord";
18
18
  record: ResourceKey;
19
19
  field: string;
20
- // never null if field is a collection
21
20
  value: ResourceKey | null;
22
- // if field is a collection,
23
- // the value we are swapping with
24
21
  prior?: ResourceKey;
25
22
  index?: number;
26
23
  }
@@ -28,14 +25,8 @@ export interface ReplaceRelatedRecordsMutation {
28
25
  op: "replaceRelatedRecords";
29
26
  record: ResourceKey;
30
27
  field: string;
31
- // the records to add. If no prior/index
32
- // specified all existing should be removed
33
28
  value: ResourceKey[];
34
- // if this is a "splice" the
35
- // records we expect to be removed
36
29
  prior?: ResourceKey[];
37
- // if this is a "splice" the
38
- // index to start from
39
30
  index?: number;
40
31
  }
41
32
  export interface SortRelatedRecordsMutation {
@@ -44,19 +35,4 @@ export interface SortRelatedRecordsMutation {
44
35
  field: string;
45
36
  value: ResourceKey[];
46
37
  }
47
- // A Mutation is an action that updates
48
- // the local state of the Cache in some
49
- // manner.
50
- // Most Mutations are in theory also
51
- // Operations; with the difference being
52
- // that the change should be applied as
53
- // "local" or "dirty" state instead of
54
- // as "remote" or "clean" state.
55
- //
56
- // Note: this RFC does not publicly surface
57
- // any of the mutations listed here as
58
- // "operations", though the (private) Graph
59
- // already expects and utilizes these.
60
- // and we look forward to an RFC that makes
61
- // the Graph a fully public API.
62
38
  export type Mutation = ReplaceRelatedRecordsMutation | ReplaceRelatedRecordMutation | RemoveFromResourceRelationshipMutation | AddToResourceRelationshipMutation | SortRelatedRecordsMutation;
@@ -1,13 +1,10 @@
1
1
  import type { ResourceKey } from "../identifier.js";
2
2
  import type { Links, Meta, PaginationLinks } from "../spec/json-api-raw.js";
3
- // we request that it be in the stable form already.
4
3
  export interface ResourceRelationship<T = ResourceKey> {
5
4
  data?: T | null;
6
5
  meta?: Meta;
7
6
  links?: Links;
8
7
  }
9
- // Note: in v1 data could be a ResourceIdentifier, now
10
- // we request that it be in the stable form already.
11
8
  export interface CollectionRelationship<T = ResourceKey> {
12
9
  data?: T[];
13
10
  meta?: Meta;
@@ -42,8 +42,6 @@ export interface Cache {
42
42
  * @public
43
43
  */
44
44
  version: "2";
45
- // Cache Management
46
- // ================
47
45
  /**
48
46
  * Cache the response to a request
49
47
  *
@@ -164,8 +162,6 @@ export interface Cache {
164
162
  * @return if `hasRecord` is true then calculated key changes should be returned
165
163
  */
166
164
  upsert(cacheKey: ResourceKey, data: ResourceBlob, hasRecord: boolean): void | string[];
167
- // Cache Forking Support
168
- // =====================
169
165
  /**
170
166
  * Create a fork of the cache from the current state.
171
167
  *
@@ -218,8 +214,6 @@ export interface Cache {
218
214
  * @public
219
215
  */
220
216
  diff(): Promise<Change[]>;
221
- // SSR Support
222
- // ===========
223
217
  /**
224
218
  * Serialize the entire contents of the Cache into a Stream
225
219
  * which may be fed back into a new instance of the same Cache
@@ -244,8 +238,6 @@ export interface Cache {
244
238
  * @public
245
239
  */
246
240
  hydrate(stream: ReadableStream<unknown>): Promise<void>;
247
- // Resource Support
248
- // ================
249
241
  /**
250
242
  * [LIFECYCLE] Signal to the cache that a new record has been instantiated on the client
251
243
  *
@@ -287,8 +279,6 @@ export interface Cache {
287
279
  * @public
288
280
  */
289
281
  unloadRecord(cacheKey: ResourceKey): void;
290
- // Granular Resource Data APIs
291
- // ===========================
292
282
  /**
293
283
  * Retrieve the data for an attribute from the cache
294
284
  *
@@ -392,8 +382,6 @@ export interface Cache {
392
382
  * @return resource relationship object
393
383
  */
394
384
  getRemoteRelationship(cacheKey: ResourceKey, field: string, isCollection?: boolean): ResourceRelationship | CollectionRelationship;
395
- // Resource State
396
- // ===============
397
385
  /**
398
386
  * Update the cache state for the given resource to be marked
399
387
  * as locally deleted, or remove such a mark.
@@ -1,8 +1,6 @@
1
- // provided for additional debuggability
2
1
  export declare const DEBUG_CLIENT_ORIGINATED: unique symbol;
3
2
  export declare const DEBUG_KEY_TYPE: unique symbol;
4
3
  export declare const DEBUG_STALE_CACHE_OWNER: unique symbol;
5
- // also present in production
6
4
  export declare const CACHE_OWNER: "__$co";
7
5
  export type CacheKeyType = "record" | "document";
8
6
  /**
@@ -47,9 +47,6 @@ export type CacheOptions = {
47
47
  * than to invalidate findRecord requests for one.
48
48
  *
49
49
  */
50
- // TODO: Ideally this would be T extends TypedRecordInstance ? ExtractSuggestedCacheTypes<T>[] : string[];
51
- // but that leads to `Type instantiation is excessively deep and possibly infinite.`
52
- // issues when `T` has many properties.
53
50
  types?: string[];
54
51
  /**
55
52
  * If true, the request will never be handled by the cache-manager and thus
@@ -2,7 +2,6 @@ import type { PersistedResourceKey } from "../identifier.js";
2
2
  import type { ApiError } from "./error.js";
3
3
  import type { Links, Meta, PaginationLinks } from "./json-api-raw.js";
4
4
  export interface ResourceMetaDocument {
5
- // the url or cache-key associated with the structured document
6
5
  lid?: string;
7
6
  meta: Meta;
8
7
  links?: Links | PaginationLinks;
@@ -11,7 +10,6 @@ export interface SingleResourceDataDocument<
11
10
  T = PersistedResourceKey,
12
11
  R = PersistedResourceKey
13
12
  > {
14
- // the url or cache-key associated with the structured document
15
13
  lid?: string;
16
14
  links?: Links | PaginationLinks;
17
15
  meta?: Meta;
@@ -19,7 +17,6 @@ export interface SingleResourceDataDocument<
19
17
  included?: R[];
20
18
  }
21
19
  export interface CollectionResourceDataDocument<T = PersistedResourceKey> {
22
- // the url or cache-key associated with the structured document
23
20
  lid?: string;
24
21
  links?: Links | PaginationLinks;
25
22
  meta?: Meta;
@@ -28,7 +25,6 @@ export interface CollectionResourceDataDocument<T = PersistedResourceKey> {
28
25
  }
29
26
  export type ResourceDataDocument<T = PersistedResourceKey> = SingleResourceDataDocument<T> | CollectionResourceDataDocument<T>;
30
27
  export interface ResourceErrorDocument {
31
- // the url or cache-key associated with the structured document
32
28
  lid?: string;
33
29
  links?: Links | PaginationLinks;
34
30
  meta?: Meta;
@@ -82,7 +82,6 @@ export interface ResourceIdentifier {
82
82
  lid: string;
83
83
  }
84
84
  export type ResourceIdentifierObject<T extends string = string> = ResourceIdentifier | ExistingResourceIdentifierObject<T> | NewResourceIdentifierObject<T>;
85
- // TODO disallow NewResource, make narrowable
86
85
  export interface SingleResourceRelationship<T = ExistingResourceIdentifierObject | NewResourceIdentifierObject> {
87
86
  data?: T | null;
88
87
  meta?: Meta;
@@ -6,7 +6,6 @@
6
6
  */
7
7
  export type { StableRecordIdentifier, ResourceKey } from "./types/identifier.js";
8
8
  export type { CacheCapabilitiesManager } from "./store/-types/q/cache-capabilities-manager.js";
9
- // FIXME this should come from somewhere more intelligent
10
9
  export type { ModelSchema } from "./store/deprecated/-private.js";
11
10
  export type { SchemaService } from "./store/-types/q/schema-service.js";
12
11
  export type { BaseFinderOptions, FindRecordOptions, LegacyResourceQuery, QueryOptions, FindAllOptions } from "./store/-types/q/store.js";
@@ -25,7 +25,6 @@ export declare class LRUCache<
25
25
  size: number;
26
26
  state: Map<T, V>;
27
27
  doWork: (k: T) => V;
28
- // debug stats
29
28
  _hits: number;
30
29
  _misses: number;
31
30
  _ejected: number;
@@ -1,6 +1,6 @@
1
1
  import { macroCondition, getGlobalConfig } from '@embroider/macros';
2
2
  const name = "@warp-drive/core";
3
- const version = "5.7.0-alpha.38";
3
+ const version = "5.7.0-alpha.39";
4
4
 
5
5
  // in testing mode, we utilize globals to ensure only one copy exists of
6
6
  // these maps, due to bugs in ember-auto-import
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@warp-drive/core",
3
- "version": "5.7.0-alpha.38",
3
+ "version": "5.7.0-alpha.39",
4
4
  "description": "Core package for WarpDrive | All the Universal Basics",
5
5
  "keywords": [
6
6
  "ember-addon"
@@ -37,18 +37,18 @@
37
37
  },
38
38
  "dependencies": {
39
39
  "@embroider/macros": "^1.18.1",
40
- "@warp-drive/build-config": "5.7.0-alpha.38"
40
+ "@warp-drive/build-config": "5.7.0-alpha.39"
41
41
  },
42
42
  "devDependencies": {
43
- "@babel/core": "^7.28.0",
43
+ "@babel/core": "^7.28.3",
44
44
  "@babel/plugin-transform-typescript": "^7.28.0",
45
45
  "@babel/preset-typescript": "^7.27.1",
46
- "@warp-drive/internal-config": "5.7.0-alpha.38",
46
+ "@warp-drive/internal-config": "5.7.0-alpha.39",
47
47
  "decorator-transforms": "^2.3.0",
48
48
  "ember-source": "~6.6.0",
49
- "expect-type": "^1.2.1",
49
+ "expect-type": "^1.2.2",
50
50
  "typescript": "^5.9.2",
51
- "vite": "^7.1.2"
51
+ "vite": "^7.1.3"
52
52
  },
53
53
  "volta": {
54
54
  "extends": "../../package.json"