@pisell/pisellos 2.3.72 → 2.3.74

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.
Files changed (74) hide show
  1. package/dist/core/index.d.ts +7 -0
  2. package/dist/core/index.js +109 -65
  3. package/dist/modules/OpenData/types.d.ts +1 -0
  4. package/dist/modules/Order/index.d.ts +1 -1
  5. package/dist/modules/Order/utils.js +6 -1
  6. package/dist/modules/Quotation/index.d.ts +6 -0
  7. package/dist/modules/Quotation/index.js +75 -19
  8. package/dist/modules/ResourcePlanner/index.d.ts +0 -22
  9. package/dist/modules/ResourcePlanner/index.js +1 -180
  10. package/dist/modules/ResourcePlanner/localClock.d.ts +33 -0
  11. package/dist/modules/ResourcePlanner/localClock.js +183 -0
  12. package/dist/modules/ResourcePlanner/planner.d.ts +5 -14
  13. package/dist/modules/ResourcePlanner/planner.js +2019 -936
  14. package/dist/modules/ResourcePlanner/types.d.ts +346 -187
  15. package/dist/modules/ResourcePlanner/types.js +33 -1
  16. package/dist/plugins/request.d.ts +1 -0
  17. package/dist/server/index.d.ts +8 -2
  18. package/dist/server/index.js +206 -140
  19. package/dist/server/modules/floor-plan/index.d.ts +4 -0
  20. package/dist/server/modules/floor-plan/index.js +240 -98
  21. package/dist/server/modules/menu/index.js +48 -23
  22. package/dist/server/modules/order/index.d.ts +17 -7
  23. package/dist/server/modules/order/index.js +419 -207
  24. package/dist/server/modules/products/index.d.ts +8 -2
  25. package/dist/server/modules/products/index.js +167 -75
  26. package/dist/server/modules/resource/index.js +21 -13
  27. package/dist/solution/BookingByStep/index.d.ts +1 -1
  28. package/dist/solution/BookingTicket/index.js +4 -2
  29. package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +2 -1
  30. package/dist/solution/BookingTicket/utils/addProductDecision.js +3 -2
  31. package/dist/solution/UnifiedBookingSales/index.d.ts +110 -73
  32. package/dist/solution/UnifiedBookingSales/index.js +3349 -971
  33. package/dist/solution/UnifiedBookingSales/remoteOccupancyCache.d.ts +49 -0
  34. package/dist/solution/UnifiedBookingSales/remoteOccupancyCache.js +430 -0
  35. package/dist/solution/UnifiedBookingSales/types.d.ts +133 -76
  36. package/dist/solution/UnifiedBookingSales/types.js +4 -9
  37. package/lib/core/index.d.ts +7 -0
  38. package/lib/core/index.js +20 -2
  39. package/lib/model/strategy/adapter/promotion/index.js +0 -51
  40. package/lib/modules/OpenData/types.d.ts +1 -0
  41. package/lib/modules/Order/index.d.ts +1 -1
  42. package/lib/modules/Order/utils.js +5 -1
  43. package/lib/modules/Quotation/index.d.ts +6 -0
  44. package/lib/modules/Quotation/index.js +49 -5
  45. package/lib/modules/ResourcePlanner/index.d.ts +0 -22
  46. package/lib/modules/ResourcePlanner/index.js +0 -123
  47. package/lib/modules/ResourcePlanner/localClock.d.ts +33 -0
  48. package/lib/modules/ResourcePlanner/localClock.js +270 -0
  49. package/lib/modules/ResourcePlanner/planner.d.ts +5 -14
  50. package/lib/modules/ResourcePlanner/planner.js +1903 -798
  51. package/lib/modules/ResourcePlanner/types.d.ts +346 -187
  52. package/lib/modules/ResourcePlanner/types.js +19 -0
  53. package/lib/plugins/request.d.ts +1 -0
  54. package/lib/server/index.d.ts +8 -2
  55. package/lib/server/index.js +52 -17
  56. package/lib/server/modules/floor-plan/index.d.ts +4 -0
  57. package/lib/server/modules/floor-plan/index.js +54 -6
  58. package/lib/server/modules/menu/index.js +31 -5
  59. package/lib/server/modules/order/index.d.ts +17 -7
  60. package/lib/server/modules/order/index.js +197 -40
  61. package/lib/server/modules/products/index.d.ts +8 -2
  62. package/lib/server/modules/products/index.js +97 -24
  63. package/lib/server/modules/resource/index.js +7 -2
  64. package/lib/solution/BookingByStep/index.d.ts +1 -1
  65. package/lib/solution/BookingTicket/index.js +2 -1
  66. package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +2 -1
  67. package/lib/solution/BookingTicket/utils/addProductDecision.js +2 -0
  68. package/lib/solution/UnifiedBookingSales/index.d.ts +110 -73
  69. package/lib/solution/UnifiedBookingSales/index.js +2289 -374
  70. package/lib/solution/UnifiedBookingSales/remoteOccupancyCache.d.ts +49 -0
  71. package/lib/solution/UnifiedBookingSales/remoteOccupancyCache.js +376 -0
  72. package/lib/solution/UnifiedBookingSales/types.d.ts +133 -76
  73. package/lib/solution/UnifiedBookingSales/types.js +3 -2
  74. package/package.json +1 -1
