@marleena/trb-proto 1.0.8 → 1.0.20

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/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 Анатолий
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Анатолий
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,64 +1,69 @@
1
- # TrB proto
2
-
3
- Контракты сервисов и сгенерированный код:
4
-
5
- - Go — `gen/go`
6
- - JavaScript / TypeScript (protobuf + gRPC-Web) — npm-пакет [`@marleena/trb-proto`](https://www.npmjs.com/package/@marleena/trb-proto)
7
-
8
- ## Генерация
9
-
10
- Нужны `protoc` и плагины: `protoc-gen-go`, `protoc-gen-go-grpc`, `protoc-gen-grpc-gateway`, `protoc-gen-js`, `protoc-gen-grpc-web`.
11
-
12
- ```bash
13
- make gene
14
- ```
15
-
16
- Собирает Go, JS/TS и descriptor set. Google API-аннотации для JS генерируются отдельно, чтобы не попасть в `gen/go`.
17
-
18
- Другие цели: `make desc`, `make buf`.
19
-
20
- ## npm
21
-
22
- ```bash
23
- npm install @marleena/trb-proto
24
- ```
25
-
26
- ```ts
27
- import { MessageRequest } from '@marleena/trb-proto/example/Example_pb';
28
- import { exampleClient } from '@marleena/trb-proto/example/ExampleServiceClientPb';
29
-
30
- const client = new exampleClient('https://api.example.com');
31
- const req = new MessageRequest();
32
- req.setText('hello');
33
- ```
34
-
35
- Сервисы: `example`, `tinvest`, `moex`, `clickhouse` (native gRPC), `manager_indicators`, `api/nats`, `api/clickhouse`, `api/db_api`, `api/test`.
36
-
37
- `api/clickhouse` (`trb.clickhouse.manager.public.contract.v1.ClickHouseManager`) — DDL: базы, таблицы, колонки. Запросы — `clickhouse.grpc.ClickHouse`, прикладные выборки — `api/db_api`.
38
-
39
- `api/db_api` (`trb.db.api.public.contract.v1.DbApi`) — gRPC API веб-клиента к ClickHouse и Postgres. Новый метод добавляется RPC-ом в `services/api/db_api/db_api.proto`.
40
-
41
- ## Релиз
42
-
43
- Одна команда: коммит (если указан `MSG`), новая версия и тег, push в GitHub, публикация npm.
44
-
45
- ```bash
46
- make gene
47
- make release PART=patch MSG="add ClickHouse manager" OTP=123456
48
- ```
49
-
50
- `PART`: `patch` (0.1.30.1.4), `minor` (0.2.0), `major` (1.0.0).
51
-
52
- Если изменения уже закоммичены:
53
-
54
- ```bash
55
- make release PART=patch OTP=123456
56
- ```
57
-
58
- Через token вместо OTP: `TOKEN=npm_...` (сначала `make logout`).
59
-
60
- Только npm, без тега и push:
61
-
62
- ```bash
63
- make publish OTP=123456
64
- ```
1
+ # TrB proto
2
+
3
+ Контракты сервисов и сгенерированный код:
4
+
5
+ - Go — `gen/go`
6
+ - JavaScript / TypeScript (protobuf + gRPC-Web) — npm-пакет [`@marleena/trb-proto`](https://www.npmjs.com/package/@marleena/trb-proto)
7
+
8
+ ## Генерация
9
+
10
+ Нужны `protoc` и плагины: `protoc-gen-go`, `protoc-gen-go-grpc`, `protoc-gen-grpc-gateway`, `protoc-gen-js`, `protoc-gen-grpc-web`.
11
+
12
+ ```bash
13
+ make gene
14
+ ```
15
+
16
+ Собирает Go, JS/TS и descriptor set. Google API-аннотации для JS генерируются отдельно, чтобы не попасть в `gen/go`.
17
+
18
+ Другие цели: `make desc`, `make buf`.
19
+
20
+ ## npm
21
+
22
+ ```bash
23
+ npm install @marleena/trb-proto
24
+ ```
25
+
26
+ ```ts
27
+ import { MessageRequest } from '@marleena/trb-proto/example/Example_pb';
28
+ import { exampleClient } from '@marleena/trb-proto/example/ExampleServiceClientPb';
29
+
30
+ const client = new exampleClient('https://api.example.com');
31
+ const req = new MessageRequest();
32
+ req.setText('hello');
33
+ ```
34
+
35
+ Сервисы: `example`, `tinvest`, `moex`, `clickhouse` (native gRPC), `manager_indicators`, `api/nats`, `api/clickhouse`, `api/db_api`, `api/test`.
36
+
37
+ `api/clickhouse` (`trb.clickhouse.manager.public.contract.v1.ClickHouseManager`) — DDL: базы, таблицы, колонки. Запросы — `clickhouse.grpc.ClickHouse`, прикладные выборки — `api/db_api`.
38
+
39
+ `api/db_api` (`trb.db.api.public.contract.v1.DbApi`) — gRPC API веб-клиента к ClickHouse и Postgres. Новый метод добавляется RPC-ом в `services/api/db_api/db_api.proto`.
40
+
41
+ ## CI/CD
42
+
43
+ Один workflow [Release](.github/workflows/release.yml): при коммите в `main` с сообщением `v1.2.3`
44
+
45
+ - публикует `@marleena/trb-proto` в npm;
46
+ - просит [pkg.go.dev](https://pkg.go.dev/github.com/Mar1eena/trb_proto) проиндексировать `github.com/Mar1eena/trb_proto@v1.2.3` (для этого пушится git-тег той же версии).
47
+
48
+ Публикация в npm через [Trusted Publishing](https://docs.npmjs.com/trusted-publishers/) (OIDC, без `NPM_TOKEN`).
49
+
50
+ На [npmjs.com](https://www.npmjs.com)пакет `@marleena/trb-proto` **Settings** → **Trusted Publisher** → GitHub Actions:
51
+
52
+ - Organization or user: `Mar1eena`
53
+ - Repository: `TrB_proto`
54
+ - Workflow filename: `release.yml`
55
+ - Allowed actions: `npm publish`
56
+
57
+ После успешного релиза токен в GitHub можно удалить. Сообщение коммита должно совпадать с версией в `package.json`.
58
+
59
+ ## Релиз
60
+
61
+ ```bash
62
+ make rel
63
+ ```
64
+
65
+ Собирает proto, поднимает patch-версию, коммитит все изменения с сообщением `v1.2.3` и пушит в `main`. Actions публикует npm и обновляет pkg.go.dev.
66
+
67
+ Другой шаг версии: `make rel PART=minor` или `PART=major`.
68
+
69
+ Для коммита нужны `user.name` и `user.email` в Git.
@@ -61,9 +61,6 @@ export class InstrumentListItem extends jspb.Message {
61
61
  hasShare(): boolean;
62
62
  clearShare(): InstrumentListItem;
63
63
 
64
- getActual(): boolean;
65
- setActual(value: boolean): InstrumentListItem;
66
-
67
64
  getVersion(): google_protobuf_timestamp_pb.Timestamp | undefined;
68
65
  setVersion(value?: google_protobuf_timestamp_pb.Timestamp): InstrumentListItem;
69
66
  hasVersion(): boolean;
@@ -83,7 +80,6 @@ export class InstrumentListItem extends jspb.Message {
83
80
  export namespace InstrumentListItem {
84
81
  export type AsObject = {
85
82
  share?: tinvest_instruments_pb.Share.AsObject,
86
- actual: boolean,
87
83
  version?: google_protobuf_timestamp_pb.Timestamp.AsObject,
88
84
  versionCount: number,
89
85
  }
@@ -133,9 +129,6 @@ export class InstrumentVersion extends jspb.Message {
133
129
  hasShare(): boolean;
134
130
  clearShare(): InstrumentVersion;
135
131
 
136
- getActual(): boolean;
137
- setActual(value: boolean): InstrumentVersion;
138
-
139
132
  getVersion(): google_protobuf_timestamp_pb.Timestamp | undefined;
140
133
  setVersion(value?: google_protobuf_timestamp_pb.Timestamp): InstrumentVersion;
141
134
  hasVersion(): boolean;
@@ -152,7 +145,6 @@ export class InstrumentVersion extends jspb.Message {
152
145
  export namespace InstrumentVersion {
153
146
  export type AsObject = {
154
147
  share?: tinvest_instruments_pb.Share.AsObject,
155
- actual: boolean,
156
148
  version?: google_protobuf_timestamp_pb.Timestamp.AsObject,
157
149
  }
158
150
  }
@@ -805,9 +805,8 @@ proto.trb.db.api.public.contract.v1.InstrumentListItem.prototype.toObject = func
805
805
  proto.trb.db.api.public.contract.v1.InstrumentListItem.toObject = function(includeInstance, msg) {
806
806
  var f, obj = {
807
807
  share: (f = msg.getShare()) && tinvest_instruments_pb.Share.toObject(includeInstance, f),
808
- actual: jspb.Message.getBooleanFieldWithDefault(msg, 2, false),
809
808
  version: (f = msg.getVersion()) && google_protobuf_timestamp_pb.Timestamp.toObject(includeInstance, f),
810
- versionCount: jspb.Message.getFieldWithDefault(msg, 4, 0)
809
+ versionCount: jspb.Message.getFieldWithDefault(msg, 3, 0)
811
810
  };
812
811
 
813
812
  if (includeInstance) {
@@ -850,15 +849,11 @@ proto.trb.db.api.public.contract.v1.InstrumentListItem.deserializeBinaryFromRead
850
849
  msg.setShare(value);
851
850
  break;
852
851
  case 2:
853
- var value = /** @type {boolean} */ (reader.readBool());
854
- msg.setActual(value);
855
- break;
856
- case 3:
857
852
  var value = new google_protobuf_timestamp_pb.Timestamp;
858
853
  reader.readMessage(value,google_protobuf_timestamp_pb.Timestamp.deserializeBinaryFromReader);
859
854
  msg.setVersion(value);
860
855
  break;
861
- case 4:
856
+ case 3:
862
857
  var value = /** @type {number} */ (reader.readInt32());
863
858
  msg.setVersionCount(value);
864
859
  break;
@@ -899,17 +894,10 @@ proto.trb.db.api.public.contract.v1.InstrumentListItem.serializeBinaryToWriter =
899
894
  tinvest_instruments_pb.Share.serializeBinaryToWriter
900
895
  );
901
896
  }
902
- f = message.getActual();
903
- if (f) {
904
- writer.writeBool(
905
- 2,
906
- f
907
- );
908
- }
909
897
  f = message.getVersion();
910
898
  if (f != null) {
911
899
  writer.writeMessage(
912
- 3,
900
+ 2,
913
901
  f,
914
902
  google_protobuf_timestamp_pb.Timestamp.serializeBinaryToWriter
915
903
  );
@@ -917,7 +905,7 @@ proto.trb.db.api.public.contract.v1.InstrumentListItem.serializeBinaryToWriter =
917
905
  f = message.getVersionCount();
918
906
  if (f !== 0) {
919
907
  writer.writeInt32(
920
- 4,
908
+ 3,
921
909
  f
922
910
  );
923
911
  }
@@ -962,30 +950,12 @@ proto.trb.db.api.public.contract.v1.InstrumentListItem.prototype.hasShare = func
962
950
 
963
951
 
964
952
  /**
965
- * optional bool actual = 2;
966
- * @return {boolean}
967
- */
968
- proto.trb.db.api.public.contract.v1.InstrumentListItem.prototype.getActual = function() {
969
- return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false));
970
- };
971
-
972
-
973
- /**
974
- * @param {boolean} value
975
- * @return {!proto.trb.db.api.public.contract.v1.InstrumentListItem} returns this
976
- */
977
- proto.trb.db.api.public.contract.v1.InstrumentListItem.prototype.setActual = function(value) {
978
- return jspb.Message.setProto3BooleanField(this, 2, value);
979
- };
980
-
981
-
982
- /**
983
- * optional google.protobuf.Timestamp version = 3;
953
+ * optional google.protobuf.Timestamp version = 2;
984
954
  * @return {?proto.google.protobuf.Timestamp}
985
955
  */
986
956
  proto.trb.db.api.public.contract.v1.InstrumentListItem.prototype.getVersion = function() {
987
957
  return /** @type{?proto.google.protobuf.Timestamp} */ (
988
- jspb.Message.getWrapperField(this, google_protobuf_timestamp_pb.Timestamp, 3));
958
+ jspb.Message.getWrapperField(this, google_protobuf_timestamp_pb.Timestamp, 2));
989
959
  };
990
960
 
991
961
 
@@ -994,7 +964,7 @@ proto.trb.db.api.public.contract.v1.InstrumentListItem.prototype.getVersion = fu
994
964
  * @return {!proto.trb.db.api.public.contract.v1.InstrumentListItem} returns this
995
965
  */
996
966
  proto.trb.db.api.public.contract.v1.InstrumentListItem.prototype.setVersion = function(value) {
997
- return jspb.Message.setWrapperField(this, 3, value);
967
+ return jspb.Message.setWrapperField(this, 2, value);
998
968
  };
999
969
 
1000
970
 
@@ -1012,16 +982,16 @@ proto.trb.db.api.public.contract.v1.InstrumentListItem.prototype.clearVersion =
1012
982
  * @return {boolean}
1013
983
  */
1014
984
  proto.trb.db.api.public.contract.v1.InstrumentListItem.prototype.hasVersion = function() {
1015
- return jspb.Message.getField(this, 3) != null;
985
+ return jspb.Message.getField(this, 2) != null;
1016
986
  };
1017
987
 
1018
988
 
1019
989
  /**
1020
- * optional int32 version_count = 4;
990
+ * optional int32 version_count = 3;
1021
991
  * @return {number}
1022
992
  */
1023
993
  proto.trb.db.api.public.contract.v1.InstrumentListItem.prototype.getVersionCount = function() {
1024
- return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0));
994
+ return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0));
1025
995
  };
1026
996
 
1027
997
 
@@ -1030,7 +1000,7 @@ proto.trb.db.api.public.contract.v1.InstrumentListItem.prototype.getVersionCount
1030
1000
  * @return {!proto.trb.db.api.public.contract.v1.InstrumentListItem} returns this
1031
1001
  */
1032
1002
  proto.trb.db.api.public.contract.v1.InstrumentListItem.prototype.setVersionCount = function(value) {
1033
- return jspb.Message.setProto3IntField(this, 4, value);
1003
+ return jspb.Message.setProto3IntField(this, 3, value);
1034
1004
  };
1035
1005
 
1036
1006
 
@@ -1357,7 +1327,6 @@ proto.trb.db.api.public.contract.v1.InstrumentVersion.prototype.toObject = funct
1357
1327
  proto.trb.db.api.public.contract.v1.InstrumentVersion.toObject = function(includeInstance, msg) {
1358
1328
  var f, obj = {
1359
1329
  share: (f = msg.getShare()) && tinvest_instruments_pb.Share.toObject(includeInstance, f),
1360
- actual: jspb.Message.getBooleanFieldWithDefault(msg, 2, false),
1361
1330
  version: (f = msg.getVersion()) && google_protobuf_timestamp_pb.Timestamp.toObject(includeInstance, f)
1362
1331
  };
1363
1332
 
@@ -1401,10 +1370,6 @@ proto.trb.db.api.public.contract.v1.InstrumentVersion.deserializeBinaryFromReade
1401
1370
  msg.setShare(value);
1402
1371
  break;
1403
1372
  case 2:
1404
- var value = /** @type {boolean} */ (reader.readBool());
1405
- msg.setActual(value);
1406
- break;
1407
- case 3:
1408
1373
  var value = new google_protobuf_timestamp_pb.Timestamp;
1409
1374
  reader.readMessage(value,google_protobuf_timestamp_pb.Timestamp.deserializeBinaryFromReader);
1410
1375
  msg.setVersion(value);
@@ -1446,17 +1411,10 @@ proto.trb.db.api.public.contract.v1.InstrumentVersion.serializeBinaryToWriter =
1446
1411
  tinvest_instruments_pb.Share.serializeBinaryToWriter
1447
1412
  );
1448
1413
  }
1449
- f = message.getActual();
1450
- if (f) {
1451
- writer.writeBool(
1452
- 2,
1453
- f
1454
- );
1455
- }
1456
1414
  f = message.getVersion();
1457
1415
  if (f != null) {
1458
1416
  writer.writeMessage(
1459
- 3,
1417
+ 2,
1460
1418
  f,
1461
1419
  google_protobuf_timestamp_pb.Timestamp.serializeBinaryToWriter
1462
1420
  );
@@ -1502,30 +1460,12 @@ proto.trb.db.api.public.contract.v1.InstrumentVersion.prototype.hasShare = funct
1502
1460
 
1503
1461
 
1504
1462
  /**
1505
- * optional bool actual = 2;
1506
- * @return {boolean}
1507
- */
1508
- proto.trb.db.api.public.contract.v1.InstrumentVersion.prototype.getActual = function() {
1509
- return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false));
1510
- };
1511
-
1512
-
1513
- /**
1514
- * @param {boolean} value
1515
- * @return {!proto.trb.db.api.public.contract.v1.InstrumentVersion} returns this
1516
- */
1517
- proto.trb.db.api.public.contract.v1.InstrumentVersion.prototype.setActual = function(value) {
1518
- return jspb.Message.setProto3BooleanField(this, 2, value);
1519
- };
1520
-
1521
-
1522
- /**
1523
- * optional google.protobuf.Timestamp version = 3;
1463
+ * optional google.protobuf.Timestamp version = 2;
1524
1464
  * @return {?proto.google.protobuf.Timestamp}
1525
1465
  */
1526
1466
  proto.trb.db.api.public.contract.v1.InstrumentVersion.prototype.getVersion = function() {
1527
1467
  return /** @type{?proto.google.protobuf.Timestamp} */ (
1528
- jspb.Message.getWrapperField(this, google_protobuf_timestamp_pb.Timestamp, 3));
1468
+ jspb.Message.getWrapperField(this, google_protobuf_timestamp_pb.Timestamp, 2));
1529
1469
  };
1530
1470
 
1531
1471
 
@@ -1534,7 +1474,7 @@ proto.trb.db.api.public.contract.v1.InstrumentVersion.prototype.getVersion = fun
1534
1474
  * @return {!proto.trb.db.api.public.contract.v1.InstrumentVersion} returns this
1535
1475
  */
1536
1476
  proto.trb.db.api.public.contract.v1.InstrumentVersion.prototype.setVersion = function(value) {
1537
- return jspb.Message.setWrapperField(this, 3, value);
1477
+ return jspb.Message.setWrapperField(this, 2, value);
1538
1478
  };
1539
1479
 
1540
1480
 
@@ -1552,7 +1492,7 @@ proto.trb.db.api.public.contract.v1.InstrumentVersion.prototype.clearVersion = f
1552
1492
  * @return {boolean}
1553
1493
  */
1554
1494
  proto.trb.db.api.public.contract.v1.InstrumentVersion.prototype.hasVersion = function() {
1555
- return jspb.Message.getField(this, 3) != null;
1495
+ return jspb.Message.getField(this, 2) != null;
1556
1496
  };
1557
1497
 
1558
1498
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marleena/trb-proto",
3
- "version": "v1.0.8",
3
+ "version": "1.0.20",
4
4
  "description": "Generated protobuf messages and gRPC-Web clients for TrB services",
5
5
  "license": "MIT",
6
6
  "repository": {