syncorejs 0.2.1 → 0.2.3

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 (169) hide show
  1. package/README.md +2 -1
  2. package/dist/_vendor/cli/app.d.mts.map +1 -1
  3. package/dist/_vendor/cli/app.mjs +330 -46
  4. package/dist/_vendor/cli/app.mjs.map +1 -1
  5. package/dist/_vendor/cli/context.mjs +27 -9
  6. package/dist/_vendor/cli/context.mjs.map +1 -1
  7. package/dist/_vendor/cli/dev-session.mjs.map +1 -1
  8. package/dist/_vendor/cli/doctor.mjs +513 -46
  9. package/dist/_vendor/cli/doctor.mjs.map +1 -1
  10. package/dist/_vendor/cli/errors.mjs.map +1 -1
  11. package/dist/_vendor/cli/help.mjs.map +1 -1
  12. package/dist/_vendor/cli/index.mjs +9 -2
  13. package/dist/_vendor/cli/index.mjs.map +1 -1
  14. package/dist/_vendor/cli/messages.mjs +5 -4
  15. package/dist/_vendor/cli/messages.mjs.map +1 -1
  16. package/dist/_vendor/cli/preflight.mjs.map +1 -1
  17. package/dist/_vendor/cli/project.mjs +125 -27
  18. package/dist/_vendor/cli/project.mjs.map +1 -1
  19. package/dist/_vendor/cli/render.mjs +57 -9
  20. package/dist/_vendor/cli/render.mjs.map +1 -1
  21. package/dist/_vendor/cli/targets.mjs +4 -3
  22. package/dist/_vendor/cli/targets.mjs.map +1 -1
  23. package/dist/_vendor/core/cli.d.mts +20 -4
  24. package/dist/_vendor/core/cli.d.mts.map +1 -1
  25. package/dist/_vendor/core/cli.mjs +458 -133
  26. package/dist/_vendor/core/cli.mjs.map +1 -1
  27. package/dist/_vendor/core/devtools-auth.mjs +60 -0
  28. package/dist/_vendor/core/devtools-auth.mjs.map +1 -0
  29. package/dist/_vendor/core/index.d.mts +5 -3
  30. package/dist/_vendor/core/index.mjs +22 -2
  31. package/dist/_vendor/core/index.mjs.map +1 -1
  32. package/dist/_vendor/core/runtime/components.d.mts +111 -0
  33. package/dist/_vendor/core/runtime/components.d.mts.map +1 -0
  34. package/dist/_vendor/core/runtime/components.mjs +186 -0
  35. package/dist/_vendor/core/runtime/components.mjs.map +1 -0
  36. package/dist/_vendor/core/runtime/devtools.d.mts +4 -4
  37. package/dist/_vendor/core/runtime/devtools.d.mts.map +1 -1
  38. package/dist/_vendor/core/runtime/devtools.mjs +178 -60
  39. package/dist/_vendor/core/runtime/devtools.mjs.map +1 -1
  40. package/dist/_vendor/core/runtime/functions.d.mts +398 -16
  41. package/dist/_vendor/core/runtime/functions.d.mts.map +1 -1
  42. package/dist/_vendor/core/runtime/functions.mjs +74 -3
  43. package/dist/_vendor/core/runtime/functions.mjs.map +1 -1
  44. package/dist/_vendor/core/runtime/id.d.mts.map +1 -1
  45. package/dist/_vendor/core/runtime/id.mjs.map +1 -1
  46. package/dist/_vendor/core/runtime/internal/engines/devtoolsEngine.mjs +83 -0
  47. package/dist/_vendor/core/runtime/internal/engines/devtoolsEngine.mjs.map +1 -0
  48. package/dist/_vendor/core/runtime/internal/engines/executionEngine.mjs +720 -0
  49. package/dist/_vendor/core/runtime/internal/engines/executionEngine.mjs.map +1 -0
  50. package/dist/_vendor/core/runtime/internal/engines/reactivityEngine.mjs +234 -0
  51. package/dist/_vendor/core/runtime/internal/engines/reactivityEngine.mjs.map +1 -0
  52. package/dist/_vendor/core/runtime/internal/engines/schedulerEngine.mjs +255 -0
  53. package/dist/_vendor/core/runtime/internal/engines/schedulerEngine.mjs.map +1 -0
  54. package/dist/_vendor/core/runtime/internal/engines/schemaEngine.mjs +200 -0
  55. package/dist/_vendor/core/runtime/internal/engines/schemaEngine.mjs.map +1 -0
  56. package/dist/_vendor/core/runtime/internal/engines/shared.mjs +252 -0
  57. package/dist/_vendor/core/runtime/internal/engines/shared.mjs.map +1 -0
  58. package/dist/_vendor/core/runtime/internal/engines/storageEngine.mjs +145 -0
  59. package/dist/_vendor/core/runtime/internal/engines/storageEngine.mjs.map +1 -0
  60. package/dist/_vendor/core/runtime/internal/runtimeKernel.mjs +221 -0
  61. package/dist/_vendor/core/runtime/internal/runtimeKernel.mjs.map +1 -0
  62. package/dist/_vendor/core/runtime/internal/runtimeStatus.mjs +32 -0
  63. package/dist/_vendor/core/runtime/internal/runtimeStatus.mjs.map +1 -0
  64. package/dist/_vendor/core/runtime/internal/systemMeta.mjs +61 -0
  65. package/dist/_vendor/core/runtime/internal/systemMeta.mjs.map +1 -0
  66. package/dist/_vendor/core/runtime/internal/transactionCoordinator.mjs +41 -0
  67. package/dist/_vendor/core/runtime/internal/transactionCoordinator.mjs.map +1 -0
  68. package/dist/_vendor/core/runtime/runtime.d.mts +1187 -202
  69. package/dist/_vendor/core/runtime/runtime.d.mts.map +1 -1
  70. package/dist/_vendor/core/runtime/runtime.mjs +73 -1365
  71. package/dist/_vendor/core/runtime/runtime.mjs.map +1 -1
  72. package/dist/_vendor/core/transport.d.mts +113 -0
  73. package/dist/_vendor/core/transport.d.mts.map +1 -0
  74. package/dist/_vendor/core/transport.mjs +428 -0
  75. package/dist/_vendor/core/transport.mjs.map +1 -0
  76. package/dist/_vendor/devtools-protocol/index.d.ts +187 -4
  77. package/dist/_vendor/devtools-protocol/index.d.ts.map +1 -1
  78. package/dist/_vendor/devtools-protocol/index.js +25 -9
  79. package/dist/_vendor/devtools-protocol/index.js.map +1 -1
  80. package/dist/_vendor/next/config.d.ts +3 -4
  81. package/dist/_vendor/next/config.d.ts.map +1 -1
  82. package/dist/_vendor/next/config.js +37 -19
  83. package/dist/_vendor/next/config.js.map +1 -1
  84. package/dist/_vendor/next/index.d.ts +109 -29
  85. package/dist/_vendor/next/index.d.ts.map +1 -1
  86. package/dist/_vendor/next/index.js +104 -26
  87. package/dist/_vendor/next/index.js.map +1 -1
  88. package/dist/_vendor/platform-expo/index.d.ts +156 -37
  89. package/dist/_vendor/platform-expo/index.d.ts.map +1 -1
  90. package/dist/_vendor/platform-expo/index.js +80 -12
  91. package/dist/_vendor/platform-expo/index.js.map +1 -1
  92. package/dist/_vendor/platform-expo/react.d.ts.map +1 -1
  93. package/dist/_vendor/platform-expo/react.js +11 -10
  94. package/dist/_vendor/platform-expo/react.js.map +1 -1
  95. package/dist/_vendor/platform-expo/web-sqljs-wasm.js +16 -0
  96. package/dist/_vendor/platform-expo/web-sqljs-wasm.js.map +1 -0
  97. package/dist/_vendor/platform-node/index.d.mts +192 -24
  98. package/dist/_vendor/platform-node/index.d.mts.map +1 -1
  99. package/dist/_vendor/platform-node/index.mjs +236 -97
  100. package/dist/_vendor/platform-node/index.mjs.map +1 -1
  101. package/dist/_vendor/platform-node/ipc-react.d.mts.map +1 -1
  102. package/dist/_vendor/platform-node/ipc-react.mjs +15 -2
  103. package/dist/_vendor/platform-node/ipc-react.mjs.map +1 -1
  104. package/dist/_vendor/platform-node/ipc.d.mts +11 -35
  105. package/dist/_vendor/platform-node/ipc.d.mts.map +1 -1
  106. package/dist/_vendor/platform-node/ipc.mjs +3 -273
  107. package/dist/_vendor/platform-node/ipc.mjs.map +1 -1
  108. package/dist/_vendor/platform-web/external-change.d.ts +43 -1
  109. package/dist/_vendor/platform-web/external-change.d.ts.map +1 -1
  110. package/dist/_vendor/platform-web/external-change.js +32 -1
  111. package/dist/_vendor/platform-web/external-change.js.map +1 -1
  112. package/dist/_vendor/platform-web/index.d.ts +323 -51
  113. package/dist/_vendor/platform-web/index.d.ts.map +1 -1
  114. package/dist/_vendor/platform-web/index.js +233 -30
  115. package/dist/_vendor/platform-web/index.js.map +1 -1
  116. package/dist/_vendor/platform-web/indexeddb.d.ts +12 -0
  117. package/dist/_vendor/platform-web/indexeddb.d.ts.map +1 -1
  118. package/dist/_vendor/platform-web/indexeddb.js +10 -0
  119. package/dist/_vendor/platform-web/indexeddb.js.map +1 -1
  120. package/dist/_vendor/platform-web/opfs.d.ts +13 -0
  121. package/dist/_vendor/platform-web/opfs.d.ts.map +1 -1
  122. package/dist/_vendor/platform-web/opfs.js +12 -0
  123. package/dist/_vendor/platform-web/opfs.js.map +1 -1
  124. package/dist/_vendor/platform-web/persistence.d.ts +54 -0
  125. package/dist/_vendor/platform-web/persistence.d.ts.map +1 -1
  126. package/dist/_vendor/platform-web/persistence.js +15 -0
  127. package/dist/_vendor/platform-web/persistence.js.map +1 -1
  128. package/dist/_vendor/platform-web/react.d.ts +1 -2
  129. package/dist/_vendor/platform-web/react.d.ts.map +1 -1
  130. package/dist/_vendor/platform-web/react.js +27 -13
  131. package/dist/_vendor/platform-web/react.js.map +1 -1
  132. package/dist/_vendor/platform-web/sqljs.js +10 -1
  133. package/dist/_vendor/platform-web/sqljs.js.map +1 -1
  134. package/dist/_vendor/platform-web/web-sqljs-wasm.js +8 -0
  135. package/dist/_vendor/platform-web/web-sqljs-wasm.js.map +1 -0
  136. package/dist/_vendor/platform-web/worker.d.ts +71 -44
  137. package/dist/_vendor/platform-web/worker.d.ts.map +1 -1
  138. package/dist/_vendor/platform-web/worker.js +40 -271
  139. package/dist/_vendor/platform-web/worker.js.map +1 -1
  140. package/dist/_vendor/react/index.d.ts +222 -23
  141. package/dist/_vendor/react/index.d.ts.map +1 -1
  142. package/dist/_vendor/react/index.js +476 -63
  143. package/dist/_vendor/react/index.js.map +1 -1
  144. package/dist/_vendor/schema/definition.d.ts +151 -37
  145. package/dist/_vendor/schema/definition.d.ts.map +1 -1
  146. package/dist/_vendor/schema/definition.js +102 -20
  147. package/dist/_vendor/schema/definition.js.map +1 -1
  148. package/dist/_vendor/schema/index.d.ts +4 -4
  149. package/dist/_vendor/schema/index.js +2 -2
  150. package/dist/_vendor/schema/planner.d.ts +19 -2
  151. package/dist/_vendor/schema/planner.d.ts.map +1 -1
  152. package/dist/_vendor/schema/planner.js +79 -3
  153. package/dist/_vendor/schema/planner.js.map +1 -1
  154. package/dist/_vendor/schema/validators.d.ts +279 -83
  155. package/dist/_vendor/schema/validators.d.ts.map +1 -1
  156. package/dist/_vendor/schema/validators.js +330 -38
  157. package/dist/_vendor/schema/validators.js.map +1 -1
  158. package/dist/_vendor/svelte/index.d.ts +245 -19
  159. package/dist/_vendor/svelte/index.d.ts.map +1 -1
  160. package/dist/_vendor/svelte/index.js +443 -20
  161. package/dist/_vendor/svelte/index.js.map +1 -1
  162. package/dist/browser.d.ts.map +1 -1
  163. package/dist/cli.js +3 -1
  164. package/dist/cli.js.map +1 -1
  165. package/dist/components.d.ts +2 -0
  166. package/dist/components.js +2 -0
  167. package/dist/index.d.ts +3 -2
  168. package/dist/index.js +2 -1
  169. package/package.json +29 -21
