@camstack/types 1.2.299 → 1.2.302

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/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_sleep = require("./sleep-G4F3X9X_.js");
2
+ const require_sleep = require("./sleep-C3gDpn7G.js");
3
3
  const require_event_category = require("./event-category-DmS_tLsU.js");
4
4
  const require_composition = require("./composition-BLWAivB2.js");
5
5
  const require_err_msg = require("./err-msg-Dx2Kor0g.js");
@@ -17904,6 +17904,17 @@ var SendResultSchema = zod.z.object({
17904
17904
  });
17905
17905
  /** Same shape as SendResult — kept as a distinct name for the test panel. */
17906
17906
  var TestResultSchema = SendResultSchema;
17907
+ /**
17908
+ * Pre-save credential probe against a partial (unsaved) target config.
17909
+ * `resolvedUrl` never includes secrets (token stripped from path).
17910
+ */
17911
+ var ProbeTargetConfigResultSchema = zod.z.object({
17912
+ ok: zod.z.boolean(),
17913
+ resolvedUrl: zod.z.string(),
17914
+ httpStatus: zod.z.number().int().optional(),
17915
+ stateInstance: zod.z.string().optional(),
17916
+ error: zod.z.string().optional()
17917
+ });
17907
17918
  var notificationOutputCapability = {
17908
17919
  name: "notification-output",
17909
17920
  scope: "system",
@@ -17911,10 +17922,32 @@ var notificationOutputCapability = {
17911
17922
  methods: {
17912
17923
  listTargetKinds: require_sleep.method(zod.z.object({}), zod.z.array(TargetKindSchema)),
17913
17924
  listTargets: require_sleep.method(zod.z.object({}), zod.z.array(TargetSchema), { auth: "admin" }),
17925
+ /**
17926
+ * One target WITH secrets — admin edit / duplicate hydration only.
17927
+ * `listTargets` stays redacted; the editor loads this so password fields
17928
+ * are filled (masked in the input) and a save can round-trip the token
17929
+ * when a destination changes (Duplicate with a new chatId, etc.).
17930
+ */
17931
+ getTarget: require_sleep.method(zod.z.object({ targetId: zod.z.string() }), TargetSchema, { auth: "admin" }),
17914
17932
  discoverTargets: require_sleep.method(zod.z.object({
17915
17933
  kind: zod.z.string(),
17916
- config: zod.z.record(zod.z.string(), zod.z.unknown()).optional()
17934
+ config: zod.z.record(zod.z.string(), zod.z.unknown()).optional(),
17935
+ /**
17936
+ * When editing / duplicating, the blank password field never round-trips
17937
+ * the stored token. Pass the source target id so the provider can restore
17938
+ * secrets server-side before dialling (same merge as upsert).
17939
+ */
17940
+ targetId: zod.z.string().optional()
17917
17941
  }), zod.z.array(DiscoveredTargetSchema), { auth: "admin" }),
17942
+ probeTargetConfig: require_sleep.method(zod.z.object({
17943
+ kind: zod.z.string(),
17944
+ config: zod.z.record(zod.z.string(), zod.z.unknown()),
17945
+ /** See `discoverTargets.targetId` — restore stored secrets for a blank password. */
17946
+ targetId: zod.z.string().optional()
17947
+ }), ProbeTargetConfigResultSchema, {
17948
+ kind: "mutation",
17949
+ auth: "admin"
17950
+ }),
17918
17951
  send: require_sleep.method(zod.z.object({
17919
17952
  targetId: zod.z.string(),
17920
17953
  notification: NotificationSchema
@@ -17929,7 +17962,16 @@ var notificationOutputCapability = {
17929
17962
  kind: "mutation",
17930
17963
  auth: "admin"
17931
17964
  }),
17932
- upsertTarget: require_sleep.method(zod.z.object({ target: TargetSchema }), TargetSchema, {
17965
+ upsertTarget: require_sleep.method(zod.z.object({
17966
+ target: TargetSchema,
17967
+ /**
17968
+ * Duplicate flow: create a NEW target id while copying secrets from an
17969
+ * existing row. The UI never holds the stored token; blank / redacted
17970
+ * password fields are restored from this source (D634 still applies if
17971
+ * destinations diverge without a re-typed secret).
17972
+ */
17973
+ cloneSecretsFrom: zod.z.string().optional()
17974
+ }), TargetSchema, {
17933
17975
  kind: "mutation",
17934
17976
  auth: "admin"
17935
17977
  }),
@@ -18950,6 +18992,15 @@ var AlarmArmModeSchema = zod.z.enum([
18950
18992
  var AlarmPanelStatusSchema = zod.z.object({
18951
18993
  /** Current lifecycle state. */
18952
18994
  state: AlarmStateSchema,
18995
+ /**
18996
+ * The arm mode the machine belongs to under transitional words
18997
+ * (`arming` / `pending` / `triggered` / `disarming`). `null` when
18998
+ * disarmed or when a provider cannot name one. Exporters MUST prefer
18999
+ * this over an in-process memo — a HomeKit accessory that missed the
19000
+ * settled `armed_*` slice used to map `pending` to DISARMED and hide
19001
+ * an entry delay.
19002
+ */
19003
+ targetMode: AlarmArmModeSchema.nullable().optional(),
18953
19004
  /** Subset of arm modes the panel accepts. UI renders one button per
18954
19005
  * mode in this list. */
18955
19006
  availableModes: zod.z.array(AlarmArmModeSchema),
@@ -47080,7 +47131,8 @@ function roomCompositionExample(input) {
47080
47131
  return require_composition.CompositionSchema.parse({
47081
47132
  target: {
47082
47133
  kind: "new",
47083
- type: require_err_msg.DeviceType.Sensor
47134
+ type: require_err_msg.DeviceType.Sensor,
47135
+ role: require_err_msg.DeviceRole.TemperatureSensor
47084
47136
  },
47085
47137
  features: [{
47086
47138
  kind: "fields",
@@ -53502,6 +53554,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
53502
53554
  addonId: null,
53503
53555
  access: "view"
53504
53556
  },
53557
+ "notificationOutput.getTarget": {
53558
+ capName: "notification-output",
53559
+ capScope: "system",
53560
+ addonId: null,
53561
+ access: "view"
53562
+ },
53505
53563
  "notificationOutput.listTargetKinds": {
53506
53564
  capName: "notification-output",
53507
53565
  capScope: "system",
@@ -53514,6 +53572,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
53514
53572
  addonId: null,
53515
53573
  access: "view"
53516
53574
  },
53575
+ "notificationOutput.probeTargetConfig": {
53576
+ capName: "notification-output",
53577
+ capScope: "system",
53578
+ addonId: null,
53579
+ access: "create"
53580
+ },
53517
53581
  "notificationOutput.send": {
53518
53582
  capName: "notification-output",
53519
53583
  capScope: "system",
@@ -57636,6 +57700,199 @@ var DEVICE_DO_ACTIONS = [
57636
57700
  method: "stop",
57637
57701
  args: {}
57638
57702
  },
57703
+ {
57704
+ id: "climate.off",
57705
+ label: "Climate off",
57706
+ cap: "climate-control",
57707
+ method: "setMode",
57708
+ args: { mode: "off" }
57709
+ },
57710
+ {
57711
+ id: "climate.heat",
57712
+ label: "Heat",
57713
+ cap: "climate-control",
57714
+ method: "setMode",
57715
+ args: { mode: "heat" }
57716
+ },
57717
+ {
57718
+ id: "climate.cool",
57719
+ label: "Cool",
57720
+ cap: "climate-control",
57721
+ method: "setMode",
57722
+ args: { mode: "cool" }
57723
+ },
57724
+ {
57725
+ id: "climate.auto",
57726
+ label: "Climate auto",
57727
+ cap: "climate-control",
57728
+ method: "setMode",
57729
+ args: { mode: "auto" }
57730
+ },
57731
+ {
57732
+ id: "fan.off",
57733
+ label: "Fan off",
57734
+ cap: "fan-control",
57735
+ method: "setPercentage",
57736
+ args: { percentage: 0 }
57737
+ },
57738
+ {
57739
+ id: "fan.full",
57740
+ label: "Fan full",
57741
+ cap: "fan-control",
57742
+ method: "setPercentage",
57743
+ args: { percentage: 100 }
57744
+ },
57745
+ {
57746
+ id: "vacuum.start",
57747
+ label: "Start cleaning",
57748
+ cap: "vacuum-control",
57749
+ method: "start",
57750
+ args: {}
57751
+ },
57752
+ {
57753
+ id: "vacuum.pause",
57754
+ label: "Pause",
57755
+ cap: "vacuum-control",
57756
+ method: "pause",
57757
+ args: {}
57758
+ },
57759
+ {
57760
+ id: "vacuum.stop",
57761
+ label: "Stop",
57762
+ cap: "vacuum-control",
57763
+ method: "stop",
57764
+ args: {}
57765
+ },
57766
+ {
57767
+ id: "vacuum.dock",
57768
+ label: "Return to base",
57769
+ cap: "vacuum-control",
57770
+ method: "returnToBase",
57771
+ args: {}
57772
+ },
57773
+ {
57774
+ id: "ptz.goHome",
57775
+ label: "PTZ go home",
57776
+ cap: "ptz",
57777
+ method: "goHome",
57778
+ args: {}
57779
+ },
57780
+ {
57781
+ id: "ptz.goToPreset",
57782
+ label: "PTZ go to preset",
57783
+ cap: "ptz",
57784
+ method: "goToPreset",
57785
+ openArgs: [{
57786
+ key: "presetId",
57787
+ label: "Preset id",
57788
+ kind: "string"
57789
+ }]
57790
+ },
57791
+ {
57792
+ id: "ptz.autotrackOn",
57793
+ label: "Autotrack on",
57794
+ cap: "ptz-autotrack",
57795
+ method: "setEnabled",
57796
+ args: { enabled: true }
57797
+ },
57798
+ {
57799
+ id: "ptz.autotrackOff",
57800
+ label: "Autotrack off",
57801
+ cap: "ptz-autotrack",
57802
+ method: "setEnabled",
57803
+ args: { enabled: false }
57804
+ },
57805
+ {
57806
+ id: "privacy.maskOn",
57807
+ label: "Privacy mask on",
57808
+ cap: "privacy-mask",
57809
+ method: "setMask",
57810
+ args: { patch: { enabled: true } }
57811
+ },
57812
+ {
57813
+ id: "privacy.maskOff",
57814
+ label: "Privacy mask off",
57815
+ cap: "privacy-mask",
57816
+ method: "setMask",
57817
+ args: { patch: { enabled: false } }
57818
+ },
57819
+ {
57820
+ id: "privacy.micOn",
57821
+ label: "Microphone on",
57822
+ cap: "privacy-mask",
57823
+ method: "setAudioEnabled",
57824
+ args: { enabled: true }
57825
+ },
57826
+ {
57827
+ id: "privacy.micOff",
57828
+ label: "Microphone off",
57829
+ cap: "privacy-mask",
57830
+ method: "setAudioEnabled",
57831
+ args: { enabled: false }
57832
+ },
57833
+ {
57834
+ id: "dayNight.auto",
57835
+ label: "Day/night auto",
57836
+ cap: "day-night",
57837
+ method: "setSettings",
57838
+ args: { settings: { mode: "auto" } }
57839
+ },
57840
+ {
57841
+ id: "dayNight.day",
57842
+ label: "Day mode",
57843
+ cap: "day-night",
57844
+ method: "setSettings",
57845
+ args: { settings: { mode: "day" } }
57846
+ },
57847
+ {
57848
+ id: "dayNight.night",
57849
+ label: "Night mode",
57850
+ cap: "day-night",
57851
+ method: "setSettings",
57852
+ args: { settings: { mode: "night" } }
57853
+ },
57854
+ {
57855
+ id: "reboot.reboot",
57856
+ label: "Reboot device",
57857
+ cap: "reboot",
57858
+ method: "reboot",
57859
+ args: {}
57860
+ },
57861
+ {
57862
+ id: "brightness.full",
57863
+ label: "Brightness full",
57864
+ cap: "brightness",
57865
+ method: "setBrightness",
57866
+ args: { percentage: 100 }
57867
+ },
57868
+ {
57869
+ id: "brightness.half",
57870
+ label: "Brightness half",
57871
+ cap: "brightness",
57872
+ method: "setBrightness",
57873
+ args: { percentage: 50 }
57874
+ },
57875
+ {
57876
+ id: "brightness.off",
57877
+ label: "Brightness off",
57878
+ cap: "brightness",
57879
+ method: "setBrightness",
57880
+ args: { percentage: 0 }
57881
+ },
57882
+ {
57883
+ id: "motionTrigger.on",
57884
+ label: "Motion trigger on",
57885
+ cap: "motion-trigger",
57886
+ method: "setMotionTrigger",
57887
+ args: { enabled: true }
57888
+ },
57889
+ {
57890
+ id: "motionTrigger.off",
57891
+ label: "Motion trigger off",
57892
+ cap: "motion-trigger",
57893
+ method: "setMotionTrigger",
57894
+ args: { enabled: false }
57895
+ },
57639
57896
  {
57640
57897
  id: "alarm.trigger",
57641
57898
  label: "Trigger alarm",
@@ -57703,15 +57960,42 @@ function isDoActionActuatable(action) {
57703
57960
  }
57704
57961
  return false;
57705
57962
  }
57706
- function argsEqual(left, right) {
57707
- const a = left ?? {};
57708
- const b = right ?? {};
57963
+ function valueEqual(left, right) {
57964
+ if (left === right) return true;
57965
+ if (left === null || right === null) return left === right;
57966
+ if (typeof left !== "object" || typeof right !== "object") return false;
57967
+ if (Array.isArray(left) || Array.isArray(right)) {
57968
+ if (!Array.isArray(left) || !Array.isArray(right)) return false;
57969
+ if (left.length !== right.length) return false;
57970
+ for (let i = 0; i < left.length; i++) if (!valueEqual(left[i], right[i])) return false;
57971
+ return true;
57972
+ }
57973
+ const a = left;
57974
+ const b = right;
57709
57975
  const aKeys = Object.keys(a);
57710
57976
  const bKeys = Object.keys(b);
57711
57977
  if (aKeys.length !== bKeys.length) return false;
57712
- for (const key of aKeys) if (a[key] !== b[key]) return false;
57978
+ for (const key of aKeys) if (!valueEqual(a[key], b[key])) return false;
57713
57979
  return true;
57714
57980
  }
57981
+ function argsEqual(left, right) {
57982
+ return valueEqual(left ?? {}, right ?? {});
57983
+ }
57984
+ /** Baked args only — open-arg keys the operator fills are ignored for matching. */
57985
+ function bakedArgsEqual(action, args) {
57986
+ if (action.openArgs !== void 0) {
57987
+ const open = new Set(action.openArgs.map((a) => a.key));
57988
+ const baked = action.args ?? {};
57989
+ const actual = args ?? {};
57990
+ for (const key of Object.keys(baked)) if (!valueEqual(baked[key], actual[key])) return false;
57991
+ for (const key of Object.keys(actual)) {
57992
+ if (open.has(key)) continue;
57993
+ if (!(key in baked)) return false;
57994
+ }
57995
+ return true;
57996
+ }
57997
+ return argsEqual(action.args, args);
57998
+ }
57715
57999
  /**
57716
58000
  * Actions offered for a device that binds the given caps.
57717
58001
  *
@@ -57734,7 +58018,7 @@ function allDoActions() {
57734
58018
  function matchDoAction(cap, method, args) {
57735
58019
  for (const action of DEVICE_DO_ACTIONS) {
57736
58020
  if (action.cap !== cap || action.method !== method) continue;
57737
- if (!argsEqual(action.args, args)) continue;
58021
+ if (!bakedArgsEqual(action, args)) continue;
57738
58022
  return action;
57739
58023
  }
57740
58024
  return null;
@@ -64967,7 +65251,9 @@ function createSystemProxy(api) {
64967
65251
  notificationOutput: {
64968
65252
  listTargetKinds: (input) => dispatch("notificationOutput", "listTargetKinds", "query", input),
64969
65253
  listTargets: (input) => dispatch("notificationOutput", "listTargets", "query", input),
65254
+ getTarget: (input) => dispatch("notificationOutput", "getTarget", "query", input),
64970
65255
  discoverTargets: (input) => dispatch("notificationOutput", "discoverTargets", "query", input),
65256
+ probeTargetConfig: (input) => dispatch("notificationOutput", "probeTargetConfig", "mutation", input),
64971
65257
  send: (input) => dispatch("notificationOutput", "send", "mutation", input),
64972
65258
  testTarget: (input) => dispatch("notificationOutput", "testTarget", "mutation", input),
64973
65259
  upsertTarget: (input) => dispatch("notificationOutput", "upsertTarget", "mutation", input),
@@ -68701,6 +68987,34 @@ function sendTimesOfSchedule(schedule) {
68701
68987
  }
68702
68988
  return times;
68703
68989
  }
68990
+ /**
68991
+ * Punctual times for a `mode: 'times'` editor.
68992
+ *
68993
+ * Exact one-minute windows win. Otherwise each window's END is the fire time
68994
+ * (summary delivery fires when a window closes) — so a legacy 17:00→18:00 band
68995
+ * authored as a range still opens as a single "At 18:00" row instead of two
68996
+ * clocks. `null` only when inverted (cannot map to punctual rows).
68997
+ */
68998
+ function sendTimesForEditor(schedule) {
68999
+ const exact = sendTimesOfSchedule(schedule);
69000
+ if (exact !== null) return {
69001
+ times: exact,
69002
+ approximated: false
69003
+ };
69004
+ if (schedule.invert === true) return null;
69005
+ const times = [];
69006
+ for (const window of schedule.windows) {
69007
+ const days = window.endMinute === 0 ? window.days.map((day) => (day + 1) % 7) : window.days;
69008
+ times.push({
69009
+ days: days.toSorted((a, b) => a - b),
69010
+ minute: window.endMinute
69011
+ });
69012
+ }
69013
+ return {
69014
+ times,
69015
+ approximated: times.length > 0
69016
+ };
69017
+ }
68704
69018
  var SUMMARY_CONTENT_VAR = /\{\{\s*summary(?:Text|Devices|Streams|Battery|Consumables|Tanks|Detection|Nodes|Addons|Updates)\s*\}\}/;
68705
69019
  /**
68706
69020
  * Does a custom BODY carry the summary's content (`{{summaryText}}` or a
@@ -72856,6 +73170,7 @@ exports.PrivacyMaskPatchSchema = PrivacyMaskPatchSchema;
72856
73170
  exports.PrivacyMaskRegionSchema = PrivacyMaskRegionSchema;
72857
73171
  exports.PrivacyMaskShapeSchema = PrivacyMaskShapeSchema;
72858
73172
  exports.PrivacyMaskStatusSchema = PrivacyMaskStatusSchema;
73173
+ exports.ProbeTargetConfigResultSchema = ProbeTargetConfigResultSchema;
72859
73174
  exports.ProfileRtspEntrySchema = require_sleep.ProfileRtspEntrySchema;
72860
73175
  exports.ProfileSlotSchema = require_sleep.ProfileSlotSchema;
72861
73176
  exports.ProfileSlotStatusSchema = require_sleep.ProfileSlotStatusSchema;
@@ -73809,6 +74124,7 @@ exports.scriptRunnerCapability = scriptRunnerCapability;
73809
74124
  exports.searchDisplayIcons = searchDisplayIcons;
73810
74125
  exports.secureActuationFor = secureActuationFor;
73811
74126
  exports.selectAssignedProfileSlots = require_sleep.selectAssignedProfileSlots;
74127
+ exports.sendTimesForEditor = sendTimesForEditor;
73812
74128
  exports.sendTimesOfSchedule = sendTimesOfSchedule;
73813
74129
  exports.sensorRaisedOf = sensorRaisedOf;
73814
74130
  exports.sensorTransitionNeverFires = sensorTransitionNeverFires;