quiver-protobuf-typescript 1.0.1689170133 → 1.0.1689175230

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,127 @@
1
+ /* eslint-disable */
2
+ import _m0 from "protobufjs/minimal";
3
+ import { Timestamp } from "../google/protobuf/timestamp";
4
+ import { CreateCourierLocationRequest } from "./courier_location";
5
+
6
+ export const protobufPackage = "courier";
7
+
8
+ export interface StartNextCourierJobRequest {
9
+ courierId: number;
10
+ location: CreateCourierLocationRequest | undefined;
11
+ timestamp: string | undefined;
12
+ }
13
+
14
+ function createBaseStartNextCourierJobRequest(): StartNextCourierJobRequest {
15
+ return { courierId: 0, location: undefined, timestamp: undefined };
16
+ }
17
+
18
+ export const StartNextCourierJobRequest = {
19
+ encode(message: StartNextCourierJobRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
20
+ if (message.courierId !== 0) {
21
+ writer.uint32(8).int32(message.courierId);
22
+ }
23
+ if (message.location !== undefined) {
24
+ CreateCourierLocationRequest.encode(message.location, writer.uint32(18).fork()).ldelim();
25
+ }
26
+ if (message.timestamp !== undefined) {
27
+ Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(26).fork()).ldelim();
28
+ }
29
+ return writer;
30
+ },
31
+
32
+ decode(input: _m0.Reader | Uint8Array, length?: number): StartNextCourierJobRequest {
33
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
34
+ let end = length === undefined ? reader.len : reader.pos + length;
35
+ const message = createBaseStartNextCourierJobRequest();
36
+ while (reader.pos < end) {
37
+ const tag = reader.uint32();
38
+ switch (tag >>> 3) {
39
+ case 1:
40
+ if (tag !== 8) {
41
+ break;
42
+ }
43
+
44
+ message.courierId = reader.int32();
45
+ continue;
46
+ case 2:
47
+ if (tag !== 18) {
48
+ break;
49
+ }
50
+
51
+ message.location = CreateCourierLocationRequest.decode(reader, reader.uint32());
52
+ continue;
53
+ case 3:
54
+ if (tag !== 26) {
55
+ break;
56
+ }
57
+
58
+ message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
59
+ continue;
60
+ }
61
+ if ((tag & 7) === 4 || tag === 0) {
62
+ break;
63
+ }
64
+ reader.skipType(tag & 7);
65
+ }
66
+ return message;
67
+ },
68
+
69
+ fromJSON(object: any): StartNextCourierJobRequest {
70
+ return {
71
+ courierId: isSet(object.courierId) ? Number(object.courierId) : 0,
72
+ location: isSet(object.location) ? CreateCourierLocationRequest.fromJSON(object.location) : undefined,
73
+ timestamp: isSet(object.timestamp) ? String(object.timestamp) : undefined,
74
+ };
75
+ },
76
+
77
+ toJSON(message: StartNextCourierJobRequest): unknown {
78
+ const obj: any = {};
79
+ message.courierId !== undefined && (obj.courierId = Math.round(message.courierId));
80
+ message.location !== undefined &&
81
+ (obj.location = message.location ? CreateCourierLocationRequest.toJSON(message.location) : undefined);
82
+ message.timestamp !== undefined && (obj.timestamp = message.timestamp);
83
+ return obj;
84
+ },
85
+
86
+ create<I extends Exact<DeepPartial<StartNextCourierJobRequest>, I>>(base?: I): StartNextCourierJobRequest {
87
+ return StartNextCourierJobRequest.fromPartial(base ?? {});
88
+ },
89
+
90
+ fromPartial<I extends Exact<DeepPartial<StartNextCourierJobRequest>, I>>(object: I): StartNextCourierJobRequest {
91
+ const message = createBaseStartNextCourierJobRequest();
92
+ message.courierId = object.courierId ?? 0;
93
+ message.location = (object.location !== undefined && object.location !== null)
94
+ ? CreateCourierLocationRequest.fromPartial(object.location)
95
+ : undefined;
96
+ message.timestamp = object.timestamp ?? undefined;
97
+ return message;
98
+ },
99
+ };
100
+
101
+ type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
102
+
103
+ export type DeepPartial<T> = T extends Builtin ? T
104
+ : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
105
+ : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
106
+ : Partial<T>;
107
+
108
+ type KeysOfUnion<T> = T extends T ? keyof T : never;
109
+ export type Exact<P, I extends P> = P extends Builtin ? P
110
+ : P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };
111
+
112
+ function toTimestamp(dateStr: string): Timestamp {
113
+ const date = new Date(dateStr);
114
+ const seconds = date.getTime() / 1_000;
115
+ const nanos = (date.getTime() % 1_000) * 1_000_000;
116
+ return { seconds, nanos };
117
+ }
118
+
119
+ function fromTimestamp(t: Timestamp): string {
120
+ let millis = (t.seconds || 0) * 1_000;
121
+ millis += (t.nanos || 0) / 1_000_000;
122
+ return new Date(millis).toISOString();
123
+ }
124
+
125
+ function isSet(value: any): boolean {
126
+ return value !== null && value !== undefined;
127
+ }
@@ -51,12 +51,6 @@ export interface CourierLocation {
51
51
  accuracy: number;
52
52
  }
