@peabody-soft/mbs-model-ts 1.5.0 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Address.js +8 -11
- package/dist/Attachment.js +7 -8
- package/dist/AttachmentBaseUrl.js +10 -10
- package/dist/AuthTokens.js +12 -7
- package/dist/Business.js +19 -19
- package/dist/BusinessIdentifier.js +2 -2
- package/dist/BusinessLink.js +16 -16
- package/dist/BusinessProfile.js +4 -4
- package/dist/CartEditor.js +137 -166
- package/dist/Catalog.js +19 -25
- package/dist/Constants.js +10 -10
- package/dist/ContainerNames.js +10 -11
- package/dist/Entity.js +11 -9
- package/dist/Enums.js +2 -2
- package/dist/Exceptions.js +2 -2
- package/dist/GeneralSettings.js +23 -21
- package/dist/HttpStatusCodes.js +10 -11
- package/dist/Ids.js +24 -30
- package/dist/Item.js +6 -7
- package/dist/LatLong.js +3 -3
- package/dist/LiveData.js +6 -6
- package/dist/Measures.js +2 -2
- package/dist/Message.js +6 -6
- package/dist/MockDatabase.js +2 -2
- package/dist/Model.js +294 -365
- package/dist/Order.js +20 -17
- package/dist/Package.js +7 -8
- package/dist/PackageIdentifier.js +2 -2
- package/dist/PaymentMethodDetail.js +4 -4
- package/dist/Photo.js +6 -7
- package/dist/Price.js +8 -9
- package/dist/PriceList.js +2 -2
- package/dist/Product.js +17 -22
- package/dist/ProductCategory.js +3 -4
- package/dist/Profile.js +26 -27
- package/dist/ProtoMap.d.ts +3 -0
- package/dist/ProtoMap.js +288 -294
- package/dist/Routes.js +3 -3
- package/dist/ServiceExceptions.js +11 -12
- package/dist/ServiceProxy.js +19 -23
- package/dist/ShoppingList.js +112 -130
- package/dist/SyncCache.d.ts +3 -0
- package/dist/SyncCache.js +92 -75
- package/dist/SyncKeys.js +8 -8
- package/dist/SyncState.js +5 -5
- package/dist/Tax.js +16 -21
- package/dist/TaxHelper.js +22 -30
- package/dist/TaxType.js +8 -9
- package/dist/UserProfile.js +4 -4
- package/dist/WorkingDays.js +15 -15
- package/dist/index.js +9 -9
- package/package.json +1 -1
package/dist/WorkingDays.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Constants as proto_Constants } from "./generated/Constants";
|
|
2
2
|
import { InvalidArgumentException } from "./Exceptions";
|
|
3
3
|
// Days and hours a business works. Absence is the permissive value throughout: no WorkingDays
|
|
4
|
-
// means every day (ALL_DAYS)
|
|
5
|
-
//
|
|
6
|
-
//
|
|
4
|
+
// means every day (ALL_DAYS), and a day with no hours or ranges is worked all day.
|
|
5
|
+
// Hours are minutes after local midnight in timeZone, so a caller asking about a moment reads it
|
|
6
|
+
// in that zone first, as a day and a minute.
|
|
7
7
|
class WorkingDays {
|
|
8
8
|
constructor(_days, _timeZone, _workingHours) {
|
|
9
9
|
this._days = _days;
|
|
@@ -15,15 +15,15 @@ class WorkingDays {
|
|
|
15
15
|
get days() {
|
|
16
16
|
return this._days;
|
|
17
17
|
}
|
|
18
|
-
// The IANA ID of the zone the hours are in, for example "Asia/Kolkata"
|
|
19
|
-
// like "IST". Null when none was specified
|
|
20
|
-
// ALL_DAYS.
|
|
18
|
+
// The IANA ID of the zone the hours are in, for example "Asia/Kolkata", never an abbreviation
|
|
19
|
+
// like "IST". Null when none was specified (settings saved before the protocol carried one, and
|
|
20
|
+
// ALL_DAYS). The hours then cannot be placed on a clock, and only a caller that knows the
|
|
21
21
|
// business's zone can read a moment into them.
|
|
22
22
|
get timeZone() {
|
|
23
23
|
return this._timeZone;
|
|
24
24
|
}
|
|
25
|
-
// Indexed
|
|
26
|
-
//
|
|
25
|
+
// Indexed as days is. Shorter than days, or empty, is normal. See the class comment for what a
|
|
26
|
+
// missing entry means.
|
|
27
27
|
get workingHours() {
|
|
28
28
|
return this._workingHours;
|
|
29
29
|
}
|
|
@@ -37,8 +37,8 @@ class WorkingDays {
|
|
|
37
37
|
WorkingDays.checkDayOfWeek(dayOfWeek);
|
|
38
38
|
return this._days[dayOfWeek] === true;
|
|
39
39
|
}
|
|
40
|
-
// The hours of a day
|
|
41
|
-
//
|
|
40
|
+
// The hours of a worked day, or null when that day is worked all day or not at all. A UI showing
|
|
41
|
+
// opening times tests the day first, then treats null as all day.
|
|
42
42
|
getWorkingHours(dayOfWeek) {
|
|
43
43
|
WorkingDays.checkDayOfWeek(dayOfWeek);
|
|
44
44
|
if (dayOfWeek >= this._workingHours.length)
|
|
@@ -58,13 +58,13 @@ class WorkingDays {
|
|
|
58
58
|
// there is nothing for a zone to place, so it has none.
|
|
59
59
|
WorkingDays.ALL_DAYS = new WorkingDays(Object.freeze([true, true, true, true, true, true, true]), null, Object.freeze([]));
|
|
60
60
|
export default WorkingDays;
|
|
61
|
-
// The hours of a single day
|
|
61
|
+
// The worked hours of a single day, as ranges.
|
|
62
62
|
export class WorkingHours {
|
|
63
63
|
constructor(_ranges) {
|
|
64
64
|
this._ranges = _ranges;
|
|
65
65
|
}
|
|
66
|
-
// Ordered by openMinute,
|
|
67
|
-
//
|
|
66
|
+
// Ordered by openMinute, non-overlapping and non-touching: a range that closes when the next
|
|
67
|
+
// opens arrives as one unbroken range.
|
|
68
68
|
get ranges() {
|
|
69
69
|
return this._ranges;
|
|
70
70
|
}
|
|
@@ -108,8 +108,8 @@ export class WorkingHoursRange {
|
|
|
108
108
|
get openMinute() {
|
|
109
109
|
return this._openMinute;
|
|
110
110
|
}
|
|
111
|
-
// Not worked; MINUTES_PER_DAY means work stops at midnight. Always
|
|
112
|
-
// spans midnight, so overnight work is two ranges on two days.
|
|
111
|
+
// Not worked; MINUTES_PER_DAY means work stops at midnight. Always greater than openMinute. A
|
|
112
|
+
// range never spans midnight, so overnight work is two ranges on two days.
|
|
113
113
|
get closeMinute() {
|
|
114
114
|
return this._closeMinute;
|
|
115
115
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
// The public surface of this library.
|
|
1
|
+
// The public surface of this library. Excludes Attachment (UIs get Photo instead), the sync layer's internal cursors,
|
|
2
2
|
// the auth tokens (except BusinessLink.linkToken, which the protocol hands to a client), ProtoMap (the wire boundary, except buildAuthTokensBytes),
|
|
3
|
-
// the scaled-value conversions of Constants.ts (
|
|
4
|
-
// and TaxHelper
|
|
3
|
+
// the scaled-value conversions of Constants.ts (every getter is already unscaled),
|
|
4
|
+
// and TaxHelper (tax arithmetic in scaled values; a UI reads a tax off a ShoppingListItem, ShoppingList or CartLine).
|
|
5
5
|
export { default as Model } from "./Model";
|
|
6
6
|
export * as ContainerNames from "./ContainerNames";
|
|
7
7
|
export { buildAuthTokensBytes } from "./ProtoMap";
|
|
8
|
-
// The Service implementation that reaches a real server, and
|
|
9
|
-
//
|
|
8
|
+
// The Service implementation that reaches a real server, and its routes. A caller using plain
|
|
9
|
+
// https needs only the base url. Any other caller implements Service itself.
|
|
10
10
|
export { default as ServiceProxy } from "./ServiceProxy";
|
|
11
11
|
export { default as Routes } from "./Routes";
|
|
12
12
|
// Observation
|
|
@@ -45,13 +45,13 @@ export { default as ShoppingList, ItemChange, ShoppingListItem } from "./Shoppin
|
|
|
45
45
|
export { default as Tax, TaxAmount } from "./Tax";
|
|
46
46
|
export { default as WorkingDays, WorkingHours, WorkingHoursRange } from "./WorkingDays";
|
|
47
47
|
// The enums of the protocol, the limits it obeys, and how an id is read. The price list a
|
|
48
|
-
// storefront sells from is
|
|
49
|
-
//
|
|
48
|
+
// storefront sells from is exported because a UI naming it on a cart it is building needs it,
|
|
49
|
+
// while Catalog.priceList is null until the catalog has arrived.
|
|
50
50
|
export * from "./Enums";
|
|
51
51
|
export { Constants, MERABILLS_ONLINE_PRICE_LIST_ID, buildPriceListId } from "./Constants";
|
|
52
52
|
export { default as Ids } from "./Ids";
|
|
53
|
-
// Failures. The two in Exceptions.ts are programming errors
|
|
54
|
-
// and are meant to be caught
|
|
53
|
+
// Failures. The two in Exceptions.ts are programming errors. The rest are what a call fails with
|
|
54
|
+
// and are meant to be caught: ServiceException for anything the server refused,
|
|
55
55
|
// NetworkConnectionException for a call that never got an answer.
|
|
56
56
|
export { IllegalOperationException, InvalidArgumentException } from "./Exceptions";
|
|
57
57
|
export { BadRequestException, ConflictException, InternalServerException, MethodNotAllowedException, NetworkConnectionException, NotFoundException, ServiceException, ServiceUnavailableException, UnauthorizedException, UpgradeRequiredException, } from "./ServiceExceptions";
|