@lunora/angular 1.0.0-alpha.213 → 1.0.0-alpha.214
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/README.md +21 -0
- package/dist/index.d.mts +47 -3
- package/dist/index.d.ts +47 -3
- package/dist/index.mjs +1 -1
- package/dist/packem_shared/liveTopic-rphiqpWi.mjs +1 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -82,6 +82,27 @@ liveQuery(api.messages.list, () => ({ channelId: this.channelId() }), {
|
|
|
82
82
|
});
|
|
83
83
|
```
|
|
84
84
|
|
|
85
|
+
## Live topics
|
|
86
|
+
|
|
87
|
+
`liveTopic` follows one topic on the connection shared by its URL, and mirrors
|
|
88
|
+
the last payload and any refusal into two signals: `lastEvent` and `error`. It
|
|
89
|
+
subscribes when the component is created and unsubscribes on `DestroyRef`.
|
|
90
|
+
|
|
91
|
+
```ts
|
|
92
|
+
import { input } from "@angular/core";
|
|
93
|
+
import { liveTopic } from "@lunora/angular";
|
|
94
|
+
|
|
95
|
+
export class PostComponent {
|
|
96
|
+
readonly postId = input.required<string>();
|
|
97
|
+
|
|
98
|
+
readonly comments = liveTopic(() => ({ url: "/live/posts/connect", topic: `comments:${this.postId()}` }));
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
A new topic resubscribes; a new `onEvent` or `onError` callback is read at call
|
|
103
|
+
time and does not. Pass `{ destroyRef, injector }` as the second argument when
|
|
104
|
+
calling outside an injection context, as with `liveQuery`.
|
|
105
|
+
|
|
85
106
|
## Mutations
|
|
86
107
|
|
|
87
108
|
```ts
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DestroyRef, Signal, InjectionToken, EnvironmentProviders, Injector } from '@angular/core';
|
|
2
|
-
import { FunctionReference, LunoraClient, SubscriptionErrorCallback, SubscriptionError, User, LunoraClientOptions, ConnectionStatus, Preloaded, ArgsOf, ReturnOf, MutationCallOptions, MutatorHandle, ActionCallOptions } from '@lunora/client';
|
|
2
|
+
import { FunctionReference, LunoraClient, SubscriptionErrorCallback, SubscriptionError, User, LunoraClientOptions, ConnectionStatus, Preloaded, ArgsOf, ReturnOf, SubscribeLiveTopicOptions, LiveStreamSubscribeError, MutationCallOptions, MutatorHandle, ActionCallOptions } from '@lunora/client';
|
|
3
3
|
export type { ArgsOf, ConnectionStatus, FunctionReference, LunoraClient, LunoraClientOptions, MutationCallOptions, Preloaded, ReturnOf, SubscriptionError, Unsubscribe } from '@lunora/client';
|
|
4
4
|
import { AuthStatus } from '@lunora/client/auth';
|
|
5
5
|
import { PaginationStatus } from '@lunora/client/pagination';
|
|
@@ -840,6 +840,50 @@ interface LiveQueryOptions {
|
|
|
840
840
|
* @experimental
|
|
841
841
|
*/
|
|
842
842
|
declare const liveQuery: <F extends FunctionReference>(reference: F, args: ArgsOf<F> | "skip" | (() => ArgsOf<F> | "skip"), options?: LiveQueryOptions) => Signal<ReturnOf<F> | undefined>;
|
|
843
|
+
/**
|
|
844
|
+
* `LiveTopicOptions` is part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
845
|
+
* @experimental
|
|
846
|
+
*/
|
|
847
|
+
interface LiveTopicOptions {
|
|
848
|
+
/**
|
|
849
|
+
* `DestroyRef` whose `onDestroy` tears the subscription down. Defaults to
|
|
850
|
+
* `inject(DestroyRef)` — the calling component/service.
|
|
851
|
+
*/
|
|
852
|
+
destroyRef?: DestroyRef;
|
|
853
|
+
/**
|
|
854
|
+
* `Injector` to create the reactive-args `effect()` from. Only needed when the
|
|
855
|
+
* options are a function AND `liveTopic` is called outside an injection context
|
|
856
|
+
* with an explicit `destroyRef`. Unused for the static form.
|
|
857
|
+
*/
|
|
858
|
+
injector?: Injector;
|
|
859
|
+
}
|
|
860
|
+
/**
|
|
861
|
+
* Follow one live topic on the connection shared by its URL, and mirror its
|
|
862
|
+
* payloads into an Angular `signal`.
|
|
863
|
+
*
|
|
864
|
+
* `lastEvent` reads `undefined` until the first event lands; `error` carries the
|
|
865
|
+
* shard's refusal of the subscription. The subscription is torn down when the
|
|
866
|
+
* owning `DestroyRef` fires, so there is no leaked subscriber.
|
|
867
|
+
*
|
|
868
|
+
* ```ts
|
|
869
|
+
* export class PostComponent {
|
|
870
|
+
* readonly postId = input.required<string>();
|
|
871
|
+
*
|
|
872
|
+
* readonly comments = liveTopic(() => ({ url: "/live/posts/connect", topic: `comments:${this.postId()}` }));
|
|
873
|
+
* }
|
|
874
|
+
* ```
|
|
875
|
+
*
|
|
876
|
+
* Pass a function when the options read a signal, as above: an input is not bound
|
|
877
|
+
* while a field initializer runs, so the plain-object form would read `this.postId`
|
|
878
|
+
* too early. An options change (a new topic, say) resubscribes, while a new
|
|
879
|
+
* `onEvent` / `onError` identity is read at call time and does not reopen the
|
|
880
|
+
* subscription.
|
|
881
|
+
* @experimental
|
|
882
|
+
*/
|
|
883
|
+
declare const liveTopic: (source: SubscribeLiveTopicOptions | (() => SubscribeLiveTopicOptions), options?: LiveTopicOptions) => {
|
|
884
|
+
error: Signal<LiveStreamSubscribeError | undefined>;
|
|
885
|
+
lastEvent: Signal<unknown>;
|
|
886
|
+
};
|
|
843
887
|
/**
|
|
844
888
|
* `MutateOptions` is part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
845
889
|
* @experimental
|
|
@@ -1499,7 +1543,7 @@ interface VoiceAgentResult {
|
|
|
1499
1543
|
* @experimental
|
|
1500
1544
|
*/
|
|
1501
1545
|
declare const voiceAgent: (options: VoiceAgentOptions) => VoiceAgentResult;
|
|
1502
|
-
export { type AgentApi, type AgentChatApi, type AgentChatMessage, type AgentChatOptions, type AgentChatResult, type AgentLiveEvent, type AgentOptions, type AgentProgressEvent, type AgentResult, type AgentStateApi, type AgentStateOptions, type AgentStateResult, type AgentThreadRecord, type AgentThreadStatus, type AgentTokenDelta, type AgentTokenStreamReference, type AgentToolEvent, type AgentToolEventsApi, type AgentToolEventsOptions, type AgentToolEventsResult, type AuthGateResult, type AuthOptions, type AuthResult, type ConnectionStatusOptions, type FlagOptions, type FlagValue, type FlagsOptions, type HeartbeatReference, type HydratePreloadedOptions, type HydratePreloadedResult, type InfiniteQueryResult, LUNORA_CLIENT, type ListPresentReference, type LiveQueryOptions, type MutateOptions, type MutatorResult, type PaginatedQueryOptions, type PaginatedQueryResult, type PresenceOptions, type PresenceResult,
|
|
1546
|
+
export { type AgentApi, type AgentChatApi, type AgentChatMessage, type AgentChatOptions, type AgentChatResult, type AgentLiveEvent, type AgentOptions, type AgentProgressEvent, type AgentResult, type AgentStateApi, type AgentStateOptions, type AgentStateResult, type AgentThreadRecord, type AgentThreadStatus, type AgentTokenDelta, type AgentTokenStreamReference, type AgentToolEvent, type AgentToolEventsApi, type AgentToolEventsOptions, type AgentToolEventsResult, type AuthGateResult, type AuthOptions, type AuthResult, type ConnectionStatusOptions, type FlagOptions, type FlagValue, type FlagsOptions, type HeartbeatReference, type HydratePreloadedOptions, type HydratePreloadedResult, type InfiniteQueryResult, LUNORA_CLIENT, type ListPresentReference, type LiveQueryOptions, type LiveTopicOptions, type MutateOptions, type MutatorResult, type PaginatedQueryOptions, type PaginatedQueryResult, type PresenceOptions, type PresenceResult,
|
|
1503
1547
|
/**
|
|
1504
1548
|
* The Angular adapter for Lunora.
|
|
1505
1549
|
*
|
|
@@ -1515,4 +1559,4 @@ export { type AgentApi, type AgentChatApi, type AgentChatMessage, type AgentChat
|
|
|
1515
1559
|
* queue pass through to the client). `connectionStatus` is a `signal` of the
|
|
1516
1560
|
* aggregate live-socket status.
|
|
1517
1561
|
*/
|
|
1518
|
-
type ProvideLunoraOptions, type RateLimitOptions, type RateLimitResult, type RunActionOptions, type StreamOptions, type StreamResult, type StreamStatus, type SubscriptionOptions, type SubscriptionResult, type VoiceAgentOptions, type VoiceAgentResult, type VoiceAudioFormat, type VoiceReference, type VoiceStatus, agent, agentChat, agentState, agentToolEvents, auth, authGate, connectionStatus, flag, flags, hydratePreloaded, infiniteQuery, injectLunoraClient, liveQuery, mutate, mutator, paginatedQuery, presence, provideLunora, rateLimit, runAction, stream, subscription, voiceAgent };
|
|
1562
|
+
type ProvideLunoraOptions, type RateLimitOptions, type RateLimitResult, type RunActionOptions, type StreamOptions, type StreamResult, type StreamStatus, type SubscriptionOptions, type SubscriptionResult, type VoiceAgentOptions, type VoiceAgentResult, type VoiceAudioFormat, type VoiceReference, type VoiceStatus, agent, agentChat, agentState, agentToolEvents, auth, authGate, connectionStatus, flag, flags, hydratePreloaded, infiniteQuery, injectLunoraClient, liveQuery, liveTopic, mutate, mutator, paginatedQuery, presence, provideLunora, rateLimit, runAction, stream, subscription, voiceAgent };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DestroyRef, Signal, InjectionToken, EnvironmentProviders, Injector } from '@angular/core';
|
|
2
|
-
import { FunctionReference, LunoraClient, SubscriptionErrorCallback, SubscriptionError, User, LunoraClientOptions, ConnectionStatus, Preloaded, ArgsOf, ReturnOf, MutationCallOptions, MutatorHandle, ActionCallOptions } from '@lunora/client';
|
|
2
|
+
import { FunctionReference, LunoraClient, SubscriptionErrorCallback, SubscriptionError, User, LunoraClientOptions, ConnectionStatus, Preloaded, ArgsOf, ReturnOf, SubscribeLiveTopicOptions, LiveStreamSubscribeError, MutationCallOptions, MutatorHandle, ActionCallOptions } from '@lunora/client';
|
|
3
3
|
export type { ArgsOf, ConnectionStatus, FunctionReference, LunoraClient, LunoraClientOptions, MutationCallOptions, Preloaded, ReturnOf, SubscriptionError, Unsubscribe } from '@lunora/client';
|
|
4
4
|
import { AuthStatus } from '@lunora/client/auth';
|
|
5
5
|
import { PaginationStatus } from '@lunora/client/pagination';
|
|
@@ -840,6 +840,50 @@ interface LiveQueryOptions {
|
|
|
840
840
|
* @experimental
|
|
841
841
|
*/
|
|
842
842
|
declare const liveQuery: <F extends FunctionReference>(reference: F, args: ArgsOf<F> | "skip" | (() => ArgsOf<F> | "skip"), options?: LiveQueryOptions) => Signal<ReturnOf<F> | undefined>;
|
|
843
|
+
/**
|
|
844
|
+
* `LiveTopicOptions` is part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
845
|
+
* @experimental
|
|
846
|
+
*/
|
|
847
|
+
interface LiveTopicOptions {
|
|
848
|
+
/**
|
|
849
|
+
* `DestroyRef` whose `onDestroy` tears the subscription down. Defaults to
|
|
850
|
+
* `inject(DestroyRef)` — the calling component/service.
|
|
851
|
+
*/
|
|
852
|
+
destroyRef?: DestroyRef;
|
|
853
|
+
/**
|
|
854
|
+
* `Injector` to create the reactive-args `effect()` from. Only needed when the
|
|
855
|
+
* options are a function AND `liveTopic` is called outside an injection context
|
|
856
|
+
* with an explicit `destroyRef`. Unused for the static form.
|
|
857
|
+
*/
|
|
858
|
+
injector?: Injector;
|
|
859
|
+
}
|
|
860
|
+
/**
|
|
861
|
+
* Follow one live topic on the connection shared by its URL, and mirror its
|
|
862
|
+
* payloads into an Angular `signal`.
|
|
863
|
+
*
|
|
864
|
+
* `lastEvent` reads `undefined` until the first event lands; `error` carries the
|
|
865
|
+
* shard's refusal of the subscription. The subscription is torn down when the
|
|
866
|
+
* owning `DestroyRef` fires, so there is no leaked subscriber.
|
|
867
|
+
*
|
|
868
|
+
* ```ts
|
|
869
|
+
* export class PostComponent {
|
|
870
|
+
* readonly postId = input.required<string>();
|
|
871
|
+
*
|
|
872
|
+
* readonly comments = liveTopic(() => ({ url: "/live/posts/connect", topic: `comments:${this.postId()}` }));
|
|
873
|
+
* }
|
|
874
|
+
* ```
|
|
875
|
+
*
|
|
876
|
+
* Pass a function when the options read a signal, as above: an input is not bound
|
|
877
|
+
* while a field initializer runs, so the plain-object form would read `this.postId`
|
|
878
|
+
* too early. An options change (a new topic, say) resubscribes, while a new
|
|
879
|
+
* `onEvent` / `onError` identity is read at call time and does not reopen the
|
|
880
|
+
* subscription.
|
|
881
|
+
* @experimental
|
|
882
|
+
*/
|
|
883
|
+
declare const liveTopic: (source: SubscribeLiveTopicOptions | (() => SubscribeLiveTopicOptions), options?: LiveTopicOptions) => {
|
|
884
|
+
error: Signal<LiveStreamSubscribeError | undefined>;
|
|
885
|
+
lastEvent: Signal<unknown>;
|
|
886
|
+
};
|
|
843
887
|
/**
|
|
844
888
|
* `MutateOptions` is part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
845
889
|
* @experimental
|
|
@@ -1499,7 +1543,7 @@ interface VoiceAgentResult {
|
|
|
1499
1543
|
* @experimental
|
|
1500
1544
|
*/
|
|
1501
1545
|
declare const voiceAgent: (options: VoiceAgentOptions) => VoiceAgentResult;
|
|
1502
|
-
export { type AgentApi, type AgentChatApi, type AgentChatMessage, type AgentChatOptions, type AgentChatResult, type AgentLiveEvent, type AgentOptions, type AgentProgressEvent, type AgentResult, type AgentStateApi, type AgentStateOptions, type AgentStateResult, type AgentThreadRecord, type AgentThreadStatus, type AgentTokenDelta, type AgentTokenStreamReference, type AgentToolEvent, type AgentToolEventsApi, type AgentToolEventsOptions, type AgentToolEventsResult, type AuthGateResult, type AuthOptions, type AuthResult, type ConnectionStatusOptions, type FlagOptions, type FlagValue, type FlagsOptions, type HeartbeatReference, type HydratePreloadedOptions, type HydratePreloadedResult, type InfiniteQueryResult, LUNORA_CLIENT, type ListPresentReference, type LiveQueryOptions, type MutateOptions, type MutatorResult, type PaginatedQueryOptions, type PaginatedQueryResult, type PresenceOptions, type PresenceResult,
|
|
1546
|
+
export { type AgentApi, type AgentChatApi, type AgentChatMessage, type AgentChatOptions, type AgentChatResult, type AgentLiveEvent, type AgentOptions, type AgentProgressEvent, type AgentResult, type AgentStateApi, type AgentStateOptions, type AgentStateResult, type AgentThreadRecord, type AgentThreadStatus, type AgentTokenDelta, type AgentTokenStreamReference, type AgentToolEvent, type AgentToolEventsApi, type AgentToolEventsOptions, type AgentToolEventsResult, type AuthGateResult, type AuthOptions, type AuthResult, type ConnectionStatusOptions, type FlagOptions, type FlagValue, type FlagsOptions, type HeartbeatReference, type HydratePreloadedOptions, type HydratePreloadedResult, type InfiniteQueryResult, LUNORA_CLIENT, type ListPresentReference, type LiveQueryOptions, type LiveTopicOptions, type MutateOptions, type MutatorResult, type PaginatedQueryOptions, type PaginatedQueryResult, type PresenceOptions, type PresenceResult,
|
|
1503
1547
|
/**
|
|
1504
1548
|
* The Angular adapter for Lunora.
|
|
1505
1549
|
*
|
|
@@ -1515,4 +1559,4 @@ export { type AgentApi, type AgentChatApi, type AgentChatMessage, type AgentChat
|
|
|
1515
1559
|
* queue pass through to the client). `connectionStatus` is a `signal` of the
|
|
1516
1560
|
* aggregate live-socket status.
|
|
1517
1561
|
*/
|
|
1518
|
-
type ProvideLunoraOptions, type RateLimitOptions, type RateLimitResult, type RunActionOptions, type StreamOptions, type StreamResult, type StreamStatus, type SubscriptionOptions, type SubscriptionResult, type VoiceAgentOptions, type VoiceAgentResult, type VoiceAudioFormat, type VoiceReference, type VoiceStatus, agent, agentChat, agentState, agentToolEvents, auth, authGate, connectionStatus, flag, flags, hydratePreloaded, infiniteQuery, injectLunoraClient, liveQuery, mutate, mutator, paginatedQuery, presence, provideLunora, rateLimit, runAction, stream, subscription, voiceAgent };
|
|
1562
|
+
type ProvideLunoraOptions, type RateLimitOptions, type RateLimitResult, type RunActionOptions, type StreamOptions, type StreamResult, type StreamStatus, type SubscriptionOptions, type SubscriptionResult, type VoiceAgentOptions, type VoiceAgentResult, type VoiceAudioFormat, type VoiceReference, type VoiceStatus, agent, agentChat, agentState, agentToolEvents, auth, authGate, connectionStatus, flag, flags, hydratePreloaded, infiniteQuery, injectLunoraClient, liveQuery, liveTopic, mutate, mutator, paginatedQuery, presence, provideLunora, rateLimit, runAction, stream, subscription, voiceAgent };
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{agent as
|
|
1
|
+
import{agent as e}from"./packem_shared/agent-DjMQf-yE.mjs";import{agentChat as p}from"./packem_shared/agentChat-DyJrje49.mjs";import{agentState as f}from"./packem_shared/agentState-Bjqf9q2f.mjs";import{agentToolEvents as x}from"./packem_shared/agentToolEvents-VuBRpS6v.mjs";import{auth as i,authGate as u}from"./packem_shared/auth-C3dB8sYS.mjs";import{LUNORA_CLIENT as g,injectLunoraClient as l,provideLunora as s}from"./packem_shared/LUNORA_CLIENT-B0toApHY.mjs";import{connectionStatus as v}from"./packem_shared/connectionStatus-UhmuwzMa.mjs";import{flag as h,flags as y}from"./packem_shared/flag-BDKBQGos.mjs";import{hydratePreloaded as C}from"./packem_shared/hydratePreloaded-QPAo50Am.mjs";import{liveQuery as S}from"./packem_shared/liveQuery-eE9zMaxo.mjs";import{liveTopic as E}from"./packem_shared/liveTopic-rphiqpWi.mjs";import{mutate as N}from"./packem_shared/mutate-BZvLQLyu.mjs";import{mutator as b}from"./packem_shared/mutator-DjG1yGk8.mjs";import{infiniteQuery as G,paginatedQuery as K}from"./packem_shared/infiniteQuery-DGYdgFHW.mjs";import{presence as R}from"./packem_shared/presence-1T4-U8ij.mjs";import{rateLimit as _}from"./packem_shared/rateLimit-B3h9qzh-.mjs";import{runAction as q}from"./packem_shared/runAction-BfiPq4Xz.mjs";import{stream as z}from"./packem_shared/stream-BuhiwhIH.mjs";import{subscription as D}from"./packem_shared/subscription-zJv48q6C.mjs";import{voiceAgent as H}from"./packem_shared/voiceAgent-CH--tRWP.mjs";import{SKIP as M}from"@lunora/client/query";export{g as LUNORA_CLIENT,M as SKIP,e as agent,p as agentChat,f as agentState,x as agentToolEvents,i as auth,u as authGate,v as connectionStatus,h as flag,y as flags,C as hydratePreloaded,G as infiniteQuery,l as injectLunoraClient,S as liveQuery,E as liveTopic,N as mutate,b as mutator,K as paginatedQuery,R as presence,s as provideLunora,_ as rateLimit,q as runAction,z as stream,D as subscription,H as voiceAgent};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{inject as m,DestroyRef as R,signal as y}from"@angular/core";import{subscribeLiveTopic as h}from"@lunora/client";import{s as u,a as D}from"./platform-DGTu4Ucl.mjs";const d=e=>({headers:e.headers,maxDelayMs:e.maxDelayMs,retryDelay:e.retryDelay,sessionKey:e.sessionKey,topic:e.topic,url:e.url,withCredentials:e.withCredentials}),p=(e,o={})=>{const l=o.destroyRef===void 0,c=o.destroyRef??m(R),n=y(void 0),r=y(void 0),s=typeof e=="function"?e:()=>e,a=(i,f)=>{n.set(void 0),r.set(void 0);const v=h({...i,onError:t=>{r.set(t),s().onError?.(t)},onEvent:t=>{n.set(t),r.set(void 0),s().onEvent?.(t)}});f(v)};return u(l)&&(typeof e=="function"?D(()=>d(s()),{destroyRef:c,injector:o.injector},a):a(d(e),i=>c.onDestroy(i))),{error:r.asReadonly(),lastEvent:n.asReadonly()}};export{p as liveTopic};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lunora/angular",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.214",
|
|
4
4
|
"description": "Angular reactive adapter for Lunora — signal-based live queries and mutations",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"angular",
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
"access": "public"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@lunora/client": "1.0.0-alpha.
|
|
57
|
-
"@lunora/ratelimit": "1.0.0-alpha.
|
|
56
|
+
"@lunora/client": "1.0.0-alpha.228",
|
|
57
|
+
"@lunora/ratelimit": "1.0.0-alpha.151",
|
|
58
58
|
"@lunora/wire": "1.0.0-alpha.1",
|
|
59
59
|
"@visulima/storage-client": "1.0.9"
|
|
60
60
|
},
|