@miteradar/contracts 1.0.4 → 1.1.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.
@@ -0,0 +1,107 @@
1
+ import { Observable } from "rxjs";
2
+ import { Timestamp } from "./google/protobuf/timestamp";
3
+ export declare const protobufPackage = "bites.v1";
4
+ export declare enum HumanGenders {
5
+ HUMAN_FEMALE = 0,
6
+ HUMAN_MALE = 1,
7
+ UNRECOGNIZED = -1
8
+ }
9
+ export declare enum MiteGenders {
10
+ UNKNOWN = 0,
11
+ FEMALE = 1,
12
+ MALE = 2,
13
+ NYMPH = 3,
14
+ LARVA = 4,
15
+ UNRECOGNIZED = -1
16
+ }
17
+ export interface CreateBiteRequest {
18
+ code: string;
19
+ requestDate: Timestamp | undefined;
20
+ biteDate?: Timestamp | undefined;
21
+ longitude: number;
22
+ latitude: number;
23
+ isVerified?: boolean | undefined;
24
+ districtId: string;
25
+ placeId: string;
26
+ materialId: string;
27
+ patientSex?: HumanGenders | undefined;
28
+ patientAge?: number | undefined;
29
+ patientResidence?: string | undefined;
30
+ miteTbePositive?: boolean | undefined;
31
+ miteBorreliosisPositive?: boolean | undefined;
32
+ miteEhrlichiosisPositive?: boolean | undefined;
33
+ miteAnaplasmosisPositive?: boolean | undefined;
34
+ miteRickettsiosisPositive?: boolean | undefined;
35
+ miteRelapsingFeverPositive?: boolean | undefined;
36
+ isInCity?: boolean | undefined;
37
+ miteId?: string | undefined;
38
+ miteSex?: MiteGenders | undefined;
39
+ bloodTbePositive?: boolean | undefined;
40
+ bloodBorreliosisPositive?: boolean | undefined;
41
+ bloodEhrlichiosisPositive?: boolean | undefined;
42
+ bloodAnaplasmosisPositive?: boolean | undefined;
43
+ bloodRickettsiosisPositive?: boolean | undefined;
44
+ bloodRelapsingFeverPositive?: boolean | undefined;
45
+ bloodTbeAntigenSerum?: boolean | undefined;
46
+ circumstances?: string | undefined;
47
+ noticeLab?: string | undefined;
48
+ }
49
+ export interface GetBiteRequest {
50
+ id: string;
51
+ }
52
+ export interface ListBitesRequest {
53
+ }
54
+ export interface BiteResponse {
55
+ bite: Bite | undefined;
56
+ }
57
+ export interface ListBitesResponse {
58
+ bites: Bite[];
59
+ }
60
+ export interface Bite {
61
+ id: string;
62
+ code: number;
63
+ requestDate: Timestamp | undefined;
64
+ biteDate?: Timestamp | undefined;
65
+ longitude: number;
66
+ latitude: number;
67
+ isVerified: boolean;
68
+ districtId: string;
69
+ placeId: string;
70
+ materialId: string;
71
+ patientSex?: HumanGenders | undefined;
72
+ patientAge?: number | undefined;
73
+ patientResidence: string;
74
+ miteTbePositive?: boolean | undefined;
75
+ miteBorreliosisPositive?: boolean | undefined;
76
+ miteEhrlichiosisPositive?: boolean | undefined;
77
+ miteAnaplasmosisPositive?: boolean | undefined;
78
+ miteRickettsiosisPositive?: boolean | undefined;
79
+ miteRelapsingFeverPositive?: boolean | undefined;
80
+ isInCity?: boolean | undefined;
81
+ miteId?: string | undefined;
82
+ miteSex: MiteGenders;
83
+ bloodTbePositive?: boolean | undefined;
84
+ bloodBorreliosisPositive?: boolean | undefined;
85
+ bloodEhrlichiosisPositive?: boolean | undefined;
86
+ bloodAnaplasmosisPositive?: boolean | undefined;
87
+ bloodRickettsiosisPositive?: boolean | undefined;
88
+ bloodRelapsingFeverPositive?: boolean | undefined;
89
+ bloodTbeAntigenSerum?: boolean | undefined;
90
+ circumstances: string;
91
+ noticeLab: string;
92
+ updatedAt: Timestamp | undefined;
93
+ createdAt: Timestamp | undefined;
94
+ }
95
+ export declare const BITES_V1_PACKAGE_NAME = "bites.v1";
96
+ export interface BiteServiceClient {
97
+ createBite(request: CreateBiteRequest): Observable<BiteResponse>;
98
+ getBite(request: GetBiteRequest): Observable<BiteResponse>;
99
+ listBites(request: ListBitesRequest): Observable<ListBitesResponse>;
100
+ }
101
+ export interface BiteServiceController {
102
+ createBite(request: CreateBiteRequest): Promise<BiteResponse> | Observable<BiteResponse> | BiteResponse;
103
+ getBite(request: GetBiteRequest): Promise<BiteResponse> | Observable<BiteResponse> | BiteResponse;
104
+ listBites(request: ListBitesRequest): Promise<ListBitesResponse> | Observable<ListBitesResponse> | ListBitesResponse;
105
+ }
106
+ export declare function BiteServiceControllerMethods(): (constructor: Function) => void;
107
+ export declare const BITE_SERVICE_NAME = "BiteService";
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
3
+ // versions:
4
+ // protoc-gen-ts_proto v2.11.6
5
+ // protoc v6.33.2
6
+ // source: bite.proto
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.BITE_SERVICE_NAME = exports.BITES_V1_PACKAGE_NAME = exports.MiteGenders = exports.HumanGenders = exports.protobufPackage = void 0;
9
+ exports.BiteServiceControllerMethods = BiteServiceControllerMethods;
10
+ /* eslint-disable */
11
+ const microservices_1 = require("@nestjs/microservices");
12
+ exports.protobufPackage = "bites.v1";
13
+ var HumanGenders;
14
+ (function (HumanGenders) {
15
+ HumanGenders[HumanGenders["HUMAN_FEMALE"] = 0] = "HUMAN_FEMALE";
16
+ HumanGenders[HumanGenders["HUMAN_MALE"] = 1] = "HUMAN_MALE";
17
+ HumanGenders[HumanGenders["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
18
+ })(HumanGenders || (exports.HumanGenders = HumanGenders = {}));
19
+ var MiteGenders;
20
+ (function (MiteGenders) {
21
+ MiteGenders[MiteGenders["UNKNOWN"] = 0] = "UNKNOWN";
22
+ MiteGenders[MiteGenders["FEMALE"] = 1] = "FEMALE";
23
+ MiteGenders[MiteGenders["MALE"] = 2] = "MALE";
24
+ MiteGenders[MiteGenders["NYMPH"] = 3] = "NYMPH";
25
+ MiteGenders[MiteGenders["LARVA"] = 4] = "LARVA";
26
+ MiteGenders[MiteGenders["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
27
+ })(MiteGenders || (exports.MiteGenders = MiteGenders = {}));
28
+ exports.BITES_V1_PACKAGE_NAME = "bites.v1";
29
+ function BiteServiceControllerMethods() {
30
+ return function (constructor) {
31
+ const grpcMethods = ["createBite", "getBite", "listBites"];
32
+ for (const method of grpcMethods) {
33
+ const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
34
+ (0, microservices_1.GrpcMethod)("BiteService", method)(constructor.prototype[method], method, descriptor);
35
+ }
36
+ const grpcStreamMethods = [];
37
+ for (const method of grpcStreamMethods) {
38
+ const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
39
+ (0, microservices_1.GrpcStreamMethod)("BiteService", method)(constructor.prototype[method], method, descriptor);
40
+ }
41
+ };
42
+ }
43
+ exports.BITE_SERVICE_NAME = "BiteService";
@@ -0,0 +1,109 @@
1
+ export declare const protobufPackage = "google.protobuf";
2
+ /**
3
+ * A Timestamp represents a point in time independent of any time zone or local
4
+ * calendar, encoded as a count of seconds and fractions of seconds at
5
+ * nanosecond resolution. The count is relative to an epoch at UTC midnight on
6
+ * January 1, 1970, in the proleptic Gregorian calendar which extends the
7
+ * Gregorian calendar backwards to year one.
8
+ *
9
+ * All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap
10
+ * second table is needed for interpretation, using a [24-hour linear
11
+ * smear](https://developers.google.com/time/smear).
12
+ *
13
+ * The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By
14
+ * restricting to that range, we ensure that we can convert to and from [RFC
15
+ * 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.
16
+ *
17
+ * # Examples
18
+ *
19
+ * Example 1: Compute Timestamp from POSIX `time()`.
20
+ *
21
+ * Timestamp timestamp;
22
+ * timestamp.set_seconds(time(NULL));
23
+ * timestamp.set_nanos(0);
24
+ *
25
+ * Example 2: Compute Timestamp from POSIX `gettimeofday()`.
26
+ *
27
+ * struct timeval tv;
28
+ * gettimeofday(&tv, NULL);
29
+ *
30
+ * Timestamp timestamp;
31
+ * timestamp.set_seconds(tv.tv_sec);
32
+ * timestamp.set_nanos(tv.tv_usec * 1000);
33
+ *
34
+ * Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
35
+ *
36
+ * FILETIME ft;
37
+ * GetSystemTimeAsFileTime(&ft);
38
+ * UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
39
+ *
40
+ * // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
41
+ * // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
42
+ * Timestamp timestamp;
43
+ * timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
44
+ * timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
45
+ *
46
+ * Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
47
+ *
48
+ * long millis = System.currentTimeMillis();
49
+ *
50
+ * Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
51
+ * .setNanos((int) ((millis % 1000) * 1000000)).build();
52
+ *
53
+ * Example 5: Compute Timestamp from Java `Instant.now()`.
54
+ *
55
+ * Instant now = Instant.now();
56
+ *
57
+ * Timestamp timestamp =
58
+ * Timestamp.newBuilder().setSeconds(now.getEpochSecond())
59
+ * .setNanos(now.getNano()).build();
60
+ *
61
+ * Example 6: Compute Timestamp from current time in Python.
62
+ *
63
+ * timestamp = Timestamp()
64
+ * timestamp.GetCurrentTime()
65
+ *
66
+ * # JSON Mapping
67
+ *
68
+ * In JSON format, the Timestamp type is encoded as a string in the
69
+ * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
70
+ * format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z"
71
+ * where {year} is always expressed using four digits while {month}, {day},
72
+ * {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
73
+ * seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
74
+ * are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
75
+ * is required. A proto3 JSON serializer should always use UTC (as indicated by
76
+ * "Z") when printing the Timestamp type and a proto3 JSON parser should be
77
+ * able to accept both UTC and other timezones (as indicated by an offset).
78
+ *
79
+ * For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
80
+ * 01:30 UTC on January 15, 2017.
81
+ *
82
+ * In JavaScript, one can convert a Date object to this format using the
83
+ * standard
84
+ * [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
85
+ * method. In Python, a standard `datetime.datetime` object can be converted
86
+ * to this format using
87
+ * [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with
88
+ * the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
89
+ * the Joda Time's [`ISODateTimeFormat.dateTime()`](
90
+ * http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime()
91
+ * ) to obtain a formatter capable of generating timestamps in this format.
92
+ */
93
+ export interface Timestamp {
94
+ /**
95
+ * Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must
96
+ * be between -315576000000 and 315576000000 inclusive (which corresponds to
97
+ * 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z).
98
+ */
99
+ seconds: number;
100
+ /**
101
+ * Non-negative fractions of a second at nanosecond resolution. This field is
102
+ * the nanosecond portion of the duration, not an alternative to seconds.
103
+ * Negative second values with fractions must still have non-negative nanos
104
+ * values that count forward in time. Must be between 0 and 999,999,999
105
+ * inclusive.
106
+ */
107
+ nanos: number;
108
+ }
109
+ export declare const GOOGLE_PROTOBUF_PACKAGE_NAME = "google.protobuf";
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
3
+ // versions:
4
+ // protoc-gen-ts_proto v2.11.6
5
+ // protoc v6.33.2
6
+ // source: google/protobuf/timestamp.proto
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.GOOGLE_PROTOBUF_PACKAGE_NAME = exports.protobufPackage = void 0;
9
+ /* eslint-disable */
10
+ exports.protobufPackage = "google.protobuf";
11
+ exports.GOOGLE_PROTOBUF_PACKAGE_NAME = "google.protobuf";
package/dist/index.d.ts CHANGED
@@ -1,2 +1 @@
1
1
  export * from './proto';
2
- export * from './gen';
package/dist/index.js CHANGED
@@ -15,4 +15,3 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./proto"), exports);
18
- __exportStar(require("./gen"), exports);
@@ -0,0 +1,122 @@
1
+ syntax = "proto3";
2
+
3
+ package bites.v1;
4
+
5
+ import "google/protobuf/timestamp.proto";
6
+
7
+ service BiteService {
8
+ rpc CreateBite(CreateBiteRequest) returns (BiteResponse);
9
+ rpc GetBite(GetBiteRequest) returns (BiteResponse);
10
+ rpc ListBites(ListBitesRequest) returns (ListBitesResponse);
11
+ }
12
+
13
+ message CreateBiteRequest {
14
+ string code = 1;
15
+ google.protobuf.Timestamp request_date = 2;
16
+ optional google.protobuf.Timestamp bite_date = 3;
17
+
18
+ float longitude = 4;
19
+ float latitude = 5;
20
+
21
+ optional bool is_verified = 6;
22
+ string district_id = 7;
23
+ string place_id = 8;
24
+ string material_id = 9;
25
+
26
+ optional HumanGenders patient_sex = 10;
27
+ optional int32 patient_age = 11;
28
+ optional string patient_residence = 12;
29
+
30
+ optional bool mite_tbe_positive = 13;
31
+ optional bool mite_borreliosis_positive = 14;
32
+ optional bool mite_ehrlichiosis_positive = 15;
33
+ optional bool mite_anaplasmosis_positive = 16;
34
+ optional bool mite_rickettsiosis_positive = 17;
35
+ optional bool mite_relapsing_fever_positive = 18;
36
+ optional bool is_in_city = 19;
37
+ optional string mite_id = 20;
38
+ optional MiteGenders mite_sex = 21;
39
+
40
+ optional bool blood_tbe_positive = 22;
41
+ optional bool blood_borreliosis_positive = 23;
42
+ optional bool blood_ehrlichiosis_positive = 24;
43
+ optional bool blood_anaplasmosis_positive = 25;
44
+ optional bool blood_rickettsiosis_positive = 26;
45
+ optional bool blood_relapsing_fever_positive = 27;
46
+ optional bool blood_tbe_antigen_serum = 28;
47
+
48
+ optional string circumstances = 29;
49
+ optional string notice_lab = 30;
50
+ }
51
+
52
+ message GetBiteRequest {
53
+ string id = 1;
54
+ }
55
+
56
+ message ListBitesRequest {
57
+
58
+ }
59
+
60
+ message BiteResponse {
61
+ Bite bite = 1;
62
+ }
63
+
64
+ message ListBitesResponse {
65
+ repeated Bite bites = 1;
66
+ }
67
+
68
+ message Bite {
69
+ string id = 1;
70
+ int32 code = 2;
71
+ google.protobuf.Timestamp request_date = 3;
72
+ optional google.protobuf.Timestamp bite_date = 4;
73
+
74
+ double longitude = 5;
75
+ double latitude = 6;
76
+
77
+ bool is_verified = 7;
78
+ string district_id = 8;
79
+ string place_id = 9;
80
+ string material_id = 10;
81
+
82
+ optional HumanGenders patient_sex = 11;
83
+ optional int32 patient_age = 12;
84
+ string patient_residence = 13;
85
+
86
+ optional bool mite_tbe_positive = 14;
87
+ optional bool mite_borreliosis_positive = 15;
88
+ optional bool mite_ehrlichiosis_positive = 16;
89
+ optional bool mite_anaplasmosis_positive = 17;
90
+ optional bool mite_rickettsiosis_positive = 18;
91
+ optional bool mite_relapsing_fever_positive = 19;
92
+ optional bool is_in_city = 20;
93
+ optional string mite_id = 21;
94
+ MiteGenders mite_sex = 22;
95
+
96
+ optional bool blood_tbe_positive = 23;
97
+ optional bool blood_borreliosis_positive = 24;
98
+ optional bool blood_ehrlichiosis_positive = 25;
99
+ optional bool blood_anaplasmosis_positive = 26;
100
+ optional bool blood_rickettsiosis_positive = 27;
101
+ optional bool blood_relapsing_fever_positive = 28;
102
+ optional bool blood_tbe_antigen_serum = 29;
103
+
104
+ string circumstances = 30;
105
+ string notice_lab = 31;
106
+
107
+ google.protobuf.Timestamp updated_at = 32;
108
+ google.protobuf.Timestamp created_at = 33;
109
+ }
110
+
111
+ enum HumanGenders {
112
+ HUMAN_FEMALE = 0;
113
+ HUMAN_MALE = 1;
114
+ }
115
+
116
+ enum MiteGenders {
117
+ UNKNOWN = 0;
118
+ FEMALE = 1;
119
+ MALE = 2;
120
+ NYMPH = 3;
121
+ LARVA = 4;
122
+ }
@@ -1,3 +1,4 @@
1
1
  export declare const PROTO_PATHS: {
2
2
  readonly AUTH: string;
3
+ readonly BITE: string;
3
4
  };
@@ -3,5 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PROTO_PATHS = void 0;
4
4
  const node_path_1 = require("node:path");
5
5
  exports.PROTO_PATHS = {
6
- AUTH: (0, node_path_1.join)(__dirname, '../../proto/auth.proto'),
6
+ AUTH: (0, node_path_1.join)(__dirname, './contracts/auth.proto'),
7
+ BITE: (0, node_path_1.join)(__dirname, './contracts/bite.proto')
7
8
  };
package/package.json CHANGED
@@ -1,21 +1,16 @@
1
1
  {
2
2
  "name": "@miteradar/contracts",
3
- "version": "1.0.4",
3
+ "version": "1.1.0",
4
4
  "description": "Protobuf definitions and generated ts types",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
7
7
  "scripts": {
8
- "generate": "protoc -I ./proto ./proto/*.proto --ts_proto_out=./src/gen --ts_proto_opt=nestJs=true,package=omit",
9
- "build": "tsc -p tsconfig.build.json"
8
+ "generate": "mkdir -p ./lib/gen && protoc -I ./lib/proto/contracts ./lib/proto/contracts/*.proto --ts_proto_out=./lib/gen --ts_proto_opt=nestJs=true,package=omit",
9
+ "build": "tsc -p tsconfig.build.json && npx cpy 'lib/proto/**/*.proto' 'dist/proto' --parents"
10
10
  },
11
11
  "files": [
12
- "proto",
13
12
  "dist"
14
13
  ],
15
- "exports": {
16
- ".": "./dist/index.js",
17
- "./gen/*": "./dist/gen/*"
18
- },
19
14
  "publishConfig": {
20
15
  "access": "public"
21
16
  },
@@ -26,6 +21,7 @@
26
21
  },
27
22
  "devDependencies": {
28
23
  "@types/node": "^25.6.0",
24
+ "cpy-cli": "^7.0.0",
29
25
  "typescript": "^5.9.3"
30
26
  }
31
27
  }
@@ -1 +0,0 @@
1
- export * from './auth';
package/dist/gen/index.js DELETED
@@ -1,17 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./auth"), exports);
File without changes