@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.
- package/dist/core/index.d.ts +7 -0
- package/dist/core/index.js +109 -65
- package/dist/modules/OpenData/types.d.ts +1 -0
- package/dist/modules/Order/index.d.ts +1 -1
- package/dist/modules/Order/utils.js +6 -1
- package/dist/modules/Quotation/index.d.ts +6 -0
- package/dist/modules/Quotation/index.js +75 -19
- package/dist/modules/ResourcePlanner/index.d.ts +0 -22
- package/dist/modules/ResourcePlanner/index.js +1 -180
- package/dist/modules/ResourcePlanner/localClock.d.ts +33 -0
- package/dist/modules/ResourcePlanner/localClock.js +183 -0
- package/dist/modules/ResourcePlanner/planner.d.ts +5 -14
- package/dist/modules/ResourcePlanner/planner.js +2019 -936
- package/dist/modules/ResourcePlanner/types.d.ts +346 -187
- package/dist/modules/ResourcePlanner/types.js +33 -1
- package/dist/plugins/request.d.ts +1 -0
- package/dist/server/index.d.ts +8 -2
- package/dist/server/index.js +206 -140
- package/dist/server/modules/floor-plan/index.d.ts +4 -0
- package/dist/server/modules/floor-plan/index.js +240 -98
- package/dist/server/modules/menu/index.js +48 -23
- package/dist/server/modules/order/index.d.ts +17 -7
- package/dist/server/modules/order/index.js +419 -207
- package/dist/server/modules/products/index.d.ts +8 -2
- package/dist/server/modules/products/index.js +167 -75
- package/dist/server/modules/resource/index.js +21 -13
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.js +4 -2
- package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +2 -1
- package/dist/solution/BookingTicket/utils/addProductDecision.js +3 -2
- package/dist/solution/UnifiedBookingSales/index.d.ts +110 -73
- package/dist/solution/UnifiedBookingSales/index.js +3349 -971
- package/dist/solution/UnifiedBookingSales/remoteOccupancyCache.d.ts +49 -0
- package/dist/solution/UnifiedBookingSales/remoteOccupancyCache.js +430 -0
- package/dist/solution/UnifiedBookingSales/types.d.ts +133 -76
- package/dist/solution/UnifiedBookingSales/types.js +4 -9
- package/lib/core/index.d.ts +7 -0
- package/lib/core/index.js +20 -2
- package/lib/model/strategy/adapter/promotion/index.js +0 -51
- package/lib/modules/OpenData/types.d.ts +1 -0
- package/lib/modules/Order/index.d.ts +1 -1
- package/lib/modules/Order/utils.js +5 -1
- package/lib/modules/Quotation/index.d.ts +6 -0
- package/lib/modules/Quotation/index.js +49 -5
- package/lib/modules/ResourcePlanner/index.d.ts +0 -22
- package/lib/modules/ResourcePlanner/index.js +0 -123
- package/lib/modules/ResourcePlanner/localClock.d.ts +33 -0
- package/lib/modules/ResourcePlanner/localClock.js +270 -0
- package/lib/modules/ResourcePlanner/planner.d.ts +5 -14
- package/lib/modules/ResourcePlanner/planner.js +1903 -798
- package/lib/modules/ResourcePlanner/types.d.ts +346 -187
- package/lib/modules/ResourcePlanner/types.js +19 -0
- package/lib/plugins/request.d.ts +1 -0
- package/lib/server/index.d.ts +8 -2
- package/lib/server/index.js +52 -17
- package/lib/server/modules/floor-plan/index.d.ts +4 -0
- package/lib/server/modules/floor-plan/index.js +54 -6
- package/lib/server/modules/menu/index.js +31 -5
- package/lib/server/modules/order/index.d.ts +17 -7
- package/lib/server/modules/order/index.js +197 -40
- package/lib/server/modules/products/index.d.ts +8 -2
- package/lib/server/modules/products/index.js +97 -24
- package/lib/server/modules/resource/index.js +7 -2
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.js +2 -1
- package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +2 -1
- package/lib/solution/BookingTicket/utils/addProductDecision.js +2 -0
- package/lib/solution/UnifiedBookingSales/index.d.ts +110 -73
- package/lib/solution/UnifiedBookingSales/index.js +2289 -374
- package/lib/solution/UnifiedBookingSales/remoteOccupancyCache.d.ts +49 -0
- package/lib/solution/UnifiedBookingSales/remoteOccupancyCache.js +376 -0
- package/lib/solution/UnifiedBookingSales/types.d.ts +133 -76
- package/lib/solution/UnifiedBookingSales/types.js +3 -2
- package/package.json +1 -1
|
@@ -1,227 +1,386 @@
|
|
|
1
|
-
export type
|
|
2
|
-
export type
|
|
3
|
-
export type
|
|
4
|
-
export type
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
resource_id?: number | string;
|
|
12
|
-
pax?: number;
|
|
13
|
-
product_uid?: string;
|
|
14
|
-
source?: 'remote' | 'cart' | 'selection';
|
|
15
|
-
[key: string]: any;
|
|
1
|
+
export type AvailabilityId = number | string;
|
|
2
|
+
export type AvailabilityMode = 'appointment' | 'scan_order' | 'venue_grid';
|
|
3
|
+
export type AvailabilityProductKind = 'normal' | 'duration' | 'session' | 'venue_slot';
|
|
4
|
+
export type AvailabilityResourceType = 'single' | 'multiple' | 'capacity';
|
|
5
|
+
export type AvailabilityStatus = 'available' | 'limited' | 'full' | 'conflict' | 'unavailable' | 'past';
|
|
6
|
+
export type AvailabilityScheduleMode = 'daily' | 'weekly' | 'designation';
|
|
7
|
+
export type AvailabilityErrorCode = 'MISSING_ANCHOR' | 'MISSING_CATALOG_SCOPE' | 'AVAILABILITY_CONTEXT_NOT_FOUND' | 'AVAILABILITY_SELECTION_STALE' | 'AVAILABILITY_COMMIT_IN_PROGRESS' | 'OPERATING_HOURS_RESOLVE_FAILED' | 'INVALID_DATE_RANGE' | 'RANGE_TOO_LARGE' | 'OUT_OF_PROJECTION_COVERAGE' | 'STALE_PROJECTION' | 'INVALID_TARGET_FILTER' | 'MISSING_TIME_CANDIDATES' | 'MISSING_SELECTED_RANGE' | 'PRODUCT_LINE_NOT_FOUND' | 'SELF_EXCLUSION_RESOLVE_FAILED' | 'INVALID_RESERVATION_QUANTITY' | 'REVALIDATION_FAILED';
|
|
8
|
+
export interface AvailabilityAbsoluteRange {
|
|
9
|
+
startAt: string;
|
|
10
|
+
endAt: string;
|
|
16
11
|
}
|
|
17
|
-
export interface
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
12
|
+
export interface AvailabilityDisplayRange extends AvailabilityAbsoluteRange {
|
|
13
|
+
date: string;
|
|
14
|
+
startTime: string;
|
|
15
|
+
endTime: string;
|
|
16
|
+
timezone: string;
|
|
17
|
+
}
|
|
18
|
+
export interface AvailabilityDateRange {
|
|
19
|
+
startDate: string;
|
|
20
|
+
endDate: string;
|
|
21
|
+
}
|
|
22
|
+
export interface AvailabilityScheduleRef {
|
|
23
|
+
scheduleId?: AvailabilityId;
|
|
24
|
+
timeSlotId?: AvailabilityId;
|
|
25
|
+
ruleId?: string;
|
|
26
|
+
source?: string;
|
|
27
|
+
label?: string;
|
|
28
|
+
}
|
|
29
|
+
export interface AvailabilityScheduleRule {
|
|
30
|
+
id: string;
|
|
31
|
+
mode: AvailabilityScheduleMode;
|
|
32
|
+
startTime: string;
|
|
33
|
+
endTime: string;
|
|
34
|
+
startDate?: string;
|
|
35
|
+
endDate?: string;
|
|
36
|
+
frequency?: number;
|
|
37
|
+
weekdays?: number[];
|
|
38
|
+
dates?: string[];
|
|
39
|
+
includeDates?: string[];
|
|
40
|
+
excludeDates?: string[];
|
|
41
|
+
scheduleRef?: AvailabilityScheduleRef;
|
|
42
|
+
}
|
|
43
|
+
export interface AvailabilitySessionRange extends AvailabilityAbsoluteRange {
|
|
44
|
+
scheduleRefs?: AvailabilityScheduleRef[];
|
|
45
|
+
}
|
|
46
|
+
export interface AvailabilityRequirementGroup {
|
|
47
|
+
id: string;
|
|
48
|
+
formId?: AvailabilityId;
|
|
49
|
+
title?: string;
|
|
50
|
+
code?: string;
|
|
51
|
+
resourceType: AvailabilityResourceType;
|
|
22
52
|
required?: boolean;
|
|
53
|
+
min?: number;
|
|
54
|
+
max?: number;
|
|
55
|
+
resourceIds?: AvailabilityId[];
|
|
56
|
+
capacityRequired?: number;
|
|
57
|
+
raw?: Record<string, any>;
|
|
23
58
|
}
|
|
24
|
-
export
|
|
25
|
-
|
|
59
|
+
export type AvailabilityCutOffPolicy = {
|
|
60
|
+
type: 'ongoing';
|
|
61
|
+
mode: 'before_end';
|
|
62
|
+
futureDay?: number;
|
|
63
|
+
} | {
|
|
64
|
+
type: 'ongoing';
|
|
65
|
+
mode: 'after_start';
|
|
66
|
+
graceMinutes: number;
|
|
67
|
+
futureDay?: number;
|
|
68
|
+
} | {
|
|
69
|
+
type: 'before_start';
|
|
70
|
+
futureDay?: number;
|
|
71
|
+
} | {
|
|
72
|
+
type: 'advance';
|
|
73
|
+
unit: number;
|
|
74
|
+
unitType: 'days' | 'hours' | 'minutes';
|
|
75
|
+
futureDay?: number;
|
|
76
|
+
} | {
|
|
77
|
+
type: 'invalid';
|
|
78
|
+
reason: string;
|
|
79
|
+
};
|
|
80
|
+
export interface AvailabilityProduct {
|
|
81
|
+
id: AvailabilityId;
|
|
26
82
|
title?: string;
|
|
27
|
-
kind:
|
|
83
|
+
kind: AvailabilityProductKind;
|
|
28
84
|
durationMinutes?: number;
|
|
29
|
-
schedule?: ResourcePlannerTimeRange[];
|
|
30
|
-
resourceRequirements?: ResourcePlannerResourceRequirement[];
|
|
31
|
-
capacityRequired?: number;
|
|
32
85
|
quantity?: number;
|
|
33
|
-
|
|
86
|
+
capacityRequired?: number;
|
|
87
|
+
cutOffPolicy?: AvailabilityCutOffPolicy;
|
|
88
|
+
requirementGroups?: AvailabilityRequirementGroup[];
|
|
89
|
+
sessionRules?: AvailabilityScheduleRule[];
|
|
90
|
+
sessionRanges?: AvailabilitySessionRange[];
|
|
91
|
+
raw?: Record<string, any>;
|
|
92
|
+
}
|
|
93
|
+
export interface AvailabilityResourceWindow extends AvailabilityAbsoluteRange {
|
|
94
|
+
source?: string;
|
|
34
95
|
raw?: Record<string, any>;
|
|
35
96
|
}
|
|
36
|
-
export
|
|
37
|
-
|
|
38
|
-
|
|
97
|
+
export type AvailabilityOperatingHoursSource = 'prepare_business_hours' | 'open_data_schedule' | 'default_business_hours';
|
|
98
|
+
export interface AvailabilityOperatingHoursSnapshot {
|
|
99
|
+
source: AvailabilityOperatingHoursSource;
|
|
100
|
+
scheduleIds: AvailabilityId[];
|
|
101
|
+
missingScheduleIds: AvailabilityId[];
|
|
102
|
+
windows: AvailabilityResourceWindow[];
|
|
103
|
+
}
|
|
104
|
+
export interface AvailabilityResource {
|
|
105
|
+
id: AvailabilityId;
|
|
106
|
+
formId?: AvailabilityId;
|
|
39
107
|
name?: string;
|
|
40
|
-
|
|
108
|
+
code?: string;
|
|
109
|
+
resourceType: AvailabilityResourceType;
|
|
41
110
|
capacity: number;
|
|
42
|
-
|
|
43
|
-
event_list?: ResourcePlannerEvent[];
|
|
44
|
-
[key: string]: any;
|
|
45
|
-
}>;
|
|
46
|
-
childResourceIds?: Array<number | string>;
|
|
111
|
+
windows: AvailabilityResourceWindow[];
|
|
47
112
|
raw?: Record<string, any>;
|
|
48
113
|
}
|
|
49
|
-
export interface
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
externalEvents?: ResourcePlannerEvent[];
|
|
53
|
-
slotDurationMinutes?: number;
|
|
54
|
-
businessStartTime?: string;
|
|
55
|
-
businessEndTime?: string;
|
|
56
|
-
}
|
|
57
|
-
export interface ResourcePlannerQuery {
|
|
58
|
-
mode?: ResourcePlannerMode;
|
|
59
|
-
productIds?: Array<number | string>;
|
|
60
|
-
date?: string;
|
|
61
|
-
dateRange?: {
|
|
62
|
-
start: string;
|
|
63
|
-
end: string;
|
|
64
|
-
};
|
|
65
|
-
startTime?: string;
|
|
66
|
-
endTime?: string;
|
|
67
|
-
resourceIds?: Array<number | string>;
|
|
68
|
-
serviceObjectIds?: Array<number | string>;
|
|
69
|
-
holderIds?: Array<number | string>;
|
|
114
|
+
export interface AvailabilityOccupancy extends AvailabilityAbsoluteRange {
|
|
115
|
+
id?: string;
|
|
116
|
+
resourceId: AvailabilityId;
|
|
70
117
|
pax?: number;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
endTime?: string;
|
|
78
|
-
resourceIds: Array<number | string>;
|
|
79
|
-
assignments: ResourcePlannerAssignment[];
|
|
80
|
-
mode?: ResourcePlannerMode;
|
|
118
|
+
source?: 'remote' | 'cart' | 'selection';
|
|
119
|
+
serverEventId?: AvailabilityId;
|
|
120
|
+
bookingUid?: AvailabilityId;
|
|
121
|
+
productUid?: AvailabilityId;
|
|
122
|
+
scheduleEventId?: AvailabilityId;
|
|
123
|
+
raw?: Record<string, any>;
|
|
81
124
|
}
|
|
82
|
-
export interface
|
|
83
|
-
|
|
125
|
+
export interface AvailabilityProjectionMeta {
|
|
126
|
+
readonly snapshotId: string;
|
|
127
|
+
readonly preparedAt: string;
|
|
128
|
+
readonly timezone: string;
|
|
129
|
+
readonly orderRevision?: AvailabilityId;
|
|
130
|
+
readonly mode: AvailabilityMode;
|
|
131
|
+
readonly coverage: Readonly<AvailabilityDateRange & AvailabilityAbsoluteRange>;
|
|
132
|
+
readonly defaults: {
|
|
133
|
+
readonly slotStepMinutes: number;
|
|
134
|
+
readonly businessHours: {
|
|
135
|
+
readonly startTime: string;
|
|
136
|
+
readonly endTime: string;
|
|
137
|
+
};
|
|
138
|
+
readonly operatingHours: Readonly<AvailabilityOperatingHoursSnapshot>;
|
|
139
|
+
};
|
|
140
|
+
readonly now: string;
|
|
141
|
+
readonly durationCandidateAnchorAt: string;
|
|
142
|
+
readonly prepareParams?: Readonly<Record<string, any>>;
|
|
143
|
+
readonly anchors?: {
|
|
144
|
+
readonly productIds?: readonly AvailabilityId[];
|
|
145
|
+
readonly resourceIds?: readonly AvailabilityId[];
|
|
146
|
+
readonly dateRange?: Readonly<AvailabilityDateRange>;
|
|
147
|
+
};
|
|
84
148
|
}
|
|
85
|
-
export interface
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
149
|
+
export interface AvailabilityProjectionInput {
|
|
150
|
+
products: AvailabilityProduct[];
|
|
151
|
+
resources: AvailabilityResource[];
|
|
152
|
+
resourceOccupancies?: AvailabilityOccupancy[];
|
|
153
|
+
mode?: AvailabilityMode;
|
|
154
|
+
timezone: string;
|
|
155
|
+
coverage: AvailabilityDateRange;
|
|
156
|
+
slotStepMinutes?: number;
|
|
157
|
+
businessHours?: {
|
|
158
|
+
startTime: string;
|
|
159
|
+
endTime: string;
|
|
160
|
+
};
|
|
161
|
+
operatingHours?: AvailabilityOperatingHoursSnapshot;
|
|
162
|
+
snapshotId?: string;
|
|
163
|
+
preparedAt?: string;
|
|
164
|
+
now?: string;
|
|
165
|
+
durationCandidateAnchorAt?: string;
|
|
166
|
+
orderRevision?: AvailabilityId;
|
|
167
|
+
anchors?: AvailabilityProjectionMeta['anchors'];
|
|
168
|
+
prepareParams?: Record<string, any>;
|
|
103
169
|
}
|
|
104
|
-
export interface
|
|
170
|
+
export interface AvailabilityCell extends AvailabilityDisplayRange {
|
|
105
171
|
key: string;
|
|
106
|
-
productId:
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
durationMinutes?: number;
|
|
114
|
-
cellType: 'availability_range' | 'fixed_interval' | 'unavailable';
|
|
115
|
-
status: ResourcePlannerStatus;
|
|
172
|
+
productId: AvailabilityId;
|
|
173
|
+
requirementGroupId?: string;
|
|
174
|
+
requirementFormId?: AvailabilityId;
|
|
175
|
+
resourceId?: AvailabilityId;
|
|
176
|
+
resourceName?: string;
|
|
177
|
+
resourceType?: AvailabilityResourceType;
|
|
178
|
+
status: AvailabilityStatus;
|
|
116
179
|
remainingCapacity?: number;
|
|
117
180
|
maxCapacity?: number;
|
|
118
181
|
reasonCodes: string[];
|
|
119
|
-
|
|
182
|
+
occupancyRefs: Array<{
|
|
183
|
+
id?: string;
|
|
184
|
+
resourceId: AvailabilityId;
|
|
185
|
+
source?: AvailabilityOccupancy['source'];
|
|
186
|
+
serverEventId?: AvailabilityId;
|
|
187
|
+
bookingUid?: AvailabilityId;
|
|
188
|
+
productUid?: AvailabilityId;
|
|
189
|
+
scheduleEventId?: AvailabilityId;
|
|
190
|
+
}>;
|
|
191
|
+
}
|
|
192
|
+
export interface AvailabilityProjection {
|
|
193
|
+
readonly meta: AvailabilityProjectionMeta;
|
|
194
|
+
readonly products: readonly AvailabilityProduct[];
|
|
195
|
+
readonly resources: readonly AvailabilityResource[];
|
|
196
|
+
readonly resourceOccupancies: readonly AvailabilityOccupancy[];
|
|
197
|
+
readonly cells: readonly AvailabilityCell[];
|
|
120
198
|
}
|
|
121
|
-
export interface
|
|
122
|
-
|
|
199
|
+
export interface ProductTimeRange extends AvailabilityDisplayRange {
|
|
200
|
+
key: string;
|
|
201
|
+
productId: AvailabilityId;
|
|
202
|
+
source: 'session_schedule' | 'duration_window';
|
|
203
|
+
/** Actual interval start used by availability evaluation, assignments, and cart booking. */
|
|
204
|
+
bookingStartAt: string;
|
|
205
|
+
/** Actual interval end kept explicitly for availability evaluation and cart compatibility. */
|
|
206
|
+
bookingEndAt: string;
|
|
207
|
+
scheduleRefs: AvailabilityScheduleRef[];
|
|
208
|
+
primaryScheduleRef?: AvailabilityScheduleRef;
|
|
209
|
+
}
|
|
210
|
+
export interface ProductTimeRangeGroup {
|
|
211
|
+
productId: AvailabilityId;
|
|
123
212
|
title?: string;
|
|
124
|
-
|
|
125
|
-
|
|
213
|
+
kind: AvailabilityProductKind;
|
|
214
|
+
ranges: ProductTimeRange[];
|
|
215
|
+
}
|
|
216
|
+
export interface AvailabilityAssignment extends AvailabilityAbsoluteRange {
|
|
217
|
+
productId: AvailabilityId;
|
|
218
|
+
resourceId: AvailabilityId;
|
|
219
|
+
formId?: AvailabilityId;
|
|
220
|
+
capacityRequired?: number;
|
|
221
|
+
scheduleId?: AvailabilityId;
|
|
222
|
+
timeSlotId?: AvailabilityId;
|
|
126
223
|
}
|
|
127
|
-
export interface
|
|
128
|
-
|
|
224
|
+
export interface AvailabilityRequirementSelection {
|
|
225
|
+
requirementGroupId?: string;
|
|
226
|
+
formId?: AvailabilityId;
|
|
227
|
+
resourceIds: AvailabilityId[];
|
|
228
|
+
}
|
|
229
|
+
export interface GetProductTimeRangesRequest {
|
|
230
|
+
productIds?: AvailabilityId[];
|
|
231
|
+
dateRange?: Partial<AvailabilityDateRange>;
|
|
232
|
+
resourceIds?: AvailabilityId[];
|
|
233
|
+
partySize?: number;
|
|
234
|
+
}
|
|
235
|
+
export interface QueryAvailabilityBaseRequest {
|
|
236
|
+
productIds?: AvailabilityId[];
|
|
237
|
+
resourceIds?: AvailabilityId[];
|
|
238
|
+
partySize?: number;
|
|
239
|
+
}
|
|
240
|
+
export interface ProductAvailabilityQuery extends QueryAvailabilityBaseRequest {
|
|
241
|
+
target: 'product';
|
|
242
|
+
dateRange?: Partial<AvailabilityDateRange>;
|
|
243
|
+
}
|
|
244
|
+
export interface DateAvailabilityQuery extends QueryAvailabilityBaseRequest {
|
|
245
|
+
target: 'date';
|
|
246
|
+
dateRange?: Partial<AvailabilityDateRange>;
|
|
247
|
+
}
|
|
248
|
+
export interface TimeAvailabilityQuery extends QueryAvailabilityBaseRequest {
|
|
249
|
+
target: 'time';
|
|
250
|
+
candidates: ProductTimeRange[];
|
|
251
|
+
}
|
|
252
|
+
export interface ResourceAvailabilityQuery extends QueryAvailabilityBaseRequest {
|
|
253
|
+
target: 'resource';
|
|
254
|
+
selectedRanges: ProductTimeRange[];
|
|
255
|
+
}
|
|
256
|
+
export type AvailabilityQuery = ProductAvailabilityQuery | DateAvailabilityQuery | TimeAvailabilityQuery | ResourceAvailabilityQuery;
|
|
257
|
+
export interface AvailabilityResourceOption {
|
|
258
|
+
resourceId: AvailabilityId;
|
|
129
259
|
resourceName?: string;
|
|
130
|
-
resourceFormId?:
|
|
131
|
-
resourceType:
|
|
132
|
-
status:
|
|
260
|
+
resourceFormId?: AvailabilityId;
|
|
261
|
+
resourceType: AvailabilityResourceType;
|
|
262
|
+
status: AvailabilityStatus;
|
|
263
|
+
remainingCapacity?: number;
|
|
264
|
+
maxCapacity?: number;
|
|
265
|
+
maxPartySize: number;
|
|
266
|
+
reasonCodes: string[];
|
|
267
|
+
}
|
|
268
|
+
export interface AvailabilityRequirementGroupResult {
|
|
269
|
+
groupId: string;
|
|
270
|
+
formId?: AvailabilityId;
|
|
271
|
+
title?: string;
|
|
272
|
+
code?: string;
|
|
273
|
+
resourceType: AvailabilityResourceType;
|
|
274
|
+
required: boolean;
|
|
275
|
+
min: number;
|
|
276
|
+
max: number;
|
|
277
|
+
status: AvailabilityStatus;
|
|
278
|
+
availableResourceCount: number;
|
|
279
|
+
totalResourceCount: number;
|
|
280
|
+
maxPartySize: number;
|
|
133
281
|
remainingCapacity?: number;
|
|
134
282
|
maxCapacity?: number;
|
|
135
283
|
reasonCodes: string[];
|
|
284
|
+
options: AvailabilityResourceOption[];
|
|
285
|
+
}
|
|
286
|
+
export interface TimeAvailabilityItem extends ProductTimeRange {
|
|
287
|
+
status: AvailabilityStatus;
|
|
288
|
+
maxPartySize: number;
|
|
289
|
+
reasonCodes: string[];
|
|
290
|
+
requirementGroups: AvailabilityRequirementGroupResult[];
|
|
291
|
+
}
|
|
292
|
+
export interface ProductAvailabilityItem {
|
|
293
|
+
productId: AvailabilityId;
|
|
294
|
+
title?: string;
|
|
295
|
+
status: AvailabilityStatus;
|
|
296
|
+
reasonCodes: string[];
|
|
297
|
+
availableDateCount: number;
|
|
298
|
+
totalDateCount: number;
|
|
299
|
+
availableTimeCount: number;
|
|
300
|
+
totalTimeCount: number;
|
|
301
|
+
maxPartySize: number;
|
|
136
302
|
}
|
|
137
|
-
export interface
|
|
303
|
+
export interface DateAvailabilityItem {
|
|
138
304
|
date: string;
|
|
139
|
-
status:
|
|
305
|
+
status: AvailabilityStatus;
|
|
140
306
|
availableCount: number;
|
|
141
307
|
totalCount: number;
|
|
308
|
+
maxPartySize: number;
|
|
309
|
+
remainingCapacity: number;
|
|
310
|
+
maxCapacity: number;
|
|
311
|
+
reasonCodes: string[];
|
|
142
312
|
}
|
|
143
|
-
export interface
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
313
|
+
export interface ProductAvailabilityGroup {
|
|
314
|
+
productId: AvailabilityId;
|
|
315
|
+
title?: string;
|
|
316
|
+
item: ProductAvailabilityItem;
|
|
317
|
+
}
|
|
318
|
+
export interface DateAvailabilityGroup {
|
|
319
|
+
productId: AvailabilityId;
|
|
320
|
+
title?: string;
|
|
321
|
+
dates: DateAvailabilityItem[];
|
|
322
|
+
}
|
|
323
|
+
export interface TimeAvailabilityGroup {
|
|
324
|
+
productId: AvailabilityId;
|
|
325
|
+
title?: string;
|
|
326
|
+
times: TimeAvailabilityItem[];
|
|
327
|
+
}
|
|
328
|
+
export interface ResourceAvailabilityRangeGroup {
|
|
329
|
+
range: ProductTimeRange;
|
|
330
|
+
status: AvailabilityStatus;
|
|
331
|
+
maxPartySize: number;
|
|
151
332
|
reasonCodes: string[];
|
|
333
|
+
requirementGroups: AvailabilityRequirementGroupResult[];
|
|
152
334
|
}
|
|
153
|
-
export interface
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
slots: ResourcePlannerTimeSlot[];
|
|
158
|
-
}
|
|
159
|
-
export interface ResourcePlannerTimeGrid {
|
|
160
|
-
date?: string;
|
|
161
|
-
timeLabels: string[];
|
|
162
|
-
resources: ResourcePlannerTimeGridRow[];
|
|
163
|
-
}
|
|
164
|
-
export interface ResourcePlannerProjection {
|
|
165
|
-
query: ResourcePlannerQuery;
|
|
166
|
-
demandIntervals: ResourcePlannerDemandInterval[];
|
|
167
|
-
productOptions: ResourcePlannerProductOption[];
|
|
168
|
-
resourceOptions: ResourcePlannerResourceOption[];
|
|
169
|
-
dateSummary: ResourcePlannerDateSummary[];
|
|
170
|
-
timeGrid: ResourcePlannerTimeGrid;
|
|
171
|
-
cells: ResourcePlannerAvailabilityCell[];
|
|
172
|
-
}
|
|
173
|
-
export interface ResourcePlannerAssignment {
|
|
174
|
-
productId: number | string;
|
|
175
|
-
resourceId: number | string;
|
|
176
|
-
start_at: string;
|
|
177
|
-
end_at: string;
|
|
178
|
-
capacityRequired?: number;
|
|
335
|
+
export interface ResourceAvailabilityGroup {
|
|
336
|
+
productId: AvailabilityId;
|
|
337
|
+
title?: string;
|
|
338
|
+
ranges: ResourceAvailabilityRangeGroup[];
|
|
179
339
|
}
|
|
180
|
-
export interface
|
|
181
|
-
|
|
340
|
+
export interface AvailabilityQueryResultBase<TTarget extends AvailabilityQuery['target'], TData> {
|
|
341
|
+
target: TTarget;
|
|
342
|
+
evaluatedAt: string;
|
|
343
|
+
snapshotId: string;
|
|
344
|
+
data: TData;
|
|
345
|
+
}
|
|
346
|
+
export type ProductAvailabilityQueryResult = AvailabilityQueryResultBase<'product', ProductAvailabilityGroup[]>;
|
|
347
|
+
export type DateAvailabilityQueryResult = AvailabilityQueryResultBase<'date', DateAvailabilityGroup[]>;
|
|
348
|
+
export type TimeAvailabilityQueryResult = AvailabilityQueryResultBase<'time', TimeAvailabilityGroup[]>;
|
|
349
|
+
export type ResourceAvailabilityQueryResult = AvailabilityQueryResultBase<'resource', ResourceAvailabilityGroup[]>;
|
|
350
|
+
export type AvailabilityQueryResult = ProductAvailabilityQueryResult | DateAvailabilityQueryResult | TimeAvailabilityQueryResult | ResourceAvailabilityQueryResult;
|
|
351
|
+
export interface AvailabilityValidationConflict {
|
|
352
|
+
code: string;
|
|
353
|
+
message: string;
|
|
354
|
+
reasonCodes?: string[];
|
|
355
|
+
productId?: AvailabilityId;
|
|
356
|
+
requirementGroupId?: string;
|
|
357
|
+
formId?: AvailabilityId;
|
|
358
|
+
resourceId?: AvailabilityId;
|
|
182
359
|
resourceName?: string;
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
360
|
+
candidateKey?: string;
|
|
361
|
+
requestedQuantity?: number;
|
|
362
|
+
availableQuantity?: number;
|
|
186
363
|
remainingCapacity?: number;
|
|
187
|
-
|
|
364
|
+
capacityPerBooking?: number;
|
|
188
365
|
}
|
|
189
|
-
export interface
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
endTime: string;
|
|
197
|
-
durationMinutes: number;
|
|
198
|
-
status: ResourcePlannerStatus;
|
|
199
|
-
resources: ResourcePlannerAssignableSlotResource[];
|
|
200
|
-
assignments: ResourcePlannerAssignment[];
|
|
201
|
-
conflicts: ResourcePlannerConflict[];
|
|
202
|
-
}
|
|
203
|
-
export interface ResourcePlannerAssignableSlotResult {
|
|
204
|
-
projection: ResourcePlannerProjection;
|
|
205
|
-
slots: ResourcePlannerAssignableSlot[];
|
|
206
|
-
conflicts: ResourcePlannerConflict[];
|
|
207
|
-
}
|
|
208
|
-
export interface ResourcePlannerAssignmentResult {
|
|
209
|
-
assignments: ResourcePlannerAssignment[];
|
|
210
|
-
conflicts: ResourcePlannerConflict[];
|
|
211
|
-
}
|
|
212
|
-
export interface ResourcePlannerValidationResult {
|
|
366
|
+
export interface AvailabilitySelectionValidationParams {
|
|
367
|
+
candidate: ProductTimeRange;
|
|
368
|
+
partySize?: number;
|
|
369
|
+
bookingCount?: number;
|
|
370
|
+
requirementSelections: AvailabilityRequirementSelection[];
|
|
371
|
+
}
|
|
372
|
+
export interface AvailabilitySelectionValidationResult {
|
|
213
373
|
ok: boolean;
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
}
|
|
222
|
-
export
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
version: number;
|
|
374
|
+
status: AvailabilityStatus;
|
|
375
|
+
assignments: AvailabilityAssignment[];
|
|
376
|
+
conflicts: AvailabilityValidationConflict[];
|
|
377
|
+
availability: TimeAvailabilityItem;
|
|
378
|
+
}
|
|
379
|
+
export interface AvailabilityErrorDetails {
|
|
380
|
+
[key: string]: any;
|
|
381
|
+
}
|
|
382
|
+
export declare class AvailabilityError extends Error {
|
|
383
|
+
code: AvailabilityErrorCode;
|
|
384
|
+
details?: AvailabilityErrorDetails;
|
|
385
|
+
constructor(code: AvailabilityErrorCode, message: string, details?: AvailabilityErrorDetails);
|
|
227
386
|
}
|
|
@@ -1 +1,33 @@
|
|
|
1
|
-
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
3
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
4
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
5
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
6
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
7
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
8
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
9
|
+
function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }
|
|
10
|
+
function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct.bind(); } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
|
|
11
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
12
|
+
function _isNativeFunction(fn) { try { return Function.toString.call(fn).indexOf("[native code]") !== -1; } catch (e) { return typeof fn === "function"; } }
|
|
13
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
14
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
15
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
16
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
17
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
18
|
+
export var AvailabilityError = /*#__PURE__*/function (_Error) {
|
|
19
|
+
_inherits(AvailabilityError, _Error);
|
|
20
|
+
var _super = _createSuper(AvailabilityError);
|
|
21
|
+
function AvailabilityError(code, message, details) {
|
|
22
|
+
var _this;
|
|
23
|
+
_classCallCheck(this, AvailabilityError);
|
|
24
|
+
_this = _super.call(this, message);
|
|
25
|
+
_defineProperty(_assertThisInitialized(_this), "code", void 0);
|
|
26
|
+
_defineProperty(_assertThisInitialized(_this), "details", void 0);
|
|
27
|
+
_this.name = 'AvailabilityError';
|
|
28
|
+
_this.code = code;
|
|
29
|
+
_this.details = details;
|
|
30
|
+
return _this;
|
|
31
|
+
}
|
|
32
|
+
return _createClass(AvailabilityError);
|
|
33
|
+
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
package/dist/server/index.d.ts
CHANGED
|
@@ -51,6 +51,8 @@ declare class Server {
|
|
|
51
51
|
private productQueryScheduleTimers;
|
|
52
52
|
/** 餐牌筛选为空时才触发的菜单/日程缓存自愈,避免每次商品查询都请求远端。 */
|
|
53
53
|
private menuScheduleRefreshInFlight;
|
|
54
|
+
/** 启动阶段模块预加载任务;预渲染商品查询复用该任务,避免缓存尚未 ready 时误触发远端自愈。 */
|
|
55
|
+
private startupModulePreloadInFlight;
|
|
54
56
|
private lastMenuScheduleRefreshAt;
|
|
55
57
|
private readonly MENU_SCHEDULE_REFRESH_COOLDOWN_MS;
|
|
56
58
|
private orderQuerySubscribers;
|
|
@@ -157,13 +159,17 @@ declare class Server {
|
|
|
157
159
|
* 重新拉取全量 SSE 接口,更新本地数据后触发 onProductsSyncCompleted
|
|
158
160
|
* 不影响当前界面展示,适用于切回前台、定时刷新等场景
|
|
159
161
|
*/
|
|
160
|
-
refreshProductsInBackground(
|
|
162
|
+
refreshProductsInBackground(options?: {
|
|
163
|
+
trigger?: string;
|
|
164
|
+
}): Promise<void>;
|
|
161
165
|
/**
|
|
162
166
|
* 后台静默刷新订单数据
|
|
163
167
|
* 重新拉取全量 SSE 接口,更新本地数据后触发 onOrdersSyncCompleted
|
|
164
168
|
* 不影响当前界面展示,适用于切回前台、定时刷新等场景
|
|
165
169
|
*/
|
|
166
|
-
refreshOrdersInBackground(
|
|
170
|
+
refreshOrdersInBackground(options?: {
|
|
171
|
+
trigger?: string;
|
|
172
|
+
}): Promise<void>;
|
|
167
173
|
/**
|
|
168
174
|
* 编辑正式订单时强制查询 Server 最新快照并覆盖本地缓存。
|
|
169
175
|
* 商品成员增删由 OrderModule 在 SQLite/Store 更新完成后广播,
|