@warp-drive/core 5.8.0-alpha.9 → 5.8.0-beta.1
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/README.md +22 -38
- package/declarations/configure.d.ts +1 -1
- package/declarations/graph/-private/-edge-definition.d.ts +12 -2
- package/declarations/index.d.ts +14 -9
- package/declarations/reactive/-private/default-mode.d.ts +1 -1
- package/declarations/reactive/-private/fields/extension.d.ts +1 -1
- package/declarations/reactive/-private/fields/managed-array.d.ts +2 -2
- package/declarations/reactive/-private/fields/managed-object.d.ts +1 -1
- package/declarations/reactive/-private/record.d.ts +10 -1
- package/declarations/reactive/-private.d.ts +1 -0
- package/declarations/reactive.d.ts +11 -7
- package/declarations/request/-private/types.d.ts +1 -1
- package/declarations/signals/-leaked.d.ts +2 -0
- package/declarations/signals/-private.d.ts +6 -0
- package/declarations/{store/-private/new-core-tmp → signals}/promise-state.d.ts +1 -1
- package/declarations/{store/-private/new-core-tmp → signals}/request-state.d.ts +6 -6
- package/declarations/{store/-private/new-core-tmp → signals}/request-subscription.d.ts +4 -4
- package/declarations/store/-private/cache-handler/types.d.ts +2 -16
- package/declarations/store/-private/caches/instance-cache.d.ts +1 -1
- package/declarations/store/-private/managers/cache-manager.d.ts +1 -14
- package/declarations/store/-private/managers/notification-manager.d.ts +1 -1
- package/declarations/store/-private/record-arrays/legacy-many-array.d.ts +1 -1
- package/declarations/store/-private/record-arrays/resource-array.d.ts +1 -1
- package/declarations/store/-private/store-service.d.ts +2 -2
- package/declarations/store/-private.d.ts +0 -6
- package/declarations/store/deprecated/-private.d.ts +2 -2
- package/declarations/store/deprecated/store.d.ts +1 -1
- package/declarations/store.d.ts +1 -0
- package/declarations/types/cache.d.ts +2 -2
- package/declarations/types/record.d.ts +132 -0
- package/declarations/types/request.d.ts +22 -8
- package/declarations/types/schema/fields.d.ts +26 -13
- package/declarations/types/schema/schema-service.d.ts +4 -4
- package/declarations/types/spec/document.d.ts +34 -0
- package/dist/configure-DPUFCemT.js +1940 -0
- package/dist/configure.js +2 -1
- package/dist/{request-oqoLC9rz.js → future-BKkJJkj7.js} +1 -48
- package/dist/graph/-private.js +15 -5
- package/dist/{index-B1cSRj-N.js → index-CQP2NSqg.js} +63 -1812
- package/dist/index.js +5 -5
- package/dist/reactive/-private.js +1 -1
- package/dist/reactive.js +4 -129
- package/dist/request.js +49 -1
- package/dist/signals/-leaked.js +1 -0
- package/dist/store/-private.js +1 -2
- package/dist/symbols-3C1OkYtZ.js +39 -0
- package/dist/types/-private.js +1 -1
- package/dist/types/record.js +127 -0
- package/dist/types/request.js +11 -7
- package/dist/unpkg/dev/-leaked-Co0EI6Go.js +1939 -0
- package/dist/unpkg/dev/build-config/babel-macros.js +1 -0
- package/dist/unpkg/dev/build-config/canary-features.js +1 -0
- package/dist/unpkg/dev/build-config/debugging.js +1 -0
- package/dist/unpkg/dev/build-config/deprecations.js +1 -0
- package/dist/unpkg/dev/build-config/env.js +1 -0
- package/dist/unpkg/dev/build-config/macros.js +1 -0
- package/dist/unpkg/dev/build-config.js +1 -0
- package/dist/unpkg/dev/configure.js +1 -0
- package/dist/unpkg/dev/future-DFfOzSoe.js +672 -0
- package/dist/unpkg/dev/graph/-private.js +3132 -0
- package/dist/unpkg/dev/index-BzcBOnw9.js +9392 -0
- package/dist/unpkg/dev/index.js +6 -0
- package/dist/unpkg/dev/reactive/-private.js +1 -0
- package/dist/unpkg/dev/reactive.js +3 -0
- package/dist/unpkg/dev/request.js +49 -0
- package/dist/unpkg/dev/runtime-E1M51_-O.js +135 -0
- package/dist/unpkg/dev/signals/-leaked.js +1 -0
- package/dist/unpkg/dev/store/-private.js +55 -0
- package/dist/unpkg/dev/store.js +558 -0
- package/dist/unpkg/dev/types/-private.js +69 -0
- package/dist/unpkg/dev/types/cache/aliases.js +0 -0
- package/dist/unpkg/dev/types/cache/change.js +0 -0
- package/dist/unpkg/dev/types/cache/mutations.js +0 -0
- package/dist/unpkg/dev/types/cache/operations.js +0 -0
- package/dist/unpkg/dev/types/cache/relationship.js +0 -0
- package/dist/unpkg/dev/types/cache.js +0 -0
- package/dist/unpkg/dev/types/graph.js +0 -0
- package/dist/unpkg/dev/types/identifier.js +61 -0
- package/dist/unpkg/dev/types/json/raw.js +0 -0
- package/dist/unpkg/dev/types/params.js +0 -0
- package/dist/unpkg/dev/types/record.js +191 -0
- package/dist/unpkg/dev/types/request.js +77 -0
- package/dist/unpkg/dev/types/runtime.js +34 -0
- package/dist/unpkg/dev/types/schema/concepts.js +0 -0
- package/dist/unpkg/dev/types/schema/fields.js +505 -0
- package/dist/unpkg/dev/types/schema/fields.type-test.js +0 -0
- package/dist/unpkg/dev/types/schema/schema-service.js +0 -0
- package/dist/unpkg/dev/types/spec/document.js +0 -0
- package/dist/unpkg/dev/types/spec/error.js +0 -0
- package/dist/unpkg/dev/types/spec/json-api-raw.js +0 -0
- package/dist/unpkg/dev/types/symbols.js +84 -0
- package/dist/unpkg/dev/types/utils.js +0 -0
- package/dist/unpkg/dev/types.js +0 -0
- package/dist/unpkg/dev/utils/string.js +91 -0
- package/dist/unpkg/dev-deprecated/-leaked-DjMeRqdU.js +1939 -0
- package/dist/unpkg/dev-deprecated/-private-3C1OkYtZ.js +39 -0
- package/dist/unpkg/dev-deprecated/build-config/babel-macros.js +1 -0
- package/dist/unpkg/dev-deprecated/build-config/canary-features.js +1 -0
- package/dist/unpkg/dev-deprecated/build-config/debugging.js +1 -0
- package/dist/unpkg/dev-deprecated/build-config/deprecations.js +1 -0
- package/dist/unpkg/dev-deprecated/build-config/env.js +1 -0
- package/dist/unpkg/dev-deprecated/build-config/macros.js +1 -0
- package/dist/unpkg/dev-deprecated/build-config.js +1 -0
- package/dist/unpkg/dev-deprecated/configure.js +1 -0
- package/dist/unpkg/dev-deprecated/future-DFfOzSoe.js +672 -0
- package/dist/unpkg/dev-deprecated/graph/-private.js +3327 -0
- package/dist/unpkg/dev-deprecated/index-6TnTv-WG.js +10007 -0
- package/dist/unpkg/dev-deprecated/index.js +5 -0
- package/dist/unpkg/dev-deprecated/reactive/-private.js +1 -0
- package/dist/unpkg/dev-deprecated/reactive.js +3 -0
- package/dist/unpkg/dev-deprecated/request.js +49 -0
- package/dist/unpkg/dev-deprecated/runtime-DAu5b0IR.js +135 -0
- package/dist/unpkg/dev-deprecated/signals/-leaked.js +1 -0
- package/dist/unpkg/dev-deprecated/store/-private.js +1 -0
- package/dist/unpkg/dev-deprecated/store.js +558 -0
- package/dist/unpkg/dev-deprecated/types/-private.js +69 -0
- package/dist/unpkg/dev-deprecated/types/cache/aliases.js +0 -0
- package/dist/unpkg/dev-deprecated/types/cache/change.js +0 -0
- package/dist/unpkg/dev-deprecated/types/cache/mutations.js +0 -0
- package/dist/unpkg/dev-deprecated/types/cache/operations.js +0 -0
- package/dist/unpkg/dev-deprecated/types/cache/relationship.js +0 -0
- package/dist/unpkg/dev-deprecated/types/cache.js +0 -0
- package/dist/unpkg/dev-deprecated/types/graph.js +0 -0
- package/dist/unpkg/dev-deprecated/types/identifier.js +61 -0
- package/dist/unpkg/dev-deprecated/types/json/raw.js +0 -0
- package/dist/unpkg/dev-deprecated/types/params.js +0 -0
- package/dist/unpkg/dev-deprecated/types/record.js +191 -0
- package/dist/unpkg/dev-deprecated/types/request.js +77 -0
- package/dist/unpkg/dev-deprecated/types/runtime.js +34 -0
- package/dist/unpkg/dev-deprecated/types/schema/concepts.js +0 -0
- package/dist/unpkg/dev-deprecated/types/schema/fields.js +505 -0
- package/dist/unpkg/dev-deprecated/types/schema/fields.type-test.js +0 -0
- package/dist/unpkg/dev-deprecated/types/schema/schema-service.js +0 -0
- package/dist/unpkg/dev-deprecated/types/spec/document.js +0 -0
- package/dist/unpkg/dev-deprecated/types/spec/error.js +0 -0
- package/dist/unpkg/dev-deprecated/types/spec/json-api-raw.js +0 -0
- package/dist/unpkg/dev-deprecated/types/symbols.js +84 -0
- package/dist/unpkg/dev-deprecated/types/utils.js +0 -0
- package/dist/unpkg/dev-deprecated/types.js +0 -0
- package/dist/unpkg/dev-deprecated/utils/string.js +91 -0
- package/dist/unpkg/prod/-leaked-DUONXQDB.js +1676 -0
- package/dist/unpkg/prod/-private-sql1_mdx.js +39 -0
- package/dist/unpkg/prod/build-config/babel-macros.js +1 -0
- package/dist/unpkg/prod/build-config/canary-features.js +1 -0
- package/dist/unpkg/prod/build-config/debugging.js +1 -0
- package/dist/unpkg/prod/build-config/deprecations.js +1 -0
- package/dist/unpkg/prod/build-config/env.js +1 -0
- package/dist/unpkg/prod/build-config/macros.js +1 -0
- package/dist/unpkg/prod/build-config.js +1 -0
- package/dist/unpkg/prod/configure.js +2 -0
- package/dist/unpkg/prod/graph/-private.js +2235 -0
- package/dist/unpkg/prod/handler-EU_8ncB2.js +1619 -0
- package/dist/unpkg/prod/index.js +483 -0
- package/dist/unpkg/prod/promise-cache-DIT8Ypjq.js +19 -0
- package/dist/unpkg/prod/reactive/-private.js +1 -0
- package/dist/unpkg/prod/reactive.js +30 -0
- package/dist/unpkg/prod/request-BrJSCG6r.js +421 -0
- package/dist/unpkg/prod/request.js +2 -0
- package/dist/unpkg/prod/schema-BSkHyoWz.js +5219 -0
- package/dist/unpkg/prod/signals/-leaked.js +1 -0
- package/dist/unpkg/prod/store/-private.js +126 -0
- package/dist/unpkg/prod/store.js +437 -0
- package/dist/unpkg/prod/types/-private.js +49 -0
- package/dist/unpkg/prod/types/cache/aliases.js +0 -0
- package/dist/unpkg/prod/types/cache/change.js +0 -0
- package/dist/unpkg/prod/types/cache/mutations.js +0 -0
- package/dist/unpkg/prod/types/cache/operations.js +0 -0
- package/dist/unpkg/prod/types/cache/relationship.js +0 -0
- package/dist/unpkg/prod/types/cache.js +0 -0
- package/dist/unpkg/prod/types/graph.js +0 -0
- package/dist/unpkg/prod/types/identifier.js +61 -0
- package/dist/unpkg/prod/types/json/raw.js +0 -0
- package/dist/unpkg/prod/types/params.js +0 -0
- package/dist/unpkg/prod/types/record.js +191 -0
- package/dist/unpkg/prod/types/request.js +77 -0
- package/dist/unpkg/prod/types/runtime.js +34 -0
- package/dist/unpkg/prod/types/schema/concepts.js +0 -0
- package/dist/unpkg/prod/types/schema/fields.js +505 -0
- package/dist/unpkg/prod/types/schema/fields.type-test.js +0 -0
- package/dist/unpkg/prod/types/schema/schema-service.js +0 -0
- package/dist/unpkg/prod/types/spec/document.js +0 -0
- package/dist/unpkg/prod/types/spec/error.js +0 -0
- package/dist/unpkg/prod/types/spec/json-api-raw.js +0 -0
- package/dist/unpkg/prod/types/symbols.js +84 -0
- package/dist/unpkg/prod/types/utils.js +0 -0
- package/dist/unpkg/prod/types.js +0 -0
- package/dist/unpkg/prod/utils/string.js +72 -0
- package/dist/unpkg/prod-deprecated/-leaked-DRNv9VIX.js +1676 -0
- package/dist/unpkg/prod-deprecated/-private-3C1OkYtZ.js +39 -0
- package/dist/unpkg/prod-deprecated/build-config/babel-macros.js +1 -0
- package/dist/unpkg/prod-deprecated/build-config/canary-features.js +1 -0
- package/dist/unpkg/prod-deprecated/build-config/debugging.js +1 -0
- package/dist/unpkg/prod-deprecated/build-config/deprecations.js +1 -0
- package/dist/unpkg/prod-deprecated/build-config/env.js +1 -0
- package/dist/unpkg/prod-deprecated/build-config/macros.js +1 -0
- package/dist/unpkg/prod-deprecated/build-config.js +1 -0
- package/dist/unpkg/prod-deprecated/configure.js +2 -0
- package/dist/unpkg/prod-deprecated/graph/-private.js +2408 -0
- package/dist/unpkg/prod-deprecated/handler-CCIu4sQ3.js +334 -0
- package/dist/unpkg/prod-deprecated/hooks-Dv4Np0MY.js +26 -0
- package/dist/unpkg/prod-deprecated/index.js +483 -0
- package/dist/unpkg/prod-deprecated/promise-cache-DIT8Ypjq.js +19 -0
- package/dist/unpkg/prod-deprecated/reactive/-private.js +1 -0
- package/dist/unpkg/prod-deprecated/reactive.js +5 -0
- package/dist/unpkg/prod-deprecated/request-BrJSCG6r.js +421 -0
- package/dist/unpkg/prod-deprecated/request.js +2 -0
- package/dist/unpkg/prod-deprecated/schema-CJcjHv0E.js +6939 -0
- package/dist/unpkg/prod-deprecated/signals/-leaked.js +1 -0
- package/dist/unpkg/prod-deprecated/store/-private.js +88 -0
- package/dist/unpkg/prod-deprecated/store.js +437 -0
- package/dist/unpkg/prod-deprecated/types/-private.js +49 -0
- package/dist/unpkg/prod-deprecated/types/cache/aliases.js +0 -0
- package/dist/unpkg/prod-deprecated/types/cache/change.js +0 -0
- package/dist/unpkg/prod-deprecated/types/cache/mutations.js +0 -0
- package/dist/unpkg/prod-deprecated/types/cache/operations.js +0 -0
- package/dist/unpkg/prod-deprecated/types/cache/relationship.js +0 -0
- package/dist/unpkg/prod-deprecated/types/cache.js +0 -0
- package/dist/unpkg/prod-deprecated/types/graph.js +0 -0
- package/dist/unpkg/prod-deprecated/types/identifier.js +61 -0
- package/dist/unpkg/prod-deprecated/types/json/raw.js +0 -0
- package/dist/unpkg/prod-deprecated/types/params.js +0 -0
- package/dist/unpkg/prod-deprecated/types/record.js +191 -0
- package/dist/unpkg/prod-deprecated/types/request.js +77 -0
- package/dist/unpkg/prod-deprecated/types/runtime.js +34 -0
- package/dist/unpkg/prod-deprecated/types/schema/concepts.js +0 -0
- package/dist/unpkg/prod-deprecated/types/schema/fields.js +505 -0
- package/dist/unpkg/prod-deprecated/types/schema/fields.type-test.js +0 -0
- package/dist/unpkg/prod-deprecated/types/schema/schema-service.js +0 -0
- package/dist/unpkg/prod-deprecated/types/spec/document.js +0 -0
- package/dist/unpkg/prod-deprecated/types/spec/error.js +0 -0
- package/dist/unpkg/prod-deprecated/types/spec/json-api-raw.js +0 -0
- package/dist/unpkg/prod-deprecated/types/symbols.js +84 -0
- package/dist/unpkg/prod-deprecated/types/utils.js +0 -0
- package/dist/unpkg/prod-deprecated/types.js +0 -0
- package/dist/unpkg/prod-deprecated/utils/string.js +72 -0
- package/logos/README.md +2 -2
- package/logos/logo-yellow-slab.svg +1 -0
- package/logos/word-mark-black.svg +1 -0
- package/logos/word-mark-white.svg +1 -0
- package/package.json +11 -3
- package/declarations/store/-private/new-core-tmp/expensive-subscription.d.ts +0 -24
- package/dist/configure-C3x8YXzL.js +0 -181
- package/logos/NCC-1701-a-blue.svg +0 -4
- package/logos/NCC-1701-a-gold.svg +0 -4
- package/logos/NCC-1701-a-gold_100.svg +0 -1
- package/logos/NCC-1701-a-gold_base-64.txt +0 -1
- package/logos/NCC-1701-a.svg +0 -4
- package/logos/docs-badge.svg +0 -2
- package/logos/ember-data-logo-dark.svg +0 -12
- package/logos/ember-data-logo-light.svg +0 -12
- package/logos/social1.png +0 -0
- package/logos/social2.png +0 -0
- package/logos/warp-drive-logo-dark.svg +0 -4
- package/logos/warp-drive-logo-gold.svg +0 -4
- /package/declarations/{store/-private/new-core-tmp → signals}/reactivity/configure.d.ts +0 -0
- /package/declarations/{store/-private/new-core-tmp → signals}/reactivity/internal.d.ts +0 -0
- /package/declarations/{store/-private/new-core-tmp → signals}/reactivity/signal.d.ts +0 -0
- /package/dist/{symbols-sql1_mdx.js → unpkg/dev/-private-sql1_mdx.js} +0 -0
package/dist/configure.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { u as setupSignals } from "./configure-DPUFCemT.js";
|
|
2
|
+
import '@embroider/macros';
|
|
@@ -675,51 +675,4 @@ function createFuture(owner) {
|
|
|
675
675
|
deferred.promise = promise;
|
|
676
676
|
return deferred;
|
|
677
677
|
}
|
|
678
|
-
|
|
679
|
-
/**
|
|
680
|
-
* Brands the supplied object with the supplied response type.
|
|
681
|
-
*
|
|
682
|
-
* ```ts
|
|
683
|
-
* import type { ReactiveDataDocument } from '@warp-drive/core/reactive';
|
|
684
|
-
* import { withResponseType } from '@warp-drive/core/request';
|
|
685
|
-
* import type { User } from '#/data/user.ts'
|
|
686
|
-
*
|
|
687
|
-
* const result = await store.request(
|
|
688
|
-
* withResponseType<ReactiveDataDocument<User>>({ url: '/users/1' })
|
|
689
|
-
* );
|
|
690
|
-
*
|
|
691
|
-
* result.content.data; // will have type User
|
|
692
|
-
* ```
|
|
693
|
-
*
|
|
694
|
-
*/
|
|
695
|
-
function withResponseType(obj) {
|
|
696
|
-
return obj;
|
|
697
|
-
}
|
|
698
|
-
|
|
699
|
-
/**
|
|
700
|
-
* Brands the supplied object with the supplied response type
|
|
701
|
-
* wrapped in {@link ReactiveDataDocument}. This is a convenience for
|
|
702
|
-
* the common case of using {@link withResponseType} with `ReactiveDataDocument`.
|
|
703
|
-
*
|
|
704
|
-
* ```ts
|
|
705
|
-
* import { withReactiveResponse } from '@warp-drive/core/request';
|
|
706
|
-
* import type { User } from '#/data/user.ts'
|
|
707
|
-
*
|
|
708
|
-
* const result = await store.request(
|
|
709
|
-
* withReactiveResponse<User>({ url: '/users/1' })
|
|
710
|
-
* );
|
|
711
|
-
*
|
|
712
|
-
* result.content.data; // will have type User
|
|
713
|
-
* ```
|
|
714
|
-
*
|
|
715
|
-
* @public
|
|
716
|
-
*/
|
|
717
|
-
function withReactiveResponse(obj) {
|
|
718
|
-
return obj;
|
|
719
|
-
}
|
|
720
|
-
|
|
721
|
-
/**
|
|
722
|
-
* @deprecated use {@link withResponseType} instead
|
|
723
|
-
*/
|
|
724
|
-
const withBrand = withResponseType;
|
|
725
|
-
export { IS_CACHE_HANDLER as I, assertValidRequest as a, getRequestResult as b, cloneResponseProperties as c, clearRequestResult as d, executeNextHandler as e, withResponseType as f, getPromiseResult as g, withReactiveResponse as h, createDeferred as i, setPromiseResult as s, upgradePromise as u, withBrand as w };
|
|
678
|
+
export { IS_CACHE_HANDLER as I, cloneResponseProperties as a, assertValidRequest as b, createDeferred as c, getRequestResult as d, executeNextHandler as e, clearRequestResult as f, getPromiseResult as g, setPromiseResult as s, upgradePromise as u };
|
package/dist/graph/-private.js
CHANGED
|
@@ -349,6 +349,7 @@ function implicitKeyFor(type, key) {
|
|
|
349
349
|
function syncMeta(definition, inverseDefinition) {
|
|
350
350
|
definition.inverseKind = inverseDefinition.kind;
|
|
351
351
|
definition.inverseKey = inverseDefinition.key;
|
|
352
|
+
definition.inverseName = inverseDefinition.name;
|
|
352
353
|
definition.inverseType = inverseDefinition.type;
|
|
353
354
|
definition.inverseIsAsync = inverseDefinition.isAsync;
|
|
354
355
|
definition.inverseIsCollection = inverseDefinition.isCollection;
|
|
@@ -366,7 +367,8 @@ function upgradeMeta(meta) {
|
|
|
366
367
|
const niceMeta = {};
|
|
367
368
|
const options = meta.options;
|
|
368
369
|
niceMeta.kind = meta.kind;
|
|
369
|
-
niceMeta.key = meta.name;
|
|
370
|
+
niceMeta.key = meta.sourceKey ?? meta.name;
|
|
371
|
+
niceMeta.name = meta.name;
|
|
370
372
|
niceMeta.type = meta.type;
|
|
371
373
|
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
372
374
|
if (!test) {
|
|
@@ -379,6 +381,7 @@ function upgradeMeta(meta) {
|
|
|
379
381
|
niceMeta.isPolymorphic = options && !!options.polymorphic;
|
|
380
382
|
niceMeta.isLinksMode = options.linksMode ?? false;
|
|
381
383
|
niceMeta.inverseKey = options && options.inverse || STR_LATER;
|
|
384
|
+
niceMeta.inverseName = options && options.inverse || STR_LATER;
|
|
382
385
|
niceMeta.inverseType = STR_LATER;
|
|
383
386
|
niceMeta.inverseIsAsync = BOOL_LATER;
|
|
384
387
|
niceMeta.inverseIsImplicit = options && options.inverse === null || BOOL_LATER;
|
|
@@ -502,12 +505,13 @@ function upgradeDefinition(graph, key, propertyName, isImplicit = false) {
|
|
|
502
505
|
}
|
|
503
506
|
})(!isImplicit) : {};
|
|
504
507
|
const relationships = storeWrapper.schema.fields(key);
|
|
508
|
+
const relationshipsBySourceKey = storeWrapper.schema.cacheFields?.(key) ?? relationships;
|
|
505
509
|
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
506
510
|
if (!test) {
|
|
507
511
|
throw new Error(`Expected to have a relationship definition for ${type} but none was found.`);
|
|
508
512
|
}
|
|
509
513
|
})(relationships) : {};
|
|
510
|
-
const meta =
|
|
514
|
+
const meta = relationshipsBySourceKey.get(propertyName);
|
|
511
515
|
if (!meta) {
|
|
512
516
|
// TODO potentially we should just be permissive here since this is an implicit relationship
|
|
513
517
|
// and not require the lookup table to be populated
|
|
@@ -564,6 +568,7 @@ function upgradeDefinition(graph, key, propertyName, isImplicit = false) {
|
|
|
564
568
|
kind: 'belongsTo',
|
|
565
569
|
// this must be updated when we find the first belongsTo or hasMany definition that matches
|
|
566
570
|
key: definition.inverseKey,
|
|
571
|
+
name: definition.inverseName,
|
|
567
572
|
type: type,
|
|
568
573
|
isAsync: false,
|
|
569
574
|
// this must be updated when we find the first belongsTo or hasMany definition that matches
|
|
@@ -578,6 +583,7 @@ function upgradeDefinition(graph, key, propertyName, isImplicit = false) {
|
|
|
578
583
|
inverseDefinition = null;
|
|
579
584
|
} else {
|
|
580
585
|
// CASE: We have an explicit inverse or were able to resolve one
|
|
586
|
+
// for the inverse we use "name" for lookup not "sourceKey"
|
|
581
587
|
const inverseDefinitions = storeWrapper.schema.fields({
|
|
582
588
|
type: inverseType
|
|
583
589
|
});
|
|
@@ -710,7 +716,8 @@ function upgradeDefinition(graph, key, propertyName, isImplicit = false) {
|
|
|
710
716
|
return info;
|
|
711
717
|
}
|
|
712
718
|
function inverseForRelationship(store, resourceKey, key) {
|
|
713
|
-
const
|
|
719
|
+
const fields = store.schema.fields(resourceKey);
|
|
720
|
+
const definition = fields.get(key);
|
|
714
721
|
if (!definition) {
|
|
715
722
|
return null;
|
|
716
723
|
}
|
|
@@ -819,6 +826,7 @@ if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
|
|
|
819
826
|
function inverseDefinition(definition) {
|
|
820
827
|
return {
|
|
821
828
|
key: definition.inverseKey,
|
|
829
|
+
name: definition.inverseName,
|
|
822
830
|
type: definition.inverseType,
|
|
823
831
|
kind: definition.inverseKind,
|
|
824
832
|
isAsync: definition.inverseIsAsync,
|
|
@@ -827,6 +835,7 @@ if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
|
|
|
827
835
|
isCollection: definition.inverseIsCollection,
|
|
828
836
|
isImplicit: definition.inverseIsImplicit,
|
|
829
837
|
inverseKey: definition.key,
|
|
838
|
+
inverseName: definition.name,
|
|
830
839
|
inverseType: definition.type,
|
|
831
840
|
inverseKind: definition.kind,
|
|
832
841
|
inverseIsAsync: definition.isAsync,
|
|
@@ -2151,6 +2160,7 @@ function createCollectionEdge(definition, identifier) {
|
|
|
2151
2160
|
_diff: undefined
|
|
2152
2161
|
};
|
|
2153
2162
|
}
|
|
2163
|
+
const cp = structuredClone;
|
|
2154
2164
|
function legacyGetCollectionRelationshipData(source, getRemoteState) {
|
|
2155
2165
|
source.accessed = true;
|
|
2156
2166
|
const payload = {};
|
|
@@ -2158,10 +2168,10 @@ function legacyGetCollectionRelationshipData(source, getRemoteState) {
|
|
|
2158
2168
|
payload.data = getRemoteState ? source.remoteState.slice() : computeLocalState(source);
|
|
2159
2169
|
}
|
|
2160
2170
|
if (source.links) {
|
|
2161
|
-
payload.links = source.links;
|
|
2171
|
+
payload.links = cp(source.links);
|
|
2162
2172
|
}
|
|
2163
2173
|
if (source.meta) {
|
|
2164
|
-
payload.meta = source.meta;
|
|
2174
|
+
payload.meta = cp(source.meta);
|
|
2165
2175
|
}
|
|
2166
2176
|
return payload;
|
|
2167
2177
|
}
|