@@ -1,43 +1,269 @@
1
1
  import { Readable } from "svelte/store";
2
- import { FunctionArgs, FunctionReference, FunctionResult, SyncoreClient } from "../core/index.d.mts";
2
+ import { FunctionArgs, FunctionReference, FunctionResult, PaginationOptions, PaginationResult, SyncoreClient, SyncoreQueryState, SyncoreRuntimeStatus, UsePaginatedQueryResult } from "../core/index.d.mts";
3
3
 
4
4
  //#region src/index.d.ts
5
5
  type OptionalArgsTuple<TArgs> = Record<never, never> extends TArgs ? [args?: TArgs] : [args: TArgs];
6
+ type QueryRequestInput<TReference extends FunctionReference<"query"> = FunctionReference<"query">> = Record<never, never> extends FunctionArgs<TReference> ? {
7
+ query: TReference;
8
+ args?: FunctionArgs<TReference> | Skip;
9
+ } : {
10
+ query: TReference;
11
+ args: FunctionArgs<TReference> | Skip;
12
+ };
13
+ type QueriesRequestInput = Record<string, QueryRequestInput>;
14
+ type QueryStateForEntry<TEntry> = TEntry extends QueryRequestInput<infer TReference> ? SyncoreQueryState<FunctionResult<TReference>> : never;
15
+ type CreateQueriesStoreResult<TEntries extends QueriesRequestInput> = { [TKey in keyof TEntries]: QueryStateForEntry<TEntries[TKey]> };
16
+ type PaginatedQueryReference = FunctionReference<"query", Record<string, unknown>, PaginationResult<unknown>>;
17
+ type PaginatedQueryArgs<TReference extends FunctionReference<"query">> = FunctionArgs<TReference> extends {
18
+ paginationOpts: PaginationOptions;
19
+ } ? Omit<FunctionArgs<TReference>, "paginationOpts"> : never;
20
+ type PaginatedQueryItem<TReference extends FunctionReference<"query">> = FunctionResult<TReference> extends PaginationResult<infer TItem> ? TItem : never;
6
21
  /**
7
- * The observable state exposed by a Syncore-backed Svelte query store.
22
+ * The reactive query state shape emitted by Syncore's Svelte store factories.
23
+ *
24
+ * Extends {@link SyncoreQueryState} with the same fields (`data`, `error`,
25
+ * `status`, `runtimeStatus`, `isLoading`, `isError`, `isReady`). Returned as
26
+ * the value of stores created by {@link createQueryStore} and
27
+ * {@link createClientQueryStore}.
8
28
  */
