@warp-drive/core 5.7.0-alpha.1 → 5.7.0-alpha.11

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 (46) hide show
  1. package/declarations/reactive/-private/default-mode.d.ts +73 -0
  2. package/declarations/reactive/-private/fields/get-field-key.d.ts +8 -0
  3. package/declarations/reactive/-private/fields/managed-array.d.ts +5 -8
  4. package/declarations/reactive/-private/fields/managed-object.d.ts +7 -9
  5. package/declarations/reactive/-private/kind/alias-field.d.ts +4 -0
  6. package/declarations/reactive/-private/kind/array-field.d.ts +4 -0
  7. package/declarations/reactive/-private/kind/attribute-field.d.ts +4 -0
  8. package/declarations/reactive/-private/kind/belongs-to-field.d.ts +4 -0
  9. package/declarations/reactive/-private/kind/collection-field.d.ts +4 -0
  10. package/declarations/reactive/-private/kind/derived-field.d.ts +4 -0
  11. package/declarations/reactive/-private/kind/generic-field.d.ts +4 -0
  12. package/declarations/reactive/-private/kind/has-many-field.d.ts +4 -0
  13. package/declarations/reactive/-private/kind/hash-field.d.ts +4 -0
  14. package/declarations/reactive/-private/kind/identity-field.d.ts +4 -0
  15. package/declarations/reactive/-private/kind/local-field.d.ts +4 -0
  16. package/declarations/reactive/-private/kind/object-field.d.ts +4 -0
  17. package/declarations/reactive/-private/kind/resource-field.d.ts +4 -0
  18. package/declarations/reactive/-private/kind/schema-array-field.d.ts +4 -0
  19. package/declarations/reactive/-private/kind/schema-object-field.d.ts +4 -0
  20. package/declarations/reactive/-private/record.d.ts +6 -21
  21. package/declarations/reactive/-private/schema.d.ts +6 -2
  22. package/declarations/reactive/-private/symbols.d.ts +1 -6
  23. package/declarations/reactive/-private.d.ts +1 -1
  24. package/declarations/reactive.d.ts +1 -0
  25. package/declarations/request/-private/fetch.d.ts +2 -0
  26. package/declarations/store/-types/q/schema-service.d.ts +27 -32
  27. package/declarations/store/-types/q/store.d.ts +6 -7
  28. package/declarations/store/deprecated/-private.d.ts +7 -7
  29. package/declarations/store/deprecated/store.d.ts +5 -5
  30. package/declarations/types/-private.d.ts +1 -1
  31. package/declarations/types/cache.d.ts +0 -2
  32. package/declarations/types/params.d.ts +2 -3
  33. package/declarations/types/request.d.ts +6 -6
  34. package/declarations/types/schema/fields.d.ts +377 -13
  35. package/dist/graph/-private.js +1 -1
  36. package/dist/{handler-D2jjnIA-.js → handler-SdXlte1w.js} +1 -1
  37. package/dist/index.js +2 -2
  38. package/dist/reactive/-private.js +1 -1
  39. package/dist/reactive.js +1171 -603
  40. package/dist/{request-state-CejVJgdj.js → request-state-CeN66aML.js} +12 -10
  41. package/dist/store/-private.js +2 -2
  42. package/dist/{symbols-SIstXMLI.js → symbols-BoONANuz.js} +2 -7
  43. package/dist/types/-private.js +1 -1
  44. package/dist/types/schema/fields.js +21 -2
  45. package/package.json +3 -3
  46. package/declarations/reactive/-private/fields/compute.d.ts +0 -43
@@ -3481,7 +3481,7 @@ function extractIdentifierFromRecord$2(record) {
3481
3481
  return recordIdentifierFor(record);
3482
3482
  }
3483
3483
  const FAKE_ARR = getOrSetGlobal('FAKE_ARR', {});
3484
- const SLICE_BATCH_SIZE = 1200;
3484
+ const SLICE_BATCH_SIZE = 4761;
3485
3485
  /**
3486
3486
  * This is a clever optimization.
3487
3487
  *
@@ -3521,15 +3521,12 @@ const SLICE_BATCH_SIZE = 1200;
3521
3521
  * @param source the items to push into target
3522
3522
  */
