@stanterprise/protobuf 0.0.1
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 +21 -0
- package/gen/ts/common.ts +121 -0
- package/gen/ts/events.ts +398 -0
- package/gen/ts/google/protobuf/timestamp.ts +287 -0
- package/gen/ts/observer.client.ts +61 -0
- package/gen/ts/observer.ts +92 -0
- package/package.json +31 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Stanislav Fedii
|
|
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/gen/ts/common.ts
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
// @generated by protobuf-ts 2.11.0 with parameter long_type_string,optimize_code_size
|
|
2
|
+
// @generated from protobuf file "common.proto" (package "testsystem.common", syntax proto3)
|
|
3
|
+
// tslint:disable
|
|
4
|
+
import type { BinaryWriteOptions } from "@protobuf-ts/runtime";
|
|
5
|
+
import type { IBinaryWriter } from "@protobuf-ts/runtime";
|
|
6
|
+
import { WireType } from "@protobuf-ts/runtime";
|
|
7
|
+
import type { BinaryReadOptions } from "@protobuf-ts/runtime";
|
|
8
|
+
import type { IBinaryReader } from "@protobuf-ts/runtime";
|
|
9
|
+
import { UnknownFieldHandler } from "@protobuf-ts/runtime";
|
|
10
|
+
import type { PartialMessage } from "@protobuf-ts/runtime";
|
|
11
|
+
import { reflectionMergePartial } from "@protobuf-ts/runtime";
|
|
12
|
+
import { MessageType } from "@protobuf-ts/runtime";
|
|
13
|
+
/**
|
|
14
|
+
* Message for attachments
|
|
15
|
+
*
|
|
16
|
+
* @generated from protobuf message testsystem.common.Attachment
|
|
17
|
+
*/
|
|
18
|
+
export interface Attachment {
|
|
19
|
+
/**
|
|
20
|
+
* @generated from protobuf field: string name = 1
|
|
21
|
+
*/
|
|
22
|
+
name: string;
|
|
23
|
+
/**
|
|
24
|
+
* @generated from protobuf field: string mime_type = 2
|
|
25
|
+
*/
|
|
26
|
+
mimeType: string;
|
|
27
|
+
/**
|
|
28
|
+
* @generated from protobuf field: bytes content = 3
|
|
29
|
+
*/
|
|
30
|
+
content: Uint8Array; // Binary content of the attachment
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Enum for test result statuses
|
|
34
|
+
*
|
|
35
|
+
* @generated from protobuf enum testsystem.common.TestStatus
|
|
36
|
+
*/
|
|
37
|
+
export enum TestStatus {
|
|
38
|
+
/**
|
|
39
|
+
* @generated from protobuf enum value: UNKNOWN = 0;
|
|
40
|
+
*/
|
|
41
|
+
UNKNOWN = 0,
|
|
42
|
+
/**
|
|
43
|
+
* @generated from protobuf enum value: PASSED = 1;
|
|
44
|
+
*/
|
|
45
|
+
PASSED = 1,
|
|
46
|
+
/**
|
|
47
|
+
* @generated from protobuf enum value: FAILED = 2;
|
|
48
|
+
*/
|
|
49
|
+
FAILED = 2,
|
|
50
|
+
/**
|
|
51
|
+
* @generated from protobuf enum value: SKIPPED = 3;
|
|
52
|
+
*/
|
|
53
|
+
SKIPPED = 3,
|
|
54
|
+
/**
|
|
55
|
+
* @generated from protobuf enum value: BROKEN = 4;
|
|
56
|
+
*/
|
|
57
|
+
BROKEN = 4
|
|
58
|
+
}
|
|
59
|
+
// @generated message type with reflection information, may provide speed optimized methods
|
|
60
|
+
class Attachment$Type extends MessageType<Attachment> {
|
|
61
|
+
constructor() {
|
|
62
|
+
super("testsystem.common.Attachment", [
|
|
63
|
+
{ no: 1, name: "name", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
|
|
64
|
+
{ no: 2, name: "mime_type", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
|
|
65
|
+
{ no: 3, name: "content", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }
|
|
66
|
+
]);
|
|
67
|
+
}
|
|
68
|
+
create(value?: PartialMessage<Attachment>): Attachment {
|
|
69
|
+
const message = globalThis.Object.create((this.messagePrototype!));
|
|
70
|
+
message.name = "";
|
|
71
|
+
message.mimeType = "";
|
|
72
|
+
message.content = new Uint8Array(0);
|
|
73
|
+
if (value !== undefined)
|
|
74
|
+
reflectionMergePartial<Attachment>(this, message, value);
|
|
75
|
+
return message;
|
|
76
|
+
}
|
|
77
|
+
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Attachment): Attachment {
|
|
78
|
+
let message = target ?? this.create(), end = reader.pos + length;
|
|
79
|
+
while (reader.pos < end) {
|
|
80
|
+
let [fieldNo, wireType] = reader.tag();
|
|
81
|
+
switch (fieldNo) {
|
|
82
|
+
case /* string name */ 1:
|
|
83
|
+
message.name = reader.string();
|
|
84
|
+
break;
|
|
85
|
+
case /* string mime_type */ 2:
|
|
86
|
+
message.mimeType = reader.string();
|
|
87
|
+
break;
|
|
88
|
+
case /* bytes content */ 3:
|
|
89
|
+
message.content = reader.bytes();
|
|
90
|
+
break;
|
|
91
|
+
default:
|
|
92
|
+
let u = options.readUnknownField;
|
|
93
|
+
if (u === "throw")
|
|
94
|
+
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
|
95
|
+
let d = reader.skip(wireType);
|
|
96
|
+
if (u !== false)
|
|
97
|
+
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return message;
|
|
101
|
+
}
|
|
102
|
+
internalBinaryWrite(message: Attachment, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
|
|
103
|
+
/* string name = 1; */
|
|
104
|
+
if (message.name !== "")
|
|
105
|
+
writer.tag(1, WireType.LengthDelimited).string(message.name);
|
|
106
|
+
/* string mime_type = 2; */
|
|
107
|
+
if (message.mimeType !== "")
|
|
108
|
+
writer.tag(2, WireType.LengthDelimited).string(message.mimeType);
|
|
109
|
+
/* bytes content = 3; */
|
|
110
|
+
if (message.content.length)
|
|
111
|
+
writer.tag(3, WireType.LengthDelimited).bytes(message.content);
|
|
112
|
+
let u = options.writeUnknownFields;
|
|
113
|
+
if (u !== false)
|
|
114
|
+
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
115
|
+
return writer;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* @generated MessageType for protobuf message testsystem.common.Attachment
|
|
120
|
+
*/
|
|
121
|
+
export const Attachment = new Attachment$Type();
|
package/gen/ts/events.ts
ADDED
|
@@ -0,0 +1,398 @@
|
|
|
1
|
+
// @generated by protobuf-ts 2.11.0 with parameter long_type_string,optimize_code_size
|
|
2
|
+
// @generated from protobuf file "events.proto" (package "testsystem.events", syntax proto3)
|
|
3
|
+
// tslint:disable
|
|
4
|
+
import type { BinaryWriteOptions } from "@protobuf-ts/runtime";
|
|
5
|
+
import type { IBinaryWriter } from "@protobuf-ts/runtime";
|
|
6
|
+
import { WireType } from "@protobuf-ts/runtime";
|
|
7
|
+
import type { BinaryReadOptions } from "@protobuf-ts/runtime";
|
|
8
|
+
import type { IBinaryReader } from "@protobuf-ts/runtime";
|
|
9
|
+
import { UnknownFieldHandler } from "@protobuf-ts/runtime";
|
|
10
|
+
import type { PartialMessage } from "@protobuf-ts/runtime";
|
|
11
|
+
import { reflectionMergePartial } from "@protobuf-ts/runtime";
|
|
12
|
+
import { MessageType } from "@protobuf-ts/runtime";
|
|
13
|
+
import { Attachment } from "./common";
|
|
14
|
+
import { TestStatus } from "./common";
|
|
15
|
+
import { Timestamp } from "./google/protobuf/timestamp";
|
|
16
|
+
/**
|
|
17
|
+
* @generated from protobuf message testsystem.events.TestStartEvent
|
|
18
|
+
*/
|
|
19
|
+
export interface TestStartEvent {
|
|
20
|
+
/**
|
|
21
|
+
* @generated from protobuf field: string test_id = 1
|
|
22
|
+
*/
|
|
23
|
+
testId: string;
|
|
24
|
+
/**
|
|
25
|
+
* @generated from protobuf field: string test_name = 2
|
|
26
|
+
*/
|
|
27
|
+
testName: string;
|
|
28
|
+
/**
|
|
29
|
+
* @generated from protobuf field: google.protobuf.Timestamp start_time = 3
|
|
30
|
+
*/
|
|
31
|
+
startTime?: Timestamp;
|
|
32
|
+
/**
|
|
33
|
+
* @generated from protobuf field: map<string, string> metadata = 4
|
|
34
|
+
*/
|
|
35
|
+
metadata: {
|
|
36
|
+
[key: string]: string;
|
|
37
|
+
}; // Additional metadata
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* @generated from protobuf message testsystem.events.TestFinishEvent
|
|
41
|
+
*/
|
|
42
|
+
export interface TestFinishEvent {
|
|
43
|
+
/**
|
|
44
|
+
* @generated from protobuf field: string test_id = 1
|
|
45
|
+
*/
|
|
46
|
+
testId: string;
|
|
47
|
+
/**
|
|
48
|
+
* @generated from protobuf field: testsystem.common.TestStatus status = 2
|
|
49
|
+
*/
|
|
50
|
+
status: TestStatus;
|
|
51
|
+
/**
|
|
52
|
+
* @generated from protobuf field: google.protobuf.Timestamp end_time = 3
|
|
53
|
+
*/
|
|
54
|
+
endTime?: Timestamp;
|
|
55
|
+
/**
|
|
56
|
+
* @generated from protobuf field: repeated testsystem.common.Attachment attachments = 4
|
|
57
|
+
*/
|
|
58
|
+
attachments: Attachment[];
|
|
59
|
+
/**
|
|
60
|
+
* @generated from protobuf field: string error_message = 5
|
|
61
|
+
*/
|
|
62
|
+
errorMessage: string; // If any
|
|
63
|
+
/**
|
|
64
|
+
* @generated from protobuf field: string stack_trace = 6
|
|
65
|
+
*/
|
|
66
|
+
stackTrace: string; // If any
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* @generated from protobuf message testsystem.events.TestStep
|
|
70
|
+
*/
|
|
71
|
+
export interface TestStep {
|
|
72
|
+
/**
|
|
73
|
+
* @generated from protobuf field: string description = 1
|
|
74
|
+
*/
|
|
75
|
+
description: string;
|
|
76
|
+
/**
|
|
77
|
+
* @generated from protobuf field: google.protobuf.Timestamp timestamp = 2
|
|
78
|
+
*/
|
|
79
|
+
timestamp?: Timestamp;
|
|
80
|
+
/**
|
|
81
|
+
* @generated from protobuf field: testsystem.common.TestStatus status = 3
|
|
82
|
+
*/
|
|
83
|
+
status: TestStatus;
|
|
84
|
+
/**
|
|
85
|
+
* @generated from protobuf field: repeated testsystem.common.Attachment attachments = 4
|
|
86
|
+
*/
|
|
87
|
+
attachments: Attachment[];
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* @generated from protobuf message testsystem.events.TestStepEvent
|
|
91
|
+
*/
|
|
92
|
+
export interface TestStepEvent {
|
|
93
|
+
/**
|
|
94
|
+
* @generated from protobuf field: string test_id = 1
|
|
95
|
+
*/
|
|
96
|
+
testId: string;
|
|
97
|
+
/**
|
|
98
|
+
* @generated from protobuf field: repeated testsystem.events.TestStep steps = 2
|
|
99
|
+
*/
|
|
100
|
+
steps: TestStep[];
|
|
101
|
+
}
|
|
102
|
+
// @generated message type with reflection information, may provide speed optimized methods
|
|
103
|
+
class TestStartEvent$Type extends MessageType<TestStartEvent> {
|
|
104
|
+
constructor() {
|
|
105
|
+
super("testsystem.events.TestStartEvent", [
|
|
106
|
+
{ no: 1, name: "test_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
|
|
107
|
+
{ no: 2, name: "test_name", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
|
|
108
|
+
{ no: 3, name: "start_time", kind: "message", T: () => Timestamp },
|
|
109
|
+
{ no: 4, name: "metadata", kind: "map", K: 9 /*ScalarType.STRING*/, V: { kind: "scalar", T: 9 /*ScalarType.STRING*/ } }
|
|
110
|
+
]);
|
|
111
|
+
}
|
|
112
|
+
create(value?: PartialMessage<TestStartEvent>): TestStartEvent {
|
|
113
|
+
const message = globalThis.Object.create((this.messagePrototype!));
|
|
114
|
+
message.testId = "";
|
|
115
|
+
message.testName = "";
|
|
116
|
+
message.metadata = {};
|
|
117
|
+
if (value !== undefined)
|
|
118
|
+
reflectionMergePartial<TestStartEvent>(this, message, value);
|
|
119
|
+
return message;
|
|
120
|
+
}
|
|
121
|
+
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: TestStartEvent): TestStartEvent {
|
|
122
|
+
let message = target ?? this.create(), end = reader.pos + length;
|
|
123
|
+
while (reader.pos < end) {
|
|
124
|
+
let [fieldNo, wireType] = reader.tag();
|
|
125
|
+
switch (fieldNo) {
|
|
126
|
+
case /* string test_id */ 1:
|
|
127
|
+
message.testId = reader.string();
|
|
128
|
+
break;
|
|
129
|
+
case /* string test_name */ 2:
|
|
130
|
+
message.testName = reader.string();
|
|
131
|
+
break;
|
|
132
|
+
case /* google.protobuf.Timestamp start_time */ 3:
|
|
133
|
+
message.startTime = Timestamp.internalBinaryRead(reader, reader.uint32(), options, message.startTime);
|
|
134
|
+
break;
|
|
135
|
+
case /* map<string, string> metadata */ 4:
|
|
136
|
+
this.binaryReadMap4(message.metadata, reader, options);
|
|
137
|
+
break;
|
|
138
|
+
default:
|
|
139
|
+
let u = options.readUnknownField;
|
|
140
|
+
if (u === "throw")
|
|
141
|
+
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
|
142
|
+
let d = reader.skip(wireType);
|
|
143
|
+
if (u !== false)
|
|
144
|
+
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
return message;
|
|
148
|
+
}
|
|
149
|
+
private binaryReadMap4(map: TestStartEvent["metadata"], reader: IBinaryReader, options: BinaryReadOptions): void {
|
|
150
|
+
let len = reader.uint32(), end = reader.pos + len, key: keyof TestStartEvent["metadata"] | undefined, val: TestStartEvent["metadata"][any] | undefined;
|
|
151
|
+
while (reader.pos < end) {
|
|
152
|
+
let [fieldNo, wireType] = reader.tag();
|
|
153
|
+
switch (fieldNo) {
|
|
154
|
+
case 1:
|
|
155
|
+
key = reader.string();
|
|
156
|
+
break;
|
|
157
|
+
case 2:
|
|
158
|
+
val = reader.string();
|
|
159
|
+
break;
|
|
160
|
+
default: throw new globalThis.Error("unknown map entry field for testsystem.events.TestStartEvent.metadata");
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
map[key ?? ""] = val ?? "";
|
|
164
|
+
}
|
|
165
|
+
internalBinaryWrite(message: TestStartEvent, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
|
|
166
|
+
/* string test_id = 1; */
|
|
167
|
+
if (message.testId !== "")
|
|
168
|
+
writer.tag(1, WireType.LengthDelimited).string(message.testId);
|
|
169
|
+
/* string test_name = 2; */
|
|
170
|
+
if (message.testName !== "")
|
|
171
|
+
writer.tag(2, WireType.LengthDelimited).string(message.testName);
|
|
172
|
+
/* google.protobuf.Timestamp start_time = 3; */
|
|
173
|
+
if (message.startTime)
|
|
174
|
+
Timestamp.internalBinaryWrite(message.startTime, writer.tag(3, WireType.LengthDelimited).fork(), options).join();
|
|
175
|
+
/* map<string, string> metadata = 4; */
|
|
176
|
+
for (let k of globalThis.Object.keys(message.metadata))
|
|
177
|
+
writer.tag(4, WireType.LengthDelimited).fork().tag(1, WireType.LengthDelimited).string(k).tag(2, WireType.LengthDelimited).string(message.metadata[k]).join();
|
|
178
|
+
let u = options.writeUnknownFields;
|
|
179
|
+
if (u !== false)
|
|
180
|
+
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
181
|
+
return writer;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* @generated MessageType for protobuf message testsystem.events.TestStartEvent
|
|
186
|
+
*/
|
|
187
|
+
export const TestStartEvent = new TestStartEvent$Type();
|
|
188
|
+
// @generated message type with reflection information, may provide speed optimized methods
|
|
189
|
+
class TestFinishEvent$Type extends MessageType<TestFinishEvent> {
|
|
190
|
+
constructor() {
|
|
191
|
+
super("testsystem.events.TestFinishEvent", [
|
|
192
|
+
{ no: 1, name: "test_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
|
|
193
|
+
{ no: 2, name: "status", kind: "enum", T: () => ["testsystem.common.TestStatus", TestStatus] },
|
|
194
|
+
{ no: 3, name: "end_time", kind: "message", T: () => Timestamp },
|
|
195
|
+
{ no: 4, name: "attachments", kind: "message", repeat: 2 /*RepeatType.UNPACKED*/, T: () => Attachment },
|
|
196
|
+
{ no: 5, name: "error_message", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
|
|
197
|
+
{ no: 6, name: "stack_trace", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
|
|
198
|
+
]);
|
|
199
|
+
}
|
|
200
|
+
create(value?: PartialMessage<TestFinishEvent>): TestFinishEvent {
|
|
201
|
+
const message = globalThis.Object.create((this.messagePrototype!));
|
|
202
|
+
message.testId = "";
|
|
203
|
+
message.status = 0;
|
|
204
|
+
message.attachments = [];
|
|
205
|
+
message.errorMessage = "";
|
|
206
|
+
message.stackTrace = "";
|
|
207
|
+
if (value !== undefined)
|
|
208
|
+
reflectionMergePartial<TestFinishEvent>(this, message, value);
|
|
209
|
+
return message;
|
|
210
|
+
}
|
|
211
|
+
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: TestFinishEvent): TestFinishEvent {
|
|
212
|
+
let message = target ?? this.create(), end = reader.pos + length;
|
|
213
|
+
while (reader.pos < end) {
|
|
214
|
+
let [fieldNo, wireType] = reader.tag();
|
|
215
|
+
switch (fieldNo) {
|
|
216
|
+
case /* string test_id */ 1:
|
|
217
|
+
message.testId = reader.string();
|
|
218
|
+
break;
|
|
219
|
+
case /* testsystem.common.TestStatus status */ 2:
|
|
220
|
+
message.status = reader.int32();
|
|
221
|
+
break;
|
|
222
|
+
case /* google.protobuf.Timestamp end_time */ 3:
|
|
223
|
+
message.endTime = Timestamp.internalBinaryRead(reader, reader.uint32(), options, message.endTime);
|
|
224
|
+
break;
|
|
225
|
+
case /* repeated testsystem.common.Attachment attachments */ 4:
|
|
226
|
+
message.attachments.push(Attachment.internalBinaryRead(reader, reader.uint32(), options));
|
|
227
|
+
break;
|
|
228
|
+
case /* string error_message */ 5:
|
|
229
|
+
message.errorMessage = reader.string();
|
|
230
|
+
break;
|
|
231
|
+
case /* string stack_trace */ 6:
|
|
232
|
+
message.stackTrace = reader.string();
|
|
233
|
+
break;
|
|
234
|
+
default:
|
|
235
|
+
let u = options.readUnknownField;
|
|
236
|
+
if (u === "throw")
|
|
237
|
+
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
|
238
|
+
let d = reader.skip(wireType);
|
|
239
|
+
if (u !== false)
|
|
240
|
+
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
return message;
|
|
244
|
+
}
|
|
245
|
+
internalBinaryWrite(message: TestFinishEvent, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
|
|
246
|
+
/* string test_id = 1; */
|
|
247
|
+
if (message.testId !== "")
|
|
248
|
+
writer.tag(1, WireType.LengthDelimited).string(message.testId);
|
|
249
|
+
/* testsystem.common.TestStatus status = 2; */
|
|
250
|
+
if (message.status !== 0)
|
|
251
|
+
writer.tag(2, WireType.Varint).int32(message.status);
|
|
252
|
+
/* google.protobuf.Timestamp end_time = 3; */
|
|
253
|
+
if (message.endTime)
|
|
254
|
+
Timestamp.internalBinaryWrite(message.endTime, writer.tag(3, WireType.LengthDelimited).fork(), options).join();
|
|
255
|
+
/* repeated testsystem.common.Attachment attachments = 4; */
|
|
256
|
+
for (let i = 0; i < message.attachments.length; i++)
|
|
257
|
+
Attachment.internalBinaryWrite(message.attachments[i], writer.tag(4, WireType.LengthDelimited).fork(), options).join();
|
|
258
|
+
/* string error_message = 5; */
|
|
259
|
+
if (message.errorMessage !== "")
|
|
260
|
+
writer.tag(5, WireType.LengthDelimited).string(message.errorMessage);
|
|
261
|
+
/* string stack_trace = 6; */
|
|
262
|
+
if (message.stackTrace !== "")
|
|
263
|
+
writer.tag(6, WireType.LengthDelimited).string(message.stackTrace);
|
|
264
|
+
let u = options.writeUnknownFields;
|
|
265
|
+
if (u !== false)
|
|
266
|
+
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
267
|
+
return writer;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* @generated MessageType for protobuf message testsystem.events.TestFinishEvent
|
|
272
|
+
*/
|
|
273
|
+
export const TestFinishEvent = new TestFinishEvent$Type();
|
|
274
|
+
// @generated message type with reflection information, may provide speed optimized methods
|
|
275
|
+
class TestStep$Type extends MessageType<TestStep> {
|
|
276
|
+
constructor() {
|
|
277
|
+
super("testsystem.events.TestStep", [
|
|
278
|
+
{ no: 1, name: "description", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
|
|
279
|
+
{ no: 2, name: "timestamp", kind: "message", T: () => Timestamp },
|
|
280
|
+
{ no: 3, name: "status", kind: "enum", T: () => ["testsystem.common.TestStatus", TestStatus] },
|
|
281
|
+
{ no: 4, name: "attachments", kind: "message", repeat: 2 /*RepeatType.UNPACKED*/, T: () => Attachment }
|
|
282
|
+
]);
|
|
283
|
+
}
|
|
284
|
+
create(value?: PartialMessage<TestStep>): TestStep {
|
|
285
|
+
const message = globalThis.Object.create((this.messagePrototype!));
|
|
286
|
+
message.description = "";
|
|
287
|
+
message.status = 0;
|
|
288
|
+
message.attachments = [];
|
|
289
|
+
if (value !== undefined)
|
|
290
|
+
reflectionMergePartial<TestStep>(this, message, value);
|
|
291
|
+
return message;
|
|
292
|
+
}
|
|
293
|
+
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: TestStep): TestStep {
|
|
294
|
+
let message = target ?? this.create(), end = reader.pos + length;
|
|
295
|
+
while (reader.pos < end) {
|
|
296
|
+
let [fieldNo, wireType] = reader.tag();
|
|
297
|
+
switch (fieldNo) {
|
|
298
|
+
case /* string description */ 1:
|
|
299
|
+
message.description = reader.string();
|
|
300
|
+
break;
|
|
301
|
+
case /* google.protobuf.Timestamp timestamp */ 2:
|
|
302
|
+
message.timestamp = Timestamp.internalBinaryRead(reader, reader.uint32(), options, message.timestamp);
|
|
303
|
+
break;
|
|
304
|
+
case /* testsystem.common.TestStatus status */ 3:
|
|
305
|
+
message.status = reader.int32();
|
|
306
|
+
break;
|
|
307
|
+
case /* repeated testsystem.common.Attachment attachments */ 4:
|
|
308
|
+
message.attachments.push(Attachment.internalBinaryRead(reader, reader.uint32(), options));
|
|
309
|
+
break;
|
|
310
|
+
default:
|
|
311
|
+
let u = options.readUnknownField;
|
|
312
|
+
if (u === "throw")
|
|
313
|
+
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
|
314
|
+
let d = reader.skip(wireType);
|
|
315
|
+
if (u !== false)
|
|
316
|
+
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
return message;
|
|
320
|
+
}
|
|
321
|
+
internalBinaryWrite(message: TestStep, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
|
|
322
|
+
/* string description = 1; */
|
|
323
|
+
if (message.description !== "")
|
|
324
|
+
writer.tag(1, WireType.LengthDelimited).string(message.description);
|
|
325
|
+
/* google.protobuf.Timestamp timestamp = 2; */
|
|
326
|
+
if (message.timestamp)
|
|
327
|
+
Timestamp.internalBinaryWrite(message.timestamp, writer.tag(2, WireType.LengthDelimited).fork(), options).join();
|
|
328
|
+
/* testsystem.common.TestStatus status = 3; */
|
|
329
|
+
if (message.status !== 0)
|
|
330
|
+
writer.tag(3, WireType.Varint).int32(message.status);
|
|
331
|
+
/* repeated testsystem.common.Attachment attachments = 4; */
|
|
332
|
+
for (let i = 0; i < message.attachments.length; i++)
|
|
333
|
+
Attachment.internalBinaryWrite(message.attachments[i], writer.tag(4, WireType.LengthDelimited).fork(), options).join();
|
|
334
|
+
let u = options.writeUnknownFields;
|
|
335
|
+
if (u !== false)
|
|
336
|
+
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
337
|
+
return writer;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* @generated MessageType for protobuf message testsystem.events.TestStep
|
|
342
|
+
*/
|
|
343
|
+
export const TestStep = new TestStep$Type();
|
|
344
|
+
// @generated message type with reflection information, may provide speed optimized methods
|
|
345
|
+
class TestStepEvent$Type extends MessageType<TestStepEvent> {
|
|
346
|
+
constructor() {
|
|
347
|
+
super("testsystem.events.TestStepEvent", [
|
|
348
|
+
{ no: 1, name: "test_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
|
|
349
|
+
{ no: 2, name: "steps", kind: "message", repeat: 2 /*RepeatType.UNPACKED*/, T: () => TestStep }
|
|
350
|
+
]);
|
|
351
|
+
}
|
|
352
|
+
create(value?: PartialMessage<TestStepEvent>): TestStepEvent {
|
|
353
|
+
const message = globalThis.Object.create((this.messagePrototype!));
|
|
354
|
+
message.testId = "";
|
|
355
|
+
message.steps = [];
|
|
356
|
+
if (value !== undefined)
|
|
357
|
+
reflectionMergePartial<TestStepEvent>(this, message, value);
|
|
358
|
+
return message;
|
|
359
|
+
}
|
|
360
|
+
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: TestStepEvent): TestStepEvent {
|
|
361
|
+
let message = target ?? this.create(), end = reader.pos + length;
|
|
362
|
+
while (reader.pos < end) {
|
|
363
|
+
let [fieldNo, wireType] = reader.tag();
|
|
364
|
+
switch (fieldNo) {
|
|
365
|
+
case /* string test_id */ 1:
|
|
366
|
+
message.testId = reader.string();
|
|
367
|
+
break;
|
|
368
|
+
case /* repeated testsystem.events.TestStep steps */ 2:
|
|
369
|
+
message.steps.push(TestStep.internalBinaryRead(reader, reader.uint32(), options));
|
|
370
|
+
break;
|
|
371
|
+
default:
|
|
372
|
+
let u = options.readUnknownField;
|
|
373
|
+
if (u === "throw")
|
|
374
|
+
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
|
375
|
+
let d = reader.skip(wireType);
|
|
376
|
+
if (u !== false)
|
|
377
|
+
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
return message;
|
|
381
|
+
}
|
|
382
|
+
internalBinaryWrite(message: TestStepEvent, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
|
|
383
|
+
/* string test_id = 1; */
|
|
384
|
+
if (message.testId !== "")
|
|
385
|
+
writer.tag(1, WireType.LengthDelimited).string(message.testId);
|
|
386
|
+
/* repeated testsystem.events.TestStep steps = 2; */
|
|
387
|
+
for (let i = 0; i < message.steps.length; i++)
|
|
388
|
+
TestStep.internalBinaryWrite(message.steps[i], writer.tag(2, WireType.LengthDelimited).fork(), options).join();
|
|
389
|
+
let u = options.writeUnknownFields;
|
|
390
|
+
if (u !== false)
|
|
391
|
+
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
392
|
+
return writer;
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
/**
|
|
396
|
+
* @generated MessageType for protobuf message testsystem.events.TestStepEvent
|
|
397
|
+
*/
|
|
398
|
+
export const TestStepEvent = new TestStepEvent$Type();
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
// @generated by protobuf-ts 2.11.0 with parameter long_type_string,optimize_code_size
|
|
2
|
+
// @generated from protobuf file "google/protobuf/timestamp.proto" (package "google.protobuf", syntax proto3)
|
|
3
|
+
// tslint:disable
|
|
4
|
+
//
|
|
5
|
+
// Protocol Buffers - Google's data interchange format
|
|
6
|
+
// Copyright 2008 Google Inc. All rights reserved.
|
|
7
|
+
// https://developers.google.com/protocol-buffers/
|
|
8
|
+
//
|
|
9
|
+
// Redistribution and use in source and binary forms, with or without
|
|
10
|
+
// modification, are permitted provided that the following conditions are
|
|
11
|
+
// met:
|
|
12
|
+
//
|
|
13
|
+
// * Redistributions of source code must retain the above copyright
|
|
14
|
+
// notice, this list of conditions and the following disclaimer.
|
|
15
|
+
// * Redistributions in binary form must reproduce the above
|
|
16
|
+
// copyright notice, this list of conditions and the following disclaimer
|
|
17
|
+
// in the documentation and/or other materials provided with the
|
|
18
|
+
// distribution.
|
|
19
|
+
// * Neither the name of Google Inc. nor the names of its
|
|
20
|
+
// contributors may be used to endorse or promote products derived from
|
|
21
|
+
// this software without specific prior written permission.
|
|
22
|
+
//
|
|
23
|
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
24
|
+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
25
|
+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
26
|
+
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
27
|
+
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
28
|
+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
29
|
+
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
30
|
+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
31
|
+
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
32
|
+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
33
|
+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
34
|
+
//
|
|
35
|
+
import type { BinaryWriteOptions } from "@protobuf-ts/runtime";
|
|
36
|
+
import type { IBinaryWriter } from "@protobuf-ts/runtime";
|
|
37
|
+
import { WireType } from "@protobuf-ts/runtime";
|
|
38
|
+
import type { BinaryReadOptions } from "@protobuf-ts/runtime";
|
|
39
|
+
import type { IBinaryReader } from "@protobuf-ts/runtime";
|
|
40
|
+
import { UnknownFieldHandler } from "@protobuf-ts/runtime";
|
|
41
|
+
import type { PartialMessage } from "@protobuf-ts/runtime";
|
|
42
|
+
import { reflectionMergePartial } from "@protobuf-ts/runtime";
|
|
43
|
+
import { typeofJsonValue } from "@protobuf-ts/runtime";
|
|
44
|
+
import type { JsonValue } from "@protobuf-ts/runtime";
|
|
45
|
+
import type { JsonReadOptions } from "@protobuf-ts/runtime";
|
|
46
|
+
import type { JsonWriteOptions } from "@protobuf-ts/runtime";
|
|
47
|
+
import { PbLong } from "@protobuf-ts/runtime";
|
|
48
|
+
import { MessageType } from "@protobuf-ts/runtime";
|
|
49
|
+
/**
|
|
50
|
+
* A Timestamp represents a point in time independent of any time zone or local
|
|
51
|
+
* calendar, encoded as a count of seconds and fractions of seconds at
|
|
52
|
+
* nanosecond resolution. The count is relative to an epoch at UTC midnight on
|
|
53
|
+
* January 1, 1970, in the proleptic Gregorian calendar which extends the
|
|
54
|
+
* Gregorian calendar backwards to year one.
|
|
55
|
+
*
|
|
56
|
+
* All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap
|
|
57
|
+
* second table is needed for interpretation, using a [24-hour linear
|
|
58
|
+
* smear](https://developers.google.com/time/smear).
|
|
59
|
+
*
|
|
60
|
+
* The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By
|
|
61
|
+
* restricting to that range, we ensure that we can convert to and from [RFC
|
|
62
|
+
* 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.
|
|
63
|
+
*
|
|
64
|
+
* # Examples
|
|
65
|
+
*
|
|
66
|
+
* Example 1: Compute Timestamp from POSIX `time()`.
|
|
67
|
+
*
|
|
68
|
+
* Timestamp timestamp;
|
|
69
|
+
* timestamp.set_seconds(time(NULL));
|
|
70
|
+
* timestamp.set_nanos(0);
|
|
71
|
+
*
|
|
72
|
+
* Example 2: Compute Timestamp from POSIX `gettimeofday()`.
|
|
73
|
+
*
|
|
74
|
+
* struct timeval tv;
|
|
75
|
+
* gettimeofday(&tv, NULL);
|
|
76
|
+
*
|
|
77
|
+
* Timestamp timestamp;
|
|
78
|
+
* timestamp.set_seconds(tv.tv_sec);
|
|
79
|
+
* timestamp.set_nanos(tv.tv_usec * 1000);
|
|
80
|
+
*
|
|
81
|
+
* Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
|
|
82
|
+
*
|
|
83
|
+
* FILETIME ft;
|
|
84
|
+
* GetSystemTimeAsFileTime(&ft);
|
|
85
|
+
* UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
|
|
86
|
+
*
|
|
87
|
+
* // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
|
|
88
|
+
* // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
|
|
89
|
+
* Timestamp timestamp;
|
|
90
|
+
* timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
|
|
91
|
+
* timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
|
|
92
|
+
*
|
|
93
|
+
* Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
|
|
94
|
+
*
|
|
95
|
+
* long millis = System.currentTimeMillis();
|
|
96
|
+
*
|
|
97
|
+
* Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
|
|
98
|
+
* .setNanos((int) ((millis % 1000) * 1000000)).build();
|
|
99
|
+
*
|
|
100
|
+
* Example 5: Compute Timestamp from Java `Instant.now()`.
|
|
101
|
+
*
|
|
102
|
+
* Instant now = Instant.now();
|
|
103
|
+
*
|
|
104
|
+
* Timestamp timestamp =
|
|
105
|
+
* Timestamp.newBuilder().setSeconds(now.getEpochSecond())
|
|
106
|
+
* .setNanos(now.getNano()).build();
|
|
107
|
+
*
|
|
108
|
+
* Example 6: Compute Timestamp from current time in Python.
|
|
109
|
+
*
|
|
110
|
+
* timestamp = Timestamp()
|
|
111
|
+
* timestamp.GetCurrentTime()
|
|
112
|
+
*
|
|
113
|
+
* # JSON Mapping
|
|
114
|
+
*
|
|
115
|
+
* In JSON format, the Timestamp type is encoded as a string in the
|
|
116
|
+
* [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
|
|
117
|
+
* format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z"
|
|
118
|
+
* where {year} is always expressed using four digits while {month}, {day},
|
|
119
|
+
* {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
|
|
120
|
+
* seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
|
|
121
|
+
* are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
|
|
122
|
+
* is required. A proto3 JSON serializer should always use UTC (as indicated by
|
|
123
|
+
* "Z") when printing the Timestamp type and a proto3 JSON parser should be
|
|
124
|
+
* able to accept both UTC and other timezones (as indicated by an offset).
|
|
125
|
+
*
|
|
126
|
+
* For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
|
|
127
|
+
* 01:30 UTC on January 15, 2017.
|
|
128
|
+
*
|
|
129
|
+
* In JavaScript, one can convert a Date object to this format using the
|
|
130
|
+
* standard
|
|
131
|
+
* [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
|
|
132
|
+
* method. In Python, a standard `datetime.datetime` object can be converted
|
|
133
|
+
* to this format using
|
|
134
|
+
* [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with
|
|
135
|
+
* the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
|
|
136
|
+
* the Joda Time's [`ISODateTimeFormat.dateTime()`](
|
|
137
|
+
* http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime()
|
|
138
|
+
* ) to obtain a formatter capable of generating timestamps in this format.
|
|
139
|
+
*
|
|
140
|
+
*
|
|
141
|
+
* @generated from protobuf message google.protobuf.Timestamp
|
|
142
|
+
*/
|
|
143
|
+
export interface Timestamp {
|
|
144
|
+
/**
|
|
145
|
+
* Represents seconds of UTC time since Unix epoch
|
|
146
|
+
* 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
|
|
147
|
+
* 9999-12-31T23:59:59Z inclusive.
|
|
148
|
+
*
|
|
149
|
+
* @generated from protobuf field: int64 seconds = 1
|
|
150
|
+
*/
|
|
151
|
+
seconds: string;
|
|
152
|
+
/**
|
|
153
|
+
* Non-negative fractions of a second at nanosecond resolution. Negative
|
|
154
|
+
* second values with fractions must still have non-negative nanos values
|
|
155
|
+
* that count forward in time. Must be from 0 to 999,999,999
|
|
156
|
+
* inclusive.
|
|
157
|
+
*
|
|
158
|
+
* @generated from protobuf field: int32 nanos = 2
|
|
159
|
+
*/
|
|
160
|
+
nanos: number;
|
|
161
|
+
}
|
|
162
|
+
// @generated message type with reflection information, may provide speed optimized methods
|
|
163
|
+
class Timestamp$Type extends MessageType<Timestamp> {
|
|
164
|
+
constructor() {
|
|
165
|
+
super("google.protobuf.Timestamp", [
|
|
166
|
+
{ no: 1, name: "seconds", kind: "scalar", T: 3 /*ScalarType.INT64*/ },
|
|
167
|
+
{ no: 2, name: "nanos", kind: "scalar", T: 5 /*ScalarType.INT32*/ }
|
|
168
|
+
]);
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Creates a new `Timestamp` for the current time.
|
|
172
|
+
*/
|
|
173
|
+
now(): Timestamp {
|
|
174
|
+
const msg = this.create();
|
|
175
|
+
const ms = Date.now();
|
|
176
|
+
msg.seconds = PbLong.from(Math.floor(ms / 1000)).toString();
|
|
177
|
+
msg.nanos = (ms % 1000) * 1000000;
|
|
178
|
+
return msg;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Converts a `Timestamp` to a JavaScript Date.
|
|
182
|
+
*/
|
|
183
|
+
toDate(message: Timestamp): Date {
|
|
184
|
+
return new Date(PbLong.from(message.seconds).toNumber() * 1000 + Math.ceil(message.nanos / 1000000));
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Converts a JavaScript Date to a `Timestamp`.
|
|
188
|
+
*/
|
|
189
|
+
fromDate(date: Date): Timestamp {
|
|
190
|
+
const msg = this.create();
|
|
191
|
+
const ms = date.getTime();
|
|
192
|
+
msg.seconds = PbLong.from(Math.floor(ms / 1000)).toString();
|
|
193
|
+
msg.nanos = ((ms % 1000) + (ms < 0 && ms % 1000 !== 0 ? 1000 : 0)) * 1000000;
|
|
194
|
+
return msg;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* In JSON format, the `Timestamp` type is encoded as a string
|
|
198
|
+
* in the RFC 3339 format.
|
|
199
|
+
*/
|
|
200
|
+
internalJsonWrite(message: Timestamp, options: JsonWriteOptions): JsonValue {
|
|
201
|
+
let ms = PbLong.from(message.seconds).toNumber() * 1000;
|
|
202
|
+
if (ms < Date.parse("0001-01-01T00:00:00Z") || ms > Date.parse("9999-12-31T23:59:59Z"))
|
|
203
|
+
throw new Error("Unable to encode Timestamp to JSON. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.");
|
|
204
|
+
if (message.nanos < 0)
|
|
205
|
+
throw new Error("Unable to encode invalid Timestamp to JSON. Nanos must not be negative.");
|
|
206
|
+
let z = "Z";
|
|
207
|
+
if (message.nanos > 0) {
|
|
208
|
+
let nanosStr = (message.nanos + 1000000000).toString().substring(1);
|
|
209
|
+
if (nanosStr.substring(3) === "000000")
|
|
210
|
+
z = "." + nanosStr.substring(0, 3) + "Z";
|
|
211
|
+
else if (nanosStr.substring(6) === "000")
|
|
212
|
+
z = "." + nanosStr.substring(0, 6) + "Z";
|
|
213
|
+
else
|
|
214
|
+
z = "." + nanosStr + "Z";
|
|
215
|
+
}
|
|
216
|
+
return new Date(ms).toISOString().replace(".000Z", z);
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* In JSON format, the `Timestamp` type is encoded as a string
|
|
220
|
+
* in the RFC 3339 format.
|
|
221
|
+
*/
|
|
222
|
+
internalJsonRead(json: JsonValue, options: JsonReadOptions, target?: Timestamp): Timestamp {
|
|
223
|
+
if (typeof json !== "string")
|
|
224
|
+
throw new Error("Unable to parse Timestamp from JSON " + typeofJsonValue(json) + ".");
|
|
225
|
+
let matches = json.match(/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(?:Z|\.([0-9]{3,9})Z|([+-][0-9][0-9]:[0-9][0-9]))$/);
|
|
226
|
+
if (!matches)
|
|
227
|
+
throw new Error("Unable to parse Timestamp from JSON. Invalid format.");
|
|
228
|
+
let ms = Date.parse(matches[1] + "-" + matches[2] + "-" + matches[3] + "T" + matches[4] + ":" + matches[5] + ":" + matches[6] + (matches[8] ? matches[8] : "Z"));
|
|
229
|
+
if (Number.isNaN(ms))
|
|
230
|
+
throw new Error("Unable to parse Timestamp from JSON. Invalid value.");
|
|
231
|
+
if (ms < Date.parse("0001-01-01T00:00:00Z") || ms > Date.parse("9999-12-31T23:59:59Z"))
|
|
232
|
+
throw new globalThis.Error("Unable to parse Timestamp from JSON. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.");
|
|
233
|
+
if (!target)
|
|
234
|
+
target = this.create();
|
|
235
|
+
target.seconds = PbLong.from(ms / 1000).toString();
|
|
236
|
+
target.nanos = 0;
|
|
237
|
+
if (matches[7])
|
|
238
|
+
target.nanos = (parseInt("1" + matches[7] + "0".repeat(9 - matches[7].length)) - 1000000000);
|
|
239
|
+
return target;
|
|
240
|
+
}
|
|
241
|
+
create(value?: PartialMessage<Timestamp>): Timestamp {
|
|
242
|
+
const message = globalThis.Object.create((this.messagePrototype!));
|
|
243
|
+
message.seconds = "0";
|
|
244
|
+
message.nanos = 0;
|
|
245
|
+
if (value !== undefined)
|
|
246
|
+
reflectionMergePartial<Timestamp>(this, message, value);
|
|
247
|
+
return message;
|
|
248
|
+
}
|
|
249
|
+
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Timestamp): Timestamp {
|
|
250
|
+
let message = target ?? this.create(), end = reader.pos + length;
|
|
251
|
+
while (reader.pos < end) {
|
|
252
|
+
let [fieldNo, wireType] = reader.tag();
|
|
253
|
+
switch (fieldNo) {
|
|
254
|
+
case /* int64 seconds */ 1:
|
|
255
|
+
message.seconds = reader.int64().toString();
|
|
256
|
+
break;
|
|
257
|
+
case /* int32 nanos */ 2:
|
|
258
|
+
message.nanos = reader.int32();
|
|
259
|
+
break;
|
|
260
|
+
default:
|
|
261
|
+
let u = options.readUnknownField;
|
|
262
|
+
if (u === "throw")
|
|
263
|
+
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
|
264
|
+
let d = reader.skip(wireType);
|
|
265
|
+
if (u !== false)
|
|
266
|
+
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
return message;
|
|
270
|
+
}
|
|
271
|
+
internalBinaryWrite(message: Timestamp, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
|
|
272
|
+
/* int64 seconds = 1; */
|
|
273
|
+
if (message.seconds !== "0")
|
|
274
|
+
writer.tag(1, WireType.Varint).int64(message.seconds);
|
|
275
|
+
/* int32 nanos = 2; */
|
|
276
|
+
if (message.nanos !== 0)
|
|
277
|
+
writer.tag(2, WireType.Varint).int32(message.nanos);
|
|
278
|
+
let u = options.writeUnknownFields;
|
|
279
|
+
if (u !== false)
|
|
280
|
+
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
281
|
+
return writer;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* @generated MessageType for protobuf message google.protobuf.Timestamp
|
|
286
|
+
*/
|
|
287
|
+
export const Timestamp = new Timestamp$Type();
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// @generated by protobuf-ts 2.11.0 with parameter long_type_string,optimize_code_size
|
|
2
|
+
// @generated from protobuf file "observer.proto" (package "testsystem.observer", syntax proto3)
|
|
3
|
+
// tslint:disable
|
|
4
|
+
import type { RpcTransport } from "@protobuf-ts/runtime-rpc";
|
|
5
|
+
import type { ServiceInfo } from "@protobuf-ts/runtime-rpc";
|
|
6
|
+
import { TestEventCollector } from "./observer";
|
|
7
|
+
import type { TestStepEvent } from "./events";
|
|
8
|
+
import type { TestFinishEvent } from "./events";
|
|
9
|
+
import { stackIntercept } from "@protobuf-ts/runtime-rpc";
|
|
10
|
+
import type { Ack } from "./observer";
|
|
11
|
+
import type { TestStartEvent } from "./events";
|
|
12
|
+
import type { UnaryCall } from "@protobuf-ts/runtime-rpc";
|
|
13
|
+
import type { RpcOptions } from "@protobuf-ts/runtime-rpc";
|
|
14
|
+
/**
|
|
15
|
+
* @generated from protobuf service testsystem.observer.TestEventCollector
|
|
16
|
+
*/
|
|
17
|
+
export interface ITestEventCollectorClient {
|
|
18
|
+
/**
|
|
19
|
+
* @generated from protobuf rpc: ReportTestStart
|
|
20
|
+
*/
|
|
21
|
+
reportTestStart(input: TestStartEvent, options?: RpcOptions): UnaryCall<TestStartEvent, Ack>;
|
|
22
|
+
/**
|
|
23
|
+
* @generated from protobuf rpc: ReportTestFinish
|
|
24
|
+
*/
|
|
25
|
+
reportTestFinish(input: TestFinishEvent, options?: RpcOptions): UnaryCall<TestFinishEvent, Ack>;
|
|
26
|
+
/**
|
|
27
|
+
* @generated from protobuf rpc: ReportTestStep
|
|
28
|
+
*/
|
|
29
|
+
reportTestStep(input: TestStepEvent, options?: RpcOptions): UnaryCall<TestStepEvent, Ack>;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* @generated from protobuf service testsystem.observer.TestEventCollector
|
|
33
|
+
*/
|
|
34
|
+
export class TestEventCollectorClient implements ITestEventCollectorClient, ServiceInfo {
|
|
35
|
+
typeName = TestEventCollector.typeName;
|
|
36
|
+
methods = TestEventCollector.methods;
|
|
37
|
+
options = TestEventCollector.options;
|
|
38
|
+
constructor(private readonly _transport: RpcTransport) {
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* @generated from protobuf rpc: ReportTestStart
|
|
42
|
+
*/
|
|
43
|
+
reportTestStart(input: TestStartEvent, options?: RpcOptions): UnaryCall<TestStartEvent, Ack> {
|
|
44
|
+
const method = this.methods[0], opt = this._transport.mergeOptions(options);
|
|
45
|
+
return stackIntercept<TestStartEvent, Ack>("unary", this._transport, method, opt, input);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* @generated from protobuf rpc: ReportTestFinish
|
|
49
|
+
*/
|
|
50
|
+
reportTestFinish(input: TestFinishEvent, options?: RpcOptions): UnaryCall<TestFinishEvent, Ack> {
|
|
51
|
+
const method = this.methods[1], opt = this._transport.mergeOptions(options);
|
|
52
|
+
return stackIntercept<TestFinishEvent, Ack>("unary", this._transport, method, opt, input);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* @generated from protobuf rpc: ReportTestStep
|
|
56
|
+
*/
|
|
57
|
+
reportTestStep(input: TestStepEvent, options?: RpcOptions): UnaryCall<TestStepEvent, Ack> {
|
|
58
|
+
const method = this.methods[2], opt = this._transport.mergeOptions(options);
|
|
59
|
+
return stackIntercept<TestStepEvent, Ack>("unary", this._transport, method, opt, input);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
// @generated by protobuf-ts 2.11.0 with parameter long_type_string,optimize_code_size
|
|
2
|
+
// @generated from protobuf file "observer.proto" (package "testsystem.observer", syntax proto3)
|
|
3
|
+
// tslint:disable
|
|
4
|
+
import { TestStepEvent } from "./events";
|
|
5
|
+
import { TestFinishEvent } from "./events";
|
|
6
|
+
import { TestStartEvent } from "./events";
|
|
7
|
+
import { ServiceType } from "@protobuf-ts/runtime-rpc";
|
|
8
|
+
import type { BinaryWriteOptions } from "@protobuf-ts/runtime";
|
|
9
|
+
import type { IBinaryWriter } from "@protobuf-ts/runtime";
|
|
10
|
+
import { WireType } from "@protobuf-ts/runtime";
|
|
11
|
+
import type { BinaryReadOptions } from "@protobuf-ts/runtime";
|
|
12
|
+
import type { IBinaryReader } from "@protobuf-ts/runtime";
|
|
13
|
+
import { UnknownFieldHandler } from "@protobuf-ts/runtime";
|
|
14
|
+
import type { PartialMessage } from "@protobuf-ts/runtime";
|
|
15
|
+
import { reflectionMergePartial } from "@protobuf-ts/runtime";
|
|
16
|
+
import { MessageType } from "@protobuf-ts/runtime";
|
|
17
|
+
/**
|
|
18
|
+
* @generated from protobuf message testsystem.observer.Ack
|
|
19
|
+
*/
|
|
20
|
+
export interface Ack {
|
|
21
|
+
/**
|
|
22
|
+
* @generated from protobuf field: bool success = 1
|
|
23
|
+
*/
|
|
24
|
+
success: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* @generated from protobuf field: string message = 2
|
|
27
|
+
*/
|
|
28
|
+
message: string; // Optional message
|
|
29
|
+
}
|
|
30
|
+
// @generated message type with reflection information, may provide speed optimized methods
|
|
31
|
+
class Ack$Type extends MessageType<Ack> {
|
|
32
|
+
constructor() {
|
|
33
|
+
super("testsystem.observer.Ack", [
|
|
34
|
+
{ no: 1, name: "success", kind: "scalar", T: 8 /*ScalarType.BOOL*/ },
|
|
35
|
+
{ no: 2, name: "message", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
|
|
36
|
+
]);
|
|
37
|
+
}
|
|
38
|
+
create(value?: PartialMessage<Ack>): Ack {
|
|
39
|
+
const message = globalThis.Object.create((this.messagePrototype!));
|
|
40
|
+
message.success = false;
|
|
41
|
+
message.message = "";
|
|
42
|
+
if (value !== undefined)
|
|
43
|
+
reflectionMergePartial<Ack>(this, message, value);
|
|
44
|
+
return message;
|
|
45
|
+
}
|
|
46
|
+
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Ack): Ack {
|
|
47
|
+
let message = target ?? this.create(), end = reader.pos + length;
|
|
48
|
+
while (reader.pos < end) {
|
|
49
|
+
let [fieldNo, wireType] = reader.tag();
|
|
50
|
+
switch (fieldNo) {
|
|
51
|
+
case /* bool success */ 1:
|
|
52
|
+
message.success = reader.bool();
|
|
53
|
+
break;
|
|
54
|
+
case /* string message */ 2:
|
|
55
|
+
message.message = reader.string();
|
|
56
|
+
break;
|
|
57
|
+
default:
|
|
58
|
+
let u = options.readUnknownField;
|
|
59
|
+
if (u === "throw")
|
|
60
|
+
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
|
61
|
+
let d = reader.skip(wireType);
|
|
62
|
+
if (u !== false)
|
|
63
|
+
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return message;
|
|
67
|
+
}
|
|
68
|
+
internalBinaryWrite(message: Ack, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
|
|
69
|
+
/* bool success = 1; */
|
|
70
|
+
if (message.success !== false)
|
|
71
|
+
writer.tag(1, WireType.Varint).bool(message.success);
|
|
72
|
+
/* string message = 2; */
|
|
73
|
+
if (message.message !== "")
|
|
74
|
+
writer.tag(2, WireType.LengthDelimited).string(message.message);
|
|
75
|
+
let u = options.writeUnknownFields;
|
|
76
|
+
if (u !== false)
|
|
77
|
+
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
78
|
+
return writer;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* @generated MessageType for protobuf message testsystem.observer.Ack
|
|
83
|
+
*/
|
|
84
|
+
export const Ack = new Ack$Type();
|
|
85
|
+
/**
|
|
86
|
+
* @generated ServiceType for protobuf service testsystem.observer.TestEventCollector
|
|
87
|
+
*/
|
|
88
|
+
export const TestEventCollector = new ServiceType("testsystem.observer.TestEventCollector", [
|
|
89
|
+
{ name: "ReportTestStart", options: {}, I: TestStartEvent, O: Ack },
|
|
90
|
+
{ name: "ReportTestFinish", options: {}, I: TestFinishEvent, O: Ack },
|
|
91
|
+
{ name: "ReportTestStep", options: {}, I: TestStepEvent, O: Ack }
|
|
92
|
+
]);
|
package/package.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@stanterprise/protobuf",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Generated Protobuf code",
|
|
5
|
+
"files": [
|
|
6
|
+
"gen/ts/**/*"
|
|
7
|
+
],
|
|
8
|
+
"scripts": {
|
|
9
|
+
"prepublishOnly": "npm run generate",
|
|
10
|
+
"prepare": "npm run generate",
|
|
11
|
+
"generate": "npx protoc --ts_out gen/ts --ts_opt long_type_string --ts_opt optimize_code_size --proto_path testsystem testsystem/*.proto"
|
|
12
|
+
},
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "git+https://github.com/stanterprise/protobuf.git"
|
|
16
|
+
},
|
|
17
|
+
"author": "Your Name",
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"@grpc/grpc-js": "^1.0.0",
|
|
21
|
+
"google-protobuf": "^3.0.0"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@protobuf-ts/plugin": "^2.11.0",
|
|
25
|
+
"@types/google-protobuf": "^3.15.12",
|
|
26
|
+
"grpc-tools": "^1.13.0",
|
|
27
|
+
"protoc-gen-ts": "^0.8.7",
|
|
28
|
+
"ts-proto": "^2.7.2",
|
|
29
|
+
"ts-protoc-gen": "^0.15.0"
|
|
30
|
+
}
|
|
31
|
+
}
|