9
- interface SyncoreQueryStoreState<TResult> {
10
- /** The latest local result for the watched query. */
11
- data: TResult | undefined;
12
- /** The latest local error for the watched query, if any. */
13
- error: Error | undefined;
14
- /** The current watch lifecycle status. */
15
- status: "loading" | "ready" | "error";
16
- }
29
+ interface SyncoreQueryStoreState<TResult> extends SyncoreQueryState<TResult> {}
17
30
  /**
18
- * Store a Syncore client in the current Svelte component context.
31
+ * A sentinel value that tells Syncore store factories to skip the query.
32
+ *
33
+ * Use `skip` in place of a query’s `args` argument to avoid firing the query
34
+ * while some required data is not yet available (e.g. a user ID that loads
35
+ * asynchronously). The store will remain in a `"loading"` / skipped state
36
+ * until a non-skip value is provided.
37
+ *
38
+ * ```svelte
39
+ * <script>
40
+ * import { createQueryValueStore, skip } from "syncorejs/svelte";
41
+ * import { api } from "../syncore/_generated/api";
42
+ *
43
+ * export let userId: string | undefined;
44
+ *
45
+ * $: profile = createQueryValueStore(
46
+ * api.users.get,
47
+ * userId ? { id: userId } : skip
48
+ * );
49
+ * </script>
50
+ * ```
51
+ */
52
+ declare const skip: "skip";
53
+ type Skip = typeof skip;
54
+ /**
55
+ * Store the Syncore client in Svelte’s component context.
56
+ *
57
+ * Call this once at the root of your component tree (e.g. in a layout or
58
+ * root `+layout.svelte`) so that the context-aware store factories
59
+ * (`createQueryStore`, `createQueriesStore`, etc.) can retrieve it
60
+ * automatically without prop-drilling.
61
+ *
62
+ * ```svelte
63
+ * <!-- +layout.svelte -->
64
+ * <script>
65
+ * import { setSyncoreClient } from "syncorejs/svelte";
66
+ * export let data; // { client } from +layout.ts
67
+ * setSyncoreClient(data.client);
68
+ * </script>
69
+ * <slot />
70
+ * ```
71
+ *
72
+ * @param client - The ready Syncore client to store in context.
73
+ * @returns The same `client` for convenience.
19
74
  */
