@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.
@@ -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
- id: "switch.on",
7953
- method: "setState",
7954
- label: {
7955
- en: "Turn on",
7956
- it: "Accendi"
7957
- },
7958
- phrase: {
7959
- en: "Turn on {device}",
7960
- it: "Accendi {device}"
7961
- },
7962
- icon: "power",
7963
- args: { on: true },
7964
- effect: {
7965
- field: "on",
7966
- value: true
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
- phrase: {
7976
- en: "Turn off {device}",
7977
- it: "Spegni {device}"
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
- icon: "power-off",
7980
- args: { on: false },
7981
- effect: {
7982
- field: "on",
7983
- value: false
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
- id: "switch.on",
7953
- method: "setState",
7954
- label: {
7955
- en: "Turn on",
7956
- it: "Accendi"
7957
- },
7958
- phrase: {
7959
- en: "Turn on {device}",
7960
- it: "Accendi {device}"
7961
- },
7962
- icon: "power",
7963
- args: { on: true },
7964
- effect: {
7965
- field: "on",
7966
- value: true
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
- phrase: {
7976
- en: "Turn off {device}",
7977
- it: "Spegni {device}"
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
- icon: "power-off",
7980
- args: { on: false },
7981
- effect: {
7982
- field: "on",
7983
- value: false
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) };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/types",
3
- "version": "1.2.562",
3
+ "version": "1.2.563",
4
4
  "description": "Shared types, interfaces, and model catalogs for the CamStack detection ecosystem",
5
5
  "keywords": [
6
6
  "camstack",