@sentio/runtime 2.0.3-rc.2 → 2.1.0-rc.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/lib/full-service.d.ts +5 -1
- package/lib/full-service.js +10 -1
- package/lib/full-service.js.map +1 -1
- package/lib/gen/processor/protos/processor.d.ts +4 -0
- package/lib/gen/processor/protos/processor.js +10 -1
- package/lib/gen/processor/protos/processor.js.map +1 -1
- package/package.json +3 -3
- package/src/full-service.ts +13 -3
- package/src/gen/processor/protos/processor.ts +12 -1
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@sentio/runtime",
|
3
3
|
"license": "Apache-2.0",
|
4
|
-
"version": "2.0
|
4
|
+
"version": "2.1.0-rc.1",
|
5
5
|
"scripts": {
|
6
6
|
"compile": "tsc",
|
7
7
|
"build": "yarn compile",
|
@@ -13,7 +13,7 @@
|
|
13
13
|
"start_js": "ts-node-esm --files ./lib/processor-runner.js $PWD/../../debug/dist/lib.js"
|
14
14
|
},
|
15
15
|
"dependencies": {
|
16
|
-
"@sentio/protos": "^2.0
|
16
|
+
"@sentio/protos": "^2.1.0-rc.1",
|
17
17
|
"command-line-args": "^5.2.1",
|
18
18
|
"command-line-usage": "^6.1.3",
|
19
19
|
"fs-extra": "^11.0.0",
|
@@ -45,5 +45,5 @@
|
|
45
45
|
"!{lib,src}/tests",
|
46
46
|
"!**/*.test.{js,ts}"
|
47
47
|
],
|
48
|
-
"gitHead": "
|
48
|
+
"gitHead": "af9ca57b8b46a722e11e8e74e6c72cf421132819"
|
49
49
|
}
|
package/src/full-service.ts
CHANGED
@@ -10,11 +10,11 @@ import {
|
|
10
10
|
ProcessConfigRequest,
|
11
11
|
ProcessorServiceImplementation,
|
12
12
|
StartRequest,
|
13
|
+
ProcessResult,
|
13
14
|
} from './gen/processor/protos/processor.js'
|
14
15
|
|
15
16
|
import { Empty } from '@sentio/protos'
|
16
17
|
import fs from 'fs-extra'
|
17
|
-
import * as assert from 'assert'
|
18
18
|
import path from 'path'
|
19
19
|
|
20
20
|
function locatePackageJson(pkgId: string) {
|
@@ -59,7 +59,9 @@ export class FullProcessorServiceImpl implements ProcessorServiceImplementation
|
|
59
59
|
for (const binding of request.bindings) {
|
60
60
|
this.adjustDataBinding(binding)
|
61
61
|
}
|
62
|
-
|
62
|
+
const result = await this.instance.processBindings(request, options)
|
63
|
+
this.adjustResult(result.result as ProcessResult)
|
64
|
+
return result
|
63
65
|
}
|
64
66
|
|
65
67
|
async *processBindingsStream(requests: AsyncIterable<DataBinding>, context: CallContext) {
|
@@ -67,7 +69,15 @@ export class FullProcessorServiceImpl implements ProcessorServiceImplementation
|
|
67
69
|
// y this.instance.processBindingsStream(requests, context)
|
68
70
|
}
|
69
71
|
|
70
|
-
|
72
|
+
private adjustResult(res: ProcessResult): void {
|
73
|
+
for (const log of res.logs) {
|
74
|
+
if (log.attributes && !log.attributes2) {
|
75
|
+
log.attributes2 = JSON.parse(log.attributes)
|
76
|
+
}
|
77
|
+
}
|
78
|
+
}
|
79
|
+
|
80
|
+
private adjustDataBinding(dataBinding: DataBinding): void {
|
71
81
|
switch (dataBinding.handlerType) {
|
72
82
|
case HandlerType.APT_EVENT:
|
73
83
|
if (dataBinding.data?.aptEvent) {
|
@@ -609,7 +609,9 @@ export interface LogResult {
|
|
609
609
|
metadata: RecordMetaData | undefined;
|
610
610
|
level: LogLevel;
|
611
611
|
message: string;
|
612
|
+
/** @deprecated */
|
612
613
|
attributes: string;
|
614
|
+
attributes2: { [key: string]: any } | undefined;
|
613
615
|
runtimeInfo: RuntimeInfo | undefined;
|
614
616
|
}
|
615
617
|
|
@@ -4567,7 +4569,7 @@ export const CounterResult = {
|
|
4567
4569
|
};
|
4568
4570
|
|
4569
4571
|
function createBaseLogResult(): LogResult {
|
4570
|
-
return { metadata: undefined, level: 0, message: "", attributes: "", runtimeInfo: undefined };
|
4572
|
+
return { metadata: undefined, level: 0, message: "", attributes: "", attributes2: undefined, runtimeInfo: undefined };
|
4571
4573
|
}
|
4572
4574
|
|
4573
4575
|
export const LogResult = {
|
@@ -4584,6 +4586,9 @@ export const LogResult = {
|
|
4584
4586
|
if (message.attributes !== "") {
|
4585
4587
|
writer.uint32(50).string(message.attributes);
|
4586
4588
|
}
|
4589
|
+
if (message.attributes2 !== undefined) {
|
4590
|
+
Struct.encode(Struct.wrap(message.attributes2), writer.uint32(58).fork()).ldelim();
|
4591
|
+
}
|
4587
4592
|
if (message.runtimeInfo !== undefined) {
|
4588
4593
|
RuntimeInfo.encode(message.runtimeInfo, writer.uint32(34).fork()).ldelim();
|
4589
4594
|
}
|
@@ -4609,6 +4614,9 @@ export const LogResult = {
|
|
4609
4614
|
case 6:
|
4610
4615
|
message.attributes = reader.string();
|
4611
4616
|
break;
|
4617
|
+
case 7:
|
4618
|
+
message.attributes2 = Struct.unwrap(Struct.decode(reader, reader.uint32()));
|
4619
|
+
break;
|
4612
4620
|
case 4:
|
4613
4621
|
message.runtimeInfo = RuntimeInfo.decode(reader, reader.uint32());
|
4614
4622
|
break;
|
@@ -4626,6 +4634,7 @@ export const LogResult = {
|
|
4626
4634
|
level: isSet(object.level) ? logLevelFromJSON(object.level) : 0,
|
4627
4635
|
message: isSet(object.message) ? String(object.message) : "",
|
4628
4636
|
attributes: isSet(object.attributes) ? String(object.attributes) : "",
|
4637
|
+
attributes2: isObject(object.attributes2) ? object.attributes2 : undefined,
|
4629
4638
|
runtimeInfo: isSet(object.runtimeInfo) ? RuntimeInfo.fromJSON(object.runtimeInfo) : undefined,
|
4630
4639
|
};
|
4631
4640
|
},
|
@@ -4637,6 +4646,7 @@ export const LogResult = {
|
|
4637
4646
|
message.level !== undefined && (obj.level = logLevelToJSON(message.level));
|
4638
4647
|
message.message !== undefined && (obj.message = message.message);
|
4639
4648
|
message.attributes !== undefined && (obj.attributes = message.attributes);
|
4649
|
+
message.attributes2 !== undefined && (obj.attributes2 = message.attributes2);
|
4640
4650
|
message.runtimeInfo !== undefined &&
|
4641
4651
|
(obj.runtimeInfo = message.runtimeInfo ? RuntimeInfo.toJSON(message.runtimeInfo) : undefined);
|
4642
4652
|
return obj;
|
@@ -4650,6 +4660,7 @@ export const LogResult = {
|
|
4650
4660
|
message.level = object.level ?? 0;
|
4651
4661
|
message.message = object.message ?? "";
|
4652
4662
|
message.attributes = object.attributes ?? "";
|
4663
|
+
message.attributes2 = object.attributes2 ?? undefined;
|
4653
4664
|
message.runtimeInfo = (object.runtimeInfo !== undefined && object.runtimeInfo !== null)
|
4654
4665
|
? RuntimeInfo.fromPartial(object.runtimeInfo)
|
4655
4666
|
: undefined;
|