@warp-drive/core 5.10.0-alpha.0 → 5.10.0-alpha.10
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/dist/{-private-DQW39hCl.js → -private-CjK1Dmuh.js} +3 -3
- package/dist/{-private-DQW39hCl.js.map → -private-CjK1Dmuh.js.map} +1 -1
- package/dist/{-private-BVx3LW79.js → -private-Dtj8O5W7.js} +2 -2
- package/dist/{-private-BVx3LW79.js.map → -private-Dtj8O5W7.js.map} +1 -1
- package/dist/configure.js +1 -1
- package/dist/{document-BEn91SwT.d.ts → document-Ca4ZZBd9.d.ts} +2 -2
- package/dist/{document-BEn91SwT.d.ts.map → document-Ca4ZZBd9.d.ts.map} +1 -1
- package/dist/{error-50OSEhsF.d.ts → error-0uD6GkNX.d.ts} +6 -2
- package/dist/error-0uD6GkNX.d.ts.map +1 -0
- package/dist/graph/-private.d.ts +1 -1
- package/dist/graph/-private.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/{internal-DtWOpxrR.d.ts → internal-9XuWZdDv.d.ts} +840 -758
- package/dist/internal-9XuWZdDv.d.ts.map +1 -0
- package/dist/reactive/-private.d.ts +1 -1
- package/dist/reactive/-private.js +1 -1
- package/dist/reactive.d.ts +1 -1
- package/dist/reactive.js +3 -3
- package/dist/{request-CVg2OTfv.js → request-Di274pQz.js} +14 -2
- package/dist/{request-CVg2OTfv.js.map → request-Di274pQz.js.map} +1 -1
- package/dist/request.d.ts +1 -1
- package/dist/request.js +1 -1
- package/dist/signals/-leaked.d.ts +16 -16
- package/dist/signals/-leaked.d.ts.map +1 -1
- package/dist/signals/-leaked.js +1 -1
- package/dist/{src-BJWUE7e3.js → src-TlQlgL5V.js} +76 -57
- package/dist/src-TlQlgL5V.js.map +1 -0
- package/dist/store/-private.d.ts +2 -2
- package/dist/store/-private.js +2 -2
- package/dist/store.d.ts +1 -1
- package/dist/types/-private.d.ts +6 -7
- package/dist/types/-private.d.ts.map +1 -1
- package/dist/types/-private.js +116 -2
- package/dist/types/-private.js.map +1 -0
- package/dist/types/cache.d.ts +1 -1
- package/dist/types/request.d.ts +1 -1
- package/dist/types/request.js +1 -1
- package/dist/types/runtime.d.ts +3 -4
- package/dist/types/runtime.d.ts.map +1 -1
- package/dist/types/runtime.js +1 -1
- package/dist/types/schema/schema-service.d.ts +1 -1
- package/dist/types/spec/document.d.ts +1 -1
- package/dist/types/spec/error.d.ts +1 -1
- package/dist/types/symbols.js +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/unpkg/dev/{-private-B9s2h5b6.js → -private-DrQgwtNS.js} +3 -3
- package/dist/unpkg/{dev-deprecated/-private-B9s2h5b6.js.map → dev/-private-DrQgwtNS.js.map} +1 -1
- package/dist/unpkg/dev/{-private-DcPB5DHD.js → -private-Dtj8O5W7.js} +2 -2
- package/dist/unpkg/{prod/-private-BWNdDSOr.js.map → dev/-private-Dtj8O5W7.js.map} +1 -1
- package/dist/unpkg/dev/configure.js +1 -1
- package/dist/unpkg/dev/graph/-private.js +2 -2
- package/dist/unpkg/dev/index.js +1 -1
- package/dist/unpkg/dev/reactive/-private.js +1 -1
- package/dist/unpkg/dev/reactive.js +3 -3
- package/dist/unpkg/{dev-deprecated/request-DEdT4gST.js → dev/request-nAaeDlS9.js} +14 -2
- package/dist/unpkg/dev/{request-DEdT4gST.js.map → request-nAaeDlS9.js.map} +1 -1
- package/dist/unpkg/dev/request.js +1 -1
- package/dist/unpkg/dev/{runtime-FdPeCUwk.js → runtime-vtT5WRY_.js} +2 -2
- package/dist/unpkg/dev/{runtime-FdPeCUwk.js.map → runtime-vtT5WRY_.js.map} +1 -1
- package/dist/unpkg/dev/signals/-leaked.js +1 -1
- package/dist/unpkg/dev/{src-CdRGGxoN.js → src-D8uKAIUN.js} +78 -59
- package/dist/unpkg/dev/src-D8uKAIUN.js.map +1 -0
- package/dist/unpkg/dev/store/-private.js +2 -2
- package/dist/unpkg/dev/{store-BRZE8mQW.js → store-BIFNM_fB.js} +3 -3
- package/dist/unpkg/dev/{store-BRZE8mQW.js.map → store-BIFNM_fB.js.map} +1 -1
- package/dist/unpkg/dev/store.js +1 -1
- package/dist/unpkg/dev/types/-private.js +107 -2
- package/dist/unpkg/dev/types/-private.js.map +1 -0
- package/dist/unpkg/dev/types/request.js +1 -1
- package/dist/unpkg/dev/types/runtime.js +1 -1
- package/dist/unpkg/dev/types/symbols.js +1 -1
- package/dist/unpkg/dev-deprecated/{-private-B9s2h5b6.js → -private-DrQgwtNS.js} +3 -3
- package/dist/unpkg/{dev/-private-B9s2h5b6.js.map → dev-deprecated/-private-DrQgwtNS.js.map} +1 -1
- package/dist/unpkg/dev-deprecated/{-private-DcPB5DHD.js → -private-Dtj8O5W7.js} +2 -2
- package/dist/unpkg/dev-deprecated/{-private-DcPB5DHD.js.map → -private-Dtj8O5W7.js.map} +1 -1
- package/dist/unpkg/dev-deprecated/configure.js +1 -1
- package/dist/unpkg/dev-deprecated/graph/-private.js +3 -3
- package/dist/unpkg/dev-deprecated/graph/-private.js.map +1 -1
- package/dist/unpkg/dev-deprecated/index.js +1 -1
- package/dist/unpkg/dev-deprecated/reactive/-private.js +1 -1
- package/dist/unpkg/dev-deprecated/reactive.js +3 -3
- package/dist/unpkg/{dev/request-DEdT4gST.js → dev-deprecated/request-nAaeDlS9.js} +14 -2
- package/dist/unpkg/dev-deprecated/{request-DEdT4gST.js.map → request-nAaeDlS9.js.map} +1 -1
- package/dist/unpkg/dev-deprecated/request.js +1 -1
- package/dist/unpkg/dev-deprecated/{runtime-Klu1azLv.js → runtime-e4oZ_UWz.js} +2 -2
- package/dist/unpkg/dev-deprecated/{runtime-Klu1azLv.js.map → runtime-e4oZ_UWz.js.map} +1 -1
- package/dist/unpkg/dev-deprecated/signals/-leaked.js +1 -1
- package/dist/unpkg/dev-deprecated/{src-Dy15xjRt.js → src-BlewXGbB.js} +81 -62
- package/dist/unpkg/dev-deprecated/src-BlewXGbB.js.map +1 -0
- package/dist/unpkg/dev-deprecated/store/-private.js +2 -2
- package/dist/unpkg/dev-deprecated/{store-C6m5EkF2.js → store-X1WN7P_O.js} +3 -3
- package/dist/unpkg/dev-deprecated/{store-C6m5EkF2.js.map → store-X1WN7P_O.js.map} +1 -1
- package/dist/unpkg/dev-deprecated/store.js +1 -1
- package/dist/unpkg/dev-deprecated/types/-private.js +107 -2
- package/dist/unpkg/dev-deprecated/types/-private.js.map +1 -0
- package/dist/unpkg/dev-deprecated/types/request.js +1 -1
- package/dist/unpkg/dev-deprecated/types/runtime.js +1 -1
- package/dist/unpkg/dev-deprecated/types/symbols.js +1 -1
- package/dist/unpkg/prod/{-private-Da3Xoapd.js → -private-Dg1vsF-H.js} +3 -3
- package/dist/unpkg/prod/{-private-Da3Xoapd.js.map → -private-Dg1vsF-H.js.map} +1 -1
- package/dist/unpkg/prod/-private-Dtj8O5W7.js +22 -0
- package/dist/unpkg/{prod-deprecated/-private-BWNdDSOr.js.map → prod/-private-Dtj8O5W7.js.map} +1 -1
- package/dist/unpkg/prod/configure.js +1 -1
- package/dist/unpkg/prod/graph/-private.js +1 -1
- package/dist/unpkg/prod/index.js +1 -1
- package/dist/unpkg/prod/reactive/-private.js +1 -1
- package/dist/unpkg/prod/reactive.js +3 -3
- package/dist/unpkg/{prod-deprecated/request-BP3eOqZa.js → prod/request-DK7nNaAf.js} +14 -2
- package/dist/unpkg/prod/{request-BP3eOqZa.js.map → request-DK7nNaAf.js.map} +1 -1
- package/dist/unpkg/prod/request.js +1 -1
- package/dist/unpkg/prod/signals/-leaked.js +1 -1
- package/dist/unpkg/prod/{src-DZBa2djC.js → src-DGB6WvXW.js} +50 -30
- package/dist/unpkg/prod/src-DGB6WvXW.js.map +1 -0
- package/dist/unpkg/prod/store/-private.js +2 -2
- package/dist/unpkg/prod/types/-private.js +95 -2
- package/dist/unpkg/prod/types/-private.js.map +1 -0
- package/dist/unpkg/prod/types/request.js +1 -1
- package/dist/unpkg/prod/types/runtime.js +1 -1
- package/dist/unpkg/prod/types/symbols.js +1 -1
- package/dist/unpkg/prod-deprecated/{-private-Da3Xoapd.js → -private-Dg1vsF-H.js} +3 -3
- package/dist/unpkg/prod-deprecated/{-private-Da3Xoapd.js.map → -private-Dg1vsF-H.js.map} +1 -1
- package/dist/unpkg/prod-deprecated/{-private-BWNdDSOr.js → -private-Dtj8O5W7.js} +2 -2
- package/dist/unpkg/{dev/-private-DcPB5DHD.js.map → prod-deprecated/-private-Dtj8O5W7.js.map} +1 -1
- package/dist/unpkg/prod-deprecated/configure.js +1 -1
- package/dist/unpkg/prod-deprecated/graph/-private.js +1 -1
- package/dist/unpkg/prod-deprecated/index.js +1 -1
- package/dist/unpkg/prod-deprecated/reactive/-private.js +1 -1
- package/dist/unpkg/prod-deprecated/reactive.js +3 -3
- package/dist/unpkg/{prod/request-BP3eOqZa.js → prod-deprecated/request-DK7nNaAf.js} +14 -2
- package/dist/unpkg/prod-deprecated/{request-BP3eOqZa.js.map → request-DK7nNaAf.js.map} +1 -1
- package/dist/unpkg/prod-deprecated/request.js +1 -1
- package/dist/unpkg/prod-deprecated/signals/-leaked.js +1 -1
- package/dist/unpkg/prod-deprecated/{src-CXgpypVP.js → src-B9AnmJPz.js} +51 -31
- package/dist/unpkg/prod-deprecated/src-B9AnmJPz.js.map +1 -0
- package/dist/unpkg/prod-deprecated/store/-private.js +2 -2
- package/dist/unpkg/prod-deprecated/types/-private.js +95 -2
- package/dist/unpkg/prod-deprecated/types/-private.js.map +1 -0
- package/dist/unpkg/prod-deprecated/types/request.js +1 -1
- package/dist/unpkg/prod-deprecated/types/runtime.js +1 -1
- package/dist/unpkg/prod-deprecated/types/symbols.js +1 -1
- package/dist/utils/string.d.ts +3 -4
- package/dist/utils/string.d.ts.map +1 -1
- package/package.json +8 -8
- package/dist/-private-do3tS7lK.js +0 -120
- package/dist/-private-do3tS7lK.js.map +0 -1
- package/dist/error-50OSEhsF.d.ts.map +0 -1
- package/dist/internal-DtWOpxrR.d.ts.map +0 -1
- package/dist/src-BJWUE7e3.js.map +0 -1
- package/dist/unpkg/dev/-private-9RWV1Vii.js +0 -111
- package/dist/unpkg/dev/-private-9RWV1Vii.js.map +0 -1
- package/dist/unpkg/dev/src-CdRGGxoN.js.map +0 -1
- package/dist/unpkg/dev-deprecated/-private-9RWV1Vii.js +0 -111
- package/dist/unpkg/dev-deprecated/-private-9RWV1Vii.js.map +0 -1
- package/dist/unpkg/dev-deprecated/src-Dy15xjRt.js.map +0 -1
- package/dist/unpkg/prod/-private-BWNdDSOr.js +0 -22
- package/dist/unpkg/prod/-private-C2sWpOcv.js +0 -99
- package/dist/unpkg/prod/-private-C2sWpOcv.js.map +0 -1
- package/dist/unpkg/prod/src-DZBa2djC.js.map +0 -1
- package/dist/unpkg/prod-deprecated/-private-C2sWpOcv.js +0 -99
- package/dist/unpkg/prod-deprecated/-private-C2sWpOcv.js.map +0 -1
- package/dist/unpkg/prod-deprecated/src-CXgpypVP.js.map +0 -1
|
@@ -3,7 +3,7 @@ import { t as QueryParamsSerializationOptions } from "./params-DrEx3bf8.js";
|
|
|
3
3
|
import { a as Type, n as RequestSignature } from "./symbols-DjRDCeX0.js";
|
|
4
4
|
import { c as TypedRecordInstance, i as OpaqueRecordInstance$1, o as TypeFromInstance, s as TypeFromInstanceOrString } from "./record-D3QQcaIR.js";
|
|
5
5
|
import { i as Value, n as ObjectValue } from "./raw-D5hnjiq7.js";
|
|
6
|
-
import { d as Meta, g as ResourceIdentifierObject, i as ExistingResourceIdentifierObject, m as PaginationLinks, r as EmptyResourceDocument, s as JsonApiDocument, t as CollectionResourceDocument, u as Links, y as SingleResourceDocument } from "./json-api-raw-C5APJHHB.js";
|
|
6
|
+
import { a as ExistingResourceObject, d as Meta, g as ResourceIdentifierObject, i as ExistingResourceIdentifierObject, m as PaginationLinks, r as EmptyResourceDocument, s as JsonApiDocument, t as CollectionResourceDocument, u as Links, y as SingleResourceDocument } from "./json-api-raw-C5APJHHB.js";
|
|
7
7
|
import { A as ResourceField, C as ObjectField, F as Trait, M as Schema, N as SchemaArrayField, O as PolarisResourceSchema, P as SchemaObjectField, T as ObjectSchema, a as DerivedField, b as LinksModeHasManyField, c as HashField, d as LegacyAttributeField, f as LegacyBelongsToField, g as LegacyRelationshipField, i as CollectionField, j as ResourceSchema, l as IdentityField, m as LegacyHasManyField, o as FieldSchema, r as CacheableFieldSchema, s as GenericField, t as ArrayField } from "./fields-FM7peCiM.js";
|
|
8
8
|
import { n as HashFn, r as Transformation$1, t as Derivation } from "./concepts-DFldVwEM.js";
|
|
9
9
|
import { n as WithPartial } from "./utils-BtURiy8l.js";
|
|
@@ -12,8 +12,8 @@ import { t as Change } from "./change-C7kqv2kW.js";
|
|
|
12
12
|
import { n as Mutation } from "./mutations-CqtoGB4t.js";
|
|
13
13
|
import { r as ResourceRelationship, t as CollectionRelationship } from "./relationship-CmHzMPKf.js";
|
|
14
14
|
import { i as MergeOperation, o as Operation$1 } from "./operations-D1qA6r0_.js";
|
|
15
|
-
import { t as ApiError } from "./error-
|
|
16
|
-
import { o as SingleResourceDataDocument, r as ResourceDocument, t as CollectionResourceDataDocument } from "./document-
|
|
15
|
+
import { t as ApiError } from "./error-0uD6GkNX.js";
|
|
16
|
+
import { o as SingleResourceDataDocument, r as ResourceDocument, t as CollectionResourceDataDocument } from "./document-Ca4ZZBd9.js";
|
|
17
17
|
import { i as RemoteRelationshipOperation, n as LocalRelationshipOperation, t as DeleteRecordOperation } from "./graph-DLqYXP2z.js";
|
|
18
18
|
import { i as SignalRef, t as ARRAY_SIGNAL } from "./configure-B_F639tN.js";
|
|
19
19
|
//#region src/request/-private/manager.d.ts
|
|
@@ -1295,489 +1295,6 @@ type KeyInfo = {
|
|
|
1295
1295
|
};
|
|
1296
1296
|
type KeyInfoMethod = (resource: unknown, known: ResourceKey | null) => KeyInfo;
|
|
1297
1297
|
//#endregion
|
|
1298
|
-
//#region src/store/-private/managers/cache-key-manager.d.ts
|
|
1299
|
-
type TypeFromIdentifier<T> = T extends {
|
|
1300
|
-
type: infer U;
|
|
1301
|
-
} ? U : string;
|
|
1302
|
-
type NarrowIdentifierIfPossible<T> = T extends ExistingResourceIdentifierObject ? PersistedResourceKey<TypeFromIdentifier<T>> : ResourceKey;
|
|
1303
|
-
/**
|
|
1304
|
-
* Type-guard that returns `true` if the given value is a stable {@link ResourceKey}
|
|
1305
|
-
* (as opposed to a {@link RequestKey} or arbitrary, not-yet-stabilized resource data).
|
|
1306
|
-
*/
|
|
1307
|
-
declare function isResourceKey(identifier: unknown): identifier is ResourceKey;
|
|
1308
|
-
/**
|
|
1309
|
-
* Type-guard that returns `true` if the given value is a stable {@link RequestKey}
|
|
1310
|
-
* (as opposed to a {@link ResourceKey} or arbitrary, not-yet-stabilized data).
|
|
1311
|
-
*/
|
|
1312
|
-
declare function isRequestKey(identifier: unknown): identifier is RequestKey;
|
|
1313
|
-
interface KeyOptions {
|
|
1314
|
-
lid: IdentifierMap;
|
|
1315
|
-
id: IdentifierMap;
|
|
1316
|
-
}
|
|
1317
|
-
type TypeMap = {
|
|
1318
|
-
[key: string]: KeyOptions;
|
|
1319
|
-
};
|
|
1320
|
-
type IdentifierMap = Map<string, ResourceKey>;
|
|
1321
|
-
type StableCache = {
|
|
1322
|
-
resources: IdentifierMap;
|
|
1323
|
-
documents: Map<string, RequestKey>;
|
|
1324
|
-
resourcesByType: TypeMap;
|
|
1325
|
-
polymorphicLidBackMap: Map<string, string[]>;
|
|
1326
|
-
};
|
|
1327
|
-
type MergeMethod = (targetIdentifier: ResourceKey, matchedIdentifier: ResourceKey, resourceData: unknown) => ResourceKey;
|
|
1328
|
-
/**
|
|
1329
|
-
Configures how unique identifier lid strings are generated by @ember-data/store.
|
|
1330
|
-
|
|
1331
|
-
This configuration MUST occur prior to the store instance being created.
|
|
1332
|
-
|
|
1333
|
-
Takes a method which can expect to receive various data as its first argument
|
|
1334
|
-
and the name of a bucket as its second argument.
|
|
1335
|
-
|
|
1336
|
-
Currently there are two buckets, 'record' and 'document'.
|
|
1337
|
-
|
|
1338
|
-
### Resource (`Record`) Identity
|
|
1339
|
-
|
|
1340
|
-
If the bucket is `record` the method must return a unique (to at-least
|
|
1341
|
-
the given bucket) string identifier for the given data as a string to be
|
|
1342
|
-
used as the `lid` of an `Identifier` token.
|
|
1343
|
-
|
|
1344
|
-
This method will only be called by either `getOrCreateRecordIdentifier` or
|
|
1345
|
-
`createIdentifierForNewRecord` when an identifier for the supplied data
|
|
1346
|
-
is not already known via `lid` or `type + id` combo and one needs to be
|
|
1347
|
-
generated or retrieved from a proprietary cache.
|
|
1348
|
-
|
|
1349
|
-
`data` will be the same data argument provided to `getOrCreateRecordIdentifier`
|
|
1350
|
-
and in the `createIdentifierForNewRecord` case will be an object with
|
|
1351
|
-
only `type` as a key.
|
|
1352
|
-
|
|
1353
|
-
```ts
|
|
1354
|
-
import { setIdentifierGenerationMethod } from '@warp-drive/core';
|
|
1355
|
-
|
|
1356
|
-
export function initialize(applicationInstance) {
|
|
1357
|
-
// note how `count` here is now scoped to the application instance
|
|
1358
|
-
// for our generation method by being inside the closure provided
|
|
1359
|
-
// by the initialize function
|
|
1360
|
-
let count = 0;
|
|
1361
|
-
|
|
1362
|
-
setIdentifierGenerationMethod((resource, bucket) => {
|
|
1363
|
-
return resource.lid || `my-key-${count++}`;
|
|
1364
|
-
});
|
|
1365
|
-
}
|
|
1366
|
-
|
|
1367
|
-
export default {
|
|
1368
|
-
name: 'configure-ember-data-identifiers',
|
|
1369
|
-
initialize
|
|
1370
|
-
};
|
|
1371
|
-
```
|
|
1372
|
-
|
|
1373
|
-
### Document Identity
|
|
1374
|
-
|
|
1375
|
-
If the bucket is `document` the method will receive the associated
|
|
1376
|
-
immutable `request` passed to `store.request` as its first argument
|
|
1377
|
-
and should return a unique string for the given request if the document
|
|
1378
|
-
should be cached, and `null` if it should not be cached.
|
|
1379
|
-
|
|
1380
|
-
Note, the request result will still be passed to the cache via `Cache.put`,
|
|
1381
|
-
but caches should take this as a signal that the document should not itself
|
|
1382
|
-
be cached, while its contents may still be used to update other cache state.
|
|
1383
|
-
|
|
1384
|
-
The presence of `cacheOptions.key` on the request will take precedence
|
|
1385
|
-
for the document cache key, and this method will not be called if it is
|
|
1386
|
-
present.
|
|
1387
|
-
|
|
1388
|
-
The default method implementation for this bucket is to return `null`
|
|
1389
|
-
for all requests whose method is not `GET`, and to return the `url` for
|
|
1390
|
-
those where it is.
|
|
1391
|
-
|
|
1392
|
-
This means that queries via `POST` MUST provide `cacheOptions.key` or
|
|
1393
|
-
implement this hook.
|
|
1394
|
-
|
|
1395
|
-
⚠️ Caution: Requests that do not have a `method` assigned are assumed to be `GET`
|
|
1396
|
-
|
|
1397
|
-
@public
|
|
1398
|
-
*/
|
|
1399
|
-
declare function setIdentifierGenerationMethod(method: GenerationMethod | null): void;
|
|
1400
|
-
/**
|
|
1401
|
-
Configure a callback for when the identifier cache encounters new resource
|
|
1402
|
-
data for an existing resource.
|
|
1403
|
-
|
|
1404
|
-
This configuration MUST occur prior to the store instance being created.
|
|
1405
|
-
|
|
1406
|
-
```js
|
|
1407
|
-
import { setIdentifierUpdateMethod } from '@warp-drive/core';
|
|
1408
|
-
```
|
|
1409
|
-
|
|
1410
|
-
Takes a method which can expect to receive an existing `Identifier` alongside
|
|
1411
|
-
some new data to consider as a second argument. This is an opportunity
|
|
1412
|
-
for secondary lookup tables and caches associated with the identifier
|
|
1413
|
-
to be amended.
|
|
1414
|
-
|
|
1415
|
-
This method is called everytime `updateRecordIdentifier` is called and
|
|
1416
|
-
with the same arguments. It provides the opportunity to update secondary
|
|
1417
|
-
lookup tables for existing identifiers.
|
|
1418
|
-
|
|
1419
|
-
It will always be called after an identifier created with `createIdentifierForNewRecord`
|
|
1420
|
-
has been committed, or after an update to the `record` a `RecordIdentifier`
|
|
1421
|
-
is assigned to has been committed. Committed here meaning that the server
|
|
1422
|
-
has acknowledged the update (for instance after a call to `.save()`)
|
|
1423
|
-
|
|
1424
|
-
If `id` has not previously existed, it will be assigned to the `Identifier`
|
|
1425
|
-
prior to this `UpdateMethod` being called; however, calls to the parent method
|
|
1426
|
-
`updateRecordIdentifier` that attempt to change the `id` or calling update
|
|
1427
|
-
without providing an `id` when one is missing will throw an error.
|
|
1428
|
-
|
|
1429
|
-
@public
|
|
1430
|
-
*/
|
|
1431
|
-
declare function setIdentifierUpdateMethod(method: UpdateMethod | null): void;
|
|
1432
|
-
/**
|
|
1433
|
-
Configure a callback for when the identifier cache is going to release an identifier.
|
|
1434
|
-
|
|
1435
|
-
This configuration MUST occur prior to the store instance being created.
|
|
1436
|
-
|
|
1437
|
-
```js
|
|
1438
|
-
import { setIdentifierForgetMethod } from '@warp-drive/core';
|
|
1439
|
-
```
|
|
1440
|
-
|
|
1441
|
-
Takes method which can expect to receive an existing `Identifier` that should be eliminated
|
|
1442
|
-
from any secondary lookup tables or caches that the user has populated for it.
|
|
1443
|
-
|
|
1444
|
-
@public
|
|
1445
|
-
*/
|
|
1446
|
-
declare function setIdentifierForgetMethod(method: ForgetMethod | null): void;
|
|
1447
|
-
/**
|
|
1448
|
-
Configure a callback for when the identifier cache is being torn down.
|
|
1449
|
-
|
|
1450
|
-
This configuration MUST occur prior to the store instance being created.
|
|
1451
|
-
|
|
1452
|
-
```js
|
|
1453
|
-
import { setIdentifierResetMethod } from '@warp-drive/core';
|
|
1454
|
-
```
|
|
1455
|
-
|
|
1456
|
-
Takes a method which can expect to be called when the parent application is destroyed.
|
|
1457
|
-
|
|
1458
|
-
If you have properly used a WeakMap to encapsulate the state of your customization
|
|
1459
|
-
to the application instance, you may not need to implement the `resetMethod`.
|
|
1460
|
-
|
|
1461
|
-
@public
|
|
1462
|
-
*/
|
|
1463
|
-
declare function setIdentifierResetMethod(method: ResetMethod | null): void;
|
|
1464
|
-
/**
|
|
1465
|
-
Configure a callback for when the identifier cache is generating a new
|
|
1466
|
-
ResourceKey for a resource.
|
|
1467
|
-
|
|
1468
|
-
This method controls the `type` and `id` that will be assigned to the
|
|
1469
|
-
`ResourceKey` that is created.
|
|
1470
|
-
|
|
1471
|
-
This configuration MUST occur prior to the store instance being created.
|
|
1472
|
-
|
|
1473
|
-
```js
|
|
1474
|
-
import { setKeyInfoForResource } from '@warp-drive/core';
|
|
1475
|
-
```
|
|
1476
|
-
|
|
1477
|
-
@public
|
|
1478
|
-
*/
|
|
1479
|
-
declare function setKeyInfoForResource(method: KeyInfoMethod | null): void;
|
|
1480
|
-
/**
|
|
1481
|
-
* Each instance of {@link Store} receives a unique instance of a CacheKeyManager.
|
|
1482
|
-
*
|
|
1483
|
-
* This cache is responsible for assigning or retrieving the unique identify
|
|
1484
|
-
* for arbitrary resource data encountered by the store. Data representing
|
|
1485
|
-
* a unique resource or record should always be represented by the same
|
|
1486
|
-
* identifier.
|
|
1487
|
-
*
|
|
1488
|
-
* It can be configured by consuming applications.
|
|
1489
|
-
*
|
|
1490
|
-
* @hideconstructor
|
|
1491
|
-
* @public
|
|
1492
|
-
*/
|
|
1493
|
-
declare class CacheKeyManager {
|
|
1494
|
-
constructor();
|
|
1495
|
-
/**
|
|
1496
|
-
* allows us to peek without generating when needed
|
|
1497
|
-
* useful for the "create" case when we need to see if
|
|
1498
|
-
* we are accidentally overwritting something
|
|
1499
|
-
*
|
|
1500
|
-
* @private
|
|
1501
|
-
*/
|
|
1502
|
-
peekResourceKey(resource: ResourceIdentifierObject): ResourceKey | undefined;
|
|
1503
|
-
/**
|
|
1504
|
-
* Peeks the {@link RequestKey} for the given {@link RequestInfo}, but will not
|
|
1505
|
-
* create one if none has been previously generated.
|
|
1506
|
-
*
|
|
1507
|
-
* @public
|
|
1508
|
-
*/
|
|
1509
|
-
peekRequestKey(request: RequestInfo): RequestKey | null;
|
|
1510
|
-
/**
|
|
1511
|
-
* Returns the {@link RequestKey} for the given {@link RequestInfo} if the request is
|
|
1512
|
-
* considered cacheable. For cacheable requests, this method will create
|
|
1513
|
-
* a RequestKey if none is found.
|
|
1514
|
-
*
|
|
1515
|
-
* A `null` response indicates the request cannot/will not be cached,
|
|
1516
|
-
* generally this means either
|
|
1517
|
-
*
|
|
1518
|
-
* - {@link RequestInfo.cacheOptions.key} is not present on the `RequestInfo`
|
|
1519
|
-
* - the request's method is `GET` but it has no `url`
|
|
1520
|
-
*
|
|
1521
|
-
* Generally you should not seek to cache requests that are not idempotent
|
|
1522
|
-
* or have side effects, such as mutations that create, update or delete
|
|
1523
|
-
* a resource.
|
|
1524
|
-
*
|
|
1525
|
-
* @public
|
|
1526
|
-
*/
|
|
1527
|
-
getOrCreateDocumentIdentifier(request: RequestInfo): RequestKey | null;
|
|
1528
|
-
/**
|
|
1529
|
-
Returns the {@link ResourceKey} for the given Resource, creates one if it does not yet exist.
|
|
1530
|
-
|
|
1531
|
-
Specifically this means that we:
|
|
1532
|
-
|
|
1533
|
-
- validate the `id` `type` and `lid` combo against known identifiers
|
|
1534
|
-
- return an object with an `lid` that is stable (repeated calls with the same
|
|
1535
|
-
`id` + `type` or `lid` will return the same `lid` value)
|
|
1536
|
-
- this referential stability of the object itself is guaranteed
|
|
1537
|
-
|
|
1538
|
-
@public
|
|
1539
|
-
*/
|
|
1540
|
-
getOrCreateRecordIdentifier<T>(resource: T): NarrowIdentifierIfPossible<T>;
|
|
1541
|
-
/**
|
|
1542
|
-
Returns a new Identifier for the supplied data. Call this method to generate
|
|
1543
|
-
an identifier when a new resource is being created local to the client and
|
|
1544
|
-
potentially does not have an `id`.
|
|
1545
|
-
|
|
1546
|
-
Delegates generation to the user supplied `GenerateMethod` if one has been provided
|
|
1547
|
-
with the signature `generateMethod({ type }, 'record')`.
|
|
1548
|
-
|
|
1549
|
-
@public
|
|
1550
|
-
*/
|
|
1551
|
-
createIdentifierForNewRecord(data: {
|
|
1552
|
-
type: string;
|
|
1553
|
-
id?: string | null;
|
|
1554
|
-
lid?: string;
|
|
1555
|
-
}): ResourceKey;
|
|
1556
|
-
/**
|
|
1557
|
-
Provides the opportunity to update secondary lookup tables for existing identifiers
|
|
1558
|
-
Called after an identifier created with `createIdentifierForNewRecord` has been
|
|
1559
|
-
committed.
|
|
1560
|
-
|
|
1561
|
-
Assigned `id` to an `Identifier` if `id` has not previously existed; however,
|
|
1562
|
-
attempting to change the `id` or calling update without providing an `id` when
|
|
1563
|
-
one is missing will throw an error.
|
|
1564
|
-
|
|
1565
|
-
- sets `id` (if `id` was previously `null`)
|
|
1566
|
-
- `lid` and `type` MUST NOT be altered post creation
|
|
1567
|
-
|
|
1568
|
-
If a merge occurs, it is possible the returned identifier does not match the originally
|
|
1569
|
-
provided identifier. In this case the abandoned identifier will go through the usual
|
|
1570
|
-
`forgetRecordIdentifier` codepaths.
|
|
1571
|
-
|
|
1572
|
-
@public
|
|
1573
|
-
*/
|
|
1574
|
-
updateRecordIdentifier(identifierObject: ResourceKey, data: unknown): ResourceKey;
|
|
1575
|
-
/**
|
|
1576
|
-
Provides the opportunity to eliminate an identifier from secondary lookup tables
|
|
1577
|
-
as well as eliminates it from ember-data's own lookup tables and book keeping.
|
|
1578
|
-
|
|
1579
|
-
Useful when a record has been deleted and the deletion has been persisted and
|
|
1580
|
-
we do not care about the record anymore. Especially useful when an `id` of a
|
|
1581
|
-
deleted record might be reused later for a new record.
|
|
1582
|
-
|
|
1583
|
-
@public
|
|
1584
|
-
*/
|
|
1585
|
-
forgetRecordIdentifier(identifierObject: ResourceKey): void;
|
|
1586
|
-
}
|
|
1587
|
-
/**
|
|
1588
|
-
* This type exists for internal use only for
|
|
1589
|
-
* where intimate contracts still exist either for
|
|
1590
|
-
* the Test Suite or for Legacy code.
|
|
1591
|
-
*
|
|
1592
|
-
* @private
|
|
1593
|
-
*/
|
|
1594
|
-
interface PrivateCacheKeyManager extends CacheKeyManager {
|
|
1595
|
-
_cache: StableCache;
|
|
1596
|
-
/**
|
|
1597
|
-
* Internal hook to allow management of merge conflicts with identifiers.
|
|
1598
|
-
*
|
|
1599
|
-
* we allow late binding of this private internal merge so that
|
|
1600
|
-
* the cache can insert itself here to handle elimination of duplicates
|
|
1601
|
-
*/
|
|
1602
|
-
__configureMerge(method: MergeMethod | null): void;
|
|
1603
|
-
_mergeRecordIdentifiers(keyInfo: KeyInfo, identifier: ResourceKey, existingIdentifier: ResourceKey, data: unknown): ResourceKey;
|
|
1604
|
-
destroy(): void;
|
|
1605
|
-
}
|
|
1606
|
-
//#endregion
|
|
1607
|
-
//#region src/store/-private/managers/notification-manager.d.ts
|
|
1608
|
-
type UnsubscribeToken$1 = object;
|
|
1609
|
-
/**
|
|
1610
|
-
* The kinds of change notifications the {@link NotificationManager} can emit for a resource.
|
|
1611
|
-
*/
|
|
1612
|
-
type CacheOperation$1 = "added" | "removed" | "updated" | "state";
|
|
1613
|
-
/**
|
|
1614
|
-
* The kinds of change notifications the {@link NotificationManager} can emit for a request document.
|
|
1615
|
-
*/
|
|
1616
|
-
type DocumentCacheOperation$1 = "invalidated" | "added" | "removed" | "updated" | "state";
|
|
1617
|
-
/**
|
|
1618
|
-
* The full set of notification kinds the {@link NotificationManager} can emit for a resource,
|
|
1619
|
-
* including both {@link CacheOperation}s and finer-grained field-level change notifications.
|
|
1620
|
-
*/
|
|
1621
|
-
type NotificationType = "attributes" | "relationships" | "identity" | "errors" | "meta" | CacheOperation$1;
|
|
1622
|
-
/**
|
|
1623
|
-
* The shape accepted by {@link NotificationManager.notify} and
|
|
1624
|
-
* {@link CacheCapabilitiesManager.notifyChange} for delivering many keys for
|
|
1625
|
-
* the `'attributes'` or `'relationships'` namespaces in a single call
|
|
1626
|
-
* instead of once per key.
|
|
1627
|
-
*
|
|
1628
|
-
* @since 5.9.0
|
|
1629
|
-
* @public
|
|
1630
|
-
*/
|
|
1631
|
-
type NotifyKeys = Set<string>;
|
|
1632
|
-
/**
|
|
1633
|
-
* A change to a resource's `attributes` or `relationships` can be relevant to
|
|
1634
|
-
* a "local" view of the resource (its mutable/editable state), a "remote" view
|
|
1635
|
-
* (its last-known-persisted state), or both.
|
|
1636
|
-
*
|
|
1637
|
-
* Each view subscribes to its own channel and, when notified, re-pulls its own
|
|
1638
|
-
* projection of the data: a remote-only reader (e.g. PolarisMode's default
|
|
1639
|
-
* immutable record) subscribes `'remote'` and re-reads remote state; an
|
|
1640
|
-
* editable/reconciled reader (a legacy record, or an editable checkout)
|
|
1641
|
-
* subscribes `'local'` (the same as omitting the channel) and re-reads local
|
|
1642
|
-
* state. A notifier that knows which projection changed tags the notification
|
|
1643
|
-
* with that channel; each tag is delivered only to that channel's subscribers.
|
|
1644
|
-
* A change affecting both projections is either notified unscoped or once per
|
|
1645
|
-
* channel. An unscoped notify cannot guarantee which view changed, so it
|
|
1646
|
-
* reaches every subscriber -- this keeps every pre-channel `notify` callsite
|
|
1647
|
-
* (and any custom cache that doesn't know about channels) fully compatible.
|
|
1648
|
-
*
|
|
1649
|
-
* The full delivery matrix:
|
|
1650
|
-
*
|
|
1651
|
-
* | notify ↓ subscribe → | `'local'` | `'remote'` | omitted (= `'local'`) |
|
|
1652
|
-
* | -------------------- | --------- | ---------- | --------------------- |
|
|
1653
|
-
* | `'local'` | ✅ | ❌ | ✅ |
|
|
1654
|
-
* | `'remote'` | ❌ | ✅ | ❌ |
|
|
1655
|
-
* | omitted | ✅ | ✅ | ✅ |
|
|
1656
|
-
*
|
|
1657
|
-
* Channel only applies to the `'attributes'` and `'relationships'`
|
|
1658
|
-
* notification types. All other types (`'errors'`,
|
|
1659
|
-
* `'identity'`, `'state'`, and the various `CacheOperation`/
|
|
1660
|
-
* `DocumentCacheOperation` values) are never filtered by channel since they
|
|
1661
|
-
* have no local/remote duality.
|
|
1662
|
-
*
|
|
1663
|
-
* @public
|
|
1664
|
-
*/
|
|
1665
|
-
type NotificationChannel = "local" | "remote";
|
|
1666
|
-
interface NotificationCallback$1 {
|
|
1667
|
-
(cacheKey: ResourceKey, notificationType: "attributes" | "relationships", key?: string): void;
|
|
1668
|
-
(cacheKey: ResourceKey, notificationType: "errors" | "meta" | "identity" | "state"): void;
|
|
1669
|
-
(cacheKey: ResourceKey, notificationType: CacheOperation$1): void;
|
|
1670
|
-
}
|
|
1671
|
-
interface ResourceOperationCallback$1 {
|
|
1672
|
-
(cacheKey: ResourceKey, notificationType: CacheOperation$1): void;
|
|
1673
|
-
}
|
|
1674
|
-
interface DocumentOperationCallback$1 {
|
|
1675
|
-
(cacheKey: RequestKey, notificationType: DocumentCacheOperation$1): void;
|
|
1676
|
-
}
|
|
1677
|
-
/**
|
|
1678
|
-
* The NotificationManager provides the ability to subscribe to
|
|
1679
|
-
* changes to Cache state.
|
|
1680
|
-
*
|
|
1681
|
-
* This Feature is what allows WarpDrive to create subscriptions that
|
|
1682
|
-
* work with any framework or change-notification system.
|
|
1683
|
-
*
|
|
1684
|
-
* @hideconstructor
|
|
1685
|
-
* @public
|
|
1686
|
-
*/
|
|
1687
|
-
declare class NotificationManager$1 {
|
|
1688
|
-
constructor(store: Store$1);
|
|
1689
|
-
/**
|
|
1690
|
-
* Subscribe to changes for a given ResourceKey, RequestKey, or addition/removal of any resource
|
|
1691
|
-
* or document.
|
|
1692
|
-
*
|
|
1693
|
-
* ```ts
|
|
1694
|
-
* export type CacheOperation = 'added' | 'removed' | 'updated' | 'state';
|
|
1695
|
-
*
|
|
1696
|
-
* export interface NotificationCallback {
|
|
1697
|
-
* (cacheKey: ResourceKey, notificationType: 'attributes' | 'relationships', key?: string): void;
|
|
1698
|
-
* (cacheKey: ResourceKey, notificationType: 'errors' | 'meta' | 'identity' | 'state'): void;
|
|
1699
|
-
* (cacheKey: ResourceKey, notificationType: NotificationType, key?: string): void;
|
|
1700
|
-
* }
|
|
1701
|
-
* export interface ResourceOperationCallback {
|
|
1702
|
-
* // resource updates
|
|
1703
|
-
* (cacheKey: ResourceKey, notificationType: CacheOperation): void;
|
|
1704
|
-
* }
|
|
1705
|
-
* export interface DocumentOperationCallback {
|
|
1706
|
-
* // document updates
|
|
1707
|
-
* (cacheKey: RequestKey, notificationType: CacheOperation): void;
|
|
1708
|
-
* }
|
|
1709
|
-
* ```
|
|
1710
|
-
*
|
|
1711
|
-
* A `channel` may be provided when subscribing to a `ResourceKey`. Its
|
|
1712
|
-
* effect is that the subscription skips `'attributes'`/`'relationships'`
|
|
1713
|
-
* notifications explicitly tagged with the *other* channel; unscoped
|
|
1714
|
-
* notifications, and notifications for all other notification types, always
|
|
1715
|
-
* reach the subscriber. Subscribing `'local'` and omitting the channel are
|
|
1716
|
-
* the same thing. See {@link NotificationChannel}.
|
|
1717
|
-
*
|
|
1718
|
-
* | notify ↓ subscribe → | `'local'` | `'remote'` | omitted (= `'local'`) |
|
|
1719
|
-
* | -------------------- | --------- | ---------- | --------------------- |
|
|
1720
|
-
* | `'local'` | ✅ | ❌ | ✅ |
|
|
1721
|
-
* | `'remote'` | ❌ | ✅ | ❌ |
|
|
1722
|
-
* | omitted | ✅ | ✅ | ✅ |
|
|
1723
|
-
*
|
|
1724
|
-
* @public
|
|
1725
|
-
* @return an opaque token to be used with unsubscribe
|
|
1726
|
-
*/
|
|
1727
|
-
subscribe(cacheKey: ResourceKey, callback: NotificationCallback$1, channel?: NotificationChannel): UnsubscribeToken$1;
|
|
1728
|
-
subscribe(cacheKey: "resource", callback: ResourceOperationCallback$1): UnsubscribeToken$1;
|
|
1729
|
-
subscribe(cacheKey: "document" | RequestKey, callback: DocumentOperationCallback$1): UnsubscribeToken$1;
|
|
1730
|
-
/**
|
|
1731
|
-
* remove a previous subscription
|
|
1732
|
-
*
|
|
1733
|
-
* @public
|
|
1734
|
-
*/
|
|
1735
|
-
unsubscribe(token: UnsubscribeToken$1): void;
|
|
1736
|
-
/**
|
|
1737
|
-
* Custom Caches and Application Code should not call this method directly.
|
|
1738
|
-
*
|
|
1739
|
-
* When notifying `'attributes'` or `'relationships'` for many keys on the
|
|
1740
|
-
* same `cacheKey` at once (for instance, when a bulk update to a single
|
|
1741
|
-
* record touches many fields) `key` may be supplied as a `Set<string>`
|
|
1742
|
-
* instead of being called once per key. The `Set` is iterated as-is (it is
|
|
1743
|
-
* never converted to or from an array internally). This delivers the
|
|
1744
|
-
* exact same sequence of individual notifications to subscribers (each
|
|
1745
|
-
* subscriber callback is still invoked once per key, in order) while
|
|
1746
|
-
* paying the per-call overhead (validity checks, subscriber lookups,
|
|
1747
|
-
* buffer/flush scheduling) only once for the whole batch instead of once
|
|
1748
|
-
* per key.
|
|
1749
|
-
*
|
|
1750
|
-
* A `channel` may be supplied for the `'attributes'`/`'relationships'`
|
|
1751
|
-
* namespaces. Tagging a notification `'local'` declares "only the local
|
|
1752
|
-
* (reconciled/editable) view changed"; tagging it `'remote'` declares "only
|
|
1753
|
-
* the remote view changed". Each tag is delivered only to that channel's
|
|
1754
|
-
* subscribers. Omitting the channel reaches every subscriber regardless of
|
|
1755
|
-
* its channel. See {@link NotificationChannel}.
|
|
1756
|
-
*
|
|
1757
|
-
* | notify ↓ subscribe → | `'local'` | `'remote'` | omitted (= `'local'`) |
|
|
1758
|
-
* | -------------------- | --------- | ---------- | --------------------- |
|
|
1759
|
-
* | `'local'` | ✅ | ❌ | ✅ |
|
|
1760
|
-
* | `'remote'` | ❌ | ✅ | ❌ |
|
|
1761
|
-
* | omitted | ✅ | ✅ | ✅ |
|
|
1762
|
-
*
|
|
1763
|
-
* @private
|
|
1764
|
-
*/
|
|
1765
|
-
notify(cacheKey: ResourceKey, value: "attributes" | "relationships", key?: string | NotifyKeys | null, channel?: NotificationChannel): boolean;
|
|
1766
|
-
notify(cacheKey: ResourceKey, value: "errors" | "meta" | "identity" | "state", key?: null): boolean;
|
|
1767
|
-
notify(cacheKey: ResourceKey, value: CacheOperation$1, key?: null): boolean;
|
|
1768
|
-
notify(cacheKey: RequestKey, value: DocumentCacheOperation$1, key?: null): boolean;
|
|
1769
|
-
}
|
|
1770
|
-
/**
|
|
1771
|
-
* This type exists for internal use only for
|
|
1772
|
-
* where intimate contracts still exist either for
|
|
1773
|
-
* the Test Suite or for Legacy code.
|
|
1774
|
-
*
|
|
1775
|
-
* @private
|
|
1776
|
-
*/
|
|
1777
|
-
interface PrivateNotificationManager extends NotificationManager$1 {
|
|
1778
|
-
_flush(): void;
|
|
1779
|
-
}
|
|
1780
|
-
//#endregion
|
|
1781
1298
|
//#region src/store/deprecated/-private.d.ts
|
|
1782
1299
|
interface BaseFinderOptions$1 {
|
|
1783
1300
|
reload?: boolean;
|
|
@@ -2521,312 +2038,820 @@ interface SchemaService {
|
|
|
2521
2038
|
* Queries whether the SchemaService recognizes `type` as a resource type
|
|
2522
2039
|
*
|
|
2523
2040
|
* @public
|
|
2524
|
-
* @deprecated - use {@link SchemaService.hasResource | hasResource}
|
|
2041
|
+
* @deprecated - use {@link SchemaService.hasResource | hasResource}
|
|
2042
|
+
*/
|
|
2043
|
+
doesTypeExist?(type: string): boolean;
|
|
2044
|
+
/**
|
|
2045
|
+
* Queries whether the SchemaService recognizes `type` as a resource type
|
|
2046
|
+
*
|
|
2047
|
+
* @public
|
|
2048
|
+
*/
|
|
2049
|
+
hasResource(resource: ObjectWithStringTypeProperty | ResourceKey): boolean;
|
|
2050
|
+
/**
|
|
2051
|
+
* Queries whether the SchemaService recognizes `type` as a resource trait
|
|
2052
|
+
*
|
|
2053
|
+
* @public
|
|
2054
|
+
*/
|
|
2055
|
+
hasTrait(type: string): boolean;
|
|
2056
|
+
/**
|
|
2057
|
+
* Queries whether the given resource has the given trait
|
|
2058
|
+
*
|
|
2059
|
+
* @public
|
|
2060
|
+
*/
|
|
2061
|
+
resourceHasTrait(resource: ObjectWithStringTypeProperty | ResourceKey, trait: string): boolean;
|
|
2062
|
+
/**
|
|
2063
|
+
* Queries for the fields of a given resource type or resource identity.
|
|
2064
|
+
*
|
|
2065
|
+
* Should error if the resource type is not recognized.
|
|
2066
|
+
*
|
|
2067
|
+
* @public
|
|
2068
|
+
*/
|
|
2069
|
+
fields(resource: ObjectWithStringTypeProperty | ResourceKey): Map<string, FieldSchema>;
|
|
2070
|
+
/**
|
|
2071
|
+
* Queries for the fields of a given resource type or resource identity.
|
|
2072
|
+
*
|
|
2073
|
+
* Should error if the resource type is not recognized.
|
|
2074
|
+
*
|
|
2075
|
+
* @public
|
|
2076
|
+
*/
|
|
2077
|
+
cacheFields?(resource: ObjectWithStringTypeProperty | ResourceKey): Map<string, Exclude<CacheableFieldSchema, IdentityField>>;
|
|
2078
|
+
/**
|
|
2079
|
+
* Returns the transformation registered with the name provided
|
|
2080
|
+
* by `field.type`. Validates that the field is a valid transformable.
|
|
2081
|
+
*
|
|
2082
|
+
* @public
|
|
2083
|
+
*/
|
|
2084
|
+
transformation(field: GenericField | ObjectField | ArrayField | ObjectWithStringTypeProperty): Transformation$1;
|
|
2085
|
+
/**
|
|
2086
|
+
* Returns the hash function registered with the name provided
|
|
2087
|
+
* by `field.type`. Validates that the field is a valid HashField.
|
|
2088
|
+
*
|
|
2089
|
+
* @public
|
|
2090
|
+
*/
|
|
2091
|
+
hashFn(field: HashField | ObjectWithStringTypeProperty): HashFn;
|
|
2092
|
+
/**
|
|
2093
|
+
* Returns the derivation registered with the name provided
|
|
2094
|
+
* by `field.type`. Validates that the field is a valid DerivedField.
|
|
2095
|
+
*
|
|
2096
|
+
* @public
|
|
2097
|
+
*/
|
|
2098
|
+
derivation(field: DerivedField | ObjectWithStringTypeProperty): Derivation;
|
|
2099
|
+
/**
|
|
2100
|
+
* Returns the schema for the provided resource type.
|
|
2101
|
+
*
|
|
2102
|
+
* @public
|
|
2103
|
+
*/
|
|
2104
|
+
resource(resource: ObjectWithStringTypeProperty | ResourceKey): Schema;
|
|
2105
|
+
/**
|
|
2106
|
+
* Enables registration of multiple Schemas at once.
|
|
2107
|
+
*
|
|
2108
|
+
* This can be useful for either pre-loading schema information
|
|
2109
|
+
* or for registering schema information delivered by API calls
|
|
2110
|
+
* or other sources just-in-time.
|
|
2111
|
+
*
|
|
2112
|
+
* @public
|
|
2113
|
+
*/
|
|
2114
|
+
registerResources(schemas: Schema[]): void;
|
|
2115
|
+
/**
|
|
2116
|
+
* Enables registration of a single Schema representing either
|
|
2117
|
+
* a resource in PolarisMode or LegacyMode or an ObjectSchema
|
|
2118
|
+
* representing an embedded structure in other schemas.
|
|
2119
|
+
*
|
|
2120
|
+
* This can be useful for either pre-loading schema information
|
|
2121
|
+
* or for registering schema information delivered by API calls
|
|
2122
|
+
* or other sources just-in-time.
|
|
2123
|
+
*
|
|
2124
|
+
* @public
|
|
2125
|
+
*/
|
|
2126
|
+
registerResource(schema: Schema): void;
|
|
2127
|
+
/**
|
|
2128
|
+
* Enables registration of a transformation.
|
|
2129
|
+
*
|
|
2130
|
+
* The transformation can later be retrieved by the name
|
|
2131
|
+
* attached to it's `[Type]` property.
|
|
2132
|
+
*
|
|
2133
|
+
* @public
|
|
2134
|
+
*/
|
|
2135
|
+
registerTransformation(transform: Transformation$1): void;
|
|
2136
|
+
/**
|
|
2137
|
+
* Enables registration of a derivation.
|
|
2138
|
+
*
|
|
2139
|
+
* The derivation can later be retrieved by the name
|
|
2140
|
+
* attached to it's `[Type]` property.
|
|
2141
|
+
*
|
|
2142
|
+
* @public
|
|
2143
|
+
*/
|
|
2144
|
+
registerDerivation<R, T, FM extends ObjectValue | null>(derivation: Derivation<R, T, FM>): void;
|
|
2145
|
+
/**
|
|
2146
|
+
* Enables registration of a hashing function
|
|
2147
|
+
*
|
|
2148
|
+
* The hashing function can later be retrieved by the name
|
|
2149
|
+
* attached to it's `[Type]` property.
|
|
2150
|
+
*
|
|
2151
|
+
* @public
|
|
2152
|
+
*/
|
|
2153
|
+
registerHashFn(hashFn: HashFn): void;
|
|
2154
|
+
/**
|
|
2155
|
+
* Registers a {@link Trait} for use by resource schemas.
|
|
2156
|
+
*
|
|
2157
|
+
* Traits are re-usable collections of fields that can be composed to
|
|
2158
|
+
* build up a resource schema. Often they represent polymorphic behaviors
|
|
2159
|
+
* a resource should exhibit.
|
|
2160
|
+
*
|
|
2161
|
+
* When we finalize a resource, we walk its traits and apply their fields
|
|
2162
|
+
* to the resource's fields. All specified traits must be registered by
|
|
2163
|
+
* this time or an error will be thrown.
|
|
2164
|
+
*
|
|
2165
|
+
* Traits are applied left-to-right, with traits of traits being applied in the same
|
|
2166
|
+
* way. Thus for the most part, application of traits is a post-order graph traversal
|
|
2167
|
+
* problem.
|
|
2168
|
+
*
|
|
2169
|
+
* A trait is only ever processed once. If multiple traits (A, B, C) have the same
|
|
2170
|
+
* trait (D) as a dependency, D will be included only once when first encountered by
|
|
2171
|
+
* A.
|
|
2172
|
+
*
|
|
2173
|
+
* If a cycle exists such that trait A has trait B which has Trait A, trait A will
|
|
2174
|
+
* be applied *after* trait B in production. In development a cycle error will be thrown.
|
|
2175
|
+
*
|
|
2176
|
+
* Fields are finalized on a "last wins principle". Thus traits appearing higher in
|
|
2177
|
+
* the tree and further to the right of a traits array take precedence, with the
|
|
2178
|
+
* resource's fields always being applied last and winning out.
|
|
2179
|
+
*
|
|
2180
|
+
* @public
|
|
2181
|
+
*/
|
|
2182
|
+
registerTrait?(trait: Trait): void;
|
|
2183
|
+
/**
|
|
2184
|
+
* DEPRECATED - use `fields` instead
|
|
2185
|
+
*
|
|
2186
|
+
* Returns definitions for all properties of the specified resource
|
|
2187
|
+
* that are considered "attributes". Generally these are properties
|
|
2188
|
+
* that are not related to book-keeping state on the client and do
|
|
2189
|
+
* not represent a linkage to another resource.
|
|
2190
|
+
*
|
|
2191
|
+
* The return value should be a dictionary of key:value pairs
|
|
2192
|
+
* where the `key` is the attribute or property's name and `value`
|
|
2193
|
+
* is an object with at least the property `name` which should also
|
|
2194
|
+
* match `key`.
|
|
2195
|
+
*
|
|
2196
|
+
* Optionally, this object may also specify `type`, which should
|
|
2197
|
+
* be a string reference to a `transform`, and `options` which
|
|
2198
|
+
* should be dictionary in which any key:value pairs are permissable.
|
|
2199
|
+
*
|
|
2200
|
+
* For instance, when using `@warp-drive/legacy/model`, the following attribute
|
|
2201
|
+
* definition:
|
|
2202
|
+
*
|
|
2203
|
+
* ```ts
|
|
2204
|
+
* class extends Model {
|
|
2205
|
+
* @attr('string', { defaultValue: 'hello' }) greeting;
|
|
2206
|
+
* @attr('date') birthday;
|
|
2207
|
+
* @attr firstName;
|
|
2208
|
+
* }
|
|
2209
|
+
* ```
|
|
2210
|
+
*
|
|
2211
|
+
* Would be returned as:
|
|
2212
|
+
*
|
|
2213
|
+
* ```js
|
|
2214
|
+
* {
|
|
2215
|
+
* greeting: { name: 'greeting', type: 'string', options: { defaultValue: 'hello' } },
|
|
2216
|
+
* birthday: { name: 'birthday', type: 'date' },
|
|
2217
|
+
* firstName: { name: 'firstName' }
|
|
2218
|
+
* }
|
|
2219
|
+
* ```
|
|
2220
|
+
*
|
|
2221
|
+
* @public
|
|
2222
|
+
* @deprecated - use {@link SchemaService.fields | fields}
|
|
2223
|
+
*/
|
|
2224
|
+
attributesDefinitionFor?(key: ResourceKey | ObjectWithStringTypeProperty): AttributesSchema;
|
|
2225
|
+
/**
|
|
2226
|
+
* DEPRECATED - use `fields` instead
|
|
2227
|
+
*
|
|
2228
|
+
* Returns definitions for all properties of the specified resource
|
|
2229
|
+
* that are considered "relationships". Generally these are properties
|
|
2230
|
+
* that represent a linkage to another resource.
|
|
2231
|
+
*
|
|
2232
|
+
* The return value should be a dictionary of key:value pairs
|
|
2233
|
+
* where the `key` is the relationship or property's name and `value`
|
|
2234
|
+
* is an object with at least the following properties:
|
|
2235
|
+
*
|
|
2236
|
+
* - `name` which should also match the `key` used in the dictionary.
|
|
2237
|
+
* - `kind` which should be either `belongsTo` or `hasMany`
|
|
2238
|
+
* - `type` which should be the related resource's string "type"
|
|
2239
|
+
* - `options` which should be a dictionary allowing any key but with
|
|
2240
|
+
* at least the below keys present.
|
|
2241
|
+
*
|
|
2242
|
+
* - `options.async` a boolean representing whether data for this relationship is
|
|
2243
|
+
* typically loaded on-demand.
|
|
2244
|
+
* - `options.inverse` a string or null representing the field name / key of the
|
|
2245
|
+
* corresponding relationship on the inverse resource.
|
|
2246
|
+
*
|
|
2247
|
+
* Additionally the following options properties are optional. See [Polymorphic Relationships](https://rfcs.emberjs.com/id/0793-polymporphic-relations-without-inheritance)
|
|
2248
|
+
*
|
|
2249
|
+
* - `options.polymorphic` a boolean representing whether multiple resource types
|
|
2250
|
+
* can be used to satisfy this relationship.
|
|
2251
|
+
* - `options.as` a string representing the abstract type that the concrete side of
|
|
2252
|
+
* a relationship must specify when fulfilling a polymorphic inverse.
|
|
2253
|
+
*
|
|
2254
|
+
* For example, the following Model using @warp-drive/legacy/model would generate this relationships
|
|
2255
|
+
* definition by default:
|
|
2256
|
+
*
|
|
2257
|
+
* ```js
|
|
2258
|
+
* class User extends Model {
|
|
2259
|
+
* @belongsTo('user', { async: false, inverse: null }) bestFriend;
|
|
2260
|
+
* @hasMany('user', { async: true, inverse: 'friends' }) friends;
|
|
2261
|
+
* @hasMany('pet', { async: false, polymorphic: true, inverse: 'owner' }) pets;
|
|
2262
|
+
* }
|
|
2263
|
+
* ```
|
|
2264
|
+
*
|
|
2265
|
+
* Which would be returned as
|
|
2266
|
+
*
|
|
2267
|
+
* ```js
|
|
2268
|
+
* {
|
|
2269
|
+
* bestFriend: {
|
|
2270
|
+
* name: 'bestFriend',
|
|
2271
|
+
* kind: 'belongsTo',
|
|
2272
|
+
* type: 'user',
|
|
2273
|
+
* options: {
|
|
2274
|
+
* async: false,
|
|
2275
|
+
* inverse: null
|
|
2276
|
+
* }
|
|
2277
|
+
* },
|
|
2278
|
+
* friends: {
|
|
2279
|
+
* name: 'friends',
|
|
2280
|
+
* kind: 'hasMany',
|
|
2281
|
+
* type: 'user',
|
|
2282
|
+
* options: {
|
|
2283
|
+
* async: true,
|
|
2284
|
+
* inverse: 'friends'
|
|
2285
|
+
* }
|
|
2286
|
+
* },
|
|
2287
|
+
* pets: {
|
|
2288
|
+
* name: 'pets',
|
|
2289
|
+
* kind: 'hasMany',
|
|
2290
|
+
* type: 'pet',
|
|
2291
|
+
* options: {
|
|
2292
|
+
* async: false,
|
|
2293
|
+
* polymorphic: true,
|
|
2294
|
+
* inverse: 'owner'
|
|
2295
|
+
* }
|
|
2296
|
+
* },
|
|
2297
|
+
* }
|
|
2298
|
+
* ```
|
|
2299
|
+
*
|
|
2300
|
+
* @public
|
|
2301
|
+
* @deprecated - use {@link SchemaService.fields | fields}
|
|
2525
2302
|
*/
|
|
2526
|
-
|
|
2303
|
+
relationshipsDefinitionFor?(key: ResourceKey | ObjectWithStringTypeProperty): RelationshipsSchema;
|
|
2527
2304
|
/**
|
|
2528
|
-
*
|
|
2305
|
+
* Returns all known resource types
|
|
2529
2306
|
*
|
|
2530
2307
|
* @public
|
|
2531
2308
|
*/
|
|
2532
|
-
|
|
2309
|
+
resourceTypes(): Readonly<string[]>;
|
|
2533
2310
|
/**
|
|
2534
|
-
*
|
|
2311
|
+
* Register an extension for either objects or arrays
|
|
2312
|
+
*
|
|
2313
|
+
* See also {@link CAUTION_MEGA_DANGER_ZONE_Extension}
|
|
2535
2314
|
*
|
|
2536
2315
|
* @public
|
|
2537
2316
|
*/
|
|
2538
|
-
|
|
2317
|
+
CAUTION_MEGA_DANGER_ZONE_registerExtension?(extension: CAUTION_MEGA_DANGER_ZONE_Extension): void;
|
|
2539
2318
|
/**
|
|
2540
|
-
*
|
|
2319
|
+
* Retrieve the extension map for a resource
|
|
2541
2320
|
*
|
|
2542
2321
|
* @public
|
|
2543
2322
|
*/
|
|
2544
|
-
|
|
2323
|
+
CAUTION_MEGA_DANGER_ZONE_resourceExtensions?(resource: ResourceKey | {
|
|
2324
|
+
type: string;
|
|
2325
|
+
}): null | ProcessedExtension["features"];
|
|
2545
2326
|
/**
|
|
2546
|
-
*
|
|
2547
|
-
*
|
|
2548
|
-
* Should error if the resource type is not recognized.
|
|
2327
|
+
* Retrieve the extension map for an object field
|
|
2549
2328
|
*
|
|
2550
2329
|
* @public
|
|
2551
2330
|
*/
|
|
2552
|
-
|
|
2331
|
+
CAUTION_MEGA_DANGER_ZONE_objectExtensions?(field: ExtensibleField, resolvedType: string | null): null | ProcessedExtension["features"];
|
|
2553
2332
|
/**
|
|
2554
|
-
*
|
|
2333
|
+
* Retrieve the extension map for an array field
|
|
2555
2334
|
*
|
|
2556
|
-
*
|
|
2335
|
+
* @public
|
|
2336
|
+
*/
|
|
2337
|
+
CAUTION_MEGA_DANGER_ZONE_arrayExtensions?(field: ExtensibleField): null | ProcessedExtension["features"];
|
|
2338
|
+
/**
|
|
2339
|
+
* Check if a specific extension has been registered previously
|
|
2557
2340
|
*
|
|
2558
2341
|
* @public
|
|
2559
2342
|
*/
|
|
2560
|
-
|
|
2343
|
+
CAUTION_MEGA_DANGER_ZONE_hasExtension?(ext: {
|
|
2344
|
+
kind: "object" | "array";
|
|
2345
|
+
name: string;
|
|
2346
|
+
}): boolean;
|
|
2347
|
+
}
|
|
2348
|
+
//#endregion
|
|
2349
|
+
//#region src/store/-private/managers/cache-key-manager.d.ts
|
|
2350
|
+
type TypeFromIdentifier<T> = T extends {
|
|
2351
|
+
type: infer U;
|
|
2352
|
+
} ? U : string;
|
|
2353
|
+
type NarrowIdentifierIfPossible<T> = T extends ExistingResourceIdentifierObject ? PersistedResourceKey<TypeFromIdentifier<T>> : ResourceKey;
|
|
2354
|
+
/**
|
|
2355
|
+
* Type-guard that returns `true` if the given value is a stable {@link ResourceKey}
|
|
2356
|
+
* (as opposed to a {@link RequestKey} or arbitrary, not-yet-stabilized resource data).
|
|
2357
|
+
*/
|
|
2358
|
+
declare function isResourceKey(identifier: unknown): identifier is ResourceKey;
|
|
2359
|
+
/**
|
|
2360
|
+
* Type-guard that returns `true` if the given value is a stable {@link RequestKey}
|
|
2361
|
+
* (as opposed to a {@link ResourceKey} or arbitrary, not-yet-stabilized data).
|
|
2362
|
+
*/
|
|
2363
|
+
declare function isRequestKey(identifier: unknown): identifier is RequestKey;
|
|
2364
|
+
/**
|
|
2365
|
+
* The identity of a field's value, as returned by {@link fieldValueIdentity}.
|
|
2366
|
+
* Today only schema-object values (a `schema-object` field, or one element of
|
|
2367
|
+
* a `schema-array`) have one: the concrete schema-object type the value
|
|
2368
|
+
* resolves to, and the identity hash that type's `ObjectSchema` declares for
|
|
2369
|
+
* it, or `null` when the schema declares `identity: null`.
|
|
2370
|
+
*/
|
|
2371
|
+
interface FieldValueIdentity {
|
|
2372
|
+
type: string;
|
|
2373
|
+
hash: string | null;
|
|
2374
|
+
}
|
|
2375
|
+
/**
|
|
2376
|
+
* The identity of `value` as a value of `field`, when the field kind has one.
|
|
2377
|
+
*
|
|
2378
|
+
* A `schema-object` value, or one element of a `schema-array`, resolves to its
|
|
2379
|
+
* concrete schema-object type and the identity hash that type's `ObjectSchema`
|
|
2380
|
+
* declares (`null` when the schema declares `identity: null`). A
|
|
2381
|
+
* non-polymorphic field names the type directly; a polymorphic field reads it
|
|
2382
|
+
* off the value at `options.type` (default `'type'`), or computes it with the
|
|
2383
|
+
* hash function named by `field.type` when `options.type` is `'@hash'`.
|
|
2384
|
+
*
|
|
2385
|
+
* Every other field kind, and any non-object value, has no identity and
|
|
2386
|
+
* returns `null`.
|
|
2387
|
+
*/
|
|
2388
|
+
declare function fieldValueIdentity(schema: SchemaService, field: FieldSchema, value: unknown): FieldValueIdentity | null;
|
|
2389
|
+
interface KeyOptions {
|
|
2390
|
+
lid: IdentifierMap;
|
|
2391
|
+
id: IdentifierMap;
|
|
2392
|
+
}
|
|
2393
|
+
type TypeMap = {
|
|
2394
|
+
[key: string]: KeyOptions;
|
|
2395
|
+
};
|
|
2396
|
+
type IdentifierMap = Map<string, ResourceKey>;
|
|
2397
|
+
type StableCache = {
|
|
2398
|
+
resources: IdentifierMap;
|
|
2399
|
+
documents: Map<string, RequestKey>;
|
|
2400
|
+
resourcesByType: TypeMap;
|
|
2401
|
+
polymorphicLidBackMap: Map<string, string[]>;
|
|
2402
|
+
};
|
|
2403
|
+
type MergeMethod = (targetIdentifier: ResourceKey, matchedIdentifier: ResourceKey, resourceData: unknown) => ResourceKey;
|
|
2404
|
+
/**
|
|
2405
|
+
Configures how unique identifier lid strings are generated by @ember-data/store.
|
|
2406
|
+
|
|
2407
|
+
This configuration MUST occur prior to the store instance being created.
|
|
2408
|
+
|
|
2409
|
+
Takes a method which can expect to receive various data as its first argument
|
|
2410
|
+
and the name of a bucket as its second argument.
|
|
2411
|
+
|
|
2412
|
+
Currently there are two buckets, 'record' and 'document'.
|
|
2413
|
+
|
|
2414
|
+
### Resource (`Record`) Identity
|
|
2415
|
+
|
|
2416
|
+
If the bucket is `record` the method must return a unique (to at-least
|
|
2417
|
+
the given bucket) string identifier for the given data as a string to be
|
|
2418
|
+
used as the `lid` of an `Identifier` token.
|
|
2419
|
+
|
|
2420
|
+
This method will only be called by either `getOrCreateRecordIdentifier` or
|
|
2421
|
+
`createIdentifierForNewRecord` when an identifier for the supplied data
|
|
2422
|
+
is not already known via `lid` or `type + id` combo and one needs to be
|
|
2423
|
+
generated or retrieved from a proprietary cache.
|
|
2424
|
+
|
|
2425
|
+
`data` will be the same data argument provided to `getOrCreateRecordIdentifier`
|
|
2426
|
+
and in the `createIdentifierForNewRecord` case will be an object with
|
|
2427
|
+
only `type` as a key.
|
|
2428
|
+
|
|
2429
|
+
```ts
|
|
2430
|
+
import { setIdentifierGenerationMethod } from '@warp-drive/core';
|
|
2431
|
+
|
|
2432
|
+
export function initialize(applicationInstance) {
|
|
2433
|
+
// note how `count` here is now scoped to the application instance
|
|
2434
|
+
// for our generation method by being inside the closure provided
|
|
2435
|
+
// by the initialize function
|
|
2436
|
+
let count = 0;
|
|
2437
|
+
|
|
2438
|
+
setIdentifierGenerationMethod((resource, bucket) => {
|
|
2439
|
+
return resource.lid || `my-key-${count++}`;
|
|
2440
|
+
});
|
|
2441
|
+
}
|
|
2442
|
+
|
|
2443
|
+
export default {
|
|
2444
|
+
name: 'configure-ember-data-identifiers',
|
|
2445
|
+
initialize
|
|
2446
|
+
};
|
|
2447
|
+
```
|
|
2448
|
+
|
|
2449
|
+
### Document Identity
|
|
2450
|
+
|
|
2451
|
+
If the bucket is `document` the method will receive the associated
|
|
2452
|
+
immutable `request` passed to `store.request` as its first argument
|
|
2453
|
+
and should return a unique string for the given request if the document
|
|
2454
|
+
should be cached, and `null` if it should not be cached.
|
|
2455
|
+
|
|
2456
|
+
Note, the request result will still be passed to the cache via `Cache.put`,
|
|
2457
|
+
but caches should take this as a signal that the document should not itself
|
|
2458
|
+
be cached, while its contents may still be used to update other cache state.
|
|
2459
|
+
|
|
2460
|
+
The presence of `cacheOptions.key` on the request will take precedence
|
|
2461
|
+
for the document cache key, and this method will not be called if it is
|
|
2462
|
+
present.
|
|
2463
|
+
|
|
2464
|
+
The default method implementation for this bucket is to return `null`
|
|
2465
|
+
for all requests whose method is not `GET`, and to return the `url` for
|
|
2466
|
+
those where it is.
|
|
2467
|
+
|
|
2468
|
+
This means that queries via `POST` MUST provide `cacheOptions.key` or
|
|
2469
|
+
implement this hook.
|
|
2470
|
+
|
|
2471
|
+
⚠️ Caution: Requests that do not have a `method` assigned are assumed to be `GET`
|
|
2472
|
+
|
|
2473
|
+
@public
|
|
2474
|
+
*/
|
|
2475
|
+
declare function setIdentifierGenerationMethod(method: GenerationMethod | null): void;
|
|
2476
|
+
/**
|
|
2477
|
+
Configure a callback for when the identifier cache encounters new resource
|
|
2478
|
+
data for an existing resource.
|
|
2479
|
+
|
|
2480
|
+
This configuration MUST occur prior to the store instance being created.
|
|
2481
|
+
|
|
2482
|
+
```js
|
|
2483
|
+
import { setIdentifierUpdateMethod } from '@warp-drive/core';
|
|
2484
|
+
```
|
|
2485
|
+
|
|
2486
|
+
Takes a method which can expect to receive an existing `Identifier` alongside
|
|
2487
|
+
some new data to consider as a second argument. This is an opportunity
|
|
2488
|
+
for secondary lookup tables and caches associated with the identifier
|
|
2489
|
+
to be amended.
|
|
2490
|
+
|
|
2491
|
+
This method is called everytime `updateRecordIdentifier` is called and
|
|
2492
|
+
with the same arguments. It provides the opportunity to update secondary
|
|
2493
|
+
lookup tables for existing identifiers.
|
|
2494
|
+
|
|
2495
|
+
It will always be called after an identifier created with `createIdentifierForNewRecord`
|
|
2496
|
+
has been committed, or after an update to the `record` a `RecordIdentifier`
|
|
2497
|
+
is assigned to has been committed. Committed here meaning that the server
|
|
2498
|
+
has acknowledged the update (for instance after a call to `.save()`)
|
|
2499
|
+
|
|
2500
|
+
If `id` has not previously existed, it will be assigned to the `Identifier`
|
|
2501
|
+
prior to this `UpdateMethod` being called; however, calls to the parent method
|
|
2502
|
+
`updateRecordIdentifier` that attempt to change the `id` or calling update
|
|
2503
|
+
without providing an `id` when one is missing will throw an error.
|
|
2504
|
+
|
|
2505
|
+
@public
|
|
2506
|
+
*/
|
|
2507
|
+
declare function setIdentifierUpdateMethod(method: UpdateMethod | null): void;
|
|
2508
|
+
/**
|
|
2509
|
+
Configure a callback for when the identifier cache is going to release an identifier.
|
|
2510
|
+
|
|
2511
|
+
This configuration MUST occur prior to the store instance being created.
|
|
2512
|
+
|
|
2513
|
+
```js
|
|
2514
|
+
import { setIdentifierForgetMethod } from '@warp-drive/core';
|
|
2515
|
+
```
|
|
2516
|
+
|
|
2517
|
+
Takes method which can expect to receive an existing `Identifier` that should be eliminated
|
|
2518
|
+
from any secondary lookup tables or caches that the user has populated for it.
|
|
2519
|
+
|
|
2520
|
+
@public
|
|
2521
|
+
*/
|
|
2522
|
+
declare function setIdentifierForgetMethod(method: ForgetMethod | null): void;
|
|
2523
|
+
/**
|
|
2524
|
+
Configure a callback for when the identifier cache is being torn down.
|
|
2525
|
+
|
|
2526
|
+
This configuration MUST occur prior to the store instance being created.
|
|
2527
|
+
|
|
2528
|
+
```js
|
|
2529
|
+
import { setIdentifierResetMethod } from '@warp-drive/core';
|
|
2530
|
+
```
|
|
2531
|
+
|
|
2532
|
+
Takes a method which can expect to be called when the parent application is destroyed.
|
|
2533
|
+
|
|
2534
|
+
If you have properly used a WeakMap to encapsulate the state of your customization
|
|
2535
|
+
to the application instance, you may not need to implement the `resetMethod`.
|
|
2536
|
+
|
|
2537
|
+
@public
|
|
2538
|
+
*/
|
|
2539
|
+
declare function setIdentifierResetMethod(method: ResetMethod | null): void;
|
|
2540
|
+
/**
|
|
2541
|
+
Configure a callback for when the identifier cache is generating a new
|
|
2542
|
+
ResourceKey for a resource.
|
|
2543
|
+
|
|
2544
|
+
This method controls the `type` and `id` that will be assigned to the
|
|
2545
|
+
`ResourceKey` that is created.
|
|
2546
|
+
|
|
2547
|
+
This configuration MUST occur prior to the store instance being created.
|
|
2548
|
+
|
|
2549
|
+
```js
|
|
2550
|
+
import { setKeyInfoForResource } from '@warp-drive/core';
|
|
2551
|
+
```
|
|
2552
|
+
|
|
2553
|
+
@public
|
|
2554
|
+
*/
|
|
2555
|
+
declare function setKeyInfoForResource(method: KeyInfoMethod | null): void;
|
|
2556
|
+
/**
|
|
2557
|
+
* Each instance of {@link Store} receives a unique instance of a CacheKeyManager.
|
|
2558
|
+
*
|
|
2559
|
+
* This cache is responsible for assigning or retrieving the unique identify
|
|
2560
|
+
* for arbitrary resource data encountered by the store. Data representing
|
|
2561
|
+
* a unique resource or record should always be represented by the same
|
|
2562
|
+
* identifier.
|
|
2563
|
+
*
|
|
2564
|
+
* It can be configured by consuming applications.
|
|
2565
|
+
*
|
|
2566
|
+
* @hideconstructor
|
|
2567
|
+
* @public
|
|
2568
|
+
*/
|
|
2569
|
+
declare class CacheKeyManager {
|
|
2570
|
+
constructor();
|
|
2561
2571
|
/**
|
|
2562
|
-
*
|
|
2563
|
-
*
|
|
2572
|
+
* allows us to peek without generating when needed
|
|
2573
|
+
* useful for the "create" case when we need to see if
|
|
2574
|
+
* we are accidentally overwritting something
|
|
2564
2575
|
*
|
|
2565
|
-
* @
|
|
2576
|
+
* @private
|
|
2566
2577
|
*/
|
|
2567
|
-
|
|
2578
|
+
peekResourceKey(resource: ResourceIdentifierObject): ResourceKey | undefined;
|
|
2568
2579
|
/**
|
|
2569
|
-
*
|
|
2570
|
-
*
|
|
2580
|
+
* Peeks the {@link RequestKey} for the given {@link RequestInfo}, but will not
|
|
2581
|
+
* create one if none has been previously generated.
|
|
2571
2582
|
*
|
|
2572
2583
|
* @public
|
|
2573
2584
|
*/
|
|
2574
|
-
|
|
2585
|
+
peekRequestKey(request: RequestInfo): RequestKey | null;
|
|
2575
2586
|
/**
|
|
2576
|
-
* Returns the
|
|
2577
|
-
*
|
|
2587
|
+
* Returns the {@link RequestKey} for the given {@link RequestInfo} if the request is
|
|
2588
|
+
* considered cacheable. For cacheable requests, this method will create
|
|
2589
|
+
* a RequestKey if none is found.
|
|
2578
2590
|
*
|
|
2579
|
-
*
|
|
2580
|
-
|
|
2581
|
-
derivation(field: DerivedField | ObjectWithStringTypeProperty): Derivation;
|
|
2582
|
-
/**
|
|
2583
|
-
* Returns the schema for the provided resource type.
|
|
2591
|
+
* A `null` response indicates the request cannot/will not be cached,
|
|
2592
|
+
* generally this means either
|
|
2584
2593
|
*
|
|
2585
|
-
* @
|
|
2586
|
-
|
|
2587
|
-
resource(resource: ObjectWithStringTypeProperty | ResourceKey): Schema;
|
|
2588
|
-
/**
|
|
2589
|
-
* Enables registration of multiple Schemas at once.
|
|
2594
|
+
* - {@link RequestInfo.cacheOptions.key} is not present on the `RequestInfo`
|
|
2595
|
+
* - the request's method is `GET` but it has no `url`
|
|
2590
2596
|
*
|
|
2591
|
-
*
|
|
2592
|
-
* or
|
|
2593
|
-
*
|
|
2597
|
+
* Generally you should not seek to cache requests that are not idempotent
|
|
2598
|
+
* or have side effects, such as mutations that create, update or delete
|
|
2599
|
+
* a resource.
|
|
2594
2600
|
*
|
|
2595
2601
|
* @public
|
|
2596
2602
|
*/
|
|
2597
|
-
|
|
2603
|
+
getOrCreateDocumentIdentifier(request: RequestInfo): RequestKey | null;
|
|
2598
2604
|
/**
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2605
|
+
Returns the {@link ResourceKey} for the given Resource, creates one if it does not yet exist.
|
|
2606
|
+
|
|
2607
|
+
Specifically this means that we:
|
|
2608
|
+
|
|
2609
|
+
- validate the `id` `type` and `lid` combo against known identifiers
|
|
2610
|
+
- return an object with an `lid` that is stable (repeated calls with the same
|
|
2611
|
+
`id` + `type` or `lid` will return the same `lid` value)
|
|
2612
|
+
- this referential stability of the object itself is guaranteed
|
|
2613
|
+
|
|
2614
|
+
@public
|
|
2615
|
+
*/
|
|
2616
|
+
getOrCreateRecordIdentifier<T>(resource: T): NarrowIdentifierIfPossible<T>;
|
|
2610
2617
|
/**
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2618
|
+
Returns a new Identifier for the supplied data. Call this method to generate
|
|
2619
|
+
an identifier when a new resource is being created local to the client and
|
|
2620
|
+
potentially does not have an `id`.
|
|
2621
|
+
|
|
2622
|
+
Delegates generation to the user supplied `GenerateMethod` if one has been provided
|
|
2623
|
+
with the signature `generateMethod({ type }, 'record')`.
|
|
2624
|
+
|
|
2625
|
+
@public
|
|
2626
|
+
*/
|
|
2627
|
+
createIdentifierForNewRecord(data: {
|
|
2628
|
+
type: string;
|
|
2629
|
+
id?: string | null;
|
|
2630
|
+
lid?: string;
|
|
2631
|
+
}): ResourceKey;
|
|
2619
2632
|
/**
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2633
|
+
Provides the opportunity to update secondary lookup tables for existing identifiers
|
|
2634
|
+
Called after an identifier created with `createIdentifierForNewRecord` has been
|
|
2635
|
+
committed.
|
|
2636
|
+
|
|
2637
|
+
Assigned `id` to an `Identifier` if `id` has not previously existed; however,
|
|
2638
|
+
attempting to change the `id` or calling update without providing an `id` when
|
|
2639
|
+
one is missing will throw an error.
|
|
2640
|
+
|
|
2641
|
+
- sets `id` (if `id` was previously `null`)
|
|
2642
|
+
- `lid` and `type` MUST NOT be altered post creation
|
|
2643
|
+
|
|
2644
|
+
If a merge occurs, it is possible the returned identifier does not match the originally
|
|
2645
|
+
provided identifier. In this case the abandoned identifier will go through the usual
|
|
2646
|
+
`forgetRecordIdentifier` codepaths.
|
|
2647
|
+
|
|
2648
|
+
@public
|
|
2649
|
+
*/
|
|
2650
|
+
updateRecordIdentifier(identifierObject: ResourceKey, data: unknown): ResourceKey;
|
|
2628
2651
|
/**
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2652
|
+
Provides the opportunity to eliminate an identifier from secondary lookup tables
|
|
2653
|
+
as well as eliminates it from ember-data's own lookup tables and book keeping.
|
|
2654
|
+
|
|
2655
|
+
Useful when a record has been deleted and the deletion has been persisted and
|
|
2656
|
+
we do not care about the record anymore. Especially useful when an `id` of a
|
|
2657
|
+
deleted record might be reused later for a new record.
|
|
2658
|
+
|
|
2659
|
+
@public
|
|
2660
|
+
*/
|
|
2661
|
+
forgetRecordIdentifier(identifierObject: ResourceKey): void;
|
|
2662
|
+
}
|
|
2663
|
+
/**
|
|
2664
|
+
* This type exists for internal use only for
|
|
2665
|
+
* where intimate contracts still exist either for
|
|
2666
|
+
* the Test Suite or for Legacy code.
|
|
2667
|
+
*
|
|
2668
|
+
* @private
|
|
2669
|
+
*/
|
|
2670
|
+
interface PrivateCacheKeyManager extends CacheKeyManager {
|
|
2671
|
+
_cache: StableCache;
|
|
2637
2672
|
/**
|
|
2638
|
-
*
|
|
2639
|
-
*
|
|
2640
|
-
* Traits are re-usable collections of fields that can be composed to
|
|
2641
|
-
* build up a resource schema. Often they represent polymorphic behaviors
|
|
2642
|
-
* a resource should exhibit.
|
|
2643
|
-
*
|
|
2644
|
-
* When we finalize a resource, we walk its traits and apply their fields
|
|
2645
|
-
* to the resource's fields. All specified traits must be registered by
|
|
2646
|
-
* this time or an error will be thrown.
|
|
2647
|
-
*
|
|
2648
|
-
* Traits are applied left-to-right, with traits of traits being applied in the same
|
|
2649
|
-
* way. Thus for the most part, application of traits is a post-order graph traversal
|
|
2650
|
-
* problem.
|
|
2651
|
-
*
|
|
2652
|
-
* A trait is only ever processed once. If multiple traits (A, B, C) have the same
|
|
2653
|
-
* trait (D) as a dependency, D will be included only once when first encountered by
|
|
2654
|
-
* A.
|
|
2655
|
-
*
|
|
2656
|
-
* If a cycle exists such that trait A has trait B which has Trait A, trait A will
|
|
2657
|
-
* be applied *after* trait B in production. In development a cycle error will be thrown.
|
|
2658
|
-
*
|
|
2659
|
-
* Fields are finalized on a "last wins principle". Thus traits appearing higher in
|
|
2660
|
-
* the tree and further to the right of a traits array take precedence, with the
|
|
2661
|
-
* resource's fields always being applied last and winning out.
|
|
2673
|
+
* Internal hook to allow management of merge conflicts with identifiers.
|
|
2662
2674
|
*
|
|
2663
|
-
*
|
|
2675
|
+
* we allow late binding of this private internal merge so that
|
|
2676
|
+
* the cache can insert itself here to handle elimination of duplicates
|
|
2664
2677
|
*/
|
|
2665
|
-
|
|
2678
|
+
__configureMerge(method: MergeMethod | null): void;
|
|
2679
|
+
_mergeRecordIdentifiers(keyInfo: KeyInfo, identifier: ResourceKey, existingIdentifier: ResourceKey, data: unknown): ResourceKey;
|
|
2680
|
+
destroy(): void;
|
|
2681
|
+
}
|
|
2682
|
+
//#endregion
|
|
2683
|
+
//#region src/store/-private/managers/notification-manager.d.ts
|
|
2684
|
+
type UnsubscribeToken$1 = object;
|
|
2685
|
+
/**
|
|
2686
|
+
* The kinds of change notifications the {@link NotificationManager} can emit for a resource.
|
|
2687
|
+
*/
|
|
2688
|
+
type CacheOperation$1 = "added" | "removed" | "updated" | "state";
|
|
2689
|
+
/**
|
|
2690
|
+
* The kinds of change notifications the {@link NotificationManager} can emit for a request document.
|
|
2691
|
+
*/
|
|
2692
|
+
type DocumentCacheOperation$1 = "invalidated" | "added" | "removed" | "updated" | "state";
|
|
2693
|
+
/**
|
|
2694
|
+
* The full set of notification kinds the {@link NotificationManager} can emit for a resource,
|
|
2695
|
+
* including both {@link CacheOperation}s and finer-grained field-level change notifications.
|
|
2696
|
+
*/
|
|
2697
|
+
type NotificationType = "attributes" | "relationships" | "identity" | "errors" | "meta" | CacheOperation$1;
|
|
2698
|
+
/**
|
|
2699
|
+
* The shape accepted by {@link NotificationManager.notify} and
|
|
2700
|
+
* {@link CacheCapabilitiesManager.notifyChange} for delivering many keys for
|
|
2701
|
+
* the `'attributes'` or `'relationships'` namespaces in a single call
|
|
2702
|
+
* instead of once per key.
|
|
2703
|
+
*
|
|
2704
|
+
* @since 5.9.0
|
|
2705
|
+
* @public
|
|
2706
|
+
*/
|
|
2707
|
+
type NotifyKeys = Set<string>;
|
|
2708
|
+
/**
|
|
2709
|
+
* A change to a resource's `attributes` or `relationships` can be relevant to
|
|
2710
|
+
* a "local" view of the resource (its mutable/editable state), a "remote" view
|
|
2711
|
+
* (its last-known-persisted state), or both.
|
|
2712
|
+
*
|
|
2713
|
+
* Each view subscribes to its own channel and, when notified, re-pulls its own
|
|
2714
|
+
* projection of the data: a remote-only reader (e.g. PolarisMode's default
|
|
2715
|
+
* immutable record) subscribes `'remote'` and re-reads remote state; an
|
|
2716
|
+
* editable/reconciled reader (a legacy record, or an editable checkout)
|
|
2717
|
+
* subscribes `'local'` (the same as omitting the channel) and re-reads local
|
|
2718
|
+
* state. A notifier that knows which projection changed tags the notification
|
|
2719
|
+
* with that channel; each tag is delivered only to that channel's subscribers.
|
|
2720
|
+
* A change affecting both projections is either notified unscoped or once per
|
|
2721
|
+
* channel. An unscoped notify cannot guarantee which view changed, so it
|
|
2722
|
+
* reaches every subscriber -- this keeps every pre-channel `notify` callsite
|
|
2723
|
+
* (and any custom cache that doesn't know about channels) fully compatible.
|
|
2724
|
+
*
|
|
2725
|
+
* The full delivery matrix:
|
|
2726
|
+
*
|
|
2727
|
+
* | notify ↓ subscribe → | `'local'` | `'remote'` | omitted (= `'local'`) |
|
|
2728
|
+
* | -------------------- | --------- | ---------- | --------------------- |
|
|
2729
|
+
* | `'local'` | ✅ | ❌ | ✅ |
|
|
2730
|
+
* | `'remote'` | ❌ | ✅ | ❌ |
|
|
2731
|
+
* | omitted | ✅ | ✅ | ✅ |
|
|
2732
|
+
*
|
|
2733
|
+
* Channel only applies to the `'attributes'` and `'relationships'`
|
|
2734
|
+
* notification types. All other types (`'errors'`,
|
|
2735
|
+
* `'identity'`, `'state'`, and the various `CacheOperation`/
|
|
2736
|
+
* `DocumentCacheOperation` values) are never filtered by channel since they
|
|
2737
|
+
* have no local/remote duality.
|
|
2738
|
+
*
|
|
2739
|
+
* @public
|
|
2740
|
+
*/
|
|
2741
|
+
type NotificationChannel = "local" | "remote";
|
|
2742
|
+
interface NotificationCallback$1 {
|
|
2743
|
+
(cacheKey: ResourceKey, notificationType: "attributes" | "relationships", key?: string): void;
|
|
2744
|
+
(cacheKey: ResourceKey, notificationType: "errors" | "meta" | "identity" | "state"): void;
|
|
2745
|
+
(cacheKey: ResourceKey, notificationType: CacheOperation$1): void;
|
|
2746
|
+
}
|
|
2747
|
+
interface ResourceOperationCallback$1 {
|
|
2748
|
+
(cacheKey: ResourceKey, notificationType: CacheOperation$1): void;
|
|
2749
|
+
}
|
|
2750
|
+
interface DocumentOperationCallback$1 {
|
|
2751
|
+
(cacheKey: RequestKey, notificationType: DocumentCacheOperation$1): void;
|
|
2752
|
+
}
|
|
2753
|
+
/**
|
|
2754
|
+
* The NotificationManager provides the ability to subscribe to
|
|
2755
|
+
* changes to Cache state.
|
|
2756
|
+
*
|
|
2757
|
+
* This Feature is what allows WarpDrive to create subscriptions that
|
|
2758
|
+
* work with any framework or change-notification system.
|
|
2759
|
+
*
|
|
2760
|
+
* @hideconstructor
|
|
2761
|
+
* @public
|
|
2762
|
+
*/
|
|
2763
|
+
declare class NotificationManager$1 {
|
|
2764
|
+
constructor(store: Store$1);
|
|
2666
2765
|
/**
|
|
2667
|
-
*
|
|
2668
|
-
*
|
|
2669
|
-
* Returns definitions for all properties of the specified resource
|
|
2670
|
-
* that are considered "attributes". Generally these are properties
|
|
2671
|
-
* that are not related to book-keeping state on the client and do
|
|
2672
|
-
* not represent a linkage to another resource.
|
|
2673
|
-
*
|
|
2674
|
-
* The return value should be a dictionary of key:value pairs
|
|
2675
|
-
* where the `key` is the attribute or property's name and `value`
|
|
2676
|
-
* is an object with at least the property `name` which should also
|
|
2677
|
-
* match `key`.
|
|
2678
|
-
*
|
|
2679
|
-
* Optionally, this object may also specify `type`, which should
|
|
2680
|
-
* be a string reference to a `transform`, and `options` which
|
|
2681
|
-
* should be dictionary in which any key:value pairs are permissable.
|
|
2682
|
-
*
|
|
2683
|
-
* For instance, when using `@warp-drive/legacy/model`, the following attribute
|
|
2684
|
-
* definition:
|
|
2766
|
+
* Subscribe to changes for a given ResourceKey, RequestKey, or addition/removal of any resource
|
|
2767
|
+
* or document.
|
|
2685
2768
|
*
|
|
2686
2769
|
* ```ts
|
|
2687
|
-
*
|
|
2688
|
-
* @attr('string', { defaultValue: 'hello' }) greeting;
|
|
2689
|
-
* @attr('date') birthday;
|
|
2690
|
-
* @attr firstName;
|
|
2691
|
-
* }
|
|
2692
|
-
* ```
|
|
2693
|
-
*
|
|
2694
|
-
* Would be returned as:
|
|
2770
|
+
* export type CacheOperation = 'added' | 'removed' | 'updated' | 'state';
|
|
2695
2771
|
*
|
|
2696
|
-
*
|
|
2697
|
-
*
|
|
2698
|
-
*
|
|
2699
|
-
*
|
|
2700
|
-
* firstName: { name: 'firstName' }
|
|
2772
|
+
* export interface NotificationCallback {
|
|
2773
|
+
* (cacheKey: ResourceKey, notificationType: 'attributes' | 'relationships', key?: string): void;
|
|
2774
|
+
* (cacheKey: ResourceKey, notificationType: 'errors' | 'meta' | 'identity' | 'state'): void;
|
|
2775
|
+
* (cacheKey: ResourceKey, notificationType: NotificationType, key?: string): void;
|
|
2701
2776
|
* }
|
|
2702
|
-
*
|
|
2703
|
-
*
|
|
2704
|
-
*
|
|
2705
|
-
* @deprecated - use {@link SchemaService.fields | fields}
|
|
2706
|
-
*/
|
|
2707
|
-
attributesDefinitionFor?(key: ResourceKey | ObjectWithStringTypeProperty): AttributesSchema;
|
|
2708
|
-
/**
|
|
2709
|
-
* DEPRECATED - use `fields` instead
|
|
2710
|
-
*
|
|
2711
|
-
* Returns definitions for all properties of the specified resource
|
|
2712
|
-
* that are considered "relationships". Generally these are properties
|
|
2713
|
-
* that represent a linkage to another resource.
|
|
2714
|
-
*
|
|
2715
|
-
* The return value should be a dictionary of key:value pairs
|
|
2716
|
-
* where the `key` is the relationship or property's name and `value`
|
|
2717
|
-
* is an object with at least the following properties:
|
|
2718
|
-
*
|
|
2719
|
-
* - `name` which should also match the `key` used in the dictionary.
|
|
2720
|
-
* - `kind` which should be either `belongsTo` or `hasMany`
|
|
2721
|
-
* - `type` which should be the related resource's string "type"
|
|
2722
|
-
* - `options` which should be a dictionary allowing any key but with
|
|
2723
|
-
* at least the below keys present.
|
|
2724
|
-
*
|
|
2725
|
-
* - `options.async` a boolean representing whether data for this relationship is
|
|
2726
|
-
* typically loaded on-demand.
|
|
2727
|
-
* - `options.inverse` a string or null representing the field name / key of the
|
|
2728
|
-
* corresponding relationship on the inverse resource.
|
|
2729
|
-
*
|
|
2730
|
-
* Additionally the following options properties are optional. See [Polymorphic Relationships](https://rfcs.emberjs.com/id/0793-polymporphic-relations-without-inheritance)
|
|
2731
|
-
*
|
|
2732
|
-
* - `options.polymorphic` a boolean representing whether multiple resource types
|
|
2733
|
-
* can be used to satisfy this relationship.
|
|
2734
|
-
* - `options.as` a string representing the abstract type that the concrete side of
|
|
2735
|
-
* a relationship must specify when fulfilling a polymorphic inverse.
|
|
2736
|
-
*
|
|
2737
|
-
* For example, the following Model using @warp-drive/legacy/model would generate this relationships
|
|
2738
|
-
* definition by default:
|
|
2739
|
-
*
|
|
2740
|
-
* ```js
|
|
2741
|
-
* class User extends Model {
|
|
2742
|
-
* @belongsTo('user', { async: false, inverse: null }) bestFriend;
|
|
2743
|
-
* @hasMany('user', { async: true, inverse: 'friends' }) friends;
|
|
2744
|
-
* @hasMany('pet', { async: false, polymorphic: true, inverse: 'owner' }) pets;
|
|
2777
|
+
* export interface ResourceOperationCallback {
|
|
2778
|
+
* // resource updates
|
|
2779
|
+
* (cacheKey: ResourceKey, notificationType: CacheOperation): void;
|
|
2745
2780
|
* }
|
|
2746
|
-
*
|
|
2747
|
-
*
|
|
2748
|
-
*
|
|
2749
|
-
*
|
|
2750
|
-
* ```js
|
|
2751
|
-
* {
|
|
2752
|
-
* bestFriend: {
|
|
2753
|
-
* name: 'bestFriend',
|
|
2754
|
-
* kind: 'belongsTo',
|
|
2755
|
-
* type: 'user',
|
|
2756
|
-
* options: {
|
|
2757
|
-
* async: false,
|
|
2758
|
-
* inverse: null
|
|
2759
|
-
* }
|
|
2760
|
-
* },
|
|
2761
|
-
* friends: {
|
|
2762
|
-
* name: 'friends',
|
|
2763
|
-
* kind: 'hasMany',
|
|
2764
|
-
* type: 'user',
|
|
2765
|
-
* options: {
|
|
2766
|
-
* async: true,
|
|
2767
|
-
* inverse: 'friends'
|
|
2768
|
-
* }
|
|
2769
|
-
* },
|
|
2770
|
-
* pets: {
|
|
2771
|
-
* name: 'pets',
|
|
2772
|
-
* kind: 'hasMany',
|
|
2773
|
-
* type: 'pet',
|
|
2774
|
-
* options: {
|
|
2775
|
-
* async: false,
|
|
2776
|
-
* polymorphic: true,
|
|
2777
|
-
* inverse: 'owner'
|
|
2778
|
-
* }
|
|
2779
|
-
* },
|
|
2781
|
+
* export interface DocumentOperationCallback {
|
|
2782
|
+
* // document updates
|
|
2783
|
+
* (cacheKey: RequestKey, notificationType: CacheOperation): void;
|
|
2780
2784
|
* }
|
|
2781
2785
|
* ```
|
|
2782
2786
|
*
|
|
2783
|
-
*
|
|
2784
|
-
*
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
*
|
|
2789
|
-
*
|
|
2790
|
-
* @public
|
|
2791
|
-
*/
|
|
2792
|
-
resourceTypes(): Readonly<string[]>;
|
|
2793
|
-
/**
|
|
2794
|
-
* Register an extension for either objects or arrays
|
|
2787
|
+
* A `channel` may be provided when subscribing to a `ResourceKey`. Its
|
|
2788
|
+
* effect is that the subscription skips `'attributes'`/`'relationships'`
|
|
2789
|
+
* notifications explicitly tagged with the *other* channel; unscoped
|
|
2790
|
+
* notifications, and notifications for all other notification types, always
|
|
2791
|
+
* reach the subscriber. Subscribing `'local'` and omitting the channel are
|
|
2792
|
+
* the same thing. See {@link NotificationChannel}.
|
|
2795
2793
|
*
|
|
2796
|
-
*
|
|
2794
|
+
* | notify ↓ subscribe → | `'local'` | `'remote'` | omitted (= `'local'`) |
|
|
2795
|
+
* | -------------------- | --------- | ---------- | --------------------- |
|
|
2796
|
+
* | `'local'` | ✅ | ❌ | ✅ |
|
|
2797
|
+
* | `'remote'` | ❌ | ✅ | ❌ |
|
|
2798
|
+
* | omitted | ✅ | ✅ | ✅ |
|
|
2797
2799
|
*
|
|
2798
2800
|
* @public
|
|
2801
|
+
* @return an opaque token to be used with unsubscribe
|
|
2799
2802
|
*/
|
|
2800
|
-
|
|
2803
|
+
subscribe(cacheKey: ResourceKey, callback: NotificationCallback$1, channel?: NotificationChannel): UnsubscribeToken$1;
|
|
2804
|
+
subscribe(cacheKey: "resource", callback: ResourceOperationCallback$1): UnsubscribeToken$1;
|
|
2805
|
+
subscribe(cacheKey: "document" | RequestKey, callback: DocumentOperationCallback$1): UnsubscribeToken$1;
|
|
2801
2806
|
/**
|
|
2802
|
-
*
|
|
2807
|
+
* remove a previous subscription
|
|
2803
2808
|
*
|
|
2804
2809
|
* @public
|
|
2805
2810
|
*/
|
|
2806
|
-
|
|
2807
|
-
type: string;
|
|
2808
|
-
}): null | ProcessedExtension["features"];
|
|
2811
|
+
unsubscribe(token: UnsubscribeToken$1): void;
|
|
2809
2812
|
/**
|
|
2810
|
-
*
|
|
2813
|
+
* Custom Caches and Application Code should not call this method directly.
|
|
2811
2814
|
*
|
|
2812
|
-
*
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
*
|
|
2815
|
+
* When notifying `'attributes'` or `'relationships'` for many keys on the
|
|
2816
|
+
* same `cacheKey` at once (for instance, when a bulk update to a single
|
|
2817
|
+
* record touches many fields) `key` may be supplied as a `Set<string>`
|
|
2818
|
+
* instead of being called once per key. The `Set` is iterated as-is (it is
|
|
2819
|
+
* never converted to or from an array internally). This delivers the
|
|
2820
|
+
* exact same sequence of individual notifications to subscribers (each
|
|
2821
|
+
* subscriber callback is still invoked once per key, in order) while
|
|
2822
|
+
* paying the per-call overhead (validity checks, subscriber lookups,
|
|
2823
|
+
* buffer/flush scheduling) only once for the whole batch instead of once
|
|
2824
|
+
* per key.
|
|
2817
2825
|
*
|
|
2818
|
-
*
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
*
|
|
2826
|
+
* A `channel` may be supplied for the `'attributes'`/`'relationships'`
|
|
2827
|
+
* namespaces. Tagging a notification `'local'` declares "only the local
|
|
2828
|
+
* (reconciled/editable) view changed"; tagging it `'remote'` declares "only
|
|
2829
|
+
* the remote view changed". Each tag is delivered only to that channel's
|
|
2830
|
+
* subscribers. Omitting the channel reaches every subscriber regardless of
|
|
2831
|
+
* its channel. See {@link NotificationChannel}.
|
|
2823
2832
|
*
|
|
2824
|
-
*
|
|
2833
|
+
* | notify ↓ subscribe → | `'local'` | `'remote'` | omitted (= `'local'`) |
|
|
2834
|
+
* | -------------------- | --------- | ---------- | --------------------- |
|
|
2835
|
+
* | `'local'` | ✅ | ❌ | ✅ |
|
|
2836
|
+
* | `'remote'` | ❌ | ✅ | ❌ |
|
|
2837
|
+
* | omitted | ✅ | ✅ | ✅ |
|
|
2838
|
+
*
|
|
2839
|
+
* @private
|
|
2825
2840
|
*/
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2841
|
+
notify(cacheKey: ResourceKey, value: "attributes" | "relationships", key?: string | NotifyKeys | null, channel?: NotificationChannel): boolean;
|
|
2842
|
+
notify(cacheKey: ResourceKey, value: "errors" | "meta" | "identity" | "state", key?: null): boolean;
|
|
2843
|
+
notify(cacheKey: ResourceKey, value: CacheOperation$1, key?: null): boolean;
|
|
2844
|
+
notify(cacheKey: RequestKey, value: DocumentCacheOperation$1, key?: null): boolean;
|
|
2845
|
+
}
|
|
2846
|
+
/**
|
|
2847
|
+
* This type exists for internal use only for
|
|
2848
|
+
* where intimate contracts still exist either for
|
|
2849
|
+
* the Test Suite or for Legacy code.
|
|
2850
|
+
*
|
|
2851
|
+
* @private
|
|
2852
|
+
*/
|
|
2853
|
+
interface PrivateNotificationManager extends NotificationManager$1 {
|
|
2854
|
+
_flush(): void;
|
|
2830
2855
|
}
|
|
2831
2856
|
//#endregion
|
|
2832
2857
|
//#region src/store/-types/q/cache-capabilities-manager.d.ts
|
|
@@ -3203,7 +3228,11 @@ interface Cache {
|
|
|
3203
3228
|
* Push resource data from a remote source into the cache for this ResourceKey
|
|
3204
3229
|
*
|
|
3205
3230
|
* @public
|
|
3206
|
-
* @return
|
|
3231
|
+
* @return when `hasRecord` is true, the names of the attributes whose persisted value
|
|
3232
|
+
* this push changed, or `undefined` when none did. A key counts as changed when the
|
|
3233
|
+
* value the cache holds for it moved, whether or not a local edit already held the new
|
|
3234
|
+
* value; a value the schema considers equal (for instance, a schema-object with a
|
|
3235
|
+
* matching identity hash) does not count. Otherwise `void`.
|
|
3207
3236
|
*/
|
|
3208
3237
|
upsert(cacheKey: ResourceKey, data: ResourceBlob, hasRecord: boolean): void | string[];
|
|
3209
3238
|
/**
|
|
@@ -3284,7 +3313,7 @@ interface Cache {
|
|
|
3284
3313
|
* @param cacheKey - the primary ResourceKey that was operated on
|
|
3285
3314
|
* @param result - a document in the cache format containing any updated data
|
|
3286
3315
|
*/
|
|
3287
|
-
didCommit(cacheKey: ResourceKey, result: StructuredDataDocument<SingleResourceDataDocument
|
|
3316
|
+
didCommit(cacheKey: ResourceKey, result: StructuredDataDocument<SingleResourceDataDocument<ExistingResourceObject, ExistingResourceObject>> | null): SingleResourceDataDocument;
|
|
3288
3317
|
/**
|
|
3289
3318
|
* [LIFECYCLE] Signals to the cache that a set of resources
|
|
3290
3319
|
* was successfully updated as part of a save transaction that
|
|
@@ -3294,7 +3323,7 @@ interface Cache {
|
|
|
3294
3323
|
* @param cacheKey - the primary ResourceKeys that were operated on
|
|
3295
3324
|
* @param result - a document in the cache format containing any updated data
|
|
3296
3325
|
*/
|
|
3297
|
-
didCommit(cacheKey: ResourceKey[], result: StructuredDataDocument<SingleResourceDataDocument
|
|
3326
|
+
didCommit(cacheKey: ResourceKey[], result: StructuredDataDocument<SingleResourceDataDocument<ExistingResourceObject, ExistingResourceObject>> | null): SingleResourceDataDocument;
|
|
3298
3327
|
/**
|
|
3299
3328
|
* [LIFECYCLE] Signals to the cache that a set of resources
|
|
3300
3329
|
* was successfully updated as part of a save transaction that
|
|
@@ -3304,7 +3333,7 @@ interface Cache {
|
|
|
3304
3333
|
* @param cacheKey - the primary ResourceKeys that were operated on
|
|
3305
3334
|
* @param result - a document in the cache format containing any updated data
|
|
3306
3335
|
*/
|
|
3307
|
-
didCommit(cacheKey: ResourceKey[], result: StructuredDataDocument<CollectionResourceDataDocument
|
|
3336
|
+
didCommit(cacheKey: ResourceKey[], result: StructuredDataDocument<CollectionResourceDataDocument<ExistingResourceObject>> | null): CollectionResourceDataDocument;
|
|
3308
3337
|
/**
|
|
3309
3338
|
* [LIFECYCLE] Signals to the cache that a resource
|
|
3310
3339
|
* was update via a save transaction failed.
|
|
@@ -4080,11 +4109,23 @@ declare function withResponseType<T>(obj: RequestInfo): RequestInfo<T> & {
|
|
|
4080
4109
|
* result.content.data; // will have type User
|
|
4081
4110
|
* ```
|
|
4082
4111
|
*
|
|
4112
|
+
* Pass a second type param to declare the `meta` the endpoint returns:
|
|
4113
|
+
*
|
|
4114
|
+
* ```ts
|
|
4115
|
+
* type PageMeta = { page: { limit: number; offset: number }; total?: number };
|
|
4116
|
+
*
|
|
4117
|
+
* const result = await store.request(
|
|
4118
|
+
* withReactiveResponse<User[], PageMeta>({ url: '/users' })
|
|
4119
|
+
* );
|
|
4120
|
+
*
|
|
4121
|
+
* result.content.meta?.total; // number | undefined
|
|
4122
|
+
* ```
|
|
4123
|
+
*
|
|
4083
4124
|
* @public
|
|
4084
4125
|
*/
|
|
4085
|
-
declare function withReactiveResponse<T>(obj: RequestInfo): RequestInfo<ReactiveDataDocument<T>> & {
|
|
4126
|
+
declare function withReactiveResponse<T, M extends Meta | undefined = Meta | undefined, E extends object = object, EM extends Meta | undefined = M>(obj: RequestInfo): RequestInfo<ReactiveDataDocument<T, M, E, EM>> & {
|
|
4086
4127
|
/** The branded response type. Present only at the type level; carries no runtime value. */
|
|
4087
|
-
[RequestSignature]: ReactiveDataDocument<T>;
|
|
4128
|
+
[RequestSignature]: ReactiveDataDocument<T, M, E, EM>;
|
|
4088
4129
|
};
|
|
4089
4130
|
/**
|
|
4090
4131
|
* @deprecated use {@link withResponseType} instead
|
|
@@ -4233,7 +4274,7 @@ interface CachePolicy {
|
|
|
4233
4274
|
}
|
|
4234
4275
|
//#endregion
|
|
4235
4276
|
//#region src/reactive/-private/document.d.ts
|
|
4236
|
-
interface ReactiveDocumentBase<T> {
|
|
4277
|
+
interface ReactiveDocumentBase<T, M extends Meta | undefined = Meta | undefined, E extends object = object, EM extends Meta | undefined = M> {
|
|
4237
4278
|
/**
|
|
4238
4279
|
* The links object for this document, if any
|
|
4239
4280
|
*
|
|
@@ -4248,12 +4289,6 @@ interface ReactiveDocumentBase<T> {
|
|
|
4248
4289
|
* @public
|
|
4249
4290
|
*/
|
|
4250
4291
|
readonly links?: PaginationLinks;
|
|
4251
|
-
/**
|
|
4252
|
-
* The meta object for this document, if any
|
|
4253
|
-
*
|
|
4254
|
-
* @public
|
|
4255
|
-
*/
|
|
4256
|
-
readonly meta?: Meta;
|
|
4257
4292
|
/**
|
|
4258
4293
|
* The RequestKey associated with this document, if any
|
|
4259
4294
|
*
|
|
@@ -4267,7 +4302,7 @@ interface ReactiveDocumentBase<T> {
|
|
|
4267
4302
|
*
|
|
4268
4303
|
* @public
|
|
4269
4304
|
*/
|
|
4270
|
-
fetch(options?: RequestInfo<ReactiveDocument<T>>): Promise<ReactiveDocument<T>>;
|
|
4305
|
+
fetch(options?: RequestInfo<ReactiveDocument<T, M, E, EM>>): Promise<ReactiveDocument<T, M, E, EM>>;
|
|
4271
4306
|
/**
|
|
4272
4307
|
* Fetches the next link for this document, returning a promise that resolves
|
|
4273
4308
|
* with the new document when the request completes, or null if there is no
|
|
@@ -4275,7 +4310,7 @@ interface ReactiveDocumentBase<T> {
|
|
|
4275
4310
|
*
|
|
4276
4311
|
* @public
|
|
4277
4312
|
*/
|
|
4278
|
-
next(options?: RequestInfo<ReactiveDocument<T>>): Promise<ReactiveDocument<T> | null>;
|
|
4313
|
+
next(options?: RequestInfo<ReactiveDocument<T, M, E, EM>>): Promise<ReactiveDocument<T, M, E, EM> | null>;
|
|
4279
4314
|
/**
|
|
4280
4315
|
* Fetches the prev link for this document, returning a promise that resolves
|
|
4281
4316
|
* with the new document when the request completes, or null if there is no
|
|
@@ -4283,7 +4318,7 @@ interface ReactiveDocumentBase<T> {
|
|
|
4283
4318
|
*
|
|
4284
4319
|
* @public
|
|
4285
4320
|
*/
|
|
4286
|
-
prev(options: RequestInfo<ReactiveDocument<T>>): Promise<ReactiveDocument<T> | null>;
|
|
4321
|
+
prev(options: RequestInfo<ReactiveDocument<T, M, E, EM>>): Promise<ReactiveDocument<T, M, E, EM> | null>;
|
|
4287
4322
|
/**
|
|
4288
4323
|
* Fetches the first link for this document, returning a promise that resolves
|
|
4289
4324
|
* with the new document when the request completes, or null if there is no
|
|
@@ -4291,7 +4326,7 @@ interface ReactiveDocumentBase<T> {
|
|
|
4291
4326
|
*
|
|
4292
4327
|
* @public
|
|
4293
4328
|
*/
|
|
4294
|
-
first(options: RequestInfo<ReactiveDocument<T>>): Promise<ReactiveDocument<T> | null>;
|
|
4329
|
+
first(options: RequestInfo<ReactiveDocument<T, M, E, EM>>): Promise<ReactiveDocument<T, M, E, EM> | null>;
|
|
4295
4330
|
/**
|
|
4296
4331
|
* Fetches the last link for this document, returning a promise that resolves
|
|
4297
4332
|
* with the new document when the request completes, or null if there is no
|
|
@@ -4299,7 +4334,7 @@ interface ReactiveDocumentBase<T> {
|
|
|
4299
4334
|
*
|
|
4300
4335
|
* @public
|
|
4301
4336
|
*/
|
|
4302
|
-
last(options: RequestInfo<ReactiveDocument<T>>): Promise<ReactiveDocument<T> | null>;
|
|
4337
|
+
last(options: RequestInfo<ReactiveDocument<T, M, E, EM>>): Promise<ReactiveDocument<T, M, E, EM> | null>;
|
|
4303
4338
|
/**
|
|
4304
4339
|
* Implemented for `JSON.stringify` support.
|
|
4305
4340
|
*
|
|
@@ -4314,13 +4349,55 @@ interface ReactiveDocumentBase<T> {
|
|
|
4314
4349
|
*/
|
|
4315
4350
|
toJSON(): object;
|
|
4316
4351
|
}
|
|
4352
|
+
/**
|
|
4353
|
+
* The `meta` member of a reactive document.
|
|
4354
|
+
*
|
|
4355
|
+
* Optional when the meta type has not been narrowed — the default,
|
|
4356
|
+
* `Meta | undefined`, is "any JSON object, or nothing" — and required once a
|
|
4357
|
+
* request declares what its endpoint returns, so a declared key needs no `?.`.
|
|
4358
|
+
*
|
|
4359
|
+
* Keeping it optional at the default is what lets consumers keep deriving from
|
|
4360
|
+
* these types: an interface that re-declares `meta?:`, a mirrored copy checked
|
|
4361
|
+
* by mutual assignability, a `class ... implements`, an intersection with
|
|
4362
|
+
* `{ meta?: X }`, and `satisfies` all continue to work.
|
|
4363
|
+
*
|
|
4364
|
+
* The check is `undefined extends M` and not `M extends undefined`: a naked
|
|
4365
|
+
* type param on the left of a conditional distributes over the union default
|
|
4366
|
+
* and yields `{ meta: Meta } | { meta?: undefined }` rather than one object
|
|
4367
|
+
* type.
|
|
4368
|
+
*/
|
|
4369
|
+
type DocumentMeta<M extends Meta | undefined> = undefined extends M ? {
|
|
4370
|
+
/**
|
|
4371
|
+
* The meta object for this document, if any.
|
|
4372
|
+
*
|
|
4373
|
+
* @public
|
|
4374
|
+
*/
|
|
4375
|
+
readonly meta?: M;
|
|
4376
|
+
} : {
|
|
4377
|
+
/**
|
|
4378
|
+
* The meta object for this document.
|
|
4379
|
+
*
|
|
4380
|
+
* Required because the request named the shape it returns — read a
|
|
4381
|
+
* documented key directly, no cast, coercion, or `?.`.
|
|
4382
|
+
*
|
|
4383
|
+
* ```ts
|
|
4384
|
+
* type PageMeta = { page: { limit: number; offset: number }; total?: number };
|
|
4385
|
+
*
|
|
4386
|
+
* const { content } = await store.request(query<User, PageMeta>('user'));
|
|
4387
|
+
* content.meta.total; // number | undefined, not unknown
|
|
4388
|
+
* ```
|
|
4389
|
+
*
|
|
4390
|
+
* @public
|
|
4391
|
+
*/
|
|
4392
|
+
readonly meta: M;
|
|
4393
|
+
};
|
|
4317
4394
|
/**
|
|
4318
4395
|
* The variant of {@link ReactiveDocument} returned for a request whose
|
|
4319
4396
|
* response contained no primary data, e.g. an error response.
|
|
4320
4397
|
*
|
|
4321
4398
|
* @public
|
|
4322
4399
|
*/
|
|
4323
|
-
|
|
4400
|
+
type ReactiveErrorDocument<T, EM extends Meta | undefined = Meta | undefined, E extends object = object, M extends Meta | undefined = EM> = ReactiveDocumentBase<T, M, E, EM> & DocumentMeta<EM> & {
|
|
4324
4401
|
/**
|
|
4325
4402
|
* The primary data for this document, if any.
|
|
4326
4403
|
*
|
|
@@ -4336,17 +4413,21 @@ interface ReactiveErrorDocument<T> extends ReactiveDocumentBase<T> {
|
|
|
4336
4413
|
/**
|
|
4337
4414
|
* The errors returned by the API for this request, if any
|
|
4338
4415
|
*
|
|
4416
|
+
* The cache stores whatever the API sent without validating it, so by
|
|
4417
|
+
* default this is `object` — no shape is promised. Requests that know what
|
|
4418
|
+
* their endpoint returns may narrow it by supplying the `E` type param.
|
|
4419
|
+
*
|
|
4339
4420
|
* @public
|
|
4340
4421
|
*/
|
|
4341
|
-
readonly errors:
|
|
4342
|
-
}
|
|
4422
|
+
readonly errors: E[];
|
|
4423
|
+
};
|
|
4343
4424
|
/**
|
|
4344
4425
|
* The variant of {@link ReactiveDocument} returned for a request whose
|
|
4345
4426
|
* response contained primary data.
|
|
4346
4427
|
*
|
|
4347
4428
|
* @public
|
|
4348
4429
|
*/
|
|
4349
|
-
|
|
4430
|
+
type ReactiveDataDocument<T, M extends Meta | undefined = Meta | undefined, E extends object = object, EM extends Meta | undefined = M> = ReactiveDocumentBase<T, M, E, EM> & DocumentMeta<M> & {
|
|
4350
4431
|
/**
|
|
4351
4432
|
* The primary data for this document, if any.
|
|
4352
4433
|
*
|
|
@@ -4365,7 +4446,7 @@ interface ReactiveDataDocument<T> extends ReactiveDocumentBase<T> {
|
|
|
4365
4446
|
* @public
|
|
4366
4447
|
*/
|
|
4367
4448
|
readonly errors?: undefined;
|
|
4368
|
-
}
|
|
4449
|
+
};
|
|
4369
4450
|
/**
|
|
4370
4451
|
* A Document is a class that wraps the response content from a request to the API
|
|
4371
4452
|
* returned by `Cache.put` or `Cache.peek`, converting ResourceKeys into
|
|
@@ -4377,7 +4458,7 @@ interface ReactiveDataDocument<T> extends ReactiveDocumentBase<T> {
|
|
|
4377
4458
|
*
|
|
4378
4459
|
* @public
|
|
4379
4460
|
*/
|
|
4380
|
-
type ReactiveDocument<T> = ReactiveDataDocument<T> | ReactiveErrorDocument<T>;
|
|
4461
|
+
type ReactiveDocument<T, M extends Meta | undefined = Meta | undefined, E extends object = object, EM extends Meta | undefined = M> = ReactiveDataDocument<T, M, E, EM> | ReactiveErrorDocument<T, EM, E, M>;
|
|
4381
4462
|
//#endregion
|
|
4382
4463
|
//#region src/store/-private/managers/cache-capabilities-manager.d.ts
|
|
4383
4464
|
interface CacheCapabilitiesManager {
|
|
@@ -4519,7 +4600,8 @@ declare class CacheManager implements Cache {
|
|
|
4519
4600
|
* Push resource data from a remote source into the cache for this ResourceKey
|
|
4520
4601
|
*
|
|
4521
4602
|
* @public
|
|
4522
|
-
* @return
|
|
4603
|
+
* @return when `hasRecord` is true, the names of the attributes whose persisted value
|
|
4604
|
+
* this push changed, or `undefined` when none did. Otherwise `void`.
|
|
4523
4605
|
*/
|
|
4524
4606
|
upsert(key: ResourceKey, data: unknown, hasRecord: boolean): void | string[];
|
|
4525
4607
|
/**
|
|
@@ -4621,9 +4703,9 @@ declare class CacheManager implements Cache {
|
|
|
4621
4703
|
*
|
|
4622
4704
|
* @public
|
|
4623
4705
|
*/
|
|
4624
|
-
didCommit(key: ResourceKey, result: StructuredDataDocument<SingleResourceDataDocument
|
|
4625
|
-
didCommit(key: ResourceKey[], result: StructuredDataDocument<SingleResourceDataDocument
|
|
4626
|
-
didCommit(key: ResourceKey[], result: StructuredDataDocument<CollectionResourceDataDocument
|
|
4706
|
+
didCommit(key: ResourceKey, result: StructuredDataDocument<SingleResourceDataDocument<ExistingResourceObject, ExistingResourceObject>> | null): SingleResourceDataDocument;
|
|
4707
|
+
didCommit(key: ResourceKey[], result: StructuredDataDocument<SingleResourceDataDocument<ExistingResourceObject, ExistingResourceObject>> | null): SingleResourceDataDocument;
|
|
4708
|
+
didCommit(key: ResourceKey[], result: StructuredDataDocument<CollectionResourceDataDocument<ExistingResourceObject>> | null): CollectionResourceDataDocument;
|
|
4627
4709
|
/**
|
|
4628
4710
|
* [LIFECYCLE] Signals to the cache that a resource
|
|
4629
4711
|
* was update via a save transaction failed.
|
|
@@ -7963,7 +8045,7 @@ declare class DefaultCachePolicy implements CachePolicy {
|
|
|
7963
8045
|
/**
|
|
7964
8046
|
* @deprecated use {@link ReactiveDocument} instead
|
|
7965
8047
|
*/
|
|
7966
|
-
type Document<T> = ReactiveDocument<T>;
|
|
8048
|
+
type Document<T, M extends Meta | undefined = Meta | undefined, E extends object = object, EM extends Meta | undefined = M> = ReactiveDocument<T, M, E, EM>;
|
|
7967
8049
|
/**
|
|
7968
8050
|
* Options for setting up a Store instance with `useRecommendedStore`.
|
|
7969
8051
|
*/
|
|
@@ -9178,5 +9260,5 @@ declare function peekInternalSignal(signals: SignalStore | undefined, key: strin
|
|
|
9178
9260
|
*/
|
|
9179
9261
|
declare function notifyInternalSignal(signal: WarpDriveSignal | undefined): void;
|
|
9180
9262
|
//#endregion
|
|
9181
|
-
export { PrivateRequestStateService as $,
|
|
9182
|
-
//# sourceMappingURL=internal-
|
|
9263
|
+
export { PrivateRequestStateService as $, UpdateRequestOptions as $n, NotificationType as $t, PolicyConfig as A, CreateRequestOptions as An, withReactiveResponse as At, logGroup as B, ImmutableRequestInfo as Bn, GraphEdge as Bt, getPromiseState as C, FindAllOptions as Cn, ReactiveDocument as Ct, useRecommendedStore as D, ModelSchema as Dn, StoreRequestContext as Dt, StoreSetupOptions as E, QueryOptions as En, CacheHandler as Et, PrivateReactiveResource as F, HTTPMethod as Fn, createDeferred as Ft, ensureStringId as G, RequestContext as Gn, Cache as Gt, createLegacyManyArray as H, PostQueryRequestOptions as Hn, ImplicitEdge as Ht, ReactiveResource as I, IS_FUTURE as In, graphFor as It, PrivateStore as J, STRUCTURED as Jn, CacheCapabilitiesManager$1 as Jt, constructResource as K, RequestInfo as Kn, ChangedAttributesHash as Kt, checkout as L, ImmutableCreateRequestOptions as Ln, peekGraph as Lt, Fetch as M, EnableHydration as Mn, Awaitable as Mt, instantiateRecord as N, FindRecordOptions$2 as Nn, getPromiseResult as Nt, CacheControlValue as O, CacheOptions as On, StoreRequestInput as Ot, teardownRecord as P, FindRecordRequestOptions as Pn, setPromiseResult as Pt, FindRecordQuery as Q, StructuredErrorDocument as Qn, NotificationManager$1 as Qt, commit as R, ImmutableDeleteRequestOptions as Rn, isBelongsTo as Rt, ResolvedPromise as S, BaseFinderOptions as Sn, ReactiveDataDocument as St, Document as T, LegacyResourceQuery as Tn, CachePolicy as Tt, normalizeModelName as U, QueryRequestOptions as Un, CollectionEdge as Ut, LegacyManyArray as V, ImmutableUpdateRequestOptions as Vn, ResourceEdge as Vt, coerceId as W, RemotelyAccessibleIdentifier as Wn, UpgradedMeta as Wt, assertPrivateStore as X, StructuredDataDocument as Xn, DocumentCacheOperation$1 as Xt, Store$1 as Y, SkipCache as Yn, CacheOperation$1 as Yt, isPrivateStore as Z, StructuredDocument as Zn, NotificationChannel as Zt, RequestState as _, SchemaService$1 as _n, recordIdentifierFor as _t, notifyInternalSignal as a, setIdentifierForgetMethod as an, Handler as ar, fastPush as at, PromiseState as b, registerDerivations as bn, PrivateCacheCapabilitiesManager as bt, AutorefreshBehaviorCombos as c, setIdentifierUpdateMethod as cn, RequestManager as cr, PrivateReactiveResourceArray as ct, RecoveryFeatures as d, RelationshipsSchema as dn, Checkout as dt, NotifyKeys as en, FetchError as er, Request$1 as et, RequestArgs as f, SchemaService as fn, Context as ft, RequestLoadingState as g, ProcessedExtension as gn, _clearCaches as gt, createRequestSubscription as h, ExtensionDef as hn, StoreMap as ht, makeInitializer as i, isResourceKey as in, Future as ir, RecordArrayManager as it, parseCacheControl as j, DeleteRequestOptions as jn, withResponseType as jt, DefaultCachePolicy as k, ConstrainedRequestOptions as kn, withBrand as kt, ContentFeatures as l, setKeyInfoForResource as ln, ReactiveResourceArray as lt, SubscriptionArgs as m, ExtensibleField as mn, InstanceCache as mt, WarpDriveSignal as n, fieldValueIdentity as nn, CacheHandler$1 as nr, RequestStateService as nt, peekInternalSignal as o, setIdentifierGenerationMethod as on, ManagedRequestPriority as or, LegacyQueryArray as ot, RequestSubscription as p, CAUTION_MEGA_DANGER_ZONE_Extension as pn, NativeProxy as pt, CreateRecordProperties as q, ResponseInfo as qn, RelationshipDiff as qt, getOrCreateInternalSignal as r, isRequestKey as rn, Deferred as rr, SaveRecordMutation as rt, withSignalStore as s, setIdentifierResetMethod as sn, NextFn as sr, LegacyLiveArray as st, SignalStore as t, FieldValueIdentity as tn, Context$1 as tr, RequestCacheRequestState as tt, DISPOSE as u, AttributesSchema as un, ManagedArray as ut, getRequestState as v, Transformation as vn, setRecordIdentifier as vt, ConfiguredStore as w, FindRecordOptions as wn, ReactiveErrorDocument as wt, RejectedPromise as x, withDefaults as xn, assertPrivateCapabilities as xt, PendingPromise as y, fromIdentity as yn, storeFor as yt, log as z, ImmutableHeaders as zn, Graph as zt };
|
|
9264
|
+
//# sourceMappingURL=internal-9XuWZdDv.d.ts.map
|