@powerhousedao/reactor-browser 6.2.3-dev.24 → 6.2.3-dev.26

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.
Files changed (85) hide show
  1. package/dist/{attachment-service-cIdRZcTa.d.ts → attachment-service-CF8LWxyM.d.ts} +65 -53
  2. package/dist/attachment-service-CF8LWxyM.d.ts.map +1 -0
  3. package/dist/{client-DjK30EQ-.js → client-BiJAJ9dW.js} +1 -1
  4. package/dist/{client-DjK30EQ-.js.map → client-BiJAJ9dW.js.map} +1 -1
  5. package/dist/{client-CxJD0Ck2.d.ts → client-CngU4mtn.d.ts} +3 -3
  6. package/dist/client-CngU4mtn.d.ts.map +1 -0
  7. package/dist/{client-D4bkR4pH.js → client-VV9M73s_.js} +15 -20
  8. package/dist/client-VV9M73s_.js.map +1 -0
  9. package/dist/{document-by-id-DgdUGMVm.js → dispatch-BOQgTK9B.js} +15 -25
  10. package/dist/dispatch-BOQgTK9B.js.map +1 -0
  11. package/dist/document-by-id-Kuxk62l1.js +16 -0
  12. package/dist/document-by-id-Kuxk62l1.js.map +1 -0
  13. package/dist/{document-model-modules-D1ZEoGjN.js → document-model-modules-Cv9KSduJ.js} +14 -59
  14. package/dist/document-model-modules-Cv9KSduJ.js.map +1 -0
  15. package/dist/{document-operations-DhrcpXMf.js → document-operations-D16LsXDs.js} +22 -21
  16. package/dist/document-operations-D16LsXDs.js.map +1 -0
  17. package/dist/{global-BGoyNc1s.d.ts → global-yMvtFjK6.d.ts} +21 -16
  18. package/dist/global-yMvtFjK6.d.ts.map +1 -0
  19. package/dist/{index-DrgDweMA.d.ts → index-UsPtg1Z3.d.ts} +19 -98
  20. package/dist/index-UsPtg1Z3.d.ts.map +1 -0
  21. package/dist/{index-BIVDXw3K.d.ts → index-rtDmzViP.d.ts} +3 -3
  22. package/dist/index-rtDmzViP.d.ts.map +1 -0
  23. package/dist/index.d.ts +361 -361
  24. package/dist/index.d.ts.map +1 -1
  25. package/dist/index.js +34 -23
  26. package/dist/index.js.map +1 -1
  27. package/dist/{inspector-proxy-6h5VKAwt.d.ts → inspector-proxy-B2qjCMEv.d.ts} +9 -4
  28. package/dist/inspector-proxy-B2qjCMEv.d.ts.map +1 -0
  29. package/dist/{make-ph-event-functions-DBq3iWYn.js → make-ph-event-functions-FzpvQtj6.js} +1 -1
  30. package/dist/{make-ph-event-functions-DBq3iWYn.js.map → make-ph-event-functions-FzpvQtj6.js.map} +1 -1
  31. package/dist/{pglite-CntadC_p-9NDG14dS.d.ts → pglite-CntadC_p-DTkdF8sr.d.ts} +11 -33
  32. package/dist/pglite-CntadC_p-DTkdF8sr.d.ts.map +1 -0
  33. package/dist/{relational-D1RB45sA.js → relational-ChC_AWAK.js} +3 -2
  34. package/dist/{relational-D1RB45sA.js.map → relational-ChC_AWAK.js.map} +1 -1
  35. package/dist/{renown-rqK8sokh.js → renown-C9pYZRqf.js} +7 -8
  36. package/dist/{renown-rqK8sokh.js.map → renown-C9pYZRqf.js.map} +1 -1
  37. package/dist/{renown-BHxwP7xU.js → renown-Def5iO8k.js} +2 -2
  38. package/dist/{renown-BHxwP7xU.js.map → renown-Def5iO8k.js.map} +1 -1
  39. package/dist/src/ai/index.d.ts +50 -61
  40. package/dist/src/ai/index.d.ts.map +1 -1
  41. package/dist/src/ai/index.js +5 -8
  42. package/dist/src/ai/index.js.map +1 -1
  43. package/dist/src/analytics/index.d.ts +36 -44
  44. package/dist/src/analytics/index.d.ts.map +1 -1
  45. package/dist/src/analytics/index.js +2 -2
  46. package/dist/src/analytics/index.js.map +1 -1
  47. package/dist/src/document-model.d.ts +3 -4
  48. package/dist/src/document-model.d.ts.map +1 -1
  49. package/dist/src/document-model.js.map +1 -1
  50. package/dist/src/graphql/client.d.ts +4 -3
  51. package/dist/src/graphql/client.js +1 -1
  52. package/dist/src/graphql-client/entry.d.ts +5 -4
  53. package/dist/src/graphql-client/entry.js +3 -3
  54. package/dist/src/relational/index.d.ts +8 -9
  55. package/dist/src/relational/index.d.ts.map +1 -1
  56. package/dist/src/relational/index.js +1 -1
  57. package/dist/src/renown/index.d.ts +3 -2
  58. package/dist/src/renown/index.js +2 -2
  59. package/dist/src/rpc/index.d.ts +31 -30
  60. package/dist/src/rpc/index.d.ts.map +1 -1
  61. package/dist/src/rpc/index.js +5 -3
  62. package/dist/src/rpc/index.js.map +1 -1
  63. package/dist/{store-BJYcr_FL.js → store-DInXcjal.js} +1 -1
  64. package/dist/{store-BJYcr_FL.js.map → store-DInXcjal.js.map} +1 -1
  65. package/dist/{switchboard-BEiFkv9K.js → switchboard-Nyr7CXcr.js} +58 -6
  66. package/dist/switchboard-Nyr7CXcr.js.map +1 -0
  67. package/dist/{types-6vDzbRRS.d.ts → types-520nWrB3.d.ts} +2 -2
  68. package/dist/types-520nWrB3.d.ts.map +1 -0
  69. package/dist/{types-N3Jy6Nry.d.ts → types-B7-_l_wE.d.ts} +17 -17
  70. package/dist/types-B7-_l_wE.d.ts.map +1 -0
  71. package/package.json +13 -14
  72. package/dist/attachment-service-cIdRZcTa.d.ts.map +0 -1
  73. package/dist/client-CxJD0Ck2.d.ts.map +0 -1
  74. package/dist/client-D4bkR4pH.js.map +0 -1
  75. package/dist/document-by-id-DgdUGMVm.js.map +0 -1
  76. package/dist/document-model-modules-D1ZEoGjN.js.map +0 -1
  77. package/dist/document-operations-DhrcpXMf.js.map +0 -1
  78. package/dist/global-BGoyNc1s.d.ts.map +0 -1
  79. package/dist/index-BIVDXw3K.d.ts.map +0 -1
  80. package/dist/index-DrgDweMA.d.ts.map +0 -1
  81. package/dist/inspector-proxy-6h5VKAwt.d.ts.map +0 -1
  82. package/dist/pglite-CntadC_p-9NDG14dS.d.ts.map +0 -1
  83. package/dist/switchboard-BEiFkv9K.js.map +0 -1
  84. package/dist/types-6vDzbRRS.d.ts.map +0 -1
  85. package/dist/types-N3Jy6Nry.d.ts.map +0 -1
