@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
|
@@ -17,7 +17,8 @@ class Product$Type extends MessageType {
|
|
|
17
17
|
{ no: 5, name: "manufacturer", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/ },
|
|
18
18
|
{ no: 6, name: "manufacturerAddress", kind: "message", T: () => Address },
|
|
19
19
|
{ no: 7, name: "taxes", kind: "message", repeat: 2 /*RepeatType.UNPACKED*/, T: () => Tax },
|
|
20
|
-
{ no: 8, name: "features", kind: "scalar", repeat: 2 /*RepeatType.UNPACKED*/, T: 9 /*ScalarType.STRING*/ }
|
|
20
|
+
{ no: 8, name: "features", kind: "scalar", repeat: 2 /*RepeatType.UNPACKED*/, T: 9 /*ScalarType.STRING*/ },
|
|
21
|
+
{ no: 9, name: "forOfflineSaleOnly", kind: "scalar", T: 8 /*ScalarType.BOOL*/ }
|
|
21
22
|
]);
|
|
22
23
|
}
|
|
23
24
|
create(value) {
|
|
@@ -25,6 +26,7 @@ class Product$Type extends MessageType {
|
|
|
25
26
|
message.productType = 0;
|
|
26
27
|
message.taxes = [];
|
|
27
28
|
message.features = [];
|
|
29
|
+
message.forOfflineSaleOnly = false;
|
|
28
30
|
if (value !== undefined)
|
|
29
31
|
reflectionMergePartial(this, message, value);
|
|
30
32
|
return message;
|
|
@@ -58,6 +60,9 @@ class Product$Type extends MessageType {
|
|
|
58
60
|
case /* repeated string features */ 8:
|
|
59
61
|
message.features.push(reader.string());
|
|
60
62
|
break;
|
|
63
|
+
case /* bool forOfflineSaleOnly */ 9:
|
|
64
|
+
message.forOfflineSaleOnly = reader.bool();
|
|
65
|
+
break;
|
|
61
66
|
default:
|
|
62
67
|
let u = options.readUnknownField;
|
|
63
68
|
if (u === "throw")
|
|
@@ -94,6 +99,9 @@ class Product$Type extends MessageType {
|
|
|
94
99
|
/* repeated string features = 8; */
|
|
95
100
|
for (let i = 0; i < message.features.length; i++)
|
|
96
101
|
writer.tag(8, WireType.LengthDelimited).string(message.features[i]);
|
|
102
|
+
/* bool forOfflineSaleOnly = 9; */
|
|
103
|
+
if (message.forOfflineSaleOnly !== false)
|
|
104
|
+
writer.tag(9, WireType.Varint).bool(message.forOfflineSaleOnly);
|
|
97
105
|
let u = options.writeUnknownFields;
|
|
98
106
|
if (u !== false)
|
|
99
107
|
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
@@ -32,7 +32,23 @@ export interface ProfileSyncOutRequest {
|
|
|
32
32
|
*/
|
|
33
33
|
businessLinkUpdateNumber: bigint;
|
|
34
34
|
/**
|
|
35
|
-
* The business to join as a customer, if the caller is not already linked to it. 0 means none
|
|
35
|
+
* The business to join as a customer, if the caller is not already linked to it. 0 means none, and
|
|
36
|
+
* anything else has to be the id of a business: one that is not is refused, not ignored.
|
|
37
|
+
* A call that carries a valid link token of this business is from a member of it already, and nothing is
|
|
38
|
+
* joined: the response is what the cursors above return, as for a call that joins nothing, and it is not
|
|
39
|
+
* refused for the business no longer allowing customers to join it. A link token that is not valid is
|
|
40
|
+
* refused (401), and one of another business says nothing of this one.
|
|
41
|
+
* Otherwise the response always carries the BusinessLink and the Business that a join returns, even
|
|
42
|
+
* where the cursors above would not return them.
|
|
43
|
+
* An invitation to this business for the caller (looked for by their phone number) takes precedence: it is
|
|
44
|
+
* accepted in the role and party that the invitation names, which may be those of a manager or an owner as
|
|
45
|
+
* well as of a customer, whether or not the business allows customers to join without an invitation, and
|
|
46
|
+
* the invitation is deleted. Only when there is none does the business decide.
|
|
47
|
+
* The call fails with 404 (NotFoundException) if there is no such business, or if the caller has no
|
|
48
|
+
* invitation to it and it does not allow customers to join it, and the caller does not hold a valid link
|
|
49
|
+
* token of it. It is the link token that is tested, and not membership: a member that does not hold one (on
|
|
50
|
+
* a new device, say) of a business that has since stopped allowing customers to join is refused in the same
|
|
51
|
+
* way, and then the whole call is a 404 - nothing of the profile is returned either, and not only no join.
|
|
36
52
|
*
|
|
37
53
|
* @generated from protobuf field: int64 joinBusinessId = 4
|
|
38
54
|
*/
|
|
@@ -11,8 +11,9 @@ import { AuthTokens } from "./AuthTokens";
|
|
|
11
11
|
/**
|
|
12
12
|
* The answer to a ProfileSyncOutRequest: who the caller is, the businesses they are linked to, and
|
|
13
13
|
* those businesses. Nothing is nested - match BusinessLink.businessId against Business.entity.id.
|
|
14
|
-
* Every field is absent/empty unless that type has changed
|
|
15
|
-
*
|
|
14
|
+
* Every field is absent/empty unless that type has changed, but for the caller's own user, which is
|
|
15
|
+
* sent with every response; a tombstone (updateNumber's update-type bits =
|
|
16
|
+
* Constants.UPDATE_TYPE_DELETED) means the entity, and what it owned, was deleted.
|
|
16
17
|
*
|
|
17
18
|
* @generated from protobuf message com.merabills.storefront.ProfileSyncOutResponse
|
|
18
19
|
*/
|
|
@@ -25,13 +26,17 @@ export interface ProfileSyncOutResponse {
|
|
|
25
26
|
*/
|
|
26
27
|
authTokens?: AuthTokens;
|
|
27
28
|
/**
|
|
28
|
-
* The caller.
|
|
29
|
+
* The caller. Sent with every response, whatever userUpdateNumber is: a client keeps the copy it holds
|
|
30
|
+
* when it is as new as this one. The only user a response ever carries: nobody else's, such as the
|
|
31
|
+
* owner of a business, is sent to a customer.
|
|
29
32
|
*
|
|
30
33
|
* @generated from protobuf field: com.merabills.storefront.User user = 2
|
|
31
34
|
*/
|
|
32
35
|
user?: User;
|
|
33
36
|
/**
|
|
34
37
|
* The businesses the caller is linked to, and the token for each. Empty unless a link has changed.
|
|
38
|
+
* Only the caller's own links: never that of anybody else, such as the owner of a business, which is a
|
|
39
|
+
* credential for it.
|
|
35
40
|
*
|
|
36
41
|
* @generated from protobuf field: repeated com.merabills.storefront.BusinessLink businessLinks = 3
|
|
37
42
|
*/
|
|
@@ -10,7 +10,10 @@ import { FulfillmentMode } from "./FulfillmentMode";
|
|
|
10
10
|
import { OrderStatus } from "./OrderStatus";
|
|
11
11
|
/**
|
|
12
12
|
* The payload of a SALES_ORDER message: an order placed by a customer.
|
|
13
|
-
* Excluded: serviceStationNumber, dueDate.
|
|
13
|
+
* Excluded: serviceStationNumber, dueDate, createdByParty. The last is set by the merchant app for an
|
|
14
|
+
* order that its party placed itself and not an operator of the business on its behalf. Nothing reads
|
|
15
|
+
* it and a storefront has no use for it, so it is not carried, and the server leaves it unset on an
|
|
16
|
+
* order that a storefront pushes.
|
|
14
17
|
*
|
|
15
18
|
* @generated from protobuf message com.merabills.storefront.SalesOrderPayload
|
|
16
19
|
*/
|
|
@@ -66,7 +69,9 @@ export interface SalesOrderPayload {
|
|
|
66
69
|
*/
|
|
67
70
|
note?: string;
|
|
68
71
|
/**
|
|
69
|
-
* Payment received towards this order so far. Can only be set by an operator of the business.
|
|
72
|
+
* Payment received towards this order so far. Can only be set by an operator of the business. That is not
|
|
73
|
+
* enforced yet: sync in is not implemented (its route answers 501), and ProtoMap.fromProto accepts this
|
|
74
|
+
* from whoever pushes the order, so sync in must refuse or drop it from a customer when it is written.
|
|
70
75
|
*
|
|
71
76
|
* @generated from protobuf field: optional int64 paymentReceived = 10
|
|
72
77
|
*/
|
|
@@ -35,14 +35,17 @@ export interface ShoppingList {
|
|
|
35
35
|
*/
|
|
36
36
|
autoAddServiceCharge: boolean;
|
|
37
37
|
/**
|
|
38
|
-
* Id of the inventory location the items are drawn from. 0 is the default location.
|
|
38
|
+
* Id of the inventory location the items are drawn from. 0 is the default location. It is a number of 16 bits, from
|
|
39
|
+
* -32768 to 32767: a message with one that is outside of that is refused (400), and not read as some other location.
|
|
39
40
|
*
|
|
40
41
|
* @generated from protobuf field: int32 inventoryLocationId = 4
|
|
41
42
|
*/
|
|
42
43
|
inventoryLocationId: number;
|
|
43
44
|
/**
|
|
44
|
-
* Id of the PriceList the prices came from. A
|
|
45
|
-
* Constants.
|
|
45
|
+
* Id of the PriceList the prices came from. A storefront sells from the MeraBills Online price
|
|
46
|
+
* list (the id built from Constants.MERABILLS_ONLINE_PRICE_LIST), so, that is what a cart that it
|
|
47
|
+
* pushes carries, an empty one included. Java does not default this for a cart: one that was given
|
|
48
|
+
* no price list holds Constants.ENTITY_ID_NULL, and the server keeps the id that it is sent.
|
|
46
49
|
*
|
|
47
50
|
* @generated from protobuf field: int64 priceListId = 5
|
|
48
51
|
*/
|
|
@@ -8,8 +8,21 @@ import { Tax } from "./Tax";
|
|
|
8
8
|
/**
|
|
9
9
|
* A line item in a shopping list: the package bought, how much, and at what price.
|
|
10
10
|
* Excluded: batches.
|
|
11
|
-
*
|
|
12
|
-
*
|
|
11
|
+
*
|
|
12
|
+
* Every field here is exactly the member of the same name in the Java class ShoppingListItem, with the same meaning,
|
|
13
|
+
* and is converted to and from it by copying: nothing is calculated. In particular, the prices (unitPrice and
|
|
14
|
+
* priceDiscount) are the prices WITHOUT taxes. Taxes are calculated from them, as follows:
|
|
15
|
+
* tax base = unitPrice x quantity, rounded half up to a whole amount, where the quantity is
|
|
16
|
+
* (quantity / Constants.QUANTITY_FACTOR) worked out in 32 bit floating point (a float), and then widened to
|
|
17
|
+
* a double to multiply it by unitPrice. Java does Math.round((double) unitPrice * (double) (quantity / 1000f)),
|
|
18
|
+
* and that is to be matched exactly: dividing in double precision, or multiplying the integers first,
|
|
19
|
+
* differs at exact halves. A unitPrice of 5 and a quantity of 700 (0.7) has a tax base of 3 here, because
|
|
20
|
+
* 0.7f is a little under 0.7, and of 4 in double precision
|
|
21
|
+
* each tax = tax base x the rate of the tax / Constants.TAX_RATE_FACTOR, rounded half up (each tax is rounded
|
|
22
|
+
* separately). Taxes only apply to a tax base that is greater than zero
|
|
23
|
+
* finalPrice = tax base + all the taxes - discount (not less than 0). Note that discount is taken off the price
|
|
24
|
+
* with taxes
|
|
25
|
+
* Not included because it is derived: tax amounts, totalTax, finalPrice.
|
|
13
26
|
*
|
|
14
27
|
* @generated from protobuf message com.merabills.storefront.ShoppingListItem
|
|
15
28
|
*/
|
|
@@ -28,14 +41,16 @@ export interface ShoppingListItem {
|
|
|
28
41
|
*/
|
|
29
42
|
quantity: number;
|
|
30
43
|
/**
|
|
31
|
-
* Price of one unit of the package, multiplied by
|
|
44
|
+
* Price of one unit of the package, WITHOUT taxes (the taxes in taxes are calculated on top of it), multiplied by
|
|
45
|
+
* Constants.AMOUNT_FACTOR.
|
|
32
46
|
* This is the offer price when the package is on offer.
|
|
33
47
|
*
|
|
34
48
|
* @generated from protobuf field: int64 unitPrice = 3
|
|
35
49
|
*/
|
|
36
50
|
unitPrice: bigint;
|
|
37
51
|
/**
|
|
38
|
-
* Position of this item in the shopping list (0 to Constants.SHOPPING_LIST_ITEM_MAX_ORDER)
|
|
52
|
+
* Position of this item in the shopping list (0 to Constants.SHOPPING_LIST_ITEM_MAX_ORDER). A message with one that is
|
|
53
|
+
* outside of that is refused (400), and not read as some other position.
|
|
39
54
|
*
|
|
40
55
|
* @generated from protobuf field: int32 shoppingListOrder = 4
|
|
41
56
|
*/
|
|
@@ -57,8 +72,8 @@ export interface ShoppingListItem {
|
|
|
57
72
|
*/
|
|
58
73
|
isStockKeepingRequired: boolean;
|
|
59
74
|
/**
|
|
60
|
-
* Discount in the unit price (regularPrice - offerPrice of the package), multiplied by
|
|
61
|
-
* Constants.AMOUNT_FACTOR
|
|
75
|
+
* Discount in the unit price (regularPrice - offerPrice of the package, both WITHOUT taxes), multiplied by
|
|
76
|
+
* Constants.AMOUNT_FACTOR. So, the regular price of one unit, without taxes, is unitPrice + priceDiscount.
|
|
62
77
|
*
|
|
63
78
|
* @generated from protobuf field: int64 priceDiscount = 8
|
|
64
79
|
*/
|
package/dist/generated/Tax.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ import type { BinaryReadOptions } from "@protobuf-ts/runtime";
|
|
|
4
4
|
import type { IBinaryReader } from "@protobuf-ts/runtime";
|
|
5
5
|
import type { PartialMessage } from "@protobuf-ts/runtime";
|
|
6
6
|
import { MessageType } from "@protobuf-ts/runtime";
|
|
7
|
-
import { TaxType } from "./TaxType";
|
|
8
7
|
/**
|
|
9
8
|
* A tax and the rate at which it applies. Replaces the parallel taxCodes / taxRates arrays in Java.
|
|
10
9
|
*
|
|
@@ -12,11 +11,12 @@ import { TaxType } from "./TaxType";
|
|
|
12
11
|
*/
|
|
13
12
|
export interface Tax {
|
|
14
13
|
/**
|
|
15
|
-
*
|
|
14
|
+
* The raw tax code: 0 to 127, and meaningful only within the country of the business the tax is on,
|
|
15
|
+
* which both ends already hold (Business.countryCode). A client names a tax by combining the two.
|
|
16
16
|
*
|
|
17
|
-
* @generated from protobuf field:
|
|
17
|
+
* @generated from protobuf field: int32 taxCode = 1
|
|
18
18
|
*/
|
|
19
|
-
|
|
19
|
+
taxCode: number;
|
|
20
20
|
/**
|
|
21
21
|
* Tax rate, multiplied by Constants.TAX_RATE_FACTOR. 18% is stored as 1800.
|
|
22
22
|
*
|
package/dist/generated/Tax.js
CHANGED
|
@@ -2,18 +2,17 @@ import { WireType } from "@protobuf-ts/runtime";
|
|
|
2
2
|
import { UnknownFieldHandler } from "@protobuf-ts/runtime";
|
|
3
3
|
import { reflectionMergePartial } from "@protobuf-ts/runtime";
|
|
4
4
|
import { MessageType } from "@protobuf-ts/runtime";
|
|
5
|
-
import { TaxType } from "./TaxType";
|
|
6
5
|
// @generated message type with reflection information, may provide speed optimized methods
|
|
7
6
|
class Tax$Type extends MessageType {
|
|
8
7
|
constructor() {
|
|
9
8
|
super("com.merabills.storefront.Tax", [
|
|
10
|
-
{ no: 1, name: "
|
|
9
|
+
{ no: 1, name: "taxCode", kind: "scalar", T: 5 /*ScalarType.INT32*/ },
|
|
11
10
|
{ no: 2, name: "rate", kind: "scalar", T: 5 /*ScalarType.INT32*/ }
|
|
12
11
|
]);
|
|
13
12
|
}
|
|
14
13
|
create(value) {
|
|
15
14
|
const message = globalThis.Object.create((this.messagePrototype));
|
|
16
|
-
message.
|
|
15
|
+
message.taxCode = 0;
|
|
17
16
|
message.rate = 0;
|
|
18
17
|
if (value !== undefined)
|
|
19
18
|
reflectionMergePartial(this, message, value);
|
|
@@ -24,8 +23,8 @@ class Tax$Type extends MessageType {
|
|
|
24
23
|
while (reader.pos < end) {
|
|
25
24
|
let [fieldNo, wireType] = reader.tag();
|
|
26
25
|
switch (fieldNo) {
|
|
27
|
-
case /*
|
|
28
|
-
message.
|
|
26
|
+
case /* int32 taxCode */ 1:
|
|
27
|
+
message.taxCode = reader.int32();
|
|
29
28
|
break;
|
|
30
29
|
case /* int32 rate */ 2:
|
|
31
30
|
message.rate = reader.int32();
|
|
@@ -42,9 +41,9 @@ class Tax$Type extends MessageType {
|
|
|
42
41
|
return message;
|
|
43
42
|
}
|
|
44
43
|
internalBinaryWrite(message, writer, options) {
|
|
45
|
-
/*
|
|
46
|
-
if (message.
|
|
47
|
-
writer.tag(1, WireType.Varint).int32(message.
|
|
44
|
+
/* int32 taxCode = 1; */
|
|
45
|
+
if (message.taxCode !== 0)
|
|
46
|
+
writer.tag(1, WireType.Varint).int32(message.taxCode);
|
|
48
47
|
/* int32 rate = 2; */
|
|
49
48
|
if (message.rate !== 0)
|
|
50
49
|
writer.tag(2, WireType.Varint).int32(message.rate);
|
|
@@ -5,8 +5,8 @@ import type { IBinaryReader } from "@protobuf-ts/runtime";
|
|
|
5
5
|
import type { PartialMessage } from "@protobuf-ts/runtime";
|
|
6
6
|
import { MessageType } from "@protobuf-ts/runtime";
|
|
7
7
|
/**
|
|
8
|
-
* A single stretch of working hours within a day, in minutes after local midnight (
|
|
9
|
-
* carried -
|
|
8
|
+
* A single stretch of working hours within a day, in minutes after local midnight (the time zone is
|
|
9
|
+
* not carried here - it is WorkingDays.timeZone).
|
|
10
10
|
* A range never spans midnight; work past midnight is two ranges - one closing at
|
|
11
11
|
* Constants.MINUTES_PER_DAY, one opening at 0 the next day.
|
|
12
12
|
* Not included because it is derived: isAllDay, contains, overlaps.
|
package/dist/index.d.ts
CHANGED
|
@@ -37,8 +37,8 @@ export { default as LatLong } from "./LatLong";
|
|
|
37
37
|
export { Dimensions, Weight } from "./Measures";
|
|
38
38
|
export { default as PackageIdentifier } from "./PackageIdentifier";
|
|
39
39
|
export { default as PaymentMethodDetail } from "./PaymentMethodDetail";
|
|
40
|
-
export { default as ShoppingList, ShoppingListItem } from "./ShoppingList";
|
|
41
|
-
export { default as Tax } from "./Tax";
|
|
40
|
+
export { default as ShoppingList, ItemChange, ShoppingListItem } from "./ShoppingList";
|
|
41
|
+
export { default as Tax, TaxAmount } from "./Tax";
|
|
42
42
|
export { default as WorkingDays, WorkingHours, WorkingHoursRange } from "./WorkingDays";
|
|
43
43
|
export * from "./Enums";
|
|
44
44
|
export { Constants, MERABILLS_ONLINE_PRICE_LIST_ID, buildPriceListId } from "./Constants";
|
package/dist/index.js
CHANGED
|
@@ -1,11 +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
|
-
//
|
|
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).
|
|
4
5
|
export { default as Model } from "./Model";
|
|
5
6
|
export * as ContainerNames from "./ContainerNames";
|
|
6
7
|
export { buildAuthTokensBytes } from "./ProtoMap";
|
|
7
|
-
// The Service implementation that reaches a real server, and
|
|
8
|
-
//
|
|
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.
|
|
9
10
|
export { default as ServiceProxy } from "./ServiceProxy";
|
|
10
11
|
export { default as Routes } from "./Routes";
|
|
11
12
|
// Observation
|
|
@@ -40,17 +41,17 @@ export { default as LatLong } from "./LatLong";
|
|
|
40
41
|
export { Dimensions, Weight } from "./Measures";
|
|
41
42
|
export { default as PackageIdentifier } from "./PackageIdentifier";
|
|
42
43
|
export { default as PaymentMethodDetail } from "./PaymentMethodDetail";
|
|
43
|
-
export { default as ShoppingList, ShoppingListItem } from "./ShoppingList";
|
|
44
|
-
export { default as Tax } from "./Tax";
|
|
44
|
+
export { default as ShoppingList, ItemChange, ShoppingListItem } from "./ShoppingList";
|
|
45
|
+
export { default as Tax, TaxAmount } from "./Tax";
|
|
45
46
|
export { default as WorkingDays, WorkingHours, WorkingHoursRange } from "./WorkingDays";
|
|
46
47
|
// The enums of the protocol, the limits it obeys, and how an id is read. The price list a
|
|
47
|
-
// storefront sells from is
|
|
48
|
-
//
|
|
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.
|
|
49
50
|
export * from "./Enums";
|
|
50
51
|
export { Constants, MERABILLS_ONLINE_PRICE_LIST_ID, buildPriceListId } from "./Constants";
|
|
51
52
|
export { default as Ids } from "./Ids";
|
|
52
|
-
// Failures. The two in Exceptions.ts are programming errors
|
|
53
|
-
// 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,
|
|
54
55
|
// NetworkConnectionException for a call that never got an answer.
|
|
55
56
|
export { IllegalOperationException, InvalidArgumentException } from "./Exceptions";
|
|
56
57
|
export { BadRequestException, ConflictException, InternalServerException, MethodNotAllowedException, NetworkConnectionException, NotFoundException, ServiceException, ServiceUnavailableException, UnauthorizedException, UpgradeRequiredException, } from "./ServiceExceptions";
|
package/package.json
CHANGED
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@peabody-soft/mbs-model-ts",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "MeraBills storefront client-side model (TypeScript)",
|
|
5
|
-
"author": "Peabody Soft",
|
|
6
|
-
"license": "AGPL-3.0-or-later",
|
|
7
|
-
"homepage": "https://merabills.com",
|
|
8
|
-
"keywords": [
|
|
9
|
-
"MeraBills",
|
|
10
|
-
"Peabody Soft",
|
|
11
|
-
"Model",
|
|
12
|
-
"Storefront",
|
|
13
|
-
"Mock",
|
|
14
|
-
"TypeScript"
|
|
15
|
-
],
|
|
16
|
-
"publishConfig": {
|
|
17
|
-
"access": "public"
|
|
18
|
-
},
|
|
19
|
-
"main": "./dist/index.js",
|
|
20
|
-
"types": "./dist/index.d.ts",
|
|
21
|
-
"exports": {
|
|
22
|
-
".": {
|
|
23
|
-
"types": "./dist/index.d.ts",
|
|
24
|
-
"default": "./dist/index.js"
|
|
25
|
-
},
|
|
26
|
-
"./dist/*": {
|
|
27
|
-
"types": "./dist/*.d.ts",
|
|
28
|
-
"default": "./dist/*.js"
|
|
29
|
-
},
|
|
30
|
-
"./generated/*": {
|
|
31
|
-
"types": "./dist/generated/*.d.ts",
|
|
32
|
-
"default": "./dist/generated/*.js"
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
"files": [
|
|
36
|
-
"dist/**",
|
|
37
|
-
"!dist/**/*.map",
|
|
38
|
-
"!USAGE.md"
|
|
39
|
-
],
|
|
40
|
-
"scripts": {
|
|
41
|
-
"generate": "node generate.mjs",
|
|
42
|
-
"clean": "node -e \"require('fs').rmSync('dist', { recursive: true, force: true })\"",
|
|
43
|
-
"build": "npm run generate && npm run clean && tsc",
|
|
44
|
-
"typecheck": "npm run generate && tsc --noEmit",
|
|
45
|
-
"prepack": "npm run build"
|
|
46
|
-
},
|
|
47
|
-
"devDependencies": {
|
|
48
|
-
"@protobuf-ts/plugin": "^2.11.1",
|
|
49
|
-
"typescript": "^7.0.2"
|
|
50
|
-
},
|
|
51
|
-
"dependencies": {
|
|
52
|
-
"@peabody-soft/mbs-protos": "^1.
|
|
53
|
-
"@protobuf-ts/runtime": "^2.11.1"
|
|
54
|
-
}
|
|
55
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@peabody-soft/mbs-model-ts",
|
|
3
|
+
"version": "1.6.0",
|
|
4
|
+
"description": "MeraBills storefront client-side model (TypeScript)",
|
|
5
|
+
"author": "Peabody Soft",
|
|
6
|
+
"license": "AGPL-3.0-or-later",
|
|
7
|
+
"homepage": "https://merabills.com",
|
|
8
|
+
"keywords": [
|
|
9
|
+
"MeraBills",
|
|
10
|
+
"Peabody Soft",
|
|
11
|
+
"Model",
|
|
12
|
+
"Storefront",
|
|
13
|
+
"Mock",
|
|
14
|
+
"TypeScript"
|
|
15
|
+
],
|
|
16
|
+
"publishConfig": {
|
|
17
|
+
"access": "public"
|
|
18
|
+
},
|
|
19
|
+
"main": "./dist/index.js",
|
|
20
|
+
"types": "./dist/index.d.ts",
|
|
21
|
+
"exports": {
|
|
22
|
+
".": {
|
|
23
|
+
"types": "./dist/index.d.ts",
|
|
24
|
+
"default": "./dist/index.js"
|
|
25
|
+
},
|
|
26
|
+
"./dist/*": {
|
|
27
|
+
"types": "./dist/*.d.ts",
|
|
28
|
+
"default": "./dist/*.js"
|
|
29
|
+
},
|
|
30
|
+
"./generated/*": {
|
|
31
|
+
"types": "./dist/generated/*.d.ts",
|
|
32
|
+
"default": "./dist/generated/*.js"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"files": [
|
|
36
|
+
"dist/**",
|
|
37
|
+
"!dist/**/*.map",
|
|
38
|
+
"!USAGE.md"
|
|
39
|
+
],
|
|
40
|
+
"scripts": {
|
|
41
|
+
"generate": "node generate.mjs",
|
|
42
|
+
"clean": "node -e \"require('fs').rmSync('dist', { recursive: true, force: true })\"",
|
|
43
|
+
"build": "npm run generate && npm run clean && tsc",
|
|
44
|
+
"typecheck": "npm run generate && tsc --noEmit",
|
|
45
|
+
"prepack": "npm run build"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@protobuf-ts/plugin": "^2.11.1",
|
|
49
|
+
"typescript": "^7.0.2"
|
|
50
|
+
},
|
|
51
|
+
"dependencies": {
|
|
52
|
+
"@peabody-soft/mbs-protos": "^1.11.0",
|
|
53
|
+
"@protobuf-ts/runtime": "^2.11.1"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A tax that applies to a product or to a line item. A raw Java tax code is only unique within a
|
|
3
|
-
* country, so values here are not that raw code: they are computed ids, TaxType.createId(country,
|
|
4
|
-
* taxCode) = (country.getNumeric() << 8) | taxCode, making each value globally unique and
|
|
5
|
-
* self-describing rather than meaningful only together with some other, separately carried country
|
|
6
|
-
* code. A client can recover the ISO 3166-1 numeric country code with (value >> 8); it cannot
|
|
7
|
-
* recover the raw tax code beyond the low 8 bits, and does not need to - the enum name already
|
|
8
|
-
* carries that meaning.
|
|
9
|
-
*
|
|
10
|
-
* @generated from protobuf enum com.merabills.storefront.TaxType
|
|
11
|
-
*/
|
|
12
|
-
export declare enum TaxType {
|
|
13
|
-
/**
|
|
14
|
-
* No country's numeric code is ever 0, so this id can never collide with a real one
|
|
15
|
-
*
|
|
16
|
-
* @generated from protobuf enum value: UNSPECIFIED_TAX_TYPE = 0;
|
|
17
|
-
*/
|
|
18
|
-
UNSPECIFIED_TAX_TYPE = 0,
|
|
19
|
-
/**
|
|
20
|
-
* India (countryCode 356): Goods and Services Tax (taxCode 0)
|
|
21
|
-
*
|
|
22
|
-
* @generated from protobuf enum value: GST = 91136;
|
|
23
|
-
*/
|
|
24
|
-
GST = 91136
|
|
25
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
|
-
// @generated by protobuf-ts 2.11.1 with parameter long_type_bigint
|
|
3
|
-
// @generated from protobuf file "TaxType.proto" (package "com.merabills.storefront", syntax proto3)
|
|
4
|
-
// tslint:disable
|
|
5
|
-
/**
|
|
6
|
-
* A tax that applies to a product or to a line item. A raw Java tax code is only unique within a
|
|
7
|
-
* country, so values here are not that raw code: they are computed ids, TaxType.createId(country,
|
|
8
|
-
* taxCode) = (country.getNumeric() << 8) | taxCode, making each value globally unique and
|
|
9
|
-
* self-describing rather than meaningful only together with some other, separately carried country
|
|
10
|
-
* code. A client can recover the ISO 3166-1 numeric country code with (value >> 8); it cannot
|
|
11
|
-
* recover the raw tax code beyond the low 8 bits, and does not need to - the enum name already
|
|
12
|
-
* carries that meaning.
|
|
13
|
-
*
|
|
14
|
-
* @generated from protobuf enum com.merabills.storefront.TaxType
|
|
15
|
-
*/
|
|
16
|
-
export var TaxType;
|
|
17
|
-
(function (TaxType) {
|
|
18
|
-
/**
|
|
19
|
-
* No country's numeric code is ever 0, so this id can never collide with a real one
|
|
20
|
-
*
|
|
21
|
-
* @generated from protobuf enum value: UNSPECIFIED_TAX_TYPE = 0;
|
|
22
|
-
*/
|
|
23
|
-
TaxType[TaxType["UNSPECIFIED_TAX_TYPE"] = 0] = "UNSPECIFIED_TAX_TYPE";
|
|
24
|
-
/**
|
|
25
|
-
* India (countryCode 356): Goods and Services Tax (taxCode 0)
|
|
26
|
-
*
|
|
27
|
-
* @generated from protobuf enum value: GST = 91136;
|
|
28
|
-
*/
|
|
29
|
-
TaxType[TaxType["GST"] = 91136] = "GST";
|
|
30
|
-
})(TaxType || (TaxType = {}));
|