@lunora/client 1.0.0-alpha.16 → 1.0.0-alpha.17
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/auth/index.d.mts +1 -1
- package/dist/auth/index.d.ts +1 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.mjs +3 -3
- package/dist/packem_shared/{LunoraClient-Zb_AVP5H.mjs → LunoraClient-jOfAmV8f.mjs} +60 -53
- package/dist/packem_shared/{createInMemoryPersistence-CY6F0ZvQ.mjs → createInMemoryPersistence-Ds7z8n8d.mjs} +3 -1
- package/dist/packem_shared/{createInMemoryQueryCache-Bv4Ruv6n.mjs → createInMemoryQueryCache-iWtKPrid.mjs} +3 -1
- package/dist/packem_shared/{createServerClient-CFrM8ZQO.mjs → createServerClient-Blht8tLm.mjs} +1 -1
- package/dist/packem_shared/{lunora-client.d-CPMaTnsC.d.mts → lunora-client.d-DPLSlPiP.d.mts} +11 -1
- package/dist/packem_shared/{lunora-client.d-CPMaTnsC.d.ts → lunora-client.d-DPLSlPiP.d.ts} +11 -1
- package/dist/packem_shared/{preload.d-Bl3z1rPo.d.mts → preload.d-Bpi7xweC.d.mts} +1 -1
- package/dist/packem_shared/{preload.d-DH0CqSxy.d.ts → preload.d-CmFdZFQi.d.ts} +1 -1
- package/dist/query/index.d.mts +2 -2
- package/dist/query/index.d.ts +2 -2
- package/dist/ssr/index.d.mts +3 -3
- package/dist/ssr/index.d.ts +3 -3
- package/dist/ssr/index.mjs +1 -1
- package/package.json +4 -1
package/dist/auth/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { U as User, L as LunoraClient } from "../packem_shared/lunora-client.d-
|
|
1
|
+
import { U as User, L as LunoraClient } from "../packem_shared/lunora-client.d-DPLSlPiP.mjs";
|
|
2
2
|
import '@lunora/runtime';
|
|
3
3
|
interface IdentityStore {
|
|
4
4
|
/** Read the current resolved user, or `null` when signed out / not yet resolved. */
|
package/dist/auth/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { U as User, L as LunoraClient } from "../packem_shared/lunora-client.d-
|
|
1
|
+
import { U as User, L as LunoraClient } from "../packem_shared/lunora-client.d-DPLSlPiP.js";
|
|
2
2
|
import '@lunora/runtime';
|
|
3
3
|
interface IdentityStore {
|
|
4
4
|
/** Read the current resolved user, or `null` when signed out / not yet resolved. */
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { c as PersistenceAdapter, B as BookmarkStorage, F as FunctionReference, A as ArgsOf, M as MutationCallOptions, R as ReturnOf, O as OfflineQueueOptions, Q as QueryCacheAdapter, d as ReconnectOptions } from "./packem_shared/lunora-client.d-
|
|
2
|
-
export { type e as BatchSlot, C as CONFLICT_ERROR_CODE, type f as CachedQuery, type g as ClientMessage, type h as ClientShapeSubscribeMessage, type i as ClientShapeUnsubscribeMessage, type j as ConnectionStatus, D as DEFAULT_MAX_BUFFER, type k as FunctionArgumentDescriptor, type l as FunctionDescriptor, type G as GlobalFacetResult, type m as GlobalFacetValue, type n as GlobalFilterClause, type o as GlobalTableInfo, type p as GlobalTablePage, L as LunoraClient, type q as LunoraClientError, type r as LunoraClientOptions, type s as LunoraErrorCode, type t as MutationSettledEvent, type u as OptimisticLocalStore, type v as OptimisticUpdate, type w as OutboxMutation, type x as OutboxSink, type y as PersistedMutation, type P as Preloaded, type z as RowOp, type E as RpcEnvelope, type H as RpcResponseBody, type I as ScheduleRecord, type J as SchedulerPoolStatus, type K as SchedulerStatus, type N as ServerMessage, type T as ServerPokeEndMessage, type V as ServerPokePartMessage, type W as ServerPokeStartMessage, type X as ShardTrafficEntry, type Y as ShardTrafficResult, type Z as StorageListPage, type _ as StorageObject, type $ as StreamHandle, type a0 as StreamIterable, type a1 as SubscriptionCallback, type S as SubscriptionError, type b as SubscriptionErrorCallback, a2 as SubscriptionRegistry, type a3 as SubscriptionState, type a4 as SyncWatermark, type a as Unsubscribe, type U as User, type a5 as WorkflowInstanceAction, type a6 as WorkflowInstanceDetail, type a7 as WorkflowInstancePage, type a8 as WorkflowInstanceStatus, type a9 as WorkflowInstanceSummary, type aa as WorkflowStepDetail, ab as createLocalStore, ac as createStream, ad as getErrorCode, ae as getRetryAfterMs, af as isConflictError, ag as isForbiddenError, ah as isRateLimitedError, ai as isUnauthorizedError } from "./packem_shared/lunora-client.d-
|
|
3
|
-
export { p as preloadQuery, a as preloadedQueryResult } from "./packem_shared/preload.d-
|
|
1
|
+
import { c as PersistenceAdapter, B as BookmarkStorage, F as FunctionReference, A as ArgsOf, M as MutationCallOptions, R as ReturnOf, O as OfflineQueueOptions, Q as QueryCacheAdapter, d as ReconnectOptions } from "./packem_shared/lunora-client.d-DPLSlPiP.mjs";
|
|
2
|
+
export { type e as BatchSlot, C as CONFLICT_ERROR_CODE, type f as CachedQuery, type g as ClientMessage, type h as ClientShapeSubscribeMessage, type i as ClientShapeUnsubscribeMessage, type j as ConnectionStatus, D as DEFAULT_MAX_BUFFER, type k as FunctionArgumentDescriptor, type l as FunctionDescriptor, type G as GlobalFacetResult, type m as GlobalFacetValue, type n as GlobalFilterClause, type o as GlobalTableInfo, type p as GlobalTablePage, L as LunoraClient, type q as LunoraClientError, type r as LunoraClientOptions, type s as LunoraErrorCode, type t as MutationSettledEvent, type u as OptimisticLocalStore, type v as OptimisticUpdate, type w as OutboxMutation, type x as OutboxSink, type y as PersistedMutation, type P as Preloaded, type z as RowOp, type E as RpcEnvelope, type H as RpcResponseBody, type I as ScheduleRecord, type J as SchedulerPoolStatus, type K as SchedulerStatus, type N as ServerMessage, type T as ServerPokeEndMessage, type V as ServerPokePartMessage, type W as ServerPokeStartMessage, type X as ShardTrafficEntry, type Y as ShardTrafficResult, type Z as StorageListPage, type _ as StorageObject, type $ as StreamHandle, type a0 as StreamIterable, type a1 as SubscriptionCallback, type S as SubscriptionError, type b as SubscriptionErrorCallback, a2 as SubscriptionRegistry, type a3 as SubscriptionState, type a4 as SyncWatermark, type a as Unsubscribe, type U as User, type a5 as WorkflowInstanceAction, type a6 as WorkflowInstanceDetail, type a7 as WorkflowInstancePage, type a8 as WorkflowInstanceStatus, type a9 as WorkflowInstanceSummary, type aa as WorkflowStepDetail, ab as createLocalStore, ac as createStream, ad as getErrorCode, ae as getRetryAfterMs, af as isConflictError, ag as isForbiddenError, ah as isRateLimitedError, ai as isUnauthorizedError } from "./packem_shared/lunora-client.d-DPLSlPiP.mjs";
|
|
3
|
+
export { p as preloadQuery, a as preloadedQueryResult } from "./packem_shared/preload.d-Bpi7xweC.mjs";
|
|
4
4
|
export type { AuthCapabilities, AuthImpersonation, AuthPage, AuthSession, AuthUser, CronJobInfo, KvKeyEntry, KvKeyListResult, KvNamespaceSummary, KvValueResult, VectorIndexSummary, VectorQueryMatch } from '@lunora/runtime';
|
|
5
5
|
/**
|
|
6
6
|
* The slice of React Native's `AsyncStorage` (or any async key/value store —
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { c as PersistenceAdapter, B as BookmarkStorage, F as FunctionReference, A as ArgsOf, M as MutationCallOptions, R as ReturnOf, O as OfflineQueueOptions, Q as QueryCacheAdapter, d as ReconnectOptions } from "./packem_shared/lunora-client.d-
|
|
2
|
-
export { type e as BatchSlot, C as CONFLICT_ERROR_CODE, type f as CachedQuery, type g as ClientMessage, type h as ClientShapeSubscribeMessage, type i as ClientShapeUnsubscribeMessage, type j as ConnectionStatus, D as DEFAULT_MAX_BUFFER, type k as FunctionArgumentDescriptor, type l as FunctionDescriptor, type G as GlobalFacetResult, type m as GlobalFacetValue, type n as GlobalFilterClause, type o as GlobalTableInfo, type p as GlobalTablePage, L as LunoraClient, type q as LunoraClientError, type r as LunoraClientOptions, type s as LunoraErrorCode, type t as MutationSettledEvent, type u as OptimisticLocalStore, type v as OptimisticUpdate, type w as OutboxMutation, type x as OutboxSink, type y as PersistedMutation, type P as Preloaded, type z as RowOp, type E as RpcEnvelope, type H as RpcResponseBody, type I as ScheduleRecord, type J as SchedulerPoolStatus, type K as SchedulerStatus, type N as ServerMessage, type T as ServerPokeEndMessage, type V as ServerPokePartMessage, type W as ServerPokeStartMessage, type X as ShardTrafficEntry, type Y as ShardTrafficResult, type Z as StorageListPage, type _ as StorageObject, type $ as StreamHandle, type a0 as StreamIterable, type a1 as SubscriptionCallback, type S as SubscriptionError, type b as SubscriptionErrorCallback, a2 as SubscriptionRegistry, type a3 as SubscriptionState, type a4 as SyncWatermark, type a as Unsubscribe, type U as User, type a5 as WorkflowInstanceAction, type a6 as WorkflowInstanceDetail, type a7 as WorkflowInstancePage, type a8 as WorkflowInstanceStatus, type a9 as WorkflowInstanceSummary, type aa as WorkflowStepDetail, ab as createLocalStore, ac as createStream, ad as getErrorCode, ae as getRetryAfterMs, af as isConflictError, ag as isForbiddenError, ah as isRateLimitedError, ai as isUnauthorizedError } from "./packem_shared/lunora-client.d-
|
|
3
|
-
export { p as preloadQuery, a as preloadedQueryResult } from "./packem_shared/preload.d-
|
|
1
|
+
import { c as PersistenceAdapter, B as BookmarkStorage, F as FunctionReference, A as ArgsOf, M as MutationCallOptions, R as ReturnOf, O as OfflineQueueOptions, Q as QueryCacheAdapter, d as ReconnectOptions } from "./packem_shared/lunora-client.d-DPLSlPiP.js";
|
|
2
|
+
export { type e as BatchSlot, C as CONFLICT_ERROR_CODE, type f as CachedQuery, type g as ClientMessage, type h as ClientShapeSubscribeMessage, type i as ClientShapeUnsubscribeMessage, type j as ConnectionStatus, D as DEFAULT_MAX_BUFFER, type k as FunctionArgumentDescriptor, type l as FunctionDescriptor, type G as GlobalFacetResult, type m as GlobalFacetValue, type n as GlobalFilterClause, type o as GlobalTableInfo, type p as GlobalTablePage, L as LunoraClient, type q as LunoraClientError, type r as LunoraClientOptions, type s as LunoraErrorCode, type t as MutationSettledEvent, type u as OptimisticLocalStore, type v as OptimisticUpdate, type w as OutboxMutation, type x as OutboxSink, type y as PersistedMutation, type P as Preloaded, type z as RowOp, type E as RpcEnvelope, type H as RpcResponseBody, type I as ScheduleRecord, type J as SchedulerPoolStatus, type K as SchedulerStatus, type N as ServerMessage, type T as ServerPokeEndMessage, type V as ServerPokePartMessage, type W as ServerPokeStartMessage, type X as ShardTrafficEntry, type Y as ShardTrafficResult, type Z as StorageListPage, type _ as StorageObject, type $ as StreamHandle, type a0 as StreamIterable, type a1 as SubscriptionCallback, type S as SubscriptionError, type b as SubscriptionErrorCallback, a2 as SubscriptionRegistry, type a3 as SubscriptionState, type a4 as SyncWatermark, type a as Unsubscribe, type U as User, type a5 as WorkflowInstanceAction, type a6 as WorkflowInstanceDetail, type a7 as WorkflowInstancePage, type a8 as WorkflowInstanceStatus, type a9 as WorkflowInstanceSummary, type aa as WorkflowStepDetail, ab as createLocalStore, ac as createStream, ad as getErrorCode, ae as getRetryAfterMs, af as isConflictError, ag as isForbiddenError, ah as isRateLimitedError, ai as isUnauthorizedError } from "./packem_shared/lunora-client.d-DPLSlPiP.js";
|
|
3
|
+
export { p as preloadQuery, a as preloadedQueryResult } from "./packem_shared/preload.d-CmFdZFQi.js";
|
|
4
4
|
export type { AuthCapabilities, AuthImpersonation, AuthPage, AuthSession, AuthUser, CronJobInfo, KvKeyEntry, KvKeyListResult, KvNamespaceSummary, KvValueResult, VectorIndexSummary, VectorQueryMatch } from '@lunora/runtime';
|
|
5
5
|
/**
|
|
6
6
|
* The slice of React Native's `AsyncStorage` (or any async key/value store —
|
package/dist/index.mjs
CHANGED
|
@@ -3,13 +3,13 @@ export { default as createInMemoryBookmarkStorage } from './packem_shared/create
|
|
|
3
3
|
export { applyDelta, isMutationDelta } from './packem_shared/applyDelta-4jFGTPA3.mjs';
|
|
4
4
|
export { CONFLICT_ERROR_CODE, getErrorCode, getRetryAfterMs, isConflictError, isForbiddenError, isRateLimitedError, isUnauthorizedError } from './packem_shared/CONFLICT_ERROR_CODE-B8gQ8tyU.mjs';
|
|
5
5
|
export { c as createLocalStore } from './packem_shared/local-store-BNgN3Dw3.mjs';
|
|
6
|
-
export { LunoraClient } from './packem_shared/LunoraClient-
|
|
6
|
+
export { LunoraClient } from './packem_shared/LunoraClient-jOfAmV8f.mjs';
|
|
7
7
|
export { createMutationRunner } from './packem_shared/createMutationRunner-BqsavzvG.mjs';
|
|
8
8
|
export { createMutatorRunner } from './packem_shared/createMutatorRunner-BETvCd0p.mjs';
|
|
9
9
|
export { O as OfflineQueue } from './packem_shared/offline-queue-B9vfdSqp.mjs';
|
|
10
|
-
export { createInMemoryPersistence, createIndexedDbPersistence } from './packem_shared/createInMemoryPersistence-
|
|
10
|
+
export { createInMemoryPersistence, createIndexedDbPersistence } from './packem_shared/createInMemoryPersistence-Ds7z8n8d.mjs';
|
|
11
11
|
export { preloadQuery, preloadedQueryResult } from './packem_shared/preloadQuery-lobFkD2Z.mjs';
|
|
12
|
-
export { createInMemoryQueryCache, createIndexedDbQueryCache, queryCacheKey } from './packem_shared/createInMemoryQueryCache-
|
|
12
|
+
export { createInMemoryQueryCache, createIndexedDbQueryCache, queryCacheKey } from './packem_shared/createInMemoryQueryCache-iWtKPrid.mjs';
|
|
13
13
|
export { createReconnect } from './packem_shared/createReconnect-Di_-oHH7.mjs';
|
|
14
14
|
export { DEFAULT_MAX_BUFFER, createStream } from './packem_shared/DEFAULT_MAX_BUFFER-BDkqO5PW.mjs';
|
|
15
15
|
export { S as SubscriptionRegistry } from './packem_shared/subscription-DoyO04-2.mjs';
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { LunoraError } from '@lunora/errors';
|
|
1
2
|
import { S as SubscriptionRegistry, s as stableStringify } from './subscription-DoyO04-2.mjs';
|
|
2
3
|
import createInMemoryBookmarkStorage from './createInMemoryBookmarkStorage-BoN7a7TH.mjs';
|
|
3
4
|
import { isMutationDelta, applyDelta } from './applyDelta-4jFGTPA3.mjs';
|
|
4
5
|
import { a as applyOptimisticLayer, d as dropConfirmedLayers, n as notifySubscription, f as foldOptimistic, c as createLocalStore } from './local-store-BNgN3Dw3.mjs';
|
|
5
6
|
import { O as OfflineQueue, n as nextId, i as isStaleVersion, r as reportPersistenceError } from './offline-queue-B9vfdSqp.mjs';
|
|
6
|
-
import { resolvePersistenceAdapter } from './createInMemoryPersistence-
|
|
7
|
-
import { resolveQueryCacheAdapter, queryCacheKey } from './createInMemoryQueryCache-
|
|
7
|
+
import { resolvePersistenceAdapter } from './createInMemoryPersistence-Ds7z8n8d.mjs';
|
|
8
|
+
import { resolveQueryCacheAdapter, queryCacheKey } from './createInMemoryQueryCache-iWtKPrid.mjs';
|
|
8
9
|
import { createReconnect } from './createReconnect-Di_-oHH7.mjs';
|
|
9
10
|
import { createStream } from './DEFAULT_MAX_BUFFER-BDkqO5PW.mjs';
|
|
10
11
|
|
|
@@ -406,6 +407,12 @@ const reconstructError = (errorBody) => {
|
|
|
406
407
|
if (errorBody.data !== void 0) {
|
|
407
408
|
error.data = decodeWire(errorBody.data);
|
|
408
409
|
}
|
|
410
|
+
if (errorBody.hint !== void 0) {
|
|
411
|
+
error.hint = errorBody.hint;
|
|
412
|
+
}
|
|
413
|
+
if (errorBody.docsUrl !== void 0) {
|
|
414
|
+
error.docsUrl = errorBody.docsUrl;
|
|
415
|
+
}
|
|
409
416
|
return error;
|
|
410
417
|
};
|
|
411
418
|
const encodeCallArgs = (payload, label) => {
|
|
@@ -692,7 +699,7 @@ class LunoraClient {
|
|
|
692
699
|
async callMutator(functionPath, args, options) {
|
|
693
700
|
const clientSeq = options?.clientSeq;
|
|
694
701
|
if (clientSeq !== void 0 && (!Number.isInteger(clientSeq) || clientSeq <= 0)) {
|
|
695
|
-
throw new
|
|
702
|
+
throw new LunoraError("INTERNAL", `callMutator: clientSeq must be a positive integer, got ${String(clientSeq)}`);
|
|
696
703
|
}
|
|
697
704
|
const bucket = options?.shardKey ?? "";
|
|
698
705
|
let ackWatermark;
|
|
@@ -976,7 +983,7 @@ class LunoraClient {
|
|
|
976
983
|
// --- RPC ---------------------------------------------------------------
|
|
977
984
|
async query(function_, args, options = {}) {
|
|
978
985
|
if (this.closed) {
|
|
979
|
-
throw new
|
|
986
|
+
throw new LunoraError("INTERNAL", "LunoraClient is closed");
|
|
980
987
|
}
|
|
981
988
|
return await this.rpc(function_.__lunoraRef, args, options.shardKey, { attachBookmark: true });
|
|
982
989
|
}
|
|
@@ -996,10 +1003,10 @@ class LunoraClient {
|
|
|
996
1003
|
*/
|
|
997
1004
|
async batch(calls) {
|
|
998
1005
|
if (this.closed) {
|
|
999
|
-
throw new
|
|
1006
|
+
throw new LunoraError("INTERNAL", "LunoraClient is closed");
|
|
1000
1007
|
}
|
|
1001
1008
|
if (!this.fetchImpl) {
|
|
1002
|
-
throw new
|
|
1009
|
+
throw new LunoraError("INTERNAL", "LunoraClient: no `fetch` implementation available");
|
|
1003
1010
|
}
|
|
1004
1011
|
if (calls.length === 0) {
|
|
1005
1012
|
return [];
|
|
@@ -1026,13 +1033,13 @@ class LunoraClient {
|
|
|
1026
1033
|
try {
|
|
1027
1034
|
body = await response.json();
|
|
1028
1035
|
} catch {
|
|
1029
|
-
throw new
|
|
1036
|
+
throw new LunoraError("INTERNAL", `LunoraClient: batch response was not JSON (status ${response.status.toString()})`);
|
|
1030
1037
|
}
|
|
1031
1038
|
if (!response.ok || body.error && !body.results) {
|
|
1032
1039
|
if (body.error) {
|
|
1033
1040
|
throw reconstructError(body.error);
|
|
1034
1041
|
}
|
|
1035
|
-
throw new
|
|
1042
|
+
throw new LunoraError("INTERNAL", `LunoraClient: batch request failed (status ${response.status.toString()})`);
|
|
1036
1043
|
}
|
|
1037
1044
|
return demuxBatchResults(body.results ?? [], calls.length);
|
|
1038
1045
|
}
|
|
@@ -1048,7 +1055,7 @@ class LunoraClient {
|
|
|
1048
1055
|
*/
|
|
1049
1056
|
async mutation(function_, args, options = {}) {
|
|
1050
1057
|
if (this.closed) {
|
|
1051
|
-
throw new
|
|
1058
|
+
throw new LunoraError("INTERNAL", "LunoraClient is closed");
|
|
1052
1059
|
}
|
|
1053
1060
|
const argsRecord = args;
|
|
1054
1061
|
const mutationId = options.mutationId ?? nextId();
|
|
@@ -1092,7 +1099,7 @@ class LunoraClient {
|
|
|
1092
1099
|
}
|
|
1093
1100
|
async action(function_, args, options = {}) {
|
|
1094
1101
|
if (this.closed) {
|
|
1095
|
-
throw new
|
|
1102
|
+
throw new LunoraError("INTERNAL", "LunoraClient is closed");
|
|
1096
1103
|
}
|
|
1097
1104
|
return await this.rpc(function_.__lunoraRef, args, options.shardKey);
|
|
1098
1105
|
}
|
|
@@ -1109,7 +1116,7 @@ class LunoraClient {
|
|
|
1109
1116
|
*/
|
|
1110
1117
|
async shardTraffic(table) {
|
|
1111
1118
|
if (this.closed) {
|
|
1112
|
-
throw new
|
|
1119
|
+
throw new LunoraError("INTERNAL", "LunoraClient is closed");
|
|
1113
1120
|
}
|
|
1114
1121
|
const body = await this.adminFetch(SHARD_TRAFFIC_PATH, "POST", { table });
|
|
1115
1122
|
return { failed: body.failed ?? 0, ok: body.ok ?? 0, shards: body.shards ?? [] };
|
|
@@ -1124,7 +1131,7 @@ class LunoraClient {
|
|
|
1124
1131
|
*/
|
|
1125
1132
|
async listScheduledJobs() {
|
|
1126
1133
|
if (this.closed) {
|
|
1127
|
-
throw new
|
|
1134
|
+
throw new LunoraError("INTERNAL", "LunoraClient is closed");
|
|
1128
1135
|
}
|
|
1129
1136
|
const body = await this.adminFetch(SCHEDULED_PATH, "GET");
|
|
1130
1137
|
return body.records ?? [];
|
|
@@ -1140,7 +1147,7 @@ class LunoraClient {
|
|
|
1140
1147
|
*/
|
|
1141
1148
|
async schedulerStatus() {
|
|
1142
1149
|
if (this.closed) {
|
|
1143
|
-
throw new
|
|
1150
|
+
throw new LunoraError("INTERNAL", "LunoraClient is closed");
|
|
1144
1151
|
}
|
|
1145
1152
|
const body = await this.adminFetch(SCHEDULED_STATUS_PATH, "GET");
|
|
1146
1153
|
return {
|
|
@@ -1152,7 +1159,7 @@ class LunoraClient {
|
|
|
1152
1159
|
/** Cancel a pending scheduled job by id. Returns whether a job was removed. */
|
|
1153
1160
|
async cancelScheduledJob(id) {
|
|
1154
1161
|
if (this.closed) {
|
|
1155
|
-
throw new
|
|
1162
|
+
throw new LunoraError("INTERNAL", "LunoraClient is closed");
|
|
1156
1163
|
}
|
|
1157
1164
|
const body = await this.adminFetch(SCHEDULED_CANCEL_PATH, "POST", { id });
|
|
1158
1165
|
return { cancelled: body.cancelled === true };
|
|
@@ -1167,7 +1174,7 @@ class LunoraClient {
|
|
|
1167
1174
|
*/
|
|
1168
1175
|
async listDeadJobs() {
|
|
1169
1176
|
if (this.closed) {
|
|
1170
|
-
throw new
|
|
1177
|
+
throw new LunoraError("INTERNAL", "LunoraClient is closed");
|
|
1171
1178
|
}
|
|
1172
1179
|
const body = await this.adminFetch(SCHEDULED_DEAD_PATH, "GET");
|
|
1173
1180
|
return body.records ?? [];
|
|
@@ -1179,7 +1186,7 @@ class LunoraClient {
|
|
|
1179
1186
|
*/
|
|
1180
1187
|
async retryDeadJob(id) {
|
|
1181
1188
|
if (this.closed) {
|
|
1182
|
-
throw new
|
|
1189
|
+
throw new LunoraError("INTERNAL", "LunoraClient is closed");
|
|
1183
1190
|
}
|
|
1184
1191
|
const body = await this.adminFetch(SCHEDULED_DEAD_RETRY_PATH, "POST", { id });
|
|
1185
1192
|
return { retried: body.retried === true };
|
|
@@ -1191,7 +1198,7 @@ class LunoraClient {
|
|
|
1191
1198
|
*/
|
|
1192
1199
|
async removeDeadJob(id) {
|
|
1193
1200
|
if (this.closed) {
|
|
1194
|
-
throw new
|
|
1201
|
+
throw new LunoraError("INTERNAL", "LunoraClient is closed");
|
|
1195
1202
|
}
|
|
1196
1203
|
const body = await this.adminFetch(SCHEDULED_DEAD_CANCEL_PATH, "POST", { id });
|
|
1197
1204
|
return { removed: body.removed === true };
|
|
@@ -1209,7 +1216,7 @@ class LunoraClient {
|
|
|
1209
1216
|
*/
|
|
1210
1217
|
async listWorkflowInstances(options) {
|
|
1211
1218
|
if (this.closed) {
|
|
1212
|
-
throw new
|
|
1219
|
+
throw new LunoraError("INTERNAL", "LunoraClient is closed");
|
|
1213
1220
|
}
|
|
1214
1221
|
const query = new URLSearchParams({ name: options.name });
|
|
1215
1222
|
if (options.status !== void 0) {
|
|
@@ -1233,7 +1240,7 @@ class LunoraClient {
|
|
|
1233
1240
|
/** Read one workflow instance with its step timeline (`/_lunora/admin/workflows/instance`). */
|
|
1234
1241
|
async getWorkflowInstance(options) {
|
|
1235
1242
|
if (this.closed) {
|
|
1236
|
-
throw new
|
|
1243
|
+
throw new LunoraError("INTERNAL", "LunoraClient is closed");
|
|
1237
1244
|
}
|
|
1238
1245
|
const query = new URLSearchParams({ id: options.id, name: options.name });
|
|
1239
1246
|
const body = await this.adminFetch(`${WORKFLOWS_INSTANCE_PATH}?${query.toString()}`, "GET");
|
|
@@ -1252,7 +1259,7 @@ class LunoraClient {
|
|
|
1252
1259
|
/** Pause / resume / terminate a workflow instance (`/_lunora/admin/workflows/status`). Needs an Edit-scoped Cloudflare token. */
|
|
1253
1260
|
async setWorkflowInstanceStatus(options) {
|
|
1254
1261
|
if (this.closed) {
|
|
1255
|
-
throw new
|
|
1262
|
+
throw new LunoraError("INTERNAL", "LunoraClient is closed");
|
|
1256
1263
|
}
|
|
1257
1264
|
const body = await this.adminFetch(WORKFLOWS_STATUS_PATH, "POST", { action: options.action, id: options.id, name: options.name });
|
|
1258
1265
|
return { status: body.status ?? "unknown" };
|
|
@@ -1267,7 +1274,7 @@ class LunoraClient {
|
|
|
1267
1274
|
*/
|
|
1268
1275
|
subscribeScheduledJobs(onJobs) {
|
|
1269
1276
|
if (this.closed) {
|
|
1270
|
-
throw new
|
|
1277
|
+
throw new LunoraError("INTERNAL", "LunoraClient is closed");
|
|
1271
1278
|
}
|
|
1272
1279
|
if (this.WebSocketImpl === void 0) {
|
|
1273
1280
|
return () => void 0;
|
|
@@ -1323,7 +1330,7 @@ class LunoraClient {
|
|
|
1323
1330
|
*/
|
|
1324
1331
|
async listFunctions() {
|
|
1325
1332
|
if (this.closed) {
|
|
1326
|
-
throw new
|
|
1333
|
+
throw new LunoraError("INTERNAL", "LunoraClient is closed");
|
|
1327
1334
|
}
|
|
1328
1335
|
const body = await this.adminFetch(FUNCTIONS_PATH, "GET");
|
|
1329
1336
|
return body.functions ?? [];
|
|
@@ -1339,7 +1346,7 @@ class LunoraClient {
|
|
|
1339
1346
|
*/
|
|
1340
1347
|
async getCronJobs() {
|
|
1341
1348
|
if (this.closed) {
|
|
1342
|
-
throw new
|
|
1349
|
+
throw new LunoraError("INTERNAL", "LunoraClient is closed");
|
|
1343
1350
|
}
|
|
1344
1351
|
const body = await this.adminFetch(CRON_JOBS_PATH, "GET");
|
|
1345
1352
|
return body.jobs ?? [];
|
|
@@ -1355,7 +1362,7 @@ class LunoraClient {
|
|
|
1355
1362
|
*/
|
|
1356
1363
|
async runCronJob(name) {
|
|
1357
1364
|
if (this.closed) {
|
|
1358
|
-
throw new
|
|
1365
|
+
throw new LunoraError("INTERNAL", "LunoraClient is closed");
|
|
1359
1366
|
}
|
|
1360
1367
|
const body = await this.adminFetch(CRON_JOBS_RUN_PATH, "POST", { name });
|
|
1361
1368
|
return { name: body.name ?? name, ran: body.ran === true };
|
|
@@ -1370,7 +1377,7 @@ class LunoraClient {
|
|
|
1370
1377
|
*/
|
|
1371
1378
|
async fetchOpenApi() {
|
|
1372
1379
|
if (this.closed) {
|
|
1373
|
-
throw new
|
|
1380
|
+
throw new LunoraError("INTERNAL", "LunoraClient is closed");
|
|
1374
1381
|
}
|
|
1375
1382
|
return await this.adminFetch(OPENAPI_PATH, "GET");
|
|
1376
1383
|
}
|
|
@@ -1386,7 +1393,7 @@ class LunoraClient {
|
|
|
1386
1393
|
*/
|
|
1387
1394
|
async fetchOpenRpc() {
|
|
1388
1395
|
if (this.closed) {
|
|
1389
|
-
throw new
|
|
1396
|
+
throw new LunoraError("INTERNAL", "LunoraClient is closed");
|
|
1390
1397
|
}
|
|
1391
1398
|
return await this.adminFetch(OPENRPC_PATH, "GET");
|
|
1392
1399
|
}
|
|
@@ -1400,7 +1407,7 @@ class LunoraClient {
|
|
|
1400
1407
|
*/
|
|
1401
1408
|
async listStorageObjects(options = {}) {
|
|
1402
1409
|
if (this.closed) {
|
|
1403
|
-
throw new
|
|
1410
|
+
throw new LunoraError("INTERNAL", "LunoraClient is closed");
|
|
1404
1411
|
}
|
|
1405
1412
|
const params = new URLSearchParams();
|
|
1406
1413
|
if (options.prefix !== void 0 && options.prefix !== "") {
|
|
@@ -1428,7 +1435,7 @@ class LunoraClient {
|
|
|
1428
1435
|
*/
|
|
1429
1436
|
async deleteStorageObject(key, options) {
|
|
1430
1437
|
if (this.closed) {
|
|
1431
|
-
throw new
|
|
1438
|
+
throw new LunoraError("INTERNAL", "LunoraClient is closed");
|
|
1432
1439
|
}
|
|
1433
1440
|
const path = `${STORAGE_PATH}?key=${encodeURIComponent(key)}${bucketQuery(options?.bucket)}`;
|
|
1434
1441
|
const body = await this.adminFetch(path, "DELETE");
|
|
@@ -1442,7 +1449,7 @@ class LunoraClient {
|
|
|
1442
1449
|
*/
|
|
1443
1450
|
async listStorageBuckets() {
|
|
1444
1451
|
if (this.closed) {
|
|
1445
|
-
throw new
|
|
1452
|
+
throw new LunoraError("INTERNAL", "LunoraClient is closed");
|
|
1446
1453
|
}
|
|
1447
1454
|
const body = await this.adminFetch(STORAGE_BUCKETS_PATH, "GET");
|
|
1448
1455
|
return body.buckets ?? [];
|
|
@@ -1456,7 +1463,7 @@ class LunoraClient {
|
|
|
1456
1463
|
*/
|
|
1457
1464
|
async uploadStorageObject(options) {
|
|
1458
1465
|
if (this.closed) {
|
|
1459
|
-
throw new
|
|
1466
|
+
throw new LunoraError("INTERNAL", "LunoraClient is closed");
|
|
1460
1467
|
}
|
|
1461
1468
|
const path = `${STORAGE_PATH}?key=${encodeURIComponent(options.key)}${bucketQuery(options.bucket)}`;
|
|
1462
1469
|
const body = await this.adminFetch(path, "PUT", options.body, options.contentType);
|
|
@@ -1475,7 +1482,7 @@ class LunoraClient {
|
|
|
1475
1482
|
*/
|
|
1476
1483
|
async signedStorageUrl(key, options) {
|
|
1477
1484
|
if (this.closed) {
|
|
1478
|
-
throw new
|
|
1485
|
+
throw new LunoraError("INTERNAL", "LunoraClient is closed");
|
|
1479
1486
|
}
|
|
1480
1487
|
const expiresInSeconds = options?.expiresInSeconds;
|
|
1481
1488
|
const expiryQuery = expiresInSeconds === void 0 ? "" : `&expiresIn=${encodeURIComponent(expiresInSeconds.toString())}`;
|
|
@@ -1495,7 +1502,7 @@ class LunoraClient {
|
|
|
1495
1502
|
*/
|
|
1496
1503
|
async listGlobalTables() {
|
|
1497
1504
|
if (this.closed) {
|
|
1498
|
-
throw new
|
|
1505
|
+
throw new LunoraError("INTERNAL", "LunoraClient is closed");
|
|
1499
1506
|
}
|
|
1500
1507
|
return await this.adminFetch(GLOBAL_TABLES_PATH, "GET");
|
|
1501
1508
|
}
|
|
@@ -1507,7 +1514,7 @@ class LunoraClient {
|
|
|
1507
1514
|
*/
|
|
1508
1515
|
async readGlobalTablePage(options) {
|
|
1509
1516
|
if (this.closed) {
|
|
1510
|
-
throw new
|
|
1517
|
+
throw new LunoraError("INTERNAL", "LunoraClient is closed");
|
|
1511
1518
|
}
|
|
1512
1519
|
const params = new URLSearchParams({ table: options.table });
|
|
1513
1520
|
if (options.limit !== void 0) {
|
|
@@ -1530,7 +1537,7 @@ class LunoraClient {
|
|
|
1530
1537
|
*/
|
|
1531
1538
|
async facetGlobalColumn(options) {
|
|
1532
1539
|
if (this.closed) {
|
|
1533
|
-
throw new
|
|
1540
|
+
throw new LunoraError("INTERNAL", "LunoraClient is closed");
|
|
1534
1541
|
}
|
|
1535
1542
|
const params = new URLSearchParams({ column: options.column, table: options.table });
|
|
1536
1543
|
if (options.limit !== void 0) {
|
|
@@ -1553,7 +1560,7 @@ class LunoraClient {
|
|
|
1553
1560
|
*/
|
|
1554
1561
|
async listVectorIndexes() {
|
|
1555
1562
|
if (this.closed) {
|
|
1556
|
-
throw new
|
|
1563
|
+
throw new LunoraError("INTERNAL", "LunoraClient is closed");
|
|
1557
1564
|
}
|
|
1558
1565
|
const body = await this.adminFetch(VECTOR_INDEXES_PATH, "GET");
|
|
1559
1566
|
return body.indexes ?? [];
|
|
@@ -1567,7 +1574,7 @@ class LunoraClient {
|
|
|
1567
1574
|
*/
|
|
1568
1575
|
async queryVectorIndex(options) {
|
|
1569
1576
|
if (this.closed) {
|
|
1570
|
-
throw new
|
|
1577
|
+
throw new LunoraError("INTERNAL", "LunoraClient is closed");
|
|
1571
1578
|
}
|
|
1572
1579
|
const body = await this.adminFetch(VECTOR_QUERY_PATH, "POST", options);
|
|
1573
1580
|
return body.matches ?? [];
|
|
@@ -1581,7 +1588,7 @@ class LunoraClient {
|
|
|
1581
1588
|
*/
|
|
1582
1589
|
async listKvNamespaces() {
|
|
1583
1590
|
if (this.closed) {
|
|
1584
|
-
throw new
|
|
1591
|
+
throw new LunoraError("INTERNAL", "LunoraClient is closed");
|
|
1585
1592
|
}
|
|
1586
1593
|
const body = await this.adminFetch(KV_NAMESPACES_PATH, "GET");
|
|
1587
1594
|
return body.namespaces ?? [];
|
|
@@ -1593,7 +1600,7 @@ class LunoraClient {
|
|
|
1593
1600
|
*/
|
|
1594
1601
|
async listKvKeys(options) {
|
|
1595
1602
|
if (this.closed) {
|
|
1596
|
-
throw new
|
|
1603
|
+
throw new LunoraError("INTERNAL", "LunoraClient is closed");
|
|
1597
1604
|
}
|
|
1598
1605
|
const path = withQuery(KV_KEYS_PATH, {
|
|
1599
1606
|
cursor: options.cursor,
|
|
@@ -1610,7 +1617,7 @@ class LunoraClient {
|
|
|
1610
1617
|
*/
|
|
1611
1618
|
async getKvValue(options) {
|
|
1612
1619
|
if (this.closed) {
|
|
1613
|
-
throw new
|
|
1620
|
+
throw new LunoraError("INTERNAL", "LunoraClient is closed");
|
|
1614
1621
|
}
|
|
1615
1622
|
const path = withQuery(KV_VALUE_PATH, { key: options.key, namespace: options.namespace });
|
|
1616
1623
|
return await this.adminFetch(path, "GET");
|
|
@@ -1623,7 +1630,7 @@ class LunoraClient {
|
|
|
1623
1630
|
*/
|
|
1624
1631
|
async putKvValue(options) {
|
|
1625
1632
|
if (this.closed) {
|
|
1626
|
-
throw new
|
|
1633
|
+
throw new LunoraError("INTERNAL", "LunoraClient is closed");
|
|
1627
1634
|
}
|
|
1628
1635
|
await this.adminFetch(KV_VALUE_PATH, "PUT", options);
|
|
1629
1636
|
}
|
|
@@ -1633,7 +1640,7 @@ class LunoraClient {
|
|
|
1633
1640
|
*/
|
|
1634
1641
|
async deleteKvKey(options) {
|
|
1635
1642
|
if (this.closed) {
|
|
1636
|
-
throw new
|
|
1643
|
+
throw new LunoraError("INTERNAL", "LunoraClient is closed");
|
|
1637
1644
|
}
|
|
1638
1645
|
const path = withQuery(KV_VALUE_PATH, { key: options.key, namespace: options.namespace });
|
|
1639
1646
|
await this.adminFetch(path, "DELETE");
|
|
@@ -1647,7 +1654,7 @@ class LunoraClient {
|
|
|
1647
1654
|
*/
|
|
1648
1655
|
async listAuthUsers(options = {}) {
|
|
1649
1656
|
if (this.closed) {
|
|
1650
|
-
throw new
|
|
1657
|
+
throw new LunoraError("INTERNAL", "LunoraClient is closed");
|
|
1651
1658
|
}
|
|
1652
1659
|
const path = withQuery(AUTH_USERS_PATH, {
|
|
1653
1660
|
filterField: options.filterField,
|
|
@@ -1762,7 +1769,7 @@ class LunoraClient {
|
|
|
1762
1769
|
/** List auth sessions, paged and optionally filtered to one user. */
|
|
1763
1770
|
async listAuthSessions(options = {}) {
|
|
1764
1771
|
if (this.closed) {
|
|
1765
|
-
throw new
|
|
1772
|
+
throw new LunoraError("INTERNAL", "LunoraClient is closed");
|
|
1766
1773
|
}
|
|
1767
1774
|
const params = new URLSearchParams();
|
|
1768
1775
|
if (options.userId !== void 0 && options.userId !== "") {
|
|
@@ -1780,7 +1787,7 @@ class LunoraClient {
|
|
|
1780
1787
|
// --- Subscriptions ------------------------------------------------------
|
|
1781
1788
|
subscribe(function_, args, callback, options = {}) {
|
|
1782
1789
|
if (this.closed) {
|
|
1783
|
-
throw new
|
|
1790
|
+
throw new LunoraError("INTERNAL", "LunoraClient is closed");
|
|
1784
1791
|
}
|
|
1785
1792
|
const argsRecord = args ?? {};
|
|
1786
1793
|
const key = SubscriptionRegistry.key(function_.__lunoraRef, argsRecord, options.shardKey);
|
|
@@ -1858,7 +1865,7 @@ class LunoraClient {
|
|
|
1858
1865
|
*/
|
|
1859
1866
|
subscribeShape(shape, callback, options = {}) {
|
|
1860
1867
|
if (this.closed) {
|
|
1861
|
-
throw new
|
|
1868
|
+
throw new LunoraError("INTERNAL", "LunoraClient is closed");
|
|
1862
1869
|
}
|
|
1863
1870
|
this.nextShapeId += 1;
|
|
1864
1871
|
const id = `shape_${this.nextShapeId.toString()}`;
|
|
@@ -1904,10 +1911,10 @@ class LunoraClient {
|
|
|
1904
1911
|
*/
|
|
1905
1912
|
stream(function_, args, options = {}) {
|
|
1906
1913
|
if (this.closed) {
|
|
1907
|
-
throw new
|
|
1914
|
+
throw new LunoraError("INTERNAL", "LunoraClient is closed");
|
|
1908
1915
|
}
|
|
1909
1916
|
if (this.WebSocketImpl === void 0) {
|
|
1910
|
-
throw new
|
|
1917
|
+
throw new LunoraError("INTERNAL", "LunoraClient: streams require a WebSocket implementation");
|
|
1911
1918
|
}
|
|
1912
1919
|
this.nextStreamId += 1;
|
|
1913
1920
|
const id = `stream_${this.nextStreamId.toString()}`;
|
|
@@ -2357,7 +2364,7 @@ class LunoraClient {
|
|
|
2357
2364
|
}
|
|
2358
2365
|
async rpc(functionPath, args, shardKey, flags = {}) {
|
|
2359
2366
|
if (!this.fetchImpl) {
|
|
2360
|
-
throw new
|
|
2367
|
+
throw new LunoraError("INTERNAL", "LunoraClient: no `fetch` implementation available");
|
|
2361
2368
|
}
|
|
2362
2369
|
const headers = this.rpcRequestHeaders(flags);
|
|
2363
2370
|
const response = await this.fetchImpl(joinUrl(this.url, RPC_PATH), {
|
|
@@ -2379,14 +2386,14 @@ class LunoraClient {
|
|
|
2379
2386
|
body = await response.json();
|
|
2380
2387
|
} catch {
|
|
2381
2388
|
const statusText = response.statusText ? ` ${response.statusText}` : "";
|
|
2382
|
-
throw new
|
|
2389
|
+
throw new LunoraError("INTERNAL", `LunoraClient: response was not JSON (status ${response.status.toString()}${statusText})`);
|
|
2383
2390
|
}
|
|
2384
2391
|
if ("error" in body) {
|
|
2385
2392
|
throw reconstructError(body.error);
|
|
2386
2393
|
}
|
|
2387
2394
|
if (!response.ok) {
|
|
2388
2395
|
const statusText = response.statusText ? ` ${response.statusText}` : "";
|
|
2389
|
-
throw new
|
|
2396
|
+
throw new LunoraError("INTERNAL", `LunoraClient: request failed (status ${response.status.toString()}${statusText})`);
|
|
2390
2397
|
}
|
|
2391
2398
|
flags.onMutationAck?.(body.lastMutationId);
|
|
2392
2399
|
flags.onCommitCursor?.(body.commitCursor);
|
|
@@ -2400,7 +2407,7 @@ class LunoraClient {
|
|
|
2400
2407
|
*/
|
|
2401
2408
|
async adminFetch(path, method, payload, contentType) {
|
|
2402
2409
|
if (!this.fetchImpl) {
|
|
2403
|
-
throw new
|
|
2410
|
+
throw new LunoraError("INTERNAL", "LunoraClient: no `fetch` implementation available");
|
|
2404
2411
|
}
|
|
2405
2412
|
const headers = {};
|
|
2406
2413
|
if (this.authToken) {
|
|
@@ -2429,7 +2436,7 @@ class LunoraClient {
|
|
|
2429
2436
|
body = await response.json();
|
|
2430
2437
|
} catch {
|
|
2431
2438
|
const statusText = response.statusText ? ` ${response.statusText}` : "";
|
|
2432
|
-
throw new
|
|
2439
|
+
throw new LunoraError("INTERNAL", `LunoraClient: response was not JSON (status ${response.status.toString()}${statusText})`);
|
|
2433
2440
|
}
|
|
2434
2441
|
if (typeof body === "object" && body !== null && "error" in body) {
|
|
2435
2442
|
const envelope = body.error;
|
|
@@ -2439,7 +2446,7 @@ class LunoraClient {
|
|
|
2439
2446
|
}
|
|
2440
2447
|
if (!response.ok) {
|
|
2441
2448
|
const statusText = response.statusText ? ` ${response.statusText}` : "";
|
|
2442
|
-
throw new
|
|
2449
|
+
throw new LunoraError("INTERNAL", `LunoraClient: admin request failed (status ${response.status.toString()}${statusText})`);
|
|
2443
2450
|
}
|
|
2444
2451
|
return body;
|
|
2445
2452
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { LunoraError } from '@lunora/errors';
|
|
2
|
+
|
|
1
3
|
const createInMemoryPersistence = () => {
|
|
2
4
|
const entries = /* @__PURE__ */ new Map();
|
|
3
5
|
const clone = (mutation) => {
|
|
@@ -39,7 +41,7 @@ const promisifyRequest = (request) => new Promise((resolve, reject) => {
|
|
|
39
41
|
const createIndexedDbPersistence = (options = {}) => {
|
|
40
42
|
const factory = options.indexedDB ?? (typeof indexedDB === "undefined" ? void 0 : indexedDB);
|
|
41
43
|
if (!factory) {
|
|
42
|
-
throw new
|
|
44
|
+
throw new LunoraError("INTERNAL", "createIndexedDbPersistence: no IndexedDB available — pass `indexedDB` or use createInMemoryPersistence()");
|
|
43
45
|
}
|
|
44
46
|
const databaseName = options.databaseName ?? DEFAULT_DATABASE;
|
|
45
47
|
const storeName = options.storeName ?? DEFAULT_STORE;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { LunoraError } from '@lunora/errors';
|
|
2
|
+
|
|
1
3
|
const queryCacheKey = (functionPath, argsKey, shardKey) => `${functionPath}::${argsKey}::${shardKey ?? ""}`;
|
|
2
4
|
const DEFAULT_MAX_ENTRIES = 500;
|
|
3
5
|
const createInMemoryQueryCache = (options = {}) => {
|
|
@@ -50,7 +52,7 @@ const promisifyRequest = (request) => new Promise((resolve, reject) => {
|
|
|
50
52
|
const createIndexedDbQueryCache = (options = {}) => {
|
|
51
53
|
const factory = options.indexedDB ?? (typeof indexedDB === "undefined" ? void 0 : indexedDB);
|
|
52
54
|
if (!factory) {
|
|
53
|
-
throw new
|
|
55
|
+
throw new LunoraError("INTERNAL", "createIndexedDbQueryCache: no IndexedDB available — pass `indexedDB` or use createInMemoryQueryCache()");
|
|
54
56
|
}
|
|
55
57
|
const databaseName = options.databaseName ?? DEFAULT_DATABASE;
|
|
56
58
|
const storeName = options.storeName ?? DEFAULT_STORE;
|
package/dist/packem_shared/{lunora-client.d-CPMaTnsC.d.mts → lunora-client.d-DPLSlPiP.d.mts}
RENAMED
|
@@ -1207,10 +1207,20 @@ interface SyncWatermark {
|
|
|
1207
1207
|
checkpoint?: number;
|
|
1208
1208
|
mutationId?: number;
|
|
1209
1209
|
}
|
|
1210
|
-
/**
|
|
1210
|
+
/**
|
|
1211
|
+
* An `Error` carrying the server's machine-readable `code` and (for a
|
|
1212
|
+
* `LunoraError`) structured `data`, plus an optional actionable `hint` (Markdown)
|
|
1213
|
+
* and `docsUrl` resolved from the central error catalog. The client's public
|
|
1214
|
+
* error contract for RPC/batch failures — a UI can render `hint`/`docsUrl` to
|
|
1215
|
+
* tell the user how to fix the error. The `(string & {})` arm keeps
|
|
1216
|
+
* forward-compat/unknown server codes assignable without losing autocomplete on
|
|
1217
|
+
* the known {@link LunoraErrorCode} union.
|
|
1218
|
+
*/
|
|
1211
1219
|
type LunoraClientError = Error & {
|
|
1212
1220
|
code?: LunoraErrorCode | (string & {});
|
|
1213
1221
|
data?: unknown;
|
|
1222
|
+
docsUrl?: string;
|
|
1223
|
+
hint?: string | string[];
|
|
1214
1224
|
};
|
|
1215
1225
|
/** One demuxed result slot of a {@link LunoraClient.batch} call (plan 088). */
|
|
1216
1226
|
type BatchSlot = {
|
|
@@ -1207,10 +1207,20 @@ interface SyncWatermark {
|
|
|
1207
1207
|
checkpoint?: number;
|
|
1208
1208
|
mutationId?: number;
|
|
1209
1209
|
}
|
|
1210
|
-
/**
|
|
1210
|
+
/**
|
|
1211
|
+
* An `Error` carrying the server's machine-readable `code` and (for a
|
|
1212
|
+
* `LunoraError`) structured `data`, plus an optional actionable `hint` (Markdown)
|
|
1213
|
+
* and `docsUrl` resolved from the central error catalog. The client's public
|
|
1214
|
+
* error contract for RPC/batch failures — a UI can render `hint`/`docsUrl` to
|
|
1215
|
+
* tell the user how to fix the error. The `(string & {})` arm keeps
|
|
1216
|
+
* forward-compat/unknown server codes assignable without losing autocomplete on
|
|
1217
|
+
* the known {@link LunoraErrorCode} union.
|
|
1218
|
+
*/
|
|
1211
1219
|
type LunoraClientError = Error & {
|
|
1212
1220
|
code?: LunoraErrorCode | (string & {});
|
|
1213
1221
|
data?: unknown;
|
|
1222
|
+
docsUrl?: string;
|
|
1223
|
+
hint?: string | string[];
|
|
1214
1224
|
};
|
|
1215
1225
|
/** One demuxed result slot of a {@link LunoraClient.batch} call (plan 088). */
|
|
1216
1226
|
type BatchSlot = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { F as FunctionReference, L as LunoraClient, A as ArgsOf, R as ReturnOf, P as Preloaded } from "./lunora-client.d-
|
|
1
|
+
import { F as FunctionReference, L as LunoraClient, A as ArgsOf, R as ReturnOf, P as Preloaded } from "./lunora-client.d-DPLSlPiP.mjs";
|
|
2
2
|
/**
|
|
3
3
|
* Run a query once on the server (during SSR) and capture its result in a
|
|
4
4
|
* serializable {@link Preloaded} token. Embed the token in the rendered HTML and
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { F as FunctionReference, L as LunoraClient, A as ArgsOf, R as ReturnOf, P as Preloaded } from "./lunora-client.d-
|
|
1
|
+
import { F as FunctionReference, L as LunoraClient, A as ArgsOf, R as ReturnOf, P as Preloaded } from "./lunora-client.d-DPLSlPiP.js";
|
|
2
2
|
/**
|
|
3
3
|
* Run a query once on the server (during SSR) and capture its result in a
|
|
4
4
|
* serializable {@link Preloaded} token. Embed the token in the rendered HTML and
|
package/dist/query/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as SubscriptionError, F as FunctionReference, A as ArgsOf, R as ReturnOf, L as LunoraClient, a as Unsubscribe } from "../packem_shared/lunora-client.d-
|
|
2
|
-
export type { b as SubscriptionErrorCallback } from "../packem_shared/lunora-client.d-
|
|
1
|
+
import { S as SubscriptionError, F as FunctionReference, A as ArgsOf, R as ReturnOf, L as LunoraClient, a as Unsubscribe } from "../packem_shared/lunora-client.d-DPLSlPiP.mjs";
|
|
2
|
+
export type { b as SubscriptionErrorCallback } from "../packem_shared/lunora-client.d-DPLSlPiP.mjs";
|
|
3
3
|
import '@lunora/runtime';
|
|
4
4
|
/**
|
|
5
5
|
* The sentinel a framework adapter resolves its reactive args to when it wants
|
package/dist/query/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as SubscriptionError, F as FunctionReference, A as ArgsOf, R as ReturnOf, L as LunoraClient, a as Unsubscribe } from "../packem_shared/lunora-client.d-
|
|
2
|
-
export type { b as SubscriptionErrorCallback } from "../packem_shared/lunora-client.d-
|
|
1
|
+
import { S as SubscriptionError, F as FunctionReference, A as ArgsOf, R as ReturnOf, L as LunoraClient, a as Unsubscribe } from "../packem_shared/lunora-client.d-DPLSlPiP.js";
|
|
2
|
+
export type { b as SubscriptionErrorCallback } from "../packem_shared/lunora-client.d-DPLSlPiP.js";
|
|
3
3
|
import '@lunora/runtime';
|
|
4
4
|
/**
|
|
5
5
|
* The sentinel a framework adapter resolves its reactive args to when it wants
|
package/dist/ssr/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { P as Preloaded, L as LunoraClient } from "../packem_shared/lunora-client.d-
|
|
2
|
-
export type { A as ArgsOf, F as FunctionReference, R as ReturnOf } from "../packem_shared/lunora-client.d-
|
|
3
|
-
export { p as preloadQuery, a as preloadedQueryResult } from "../packem_shared/preload.d-
|
|
1
|
+
import { P as Preloaded, L as LunoraClient } from "../packem_shared/lunora-client.d-DPLSlPiP.mjs";
|
|
2
|
+
export type { A as ArgsOf, F as FunctionReference, R as ReturnOf } from "../packem_shared/lunora-client.d-DPLSlPiP.mjs";
|
|
3
|
+
export { p as preloadQuery, a as preloadedQueryResult } from "../packem_shared/preload.d-Bpi7xweC.mjs";
|
|
4
4
|
import '@lunora/runtime';
|
|
5
5
|
/**
|
|
6
6
|
* Structural shape of a better-auth `getSession` call's resolved value.
|
package/dist/ssr/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { P as Preloaded, L as LunoraClient } from "../packem_shared/lunora-client.d-
|
|
2
|
-
export type { A as ArgsOf, F as FunctionReference, R as ReturnOf } from "../packem_shared/lunora-client.d-
|
|
3
|
-
export { p as preloadQuery, a as preloadedQueryResult } from "../packem_shared/preload.d-
|
|
1
|
+
import { P as Preloaded, L as LunoraClient } from "../packem_shared/lunora-client.d-DPLSlPiP.js";
|
|
2
|
+
export type { A as ArgsOf, F as FunctionReference, R as ReturnOf } from "../packem_shared/lunora-client.d-DPLSlPiP.js";
|
|
3
|
+
export { p as preloadQuery, a as preloadedQueryResult } from "../packem_shared/preload.d-CmFdZFQi.js";
|
|
4
4
|
import '@lunora/runtime';
|
|
5
5
|
/**
|
|
6
6
|
* Structural shape of a better-auth `getSession` call's resolved value.
|
package/dist/ssr/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { getServerSession } from '../packem_shared/getServerSession-8jXewqxd.mjs';
|
|
2
2
|
export { deserializePreloaded, serializePreloaded } from '../packem_shared/deserializePreloaded-C0eJTY_W.mjs';
|
|
3
|
-
export { createServerClient } from '../packem_shared/createServerClient-
|
|
3
|
+
export { createServerClient } from '../packem_shared/createServerClient-Blht8tLm.mjs';
|
|
4
4
|
export { preloadQuery, preloadedQueryResult } from '../packem_shared/preloadQuery-lobFkD2Z.mjs';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lunora/client",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.17",
|
|
4
4
|
"description": "Lunora browser SDK: WebSocket transport, optimistic updates, and an offline mutation queue",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare",
|
|
@@ -61,6 +61,9 @@
|
|
|
61
61
|
"publishConfig": {
|
|
62
62
|
"access": "public"
|
|
63
63
|
},
|
|
64
|
+
"dependencies": {
|
|
65
|
+
"@lunora/errors": "1.0.0-alpha.1"
|
|
66
|
+
},
|
|
64
67
|
"engines": {
|
|
65
68
|
"node": "^22.15.0 || >=24.11.0"
|
|
66
69
|
}
|