@peabody-soft/mbs-model-ts 1.4.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.
- 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.d.ts +10 -5
- package/dist/CartEditor.js +258 -180
- package/dist/Catalog.js +31 -29
- package/dist/Constants.js +10 -10
- package/dist/ContainerNames.js +10 -11
- package/dist/Entity.js +11 -9
- package/dist/Enums.d.ts +1 -1
- package/dist/Enums.js +4 -3
- package/dist/Exceptions.js +2 -2
- package/dist/GeneralSettings.d.ts +4 -2
- package/dist/GeneralSettings.js +30 -18
- package/dist/HttpStatusCodes.js +10 -11
- package/dist/Ids.d.ts +2 -0
- package/dist/Ids.js +28 -24
- 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 -5
- package/dist/MockDatabase.js +2 -2
- package/dist/Model.d.ts +5 -0
- package/dist/Model.js +400 -254
- 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 +9 -6
- package/dist/PriceList.js +2 -2
- package/dist/Product.d.ts +5 -3
- package/dist/Product.js +26 -19
- package/dist/ProductCategory.js +3 -4
- package/dist/Profile.d.ts +1 -0
- package/dist/Profile.js +94 -8
- package/dist/ProtoMap.d.ts +18 -8
- package/dist/ProtoMap.js +451 -331
- package/dist/Routes.js +3 -3
- package/dist/ServiceExceptions.js +11 -12
- package/dist/ServiceProxy.js +19 -23
- package/dist/ShoppingList.d.ts +30 -1
- package/dist/ShoppingList.js +339 -47
- package/dist/SyncCache.d.ts +12 -0
- package/dist/SyncCache.js +136 -56
- package/dist/SyncKeys.js +8 -8
- package/dist/SyncState.js +5 -5
- package/dist/Tax.d.ts +12 -4
- package/dist/Tax.js +37 -13
- package/dist/TaxHelper.d.ts +12 -0
- package/dist/TaxHelper.js +85 -0
- package/dist/TaxType.d.ts +7 -0
- package/dist/TaxType.js +31 -0
- package/dist/UserProfile.js +4 -4
- package/dist/WorkingDays.js +15 -15
- package/dist/generated/AttachmentType.d.ts +19 -1
- package/dist/generated/AttachmentType.js +18 -0
- package/dist/generated/AuthTokens.d.ts +3 -1
- package/dist/generated/BusinessLink.d.ts +4 -1
- package/dist/generated/BusinessSyncInRequest.d.ts +11 -3
- package/dist/generated/BusinessSyncInResponse.d.ts +5 -4
- package/dist/generated/BusinessSyncOutRequest.d.ts +37 -10
- package/dist/generated/BusinessSyncOutRequest.js +42 -29
- package/dist/generated/BusinessSyncOutResponse.d.ts +14 -1
- package/dist/generated/Configuration.d.ts +2 -1
- package/dist/generated/CreateUserRequest.d.ts +8 -2
- package/dist/generated/Entity.d.ts +7 -3
- package/dist/generated/GeneralSettings.d.ts +14 -4
- package/dist/generated/GeneralSettings.js +9 -1
- package/dist/generated/Message.d.ts +4 -2
- package/dist/generated/Product.d.ts +10 -1
- package/dist/generated/Product.js +9 -1
- package/dist/generated/ProfileSyncOutRequest.d.ts +17 -1
- package/dist/generated/ProfileSyncOutResponse.d.ts +8 -3
- package/dist/generated/SalesOrderPayload.d.ts +7 -2
- package/dist/generated/ShoppingList.d.ts +6 -3
- package/dist/generated/ShoppingListItem.d.ts +21 -6
- package/dist/generated/Tax.d.ts +4 -4
- package/dist/generated/Tax.js +7 -8
- package/dist/generated/WorkingHoursRange.d.ts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +11 -10
- package/package.json +55 -55
- package/dist/generated/TaxType.d.ts +0 -25
- package/dist/generated/TaxType.js +0 -30
package/dist/LiveData.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
// A value that notifies its observers whenever it is set
|
|
2
|
-
//
|
|
3
|
-
// observe() returns its own unobserve function, holder gives a stable snapshot for React, observers are a Map for O(1) removal, and a value set mid-notification restarts
|
|
1
|
+
// A value that notifies its observers whenever it is set. This library's version of Android LiveData, which every storefront UI binds to.
|
|
2
|
+
// Skips LifecycleOwner and onActive/onInactive (no web equivalent, no need). Differs from mbl-model's Observations:
|
|
3
|
+
// observe() returns its own unobserve function, holder gives a stable snapshot for React, observers are a Map for O(1) removal, and a value set mid-notification restarts the notification instead of interleaving.
|
|
4
4
|
class LiveData {
|
|
5
5
|
constructor(value) {
|
|
6
6
|
this._observers = new Map();
|
|
@@ -12,14 +12,14 @@ class LiveData {
|
|
|
12
12
|
get value() {
|
|
13
13
|
return this._holder.value;
|
|
14
14
|
}
|
|
15
|
-
// Private
|
|
15
|
+
// Private. Only the sync layer (through an UpdatableLiveData cast) can set the value; a UI can only read and observe.
|
|
16
16
|
set value(value) {
|
|
17
|
-
// Always replaces the holder and notifies, even
|
|
17
|
+
// Always replaces the holder and notifies, even for the same reference, since the interior may have changed and this class cannot tell.
|
|
18
18
|
++this._version;
|
|
19
19
|
this._holder = new StateHolder(value);
|
|
20
20
|
this.notifyObservers();
|
|
21
21
|
}
|
|
22
|
-
// The current value, wrapped so its identity changes
|
|
22
|
+
// The current value, wrapped so its identity changes once per notification. Use this instead of value for reference-equality snapshot comparisons.
|
|
23
23
|
get holder() {
|
|
24
24
|
return this._holder;
|
|
25
25
|
}
|
package/dist/Measures.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
// How big a package is
|
|
2
|
-
// Units are the generated proto enums
|
|
1
|
+
// How big a package is and how much it weighs, grouped since a UI showing one usually shows both. Neither is an entity; both are values on the Package row.
|
|
2
|
+
// Units are the generated proto enums. A value displays in the unit the merchant entered it in, and nothing here converts between units.
|
|
3
3
|
export class Dimensions {
|
|
4
4
|
constructor(_unit, _length, _width, _height) {
|
|
5
5
|
this._unit = _unit;
|
package/dist/Message.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Entity from "./Entity";
|
|
2
|
-
// Something a customer sent to a business: an order (sales order) or a shopping cart (party preferences)
|
|
3
|
-
// A business entity despite being customer-authored, since Java authorizes the message table
|
|
2
|
+
// Something a customer sent to a business: an order (sales order) or a shopping cart (party preferences), the two payloads this library understands.
|
|
3
|
+
// A business entity despite being customer-authored, since Java authorizes the message table through Right.MESSAGES_MODIFY against the business.
|
|
4
4
|
export default class Message extends Entity {
|
|
5
5
|
constructor(header, _senderId, _messageType, _taskStatus, _senderName, _senderPhone) {
|
|
6
6
|
super(header);
|
|
@@ -10,15 +10,16 @@ export default class Message extends Entity {
|
|
|
10
10
|
this._senderName = _senderName;
|
|
11
11
|
this._senderPhone = _senderPhone;
|
|
12
12
|
}
|
|
13
|
-
// The customer's
|
|
14
|
-
//
|
|
13
|
+
// The customer's party id at the business (BusinessLink.partyId), not the id of their User. A
|
|
14
|
+
// business sync out sends a customer only messages from their own party. senderName and
|
|
15
|
+
// senderPhone say who it was without resolving the party.
|
|
15
16
|
get senderId() {
|
|
16
17
|
return this._senderId;
|
|
17
18
|
}
|
|
18
19
|
get messageType() {
|
|
19
20
|
return this._messageType;
|
|
20
21
|
}
|
|
21
|
-
// How far the business has got with this message. Named after its enum
|
|
22
|
+
// How far the business has got with this message. Named after its enum rather than the wire field "status", which would clash with Order.status.
|
|
22
23
|
get taskStatus() {
|
|
23
24
|
return this._taskStatus;
|
|
24
25
|
}
|
package/dist/MockDatabase.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// A Database that holds everything in a Map, for tests and training mode to run against with no
|
|
2
|
-
// network. Enforces the eTag rule
|
|
2
|
+
// network. Enforces the eTag rule (write only if the new eTag is greater), so a test proves the sync is idempotent.
|
|
3
3
|
export default class MockDatabase {
|
|
4
4
|
constructor() {
|
|
5
5
|
this._containers = new Map();
|
|
@@ -51,7 +51,7 @@ export class MockContainer {
|
|
|
51
51
|
this._blobs.set(blob.id, blob);
|
|
52
52
|
++appliedCount;
|
|
53
53
|
}
|
|
54
|
-
//
|
|
54
|
+
// After the writes, as the Database contract says
|
|
55
55
|
for (const id of deletes)
|
|
56
56
|
this._blobs.delete(id);
|
|
57
57
|
return appliedCount;
|
package/dist/Model.d.ts
CHANGED
|
@@ -31,6 +31,8 @@ export default class Model {
|
|
|
31
31
|
private businessSyncIn;
|
|
32
32
|
private syncAnonymousBusiness;
|
|
33
33
|
private syncBusinessContainer;
|
|
34
|
+
private readBusinessPages;
|
|
35
|
+
private static isBusinessNamed;
|
|
34
36
|
private requireBusinessLink;
|
|
35
37
|
private readJoinBusinessId;
|
|
36
38
|
private static findBusinessEntity;
|
|
@@ -48,6 +50,8 @@ export default class Model {
|
|
|
48
50
|
private buildProfileAuthTokens;
|
|
49
51
|
private requireProfileAuthTokens;
|
|
50
52
|
private publishBusiness;
|
|
53
|
+
private publish;
|
|
54
|
+
private static buildPublishable;
|
|
51
55
|
private publishProfile;
|
|
52
56
|
private static getService;
|
|
53
57
|
private static getCache;
|
|
@@ -58,6 +62,7 @@ export default class Model {
|
|
|
58
62
|
private _subjectId;
|
|
59
63
|
private _authenticationToken;
|
|
60
64
|
private _businessId;
|
|
65
|
+
private _isPublishedBusinessVetted;
|
|
61
66
|
private readonly _business;
|
|
62
67
|
private readonly _profile;
|
|
63
68
|
}
|