@lunora/client 1.0.0-alpha.15 → 1.0.0-alpha.16
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 +4 -15
- package/dist/index.d.ts +4 -15
- package/dist/index.mjs +2 -2
- package/dist/packem_shared/CONFLICT_ERROR_CODE-B8gQ8tyU.mjs +33 -0
- package/dist/packem_shared/{LunoraClient-ClBd8JUG.mjs → LunoraClient-Zb_AVP5H.mjs} +8 -1
- package/dist/packem_shared/{createServerClient-BUEYFHjp.mjs → createServerClient-CFrM8ZQO.mjs} +1 -1
- package/dist/packem_shared/{lunora-client.d-CtSRWJJ7.d.ts → lunora-client.d-CPMaTnsC.d.mts} +58 -3
- package/dist/packem_shared/{lunora-client.d-CtSRWJJ7.d.mts → lunora-client.d-CPMaTnsC.d.ts} +58 -3
- package/dist/packem_shared/{preload.d-GjXaOwY9.d.mts → preload.d-Bl3z1rPo.d.mts} +1 -1
- package/dist/packem_shared/{preload.d-NMFbch9j.d.ts → preload.d-DH0CqSxy.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 +1 -1
- package/dist/packem_shared/CONFLICT_ERROR_CODE-aUdVbEDw.mjs +0 -4
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-CPMaTnsC.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-CPMaTnsC.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, type
|
|
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-CPMaTnsC.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-CPMaTnsC.mjs";
|
|
3
|
+
export { p as preloadQuery, a as preloadedQueryResult } from "./packem_shared/preload.d-Bl3z1rPo.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 —
|
|
@@ -95,17 +95,6 @@ declare const isMutationDelta: (value: unknown) => value is MutationDelta;
|
|
|
95
95
|
* when an `insert`/`update` delta carries no `row` to splice in.
|
|
96
96
|
*/
|
|
97
97
|
declare const applyDelta: (current: unknown, delta: MutationDelta) => undefined | unknown[];
|
|
98
|
-
/** Error code the server uses for optimistic-concurrency conflicts (HTTP 409). */
|
|
99
|
-
declare const CONFLICT_ERROR_CODE = "CONFLICT";
|
|
100
|
-
/**
|
|
101
|
-
* Whether an unknown rejection is an optimistic-concurrency conflict — the
|
|
102
|
-
* server lost a write race and the caller should refetch and retry (or surface
|
|
103
|
-
* the conflict). Structural check on the `code` property the client attaches
|
|
104
|
-
* when decoding the worker's `{ error: { code, message } }` envelope.
|
|
105
|
-
*/
|
|
106
|
-
declare const isConflictError: (error: unknown) => error is Error & {
|
|
107
|
-
code: "CONFLICT";
|
|
108
|
-
};
|
|
109
98
|
/** The single transport method a mutation runner needs — narrowed so adapters can test against a stub. */
|
|
110
99
|
interface MutationCapableClient<F extends FunctionReference> {
|
|
111
100
|
mutation: (function_: F, args: ArgsOf<F>, options?: MutationCallOptions<unknown, unknown, ArgsOf<F>>) => Promise<ReturnOf<F>>;
|
|
@@ -409,4 +398,4 @@ interface ReconnectCalculator {
|
|
|
409
398
|
reset: () => void;
|
|
410
399
|
}
|
|
411
400
|
declare const createReconnect: (options?: ReconnectOptions, random?: () => number) => ReconnectCalculator;
|
|
412
|
-
export { type ArgsOf, type AsyncStorageLike, type AsyncStoragePersistenceOptions, type BookmarkStorage,
|
|
401
|
+
export { type ArgsOf, type AsyncStorageLike, type AsyncStoragePersistenceOptions, type BookmarkStorage, type FunctionReference, type IndexedDbPersistenceOptions, type IndexedDbQueryCacheOptions, type MutationCallOptions, type MutationDelta, type MutationRunnerSinks, type MutatorHandle, type MutatorRunnerSinks, type MutatorTransaction, OfflineQueue, type OfflineQueueOptions, type PersistenceAdapter, type QueryCacheAdapter, type QueuedMutation, type ReconnectCalculator, type ReconnectOptions, type ReturnOf, applyDelta, createAsyncStoragePersistence, createInMemoryBookmarkStorage, createInMemoryPersistence, createInMemoryQueryCache, createIndexedDbPersistence, createIndexedDbQueryCache, createMutationRunner, createMutatorRunner, createReconnect, isMutationDelta, queryCacheKey };
|
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, type
|
|
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-CPMaTnsC.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-CPMaTnsC.js";
|
|
3
|
+
export { p as preloadQuery, a as preloadedQueryResult } from "./packem_shared/preload.d-DH0CqSxy.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 —
|
|
@@ -95,17 +95,6 @@ declare const isMutationDelta: (value: unknown) => value is MutationDelta;
|
|
|
95
95
|
* when an `insert`/`update` delta carries no `row` to splice in.
|
|
96
96
|
*/
|
|
97
97
|
declare const applyDelta: (current: unknown, delta: MutationDelta) => undefined | unknown[];
|
|
98
|
-
/** Error code the server uses for optimistic-concurrency conflicts (HTTP 409). */
|
|
99
|
-
declare const CONFLICT_ERROR_CODE = "CONFLICT";
|
|
100
|
-
/**
|
|
101
|
-
* Whether an unknown rejection is an optimistic-concurrency conflict — the
|
|
102
|
-
* server lost a write race and the caller should refetch and retry (or surface
|
|
103
|
-
* the conflict). Structural check on the `code` property the client attaches
|
|
104
|
-
* when decoding the worker's `{ error: { code, message } }` envelope.
|
|
105
|
-
*/
|
|
106
|
-
declare const isConflictError: (error: unknown) => error is Error & {
|
|
107
|
-
code: "CONFLICT";
|
|
108
|
-
};
|
|
109
98
|
/** The single transport method a mutation runner needs — narrowed so adapters can test against a stub. */
|
|
110
99
|
interface MutationCapableClient<F extends FunctionReference> {
|
|
111
100
|
mutation: (function_: F, args: ArgsOf<F>, options?: MutationCallOptions<unknown, unknown, ArgsOf<F>>) => Promise<ReturnOf<F>>;
|
|
@@ -409,4 +398,4 @@ interface ReconnectCalculator {
|
|
|
409
398
|
reset: () => void;
|
|
410
399
|
}
|
|
411
400
|
declare const createReconnect: (options?: ReconnectOptions, random?: () => number) => ReconnectCalculator;
|
|
412
|
-
export { type ArgsOf, type AsyncStorageLike, type AsyncStoragePersistenceOptions, type BookmarkStorage,
|
|
401
|
+
export { type ArgsOf, type AsyncStorageLike, type AsyncStoragePersistenceOptions, type BookmarkStorage, type FunctionReference, type IndexedDbPersistenceOptions, type IndexedDbQueryCacheOptions, type MutationCallOptions, type MutationDelta, type MutationRunnerSinks, type MutatorHandle, type MutatorRunnerSinks, type MutatorTransaction, OfflineQueue, type OfflineQueueOptions, type PersistenceAdapter, type QueryCacheAdapter, type QueuedMutation, type ReconnectCalculator, type ReconnectOptions, type ReturnOf, applyDelta, createAsyncStoragePersistence, createInMemoryBookmarkStorage, createInMemoryPersistence, createInMemoryQueryCache, createIndexedDbPersistence, createIndexedDbQueryCache, createMutationRunner, createMutatorRunner, createReconnect, isMutationDelta, queryCacheKey };
|
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export { createAsyncStoragePersistence } from './packem_shared/createAsyncStoragePersistence-1Z5BZ8RC.mjs';
|
|
2
2
|
export { default as createInMemoryBookmarkStorage } from './packem_shared/createInMemoryBookmarkStorage-BoN7a7TH.mjs';
|
|
3
3
|
export { applyDelta, isMutationDelta } from './packem_shared/applyDelta-4jFGTPA3.mjs';
|
|
4
|
-
export { CONFLICT_ERROR_CODE, isConflictError } from './packem_shared/CONFLICT_ERROR_CODE-
|
|
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-Zb_AVP5H.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';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
const LUNORA_ERROR_CODES = [
|
|
2
|
+
"BAD_REQUEST",
|
|
3
|
+
"CONFLICT",
|
|
4
|
+
"COUNT_RLS_UNSUPPORTED",
|
|
5
|
+
"FORBIDDEN",
|
|
6
|
+
"INTERNAL_SERVER_ERROR",
|
|
7
|
+
"MASK_UNSUPPORTED",
|
|
8
|
+
"NOT_FOUND",
|
|
9
|
+
"NOT_IMPLEMENTED",
|
|
10
|
+
"RELATION_PREDICATE_UNSUPPORTED",
|
|
11
|
+
"TOO_MANY_REQUESTS",
|
|
12
|
+
"UNAUTHORIZED",
|
|
13
|
+
"UNPROCESSABLE"
|
|
14
|
+
];
|
|
15
|
+
const KNOWN_ERROR_CODES = new Set(LUNORA_ERROR_CODES);
|
|
16
|
+
const CONFLICT_ERROR_CODE = "CONFLICT";
|
|
17
|
+
const isConflictError = (error) => error instanceof Error && error.code === CONFLICT_ERROR_CODE;
|
|
18
|
+
const isForbiddenError = (error) => error instanceof Error && error.code === "FORBIDDEN";
|
|
19
|
+
const isUnauthorizedError = (error) => error instanceof Error && error.code === "UNAUTHORIZED";
|
|
20
|
+
const isRateLimitedError = (error) => error instanceof Error && error.code === "TOO_MANY_REQUESTS";
|
|
21
|
+
const getErrorCode = (error) => {
|
|
22
|
+
if (!(error instanceof Error)) {
|
|
23
|
+
return void 0;
|
|
24
|
+
}
|
|
25
|
+
const { code } = error;
|
|
26
|
+
return typeof code === "string" && KNOWN_ERROR_CODES.has(code) ? code : void 0;
|
|
27
|
+
};
|
|
28
|
+
const getRetryAfterMs = (error) => {
|
|
29
|
+
const value = error?.data?.retryAfterMs;
|
|
30
|
+
return typeof value === "number" && Number.isFinite(value) ? value : void 0;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export { CONFLICT_ERROR_CODE, getErrorCode, getRetryAfterMs, isConflictError, isForbiddenError, isRateLimitedError, isUnauthorizedError };
|
|
@@ -182,7 +182,14 @@ const decodeWire = (value, depth = 0) => {
|
|
|
182
182
|
if (error.name !== name) {
|
|
183
183
|
Object.defineProperty(error, "name", { configurable: true, value: name, writable: true });
|
|
184
184
|
}
|
|
185
|
-
|
|
185
|
+
const props = decodeWire(value[4], depth + 1);
|
|
186
|
+
for (const key of Object.keys(props)) {
|
|
187
|
+
if (key === UNSAFE_KEY) {
|
|
188
|
+
Object.defineProperty(error, key, { configurable: true, enumerable: true, value: props[key], writable: true });
|
|
189
|
+
} else {
|
|
190
|
+
error[key] = props[key];
|
|
191
|
+
}
|
|
192
|
+
}
|
|
186
193
|
if (value.length > 5) {
|
|
187
194
|
Object.defineProperty(error, "cause", { configurable: true, value: decodeWire(value[5], depth + 1), writable: true });
|
|
188
195
|
}
|
|
@@ -1,4 +1,59 @@
|
|
|
1
1
|
import { CronJobInfo, VectorIndexSummary, VectorQueryMatch, KvNamespaceSummary, KvKeyListResult, KvValueResult, AuthUser, AuthPage, AuthImpersonation, AuthCapabilities, AuthSession } from '@lunora/runtime';
|
|
2
|
+
/**
|
|
3
|
+
* The machine-readable error codes a client can observe on a failed
|
|
4
|
+
* RPC/batch/subscription. Mirrors the server's `CODE_STATUS` keys
|
|
5
|
+
* (`@lunora/server`'s `error.ts`) by hand — the client is framework-neutral and
|
|
6
|
+
* must never import the server package (wrong dependency direction / would pull
|
|
7
|
+
* the server into the browser bundle). Keep this list in sync when a server code
|
|
8
|
+
* is added or removed (see the drift-guard note in the plan/maintenance docs).
|
|
9
|
+
*/
|
|
10
|
+
declare const LUNORA_ERROR_CODES: readonly ["BAD_REQUEST", "CONFLICT", "COUNT_RLS_UNSUPPORTED", "FORBIDDEN", "INTERNAL_SERVER_ERROR", "MASK_UNSUPPORTED", "NOT_FOUND", "NOT_IMPLEMENTED", "RELATION_PREDICATE_UNSUPPORTED", "TOO_MANY_REQUESTS", "UNAUTHORIZED", "UNPROCESSABLE"];
|
|
11
|
+
/** A machine-readable error `code` the client may observe. Mirror of the server's `LunoraErrorCode`. */
|
|
12
|
+
type LunoraErrorCode = (typeof LUNORA_ERROR_CODES)[number];
|
|
13
|
+
/** Error code the server uses for optimistic-concurrency conflicts (HTTP 409). */
|
|
14
|
+
declare const CONFLICT_ERROR_CODE = "CONFLICT";
|
|
15
|
+
/**
|
|
16
|
+
* Whether an unknown rejection is an optimistic-concurrency conflict — the
|
|
17
|
+
* server lost a write race and the caller should refetch and retry (or surface
|
|
18
|
+
* the conflict). Structural check on the `code` property the client attaches
|
|
19
|
+
* when decoding the worker's `{ error: { code, message } }` envelope.
|
|
20
|
+
*/
|
|
21
|
+
declare const isConflictError: (error: unknown) => error is Error & {
|
|
22
|
+
code: "CONFLICT";
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Whether a rejection is an RLS/policy denial (`FORBIDDEN`, HTTP 403) — the
|
|
26
|
+
* caller is authenticated but not permitted to read/write the row. The most
|
|
27
|
+
* common per-call error a UI must handle in an RLS-first app.
|
|
28
|
+
*/
|
|
29
|
+
declare const isForbiddenError: (error: unknown) => error is Error & {
|
|
30
|
+
code: "FORBIDDEN";
|
|
31
|
+
};
|
|
32
|
+
/** Whether a rejection is an authentication failure (`UNAUTHORIZED`, HTTP 401) — no/invalid identity. */
|
|
33
|
+
declare const isUnauthorizedError: (error: unknown) => error is Error & {
|
|
34
|
+
code: "UNAUTHORIZED";
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Whether a rejection is a rate-limit denial (`TOO_MANY_REQUESTS`, HTTP 429).
|
|
38
|
+
* The retry hint (if the server sent one) is read with {@link getRetryAfterMs}.
|
|
39
|
+
*/
|
|
40
|
+
declare const isRateLimitedError: (error: unknown) => error is Error & {
|
|
41
|
+
code: "TOO_MANY_REQUESTS";
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Read the server's machine-readable `code` off a rejection, narrowed to the
|
|
45
|
+
* known {@link LunoraErrorCode} union. Returns `undefined` for a non-`Error`, a
|
|
46
|
+
* missing code, or an unrecognized code string (forward-compat server codes read
|
|
47
|
+
* as `undefined` here rather than being falsely narrowed).
|
|
48
|
+
*/
|
|
49
|
+
declare const getErrorCode: (error: unknown) => LunoraErrorCode | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* Read the rate-limit retry hint (`data.retryAfterMs`) off a
|
|
52
|
+
* `TOO_MANY_REQUESTS` rejection without hand-casting the `unknown` `data`
|
|
53
|
+
* payload. Returns the finite millisecond value the server sent, or `undefined`
|
|
54
|
+
* when absent/non-numeric. Pair with {@link isRateLimitedError}.
|
|
55
|
+
*/
|
|
56
|
+
declare const getRetryAfterMs: (error: unknown) => number | undefined;
|
|
2
57
|
/** The registered function kinds a {@link FunctionReference} can describe. `stream` is a query that yields multiple frames over the WS. */
|
|
3
58
|
type FunctionKind = "action" | "mutation" | "query" | "stream";
|
|
4
59
|
/**
|
|
@@ -1152,9 +1207,9 @@ interface SyncWatermark {
|
|
|
1152
1207
|
checkpoint?: number;
|
|
1153
1208
|
mutationId?: number;
|
|
1154
1209
|
}
|
|
1155
|
-
/** An `Error` carrying the server's machine-readable `code` and (for a `LunoraError`) structured `data`. The client's public error contract for RPC/batch failures. */
|
|
1210
|
+
/** An `Error` carrying the server's machine-readable `code` and (for a `LunoraError`) structured `data`. The client's public error contract for RPC/batch failures. The `(string & {})` arm keeps forward-compat/unknown server codes assignable without losing autocomplete on the known {@link LunoraErrorCode} union. */
|
|
1156
1211
|
type LunoraClientError = Error & {
|
|
1157
|
-
code?: string;
|
|
1212
|
+
code?: LunoraErrorCode | (string & {});
|
|
1158
1213
|
data?: unknown;
|
|
1159
1214
|
};
|
|
1160
1215
|
/** One demuxed result slot of a {@link LunoraClient.batch} call (plan 088). */
|
|
@@ -2357,4 +2412,4 @@ declare class LunoraClient {
|
|
|
2357
2412
|
*/
|
|
2358
2413
|
private settleReplayBatchSlots;
|
|
2359
2414
|
}
|
|
2360
|
-
export {
|
|
2415
|
+
export { StreamHandle as $, ArgsOf as A, BookmarkStorage as B, CONFLICT_ERROR_CODE as C, DEFAULT_MAX_BUFFER as D, RpcEnvelope as E, FunctionReference as F, GlobalFacetResult as G, RpcResponseBody as H, ScheduleRecord as I, SchedulerPoolStatus as J, SchedulerStatus as K, LunoraClient as L, MutationCallOptions as M, ServerMessage as N, OfflineQueueOptions as O, Preloaded as P, QueryCacheAdapter as Q, ReturnOf as R, SubscriptionError as S, ServerPokeEndMessage as T, User as U, ServerPokePartMessage as V, ServerPokeStartMessage as W, ShardTrafficEntry as X, ShardTrafficResult as Y, StorageListPage as Z, StorageObject as _, Unsubscribe as a, StreamIterable as a0, SubscriptionCallback as a1, SubscriptionRegistry as a2, SubscriptionState as a3, SyncWatermark as a4, WorkflowInstanceAction as a5, WorkflowInstanceDetail as a6, WorkflowInstancePage as a7, WorkflowInstanceStatus as a8, WorkflowInstanceSummary as a9, WorkflowStepDetail as aa, createLocalStore as ab, createStream as ac, getErrorCode as ad, getRetryAfterMs as ae, isConflictError as af, isForbiddenError as ag, isRateLimitedError as ah, isUnauthorizedError as ai, SubscriptionErrorCallback as b, PersistenceAdapter as c, ReconnectOptions as d, BatchSlot as e, CachedQuery as f, ClientMessage as g, ClientShapeSubscribeMessage as h, ClientShapeUnsubscribeMessage as i, ConnectionStatus as j, FunctionArgumentDescriptor as k, FunctionDescriptor as l, GlobalFacetValue as m, GlobalFilterClause as n, GlobalTableInfo as o, GlobalTablePage as p, LunoraClientError as q, LunoraClientOptions as r, LunoraErrorCode as s, MutationSettledEvent as t, OptimisticLocalStore as u, OptimisticUpdate as v, OutboxMutation as w, OutboxSink as x, PersistedMutation as y, RowOp as z };
|
|
@@ -1,4 +1,59 @@
|
|
|
1
1
|
import { CronJobInfo, VectorIndexSummary, VectorQueryMatch, KvNamespaceSummary, KvKeyListResult, KvValueResult, AuthUser, AuthPage, AuthImpersonation, AuthCapabilities, AuthSession } from '@lunora/runtime';
|
|
2
|
+
/**
|
|
3
|
+
* The machine-readable error codes a client can observe on a failed
|
|
4
|
+
* RPC/batch/subscription. Mirrors the server's `CODE_STATUS` keys
|
|
5
|
+
* (`@lunora/server`'s `error.ts`) by hand — the client is framework-neutral and
|
|
6
|
+
* must never import the server package (wrong dependency direction / would pull
|
|
7
|
+
* the server into the browser bundle). Keep this list in sync when a server code
|
|
8
|
+
* is added or removed (see the drift-guard note in the plan/maintenance docs).
|
|
9
|
+
*/
|
|
10
|
+
declare const LUNORA_ERROR_CODES: readonly ["BAD_REQUEST", "CONFLICT", "COUNT_RLS_UNSUPPORTED", "FORBIDDEN", "INTERNAL_SERVER_ERROR", "MASK_UNSUPPORTED", "NOT_FOUND", "NOT_IMPLEMENTED", "RELATION_PREDICATE_UNSUPPORTED", "TOO_MANY_REQUESTS", "UNAUTHORIZED", "UNPROCESSABLE"];
|
|
11
|
+
/** A machine-readable error `code` the client may observe. Mirror of the server's `LunoraErrorCode`. */
|
|
12
|
+
type LunoraErrorCode = (typeof LUNORA_ERROR_CODES)[number];
|
|
13
|
+
/** Error code the server uses for optimistic-concurrency conflicts (HTTP 409). */
|
|
14
|
+
declare const CONFLICT_ERROR_CODE = "CONFLICT";
|
|
15
|
+
/**
|
|
16
|
+
* Whether an unknown rejection is an optimistic-concurrency conflict — the
|
|
17
|
+
* server lost a write race and the caller should refetch and retry (or surface
|
|
18
|
+
* the conflict). Structural check on the `code` property the client attaches
|
|
19
|
+
* when decoding the worker's `{ error: { code, message } }` envelope.
|
|
20
|
+
*/
|
|
21
|
+
declare const isConflictError: (error: unknown) => error is Error & {
|
|
22
|
+
code: "CONFLICT";
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Whether a rejection is an RLS/policy denial (`FORBIDDEN`, HTTP 403) — the
|
|
26
|
+
* caller is authenticated but not permitted to read/write the row. The most
|
|
27
|
+
* common per-call error a UI must handle in an RLS-first app.
|
|
28
|
+
*/
|
|
29
|
+
declare const isForbiddenError: (error: unknown) => error is Error & {
|
|
30
|
+
code: "FORBIDDEN";
|
|
31
|
+
};
|
|
32
|
+
/** Whether a rejection is an authentication failure (`UNAUTHORIZED`, HTTP 401) — no/invalid identity. */
|
|
33
|
+
declare const isUnauthorizedError: (error: unknown) => error is Error & {
|
|
34
|
+
code: "UNAUTHORIZED";
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Whether a rejection is a rate-limit denial (`TOO_MANY_REQUESTS`, HTTP 429).
|
|
38
|
+
* The retry hint (if the server sent one) is read with {@link getRetryAfterMs}.
|
|
39
|
+
*/
|
|
40
|
+
declare const isRateLimitedError: (error: unknown) => error is Error & {
|
|
41
|
+
code: "TOO_MANY_REQUESTS";
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Read the server's machine-readable `code` off a rejection, narrowed to the
|
|
45
|
+
* known {@link LunoraErrorCode} union. Returns `undefined` for a non-`Error`, a
|
|
46
|
+
* missing code, or an unrecognized code string (forward-compat server codes read
|
|
47
|
+
* as `undefined` here rather than being falsely narrowed).
|
|
48
|
+
*/
|
|
49
|
+
declare const getErrorCode: (error: unknown) => LunoraErrorCode | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* Read the rate-limit retry hint (`data.retryAfterMs`) off a
|
|
52
|
+
* `TOO_MANY_REQUESTS` rejection without hand-casting the `unknown` `data`
|
|
53
|
+
* payload. Returns the finite millisecond value the server sent, or `undefined`
|
|
54
|
+
* when absent/non-numeric. Pair with {@link isRateLimitedError}.
|
|
55
|
+
*/
|
|
56
|
+
declare const getRetryAfterMs: (error: unknown) => number | undefined;
|
|
2
57
|
/** The registered function kinds a {@link FunctionReference} can describe. `stream` is a query that yields multiple frames over the WS. */
|
|
3
58
|
type FunctionKind = "action" | "mutation" | "query" | "stream";
|
|
4
59
|
/**
|
|
@@ -1152,9 +1207,9 @@ interface SyncWatermark {
|
|
|
1152
1207
|
checkpoint?: number;
|
|
1153
1208
|
mutationId?: number;
|
|
1154
1209
|
}
|
|
1155
|
-
/** An `Error` carrying the server's machine-readable `code` and (for a `LunoraError`) structured `data`. The client's public error contract for RPC/batch failures. */
|
|
1210
|
+
/** An `Error` carrying the server's machine-readable `code` and (for a `LunoraError`) structured `data`. The client's public error contract for RPC/batch failures. The `(string & {})` arm keeps forward-compat/unknown server codes assignable without losing autocomplete on the known {@link LunoraErrorCode} union. */
|
|
1156
1211
|
type LunoraClientError = Error & {
|
|
1157
|
-
code?: string;
|
|
1212
|
+
code?: LunoraErrorCode | (string & {});
|
|
1158
1213
|
data?: unknown;
|
|
1159
1214
|
};
|
|
1160
1215
|
/** One demuxed result slot of a {@link LunoraClient.batch} call (plan 088). */
|
|
@@ -2357,4 +2412,4 @@ declare class LunoraClient {
|
|
|
2357
2412
|
*/
|
|
2358
2413
|
private settleReplayBatchSlots;
|
|
2359
2414
|
}
|
|
2360
|
-
export {
|
|
2415
|
+
export { StreamHandle as $, ArgsOf as A, BookmarkStorage as B, CONFLICT_ERROR_CODE as C, DEFAULT_MAX_BUFFER as D, RpcEnvelope as E, FunctionReference as F, GlobalFacetResult as G, RpcResponseBody as H, ScheduleRecord as I, SchedulerPoolStatus as J, SchedulerStatus as K, LunoraClient as L, MutationCallOptions as M, ServerMessage as N, OfflineQueueOptions as O, Preloaded as P, QueryCacheAdapter as Q, ReturnOf as R, SubscriptionError as S, ServerPokeEndMessage as T, User as U, ServerPokePartMessage as V, ServerPokeStartMessage as W, ShardTrafficEntry as X, ShardTrafficResult as Y, StorageListPage as Z, StorageObject as _, Unsubscribe as a, StreamIterable as a0, SubscriptionCallback as a1, SubscriptionRegistry as a2, SubscriptionState as a3, SyncWatermark as a4, WorkflowInstanceAction as a5, WorkflowInstanceDetail as a6, WorkflowInstancePage as a7, WorkflowInstanceStatus as a8, WorkflowInstanceSummary as a9, WorkflowStepDetail as aa, createLocalStore as ab, createStream as ac, getErrorCode as ad, getRetryAfterMs as ae, isConflictError as af, isForbiddenError as ag, isRateLimitedError as ah, isUnauthorizedError as ai, SubscriptionErrorCallback as b, PersistenceAdapter as c, ReconnectOptions as d, BatchSlot as e, CachedQuery as f, ClientMessage as g, ClientShapeSubscribeMessage as h, ClientShapeUnsubscribeMessage as i, ConnectionStatus as j, FunctionArgumentDescriptor as k, FunctionDescriptor as l, GlobalFacetValue as m, GlobalFilterClause as n, GlobalTableInfo as o, GlobalTablePage as p, LunoraClientError as q, LunoraClientOptions as r, LunoraErrorCode as s, MutationSettledEvent as t, OptimisticLocalStore as u, OptimisticUpdate as v, OutboxMutation as w, OutboxSink as x, PersistedMutation as y, RowOp as z };
|
|
@@ -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-CPMaTnsC.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-CPMaTnsC.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-CPMaTnsC.mjs";
|
|
2
|
+
export type { b as SubscriptionErrorCallback } from "../packem_shared/lunora-client.d-CPMaTnsC.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-CPMaTnsC.js";
|
|
2
|
+
export type { b as SubscriptionErrorCallback } from "../packem_shared/lunora-client.d-CPMaTnsC.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-CPMaTnsC.mjs";
|
|
2
|
+
export type { A as ArgsOf, F as FunctionReference, R as ReturnOf } from "../packem_shared/lunora-client.d-CPMaTnsC.mjs";
|
|
3
|
+
export { p as preloadQuery, a as preloadedQueryResult } from "../packem_shared/preload.d-Bl3z1rPo.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-CPMaTnsC.js";
|
|
2
|
+
export type { A as ArgsOf, F as FunctionReference, R as ReturnOf } from "../packem_shared/lunora-client.d-CPMaTnsC.js";
|
|
3
|
+
export { p as preloadQuery, a as preloadedQueryResult } from "../packem_shared/preload.d-DH0CqSxy.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-CFrM8ZQO.mjs';
|
|
4
4
|
export { preloadQuery, preloadedQueryResult } from '../packem_shared/preloadQuery-lobFkD2Z.mjs';
|
package/package.json
CHANGED