@camstack/types 1.2.588 → 1.2.589

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,8 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_sleep = require("./sleep-CsZJsb8n.js");
2
+ const require_sleep = require("./sleep-CICYFVJf.js");
3
3
  const require_event_category = require("./event-category-CE_VCE2G.js");
4
- const require_composed_stable_id = require("./composed-stable-id-CVbyajE5.js");
5
- const require_implemented_methods = require("./implemented-methods-ChtdIofW.js");
4
+ const require_composed_stable_id = require("./composed-stable-id-DDv-Og0u.js");
5
+ const require_implemented_methods = require("./implemented-methods-CbdShcW1.js");
6
6
  const require_node_color = require("./node-color.js");
7
7
  const require_convert = require("./convert-BI8iTXn6.js");
8
8
  const require_device_template_catalogue = require("./device-template-catalogue.js");
@@ -30566,6 +30566,70 @@ var PreferencesChangedSinceOutputSchema = zod.z.object({
30566
30566
  deleted: zod.z.array(PreferenceNamespaceSchema)
30567
30567
  });
30568
30568
  //#endregion
30569
+ //#region src/schemas/api-catalog.ts
30570
+ /**
30571
+ * The wire shapes of `apiCatalog.*` — the API explorer's data (planning#595).
30572
+ *
30573
+ * One entry per tRPC method the hub serves, capability and core routes alike,
30574
+ * read off the live router by the hub (never a hand-written list).
30575
+ */
30576
+ var ApiProcedureKindSchema = zod.z.enum([
30577
+ "query",
30578
+ "mutation",
30579
+ "subscription"
30580
+ ]);
30581
+ /** The gate a method runs behind. */
30582
+ var ApiProcedureTierSchema = zod.z.enum([
30583
+ "public",
30584
+ "protected",
30585
+ "admin"
30586
+ ]);
30587
+ /** The token scope a capability route is matched against (its `METHOD_ACCESS_MAP` row). */
30588
+ var ApiCatalogScopeSchema = zod.z.object({
30589
+ capName: zod.z.string(),
30590
+ capScope: zod.z.enum(["device", "system"]),
30591
+ access: zod.z.enum([
30592
+ "view",
30593
+ "create",
30594
+ "delete"
30595
+ ]),
30596
+ role: zod.z.string()
30597
+ });
30598
+ var ApiCatalogEntrySchema = zod.z.object({
30599
+ /** `<router>.<method>` — the tRPC path. */
30600
+ path: zod.z.string(),
30601
+ router: zod.z.string(),
30602
+ method: zod.z.string(),
30603
+ kind: ApiProcedureKindSchema,
30604
+ tier: ApiProcedureTierSchema,
30605
+ source: zod.z.enum(["capability", "core"]),
30606
+ /** `null` on a core route: it needs authentication only (plus admin where its tier says so). */
30607
+ scope: ApiCatalogScopeSchema.nullable(),
30608
+ hasInput: zod.z.boolean()
30609
+ });
30610
+ /**
30611
+ * May the CALLER call a method. The list has no input, so a method reached
30612
+ * only through a device grant is `per-device`: the real call is allowed or
30613
+ * refused on the device its input names.
30614
+ */
30615
+ var ApiCallableSchema = zod.z.enum([
30616
+ "yes",
30617
+ "no",
30618
+ "per-device"
30619
+ ]);
30620
+ var ApiCatalogMethodSchema = ApiCatalogEntrySchema.extend({ callable: ApiCallableSchema });
30621
+ var ApiCatalogListOutputSchema = zod.z.object({ methods: zod.z.array(ApiCatalogMethodSchema) });
30622
+ /** A JSON Schema document, as the explorer receives it. */
30623
+ var JsonSchemaDocumentSchema = zod.z.record(zod.z.string(), zod.z.unknown());
30624
+ var ApiCatalogInputSchemaOutputSchema = zod.z.object({
30625
+ path: zod.z.string(),
30626
+ hasInput: zod.z.boolean(),
30627
+ /** The INPUT JSON schema (what the caller sends); `null` without input or when it could not be produced. */
30628
+ schema: JsonSchemaDocumentSchema.nullable(),
30629
+ /** Why no schema could be produced (a non-Zod parser, an unrepresentable type). */
30630
+ error: zod.z.string().nullable()
30631
+ });
30632
+ //#endregion
30569
30633
  //#region src/auth/app-callback.ts