20
75
  declare function setSyncoreClient(client: SyncoreClient): SyncoreClient;
21
76
  /**
22
- * Read the active Syncore client from the current Svelte component context.
77
+ * Retrieve the Syncore client from Svelte’s component context.
78
+ *
79
+ * Throws if {@link setSyncoreClient} has not been called by an ancestor
80
+ * component. Only use this inside Svelte components; for standalone scripts
81
+ * keep an explicit reference to the client instead.
82
+ *
83
+ * @throws `Error` when no client is found in the component context.
23
84
  */
24
85
  declare function getSyncoreClient(): SyncoreClient;
25
86
  /**
26
- * Create a readable Svelte store backed by a reactive Syncore query.
87
+ * Create a reactive Svelte store that tracks the Syncore runtime status.
88
+ *
89
+ * Uses the client from Svelte context (set via {@link setSyncoreClient}).
90
+ * Subscribe to gate your UI on `"ready"` before rendering data-dependent
91
+ * components.
92
+ *
93
+ * ```svelte
94
+ * <script>
95
+ * import { createSyncoreStatusStore } from "syncorejs/svelte";
96
+ * const status = createSyncoreStatusStore();
97
+ * </script>
98
+ *
99
+ * {#if $status.kind === "ready"}
100
+ * <App />
101
+ * {:else}
102
+ * <Loading />
103
+ * {/if}
104
+ * ```
105
+ */
106
+ declare function createSyncoreStatusStore(): Readable<SyncoreRuntimeStatus>;
107
+ /**
108
+ * Create a reactive Svelte store that tracks the Syncore runtime status.
109
+ *
110
+ * Accepts an explicit `client` rather than reading from Svelte context,
111
+ * making it usable outside component trees (e.g. in module-level code or
112
+ * SvelteKit `load` functions).
113
+ *
114
+ * @param client - The Syncore client to observe.
115
+ */
116
+ declare function createClientSyncoreStatusStore(client: SyncoreClient): Readable<SyncoreRuntimeStatus>;
117
+ /**
118
+ * Create a reactive Svelte store that emits the current value of a Syncore
119
+ * query, or `undefined` while loading.
120
+ *
121
+ * Uses the client from Svelte context (set via {@link setSyncoreClient}).
122
+ * Pass `skip` as `args` to pause the query.
123
+ *
124
+ * ```svelte
125
+ * <script>
126
+ * import { createQueryValueStore } from "syncorejs/svelte";
127
+ * import { api } from "../syncore/_generated/api";
128
+ *
129
+ * const todos = createQueryValueStore(api.todos.list);
130
+ * </script>
131
+ *
132
+ * {#each $todos ?? [] as todo}
133
+ * <p>{todo.text}</p>
134
+ * {/each}
135
+ * ```
136
+ */
137
+ declare function createQueryValueStore<TReference extends FunctionReference<"query">>(reference: TReference, ...args: OptionalArgsTuple<FunctionArgs<TReference>> | [Skip]): Readable<FunctionResult<TReference> | undefined>;
138
+ /**
139
+ * Create a reactive Svelte store that emits the current value of a Syncore
140
+ * query, or `undefined` while loading.
141
+ *
142
+ * Accepts an explicit `client` instead of reading from Svelte context.
143
+ *
144
+ * @param client - The Syncore client to query against.
145
+ */
146
+ declare function createClientQueryValueStore<TReference extends FunctionReference<"query">>(client: SyncoreClient, reference: TReference, ...args: OptionalArgsTuple<FunctionArgs<TReference>> | [Skip]): Readable<FunctionResult<TReference> | undefined>;
147
+ /**
148
+ * Create a reactive Svelte store that emits the full {@link SyncoreQueryState}
149
+ * for a query, including `data`, `error`, `status`, and `isPending`.
150
+ *
151
+ * Uses the client from Svelte context (set via {@link setSyncoreClient}).
152
+ *
153
+ * ```svelte
154
+ * <script>
155
+ * import { createQueryStore } from "syncorejs/svelte";
156
+ * import { api } from "../syncore/_generated/api";
157
+ *
158
+ * const state = createQueryStore(api.todos.list);
159
+ * </script>
160
+ *
161
+ * {#if $state.isPending}
162
+ * <Spinner />
163
+ * {:else if $state.error}
164
+ * <Error message={$state.error.message} />
165
+ * {:else}
166
+ * {#each $state.data as todo}<p>{todo.text}</p>{/each}
167
+ * {/if}
168
+ * ```
169
+ */
170
+ declare function createQueryStore<TReference extends FunctionReference<"query">>(reference: TReference, ...args: OptionalArgsTuple<FunctionArgs<TReference>> | [Skip]): Readable<SyncoreQueryStoreState<FunctionResult<TReference>>>;
171
+ /**
172
+ * Create a reactive Svelte store that emits the full {@link SyncoreQueryState}
173
+ * for a query, including `data`, `error`, `status`, and `isPending`.
174
+ *
175
+ * Accepts an explicit `client` instead of reading from Svelte context.
176
+ *
177
+ * @param client - The Syncore client to query against.
178
+ */
179
+ declare function createClientQueryStore<TReference extends FunctionReference<"query">>(client: SyncoreClient, reference: TReference, ...args: OptionalArgsTuple<FunctionArgs<TReference>> | [Skip]): Readable<SyncoreQueryStoreState<FunctionResult<TReference>>>;
180
+ /**
181
+ * Create a reactive Svelte store that simultaneously observes multiple
182
+ * Syncore queries.
183
+ *
184
+ * Uses the client from Svelte context (set via {@link setSyncoreClient}).
185
+ * Each key in `entries` corresponds to a key in the emitted result object.
186
+ *
187
+ * ```svelte
188
+ * <script>
189
+ * import { createQueriesStore } from "syncorejs/svelte";
190
+ * import { api } from "../syncore/_generated/api";
191
+ *
192
+ * const stores = createQueriesStore({
193
+ * todos: { query: api.todos.list },
194
+ * user: { query: api.users.me },
195
+ * });
196
+ * </script>
197
+ *
198
+ * <p>{$stores.user.data?.name} has {$stores.todos.data?.length} todos</p>
199
+ * ```
200
+ */
201
+ declare function createQueriesStore<TEntries extends QueriesRequestInput>(entries: TEntries): Readable<CreateQueriesStoreResult<TEntries>>;
202
+ /**
203
+ * Create a reactive Svelte store that simultaneously observes multiple
204
+ * Syncore queries.
205
+ *
206
+ * Accepts an explicit `client` instead of reading from Svelte context.
207
+ *
208
+ * @param client - The Syncore client to query against.
209
+ */
210
+ declare function createClientQueriesStore<TEntries extends QueriesRequestInput>(client: SyncoreClient, entries: TEntries): Readable<CreateQueriesStoreResult<TEntries>>;
211
+ /**
212
+ * Create a reactive Svelte store for cursor-based paginated Syncore queries.
213
+ *
214
+ * Uses the client from Svelte context (set via {@link setSyncoreClient}).
215
+ * The store handles page tracking and exposes a `loadMore()` function so you
216
+ * can implement “Load More” UIs without manual cursor management.
217
+ *
218
+ * The query referenced by `reference` must accept a `paginationOpts`
219
+ * argument and return a {@link PaginationResult}.
220
+ *
221
+ * ```svelte
222
+ * <script>
223
+ * import { createPaginatedQueryStore } from "syncorejs/svelte";
224
+ * import { api } from "../syncore/_generated/api";
225
+ *
226
+ * const result = createPaginatedQueryStore(
227
+ * api.todos.listPaginated,
228
+ * {},
229
+ * { initialNumItems: 10 }
230
+ * );
231
+ * </script>
232
+ *
233
+ * {#each $result.results as todo}<p>{todo.text}</p>{/each}
234
+ * {#if $result.canLoadMore}
235
+ * <button on:click={() => $result.loadMore(10)}>Load more</button>
236
+ * {/if}
237
+ * ```
238
+ *
239
+ * @param reference - A paginated query function reference.
240
+ * @param args - Query arguments excluding `paginationOpts`, or `skip`.
241
+ * @param options.initialNumItems - Number of items to fetch on the first page.
27
242
  */
