@camstack/types 1.2.554 → 1.2.555

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.
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Most bytes a decoded IR code may hold: two bytes per timing. A level-1 stream
3
+ * can expand ~130x, so the decoder checks this bound before every write.
4
+ */
5
+ export declare const IR_DECOMPRESSED_MAX: number;
6
+ export declare function fastlzDecompress(input: Uint8Array): Uint8Array;
7
+ export declare function fastlzCompress(input: Uint8Array): Uint8Array;
@@ -5,3 +5,5 @@ export * from './pronto.js';
5
5
  export * from './samsung.js';
6
6
  export * from './smartir.js';
7
7
  export * from './flipper.js';
8
+ export * from './tuya.js';
9
+ export * from './native.js';
@@ -1,5 +1,5 @@
1
1
  /** Why an IR/RF codec refused an input. Callers branch on the code, never on the message. */
2
- export type IrCodecErrorCode = 'invalid-timings' | 'invalid-raw' | 'pronto-malformed' | 'pronto-unsupported-form' | 'smartir-malformed' | 'samsung-invalid' | 'flipper-malformed';
2
+ export type IrCodecErrorCode = 'invalid-timings' | 'invalid-raw' | 'pronto-malformed' | 'pronto-unsupported-form' | 'smartir-malformed' | 'samsung-invalid' | 'flipper-malformed' | 'tuya-malformed';
3
3
  export declare class IrCodecError extends Error {
4
4
  readonly code: IrCodecErrorCode;
5
5
  constructor(code: IrCodecErrorCode, message: string);
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { type IrTimings, type TransmitSettings } from './ir-timings.js';
3
- /** What a remote command stores: a raw pulse train, or a learned Pronto code. */
3
+ /** What a remote command stores: a raw pulse train, a learned Pronto code, or a device-native code. */
4
4
  export declare const IrPayloadSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
5
5
  kind: z.ZodLiteral<"raw">;
6
6
  timings: z.ZodArray<z.ZodNumber>;
@@ -13,6 +13,12 @@ export declare const IrPayloadSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
13
13
  }, z.core.$strip>, z.ZodObject<{
14
14
  kind: z.ZodLiteral<"pronto">;
15
15
  code: z.ZodString;
16
+ }, z.core.$strip>, z.ZodObject<{
17
+ kind: z.ZodLiteral<"native">;
18
+ format: z.ZodEnum<{
19
+ tuya: "tuya";
20
+ }>;
21
+ code: z.ZodString;
16
22
  }, z.core.$strip>], "kind">;
17
23
  export type IrPayload = z.infer<typeof IrPayloadSchema>;
18
24
  export interface ResolvedTransmission {
@@ -0,0 +1,24 @@
1
+ import { z } from 'zod';
2
+ import type { IrTimings } from './ir-timings.js';
3
+ /** Device-native IR code formats a transmitter can replay verbatim. */
4
+ export declare const IrNativeFormatSchema: z.ZodEnum<{
5
+ tuya: "tuya";
6
+ }>;
7
+ export type IrNativeFormat = z.infer<typeof IrNativeFormatSchema>;
8
+ /**
9
+ * Longest native code accepted: base64 of the worst-case compressed stream
10
+ * (every decoded byte as a literal, plus one control byte per 32), with margin.
11
+ */
12
+ export declare const IR_NATIVE_CODE_MAX_CHARS: number;
13
+ export declare const IrNativeCodeSchema: z.ZodObject<{
14
+ format: z.ZodEnum<{
15
+ tuya: "tuya";
16
+ }>;
17
+ code: z.ZodString;
18
+ }, z.core.$strip>;
19
+ export type IrNativeCode = z.infer<typeof IrNativeCodeSchema>;
20
+ export interface IrNativeCodec {
21
+ encode(timings: IrTimings): string;
22
+ decode(code: string): IrTimings;
23
+ }
24
+ export declare const IR_NATIVE_CODECS: Record<IrNativeFormat, IrNativeCodec>;
@@ -0,0 +1,5 @@
1
+ import { type IrTimings } from './ir-timings.js';
2
+ /** Signed pulse train to a Tuya IR code: base64(FastLZ(uint16 LE durations)). */
3
+ export declare function encodeTuya(timings: IrTimings): string;
4
+ /** A Tuya IR code to a signed pulse train (mark first). Throws `IrCodecError`. */
5
+ export declare function decodeTuya(code: string): IrTimings;
@@ -89,6 +89,12 @@ export declare const RemoteConfigSchema: z.ZodObject<{
89
89
  }, z.core.$strip>, z.ZodObject<{
90
90
  kind: z.ZodLiteral<"pronto">;
91
91
  code: z.ZodString;
92
+ }, z.core.$strip>, z.ZodObject<{
93
+ kind: z.ZodLiteral<"native">;
94
+ format: z.ZodEnum<{
95
+ tuya: "tuya";
96
+ }>;
97
+ code: z.ZodString;
92
98
  }, z.core.$strip>], "kind">;