@@ -2,10 +2,6 @@ var __defProp = Object.defineProperty;
2
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
5
  var __copyProps = (to, from, except, desc) => {
10
6
  if (from && typeof from === "object" || typeof from === "function") {
11
7
  for (let key of __getOwnPropNames(from))
@@ -19,130 +15,11 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
19
15
 
20
16
  // src/modules/ResourcePlanner/index.ts
21
17
  var ResourcePlanner_exports = {};
22
- __export(ResourcePlanner_exports, {
23
- ResourcePlannerHooks: () => ResourcePlannerHooks,
24
- ResourcePlannerModule: () => ResourcePlannerModule
25
- });
26
18
  module.exports = __toCommonJS(ResourcePlanner_exports);
27
- var import_BaseModule = require("../BaseModule");
28
- var import_planner = require("./planner");
29
19
  __reExport(ResourcePlanner_exports, require("./types"), module.exports);
30
20
  __reExport(ResourcePlanner_exports, require("./planner"), module.exports);
31
- var ResourcePlannerHooks = /* @__PURE__ */ ((ResourcePlannerHooks2) => {
32
- ResourcePlannerHooks2["onContextChanged"] = "resourcePlanner:onContextChanged";
33
- ResourcePlannerHooks2["onSelectionChanged"] = "resourcePlanner:onSelectionChanged";
34
- ResourcePlannerHooks2["onProjectionChanged"] = "resourcePlanner:onProjectionChanged";
35
- return ResourcePlannerHooks2;
36
- })(ResourcePlannerHooks || {});
37
- var ResourcePlannerModule = class extends import_BaseModule.BaseModule {
38
- constructor() {
39
- super(...arguments);
40
- this.defaultName = "resourcePlanner";
41
- this.defaultVersion = "1.0.0";
42
- }
43
- async initialize(core, options) {
44
- this.core = core;
45
- const initialState = options.initialState;
46
- this.store = {
47
- context: (0, import_planner.normalizePlannerContext)((initialState == null ? void 0 : initialState.context) || import_planner.DEFAULT_RESOURCE_PLANNER_CONTEXT),
48
- selection: (initialState == null ? void 0 : initialState.selection) || { ...import_planner.DEFAULT_RESOURCE_PLANNER_SELECTION },
49
- projection: (initialState == null ? void 0 : initialState.projection) || null,
50
- version: (initialState == null ? void 0 : initialState.version) || 0
51
- };
52
- }
53
- setContext(input) {
54
- this.store.context = (0, import_planner.normalizePlannerContext)(input);
55
- this.store.version += 1;
56
- this.store.projection = null;
57
- const snapshot = this.getSnapshot();
58
- void this.core.effects.emit(`${this.name}:contextChanged`, snapshot);
59
- return snapshot;
60
- }
61
- mergeContext(input) {
62
- return this.setContext({
63
- ...this.store.context,
64
- ...input,
65
- products: input.products || this.store.context.products,
66
- resources: input.resources || this.store.context.resources,
67
- externalEvents: input.externalEvents || this.store.context.externalEvents
68
- });
69
- }
70
- setSelectionPatch(patch) {
71
- const assignments = patch.assignments ? patch.replaceAssignments === false ? [...this.store.selection.assignments, ...patch.assignments] : patch.assignments : this.store.selection.assignments;
72
- this.store.selection = {
73
- ...this.store.selection,
74
- ...patch,
75
- productIds: patch.productIds || this.store.selection.productIds,
76
- resourceIds: patch.resourceIds || this.store.selection.resourceIds,
77
- assignments
78
- };
79
- this.store.version += 1;
80
- const snapshot = this.getSnapshot();
81
- void this.core.effects.emit(`${this.name}:selectionChanged`, snapshot);
82
- return snapshot;
83
- }
84
- queryAvailability(query = {}) {
85
- const mergedQuery = {
86
- mode: this.store.selection.mode,
87
- productIds: this.store.selection.productIds,
88
- date: this.store.selection.date,
89
- startTime: this.store.selection.startTime,
90
- endTime: this.store.selection.endTime,
91
- resourceIds: this.store.selection.resourceIds,
92
- ...query
93
- };
94
- const projection = (0, import_planner.queryPlannerAvailability)(this.store.context, mergedQuery);
95
- this.store.projection = projection;
96
- this.store.version += 1;
97
- void this.core.effects.emit(`${this.name}:projectionChanged`, this.getSnapshot());
98
- return projection;
99
- }
100
- autoAssign(query = {}) {
101
- const result = (0, import_planner.autoAssignResources)(this.store.context, {
102
- mode: this.store.selection.mode,
103
- productIds: this.store.selection.productIds,
104
- date: this.store.selection.date,
105
- startTime: this.store.selection.startTime,
106
- endTime: this.store.selection.endTime,
107
- resourceIds: this.store.selection.resourceIds,
108
- ...query
109
- });
110
- const resourceIds = Array.from(new Map(
111
- result.assignments.map((assignment) => [String(assignment.resourceId), assignment.resourceId])
112
- ).values());
113
- this.setSelectionPatch({
114
- assignments: result.assignments,
115
- ...resourceIds.length ? { resourceIds } : {}
116
- });
117
- return result;
118
- }
119
- resolveAssignableSlots(query = {}) {
120
- return (0, import_planner.resolveAssignableSlots)(this.store.context, {
121
- mode: this.store.selection.mode,
122
- productIds: this.store.selection.productIds,
123
- date: this.store.selection.date,
124
- startTime: this.store.selection.startTime,
125
- endTime: this.store.selection.endTime,
126
- resourceIds: this.store.selection.resourceIds,
127
- ...query
128
- });
129
- }
130
- validateSelection() {
131
- return (0, import_planner.validateAssignments)(this.store.context, this.store.selection);
132
- }
133
- getSnapshot() {
134
- return {
135
- context: this.store.context,
136
- selection: this.store.selection,
137
- projection: this.store.projection,
138
- version: this.store.version
139
- };
140
- }
141
- };
142
21
  // Annotate the CommonJS export names for ESM import in node:
143
22
  0 && (module.exports = {
144
- ResourcePlannerHooks,
145
- ResourcePlannerModule,
146
23
  ...require("./types"),
147
24
  ...require("./planner")
148
25
  });
@@ -0,0 +1,33 @@
1
+ export interface LocalDateParts {
2
+ year: number;
3
+ month: number;
4
+ day: number;
5
+ }
6
+ export interface LocalDateTimeParts extends LocalDateParts {
7
+ hour: number;
8
+ minute: number;
9
+ second: number;
10
+ }
11
+ type LocalDateInput = string | LocalDateParts;
12
+ type LocalDateTimeInput = string | number | LocalDateTimeParts;
13
+ export declare function parseLocalDate(value: string): LocalDateParts;
14
+ export declare function parseLocalDateTime(value: string): LocalDateTimeParts;
15
+ export declare function extractFixedOffsetMinutes(value: string | null | undefined): number | null;
16
+ export declare function captureRuntimeOffsetMinutes(value?: Date): number;
17
+ export declare function formatFixedOffset(offsetMinutes: number | null | undefined): string;
18
+ export declare function localDateTimeToScalar(value: LocalDateTimeParts): number;
19
+ export declare function localDateToScalar(value: Date): number;
20
+ export declare function localDateToScalarStart(value: LocalDateInput): number;
21
+ export declare function scalarToLocalDateParts(value: number): LocalDateParts;
22
+ export declare function scalarToLocalDateTimeParts(value: number): LocalDateTimeParts;
23
+ export declare function dateOrdinalFromLocalDate(value: LocalDateInput): number;
24
+ export declare function weekdayFromLocalDate(value: LocalDateInput): number;
25
+ export declare function formatLocalDate(value: LocalDateInput | number): string;
26
+ export declare function formatLocalTime(value: LocalDateTimeInput, includeSeconds?: boolean): string;
27
+ export declare function formatLocalDateTime(value: LocalDateTimeInput, fixedOffsetMinutes?: number | null): string;
28
+ export declare function addLocalMinutes(value: number, minutes: number): number;
29
+ export declare function addLocalHours(value: number, hours: number): number;
30
+ export declare function addLocalCalendarDays(value: number, days: number): number;
31
+ export declare function nextDate(value: LocalDateInput): string;
32
+ export declare function ceilLocalScalarToTenMinutes(value: number): number;
33
+ export {};
@@ -0,0 +1,270 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/modules/ResourcePlanner/localClock.ts
20
+ var localClock_exports = {};
21
+ __export(localClock_exports, {
22
+ addLocalCalendarDays: () => addLocalCalendarDays,
23
+ addLocalHours: () => addLocalHours,
24
+ addLocalMinutes: () => addLocalMinutes,
25
+ captureRuntimeOffsetMinutes: () => captureRuntimeOffsetMinutes,
26
+ ceilLocalScalarToTenMinutes: () => ceilLocalScalarToTenMinutes,
27
+ dateOrdinalFromLocalDate: () => dateOrdinalFromLocalDate,
28
+ extractFixedOffsetMinutes: () => extractFixedOffsetMinutes,
29
+ formatFixedOffset: () => formatFixedOffset,
30
+ formatLocalDate: () => formatLocalDate,
31
+ formatLocalDateTime: () => formatLocalDateTime,
32
+ formatLocalTime: () => formatLocalTime,
33
+ localDateTimeToScalar: () => localDateTimeToScalar,
34
+ localDateToScalar: () => localDateToScalar,
35
+ localDateToScalarStart: () => localDateToScalarStart,
36
+ nextDate: () => nextDate,
37
+ parseLocalDate: () => parseLocalDate,
38
+ parseLocalDateTime: () => parseLocalDateTime,
39
+ scalarToLocalDateParts: () => scalarToLocalDateParts,
40
+ scalarToLocalDateTimeParts: () => scalarToLocalDateTimeParts,
41
+ weekdayFromLocalDate: () => weekdayFromLocalDate
42
+ });
43
+ module.exports = __toCommonJS(localClock_exports);
44
+ var MINUTE_MS = 60 * 1e3;
45
+ var HOUR_MS = 60 * MINUTE_MS;
46
+ function pad(value, size = 2) {
47
+ return String(value).padStart(size, "0");
48
+ }
49
+ function isFiniteInteger(value) {
50
+ return Number.isInteger(value) && Number.isFinite(value);
51
+ }
52
+ function assertDateParts(parts) {
53
+ if (!isFiniteInteger(parts.year) || !isFiniteInteger(parts.month) || !isFiniteInteger(parts.day)) {
54
+ throw new Error("Invalid local date parts");
55
+ }
56
+ const probe = new Date(Date.UTC(parts.year, parts.month - 1, parts.day));
57
+ if (probe.getUTCFullYear() !== parts.year || probe.getUTCMonth() !== parts.month - 1 || probe.getUTCDate() !== parts.day) {
58
+ throw new Error("Invalid local date");
59
+ }
60
+ }
61
+ function assertTimeParts(parts) {
62
+ if (!isFiniteInteger(parts.hour) || !isFiniteInteger(parts.minute) || !isFiniteInteger(parts.second) || parts.hour < 0 || parts.hour > 23 || parts.minute < 0 || parts.minute > 59 || parts.second < 0 || parts.second > 59) {
63
+ throw new Error("Invalid local time");
64
+ }
65
+ }
66
+ function localDateInputToParts(value) {
67
+ if (typeof value !== "string") {
68
+ assertDateParts(value);
69
+ return value;
70
+ }
71
+ return parseLocalDate(value);
72
+ }
73
+ function scalarToDate(value) {
74
+ if (!Number.isFinite(value)) {
75
+ throw new Error("Invalid local scalar");
76
+ }
77
+ return new Date(value);
78
+ }
79
+ function parseLocalDate(value) {
80
+ const match = /^(\d{4})-(\d{2})-(\d{2})$/.exec(value.trim());
81
+ if (!match) {
82
+ throw new Error(`Invalid local date: ${value}`);
83
+ }
84
+ const parts = {
85
+ year: Number(match[1]),
86
+ month: Number(match[2]),
87
+ day: Number(match[3])
88
+ };
89
+ assertDateParts(parts);
90
+ return parts;
91
+ }
92
+ function parseLocalDateTime(value) {
93
+ const match = /^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2})(?::(\d{2}))?(?:\.\d{1,9})?(?:[zZ]|[+-]\d{2}:\d{2})?$/.exec(value.trim());
94
+ if (!match) {
95
+ throw new Error(`Invalid local datetime: ${value}`);
96
+ }
97
+ const parts = {
98
+ year: Number(match[1]),
99
+ month: Number(match[2]),
100
+ day: Number(match[3]),
101
+ hour: Number(match[4]),
102
+ minute: Number(match[5]),
103
+ second: Number(match[6] || "0")
104
+ };
105
+ assertDateParts(parts);
106
+ assertTimeParts(parts);
107
+ return parts;
108
+ }
109
+ function extractFixedOffsetMinutes(value) {
110
+ if (!value)
111
+ return null;
112
+ const trimmed = value.trim();
113
+ if (trimmed.toUpperCase() === "Z")
114
+ return 0;
115
+ const directMatch = /^([+-])(\d{2}):(\d{2})$/.exec(trimmed);
116
+ const suffixMatch = /([zZ]|[+-]\d{2}:\d{2})$/.exec(trimmed);
117
+ const target = directMatch ? trimmed : suffixMatch == null ? void 0 : suffixMatch[1];
118
+ if (!target)
119
+ return null;
120
+ if (target.toUpperCase() === "Z")
121
+ return 0;
122
+ const match = /^([+-])(\d{2}):(\d{2})$/.exec(target);
123
+ if (!match)
124
+ return null;
125
+ const minutes = Number(match[2]) * 60 + Number(match[3]);
126
+ return match[1] === "-" ? -minutes : minutes;
127
+ }
128
+ function captureRuntimeOffsetMinutes(value = /* @__PURE__ */ new Date()) {
129
+ return -value.getTimezoneOffset();
130
+ }
131
+ function formatFixedOffset(offsetMinutes) {
132
+ if (offsetMinutes === null || offsetMinutes === void 0)
133
+ return "";
134
+ if (!Number.isFinite(offsetMinutes)) {
135
+ throw new Error("Invalid fixed offset");
136
+ }
137
+ const normalized = Math.trunc(offsetMinutes);
138
+ if (normalized === 0)
139
+ return "Z";
140
+ const sign = normalized >= 0 ? "+" : "-";
141
+ const absolute = Math.abs(normalized);
142
+ return `${sign}${pad(Math.floor(absolute / 60))}:${pad(absolute % 60)}`;
143
+ }
144
+ function localDateTimeToScalar(value) {
145
+ assertDateParts(value);
146
+ assertTimeParts(value);
147
+ return Date.UTC(value.year, value.month - 1, value.day, value.hour, value.minute, value.second, 0);
148
+ }
149
+ function localDateToScalar(value) {
150
+ return Date.UTC(
151
+ value.getFullYear(),
152
+ value.getMonth(),
153
+ value.getDate(),
154
+ value.getHours(),
155
+ value.getMinutes(),
156
+ value.getSeconds(),
157
+ 0
158
+ );
159
+ }
160
+ function localDateToScalarStart(value) {
161
+ const parts = localDateInputToParts(value);
162
+ return Date.UTC(parts.year, parts.month - 1, parts.day, 0, 0, 0, 0);
163
+ }
164
+ function scalarToLocalDateParts(value) {
165
+ const date = scalarToDate(value);
166
+ return {
167
+ year: date.getUTCFullYear(),
168
+ month: date.getUTCMonth() + 1,
169
+ day: date.getUTCDate()
170
+ };
171
+ }
172
+ function scalarToLocalDateTimeParts(value) {
173
+ const date = scalarToDate(value);
174
+ return {
175
+ year: date.getUTCFullYear(),
176
+ month: date.getUTCMonth() + 1,
177
+ day: date.getUTCDate(),
178
+ hour: date.getUTCHours(),
179
+ minute: date.getUTCMinutes(),
180
+ second: date.getUTCSeconds()
181
+ };
182
+ }
183
+ function dateOrdinalFromLocalDate(value) {
184
+ const parts = localDateInputToParts(value);
185
+ return Math.floor(Date.UTC(parts.year, parts.month - 1, parts.day) / (24 * HOUR_MS));
186
+ }
187
+ function weekdayFromLocalDate(value) {
188
+ const parts = localDateInputToParts(value);
189
+ return new Date(Date.UTC(parts.year, parts.month - 1, parts.day)).getUTCDay();
190
+ }
191
+ function formatLocalDate(value) {
192
+ const parts = typeof value === "number" ? scalarToLocalDateParts(value) : localDateInputToParts(value);
193
+ return `${pad(parts.year, 4)}-${pad(parts.month)}-${pad(parts.day)}`;
194
+ }
195
+ function formatLocalTime(value, includeSeconds = true) {
196
+ const parts = typeof value === "number" ? scalarToLocalDateTimeParts(value) : typeof value === "string" ? parseLocalDateTime(value) : value;
197
+ assertTimeParts(parts);
198
+ if (!includeSeconds) {
199
+ return `${pad(parts.hour)}:${pad(parts.minute)}`;
200
+ }
201
+ return `${pad(parts.hour)}:${pad(parts.minute)}:${pad(parts.second)}`;
202
+ }
203
+ function formatLocalDateTime(value, fixedOffsetMinutes) {
204
+ const parts = typeof value === "number" ? scalarToLocalDateTimeParts(value) : typeof value === "string" ? parseLocalDateTime(value) : value;
205
+ assertDateParts(parts);
206
+ assertTimeParts(parts);
207
+ return `${formatLocalDate(parts)}T${formatLocalTime(parts)}${formatFixedOffset(fixedOffsetMinutes)}`;
208
+ }
209
+ function addLocalMinutes(value, minutes) {
210
+ if (!Number.isFinite(minutes)) {
211
+ throw new Error("Invalid minute delta");
212
+ }
213
+ return value + Math.trunc(minutes) * MINUTE_MS;
214
+ }
215
+ function addLocalHours(value, hours) {
216
+ if (!Number.isFinite(hours)) {
217
+ throw new Error("Invalid hour delta");
218
+ }
219
+ return value + Math.trunc(hours) * HOUR_MS;
220
+ }
221
+ function addLocalCalendarDays(value, days) {
222
+ if (!Number.isFinite(days)) {
223
+ throw new Error("Invalid day delta");
224
+ }
225
+ const parts = scalarToLocalDateTimeParts(value);
226
+ return Date.UTC(
227
+ parts.year,
228
+ parts.month - 1,
229
+ parts.day + Math.trunc(days),
230
+ parts.hour,
231
+ parts.minute,
232
+ parts.second,
233
+ 0
234
+ );
235
+ }
236
+ function nextDate(value) {
237
+ return formatLocalDate(addLocalCalendarDays(localDateToScalarStart(value), 1));
238
+ }
239
+ function ceilLocalScalarToTenMinutes(value) {
240
+ const parts = scalarToLocalDateTimeParts(value);
241
+ const minuteRemainder = parts.minute % 10;
242
+ if (minuteRemainder === 0 && parts.second === 0)
243
+ return value;
244
+ const deltaMinutes = parts.second === 0 ? 10 - minuteRemainder : minuteRemainder === 0 ? 10 : 10 - minuteRemainder;
245
+ const roundedBase = Date.UTC(parts.year, parts.month - 1, parts.day, parts.hour, parts.minute, 0, 0);
246
+ return addLocalMinutes(roundedBase, deltaMinutes);
247
+ }
248
+ // Annotate the CommonJS export names for ESM import in node:
249
+ 0 && (module.exports = {
250
+ addLocalCalendarDays,
251
+ addLocalHours,
252
+ addLocalMinutes,
253
+ captureRuntimeOffsetMinutes,
254
+ ceilLocalScalarToTenMinutes,
255
+ dateOrdinalFromLocalDate,
256
+ extractFixedOffsetMinutes,
257
+ formatFixedOffset,
258
+ formatLocalDate,
259
+ formatLocalDateTime,
260
+ formatLocalTime,
261
+ localDateTimeToScalar,
262
+ localDateToScalar,
263
+ localDateToScalarStart,
264
+ nextDate,
265
+ parseLocalDate,
266
+ parseLocalDateTime,
267
+ scalarToLocalDateParts,
268
+ scalarToLocalDateTimeParts,
269
+ weekdayFromLocalDate
270
+ });
@@ -1,14 +1,5 @@
1
- import type { ResourcePlannerAssignmentResult, ResourcePlannerAssignableSlotResult, ResourcePlannerAvailabilityCell, ResourcePlannerContextInput, ResourcePlannerDemandInterval, ResourcePlannerProduct, ResourcePlannerProjection, ResourcePlannerQuery, ResourcePlannerResource, ResourcePlannerSelection, ResourcePlannerValidationResult } from './types';
2
- export declare const DEFAULT_RESOURCE_PLANNER_CONTEXT: Required<ResourcePlannerContextInput>;
3
- export declare const DEFAULT_RESOURCE_PLANNER_SELECTION: ResourcePlannerSelection;
4
- export declare function normalizePlannerContext(input?: ResourcePlannerContextInput): Required<ResourcePlannerContextInput>;
5
- export declare function buildDemandIntervals(products: ResourcePlannerProduct[], query: ResourcePlannerQuery, context?: Required<ResourcePlannerContextInput>): ResourcePlannerDemandInterval[];
6
- export declare function evaluateResourceForInterval(params: {
7
- resource: ResourcePlannerResource;
8
- interval: ResourcePlannerDemandInterval;
9
- context: Required<ResourcePlannerContextInput>;
10
- }): ResourcePlannerAvailabilityCell;
11
- export declare function queryPlannerAvailability(contextInput: ResourcePlannerContextInput, query?: ResourcePlannerQuery): ResourcePlannerProjection;
12
- export declare function resolveAssignableSlots(contextInput: ResourcePlannerContextInput, query?: ResourcePlannerQuery): ResourcePlannerAssignableSlotResult;
13
- export declare function autoAssignResources(contextInput: ResourcePlannerContextInput, query?: ResourcePlannerQuery): ResourcePlannerAssignmentResult;
14
- export declare function validateAssignments(contextInput: ResourcePlannerContextInput, selection: ResourcePlannerSelection): ResourcePlannerValidationResult;
1
+ import type { AvailabilityProjection, AvailabilityProjectionInput, AvailabilityQuery, AvailabilityQueryResult, AvailabilitySelectionValidationParams, AvailabilitySelectionValidationResult, GetProductTimeRangesRequest, ProductTimeRangeGroup } from './types';
2
+ export declare function createAvailabilityProjection(input: AvailabilityProjectionInput): AvailabilityProjection;
3
+ export declare function getProductTimeRanges(projection: AvailabilityProjection, request?: GetProductTimeRangesRequest): ProductTimeRangeGroup[];
4
+ export declare function queryAvailabilityProjection(projection: AvailabilityProjection, request: AvailabilityQuery): AvailabilityQueryResult;
5
+ export declare function validateAvailabilitySelection(projection: AvailabilityProjection, params: AvailabilitySelectionValidationParams): AvailabilitySelectionValidationResult;