@camstack/types 1.2.54 → 1.2.56
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/addon.js +2 -2
- package/dist/addon.mjs +2 -2
- package/dist/auth/principal-scope.d.ts +123 -0
- package/dist/capabilities/index.d.ts +1 -1
- package/dist/capabilities/notification-rules.cap.d.ts +274 -0
- package/dist/capabilities/oauth-integration.cap.d.ts +25 -12
- package/dist/capabilities/osd-manager.cap.d.ts +93 -0
- package/dist/capabilities/sso-bridge.cap.d.ts +4 -1
- package/dist/capabilities/user-management.cap.d.ts +1 -0
- package/dist/enums/event-category.d.ts +7 -0
- package/dist/enums.js +1 -1
- package/dist/enums.mjs +1 -1
- package/dist/{event-category-41fKf-q9.mjs → event-category-Cv9dO26A.mjs} +7 -0
- package/dist/{event-category-BE4PDZ_3.js → event-category-DxZbWydC.js} +7 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +270 -25
- package/dist/index.mjs +264 -26
- package/dist/interfaces/event-bus.d.ts +8 -0
- package/dist/{sleep-CT4lN1ij.mjs → sleep-CeuvKr4N.mjs} +1 -1
- package/dist/{sleep-DfF6vKCf.js → sleep-EX1-qUVR.js} +1 -1
- package/package.json +1 -1
package/dist/addon.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_event_category = require("./event-category-
|
|
3
|
-
const require_sleep = require("./sleep-
|
|
2
|
+
const require_event_category = require("./event-category-DxZbWydC.js");
|
|
3
|
+
const require_sleep = require("./sleep-EX1-qUVR.js");
|
|
4
4
|
const require_err_msg = require("./err-msg-COpsHMw2.js");
|
|
5
5
|
//#region src/generated/collection-array-methods.ts
|
|
6
6
|
/**
|
package/dist/addon.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as EventCategory } from "./event-category-
|
|
2
|
-
import { C as DeviceType, F as readNodePin, L as ReadinessRegistry, O as expandCapMethods, P as nodePin, R as ReadinessTimeoutError, V as scopeKey, a as asJsonObject, d as DEVICE_SCOPED_CAPS, f as isDeviceScopedCap, gt as normalizeAddonInitResult, ht as BaseAddon, mt as DisposerChain, p as createDeviceProxy, pt as DATAPLANE_SECRET_HEADER, s as asString, t as sleep, u as parseJsonUnknown, v as deviceOpsCapability, w as adminUiCapability, y as viewerUiCapability, yt as emitReadiness } from "./sleep-
|
|
1
|
+
import { t as EventCategory } from "./event-category-Cv9dO26A.mjs";
|
|
2
|
+
import { C as DeviceType, F as readNodePin, L as ReadinessRegistry, O as expandCapMethods, P as nodePin, R as ReadinessTimeoutError, V as scopeKey, a as asJsonObject, d as DEVICE_SCOPED_CAPS, f as isDeviceScopedCap, gt as normalizeAddonInitResult, ht as BaseAddon, mt as DisposerChain, p as createDeviceProxy, pt as DATAPLANE_SECRET_HEADER, s as asString, t as sleep, u as parseJsonUnknown, v as deviceOpsCapability, w as adminUiCapability, y as viewerUiCapability, yt as emitReadiness } from "./sleep-CeuvKr4N.mjs";
|
|
3
3
|
import { t as errMsg } from "./err-msg-IQTHeDzc.mjs";
|
|
4
4
|
//#region src/generated/collection-array-methods.ts
|
|
5
5
|
/**
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one place a bearer principal is classified and matched against a
|
|
3
|
+
* `TokenScope` set. Pure — no I/O, no registry, no logger — so the kernel,
|
|
4
|
+
* `server/backend` and any ADDON can share it. It lives in `@camstack/types`
|
|
5
|
+
* for exactly that reason: `scopesAllowDeviceCap` used to live in
|
|
6
|
+
* `@camstack/system`, which addons may not import, so `addon-export-alexa`
|
|
7
|
+
* hand-copied it into `directive-router.ts` and said so in a comment twice.
|
|
8
|
+
* One vector, one derivation.
|
|
9
|
+
*
|
|
10
|
+
* ── What this exists to stop ────────────────────────────────────────────
|
|
11
|
+
*
|
|
12
|
+
* Measured on the live hub, 2026-08-09: an `oauth-access` token minted for the
|
|
13
|
+
* `export-alexa` account link was accepted on
|
|
14
|
+
* `POST /addon/homeassistant-export/command` — a route that actuates PTZ,
|
|
15
|
+
* reboot, the per-camera switches and notification snooze. The addon-route gate
|
|
16
|
+
* verified the JWT signature and checked `isAdmin` for `access: 'admin'` routes
|
|
17
|
+
* and nothing else, so every `access: 'authenticated'` route in the product was
|
|
18
|
+
* reachable by ANY valid hub JWT, including one issued to a different
|
|
19
|
+
* integration, a 60-second single-use authorization CODE, and a 30-day refresh
|
|
20
|
+
* token. See D103.
|
|
21
|
+
*/
|
|
22
|
+
import type { MethodAccess, TokenScope } from '../schemas/auth-records.js';
|
|
23
|
+
/**
|
|
24
|
+
* The access flavour an HTTP verb asks for. `GET`/`HEAD` read; anything that
|
|
25
|
+
* can change state is at least `create`.
|
|
26
|
+
*
|
|
27
|
+
* An UNRECOGNISED verb resolves to `delete`, the most privileged flavour, so a
|
|
28
|
+
* method nobody thought about fails closed. The inverse default — treating the
|
|
29
|
+
* unknown as `view` — is how a gate quietly stops gating.
|
|
30
|
+
*/
|
|
31
|
+
export declare function methodAccessForHttpMethod(method: string): MethodAccess;
|
|
32
|
+
/**
|
|
33
|
+
* True if the scope set grants `access` on device-scoped capabilities.
|
|
34
|
+
* A `category:device` grant covers every device cap (the broad grant).
|
|
35
|
+
*/
|
|
36
|
+
export declare function scopesAllowDeviceCap(scopes: readonly TokenScope[], access: MethodAccess): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* True if the scope set names this addon with at least `access`.
|
|
39
|
+
*
|
|
40
|
+
* Deliberately NOT satisfied by `category:device`: a grant over per-camera
|
|
41
|
+
* capabilities says nothing about an addon's own HTTP surface, and conflating
|
|
42
|
+
* the two is precisely the confusion that let an Alexa token drive Home
|
|
43
|
+
* Assistant's command route.
|
|
44
|
+
*/
|
|
45
|
+
export declare function scopesAllowAddon(scopes: readonly TokenScope[], addonId: string, access: MethodAccess): boolean;
|
|
46
|
+
/**
|
|
47
|
+
* What a verified JWT actually IS. Every one of these verifies under the same
|
|
48
|
+
* hub secret — that is the whole trap. `jwt.verify` succeeding means "we minted
|
|
49
|
+
* this", never "this is an API credential".
|
|
50
|
+
*/
|
|
51
|
+
export type BearerPrincipal =
|
|
52
|
+
/** An ordinary user session from `auth.login`. Governed by the user's own scopes. */
|
|
53
|
+
{
|
|
54
|
+
readonly kind: 'session';
|
|
55
|
+
}
|
|
56
|
+
/** An account-linking token issued to an integration. Governed by the grant. */
|
|
57
|
+
| {
|
|
58
|
+
readonly kind: 'integration';
|
|
59
|
+
readonly provider: 'oauth-access';
|
|
60
|
+
}
|
|
61
|
+
/** Minted for one hand-off step and never meant to authenticate an API call. */
|
|
62
|
+
| {
|
|
63
|
+
readonly kind: 'not-a-credential';
|
|
64
|
+
readonly reason: string;
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* The narrow shape read off a verified JWT payload. Every field optional: the
|
|
68
|
+
* payload arrives as whatever was signed, and a missing discriminator must
|
|
69
|
+
* classify, never throw.
|
|
70
|
+
*/
|
|
71
|
+
export interface BearerPayloadShape {
|
|
72
|
+
readonly kind?: unknown;
|
|
73
|
+
readonly provider?: unknown;
|
|
74
|
+
readonly userId?: unknown;
|
|
75
|
+
readonly isAdmin?: unknown;
|
|
76
|
+
readonly scopes?: unknown;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Classify a VERIFIED JWT payload.
|
|
80
|
+
*
|
|
81
|
+
* A session JWT carries no `kind`. Everything else in this system tags itself:
|
|
82
|
+
* `kind: 'sso-bridge'` for the OAuth/SSO family (discriminated further by
|
|
83
|
+
* `provider`), `kind: 'totp-challenge'` for login leg 1. Only `oauth-access` is
|
|
84
|
+
* an API credential; a code lives in a browser redirect URL and a refresh token
|
|
85
|
+
* belongs to `/token`.
|
|
86
|
+
*/
|
|
87
|
+
export declare function classifyBearerPrincipal(payload: BearerPayloadShape): BearerPrincipal;
|
|
88
|
+
export interface PrincipalAddonReachInput {
|
|
89
|
+
readonly principal: BearerPrincipal;
|
|
90
|
+
readonly scopes: readonly TokenScope[];
|
|
91
|
+
readonly isAdmin: boolean;
|
|
92
|
+
readonly addonId: string;
|
|
93
|
+
/** The HTTP verb of the request being gated. */
|
|
94
|
+
readonly method: string;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* The verdict, with the reason carried so the refusal can be LOGGED. A branch
|
|
98
|
+
* that drops a request silently reads as "never happened".
|
|
99
|
+
*/
|
|
100
|
+
export type PrincipalAddonReachVerdict = {
|
|
101
|
+
readonly allowed: true;
|
|
102
|
+
} | {
|
|
103
|
+
readonly allowed: false;
|
|
104
|
+
readonly reason: string;
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* May this principal reach `/addon/<addonId>/…` on an `authenticated` route or
|
|
108
|
+
* data-plane endpoint?
|
|
109
|
+
*
|
|
110
|
+
* Three principals, three answers:
|
|
111
|
+
*
|
|
112
|
+
* - **session** — unchanged. A user session is governed by the route's own
|
|
113
|
+
* `access` (`authenticated` / `admin`), exactly as before. Tightening HERE
|
|
114
|
+
* would lock every non-admin viewer out of recorder playback, snapshot media
|
|
115
|
+
* and the stream-broker embed, which is a worse outcome than the hole.
|
|
116
|
+
* - **integration** — must hold `addon:<addonId>` at the verb's access. This is
|
|
117
|
+
* the same rule the `cst_` scoped-token branch has always applied; the JWT
|
|
118
|
+
* branch simply never applied it, and closing that divergence IS the fix.
|
|
119
|
+
* `isAdmin` is ignored: an integration token is minted `isAdmin: false` and a
|
|
120
|
+
* token claiming otherwise must not talk its way past the grant.
|
|
121
|
+
* - **not-a-credential** — refused unconditionally.
|
|
122
|
+
*/
|
|
123
|
+
export declare function principalMayReachAddon(input: PrincipalAddonReachInput): PrincipalAddonReachVerdict;
|
|
@@ -74,7 +74,7 @@ export { AddBrokerInputSchema, BrokerConnectionDetailsSchema, BrokerInfoSchema,
|
|
|
74
74
|
export type { NetworkAccessStatus, NetworkEndpoint } from './network-access.cap.js';
|
|
75
75
|
export { NetworkAccessStatusSchema, NetworkEndpointSchema, networkAccessCapability, } from './network-access.cap.js';
|
|
76
76
|
export { type Attachment, type AttachmentMediaType, AttachmentMediaTypeSchema, AttachmentSchema, type DiscoveredTarget, DiscoveredTargetSchema, type INotificationOutputProvider, type NotificationAction, type NotificationActionIcon, NotificationActionIconSchema, NotificationActionSchema, type NotificationFormat, NotificationFormatSchema, NotificationSchema, notificationOutputCapability, type RenderedAs, RenderedAsSchema, type SendResult, SendResultSchema, type Target, type TargetKind, type TargetKindCaps, TargetKindCapsSchema, type TargetKindLevel, TargetKindLevelSchema, TargetKindSchema, TargetSchema, type TestResult, TestResultSchema, } from './notification-output.cap.js';
|
|
77
|
-
export { type INotificationRulesProvider, NC_CONDITION_CATALOG, NC_HISTORY_LIMIT_DEFAULT, NC_HISTORY_LIMIT_MAX, NC_MAX_PER_TRACK_IMMEDIATE, NC_SNOOZE_MAX_MINUTES, type NcAlarmConfig, NcAlarmConfigSchema, type NcAlarmModeCoverage, NcAlarmModeCoverageSchema, type NcAlarmSettings, type NcAlarmSettingsPatch, NcAlarmSettingsPatchSchema, NcAlarmSettingsSchema, type NcConditionDescriptor, NcConditionDescriptorSchema, type NcConditions, NcConditionsSchema, type NcCrossing, NcCrossingSchema, type NcDelivery, NcDeliverySchema, type NcDeviceStateCondition, NcDeviceStateConditionSchema, type NcHistoryEntry, NcHistoryEntrySchema, type NcHistoryFilter, NcHistoryFilterSchema, type NcHistoryRecordKind, NcHistoryRecordKindSchema, type NcHistoryStatus, NcHistoryStatusSchema, type NcHistorySubject, NcHistorySubjectSchema, type NcMediaFrame, NcMediaFrameSchema, type NcMediaPolicy, NcMediaPolicySchema, type NcOccupancyCondition, NcOccupancyConditionSchema, type NcPlateMatcher, NcPlateMatcherSchema, type NcRule, type NcRuleAction, NcRuleActionSchema, type NcRuleActionSequence, NcRuleActionSequenceSchema, type NcRuleActions, NcRuleActionsSchema, type NcRuleInput, NcRuleInputSchema, type NcRuleNotificationButton, NcRuleNotificationButtonSchema, type NcRulePatch, NcRulePatchSchema, NcRuleSchema, type NcRuleTarget, NcRuleTargetSchema, type NcSchedule, NcScheduleSchema, type NcScheduleWindow, NcScheduleWindowSchema, type NcSnooze, type NcSnoozeInput, NcSnoozeInputSchema, NcSnoozeSchema, type NcSnoozeScope, NcSnoozeScopeSchema, type NcSnoozeSuppressed, NcSnoozeSuppressedSchema, type NcTestResult, NcTestResultSchema, type NcThrottle, type NcThrottleGranularity, NcThrottleGranularitySchema, NcThrottleSchema, type NcZoneCondition, NcZoneConditionSchema, notificationRulesCapability, } from './notification-rules.cap.js';
|
|
77
|
+
export { type INotificationRulesProvider, NC_CONDITION_CATALOG, NC_HISTORY_LIMIT_DEFAULT, NC_HISTORY_LIMIT_MAX, NC_MAX_PER_TRACK_IMMEDIATE, NC_SNOOZE_MAX_MINUTES, type NcAlarmConfig, NcAlarmConfigSchema, type NcAlarmModeCoverage, NcAlarmModeCoverageSchema, type NcAlarmSettings, type NcAlarmSettingsPatch, NcAlarmSettingsPatchSchema, NcAlarmSettingsSchema, type NcConditionDescriptor, NcConditionDescriptorSchema, type NcConditions, NcConditionsSchema, type NcCrossing, NcCrossingSchema, type NcDelivery, NcDeliverySchema, type NcDeviceStateCondition, NcDeviceStateConditionSchema, type NcHistoryEntry, NcHistoryEntrySchema, type NcHistoryFilter, NcHistoryFilterSchema, type NcHistoryRecordKind, NcHistoryRecordKindSchema, type NcHistoryStatus, NcHistoryStatusSchema, type NcHistorySubject, NcHistorySubjectSchema, type NcMediaFrame, NcMediaFrameSchema, type NcMediaPolicy, NcMediaPolicySchema, type NcOccupancyCondition, NcOccupancyConditionSchema, type NcPlateMatcher, NcPlateMatcherSchema, type NcRule, type NcRuleAction, NcRuleActionSchema, type NcRuleActionSequence, NcRuleActionSequenceSchema, type NcRuleActions, NcRuleActionsSchema, type NcRuleInput, NcRuleInputSchema, type NcRuleNotificationButton, NcRuleNotificationButtonSchema, type NcRulePatch, NcRulePatchSchema, NcRuleSchema, type NcRuleTarget, NcRuleTargetSchema, type NcSchedule, NcScheduleSchema, type NcScheduleWindow, NcScheduleWindowSchema, type NcSystemEventCondition, NcSystemEventConditionSchema, type NcSystemEventKind, NcSystemEventKindSchema, type NcSnooze, type NcSnoozeInput, NcSnoozeInputSchema, NcSnoozeSchema, type NcSnoozeScope, NcSnoozeScopeSchema, type NcSnoozeSuppressed, NcSnoozeSuppressedSchema, type NcTestResult, NcTestResultSchema, type NcThrottle, type NcThrottleGranularity, NcThrottleGranularitySchema, NcThrottleSchema, type NcZoneCondition, NcZoneConditionSchema, notificationRulesCapability, } from './notification-rules.cap.js';
|
|
78
78
|
export { type IOauthIntegrationProvider, type OauthIntegrationDescriptor, OauthIntegrationDescriptorSchema, oauthIntegrationCapability, } from './oauth-integration.cap.js';
|
|
79
79
|
export { type AudioEvent, AudioEventSchema, type DetectionSource, DetectionSourceSchema, type EventKind, type EventKindCategory, EventKindCategorySchema, type EventKindDescriptor, EventKindDescriptorSchema, type EventKindIcon, EventKindIconSchema, EventKindSchema, type EventKindsForDevice, EventKindsForDeviceSchema, type EventPruneCounts, type EventStoreDeviceFootprint, type EventStoreFootprint, type IPipelineAnalyticsProvider, type KeyEvent, KeyEventSchema, type LabelAttribution, LabelAttributionSchema, type LabelTier, LabelTierSchema, type MediaFile, type MediaFileInfo, MediaFileInfoSchema, type MediaFileKind, MediaFileSchema, type MotionEvent, MotionEventSchema, type ObjectEvent, ObjectEventSchema, pipelineAnalyticsCapability, type RecentTracksPage, RecentTracksPageSchema, type RecentTracksQuery, RecentTracksQueryInput, type RetrainAnnotation, type RetrainAnnotationDraft, RetrainAnnotationDraftSchema, RetrainAnnotationKindSchema, RetrainAnnotationSchema, RetrainAnnotationSourceSchema, type RetrainAssistResult, RetrainAssistResultSchema, RetrainAssistSubjectSchema, RetrainCopyRefusalSchema, type RetrainFrame, type RetrainFrameCandidate, RetrainFrameCandidateSchema, type RetrainFrameList, RetrainFrameListSchema, RetrainFrameSchema, type RetrainFrameSelection, RetrainFrameSelectionSchema, type RetrainMacroClass, RetrainMacroClassSchema, type RetrainStatus, RetrainStatusSchema, type RetrainTrack, RetrainTrackSchema, type RetrainTransitionResult, RetrainTransitionResultSchema, type ScoredObjectEvent, ScoredObjectEventSchema, type SensorEvent, SensorEventSchema, type Track, type TrackCascadeCounts, TrackCascadeCountsSchema, type TrackEnvelope, TrackEnvelopeSchema, TrackedDetectionSchema, type TrackFlags, type TrackFlagsPatch, TrackFlagsPatchSchema, TrackFlagsSchema, type TrackProjection, TrackProjectionSchema, TrackSchema, type TrackSource, TrackSourceSchema, type TrackState, TrackStateSchema, type TrackZoneFilter, TrackZoneFilterSchema, type TrainingExportDeviceTotals, TrainingExportDeviceTotalsSchema, type TrainingExportSummary, TrainingExportSummarySchema, type ZoneCrossing, type ZoneCrossingDirection, ZoneCrossingDirectionSchema, ZoneCrossingSchema, } from './pipeline-analytics.cap.js';
|
|
80
80
|
export type { NativeCropRef, PipelineStepInputOutput, PipelineValidationIssue, PipelineValidationResult, } from './pipeline-executor.cap.js';
|