@peabody-soft/mbs-model-ts 1.11.0 → 1.12.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/Ids.d.ts +1 -0
- package/dist/Ids.js +5 -3
- package/dist/Message.d.ts +1 -5
- package/dist/Message.js +2 -12
- package/dist/Model.d.ts +3 -3
- package/dist/Model.js +156 -102
- package/dist/Order.d.ts +2 -2
- package/dist/Order.js +4 -4
- package/dist/ProtoMap.d.ts +13 -4
- package/dist/ProtoMap.js +139 -71
- package/dist/Service.d.ts +3 -4
- package/dist/ServiceProxy.d.ts +3 -4
- package/dist/ServiceProxy.js +4 -6
- package/dist/SyncCache.d.ts +3 -1
- package/dist/SyncCache.js +46 -31
- package/dist/SyncKeys.js +3 -2
- package/dist/generated/BusinessSyncInRequest.d.ts +30 -16
- package/dist/generated/BusinessSyncInRequest.js +9 -1
- package/dist/generated/BusinessSyncInResponse.d.ts +9 -6
- package/dist/generated/Constants.d.ts +2 -12
- package/dist/generated/Constants.js +2 -12
- package/dist/generated/Message.d.ts +5 -16
- package/dist/generated/Message.js +8 -22
- package/dist/generated/Party.d.ts +52 -0
- package/dist/generated/Party.js +68 -0
- package/dist/generated/PartyPreferencesPayload.d.ts +2 -1
- package/dist/generated/ProfileSyncOutRequest.d.ts +2 -0
- package/dist/generated/ProfileSyncOutResponse.d.ts +2 -2
- package/dist/generated/SalesOrderPayload.d.ts +9 -8
- package/dist/generated/User.d.ts +3 -1
- package/dist/generated/UserRequest.d.ts +52 -0
- package/dist/generated/{CreateUserRequest.js → UserRequest.js} +11 -11
- package/package.json +2 -2
- package/dist/generated/CreateUserRequest.d.ts +0 -43
|
@@ -9,8 +9,8 @@ import { BusinessLink } from "./BusinessLink";
|
|
|
9
9
|
import { User } from "./User";
|
|
10
10
|
import { AuthTokens } from "./AuthTokens";
|
|
11
11
|
/**
|
|
12
|
-
* The answer to a ProfileSyncOutRequest: who the caller is, the businesses they are linked
|
|
13
|
-
* those businesses. Nothing is nested - match BusinessLink.businessId against Business.entity.id.
|
|
12
|
+
* The answer to a ProfileSyncOutRequest, and to a UserRequest, which carries one: who the caller is, the businesses they are linked
|
|
13
|
+
* to, and those businesses. Nothing is nested - match BusinessLink.businessId against Business.entity.id.
|
|
14
14
|
* Every field is absent/empty unless that type has changed. A tombstone (updateNumber's update-type
|
|
15
15
|
* bits = Constants.UPDATE_TYPE_DELETED) means the entity, and what it owned, was deleted.
|
|
16
16
|
*
|
|
@@ -10,10 +10,11 @@ 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, createdByParty
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* order that a storefront
|
|
13
|
+
* Excluded: serviceStationNumber, dueDate, createdByParty, and the flag that an operator's app sets in the
|
|
14
|
+
* packed category once it has checked the lines of the order against its catalog. createdByParty is true for
|
|
15
|
+
* an order that its party placed and not an operator of the business on its behalf. The server sets it on
|
|
16
|
+
* every order that a storefront sends. A storefront has no use for either flag, so neither is carried. An
|
|
17
|
+
* order that already exists is not written again, so the stored flags are kept.
|
|
17
18
|
*
|
|
18
19
|
* @generated from protobuf message com.merabills.storefront.SalesOrderPayload
|
|
19
20
|
*/
|
|
@@ -48,7 +49,8 @@ export interface SalesOrderPayload {
|
|
|
48
49
|
*/
|
|
49
50
|
shoppingListCount: number;
|
|
50
51
|
/**
|
|
51
|
-
* Id of the delivery address, in User.addresses of the customer
|
|
52
|
+
* Id of the delivery address, in User.addresses of the customer and in the addresses of the Party sent with the order (the merchant
|
|
53
|
+
* app finds the address there). 0 means no address.
|
|
52
54
|
*
|
|
53
55
|
* @generated from protobuf field: int64 deliveryAddressId = 6
|
|
54
56
|
*/
|
|
@@ -72,9 +74,8 @@ export interface SalesOrderPayload {
|
|
|
72
74
|
*/
|
|
73
75
|
note?: string;
|
|
74
76
|
/**
|
|
75
|
-
* Payment received towards this order so far. Can only be set by an operator of the business
|
|
76
|
-
*
|
|
77
|
-
* from whoever pushes the order, so sync in must refuse or drop it from a customer when it is written.
|
|
77
|
+
* Payment received towards this order so far. Can only be set by an operator of the business: an order
|
|
78
|
+
* that a customer sends with one is a 400.
|
|
78
79
|
*
|
|
79
80
|
* @generated from protobuf field: optional int64 paymentReceived = 10
|
|
80
81
|
*/
|
package/dist/generated/User.d.ts
CHANGED
|
@@ -9,7 +9,9 @@ import { Entity } from "./Entity";
|
|
|
9
9
|
/**
|
|
10
10
|
* A user of MeraBills; a customer of a business is represented by one. Carried by a
|
|
11
11
|
* ProfileSyncOutResponse, not by a business sync out - a client reads the caller once, at sign in.
|
|
12
|
-
*
|
|
12
|
+
* Also carried by a UserRequest, to create the caller's user or to update it. Only entity.id is read: it becomes the id of a new user,
|
|
13
|
+
* and matches the caller for an update.
|
|
14
|
+
* Excluded: referralDetails, isCallingUser, all Translations fields. An update keeps the ones the stored user has.
|
|
13
15
|
* Not included because it is derived: formattedName (firstName + " " + lastName).
|
|
14
16
|
*
|
|
15
17
|
* @generated from protobuf message com.merabills.storefront.User
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { BinaryWriteOptions } from "@protobuf-ts/runtime";
|
|
2
|
+
import type { IBinaryWriter } from "@protobuf-ts/runtime";
|
|
3
|
+
import type { BinaryReadOptions } from "@protobuf-ts/runtime";
|
|
4
|
+
import type { IBinaryReader } from "@protobuf-ts/runtime";
|
|
5
|
+
import type { PartialMessage } from "@protobuf-ts/runtime";
|
|
6
|
+
import { MessageType } from "@protobuf-ts/runtime";
|
|
7
|
+
import { ProfileSyncOutRequest } from "./ProfileSyncOutRequest";
|
|
8
|
+
import { User } from "./User";
|
|
9
|
+
/**
|
|
10
|
+
* The request of shop-create-user and shop-update-user. Both are answered with a ProfileSyncOutResponse. See Prompt.txt, CREATE USER
|
|
11
|
+
* AND UPDATE USER.
|
|
12
|
+
* The phone number of the user must be the one the authentication token verified (401). An invalid field is a 400.
|
|
13
|
+
*
|
|
14
|
+
* @generated from protobuf message com.merabills.storefront.UserRequest
|
|
15
|
+
*/
|
|
16
|
+
export interface UserRequest {
|
|
17
|
+
/**
|
|
18
|
+
* For shop-create-user, the user to create. The id of its entity is required and is the id of the new user: it has to be the id of a
|
|
19
|
+
* user, and not 0 or in the reserved range (400). The server sets the times, and reads nothing else of the entity.
|
|
20
|
+
* A 409 means the user was not created: the subject has a user, the id is taken, or the insert failed. The client reads its profile
|
|
21
|
+
* with shop-profile-sync-out, and creates again under a new id if the subject has no profile.
|
|
22
|
+
* For shop-update-user, the caller's own user with its new details: it is matched to the caller by entity.id (401 if it is not the
|
|
23
|
+
* caller's), and the rest of its entity is not read.
|
|
24
|
+
* A 409 means the update was not applied, for example because a change with a later time is stored (a device clock that is ahead, or
|
|
25
|
+
* two updates in the same millisecond). The client reads its profile and tries again.
|
|
26
|
+
*
|
|
27
|
+
* @generated from protobuf field: com.merabills.storefront.User user = 1
|
|
28
|
+
*/
|
|
29
|
+
user?: User;
|
|
30
|
+
/**
|
|
31
|
+
* The profile sync out that answers the call: the response carries what is newer than its cursors, as for shop-profile-sync-out.
|
|
32
|
+
* Absent is the same as all cursors at 0 and no business to join.
|
|
33
|
+
* joinBusinessId joins a business as a customer after a create. 0 means none, and anything else has to be the id of a business: one
|
|
34
|
+
* that is not is a 400, checked before the user is created. One that cannot be joined is refused as
|
|
35
|
+
* ProfileSyncOutRequest.joinBusinessId says - a 404, and the user is created all the same.
|
|
36
|
+
* An update joins no business, so a joinBusinessId that is not 0 is a 400, and nothing is changed.
|
|
37
|
+
*
|
|
38
|
+
* @generated from protobuf field: com.merabills.storefront.ProfileSyncOutRequest profileSyncOutRequest = 2
|
|
39
|
+
*/
|
|
40
|
+
profileSyncOutRequest?: ProfileSyncOutRequest;
|
|
41
|
+
}
|
|
42
|
+
declare class UserRequest$Type extends MessageType<UserRequest> {
|
|
43
|
+
constructor();
|
|
44
|
+
create(value?: PartialMessage<UserRequest>): UserRequest;
|
|
45
|
+
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: UserRequest): UserRequest;
|
|
46
|
+
internalBinaryWrite(message: UserRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* @generated MessageType for protobuf message com.merabills.storefront.UserRequest
|
|
50
|
+
*/
|
|
51
|
+
export declare const UserRequest: UserRequest$Type;
|
|
52
|
+
export {};
|
|
@@ -2,18 +2,18 @@ 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 { ProfileSyncOutRequest } from "./ProfileSyncOutRequest";
|
|
5
6
|
import { User } from "./User";
|
|
6
7
|
// @generated message type with reflection information, may provide speed optimized methods
|
|
7
|
-
class
|
|
8
|
+
class UserRequest$Type extends MessageType {
|
|
8
9
|
constructor() {
|
|
9
|
-
super("com.merabills.storefront.
|
|
10
|
+
super("com.merabills.storefront.UserRequest", [
|
|
10
11
|
{ no: 1, name: "user", kind: "message", T: () => User },
|
|
11
|
-
{ no: 2, name: "
|
|
12
|
+
{ no: 2, name: "profileSyncOutRequest", kind: "message", T: () => ProfileSyncOutRequest }
|
|
12
13
|
]);
|
|
13
14
|
}
|
|
14
15
|
create(value) {
|
|
15
16
|
const message = globalThis.Object.create((this.messagePrototype));
|
|
16
|
-
message.joinBusinessId = 0n;
|
|
17
17
|
if (value !== undefined)
|
|
18
18
|
reflectionMergePartial(this, message, value);
|
|
19
19
|
return message;
|
|
@@ -26,8 +26,8 @@ class CreateUserRequest$Type extends MessageType {
|
|
|
26
26
|
case /* com.merabills.storefront.User user */ 1:
|
|
27
27
|
message.user = User.internalBinaryRead(reader, reader.uint32(), options, message.user);
|
|
28
28
|
break;
|
|
29
|
-
case /*
|
|
30
|
-
message.
|
|
29
|
+
case /* com.merabills.storefront.ProfileSyncOutRequest profileSyncOutRequest */ 2:
|
|
30
|
+
message.profileSyncOutRequest = ProfileSyncOutRequest.internalBinaryRead(reader, reader.uint32(), options, message.profileSyncOutRequest);
|
|
31
31
|
break;
|
|
32
32
|
default:
|
|
33
33
|
let u = options.readUnknownField;
|
|
@@ -44,9 +44,9 @@ class CreateUserRequest$Type extends MessageType {
|
|
|
44
44
|
/* com.merabills.storefront.User user = 1; */
|
|
45
45
|
if (message.user)
|
|
46
46
|
User.internalBinaryWrite(message.user, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
|
|
47
|
-
/*
|
|
48
|
-
if (message.
|
|
49
|
-
writer.tag(2, WireType.
|
|
47
|
+
/* com.merabills.storefront.ProfileSyncOutRequest profileSyncOutRequest = 2; */
|
|
48
|
+
if (message.profileSyncOutRequest)
|
|
49
|
+
ProfileSyncOutRequest.internalBinaryWrite(message.profileSyncOutRequest, writer.tag(2, WireType.LengthDelimited).fork(), options).join();
|
|
50
50
|
let u = options.writeUnknownFields;
|
|
51
51
|
if (u !== false)
|
|
52
52
|
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
@@ -54,6 +54,6 @@ class CreateUserRequest$Type extends MessageType {
|
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
/**
|
|
57
|
-
* @generated MessageType for protobuf message com.merabills.storefront.
|
|
57
|
+
* @generated MessageType for protobuf message com.merabills.storefront.UserRequest
|
|
58
58
|
*/
|
|
59
|
-
export const
|
|
59
|
+
export const UserRequest = new UserRequest$Type();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@peabody-soft/mbs-model-ts",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.12.0",
|
|
4
4
|
"description": "MeraBills storefront client-side model (TypeScript)",
|
|
5
5
|
"author": "Peabody Soft",
|
|
6
6
|
"license": "AGPL-3.0-or-later",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"typescript": "^7.0.2"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@peabody-soft/mbs-protos": "^1.
|
|
52
|
+
"@peabody-soft/mbs-protos": "^1.15.0",
|
|
53
53
|
"@protobuf-ts/runtime": "^2.11.1"
|
|
54
54
|
}
|
|
55
55
|
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import type { BinaryWriteOptions } from "@protobuf-ts/runtime";
|
|
2
|
-
import type { IBinaryWriter } from "@protobuf-ts/runtime";
|
|
3
|
-
import type { BinaryReadOptions } from "@protobuf-ts/runtime";
|
|
4
|
-
import type { IBinaryReader } from "@protobuf-ts/runtime";
|
|
5
|
-
import type { PartialMessage } from "@protobuf-ts/runtime";
|
|
6
|
-
import { MessageType } from "@protobuf-ts/runtime";
|
|
7
|
-
import { User } from "./User";
|
|
8
|
-
/**
|
|
9
|
-
* Creates a new user, optionally joining it to a business as a customer in the same call, and is
|
|
10
|
-
* answered with a ProfileSyncOutResponse. Not implemented yet: the route (shopCreateUser) answers 501, and
|
|
11
|
-
* every rule below is the contract that it is to meet, and not behaviour that the server has. See
|
|
12
|
-
* Prompt.txt, CREATE USER AND UPDATE USER, which also gives the contract of the route that updates the
|
|
13
|
-
* caller's own user (its request is a bare User, matched to the caller by entity.id).
|
|
14
|
-
*
|
|
15
|
-
* @generated from protobuf message com.merabills.storefront.CreateUserRequest
|
|
16
|
-
*/
|
|
17
|
-
export interface CreateUserRequest {
|
|
18
|
-
/**
|
|
19
|
-
* The user to create.
|
|
20
|
-
*
|
|
21
|
-
* @generated from protobuf field: com.merabills.storefront.User user = 1
|
|
22
|
-
*/
|
|
23
|
-
user?: User;
|
|
24
|
-
/**
|
|
25
|
-
* The business to join as a customer after creating the user. 0 means none, and anything else has to be
|
|
26
|
-
* the id of a business: one that is not is refused, not ignored. One that cannot be joined is to be refused
|
|
27
|
-
* as ProfileSyncOutRequest.joinBusinessId says - a 404, and the user is created all the same.
|
|
28
|
-
*
|
|
29
|
-
* @generated from protobuf field: int64 joinBusinessId = 2
|
|
30
|
-
*/
|
|
31
|
-
joinBusinessId: bigint;
|
|
32
|
-
}
|
|
33
|
-
declare class CreateUserRequest$Type extends MessageType<CreateUserRequest> {
|
|
34
|
-
constructor();
|
|
35
|
-
create(value?: PartialMessage<CreateUserRequest>): CreateUserRequest;
|
|
36
|
-
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: CreateUserRequest): CreateUserRequest;
|
|
37
|
-
internalBinaryWrite(message: CreateUserRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* @generated MessageType for protobuf message com.merabills.storefront.CreateUserRequest
|
|
41
|
-
*/
|
|
42
|
-
export declare const CreateUserRequest: CreateUserRequest$Type;
|
|
43
|
-
export {};
|