@camstack/addon-notifiers 1.2.7 → 1.2.8
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/assets/samples/animation.gif +0 -0
- package/assets/samples/clip.mp4 +0 -0
- package/assets/samples/image.jpg +0 -0
- package/assets/samples/tone.mp3 +0 -0
- package/dist/addon.js +541 -86
- package/dist/addon.mjs +518 -86
- package/package.json +1 -1
package/dist/addon.mjs
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { brotliCompressSync, deflateSync, gzipSync } from "node:zlib";
|
|
2
|
+
import { readFileSync } from "node:fs";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
2
5
|
//#region ../types/dist/event-category-BLcNejAE.mjs
|
|
3
6
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
4
7
|
EventCategory["SystemBoot"] = "system.boot";
|
|
@@ -7300,35 +7303,22 @@ function buildCapturingReply(envelope) {
|
|
|
7300
7303
|
*/
|
|
7301
7304
|
var RecordingWeekdaySchema = number().int().min(0).max(6);
|
|
7302
7305
|
var HHMM = /^([01]\d|2[0-3]):[0-5]\d$/;
|
|
7303
|
-
var RecordingScheduleSchema = discriminatedUnion("kind", [object({ kind: literal("always") }), object({
|
|
7304
|
-
kind: literal("timeOfDay"),
|
|
7305
|
-
start: string().regex(HHMM),
|
|
7306
|
-
end: string().regex(HHMM),
|
|
7307
|
-
/** Restrict to these weekdays; omit = every day. */
|
|
7308
|
-
days: array(RecordingWeekdaySchema).optional()
|
|
7309
|
-
})]);
|
|
7310
|
-
var RecordingModeSchema = _enum([
|
|
7311
|
-
"continuous",
|
|
7312
|
-
"onMotion",
|
|
7313
|
-
"onAudioThreshold"
|
|
7314
|
-
]);
|
|
7315
7306
|
/**
|
|
7316
|
-
*
|
|
7317
|
-
*
|
|
7318
|
-
* - `off` —
|
|
7319
|
-
* - `events` —
|
|
7320
|
-
*
|
|
7321
|
-
* - `continuous` — record 24/7 within the schedule.
|
|
7307
|
+
* DERIVED per-camera storage summary — the single field cheap consumers read
|
|
7308
|
+
* (the viewer's status dot, the camera list) instead of walking `bands`:
|
|
7309
|
+
* - `off` — no band covers the camera (or it is disabled).
|
|
7310
|
+
* - `events` — every band records around triggers only.
|
|
7311
|
+
* - `continuous` — at least one band records continuously.
|
|
7322
7312
|
*
|
|
7323
|
-
*
|
|
7324
|
-
*
|
|
7313
|
+
* NEVER authored: the recorder stamps it from the authoritative `bands` on
|
|
7314
|
+
* every save (`activeModeForConfig`). Writing it has no effect.
|
|
7325
7315
|
*/
|
|
7326
7316
|
var RecordingStorageModeSchema = _enum([
|
|
7327
7317
|
"off",
|
|
7328
7318
|
"events",
|
|
7329
7319
|
"continuous"
|
|
7330
7320
|
]);
|
|
7331
|
-
/** Which detectors trigger an `events`-mode
|
|
7321
|
+
/** Which detectors trigger an `events`-mode band. */
|
|
7332
7322
|
var RecordingTriggersSchema = object({
|
|
7333
7323
|
motion: boolean().optional(),
|
|
7334
7324
|
audioThresholdDbfs: number().optional()
|
|
@@ -7364,18 +7354,6 @@ var RecordingBandSchema = object({
|
|
|
7364
7354
|
preBufferSec: number().min(0).optional(),
|
|
7365
7355
|
postBufferSec: number().min(0).optional()
|
|
7366
7356
|
});
|
|
7367
|
-
var RecordingRuleSchema = object({
|
|
7368
|
-
schedule: RecordingScheduleSchema,
|
|
7369
|
-
mode: RecordingModeSchema,
|
|
7370
|
-
/** Seconds of footage to retain BEFORE a trigger (applied at keep/discard). */
|
|
7371
|
-
preBufferSec: number().min(0).default(0),
|
|
7372
|
-
/** Keep recording until this many seconds after the last trigger. */
|
|
7373
|
-
postBufferSec: number().min(0).default(0),
|
|
7374
|
-
/** Each new trigger restarts the post-buffer window. */
|
|
7375
|
-
resetTimeoutOnNewEvent: boolean().default(true),
|
|
7376
|
-
/** onAudioThreshold only — dBFS level that counts as a trigger. */
|
|
7377
|
-
thresholdDbfs: number().optional()
|
|
7378
|
-
});
|
|
7379
7357
|
/**
|
|
7380
7358
|
* Per-device retention overrides. Every field is optional; an unset or `0`
|
|
7381
7359
|
* value inherits the node-wide recorder default. Only footage-lifetime limits
|
|
@@ -7409,40 +7387,28 @@ var ScrubThumbnailPresetSchema = _enum([
|
|
|
7409
7387
|
/**
|
|
7410
7388
|
* The full per-camera recording intent — the wire shape of a RecordingTarget.
|
|
7411
7389
|
*
|
|
7412
|
-
* `
|
|
7413
|
-
*
|
|
7414
|
-
*
|
|
7415
|
-
*
|
|
7390
|
+
* `bands` is the ONLY authored recording intent: what to record, when, and on
|
|
7391
|
+
* which trigger. `mode` is a derived summary the recorder stamps on save; every
|
|
7392
|
+
* other field is a storage knob (profiles, segment length, retention, scrub).
|
|
7393
|
+
*
|
|
7394
|
+
* STRICT on purpose: the legacy authoring surface (`schedule`/`schedules`/
|
|
7395
|
+
* `triggers`/`preBufferSec`/`postBufferSec`/`rules`) was retired 2026-07-30.
|
|
7396
|
+
* A stale caller must fail loudly — silently stripping its legacy intent would
|
|
7397
|
+
* persist a band-less config, i.e. silently stop recording the camera.
|
|
7416
7398
|
*/
|
|
7417
7399
|
var RecordingConfigSchema = object({
|
|
7418
7400
|
enabled: boolean(),
|
|
7419
|
-
/**
|
|
7420
|
-
*
|
|
7401
|
+
/** DERIVED summary of `bands`, stamped by the recorder on every save.
|
|
7402
|
+
* Authoring it has no effect — see {@link RecordingStorageModeSchema}. */
|
|
7421
7403
|
mode: RecordingStorageModeSchema.optional(),
|
|
7422
7404
|
profiles: array(CamProfileSchema).optional(),
|
|
7423
7405
|
segmentSeconds: number().int().positive().optional(),
|
|
7424
|
-
/** Shared recording time-bands for `events` & `continuous` — record only when
|
|
7425
|
-
* the wall-clock falls inside one of these windows. Omit or empty = always.
|
|
7426
|
-
* `continuous` compiles to one rule per band; `events` to band × trigger. */
|
|
7427
|
-
schedules: array(RecordingScheduleSchema).optional(),
|
|
7428
|
-
/** Legacy single-band predecessor of `schedules`. Read-compat only — it is
|
|
7429
|
-
* normalized into `schedules` on read and never written going forward. (Not
|
|
7430
|
-
* tagged `@deprecated`: the normalization paths must read it cast-free.) */
|
|
7431
|
-
schedule: RecordingScheduleSchema.optional(),
|
|
7432
|
-
/** `events`-mode only — which detectors trigger a recording. */
|
|
7433
|
-
triggers: RecordingTriggersSchema.optional(),
|
|
7434
|
-
/** `events`-mode only — seconds retained before / after a trigger. */
|
|
7435
|
-
preBufferSec: number().min(0).optional(),
|
|
7436
|
-
postBufferSec: number().min(0).optional(),
|
|
7437
|
-
/** DEPRECATED authoring input; retained for migration/transition. */
|
|
7438
|
-
rules: array(RecordingRuleSchema).optional(),
|
|
7439
7406
|
/**
|
|
7440
|
-
* AUTHORITATIVE mode-per-band recording model
|
|
7441
|
-
*
|
|
7442
|
-
*
|
|
7443
|
-
* derived into bands once via `migrateConfigToBands`.
|
|
7407
|
+
* AUTHORITATIVE mode-per-band recording model — the single source of truth
|
|
7408
|
+
* the recorder's band engine consumes. An empty array = record nothing;
|
|
7409
|
+
* "off" is the absence of a covering band, never a band value.
|
|
7444
7410
|
*/
|
|
7445
|
-
bands: array(RecordingBandSchema).
|
|
7411
|
+
bands: array(RecordingBandSchema).default([]),
|
|
7446
7412
|
retention: RecordingRetentionSchema.optional(),
|
|
7447
7413
|
/**
|
|
7448
7414
|
* Per-camera scrub-thumbnail fidelity preset (resolution + JPEG quality for
|
|
@@ -7450,8 +7416,15 @@ var RecordingConfigSchema = object({
|
|
|
7450
7416
|
* windows only — existing sheets are immutable, and each window's index
|
|
7451
7417
|
* carries its own tile dims so mixed-preset history renders correctly.
|
|
7452
7418
|
*/
|
|
7453
|
-
scrubThumbnails: ScrubThumbnailPresetSchema.optional()
|
|
7454
|
-
|
|
7419
|
+
scrubThumbnails: ScrubThumbnailPresetSchema.optional(),
|
|
7420
|
+
/**
|
|
7421
|
+
* OPT-IN thumbnail-strip generation for this camera: every keyframe of the
|
|
7422
|
+
* low recording saved as a JPEG (the fast-drag scrub depth), a derived
|
|
7423
|
+
* cache that eviction reclaims with the footage. Absent/false = no strips
|
|
7424
|
+
* are written and scrub reads exact keyframes at every velocity.
|
|
7425
|
+
*/
|
|
7426
|
+
stripsEnabled: boolean().optional()
|
|
7427
|
+
}).strict();
|
|
7455
7428
|
/**
|
|
7456
7429
|
* Ops-log — the durable, append-only operations audit shared by the
|
|
7457
7430
|
* recordings and events management surfaces.
|
|
@@ -7470,7 +7443,8 @@ var OpsLogOpSchema = _enum([
|
|
|
7470
7443
|
"prune",
|
|
7471
7444
|
"manual-delete",
|
|
7472
7445
|
"rescan",
|
|
7473
|
-
"retention-run"
|
|
7446
|
+
"retention-run",
|
|
7447
|
+
"relocate"
|
|
7474
7448
|
]);
|
|
7475
7449
|
/** Why the operation ran. */
|
|
7476
7450
|
var OpsLogReasonSchema = _enum([
|
|
@@ -7509,6 +7483,55 @@ var OpsLogQueryInputSchema = object({
|
|
|
7509
7483
|
limit: number().int().min(1).max(1e3).optional()
|
|
7510
7484
|
});
|
|
7511
7485
|
/**
|
|
7486
|
+
* Entity-relocation job state (storage entity-routing spec, Phase 4).
|
|
7487
|
+
*
|
|
7488
|
+
* One shape shared by the recorder's `relocateFootage` (segments + strips) and
|
|
7489
|
+
* pipeline-analytics' `relocateMedia` (event media blobs) so the admin Data
|
|
7490
|
+
* page renders both movers with one component. Jobs are in-RAM (a restart
|
|
7491
|
+
* forgets them — re-running is safe by construction: copy-if-absent, delete
|
|
7492
|
+
* after verify) and each completed/failed run also lands one durable ops-log
|
|
7493
|
+
* row on the owning addon's surface.
|
|
7494
|
+
*/
|
|
7495
|
+
var RelocateJobStateSchema = _enum([
|
|
7496
|
+
"running",
|
|
7497
|
+
"done",
|
|
7498
|
+
"failed",
|
|
7499
|
+
"cancelled"
|
|
7500
|
+
]);
|
|
7501
|
+
var RelocateJobSchema = object({
|
|
7502
|
+
jobId: string(),
|
|
7503
|
+
state: RelocateJobStateSchema,
|
|
7504
|
+
/** Source location — for media relocation this is informational ('*': rows
|
|
7505
|
+
* move from wherever they are to the target). */
|
|
7506
|
+
fromLocationId: string(),
|
|
7507
|
+
toLocationId: string(),
|
|
7508
|
+
/** Scoped device, or null = every device. */
|
|
7509
|
+
deviceId: number().nullable(),
|
|
7510
|
+
/** What the job moves (owner-addon specific: segments/strips or media). */
|
|
7511
|
+
entities: array(string()),
|
|
7512
|
+
filesMoved: number().int(),
|
|
7513
|
+
bytesMoved: number().int(),
|
|
7514
|
+
/** Total files discovered up front; null while (or when) unknown. */
|
|
7515
|
+
filesTotal: number().int().nullable(),
|
|
7516
|
+
startedAt: number(),
|
|
7517
|
+
finishedAt: number().nullable(),
|
|
7518
|
+
error: string().nullable()
|
|
7519
|
+
});
|
|
7520
|
+
var RelocateFootageInputSchema = object({
|
|
7521
|
+
deviceId: number().optional(),
|
|
7522
|
+
fromLocationId: string(),
|
|
7523
|
+
toLocationId: string(),
|
|
7524
|
+
entities: array(_enum(["segments", "strips"])).optional(),
|
|
7525
|
+
/** Copy throttle in MB/s (default 40) — the drain is a background chore,
|
|
7526
|
+
* never allowed to starve live writers. */
|
|
7527
|
+
throttleMbps: number().min(1).max(1e3).optional()
|
|
7528
|
+
});
|
|
7529
|
+
var RelocateMediaInputSchema = object({
|
|
7530
|
+
deviceId: number().optional(),
|
|
7531
|
+
toLocationId: string(),
|
|
7532
|
+
throttleMbps: number().min(1).max(1e3).optional()
|
|
7533
|
+
});
|
|
7534
|
+
/**
|
|
7512
7535
|
* `StorageLocationType` — an addon-declared id that identifies the *kind* of
|
|
7513
7536
|
* storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
|
|
7514
7537
|
* so the persisted record schema and the consumer-facing cap can both consume it
|
|
@@ -7558,6 +7581,13 @@ var StorageLocationSchema = object({
|
|
|
7558
7581
|
nodeId: string().optional(),
|
|
7559
7582
|
isDefault: boolean().default(false),
|
|
7560
7583
|
isSystem: boolean().default(false),
|
|
7584
|
+
/** COMPUTED at read time by the orchestrator (statfs of the backing volume
|
|
7585
|
+
* for node-local locations it can reach) — never persisted, absent when the
|
|
7586
|
+
* volume is remote/unreachable. The single capacity truth every UI reads. */
|
|
7587
|
+
capacity: object({
|
|
7588
|
+
totalBytes: number(),
|
|
7589
|
+
availableBytes: number()
|
|
7590
|
+
}).nullable().optional(),
|
|
7561
7591
|
createdAt: number(),
|
|
7562
7592
|
updatedAt: number()
|
|
7563
7593
|
});
|
|
@@ -8325,7 +8355,8 @@ var NcTaxonomyEntrySchema = object({
|
|
|
8325
8355
|
/** Macro/category parent for grouping ('car' → 'vehicle'); null for a top. */
|
|
8326
8356
|
parentKind: string().nullable()
|
|
8327
8357
|
});
|
|
8328
|
-
|
|
8358
|
+
/** The complete NC picker taxonomy — three grouped buckets. */
|
|
8359
|
+
var NcTaxonomySchema = object({
|
|
8329
8360
|
videoClasses: array(NcTaxonomyEntrySchema),
|
|
8330
8361
|
audioKinds: array(NcTaxonomyEntrySchema),
|
|
8331
8362
|
labels: array(NcTaxonomyEntrySchema)
|
|
@@ -9048,9 +9079,20 @@ var DEGRADE_ORDER = {
|
|
|
9048
9079
|
"markdown"
|
|
9049
9080
|
]
|
|
9050
9081
|
};
|
|
9051
|
-
/**
|
|
9082
|
+
/**
|
|
9083
|
+
* Pick the best target format the kind supports for a given source format.
|
|
9084
|
+
*
|
|
9085
|
+
* TOLERANT of a source outside the union. `NotificationSchema.format` carries
|
|
9086
|
+
* `.default('text')`, but that default only runs where the schema is PARSED —
|
|
9087
|
+
* the tRPC router. A cap call arriving from another addon (`ctx.api`) skips
|
|
9088
|
+
* that parse, so `format` reaches here `undefined`, and the bare
|
|
9089
|
+
* `DEGRADE_ORDER[source]` threw `is not iterable`. That broke the one promise
|
|
9090
|
+
* the degrade path makes ("never throws — degradation is reported, never
|
|
9091
|
+
* surfaced as an error") and dead-lettered every Notification-Center delivery
|
|
9092
|
+
* for a day (2026-07-30). An unknown source degrades like `text`.
|
|
9093
|
+
*/
|
|
9052
9094
|
function resolveFormat(source, supported) {
|
|
9053
|
-
for (const candidate of DEGRADE_ORDER[source]) if (supported.includes(candidate)) return candidate;
|
|
9095
|
+
for (const candidate of DEGRADE_ORDER[source] ?? DEGRADE_ORDER.text) if (supported.includes(candidate)) return candidate;
|
|
9054
9096
|
return supported[0] ?? "text";
|
|
9055
9097
|
}
|
|
9056
9098
|
/** Transcode a body between formats. */
|
|
@@ -9095,7 +9137,7 @@ function resolveLevel(levels, n) {
|
|
|
9095
9137
|
})[0]);
|
|
9096
9138
|
}
|
|
9097
9139
|
function splitBody(body, maxLen) {
|
|
9098
|
-
if (maxLen <= 0 || body.length <= maxLen) return [body];
|
|
9140
|
+
if (!Number.isFinite(maxLen) || maxLen <= 0 || body.length <= maxLen) return [body];
|
|
9099
9141
|
const parts = [];
|
|
9100
9142
|
for (let i = 0; i < body.length; i += maxLen) parts.push(body.slice(i, i + maxLen));
|
|
9101
9143
|
return parts;
|
|
@@ -9178,6 +9220,7 @@ function prepareNotification(caps, n) {
|
|
|
9178
9220
|
renderedAs
|
|
9179
9221
|
};
|
|
9180
9222
|
}
|
|
9223
|
+
new Set(["devices", "classes"]);
|
|
9181
9224
|
/**
|
|
9182
9225
|
* Shared geometry vocabulary for on-frame shape caps — privacy-mask,
|
|
9183
9226
|
* motion-zones, and the detection zones/lines editor all speak this one
|
|
@@ -9494,12 +9537,60 @@ var NcRuleTargetSchema = object({
|
|
|
9494
9537
|
* - `keyFrame` — the clean scene frame (no subject box).
|
|
9495
9538
|
* - `none` — no attachment.
|
|
9496
9539
|
*/
|
|
9497
|
-
|
|
9498
|
-
|
|
9499
|
-
|
|
9500
|
-
|
|
9501
|
-
|
|
9502
|
-
|
|
9540
|
+
/**
|
|
9541
|
+
* WHAT THE PICTURE SHOWS — chosen explicitly, because the implicit ladders
|
|
9542
|
+
* conflate it with the selection strategy and betray the request: asking for
|
|
9543
|
+
* the clean scene frame on an object-event owner used to start at
|
|
9544
|
+
* `fullFrameBoxed`, i.e. the annotated frame (2026-07-30).
|
|
9545
|
+
* - `cropped` — the subject, tight. What "who is at the door" wants.
|
|
9546
|
+
* - `full` — the clean scene, no annotation. What "what is going on" wants.
|
|
9547
|
+
* - `boxed` — the scene WITH the detection boxes drawn, for verifying what
|
|
9548
|
+
* the pipeline actually saw.
|
|
9549
|
+
*/
|
|
9550
|
+
var NcMediaFrameSchema = _enum([
|
|
9551
|
+
"cropped",
|
|
9552
|
+
"full",
|
|
9553
|
+
"boxed"
|
|
9554
|
+
]);
|
|
9555
|
+
var NcMediaPolicySchema = object({
|
|
9556
|
+
attach: _enum([
|
|
9557
|
+
"best",
|
|
9558
|
+
"best-matching",
|
|
9559
|
+
"keyFrame",
|
|
9560
|
+
"none"
|
|
9561
|
+
]).default("best"),
|
|
9562
|
+
/** What the still shows. Absent = `cropped` (the historical `best` shape). */
|
|
9563
|
+
frame: NcMediaFrameSchema.optional(),
|
|
9564
|
+
/** Crop the attached still to the rule's condition-zone bbox (padded) —
|
|
9565
|
+
* "show me the ZONE", not the whole scene or the subject crop. */
|
|
9566
|
+
zoneCrop: boolean().optional(),
|
|
9567
|
+
/**
|
|
9568
|
+
* Also attach a short GIF cut from the stream broker's clip ring around the
|
|
9569
|
+
* event — NOT from the recording, so the camera does not have to be
|
|
9570
|
+
* recording, and the window sits AROUND the moment instead of a segment
|
|
9571
|
+
* behind it. Fail-closed: a window the ring does not cover contributes no
|
|
9572
|
+
* gif, never a failed notification.
|
|
9573
|
+
*/
|
|
9574
|
+
gif: boolean().optional(),
|
|
9575
|
+
/**
|
|
9576
|
+
* Also attach a short MP4 CLIP of the same cut. Same source and the same
|
|
9577
|
+
* fail-closed rule as `gif`. Prefer it where the backend takes video
|
|
9578
|
+
* (telegram, discord, zentik, webhook); backends that do not are handled by
|
|
9579
|
+
* the degrade engine, which drops the video and keeps the still.
|
|
9580
|
+
*/
|
|
9581
|
+
clip: boolean().optional(),
|
|
9582
|
+
/** Seconds of footage BEFORE / AFTER the event instant. Defaults 3 / 7. */
|
|
9583
|
+
clipPreRollSec: number().int().min(0).max(30).optional(),
|
|
9584
|
+
clipPostRollSec: number().int().min(0).max(30).optional(),
|
|
9585
|
+
/**
|
|
9586
|
+
* Which stream profile the footage is cut from. Absent = the CHEAPEST
|
|
9587
|
+
* assigned profile: a notification is watched on a phone, so the 4K
|
|
9588
|
+
* rendition would burn CPU to produce a file the client downscales anyway.
|
|
9589
|
+
* A profile that is not assigned falls back to the cheapest, and the render
|
|
9590
|
+
* reports which one actually ran.
|
|
9591
|
+
*/
|
|
9592
|
+
profile: CamProfileSchema.optional()
|
|
9593
|
+
});
|
|
9503
9594
|
/** Throttle — cooldown survives restarts (rebuilt from the outbox on boot). */
|
|
9504
9595
|
var NcThrottleSchema = object({
|
|
9505
9596
|
cooldownSec: number().int().min(0).max(86400).default(60),
|
|
@@ -9513,7 +9604,19 @@ var NcRuleInputSchema = object({
|
|
|
9513
9604
|
delivery: NcDeliverySchema,
|
|
9514
9605
|
conditions: NcConditionsSchema.default({}),
|
|
9515
9606
|
schedule: NcScheduleSchema.optional(),
|
|
9516
|
-
|
|
9607
|
+
/** May be empty when `targetUsers` addresses at least one user — the
|
|
9608
|
+
* "at least one addressee" invariant is enforced by the provider, because
|
|
9609
|
+
* a cross-field refine here would break `NcRulePatchSchema.partial()`. */
|
|
9610
|
+
targets: array(NcRuleTargetSchema),
|
|
9611
|
+
/**
|
|
9612
|
+
* USERS this rule addresses in addition to `targets` (Phase 4). At fire
|
|
9613
|
+
* time each user fans out to the personal targets they own
|
|
9614
|
+
* (`config.ownerUserId`), filtered by that user's `allowedDevices` for the
|
|
9615
|
+
* firing camera — a user is never notified about a device they cannot open.
|
|
9616
|
+
* Per-user opt-outs (`disabledTargetIds`) still apply to the fanned-out
|
|
9617
|
+
* targets.
|
|
9618
|
+
*/
|
|
9619
|
+
targetUsers: array(string()).optional(),
|
|
9517
9620
|
media: NcMediaPolicySchema.default({ attach: "best" }),
|
|
9518
9621
|
throttle: NcThrottleSchema.default({
|
|
9519
9622
|
cooldownSec: 60,
|
|
@@ -9726,7 +9829,10 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
|
|
|
9726
9829
|
}), object({ results: array(NcTestResultSchema) }), {
|
|
9727
9830
|
kind: "mutation",
|
|
9728
9831
|
auth: "admin"
|
|
9729
|
-
}), method(object({}), object({
|
|
9832
|
+
}), method(object({}), object({
|
|
9833
|
+
catalog: array(NcConditionDescriptorSchema),
|
|
9834
|
+
taxonomy: NcTaxonomySchema.optional()
|
|
9835
|
+
})), method(object({ filter: NcHistoryFilterSchema.default({ limit: 100 }) }), object({ entries: array(NcHistoryEntrySchema) }), { auth: "admin" });
|
|
9730
9836
|
/**
|
|
9731
9837
|
* TimelapseRule — the STANDALONE scheduled timelapse producer's rule model.
|
|
9732
9838
|
*
|
|
@@ -10463,6 +10569,28 @@ method(object({
|
|
|
10463
10569
|
}), object({ success: literal(true) }), {
|
|
10464
10570
|
kind: "mutation",
|
|
10465
10571
|
auth: "admin"
|
|
10572
|
+
}), method(object({
|
|
10573
|
+
deviceId: number(),
|
|
10574
|
+
/** Absent = the LOWEST assigned profile — a notification attachment is
|
|
10575
|
+
* watched on a phone, and the cheap rendition is the right default. */
|
|
10576
|
+
profile: CamProfileSchema.optional(),
|
|
10577
|
+
aroundMs: number(),
|
|
10578
|
+
preRollSec: number().min(0).max(20).default(3),
|
|
10579
|
+
postRollSec: number().min(0).max(20).default(5),
|
|
10580
|
+
format: _enum(["gif", "mp4"]).default("gif"),
|
|
10581
|
+
maxWidth: number().int().min(120).max(1920).default(480),
|
|
10582
|
+
/** GIF only — MP4 keeps the source cadence. */
|
|
10583
|
+
fps: number().int().min(1).max(15).default(5)
|
|
10584
|
+
}), object({
|
|
10585
|
+
base64: string(),
|
|
10586
|
+
mime: string(),
|
|
10587
|
+
bytes: number().int(),
|
|
10588
|
+
/** The profile actually rendered (what the default resolved to). */
|
|
10589
|
+
profile: CamProfileSchema,
|
|
10590
|
+
durationMs: number()
|
|
10591
|
+
}), {
|
|
10592
|
+
kind: "mutation",
|
|
10593
|
+
auth: "admin"
|
|
10466
10594
|
}), method(_void(), array(CameraStreamSchema).readonly()), method(_void(), array(ProfileSlotSchema).readonly()), method(object({ brokerId: string() }), BrokerStatsSchema), method(object({ brokerId: string() }), object({
|
|
10467
10595
|
probed: boolean(),
|
|
10468
10596
|
summary: string()
|
|
@@ -17029,6 +17157,36 @@ var TargetKindSchema = object({
|
|
|
17029
17157
|
icon: string(),
|
|
17030
17158
|
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
17031
17159
|
addonId: string(),
|
|
17160
|
+
/**
|
|
17161
|
+
* URL of the kind's bundled BRAND icon, served by the providing addon over
|
|
17162
|
+
* its own `addon-routes` surface (`/addon/<addonId>/icons/<kind>`). Absent
|
|
17163
|
+
* when the addon bundles no icon for that kind — the client then falls back
|
|
17164
|
+
* to a neutral glyph rather than rendering the raw `icon` NAME as text.
|
|
17165
|
+
*
|
|
17166
|
+
* Root-relative on purpose: it resolves against whatever origin serves a web
|
|
17167
|
+
* client, and a native client joins it onto its own hub base.
|
|
17168
|
+
*
|
|
17169
|
+
* DECLARED here deliberately. It used to travel as an undeclared passthrough
|
|
17170
|
+
* field that survived only because the runtime cap-router forwards provider
|
|
17171
|
+
* output verbatim — so every consumer had to re-declare it by hand to stop
|
|
17172
|
+
* its own Zod parse from stripping it, and the whole arrangement would have
|
|
17173
|
+
* broken silently the moment output validation was tightened anywhere.
|
|
17174
|
+
*/
|
|
17175
|
+
iconUrl: string().optional(),
|
|
17176
|
+
/**
|
|
17177
|
+
* Media type of {@link iconUrl} (`image/svg+xml`, `image/png`, …).
|
|
17178
|
+
*
|
|
17179
|
+
* The server knows this and therefore says it, because the client cannot
|
|
17180
|
+
* safely guess: a React-Native client renders SVG and raster through two
|
|
17181
|
+
* DIFFERENT components (`react-native-svg` vs `expo-image` — expo-image does
|
|
17182
|
+
* not decode SVG on iOS/Android), so without this it silently fell back to a
|
|
17183
|
+
* placeholder glyph for every vector icon while the web build looked fine.
|
|
17184
|
+
*
|
|
17185
|
+
* Absent when {@link iconUrl} is absent, or for a legacy provider that has
|
|
17186
|
+
* not been updated — a client that cannot determine the type should prefer
|
|
17187
|
+
* its raster path, which is the safe default for an unknown image.
|
|
17188
|
+
*/
|
|
17189
|
+
iconMediaType: string().optional(),
|
|
17032
17190
|
configSchema: ConfigSchemaPassthrough,
|
|
17033
17191
|
supportsDiscovery: boolean(),
|
|
17034
17192
|
caps: TargetKindCapsSchema
|
|
@@ -17774,6 +17932,15 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
17774
17932
|
}), method(object({ deviceId: number() }), EventPruneCountsSchema, {
|
|
17775
17933
|
kind: "mutation",
|
|
17776
17934
|
auth: "admin"
|
|
17935
|
+
}), method(RelocateMediaInputSchema, object({ jobId: string() }), {
|
|
17936
|
+
kind: "mutation",
|
|
17937
|
+
auth: "admin"
|
|
17938
|
+
}), method(object({}), array(RelocateJobSchema).readonly(), {
|
|
17939
|
+
kind: "query",
|
|
17940
|
+
auth: "admin"
|
|
17941
|
+
}), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
|
|
17942
|
+
kind: "mutation",
|
|
17943
|
+
auth: "admin"
|
|
17777
17944
|
}), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
|
|
17778
17945
|
kind: "query",
|
|
17779
17946
|
auth: "admin"
|
|
@@ -20253,6 +20420,17 @@ var GetConnectionEndpointsResultSchema = object({ endpoints: array(object({
|
|
|
20253
20420
|
*/
|
|
20254
20421
|
priority: number()
|
|
20255
20422
|
})).readonly() });
|
|
20423
|
+
/**
|
|
20424
|
+
* The chosen outbound endpoint for notification artifacts. `baseUrl: null` =
|
|
20425
|
+
* AUTO (resolved from the candidate ranking at send time); `resolved` reports
|
|
20426
|
+
* what AUTO currently picks, so the UI can show the effective value either way.
|
|
20427
|
+
*/
|
|
20428
|
+
var NotificationEndpointSchema = object({
|
|
20429
|
+
/** The operator's explicit choice, or null for AUTO. */
|
|
20430
|
+
baseUrl: string().nullable(),
|
|
20431
|
+
/** What the ranking currently resolves to (null when nothing is reachable). */
|
|
20432
|
+
resolved: string().nullable()
|
|
20433
|
+
});
|
|
20256
20434
|
var AllowedAddressesSchema = object({
|
|
20257
20435
|
/**
|
|
20258
20436
|
* Allowlist of interface addresses operators have explicitly opted
|
|
@@ -20275,7 +20453,7 @@ method(_void(), ListResultSchema), method(_void(), PreferredSchema), method(obje
|
|
|
20275
20453
|
* to avoid mixed-content blocks in the browser. The public
|
|
20276
20454
|
* tunnel always emits `https://` regardless. */
|
|
20277
20455
|
scheme: _enum(["http", "https"]).optional()
|
|
20278
|
-
}), GetConnectionEndpointsResultSchema), method(_void(), AllowedAddressesSchema), method(AllowedAddressesSchema, object({ success: literal(true) }), { kind: "mutation" }), method(_void(), AllowedAddressesSchema, { kind: "mutation" });
|
|
20456
|
+
}), GetConnectionEndpointsResultSchema), method(_void(), NotificationEndpointSchema), method(object({ baseUrl: string().nullable() }), NotificationEndpointSchema, { kind: "mutation" }), method(_void(), AllowedAddressesSchema), method(AllowedAddressesSchema, object({ success: literal(true) }), { kind: "mutation" }), method(_void(), AllowedAddressesSchema, { kind: "mutation" });
|
|
20279
20457
|
/**
|
|
20280
20458
|
* mesh-network — collection cap for mesh-VPN providers.
|
|
20281
20459
|
*
|
|
@@ -21074,7 +21252,12 @@ var RecordingDeviceUsageSchema = object({
|
|
|
21074
21252
|
var RecordingLocationUsageSchema = object({
|
|
21075
21253
|
/** StorageLocation id; null for the legacy/degraded single-root fallback. */
|
|
21076
21254
|
locationId: string().nullable(),
|
|
21077
|
-
/**
|
|
21255
|
+
/** Every location id sharing this row's PHYSICAL volume (aliases). One row
|
|
21256
|
+
* is emitted per physical disk (2026-07-29): two locations on one root
|
|
21257
|
+
* previously rendered as two identical "disks" with a nonsensical used
|
|
21258
|
+
* split — hydrate attribution across aliases is arbitrary by nature. */
|
|
21259
|
+
locationIds: array(string()).optional(),
|
|
21260
|
+
/** Bytes of recordings stored on this PHYSICAL volume (all aliases). */
|
|
21078
21261
|
usedBytes: number(),
|
|
21079
21262
|
/** Free bytes on the location's volume; null when capacity is unknown (remote). */
|
|
21080
21263
|
availableBytes: number().nullable(),
|
|
@@ -21186,6 +21369,44 @@ method(object({
|
|
|
21186
21369
|
}), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
|
|
21187
21370
|
kind: "query",
|
|
21188
21371
|
auth: "admin"
|
|
21372
|
+
}), method(object({
|
|
21373
|
+
deviceId: number(),
|
|
21374
|
+
aroundMs: number(),
|
|
21375
|
+
preRollSec: number().min(0).max(30).default(2),
|
|
21376
|
+
postRollSec: number().min(0).max(30).default(5),
|
|
21377
|
+
maxWidth: number().int().min(120).max(1280).default(480),
|
|
21378
|
+
fps: number().int().min(1).max(15).default(5)
|
|
21379
|
+
}), object({
|
|
21380
|
+
gifBase64: string(),
|
|
21381
|
+
fromMs: number(),
|
|
21382
|
+
toMs: number()
|
|
21383
|
+
}), {
|
|
21384
|
+
kind: "mutation",
|
|
21385
|
+
auth: "admin"
|
|
21386
|
+
}), method(object({
|
|
21387
|
+
deviceId: number(),
|
|
21388
|
+
aroundMs: number(),
|
|
21389
|
+
preRollSec: number().min(0).max(30).default(3),
|
|
21390
|
+
postRollSec: number().min(0).max(30).default(7),
|
|
21391
|
+
maxWidth: number().int().min(160).max(1920).default(640)
|
|
21392
|
+
}), object({
|
|
21393
|
+
clipBase64: string(),
|
|
21394
|
+
mime: string(),
|
|
21395
|
+
fromMs: number(),
|
|
21396
|
+
toMs: number(),
|
|
21397
|
+
bytes: number().int()
|
|
21398
|
+
}), {
|
|
21399
|
+
kind: "mutation",
|
|
21400
|
+
auth: "admin"
|
|
21401
|
+
}), method(RelocateFootageInputSchema, object({ jobId: string() }), {
|
|
21402
|
+
kind: "mutation",
|
|
21403
|
+
auth: "admin"
|
|
21404
|
+
}), method(object({}), array(RelocateJobSchema).readonly(), {
|
|
21405
|
+
kind: "query",
|
|
21406
|
+
auth: "admin"
|
|
21407
|
+
}), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
|
|
21408
|
+
kind: "mutation",
|
|
21409
|
+
auth: "admin"
|
|
21189
21410
|
});
|
|
21190
21411
|
/**
|
|
21191
21412
|
* `recordingExport` cap — render a footage time range into a single downloadable
|
|
@@ -23671,6 +23892,12 @@ Object.freeze({
|
|
|
23671
23892
|
addonId: null,
|
|
23672
23893
|
access: "view"
|
|
23673
23894
|
},
|
|
23895
|
+
"localNetwork.getNotificationEndpoint": {
|
|
23896
|
+
capName: "local-network",
|
|
23897
|
+
capScope: "system",
|
|
23898
|
+
addonId: null,
|
|
23899
|
+
access: "view"
|
|
23900
|
+
},
|
|
23674
23901
|
"localNetwork.getPreferred": {
|
|
23675
23902
|
capName: "local-network",
|
|
23676
23903
|
capScope: "system",
|
|
@@ -23695,6 +23922,12 @@ Object.freeze({
|
|
|
23695
23922
|
addonId: null,
|
|
23696
23923
|
access: "create"
|
|
23697
23924
|
},
|
|
23925
|
+
"localNetwork.setNotificationEndpoint": {
|
|
23926
|
+
capName: "local-network",
|
|
23927
|
+
capScope: "system",
|
|
23928
|
+
addonId: null,
|
|
23929
|
+
access: "create"
|
|
23930
|
+
},
|
|
23698
23931
|
"lockControl.lock": {
|
|
23699
23932
|
capName: "lock-control",
|
|
23700
23933
|
capScope: "device",
|
|
@@ -24337,6 +24570,12 @@ Object.freeze({
|
|
|
24337
24570
|
addonId: null,
|
|
24338
24571
|
access: "create"
|
|
24339
24572
|
},
|
|
24573
|
+
"pipelineAnalytics.cancelMediaRelocate": {
|
|
24574
|
+
capName: "pipeline-analytics",
|
|
24575
|
+
capScope: "device",
|
|
24576
|
+
addonId: null,
|
|
24577
|
+
access: "create"
|
|
24578
|
+
},
|
|
24340
24579
|
"pipelineAnalytics.clearTracks": {
|
|
24341
24580
|
capName: "pipeline-analytics",
|
|
24342
24581
|
capScope: "device",
|
|
@@ -24391,6 +24630,12 @@ Object.freeze({
|
|
|
24391
24630
|
addonId: null,
|
|
24392
24631
|
access: "view"
|
|
24393
24632
|
},
|
|
24633
|
+
"pipelineAnalytics.getMediaRelocateStatus": {
|
|
24634
|
+
capName: "pipeline-analytics",
|
|
24635
|
+
capScope: "device",
|
|
24636
|
+
addonId: null,
|
|
24637
|
+
access: "view"
|
|
24638
|
+
},
|
|
24394
24639
|
"pipelineAnalytics.getMotionEvents": {
|
|
24395
24640
|
capName: "pipeline-analytics",
|
|
24396
24641
|
capScope: "device",
|
|
@@ -24463,6 +24708,12 @@ Object.freeze({
|
|
|
24463
24708
|
addonId: null,
|
|
24464
24709
|
access: "create"
|
|
24465
24710
|
},
|
|
24711
|
+
"pipelineAnalytics.relocateMedia": {
|
|
24712
|
+
capName: "pipeline-analytics",
|
|
24713
|
+
capScope: "device",
|
|
24714
|
+
addonId: null,
|
|
24715
|
+
access: "create"
|
|
24716
|
+
},
|
|
24466
24717
|
"pipelineAnalytics.searchObjectEvents": {
|
|
24467
24718
|
capName: "pipeline-analytics",
|
|
24468
24719
|
capScope: "device",
|
|
@@ -25225,6 +25476,12 @@ Object.freeze({
|
|
|
25225
25476
|
addonId: null,
|
|
25226
25477
|
access: "create"
|
|
25227
25478
|
},
|
|
25479
|
+
"recording.cancelRelocate": {
|
|
25480
|
+
capName: "recording",
|
|
25481
|
+
capScope: "system",
|
|
25482
|
+
addonId: null,
|
|
25483
|
+
access: "create"
|
|
25484
|
+
},
|
|
25228
25485
|
"recording.deleteFootprint": {
|
|
25229
25486
|
capName: "recording",
|
|
25230
25487
|
capScope: "system",
|
|
@@ -25255,6 +25512,12 @@ Object.freeze({
|
|
|
25255
25512
|
addonId: null,
|
|
25256
25513
|
access: "view"
|
|
25257
25514
|
},
|
|
25515
|
+
"recording.getRelocateStatus": {
|
|
25516
|
+
capName: "recording",
|
|
25517
|
+
capScope: "system",
|
|
25518
|
+
addonId: null,
|
|
25519
|
+
access: "view"
|
|
25520
|
+
},
|
|
25258
25521
|
"recording.getStorageUsage": {
|
|
25259
25522
|
capName: "recording",
|
|
25260
25523
|
capScope: "system",
|
|
@@ -25285,6 +25548,24 @@ Object.freeze({
|
|
|
25285
25548
|
addonId: null,
|
|
25286
25549
|
access: "view"
|
|
25287
25550
|
},
|
|
25551
|
+
"recording.relocateFootage": {
|
|
25552
|
+
capName: "recording",
|
|
25553
|
+
capScope: "system",
|
|
25554
|
+
addonId: null,
|
|
25555
|
+
access: "create"
|
|
25556
|
+
},
|
|
25557
|
+
"recording.renderClip": {
|
|
25558
|
+
capName: "recording",
|
|
25559
|
+
capScope: "system",
|
|
25560
|
+
addonId: null,
|
|
25561
|
+
access: "create"
|
|
25562
|
+
},
|
|
25563
|
+
"recording.renderGif": {
|
|
25564
|
+
capName: "recording",
|
|
25565
|
+
capScope: "system",
|
|
25566
|
+
addonId: null,
|
|
25567
|
+
access: "create"
|
|
25568
|
+
},
|
|
25288
25569
|
"recording.rescanStorage": {
|
|
25289
25570
|
capName: "recording",
|
|
25290
25571
|
capScope: "system",
|
|
@@ -25879,6 +26160,12 @@ Object.freeze({
|
|
|
25879
26160
|
addonId: null,
|
|
25880
26161
|
access: "create"
|
|
25881
26162
|
},
|
|
26163
|
+
"streamBroker.renderPreBufferClip": {
|
|
26164
|
+
capName: "stream-broker",
|
|
26165
|
+
capScope: "system",
|
|
26166
|
+
addonId: null,
|
|
26167
|
+
access: "create"
|
|
26168
|
+
},
|
|
25882
26169
|
"streamBroker.restartProfile": {
|
|
25883
26170
|
capName: "stream-broker",
|
|
25884
26171
|
capScope: "system",
|
|
@@ -26573,7 +26860,7 @@ var NOTIFIER_ICONS = {
|
|
|
26573
26860
|
/** The addon id — also the `/addon/<id>/…` route prefix. Mirrors `NOTIFIERS_ADDON_ID`. */
|
|
26574
26861
|
var NOTIFIERS_ROUTE_ID = "notifiers";
|
|
26575
26862
|
/** One day; icons are immutable per addon version. */
|
|
26576
|
-
var CACHE_CONTROL = "public, max-age=86400, immutable";
|
|
26863
|
+
var CACHE_CONTROL$1 = "public, max-age=86400, immutable";
|
|
26577
26864
|
var ICON_KINDS = new Set(Object.keys(NOTIFIER_ICONS));
|
|
26578
26865
|
/** `true` when a bundled brand icon exists for `kind`. */
|
|
26579
26866
|
function hasIcon(kind) {
|
|
@@ -26587,6 +26874,15 @@ function hasIcon(kind) {
|
|
|
26587
26874
|
function iconUrlFor(kind) {
|
|
26588
26875
|
return hasIcon(kind) ? `/addon/${NOTIFIERS_ROUTE_ID}/icons/${kind}` : void 0;
|
|
26589
26876
|
}
|
|
26877
|
+
/**
|
|
26878
|
+
* The media type `iconUrlFor(kind)` serves, or `undefined` when no icon is
|
|
26879
|
+
* bundled. The client needs it because SVG and raster render through different
|
|
26880
|
+
* components on React Native, and it cannot be guessed from the URL — the route
|
|
26881
|
+
* path deliberately carries no file extension.
|
|
26882
|
+
*/
|
|
26883
|
+
function iconMediaTypeFor(kind) {
|
|
26884
|
+
return hasIcon(kind) ? NOTIFIER_ICONS[kind].contentType : void 0;
|
|
26885
|
+
}
|
|
26590
26886
|
/** Pre-encode one bundled icon into every content coding. */
|
|
26591
26887
|
function encodeIcon(icon) {
|
|
26592
26888
|
const identity = typeof icon.body === "string" ? Buffer.from(icon.body, "utf8") : Buffer.from(icon.body);
|
|
@@ -26622,15 +26918,143 @@ function iconRoute(kind) {
|
|
|
26622
26918
|
description: `Official brand icon (${encoded.contentType}) for the '${kind}' notifier kind.`,
|
|
26623
26919
|
handler: async (request, reply) => {
|
|
26624
26920
|
const coding = negotiateEncoding(String(request.headers["accept-encoding"] ?? ""));
|
|
26625
|
-
reply.code(200).type(encoded.contentType).header("cache-control", CACHE_CONTROL).header("vary", "accept-encoding");
|
|
26921
|
+
reply.code(200).type(encoded.contentType).header("cache-control", CACHE_CONTROL$1).header("vary", "accept-encoding");
|
|
26626
26922
|
if (coding !== null) reply.header("content-encoding", coding);
|
|
26627
26923
|
reply.send(coding !== null ? encoded[coding] : encoded.identity);
|
|
26628
26924
|
}
|
|
26629
26925
|
};
|
|
26630
26926
|
}
|
|
26631
|
-
/**
|
|
26632
|
-
|
|
26633
|
-
|
|
26927
|
+
/**
|
|
26928
|
+
* The icon routes, for composition into the addon's SINGLE `addon-routes`
|
|
26929
|
+
* provider. Not a provider of its own: a provider owns one route id and matches
|
|
26930
|
+
* paths within it, so the icons and the test samples must share one route set
|
|
26931
|
+
* (see `sample-routes.ts`).
|
|
26932
|
+
*/
|
|
26933
|
+
function iconRoutes() {
|
|
26934
|
+
return Object.keys(NOTIFIER_ICONS).map(iconRoute);
|
|
26935
|
+
}
|
|
26936
|
+
//#endregion
|
|
26937
|
+
//#region src/sample-routes.ts
|
|
26938
|
+
/**
|
|
26939
|
+
* Serves the bundled test-notification sample media over the addon's own HTTP
|
|
26940
|
+
* surface via the `addon-routes` cap. One public GET route per sample:
|
|
26941
|
+
*
|
|
26942
|
+
* GET /addon/notifiers/samples/<name> → the bundled sample bytes
|
|
26943
|
+
*
|
|
26944
|
+
* WHY THIS EXISTS
|
|
26945
|
+
* ───────────────
|
|
26946
|
+
* The test panel used to attach `https://example.com/sample.jpg` — the IANA
|
|
26947
|
+
* reserved documentation domain, which serves no media. Every "does my target
|
|
26948
|
+
* deliver an image / gif / video" test was therefore broken by construction and
|
|
26949
|
+
* had never verified anything. The samples have to live somewhere the addon can
|
|
26950
|
+
* actually fetch, on an install with no internet, so they ship with the addon.
|
|
26951
|
+
*
|
|
26952
|
+
* The bytes are read from `assets/samples/` (not embedded in TS): a 128 KB mp4
|
|
26953
|
+
* as a base64 literal would inflate the bundle by ~170 KB of source. Path
|
|
26954
|
+
* resolution mirrors `addon-benchmark`'s `resolveFixturesDir` — `import.meta.url`
|
|
26955
|
+
* always points at the compiled bundle under `dist/`, so walking up one
|
|
26956
|
+
* directory lands on the package root whether the addon runs from source (tsx)
|
|
26957
|
+
* or from its built bundle.
|
|
26958
|
+
*
|
|
26959
|
+
* CONTENT-ENCODING IS OURS, DELIBERATELY
|
|
26960
|
+
* ──────────────────────────────────────
|
|
26961
|
+
* Same hazard `icon-routes.ts` documents: the hub pipes an addon route's reply
|
|
26962
|
+
* through its global `@fastify/compress`, and on the forked-addon UDS route
|
|
26963
|
+
* bridge that compressor emits an EMPTY brotli stream for a compressible body
|
|
26964
|
+
* over 1 KiB. The compressor skips a response that already declares a
|
|
26965
|
+
* non-identity `content-encoding`, so we negotiate and stamp it ourselves.
|
|
26966
|
+
*
|
|
26967
|
+
* Media types here are all ALREADY compressed (JPEG/GIF/MP4/MP3), so we serve
|
|
26968
|
+
* identity bytes and stamp `content-encoding: identity` — re-compressing them
|
|
26969
|
+
* wastes CPU for no gain, and the explicit header is what keeps the hub's
|
|
26970
|
+
* compressor off a body it would corrupt.
|
|
26971
|
+
*/
|
|
26972
|
+
/** Samples are immutable per addon version. */
|
|
26973
|
+
var CACHE_CONTROL = "public, max-age=86400, immutable";
|
|
26974
|
+
/**
|
|
26975
|
+
* The bundled set. Keyed by the `AttachmentMediaType` each one exercises, so a
|
|
26976
|
+
* caps-driven test panel can ask for "the sample for this media type" without
|
|
26977
|
+
* knowing filenames. `icon` deliberately reuses the image sample — an icon slot
|
|
26978
|
+
* wants a small raster, and shipping a fifth file to say the same thing is
|
|
26979
|
+
* waste.
|
|
26980
|
+
*/
|
|
26981
|
+
var SAMPLES = [
|
|
26982
|
+
{
|
|
26983
|
+
name: "image",
|
|
26984
|
+
file: "image.jpg",
|
|
26985
|
+
contentType: "image/jpeg"
|
|
26986
|
+
},
|
|
26987
|
+
{
|
|
26988
|
+
name: "gif",
|
|
26989
|
+
file: "animation.gif",
|
|
26990
|
+
contentType: "image/gif"
|
|
26991
|
+
},
|
|
26992
|
+
{
|
|
26993
|
+
name: "video",
|
|
26994
|
+
file: "clip.mp4",
|
|
26995
|
+
contentType: "video/mp4"
|
|
26996
|
+
},
|
|
26997
|
+
{
|
|
26998
|
+
name: "audio",
|
|
26999
|
+
file: "tone.mp3",
|
|
27000
|
+
contentType: "audio/mpeg"
|
|
27001
|
+
},
|
|
27002
|
+
{
|
|
27003
|
+
name: "icon",
|
|
27004
|
+
file: "image.jpg",
|
|
27005
|
+
contentType: "image/jpeg"
|
|
27006
|
+
}
|
|
27007
|
+
];
|
|
27008
|
+
new Set(SAMPLES.map((s) => s.name));
|
|
27009
|
+
/** Resolve the addon's bundled samples directory (see the file header). */
|
|
27010
|
+
function resolveSamplesDir() {
|
|
27011
|
+
const here = fileURLToPath(import.meta.url);
|
|
27012
|
+
const pkgRoot = path.resolve(path.dirname(here), "..");
|
|
27013
|
+
return path.join(pkgRoot, "assets", "samples");
|
|
27014
|
+
}
|
|
27015
|
+
/**
|
|
27016
|
+
* Read every sample eagerly so a missing asset fails at BOOT with a clear
|
|
27017
|
+
* error, rather than on the first operator click with a 500 that reads as a
|
|
27018
|
+
* broken notifier.
|
|
27019
|
+
*/
|
|
27020
|
+
function loadSamples() {
|
|
27021
|
+
const dir = resolveSamplesDir();
|
|
27022
|
+
const out = /* @__PURE__ */ new Map();
|
|
27023
|
+
for (const sample of SAMPLES) {
|
|
27024
|
+
const bytes = readFileSync(path.join(dir, sample.file));
|
|
27025
|
+
out.set(sample.name, {
|
|
27026
|
+
contentType: sample.contentType,
|
|
27027
|
+
bytes
|
|
27028
|
+
});
|
|
27029
|
+
}
|
|
27030
|
+
return out;
|
|
27031
|
+
}
|
|
27032
|
+
/** One static GET route serving a single bundled sample. */
|
|
27033
|
+
function sampleRoute(sample, loaded) {
|
|
27034
|
+
return {
|
|
27035
|
+
method: "GET",
|
|
27036
|
+
path: `/samples/${sample.name}`,
|
|
27037
|
+
access: "public",
|
|
27038
|
+
description: `Bundled ${sample.contentType} test sample for the '${sample.name}' attachment slot.`,
|
|
27039
|
+
handler: async (_request, reply) => {
|
|
27040
|
+
reply.code(200).type(loaded.contentType).header("cache-control", CACHE_CONTROL).header("content-encoding", "identity").header("content-length", String(loaded.bytes.byteLength));
|
|
27041
|
+
reply.send(loaded.bytes);
|
|
27042
|
+
}
|
|
27043
|
+
};
|
|
27044
|
+
}
|
|
27045
|
+
/**
|
|
27046
|
+
* The sample routes, for composition into the addon's SINGLE `addon-routes`
|
|
27047
|
+
* provider. Deliberately not a provider of its own: a provider owns one route
|
|
27048
|
+
* id and matches paths within it, so two providers sharing `notifiers` would
|
|
27049
|
+
* collide — the icons and the samples must travel in one route set.
|
|
27050
|
+
*/
|
|
27051
|
+
function sampleRoutes() {
|
|
27052
|
+
const loaded = loadSamples();
|
|
27053
|
+
return SAMPLES.map((sample) => {
|
|
27054
|
+
const bytes = loaded.get(sample.name);
|
|
27055
|
+
if (bytes === void 0) throw new Error(`notifiers: sample '${sample.name}' failed to load`);
|
|
27056
|
+
return sampleRoute(sample, bytes);
|
|
27057
|
+
});
|
|
26634
27058
|
}
|
|
26635
27059
|
//#endregion
|
|
26636
27060
|
//#region src/nc-target-actions.ts
|
|
@@ -29219,6 +29643,7 @@ function createNotificationOutputProvider(deps) {
|
|
|
29219
29643
|
};
|
|
29220
29644
|
}
|
|
29221
29645
|
const iconUrlFor = deps.iconUrlFor;
|
|
29646
|
+
const iconMediaTypeFor = deps.iconMediaTypeFor;
|
|
29222
29647
|
return {
|
|
29223
29648
|
listTargetKinds: async () => deps.adapters.map((a) => {
|
|
29224
29649
|
const descriptor = {
|
|
@@ -29226,10 +29651,16 @@ function createNotificationOutputProvider(deps) {
|
|
|
29226
29651
|
addonId
|
|
29227
29652
|
};
|
|
29228
29653
|
const iconUrl = iconUrlFor?.(a.descriptor.kind);
|
|
29229
|
-
|
|
29654
|
+
if (iconUrl === void 0) return descriptor;
|
|
29655
|
+
const iconMediaType = iconMediaTypeFor?.(a.descriptor.kind);
|
|
29656
|
+
return iconMediaType !== void 0 ? {
|
|
29657
|
+
...descriptor,
|
|
29658
|
+
iconUrl,
|
|
29659
|
+
iconMediaType
|
|
29660
|
+
} : {
|
|
29230
29661
|
...descriptor,
|
|
29231
29662
|
iconUrl
|
|
29232
|
-
}
|
|
29663
|
+
};
|
|
29233
29664
|
}),
|
|
29234
29665
|
listTargets: async () => {
|
|
29235
29666
|
return (await store.list()).map((target) => {
|
|
@@ -29500,9 +29931,10 @@ var NotifiersAddon = class extends BaseAddon {
|
|
|
29500
29931
|
store,
|
|
29501
29932
|
adapters: ADAPTERS,
|
|
29502
29933
|
logger: this.ctx.logger.child("notification-output"),
|
|
29503
|
-
iconUrlFor
|
|
29934
|
+
iconUrlFor,
|
|
29935
|
+
iconMediaTypeFor
|
|
29504
29936
|
});
|
|
29505
|
-
const
|
|
29937
|
+
const routeProvider = buildAddonRouteProvider(NOTIFIERS_ADDON_ID, [...iconRoutes(), ...sampleRoutes()]);
|
|
29506
29938
|
const ncHandlers = makeNcTargetHandlers({
|
|
29507
29939
|
provider,
|
|
29508
29940
|
logger: this.ctx.logger.child("nc-target-actions")
|
|
@@ -29514,7 +29946,7 @@ var NotifiersAddon = class extends BaseAddon {
|
|
|
29514
29946
|
provider
|
|
29515
29947
|
}, {
|
|
29516
29948
|
capability: addonRoutesCapability,
|
|
29517
|
-
provider:
|
|
29949
|
+
provider: routeProvider
|
|
29518
29950
|
}],
|
|
29519
29951
|
customActions: ncTargetActions,
|
|
29520
29952
|
actionHandlers: ncHandlers
|