processfocus 0.1.0-next.2 → 0.1.0-next.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{auth-FmXptohB.mjs → auth-DWWupwJA.mjs} +57 -24
- package/dist/auth-config/src/lib/authentication-config.d.ts +13 -8
- package/dist/auth-config/src/lib/aws-role-binding.d.ts +21 -0
- package/dist/auth-config/src/lib/provider-types.d.ts +87 -76
- package/dist/auth-config/src/lib/workload-trust.d.ts +41 -0
- package/dist/auth.mjs +1 -2
- package/dist/business-calendar/src/lib/calendar-config.d.ts +73 -76
- package/dist/business-calendar/src/lib/calendar-period.d.ts +30 -30
- package/dist/business-calendar/src/lib/calendar-service.d.ts +10 -10
- package/dist/business-calendar/src/lib/datetime-utils.d.ts +1 -1
- package/dist/business-calendar/src/lib/holidays.d.ts +40 -40
- package/dist/business-calendar/src/lib/types.d.ts +29 -29
- package/dist/calendar.mjs +73 -63
- package/dist/form-schema/src/index.d.ts +4 -1
- package/dist/form-schema/src/lib/annotation-helpers.d.ts +2 -2
- package/dist/form-schema/src/lib/email.d.ts +2 -2
- package/dist/form-schema/src/lib/field-count.d.ts +2 -2
- package/dist/form-schema/src/lib/form-annotations.d.ts +6 -0
- package/dist/form-schema/src/lib/form-presentation.d.ts +30 -0
- package/dist/form-schema/src/lib/form-schema.d.ts +64 -34
- package/dist/form-schema/src/lib/number-from-string.d.ts +3 -0
- package/dist/form-schema/src/lib/phone.d.ts +2 -2
- package/dist/form-schema/src/lib/public-completion-correction.d.ts +5 -0
- package/dist/form-schema/src/lib/search-lookup-items.d.ts +3 -0
- package/dist/form-submission-schema/src/index.d.ts +3 -0
- package/dist/form-submission-schema/src/lib/executable-rules.d.ts +43 -0
- package/dist/form-submission-schema/src/lib/form-submission-schema.d.ts +33 -10
- package/dist/form-submission-schema/src/lib/json-schema.d.ts +3 -0
- package/dist/form-submission-schema/src/lib/submission-utils.d.ts +19 -0
- package/dist/forms.mjs +26 -2
- package/dist/frontend-manifest/src/lib/browser-plugin-artifact.d.ts +9 -0
- package/dist/frontend-manifest/src/lib/frontend-manifest.d.ts +8 -6
- package/dist/frontend-plugin-host/src/lib/frontend-plugin-host.d.ts +11 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +466 -972
- package/dist/manifest.mjs +1 -2
- package/dist/plugin.mjs +1 -2
- package/dist/process/src/lib/form-authoring.d.ts +1 -1
- package/dist/process/src/lib/form-decoration.d.ts +3 -3
- package/dist/process/src/lib/form.d.ts +61 -97
- package/dist/process/src/lib/list.d.ts +36 -23
- package/dist/process/src/lib/lookup-accessor.d.ts +4 -1
- package/dist/process/src/lib/organisation.d.ts +14 -0
- package/dist/process/src/lib/process.d.ts +24 -2
- package/dist/process/src/lib/schedule.d.ts +1 -1
- package/dist/process/src/lib/step.d.ts +13 -3
- package/dist/process/src/lib/system-step-executor.d.ts +4 -4
- package/dist/process/src/lib/system-step.d.ts +11 -1
- package/dist/sdk/src/index.d.ts +1 -1
- package/dist/sdk/src/testing.d.ts +0 -1
- package/dist/{src-C-909PVQ.mjs → src-BQ55-khF.mjs} +118 -66
- package/dist/testing.d.ts +0 -1
- package/dist/testing.mjs +2 -4
- package/package.json +4 -4
- package/dist/form-client-representation/src/index.d.ts +0 -6
- package/dist/form-client-representation/src/lib/as-client-representation.d.ts +0 -31
- package/dist/form-client-representation/src/lib/client-form-definition.d.ts +0 -17
- package/dist/form-client-representation/src/lib/extract-annotations.d.ts +0 -20
- package/dist/form-client-representation/src/lib/plugin-registry.d.ts +0 -6
- package/dist/form-client-representation/src/lib/types.d.ts +0 -239
- package/dist/form-client-representation/src/lib/walker.d.ts +0 -68
- package/dist/form-rule/src/index.d.ts +0 -3
- package/dist/form-rule/src/lib/evaluator.d.ts +0 -2
- package/dist/form-rule/src/lib/paths.d.ts +0 -9
- package/dist/form-rule/src/lib/types.d.ts +0 -89
- package/dist/form-schema/src/lib/property-signature.d.ts +0 -3
- package/dist/paths-BkzLn-rG.mjs +0 -282
package/dist/calendar.mjs
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { Cause, Context, Data, DateTime, Deferred, Duration, Effect, Exit, Layer, Option, Schema, SynchronizedRef } from "effect";
|
|
2
|
-
|
|
2
|
+
// ../business-calendar/src/lib/types.ts
|
|
3
3
|
/**
|
|
4
4
|
* Day of week (0 = Sunday, 6 = Saturday).
|
|
5
5
|
* Matches JavaScript Date.getDay() convention.
|
|
6
6
|
*/
|
|
7
|
-
const DayOfWeek = Schema.Int.pipe(Schema.
|
|
7
|
+
const DayOfWeek = Schema.Int.pipe(Schema.check(Schema.isBetween({
|
|
8
|
+
minimum: 0,
|
|
9
|
+
maximum: 6
|
|
10
|
+
})), Schema.brand("DayOfWeek"));
|
|
8
11
|
/** Named weekday constants */
|
|
9
12
|
const Sunday = 0;
|
|
10
13
|
const Monday = 1;
|
|
@@ -35,8 +38,14 @@ const AllDays = [
|
|
|
35
38
|
* Time of day with hour (0-23) and minute (0-59).
|
|
36
39
|
*/
|
|
37
40
|
const TimeOfDay = Schema.Struct({
|
|
38
|
-
hour: Schema.Int.pipe(Schema.
|
|
39
|
-
|
|
41
|
+
hour: Schema.Int.pipe(Schema.check(Schema.isBetween({
|
|
42
|
+
minimum: 0,
|
|
43
|
+
maximum: 23
|
|
44
|
+
}))),
|
|
45
|
+
minute: Schema.Int.pipe(Schema.check(Schema.isBetween({
|
|
46
|
+
minimum: 0,
|
|
47
|
+
maximum: 59
|
|
48
|
+
})))
|
|
40
49
|
});
|
|
41
50
|
/**
|
|
42
51
|
* A time range within a day.
|
|
@@ -60,17 +69,26 @@ Schema.Array(DaySchedule);
|
|
|
60
69
|
/**
|
|
61
70
|
* Month number (1-12).
|
|
62
71
|
*/
|
|
63
|
-
const Month = Schema.Int.pipe(Schema.
|
|
72
|
+
const Month = Schema.Int.pipe(Schema.check(Schema.isBetween({
|
|
73
|
+
minimum: 1,
|
|
74
|
+
maximum: 12
|
|
75
|
+
})), Schema.brand("Month"));
|
|
64
76
|
/**
|
|
65
77
|
* Day of month (1-31).
|
|
66
78
|
* Note: validation doesn't check for valid days per month (e.g., Feb 30).
|
|
67
79
|
* That validation happens at calculation time.
|
|
68
80
|
*/
|
|
69
|
-
const DayOfMonth = Schema.Int.pipe(Schema.
|
|
81
|
+
const DayOfMonth = Schema.Int.pipe(Schema.check(Schema.isBetween({
|
|
82
|
+
minimum: 1,
|
|
83
|
+
maximum: 31
|
|
84
|
+
})), Schema.brand("DayOfMonth"));
|
|
70
85
|
/**
|
|
71
86
|
* Nth occurrence (1-5, where 5 means "last" in some contexts).
|
|
72
87
|
*/
|
|
73
|
-
const NthOccurrence = Schema.Int.pipe(Schema.
|
|
88
|
+
const NthOccurrence = Schema.Int.pipe(Schema.check(Schema.isBetween({
|
|
89
|
+
minimum: 1,
|
|
90
|
+
maximum: 5
|
|
91
|
+
})), Schema.brand("NthOccurrence"));
|
|
74
92
|
/**
|
|
75
93
|
* Convert TimeOfDay to minutes since midnight.
|
|
76
94
|
*/
|
|
@@ -79,8 +97,7 @@ const timeOfDayToMinutes = (time) => time.hour * 60 + time.minute;
|
|
|
79
97
|
* Check if a TimeRange spans overnight (close time is before open time).
|
|
80
98
|
*/
|
|
81
99
|
const isOvernightRange = (range) => timeOfDayToMinutes(range.close) < timeOfDayToMinutes(range.open);
|
|
82
|
-
|
|
83
|
-
//#region ../business-calendar/src/lib/calendar-period.ts
|
|
100
|
+
// ../business-calendar/src/lib/calendar-period.ts
|
|
84
101
|
/**
|
|
85
102
|
* A calendar period represents a date range with specific characteristics.
|
|
86
103
|
* Used for school terms, seasonal schedules, fiscal periods, etc.
|
|
@@ -111,12 +128,12 @@ const CalendarPeriod = Schema.Struct({
|
|
|
111
128
|
* Start date of the period (inclusive).
|
|
112
129
|
* Stored as ISO 8601 date string for serialization.
|
|
113
130
|
*/
|
|
114
|
-
startDate: Schema.
|
|
131
|
+
startDate: Schema.DateTimeUtc,
|
|
115
132
|
/**
|
|
116
133
|
* End date of the period (inclusive).
|
|
117
134
|
* Stored as ISO 8601 date string for serialization.
|
|
118
135
|
*/
|
|
119
|
-
endDate: Schema.
|
|
136
|
+
endDate: Schema.DateTimeUtc,
|
|
120
137
|
/**
|
|
121
138
|
* Whether this period counts as "active" or "working".
|
|
122
139
|
* When requireActivePeriod is set, only dates within active periods
|
|
@@ -137,13 +154,12 @@ const CalendarPeriodFromJson = Schema.Struct({
|
|
|
137
154
|
id: Schema.String,
|
|
138
155
|
type: Schema.String,
|
|
139
156
|
name: Schema.String,
|
|
140
|
-
startDate: Schema.
|
|
141
|
-
endDate: Schema.
|
|
157
|
+
startDate: Schema.DateTimeUtcFromString,
|
|
158
|
+
endDate: Schema.DateTimeUtcFromString,
|
|
142
159
|
isActive: Schema.Boolean,
|
|
143
160
|
weeklySchedule: Schema.optional(Schema.Array(DaySchedule))
|
|
144
161
|
});
|
|
145
|
-
|
|
146
|
-
//#region ../business-calendar/src/lib/holidays.ts
|
|
162
|
+
// ../business-calendar/src/lib/holidays.ts
|
|
147
163
|
/**
|
|
148
164
|
* Fixed holiday: occurs on the same date every year.
|
|
149
165
|
* Example: Christmas (December 25), New Year's Day (January 1)
|
|
@@ -192,9 +208,14 @@ const EasterRelativeHoliday = Schema.TaggedStruct("EasterRelativeHoliday", {
|
|
|
192
208
|
/**
|
|
193
209
|
* Union of all holiday types.
|
|
194
210
|
*/
|
|
195
|
-
const Holiday = Schema.Union(
|
|
211
|
+
const Holiday = Schema.Union([
|
|
212
|
+
FixedHoliday,
|
|
213
|
+
NthWeekdayHoliday,
|
|
214
|
+
LastWeekdayHoliday,
|
|
215
|
+
EasterRelativeHoliday
|
|
216
|
+
]);
|
|
196
217
|
Schema.Struct({
|
|
197
|
-
date: Schema.
|
|
218
|
+
date: Schema.DateTimeUtc,
|
|
198
219
|
name: Schema.String,
|
|
199
220
|
rule: Schema.optional(Holiday)
|
|
200
221
|
});
|
|
@@ -287,8 +308,7 @@ const NZ_HOLIDAYS = [
|
|
|
287
308
|
fixedHoliday("Christmas Day", 12, 25),
|
|
288
309
|
fixedHoliday("Boxing Day", 12, 26)
|
|
289
310
|
];
|
|
290
|
-
|
|
291
|
-
//#region ../business-calendar/src/lib/calendar-config.ts
|
|
311
|
+
// ../business-calendar/src/lib/calendar-config.ts
|
|
292
312
|
/**
|
|
293
313
|
* Date exception: one-off override for a specific date.
|
|
294
314
|
* Takes precedence over holidays and periods.
|
|
@@ -297,21 +317,18 @@ const NZ_HOLIDAYS = [
|
|
|
297
317
|
* @property note - Optional human-readable note (e.g., "Early closing for staff party")
|
|
298
318
|
*/
|
|
299
319
|
const DateException = Schema.Struct({
|
|
300
|
-
date: Schema.
|
|
301
|
-
slots: Schema.Union(Schema.Array(TimeRange), Schema.Literal("closed")),
|
|
320
|
+
date: Schema.DateTimeUtc,
|
|
321
|
+
slots: Schema.Union([Schema.Array(TimeRange), Schema.Literal("closed")]),
|
|
302
322
|
note: Schema.optional(Schema.String)
|
|
303
323
|
});
|
|
304
324
|
Schema.Struct({
|
|
305
|
-
date: Schema.
|
|
306
|
-
slots: Schema.Union(Schema.Array(TimeRange), Schema.Literal("closed")),
|
|
325
|
+
date: Schema.DateTimeUtcFromString,
|
|
326
|
+
slots: Schema.Union([Schema.Array(TimeRange), Schema.Literal("closed")]),
|
|
307
327
|
note: Schema.optional(Schema.String)
|
|
308
328
|
});
|
|
309
329
|
/**
|
|
310
330
|
* Complete business calendar configuration.
|
|
311
331
|
* Combines weekly schedule, holidays, exceptions, and periods.
|
|
312
|
-
*
|
|
313
|
-
* Note: Timezone is stored at the Organisation/OrgUnit level, not here.
|
|
314
|
-
* The calendar service receives timezone from context.
|
|
315
332
|
*/
|
|
316
333
|
const BusinessCalendarConfig = Schema.Struct({
|
|
317
334
|
/**
|
|
@@ -437,8 +454,7 @@ const createDefaultConfig = (holidays = []) => ({
|
|
|
437
454
|
periods: [],
|
|
438
455
|
startDayOfWeek: 0
|
|
439
456
|
});
|
|
440
|
-
|
|
441
|
-
//#region ../business-calendar/src/lib/calendar-service.ts
|
|
457
|
+
// ../business-calendar/src/lib/calendar-service.ts
|
|
442
458
|
/**
|
|
443
459
|
* Error thrown when business calendar operations fail.
|
|
444
460
|
*/
|
|
@@ -446,12 +462,12 @@ var BusinessCalendarError = class extends Data.TaggedError("BusinessCalendarErro
|
|
|
446
462
|
/**
|
|
447
463
|
* Business Calendar Service tag.
|
|
448
464
|
*/
|
|
449
|
-
var BusinessCalendarService = class extends Context.
|
|
465
|
+
var BusinessCalendarService = class extends Context.Service()("processfocus/business-calendar/BusinessCalendarService") {};
|
|
450
466
|
/**
|
|
451
467
|
* Business Calendar Config Service tag.
|
|
452
468
|
* Used to provide the configuration to the service implementation.
|
|
453
469
|
*/
|
|
454
|
-
var BusinessCalendarConfigService = class extends Context.
|
|
470
|
+
var BusinessCalendarConfigService = class extends Context.Service()("processfocus/business-calendar/BusinessCalendarConfigService") {};
|
|
455
471
|
Data.TaggedError("DateOutOfRangeError");
|
|
456
472
|
Data.TaggedError("NoBusinessHoursError");
|
|
457
473
|
Data.TaggedError("InvalidCalendarConfigError");
|
|
@@ -465,8 +481,7 @@ var InvalidDateError = class extends Data.TaggedError("InvalidDateError") {};
|
|
|
465
481
|
*/
|
|
466
482
|
var InvalidYearError = class extends Data.TaggedError("InvalidYearError") {};
|
|
467
483
|
Data.TaggedError("ValidationError");
|
|
468
|
-
|
|
469
|
-
//#region ../business-calendar/src/lib/holiday-calculator.ts
|
|
484
|
+
// ../business-calendar/src/lib/holiday-calculator.ts
|
|
470
485
|
/** Minimum year for Easter calculation (Gregorian calendar) */
|
|
471
486
|
const MIN_EASTER_YEAR = 1583;
|
|
472
487
|
/** Maximum year for reasonable calendar operations */
|
|
@@ -512,14 +527,14 @@ const validateDate = (year, month, day) => {
|
|
|
512
527
|
* Safely create a DateTime.Utc, wrapping potential errors.
|
|
513
528
|
*/
|
|
514
529
|
const safeDateTime = (year, month, day) => Effect.try({
|
|
515
|
-
try: () => DateTime.
|
|
530
|
+
try: () => DateTime.makeUnsafe({
|
|
516
531
|
year,
|
|
517
532
|
month,
|
|
518
533
|
day,
|
|
519
534
|
hour: 0,
|
|
520
535
|
minute: 0,
|
|
521
536
|
second: 0,
|
|
522
|
-
|
|
537
|
+
millisecond: 0
|
|
523
538
|
}),
|
|
524
539
|
catch: (error) => new InvalidDateError({
|
|
525
540
|
year,
|
|
@@ -671,8 +686,7 @@ const isDateHoliday = (date, holidayInstances) => {
|
|
|
671
686
|
if (dateParts.year === instanceParts.year && dateParts.month === instanceParts.month && dateParts.day === instanceParts.day) return instance;
|
|
672
687
|
}
|
|
673
688
|
};
|
|
674
|
-
|
|
675
|
-
//#region ../business-calendar/src/lib/calendar-service-impl.ts
|
|
689
|
+
// ../business-calendar/src/lib/calendar-service-impl.ts
|
|
676
690
|
/** Maximum number of business days to add/subtract (prevents infinite loops) */
|
|
677
691
|
const MAX_BUSINESS_DAYS = 1e4;
|
|
678
692
|
/** Maximum number of business hours to add (prevents infinite loops) */
|
|
@@ -687,7 +701,7 @@ const MAX_SEARCH_DAYS = 365;
|
|
|
687
701
|
* inside reusable package logic.
|
|
688
702
|
*/
|
|
689
703
|
const makeBusinessCalendarService = (config) => Effect.gen(function* () {
|
|
690
|
-
const timezone = config.timezone ? DateTime.
|
|
704
|
+
const timezone = config.timezone ? DateTime.zoneMakeNamedUnsafe(config.timezone) : DateTime.zoneMakeNamedUnsafe("UTC");
|
|
691
705
|
/**
|
|
692
706
|
* Get date/time parts in the calendar's local timezone.
|
|
693
707
|
* This is critical for correctly interpreting schedule times.
|
|
@@ -700,15 +714,15 @@ const makeBusinessCalendarService = (config) => Effect.gen(function* () {
|
|
|
700
714
|
* Create a UTC DateTime from local date/time parts.
|
|
701
715
|
* Used when we need to return a specific time in the calendar's timezone as UTC.
|
|
702
716
|
*/
|
|
703
|
-
const makeUtcFromLocalParts = (year, month, day,
|
|
704
|
-
const zoned = DateTime.
|
|
717
|
+
const makeUtcFromLocalParts = (year, month, day, hour, minute) => {
|
|
718
|
+
const zoned = DateTime.makeZonedUnsafe({
|
|
705
719
|
year,
|
|
706
720
|
month,
|
|
707
721
|
day,
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
722
|
+
hour,
|
|
723
|
+
minute,
|
|
724
|
+
second: 0,
|
|
725
|
+
millisecond: 0
|
|
712
726
|
}, {
|
|
713
727
|
timeZone: timezone,
|
|
714
728
|
adjustForTimeZone: true
|
|
@@ -726,8 +740,8 @@ const makeBusinessCalendarService = (config) => Effect.gen(function* () {
|
|
|
726
740
|
* failures) are committed to the cache.
|
|
727
741
|
*/
|
|
728
742
|
const holidayCacheRef = yield* SynchronizedRef.make(/* @__PURE__ */ new Map());
|
|
729
|
-
const computeHolidaysForYear = (year) => calculateHolidaysForYear(config.holidays, year).pipe(Effect.
|
|
730
|
-
if (Cause.
|
|
743
|
+
const computeHolidaysForYear = (year) => calculateHolidaysForYear(config.holidays, year).pipe(Effect.catchCause((cause) => {
|
|
744
|
+
if (Cause.hasInterrupts(cause) || Cause.hasDies(cause)) return Effect.failCause(cause);
|
|
731
745
|
return Effect.logWarning("Failed to compute holidays for year", cause).pipe(Effect.annotateLogs({ year }), Effect.as([]));
|
|
732
746
|
}));
|
|
733
747
|
const getHolidaysForYearCached = (year) => Effect.uninterruptibleMask((restore) => Effect.gen(function* () {
|
|
@@ -757,10 +771,10 @@ const makeBusinessCalendarService = (config) => Effect.gen(function* () {
|
|
|
757
771
|
});
|
|
758
772
|
switch (acquired._tag) {
|
|
759
773
|
case "hit": return acquired.holidays;
|
|
760
|
-
case "join": return yield* restore(Deferred.await(acquired.deferred).pipe(Effect.
|
|
774
|
+
case "join": return yield* restore(Deferred.await(acquired.deferred).pipe(Effect.catch(() => getHolidaysForYearCached(year))));
|
|
761
775
|
case "owner": {
|
|
762
776
|
const exit = yield* Effect.exit(restore(Effect.gen(function* () {
|
|
763
|
-
yield* Effect.yieldNow
|
|
777
|
+
yield* Effect.yieldNow;
|
|
764
778
|
return yield* computeHolidaysForYear(year);
|
|
765
779
|
})));
|
|
766
780
|
if (Exit.isSuccess(exit)) {
|
|
@@ -902,9 +916,6 @@ const makeBusinessCalendarService = (config) => Effect.gen(function* () {
|
|
|
902
916
|
const bParts = getLocalParts(b);
|
|
903
917
|
return aParts.year === bParts.year && aParts.month === bParts.month && aParts.day === bParts.day;
|
|
904
918
|
};
|
|
905
|
-
/**
|
|
906
|
-
* Service implementation
|
|
907
|
-
*/
|
|
908
919
|
const service = {
|
|
909
920
|
isBusinessDay: (date) => Effect.gen(function* () {
|
|
910
921
|
const parts = getLocalParts(date);
|
|
@@ -912,7 +923,7 @@ const makeBusinessCalendarService = (config) => Effect.gen(function* () {
|
|
|
912
923
|
if (exception?.slots === "closed") return false;
|
|
913
924
|
if (config.nonWorkingDays.includes(parts.weekDay)) return false;
|
|
914
925
|
const holidays = yield* getHolidaysForYearCached(parts.year);
|
|
915
|
-
const civilDateForHoliday = DateTime.
|
|
926
|
+
const civilDateForHoliday = DateTime.makeUnsafe({
|
|
916
927
|
year: parts.year,
|
|
917
928
|
month: parts.month,
|
|
918
929
|
day: parts.day
|
|
@@ -929,8 +940,8 @@ const makeBusinessCalendarService = (config) => Effect.gen(function* () {
|
|
|
929
940
|
if (!(yield* service.isBusinessDay(datetime))) return false;
|
|
930
941
|
const parts = getLocalParts(datetime);
|
|
931
942
|
const currentTime = {
|
|
932
|
-
hour: parts.
|
|
933
|
-
minute: parts.
|
|
943
|
+
hour: parts.hour,
|
|
944
|
+
minute: parts.minute
|
|
934
945
|
};
|
|
935
946
|
const exception = getDateException(datetime);
|
|
936
947
|
if (exception && typeof exception.slots !== "string") {
|
|
@@ -978,8 +989,8 @@ const makeBusinessCalendarService = (config) => Effect.gen(function* () {
|
|
|
978
989
|
}
|
|
979
990
|
const parts = getLocalParts(current);
|
|
980
991
|
const currentTime = {
|
|
981
|
-
hour: parts.
|
|
982
|
-
minute: parts.
|
|
992
|
+
hour: parts.hour,
|
|
993
|
+
minute: parts.minute
|
|
983
994
|
};
|
|
984
995
|
const exception = getDateException(current);
|
|
985
996
|
let ranges;
|
|
@@ -998,8 +1009,8 @@ const makeBusinessCalendarService = (config) => Effect.gen(function* () {
|
|
|
998
1009
|
current = DateTime.add(current, { minutes: minutesInCurrentRange });
|
|
999
1010
|
const newParts = getLocalParts(current);
|
|
1000
1011
|
const newTime = {
|
|
1001
|
-
hour: newParts.
|
|
1002
|
-
minute: newParts.
|
|
1012
|
+
hour: newParts.hour,
|
|
1013
|
+
minute: newParts.minute
|
|
1003
1014
|
};
|
|
1004
1015
|
let foundNextRange = false;
|
|
1005
1016
|
for (const range of ranges) {
|
|
@@ -1100,8 +1111,8 @@ const makeBusinessCalendarService = (config) => Effect.gen(function* () {
|
|
|
1100
1111
|
if (!(yield* service.isBusinessHours(datetime))) return Duration.zero;
|
|
1101
1112
|
const parts = getLocalParts(datetime);
|
|
1102
1113
|
const currentTime = {
|
|
1103
|
-
hour: parts.
|
|
1104
|
-
minute: parts.
|
|
1114
|
+
hour: parts.hour,
|
|
1115
|
+
minute: parts.minute
|
|
1105
1116
|
};
|
|
1106
1117
|
const exception = getDateException(datetime);
|
|
1107
1118
|
let ranges;
|
|
@@ -1145,8 +1156,8 @@ const makeBusinessCalendarService = (config) => Effect.gen(function* () {
|
|
|
1145
1156
|
});
|
|
1146
1157
|
const startParts = getLocalParts(start);
|
|
1147
1158
|
const endParts = getLocalParts(end);
|
|
1148
|
-
const startMinuteOfDay = startParts.
|
|
1149
|
-
const endMinuteOfDay = endParts.
|
|
1159
|
+
const startMinuteOfDay = startParts.hour * 60 + startParts.minute;
|
|
1160
|
+
const endMinuteOfDay = endParts.hour * 60 + endParts.minute;
|
|
1150
1161
|
if (isSameLocalDate(start, end)) {
|
|
1151
1162
|
const minutes = yield* businessMinutesOnDayInWindow(start, startMinuteOfDay, endMinuteOfDay);
|
|
1152
1163
|
return Duration.minutes(minutes);
|
|
@@ -1167,7 +1178,7 @@ const makeBusinessCalendarService = (config) => Effect.gen(function* () {
|
|
|
1167
1178
|
isHoliday: (date) => Effect.gen(function* () {
|
|
1168
1179
|
const parts = getLocalParts(date);
|
|
1169
1180
|
const holidays = yield* getHolidaysForYearCached(parts.year);
|
|
1170
|
-
const civilDateForHoliday = DateTime.
|
|
1181
|
+
const civilDateForHoliday = DateTime.makeUnsafe({
|
|
1171
1182
|
year: parts.year,
|
|
1172
1183
|
month: parts.month,
|
|
1173
1184
|
day: parts.day
|
|
@@ -1200,5 +1211,4 @@ const makeBusinessCalendarService = (config) => Effect.gen(function* () {
|
|
|
1200
1211
|
return service;
|
|
1201
1212
|
});
|
|
1202
1213
|
Layer.effect(BusinessCalendarService, Effect.flatMap(BusinessCalendarConfigService, makeBusinessCalendarService));
|
|
1203
|
-
//#endregion
|
|
1204
1214
|
export { AllDays, BusinessCalendarConfig, CalendarPeriod, CalendarPeriodFromJson, DateException, DayOfMonth, DayOfWeek, Friday, Holiday, Monday, Month, NL_HOLIDAYS, NZ_HOLIDAYS, NthOccurrence, Saturday, Sunday, Thursday, Tuesday, US_HOLIDAYS, Wednesday, Weekdays, createDefaultConfig, createStandardWeekdaySchedule, easterRelativeHoliday, fixedHoliday, lastWeekdayHoliday, nthWeekdayHoliday };
|
|
@@ -3,6 +3,9 @@ export * from "./lib/deferred-value.js";
|
|
|
3
3
|
export * from "./lib/email.js";
|
|
4
4
|
export * from "./lib/field-count.js";
|
|
5
5
|
export * from "./lib/form-annotations.js";
|
|
6
|
+
export * from "./lib/form-presentation.js";
|
|
6
7
|
export * from "./lib/form-schema.js";
|
|
8
|
+
export * from "./lib/number-from-string.js";
|
|
7
9
|
export * from "./lib/phone.js";
|
|
8
|
-
export * from "./lib/
|
|
10
|
+
export * from "./lib/public-completion-correction.js";
|
|
11
|
+
export { searchLookupItems } from "./lib/search-lookup-items.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Schema, SchemaAST } from "effect";
|
|
1
|
+
import type { Schema, SchemaAST } from "effect";
|
|
2
2
|
/** Look through field wrappers on the encoded side, never into container children. */
|
|
3
|
-
export declare const fieldAnnotation: (ast: SchemaAST.AST, key: symbol) => unknown;
|
|
3
|
+
export declare const fieldAnnotation: (ast: SchemaAST.AST, key: symbol | string) => unknown;
|
|
4
4
|
/** Property annotations override the underlying encoded field's annotations. */
|
|
5
5
|
export declare const fieldInputAst: (field: Schema.Struct.Fields[string]) => SchemaAST.AST;
|
|
6
6
|
export declare const hasStructuralOnlyAnnotation: (field: Schema.Struct.Fields[string]) => boolean;
|
|
@@ -19,5 +19,5 @@ import { type FieldOptions } from "./form-schema.js";
|
|
|
19
19
|
* })
|
|
20
20
|
* ```
|
|
21
21
|
*/
|
|
22
|
-
export declare const Email: Schema.
|
|
23
|
-
export declare const EmailField: (options?: FieldOptions<string>) => Schema.
|
|
22
|
+
export declare const Email: Schema.Trim;
|
|
23
|
+
export declare const EmailField: (options?: FieldOptions<string>) => Schema.Codec<string, string, never, never>;
|
|
@@ -7,7 +7,7 @@ import { Schema } from "effect";
|
|
|
7
7
|
* @param data - Data to validate
|
|
8
8
|
* @returns Number of top-level fields with validation errors
|
|
9
9
|
*/
|
|
10
|
-
export declare const countInvalidFields: (schema: Schema.
|
|
10
|
+
export declare const countInvalidFields: (schema: Schema.Top, data: unknown) => number;
|
|
11
11
|
/**
|
|
12
12
|
* Counts the total number of fields in a schema.
|
|
13
13
|
*
|
|
@@ -26,7 +26,7 @@ export declare const countTotalFields: (schema: {
|
|
|
26
26
|
*/
|
|
27
27
|
export declare const calculateFieldCompletion: (schema: {
|
|
28
28
|
fields: Record<PropertyKey, unknown>;
|
|
29
|
-
} & Schema.
|
|
29
|
+
} & Schema.Top, data: unknown) => {
|
|
30
30
|
fieldsCompleted: number;
|
|
31
31
|
totalFields: number;
|
|
32
32
|
};
|
|
@@ -8,8 +8,11 @@ export declare const FormPermission: unique symbol;
|
|
|
8
8
|
export declare const FormRequired: unique symbol;
|
|
9
9
|
export declare const FormMessage: unique symbol;
|
|
10
10
|
export declare const FormAutoComplete: unique symbol;
|
|
11
|
+
/** Set to false on a form schema to preserve initial focus instead of focusing its first editable control. */
|
|
12
|
+
export declare const FormAutoFocus: unique symbol;
|
|
11
13
|
export declare const FormNumberInput: unique symbol;
|
|
12
14
|
export declare const FormDateInput: unique symbol;
|
|
15
|
+
export declare const FormLocalDateTimeInput: unique symbol;
|
|
13
16
|
export declare const FormEmailInput: unique symbol;
|
|
14
17
|
export declare const FormPhoneInput: unique symbol;
|
|
15
18
|
export declare const FormTextAreaInput: unique symbol;
|
|
@@ -18,8 +21,11 @@ export declare const FormListInput: unique symbol;
|
|
|
18
21
|
export declare const FormFileInput: unique symbol;
|
|
19
22
|
export declare const FormLookupInput: unique symbol;
|
|
20
23
|
export declare const FormRadioInput: unique symbol;
|
|
24
|
+
export declare const FormCheckboxGroupInput: unique symbol;
|
|
21
25
|
export declare const FormSuggestionInput: unique symbol;
|
|
22
26
|
export declare const FormCalendarSlotInput: unique symbol;
|
|
23
27
|
export declare const FormProviderUserInput: unique symbol;
|
|
24
28
|
export declare const FormStaticText: unique symbol;
|
|
25
29
|
export declare const FormComponentPluginType: unique symbol;
|
|
30
|
+
/** Public, static renderer options. Server-resolved configuration travels separately. */
|
|
31
|
+
export declare const FormPluginData: unique symbol;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
/** Request data only. The executable schema remains the source of field structure. */
|
|
3
|
+
export declare const FormPresentation: Schema.Struct<{
|
|
4
|
+
readonly label: Schema.optional<Schema.String>;
|
|
5
|
+
readonly description: Schema.optional<Schema.String>;
|
|
6
|
+
readonly text: Schema.optional<Schema.String>;
|
|
7
|
+
readonly href: Schema.optional<Schema.String>;
|
|
8
|
+
}>;
|
|
9
|
+
export type FormPresentation = typeof FormPresentation.Type;
|
|
10
|
+
export declare const FormRequestData: Schema.Struct<{
|
|
11
|
+
readonly presentation: Schema.$Record<Schema.String, Schema.Struct<{
|
|
12
|
+
readonly label: Schema.optional<Schema.String>;
|
|
13
|
+
readonly description: Schema.optional<Schema.String>;
|
|
14
|
+
readonly text: Schema.optional<Schema.String>;
|
|
15
|
+
readonly href: Schema.optional<Schema.String>;
|
|
16
|
+
}>>;
|
|
17
|
+
readonly inaccessible: Schema.$Array<Schema.String>;
|
|
18
|
+
readonly originalValues: Schema.$Record<Schema.String, Schema.Unknown>;
|
|
19
|
+
readonly lookups: Schema.optional<Schema.$Record<Schema.String, Schema.Struct<{
|
|
20
|
+
readonly dependencies: Schema.$Array<Schema.String>;
|
|
21
|
+
readonly queryName: Schema.String;
|
|
22
|
+
}>>>;
|
|
23
|
+
readonly prefill: Schema.optional<Schema.Struct<{
|
|
24
|
+
readonly dependency: Schema.String;
|
|
25
|
+
readonly fields: Schema.$Array<Schema.String>;
|
|
26
|
+
readonly concealed: Schema.$Array<Schema.String>;
|
|
27
|
+
readonly queryName: Schema.String;
|
|
28
|
+
}>>;
|
|
29
|
+
}>;
|
|
30
|
+
export type FormRequestData = typeof FormRequestData.Type;
|