@camstack/types 1.1.16 → 1.1.18
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/addon.js +1 -1
- package/dist/addon.mjs +1 -1
- package/dist/capabilities/camera-streams.cap.d.ts +2 -0
- package/dist/capabilities/index.d.ts +1 -1
- package/dist/capabilities/notification-output.cap.d.ts +503 -24
- package/dist/capabilities/pipeline-orchestrator.cap.d.ts +6 -5
- package/dist/capabilities/schemas/streaming-shared.d.ts +2 -0
- package/dist/capabilities/stream-broker.cap.d.ts +2 -0
- package/dist/capabilities/stream-catalog.cap.d.ts +2 -0
- package/dist/generated/addon-api.d.ts +430 -74
- package/dist/generated/method-access-map.d.ts +1 -1
- package/dist/generated/system-proxy.d.ts +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +463 -22
- package/dist/index.mjs +445 -23
- package/dist/interfaces/notification.d.ts +24 -14
- package/dist/interfaces/stream-broker.d.ts +13 -2
- package/dist/notification/degrade-engine.d.ts +60 -0
- package/dist/notification/format-transcode.d.ts +19 -0
- package/dist/{sleep-BQzZ7joF.js → sleep-BabrCASa.js} +1 -0
- package/dist/{sleep-C2M2zF7x.mjs → sleep-MHm--th-.mjs} +1 -0
- package/package.json +1 -1
|
@@ -1,17 +1,22 @@
|
|
|
1
|
+
import type { z } from 'zod';
|
|
1
2
|
import type { ConfigUISchema } from './config-ui.js';
|
|
3
|
+
import type { NotificationSchema } from '../capabilities/notification-output.cap.js';
|
|
2
4
|
/**
|
|
3
|
-
*
|
|
5
|
+
* The canonical notification — single source of truth is the
|
|
6
|
+
* `notification-output` cap's `NotificationSchema`. Callers emit this shape;
|
|
7
|
+
* providers degrade it per their `TargetKind.caps`.
|
|
4
8
|
*/
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
+
export type Notification = z.infer<typeof NotificationSchema>;
|
|
10
|
+
/**
|
|
11
|
+
* Consumer-side envelope. `category` + `timestamp` are routing / rate-limit
|
|
12
|
+
* concerns owned by `NotificationService`, NOT wire concerns — the cap `send`
|
|
13
|
+
* payload stays the canonical `Notification`. The service strips these before
|
|
14
|
+
* dispatching to a target.
|
|
15
|
+
*/
|
|
16
|
+
export type RoutedNotification = Notification & {
|
|
9
17
|
readonly category: string;
|
|
10
|
-
readonly data?: Record<string, unknown>;
|
|
11
|
-
readonly imageUrl?: string;
|
|
12
|
-
readonly deviceId?: number;
|
|
13
18
|
readonly timestamp: number;
|
|
14
|
-
}
|
|
19
|
+
};
|
|
15
20
|
/**
|
|
16
21
|
* A toast notification for the admin UI.
|
|
17
22
|
*/
|
|
@@ -33,20 +38,25 @@ export interface IToastService {
|
|
|
33
38
|
sendToUser(userId: string, toast: Toast): void;
|
|
34
39
|
}
|
|
35
40
|
/**
|
|
36
|
-
*
|
|
37
|
-
*
|
|
41
|
+
* Legacy single-channel output view.
|
|
42
|
+
*
|
|
43
|
+
* @deprecated The canonical surface is the `notification-output` cap's
|
|
44
|
+
* collection provider (`INotificationOutputProvider`, one per addon, keyed by
|
|
45
|
+
* `addonId` and addressing individual targets via `send({ targetId, ... })`).
|
|
46
|
+
* This interface survives only for `advanced-notifier`'s internal console
|
|
47
|
+
* output; new providers implement the cap.
|
|
38
48
|
*/
|
|
39
49
|
export interface INotificationOutput {
|
|
40
50
|
readonly id: string;
|
|
41
51
|
readonly name: string;
|
|
42
52
|
readonly icon: string;
|
|
43
|
-
/** Send a notification */
|
|
53
|
+
/** Send a canonical notification through this single channel. */
|
|
44
54
|
send(notification: Notification): Promise<void>;
|
|
45
|
-
/** Test the notification channel */
|
|
55
|
+
/** Test the notification channel. */
|
|
46
56
|
sendTest?(): Promise<{
|
|
47
57
|
success: boolean;
|
|
48
58
|
error?: string;
|
|
49
59
|
}>;
|
|
50
|
-
/** Config schema for the admin UI */
|
|
60
|
+
/** Config schema for the admin UI. */
|
|
51
61
|
getConfigSchema?(): ConfigUISchema;
|
|
52
62
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import type { SubscribeAudioChunksResult, SubscribeFramesInput, SubscribeFramesResult } from '../capabilities/schemas/streaming-shared.js';
|
|
3
|
+
import type { BrokerConsumerAttribution } from '../capabilities/stream-broker.cap.js';
|
|
2
4
|
import type { FrameFormat } from '../types/io.js';
|
|
3
5
|
import type { FrameHandle } from './frame-handle.js';
|
|
4
|
-
import type { SubscribeFramesInput, SubscribeFramesResult, SubscribeAudioChunksResult } from '../capabilities/schemas/streaming-shared.js';
|
|
5
|
-
import type { BrokerConsumerAttribution } from '../capabilities/stream-broker.cap.js';
|
|
6
6
|
export declare const DecoderStatsSchema: z.ZodObject<{
|
|
7
7
|
inputFps: z.ZodNumber;
|
|
8
8
|
outputFps: z.ZodNumber;
|
|
@@ -74,6 +74,17 @@ export interface StreamSource {
|
|
|
74
74
|
* stall is an error).
|
|
75
75
|
*/
|
|
76
76
|
readonly allowStall?: boolean;
|
|
77
|
+
/**
|
|
78
|
+
* When set, the broker ingests this source THROUGH ffmpeg (`-c copy`) instead
|
|
79
|
+
* of a native TS client — the "ffmpeg parser". Carries the transport + operator
|
|
80
|
+
* normalization args. Set by the manager from the per-camStream `sourceParser`
|
|
81
|
+
* override. Absent = native ingest.
|
|
82
|
+
*/
|
|
83
|
+
readonly ffmpegParser?: {
|
|
84
|
+
readonly transport: 'tcp' | 'udp';
|
|
85
|
+
readonly inputArgs?: readonly string[];
|
|
86
|
+
readonly outputArgs?: readonly string[];
|
|
87
|
+
};
|
|
77
88
|
}
|
|
78
89
|
export interface StreamSourceOption {
|
|
79
90
|
readonly id: string;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Capability-gated notification degrade engine (Apprise-style).
|
|
3
|
+
*
|
|
4
|
+
* PURE — no I/O. Given a kind's `TargetKind.caps` and a canonical
|
|
5
|
+
* `Notification`, it transcodes the format down, resolves the native level,
|
|
6
|
+
* filters + caps attachments, slices actions, gates scalar features, and
|
|
7
|
+
* splits/truncates the body — producing a `PreparedNotification` the adapter
|
|
8
|
+
* turns into an HTTP request. Attachment url→bytes fetching is expressed as a
|
|
9
|
+
* `needsFetch` directive the adapter executes (the engine never fetches).
|
|
10
|
+
*
|
|
11
|
+
* Lives in `@camstack/types` because both the system `notifiers` addon and the
|
|
12
|
+
* HA addon need it and addons may not cross-import.
|
|
13
|
+
*/
|
|
14
|
+
import type { z } from 'zod';
|
|
15
|
+
import type { AttachmentMediaType, NotificationAction, NotificationFormat, NotificationSchema, RenderedAs, TargetKindCaps } from '../capabilities/notification-output.cap.js';
|
|
16
|
+
type Notification = z.infer<typeof NotificationSchema>;
|
|
17
|
+
/** The resolved native level the adapter maps onto its wire payload. */
|
|
18
|
+
export interface ResolvedLevel {
|
|
19
|
+
readonly id: string;
|
|
20
|
+
readonly ordinal: number | null;
|
|
21
|
+
readonly flags?: {
|
|
22
|
+
readonly critical?: boolean;
|
|
23
|
+
readonly silent?: boolean;
|
|
24
|
+
readonly noPush?: boolean;
|
|
25
|
+
};
|
|
26
|
+
/** e.g. Pushover `emergency` → `['retry','expire']` — adapter injects config defaults. */
|
|
27
|
+
readonly requires?: readonly string[];
|
|
28
|
+
}
|
|
29
|
+
/** An attachment after filtering, with a fetch directive for the adapter. */
|
|
30
|
+
export interface PreparedAttachment {
|
|
31
|
+
readonly mediaType: AttachmentMediaType;
|
|
32
|
+
readonly url?: string;
|
|
33
|
+
readonly bytes?: Uint8Array;
|
|
34
|
+
readonly mime?: string;
|
|
35
|
+
readonly name?: string;
|
|
36
|
+
/** `true` when the adapter must fetch `url` into bytes (mode:'bytes', url-only). */
|
|
37
|
+
readonly needsFetch: boolean;
|
|
38
|
+
}
|
|
39
|
+
export type PreparedAction = NotificationAction;
|
|
40
|
+
export interface PreparedNotification {
|
|
41
|
+
readonly body: string;
|
|
42
|
+
readonly title?: string;
|
|
43
|
+
readonly format: NotificationFormat;
|
|
44
|
+
readonly level: ResolvedLevel | null;
|
|
45
|
+
readonly attachments: readonly PreparedAttachment[];
|
|
46
|
+
readonly actions: readonly PreparedAction[];
|
|
47
|
+
readonly clickUrl: string | null;
|
|
48
|
+
readonly sound: string | null;
|
|
49
|
+
readonly ttl: number | null;
|
|
50
|
+
readonly tag: string | null;
|
|
51
|
+
/** Overflow: `bodyParts[0]` is the truncate view; the full array is the split. */
|
|
52
|
+
readonly bodyParts: readonly string[];
|
|
53
|
+
readonly renderedAs: RenderedAs;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Prepare a canonical notification for one kind. Never throws — degradation is
|
|
57
|
+
* always reported in `renderedAs`, never surfaced as an error.
|
|
58
|
+
*/
|
|
59
|
+
export declare function prepareNotification(caps: TargetKindCaps, n: Notification): PreparedNotification;
|
|
60
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure format transcoding for the notification degrade engine (Apprise-style).
|
|
3
|
+
* No I/O — used by both the system `notifiers` addon and the HA addon (which
|
|
4
|
+
* may not cross-import), so it lives in `@camstack/types`.
|
|
5
|
+
*/
|
|
6
|
+
import type { NotificationFormat } from '../capabilities/notification-output.cap.js';
|
|
7
|
+
export type { NotificationFormat };
|
|
8
|
+
/** Strip a small, safe subset of Markdown down to plain text. */
|
|
9
|
+
export declare function markdownToText(md: string): string;
|
|
10
|
+
/** Strip HTML tags, decode a few entities, map block/br elements to newlines. */
|
|
11
|
+
export declare function htmlToText(html: string): string;
|
|
12
|
+
/** Plain text → HTML-lite (escape + newlines to <br>). */
|
|
13
|
+
export declare function textToHtml(text: string): string;
|
|
14
|
+
/** Markdown → HTML-lite (bold/italic/code/links; used e.g. for Pushover). */
|
|
15
|
+
export declare function markdownToHtmlLite(md: string): string;
|
|
16
|
+
/** Pick the best target format the kind supports for a given source format. */
|
|
17
|
+
export declare function resolveFormat(source: NotificationFormat, supported: readonly NotificationFormat[]): NotificationFormat;
|
|
18
|
+
/** Transcode a body between formats. */
|
|
19
|
+
export declare function transcodeBody(body: string, from: NotificationFormat, to: NotificationFormat): string;
|