30570
30634
  /**
30571
30635
  * The viewer app's custom-scheme callback — the ONE list of URLs a hub flow
@@ -41536,9 +41600,8 @@ var airQualitySensorCapability = {
41536
41600
  * Many panels require a PIN code on arm / disarm — the optional
41537
41601
  * `code` field on the methods passes it through to the upstream
41538
41602
  * service; it's NEVER persisted in the runtime slice or any event
41539
- * payload. The presence of a required code is signalled by
41540
- * `DeviceFeature.AlarmPinRequired` so the UI gates a code-entry
41541
- * field without a slice fetch.
41603
+ * payload. Whether a code is required is the slice's `codeRequired`
41604
+ * (#459): `null` when the provider cannot tell (D393).
41542
41605
  *
41543
41606
  * `availableModes` mirrors HA's `supported_features`-derived arm
41544
41607
  * mode list — the UI renders only the buttons the panel accepts.
@@ -41577,9 +41640,13 @@ var AlarmPanelStatusSchema = zod.z.object({
41577
41640
  /** Subset of arm modes the panel accepts. UI renders one button per
41578
41641
  * mode in this list. */
41579
41642
  availableModes: zod.z.array(AlarmArmModeSchema),
41580
- /** Whether the panel requires a PIN on arm / disarm. Mirrors
41581
- * `DeviceFeature.AlarmPinRequired` for slice consumers. */
41582
- requiresCode: zod.z.boolean(),
41643
+ /**
41644
+ * Whether the panel requires a PIN on arm / disarm (#459; the field was
41645
+ * `requiresCode`, and the `alarm-pin-required` device feature is gone).
41646
+ * `null` = the provider cannot tell (D393), never `false`. A slice restored
41647
+ * from before the rename is upgraded at boot by `restoredFieldRenames`.
41648
+ */
41649
+ codeRequired: zod.z.boolean().nullable(),
41583
41650
  /** Ms epoch when the slice was last updated. */
41584
41651
  lastChangedAt: zod.z.number()
41585
41652
  });