28
- declare function createQueryStore<TReference extends FunctionReference<"query">>(reference: TReference, ...args: OptionalArgsTuple<FunctionArgs<TReference>>): Readable<SyncoreQueryStoreState<FunctionResult<TReference>>>;
243
+ declare function createPaginatedQueryStore<TReference extends PaginatedQueryReference>(reference: TReference, args: PaginatedQueryArgs<TReference> | Skip, options: {
244
+ initialNumItems: number;
245
+ }): Readable<UsePaginatedQueryResult<PaginatedQueryItem<TReference>>>;
29
246
  /**
30
- * Create a readable Svelte store backed by a reactive Syncore query.
247
+ * Create a reactive Svelte store for cursor-based paginated Syncore queries.
248
+ *
249
+ * Accepts an explicit `client` instead of reading from Svelte context.
250
+ *
251
+ * @param client - The Syncore client to query against.
252
+ * @param reference - A paginated query function reference.
253
+ * @param args - Query arguments excluding `paginationOpts`, or `skip`.
254
+ * @param options.initialNumItems - Number of items to fetch on the first page.
31
255
  */
32
- declare function createClientQueryStore<TReference extends FunctionReference<"query">>(client: SyncoreClient, reference: TReference, ...args: OptionalArgsTuple<FunctionArgs<TReference>>): Readable<SyncoreQueryStoreState<FunctionResult<TReference>>>;
256
+ declare function createClientPaginatedQueryStore<TReference extends PaginatedQueryReference>(client: SyncoreClient, reference: TReference, args: PaginatedQueryArgs<TReference> | Skip, options: {
257
+ initialNumItems: number;
258
+ }): Readable<UsePaginatedQueryResult<PaginatedQueryItem<TReference>>>;
33
259
  /**
34
- * Create a function that executes a Syncore mutation.
260
+ * Creates a callable wrapper for a Syncore mutation using the contextual client.
35
261
  */
