@camstack/types 1.2.12 → 1.2.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,136 @@
1
+ /**
2
+ * TimelapseRule — the STANDALONE scheduled timelapse producer's rule model.
3
+ *
4
+ * Spec: `docs/superpowers/specs/2026-07-24-nc-occupancy-timelapse-design.md`
5
+ * §3.2/§3.3.
6
+ *
7
+ * Deliberately NOT a capability definition and NOT an `NcRule`:
8
+ * - Every `NcDelivery` member is a *persisted-pipeline-record* trigger. A
9
+ * timelapse fires on a SCHEDULE WINDOW BOUNDARY, evaluates no pipeline
10
+ * record, and produces a video it assembled itself — so it rides no
11
+ * delivery-enum member (the enum is frozen) and no cap method. This file is
12
+ * a plain typed schema; it does NOT go through `npm run codegen`.
13
+ * - It shares only the delivery leg (`notification-output.send`) and the
14
+ * persistence/ownership patterns with the Notification Center, reusing
15
+ * {@link NcScheduleSchema} (weekly windows, midnight-crossing, invertible)
16
+ * and {@link NcRuleTargetSchema} (target ref + passthrough params).
17
+ *
18
+ * Ownership is SERVER-DERIVED. `ownerUserId` / `createdBy` / `createdAt` /
19
+ * `updatedAt` / `id` / `lastGeneratedAt` live on the PERSISTED rule only —
20
+ * {@link TimelapseRuleInputSchema} and {@link TimelapseRulePatchSchema} do not
21
+ * carry them, so a forged client payload can never claim or re-own a rule
22
+ * (Zod strips unknown keys). The store stamps them from the resolved caller.
23
+ */
24
+ import { z } from 'zod';
25
+ /** `{{var}}` templating over camera/rule/time — same vocabulary as `NcRule`. */
26
+ export declare const TimelapseTemplateSchema: z.ZodObject<{
27
+ title: z.ZodOptional<z.ZodString>;
28
+ body: z.ZodOptional<z.ZodString>;
29
+ }, z.core.$strip>;
30
+ export type TimelapseTemplate = z.infer<typeof TimelapseTemplateSchema>;
31
+ /**
32
+ * Client-supplied timelapse-rule fields. The server stamps id / createdBy /
33
+ * createdAt / updatedAt / ownerUserId / lastGeneratedAt — none of them appear
34
+ * here (see the ownership note above).
35
+ */
36
+ export declare const TimelapseRuleInputSchema: z.ZodObject<{
37
+ name: z.ZodString;
38
+ enabled: z.ZodDefault<z.ZodBoolean>;
39
+ deviceIds: z.ZodArray<z.ZodNumber>;
40
+ schedule: z.ZodObject<{
41
+ windows: z.ZodArray<z.ZodObject<{
42
+ days: z.ZodArray<z.ZodNumber>;
43
+ startMinute: z.ZodNumber;
44
+ endMinute: z.ZodNumber;
45
+ }, z.core.$strip>>;
46
+ timezone: z.ZodOptional<z.ZodString>;
47
+ invert: z.ZodOptional<z.ZodBoolean>;
48
+ }, z.core.$strip>;
49
+ cadenceSec: z.ZodDefault<z.ZodNumber>;
50
+ framerate: z.ZodDefault<z.ZodNumber>;
51
+ targets: z.ZodArray<z.ZodObject<{
52
+ targetId: z.ZodString;
53
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
54
+ }, z.core.$strip>>;
55
+ template: z.ZodOptional<z.ZodObject<{
56
+ title: z.ZodOptional<z.ZodString>;
57
+ body: z.ZodOptional<z.ZodString>;
58
+ }, z.core.$strip>>;
59
+ priority: z.ZodDefault<z.ZodNumber>;
60
+ }, z.core.$strip>;
61
+ export type TimelapseRuleInput = z.infer<typeof TimelapseRuleInputSchema>;
62
+ /**
63
+ * Partial patch for an update — any subset of the INPUT fields, with NO
64
+ * defaults (an absent key means "leave unchanged", never "reset to default").
65
+ * Provenance and ownership are absent by construction: a patch can rename or
66
+ * retune a rule, never re-own it or forge its generation state.
67
+ *
68
+ * CLEAR SIGNAL: `template` is the one OPTIONAL field an editor can REMOVE, so
69
+ * it is `.nullable()` here and NOWHERE else. Wire representation:
70
+ * - key absent → leave the template unchanged
71
+ * - `"template": null` → CLEAR it (the persisted rule loses the key)
72
+ * - `"template": {...}` → replace it
73
+ * `undefined` is deliberately NOT the clear signal: it does not survive
74
+ * `JSON.stringify`, so a viewer editor could not express "remove". The
75
+ * PERSISTED rule never carries `null` — the store drops the key (see
76
+ * `TimelapseStore.update`).
77
+ */
78
+ export declare const TimelapseRulePatchSchema: z.ZodObject<{
79
+ name: z.ZodOptional<z.ZodString>;
80
+ enabled: z.ZodOptional<z.ZodBoolean>;
81
+ deviceIds: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
82
+ schedule: z.ZodOptional<z.ZodObject<{
83
+ windows: z.ZodArray<z.ZodObject<{
84
+ days: z.ZodArray<z.ZodNumber>;
85
+ startMinute: z.ZodNumber;
86
+ endMinute: z.ZodNumber;
87
+ }, z.core.$strip>>;
88
+ timezone: z.ZodOptional<z.ZodString>;
89
+ invert: z.ZodOptional<z.ZodBoolean>;
90
+ }, z.core.$strip>>;
91
+ cadenceSec: z.ZodOptional<z.ZodNumber>;
92
+ framerate: z.ZodOptional<z.ZodNumber>;
93
+ targets: z.ZodOptional<z.ZodArray<z.ZodObject<{
94
+ targetId: z.ZodString;
95
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
96
+ }, z.core.$strip>>>;
97
+ template: z.ZodOptional<z.ZodNullable<z.ZodObject<{
98
+ title: z.ZodOptional<z.ZodString>;
99
+ body: z.ZodOptional<z.ZodString>;
100
+ }, z.core.$strip>>>;
101
+ priority: z.ZodOptional<z.ZodNumber>;
102
+ }, z.core.$strip>;
103
+ export type TimelapseRulePatch = z.infer<typeof TimelapseRulePatchSchema>;
104
+ /** A persisted timelapse rule. */
105
+ export declare const TimelapseRuleSchema: z.ZodObject<{
106
+ name: z.ZodString;
107
+ enabled: z.ZodDefault<z.ZodBoolean>;
108
+ deviceIds: z.ZodArray<z.ZodNumber>;
109
+ schedule: z.ZodObject<{
110
+ windows: z.ZodArray<z.ZodObject<{
111
+ days: z.ZodArray<z.ZodNumber>;
112
+ startMinute: z.ZodNumber;
113
+ endMinute: z.ZodNumber;
114
+ }, z.core.$strip>>;
115
+ timezone: z.ZodOptional<z.ZodString>;
116
+ invert: z.ZodOptional<z.ZodBoolean>;
117
+ }, z.core.$strip>;
118
+ cadenceSec: z.ZodDefault<z.ZodNumber>;
119
+ framerate: z.ZodDefault<z.ZodNumber>;
120
+ targets: z.ZodArray<z.ZodObject<{
121
+ targetId: z.ZodString;
122
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
123
+ }, z.core.$strip>>;
124
+ template: z.ZodOptional<z.ZodObject<{
125
+ title: z.ZodOptional<z.ZodString>;
126
+ body: z.ZodOptional<z.ZodString>;
127
+ }, z.core.$strip>>;
128
+ priority: z.ZodDefault<z.ZodNumber>;
129
+ id: z.ZodString;
130
+ ownerUserId: z.ZodOptional<z.ZodString>;
131
+ lastGeneratedAt: z.ZodOptional<z.ZodNumber>;
132
+ createdBy: z.ZodString;
133
+ createdAt: z.ZodNumber;
134
+ updatedAt: z.ZodNumber;
135
+ }, z.core.$strip>;
136
+ export type TimelapseRule = z.infer<typeof TimelapseRuleSchema>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/types",
3
- "version": "1.2.12",
3
+ "version": "1.2.14",
4
4
  "description": "Shared types, interfaces, and model catalogs for the CamStack detection ecosystem",
5
5
  "keywords": [
6
6
  "camstack",