@sentio/runtime 2.39.4-rc.8 → 2.39.4
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 +1 -22
- package/lib/full-service.d.ts.map +1 -1
- package/lib/gen/google/protobuf/empty.d.ts.map +1 -1
- package/lib/gen/google/protobuf/struct.d.ts.map +1 -1
- package/lib/gen/google/protobuf/timestamp.d.ts.map +1 -1
- package/lib/gen/processor/protos/processor.d.ts +33 -6
- package/lib/gen/processor/protos/processor.d.ts.map +1 -1
- package/lib/gen/processor/protos/processor.js +182 -0
- package/lib/gen/processor/protos/processor.js.map +1 -1
- package/lib/gen/service/common/protos/common.d.ts +0 -1
- package/lib/gen/service/common/protos/common.d.ts.map +1 -1
- package/lib/gen/service/common/protos/common.js +1 -15
- package/lib/gen/service/common/protos/common.js.map +1 -1
- package/lib/plugin.d.ts +0 -1
- package/lib/plugin.d.ts.map +1 -1
- package/lib/service.d.ts +2 -22
- package/lib/service.d.ts.map +1 -1
- package/lib/service.js +32 -30
- package/lib/service.js.map +1 -1
- package/package.json +2 -2
- package/src/gen/processor/protos/processor.ts +214 -0
- package/src/gen/service/common/protos/common.ts +1 -17
- package/src/service.ts +37 -31
package/lib/plugin.d.ts
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
2
1
|
import { DataBinding, HandlerType, ProcessConfigResponse, ProcessResult, StartRequest } from '@sentio/protos';
|
3
2
|
import { StoreContext } from './db-context.js';
|
4
3
|
import { AsyncLocalStorage } from 'node:async_hooks';
|
package/lib/plugin.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,qBAAqB,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7G,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AAEpD,8BAAsB,MAAM;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,iBAAiB,EAAE,WAAW,EAAE,CAAK;IAE/B,SAAS,CAAC,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC;IACvD,KAAK,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAE/C;;OAEG;IACH,SAAS,CAAC,MAAM,EAAE,qBAAqB,GAAG,OAAO;IAI3C,cAAc,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,aAAa,CAAC;CAGnE;AAED,qBAAa,aAAa;IACxB,MAAM,CAAC,QAAQ,gBAAsB;IAErC,qBAAqB,8CAAoD;IACzE,OAAO,EAAE,MAAM,EAAE,CAAK;IACtB,aAAa,2BAAiC;IAE9C,QAAQ,CAAC,MAAM,EAAE,MAAM;IAevB,SAAS,CAAC,MAAM,EAAE,qBAAqB;IAIvC,KAAK,CAAC,KAAK,EAAE,YAAY;IAIzB;;OAEG;IACH,SAAS,CAAC,MAAM,EAAE,qBAAqB,GAAG,OAAO;IAIjD,cAAc,CAAC,OAAO,EAAE,WAAW,EAAE,SAAS,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC;CASvF"}
|
package/lib/service.d.ts
CHANGED
@@ -51,7 +51,6 @@ export declare class ProcessorServiceImpl implements ProcessorServiceImplementat
|
|
51
51
|
} | undefined;
|
52
52
|
} | undefined;
|
53
53
|
} | undefined;
|
54
|
-
entityName?: string | undefined;
|
55
54
|
}[] | undefined;
|
56
55
|
} | undefined;
|
57
56
|
delete?: {
|
@@ -64,27 +63,7 @@ export declare class ProcessorServiceImpl implements ProcessorServiceImplementat
|
|
64
63
|
field?: string | undefined;
|
65
64
|
op?: import("@sentio/protos").DBRequest_DBOperator | undefined;
|
66
65
|
value?: {
|
67
|
-
values?:
|
68
|
-
nullValue?: import("@sentio/protos").RichValue_NullValue | undefined;
|
69
|
-
intValue?: number | undefined;
|
70
|
-
floatValue?: number | undefined;
|
71
|
-
bytesValue?: Uint8Array | undefined;
|
72
|
-
boolValue?: boolean | undefined;
|
73
|
-
stringValue?: string | undefined;
|
74
|
-
timestampValue?: Date | undefined;
|
75
|
-
bigintValue?: {
|
76
|
-
negative?: boolean | undefined;
|
77
|
-
data?: Uint8Array | undefined;
|
78
|
-
} | undefined;
|
79
|
-
bigdecimalValue?: {
|
80
|
-
value?: {
|
81
|
-
negative?: boolean | undefined;
|
82
|
-
data?: Uint8Array | undefined;
|
83
|
-
} | undefined;
|
84
|
-
exp?: number | undefined;
|
85
|
-
} | undefined;
|
86
|
-
listValue?: any | undefined;
|
87
|
-
}[] | undefined;
|
66
|
+
values?: any[] | undefined;
|
88
67
|
} | undefined;
|
89
68
|
}[] | undefined;
|
90
69
|
cursor?: string | undefined;
|
@@ -194,5 +173,6 @@ export declare class ProcessorServiceImpl implements ProcessorServiceImplementat
|
|
194
173
|
} | undefined;
|
195
174
|
} | undefined;
|
196
175
|
}, void, undefined>;
|
176
|
+
private handleRequests;
|
197
177
|
}
|
198
178
|
//# sourceMappingURL=service.d.ts.map
|
package/lib/service.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAuB,MAAM,WAAW,CAAA;AAK5D,OAAO,EACL,WAAW,EAEX,KAAK,EACL,WAAW,EACX,sBAAsB,EACtB,sBAAsB,EACtB,oBAAoB,EACpB,qBAAqB,EACrB,8BAA8B,EAC9B,aAAa,EACb,oBAAoB,EAEpB,YAAY,EACb,MAAM,gBAAgB,CAAA;
|
1
|
+
{"version":3,"file":"service.d.ts","source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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAiBlF,cAAc;CAkC7B"}
|
package/lib/service.js
CHANGED
@@ -126,44 +126,46 @@ export class ProcessorServiceImpl {
|
|
126
126
|
throw new ServerError(Status.UNAVAILABLE, 'Service Not started.');
|
127
127
|
}
|
128
128
|
const subject = new Subject();
|
129
|
-
|
130
|
-
new Promise(async (resolve, reject) => {
|
131
|
-
for await (const request of requests) {
|
132
|
-
if (request.binding) {
|
133
|
-
const binding = request.binding;
|
134
|
-
const dbContext = new StoreContext(subject, request.processId);
|
135
|
-
contexts[request.processId] = dbContext;
|
136
|
-
PluginManager.INSTANCE.processBinding(binding, dbContext)
|
137
|
-
.then((result) => {
|
138
|
-
subject.next({
|
139
|
-
result,
|
140
|
-
processId: request.processId
|
141
|
-
});
|
142
|
-
recordRuntimeInfo(result, binding.handlerType);
|
143
|
-
})
|
144
|
-
.catch((e) => {
|
145
|
-
dbContext.error(request.processId, e);
|
146
|
-
})
|
147
|
-
.finally(() => {
|
148
|
-
delete contexts[request.processId];
|
149
|
-
});
|
150
|
-
}
|
151
|
-
if (request.dbResult) {
|
152
|
-
const dbContext = contexts[request.processId];
|
153
|
-
dbContext?.result(request.dbResult);
|
154
|
-
}
|
155
|
-
}
|
156
|
-
resolve(null);
|
157
|
-
})
|
129
|
+
this.handleRequests(requests, subject)
|
158
130
|
.then(() => {
|
159
131
|
subject.complete();
|
160
132
|
})
|
161
133
|
.catch((e) => {
|
162
|
-
|
134
|
+
console.error(e);
|
163
135
|
subject.error(e);
|
164
136
|
});
|
165
137
|
yield* from(subject).pipe(withAbort(context.signal));
|
166
138
|
}
|
139
|
+
async handleRequests(requests, subject) {
|
140
|
+
const contexts = {};
|
141
|
+
for await (const request of requests) {
|
142
|
+
console.debug('received request:', request);
|
143
|
+
if (request.binding) {
|
144
|
+
const binding = request.binding;
|
145
|
+
const dbContext = new StoreContext(subject, request.processId);
|
146
|
+
contexts[request.processId] = dbContext;
|
147
|
+
PluginManager.INSTANCE.processBinding(binding, dbContext)
|
148
|
+
.then((result) => {
|
149
|
+
subject.next({
|
150
|
+
result,
|
151
|
+
processId: request.processId
|
152
|
+
});
|
153
|
+
recordRuntimeInfo(result, binding.handlerType);
|
154
|
+
})
|
155
|
+
.catch((e) => {
|
156
|
+
console.error(e);
|
157
|
+
dbContext.error(request.processId, e);
|
158
|
+
})
|
159
|
+
.finally(() => {
|
160
|
+
delete contexts[request.processId];
|
161
|
+
});
|
162
|
+
}
|
163
|
+
if (request.dbResult) {
|
164
|
+
const dbContext = contexts[request.processId];
|
165
|
+
dbContext?.result(request.dbResult);
|
166
|
+
}
|
167
|
+
}
|
168
|
+
}
|
167
169
|
}
|
168
170
|
function recordRuntimeInfo(results, handlerType) {
|
169
171
|
for (const list of [results.gauges, results.counters, results.events, results.exports]) {
|
package/lib/service.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"service.js","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,WAAW,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAC5D,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AACpE,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAA;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAA;AAEhE,OAAO,EAQL,qBAAqB,EAMtB,MAAM,gBAAgB,CAAA;AAEvB,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAC7D,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAEtE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,
|
1
|
+
{"version":3,"file":"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CAAA;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@sentio/runtime",
|
3
|
-
"version": "2.39.4
|
3
|
+
"version": "2.39.4",
|
4
4
|
"license": "Apache-2.0",
|
5
5
|
"type": "module",
|
6
6
|
"exports": {
|
@@ -32,7 +32,7 @@
|
|
32
32
|
"rxjs": "^7.8.1",
|
33
33
|
"utility-types": "^3.11.0",
|
34
34
|
"winston": "^3.11.0",
|
35
|
-
"@sentio/protos": "2.39.4
|
35
|
+
"@sentio/protos": "2.39.4"
|
36
36
|
},
|
37
37
|
"devDependencies": {
|
38
38
|
"@types/command-line-args": "^5.2.3",
|
@@ -757,9 +757,22 @@ export interface DBResponse {
|
|
757
757
|
list?: Array<any> | undefined;
|
758
758
|
error?: string | undefined;
|
759
759
|
entities?: RichStructList | undefined;
|
760
|
+
entityList?: EntityList | undefined;
|
760
761
|
nextCursor?: string | undefined;
|
761
762
|
}
|
762
763
|
|
764
|
+
export interface Entity {
|
765
|
+
entity: string;
|
766
|
+
genBlockNumber: bigint;
|
767
|
+
genBlockChain: string;
|
768
|
+
genBlockTime: Date | undefined;
|
769
|
+
data: RichStruct | undefined;
|
770
|
+
}
|
771
|
+
|
772
|
+
export interface EntityList {
|
773
|
+
entities: Entity[];
|
774
|
+
}
|
775
|
+
|
763
776
|
export interface DBRequest {
|
764
777
|
opId: bigint;
|
765
778
|
get?: DBRequest_DBGet | undefined;
|
@@ -5884,6 +5897,7 @@ function createBaseDBResponse(): DBResponse {
|
|
5884
5897
|
list: undefined,
|
5885
5898
|
error: undefined,
|
5886
5899
|
entities: undefined,
|
5900
|
+
entityList: undefined,
|
5887
5901
|
nextCursor: undefined,
|
5888
5902
|
};
|
5889
5903
|
}
|
@@ -5908,6 +5922,9 @@ export const DBResponse = {
|
|
5908
5922
|
if (message.entities !== undefined) {
|
5909
5923
|
RichStructList.encode(message.entities, writer.uint32(50).fork()).ldelim();
|
5910
5924
|
}
|
5925
|
+
if (message.entityList !== undefined) {
|
5926
|
+
EntityList.encode(message.entityList, writer.uint32(58).fork()).ldelim();
|
5927
|
+
}
|
5911
5928
|
if (message.nextCursor !== undefined) {
|
5912
5929
|
writer.uint32(42).string(message.nextCursor);
|
5913
5930
|
}
|
@@ -5956,6 +5973,13 @@ export const DBResponse = {
|
|
5956
5973
|
|
5957
5974
|
message.entities = RichStructList.decode(reader, reader.uint32());
|
5958
5975
|
continue;
|
5976
|
+
case 7:
|
5977
|
+
if (tag !== 58) {
|
5978
|
+
break;
|
5979
|
+
}
|
5980
|
+
|
5981
|
+
message.entityList = EntityList.decode(reader, reader.uint32());
|
5982
|
+
continue;
|
5959
5983
|
case 5:
|
5960
5984
|
if (tag !== 42) {
|
5961
5985
|
break;
|
@@ -5979,6 +6003,7 @@ export const DBResponse = {
|
|
5979
6003
|
list: globalThis.Array.isArray(object.list) ? [...object.list] : undefined,
|
5980
6004
|
error: isSet(object.error) ? globalThis.String(object.error) : undefined,
|
5981
6005
|
entities: isSet(object.entities) ? RichStructList.fromJSON(object.entities) : undefined,
|
6006
|
+
entityList: isSet(object.entityList) ? EntityList.fromJSON(object.entityList) : undefined,
|
5982
6007
|
nextCursor: isSet(object.nextCursor) ? globalThis.String(object.nextCursor) : undefined,
|
5983
6008
|
};
|
5984
6009
|
},
|
@@ -6000,6 +6025,9 @@ export const DBResponse = {
|
|
6000
6025
|
if (message.entities !== undefined) {
|
6001
6026
|
obj.entities = RichStructList.toJSON(message.entities);
|
6002
6027
|
}
|
6028
|
+
if (message.entityList !== undefined) {
|
6029
|
+
obj.entityList = EntityList.toJSON(message.entityList);
|
6030
|
+
}
|
6003
6031
|
if (message.nextCursor !== undefined) {
|
6004
6032
|
obj.nextCursor = message.nextCursor;
|
6005
6033
|
}
|
@@ -6018,11 +6046,197 @@ export const DBResponse = {
|
|
6018
6046
|
message.entities = (object.entities !== undefined && object.entities !== null)
|
6019
6047
|
? RichStructList.fromPartial(object.entities)
|
6020
6048
|
: undefined;
|
6049
|
+
message.entityList = (object.entityList !== undefined && object.entityList !== null)
|
6050
|
+
? EntityList.fromPartial(object.entityList)
|
6051
|
+
: undefined;
|
6021
6052
|
message.nextCursor = object.nextCursor ?? undefined;
|
6022
6053
|
return message;
|
6023
6054
|
},
|
6024
6055
|
};
|
6025
6056
|
|
6057
|
+
function createBaseEntity(): Entity {
|
6058
|
+
return { entity: "", genBlockNumber: BigInt("0"), genBlockChain: "", genBlockTime: undefined, data: undefined };
|
6059
|
+
}
|
6060
|
+
|
6061
|
+
export const Entity = {
|
6062
|
+
encode(message: Entity, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
|
6063
|
+
if (message.entity !== "") {
|
6064
|
+
writer.uint32(10).string(message.entity);
|
6065
|
+
}
|
6066
|
+
if (message.genBlockNumber !== BigInt("0")) {
|
6067
|
+
if (BigInt.asUintN(64, message.genBlockNumber) !== message.genBlockNumber) {
|
6068
|
+
throw new globalThis.Error("value provided for field message.genBlockNumber of type uint64 too large");
|
6069
|
+
}
|
6070
|
+
writer.uint32(16).uint64(message.genBlockNumber.toString());
|
6071
|
+
}
|
6072
|
+
if (message.genBlockChain !== "") {
|
6073
|
+
writer.uint32(26).string(message.genBlockChain);
|
6074
|
+
}
|
6075
|
+
if (message.genBlockTime !== undefined) {
|
6076
|
+
Timestamp.encode(toTimestamp(message.genBlockTime), writer.uint32(34).fork()).ldelim();
|
6077
|
+
}
|
6078
|
+
if (message.data !== undefined) {
|
6079
|
+
RichStruct.encode(message.data, writer.uint32(42).fork()).ldelim();
|
6080
|
+
}
|
6081
|
+
return writer;
|
6082
|
+
},
|
6083
|
+
|
6084
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): Entity {
|
6085
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
6086
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
6087
|
+
const message = createBaseEntity();
|
6088
|
+
while (reader.pos < end) {
|
6089
|
+
const tag = reader.uint32();
|
6090
|
+
switch (tag >>> 3) {
|
6091
|
+
case 1:
|
6092
|
+
if (tag !== 10) {
|
6093
|
+
break;
|
6094
|
+
}
|
6095
|
+
|
6096
|
+
message.entity = reader.string();
|
6097
|
+
continue;
|
6098
|
+
case 2:
|
6099
|
+
if (tag !== 16) {
|
6100
|
+
break;
|
6101
|
+
}
|
6102
|
+
|
6103
|
+
message.genBlockNumber = longToBigint(reader.uint64() as Long);
|
6104
|
+
continue;
|
6105
|
+
case 3:
|
6106
|
+
if (tag !== 26) {
|
6107
|
+
break;
|
6108
|
+
}
|
6109
|
+
|
6110
|
+
message.genBlockChain = reader.string();
|
6111
|
+
continue;
|
6112
|
+
case 4:
|
6113
|
+
if (tag !== 34) {
|
6114
|
+
break;
|
6115
|
+
}
|
6116
|
+
|
6117
|
+
message.genBlockTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
|
6118
|
+
continue;
|
6119
|
+
case 5:
|
6120
|
+
if (tag !== 42) {
|
6121
|
+
break;
|
6122
|
+
}
|
6123
|
+
|
6124
|
+
message.data = RichStruct.decode(reader, reader.uint32());
|
6125
|
+
continue;
|
6126
|
+
}
|
6127
|
+
if ((tag & 7) === 4 || tag === 0) {
|
6128
|
+
break;
|
6129
|
+
}
|
6130
|
+
reader.skipType(tag & 7);
|
6131
|
+
}
|
6132
|
+
return message;
|
6133
|
+
},
|
6134
|
+
|
6135
|
+
fromJSON(object: any): Entity {
|
6136
|
+
return {
|
6137
|
+
entity: isSet(object.entity) ? globalThis.String(object.entity) : "",
|
6138
|
+
genBlockNumber: isSet(object.genBlockNumber) ? BigInt(object.genBlockNumber) : BigInt("0"),
|
6139
|
+
genBlockChain: isSet(object.genBlockChain) ? globalThis.String(object.genBlockChain) : "",
|
6140
|
+
genBlockTime: isSet(object.genBlockTime) ? fromJsonTimestamp(object.genBlockTime) : undefined,
|
6141
|
+
data: isSet(object.data) ? RichStruct.fromJSON(object.data) : undefined,
|
6142
|
+
};
|
6143
|
+
},
|
6144
|
+
|
6145
|
+
toJSON(message: Entity): unknown {
|
6146
|
+
const obj: any = {};
|
6147
|
+
if (message.entity !== "") {
|
6148
|
+
obj.entity = message.entity;
|
6149
|
+
}
|
6150
|
+
if (message.genBlockNumber !== BigInt("0")) {
|
6151
|
+
obj.genBlockNumber = message.genBlockNumber.toString();
|
6152
|
+
}
|
6153
|
+
if (message.genBlockChain !== "") {
|
6154
|
+
obj.genBlockChain = message.genBlockChain;
|
6155
|
+
}
|
6156
|
+
if (message.genBlockTime !== undefined) {
|
6157
|
+
obj.genBlockTime = message.genBlockTime.toISOString();
|
6158
|
+
}
|
6159
|
+
if (message.data !== undefined) {
|
6160
|
+
obj.data = RichStruct.toJSON(message.data);
|
6161
|
+
}
|
6162
|
+
return obj;
|
6163
|
+
},
|
6164
|
+
|
6165
|
+
create(base?: DeepPartial<Entity>): Entity {
|
6166
|
+
return Entity.fromPartial(base ?? {});
|
6167
|
+
},
|
6168
|
+
fromPartial(object: DeepPartial<Entity>): Entity {
|
6169
|
+
const message = createBaseEntity();
|
6170
|
+
message.entity = object.entity ?? "";
|
6171
|
+
message.genBlockNumber = object.genBlockNumber ?? BigInt("0");
|
6172
|
+
message.genBlockChain = object.genBlockChain ?? "";
|
6173
|
+
message.genBlockTime = object.genBlockTime ?? undefined;
|
6174
|
+
message.data = (object.data !== undefined && object.data !== null)
|
6175
|
+
? RichStruct.fromPartial(object.data)
|
6176
|
+
: undefined;
|
6177
|
+
return message;
|
6178
|
+
},
|
6179
|
+
};
|
6180
|
+
|
6181
|
+
function createBaseEntityList(): EntityList {
|
6182
|
+
return { entities: [] };
|
6183
|
+
}
|
6184
|
+
|
6185
|
+
export const EntityList = {
|
6186
|
+
encode(message: EntityList, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
|
6187
|
+
for (const v of message.entities) {
|
6188
|
+
Entity.encode(v!, writer.uint32(10).fork()).ldelim();
|
6189
|
+
}
|
6190
|
+
return writer;
|
6191
|
+
},
|
6192
|
+
|
6193
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): EntityList {
|
6194
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
6195
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
6196
|
+
const message = createBaseEntityList();
|
6197
|
+
while (reader.pos < end) {
|
6198
|
+
const tag = reader.uint32();
|
6199
|
+
switch (tag >>> 3) {
|
6200
|
+
case 1:
|
6201
|
+
if (tag !== 10) {
|
6202
|
+
break;
|
6203
|
+
}
|
6204
|
+
|
6205
|
+
message.entities.push(Entity.decode(reader, reader.uint32()));
|
6206
|
+
continue;
|
6207
|
+
}
|
6208
|
+
if ((tag & 7) === 4 || tag === 0) {
|
6209
|
+
break;
|
6210
|
+
}
|
6211
|
+
reader.skipType(tag & 7);
|
6212
|
+
}
|
6213
|
+
return message;
|
6214
|
+
},
|
6215
|
+
|
6216
|
+
fromJSON(object: any): EntityList {
|
6217
|
+
return {
|
6218
|
+
entities: globalThis.Array.isArray(object?.entities) ? object.entities.map((e: any) => Entity.fromJSON(e)) : [],
|
6219
|
+
};
|
6220
|
+
},
|
6221
|
+
|
6222
|
+
toJSON(message: EntityList): unknown {
|
6223
|
+
const obj: any = {};
|
6224
|
+
if (message.entities?.length) {
|
6225
|
+
obj.entities = message.entities.map((e) => Entity.toJSON(e));
|
6226
|
+
}
|
6227
|
+
return obj;
|
6228
|
+
},
|
6229
|
+
|
6230
|
+
create(base?: DeepPartial<EntityList>): EntityList {
|
6231
|
+
return EntityList.fromPartial(base ?? {});
|
6232
|
+
},
|
6233
|
+
fromPartial(object: DeepPartial<EntityList>): EntityList {
|
6234
|
+
const message = createBaseEntityList();
|
6235
|
+
message.entities = object.entities?.map((e) => Entity.fromPartial(e)) || [];
|
6236
|
+
return message;
|
6237
|
+
},
|
6238
|
+
};
|
6239
|
+
|
6026
6240
|
function createBaseDBRequest(): DBRequest {
|
6027
6241
|
return { opId: BigInt("0"), get: undefined, upsert: undefined, delete: undefined, list: undefined };
|
6028
6242
|
}
|
@@ -1871,7 +1871,6 @@ export function richValue_NullValueToJSON(object: RichValue_NullValue): string {
|
|
1871
1871
|
|
1872
1872
|
export interface RichStruct {
|
1873
1873
|
fields: { [key: string]: RichValue };
|
1874
|
-
entityName: string;
|
1875
1874
|
}
|
1876
1875
|
|
1877
1876
|
export interface RichStruct_FieldsEntry {
|
@@ -12741,7 +12740,7 @@ export const RichValue = {
|
|
12741
12740
|
};
|
12742
12741
|
|
12743
12742
|
function createBaseRichStruct(): RichStruct {
|
12744
|
-
return { fields: {}
|
12743
|
+
return { fields: {} };
|
12745
12744
|
}
|
12746
12745
|
|
12747
12746
|
export const RichStruct = {
|
@@ -12749,9 +12748,6 @@ export const RichStruct = {
|
|
12749
12748
|
Object.entries(message.fields).forEach(([key, value]) => {
|
12750
12749
|
RichStruct_FieldsEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).ldelim();
|
12751
12750
|
});
|
12752
|
-
if (message.entityName !== "") {
|
12753
|
-
writer.uint32(18).string(message.entityName);
|
12754
|
-
}
|
12755
12751
|
return writer;
|
12756
12752
|
},
|
12757
12753
|
|
@@ -12772,13 +12768,6 @@ export const RichStruct = {
|
|
12772
12768
|
message.fields[entry1.key] = entry1.value;
|
12773
12769
|
}
|
12774
12770
|
continue;
|
12775
|
-
case 2:
|
12776
|
-
if (tag !== 18) {
|
12777
|
-
break;
|
12778
|
-
}
|
12779
|
-
|
12780
|
-
message.entityName = reader.string();
|
12781
|
-
continue;
|
12782
12771
|
}
|
12783
12772
|
if ((tag & 7) === 4 || tag === 0) {
|
12784
12773
|
break;
|
@@ -12796,7 +12785,6 @@ export const RichStruct = {
|
|
12796
12785
|
return acc;
|
12797
12786
|
}, {})
|
12798
12787
|
: {},
|
12799
|
-
entityName: isSet(object.entityName) ? globalThis.String(object.entityName) : "",
|
12800
12788
|
};
|
12801
12789
|
},
|
12802
12790
|
|
@@ -12811,9 +12799,6 @@ export const RichStruct = {
|
|
12811
12799
|
});
|
12812
12800
|
}
|
12813
12801
|
}
|
12814
|
-
if (message.entityName !== "") {
|
12815
|
-
obj.entityName = message.entityName;
|
12816
|
-
}
|
12817
12802
|
return obj;
|
12818
12803
|
},
|
12819
12804
|
|
@@ -12828,7 +12813,6 @@ export const RichStruct = {
|
|
12828
12813
|
}
|
12829
12814
|
return acc;
|
12830
12815
|
}, {});
|
12831
|
-
message.entityName = object.entityName ?? "";
|
12832
12816
|
return message;
|
12833
12817
|
},
|
12834
12818
|
};
|
package/src/service.ts
CHANGED
@@ -25,7 +25,6 @@ import { freezeGlobalConfig, GLOBAL_CONFIG } from './global-config.js'
|
|
25
25
|
|
26
26
|
import { StoreContext } from './db-context.js'
|
27
27
|
import { Subject } from 'rxjs'
|
28
|
-
|
29
28
|
;(BigInt.prototype as any).toJSON = function () {
|
30
29
|
return this.toString()
|
31
30
|
}
|
@@ -167,44 +166,51 @@ export class ProcessorServiceImpl implements ProcessorServiceImplementation {
|
|
167
166
|
}
|
168
167
|
|
169
168
|
const subject = new Subject<DeepPartial<ProcessStreamResponse>>()
|
170
|
-
|
171
|
-
new Promise(async (resolve, reject) => {
|
172
|
-
for await (const request of requests) {
|
173
|
-
if (request.binding) {
|
174
|
-
const binding = request.binding
|
175
|
-
const dbContext = new StoreContext(subject, request.processId)
|
176
|
-
contexts[request.processId] = dbContext
|
177
|
-
PluginManager.INSTANCE.processBinding(binding, dbContext)
|
178
|
-
.then((result) => {
|
179
|
-
subject.next({
|
180
|
-
result,
|
181
|
-
processId: request.processId
|
182
|
-
})
|
183
|
-
recordRuntimeInfo(result, binding.handlerType)
|
184
|
-
})
|
185
|
-
.catch((e) => {
|
186
|
-
dbContext.error(request.processId, e)
|
187
|
-
})
|
188
|
-
.finally(() => {
|
189
|
-
delete contexts[request.processId]
|
190
|
-
})
|
191
|
-
}
|
192
|
-
if (request.dbResult) {
|
193
|
-
const dbContext = contexts[request.processId]
|
194
|
-
dbContext?.result(request.dbResult)
|
195
|
-
}
|
196
|
-
}
|
197
|
-
resolve(null)
|
198
|
-
})
|
169
|
+
this.handleRequests(requests, subject)
|
199
170
|
.then(() => {
|
200
171
|
subject.complete()
|
201
172
|
})
|
202
173
|
.catch((e) => {
|
203
|
-
|
174
|
+
console.error(e)
|
204
175
|
subject.error(e)
|
205
176
|
})
|
206
177
|
yield* from(subject).pipe(withAbort(context.signal))
|
207
178
|
}
|
179
|
+
|
180
|
+
private async handleRequests(
|
181
|
+
requests: AsyncIterable<ProcessStreamRequest>,
|
182
|
+
subject: Subject<DeepPartial<ProcessStreamResponse>>
|
183
|
+
) {
|
184
|
+
const contexts: Record<number, StoreContext> = {}
|
185
|
+
|
186
|
+
for await (const request of requests) {
|
187
|
+
console.debug('received request:', request)
|
188
|
+
if (request.binding) {
|
189
|
+
const binding = request.binding
|
190
|
+
const dbContext = new StoreContext(subject, request.processId)
|
191
|
+
contexts[request.processId] = dbContext
|
192
|
+
PluginManager.INSTANCE.processBinding(binding, dbContext)
|
193
|
+
.then((result) => {
|
194
|
+
subject.next({
|
195
|
+
result,
|
196
|
+
processId: request.processId
|
197
|
+
})
|
198
|
+
recordRuntimeInfo(result, binding.handlerType)
|
199
|
+
})
|
200
|
+
.catch((e) => {
|
201
|
+
console.error(e)
|
202
|
+
dbContext.error(request.processId, e)
|
203
|
+
})
|
204
|
+
.finally(() => {
|
205
|
+
delete contexts[request.processId]
|
206
|
+
})
|
207
|
+
}
|
208
|
+
if (request.dbResult) {
|
209
|
+
const dbContext = contexts[request.processId]
|
210
|
+
dbContext?.result(request.dbResult)
|
211
|
+
}
|
212
|
+
}
|
213
|
+
}
|
208
214
|
}
|
209
215
|
|
210
216
|
function recordRuntimeInfo(results: ProcessResult, handlerType: HandlerType) {
|