@byok-sdk/core 0.27.0 → 0.28.0

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,49 @@
1
+ export declare const ROUTINE_DAYS_OF_WEEK: readonly ["mon", "tue", "wed", "thu", "fri", "sat", "sun"];
2
+ export type RoutineDayOfWeek = (typeof ROUTINE_DAYS_OF_WEEK)[number];
3
+ /**
4
+ * One local time per matching day. No daysOfWeek and no dayOfMonth: every
5
+ * day. daysOfWeek: those weekdays only. dayOfMonth: that day of every month,
6
+ * or of `month` only. daysOfWeek and dayOfMonth never appear together;
7
+ * `month` needs `dayOfMonth`.
8
+ */
9
+ export interface RoutineSchedule {
10
+ readonly minute: number;
11
+ readonly hour: number;
12
+ readonly daysOfWeek?: readonly RoutineDayOfWeek[];
13
+ readonly dayOfMonth?: number;
14
+ readonly month?: number;
15
+ readonly tz: string;
16
+ }
17
+ /**
18
+ * 368 days: a yearly date can be 366 days plus a DST shift apart (leap year
19
+ * in between, DST state flips). The embedded wake limit must match this value.
20
+ */
21
+ export declare const ROUTINE_HORIZON_MS: number;
22
+ /**
23
+ * Supported `now`: [2000-01-01T00:00Z, 2200-01-01T00:00Z). Before 1972 some
24
+ * zones have second-level offsets (Africa/Monrovia); past 2200 tz rules are
25
+ * projections. Date and Intl themselves cover ±8.64e15 ms.
26
+ */
27
+ export declare const ROUTINE_MIN_NOW: number;
28
+ export declare const ROUTINE_MAX_NOW: number;
29
+ export type RoutineScheduleIssueCode = 'schedule_invalid' | 'schedule_unreachable' | 'schedule_beyond_horizon' | 'tz_invalid';
30
+ export type RoutineScheduleCheck = {
31
+ readonly ok: true;
32
+ } | {
33
+ readonly ok: false;
34
+ readonly code: RoutineScheduleIssueCode;
35
+ readonly message: string;
36
+ };
37
+ /** Validation only. The Host calls it when it applies create_routine / update_routine. */
38
+ export declare function checkRoutineSchedule(schedule: RoutineSchedule): RoutineScheduleCheck;
39
+ /**
40
+ * The first occurrence strictly after `now` (epoch ms): the instant at which
41
+ * the zone's wall clock shows the schedule's whole local minute on a matching
42
+ * date. Null when none falls within ROUTINE_HORIZON_MS. Throws on an invalid
43
+ * schedule.
44
+ *
45
+ * Scan from the local date before `now`; keep the running minimum `best` of
46
+ * candidates after `now`; stop at the first unshifted candidate, because a
47
+ * later local time never resolves earlier. Assumes a gap is at most one day.
48
+ */
49
+ export declare function nextRoutineOccurrence(schedule: RoutineSchedule, now: number): number | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@byok-sdk/core",
3
- "version": "0.27.0",
3
+ "version": "0.28.0",
4
4
  "description": "BYOK SDK platform contracts: branded tenant identity, tenant-first store ports, device proof canonicalization, and the composition conformance reference",
5
5
  "type": "module",
6
6
  "license": "MIT",