@apiary-dev/core 0.1.0 → 0.1.1

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/index.cjs CHANGED
@@ -20,6 +20,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
+ BookingConflictError: () => BookingConflictError,
24
+ ValidationError: () => ValidationError,
23
25
  applyBufferToRange: () => applyBufferToRange,
24
26
  buildMonthMatrix: () => buildMonthMatrix,
25
27
  buildMultiMonthMatrix: () => buildMultiMonthMatrix,
@@ -33,6 +35,20 @@ __export(index_exports, {
33
35
  });
34
36
  module.exports = __toCommonJS(index_exports);
35
37
 
38
+ // src/errors.ts
39
+ var BookingConflictError = class extends Error {
40
+ constructor(message = "Requested slot overlaps an existing booking or hold") {
41
+ super(message);
42
+ this.name = "BookingConflictError";
43
+ }
44
+ };
45
+ var ValidationError = class extends Error {
46
+ constructor(message) {
47
+ super(message);
48
+ this.name = "ValidationError";
49
+ }
50
+ };
51
+
36
52
  // src/rules/collisions.ts
37
53
  function rangesOverlap(a, b) {
38
54
  return a.start < b.end && a.end > b.start;
@@ -406,6 +422,8 @@ function expandWeeklyRules(options) {
406
422
  }
407
423
  // Annotate the CommonJS export names for ESM import in node:
408
424
  0 && (module.exports = {
425
+ BookingConflictError,
426
+ ValidationError,
409
427
  applyBufferToRange,
410
428
  buildMonthMatrix,
411
429
  buildMultiMonthMatrix,
package/dist/index.d.cts CHANGED
@@ -67,6 +67,19 @@ interface BookingRepository {
67
67
  }>;
68
68
  }
69
69
 
70
+ /**
71
+ * Thrown when a requested time range overlaps an existing booking or hold.
72
+ */
73
+ declare class BookingConflictError extends Error {
74
+ constructor(message?: string);
75
+ }
76
+ /**
77
+ * Thrown when operation input is missing or invalid.
78
+ */
79
+ declare class ValidationError extends Error {
80
+ constructor(message: string);
81
+ }
82
+
70
83
  /**
71
84
  * Checks if two half-open time ranges [start, end) overlap.
72
85
  * Touch points (RangeA.end === RangeB.start) do NOT overlap.
@@ -215,5 +228,5 @@ interface WeeklyAvailabilityOptions {
215
228
  */
216
229
  declare function expandWeeklyRules(options: WeeklyAvailabilityOptions): AvailableWindow[];
217
230
 
218
- export { applyBufferToRange, buildMonthMatrix, buildMultiMonthMatrix, buildMultiWeekMatrix, buildWeekMatrix, expandWeeklyRules, generateTimeSlots, rangesOverlap, utcToWallClock, wallClockToUTC };
231
+ export { BookingConflictError, ValidationError, applyBufferToRange, buildMonthMatrix, buildMultiMonthMatrix, buildMultiWeekMatrix, buildWeekMatrix, expandWeeklyRules, generateTimeSlots, rangesOverlap, utcToWallClock, wallClockToUTC };
219
232
  export type { AvailabilityReason, AvailableWindow, BookingRepository, BufferConfig, CalendarDay, DayOfWeek, MonthGrid, MonthGridOptions, MonthViewUnit, MultiMonthViewOptions, MultiWeekViewOptions, SlotGeneratorOptions, TimeRange, TimeSlot, WallClockTime, WeekGrid, WeekGridOptions, WeeklyAvailabilityOptions, WeeklyRule };
package/dist/index.d.ts CHANGED
@@ -67,6 +67,19 @@ interface BookingRepository {
67
67
  }>;
68
68
  }
69
69
 
70
+ /**
71
+ * Thrown when a requested time range overlaps an existing booking or hold.
72
+ */
73
+ declare class BookingConflictError extends Error {
74
+ constructor(message?: string);
75
+ }
76
+ /**
77
+ * Thrown when operation input is missing or invalid.
78
+ */
79
+ declare class ValidationError extends Error {
80
+ constructor(message: string);
81
+ }
82
+
70
83
  /**
71
84
  * Checks if two half-open time ranges [start, end) overlap.
72
85
  * Touch points (RangeA.end === RangeB.start) do NOT overlap.
@@ -215,5 +228,5 @@ interface WeeklyAvailabilityOptions {
215
228
  */
216
229
  declare function expandWeeklyRules(options: WeeklyAvailabilityOptions): AvailableWindow[];
217
230
 
218
- export { applyBufferToRange, buildMonthMatrix, buildMultiMonthMatrix, buildMultiWeekMatrix, buildWeekMatrix, expandWeeklyRules, generateTimeSlots, rangesOverlap, utcToWallClock, wallClockToUTC };
231
+ export { BookingConflictError, ValidationError, applyBufferToRange, buildMonthMatrix, buildMultiMonthMatrix, buildMultiWeekMatrix, buildWeekMatrix, expandWeeklyRules, generateTimeSlots, rangesOverlap, utcToWallClock, wallClockToUTC };
219
232
  export type { AvailabilityReason, AvailableWindow, BookingRepository, BufferConfig, CalendarDay, DayOfWeek, MonthGrid, MonthGridOptions, MonthViewUnit, MultiMonthViewOptions, MultiWeekViewOptions, SlotGeneratorOptions, TimeRange, TimeSlot, WallClockTime, WeekGrid, WeekGridOptions, WeeklyAvailabilityOptions, WeeklyRule };
package/dist/index.js CHANGED
@@ -1,3 +1,17 @@
1
+ // src/errors.ts
2
+ var BookingConflictError = class extends Error {
3
+ constructor(message = "Requested slot overlaps an existing booking or hold") {
4
+ super(message);
5
+ this.name = "BookingConflictError";
6
+ }
7
+ };
8
+ var ValidationError = class extends Error {
9
+ constructor(message) {
10
+ super(message);
11
+ this.name = "ValidationError";
12
+ }
13
+ };
14
+
1
15
  // src/rules/collisions.ts
2
16
  function rangesOverlap(a, b) {
3
17
  return a.start < b.end && a.end > b.start;
@@ -370,6 +384,8 @@ function expandWeeklyRules(options) {
370
384
  return result;
371
385
  }
372
386
  export {
387
+ BookingConflictError,
388
+ ValidationError,
373
389
  applyBufferToRange,
374
390
  buildMonthMatrix,
375
391
  buildMultiMonthMatrix,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apiary-dev/core",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Apiary core: zero-dependency, framework-agnostic scheduling domain logic",
5
5
  "license": "ISC",
6
6
  "type": "module",