@warp-drive-mirror/core 5.10.0-alpha.16 → 5.10.0-alpha.18
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-Y-13dsHO.js.map +1 -1
- package/dist/build-config/babel-macros.d.ts +0 -5
- package/dist/build-config/canary-features.d.ts +0 -5
- package/dist/build-config/debugging.d.ts +0 -59
- package/dist/build-config/deprecations.d.ts +0 -5
- package/dist/build-config.d.ts +0 -17
- package/dist/configure.d.ts +0 -8
- package/dist/graph/-private.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/{internal-BOC6nyCi.d.ts → internal-DTPBJZLO.d.ts} +2 -1
- package/dist/{internal-BOC6nyCi.d.ts.map → internal-DTPBJZLO.d.ts.map} +1 -1
- package/dist/reactive/-private.d.ts +1 -1
- package/dist/reactive.d.ts +1 -276
- package/dist/reactive.js +1 -1
- package/dist/request.d.ts +1 -9
- package/dist/signals/-leaked.d.ts +1 -15
- package/dist/signals/-leaked.d.ts.map +1 -1
- package/dist/{src-DDLNZD8D.js → src-PuYJ-RSZ.js} +1 -279
- package/dist/src-PuYJ-RSZ.js.map +1 -0
- package/dist/store/-private.d.ts +1 -1
- package/dist/store/-private.js +1 -1
- package/dist/store.d.ts +1 -6
- package/dist/types/-private.js +1 -1
- package/dist/types/cache/relationship.d.ts +0 -5
- package/dist/types/cache.d.ts +1 -6
- package/dist/types/graph.d.ts +0 -5
- package/dist/types/record.d.ts +0 -5
- package/dist/types/request.d.ts +1 -1
- package/dist/types/schema/concepts.d.ts +0 -5
- package/dist/types/schema/schema-service.d.ts +1 -6
- package/dist/types/spec/error.d.ts +0 -4
- package/dist/types/spec/json-api-raw.d.ts +0 -5
- package/dist/types.d.ts +1 -9
- package/dist/unpkg/dev/-private-BoKjsWc1.js.map +1 -1
- package/dist/unpkg/dev/index.js +1 -1
- package/dist/unpkg/dev/reactive.js +1 -1
- package/dist/unpkg/dev/runtime-DhiRXM4s.js.map +1 -1
- package/dist/unpkg/dev/{src-DKHeerUf.js → src-Dy9m6GTv.js} +1 -279
- package/dist/unpkg/dev/src-Dy9m6GTv.js.map +1 -0
- package/dist/unpkg/dev/store/-private.js +1 -1
- package/dist/unpkg/dev/types/-private.js +1 -1
- package/dist/unpkg/dev-deprecated/-private-BoKjsWc1.js.map +1 -1
- package/dist/unpkg/dev-deprecated/index.js +1 -1
- package/dist/unpkg/dev-deprecated/reactive.js +1 -1
- package/dist/unpkg/dev-deprecated/runtime-DtHRI2Rj.js.map +1 -1
- package/dist/unpkg/dev-deprecated/{src-lyEz1lmd.js → src-ByOiBTF3.js} +1 -279
- package/dist/unpkg/dev-deprecated/src-ByOiBTF3.js.map +1 -0
- package/dist/unpkg/dev-deprecated/store/-private.js +1 -1
- package/dist/unpkg/dev-deprecated/types/-private.js +1 -1
- package/dist/unpkg/prod/-private-CRDwlN1v.js.map +1 -1
- package/dist/unpkg/prod/index.js +1 -1
- package/dist/unpkg/prod/reactive.js +1 -1
- package/dist/unpkg/prod/{src-Dagh1FmP.js → src-NuWjjfax.js} +1 -279
- package/dist/unpkg/prod/src-NuWjjfax.js.map +1 -0
- package/dist/unpkg/prod/store/-private.js +1 -1
- package/dist/unpkg/prod/types/-private.js +1 -1
- package/dist/unpkg/prod-deprecated/-private-CRDwlN1v.js.map +1 -1
- package/dist/unpkg/prod-deprecated/index.js +1 -1
- package/dist/unpkg/prod-deprecated/reactive.js +1 -1
- package/dist/unpkg/prod-deprecated/{src-3nV2sDcO.js → src-Bt7BkX1Y.js} +1 -279
- package/dist/unpkg/prod-deprecated/src-Bt7BkX1Y.js.map +1 -0
- package/dist/unpkg/prod-deprecated/store/-private.js +1 -1
- package/dist/unpkg/prod-deprecated/types/-private.js +1 -1
- package/package.json +6 -6
- package/dist/src-DDLNZD8D.js.map +0 -1
- package/dist/unpkg/dev/src-DKHeerUf.js.map +0 -1
- package/dist/unpkg/dev-deprecated/src-lyEz1lmd.js.map +0 -1
- package/dist/unpkg/prod/src-Dagh1FmP.js.map +0 -1
- package/dist/unpkg/prod-deprecated/src-3nV2sDcO.js.map +0 -1
|
@@ -1,18 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* Internals that `@warp-drive-mirror/core` leaks to its sibling `@warp-drive/*` packages:
|
|
3
|
-
* the signal primitives `@warp-drive-mirror/ember`, `@warp-drive-mirror/react`, `@warp-drive-mirror/legacy`
|
|
4
|
-
* and `@warp-drive-mirror/experiments` build on, and the reactive pagination primitives.
|
|
5
|
-
*
|
|
6
|
-
* This is not public API and is left out of the published docs. Apps should import
|
|
7
|
-
* pagination from `@warp-drive-mirror/experiments/pagination` and the Ember components from
|
|
8
|
-
* `@warp-drive-mirror/ember/experiments`; the request-subscription types are published from
|
|
9
|
-
* `@warp-drive-mirror/core/reactive`.
|
|
10
|
-
*
|
|
11
|
-
* @summary Private signal and pagination primitives that core shares with sibling `@warp-drive/*` packages; not
|
|
12
|
-
* public API for apps.
|
|
13
|
-
* @module
|
|
14
|
-
*/
|
|
15
|
-
import { Ot as ReactiveDocument, a as notifyInternalSignal, b as RequestLoadingState, c as AutorefreshBehaviorCombos, d as DISPOSE, et as Store, f as RecoveryFeatures, h as SubscriptionArgs, i as makeInitializer, lr as Future, n as WarpDriveSignal, o as peekInternalSignal, p as RequestArgs, pr as RequestManager, r as getOrCreateInternalSignal, rr as StructuredErrorDocument, s as withSignalStore, t as SignalStore, u as ContentFeatures } from "../internal-BOC6nyCi.js";
|
|
1
|
+
import { Ot as ReactiveDocument, a as notifyInternalSignal, b as RequestLoadingState, c as AutorefreshBehaviorCombos, d as DISPOSE, et as Store, f as RecoveryFeatures, h as SubscriptionArgs, i as makeInitializer, lr as Future, n as WarpDriveSignal, o as peekInternalSignal, p as RequestArgs, pr as RequestManager, r as getOrCreateInternalSignal, rr as StructuredErrorDocument, s as withSignalStore, t as SignalStore, u as ContentFeatures } from "../internal-DTPBJZLO.js";
|
|
16
2
|
import { s as waitFor } from "../configure-CodrrdQr.js";
|
|
17
3
|
//#region src/signals/page-cache.d.ts
|
|
18
4
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"-leaked.d.ts","names":[],"sources":["../../src/signals/page-cache.ts","../../src/signals/pagination-cache.ts","../../src/signals/pagination-state.ts","../../src/signals/pagination-links.ts","../../src/signals/pagination-subscription.ts","../../src/signals/pagination-links-subscription.ts","../../src/signals/reactivity/signal.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"-leaked.d.ts","names":[],"sources":["../../src/signals/page-cache.ts","../../src/signals/pagination-cache.ts","../../src/signals/pagination-state.ts","../../src/signals/pagination-links.ts","../../src/signals/pagination-subscription.ts","../../src/signals/pagination-links-subscription.ts","../../src/signals/reactivity/signal.ts"],"mappings":";;;;;;;KAiBY,YAAY,MAAM;EAAa,YAAY;IAAM,IAAI;;;;;KAMrD,YAAY,MAAM,YAAY,4BAA4B,OAAO,IAAI,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA+ChF,UAAU,cAAc;;;;;;EASnC,SAAyB,OAAO;;EAMhC;;EAGA;;EAGA;;EAGA;;EAGA;;;;;;EAOA;EAOA,YAAY,SAAS,gBAAgB,IAAI,IAAI;;;;;MAWzC,SAAS;;;;;MAST,QAAQ,YAAY;;;;;MASpB;;MAMA;;MAMA;;MAMA;;MAMA;;MAMA;;MAMA,UAAU,wBAAwB;;MAMlC,QAAQ,UAAU,IAAI;;MAOtB,QAAQ,UAAU,IAAI;;MAOtB,SAAS,UAAU,IAAI;;MAOvB,QAAQ,UAAU,IAAI;;;;;;;;;;;;;;;;;;;;;;;;UC7KX;GACd,UAAU;IAA8B;IAAqB;;;;;;;;;;;;;qBAanD,kBAAkB;;;;;;;;;;;;;;;;;cAsBlB,gBAAgB,cAAc;;;;;EAkBzC;EAeA,YAAY;;;;;;;;;;;;;;;MAmHR,SAAS,SAAS,SAAS,UAAU,IAAI;;;;;;;;;MAsBzC,QAAQ,SAAS,YAAY;;;;;;;;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,0BAA0B,kBAAkB,KAAK,GAAG,aAAa;UAMvE,oCAAoC;EAC5C;;;;;wBAMc,OAAO,kBAAkB,gBAAgB,YACvD,QAAQ,GACR,KAAK,GACL,aAAa;;;;wBA2BC,SAAS,kBAAkB,gBAAgB,YACzD,QAAQ,GACR,KAAK,GACL,YAAY,qBACX;;;;;;wBAyCa,KAAK,kBAAkB,gBAAgB,YACrD,SAAS,GACT,KAAK,GACL,MAAM,qBACL;;;;;;;;;;;;;;;wBA2Da,WAAW,kBAAkB,KAAK,GAAG,aAAa,MAAM"}
|
|
@@ -8483,284 +8483,6 @@ function mergeMap(base, toApply) {
|
|
|
8483
8483
|
for (const [key, value] of toApply) base.set(key, value);
|
|
8484
8484
|
}
|
|
8485
8485
|
|
|
8486
|
-
//#endregion
|
|
8487
|
-
//#region src/reactive.ts
|
|
8488
|
-
/**
|
|
8489
|
-
* # About
|
|
8490
|
-
*
|
|
8491
|
-
* This module provides an implementation of reactive objects that a Store may use for creating
|
|
8492
|
-
* reactive representations of the raw data for requests, resources and their relationships
|
|
8493
|
-
* stored in the cache.
|
|
8494
|
-
*
|
|
8495
|
-
* - For configuring the store to use these reactive objects, see [The Setup Guide](/guides/configuration/)
|
|
8496
|
-
* - For defining resource schemas, see [The Schema Guide](/guides/the-manual/schemas/)
|
|
8497
|
-
*
|
|
8498
|
-
* Any method that returns a record instance will use the `instantiateRecord`
|
|
8499
|
-
* hook configured above to instantiate a ReactiveResource once this is in place.
|
|
8500
|
-
* After that, its up to you what ReactiveResource can do.
|
|
8501
|
-
*
|
|
8502
|
-
* ## Modes
|
|
8503
|
-
*
|
|
8504
|
-
* ReactiveResource has two modes: `legacy` and `polaris`.
|
|
8505
|
-
*
|
|
8506
|
-
* **LegacyMode** can be used to emulate the behaviors and capabilities of WarpDrive's `Model` class,
|
|
8507
|
-
* and because there is little distinction between Model and a ReactiveResource in LegacyMode we refer
|
|
8508
|
-
* to both of these approaches as LegacyMode. This mode is the default experience in V5.
|
|
8509
|
-
*
|
|
8510
|
-
* In LegacyMode:
|
|
8511
|
-
*
|
|
8512
|
-
* - records are mutable
|
|
8513
|
-
* - local changes immediately reflect app wide
|
|
8514
|
-
* - records have all the APIs of Model (references, state props, currentState, methods etc)
|
|
8515
|
-
* - the continued use of `@warp-drive-mirror/legacy` is required (though most imports from it can be removed)
|
|
8516
|
-
* - `async: true` relationships are supported (but not recommended outside of [LinksMode](/guides/the-manual/misc/links-mode.md))
|
|
8517
|
-
*
|
|
8518
|
-
* ---
|
|
8519
|
-
*
|
|
8520
|
-
* **PolarisMode** is an upcoming suite of features that will become the default experience in V6.
|
|
8521
|
-
*
|
|
8522
|
-
* In PolarisMode:
|
|
8523
|
-
*
|
|
8524
|
-
* - records are immutable, unless creating a new resource or explicitly checking out a record for editing
|
|
8525
|
-
* - local changes are isolated until committed, displaying only via the editable version of the record
|
|
8526
|
-
* - records have a more limited API, focused on only what is in their schema.
|
|
8527
|
-
* - some common operations may have more friction to perform because intended utilities are not yet available
|
|
8528
|
-
* - `async: true` relationships are not supported (see [LinksMode](/guides/the-manual/misc/links-mode.md))
|
|
8529
|
-
* - The `@warp-drive-mirror/legacy` package is not required
|
|
8530
|
-
*
|
|
8531
|
-
* These modes are interopable. The reactive object (record) for a resource in PolarisMode can relate to
|
|
8532
|
-
* a record in LegacyMode and vice-versa. This interopability is true whether the record in LegacyMode is
|
|
8533
|
-
* a ReactiveResource or a Model.
|
|
8534
|
-
*
|
|
8535
|
-
* ---
|
|
8536
|
-
*
|
|
8537
|
-
* ## Basic Usage
|
|
8538
|
-
*
|
|
8539
|
-
* ReactiveResource is a reactive object that transforms raw data from an associated
|
|
8540
|
-
* cache into reactive data backed by Signals.
|
|
8541
|
-
*
|
|
8542
|
-
* The shape of the object and the transformation of raw cache data into its
|
|
8543
|
-
* reactive form is controlled by a resource schema.
|
|
8544
|
-
*
|
|
8545
|
-
* For instance, lets say your API is a [{json:api}](https://jsonapi.org) and your store is using
|
|
8546
|
-
* the Cache provided by {@link @warp-drive-mirror/json-api! | @warp-drive-mirror/json-api}, and a request
|
|
8547
|
-
* returns the following raw data:
|
|
8548
|
-
*
|
|
8549
|
-
* ```ts
|
|
8550
|
-
* {
|
|
8551
|
-
* data: {
|
|
8552
|
-
* type: 'user',
|
|
8553
|
-
* id: '1',
|
|
8554
|
-
* attributes: { firstName: 'Chris', lastName: 'Thoburn' },
|
|
8555
|
-
* relationships: { pets: { data: [{ type: 'dog', id: '1' }] }}
|
|
8556
|
-
* },
|
|
8557
|
-
* included: [
|
|
8558
|
-
* {
|
|
8559
|
-
* type: 'dog',
|
|
8560
|
-
* id: '1',
|
|
8561
|
-
* attributes: { name: 'Rey' },
|
|
8562
|
-
* relationships: { owner: { data: { type: 'user', id: '1' }}}
|
|
8563
|
-
* }
|
|
8564
|
-
* ]
|
|
8565
|
-
* }
|
|
8566
|
-
* ```
|
|
8567
|
-
*
|
|
8568
|
-
* We could describe the `'user'` and `'dog'` resources in the above payload
|
|
8569
|
-
* with the following schemas:
|
|
8570
|
-
*
|
|
8571
|
-
* ```ts
|
|
8572
|
-
* store.schema.registerResources([
|
|
8573
|
-
* {
|
|
8574
|
-
* type: 'user',
|
|
8575
|
-
* identity: { type: '@id', name: 'id' },
|
|
8576
|
-
* fields: [
|
|
8577
|
-
* {
|
|
8578
|
-
* type: '@identity',
|
|
8579
|
-
* name: '$type',
|
|
8580
|
-
* kind: 'derived',
|
|
8581
|
-
* options: { key: 'type' },
|
|
8582
|
-
* },
|
|
8583
|
-
* { kind: 'field', name: 'firstName' },
|
|
8584
|
-
* { kind: 'field', name: 'lastName' },
|
|
8585
|
-
* {
|
|
8586
|
-
* kind: 'derived',
|
|
8587
|
-
* name: 'name',
|
|
8588
|
-
* type: 'concat',
|
|
8589
|
-
* options: { fields: ['firstName', 'lastName'], separator: ' ' }
|
|
8590
|
-
* },
|
|
8591
|
-
* {
|
|
8592
|
-
* kind: 'hasMany',
|
|
8593
|
-
* name: 'pets',
|
|
8594
|
-
* type: 'pet',
|
|
8595
|
-
* options: {
|
|
8596
|
-
* async: false,
|
|
8597
|
-
* inverse: 'owner',
|
|
8598
|
-
* polymorphic: true,
|
|
8599
|
-
* linksMode: true,
|
|
8600
|
-
* }
|
|
8601
|
-
* }
|
|
8602
|
-
* ]
|
|
8603
|
-
* },
|
|
8604
|
-
* {
|
|
8605
|
-
* type: 'dog',
|
|
8606
|
-
* identity: { type: '@id', name: 'id' },
|
|
8607
|
-
* fields: [
|
|
8608
|
-
* {
|
|
8609
|
-
* type: '@identity',
|
|
8610
|
-
* name: '$type',
|
|
8611
|
-
* kind: 'derived',
|
|
8612
|
-
* options: { key: 'type' },
|
|
8613
|
-
* },
|
|
8614
|
-
* { kind: 'field', name: 'name' },
|
|
8615
|
-
* {
|
|
8616
|
-
* kind: 'belongsTo',
|
|
8617
|
-
* name: 'owner',
|
|
8618
|
-
* type: 'user',
|
|
8619
|
-
* options: {
|
|
8620
|
-
* async: false,
|
|
8621
|
-
* inverse: 'pets',
|
|
8622
|
-
* as: 'pet',
|
|
8623
|
-
* linksMode: true,
|
|
8624
|
-
* }
|
|
8625
|
-
* }
|
|
8626
|
-
* ]
|
|
8627
|
-
* }
|
|
8628
|
-
* ]);
|
|
8629
|
-
* ```
|
|
8630
|
-
*
|
|
8631
|
-
* With these schemas in place, the reactive objects that the store would
|
|
8632
|
-
* provide us whenever we encountered a `'user'` or a `'dog'` would be:
|
|
8633
|
-
*
|
|
8634
|
-
* ```ts
|
|
8635
|
-
* interface Pet {
|
|
8636
|
-
* readonly id: string;
|
|
8637
|
-
* readonly owner: User;
|
|
8638
|
-
* }
|
|
8639
|
-
*
|
|
8640
|
-
* interface Dog extends Pet {
|
|
8641
|
-
* readonly $type: 'dog';
|
|
8642
|
-
* readonly name: string;
|
|
8643
|
-
* }
|
|
8644
|
-
*
|
|
8645
|
-
* interface EditableUser {
|
|
8646
|
-
* readonly $type: 'user';
|
|
8647
|
-
* readonly id: string;
|
|
8648
|
-
* firstName: string;
|
|
8649
|
-
* lastName: string;
|
|
8650
|
-
* readonly name: string;
|
|
8651
|
-
* pets: Array<Dog | Pet>;
|
|
8652
|
-
* }
|
|
8653
|
-
*
|
|
8654
|
-
* interface User {
|
|
8655
|
-
* readonly $type: 'user';
|
|
8656
|
-
* readonly id: string;
|
|
8657
|
-
* readonly firstName: string;
|
|
8658
|
-
* readonly lastName: string;
|
|
8659
|
-
* readonly name: string;
|
|
8660
|
-
* readonly pets: Readonly<Array<Dog | Pet>>;
|
|
8661
|
-
* [Checkout](): Promise<EditableUser>
|
|
8662
|
-
* }>
|
|
8663
|
-
* ```
|
|
8664
|
-
*
|
|
8665
|
-
* Note how based on the schema the reactive object we receive is able to produce
|
|
8666
|
-
* `name` on user (despite no name field being in the cache), provide `$type`
|
|
8667
|
-
* pulled from the identity of the resource, and flatten the individual attributes
|
|
8668
|
-
* and relationships onto the record for easier use.
|
|
8669
|
-
*
|
|
8670
|
-
* Notice also how we typed this object with `readonly`. This is because while
|
|
8671
|
-
* ReactiveResource instances are ***deeply reactive***, they are also ***immutable***.
|
|
8672
|
-
*
|
|
8673
|
-
* We can mutate a ReactiveResource only be explicitly asking permission to do so, and
|
|
8674
|
-
* in the process gaining access to an editable copy. The immutable version will
|
|
8675
|
-
* not show any in-process edits made to this editable copy.
|
|
8676
|
-
*
|
|
8677
|
-
* ```ts
|
|
8678
|
-
* import { checkout } from '@warp-drive-mirror/core/reactive';
|
|
8679
|
-
*
|
|
8680
|
-
* const editable = await checkout<EditableUser>(user);
|
|
8681
|
-
* ```
|
|
8682
|
-
*
|
|
8683
|
-
* ## Utilities
|
|
8684
|
-
*
|
|
8685
|
-
* ReactiveResource provides a schema builder that simplifies setting up a couple of
|
|
8686
|
-
* conventional fields like identity and `$type`. We can rewrite the schema
|
|
8687
|
-
* definition above using this utility like so:
|
|
8688
|
-
*
|
|
8689
|
-
* ```ts
|
|
8690
|
-
* import { withDefaults } from '@warp-drive-mirror/core/reactive';
|
|
8691
|
-
*
|
|
8692
|
-
* store.schema.registerResources([
|
|
8693
|
-
* withDefaults({
|
|
8694
|
-
* type: 'user',
|
|
8695
|
-
* fields: [
|
|
8696
|
-
* { kind: 'field', name: 'firstName' },
|
|
8697
|
-
* { kind: 'field', name: 'lastName' },
|
|
8698
|
-
* {
|
|
8699
|
-
* kind: 'derived',
|
|
8700
|
-
* name: 'name',
|
|
8701
|
-
* type: 'concat',
|
|
8702
|
-
* options: { fields: ['firstName', 'lastName'], separator: ' ' }
|
|
8703
|
-
* },
|
|
8704
|
-
* {
|
|
8705
|
-
* kind: 'hasMany',
|
|
8706
|
-
* name: 'pets',
|
|
8707
|
-
* type: 'pet',
|
|
8708
|
-
* options: {
|
|
8709
|
-
* async: false,
|
|
8710
|
-
* inverse: 'owner',
|
|
8711
|
-
* polymorphic: true,
|
|
8712
|
-
* linksMode: true,
|
|
8713
|
-
* resetOnRemoteUpdate: false,
|
|
8714
|
-
* }
|
|
8715
|
-
* }
|
|
8716
|
-
* ]
|
|
8717
|
-
* }),
|
|
8718
|
-
* withDefaults({
|
|
8719
|
-
* type: 'dog',
|
|
8720
|
-
* fields: [
|
|
8721
|
-
* { kind: 'field', name: 'name' },
|
|
8722
|
-
* {
|
|
8723
|
-
* kind: 'belongsTo',
|
|
8724
|
-
* name: 'owner',
|
|
8725
|
-
* type: 'user',
|
|
8726
|
-
* options: {
|
|
8727
|
-
* async: false,
|
|
8728
|
-
* inverse: 'pets',
|
|
8729
|
-
* as: 'pet',
|
|
8730
|
-
* linksMode: true,
|
|
8731
|
-
* resetOnRemoteUpdate: false,
|
|
8732
|
-
* }
|
|
8733
|
-
* }
|
|
8734
|
-
* ]
|
|
8735
|
-
* })
|
|
8736
|
-
* ]);
|
|
8737
|
-
* ```
|
|
8738
|
-
*
|
|
8739
|
-
* ## Type Support
|
|
8740
|
-
*
|
|
8741
|
-
* ### Resource Schemas
|
|
8742
|
-
*
|
|
8743
|
-
* - {@link PolarisResourceSchema}
|
|
8744
|
-
* - {@link LegacyResourceSchema}
|
|
8745
|
-
* - {@link ObjectSchema}
|
|
8746
|
-
*
|
|
8747
|
-
* ### Resource Schema Type Utils
|
|
8748
|
-
*
|
|
8749
|
-
* - {@link resourceSchema}
|
|
8750
|
-
* - {@link objectSchema}
|
|
8751
|
-
* - {@link isResourceSchema}
|
|
8752
|
-
* - {@link isLegacyResourceSchema}
|
|
8753
|
-
*
|
|
8754
|
-
* ### Field Schemas
|
|
8755
|
-
*
|
|
8756
|
-
* - {@link LegacyModeFieldSchema}
|
|
8757
|
-
* - {@link PolarisModeFieldSchema}
|
|
8758
|
-
*
|
|
8759
|
-
* @summary Schema-driven reactive records, arrays, and documents the store builds from cached data, plus the
|
|
8760
|
-
* `SchemaService` and schema types that define them.
|
|
8761
|
-
* @module
|
|
8762
|
-
*/
|
|
8763
|
-
|
|
8764
8486
|
//#endregion
|
|
8765
8487
|
//#region src/request/-private/fetch.ts
|
|
8766
8488
|
const _fetch = typeof fetch !== "undefined" ? (...args) => fetch(...args) : typeof FastBoot !== "undefined" ? (...args) => FastBoot.require("node-fetch")(...args) : () => {
|
|
@@ -9445,4 +9167,4 @@ function useRecommendedStore(options, StoreKlass = Store) {
|
|
|
9445
9167
|
|
|
9446
9168
|
//#endregion
|
|
9447
9169
|
export { setIdentifierGenerationMethod as A, setRecordIdentifier as C, isRequestKey as D, fieldValueIdentity as E, coerceId as F, ensureStringId as I, log as L, setIdentifierUpdateMethod as M, setKeyInfoForResource as N, isResourceKey as O, normalizeModelName as P, logGroup as R, recordIdentifierFor as S, assertPrivateCapabilities as T, isPrivateStore as _, fromIdentity as a, StoreMap as b, instantiateRecord as c, commit as d, createLegacyManyArray as f, assertPrivateStore as g, Store as h, SchemaService as i, setIdentifierResetMethod as j, setIdentifierForgetMethod as k, teardownRecord as l, CacheHandler as m, RequestManager as n, registerDerivations as o, constructResource as p, Fetch as r, withDefaults as s, useRecommendedStore as t, checkout as u, RecordArrayManager as v, storeFor as w, _clearCaches as x, fastPush as y };
|
|
9448
|
-
//# sourceMappingURL=src-
|
|
9170
|
+
//# sourceMappingURL=src-PuYJ-RSZ.js.map
|