@peabody-soft/mbs-model-ts 1.5.0 → 1.6.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.
Files changed (52) hide show
  1. package/dist/Address.js +8 -11
  2. package/dist/Attachment.js +7 -8
  3. package/dist/AttachmentBaseUrl.js +10 -10
  4. package/dist/AuthTokens.js +12 -7
  5. package/dist/Business.js +19 -19
  6. package/dist/BusinessIdentifier.js +2 -2
  7. package/dist/BusinessLink.js +16 -16
  8. package/dist/BusinessProfile.js +4 -4
  9. package/dist/CartEditor.js +137 -166
  10. package/dist/Catalog.js +19 -25
  11. package/dist/Constants.js +10 -10
  12. package/dist/ContainerNames.js +10 -11
  13. package/dist/Entity.js +11 -9
  14. package/dist/Enums.js +2 -2
  15. package/dist/Exceptions.js +2 -2
  16. package/dist/GeneralSettings.js +22 -21
  17. package/dist/HttpStatusCodes.js +10 -11
  18. package/dist/Ids.js +24 -30
  19. package/dist/Item.js +6 -7
  20. package/dist/LatLong.js +3 -3
  21. package/dist/LiveData.js +6 -6
  22. package/dist/Measures.js +2 -2
  23. package/dist/Message.js +6 -6
  24. package/dist/MockDatabase.js +2 -2
  25. package/dist/Model.js +292 -359
  26. package/dist/Order.js +20 -17
  27. package/dist/Package.js +7 -8
  28. package/dist/PackageIdentifier.js +2 -2
  29. package/dist/PaymentMethodDetail.js +4 -4
  30. package/dist/Photo.js +6 -7
  31. package/dist/Price.js +8 -9
  32. package/dist/PriceList.js +2 -2
  33. package/dist/Product.js +17 -22
  34. package/dist/ProductCategory.js +3 -4
  35. package/dist/Profile.js +26 -27
  36. package/dist/ProtoMap.d.ts +3 -0
  37. package/dist/ProtoMap.js +288 -294
  38. package/dist/Routes.js +3 -3
  39. package/dist/ServiceExceptions.js +11 -12
  40. package/dist/ServiceProxy.js +19 -23
  41. package/dist/ShoppingList.js +112 -130
  42. package/dist/SyncCache.d.ts +3 -0
  43. package/dist/SyncCache.js +92 -75
  44. package/dist/SyncKeys.js +8 -8
  45. package/dist/SyncState.js +5 -5
  46. package/dist/Tax.js +16 -21
  47. package/dist/TaxHelper.js +22 -30
  48. package/dist/TaxType.js +8 -9
  49. package/dist/UserProfile.js +4 -4
  50. package/dist/WorkingDays.js +15 -15
  51. package/dist/index.js +9 -9
  52. package/package.json +1 -1
@@ -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); a day with no hours/ranges means worked all day.
5
- // The hours are minutes after local midnight in timeZone, so a caller asking about a moment reads
6
- // it in that zone first, as a day and a minute.
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" - never an abbreviation
19
- // like "IST". Null when none was specified: settings saved before the protocol carried one, and
20
- // ALL_DAYS. Then the hours cannot be placed on a clock, and only a caller that knows the
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 exactly as days above. Shorter than days, or empty, is normal: see the comment on
26
- // this class for what a missing entry means.
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 that is worked, or null when that day is worked all day long or is not
41
- // worked at all. A UI showing opening times treats null as all day, having tested the day first.
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 that are worked, as the stretches of it that are.
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, never overlapping, and never touching: a range that closes exactly when
67
- // the next opens arrives as one unbroken range.
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 > openMinute - a range never
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. Deliberately excludes Attachment (UIs get Photo instead), the sync layer's internal cursors,
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 (amounts, quantities and tax rates are already unscaled on every getter; ProtoMap is the only caller that needs to convert one),
4
- // and TaxHelper, the tax arithmetic, which works in those scaled values (a UI reads a tax off a ShoppingListItem, a ShoppingList or a CartLine, which have done it already).
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 the routes it reaches it by. A caller
9
- // that is happy with plain https needs only the base url; one that is not implements Service itself.
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 on the surface because a UI naming it on a cart it is building needs
49
- // it, and Catalog.priceList is null until the catalog has arrived.
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; the rest are what a call fails with
54
- // and are meant to be caught - ServiceException for anything the server refused, and
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";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@peabody-soft/mbs-model-ts",
3
- "version": "1.5.0",
3
+ "version": "1.6.0",
4
4
  "description": "MeraBills storefront client-side model (TypeScript)",
5
5
  "author": "Peabody Soft",
6
6
  "license": "AGPL-3.0-or-later",