@warp-drive/core 5.7.0-alpha.3 → 5.7.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.
- package/declarations/reactive/-private/default-mode.d.ts +73 -0
- package/declarations/reactive/-private/fields/get-field-key.d.ts +8 -0
- package/declarations/reactive/-private/fields/managed-array.d.ts +3 -5
- package/declarations/reactive/-private/fields/managed-object.d.ts +5 -3
- package/declarations/reactive/-private/kind/alias-field.d.ts +4 -0
- package/declarations/reactive/-private/kind/array-field.d.ts +4 -0
- package/declarations/reactive/-private/kind/attribute-field.d.ts +4 -0
- package/declarations/reactive/-private/kind/belongs-to-field.d.ts +4 -0
- package/declarations/reactive/-private/kind/collection-field.d.ts +4 -0
- package/declarations/reactive/-private/kind/derived-field.d.ts +4 -0
- package/declarations/reactive/-private/kind/generic-field.d.ts +4 -0
- package/declarations/reactive/-private/kind/has-many-field.d.ts +4 -0
- package/declarations/reactive/-private/kind/hash-field.d.ts +4 -0
- package/declarations/reactive/-private/kind/identity-field.d.ts +4 -0
- package/declarations/reactive/-private/kind/local-field.d.ts +4 -0
- package/declarations/reactive/-private/kind/object-field.d.ts +4 -0
- package/declarations/reactive/-private/kind/resource-field.d.ts +4 -0
- package/declarations/reactive/-private/kind/schema-array-field.d.ts +4 -0
- package/declarations/reactive/-private/kind/schema-object-field.d.ts +4 -0
- package/declarations/reactive/-private/record.d.ts +2 -4
- package/declarations/reactive/-private/schema.d.ts +6 -2
- package/declarations/reactive.d.ts +1 -0
- package/declarations/store/-types/q/schema-service.d.ts +20 -32
- package/declarations/types/schema/fields.d.ts +348 -11
- package/dist/graph/-private.js +1 -1
- package/dist/{handler-D2jjnIA-.js → handler-SdXlte1w.js} +1 -1
- package/dist/index.js +2 -2
- package/dist/reactive.js +1156 -584
- package/dist/{request-state-CejVJgdj.js → request-state-CeN66aML.js} +12 -10
- package/dist/store/-private.js +2 -2
- package/dist/types/-private.js +1 -1
- package/dist/types/schema/fields.js +17 -2
- package/package.json +3 -3
- 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 =
|
|
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
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
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
|
-
|
|
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,
|
package/dist/store/-private.js
CHANGED
|
@@ -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-
|
|
2
|
-
export { C as CacheHandler } from "../handler-
|
|
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";
|
package/dist/types/-private.js
CHANGED
|
@@ -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.
|
|
3
|
+
const version = "5.7.0-alpha.5";
|
|
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,5 @@
|
|
|
1
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* A generic "field" that can be used to define
|
|
3
5
|
* primitive value fields.
|
|
@@ -132,7 +134,7 @@
|
|
|
132
134
|
* perform those itself.
|
|
133
135
|
*
|
|
134
136
|
* A schema-array can declare its "key" value to be `@hash` if
|
|
135
|
-
*
|
|
137
|
+
* the schema-objects it contains have such a field.
|
|
136
138
|
*
|
|
137
139
|
* Only one hash field is permittable per schema-object, and
|
|
138
140
|
* it should be placed in the `ResourceSchema`'s `@id` field
|
|
@@ -186,11 +188,13 @@
|
|
|
186
188
|
/**
|
|
187
189
|
* Represents a field whose value is an object
|
|
188
190
|
* with a well-defined structure described by
|
|
189
|
-
* a non-resource schema.
|
|
191
|
+
* a schema-object (a non-resource schema).
|
|
190
192
|
*
|
|
191
193
|
* If the object's structure is not well-defined,
|
|
192
194
|
* use 'object' instead.
|
|
193
195
|
*
|
|
196
|
+
* By default, a SchemaObject within
|
|
197
|
+
*
|
|
194
198
|
* @public
|
|
195
199
|
*/
|
|
196
200
|
|
|
@@ -374,6 +378,17 @@
|
|
|
374
378
|
* @public
|
|
375
379
|
*/
|
|
376
380
|
|
|
381
|
+
/**
|
|
382
|
+
* A union of all possible LegacyMode and PolarisMode
|
|
383
|
+
* field schemas that represent data that could be in
|
|
384
|
+
* the cache.
|
|
385
|
+
*
|
|
386
|
+
* In other words this will not include types like alias
|
|
387
|
+
* fields, local fields, or derived fields.
|
|
388
|
+
*
|
|
389
|
+
* @public
|
|
390
|
+
*/
|
|
391
|
+
|
|
377
392
|
/**
|
|
378
393
|
* A union of all possible field schemas that can be
|
|
379
394
|
* 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.
|
|
3
|
+
"version": "5.7.0-alpha.5",
|
|
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.
|
|
40
|
+
"@warp-drive/build-config": "5.7.0-alpha.5"
|
|
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.
|
|
46
|
+
"@warp-drive/internal-config": "5.7.0-alpha.5",
|
|
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 {};
|