@peabody-soft/mbs-protos 1.1.0 → 1.3.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/Attachment.proto +7 -21
- package/AuthTokens.proto +10 -32
- package/AuthenticationMethod.proto +2 -4
- package/Business.proto +5 -9
- package/BusinessLink.proto +14 -32
- package/BusinessSyncInRequest.proto +9 -29
- package/BusinessSyncInResponse.proto +13 -15
- package/BusinessSyncOutRequest.proto +19 -77
- package/BusinessSyncOutResponse.proto +29 -80
- package/Configuration.proto +4 -7
- package/Constants.proto +29 -59
- package/CreateUserRequest.proto +16 -0
- package/Entity.proto +13 -27
- package/GeneralSettings.proto +2 -3
- package/Item.proto +2 -4
- package/Message.proto +5 -7
- package/Package.proto +4 -6
- package/PartyPreferencesPayload.proto +1 -1
- package/Price.proto +3 -6
- package/PriceList.proto +4 -19
- package/Product.proto +4 -6
- package/ProductCategory.proto +2 -4
- package/ProfileSyncOutRequest.proto +10 -29
- package/ProfileSyncOutResponse.proto +13 -48
- package/ReservedPackage.proto +3 -15
- package/Role.proto +3 -12
- package/SalesOrderPayload.proto +3 -4
- package/ShoppingList.proto +6 -12
- package/ShoppingListItem.proto +5 -6
- package/UrlAndToken.proto +14 -42
- package/User.proto +3 -8
- package/WorkingDays.proto +5 -10
- package/WorkingHours.proto +2 -6
- package/WorkingHoursRange.proto +5 -7
- package/package.json +1 -1
package/Constants.proto
CHANGED
|
@@ -3,20 +3,15 @@ package com.merabills.storefront;
|
|
|
3
3
|
option java_multiple_files = true;
|
|
4
4
|
option java_package = "com.merabills.server.core.generated";
|
|
5
5
|
|
|
6
|
-
// The limits, scaling factors and other constants
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
//
|
|
12
|
-
//
|
|
13
|
-
//
|
|
14
|
-
//
|
|
15
|
-
// carry.
|
|
16
|
-
// - Entity.ID_MASK (0x00FFFFFFFFFFFFFF) and Entity.PARTITION_ID_MASK (0xFF00FFFFFFFFFFFF). Both
|
|
17
|
-
// are derived from the shifts below: ID_MASK is (1 << ENTITY_TYPE_BIT_SHIFT) - 1.
|
|
18
|
-
// - The Entity.NAME_* short codes ("id", "ua", "un", "cr", ...), which are strings, and which
|
|
19
|
-
// name fields of the Java JSON serialization rather than anything in this protocol.
|
|
6
|
+
// The limits, scaling factors and other constants this protocol's values obey, so a client can read
|
|
7
|
+
// them programmatically. Protobuf has no constants, so these are enum values named after the Java
|
|
8
|
+
// constant of the same meaning (allow_alias because several unrelated constants share a value); not
|
|
9
|
+
// the type of any field. Lengths are in characters and are maximums unless the name says otherwise;
|
|
10
|
+
// counts are maximums.
|
|
11
|
+
// Three kinds of Java constant don't fit a signed 32 bit enum value and are left out: Transaction.MAX_AMOUNT
|
|
12
|
+
// (17,592,186,044,415, the largest amount this protocol can carry), Entity.ID_MASK / PARTITION_ID_MASK
|
|
13
|
+
// (64 bit, derivable from the shifts below), and the Entity.NAME_* short codes (strings, not part of
|
|
14
|
+
// this protocol).
|
|
20
15
|
enum Constants {
|
|
21
16
|
|
|
22
17
|
option allow_alias = true;
|
|
@@ -117,23 +112,15 @@ enum Constants {
|
|
|
117
112
|
// means work stops at midnight (DateTimeHelper.MINUTES_PER_DAY)
|
|
118
113
|
MINUTES_PER_DAY = 1440;
|
|
119
114
|
|
|
120
|
-
//
|
|
121
|
-
//
|
|
122
|
-
// (t << ENTITY_TYPE_BIT_SHIFT) | n. Use 64 bit arithmetic - BigInt in TypeScript - for a shift.
|
|
115
|
+
// Layout of an Entity.id: top byte is the entity type, next byte is the partition id -
|
|
116
|
+
// id = (type << ENTITY_TYPE_BIT_SHIFT) | n. Use 64 bit arithmetic (BigInt in TypeScript) for the shift.
|
|
123
117
|
ENTITY_TYPE_BIT_SHIFT = 56;
|
|
124
118
|
PARTITION_ID_SHIFT = 48;
|
|
125
119
|
|
|
126
|
-
//
|
|
127
|
-
//
|
|
128
|
-
//
|
|
129
|
-
//
|
|
130
|
-
//
|
|
131
|
-
// The first three ids below belong to the profile database and the rest to a business database,
|
|
132
|
-
// which is what decides where each is read from: a ProfileSyncOutRequest has a cursor for USER,
|
|
133
|
-
// BUSINESS and BUSINESS_LINK, and a BusinessSyncOutRequest for ATTACHMENT, CONFIGURATION, MESSAGE
|
|
134
|
-
// and ITEM. BUSINESS is the one type both calls carry, because a client that has not signed in has
|
|
135
|
-
// no profile sync out to read it from; the two cursors over it are separate and must not be mixed.
|
|
136
|
-
// Ids of the profile types turn up in a business sync out even so - Message.senderId is a user id.
|
|
120
|
+
// Entity type ids used by this protocol: (id >> ENTITY_TYPE_BIT_SHIFT) is one of these; stable,
|
|
121
|
+
// never changed or reused. USER, BUSINESS and BUSINESS_LINK are profile-database types (read by a
|
|
122
|
+
// ProfileSyncOutRequest); the rest are business-database types (read by a BusinessSyncOutRequest).
|
|
123
|
+
// BUSINESS is read by both, with separate cursors that must not be mixed.
|
|
137
124
|
USER_ENTITY_TYPE_ID = 1;
|
|
138
125
|
BUSINESS_ENTITY_TYPE_ID = 2;
|
|
139
126
|
BUSINESS_LINK_ENTITY_TYPE_ID = 3;
|
|
@@ -147,9 +134,8 @@ enum Constants {
|
|
|
147
134
|
PRICE_ENTITY_TYPE_ID = 67;
|
|
148
135
|
PRICE_LIST_ENTITY_TYPE_ID = 68;
|
|
149
136
|
|
|
150
|
-
// The last two bits of Entity.updateNumber
|
|
151
|
-
//
|
|
152
|
-
// an incremental sync out is the only place a client sees one.
|
|
137
|
+
// The last two bits of Entity.updateNumber: updateNumber & UPDATE_TYPE_MASK is one of these.
|
|
138
|
+
// UPDATE_TYPE_DELETED marks a tombstone, seen only in an incremental sync out.
|
|
153
139
|
UPDATE_TYPE_MASK = 3;
|
|
154
140
|
UPDATE_TYPE_MAX_VALUE = 3;
|
|
155
141
|
UPDATE_TYPE_CREATED = 1;
|
|
@@ -162,24 +148,12 @@ enum Constants {
|
|
|
162
148
|
ENTITY_ID_UTILITIES = 1;
|
|
163
149
|
ENTITY_ID_UNASSIGNED = 255;
|
|
164
150
|
|
|
165
|
-
// The two price lists every business is created with (PriceList.DEFAULT_SALE_PRICE_LIST_ID
|
|
166
|
-
//
|
|
167
|
-
//
|
|
168
|
-
//
|
|
169
|
-
//
|
|
170
|
-
//
|
|
171
|
-
// low parts and a client builds each id as
|
|
172
|
-
//
|
|
173
|
-
// id = (PRICE_LIST_ENTITY_TYPE_ID << ENTITY_TYPE_BIT_SHIFT) | value
|
|
174
|
-
//
|
|
175
|
-
// using 64 bit arithmetic - BigInt in TypeScript. That gives 4899916394579099648 for the sale
|
|
176
|
-
// list and 4899916394579099649 for the purchase one (0x4400000000000000 and
|
|
177
|
-
// 0x4400000000000001).
|
|
178
|
-
//
|
|
179
|
-
// A storefront needs the sale one: it is the price list a business sells from unless it has been
|
|
180
|
-
// given another, and a client that pushes a shopping cart back has to put a price list id in
|
|
181
|
-
// ShoppingList.priceListId. The purchase list is here only so that a client can recognise the id
|
|
182
|
-
// and know that it is not a selling price; it is not public, so a storefront is never sent it.
|
|
151
|
+
// The two price lists every business is created with (PriceList.DEFAULT_SALE_PRICE_LIST_ID /
|
|
152
|
+
// DEFAULT_PURCHASE_PRICE_LIST_ID), well known rather than assigned. These are the low parts of a
|
|
153
|
+
// 64 bit id too big for an enum value: id = (PRICE_LIST_ENTITY_TYPE_ID << ENTITY_TYPE_BIT_SHIFT) |
|
|
154
|
+
// value, using 64 bit arithmetic. The sale list is what a business sells from unless given
|
|
155
|
+
// another, and what ShoppingList.priceListId must be set to when pushing a cart with none yet; the
|
|
156
|
+
// purchase list is not public and is never sent, but its id lets a client recognize and ignore it.
|
|
183
157
|
DEFAULT_SALE_PRICE_LIST = 0;
|
|
184
158
|
DEFAULT_PURCHASE_PRICE_LIST = 1;
|
|
185
159
|
|
|
@@ -192,20 +166,16 @@ enum Constants {
|
|
|
192
166
|
MAX_CLOCK_SKEW = 900000;
|
|
193
167
|
|
|
194
168
|
// How long before UrlAndToken.expiry the url and token of
|
|
195
|
-
// BusinessSyncOutResponse.attachmentBaseUrl must be treated as already expired, in milliseconds
|
|
196
|
-
//
|
|
197
|
-
// building and fetching, and a server renews them this early so that a client always has a working
|
|
198
|
-
// one - the margin UrlAndTokenFetcher.isTokenInvalid applies.
|
|
169
|
+
// BusinessSyncOutResponse.attachmentBaseUrl must be treated as already expired, in milliseconds -
|
|
170
|
+
// so a client stops using them, and the server renews them, before they actually run out.
|
|
199
171
|
ATTACHMENT_BASE_URL_EXPIRY_MARGIN = 300000;
|
|
200
172
|
|
|
201
|
-
// The database id of the server (Database.MASTER_DB_ID)
|
|
202
|
-
//
|
|
203
|
-
// client that keeps one has an id of its own that is never this.
|
|
173
|
+
// The database id of the server (Database.MASTER_DB_ID); what Entity.updateInfo holds for an
|
|
174
|
+
// entity the server itself last changed. Never a valid id for a client's own store.
|
|
204
175
|
MASTER_DB_ID = 0;
|
|
205
176
|
|
|
206
|
-
// Largest number of entities one sync out returns,
|
|
207
|
-
// (Database.SYNC_OUT_LIMIT).
|
|
208
|
-
// numbers it has just received, until it gets fewer.
|
|
177
|
+
// Largest number of entities one sync out returns, across all entity types together
|
|
178
|
+
// (Database.SYNC_OUT_LIMIT). That many means sync out again with the updated cursors.
|
|
209
179
|
SYNC_OUT_LIMIT = 5000;
|
|
210
180
|
|
|
211
181
|
// Entity.state and the Java attribute numbering of an entity. Neither the state nor the
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
package com.merabills.storefront;
|
|
3
|
+
option java_multiple_files = true;
|
|
4
|
+
option java_package = "com.merabills.server.core.generated";
|
|
5
|
+
|
|
6
|
+
import "User.proto";
|
|
7
|
+
|
|
8
|
+
// Creates a new user, optionally joining it to a business as a customer in the same call.
|
|
9
|
+
message CreateUserRequest {
|
|
10
|
+
|
|
11
|
+
// The user to create.
|
|
12
|
+
User user = 1;
|
|
13
|
+
|
|
14
|
+
// The business to join as a customer after creating the user. 0 means none.
|
|
15
|
+
int64 joinBusinessId = 2;
|
|
16
|
+
}
|
package/Entity.proto
CHANGED
|
@@ -4,42 +4,28 @@ option java_multiple_files = true;
|
|
|
4
4
|
option java_package = "com.merabills.server.core.generated";
|
|
5
5
|
|
|
6
6
|
// Base of most entities in the MeraBills data model.
|
|
7
|
-
// Excluded: propertyBag
|
|
8
|
-
// Not included because
|
|
9
|
-
//
|
|
10
|
-
// of updateNumber).
|
|
7
|
+
// Excluded: propertyBag, state.
|
|
8
|
+
// Not included because it is derived: partitionId and the entity type (top bits of id), updateType
|
|
9
|
+
// and isDeleted (bottom two bits of updateNumber).
|
|
11
10
|
message Entity {
|
|
12
11
|
|
|
13
|
-
// Globally unique id
|
|
14
|
-
//
|
|
15
|
-
// as a JavaScript number.
|
|
12
|
+
// Globally unique id; the most significant byte holds the entity type. Ids use the whole 64 bit
|
|
13
|
+
// range, so keep them as a string or big integer on the wire, never as a JavaScript number.
|
|
16
14
|
int64 id = 1;
|
|
17
15
|
|
|
18
|
-
// Last updated time, in milliseconds since Jan 1, 1970 00:00:00 UTC
|
|
16
|
+
// Last updated time, in milliseconds since Jan 1, 1970 00:00:00 UTC.
|
|
19
17
|
int64 updatedAt = 2;
|
|
20
18
|
|
|
21
|
-
// Id of the database
|
|
22
|
-
//
|
|
23
|
-
//
|
|
24
|
-
//
|
|
25
|
-
// This is what stops a sync echoing: a sync out compares this against
|
|
26
|
-
// BusinessSyncOutRequest.clientDatabaseId and does not return the changes that database itself
|
|
27
|
-
// made, on the assumption that it already has them. So a client sets this on every entity of a
|
|
28
|
-
// BusinessSyncInRequest, to the same id it sends as clientDatabaseId, and a sync in stores what
|
|
29
|
-
// arrives - unlike updateNumber, which the receiving database always replaces with one of its
|
|
30
|
-
// own. A client that leaves it Constants.MASTER_DB_ID is claiming the server made the change,
|
|
31
|
-
// and will be sent its own writes back on the next sync out.
|
|
32
|
-
//
|
|
33
|
-
// Only the entities of a business database carry one - the attachments, configurations, messages
|
|
34
|
-
// and items. It is 0 on the profile entities of this protocol (User, Business and BusinessLink),
|
|
35
|
-
// which are never stamped with it, because other profile entity types reuse this column for
|
|
36
|
-
// something else entirely.
|
|
19
|
+
// Id of the database that last updated this entity; Constants.MASTER_DB_ID means the server. A
|
|
20
|
+
// client stamps its own id here on every entity it pushes, so its own writes are not sent back to
|
|
21
|
+
// it on the next sync out. Only set on business-database entities (Attachment, Configuration,
|
|
22
|
+
// Message, Item); always 0 on the profile entities User, Business and BusinessLink.
|
|
37
23
|
int64 updateInfo = 3;
|
|
38
24
|
|
|
39
|
-
// Monotonically increasing update number
|
|
40
|
-
//
|
|
25
|
+
// Monotonically increasing update number, meaningful only within one database. The last two bits
|
|
26
|
+
// hold the update type (01 = created, 10 = modified, 11 = deleted).
|
|
41
27
|
int64 updateNumber = 4;
|
|
42
28
|
|
|
43
|
-
// Creation time, in milliseconds since Jan 1, 1970 00:00:00 UTC
|
|
29
|
+
// Creation time, in milliseconds since Jan 1, 1970 00:00:00 UTC.
|
|
44
30
|
int64 createdAt = 5;
|
|
45
31
|
}
|
package/GeneralSettings.proto
CHANGED
|
@@ -9,9 +9,8 @@ import "FulfillmentMode.proto";
|
|
|
9
9
|
import "PaymentMethodDetail.proto";
|
|
10
10
|
import "WorkingDays.proto";
|
|
11
11
|
|
|
12
|
-
// The publicly visible settings of a business
|
|
13
|
-
//
|
|
14
|
-
// Configuration entity of the business, and it arrives inside one.
|
|
12
|
+
// The publicly visible settings of a business - tagline, contact info, fulfillment and payment
|
|
13
|
+
// options - held in the value of the business's public Configuration entity.
|
|
15
14
|
// Excluded: onlineShoppingEnabled, and the fields of the StoreSettings base class (authToken,
|
|
16
15
|
// authTokenExpiry, lastSuccessfulSync and fees).
|
|
17
16
|
// Not included because it is a constant: overdueAfterMillis.
|
package/Item.proto
CHANGED
|
@@ -12,10 +12,8 @@ message Item {
|
|
|
12
12
|
Entity entity = 1;
|
|
13
13
|
|
|
14
14
|
// Id of the parent of this item - the category of a product, the product of a package, or the
|
|
15
|
-
// price list of a price - or 0 when
|
|
16
|
-
//
|
|
17
|
-
// id to get the products of each category, and the packages by this id to get the packages of
|
|
18
|
-
// each product.
|
|
15
|
+
// price list of a price - or 0 when it has none. A client rebuilds the catalog hierarchy by
|
|
16
|
+
// grouping items on this id, since nothing nests on the wire.
|
|
19
17
|
int64 parentItemId = 2;
|
|
20
18
|
|
|
21
19
|
bool isDisabled = 3;
|
package/Message.proto
CHANGED
|
@@ -9,17 +9,15 @@ import "PartyPreferencesPayload.proto";
|
|
|
9
9
|
import "SalesOrderPayload.proto";
|
|
10
10
|
import "TaskStatus.proto";
|
|
11
11
|
|
|
12
|
-
// A message sent to a business
|
|
13
|
-
//
|
|
14
|
-
//
|
|
15
|
-
// here. There is no payload for MONEY_TRANSFER messages in this protocol.
|
|
12
|
+
// A message sent to a business: an order (SalesOrderPayload) or a customer's shopping cart
|
|
13
|
+
// (PartyPreferencesPayload), typed here rather than left as the serialized string Java stores.
|
|
14
|
+
// MONEY_TRANSFER messages have no payload in this protocol.
|
|
16
15
|
message Message {
|
|
17
16
|
|
|
18
17
|
Entity entity = 1;
|
|
19
18
|
|
|
20
|
-
// Id of the
|
|
21
|
-
//
|
|
22
|
-
// id resolves it against a profile sync out, or against senderName and senderPhone below.
|
|
19
|
+
// Id of the User that sent this message. Not carried by a business sync out - resolve against a
|
|
20
|
+
// profile sync out, or use senderName / senderPhone below.
|
|
23
21
|
int64 senderId = 2;
|
|
24
22
|
|
|
25
23
|
MessageType messageType = 3;
|
package/Package.proto
CHANGED
|
@@ -8,12 +8,10 @@ import "Item.proto";
|
|
|
8
8
|
import "PackageIdentifier.proto";
|
|
9
9
|
import "Weight.proto";
|
|
10
10
|
|
|
11
|
-
// A package (or variant) of a product
|
|
12
|
-
//
|
|
13
|
-
//
|
|
14
|
-
//
|
|
15
|
-
// owningEntityId is this package.
|
|
16
|
-
// Excluded: isLowStockWarningEnabled, lowStockLevel, storeProperties and all Translations fields.
|
|
11
|
+
// A package (or variant) of a product - a 500 gram bottle of mango pickle, for example. Its product
|
|
12
|
+
// is Item.parentItemId; its prices are the Price entities whose packageId names it, and its photos
|
|
13
|
+
// are the Attachments whose owningEntityId names it.
|
|
14
|
+
// Excluded: isLowStockWarningEnabled, lowStockLevel, storeProperties, all Translations fields.
|
|
17
15
|
message Package {
|
|
18
16
|
|
|
19
17
|
// Base class - carries the Entity of this package
|
|
@@ -7,7 +7,7 @@ import "FulfillmentMode.proto";
|
|
|
7
7
|
import "ShoppingList.proto";
|
|
8
8
|
|
|
9
9
|
// The payload of a PARTY_PREFERENCES message: the preferences of a customer of a business,
|
|
10
|
-
// including their shopping cart.
|
|
10
|
+
// including their shopping cart.
|
|
11
11
|
// Excluded: serializedUserSettings.
|
|
12
12
|
message PartyPreferencesPayload {
|
|
13
13
|
|
package/Price.proto
CHANGED
|
@@ -6,17 +6,14 @@ option java_package = "com.merabills.server.core.generated";
|
|
|
6
6
|
import "Item.proto";
|
|
7
7
|
|
|
8
8
|
// The price of a package. Item.parentItemId is the id of the PriceList this price belongs to.
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
// Not included because it is derived: finalPrice, which is offerPrice when that is greater than
|
|
12
|
-
// zero and less than regularPrice, and regularPrice otherwise.
|
|
9
|
+
// Not included because it is derived: finalPrice (offerPrice when set and less than regularPrice,
|
|
10
|
+
// regularPrice otherwise).
|
|
13
11
|
message Price {
|
|
14
12
|
|
|
15
13
|
// Base class - carries the Entity of this price
|
|
16
14
|
Item item = 1;
|
|
17
15
|
|
|
18
|
-
// Id of the package this price applies to.
|
|
19
|
-
// client finds the prices of a package.
|
|
16
|
+
// Id of the package this price applies to.
|
|
20
17
|
int64 packageId = 2;
|
|
21
18
|
|
|
22
19
|
// The price the package is normally sold at, multiplied by Constants.AMOUNT_FACTOR
|
package/PriceList.proto
CHANGED
|
@@ -5,25 +5,10 @@ option java_package = "com.merabills.server.core.generated";
|
|
|
5
5
|
|
|
6
6
|
import "Item.proto";
|
|
7
7
|
|
|
8
|
-
// A named list of prices
|
|
9
|
-
// prices whose Item.parentItemId is this price list.
|
|
10
|
-
//
|
|
11
|
-
//
|
|
12
|
-
// A business keeps at least two, created on its first catalog load with the well known ids
|
|
13
|
-
// Constants.DEFAULT_SALE_PRICE_LIST and Constants.DEFAULT_PURCHASE_PRICE_LIST, and may have more.
|
|
14
|
-
// A storefront sells from exactly one of them and is sent only that one, so that no package ever
|
|
15
|
-
// arrives with two prices to choose between; every Price a client receives therefore belongs to
|
|
16
|
-
// the single price list it also receives.
|
|
17
|
-
//
|
|
18
|
-
// This is carried rather than left as the bare Item.parentItemId of a Price for two reasons: a
|
|
19
|
-
// price list has a name, and a client that pushes a shopping cart back has to name the price list
|
|
20
|
-
// its prices came from in ShoppingList.priceListId.
|
|
21
|
-
//
|
|
22
|
-
// Excluded: isPurchasePriceList, which says whether a list holds the prices the business buys at
|
|
23
|
-
// rather than sells at. A purchase price list is not public and its prices are of no use to a
|
|
24
|
-
// customer, so a storefront is never sent one and the flag would always be false (see the
|
|
25
|
-
// visibility flags, which are left out for the same reason). Java keeps it in the packed category
|
|
26
|
-
// short, which is never sent.
|
|
8
|
+
// A named list of prices; has no parent, so its own Item.parentItemId is 0. Contains nothing - its
|
|
9
|
+
// prices are the Price entities whose Item.parentItemId is this price list's id.
|
|
10
|
+
// Excluded: isPurchasePriceList - a purchase price list is never sent, so the flag would always be
|
|
11
|
+
// false.
|
|
27
12
|
message PriceList {
|
|
28
13
|
|
|
29
14
|
// Base class - carries the Entity of this price list
|
package/Product.proto
CHANGED
|
@@ -8,13 +8,11 @@ import "Item.proto";
|
|
|
8
8
|
import "ProductType.proto";
|
|
9
9
|
import "Tax.proto";
|
|
10
10
|
|
|
11
|
-
// A product (goods, service, raw material or fixed asset) in the catalog of a business.
|
|
12
|
-
//
|
|
13
|
-
//
|
|
14
|
-
// Item.parentItemId is this product, and its photos are the Attachments whose owningEntityId is
|
|
15
|
-
// this product.
|
|
11
|
+
// A product (goods, service, raw material or fixed asset) in the catalog of a business. Belongs to
|
|
12
|
+
// at most one category (Item.parentItemId, 0 = none); its packages and photos are found the same
|
|
13
|
+
// way, by parentItemId / owningEntityId.
|
|
16
14
|
// Excluded: isDraft, forOfflineSaleOnly, isStockKeepingEnabled, isExpiryTrackingEnabled,
|
|
17
|
-
// storeProperties, defaultExpiry, classifications
|
|
15
|
+
// storeProperties, defaultExpiry, classifications, all Translations fields.
|
|
18
16
|
message Product {
|
|
19
17
|
|
|
20
18
|
// Base class - carries the Entity of this product
|
package/ProductCategory.proto
CHANGED
|
@@ -5,10 +5,8 @@ option java_package = "com.merabills.server.core.generated";
|
|
|
5
5
|
|
|
6
6
|
import "Item.proto";
|
|
7
7
|
|
|
8
|
-
// A category that groups products of a catalog
|
|
9
|
-
//
|
|
10
|
-
// Item.parentItemId is this category. A product belongs to at most one category, and a product
|
|
11
|
-
// whose parentItemId is 0 belongs to none.
|
|
8
|
+
// A category that groups products of a catalog; its name is always set. Contains nothing - its
|
|
9
|
+
// products are those whose Item.parentItemId is this category's id (0 = none).
|
|
12
10
|
message ProductCategory {
|
|
13
11
|
|
|
14
12
|
// Base class - carries the Entity of this category
|
|
@@ -3,40 +3,21 @@ package com.merabills.storefront;
|
|
|
3
3
|
option java_multiple_files = true;
|
|
4
4
|
option java_package = "com.merabills.server.core.generated";
|
|
5
5
|
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
// Who is asking is not part of this message: it is in the AuthTokens of the authorization header. That
|
|
11
|
-
// is also why the request names no business - a profile is not scoped to one, and the response is what
|
|
12
|
-
// tells the caller which businesses exist for them.
|
|
13
|
-
//
|
|
14
|
-
// There is one cursor per entity type this reads, and they are exactly the three entity types that
|
|
15
|
-
// Java puts in a profile database (EntityType with DbType.PROFILE that this protocol carries): USER,
|
|
16
|
-
// BUSINESS and BUSINESS_LINK. A business database is read by a BusinessSyncOutRequest instead, and the
|
|
17
|
-
// two sets of cursors never mix - an update number is only comparable within one entity type, and only
|
|
18
|
-
// against the same database.
|
|
19
|
-
//
|
|
20
|
-
// Each cursor below is the highest Entity.updateNumber of that entity type that this client has
|
|
21
|
-
// already synced out. The server sends back the entities of that type whose updateNumber is greater,
|
|
22
|
-
// so a client stores the highest updateNumber it receives per type and sends it back on the next call.
|
|
23
|
-
// Zero, the default, means this client has nothing yet and asks for everything - signing in for the
|
|
24
|
-
// first time therefore leaves every cursor unset.
|
|
25
|
-
//
|
|
26
|
-
// Sync out is bounded: one call returns at most Constants.SYNC_OUT_LIMIT entities across all types
|
|
27
|
-
// together. On receiving that many, a client must call again with its updated cursors until it
|
|
28
|
-
// receives fewer.
|
|
6
|
+
// Signs an existing user in: returns the caller (from the AuthTokens of the authorization header),
|
|
7
|
+
// the businesses they are linked to, and those businesses. Incremental and bounded: each cursor is
|
|
8
|
+
// the highest Entity.updateNumber of that type already synced (0 asks for everything), and a
|
|
9
|
+
// response of Constants.SYNC_OUT_LIMIT entities means call again with the updated cursors.
|
|
29
10
|
message ProfileSyncOutRequest {
|
|
30
11
|
|
|
31
|
-
//
|
|
12
|
+
// Cursor for the caller's own User entity (Constants.USER_ENTITY_TYPE_ID).
|
|
32
13
|
int64 userUpdateNumber = 1;
|
|
33
14
|
|
|
34
|
-
//
|
|
35
|
-
// A Business is a profile database entity, which is why it is read here and not by a
|
|
36
|
-
// BusinessSyncOutRequest - that call returns the contents of one business, not the business itself.
|
|
15
|
+
// Cursor for the Business entities the caller is linked to (Constants.BUSINESS_ENTITY_TYPE_ID).
|
|
37
16
|
int64 businessUpdateNumber = 2;
|
|
38
17
|
|
|
39
|
-
//
|
|
40
|
-
// act against one of them - entity type Constants.BUSINESS_LINK_ENTITY_TYPE_ID
|
|
18
|
+
// Cursor for the caller's BusinessLink entities (Constants.BUSINESS_LINK_ENTITY_TYPE_ID).
|
|
41
19
|
int64 businessLinkUpdateNumber = 3;
|
|
20
|
+
|
|
21
|
+
// The business to join as a customer, if the caller is not already linked to it. 0 means none.
|
|
22
|
+
int64 joinBusinessId = 4;
|
|
42
23
|
}
|
|
@@ -3,62 +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
|
+
import "AuthTokens.proto";
|
|
6
7
|
import "Business.proto";
|
|
7
8
|
import "BusinessLink.proto";
|
|
8
9
|
import "User.proto";
|
|
9
10
|
|
|
10
|
-
// The answer to a ProfileSyncOutRequest: who the caller is,
|
|
11
|
-
// those businesses.
|
|
12
|
-
//
|
|
13
|
-
//
|
|
14
|
-
//
|
|
15
|
-
// This is the other half of the split the business sync messages leave open: a BusinessSyncOutResponse
|
|
16
|
-
// carries what is in a business database and therefore no User and no BusinessLink, and this carries
|
|
17
|
-
// what is in a profile database. Java splits them the same way, into Service.profileSyncOut and
|
|
18
|
-
// Service.businessSyncOut. A Business is a profile database entity and belongs here; it is also
|
|
19
|
-
// carried by a BusinessSyncOutResponse, so that a client that has not signed in can still learn the
|
|
20
|
-
// business it is showing.
|
|
21
|
-
//
|
|
22
|
-
// How a client uses it:
|
|
23
|
-
// 1. user who the caller is, and the addresses an order can be delivered to
|
|
24
|
-
// 2. businessLinks one per business the caller is linked to. Each names its business in
|
|
25
|
-
// BusinessLink.businessId and carries the BusinessLink.linkToken that goes into
|
|
26
|
-
// AuthTokens.linkToken of every later request about that business.
|
|
27
|
-
// 3. businesses the businesses those links name, so that a client can show the caller a list
|
|
28
|
-
// of shops without a call per shop. Match BusinessLink.businessId against
|
|
29
|
-
// Business.entity.id, not against Business.businessId.
|
|
30
|
-
// Nothing is nested, for the same reason nothing is nested in a business sync out: a link and the
|
|
31
|
-
// business it names change independently, so a tree could not say which of them a response is
|
|
32
|
-
// reporting.
|
|
33
|
-
//
|
|
34
|
-
// Every field is optional, as follows. A signed in caller whose profile has not changed gets a
|
|
35
|
-
// response with nothing in it at all, which is valid and means "nothing new".
|
|
36
|
-
// - user is a singular message field, so it has explicit presence: absent means the profile of the
|
|
37
|
-
// caller has not changed, not that there is no caller.
|
|
38
|
-
// - businessLinks and businesses are repeated, and a proto3 repeated field cannot be marked optional
|
|
39
|
-
// because it has no presence of its own. An empty array is the absent state, and means no link or
|
|
40
|
-
// no business has changed - it never means the caller has none. Only an arriving entity, or a
|
|
41
|
-
// tombstone, changes what a client holds.
|
|
42
|
-
//
|
|
43
|
-
// A tombstone works as it does in a business sync out: an entity whose
|
|
44
|
-
// (updateNumber & Constants.UPDATE_TYPE_MASK) equals Constants.UPDATE_TYPE_DELETED has been deleted,
|
|
45
|
-
// only its Entity is meaningful, and a deleted BusinessLink means the caller may no longer reach that
|
|
46
|
-
// business and its link token must be discarded.
|
|
47
|
-
//
|
|
48
|
-
// This sync out is incremental and bounded, exactly as the business one is: ProfileSyncOutRequest
|
|
49
|
-
// carries a cursor for each of the three entity types below, and one response returns at most
|
|
50
|
-
// Constants.SYNC_OUT_LIMIT entities across all three together. A client that receives that many
|
|
51
|
-
// raises each cursor to the highest updateNumber it has seen for that type and requests again, until
|
|
52
|
-
// it receives fewer. The response carries no cursors of its own: a client computes them from the
|
|
53
|
-
// entities it receives.
|
|
11
|
+
// The answer to a ProfileSyncOutRequest: who the caller is, the businesses they are linked to, and
|
|
12
|
+
// those businesses. Nothing is nested - match BusinessLink.businessId against Business.entity.id.
|
|
13
|
+
// Every field is absent/empty unless that type has changed; a tombstone (updateNumber's update-type
|
|
14
|
+
// bits = Constants.UPDATE_TYPE_DELETED) means the entity, and what it owned, was deleted.
|
|
54
15
|
message ProfileSyncOutResponse {
|
|
55
16
|
|
|
17
|
+
// The tokens to send with the next request, when the server has renewed one of them. Absent means
|
|
18
|
+
// what the client already holds still works - never a signal to drop the tokens it has.
|
|
19
|
+
optional AuthTokens authTokens = 1;
|
|
20
|
+
|
|
56
21
|
// The caller. Absent unless their own profile has changed.
|
|
57
|
-
User user =
|
|
22
|
+
User user = 2;
|
|
58
23
|
|
|
59
24
|
// The businesses the caller is linked to, and the token for each. Empty unless a link has changed.
|
|
60
|
-
repeated BusinessLink businessLinks =
|
|
25
|
+
repeated BusinessLink businessLinks = 3;
|
|
61
26
|
|
|
62
|
-
// The businesses
|
|
63
|
-
repeated Business businesses =
|
|
27
|
+
// The businesses those links name. Empty unless a business has changed.
|
|
28
|
+
repeated Business businesses = 4;
|
|
64
29
|
}
|
package/ReservedPackage.proto
CHANGED
|
@@ -3,21 +3,9 @@ package com.merabills.storefront;
|
|
|
3
3
|
option java_multiple_files = true;
|
|
4
4
|
option java_package = "com.merabills.server.core.generated";
|
|
5
5
|
|
|
6
|
-
// The packages reserved for the charge and summary lines of a shopping list
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
// A reserved package id does not fit in an enum value, which is 32 bits, so the value below is the
|
|
11
|
-
// low part of the id and a client builds the whole id as
|
|
12
|
-
//
|
|
13
|
-
// id = (Constants.PACKAGE_ENTITY_TYPE_ID << Constants.ENTITY_TYPE_BIT_SHIFT) | value
|
|
14
|
-
//
|
|
15
|
-
// using 64 bit arithmetic - BigInt in TypeScript. The four ids that produces are
|
|
16
|
-
// 4611686018427387904, 4611686018427387905, 4611686018427387906 and 4611686018427387907
|
|
17
|
-
// (0x4000000000000000 to 0x4000000000000003). Conversely, a packageId is a reserved package when
|
|
18
|
-
// its low 56 bits are less than or equal to SERVICE_CHARGE_PACKAGE.
|
|
19
|
-
//
|
|
20
|
-
// This is a carrier for constants, not the type of any field, so zero being a real value is safe.
|
|
6
|
+
// The packages reserved for the charge and summary lines of a shopping list; not catalog packages,
|
|
7
|
+
// so a client must label them itself. Each value is the low part of the actual 64 bit package id:
|
|
8
|
+
// id = (Constants.PACKAGE_ENTITY_TYPE_ID << Constants.ENTITY_TYPE_BIT_SHIFT) | value (BigInt math).
|
|
21
9
|
enum ReservedPackage {
|
|
22
10
|
|
|
23
11
|
// The total of the shopping list. Present only in a list a merchant has laid out for display;
|
package/Role.proto
CHANGED
|
@@ -3,18 +3,9 @@ package com.merabills.storefront;
|
|
|
3
3
|
option java_multiple_files = true;
|
|
4
4
|
option java_package = "com.merabills.server.core.generated";
|
|
5
5
|
|
|
6
|
-
// What an entity linked to a business may do with it
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
// and a role within that group, (groupId << 6) | roleId, so they are not consecutive: the group is
|
|
10
|
-
// the upper bits and, within a group, a higher value means fewer rights. The groups are
|
|
11
|
-
// 0 owner, 1 employee, 2 vendor, 3 customer, 4 partner and 63 other. A client that only needs to
|
|
12
|
-
// know which group a role is in can compute it as (role >> 6); a client that needs the actual rights
|
|
13
|
-
// cannot, because the rights are not on the wire.
|
|
14
|
-
//
|
|
15
|
-
// A storefront customer is normally CUSTOMER. The other values are here so that a role a storefront
|
|
16
|
-
// does not expect maps to a name rather than to a number, and so that the numbering cannot drift
|
|
17
|
-
// from Java by having gaps filled in later.
|
|
6
|
+
// What an entity linked to a business may do with it - the role of a BusinessLink. Values are
|
|
7
|
+
// computed ids ((groupId << 6) | roleId), not ordinals, and must never change; a client can recover
|
|
8
|
+
// the group with (role >> 6) but not the rights, which are not on the wire.
|
|
18
9
|
enum Role {
|
|
19
10
|
|
|
20
11
|
// Owner group. Only a user can be in one of these roles.
|
package/SalesOrderPayload.proto
CHANGED
|
@@ -7,10 +7,9 @@ import "FulfillmentMode.proto";
|
|
|
7
7
|
import "OrderStatus.proto";
|
|
8
8
|
import "ShoppingList.proto";
|
|
9
9
|
|
|
10
|
-
// The payload of a SALES_ORDER message: an order placed by a customer.
|
|
11
|
-
//
|
|
12
|
-
//
|
|
13
|
-
// whose parent is the income transaction of the order.
|
|
10
|
+
// The payload of a SALES_ORDER message: an order placed by a customer. Payments made against it are
|
|
11
|
+
// not part of this payload.
|
|
12
|
+
// Excluded: serviceStationNumber, dueDate.
|
|
14
13
|
message SalesOrderPayload {
|
|
15
14
|
|
|
16
15
|
OrderStatus status = 1;
|
package/ShoppingList.proto
CHANGED
|
@@ -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
|
|
12
|
-
//
|
|
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
|
|
32
|
-
//
|
|
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
|
|
37
|
-
//
|
|
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
|