@peabody-soft/mbs-model-ts 1.4.0 → 1.5.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.
Files changed (61) hide show
  1. package/dist/CartEditor.d.ts +10 -5
  2. package/dist/CartEditor.js +232 -125
  3. package/dist/Catalog.js +26 -18
  4. package/dist/Enums.d.ts +1 -1
  5. package/dist/Enums.js +2 -1
  6. package/dist/GeneralSettings.d.ts +4 -2
  7. package/dist/GeneralSettings.js +18 -7
  8. package/dist/Ids.d.ts +2 -0
  9. package/dist/Ids.js +10 -0
  10. package/dist/Message.js +3 -2
  11. package/dist/Model.d.ts +5 -0
  12. package/dist/Model.js +263 -50
  13. package/dist/Package.js +2 -2
  14. package/dist/Price.js +6 -2
  15. package/dist/Product.d.ts +5 -3
  16. package/dist/Product.js +30 -18
  17. package/dist/Profile.d.ts +1 -0
  18. package/dist/Profile.js +91 -4
  19. package/dist/ProtoMap.d.ts +15 -8
  20. package/dist/ProtoMap.js +265 -139
  21. package/dist/ShoppingList.d.ts +30 -1
  22. package/dist/ShoppingList.js +345 -35
  23. package/dist/SyncCache.d.ts +9 -0
  24. package/dist/SyncCache.js +93 -30
  25. package/dist/SyncState.js +1 -1
  26. package/dist/Tax.d.ts +12 -4
  27. package/dist/Tax.js +33 -4
  28. package/dist/TaxHelper.d.ts +12 -0
  29. package/dist/TaxHelper.js +93 -0
  30. package/dist/TaxType.d.ts +7 -0
  31. package/dist/TaxType.js +32 -0
  32. package/dist/generated/AttachmentType.d.ts +19 -1
  33. package/dist/generated/AttachmentType.js +18 -0
  34. package/dist/generated/AuthTokens.d.ts +3 -1
  35. package/dist/generated/BusinessLink.d.ts +4 -1
  36. package/dist/generated/BusinessSyncInRequest.d.ts +11 -3
  37. package/dist/generated/BusinessSyncInResponse.d.ts +5 -4
  38. package/dist/generated/BusinessSyncOutRequest.d.ts +37 -10
  39. package/dist/generated/BusinessSyncOutRequest.js +42 -29
  40. package/dist/generated/BusinessSyncOutResponse.d.ts +14 -1
  41. package/dist/generated/Configuration.d.ts +2 -1
  42. package/dist/generated/CreateUserRequest.d.ts +8 -2
  43. package/dist/generated/Entity.d.ts +7 -3
  44. package/dist/generated/GeneralSettings.d.ts +14 -4
  45. package/dist/generated/GeneralSettings.js +9 -1
  46. package/dist/generated/Message.d.ts +4 -2
  47. package/dist/generated/Product.d.ts +10 -1
  48. package/dist/generated/Product.js +9 -1
  49. package/dist/generated/ProfileSyncOutRequest.d.ts +17 -1
  50. package/dist/generated/ProfileSyncOutResponse.d.ts +8 -3
  51. package/dist/generated/SalesOrderPayload.d.ts +7 -2
  52. package/dist/generated/ShoppingList.d.ts +6 -3
  53. package/dist/generated/ShoppingListItem.d.ts +21 -6
  54. package/dist/generated/Tax.d.ts +4 -4
  55. package/dist/generated/Tax.js +7 -8
  56. package/dist/generated/WorkingHoursRange.d.ts +2 -2
  57. package/dist/index.d.ts +2 -2
  58. package/dist/index.js +4 -3
  59. package/package.json +55 -55
  60. package/dist/generated/TaxType.d.ts +0 -25
  61. package/dist/generated/TaxType.js +0 -30
@@ -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: "type", kind: "enum", T: () => ["com.merabills.storefront.TaxType", TaxType] },
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.type = 0;
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 /* com.merabills.storefront.TaxType type */ 1:
28
- message.type = reader.int32();
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
- /* com.merabills.storefront.TaxType type = 1; */
46
- if (message.type !== 0)
47
- writer.tag(1, WireType.Varint).int32(message.type);
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 (no time zone is
9
- * carried - resolve using the business address's time zone).
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,6 +1,7 @@
1
1
  // The public surface of this library. Deliberately 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
- // and the scaled-value conversions of Constants.ts (amounts, quantities and tax rates are already unscaled on every getter; ProtoMap is the only caller that needs to convert one).
3
+ // the scaled-value conversions of Constants.ts (amounts, quantities and tax rates are already unscaled on every getter; ProtoMap is the only caller that needs to convert one),
4
+ // and TaxHelper, the tax arithmetic, which works in those scaled values (a UI reads a tax off a ShoppingListItem, a ShoppingList or a CartLine, which have done it already).
4
5
  export { default as Model } from "./Model";
5
6
  export * as ContainerNames from "./ContainerNames";
6
7
  export { buildAuthTokensBytes } from "./ProtoMap";
@@ -40,8 +41,8 @@ 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
48
  // storefront sells from is on the surface because a UI naming it on a cart it is building needs
package/package.json CHANGED
@@ -1,55 +1,55 @@
1
- {
2
- "name": "@peabody-soft/mbs-model-ts",
3
- "version": "1.4.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.10.0",
53
- "@protobuf-ts/runtime": "^2.11.1"
54
- }
55
- }
1
+ {
2
+ "name": "@peabody-soft/mbs-model-ts",
3
+ "version": "1.5.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 = {}));