93
99
  }, z.core.$strip>], "kind">>>;
94
100
  stepDelayMs: z.ZodDefault<z.ZodNumber>;
@@ -57,6 +57,12 @@ export declare const RemoteIrSourceSchema: z.ZodObject<{
57
57
  }, z.core.$strip>, z.ZodObject<{
58
58
  kind: z.ZodLiteral<"pronto">;
59
59
  code: z.ZodString;
60
+ }, z.core.$strip>, z.ZodObject<{
61
+ kind: z.ZodLiteral<"native">;
62
+ format: z.ZodEnum<{
63
+ tuya: "tuya";
64
+ }>;
65
+ code: z.ZodString;
60
66
  }, z.core.$strip>], "kind">;
61
67
  }, z.core.$strip>;
62
68
  export type RemoteIrSource = z.infer<typeof RemoteIrSourceSchema>;
@@ -87,6 +93,12 @@ export declare const RemoteSourceSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
87
93
  }, z.core.$strip>, z.ZodObject<{
88
94
  kind: z.ZodLiteral<"pronto">;
89
95
  code: z.ZodString;
96
+ }, z.core.$strip>, z.ZodObject<{
97
+ kind: z.ZodLiteral<"native">;
98
+ format: z.ZodEnum<{
99
+ tuya: "tuya";
100
+ }>;
101
+ code: z.ZodString;
90
102
  }, z.core.$strip>], "kind">;
91
103
  }, z.core.$strip>], "kind">;
92
104
  export type RemoteSource = z.infer<typeof RemoteSourceSchema>;
@@ -9497,7 +9497,10 @@ var ACTUATOR_CAP_VOCABULARY = {
9497
9497
  "ir-transmitter": {
9498
9498
  scope: "device",
9499
9499
  noun: t("IR / RF transmitter", "Trasmettitore IR / RF"),
9500
- notOperatorFacing: { send: "a raw pulse train is not something an operator composes in an automation; the remote that owns the command table sends it" }
9500
+ notOperatorFacing: {
9501
+ send: "a raw pulse train is not something an operator composes in an automation; the remote that owns the command table sends it",
9502
+ learn: "an interactive capture the operator starts from the source dialog and answers by pressing a physical remote; no automation can supply the signal"
9503
+ }
9501
9504
  },
9502
9505
  control: {
9503
9506
  scope: "device",
@@ -15806,6 +15809,7 @@ function createDeviceProxy(api, binding, opts) {
15806
15809
  };
15807
15810
  const irTransmitterInterface = {
15808
15811
  send: (input) => dispatch("ir-transmitter", "irTransmitter", "send", "mutation", input),
15812
+ learn: (input) => dispatch("ir-transmitter", "irTransmitter", "learn", "mutation", input),
15809
15813
  getInfo: (input) => dispatch("ir-transmitter", "irTransmitter", "getInfo", "query", input)
15810
15814
  };
15811
15815
  const lawnMowerControlInterface = {
@@ -9497,7 +9497,10 @@ var ACTUATOR_CAP_VOCABULARY = {
9497
9497
  "ir-transmitter": {
9498
9498
  scope: "device",
9499
9499
  noun: t("IR / RF transmitter", "Trasmettitore IR / RF"),
9500
- notOperatorFacing: { send: "a raw pulse train is not something an operator composes in an automation; the remote that owns the command table sends it" }
9500
+ notOperatorFacing: {
9501
+ send: "a raw pulse train is not something an operator composes in an automation; the remote that owns the command table sends it",
9502
+ learn: "an interactive capture the operator starts from the source dialog and answers by pressing a physical remote; no automation can supply the signal"
9503
+ }
9501
9504
  },
9502
9505
  control: {
9503
9506
  scope: "device",
@@ -15806,6 +15809,7 @@ function createDeviceProxy(api, binding, opts) {
15806
15809
  };
15807
15810
  const irTransmitterInterface = {
15808
15811
  send: (input) => dispatch("ir-transmitter", "irTransmitter", "send", "mutation", input),
15812
+ learn: (input) => dispatch("ir-transmitter", "irTransmitter", "learn", "mutation", input),
15809
15813
  getInfo: (input) => dispatch("ir-transmitter", "irTransmitter", "getInfo", "query", input)
15810
15814
  };
15811
15815
  const lawnMowerControlInterface = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/types",
3
- "version": "1.2.554",
3
+ "version": "1.2.555",
4
4
  "description": "Shared types, interfaces, and model catalogs for the CamStack detection ecosystem",
5
5
  "keywords": [
6
6
  "camstack",