3523
3523
  function fastPush(target, source) {
3524
- let startLength = 0;
3525
- const newLength = source.length;
3526
- while (newLength - startLength > SLICE_BATCH_SIZE) {
3527
- // eslint-disable-next-line prefer-spread
3528
- target.push.apply(target, source.slice(startLength, startLength + SLICE_BATCH_SIZE));
3529
- startLength += SLICE_BATCH_SIZE;
3524
+ let batch;
3525
+ while (source.length > SLICE_BATCH_SIZE) {
3526
+ batch = source.splice(0, SLICE_BATCH_SIZE);
3527
+ target.push(...batch);
3530
3528
  }
3531
- // eslint-disable-next-line prefer-spread
3532
- target.push.apply(target, source.slice(startLength));
3529
+ target.push(...source);
3533
3530
  }
3534
3531
  /**
3535
3532
  @class RecordArrayManager
@@ -5078,7 +5075,7 @@ class Store extends BaseClass {
5078
5075
  if (!cache) {
5079
5076
  cache = this._instanceCache.cache = this.createCache(this._instanceCache._storeWrapper);
5080
5077
  if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
5081
- cache = new CacheManager(cache);
5078
+ cache = this._instanceCache.cache = new CacheManager(cache);
5082
5079
  }
5083
5080
  }
5084
5081
  return cache;
@@ -6412,6 +6409,7 @@ function assertNoDuplicates(collection, target, callback, reason) {
6412
6409
  }
6413
6410
  }
6414
6411
  function mutateAddToRelatedRecords(collection, operationInfo, _SIGNAL) {
6412
+ // FIXME field needs to use sourceKey
6415
6413
  mutate(collection, {
6416
6414
  op: 'add',
6417
6415
  record: collection.identifier,
@@ -6420,6 +6418,7 @@ function mutateAddToRelatedRecords(collection, operationInfo, _SIGNAL) {
6420
6418
  }, _SIGNAL);
6421
6419
  }
6422
6420
  function mutateRemoveFromRelatedRecords(collection, operationInfo, _SIGNAL) {
6421
+ // FIXME field needs to use sourceKey
6423
6422
  mutate(collection, {
6424
6423
  op: 'remove',
6425
6424
  record: collection.identifier,
@@ -6428,6 +6427,7 @@ function mutateRemoveFromRelatedRecords(collection, operationInfo, _SIGNAL) {
6428
6427
  }, _SIGNAL);
6429
6428
  }
6430
6429
  function mutateReplaceRelatedRecord(collection, operationInfo, _SIGNAL) {
6430
+ // FIXME field needs to use sourceKey
6431
6431
  mutate(collection, {
6432
6432
  op: 'replaceRelatedRecord',
6433
6433
  record: collection.identifier,
@@ -6436,6 +6436,7 @@ function mutateReplaceRelatedRecord(collection, operationInfo, _SIGNAL) {
6436
6436
  }, _SIGNAL);
6437
6437
  }
6438
6438
  function mutateReplaceRelatedRecords(collection, value, _SIGNAL) {
6439
+ // FIXME field needs to use sourceKey
6439
6440
  mutate(collection, {
6440
6441
  op: 'replaceRelatedRecords',
6441
6442
  record: collection.identifier,
@@ -6444,6 +6445,7 @@ function mutateReplaceRelatedRecords(collection, value, _SIGNAL) {
6444
6445
  }, _SIGNAL);
6445
6446
  }
6446
6447
  function mutateSortRelatedRecords(collection, value, _SIGNAL) {
6448
+ // FIXME field needs to use sourceKey
6447
6449
  mutate(collection, {
6448
6450
  op: 'sortRelatedRecords',
6449
6451
  record: collection.identifier,
@@ -1,3 +1,3 @@
1
- export { C as CollectionRecordArray, D as DISPOSE, I as LiveArray, M as MUTATE, R as RecordArrayManager, l as RelatedCollection, d as SOURCE, B as Signals, S as Store, j as StoreMap, _ as _clearCaches, n as _deprecatingNormalize, b as coerceId, c as constructResource, H as consumeInternalSignal, t as createRequestSubscription, z as defineGate, A as defineNonEnumerableSignal, y as defineSignal, e as ensureStringId, x as entangleSignal, f as fastPush, w as gate, J as getOrCreateInternalSignal, q as getPromiseState, u as getRequestState, a as isDocumentIdentifier, i as isStableIdentifier, m as log, o as logGroup, v as memoized, G as notifyInternalSignal, p as peekCache, E as peekInternalSignal, r as recordIdentifierFor, g as removeRecordDataFor, k as setCacheFor, h as setRecordIdentifier, s as storeFor, F as withSignalStore } from "../request-state-CejVJgdj.js";
2
- export { C as CacheHandler } from "../handler-D2jjnIA-.js";
1
+ export { C as CollectionRecordArray, D as DISPOSE, I as LiveArray, M as MUTATE, R as RecordArrayManager, l as RelatedCollection, d as SOURCE, B as Signals, S as Store, j as StoreMap, _ as _clearCaches, n as _deprecatingNormalize, b as coerceId, c as constructResource, H as consumeInternalSignal, t as createRequestSubscription, z as defineGate, A as defineNonEnumerableSignal, y as defineSignal, e as ensureStringId, x as entangleSignal, f as fastPush, w as gate, J as getOrCreateInternalSignal, q as getPromiseState, u as getRequestState, a as isDocumentIdentifier, i as isStableIdentifier, m as log, o as logGroup, v as memoized, G as notifyInternalSignal, p as peekCache, E as peekInternalSignal, r as recordIdentifierFor, g as removeRecordDataFor, k as setCacheFor, h as setRecordIdentifier, s as storeFor, F as withSignalStore } from "../request-state-CeN66aML.js";
2
+ export { C as CacheHandler } from "../handler-SdXlte1w.js";
3
3
  export { A as ARRAY_SIGNAL, O as OBJECT_SIGNAL, c as createMemo, w as waitFor } from "../configure-B48bFHOl.js";
@@ -34,11 +34,6 @@ import { getOrSetGlobal } from './types/-private.js';
34
34
  const SOURCE = getOrSetGlobal('SOURCE', Symbol('#source'));
35
35
  getOrSetGlobal('MUTATE', Symbol('#update'));
36
36
  const Destroy = getOrSetGlobal('Destroy', Symbol.dispose || Symbol.for('Dispose'));
37
- const Identifier = getOrSetGlobal('Identifier', Symbol('Identifier'));
38
- const Editable = getOrSetGlobal('Editable', Symbol('Editable'));
39
- const Parent = getOrSetGlobal('Parent', Symbol('Parent'));
40
37
  const Checkout = getOrSetGlobal('Checkout', Symbol('Checkout'));
41
- const Legacy = getOrSetGlobal('Legacy', Symbol('Legacy'));
42
- const EmbeddedPath = getOrSetGlobal('EmbeddedPath', Symbol('EmbeddedPath'));
43
- const EmbeddedField = getOrSetGlobal('EmbeddedField', Symbol('EmbeddedField'));
44
- export { Checkout as C, Destroy as D, Editable as E, Identifier as I, Legacy as L, Parent as P, SOURCE as S, EmbeddedPath as a, EmbeddedField as b };
38
+ const Context = getOrSetGlobal('Context', Symbol('Context'));
39
+ export { Context as C, Destroy as D, SOURCE as S, Checkout as a };
@@ -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.1";
3
+ const version = "5.7.0-alpha.11";
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
@@ -1,3 +1,9 @@
1
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
2
+
3
+ /**
4
+ * Options signature for Legacy Attributes.
5
+ */
6
+
1
7
  /**
2
8
  * A generic "field" that can be used to define
3
9
  * primitive value fields.
@@ -132,7 +138,7 @@
132
138
  * perform those itself.
133
139
  *
134
140
  * A schema-array can declare its "key" value to be `@hash` if
135
- * a schema-object has such a field.
141
+ * the schema-objects it contains have such a field.
136
142
  *
137
143
  * Only one hash field is permittable per schema-object, and
138
144
  * it should be placed in the `ResourceSchema`'s `@id` field
@@ -186,11 +192,13 @@
186
192
  /**
187
193
  * Represents a field whose value is an object
188
194
  * with a well-defined structure described by
189
- * a non-resource schema.
195
+ * a schema-object (a non-resource schema).
190
196
  *
191
197
  * If the object's structure is not well-defined,
192
198
  * use 'object' instead.
193
199
  *
200
+ * By default, a SchemaObject within
201
+ *
194
202
  * @public
195
203
  */
196
204
 
@@ -374,6 +382,17 @@
374
382
  * @public
375
383
  */
376
384
 
385
+ /**
386
+ * A union of all possible LegacyMode and PolarisMode
387
+ * field schemas that represent data that could be in
388
+ * the cache.
389
+ *
390
+ * In other words this will not include types like alias
391
+ * fields, local fields, or derived fields.
392
+ *
393
+ * @public
394
+ */
395
+
377
396
  /**
378
397
  * A union of all possible field schemas that can be
379
398
  * used in an ObjectSchema.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@warp-drive/core",
3
- "version": "5.7.0-alpha.1",
3
+ "version": "5.7.0-alpha.11",
4
4
  "description": "Core package for WarpDrive | All the Universal Basics",
5
5
  "keywords": [
6
6
  "ember-addon"
@@ -37,13 +37,13 @@
37
37
  },
38
38
  "dependencies": {
39
39
  "@embroider/macros": "^1.16.12",
40
- "@warp-drive/build-config": "5.7.0-alpha.1"
40
+ "@warp-drive/build-config": "5.7.0-alpha.11"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@babel/core": "^7.26.10",
44
44
  "@babel/plugin-transform-typescript": "^7.27.0",
45
45
  "@babel/preset-typescript": "^7.27.0",
46
- "@warp-drive/internal-config": "5.7.0-alpha.1",
46
+ "@warp-drive/internal-config": "5.7.0-alpha.11",
47
47
  "decorator-transforms": "^2.3.0",
48
48
  "ember-source": "~6.3.0",
49
49
  "expect-type": "^1.2.1",
@@ -1,43 +0,0 @@
1
- import type { Store, StoreRequestInput } from "../../../index.js";
2
- import type { Future } from "../../../request.js";
3
- import { RelatedCollection as ManyArray } from "../../../store/-private.js";
4
- import type { Cache } from "../../../types/cache.js";
5
- import type { StableRecordIdentifier } from "../../../types/identifier.js";
6
- import type { ArrayField, DerivedField, FieldSchema, GenericField, LegacyHasManyField, LocalField, ObjectField, SchemaArrayField, SchemaObjectField } from "../../../types/schema/fields.js";
7
- import type { Links } from "../../../types/spec/json-api-raw.js";
8
- import { RecordStore } from "../../../types/symbols.js";
9
- import { ReactiveResource } from "../record.js";
10
- import type { SchemaService } from "../schema.js";
11
- import { Parent } from "../symbols.js";
12
- import { ManagedArray } from "./managed-array.js";
13
- import { ManagedObject } from "./managed-object.js";
14
- export declare const ManagedArrayMap: Map<ReactiveResource, Map<string, ManagedArray | ManyArray>>;
15
- export declare const ManagedObjectMap: Map<ReactiveResource, Map<string, ManagedObject | ReactiveResource>>;
16
- export declare function computeLocal(record: typeof Proxy<ReactiveResource>, field: LocalField, prop: string): unknown;
17
- export declare function peekManagedArray(record: ReactiveResource, field: FieldSchema): ManyArray | ManagedArray | undefined;
18
- export declare function peekManagedObject(record: ReactiveResource, field: ObjectField): ManagedObject | undefined;
19
- export declare function peekManagedObject(record: ReactiveResource, field: SchemaObjectField): ReactiveResource | undefined;
20
- export declare function computeField(schema: SchemaService, cache: Cache, record: ReactiveResource, identifier: StableRecordIdentifier, field: GenericField, prop: string | string[], editable: boolean): unknown;
21
- export declare function computeArray(store: Store, schema: SchemaService, cache: Cache, record: ReactiveResource, identifier: StableRecordIdentifier, field: ArrayField | SchemaArrayField, path: string[], editable: boolean, legacy: boolean): ManagedArray | null;
22
- export declare function computeObject(schema: SchemaService, cache: Cache, record: ReactiveResource, identifier: StableRecordIdentifier, field: ObjectField, path: string[], editable: boolean, legacy: boolean): ManagedObject | null;
23
- export declare function computeSchemaObject(store: Store, cache: Cache, record: ReactiveResource, identifier: StableRecordIdentifier, field: SchemaObjectField, path: string[], legacy: boolean, editable: boolean): ReactiveResource | null;
24
- export declare function computeAttribute(cache: Cache, identifier: StableRecordIdentifier, prop: string, editable: boolean): unknown;
25
- export declare function computeDerivation(schema: SchemaService, record: ReactiveResource, identifier: StableRecordIdentifier, field: DerivedField, prop: string): unknown;
26
- interface ResourceRelationship<T extends ReactiveResource = ReactiveResource> {
27
- lid: string;
28
- [Parent]: ReactiveResource;
29
- [RecordStore]: Store;
30
- name: string;
31
- data: T | null;
32
- links: Links;
33
- meta: Record<string, unknown>;
34
- }
35
- // TODO probably this should just be a Document
36
- // but its separate until we work out the lid situation
37
- declare class ResourceRelationship<T extends ReactiveResource = ReactiveResource> {
38
- constructor(store: Store, cache: Cache, parent: ReactiveResource, identifier: StableRecordIdentifier, field: FieldSchema, name: string, editable: boolean);
39
- fetch(options?: StoreRequestInput<T, T>): Future<T>;
40
- }
41
- export declare function computeResource<T extends ReactiveResource>(store: Store, cache: Cache, parent: ReactiveResource, identifier: StableRecordIdentifier, field: FieldSchema, prop: string, editable: boolean): ResourceRelationship<T>;
42
- export declare function computeHasMany(store: Store, schema: SchemaService, cache: Cache, record: ReactiveResource, identifier: StableRecordIdentifier, field: LegacyHasManyField, path: string[], editable: boolean, legacy: boolean): ManyArray | null;
43
- export {};