53
53
 
54
- export interface StartNextCourierJobRequest {
55
- courierId: number;
56
- location: CreateCourierLocationRequest | undefined;
57
- timestamp: string | undefined;
58
- }
59
-
60
54
  function createBaseCreateCourierLocationRequest(): CreateCourierLocationRequest {
61
55
  return { courierId: undefined, latitude: 0, longitude: 0, timestamp: undefined, accuracy: 0 };
62
56
  }
@@ -792,93 +786,6 @@ export const CourierLocation = {
792
786
  },
793
787
  };
794
788
 
795
- function createBaseStartNextCourierJobRequest(): StartNextCourierJobRequest {
796
- return { courierId: 0, location: undefined, timestamp: undefined };
797
- }
798
-
799
- export const StartNextCourierJobRequest = {
800
- encode(message: StartNextCourierJobRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
801
- if (message.courierId !== 0) {
802
- writer.uint32(8).int32(message.courierId);
803
- }
804
- if (message.location !== undefined) {
805
- CreateCourierLocationRequest.encode(message.location, writer.uint32(18).fork()).ldelim();
806
- }
807
- if (message.timestamp !== undefined) {
808
- Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(26).fork()).ldelim();
809
- }
810
- return writer;
811
- },
812
-
813
- decode(input: _m0.Reader | Uint8Array, length?: number): StartNextCourierJobRequest {
814
- const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
815
- let end = length === undefined ? reader.len : reader.pos + length;
816
- const message = createBaseStartNextCourierJobRequest();
817
- while (reader.pos < end) {
818
- const tag = reader.uint32();
819
- switch (tag >>> 3) {
820
- case 1:
821
- if (tag !== 8) {
822
- break;
823
- }
824
-
825
- message.courierId = reader.int32();
826
- continue;
827
- case 2:
828
- if (tag !== 18) {
829
- break;
830
- }
831
-
832
- message.location = CreateCourierLocationRequest.decode(reader, reader.uint32());
833
- continue;
834
- case 3:
835
- if (tag !== 26) {
836
- break;
837
- }
838
-
839
- message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
840
- continue;
841
- }
842
- if ((tag & 7) === 4 || tag === 0) {
843
- break;
844
- }
845
- reader.skipType(tag & 7);
846
- }
847
- return message;
848
- },
849
-
850
- fromJSON(object: any): StartNextCourierJobRequest {
851
- return {
852
- courierId: isSet(object.courierId) ? Number(object.courierId) : 0,
853
- location: isSet(object.location) ? CreateCourierLocationRequest.fromJSON(object.location) : undefined,
854
- timestamp: isSet(object.timestamp) ? String(object.timestamp) : undefined,
855
- };
856
- },
857
-
858
- toJSON(message: StartNextCourierJobRequest): unknown {
859
- const obj: any = {};
860
- message.courierId !== undefined && (obj.courierId = Math.round(message.courierId));
861
- message.location !== undefined &&
862
- (obj.location = message.location ? CreateCourierLocationRequest.toJSON(message.location) : undefined);
863
- message.timestamp !== undefined && (obj.timestamp = message.timestamp);
864
- return obj;
865
- },
866
-
867
- create<I extends Exact<DeepPartial<StartNextCourierJobRequest>, I>>(base?: I): StartNextCourierJobRequest {
868
- return StartNextCourierJobRequest.fromPartial(base ?? {});
869
- },
870
-
871
- fromPartial<I extends Exact<DeepPartial<StartNextCourierJobRequest>, I>>(object: I): StartNextCourierJobRequest {
872
- const message = createBaseStartNextCourierJobRequest();
873
- message.courierId = object.courierId ?? 0;
874
- message.location = (object.location !== undefined && object.location !== null)
875
- ? CreateCourierLocationRequest.fromPartial(object.location)
876
- : undefined;
877
- message.timestamp = object.timestamp ?? undefined;
878
- return message;
879
- },
880
- };
881
-
882
789
  type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
883
790
 
884
791
  export type DeepPartial<T> = T extends Builtin ? T
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quiver-protobuf-typescript",
3
- "version": "1.0.1689170133",
3
+ "version": "1.0.1689175230",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",