36
262
  declare function createMutation<TReference extends FunctionReference<"mutation">>(reference: TReference): (...args: OptionalArgsTuple<FunctionArgs<TReference>>) => Promise<FunctionResult<TReference>>;
37
263
  /**
38
- * Create a function that executes a Syncore action.
264
+ * Creates a callable wrapper for a Syncore action using the contextual client.
39
265
  */
40
266
  declare function createAction<TReference extends FunctionReference<"action">>(reference: TReference): (...args: OptionalArgsTuple<FunctionArgs<TReference>>) => Promise<FunctionResult<TReference>>;
41
267
  //#endregion
42
- export { OptionalArgsTuple, SyncoreQueryStoreState, createAction, createClientQueryStore, createMutation, createQueryStore, getSyncoreClient, setSyncoreClient };
268
+ export { CreateQueriesStoreResult, OptionalArgsTuple, SyncoreQueryStoreState, createAction, createClientPaginatedQueryStore, createClientQueriesStore, createClientQueryStore, createClientQueryValueStore, createClientSyncoreStatusStore, createMutation, createPaginatedQueryStore, createQueriesStore, createQueryStore, createQueryValueStore, createSyncoreStatusStore, getSyncoreClient, setSyncoreClient, skip };
43
269
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"mappings":";;;;KAUY,iBAAA,UACV,MAAA,uBAA6B,KAAA,IAAS,IAAA,GAAO,KAAA,KAAU,IAAA,EAAM,KAAA;;AAD/D;;UAMiB,sBAAA;EALf;EAOA,IAAA,EAAM,OAAA;EAPuC;EAU7C,KAAA,EAAO,KAAA;EAV2D;EAalE,MAAA;AAAA;;;;iBAQc,gBAAA,CAAiB,MAAA,EAAQ,aAAA,GAAgB,aAAA;;;;iBAQzC,gBAAA,CAAA,GAAoB,aAAA;AAxBpC;;;AAAA,iBAqCgB,gBAAA,oBAAoC,iBAAA,UAAA,CAClD,SAAA,EAAW,UAAA,KACR,IAAA,EAAM,iBAAA,CAAkB,YAAA,CAAa,UAAA,KACvC,QAAA,CAAS,sBAAA,CAAuB,c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