@@ -41636,7 +41703,7 @@ var alarmPanelCapability = {
41636
41703
  arm: require_sleep.method(zod.z.object({
41637
41704
  deviceId: zod.z.number().int().nonnegative(),
41638
41705
  mode: AlarmArmModeSchema,
41639
- /** Optional PIN code. Required when `requiresCode === true`.
41706
+ /** Optional PIN code. Required when `codeRequired === true`.
41640
41707
  * Passed through to the upstream service; never persisted. */
41641
41708
  code: zod.z.string().min(1).optional()
41642
41709
  }), zod.z.void(), {
@@ -41753,7 +41820,7 @@ var alarmPanelCapability = {
41753
41820
  /**
41754
41821
  * Runtime-state slice — mirrored by the kernel. UI panel reads the
41755
41822
  * full slice; renders an arm button per `availableModes` entry and
41756
- * a PIN field iff `requiresCode === true`.
41823
+ * a PIN field iff `codeRequired === true`.
41757
41824
  */
41758
41825
  runtimeState: AlarmPanelStatusSchema,
41759
41826
  /**
@@ -41764,6 +41831,13 @@ var alarmPanelCapability = {
41764
41831
  */
41765
41832
  durability: "restored",
41766
41833
  /**
41834
+ * A slice persisted before #459 carries `requiresCode`; the boot seed reads it
41835
+ * once into `codeRequired` (`restoredPart`), so no reader meets the old key,
41836
+ * and rewrites the row once without it (`seedMirrorFromRow`) — so this entry
41837
+ * can be dropped after every node has booted once on a release that has it.
41838
+ */
41839
+ restoredFieldRenames: { requiresCode: "codeRequired" },
41840
+ /**
41767
41841
  * History (D850): the panel's lifecycle state as an `enum` series —
41768
41842
  * change-only, no floor, so an `arming -> pending -> triggered` sequence of a
41769
41843
  * few seconds keeps every step. Who armed it stays in the events ledger.
@@ -69895,8 +69969,8 @@ var localNetworkCapability = {
69895
69969
  * (workplace keypad locks, hospitality). The optional `code` field
69896
69970
  * on the methods passes it through to the upstream service — the
69897
69971
  * code is NEVER persisted in the runtime slice or any event payload.
69898
- * Locks that REQUIRE a code set `DeviceFeature.LockPinRequired` so
69899
- * the UI gates a code-entry field without a slice fetch.
69972
+ * Whether a lock REQUIRES a code is the slice's `codeRequired` (#459):
69973
+ * `true` / `false` when the provider knows, `null` when it does not (D393).
69900
69974
  *
69901
69975
  * Locks that support a latch-release ("open door") action advertise
69902
69976
  * `DeviceFeature.LockOpen`. The `open` method triggers the latch
@@ -69925,6 +69999,13 @@ var LockControlStatusSchema = zod.z.object({
69925
69999
  /** Lifecycle state of the lock. `jammed` means the motor reported
69926
70000
  * failure to reach the target — operator intervention required. */
69927
70001
  state: LockStateSchema,
70002
+ /**
70003
+ * Whether lock / unlock need a PIN `code` (#459, replaces the
70004
+ * `lock-pin-required` device feature). `null` = the provider cannot tell
70005
+ * (D393) — never `false`. `.optional()` so a restored slice written before
70006
+ * the field still parses; readers treat absent exactly like `null`.
70007
+ */
70008
+ codeRequired: zod.z.boolean().nullable().optional(),
69928
70009
  /** Ms epoch when the slice was last updated. */
69929
70010
  lastChangedAt: zod.z.number()
69930
70011
  });
@@ -115845,8 +115926,8 @@ var ALARM_MODES = [
115845
115926
  "vacation",
115846
115927
  "custom_bypass"
115847
115928
  ];
115848
- function alarmControls(state, modes, requiresCode) {
115849
- if (requiresCode) return [];
115929
+ function alarmControls(state, modes, codeRequired) {
115930
+ if (codeRequired) return [];
115850
115931
  const disarm = asAction(action("alarm.disarm", require_sleep.t("Disarm", "Disinserisci"), "shield-off", "alarm-panel", "disarm", {}, "primary"));
115851
115932
  const arm = (primaryFirst) => modes.map((mode, i) => asAction(action(`alarm.arm.${mode}`, ARM_LABELS[mode], "shield-check", "alarm-panel", "arm", { mode }, primaryFirst && i === 0 ? "primary" : "normal")));
115852
115933
  switch (state) {
@@ -115866,7 +115947,7 @@ var ACCESS_FAMILY_CONTRIBUTIONS = {
115866
115947
  const modes = slice === void 0 ? ALARM_MODES : slice.availableModes;
115867
115948
  return {
115868
115949
  reading: reading("alarm-panel", words?.state ?? "unknown", false, words?.title),
115869
- rows: [row$1("alarm", state === "triggered" ? "shield-alert" : state === "disarmed" ? "shield-off" : "shield-check", joinText([words?.title ?? NOT_REPORTED, since]), alarmControls(state, modes, slice?.requiresCode ?? false))],
115950
+ rows: [row$1("alarm", state === "triggered" ? "shield-alert" : state === "disarmed" ? "shield-off" : "shield-check", joinText([words?.title ?? NOT_REPORTED, since]), alarmControls(state, modes, slice?.codeRequired !== false))],
115870
115951
  ...since === null || words === null ? {} : { facts: [fact("since", "clock", since, state === "triggered" ? "danger" : "muted")] },
115871
115952
  ...words === null ? {} : { tiles: {
115872
115953
  left: [{
@@ -131277,7 +131358,6 @@ var DEVICE_FEATURE_REQUIREMENTS = {
131277
131358
  [require_composed_stable_id.DeviceFeature.FanPreset]: bound("fan-control", ["setPreset"]),
131278
131359
  [require_composed_stable_id.DeviceFeature.FanDirection]: bound("fan-control", ["setDirection"]),
131279
131360
  [require_composed_stable_id.DeviceFeature.FanOscillating]: bound("fan-control", ["setOscillating"]),
131280
- [require_composed_stable_id.DeviceFeature.LockPinRequired]: reported(CAP_PENDING),
131281
131361
  [require_composed_stable_id.DeviceFeature.LockOpen]: bound("lock-control", ["open"]),
131282
131362
  [require_composed_stable_id.DeviceFeature.MediaPlayerSeek]: bound("media-player", ["seek"]),
131283
131363
  [require_composed_stable_id.DeviceFeature.MediaPlayerVolume]: bound("media-player", ["setVolume"]),
@@ -131292,7 +131372,6 @@ var DEVICE_FEATURE_REQUIREMENTS = {
131292
131372
  [require_composed_stable_id.DeviceFeature.MediaPlayerVolumeStep]: bound("media-player", ["volumeUp", "volumeDown"]),
131293
131373
  [require_composed_stable_id.DeviceFeature.MediaPlayerChannelStep]: bound("media-player", ["channelUp", "channelDown"]),
131294
131374
  [require_composed_stable_id.DeviceFeature.MediaPlayerPower]: bound("media-player", ["turnOn", "turnOff"]),
131295
- [require_composed_stable_id.DeviceFeature.AlarmPinRequired]: reported(CAP_PENDING),
131296
131375
  [require_composed_stable_id.DeviceFeature.PresenceGps]: reported(CAP_PENDING),
131297
131376
  [require_composed_stable_id.DeviceFeature.NotifierImage]: reported(CAP_PENDING),
131298
131377
  [require_composed_stable_id.DeviceFeature.NotifierPriority]: reported(CAP_PENDING),
@@ -136438,7 +136517,8 @@ var RUNTIME_STATE_POLICY = {
136438
136517
  },
136439
136518
  "alarm-panel": {
136440
136519
  durability: "restored",
136441
- volatileFields: ["lastChangedAt"]
136520
+ volatileFields: ["lastChangedAt"],
136521
+ renamedFields: { requiresCode: "codeRequired" }
136442
136522
  },
136443
136523
  "ambient-light-sensor": {
136444
136524
  durability: "restored",
@@ -150624,6 +150704,14 @@ exports.AlertSourceSchema = AlertSourceSchema;
150624
150704
  exports.AlertStatusSchema = AlertStatusSchema;
150625
150705
  exports.AmbientLightSensorStatusSchema = AmbientLightSensorStatusSchema;
150626
150706
  exports.AnalyticsLtsSeriesSchema = AnalyticsLtsSeriesSchema;
150707
+ exports.ApiCallableSchema = ApiCallableSchema;
150708
+ exports.ApiCatalogEntrySchema = ApiCatalogEntrySchema;
150709
+ exports.ApiCatalogInputSchemaOutputSchema = ApiCatalogInputSchemaOutputSchema;
150710
+ exports.ApiCatalogListOutputSchema = ApiCatalogListOutputSchema;
150711
+ exports.ApiCatalogMethodSchema = ApiCatalogMethodSchema;
150712
+ exports.ApiCatalogScopeSchema = ApiCatalogScopeSchema;
150713
+ exports.ApiProcedureKindSchema = ApiProcedureKindSchema;
150714
+ exports.ApiProcedureTierSchema = ApiProcedureTierSchema;
150627
150715
  exports.AppFlowPurposeSchema = AppFlowPurposeSchema;
150628
150716
  exports.AppLoginPathSchema = AppLoginPathSchema;
150629
150717
  exports.AppPageLangSchema = AppPageLangSchema;
@@ -151653,6 +151741,7 @@ exports.IrTransmitterAttemptSchema = IrTransmitterAttemptSchema;
151653
151741
  exports.IrTransmitterInfoSchema = IrTransmitterInfoSchema;
151654
151742
  exports.IrTransmitterRuntimeStateSchema = IrTransmitterRuntimeStateSchema;
151655
151743
  exports.IrTransmitterSendRecordSchema = IrTransmitterSendRecordSchema;
151744
+ exports.JsonSchemaDocumentSchema = JsonSchemaDocumentSchema;
151656
151745
  exports.KEYCHAIN_MAX_REFS_PER_CALL = KEYCHAIN_MAX_REFS_PER_CALL;
151657
151746
  exports.KEYCHAIN_RESET_CONFIRMATION = KEYCHAIN_RESET_CONFIRMATION;
151658
151747
  exports.KEYCHAIN_RESET_TRIGGER_ACTOR = KEYCHAIN_RESET_TRIGGER_ACTOR;