@@ -1,20 +1,16 @@
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-BGoyNc1s.js";
2
- import { t as PGlite } from "./pglite-CntadC_p-9NDG14dS.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-N3Jy6Nry.js";
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-yMvtFjK6.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-B7-_l_wE.js";
4
4
  import { Action, DocumentModelLib, DocumentModelModule, Operation, PHDocument } from "document-model";
5
- import * as _powerhousedao_reactor0 from "@powerhousedao/reactor";
6
5
  import { Database, DocumentChangeEvent, DocumentModelSource, IDocumentModelRegistry, ISyncManager, OperationFilter, PagedResults, PagingOptions, PropagationMode, SearchFilter, ViewFilter } from "@powerhousedao/reactor";
7
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
-
18
14
  //#region src/document-refetcher.d.ts
19
15
  /** The refetch snapshot of a document with nothing in flight and no kept failure. */
20
16
  declare const IDLE_REFETCH_STATE: DocumentRefetchState;
@@ -112,14 +108,22 @@ type RemoteOperationResultPage = GetDocumentOperationsQuery["documentOperations"
112
108
  * Options for creating a RemoteDocumentController.
113
109
  */
114
110
  type RemoteControllerOptions = {
115
- client: RemoteControllerGraphQLClient; /** Remote document id. Omit for new documents. */
116
- documentId?: string; /** "batch" requires explicit push(), "streaming" auto-pushes after actions. Defaults to "batch" */
117
- mode?: "batch" | "streaming"; /** Optional signer for action signing. */
118
- signer?: ISigner; /** Branch name, defaults to "main". */
119
- branch?: string; /** Parent document identifier for creating new documents. */
120
- parentIdentifier?: string; /** Conflict resolution strategy when remote has new operations. Default: no check (current behavior). */
121
- onConflict?: ConflictStrategy; /** Called when a streaming-mode push fails. If not provided, errors are silently swallowed. */
122
- onPushError?: (error: unknown) => void; /** Number of operations to fetch per page. Defaults to 100. */
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. */
123
127
  operationsPageSize?: number;
124
128
  };
125
129
  /**
@@ -127,7 +131,8 @@ type RemoteControllerOptions = {
127
131
  */
128
132
  type PushResult = {
129
133
  remoteDocument: RemoteDocumentData;
130
- actionCount: number; /** The actions that were sent to the server (after signing, if applicable). */
134
+ actionCount: number;
135
+ /** The actions that were sent to the server (after signing, if applicable). */
131
136
  operations: ReadonlyArray<Action$1>;
132
137
  };
133
138
  /**
@@ -149,9 +154,13 @@ type TrackedAction = {
149
154
  };
150
155
  /** Information about a detected conflict. */
151
156
  type ConflictInfo = {
152
- /** Remote operations added since the last pull, grouped by scope. */remoteOperations: Record<string, RemoteOperation[]>; /** Local actions pending push. */
153
- localActions: TrackedAction[]; /** Remote revision at last pull. */
154
- knownRevision: Record<string, number>; /** Current remote revision. */
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. */
155
164
  currentRevision: Record<string, number>;
156
165
  };
157
166
  /** Custom merge handler receives conflict info and returns actions to push (or throws to abort). */
@@ -351,7 +360,8 @@ declare class SubgraphSdkRegistry {
351
360
  //#endregion
352
361
  //#region src/graphql-client/graphql-reactor-client.d.ts
353
362
  type GraphQLReactorClientOptions = {
354
- /** The Switchboard GraphQL endpoint, e.g. `http://localhost:4001/graphql`. */url: string;
363
+ /** The Switchboard GraphQL endpoint, e.g. `http://localhost:4001/graphql`. */
364
+ url: string;
355
365
  /**
356
366
  * A pre-built SDK to use instead of the transport derived from `url`.
357
367
  * Mainly a test seam.
@@ -636,7 +646,8 @@ declare global {
636
646
  */
637
647
  declare function ensurePHEventHandlers(): void;
638
648
  type GraphQLReactorProviderProps = {
639
- /** The Switchboard GraphQL endpoint, e.g. `http://localhost:4001/graphql`. */url: string;
649
+ /** The Switchboard GraphQL endpoint, e.g. `http://localhost:4001/graphql`. */
650
+ url: string;
640
651
  /**
641
652
  * Resolves the bearer token sent with every request, per request. Defaults to
642
653
  * the token of the logged-in Renown user, or none when nobody is logged in.
@@ -722,15 +733,7 @@ type GraphQLReactorProviderProps = {
722
733
  * effect rebuilds both if it runs again on the same client - which is what a
723
734
  * `StrictMode` mount does.
724
735
  */
725
- declare function GraphQLReactorProvider({
726
- url,
727
- tokenProvider,
728
- subscriptionsUrl,
729
- realtime,
730
- attachmentService,
731
- documentModels,
732
- children
733
- }: GraphQLReactorProviderProps): react_jsx_runtime0.JSX.Element;
736
+ declare function GraphQLReactorProvider({ url, tokenProvider, subscriptionsUrl, realtime, attachmentService, documentModels, children }: GraphQLReactorProviderProps): import("react/jsx-runtime").JSX.Element;
734
737
  /**
735
738
  * Returns the {@link GraphQLReactorClient} mounted by
736
739
  * {@link GraphQLReactorProvider}, or `undefined` when the slot holds something
@@ -752,7 +755,7 @@ declare function useSwitchboardClient(): GraphQLReactorClient | undefined;
752
755
  * The operation selection of `GetDocumentOperations`, lifted into a fragment so
753
756
  * the write path can reuse `remoteOperationToLocal` on the items it selects.
754
757
  */
755
- declare const ReactorOperationFieldsFragmentDoc: graphql.DocumentNode;
758
+ declare const ReactorOperationFieldsFragmentDoc: import("graphql").DocumentNode;
756
759
  /**
757
760
  * `mutateDocument` plus the operations the mutation produced.
758
761
  *
@@ -774,7 +777,7 @@ declare const ReactorOperationFieldsFragmentDoc: graphql.DocumentNode;
774
777
  * by hand or the operations came from `main` while the actions were applied
775
778
  * elsewhere. One variable cannot disagree with itself.
776
779
  */
777
- declare const MutateDocumentWithOperationsDocument: graphql.DocumentNode;
780
+ declare const MutateDocumentWithOperationsDocument: import("graphql").DocumentNode;
778
781
  type MutateDocumentWithOperationsVariables = {
779
782
  documentIdentifier: Scalars["String"]["input"];
780
783
  actions: ReadonlyArray<ActionInput>;
@@ -903,13 +906,15 @@ type DocumentChangesEventPayload = DocumentChangesSubscription["documentChanges"
903
906
  /** The connection payload sent with the `ConnectionInit` message. */
904
907
  type ConnectionParams = Record<string, string>;
905
908
  type DocumentChangesSubscriptionOptions = {
906
- /** The websocket endpoint, e.g. `ws://localhost:4001/graphql/subscriptions`. */wsUrl: string;
909
+ /** The websocket endpoint, e.g. `ws://localhost:4001/graphql/subscriptions`. */
910
+ wsUrl: string;
907
911
  /**
908
912
  * Resolves the `ConnectionInit` payload. Called again on every reconnect, so
909
913
  * a token that expired while the socket was down is refreshed on the way back
910
914
  * up.
911
915
  */
912
- connectionParams?: () => Promise<ConnectionParams>; /** Called once per server event. */
916
+ connectionParams?: () => Promise<ConnectionParams>;
917
+ /** Called once per server event. */
913
918
  onEvent: (event: DocumentChangesEventPayload) => void;
914
919
  /**
915
920
  * Called when the socket gives up: the retries built into `graphql-ws` are
@@ -997,29 +1002,29 @@ declare function useDocumentSafe(id: string | null | undefined): {
997
1002
  readonly isRefetching: false;
998
1003
  readonly refetchError: undefined;
999
1004
  } | {
1000
- readonly reload: () => Promise<PHDocument$1>;
1001
- readonly isRefetching: boolean;
1002
- readonly refetchError: unknown;
1003
1005
  readonly status: "pending";
1004
1006
  readonly isPending: true;
1005
1007
  readonly error: undefined;
1006
1008
  readonly data: undefined;
1007
- } | {
1008
1009
  readonly reload: () => Promise<PHDocument$1>;
1009
1010
  readonly isRefetching: boolean;
1010
1011
  readonly refetchError: unknown;
1012
+ } | {
1011
1013
  readonly status: "success";
1012
1014
  readonly isPending: false;
1013
1015
  readonly error: undefined;
1014
1016
  readonly data: PHDocument$1;
1015
- } | {
1016
1017
  readonly reload: () => Promise<PHDocument$1>;
1017
1018
  readonly isRefetching: boolean;
1018
1019
  readonly refetchError: unknown;
1020
+ } | {
1019
1021
  readonly status: "error";
1020
1022
  readonly isPending: false;
1021
1023
  readonly error: unknown;
1022
1024
  readonly data: undefined;
1025
+ readonly reload: () => Promise<PHDocument$1>;
1026
+ readonly isRefetching: boolean;
1027
+ readonly refetchError: unknown;
1023
1028
  };
1024
1029
  /**
1025
1030
  * Retrieves multiple documents from the reactor using React Suspense.
@@ -1066,29 +1071,29 @@ declare function useGetDocumentAsync(id: string | null | undefined): {
1066
1071
  readonly isRefetching: false;
1067
1072
  readonly refetchError: undefined;
1068
1073
  } | {
1069
- readonly reload: () => Promise<PHDocument$1>;
1070
- readonly isRefetching: boolean;
1071
- readonly refetchError: unknown;
1072
1074
  readonly status: "pending";
1073
1075
  readonly isPending: true;
1074
1076
  readonly error: undefined;
1075
1077
  readonly data: undefined;
1076
- } | {
1077
1078
  readonly reload: () => Promise<PHDocument$1>;
1078
1079
  readonly isRefetching: boolean;
1079
1080
  readonly refetchError: unknown;
1081
+ } | {
1080
1082
  readonly status: "success";
1081
1083
  readonly isPending: false;
1082
1084
  readonly error: undefined;
1083
1085
  readonly data: PHDocument$1;
1084
- } | {
1085
1086
  readonly reload: () => Promise<PHDocument$1>;
1086
1087
  readonly isRefetching: boolean;
1087
1088
  readonly refetchError: unknown;
1089
+ } | {
1088
1090
  readonly status: "error";
1089
1091
  readonly isPending: false;
1090
1092
  readonly error: unknown;
1091
1093
  readonly data: undefined;
1094
+ readonly reload: () => Promise<PHDocument$1>;
1095
+ readonly isRefetching: boolean;
1096
+ readonly refetchError: unknown;
1092
1097
  };
1093
1098
  //#endregion
1094
1099
  //#region src/hooks/reactor.d.ts
@@ -1105,7 +1110,7 @@ declare const setReactorClient: SetPHGlobalValue<IReactorBrowserClient>;
1105
1110
  /** Adds an event handler for the reactor client */
1106
1111
  declare const addReactorClientEventHandler: AddPHGlobalEventHandler;
1107
1112
  declare const useSync: () => ISyncManager | undefined;
1108
- declare const useSyncList: () => _powerhousedao_reactor0.Remote[];
1113
+ declare const useSyncList: () => import("@powerhousedao/reactor").Remote[];
1109
1114
  declare const useModelRegistry: () => IDocumentModelRegistry | undefined;
1110
1115
  declare const useDatabase: () => Kysely<Database> | undefined;
1111
1116
  declare const usePGlite: () => PGlite | undefined;
@@ -1140,17 +1145,23 @@ type UseDocumentOperationsOptions = {
1140
1145
  * changing it while pages are already loaded has no effect until the next
1141
1146
  * invalidation or `refetch`.
1142
1147
  */
1143
- limit?: number; /** Whether to fetch at all. Default true. Pass false until the operations are needed. */
1148
+ limit?: number;
1149
+ /** Whether to fetch at all. Default true. Pass false until the operations are needed. */
1144
1150
  enabled?: boolean;
1145
1151
  };
1146
1152
  /** What `useDocumentOperations` returns; exported so consumers can name it. */
1147
1153
  type DocumentOperationsResult = {
1148
- /** Every operation of the scope loaded so far, oldest first. */operations: readonly Operation$1[]; /** A page is in flight. */
1149
- isLoading: boolean; /** The last page failed. Operations loaded before it stay available. */
1150
- error: Error | undefined; /** The last page reported a further page. */
1151
- hasNextPage: boolean; /** Reported by the GraphQL client only. */
1152
- totalCount: number | undefined; /** Loads the next page and appends it. No-op while loading or when there is none. */
1153
- fetchNextPage: () => void; /** Drops the document's cached operations and reloads from the first page. */
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
+ /** Loads the next page and appends it. No-op while loading or when there is none. */
1163
+ fetchNextPage: () => void;
1164
+ /** Drops the document's cached operations and reloads from the first page. */
1154
1165
  refetch: () => void;
1155
1166
  };
1156
1167
  /**
@@ -1193,4 +1204,5 @@ declare const setAttachmentService: SetPHGlobalValue<IAttachmentService>;
1193
1204
  declare const addAttachmentServiceEventHandler: AddPHGlobalEventHandler;
1194
1205
  //#endregion
1195
1206
  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 };
1196
- //# sourceMappingURL=attachment-service-cIdRZcTa.d.ts.map
1207
+ export {};
1208
+ //# sourceMappingURL=attachment-service-CF8LWxyM.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attachment-service-CF8LWxyM.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;;iBAQpB,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;EA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C;;cAIpC,kBAAkB,iBAAiB;;cAInC,kBAAkB,iBAAiB;;cAInC,8BAA8B;cAK9B,eAAc;cAGd,oDAAW;cAKX,wBAAuB;cAGvB,mBAAkB,OAAO;cAOzB,iBAAgB;;;;;;;;;KC1DjB,WAAW,YACrB,iBAAiB,YAAY,qBAC7B,YAAY,QAAQ,kBACpB,aAAa,QAAQ;KAGX,kBAAkB,WAAW,qBACvC,uBACA,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;;;;;;KAaU;EACV,kBAAkB;EAClB,iBAAiB;EACjB;EACA,OAAO;EACP;;;iBAoFc,sBACd,wCACC;;;;;;;;;;;;;;;;;iBAiBa,sBACd,uCACA,eACA,UAAU,+BACT;;;;cC/IU,sBAAsB,iBAAiB;;cAIvC,sBAAsB,iBAAiB;;cAIvC,kCAAkC"}
@@ -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-DjK30EQ-.js.map
90
+ //# sourceMappingURL=client-BiJAJ9dW.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"client-DjK30EQ-.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;AACrD,QAAO,IAAI,SAAS,IAAI,GAAG,IAAI,MAAM,GAAG,GAAG,GAAG;;AAGhD,eAAsB,YAAY,aAAqB;CACrD,MAAM,MAAM,MAAM,MAAM,GAAG,kBAAkB,YAAY,CAAC,WAAW;AACrE,KAAI,CAAC,IAAI,GAAI,OAAM,IAAI,MAAM,wBAAwB,IAAI,SAAS;AAElE,QADc,MAAM,IAAI,MAAM;;;;;;;AAShC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CAC1B;CAEA,YAAY,QAAgB;AAC1B,OAAK,SAAS,eAAe,OAAO;;CAGtC,MAAM,cAAsC;AAE1C,SADa,MAAM,YAAY,KAAK,OAAO;;CAI7C,MAAM,0BAA0B,cAAyC;AACvE,SAAO,MAAM,0BAA0B,KAAK,QAAQ,aAAa;;CAGnE,MAAM,eAAe,OAAuC;EAC1D,MAAM,WAAW,MAAM,KAAK,aAAa;AACzC,MAAI,CAAC,MAAO,QAAO;EACnB,MAAM,aAAa,MAAM,aAAa;AAEtC,SAAO,SAAS,QAAQ,QACtB,IAAI,KAAK,aAAa,CAAC,SAAS,WAAW,CAC5C;;CAGH,UAAU,UAAqD;EAC7D,MAAM,cAAc,IAAI,YAAY,GAAG,KAAK,OAAO,WAAW;AAE9D,cAAY,iBAAiB,YAAY,MAA4B;AAEnE,YADa,KAAK,MAAM,EAAE,KAAK,CACjB;IACd;AAEF,eAAa;AACX,eAAY,OAAO"}
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,O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;EAErC,OAAO,SAAS,QAAQ,QACtB,IAAI,KAAK,YAAY,CAAC,CAAC,SAAS,UAAU,CAC5C;CACF;CAEA,UAAU,UAAqD;EAC7D,MAAM,cAAc,IAAI,YAAY,GAAG,KAAK,OAAO,UAAU;EAE7D,YAAY,iBAAiB,YAAY,MAA4B;GAEnE,SADa,KAAK,MAAM,EAAE,IACd,CAAC;EACf,CAAC;EAED,aAAa;GACX,YAAY,MAAM;EACpB;CACF;AACF"}
@@ -1,6 +1,5 @@
1
- import { c as ReactorGraphQLClient, k as SdkFunctionWrapper } from "./types-N3Jy6Nry.js";
1
+ import { c as ReactorGraphQLClient, k as SdkFunctionWrapper } from "./types-B7-_l_wE.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
- //# sourceMappingURL=client-CxJD0Ck2.d.ts.map
13
+ export {};
14
+ //# sourceMappingURL=client-CngU4mtn.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client-CngU4mtn.d.ts","names":[],"sources":["../src/graphql/client.ts"],"mappings":";;;;;;;;;iBA4BgB,aACd,yBAAyB,eACzB,aAAa,qBACZ"}
@@ -1,16 +1,6 @@
1
1
  import { GraphQLClient } from "graphql-request";
2
2
  import { gql } 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";
@@ -51,7 +41,6 @@ const GetDocumentModelsDocument = gql`
51
41
  version
52
42
  specification
53
43
  }
54
- totalCount
55
44
  hasNextPage
56
45
  hasPreviousPage
57
46
  cursor
@@ -110,7 +99,6 @@ const GetDocumentWithOperationsDocument = gql`
110
99
  }
111
100
  }
112
101
  }
113
- totalCount
114
102
  hasNextPage
115
103
  hasPreviousPage
116
104
  cursor
@@ -137,7 +125,6 @@ const GetDocumentOutgoingRelationshipsDocument = gql`
137
125
  items {
138
126
  ...PHDocumentFields
139
127
  }
140
- totalCount
141
128
  hasNextPage
142
129
  hasPreviousPage
143
130
  cursor
@@ -161,7 +148,6 @@ const GetDocumentIncomingRelationshipsDocument = gql`
161
148
  items {
162
149
  ...PHDocumentFields
163
150
  }
164
- totalCount
165
151
  hasNextPage
166
152
  hasPreviousPage
167
153
  cursor
@@ -185,7 +171,6 @@ const GetDocumentOutgoingRelationshipEdgesDocument = gql`
185
171
  items {
186
172
  ...DocumentRelationshipFields
187
173
  }
188
- totalCount
189
174
  hasNextPage
190
175
  hasPreviousPage
191
176
  cursor
@@ -209,7 +194,6 @@ const GetDocumentIncomingRelationshipEdgesDocument = gql`
209
194
  items {
210
195
  ...DocumentRelationshipFields
211
196
  }
212
- totalCount
213
197
  hasNextPage
214
198
  hasPreviousPage
215
199
  cursor
@@ -227,7 +211,6 @@ const FindDocumentsDocument = gql`
227
211
  items {
228
212
  ...PHDocumentFields
229
213
  }
230
- totalCount
231
214
  hasNextPage
232
215
  hasPreviousPage
233
216
  cursor
@@ -271,7 +254,6 @@ const GetDocumentOperationsDocument = gql`
271
254
  }
272
255
  }
273
256
  }
274
- totalCount
275
257
  hasNextPage
276
258
  hasPreviousPage
277
259
  cursor
@@ -1014,6 +996,10 @@ function createClient(urlOrGQLClient, middleware) {
1014
996
  };
1015
997
  return {
1016
998
  ...getSdk(client, middleware),
999
+ /**
1000
+ * Run a hand-authored GraphQL document through the same transport and
1001
+ * middleware as the generated SDK methods.
1002
+ */
1017
1003
  async RunDocument(options) {
1018
1004
  const { document, variables, signal } = options;
1019
1005
  return runWithMiddleware(options.operationName, (wrappedRequestHeaders) => client.request({
@@ -1026,11 +1012,20 @@ function createClient(urlOrGQLClient, middleware) {
1026
1012
  signal
1027
1013
  }), options.operationType, variables);
1028
1014
  },
1015
+ /**
1016
+ * Fetch documentOperations for multiple filters in a single HTTP request
1017
+ * using GraphQL aliases. Each filter has its own paging parameters.
1018
+ * Returns one result page per filter, in order.
1019
+ */
1029
1020
  async BatchGetDocumentOperations(filters, pagings) {
1030
1021
  const { query, variables } = buildBatchOperationsQuery(filters, pagings);
1031
1022
  const data = await runWithMiddleware("BatchGetDocumentOperations", (requestHeaders) => client.request(query, variables, requestHeaders));
1032
1023
  return filters.map((_, i) => data[`scope_${i}`]);
1033
1024
  },
1025
+ /**
1026
+ * Fetch a document AND documentOperations for multiple filters
1027
+ * in a single HTTP request. Combines GetDocument + BatchGetDocumentOperations.
1028
+ */
1034
1029
  async BatchGetDocumentWithOperations(identifier, view, filters, pagings) {
1035
1030
  const { query, variables } = buildBatchDocumentWithOperationsQuery(identifier, view, filters, pagings);
1036
1031
  const data = await runWithMiddleware("BatchGetDocumentWithOperations", (requestHeaders) => client.request(query, variables, requestHeaders));
@@ -1042,6 +1037,6 @@ function createClient(urlOrGQLClient, middleware) {
1042
1037
  };
1043
1038
  }
1044
1039
  //#endregion
1045
- export { PhDocumentFieldsFragmentDoc as a, GetDocumentWithOperationsDocument as i, DocumentChangeType as n, PropagationMode as o, DocumentChangesDocument as r, createClient as t };
1040
+ export { PropagationMode as a, PhDocumentFieldsFragmentDoc as i, DocumentChangesDocument as n, GetDocumentWithOperationsDocument as r, createClient as t };
1046
1041
 
1047
- //# sourceMappingURL=client-D4bkR4pH.js.map
1042
+ //# sourceMappingURL=client-VV9M73s_.js.map