@camstack/types 1.2.562 → 1.2.563
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/CHANGELOG.md +16 -0
- package/dist/addon.js +3 -2
- package/dist/addon.mjs +3 -2
- package/dist/capabilities/cluster-update.cap.d.ts +16 -0
- package/dist/capabilities/device-manager.cap.d.ts +2 -1
- package/dist/capabilities/device-search.d.ts +4 -2
- package/dist/capabilities/notification-rules.cap.d.ts +4 -0
- package/dist/capabilities/smtp-provider.cap.d.ts +2 -0
- package/dist/capabilities/switch.cap.d.ts +5 -0
- package/dist/client.js +46 -1
- package/dist/client.mjs +46 -1
- package/dist/device/cap-vocabulary/index.d.ts +1 -1
- package/dist/device/cap-vocabulary/resolve.d.ts +6 -0
- package/dist/generated/addon-api.d.ts +7 -0
- package/dist/generated/collection-array-methods.d.ts +1 -1
- package/dist/generated/method-access-map.d.ts +1 -1
- package/dist/generated/method-device-selectors.d.ts +2 -2
- package/dist/index.d.ts +3 -1
- package/dist/index.js +385 -39
- package/dist/index.mjs +378 -40
- package/dist/notification/degrade-engine.d.ts +5 -0
- package/dist/notification/email-image-bytes.d.ts +26 -0
- package/dist/notification/email-mime.d.ts +52 -0
- package/dist/{sleep-Cykc2bzi.mjs → sleep-BCWQQG52.mjs} +49 -32
- package/dist/{sleep-Cb2px0Nb.js → sleep-RUgd-FgK.js} +49 -32
- package/package.json +1 -1
|
@@ -48,6 +48,11 @@ export interface PreparedNotification {
|
|
|
48
48
|
readonly sound: string | null;
|
|
49
49
|
readonly ttl: number | null;
|
|
50
50
|
readonly tag: string | null;
|
|
51
|
+
/**
|
|
52
|
+
* The camera this notification is about, when it names one. Copied through so
|
|
53
|
+
* a sender that drops an image can tag the log with it.
|
|
54
|
+
*/
|
|
55
|
+
readonly deviceId?: number;
|
|
51
56
|
/**
|
|
52
57
|
* The notifier-declared delivery parameters the rule set for this target
|
|
53
58
|
* (D938), already validated by the dispatcher. An adapter reads the keys it
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read email images off `peerBytes` tickets and hand the bytes to {@link buildRawMime}.
|
|
3
|
+
*
|
|
4
|
+
* One body, one take (D613). A ticket that cannot be read is reported and left
|
|
5
|
+
* out — the mail still goes, without that image.
|
|
6
|
+
*/
|
|
7
|
+
import type { PeerBytesOpenResult, PeerBytesTicket } from '../interfaces/addon-peer-bytes.js';
|
|
8
|
+
import { type EmailImagePart, type EmailMimeImage } from './email-mime.js';
|
|
9
|
+
export type OpenEmailImage = (ticket: PeerBytesTicket) => Promise<PeerBytesOpenResult>;
|
|
10
|
+
export type EmailImageDropped = (reason: string, deviceId: number | undefined) => void;
|
|
11
|
+
/** What a sender knows before the tickets are opened. */
|
|
12
|
+
export interface OutboundEmail {
|
|
13
|
+
readonly from: string;
|
|
14
|
+
readonly to: string | readonly string[];
|
|
15
|
+
readonly cc?: readonly string[];
|
|
16
|
+
readonly bcc?: readonly string[];
|
|
17
|
+
readonly replyTo?: string;
|
|
18
|
+
readonly subject: string;
|
|
19
|
+
readonly text: string;
|
|
20
|
+
readonly html?: string;
|
|
21
|
+
readonly images?: readonly EmailImagePart[];
|
|
22
|
+
}
|
|
23
|
+
/** The images that fit. Each failure is handed to `onDropped` and skipped. */
|
|
24
|
+
export declare function materializeEmailImages(images: readonly EmailImagePart[] | undefined, open: OpenEmailImage, onDropped: EmailImageDropped): Promise<readonly EmailMimeImage[]>;
|
|
25
|
+
/** Tickets in, one MIME body out. The same call for Gmail and SMTP. */
|
|
26
|
+
export declare function assembleEmailMime(input: OutboundEmail, open: OpenEmailImage, onDropped: EmailImageDropped): Promise<string>;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One RFC 5322 body for every mail sender.
|
|
3
|
+
*
|
|
4
|
+
* Gmail and the SMTP relay both call this. An HTML message with an inline image is
|
|
5
|
+
* `multipart/related` (the HTML sits in `multipart/alternative` and references
|
|
6
|
+
* `cid:`). A text message carries the same bytes as a normal attachment
|
|
7
|
+
* (`multipart/mixed`). The image bytes are already in hand — a sender reads them
|
|
8
|
+
* off a `peerBytes` ticket before calling in ({@link assembleEmailMime}).
|
|
9
|
+
*/
|
|
10
|
+
import { z } from 'zod';
|
|
11
|
+
import { type PeerBytesTicket } from '../interfaces/addon-peer-bytes.js';
|
|
12
|
+
/** How many images one email will carry. */
|
|
13
|
+
export declare const EMAIL_IMAGE_MAX_COUNT: number;
|
|
14
|
+
/** Total image bytes one email will carry. */
|
|
15
|
+
export declare const EMAIL_IMAGE_MAX_TOTAL_BYTES: number;
|
|
16
|
+
/**
|
|
17
|
+
* Where an HTML body leaves room for the inline images: under the text, above
|
|
18
|
+
* the click link. The builder replaces it; a message with no image loses it.
|
|
19
|
+
*/
|
|
20
|
+
export declare const EMAIL_IMAGE_SLOT: string;
|
|
21
|
+
/** An image a sender still has to read (`peerBytes` ticket, not the bytes). */
|
|
22
|
+
export interface EmailImagePart {
|
|
23
|
+
readonly ticket: PeerBytesTicket;
|
|
24
|
+
readonly mime: string;
|
|
25
|
+
readonly name: string;
|
|
26
|
+
readonly contentId: string;
|
|
27
|
+
readonly placement: 'inline' | 'attachment';
|
|
28
|
+
readonly deviceId?: number;
|
|
29
|
+
}
|
|
30
|
+
export declare const EmailImagePartSchema: z.ZodType<EmailImagePart>;
|
|
31
|
+
/** An image whose bytes are already in hand, ready for the MIME body. */
|
|
32
|
+
export interface EmailMimeImage {
|
|
33
|
+
readonly bytes: Uint8Array;
|
|
34
|
+
readonly mime: string;
|
|
35
|
+
readonly name: string;
|
|
36
|
+
readonly contentId: string;
|
|
37
|
+
readonly placement: 'inline' | 'attachment';
|
|
38
|
+
}
|
|
39
|
+
/** The headers and bodies `buildRawMime` renders. `images` are bytes, not tickets. */
|
|
40
|
+
export interface RawMimeInput {
|
|
41
|
+
readonly from: string;
|
|
42
|
+
readonly to: string | readonly string[];
|
|
43
|
+
readonly cc?: readonly string[];
|
|
44
|
+
readonly bcc?: readonly string[];
|
|
45
|
+
readonly replyTo?: string;
|
|
46
|
+
readonly subject: string;
|
|
47
|
+
readonly text: string;
|
|
48
|
+
readonly html?: string;
|
|
49
|
+
readonly images?: readonly EmailMimeImage[];
|
|
50
|
+
}
|
|
51
|
+
/** Render one mail. No I/O: the caller has already decided which images survived. */
|
|
52
|
+
export declare function buildRawMime(input: RawMimeInput): string;
|
|
@@ -7948,41 +7948,57 @@ var CAP_VOCABULARY = {
|
|
|
7948
7948
|
en: "Switch",
|
|
7949
7949
|
it: "Interruttore"
|
|
7950
7950
|
},
|
|
7951
|
-
actions: [
|
|
7952
|
-
|
|
7953
|
-
|
|
7954
|
-
|
|
7955
|
-
|
|
7956
|
-
|
|
7957
|
-
|
|
7958
|
-
|
|
7959
|
-
|
|
7960
|
-
|
|
7961
|
-
|
|
7962
|
-
|
|
7963
|
-
|
|
7964
|
-
|
|
7965
|
-
|
|
7966
|
-
|
|
7967
|
-
|
|
7968
|
-
|
|
7969
|
-
id: "switch.off",
|
|
7970
|
-
method: "setState",
|
|
7971
|
-
label: {
|
|
7972
|
-
en: "Turn off",
|
|
7973
|
-
it: "Spegni"
|
|
7951
|
+
actions: [
|
|
7952
|
+
{
|
|
7953
|
+
id: "switch.on",
|
|
7954
|
+
method: "setState",
|
|
7955
|
+
label: {
|
|
7956
|
+
en: "Turn on",
|
|
7957
|
+
it: "Accendi"
|
|
7958
|
+
},
|
|
7959
|
+
phrase: {
|
|
7960
|
+
en: "Turn on {device}",
|
|
7961
|
+
it: "Accendi {device}"
|
|
7962
|
+
},
|
|
7963
|
+
icon: "power",
|
|
7964
|
+
args: { on: true },
|
|
7965
|
+
effect: {
|
|
7966
|
+
field: "on",
|
|
7967
|
+
value: true
|
|
7968
|
+
}
|
|
7974
7969
|
},
|
|
7975
|
-
|
|
7976
|
-
|
|
7977
|
-
|
|
7970
|
+
{
|
|
7971
|
+
id: "switch.off",
|
|
7972
|
+
method: "setState",
|
|
7973
|
+
label: {
|
|
7974
|
+
en: "Turn off",
|
|
7975
|
+
it: "Spegni"
|
|
7976
|
+
},
|
|
7977
|
+
phrase: {
|
|
7978
|
+
en: "Turn off {device}",
|
|
7979
|
+
it: "Spegni {device}"
|
|
7980
|
+
},
|
|
7981
|
+
icon: "power-off",
|
|
7982
|
+
args: { on: false },
|
|
7983
|
+
effect: {
|
|
7984
|
+
field: "on",
|
|
7985
|
+
value: false
|
|
7986
|
+
}
|
|
7978
7987
|
},
|
|
7979
|
-
|
|
7980
|
-
|
|
7981
|
-
|
|
7982
|
-
|
|
7983
|
-
|
|
7988
|
+
{
|
|
7989
|
+
id: "switch.toggle",
|
|
7990
|
+
method: "toggle",
|
|
7991
|
+
label: {
|
|
7992
|
+
en: "Toggle",
|
|
7993
|
+
it: "Commuta"
|
|
7994
|
+
},
|
|
7995
|
+
phrase: {
|
|
7996
|
+
en: "Toggle {device}",
|
|
7997
|
+
it: "Commuta {device}"
|
|
7998
|
+
},
|
|
7999
|
+
icon: "toggle-right"
|
|
7984
8000
|
}
|
|
7985
|
-
|
|
8001
|
+
],
|
|
7986
8002
|
state: [{
|
|
7987
8003
|
kind: "boolean",
|
|
7988
8004
|
field: "on",
|
|
@@ -20265,6 +20281,7 @@ function createDeviceProxy(api, binding, opts) {
|
|
|
20265
20281
|
const streamSignalsInterface = { listSignals: (input) => dispatch("stream-signals", "streamSignals", "listSignals", "query", input) };
|
|
20266
20282
|
const switchInterface = {
|
|
20267
20283
|
setState: (input) => dispatch("switch", "switch", "setState", "mutation", input),
|
|
20284
|
+
toggle: (input) => dispatch("switch", "switch", "toggle", "mutation", input),
|
|
20268
20285
|
getStatus: (input) => dispatch("switch", "switch", "getStatus", "query", input)
|
|
20269
20286
|
};
|
|
20270
20287
|
const tamperInterface = { getStatus: (input) => dispatch("tamper", "tamper", "getStatus", "query", input) };
|
|
@@ -7948,41 +7948,57 @@ var CAP_VOCABULARY = {
|
|
|
7948
7948
|
en: "Switch",
|
|
7949
7949
|
it: "Interruttore"
|
|
7950
7950
|
},
|
|
7951
|
-
actions: [
|
|
7952
|
-
|
|
7953
|
-
|
|
7954
|
-
|
|
7955
|
-
|
|
7956
|
-
|
|
7957
|
-
|
|
7958
|
-
|
|
7959
|
-
|
|
7960
|
-
|
|
7961
|
-
|
|
7962
|
-
|
|
7963
|
-
|
|
7964
|
-
|
|
7965
|
-
|
|
7966
|
-
|
|
7967
|
-
|
|
7968
|
-
|
|
7969
|
-
id: "switch.off",
|
|
7970
|
-
method: "setState",
|
|
7971
|
-
label: {
|
|
7972
|
-
en: "Turn off",
|
|
7973
|
-
it: "Spegni"
|
|
7951
|
+
actions: [
|
|
7952
|
+
{
|
|
7953
|
+
id: "switch.on",
|
|
7954
|
+
method: "setState",
|
|
7955
|
+
label: {
|
|
7956
|
+
en: "Turn on",
|
|
7957
|
+
it: "Accendi"
|
|
7958
|
+
},
|
|
7959
|
+
phrase: {
|
|
7960
|
+
en: "Turn on {device}",
|
|
7961
|
+
it: "Accendi {device}"
|
|
7962
|
+
},
|
|
7963
|
+
icon: "power",
|
|
7964
|
+
args: { on: true },
|
|
7965
|
+
effect: {
|
|
7966
|
+
field: "on",
|
|
7967
|
+
value: true
|
|
7968
|
+
}
|
|
7974
7969
|
},
|
|
7975
|
-
|
|
7976
|
-
|
|
7977
|
-
|
|
7970
|
+
{
|
|
7971
|
+
id: "switch.off",
|
|
7972
|
+
method: "setState",
|
|
7973
|
+
label: {
|
|
7974
|
+
en: "Turn off",
|
|
7975
|
+
it: "Spegni"
|
|
7976
|
+
},
|
|
7977
|
+
phrase: {
|
|
7978
|
+
en: "Turn off {device}",
|
|
7979
|
+
it: "Spegni {device}"
|
|
7980
|
+
},
|
|
7981
|
+
icon: "power-off",
|
|
7982
|
+
args: { on: false },
|
|
7983
|
+
effect: {
|
|
7984
|
+
field: "on",
|
|
7985
|
+
value: false
|
|
7986
|
+
}
|
|
7978
7987
|
},
|
|
7979
|
-
|
|
7980
|
-
|
|
7981
|
-
|
|
7982
|
-
|
|
7983
|
-
|
|
7988
|
+
{
|
|
7989
|
+
id: "switch.toggle",
|
|
7990
|
+
method: "toggle",
|
|
7991
|
+
label: {
|
|
7992
|
+
en: "Toggle",
|
|
7993
|
+
it: "Commuta"
|
|
7994
|
+
},
|
|
7995
|
+
phrase: {
|
|
7996
|
+
en: "Toggle {device}",
|
|
7997
|
+
it: "Commuta {device}"
|
|
7998
|
+
},
|
|
7999
|
+
icon: "toggle-right"
|
|
7984
8000
|
}
|
|
7985
|
-
|
|
8001
|
+
],
|
|
7986
8002
|
state: [{
|
|
7987
8003
|
kind: "boolean",
|
|
7988
8004
|
field: "on",
|
|
@@ -20265,6 +20281,7 @@ function createDeviceProxy(api, binding, opts) {
|
|
|
20265
20281
|
const streamSignalsInterface = { listSignals: (input) => dispatch("stream-signals", "streamSignals", "listSignals", "query", input) };
|
|
20266
20282
|
const switchInterface = {
|
|
20267
20283
|
setState: (input) => dispatch("switch", "switch", "setState", "mutation", input),
|
|
20284
|
+
toggle: (input) => dispatch("switch", "switch", "toggle", "mutation", input),
|
|
20268
20285
|
getStatus: (input) => dispatch("switch", "switch", "getStatus", "query", input)
|
|
20269
20286
|
};
|
|
20270
20287
|
const tamperInterface = { getStatus: (input) => dispatch("tamper", "tamper", "getStatus", "query", input) };
|