@powerhousedao/reactor-browser 6.2.3-dev.23 → 6.2.3-dev.25
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/{attachment-service-C14mVTk_.d.ts → attachment-service-ZjvRT9u7.d.ts} +97 -56
- package/dist/attachment-service-ZjvRT9u7.d.ts.map +1 -0
- package/dist/{client-CxJD0Ck2.d.ts → client-BAb4EAbM.d.ts} +3 -3
- package/dist/client-BAb4EAbM.d.ts.map +1 -0
- package/dist/{client-DjK30EQ-.js → client-BiJAJ9dW.js} +1 -1
- package/dist/{client-DjK30EQ-.js.map → client-BiJAJ9dW.js.map} +1 -1
- package/dist/{client-D4bkR4pH.js → client-C-y8-2iK.js} +15 -12
- package/dist/{client-D4bkR4pH.js.map → client-C-y8-2iK.js.map} +1 -1
- package/dist/{document-by-id-iXB59Ge-.js → dispatch-DDynSeBk.js} +168 -48
- package/dist/dispatch-DDynSeBk.js.map +1 -0
- package/dist/document-by-id-DFdjM023.js +16 -0
- package/dist/document-by-id-DFdjM023.js.map +1 -0
- package/dist/{document-model-modules-BSwKnUR_.js → document-model-modules-gE3Yh6Na.js} +32 -65
- package/dist/document-model-modules-gE3Yh6Na.js.map +1 -0
- package/dist/{document-operations-BjZmu1JC.js → document-operations-CwA7L3ef.js} +61 -42
- package/dist/document-operations-CwA7L3ef.js.map +1 -0
- package/dist/{global-D4e836Hk.d.ts → global-B8m-7kiK.d.ts} +31 -17
- package/dist/global-B8m-7kiK.d.ts.map +1 -0
- package/dist/{index-BvJaeywJ.d.ts → index-ERZ7o77d.d.ts} +19 -98
- package/dist/index-ERZ7o77d.d.ts.map +1 -0
- package/dist/{index-BIVDXw3K.d.ts → index-rtDmzViP.d.ts} +3 -3
- package/dist/index-rtDmzViP.d.ts.map +1 -0
- package/dist/index.d.ts +376 -362
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +103 -39
- package/dist/index.js.map +1 -1
- package/dist/{inspector-proxy-6h5VKAwt.d.ts → inspector-proxy-B2qjCMEv.d.ts} +9 -4
- package/dist/inspector-proxy-B2qjCMEv.d.ts.map +1 -0
- package/dist/{make-ph-event-functions-DBq3iWYn.js → make-ph-event-functions-FzpvQtj6.js} +1 -1
- package/dist/{make-ph-event-functions-DBq3iWYn.js.map → make-ph-event-functions-FzpvQtj6.js.map} +1 -1
- package/dist/{pglite-CntadC_p-9NDG14dS.d.ts → pglite-CntadC_p-DTkdF8sr.d.ts} +11 -33
- package/dist/pglite-CntadC_p-DTkdF8sr.d.ts.map +1 -0
- package/dist/{relational-D1RB45sA.js → relational-ChC_AWAK.js} +3 -2
- package/dist/{relational-D1RB45sA.js.map → relational-ChC_AWAK.js.map} +1 -1
- package/dist/{renown-rqK8sokh.js → renown-C9pYZRqf.js} +7 -8
- package/dist/{renown-rqK8sokh.js.map → renown-C9pYZRqf.js.map} +1 -1
- package/dist/{renown-BHxwP7xU.js → renown-Def5iO8k.js} +2 -2
- package/dist/{renown-BHxwP7xU.js.map → renown-Def5iO8k.js.map} +1 -1
- package/dist/src/ai/index.d.ts +51 -62
- package/dist/src/ai/index.d.ts.map +1 -1
- package/dist/src/ai/index.js +5 -8
- package/dist/src/ai/index.js.map +1 -1
- package/dist/src/analytics/index.d.ts +36 -44
- package/dist/src/analytics/index.d.ts.map +1 -1
- package/dist/src/analytics/index.js +2 -2
- package/dist/src/analytics/index.js.map +1 -1
- package/dist/src/document-model.d.ts +3 -4
- package/dist/src/document-model.d.ts.map +1 -1
- package/dist/src/document-model.js.map +1 -1
- package/dist/src/graphql/client.d.ts +4 -3
- package/dist/src/graphql/client.js +1 -1
- package/dist/src/graphql-client/entry.d.ts +5 -4
- package/dist/src/graphql-client/entry.js +3 -3
- package/dist/src/relational/index.d.ts +8 -9
- package/dist/src/relational/index.d.ts.map +1 -1
- package/dist/src/relational/index.js +1 -1
- package/dist/src/renown/index.d.ts +3 -2
- package/dist/src/renown/index.js +2 -2
- package/dist/src/rpc/index.d.ts +32 -31
- package/dist/src/rpc/index.d.ts.map +1 -1
- package/dist/src/rpc/index.js +6 -4
- package/dist/src/rpc/index.js.map +1 -1
- package/dist/{store-BJYcr_FL.js → store-DInXcjal.js} +1 -1
- package/dist/{store-BJYcr_FL.js.map → store-DInXcjal.js.map} +1 -1
- package/dist/{switchboard-Yt6ASJRx.js → switchboard-CXYzj-et.js} +58 -6
- package/dist/switchboard-CXYzj-et.js.map +1 -0
- package/dist/{types-6vDzbRRS.d.ts → types-520nWrB3.d.ts} +2 -2
- package/dist/types-520nWrB3.d.ts.map +1 -0
- package/dist/{types-N3Jy6Nry.d.ts → types-BCB-z7MN.d.ts} +17 -9
- package/dist/types-BCB-z7MN.d.ts.map +1 -0
- package/package.json +12 -12
- package/dist/attachment-service-C14mVTk_.d.ts.map +0 -1
- package/dist/client-CxJD0Ck2.d.ts.map +0 -1
- package/dist/document-by-id-iXB59Ge-.js.map +0 -1
- package/dist/document-model-modules-BSwKnUR_.js.map +0 -1
- package/dist/document-operations-BjZmu1JC.js.map +0 -1
- package/dist/global-D4e836Hk.d.ts.map +0 -1
- package/dist/index-BIVDXw3K.d.ts.map +0 -1
- package/dist/index-BvJaeywJ.d.ts.map +0 -1
- package/dist/inspector-proxy-6h5VKAwt.d.ts.map +0 -1
- package/dist/pglite-CntadC_p-9NDG14dS.d.ts.map +0 -1
- package/dist/switchboard-Yt6ASJRx.js.map +0 -1
- package/dist/types-6vDzbRRS.d.ts.map +0 -1
- package/dist/types-N3Jy6Nry.d.ts.map +0 -1
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { a as PHGlobal$1, b as IPackagesListener, ct as
|
|
2
|
-
import { t as PGlite } from "./pglite-CntadC_p-
|
|
3
|
-
import { A as ViewFilterInput, C as GetDocumentQuery, D as PropagationMode$1, E as PhDocumentFieldsFragment, O as Scalars, S as GetDocumentOperationsQuery, b as DocumentChangesSubscription, c as ReactorGraphQLClient, g as ActionInput, k as SdkFunctionWrapper } from "./types-
|
|
1
|
+
import { a as PHGlobal$1, at as DocumentRefetchState, b as IPackagesListener, ct as IOperationCache, d as UsePHGlobalValue$1, dt as PromiseWithState, lt as OperationsCacheEntry, rt as IReactorBrowserClient$1, st as IDocumentCache, u as SetPHGlobalValue$1, ut as PromiseState, v as IPackageListerUnsubscribe, x as PackageManagerInstallResult, y as IPackageManager } from "./global-B8m-7kiK.js";
|
|
2
|
+
import { t as PGlite } from "./pglite-CntadC_p-DTkdF8sr.js";
|
|
3
|
+
import { A as ViewFilterInput, C as GetDocumentQuery, D as PropagationMode$1, E as PhDocumentFieldsFragment, O as Scalars, S as GetDocumentOperationsQuery, b as DocumentChangesSubscription, c as ReactorGraphQLClient, g as ActionInput, k as SdkFunctionWrapper } from "./types-BCB-z7MN.js";
|
|
4
4
|
import { Action, DocumentModelLib, DocumentModelModule, Operation, PHDocument } from "document-model";
|
|
5
|
-
import { Action as Action$1, DocumentModelModule as DocumentModelModule$1, DocumentOperations, ISigner, Operation as Operation$1, PHBaseState, PHDocument as PHDocument$1, PHDocumentHeader } from "@powerhousedao/shared/document-model";
|
|
6
|
-
import * as _powerhousedao_reactor0 from "@powerhousedao/reactor";
|
|
7
5
|
import { Database, DocumentChangeEvent, DocumentModelSource, IDocumentModelRegistry, ISyncManager, OperationFilter, PagedResults, PagingOptions, PropagationMode, SearchFilter, ViewFilter } from "@powerhousedao/reactor";
|
|
6
|
+
import { Action as Action$1, ActionSigningTarget, DocumentModelModule as DocumentModelModule$1, DocumentOperations, ISigner, Operation as Operation$1, PHBaseState, PHDocument as PHDocument$1, PHDocumentHeader } from "@powerhousedao/shared/document-model";
|
|
8
7
|
import { ReactNode } from "react";
|
|
9
8
|
import { GraphQLClient, Variables } from "graphql-request";
|
|
10
|
-
import * as graphql from "graphql";
|
|
11
9
|
import { DocumentNode } from "graphql";
|
|
12
|
-
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
13
10
|
import { IAttachmentService } from "@powerhousedao/reactor-attachments/client";
|
|
14
11
|
import { Kysely } from "kysely";
|
|
15
12
|
import { AddPHGlobalEventHandler, BrowserReactorClientModule, IReactorBrowserClient, SetPHGlobalValue, UsePHGlobalValue, WorkerReactorClientModule } from "@powerhousedao/reactor-browser";
|
|
16
13
|
import { RegistryPackageSource } from "@powerhousedao/shared";
|
|
17
|
-
|
|
14
|
+
//#region src/document-refetcher.d.ts
|
|
15
|
+
/** The refetch snapshot of a document with nothing in flight and no kept failure. */
|
|
16
|
+
declare const IDLE_REFETCH_STATE: DocumentRefetchState;
|
|
17
|
+
//#endregion
|
|
18
18
|
//#region src/document-cache.d.ts
|
|
19
19
|
declare function addPromiseState<T>(promise: Promise<T>): PromiseWithState<T>;
|
|
20
20
|
declare function readPromiseState<T>(promise: Promise<T> | PromiseWithState<T>): PromiseState<T>;
|
|
@@ -35,6 +35,7 @@ declare class DocumentCache implements IDocumentCache, IOperationCache {
|
|
|
35
35
|
private documents;
|
|
36
36
|
private batchPromises;
|
|
37
37
|
private listeners;
|
|
38
|
+
private refetcher;
|
|
38
39
|
/**
|
|
39
40
|
* Cache keys that fetched a document under a name other than its id --
|
|
40
41
|
* slugs, which `client.get` resolves. Change events dispatch by `header.id`,
|
|
@@ -53,12 +54,14 @@ declare class DocumentCache implements IDocumentCache, IOperationCache {
|
|
|
53
54
|
private handleDocumentChange;
|
|
54
55
|
private handleDocumentDeleted;
|
|
55
56
|
private handleDocumentUpdated;
|
|
57
|
+
private notifyListeners;
|
|
56
58
|
/** The id an event dispatches by, plus every alias the document is cached under. */
|
|
57
59
|
private cacheKeysFor;
|
|
58
60
|
/** Records that `key` cached the document change events know as `header.id`. */
|
|
59
61
|
private recordAlias;
|
|
60
62
|
private invalidateBatchesContaining;
|
|
61
63
|
get(id: string, refetch?: boolean): Promise<PHDocument$1>;
|
|
64
|
+
getRefetchState(id: string): DocumentRefetchState;
|
|
62
65
|
getBatch(ids: string[]): Promise<PHDocument$1[]>;
|
|
63
66
|
subscribe(id: string | string[], callback: () => void): () => void;
|
|
64
67
|
getOperationsState(documentId: string, scope: string): OperationsCacheEntry;
|
|
@@ -105,14 +108,22 @@ type RemoteOperationResultPage = GetDocumentOperationsQuery["documentOperations"
|
|
|
105
108
|
* Options for creating a RemoteDocumentController.
|
|
106
109
|
*/
|
|
107
110
|
type RemoteControllerOptions = {
|
|
108
|
-
client: RemoteControllerGraphQLClient;
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
111
|
+
client: RemoteControllerGraphQLClient;
|
|
112
|
+
/** Remote document id. Omit for new documents. */
|
|
113
|
+
documentId?: string;
|
|
114
|
+
/** "batch" requires explicit push(), "streaming" auto-pushes after actions. Defaults to "batch" */
|
|
115
|
+
mode?: "batch" | "streaming";
|
|
116
|
+
/** Optional signer for action signing. */
|
|
117
|
+
signer?: ISigner;
|
|
118
|
+
/** Branch name, defaults to "main". */
|
|
119
|
+
branch?: string;
|
|
120
|
+
/** Parent document identifier for creating new documents. */
|
|
121
|
+
parentIdentifier?: string;
|
|
122
|
+
/** Conflict resolution strategy when remote has new operations. Default: no check (current behavior). */
|
|
123
|
+
onConflict?: ConflictStrategy;
|
|
124
|
+
/** Called when a streaming-mode push fails. If not provided, errors are silently swallowed. */
|
|
125
|
+
onPushError?: (error: unknown) => void;
|
|
126
|
+
/** Number of operations to fetch per page. Defaults to 100. */
|
|
116
127
|
operationsPageSize?: number;
|
|
117
128
|
};
|
|
118
129
|
/**
|
|
@@ -120,7 +131,8 @@ type RemoteControllerOptions = {
|
|
|
120
131
|
*/
|
|
121
132
|
type PushResult = {
|
|
122
133
|
remoteDocument: RemoteDocumentData;
|
|
123
|
-
actionCount: number;
|
|
134
|
+
actionCount: number;
|
|
135
|
+
/** The actions that were sent to the server (after signing, if applicable). */
|
|
124
136
|
operations: ReadonlyArray<Action$1>;
|
|
125
137
|
};
|
|
126
138
|
/**
|
|
@@ -142,9 +154,13 @@ type TrackedAction = {
|
|
|
142
154
|
};
|
|
143
155
|
/** Information about a detected conflict. */
|
|
144
156
|
type ConflictInfo = {
|
|
145
|
-
/** Remote operations added since the last pull, grouped by scope. */
|
|
146
|
-
|
|
147
|
-
|
|
157
|
+
/** Remote operations added since the last pull, grouped by scope. */
|
|
158
|
+
remoteOperations: Record<string, RemoteOperation[]>;
|
|
159
|
+
/** Local actions pending push. */
|
|
160
|
+
localActions: TrackedAction[];
|
|
161
|
+
/** Remote revision at last pull. */
|
|
162
|
+
knownRevision: Record<string, number>;
|
|
163
|
+
/** Current remote revision. */
|
|
148
164
|
currentRevision: Record<string, number>;
|
|
149
165
|
};
|
|
150
166
|
/** Custom merge handler receives conflict info and returns actions to push (or throws to abort). */
|
|
@@ -344,7 +360,8 @@ declare class SubgraphSdkRegistry {
|
|
|
344
360
|
//#endregion
|
|
345
361
|
//#region src/graphql-client/graphql-reactor-client.d.ts
|
|
346
362
|
type GraphQLReactorClientOptions = {
|
|
347
|
-
/** The Switchboard GraphQL endpoint, e.g. `http://localhost:4001/graphql`. */
|
|
363
|
+
/** The Switchboard GraphQL endpoint, e.g. `http://localhost:4001/graphql`. */
|
|
364
|
+
url: string;
|
|
348
365
|
/**
|
|
349
366
|
* A pre-built SDK to use instead of the transport derived from `url`.
|
|
350
367
|
* Mainly a test seam.
|
|
@@ -629,7 +646,8 @@ declare global {
|
|
|
629
646
|
*/
|
|
630
647
|
declare function ensurePHEventHandlers(): void;
|
|
631
648
|
type GraphQLReactorProviderProps = {
|
|
632
|
-
/** The Switchboard GraphQL endpoint, e.g. `http://localhost:4001/graphql`. */
|
|
649
|
+
/** The Switchboard GraphQL endpoint, e.g. `http://localhost:4001/graphql`. */
|
|
650
|
+
url: string;
|
|
633
651
|
/**
|
|
634
652
|
* Resolves the bearer token sent with every request, per request. Defaults to
|
|
635
653
|
* the token of the logged-in Renown user, or none when nobody is logged in.
|
|
@@ -715,15 +733,7 @@ type GraphQLReactorProviderProps = {
|
|
|
715
733
|
* effect rebuilds both if it runs again on the same client - which is what a
|
|
716
734
|
* `StrictMode` mount does.
|
|
717
735
|
*/
|
|
718
|
-
declare function GraphQLReactorProvider({
|
|
719
|
-
url,
|
|
720
|
-
tokenProvider,
|
|
721
|
-
subscriptionsUrl,
|
|
722
|
-
realtime,
|
|
723
|
-
attachmentService,
|
|
724
|
-
documentModels,
|
|
725
|
-
children
|
|
726
|
-
}: GraphQLReactorProviderProps): react_jsx_runtime0.JSX.Element;
|
|
736
|
+
declare function GraphQLReactorProvider({ url, tokenProvider, subscriptionsUrl, realtime, attachmentService, documentModels, children }: GraphQLReactorProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
727
737
|
/**
|
|
728
738
|
* Returns the {@link GraphQLReactorClient} mounted by
|
|
729
739
|
* {@link GraphQLReactorProvider}, or `undefined` when the slot holds something
|
|
@@ -745,7 +755,7 @@ declare function useSwitchboardClient(): GraphQLReactorClient | undefined;
|
|
|
745
755
|
* The operation selection of `GetDocumentOperations`, lifted into a fragment so
|
|
746
756
|
* the write path can reuse `remoteOperationToLocal` on the items it selects.
|
|
747
757
|
*/
|
|
748
|
-
declare const ReactorOperationFieldsFragmentDoc: graphql.DocumentNode;
|
|
758
|
+
declare const ReactorOperationFieldsFragmentDoc: import("graphql").DocumentNode;
|
|
749
759
|
/**
|
|
750
760
|
* `mutateDocument` plus the operations the mutation produced.
|
|
751
761
|
*
|
|
@@ -767,7 +777,7 @@ declare const ReactorOperationFieldsFragmentDoc: graphql.DocumentNode;
|
|
|
767
777
|
* by hand or the operations came from `main` while the actions were applied
|
|
768
778
|
* elsewhere. One variable cannot disagree with itself.
|
|
769
779
|
*/
|
|
770
|
-
declare const MutateDocumentWithOperationsDocument: graphql.DocumentNode;
|
|
780
|
+
declare const MutateDocumentWithOperationsDocument: import("graphql").DocumentNode;
|
|
771
781
|
type MutateDocumentWithOperationsVariables = {
|
|
772
782
|
documentIdentifier: Scalars["String"]["input"];
|
|
773
783
|
actions: ReadonlyArray<ActionInput>;
|
|
@@ -801,12 +811,12 @@ type MutateDocumentWithOperationsResult = {
|
|
|
801
811
|
*/
|
|
802
812
|
declare function stampAction(action: Action$1, document: PHDocument$1, revision?: number): Action$1;
|
|
803
813
|
/**
|
|
804
|
-
* Signs a stamped action
|
|
805
|
-
*
|
|
806
|
-
*
|
|
807
|
-
*
|
|
814
|
+
* Signs a stamped action for `target`, keeping any signatures it already
|
|
815
|
+
* carries. The signer reads `context.prevOpHash`, so this runs after
|
|
816
|
+
* {@link stampAction}. A v2 tuple covers the signer's identity, so the context
|
|
817
|
+
* takes the signer's user and app even when the action named others.
|
|
808
818
|
*/
|
|
809
|
-
declare function signStampedAction(action: Action$1, signer: ISigner, signal?: AbortSignal): Promise<Action$1>;
|
|
819
|
+
declare function signStampedAction(action: Action$1, signer: ISigner, target: ActionSigningTarget, signal?: AbortSignal): Promise<Action$1>;
|
|
810
820
|
/**
|
|
811
821
|
* Stamps and signs a batch of actions against one document snapshot, so every
|
|
812
822
|
* action carries the head its predecessor will leave behind.
|
|
@@ -896,13 +906,15 @@ type DocumentChangesEventPayload = DocumentChangesSubscription["documentChanges"
|
|
|
896
906
|
/** The connection payload sent with the `ConnectionInit` message. */
|
|
897
907
|
type ConnectionParams = Record<string, string>;
|
|
898
908
|
type DocumentChangesSubscriptionOptions = {
|
|
899
|
-
/** The websocket endpoint, e.g. `ws://localhost:4001/graphql/subscriptions`. */
|
|
909
|
+
/** The websocket endpoint, e.g. `ws://localhost:4001/graphql/subscriptions`. */
|
|
910
|
+
wsUrl: string;
|
|
900
911
|
/**
|
|
901
912
|
* Resolves the `ConnectionInit` payload. Called again on every reconnect, so
|
|
902
913
|
* a token that expired while the socket was down is refreshed on the way back
|
|
903
914
|
* up.
|
|
904
915
|
*/
|
|
905
|
-
connectionParams?: () => Promise<ConnectionParams>;
|
|
916
|
+
connectionParams?: () => Promise<ConnectionParams>;
|
|
917
|
+
/** Called once per server event. */
|
|
906
918
|
onEvent: (event: DocumentChangesEventPayload) => void;
|
|
907
919
|
/**
|
|
908
920
|
* Called when the socket gives up: the retries built into `graphql-ws` are
|
|
@@ -978,6 +990,8 @@ declare function useDocument(id: string | null | undefined): PHDocument$1 | unde
|
|
|
978
990
|
* - isPending: Whether the document is currently loading
|
|
979
991
|
* - error: Any error that occurred during loading (e.g., document not found)
|
|
980
992
|
* - reload: Function to force a refetch, or undefined when no id is supplied
|
|
993
|
+
* - isRefetching: A loaded document is being refetched; `data` is the loaded one
|
|
994
|
+
* - refetchError: The last refetch failure that kept the loaded document
|
|
981
995
|
*/
|
|
982
996
|
declare function useDocumentSafe(id: string | null | undefined): {
|
|
983
997
|
readonly status: "initial";
|
|
@@ -985,24 +999,32 @@ declare function useDocumentSafe(id: string | null | undefined): {
|
|
|
985
999
|
readonly error: undefined;
|
|
986
1000
|
readonly data: undefined;
|
|
987
1001
|
readonly reload: undefined;
|
|
1002
|
+
readonly isRefetching: false;
|
|
1003
|
+
readonly refetchError: undefined;
|
|
988
1004
|
} | {
|
|
989
|
-
readonly reload: () => Promise<PHDocument$1>;
|
|
990
1005
|
readonly status: "pending";
|
|
991
1006
|
readonly isPending: true;
|
|
992
1007
|
readonly error: undefined;
|
|
993
1008
|
readonly data: undefined;
|
|
994
|
-
} | {
|
|
995
1009
|
readonly reload: () => Promise<PHDocument$1>;
|
|
1010
|
+
readonly isRefetching: boolean;
|
|
1011
|
+
readonly refetchError: unknown;
|
|
1012
|
+
} | {
|
|
996
1013
|
readonly status: "success";
|
|
997
1014
|
readonly isPending: false;
|
|
998
1015
|
readonly error: undefined;
|
|
999
1016
|
readonly data: PHDocument$1;
|
|
1000
|
-
} | {
|
|
1001
1017
|
readonly reload: () => Promise<PHDocument$1>;
|
|
1018
|
+
readonly isRefetching: boolean;
|
|
1019
|
+
readonly refetchError: unknown;
|
|
1020
|
+
} | {
|
|
1002
1021
|
readonly status: "error";
|
|
1003
1022
|
readonly isPending: false;
|
|
1004
1023
|
readonly error: unknown;
|
|
1005
1024
|
readonly data: undefined;
|
|
1025
|
+
readonly reload: () => Promise<PHDocument$1>;
|
|
1026
|
+
readonly isRefetching: boolean;
|
|
1027
|
+
readonly refetchError: unknown;
|
|
1006
1028
|
};
|
|
1007
1029
|
/**
|
|
1008
1030
|
* Retrieves multiple documents from the reactor using React Suspense.
|
|
@@ -1037,6 +1059,8 @@ declare function useGetDocuments(): (ids: string[]) => Promise<PHDocument$1[]>;
|
|
|
1037
1059
|
* - isPending: Boolean indicating if the document is currently loading
|
|
1038
1060
|
* - error: Any error that occurred during loading
|
|
1039
1061
|
* - reload: Function to force reload the document from cache
|
|
1062
|
+
* - isRefetching: A loaded document is being refetched; `data` is the loaded one
|
|
1063
|
+
* - refetchError: The last refetch failure that kept the loaded document
|
|
1040
1064
|
*/
|
|
1041
1065
|
declare function useGetDocumentAsync(id: string | null | undefined): {
|
|
1042
1066
|
readonly status: "initial";
|
|
@@ -1044,24 +1068,32 @@ declare function useGetDocumentAsync(id: string | null | undefined): {
|
|
|
1044
1068
|
readonly isPending: false;
|
|
1045
1069
|
readonly error: undefined;
|
|
1046
1070
|
readonly reload: undefined;
|
|
1071
|
+
readonly isRefetching: false;
|
|
1072
|
+
readonly refetchError: undefined;
|
|
1047
1073
|
} | {
|
|
1048
|
-
readonly reload: () => Promise<PHDocument$1>;
|
|
1049
1074
|
readonly status: "pending";
|
|
1050
1075
|
readonly isPending: true;
|
|
1051
1076
|
readonly error: undefined;
|
|
1052
1077
|
readonly data: undefined;
|
|
1053
|
-
} | {
|
|
1054
1078
|
readonly reload: () => Promise<PHDocument$1>;
|
|
1079
|
+
readonly isRefetching: boolean;
|
|
1080
|
+
readonly refetchError: unknown;
|
|
1081
|
+
} | {
|
|
1055
1082
|
readonly status: "success";
|
|
1056
1083
|
readonly isPending: false;
|
|
1057
1084
|
readonly error: undefined;
|
|
1058
1085
|
readonly data: PHDocument$1;
|
|
1059
|
-
} | {
|
|
1060
1086
|
readonly reload: () => Promise<PHDocument$1>;
|
|
1087
|
+
readonly isRefetching: boolean;
|
|
1088
|
+
readonly refetchError: unknown;
|
|
1089
|
+
} | {
|
|
1061
1090
|
readonly status: "error";
|
|
1062
1091
|
readonly isPending: false;
|
|
1063
1092
|
readonly error: unknown;
|
|
1064
1093
|
readonly data: undefined;
|
|
1094
|
+
readonly reload: () => Promise<PHDocument$1>;
|
|
1095
|
+
readonly isRefetching: boolean;
|
|
1096
|
+
readonly refetchError: unknown;
|
|
1065
1097
|
};
|
|
1066
1098
|
//#endregion
|
|
1067
1099
|
//#region src/hooks/reactor.d.ts
|
|
@@ -1078,7 +1110,7 @@ declare const setReactorClient: SetPHGlobalValue<IReactorBrowserClient>;
|
|
|
1078
1110
|
/** Adds an event handler for the reactor client */
|
|
1079
1111
|
declare const addReactorClientEventHandler: AddPHGlobalEventHandler;
|
|
1080
1112
|
declare const useSync: () => ISyncManager | undefined;
|
|
1081
|
-
declare const useSyncList: () =>
|
|
1113
|
+
declare const useSyncList: () => import("@powerhousedao/reactor").Remote[];
|
|
1082
1114
|
declare const useModelRegistry: () => IDocumentModelRegistry | undefined;
|
|
1083
1115
|
declare const useDatabase: () => Kysely<Database> | undefined;
|
|
1084
1116
|
declare const usePGlite: () => PGlite | undefined;
|
|
@@ -1113,17 +1145,25 @@ type UseDocumentOperationsOptions = {
|
|
|
1113
1145
|
* changing it while pages are already loaded has no effect until the next
|
|
1114
1146
|
* invalidation or `refetch`.
|
|
1115
1147
|
*/
|
|
1116
|
-
limit?: number;
|
|
1148
|
+
limit?: number;
|
|
1149
|
+
/** Whether to fetch at all. Default true. Pass false until the operations are needed. */
|
|
1117
1150
|
enabled?: boolean;
|
|
1118
1151
|
};
|
|
1119
1152
|
/** What `useDocumentOperations` returns; exported so consumers can name it. */
|
|
1120
1153
|
type DocumentOperationsResult = {
|
|
1121
|
-
/** Every operation of the scope loaded so far, oldest first. */
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1154
|
+
/** Every operation of the scope loaded so far, oldest first. */
|
|
1155
|
+
operations: readonly Operation$1[];
|
|
1156
|
+
/** A page is in flight. */
|
|
1157
|
+
isLoading: boolean;
|
|
1158
|
+
/** The last page failed. Operations loaded before it stay available. */
|
|
1159
|
+
error: Error | undefined;
|
|
1160
|
+
/** The last page reported a further page. */
|
|
1161
|
+
hasNextPage: boolean;
|
|
1162
|
+
/** Reported by the GraphQL client only. */
|
|
1163
|
+
totalCount: number | undefined;
|
|
1164
|
+
/** Loads the next page and appends it. No-op while loading or when there is none. */
|
|
1165
|
+
fetchNextPage: () => void;
|
|
1166
|
+
/** Drops the document's cached operations and reloads from the first page. */
|
|
1127
1167
|
refetch: () => void;
|
|
1128
1168
|
};
|
|
1129
1169
|
/**
|
|
@@ -1165,5 +1205,6 @@ declare const setAttachmentService: SetPHGlobalValue<IAttachmentService>;
|
|
|
1165
1205
|
/** Registers the attachmentService window event handler */
|
|
1166
1206
|
declare const addAttachmentServiceEventHandler: AddPHGlobalEventHandler;
|
|
1167
1207
|
//#endregion
|
|
1168
|
-
export { useSwitchboardClient as $, useGetDocument as A, RemoteControllerOptions as At, StaticPackageManager as B, isOperationCache as Bt, useSyncList as C, GetDocumentWithOperationsResult as Ct, useDocumentCache as D, MergeHandler as Dt, useDocument as E, IRemoteController as Et, DocumentChangesSubscriptionOptions as F, SyncStatus$1 as Ft, stampAction as G, resolveDocumentModelModule as H, isAuthRefusalClose as I, TrackedAction as It, MutateDocumentWithOperationsVariables as J, MutateDocumentWithOperationsDocument as K, makeAuthConnectionParams as L, DocumentCache as Lt, useGetDocuments as M, RemoteDocumentData as Mt, ConnectionParams as N, RemoteOperation as Nt, useDocumentSafe as O, PushResult as Ot, DocumentChangesEventPayload as P, RemoteOperationResultPage as Pt, ensurePHEventHandlers as Q, startDocumentChangesSubscription as R, IDLE_OPERATIONS_ENTRY as Rt, useSync as S, GetDocumentResult as St, setDocumentCache as T, IRemoteClient as Tt, prepareSignedActions as U, packageFromDocumentModels as V, readPromiseState as Vt, signStampedAction as W, GraphQLReactorProvider as X, ReactorOperationFieldsFragmentDoc as Y, GraphQLReactorProviderProps as Z, useDatabase as _, phDocumentFromMutation as _t, DocumentOperationsState as a, SubgraphSdkFactory as at, useReactorClient as b, ConflictStrategy as bt, useDocumentModelModuleById as c, describeGraphQLDocument as ct, UseDispatchResult as d, ambientRenownTokenProvider as dt, GraphQLReactorClient as et, useDispatch as f, makeAuthMiddleware as ft, setReactorClientModule as g, phDocumentFromGetDocument as gt, setReactorClient as h, RevisionsListSelection as ht, DocumentOperationsResult as i, GraphQLRequestOptions as it, useGetDocumentAsync as j, RemoteDocumentChangeEvent as jt, useDocuments as k, RemoteControllerGraphQLClient as kt, useDocumentModelModules as l, subgraphUrlFromGraphqlUrl as lt, addReactorClientModuleEventHandler as m, GetDocumentQueryResult as mt, setAttachmentService as n, isGraphQLReactorClient as nt, UseDocumentOperationsOptions as o, SubgraphSdkRegistry as ot, addReactorClientEventHandler as p, GetDocumentQueryFields as pt, MutateDocumentWithOperationsResult as q, useAttachmentService as r, viewFilterInputFromViewFilter as rt, useDocumentOperations as s, TypedGraphQLDocument as st, addAttachmentServiceEventHandler as t, GraphQLReactorClientOptions as tt, DispatchFn as u, BearerTokenProvider as ut, useModelRegistry as v, revisionMapFromRevisionsList as vt, addDocumentCacheEventHandler as w, GetOperationsResult as wt, useReactorClientModule as x, DocumentChangeListener as xt, usePGlite as y, ConflictInfo as yt, subscriptionsUrlFromGraphqlUrl as z, addPromiseState as zt };
|
|
1169
|
-
|
|
1208
|
+
export { useSwitchboardClient as $, useGetDocument as A, RemoteControllerOptions as At, StaticPackageManager as B, isOperationCache as Bt, useSyncList as C, GetDocumentWithOperationsResult as Ct, useDocumentCache as D, MergeHandler as Dt, useDocument as E, IRemoteController as Et, DocumentChangesSubscriptionOptions as F, SyncStatus$1 as Ft, stampAction as G, resolveDocumentModelModule as H, IDLE_REFETCH_STATE as Ht, isAuthRefusalClose as I, TrackedAction as It, MutateDocumentWithOperationsVariables as J, MutateDocumentWithOperationsDocument as K, makeAuthConnectionParams as L, DocumentCache as Lt, useGetDocuments as M, RemoteDocumentData as Mt, ConnectionParams as N, RemoteOperation as Nt, useDocumentSafe as O, PushResult as Ot, DocumentChangesEventPayload as P, RemoteOperationResultPage as Pt, ensurePHEventHandlers as Q, startDocumentChangesSubscription as R, IDLE_OPERATIONS_ENTRY as Rt, useSync as S, GetDocumentResult as St, setDocumentCache as T, IRemoteClient as Tt, prepareSignedActions as U, packageFromDocumentModels as V, readPromiseState as Vt, signStampedAction as W, GraphQLReactorProvider as X, ReactorOperationFieldsFragmentDoc as Y, GraphQLReactorProviderProps as Z, useDatabase as _, phDocumentFromMutation as _t, DocumentOperationsState as a, SubgraphSdkFactory as at, useReactorClient as b, ConflictStrategy as bt, useDocumentModelModuleById as c, describeGraphQLDocument as ct, UseDispatchResult as d, ambientRenownTokenProvider as dt, GraphQLReactorClient as et, useDispatch as f, makeAuthMiddleware as ft, setReactorClientModule as g, phDocumentFromGetDocument as gt, setReactorClient as h, RevisionsListSelection as ht, DocumentOperationsResult as i, GraphQLRequestOptions as it, useGetDocumentAsync as j, RemoteDocumentChangeEvent as jt, useDocuments as k, RemoteControllerGraphQLClient as kt, useDocumentModelModules as l, subgraphUrlFromGraphqlUrl as lt, addReactorClientModuleEventHandler as m, GetDocumentQueryResult as mt, setAttachmentService as n, isGraphQLReactorClient as nt, UseDocumentOperationsOptions as o, SubgraphSdkRegistry as ot, addReactorClientEventHandler as p, GetDocumentQueryFields as pt, MutateDocumentWithOperationsResult as q, useAttachmentService as r, viewFilterInputFromViewFilter as rt, useDocumentOperations as s, TypedGraphQLDocument as st, addAttachmentServiceEventHandler as t, GraphQLReactorClientOptions as tt, DispatchFn as u, BearerTokenProvider as ut, useModelRegistry as v, revisionMapFromRevisionsList as vt, addDocumentCacheEventHandler as w, GetOperationsResult as wt, useReactorClientModule as x, DocumentChangeListener as xt, usePGlite as y, ConflictInfo as yt, subscriptionsUrlFromGraphqlUrl as z, addPromiseState as zt };
|
|
1209
|
+
export {};
|
|
1210
|
+
//# sourceMappingURL=attachment-service-ZjvRT9u7.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attachment-service-ZjvRT9u7.d.ts","names":[],"sources":["../src/document-refetcher.ts","../src/document-cache.ts","../src/remote-controller/types.ts","../src/graphql-client/adapter.ts","../src/graphql-client/auth.ts","../src/graphql-client/subgraph.ts","../src/graphql-client/graphql-reactor-client.ts","../src/graphql-client/graphql-reactor-provider.tsx","../src/graphql-client/operations.ts","../src/graphql-client/signing.ts","../src/graphql-client/static-package-manager.ts","../src/graphql-client/subscriptions.ts","../src/hooks/document-cache.ts","../src/hooks/reactor.ts","../src/hooks/dispatch.ts","../src/hooks/document-model-modules.ts","../src/hooks/document-operations.ts","../src/hooks/attachment-service.ts"],"mappings":";;;;;;;;;;;;;;;cASa,oBAAoB;;;iBCUjB,gBAAgB,GAAG,SAAS,QAAQ,KAAK,iBAAiB;iBAwB1D,iBAAiB,GAC/B,SAAS,QAAQ,KAAK,iBAAiB,KACtC,aAAa;;cA4BH,uBAAuB;;iBASpB,iBAAiB,iBAAiB,SAAS;;;;;;;;;cAiD9C,yBAAyB,gBAAgB;UAuChC;UAtCZ;UACA;UAIA;UAEA;;;;;;;;UAkBA;;UAGA;;UAKA;UACA;UAEA;EAER,YAAoB,QAAQ;UAMpB;UAuBA;UAeM;UAON;;UAOA;;UAKA;UAMA;EAQR,IAAI,YAAY,oBAAoB,QAAQ;EA0B5C,gBAAgB,aAAa;EAI7B,SAAS,gBAAgB,QAAQ;EA8DjC,UAAU,uBAAuB;EAiBjC,mBAAmB,oBAAoB,gBAAgB;EAMvD,eAAe,oBAAoB,eAAe;EA8BlD,mBAAmB,oBAAoB;;;;;;;;;;;;;;;;;;UAuD/B;;UA8CA;EAmBR,qBAAqB;EAarB,oBAAoB,oBAAoB;UAYhC;UAoCA;UAaA;UAYA;;;;EASR;;;;KC9kBU,gCAAgC,KAC1C;KAYU,qBAAqB;KAErB,kBACV;KAEU,4BACV;;;;KAKU;EACV,QAAQ;;EAER;;EAEA;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ACA,WAAW;iBAGG,YAAY,YAAY,cAAY,UAAU,UAC5D,UAAU,wBACT,kBAAkB,WAAW;;;iBCpBhB,2BAA2B;;;;;;;;;iBAuB3B,2BACd,+BACA,mBACC;;;KCvBS;;;;;;EAMV;;EAEA;;;KAIU;;EAEV,qBAAqB;;EAErB;;EAEA,OAAO;;EAEP;;EAEA;;EAEA;;EAEA;;;;;;KAaU;EACV,kBAAkB;EAClB,iBAAiB;EACjB;EACA,OAAO;EACP;;;iBAqFc,sBACd,wCACC;;;;;;;;;;;;;;;;;iBAiBa,sBACd,uCACA,eACA,UAAU,+BACT;;;;cClJU,sBAAsB,iBAAiB;;cAIvC,sBAAsB,iBAAiB;;cAIvC,kCAAkC"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { c as ReactorGraphQLClient, k as SdkFunctionWrapper } from "./types-
|
|
1
|
+
import { c as ReactorGraphQLClient, k as SdkFunctionWrapper } from "./types-BCB-z7MN.js";
|
|
2
2
|
import { GraphQLClient } from "graphql-request";
|
|
3
|
-
|
|
4
3
|
//#region src/graphql/client.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* Creates a GraphQL client for the Reactor Subgraph API.
|
|
@@ -11,4 +10,5 @@ import { GraphQLClient } from "graphql-request";
|
|
|
11
10
|
declare function createClient(urlOrGQLClient: string | GraphQLClient, middleware?: SdkFunctionWrapper): ReactorGraphQLClient;
|
|
12
11
|
//#endregion
|
|
13
12
|
export { createClient as t };
|
|
14
|
-
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=client-BAb4EAbM.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client-BAb4EAbM.d.ts","names":[],"sources":["../src/graphql/client.ts"],"mappings":";;;;;;;;;iBA4BgB,aACd,yBAAyB,eACzB,aAAa,qBACZ"}
|
|
@@ -87,4 +87,4 @@ var RegistryClient = class {
|
|
|
87
87
|
//#endregion
|
|
88
88
|
export { getPackagesByDocumentType as a, getPackages as i, getPackageInfo as n, getPackagesForDocumentType as o, getPackagePage as r, trimTrailingSlash as s, RegistryClient as t };
|
|
89
89
|
|
|
90
|
-
//# sourceMappingURL=client-
|
|
90
|
+
//# sourceMappingURL=client-BiJAJ9dW.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-
|
|
1
|
+
{"version":3,"file":"client-BiJAJ9dW.js","names":[],"sources":["../src/registry/fetchers.ts","../src/registry/client.ts"],"sourcesContent":["import type { PackageInfo, PackagePage } from \"@powerhousedao/shared/registry\";\n\n// Strip a trailing \"/\" so we don't emit `http://host//packages` when a user\n// writes `packageRegistryUrl: \"http://host/\"`. Verdaccio's own web backend\n// 404s on the doubled slash, which cascades into an empty registry list and\n// masks the real install flow.\nexport function trimTrailingSlash(url: string): string {\n return url.endsWith(\"/\") ? url.slice(0, -1) : url;\n}\n\nexport async function getPackages(registryUrl: string) {\n const res = await fetch(`${trimTrailingSlash(registryUrl)}/packages`);\n if (!res.ok) throw new Error(`Registry error: HTTP ${res.status}`);\n const data = (await res.json()) as PackageInfo[];\n return data;\n}\n\n/**\n * Fetch one page of the registry listing (trimmed items). Backed by the\n * paginated `GET /packages?limit=&offset=&search=` mode. Used by the Package\n * Manager's Available tab for infinite scroll + server-side search.\n */\nexport async function getPackagePage(\n registryUrl: string,\n params: { limit: number; offset: number; search?: string },\n): Promise<PackagePage> {\n const query = new URLSearchParams({\n limit: String(params.limit),\n offset: String(params.offset),\n });\n if (params.search) query.set(\"search\", params.search);\n const res = await fetch(\n `${trimTrailingSlash(registryUrl)}/packages?${query.toString()}`,\n );\n if (!res.ok) throw new Error(`Registry error: HTTP ${res.status}`);\n return (await res.json()) as PackagePage;\n}\n\n/**\n * Fetch full package info for every package exposing a given document type,\n * via the legacy `?documentType=` filter (returns full PackageInfo objects,\n * not just names). Used by the MissingPackageModal to offer installs without\n * loading the entire paginated listing.\n */\nexport async function getPackagesForDocumentType(\n registryUrl: string,\n documentType: string,\n): Promise<PackageInfo[]> {\n const encodedType = encodeURIComponent(documentType);\n const res = await fetch(\n `${trimTrailingSlash(registryUrl)}/packages?documentType=${encodedType}`,\n );\n if (!res.ok) throw new Error(`Registry error: HTTP ${res.status}`);\n return (await res.json()) as PackageInfo[];\n}\n\nexport async function getPackagesByDocumentType(\n registryUrl: string,\n documentType: string,\n): Promise<string[]> {\n const encodedType = encodeURIComponent(documentType);\n const res = await fetch(\n `${trimTrailingSlash(registryUrl)}/packages/by-document-type?type=${encodedType}`,\n );\n if (!res.ok) throw new Error(`Registry error: HTTP ${res.status}`);\n return (await res.json()) as string[];\n}\n\n/**\n * Fetch full metadata (versions + dist-tags) for one package from the\n * single-package endpoint. Returns null when the package no longer exists\n * upstream.\n */\nexport async function getPackageInfo(\n registryUrl: string,\n name: string,\n): Promise<PackageInfo | null> {\n const encodedName = encodeURIComponent(name);\n const res = await fetch(\n `${trimTrailingSlash(registryUrl)}/packages/${encodedName}`,\n );\n if (res.status === 404) return null;\n if (!res.ok) throw new Error(`Registry error: HTTP ${res.status}`);\n return (await res.json()) as PackageInfo;\n}\n","import type { PackageInfo } from \"@powerhousedao/shared/registry\";\nimport { getPackages, getPackagesByDocumentType } from \"./fetchers.js\";\nimport type { PublishEvent } from \"./types.js\";\n\nfunction cdnUrlToApiUrl(cdnUrl: string): string {\n return cdnUrl.replace(/\\/-\\/cdn\\/?$/, \"\");\n}\nexport class RegistryClient {\n readonly apiUrl: string;\n\n constructor(cdnUrl: string) {\n this.apiUrl = cdnUrlToApiUrl(cdnUrl);\n }\n\n async getPackages(): Promise<PackageInfo[]> {\n const data = await getPackages(this.apiUrl);\n return data;\n }\n\n async getPackagesByDocumentType(documentType: string): Promise<string[]> {\n return await getPackagesByDocumentType(this.apiUrl, documentType);\n }\n\n async searchPackages(query: string): Promise<PackageInfo[]> {\n const packages = await this.getPackages();\n if (!query) return packages;\n const lowerQuery = query.toLowerCase();\n // Match on package name only (not description).\n return packages.filter((pkg) =>\n pkg.name.toLowerCase().includes(lowerQuery),\n );\n }\n\n onPublish(callback: (event: PublishEvent) => void): () => void {\n const eventSource = new EventSource(`${this.apiUrl}/-/events`);\n\n eventSource.addEventListener(\"publish\", (e: MessageEvent<string>) => {\n const data = JSON.parse(e.data) as PublishEvent;\n callback(data);\n });\n\n return () => {\n eventSource.close();\n };\n }\n}\n"],"mappings":";AAMA,SAAgB,kBAAkB,KAAqB;CACrD,OAAO,IAAI,SAAS,GAAG,IAAI,IAAI,MAAM,GAAG,EAAE,IAAI;AAChD;AAEA,eAAsB,YAAY,aAAqB;CACrD,MAAM,MAAM,MAAM,MAAM,GAAG,kBAAkB,WAAW,EAAE,UAAU;CACpE,IAAI,CAAC,IAAI,IAAI,MAAM,IAAI,MAAM,wBAAwB,IAAI,QAAQ;CAEjE,OAAO,MADa,IAAI,KAAK;AAE/B;;;;;;AAOA,eAAsB,eACpB,aACA,QACsB;CACtB,MAAM,QAAQ,IAAI,gBAAgB;EAChC,OAAO,OAAO,OAAO,KAAK;EAC1B,QAAQ,OAAO,OAAO,MAAM;CAC9B,CAAC;CACD,IAAI,OAAO,QAAQ,MAAM,IAAI,UAAU,OAAO,MAAM;CACpD,MAAM,MAAM,MAAM,MAChB,GAAG,kBAAkB,WAAW,EAAE,YAAY,MAAM,SAAS,GAC/D;CACA,IAAI,CAAC,IAAI,IAAI,MAAM,IAAI,MAAM,wBAAwB,IAAI,QAAQ;CACjE,OAAQ,MAAM,IAAI,KAAK;AACzB;;;;;;;AAQA,eAAsB,2BACpB,aACA,cACwB;CACxB,MAAM,cAAc,mBAAmB,YAAY;CACnD,MAAM,MAAM,MAAM,MAChB,GAAG,kBAAkB,WAAW,EAAE,yBAAyB,aAC7D;CACA,IAAI,CAAC,IAAI,IAAI,MAAM,IAAI,MAAM,wBAAwB,IAAI,QAAQ;CACjE,OAAQ,MAAM,IAAI,KAAK;AACzB;AAEA,eAAsB,0BACpB,aACA,cACmB;CACnB,MAAM,cAAc,mBAAmB,YAAY;CACnD,MAAM,MAAM,MAAM,MACh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ql } from "graphql-tag";
|
|
3
3
|
//#region src/graphql/gen/schema.ts
|
|
4
|
-
let DocumentChangeType = /* @__PURE__ */ function(DocumentChangeType) {
|
|
5
|
-
DocumentChangeType["ChildAdded"] = "CHILD_ADDED";
|
|
6
|
-
DocumentChangeType["ChildRemoved"] = "CHILD_REMOVED";
|
|
7
|
-
DocumentChangeType["Created"] = "CREATED";
|
|
8
|
-
DocumentChangeType["Deleted"] = "DELETED";
|
|
9
|
-
DocumentChangeType["ParentAdded"] = "PARENT_ADDED";
|
|
10
|
-
DocumentChangeType["ParentRemoved"] = "PARENT_REMOVED";
|
|
11
|
-
DocumentChangeType["Updated"] = "UPDATED";
|
|
12
|
-
return DocumentChangeType;
|
|
13
|
-
}({});
|
|
14
4
|
let PropagationMode = /* @__PURE__ */ function(PropagationMode) {
|
|
15
5
|
PropagationMode["Cascade"] = "CASCADE";
|
|
16
6
|
PropagationMode["Orphan"] = "ORPHAN";
|
|
@@ -1014,6 +1004,10 @@ function createClient(urlOrGQLClient, middleware) {
|
|
|
1014
1004
|
};
|
|
1015
1005
|
return {
|
|
1016
1006
|
...getSdk(client, middleware),
|
|
1007
|
+
/**
|
|
1008
|
+
* Run a hand-authored GraphQL document through the same transport and
|
|
1009
|
+
* middleware as the generated SDK methods.
|
|
1010
|
+
*/
|
|
1017
1011
|
async RunDocument(options) {
|
|
1018
1012
|
const { document, variables, signal } = options;
|
|
1019
1013
|
return runWithMiddleware(options.operationName, (wrappedRequestHeaders) => client.request({
|
|
@@ -1026,11 +1020,20 @@ function createClient(urlOrGQLClient, middleware) {
|
|
|
1026
1020
|
signal
|
|
1027
1021
|
}), options.operationType, variables);
|
|
1028
1022
|
},
|
|
1023
|
+
/**
|
|
1024
|
+
* Fetch documentOperations for multiple filters in a single HTTP request
|
|
1025
|
+
* using GraphQL aliases. Each filter has its own paging parameters.
|
|
1026
|
+
* Returns one result page per filter, in order.
|
|
1027
|
+
*/
|
|
1029
1028
|
async BatchGetDocumentOperations(filters, pagings) {
|
|
1030
1029
|
const { query, variables } = buildBatchOperationsQuery(filters, pagings);
|
|
1031
1030
|
const data = await runWithMiddleware("BatchGetDocumentOperations", (requestHeaders) => client.request(query, variables, requestHeaders));
|
|
1032
1031
|
return filters.map((_, i) => data[`scope_${i}`]);
|
|
1033
1032
|
},
|
|
1033
|
+
/**
|
|
1034
|
+
* Fetch a document AND documentOperations for multiple filters
|
|
1035
|
+
* in a single HTTP request. Combines GetDocument + BatchGetDocumentOperations.
|
|
1036
|
+
*/
|
|
1034
1037
|
async BatchGetDocumentWithOperations(identifier, view, filters, pagings) {
|
|
1035
1038
|
const { query, variables } = buildBatchDocumentWithOperationsQuery(identifier, view, filters, pagings);
|
|
1036
1039
|
const data = await runWithMiddleware("BatchGetDocumentWithOperations", (requestHeaders) => client.request(query, variables, requestHeaders));
|
|
@@ -1042,6 +1045,6 @@ function createClient(urlOrGQLClient, middleware) {
|
|
|
1042
1045
|
};
|
|
1043
1046
|
}
|
|
1044
1047
|
//#endregion
|
|
1045
|
-
export {
|
|
1048
|
+
export { PropagationMode as a, PhDocumentFieldsFragmentDoc as i, DocumentChangesDocument as n, GetDocumentWithOperationsDocument as r, createClient as t };
|
|
1046
1049
|
|
|
1047
|
-
//# sourceMappingURL=client-
|
|
1050
|
+
//# sourceMappingURL=client-C-y8-2iK.js.map
|