processfocus 0.1.0-next.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.
- package/LICENSE.md +28 -0
- package/README.md +14 -0
- package/dist/auth-FmXptohB.mjs +275 -0
- package/dist/auth-config/src/lib/authentication-config.d.ts +146 -0
- package/dist/auth-config/src/lib/custom-entities-config.d.ts +47 -0
- package/dist/auth-config/src/lib/policies-config.d.ts +52 -0
- package/dist/auth-config/src/lib/provider-types.d.ts +194 -0
- package/dist/auth.d.ts +4 -0
- package/dist/auth.mjs +2 -0
- package/dist/business-calendar/src/index.d.ts +10 -0
- package/dist/business-calendar/src/lib/calendar-config.d.ts +163 -0
- package/dist/business-calendar/src/lib/calendar-period.d.ts +88 -0
- package/dist/business-calendar/src/lib/calendar-service-impl.d.ts +19 -0
- package/dist/business-calendar/src/lib/calendar-service.d.ts +215 -0
- package/dist/business-calendar/src/lib/datetime-utils.d.ts +30 -0
- package/dist/business-calendar/src/lib/duration-calculator.d.ts +49 -0
- package/dist/business-calendar/src/lib/errors.d.ts +69 -0
- package/dist/business-calendar/src/lib/holiday-calculator.d.ts +61 -0
- package/dist/business-calendar/src/lib/holidays.d.ts +141 -0
- package/dist/business-calendar/src/lib/types.d.ts +110 -0
- package/dist/calendar.d.ts +1 -0
- package/dist/calendar.mjs +1204 -0
- package/dist/form-client-representation/src/index.d.ts +6 -0
- package/dist/form-client-representation/src/lib/as-client-representation.d.ts +31 -0
- package/dist/form-client-representation/src/lib/client-form-definition.d.ts +17 -0
- package/dist/form-client-representation/src/lib/extract-annotations.d.ts +20 -0
- package/dist/form-client-representation/src/lib/plugin-registry.d.ts +6 -0
- package/dist/form-client-representation/src/lib/types.d.ts +239 -0
- package/dist/form-client-representation/src/lib/walker.d.ts +68 -0
- package/dist/form-rule/src/index.d.ts +3 -0
- package/dist/form-rule/src/lib/evaluator.d.ts +2 -0
- package/dist/form-rule/src/lib/paths.d.ts +9 -0
- package/dist/form-rule/src/lib/types.d.ts +89 -0
- package/dist/form-schema/src/index.d.ts +8 -0
- package/dist/form-schema/src/lib/annotation-helpers.d.ts +8 -0
- package/dist/form-schema/src/lib/deferred-value.d.ts +10 -0
- package/dist/form-schema/src/lib/email.d.ts +23 -0
- package/dist/form-schema/src/lib/field-count.d.ts +32 -0
- package/dist/form-schema/src/lib/form-annotations.d.ts +25 -0
- package/dist/form-schema/src/lib/form-schema.d.ts +459 -0
- package/dist/form-schema/src/lib/phone.d.ts +4 -0
- package/dist/form-schema/src/lib/property-signature.d.ts +3 -0
- package/dist/form-submission-schema/src/index.d.ts +2 -0
- package/dist/form-submission-schema/src/lib/form-submission-schema.d.ts +49 -0
- package/dist/form-submission-schema/src/lib/schema-defaults.d.ts +16 -0
- package/dist/forms.d.ts +1 -0
- package/dist/forms.mjs +2 -0
- package/dist/frontend-manifest/src/index.d.ts +2 -0
- package/dist/frontend-manifest/src/lib/browser-plugin-artifact.d.ts +25 -0
- package/dist/frontend-manifest/src/lib/frontend-manifest.d.ts +83 -0
- package/dist/frontend-plugin-host/src/index.d.ts +2 -0
- package/dist/frontend-plugin-host/src/lib/frontend-plugin-host.d.ts +124 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.mjs +3780 -0
- package/dist/manifest.d.ts +2 -0
- package/dist/manifest.mjs +5 -0
- package/dist/paths-BkzLn-rG.mjs +282 -0
- package/dist/plugin.d.ts +3 -0
- package/dist/plugin.mjs +84 -0
- package/dist/process/src/lib/app-icons.d.ts +52 -0
- package/dist/process/src/lib/brands.d.ts +20 -0
- package/dist/process/src/lib/document-store.d.ts +30 -0
- package/dist/process/src/lib/execution-failure-notifications.d.ts +14 -0
- package/dist/process/src/lib/flow-context.d.ts +181 -0
- package/dist/process/src/lib/flow-path.d.ts +123 -0
- package/dist/process/src/lib/form-authoring.d.ts +19 -0
- package/dist/process/src/lib/form-decoration.d.ts +13 -0
- package/dist/process/src/lib/form-defaults.d.ts +5 -0
- package/dist/process/src/lib/form.d.ts +557 -0
- package/dist/process/src/lib/invitation.d.ts +35 -0
- package/dist/process/src/lib/list.d.ts +447 -0
- package/dist/process/src/lib/lookup-accessor.d.ts +68 -0
- package/dist/process/src/lib/node_step.d.ts +68 -0
- package/dist/process/src/lib/org-unit.d.ts +53 -0
- package/dist/process/src/lib/org-utils.d.ts +56 -0
- package/dist/process/src/lib/organisation-frontend-plugin-manifest.d.ts +33 -0
- package/dist/process/src/lib/organisation.d.ts +166 -0
- package/dist/process/src/lib/phase.d.ts +16 -0
- package/dist/process/src/lib/process.d.ts +196 -0
- package/dist/process/src/lib/public-form-branding.d.ts +27 -0
- package/dist/process/src/lib/role.d.ts +29 -0
- package/dist/process/src/lib/schedule.d.ts +239 -0
- package/dist/process/src/lib/sla.d.ts +84 -0
- package/dist/process/src/lib/stats-view.d.ts +68 -0
- package/dist/process/src/lib/step.d.ts +130 -0
- package/dist/process/src/lib/system-step-executor.d.ts +130 -0
- package/dist/process/src/lib/system-step.d.ts +248 -0
- package/dist/sdk/src/auth.d.ts +4 -0
- package/dist/sdk/src/calendar.d.ts +1 -0
- package/dist/sdk/src/forms.d.ts +1 -0
- package/dist/sdk/src/index.d.ts +26 -0
- package/dist/sdk/src/manifest.d.ts +2 -0
- package/dist/sdk/src/plugin.d.ts +3 -0
- package/dist/sdk/src/testing.d.ts +9 -0
- package/dist/src-C-909PVQ.mjs +498 -0
- package/dist/testing.d.ts +9 -0
- package/dist/testing.mjs +5 -0
- package/package.json +67 -0
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import { Context, type DateTime, type Duration, type Effect, type Option } from "effect";
|
|
2
|
+
import type { CalendarPeriod } from "./calendar-period.js";
|
|
3
|
+
import type { HolidayInstance } from "./holidays.js";
|
|
4
|
+
import type { DaySchedule } from "./types.js";
|
|
5
|
+
declare const BusinessCalendarError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
6
|
+
readonly _tag: "BusinessCalendarError";
|
|
7
|
+
} & Readonly<A>;
|
|
8
|
+
/**
|
|
9
|
+
* Error thrown when business calendar operations fail.
|
|
10
|
+
*/
|
|
11
|
+
export declare class BusinessCalendarError extends BusinessCalendarError_base<{
|
|
12
|
+
readonly message: string;
|
|
13
|
+
readonly cause?: unknown;
|
|
14
|
+
}> {
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Service interface for business calendar operations.
|
|
18
|
+
*/
|
|
19
|
+
export interface BusinessCalendarServiceShape {
|
|
20
|
+
/**
|
|
21
|
+
* Check if a date is a business day.
|
|
22
|
+
* A business day is a day that is:
|
|
23
|
+
* - Not a weekend (as defined by nonWorkingDays)
|
|
24
|
+
* - Not a holiday
|
|
25
|
+
* - Within an active period (if requireActivePeriod is set)
|
|
26
|
+
* - Not marked as "closed" by an exception
|
|
27
|
+
*/
|
|
28
|
+
readonly isBusinessDay: (date: DateTime.Utc) => Effect.Effect<boolean, never, never>;
|
|
29
|
+
/**
|
|
30
|
+
* Check if a datetime falls within business hours.
|
|
31
|
+
* Considers the effective schedule (exceptions > periods > default).
|
|
32
|
+
*/
|
|
33
|
+
readonly isBusinessHours: (datetime: DateTime.Utc) => Effect.Effect<boolean, never, never>;
|
|
34
|
+
/**
|
|
35
|
+
* Add a number of business days to a date.
|
|
36
|
+
* Skips weekends, holidays, and inactive periods.
|
|
37
|
+
* Does not fail when the search budget is exhausted; returns the last date
|
|
38
|
+
* reached under the internal iteration limit.
|
|
39
|
+
*
|
|
40
|
+
* @param date - Starting date
|
|
41
|
+
* @param days - Number of business days to add (can be negative)
|
|
42
|
+
*/
|
|
43
|
+
readonly addBusinessDays: (date: DateTime.Utc, days: number) => Effect.Effect<DateTime.Utc, never, never>;
|
|
44
|
+
/**
|
|
45
|
+
* Add a number of business hours to a datetime.
|
|
46
|
+
* Only counts time during business hours.
|
|
47
|
+
*
|
|
48
|
+
* Fails with `BusinessCalendarError` if no business day found within search limit
|
|
49
|
+
*
|
|
50
|
+
* @param datetime - Starting datetime
|
|
51
|
+
* @param hours - Number of business hours to add (must be positive)
|
|
52
|
+
*/
|
|
53
|
+
readonly addBusinessHours: (datetime: DateTime.Utc, hours: number) => Effect.Effect<DateTime.Utc, BusinessCalendarError, never>;
|
|
54
|
+
/**
|
|
55
|
+
* Get the next business day after a given date.
|
|
56
|
+
* If the given date is a business day, returns the next one.
|
|
57
|
+
*
|
|
58
|
+
* Fails with `BusinessCalendarError` if no business day found within search limit
|
|
59
|
+
*/
|
|
60
|
+
readonly nextBusinessDay: (date: DateTime.Utc) => Effect.Effect<DateTime.Utc, BusinessCalendarError, never>;
|
|
61
|
+
/**
|
|
62
|
+
* Get the previous business day before a given date.
|
|
63
|
+
* If the given date is a business day, returns the previous one.
|
|
64
|
+
*
|
|
65
|
+
* Fails with `BusinessCalendarError` if no business day found within search limit
|
|
66
|
+
*/
|
|
67
|
+
readonly previousBusinessDay: (date: DateTime.Utc) => Effect.Effect<DateTime.Utc, BusinessCalendarError, never>;
|
|
68
|
+
/**
|
|
69
|
+
* Get the start time of business hours for a given date.
|
|
70
|
+
* Returns None if the date is not a business day.
|
|
71
|
+
*/
|
|
72
|
+
readonly businessDayStart: (date: DateTime.Utc) => Effect.Effect<Option.Option<DateTime.Utc>, never, never>;
|
|
73
|
+
/**
|
|
74
|
+
* Get the end time of business hours for a given date.
|
|
75
|
+
* Returns None if the date is not a business day.
|
|
76
|
+
*/
|
|
77
|
+
readonly businessDayEnd: (date: DateTime.Utc) => Effect.Effect<Option.Option<DateTime.Utc>, never, never>;
|
|
78
|
+
/**
|
|
79
|
+
* Get remaining business hours from a datetime until end of business day.
|
|
80
|
+
* Returns zero if outside business hours or on a non-business day.
|
|
81
|
+
*/
|
|
82
|
+
readonly businessHoursRemaining: (datetime: DateTime.Utc) => Effect.Effect<Duration.Duration, never, never>;
|
|
83
|
+
/**
|
|
84
|
+
* Count business days between two dates (exclusive of end date).
|
|
85
|
+
*/
|
|
86
|
+
readonly businessDaysBetween: (start: DateTime.Utc, end: DateTime.Utc) => Effect.Effect<number, never, never>;
|
|
87
|
+
/**
|
|
88
|
+
* Calculate business hours between two datetimes.
|
|
89
|
+
* Only counts time during business hours on business days.
|
|
90
|
+
*/
|
|
91
|
+
readonly businessHoursBetween: (start: DateTime.Utc, end: DateTime.Utc) => Effect.Effect<Duration.Duration, BusinessCalendarError, never>;
|
|
92
|
+
/**
|
|
93
|
+
* Check if a date is a holiday.
|
|
94
|
+
*/
|
|
95
|
+
readonly isHoliday: (date: DateTime.Utc) => Effect.Effect<boolean, never, never>;
|
|
96
|
+
/**
|
|
97
|
+
* Get all holidays for a year.
|
|
98
|
+
*
|
|
99
|
+
* Calculation failures are logged and degrade to an empty list (never fail
|
|
100
|
+
* the typed error channel). Callers cannot distinguish "no holidays
|
|
101
|
+
* configured" from "calculation failed". Interruptions still propagate and
|
|
102
|
+
* are not cached as a successful empty year.
|
|
103
|
+
*/
|
|
104
|
+
readonly getHolidaysForYear: (year: number) => Effect.Effect<HolidayInstance[], never, never>;
|
|
105
|
+
/**
|
|
106
|
+
* Get all active periods for a date.
|
|
107
|
+
*/
|
|
108
|
+
readonly getActivePeriods: (date: DateTime.Utc) => Effect.Effect<CalendarPeriod[], never, never>;
|
|
109
|
+
/**
|
|
110
|
+
* Get active periods of a specific type for a date.
|
|
111
|
+
*/
|
|
112
|
+
readonly getActivePeriodsByType: (date: DateTime.Utc, type: string) => Effect.Effect<CalendarPeriod[], never, never>;
|
|
113
|
+
/**
|
|
114
|
+
* Check if a date is within any period of a specific type.
|
|
115
|
+
*/
|
|
116
|
+
readonly isWithinPeriodType: (date: DateTime.Utc, type: string) => Effect.Effect<boolean, never, never>;
|
|
117
|
+
/**
|
|
118
|
+
* Get all periods that overlap with a date range.
|
|
119
|
+
* Optionally filter by period type.
|
|
120
|
+
*/
|
|
121
|
+
readonly getPeriodsForDateRange: (start: DateTime.Utc, end: DateTime.Utc, type?: string) => Effect.Effect<CalendarPeriod[], never, never>;
|
|
122
|
+
/**
|
|
123
|
+
* Get the effective schedule for a date.
|
|
124
|
+
* Priority: exceptions > period overrides > default weekly schedule.
|
|
125
|
+
*/
|
|
126
|
+
readonly getEffectiveSchedule: (date: DateTime.Utc) => Effect.Effect<DaySchedule[], never, never>;
|
|
127
|
+
}
|
|
128
|
+
declare const BusinessCalendarService_base: Context.TagClass<BusinessCalendarService, "processfocus/calendar/BusinessCalendarService", BusinessCalendarServiceShape>;
|
|
129
|
+
/**
|
|
130
|
+
* Business Calendar Service tag.
|
|
131
|
+
*/
|
|
132
|
+
export declare class BusinessCalendarService extends BusinessCalendarService_base {
|
|
133
|
+
}
|
|
134
|
+
declare const BusinessCalendarConfigService_base: Context.TagClass<BusinessCalendarConfigService, "processfocus/calendar/BusinessCalendarConfigService", {
|
|
135
|
+
readonly weeklySchedule: readonly {
|
|
136
|
+
readonly day: number & import("effect/Brand").Brand<"DayOfWeek">;
|
|
137
|
+
readonly ranges: readonly {
|
|
138
|
+
readonly open: {
|
|
139
|
+
readonly hour: number;
|
|
140
|
+
readonly minute: number;
|
|
141
|
+
};
|
|
142
|
+
readonly close: {
|
|
143
|
+
readonly hour: number;
|
|
144
|
+
readonly minute: number;
|
|
145
|
+
};
|
|
146
|
+
}[];
|
|
147
|
+
}[];
|
|
148
|
+
readonly holidays: readonly ({
|
|
149
|
+
readonly name: string;
|
|
150
|
+
readonly day: number & import("effect/Brand").Brand<"DayOfMonth">;
|
|
151
|
+
readonly month: number & import("effect/Brand").Brand<"Month">;
|
|
152
|
+
readonly _tag: "FixedHoliday";
|
|
153
|
+
} | {
|
|
154
|
+
readonly name: string;
|
|
155
|
+
readonly month: number & import("effect/Brand").Brand<"Month">;
|
|
156
|
+
readonly _tag: "NthWeekdayHoliday";
|
|
157
|
+
readonly weekday: number & import("effect/Brand").Brand<"DayOfWeek">;
|
|
158
|
+
readonly nth: number & import("effect/Brand").Brand<"NthOccurrence">;
|
|
159
|
+
} | {
|
|
160
|
+
readonly name: string;
|
|
161
|
+
readonly month: number & import("effect/Brand").Brand<"Month">;
|
|
162
|
+
readonly _tag: "LastWeekdayHoliday";
|
|
163
|
+
readonly weekday: number & import("effect/Brand").Brand<"DayOfWeek">;
|
|
164
|
+
} | {
|
|
165
|
+
readonly name: string;
|
|
166
|
+
readonly _tag: "EasterRelativeHoliday";
|
|
167
|
+
readonly daysOffset: number;
|
|
168
|
+
})[];
|
|
169
|
+
readonly exceptions: readonly {
|
|
170
|
+
readonly date: DateTime.Utc;
|
|
171
|
+
readonly slots: readonly {
|
|
172
|
+
readonly open: {
|
|
173
|
+
readonly hour: number;
|
|
174
|
+
readonly minute: number;
|
|
175
|
+
};
|
|
176
|
+
readonly close: {
|
|
177
|
+
readonly hour: number;
|
|
178
|
+
readonly minute: number;
|
|
179
|
+
};
|
|
180
|
+
}[] | "closed";
|
|
181
|
+
readonly note?: string | undefined;
|
|
182
|
+
}[];
|
|
183
|
+
readonly nonWorkingDays: readonly (number & import("effect/Brand").Brand<"DayOfWeek">)[];
|
|
184
|
+
readonly periods: readonly {
|
|
185
|
+
readonly name: string;
|
|
186
|
+
readonly id: string;
|
|
187
|
+
readonly type: string;
|
|
188
|
+
readonly startDate: DateTime.Utc;
|
|
189
|
+
readonly endDate: DateTime.Utc;
|
|
190
|
+
readonly isActive: boolean;
|
|
191
|
+
readonly weeklySchedule?: readonly {
|
|
192
|
+
readonly day: number & import("effect/Brand").Brand<"DayOfWeek">;
|
|
193
|
+
readonly ranges: readonly {
|
|
194
|
+
readonly open: {
|
|
195
|
+
readonly hour: number;
|
|
196
|
+
readonly minute: number;
|
|
197
|
+
};
|
|
198
|
+
readonly close: {
|
|
199
|
+
readonly hour: number;
|
|
200
|
+
readonly minute: number;
|
|
201
|
+
};
|
|
202
|
+
}[];
|
|
203
|
+
}[] | undefined;
|
|
204
|
+
}[];
|
|
205
|
+
readonly requireActivePeriod?: string | undefined;
|
|
206
|
+
readonly startDayOfWeek?: (number & import("effect/Brand").Brand<"DayOfWeek">) | undefined;
|
|
207
|
+
readonly timezone?: string | undefined;
|
|
208
|
+
}>;
|
|
209
|
+
/**
|
|
210
|
+
* Business Calendar Config Service tag.
|
|
211
|
+
* Used to provide the configuration to the service implementation.
|
|
212
|
+
*/
|
|
213
|
+
export declare class BusinessCalendarConfigService extends BusinessCalendarConfigService_base {
|
|
214
|
+
}
|
|
215
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { DateTime } from "effect";
|
|
2
|
+
/**
|
|
3
|
+
* Create a DateTime.Utc for a specific date and time.
|
|
4
|
+
*
|
|
5
|
+
* Note: DateTime.unsafeMake with object params sets time components to 0,
|
|
6
|
+
* so we use mutate to set the desired time.
|
|
7
|
+
*
|
|
8
|
+
* @param year - Year (e.g., 2025)
|
|
9
|
+
* @param month - Month (1-12)
|
|
10
|
+
* @param day - Day of month (1-31)
|
|
11
|
+
* @param hour - Hour (0-23), defaults to 0
|
|
12
|
+
* @param minute - Minute (0-59), defaults to 0
|
|
13
|
+
* @returns DateTime.Utc at the specified date and time
|
|
14
|
+
*/
|
|
15
|
+
export declare const makeDateTimeWithTime: (year: number, month: number, day: number, hour?: number, minute?: number) => DateTime.Utc;
|
|
16
|
+
/**
|
|
17
|
+
* Get a DateTime.Utc at the start of the day (00:00:00.000).
|
|
18
|
+
*
|
|
19
|
+
* @param date - The source DateTime
|
|
20
|
+
* @returns DateTime.Utc at midnight of the same date
|
|
21
|
+
*/
|
|
22
|
+
export declare const startOfDay: (date: DateTime.Utc) => DateTime.Utc;
|
|
23
|
+
/**
|
|
24
|
+
* Check if two DateTime.Utc values represent the same calendar date.
|
|
25
|
+
*
|
|
26
|
+
* @param a - First DateTime
|
|
27
|
+
* @param b - Second DateTime
|
|
28
|
+
* @returns true if same year, month, and day
|
|
29
|
+
*/
|
|
30
|
+
export declare const isSameDate: (a: DateTime.Utc, b: DateTime.Utc) => boolean;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Duration, Effect } from "effect";
|
|
2
|
+
import type { BusinessCalendarError, BusinessCalendarServiceShape } from "./calendar-service.js";
|
|
3
|
+
/**
|
|
4
|
+
* Timestamp pair from a completed execution.
|
|
5
|
+
*/
|
|
6
|
+
export interface TimestampPair {
|
|
7
|
+
/** Identifier for grouping (e.g., processId) */
|
|
8
|
+
id: string;
|
|
9
|
+
/** Start time in epoch milliseconds */
|
|
10
|
+
createdAt: number;
|
|
11
|
+
/** Finish time in epoch milliseconds */
|
|
12
|
+
finishedAt: number;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Duration statistics for a group of timestamp pairs.
|
|
16
|
+
*/
|
|
17
|
+
export interface DurationStats {
|
|
18
|
+
/** The identifier (e.g., processId) */
|
|
19
|
+
id: string;
|
|
20
|
+
/** Minimum business-hours duration in milliseconds, null if no samples */
|
|
21
|
+
minBusinessDurationMs: number | null;
|
|
22
|
+
/** Maximum business-hours duration in milliseconds, null if no samples */
|
|
23
|
+
maxBusinessDurationMs: number | null;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Calculate business-hours duration for a single timestamp pair.
|
|
27
|
+
* Uses a resolved BusinessCalendarService shape (no ambient service tag).
|
|
28
|
+
*/
|
|
29
|
+
export declare const calculateBusinessDuration: (calendarService: BusinessCalendarServiceShape, createdAt: number, finishedAt: number) => Effect.Effect<Duration.Duration, BusinessCalendarError, never>;
|
|
30
|
+
/**
|
|
31
|
+
* Calculate business-hours duration for multiple timestamp pairs.
|
|
32
|
+
* Groups by id and returns min/max statistics for each group.
|
|
33
|
+
*
|
|
34
|
+
* Independent pairs are evaluated with bounded concurrency; min/max
|
|
35
|
+
* aggregation is order-independent.
|
|
36
|
+
*
|
|
37
|
+
* @param calendarService - Resolved calendar service for the org unit
|
|
38
|
+
* @param timestampPairs - Array of timestamp pairs with their grouping id
|
|
39
|
+
* @returns Map of id to duration statistics
|
|
40
|
+
*/
|
|
41
|
+
export declare const calculateBusinessDurations: (calendarService: BusinessCalendarServiceShape, timestampPairs: readonly TimestampPair[]) => Effect.Effect<Map<string, DurationStats>, BusinessCalendarError, never>;
|
|
42
|
+
/**
|
|
43
|
+
* Calculate raw (wall-clock) duration for multiple timestamp pairs.
|
|
44
|
+
* This is a fallback when no business calendar is configured.
|
|
45
|
+
*
|
|
46
|
+
* @param timestampPairs - Array of timestamp pairs with their grouping id
|
|
47
|
+
* @returns Map of id to duration statistics (using wall-clock time)
|
|
48
|
+
*/
|
|
49
|
+
export declare const calculateRawDurations: (timestampPairs: readonly TimestampPair[]) => Map<string, DurationStats>;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
declare const DateOutOfRangeError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
2
|
+
readonly _tag: "DateOutOfRangeError";
|
|
3
|
+
} & Readonly<A>;
|
|
4
|
+
/**
|
|
5
|
+
* Error thrown when a date is outside the valid range for calendar operations.
|
|
6
|
+
*/
|
|
7
|
+
export declare class DateOutOfRangeError extends DateOutOfRangeError_base<{
|
|
8
|
+
readonly date: string;
|
|
9
|
+
readonly message: string;
|
|
10
|
+
}> {
|
|
11
|
+
}
|
|
12
|
+
declare const NoBusinessHoursError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
13
|
+
readonly _tag: "NoBusinessHoursError";
|
|
14
|
+
} & Readonly<A>;
|
|
15
|
+
/**
|
|
16
|
+
* Error thrown when no business hours are configured for a calendar.
|
|
17
|
+
*/
|
|
18
|
+
export declare class NoBusinessHoursError extends NoBusinessHoursError_base<{
|
|
19
|
+
readonly message: string;
|
|
20
|
+
}> {
|
|
21
|
+
}
|
|
22
|
+
declare const InvalidCalendarConfigError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
23
|
+
readonly _tag: "InvalidCalendarConfigError";
|
|
24
|
+
} & Readonly<A>;
|
|
25
|
+
/**
|
|
26
|
+
* Error thrown when calendar configuration is invalid.
|
|
27
|
+
*/
|
|
28
|
+
export declare class InvalidCalendarConfigError extends InvalidCalendarConfigError_base<{
|
|
29
|
+
readonly message: string;
|
|
30
|
+
readonly cause?: unknown;
|
|
31
|
+
}> {
|
|
32
|
+
}
|
|
33
|
+
declare const InvalidDateError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
34
|
+
readonly _tag: "InvalidDateError";
|
|
35
|
+
} & Readonly<A>;
|
|
36
|
+
/**
|
|
37
|
+
* Error thrown when a date combination is invalid (e.g., Feb 30).
|
|
38
|
+
*/
|
|
39
|
+
export declare class InvalidDateError extends InvalidDateError_base<{
|
|
40
|
+
readonly year: number;
|
|
41
|
+
readonly month: number;
|
|
42
|
+
readonly day: number;
|
|
43
|
+
readonly message: string;
|
|
44
|
+
}> {
|
|
45
|
+
}
|
|
46
|
+
declare const InvalidYearError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
47
|
+
readonly _tag: "InvalidYearError";
|
|
48
|
+
} & Readonly<A>;
|
|
49
|
+
/**
|
|
50
|
+
* Error thrown when a year is outside the supported range.
|
|
51
|
+
* Easter calculation is only valid for Gregorian calendar (year >= 1583).
|
|
52
|
+
*/
|
|
53
|
+
export declare class InvalidYearError extends InvalidYearError_base<{
|
|
54
|
+
readonly year: number;
|
|
55
|
+
readonly message: string;
|
|
56
|
+
}> {
|
|
57
|
+
}
|
|
58
|
+
declare const ValidationError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
59
|
+
readonly _tag: "ValidationError";
|
|
60
|
+
} & Readonly<A>;
|
|
61
|
+
/**
|
|
62
|
+
* Error thrown when branded type validation fails.
|
|
63
|
+
*/
|
|
64
|
+
export declare class ValidationError extends ValidationError_base<{
|
|
65
|
+
readonly message: string;
|
|
66
|
+
readonly cause?: unknown;
|
|
67
|
+
}> {
|
|
68
|
+
}
|
|
69
|
+
export {};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { DateTime, Effect } from "effect";
|
|
2
|
+
import { InvalidDateError, InvalidYearError } from "./errors.js";
|
|
3
|
+
import type { EasterRelativeHoliday, FixedHoliday, Holiday, HolidayInstance, LastWeekdayHoliday, NthWeekdayHoliday } from "./holidays.js";
|
|
4
|
+
import type { DayOfWeek, Month } from "./types.js";
|
|
5
|
+
/**
|
|
6
|
+
* Calculate Easter Sunday for a given year using the Anonymous Gregorian algorithm.
|
|
7
|
+
* This is the "Meeus/Jones/Butcher" algorithm.
|
|
8
|
+
*
|
|
9
|
+
* @see https://en.wikipedia.org/wiki/Date_of_Easter#Anonymous_Gregorian_algorithm
|
|
10
|
+
*/
|
|
11
|
+
export declare const calculateEasterSunday: (year: number) => Effect.Effect<DateTime.Utc, InvalidYearError | InvalidDateError>;
|
|
12
|
+
/**
|
|
13
|
+
* Get the nth occurrence of a weekday in a month.
|
|
14
|
+
*
|
|
15
|
+
* @param year - The year
|
|
16
|
+
* @param month - The month (1-12)
|
|
17
|
+
* @param weekday - The day of week (0 = Sunday, 6 = Saturday)
|
|
18
|
+
* @param nth - Which occurrence (1-5)
|
|
19
|
+
* @returns The date, or undefined if nth occurrence doesn't exist
|
|
20
|
+
*/
|
|
21
|
+
export declare const getNthWeekdayOfMonth: (year: number, month: Month, weekday: DayOfWeek, nth: number) => Effect.Effect<DateTime.Utc | undefined, InvalidYearError | InvalidDateError>;
|
|
22
|
+
/**
|
|
23
|
+
* Get the last occurrence of a weekday in a month.
|
|
24
|
+
*
|
|
25
|
+
* @param year - The year
|
|
26
|
+
* @param month - The month (1-12)
|
|
27
|
+
* @param weekday - The day of week (0 = Sunday, 6 = Saturday)
|
|
28
|
+
* @returns The date
|
|
29
|
+
*/
|
|
30
|
+
export declare const getLastWeekdayOfMonth: (year: number, month: Month, weekday: DayOfWeek) => Effect.Effect<DateTime.Utc, InvalidYearError | InvalidDateError>;
|
|
31
|
+
/**
|
|
32
|
+
* Calculate a fixed holiday for a specific year.
|
|
33
|
+
*/
|
|
34
|
+
export declare const calculateFixedHoliday: (holiday: FixedHoliday, year: number) => Effect.Effect<HolidayInstance, InvalidYearError | InvalidDateError>;
|
|
35
|
+
/**
|
|
36
|
+
* Calculate an nth weekday holiday for a specific year.
|
|
37
|
+
*/
|
|
38
|
+
export declare const calculateNthWeekdayHoliday: (holiday: NthWeekdayHoliday, year: number) => Effect.Effect<HolidayInstance | undefined, InvalidYearError | InvalidDateError>;
|
|
39
|
+
/**
|
|
40
|
+
* Calculate a last weekday holiday for a specific year.
|
|
41
|
+
*/
|
|
42
|
+
export declare const calculateLastWeekdayHoliday: (holiday: LastWeekdayHoliday, year: number) => Effect.Effect<HolidayInstance, InvalidYearError | InvalidDateError>;
|
|
43
|
+
/**
|
|
44
|
+
* Calculate an Easter-relative holiday for a specific year.
|
|
45
|
+
*/
|
|
46
|
+
export declare const calculateEasterRelativeHoliday: (holiday: EasterRelativeHoliday, year: number) => Effect.Effect<HolidayInstance, InvalidYearError | InvalidDateError>;
|
|
47
|
+
/**
|
|
48
|
+
* Calculate a holiday for a specific year.
|
|
49
|
+
*/
|
|
50
|
+
export declare const calculateHoliday: (holiday: Holiday, year: number) => Effect.Effect<HolidayInstance | undefined, InvalidYearError | InvalidDateError>;
|
|
51
|
+
/**
|
|
52
|
+
* Calculate all holidays for a specific year.
|
|
53
|
+
* Returns an array of holiday instances sorted by date.
|
|
54
|
+
*/
|
|
55
|
+
export declare const calculateHolidaysForYear: (holidays: readonly Holiday[], year: number) => Effect.Effect<HolidayInstance[], InvalidYearError | InvalidDateError>;
|
|
56
|
+
/**
|
|
57
|
+
* Check if a date is a holiday.
|
|
58
|
+
* Compares only the date part (year, month, day).
|
|
59
|
+
* This is a pure function - no Effect needed.
|
|
60
|
+
*/
|
|
61
|
+
export declare const isDateHoliday: (date: DateTime.Utc, holidayInstances: HolidayInstance[]) => HolidayInstance | undefined;
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import { type DayOfMonth as DayOfMonthType, type DayOfWeek as DayOfWeekType, type Month as MonthType, type NthOccurrence as NthOccurrenceType } from "./types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Fixed holiday: occurs on the same date every year.
|
|
5
|
+
* Example: Christmas (December 25), New Year's Day (January 1)
|
|
6
|
+
*/
|
|
7
|
+
export declare const FixedHoliday: Schema.TaggedStruct<"FixedHoliday", {
|
|
8
|
+
name: typeof Schema.String;
|
|
9
|
+
month: Schema.brand<Schema.filter<typeof Schema.Int>, "Month">;
|
|
10
|
+
day: Schema.brand<Schema.filter<typeof Schema.Int>, "DayOfMonth">;
|
|
11
|
+
}>;
|
|
12
|
+
export type FixedHoliday = typeof FixedHoliday.Type;
|
|
13
|
+
/**
|
|
14
|
+
* Nth weekday holiday: occurs on the nth occurrence of a weekday in a month.
|
|
15
|
+
* Example: MLK Day (3rd Monday of January), Thanksgiving (4th Thursday of November)
|
|
16
|
+
*
|
|
17
|
+
* @property nth - 1st through 5th occurrence (5th means "last or 5th if exists")
|
|
18
|
+
* @property weekday - Day of week (0 = Sunday, 6 = Saturday)
|
|
19
|
+
* @property month - Month (1-12)
|
|
20
|
+
*/
|
|
21
|
+
export declare const NthWeekdayHoliday: Schema.TaggedStruct<"NthWeekdayHoliday", {
|
|
22
|
+
name: typeof Schema.String;
|
|
23
|
+
month: Schema.brand<Schema.filter<typeof Schema.Int>, "Month">;
|
|
24
|
+
weekday: Schema.brand<Schema.filter<typeof Schema.Int>, "DayOfWeek">;
|
|
25
|
+
nth: Schema.brand<Schema.filter<typeof Schema.Int>, "NthOccurrence">;
|
|
26
|
+
}>;
|
|
27
|
+
export type NthWeekdayHoliday = typeof NthWeekdayHoliday.Type;
|
|
28
|
+
/**
|
|
29
|
+
* Last weekday holiday: occurs on the last occurrence of a weekday in a month.
|
|
30
|
+
* Example: Memorial Day (last Monday of May)
|
|
31
|
+
*
|
|
32
|
+
* @property weekday - Day of week (0 = Sunday, 6 = Saturday)
|
|
33
|
+
* @property month - Month (1-12)
|
|
34
|
+
*/
|
|
35
|
+
export declare const LastWeekdayHoliday: Schema.TaggedStruct<"LastWeekdayHoliday", {
|
|
36
|
+
name: typeof Schema.String;
|
|
37
|
+
month: Schema.brand<Schema.filter<typeof Schema.Int>, "Month">;
|
|
38
|
+
weekday: Schema.brand<Schema.filter<typeof Schema.Int>, "DayOfWeek">;
|
|
39
|
+
}>;
|
|
40
|
+
export type LastWeekdayHoliday = typeof LastWeekdayHoliday.Type;
|
|
41
|
+
/**
|
|
42
|
+
* Easter-relative holiday: calculated as days offset from Easter Sunday.
|
|
43
|
+
* Example: Good Friday (-2), Easter Monday (+1), Ash Wednesday (-46)
|
|
44
|
+
*
|
|
45
|
+
* @property daysOffset - Positive for after Easter, negative for before
|
|
46
|
+
*/
|
|
47
|
+
export declare const EasterRelativeHoliday: Schema.TaggedStruct<"EasterRelativeHoliday", {
|
|
48
|
+
name: typeof Schema.String;
|
|
49
|
+
daysOffset: typeof Schema.Int;
|
|
50
|
+
}>;
|
|
51
|
+
export type EasterRelativeHoliday = typeof EasterRelativeHoliday.Type;
|
|
52
|
+
/**
|
|
53
|
+
* Union of all holiday types.
|
|
54
|
+
*/
|
|
55
|
+
export declare const Holiday: Schema.Union<[Schema.TaggedStruct<"FixedHoliday", {
|
|
56
|
+
name: typeof Schema.String;
|
|
57
|
+
month: Schema.brand<Schema.filter<typeof Schema.Int>, "Month">;
|
|
58
|
+
day: Schema.brand<Schema.filter<typeof Schema.Int>, "DayOfMonth">;
|
|
59
|
+
}>, Schema.TaggedStruct<"NthWeekdayHoliday", {
|
|
60
|
+
name: typeof Schema.String;
|
|
61
|
+
month: Schema.brand<Schema.filter<typeof Schema.Int>, "Month">;
|
|
62
|
+
weekday: Schema.brand<Schema.filter<typeof Schema.Int>, "DayOfWeek">;
|
|
63
|
+
nth: Schema.brand<Schema.filter<typeof Schema.Int>, "NthOccurrence">;
|
|
64
|
+
}>, Schema.TaggedStruct<"LastWeekdayHoliday", {
|
|
65
|
+
name: typeof Schema.String;
|
|
66
|
+
month: Schema.brand<Schema.filter<typeof Schema.Int>, "Month">;
|
|
67
|
+
weekday: Schema.brand<Schema.filter<typeof Schema.Int>, "DayOfWeek">;
|
|
68
|
+
}>, Schema.TaggedStruct<"EasterRelativeHoliday", {
|
|
69
|
+
name: typeof Schema.String;
|
|
70
|
+
daysOffset: typeof Schema.Int;
|
|
71
|
+
}>]>;
|
|
72
|
+
export type Holiday = typeof Holiday.Type;
|
|
73
|
+
/**
|
|
74
|
+
* Computed holiday instance with resolved date.
|
|
75
|
+
* Used for caching and display.
|
|
76
|
+
*/
|
|
77
|
+
export declare const HolidayInstance: Schema.Struct<{
|
|
78
|
+
date: typeof Schema.DateTimeUtcFromSelf;
|
|
79
|
+
name: typeof Schema.String;
|
|
80
|
+
rule: Schema.optional<Schema.Union<[Schema.TaggedStruct<"FixedHoliday", {
|
|
81
|
+
name: typeof Schema.String;
|
|
82
|
+
month: Schema.brand<Schema.filter<typeof Schema.Int>, "Month">;
|
|
83
|
+
day: Schema.brand<Schema.filter<typeof Schema.Int>, "DayOfMonth">;
|
|
84
|
+
}>, Schema.TaggedStruct<"NthWeekdayHoliday", {
|
|
85
|
+
name: typeof Schema.String;
|
|
86
|
+
month: Schema.brand<Schema.filter<typeof Schema.Int>, "Month">;
|
|
87
|
+
weekday: Schema.brand<Schema.filter<typeof Schema.Int>, "DayOfWeek">;
|
|
88
|
+
nth: Schema.brand<Schema.filter<typeof Schema.Int>, "NthOccurrence">;
|
|
89
|
+
}>, Schema.TaggedStruct<"LastWeekdayHoliday", {
|
|
90
|
+
name: typeof Schema.String;
|
|
91
|
+
month: Schema.brand<Schema.filter<typeof Schema.Int>, "Month">;
|
|
92
|
+
weekday: Schema.brand<Schema.filter<typeof Schema.Int>, "DayOfWeek">;
|
|
93
|
+
}>, Schema.TaggedStruct<"EasterRelativeHoliday", {
|
|
94
|
+
name: typeof Schema.String;
|
|
95
|
+
daysOffset: typeof Schema.Int;
|
|
96
|
+
}>]>>;
|
|
97
|
+
}>;
|
|
98
|
+
export type HolidayInstance = typeof HolidayInstance.Type;
|
|
99
|
+
/**
|
|
100
|
+
* Create a fixed date holiday.
|
|
101
|
+
* @throws ParseError if month (1-12) or day (1-31) is out of range
|
|
102
|
+
*/
|
|
103
|
+
export declare const fixedHoliday: (name: string, month: number, day: number) => FixedHoliday;
|
|
104
|
+
/**
|
|
105
|
+
* Create an nth weekday holiday.
|
|
106
|
+
* @throws ParseError if month (1-12), weekday (0-6), or nth (1-5) is out of range
|
|
107
|
+
*/
|
|
108
|
+
export declare const nthWeekdayHoliday: (name: string, month: number, weekday: number, nth: number) => NthWeekdayHoliday;
|
|
109
|
+
/**
|
|
110
|
+
* Create a last weekday of month holiday.
|
|
111
|
+
* @throws ParseError if month (1-12) or weekday (0-6) is out of range
|
|
112
|
+
*/
|
|
113
|
+
export declare const lastWeekdayHoliday: (name: string, month: number, weekday: number) => LastWeekdayHoliday;
|
|
114
|
+
/**
|
|
115
|
+
* Create an Easter-relative holiday.
|
|
116
|
+
*/
|
|
117
|
+
export declare const easterRelativeHoliday: (name: string, daysOffset: number) => EasterRelativeHoliday;
|
|
118
|
+
/**
|
|
119
|
+
* Create a fixed date holiday with pre-validated branded types.
|
|
120
|
+
*/
|
|
121
|
+
export declare const fixedHolidayTyped: (name: string, month: MonthType, day: DayOfMonthType) => FixedHoliday;
|
|
122
|
+
/**
|
|
123
|
+
* Create an nth weekday holiday with pre-validated branded types.
|
|
124
|
+
*/
|
|
125
|
+
export declare const nthWeekdayHolidayTyped: (name: string, month: MonthType, weekday: DayOfWeekType, nth: NthOccurrenceType) => NthWeekdayHoliday;
|
|
126
|
+
/**
|
|
127
|
+
* Create a last weekday of month holiday with pre-validated branded types.
|
|
128
|
+
*/
|
|
129
|
+
export declare const lastWeekdayHolidayTyped: (name: string, month: MonthType, weekday: DayOfWeekType) => LastWeekdayHoliday;
|
|
130
|
+
/**
|
|
131
|
+
* Common US holidays.
|
|
132
|
+
*/
|
|
133
|
+
export declare const US_HOLIDAYS: Holiday[];
|
|
134
|
+
/**
|
|
135
|
+
* Common Dutch holidays.
|
|
136
|
+
*/
|
|
137
|
+
export declare const NL_HOLIDAYS: Holiday[];
|
|
138
|
+
/**
|
|
139
|
+
* Common NZ holidays.
|
|
140
|
+
*/
|
|
141
|
+
export declare const NZ_HOLIDAYS: Holiday[];
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
/**
|
|
3
|
+
* Day of week (0 = Sunday, 6 = Saturday).
|
|
4
|
+
* Matches JavaScript Date.getDay() convention.
|
|
5
|
+
*/
|
|
6
|
+
export declare const DayOfWeek: Schema.brand<Schema.filter<typeof Schema.Int>, "DayOfWeek">;
|
|
7
|
+
export type DayOfWeek = typeof DayOfWeek.Type;
|
|
8
|
+
/** Named weekday constants */
|
|
9
|
+
export declare const Sunday: DayOfWeek;
|
|
10
|
+
export declare const Monday: DayOfWeek;
|
|
11
|
+
export declare const Tuesday: DayOfWeek;
|
|
12
|
+
export declare const Wednesday: DayOfWeek;
|
|
13
|
+
export declare const Thursday: DayOfWeek;
|
|
14
|
+
export declare const Friday: DayOfWeek;
|
|
15
|
+
export declare const Saturday: DayOfWeek;
|
|
16
|
+
/** Array of weekdays (Mon-Fri) for convenience */
|
|
17
|
+
export declare const Weekdays: readonly DayOfWeek[];
|
|
18
|
+
/** Array of all days (Sun-Sat) for iteration */
|
|
19
|
+
export declare const AllDays: readonly DayOfWeek[];
|
|
20
|
+
/**
|
|
21
|
+
* Time of day with hour (0-23) and minute (0-59).
|
|
22
|
+
*/
|
|
23
|
+
export declare const TimeOfDay: Schema.Struct<{
|
|
24
|
+
hour: Schema.filter<typeof Schema.Int>;
|
|
25
|
+
minute: Schema.filter<typeof Schema.Int>;
|
|
26
|
+
}>;
|
|
27
|
+
export type TimeOfDay = typeof TimeOfDay.Type;
|
|
28
|
+
/**
|
|
29
|
+
* A time range within a day.
|
|
30
|
+
* Supports overnight ranges: if close < open, the range spans midnight.
|
|
31
|
+
* Example: { open: { hour: 22, minute: 0 }, close: { hour: 6, minute: 0 } }
|
|
32
|
+
* represents 10 PM to 6 AM the next day.
|
|
33
|
+
*/
|
|
34
|
+
export declare const TimeRange: Schema.Struct<{
|
|
35
|
+
open: Schema.Struct<{
|
|
36
|
+
hour: Schema.filter<typeof Schema.Int>;
|
|
37
|
+
minute: Schema.filter<typeof Schema.Int>;
|
|
38
|
+
}>;
|
|
39
|
+
close: Schema.Struct<{
|
|
40
|
+
hour: Schema.filter<typeof Schema.Int>;
|
|
41
|
+
minute: Schema.filter<typeof Schema.Int>;
|
|
42
|
+
}>;
|
|
43
|
+
}>;
|
|
44
|
+
export type TimeRange = typeof TimeRange.Type;
|
|
45
|
+
/**
|
|
46
|
+
* Schedule for a specific day of the week.
|
|
47
|
+
* Contains multiple time ranges to support split shifts (e.g., 9-12, 13-17).
|
|
48
|
+
*/
|
|
49
|
+
export declare const DaySchedule: Schema.Struct<{
|
|
50
|
+
day: Schema.brand<Schema.filter<typeof Schema.Int>, "DayOfWeek">;
|
|
51
|
+
ranges: Schema.Array$<Schema.Struct<{
|
|
52
|
+
open: Schema.Struct<{
|
|
53
|
+
hour: Schema.filter<typeof Schema.Int>;
|
|
54
|
+
minute: Schema.filter<typeof Schema.Int>;
|
|
55
|
+
}>;
|
|
56
|
+
close: Schema.Struct<{
|
|
57
|
+
hour: Schema.filter<typeof Schema.Int>;
|
|
58
|
+
minute: Schema.filter<typeof Schema.Int>;
|
|
59
|
+
}>;
|
|
60
|
+
}>>;
|
|
61
|
+
}>;
|
|
62
|
+
export type DaySchedule = typeof DaySchedule.Type;
|
|
63
|
+
/**
|
|
64
|
+
* Weekly schedule as an array of day schedules.
|
|
65
|
+
* Days without entries are considered non-working.
|
|
66
|
+
*/
|
|
67
|
+
export declare const WeeklySchedule: Schema.Array$<Schema.Struct<{
|
|
68
|
+
day: Schema.brand<Schema.filter<typeof Schema.Int>, "DayOfWeek">;
|
|
69
|
+
ranges: Schema.Array$<Schema.Struct<{
|
|
70
|
+
open: Schema.Struct<{
|
|
71
|
+
hour: Schema.filter<typeof Schema.Int>;
|
|
72
|
+
minute: Schema.filter<typeof Schema.Int>;
|
|
73
|
+
}>;
|
|
74
|
+
close: Schema.Struct<{
|
|
75
|
+
hour: Schema.filter<typeof Schema.Int>;
|
|
76
|
+
minute: Schema.filter<typeof Schema.Int>;
|
|
77
|
+
}>;
|
|
78
|
+
}>>;
|
|
79
|
+
}>>;
|
|
80
|
+
export type WeeklySchedule = typeof WeeklySchedule.Type;
|
|
81
|
+
/**
|
|
82
|
+
* Month number (1-12).
|
|
83
|
+
*/
|
|
84
|
+
export declare const Month: Schema.brand<Schema.filter<typeof Schema.Int>, "Month">;
|
|
85
|
+
export type Month = typeof Month.Type;
|
|
86
|
+
/**
|
|
87
|
+
* Day of month (1-31).
|
|
88
|
+
* Note: validation doesn't check for valid days per month (e.g., Feb 30).
|
|
89
|
+
* That validation happens at calculation time.
|
|
90
|
+
*/
|
|
91
|
+
export declare const DayOfMonth: Schema.brand<Schema.filter<typeof Schema.Int>, "DayOfMonth">;
|
|
92
|
+
export type DayOfMonth = typeof DayOfMonth.Type;
|
|
93
|
+
/**
|
|
94
|
+
* Nth occurrence (1-5, where 5 means "last" in some contexts).
|
|
95
|
+
*/
|
|
96
|
+
export declare const NthOccurrence: Schema.brand<Schema.filter<typeof Schema.Int>, "NthOccurrence">;
|
|
97
|
+
export type NthOccurrence = typeof NthOccurrence.Type;
|
|
98
|
+
/**
|
|
99
|
+
* Convert TimeOfDay to minutes since midnight.
|
|
100
|
+
*/
|
|
101
|
+
export declare const timeOfDayToMinutes: (time: TimeOfDay) => number;
|
|
102
|
+
/**
|
|
103
|
+
* Check if a TimeRange spans overnight (close time is before open time).
|
|
104
|
+
*/
|
|
105
|
+
export declare const isOvernightRange: (range: TimeRange) => boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Calculate the duration of a TimeRange in minutes.
|
|
108
|
+
* Handles overnight ranges correctly.
|
|
109
|
+
*/
|
|
110
|
+
export declare const timeRangeDurationMinutes: (range: TimeRange) => number;
|