@peabody-soft/mbs-protos 1.0.0 → 1.2.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.
@@ -6,12 +6,9 @@ option java_package = "com.merabills.server.core.generated";
6
6
  import "ShoppingListItem.proto";
7
7
 
8
8
  // A list of packages being bought - a customer's shopping cart, or the contents of an order.
9
- // In Java the items are serialized into a base64 string; they are typed here.
10
9
  // Excluded: transactionTime.
11
- // Not included because they are computed from the fields below: totalAmount (=
12
- // totalAmountBeforeDiscount - discount), totalTax (the sum of the taxes of the existing items) and
13
- // itemCount (= existingItemCount + deletedItemCount). isSaved and the change listener are Java
14
- // bookkeeping and are not part of this protocol.
10
+ // Not included because it is derived: totalAmount (= totalAmountBeforeDiscount - discount), totalTax,
11
+ // itemCount (= existingItemCount + deletedItemCount), isSaved.
15
12
  message ShoppingList {
16
13
 
17
14
  // True once the customer is done editing this list, after which the business may edit it.
@@ -28,15 +25,12 @@ message ShoppingList {
28
25
  // Id of the inventory location the items are drawn from. 0 is the default location.
29
26
  int32 inventoryLocationId = 4;
30
27
 
31
- // Id of the PriceList the prices of the items came from - the one price list a
32
- // BusinessSyncOutResponse carries. A client creating a cart that has none yet sends the id built
33
- // from Constants.DEFAULT_SALE_PRICE_LIST.
28
+ // Id of the PriceList the prices came from. A cart with none yet uses the id built from
29
+ // Constants.DEFAULT_SALE_PRICE_LIST.
34
30
  int64 priceListId = 5;
35
31
 
36
- // Sum of the final prices of the existing items, multiplied by Constants.AMOUNT_FACTOR.
37
- // This total is authoritative: it is computed with the rounding rules of PriceCalculation, which
38
- // a client is not expected to reproduce. Display it minus the discount below, rather than adding
39
- // the items up.
32
+ // Sum of the final prices of the existing items x Constants.AMOUNT_FACTOR. Authoritative - do not
33
+ // recompute; display it minus discount rather than summing items yourself.
40
34
  int64 totalAmountBeforeDiscount = 6;
41
35
 
42
36
  // Discount on the whole list, multiplied by Constants.AMOUNT_FACTOR
@@ -5,15 +5,14 @@ option java_package = "com.merabills.server.core.generated";
5
5
 
6
6
  import "Tax.proto";
7
7
 
8
- // A line item in a shopping list: the package being bought, how much of it, and at what price.
8
+ // A line item in a shopping list: the package bought, how much, and at what price.
9
9
  // Excluded: batches.
10
- // Not included because they are computed from the fields below and are not stored in Java:
11
- // taxes amounts, totalTax and finalPrice (= (unitPrice x quantity) + taxes thereon - discount).
10
+ // Not included because it is derived: tax amounts, totalTax, finalPrice (= unitPrice x quantity +
11
+ // taxes - discount).
12
12
  message ShoppingListItem {
13
13
 
14
- // Id of the package being bought. Four ids are reserved for charge and summary lines rather
15
- // than catalog packages, and will not be found in the catalog - see ReservedPackage, which
16
- // gives those ids and how to build them. A client must label those lines itself.
14
+ // Id of the package bought. Four ids are reserved for charge/summary lines (see ReservedPackage)
15
+ // and will not be found in the catalog - label those yourself.
17
16
  int64 packageId = 1;
18
17
 
19
18
  // Quantity, multiplied by Constants.QUANTITY_FACTOR. 1.5 kg is stored as 1500.
package/UrlAndToken.proto CHANGED
@@ -3,55 +3,27 @@ package com.merabills.storefront;
3
3
  option java_multiple_files = true;
4
4
  option java_package = "com.merabills.server.core.generated";
5
5
 
6
- // Where a set of files is, the shared access signature that authorizes reading them, and the moment
7
- // both stop working. This is the Java UrlAndToken of the repository client: what
8
- // Service.createAttachmentSasUrl returns, and what BlobClient builds every blob url from.
6
+ // Where a set of files is, the read-only signature that authorizes reading them, and when both
7
+ // expire. Carried once, as BusinessSyncOutResponse.attachmentBaseUrl for a business's photos - not an
8
+ // entity, and never deleted, only expired.
9
9
  //
10
- // This protocol uses it for one thing - BusinessSyncOutResponse.attachmentBaseUrl, the container
11
- // that holds the photos of a business. It is a value and not an entity: it has no Entity, no id and
12
- // no update number, because it is generated per caller on demand and stored nowhere. It cannot be
13
- // deleted either, so there is no tombstone for it; it only expires.
14
- //
15
- // A client builds the url of one file the way BlobClient.createBlobUrl does, by putting the storage
16
- // file name of the attachment in the path and the token in the query string:
17
- //
18
- // resourceUrl + "/" + storage file name + "?" + sasToken
19
- //
20
- // The storage file name is derived from the attachment rather than sent - Attachment says how it is
21
- // built. The container is flat: every file sits directly under resourceUrl, so a storage file name
22
- // must never be turned into a path of its own.
23
- //
24
- // What the token grants is only what a storefront needs, and this is what a server must keep true
25
- // when it fills this in. CloudDb.createAttachmentSasUrl grants read, grants create only to a caller
26
- // with Right.ATTACHMENTS_MODIFY, and grants nothing else - no write, no delete, and no list, so
27
- // holding this cannot be used to enumerate the container. A storefront customer has none of those
28
- // rights and must be given the read only signature of the public container; the private container
29
- // requires attachment rights and must never be handed to a storefront.
30
- //
31
- // The token is a credential: anyone holding it can read the files of that container until it
32
- // expires, so it must not be logged. Unlike AuthTokens.userToken and BusinessLink.linkToken, which
33
- // must never appear in a url, this one is meant to be in a url - a browser fetching an image can
34
- // pass it no other way. It is safe there because it is scoped to one container, read only, and
10
+ // Build a file's url as resourceUrl + "/" + storage file name + "?" + sasToken (see Attachment for
11
+ // the storage file name). The token is a credential - do not log it - but unlike AuthTokens.userToken
12
+ // and BusinessLink.linkToken it is meant to go in a url: it is scoped to one container, read only and
35
13
  // short lived.
36
14
  message UrlAndToken {
37
15
 
38
- // The url of the container the files are in - Java UrlAndToken.mResourceUrl, serialized as "ru".
39
- // Always https, and never with a trailing slash or a query string of its own.
16
+ // The url of the container the files are in. Always https, never with a trailing slash or a query
17
+ // string of its own.
40
18
  string resourceUrl = 1;
41
19
 
42
- // The shared access signature that authorizes reading a file of that container, ready to use as a
43
- // query string ("sv=...&se=...&sig=...") and without the leading question mark - Java
44
- // UrlAndToken.mSasToken, serialized as "st". A client appends it as it is; it never parses or
45
- // rebuilds it.
20
+ // The shared access signature that authorizes reading a file, ready to use as a query string
21
+ // ("sv=...&se=...&sig=...", no leading "?"). Append it as-is; never parse or rebuild it.
46
22
  string sasToken = 2;
47
23
 
48
- // When the two fields above stop working, in milliseconds since Jan 1, 1970 UTC - Java
49
- // UrlAndToken.mExpiryUtcMillis, serialized as "ex". After this, every url built from them is
50
- // refused by storage, so a client stops using them and asks for new ones - see
51
- // BusinessSyncOutRequest.attachmentBaseUrlExpiry, which is where a client sends this value back.
52
- //
53
- // A client must treat this as reached Constants.ATTACHMENT_BASE_URL_EXPIRY_MARGIN before it
54
- // actually is, the way UrlAndTokenFetcher.isTokenInvalid does, so that a url it is about to build
55
- // cannot expire between building and fetching.
24
+ // When the fields above stop working, in milliseconds since Jan 1, 1970 UTC. Send this back as
25
+ // BusinessSyncOutRequest.attachmentBaseUrlExpiry. Treat it as expired
26
+ // Constants.ATTACHMENT_BASE_URL_EXPIRY_MARGIN early, so a url being built cannot expire before it
27
+ // is fetched.
56
28
  int64 expiry = 3;
57
29
  }
package/User.proto CHANGED
@@ -6,14 +6,9 @@ option java_package = "com.merabills.server.core.generated";
6
6
  import "AddressList.proto";
7
7
  import "Entity.proto";
8
8
 
9
- // A user of MeraBills. A customer of a business is represented by a User.
10
- //
11
- // A user lives in a profile database, not in a business database, so it is carried by a
12
- // ProfileSyncOutResponse and not by a BusinessSyncOutResponse, the way Java splits
13
- // Service.profileSyncOut from Service.businessSyncOut. Do not add it to the business sync out: a
14
- // client reads the caller once, by signing in, and then reads each business separately.
15
- //
16
- // Excluded: referralDetails, isCallingUser and all Translations fields.
9
+ // A user of MeraBills; a customer of a business is represented by one. Carried by a
10
+ // ProfileSyncOutResponse, not by a business sync out - a client reads the caller once, at sign in.
11
+ // Excluded: referralDetails, isCallingUser, all Translations fields.
17
12
  // Not included because it is derived: formattedName (firstName + " " + lastName).
18
13
  message User {
19
14
 
package/WorkingDays.proto CHANGED
@@ -10,17 +10,12 @@ import "WorkingHours.proto";
10
10
  // isOpenAt.
11
11
  message WorkingDays {
12
12
 
13
- // Up to Constants.DAYS_IN_WEEK values: index 0 is Sunday, 1 is Monday ... 6 is Saturday.
14
- // A value of true means the business works on that day. A missing value is false. An absent
15
- // WorkingDays means the business works on every day of the week, which is the Java default.
13
+ // Up to Constants.DAYS_IN_WEEK values, index 0 = Sunday. True means the business works that day;
14
+ // missing means false. An absent WorkingDays means every day is worked (the default).
16
15
  repeated bool days = 1;
17
16
 
18
- // The working hours of each day, indexed exactly as days above: entry 0 is Sunday. Up to
19
- // Constants.DAYS_IN_WEEK entries, and fewer - or none at all - is normal.
20
- //
21
- // An entry that is missing, or that is present with no ranges, means work goes on all day long on
22
- // that day. So an empty workingHours means the business works round the clock on each of its
23
- // working days. Hours are only meaningful on a day whose days entry is true; on any other day
24
- // they must be ignored.
17
+ // Working hours of each day, indexed as days above (entry 0 = Sunday); up to
18
+ // Constants.DAYS_IN_WEEK entries, fewer is normal. A missing entry, or one with no ranges, means
19
+ // work all day; only meaningful on a day whose days entry is true.
25
20
  repeated WorkingHours workingHours = 2;
26
21
  }
@@ -9,11 +9,7 @@ import "WorkingHoursRange.proto";
9
9
  // Not included because they are computed: rangeCount, isAllDay and contains.
10
10
  message WorkingHours {
11
11
 
12
- // The stretches of the day that are worked (at most Constants.WORKING_HOURS_MAX_RANGES). They do
13
- // not overlap, they are ordered by openMinute, and two of them never touch - a range closing
14
- // exactly when the next opens is sent as one unbroken range.
15
- //
16
- // No ranges at all means work goes on all day long, which is also what a range covering the whole
17
- // day would mean.
12
+ // Stretches worked in the day (at most Constants.WORKING_HOURS_MAX_RANGES): non-overlapping,
13
+ // ordered by openMinute, and merged when adjacent. No ranges means work goes on all day.
18
14
  repeated WorkingHoursRange ranges = 1;
19
15
  }
@@ -3,13 +3,11 @@ package com.merabills.storefront;
3
3
  option java_multiple_files = true;
4
4
  option java_package = "com.merabills.server.core.generated";
5
5
 
6
- // A single stretch of working hours within one day, in minutes after local midnight. The times are
7
- // local to the business, not UTC, and this protocol carries no time zone: a client that wants to
8
- // know whether the business is open now has to use the time zone of the business address.
9
- //
10
- // A range never spans midnight. Work that goes on past midnight is two ranges: one closing at
11
- // Constants.MINUTES_PER_DAY on one day, and one opening at 0 on the day after.
12
- // Not included because they are computed: isAllDay, contains and overlaps.
6
+ // A single stretch of working hours within a day, in minutes after local midnight (no time zone is
7
+ // carried - resolve using the business address's time zone).
8
+ // A range never spans midnight; work past midnight is two ranges - one closing at
9
+ // Constants.MINUTES_PER_DAY, one opening at 0 the next day.
10
+ // Not included because it is derived: isAllDay, contains, overlaps.
13
11
  message WorkingHoursRange {
14
12
 
15
13
  // Minute at which work starts, from 0 to Constants.MINUTES_PER_DAY - 1. This minute is worked.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@peabody-soft/mbs-protos",
3
- "version": "1.0.0",
3
+ "version": "1.2.0",
4
4
  "description": "The MeraBills shop wire protocol",
5
5
  "author": "Peabody Soft",
6
6
  "license": "AGPL-3.0-or-later",