@restatedev/restate-sdk 0.0.0-SNAPSHOT-20231025205407
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/README.md +157 -0
- package/dist/connection/connection.d.ts +19 -0
- package/dist/connection/connection.d.ts.map +1 -0
- package/dist/connection/connection.js +13 -0
- package/dist/connection/connection.js.map +1 -0
- package/dist/connection/embedded_connection.d.ts +22 -0
- package/dist/connection/embedded_connection.d.ts.map +1 -0
- package/dist/connection/embedded_connection.js +78 -0
- package/dist/connection/embedded_connection.js.map +1 -0
- package/dist/connection/http_connection.d.ts +73 -0
- package/dist/connection/http_connection.d.ts.map +1 -0
- package/dist/connection/http_connection.js +203 -0
- package/dist/connection/http_connection.js.map +1 -0
- package/dist/connection/lambda_connection.d.ts +14 -0
- package/dist/connection/lambda_connection.d.ts.map +1 -0
- package/dist/connection/lambda_connection.js +56 -0
- package/dist/connection/lambda_connection.js.map +1 -0
- package/dist/embedded/api.d.ts +18 -0
- package/dist/embedded/api.d.ts.map +1 -0
- package/dist/embedded/api.js +37 -0
- package/dist/embedded/api.js.map +1 -0
- package/dist/embedded/handler.d.ts +4 -0
- package/dist/embedded/handler.d.ts.map +1 -0
- package/dist/embedded/handler.js +28 -0
- package/dist/embedded/handler.js.map +1 -0
- package/dist/embedded/http2_remote.d.ts +10 -0
- package/dist/embedded/http2_remote.d.ts.map +1 -0
- package/dist/embedded/http2_remote.js +85 -0
- package/dist/embedded/http2_remote.js.map +1 -0
- package/dist/embedded/invocation.d.ts +4 -0
- package/dist/embedded/invocation.d.ts.map +1 -0
- package/dist/embedded/invocation.js +90 -0
- package/dist/embedded/invocation.js.map +1 -0
- package/dist/generated/dev/restate/events.d.ts +96 -0
- package/dist/generated/dev/restate/events.d.ts.map +1 -0
- package/dist/generated/dev/restate/events.js +371 -0
- package/dist/generated/dev/restate/events.js.map +1 -0
- package/dist/generated/dev/restate/ext.d.ts +88 -0
- package/dist/generated/dev/restate/ext.d.ts.map +1 -0
- package/dist/generated/dev/restate/ext.js +212 -0
- package/dist/generated/dev/restate/ext.js.map +1 -0
- package/dist/generated/google/protobuf/descriptor.d.ts +1204 -0
- package/dist/generated/google/protobuf/descriptor.d.ts.map +1 -0
- package/dist/generated/google/protobuf/descriptor.js +6676 -0
- package/dist/generated/google/protobuf/descriptor.js.map +1 -0
- package/dist/generated/google/protobuf/empty.d.ts +86 -0
- package/dist/generated/google/protobuf/empty.d.ts.map +1 -0
- package/dist/generated/google/protobuf/empty.js +107 -0
- package/dist/generated/google/protobuf/empty.js.map +1 -0
- package/dist/generated/google/protobuf/struct.d.ts +175 -0
- package/dist/generated/google/protobuf/struct.d.ts.map +1 -0
- package/dist/generated/google/protobuf/struct.js +754 -0
- package/dist/generated/google/protobuf/struct.js.map +1 -0
- package/dist/generated/proto/discovery.d.ts +105 -0
- package/dist/generated/proto/discovery.d.ts.map +1 -0
- package/dist/generated/proto/discovery.js +364 -0
- package/dist/generated/proto/discovery.js.map +1 -0
- package/dist/generated/proto/dynrpc.d.ts +150 -0
- package/dist/generated/proto/dynrpc.d.ts.map +1 -0
- package/dist/generated/proto/dynrpc.js +668 -0
- package/dist/generated/proto/dynrpc.js.map +1 -0
- package/dist/generated/proto/javascript.d.ts +97 -0
- package/dist/generated/proto/javascript.d.ts.map +1 -0
- package/dist/generated/proto/javascript.js +297 -0
- package/dist/generated/proto/javascript.js.map +1 -0
- package/dist/generated/proto/protocol.d.ts +371 -0
- package/dist/generated/proto/protocol.d.ts.map +1 -0
- package/dist/generated/proto/protocol.js +2179 -0
- package/dist/generated/proto/protocol.js.map +1 -0
- package/dist/generated/proto/services.d.ts +307 -0
- package/dist/generated/proto/services.d.ts.map +1 -0
- package/dist/generated/proto/services.js +1535 -0
- package/dist/generated/proto/services.js.map +1 -0
- package/dist/generated/proto/test.d.ts +116 -0
- package/dist/generated/proto/test.d.ts.map +1 -0
- package/dist/generated/proto/test.js +321 -0
- package/dist/generated/proto/test.js.map +1 -0
- package/dist/invocation.d.ts +39 -0
- package/dist/invocation.d.ts.map +1 -0
- package/dist/invocation.js +138 -0
- package/dist/invocation.js.map +1 -0
- package/dist/io/decoder.d.ts +8 -0
- package/dist/io/decoder.d.ts.map +1 -0
- package/dist/io/decoder.js +133 -0
- package/dist/io/decoder.js.map +1 -0
- package/dist/io/encoder.d.ts +7 -0
- package/dist/io/encoder.d.ts.map +1 -0
- package/dist/io/encoder.js +57 -0
- package/dist/io/encoder.js.map +1 -0
- package/dist/journal.d.ts +42 -0
- package/dist/journal.d.ts.map +1 -0
- package/dist/journal.js +368 -0
- package/dist/journal.js.map +1 -0
- package/dist/local_state_store.d.ts +13 -0
- package/dist/local_state_store.d.ts.map +1 -0
- package/dist/local_state_store.js +72 -0
- package/dist/local_state_store.js.map +1 -0
- package/dist/public_api.d.ts +10 -0
- package/dist/public_api.d.ts.map +1 -0
- package/dist/public_api.js +59 -0
- package/dist/public_api.js.map +1 -0
- package/dist/restate_context.d.ts +405 -0
- package/dist/restate_context.d.ts.map +1 -0
- package/dist/restate_context.js +46 -0
- package/dist/restate_context.js.map +1 -0
- package/dist/restate_context_impl.d.ts +54 -0
- package/dist/restate_context_impl.d.ts.map +1 -0
- package/dist/restate_context_impl.js +364 -0
- package/dist/restate_context_impl.js.map +1 -0
- package/dist/server/base_restate_server.d.ts +30 -0
- package/dist/server/base_restate_server.d.ts.map +1 -0
- package/dist/server/base_restate_server.js +360 -0
- package/dist/server/base_restate_server.js.map +1 -0
- package/dist/server/restate_lambda_handler.d.ts +104 -0
- package/dist/server/restate_lambda_handler.d.ts.map +1 -0
- package/dist/server/restate_lambda_handler.js +245 -0
- package/dist/server/restate_lambda_handler.js.map +1 -0
- package/dist/server/restate_server.d.ts +91 -0
- package/dist/server/restate_server.d.ts.map +1 -0
- package/dist/server/restate_server.js +230 -0
- package/dist/server/restate_server.js.map +1 -0
- package/dist/state_machine.d.ts +75 -0
- package/dist/state_machine.d.ts.map +1 -0
- package/dist/state_machine.js +380 -0
- package/dist/state_machine.js.map +1 -0
- package/dist/types/errors.d.ts +40 -0
- package/dist/types/errors.d.ts.map +1 -0
- package/dist/types/errors.js +121 -0
- package/dist/types/errors.js.map +1 -0
- package/dist/types/grpc.d.ts +88 -0
- package/dist/types/grpc.d.ts.map +1 -0
- package/dist/types/grpc.js +68 -0
- package/dist/types/grpc.js.map +1 -0
- package/dist/types/protocol.d.ts +24 -0
- package/dist/types/protocol.d.ts.map +1 -0
- package/dist/types/protocol.js +115 -0
- package/dist/types/protocol.js.map +1 -0
- package/dist/types/router.d.ts +33 -0
- package/dist/types/router.d.ts.map +1 -0
- package/dist/types/router.js +36 -0
- package/dist/types/router.js.map +1 -0
- package/dist/types/types.d.ts +30 -0
- package/dist/types/types.d.ts.map +1 -0
- package/dist/types/types.js +125 -0
- package/dist/types/types.js.map +1 -0
- package/dist/utils/assumpsions.d.ts +8 -0
- package/dist/utils/assumpsions.d.ts.map +1 -0
- package/dist/utils/assumpsions.js +101 -0
- package/dist/utils/assumpsions.js.map +1 -0
- package/dist/utils/logger.d.ts +60 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +102 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/public_utils.d.ts +58 -0
- package/dist/utils/public_utils.d.ts.map +1 -0
- package/dist/utils/public_utils.js +49 -0
- package/dist/utils/public_utils.js.map +1 -0
- package/dist/utils/utils.d.ts +14 -0
- package/dist/utils/utils.d.ts.map +1 -0
- package/dist/utils/utils.js +119 -0
- package/dist/utils/utils.js.map +1 -0
- package/package.json +75 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2023 - Restate Software, Inc., Restate GmbH
|
|
4
|
+
*
|
|
5
|
+
* This file is part of the Restate SDK for Node.js/TypeScript,
|
|
6
|
+
* which is released under the MIT license.
|
|
7
|
+
*
|
|
8
|
+
* You can find a copy of the license in file LICENSE in the root
|
|
9
|
+
* directory of this repository or package, or at
|
|
10
|
+
* https://github.com/restatedev/sdk-typescript/blob/main/LICENSE
|
|
11
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.LambdaConnection = void 0;
|
|
14
|
+
const encoder_1 = require("../io/encoder");
|
|
15
|
+
const protocol_1 = require("../types/protocol");
|
|
16
|
+
const logger_1 = require("../utils/logger");
|
|
17
|
+
const RESOLVED = Promise.resolve();
|
|
18
|
+
class LambdaConnection {
|
|
19
|
+
// Empty buffer to store journal output messages
|
|
20
|
+
outputBuffer = Buffer.alloc(0);
|
|
21
|
+
suspendedOrCompleted = false;
|
|
22
|
+
// Callback to resolve the invocation promise of the Lambda handler when the response is ready
|
|
23
|
+
completionPromise;
|
|
24
|
+
resolveOnCompleted;
|
|
25
|
+
constructor() {
|
|
26
|
+
// Promise that signals when the invocation is over, to then flush the messages
|
|
27
|
+
this.completionPromise = new Promise((resolve) => {
|
|
28
|
+
this.resolveOnCompleted = resolve;
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
// Send a message back to the runtime
|
|
32
|
+
send(msg) {
|
|
33
|
+
// Add the header and the body to buffer and add to the output buffer
|
|
34
|
+
const msgBuffer = (0, encoder_1.encodeMessage)(msg);
|
|
35
|
+
this.outputBuffer = Buffer.concat([this.outputBuffer, msgBuffer]);
|
|
36
|
+
// An output message or suspension message is the end of a Lambda invocation
|
|
37
|
+
if (msg.messageType === protocol_1.OUTPUT_STREAM_ENTRY_MESSAGE_TYPE ||
|
|
38
|
+
msg.messageType === protocol_1.SUSPENSION_MESSAGE_TYPE) {
|
|
39
|
+
this.suspendedOrCompleted = true;
|
|
40
|
+
}
|
|
41
|
+
return RESOLVED;
|
|
42
|
+
}
|
|
43
|
+
getResult() {
|
|
44
|
+
return this.completionPromise;
|
|
45
|
+
}
|
|
46
|
+
end() {
|
|
47
|
+
if (this.suspendedOrCompleted) {
|
|
48
|
+
logger_1.rlog.debug("Flushing output buffer...");
|
|
49
|
+
this.resolveOnCompleted(this.outputBuffer);
|
|
50
|
+
}
|
|
51
|
+
this.outputBuffer = Buffer.alloc(0);
|
|
52
|
+
return RESOLVED;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
exports.LambdaConnection = LambdaConnection;
|
|
56
|
+
//# sourceMappingURL=lambda_connection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lambda_connection.js","sourceRoot":"","sources":["../../src/connection/lambda_connection.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AAGH,2CAA8C;AAC9C,gDAG2B;AAE3B,4CAAuC;AAEvC,MAAM,QAAQ,GAAkB,OAAO,CAAC,OAAO,EAAE,CAAC;AAElD,MAAa,gBAAgB;IAC3B,gDAAgD;IACxC,YAAY,GAAW,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACvC,oBAAoB,GAAG,KAAK,CAAC;IAErC,8FAA8F;IAC7E,iBAAiB,CAAkB;IAC5C,kBAAkB,CAAiD;IAE3E;QACE,+EAA+E;QAC/E,IAAI,CAAC,iBAAiB,GAAG,IAAI,OAAO,CAAS,CAAC,OAAO,EAAE,EAAE;YACvD,IAAI,CAAC,kBAAkB,GAAG,OAAO,CAAC;QACpC,CAAC,CAAC,CAAC;IACL,CAAC;IAED,qCAAqC;IACrC,IAAI,CAAC,GAAY;QACf,qEAAqE;QACrE,MAAM,SAAS,GAAG,IAAA,uBAAa,EAAC,GAAG,CAAC,CAAC;QACrC,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC,CAAC;QAElE,4EAA4E;QAC5E,IACE,GAAG,CAAC,WAAW,KAAK,2CAAgC;YACpD,GAAG,CAAC,WAAW,KAAK,kCAAuB,EAC3C;YACA,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC;SAClC;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,SAAS;QACP,OAAO,IAAI,CAAC,iBAAiB,CAAC;IAChC,CAAC;IAED,GAAG;QACD,IAAI,IAAI,CAAC,oBAAoB,EAAE;YAC7B,aAAI,CAAC,KAAK,CAAC,2BAA2B,CAAC,CAAC;YACxC,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;SAC5C;QACD,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACpC,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF;AA7CD,4CA6CC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { RpcContext } from "../restate_context";
|
|
2
|
+
export type RestateConnectionOptions = {
|
|
3
|
+
ingress: string;
|
|
4
|
+
};
|
|
5
|
+
export type RestateInvocationOptions<I, O> = {
|
|
6
|
+
id: string;
|
|
7
|
+
handler: (ctx: RpcContext, input: I) => Promise<O>;
|
|
8
|
+
input: I;
|
|
9
|
+
retain?: number;
|
|
10
|
+
};
|
|
11
|
+
export declare const connection: (opts: RestateConnectionOptions) => RestateConnection;
|
|
12
|
+
export declare class RestateConnection {
|
|
13
|
+
readonly opts: RestateConnectionOptions;
|
|
14
|
+
private remote;
|
|
15
|
+
constructor(opts: RestateConnectionOptions);
|
|
16
|
+
invoke<I, O>(opt: RestateInvocationOptions<I, O>): Promise<O>;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/embedded/api.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAOhD,MAAM,MAAM,wBAAwB,GAAG;IACrC,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,wBAAwB,CAAC,CAAC,EAAE,CAAC,IAAI;IAC3C,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,CAAC,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;IACnD,KAAK,EAAE,CAAC,CAAC;IACT,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,eAAO,MAAM,UAAU,SAAU,wBAAwB,KAAG,iBAC/B,CAAC;AAE9B,qBAAa,iBAAiB;IAGhB,QAAQ,CAAC,IAAI,EAAE,wBAAwB;IAFnD,OAAO,CAAC,MAAM,CAAgB;gBAET,IAAI,EAAE,wBAAwB;IAI5C,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,wBAAwB,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;CAKrE"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2023 - Restate Software, Inc., Restate GmbH
|
|
4
|
+
*
|
|
5
|
+
* This file is part of the Restate SDK for Node.js/TypeScript,
|
|
6
|
+
* which is released under the MIT license.
|
|
7
|
+
*
|
|
8
|
+
* You can find a copy of the license in file LICENSE in the root
|
|
9
|
+
* directory of this repository or package, or at
|
|
10
|
+
* https://github.com/restatedev/sdk-typescript/blob/main/LICENSE
|
|
11
|
+
*/
|
|
12
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
13
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
14
|
+
};
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.RestateConnection = exports.connection = void 0;
|
|
17
|
+
const invocation_1 = require("./invocation");
|
|
18
|
+
const handler_1 = require("./handler");
|
|
19
|
+
const crypto_1 = __importDefault(require("crypto"));
|
|
20
|
+
const http2_remote_1 = require("./http2_remote");
|
|
21
|
+
const connection = (opts) => new RestateConnection(opts);
|
|
22
|
+
exports.connection = connection;
|
|
23
|
+
class RestateConnection {
|
|
24
|
+
opts;
|
|
25
|
+
remote;
|
|
26
|
+
constructor(opts) {
|
|
27
|
+
this.opts = opts;
|
|
28
|
+
this.remote = (0, http2_remote_1.bufConnectRemoteContext)(opts.ingress);
|
|
29
|
+
}
|
|
30
|
+
invoke(opt) {
|
|
31
|
+
const method = (0, handler_1.wrapHandler)(opt.handler);
|
|
32
|
+
const streamId = crypto_1.default.randomUUID();
|
|
33
|
+
return (0, invocation_1.doInvoke)(this.remote, opt.id, streamId, method, opt.input);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.RestateConnection = RestateConnection;
|
|
37
|
+
//# sourceMappingURL=api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/embedded/api.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;;;;AAGH,6CAAwC;AACxC,uCAAwC;AACxC,oDAA4B;AAE5B,iDAAyD;AAalD,MAAM,UAAU,GAAG,CAAC,IAA8B,EAAqB,EAAE,CAC9E,IAAI,iBAAiB,CAAC,IAAI,CAAC,CAAC;AADjB,QAAA,UAAU,cACO;AAE9B,MAAa,iBAAiB;IAGP;IAFb,MAAM,CAAgB;IAE9B,YAAqB,IAA8B;QAA9B,SAAI,GAAJ,IAAI,CAA0B;QACjD,IAAI,CAAC,MAAM,GAAG,IAAA,sCAAuB,EAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACtD,CAAC;IAEM,MAAM,CAAO,GAAmC;QACrD,MAAM,MAAM,GAAG,IAAA,qBAAW,EAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACxC,MAAM,QAAQ,GAAG,gBAAM,CAAC,UAAU,EAAE,CAAC;QACrC,OAAO,IAAA,qBAAQ,EAAO,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC;IAC1E,CAAC;CACF;AAZD,8CAYC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { RpcContext } from "../restate_context";
|
|
2
|
+
import { HostedGrpcServiceMethod } from "../types/grpc";
|
|
3
|
+
export declare function wrapHandler<I, O>(handler: (ctx: RpcContext, input: I) => Promise<O>): HostedGrpcServiceMethod<I, O>;
|
|
4
|
+
//# sourceMappingURL=handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../src/embedded/handler.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,UAAU,EAAc,MAAM,oBAAoB,CAAC;AAE5D,OAAO,EAAqB,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAE3E,wBAAgB,WAAW,CAAC,CAAC,EAAE,CAAC,EAC9B,OAAO,EAAE,CAAC,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,GACjD,uBAAuB,CAAC,CAAC,EAAE,CAAC,CAAC,CAmB/B"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2023 - Restate Software, Inc., Restate GmbH
|
|
4
|
+
*
|
|
5
|
+
* This file is part of the Restate SDK for Node.js/TypeScript,
|
|
6
|
+
* which is released under the MIT license.
|
|
7
|
+
*
|
|
8
|
+
* You can find a copy of the license in file LICENSE in the root
|
|
9
|
+
* directory of this repository or package, or at
|
|
10
|
+
* https://github.com/restatedev/sdk-typescript/blob/main/LICENSE
|
|
11
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.wrapHandler = void 0;
|
|
14
|
+
const restate_context_1 = require("../restate_context");
|
|
15
|
+
const restate_context_impl_1 = require("../restate_context_impl");
|
|
16
|
+
const grpc_1 = require("../types/grpc");
|
|
17
|
+
function wrapHandler(handler) {
|
|
18
|
+
const localMethod = (instance, input) => {
|
|
19
|
+
const ctx = new restate_context_impl_1.RpcContextImpl((0, restate_context_1.useContext)(instance));
|
|
20
|
+
return handler(ctx, input);
|
|
21
|
+
};
|
|
22
|
+
const encoder = (output) => Buffer.from(JSON.stringify(output));
|
|
23
|
+
const decoder = (buf) => JSON.parse(buf.toString());
|
|
24
|
+
const method = new grpc_1.GrpcServiceMethod("", "", localMethod, decoder, encoder);
|
|
25
|
+
return new grpc_1.HostedGrpcServiceMethod({}, "", "", method);
|
|
26
|
+
}
|
|
27
|
+
exports.wrapHandler = wrapHandler;
|
|
28
|
+
//# sourceMappingURL=handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handler.js","sourceRoot":"","sources":["../../src/embedded/handler.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AAEH,wDAA4D;AAC5D,kEAAyD;AACzD,wCAA2E;AAE3E,SAAgB,WAAW,CACzB,OAAkD;IAElD,MAAM,WAAW,GAAG,CAAC,QAAiB,EAAE,KAAQ,EAAc,EAAE;QAC9D,MAAM,GAAG,GAAG,IAAI,qCAAc,CAAC,IAAA,4BAAU,EAAC,QAAQ,CAAC,CAAC,CAAC;QACrD,OAAO,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IAC7B,CAAC,CAAC;IAEF,MAAM,OAAO,GAAG,CAAC,MAAS,EAAc,EAAE,CACxC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;IACtC,MAAM,OAAO,GAAG,CAAC,GAAe,EAAK,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;IAEnE,MAAM,MAAM,GAAG,IAAI,wBAAiB,CAClC,EAAE,EACF,EAAE,EACF,WAAW,EACX,OAAO,EACP,OAAO,CACR,CAAC;IAEF,OAAO,IAAI,8BAAuB,CAAO,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,CAAC;AAC/D,CAAC;AArBD,kCAqBC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { RemoteContext } from "../generated/proto/services";
|
|
2
|
+
export declare class RequestError extends Error {
|
|
3
|
+
readonly url: string;
|
|
4
|
+
readonly status: number;
|
|
5
|
+
readonly statusText?: string | undefined;
|
|
6
|
+
constructor(url: string, status: number, statusText?: string | undefined);
|
|
7
|
+
precondtionFailed(): boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare const bufConnectRemoteContext: (url: string) => RemoteContext;
|
|
10
|
+
//# sourceMappingURL=http2_remote.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http2_remote.d.ts","sourceRoot":"","sources":["../../src/embedded/http2_remote.ts"],"names":[],"mappings":"AAaA,OAAO,EACL,aAAa,EAEd,MAAM,6BAA6B,CAAC;AAErC,qBAAa,YAAa,SAAQ,KAAK;aAEnB,GAAG,EAAE,MAAM;aACX,MAAM,EAAE,MAAM;aACd,UAAU,CAAC;gBAFX,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,MAAM,EACd,UAAU,CAAC,oBAAQ;IAKrC,iBAAiB,IAAI,OAAO;CAG7B;AAED,eAAO,MAAM,uBAAuB,QAAS,MAAM,KAAG,aAOrD,CAAC"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2023 - Restate Software, Inc., Restate GmbH
|
|
4
|
+
*
|
|
5
|
+
* This file is part of the Restate SDK for Node.js/TypeScript,
|
|
6
|
+
* which is released under the MIT license.
|
|
7
|
+
*
|
|
8
|
+
* You can find a copy of the license in file LICENSE in the root
|
|
9
|
+
* directory of this repository or package, or at
|
|
10
|
+
* https://github.com/restatedev/sdk-typescript/blob/main/LICENSE
|
|
11
|
+
*/
|
|
12
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
13
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
14
|
+
};
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.bufConnectRemoteContext = exports.RequestError = void 0;
|
|
17
|
+
const node_http2_1 = __importDefault(require("node:http2"));
|
|
18
|
+
const events_1 = require("events");
|
|
19
|
+
const services_1 = require("../generated/proto/services");
|
|
20
|
+
class RequestError extends Error {
|
|
21
|
+
url;
|
|
22
|
+
status;
|
|
23
|
+
statusText;
|
|
24
|
+
constructor(url, status, statusText) {
|
|
25
|
+
super(`${status} ${statusText ?? ""}`);
|
|
26
|
+
this.url = url;
|
|
27
|
+
this.status = status;
|
|
28
|
+
this.statusText = statusText;
|
|
29
|
+
}
|
|
30
|
+
precondtionFailed() {
|
|
31
|
+
return this.status === node_http2_1.default.constants.HTTP_STATUS_PRECONDITION_FAILED;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.RequestError = RequestError;
|
|
35
|
+
const bufConnectRemoteContext = (url) => {
|
|
36
|
+
const httpClient = new ProtobufHttp2Client(url);
|
|
37
|
+
return new services_1.RemoteContextClientImpl({
|
|
38
|
+
request: (service, method, data) => httpClient.post(`/${service}/${method}`, data),
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
exports.bufConnectRemoteContext = bufConnectRemoteContext;
|
|
42
|
+
class ProtobufHttp2Client {
|
|
43
|
+
ingress;
|
|
44
|
+
session;
|
|
45
|
+
constructor(ingress) {
|
|
46
|
+
this.ingress = ingress;
|
|
47
|
+
}
|
|
48
|
+
async client() {
|
|
49
|
+
if (this.session !== undefined) {
|
|
50
|
+
return this.session;
|
|
51
|
+
}
|
|
52
|
+
const client = node_http2_1.default.connect(this.ingress);
|
|
53
|
+
client.unref();
|
|
54
|
+
client.once("goaway", () => {
|
|
55
|
+
this.session = undefined;
|
|
56
|
+
});
|
|
57
|
+
client.once("close", () => {
|
|
58
|
+
this.session = undefined;
|
|
59
|
+
});
|
|
60
|
+
this.session = client;
|
|
61
|
+
return client;
|
|
62
|
+
}
|
|
63
|
+
async post(path, body) {
|
|
64
|
+
const client = await this.client();
|
|
65
|
+
const req = client.request({
|
|
66
|
+
[node_http2_1.default.constants.HTTP2_HEADER_SCHEME]: "http",
|
|
67
|
+
[node_http2_1.default.constants.HTTP2_HEADER_METHOD]: node_http2_1.default.constants.HTTP2_METHOD_POST,
|
|
68
|
+
[node_http2_1.default.constants.HTTP2_HEADER_PATH]: path,
|
|
69
|
+
[node_http2_1.default.constants.HTTP2_HEADER_CONTENT_TYPE]: "application/proto",
|
|
70
|
+
[node_http2_1.default.constants.HTTP2_HEADER_CONTENT_LENGTH]: body.length,
|
|
71
|
+
});
|
|
72
|
+
req.end(body);
|
|
73
|
+
const [headers] = await (0, events_1.once)(req, "response");
|
|
74
|
+
const status = headers[node_http2_1.default.constants.HTTP2_HEADER_STATUS] ?? 0;
|
|
75
|
+
if (status !== 200) {
|
|
76
|
+
throw new RequestError(path, status);
|
|
77
|
+
}
|
|
78
|
+
const chunks = [];
|
|
79
|
+
for await (const chunk of req) {
|
|
80
|
+
chunks.push(chunk);
|
|
81
|
+
}
|
|
82
|
+
return Buffer.concat(chunks);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=http2_remote.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http2_remote.js","sourceRoot":"","sources":["../../src/embedded/http2_remote.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;;;;AAEH,4DAA+B;AAC/B,mCAA8B;AAC9B,0DAGqC;AAErC,MAAa,YAAa,SAAQ,KAAK;IAEnB;IACA;IACA;IAHlB,YACkB,GAAW,EACX,MAAc,EACd,UAAmB;QAEnC,KAAK,CAAC,GAAG,MAAM,IAAI,UAAU,IAAI,EAAE,EAAE,CAAC,CAAC;QAJvB,QAAG,GAAH,GAAG,CAAQ;QACX,WAAM,GAAN,MAAM,CAAQ;QACd,eAAU,GAAV,UAAU,CAAS;IAGrC,CAAC;IAED,iBAAiB;QACf,OAAO,IAAI,CAAC,MAAM,KAAK,oBAAK,C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AAO,CAAC;YACzB,CAAC,oBAAK,CAAC,SAAS,CAAC,mBAAmB,CAAC,EAAE,MAAM;YAC7C,CAAC,oBAAK,CAAC,SAAS,CAAC,mBAAmB,CAAC,EAAE,oBAAK,CAAC,SAAS,CAAC,iBAAiB;YACxE,CAAC,oBAAK,CAAC,SAAS,CAAC,iBAAiB,CAAC,EAAE,IAAI;YACzC,CAAC,oBAAK,CAAC,SAAS,CAAC,yBAAyB,CAAC,EAAE,mBAAmB;YAChE,CAAC,oBAAK,CAAC,SAAS,CAAC,2BAA2B,CAAC,EAAE,IAAI,CAAC,MAAM;SAC3D,CAAC,CAAC;QACH,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAEd,MAAM,CAAC,OAAO,CAAC,GAAG,MAAM,IAAA,aAAI,EAAC,GAAG,EAAE,UAAU,CAAC,CAAC;QAC9C,MAAM,MAAM,GAAG,OAAO,CAAC,oBAAK,CAAC,SAAS,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC;QACjE,IAAI,MAAM,KAAK,GAAG,EAAE;YAClB,MAAM,IAAI,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;SACtC;QACD,MAAM,MAAM,GAAG,EAAE,CAAC;QAClB,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,GAAG,EAAE;YAC7B,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;SACpB;QACD,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC/B,CAAC;CACF"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { RemoteContext } from "../generated/proto/services";
|
|
2
|
+
import { HostedGrpcServiceMethod } from "../types/grpc";
|
|
3
|
+
export declare const doInvoke: <I, O>(remote: RemoteContext, operationId: string, streamId: string, method: HostedGrpcServiceMethod<I, O>, input: I) => Promise<O>;
|
|
4
|
+
//# sourceMappingURL=invocation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invocation.d.ts","sourceRoot":"","sources":["../../src/embedded/invocation.ts"],"names":[],"mappings":"AAaA,OAAO,EAAqB,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE/E,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAQxD,eAAO,MAAM,QAAQ,iBACX,aAAa,eACR,MAAM,YACT,MAAM,gEAgFjB,CAAC"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2023 - Restate Software, Inc., Restate GmbH
|
|
4
|
+
*
|
|
5
|
+
* This file is part of the Restate SDK for Node.js/TypeScript,
|
|
6
|
+
* which is released under the MIT license.
|
|
7
|
+
*
|
|
8
|
+
* You can find a copy of the license in file LICENSE in the root
|
|
9
|
+
* directory of this repository or package, or at
|
|
10
|
+
* https://github.com/restatedev/sdk-typescript/blob/main/LICENSE
|
|
11
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.doInvoke = void 0;
|
|
14
|
+
const decoder_1 = require("../io/decoder");
|
|
15
|
+
const invocation_1 = require("../invocation");
|
|
16
|
+
const state_machine_1 = require("../state_machine");
|
|
17
|
+
const discovery_1 = require("../generated/proto/discovery");
|
|
18
|
+
const embedded_connection_1 = require("../connection/embedded_connection");
|
|
19
|
+
const doInvoke = async (remote, operationId, streamId, method, input) => {
|
|
20
|
+
//
|
|
21
|
+
// 1. ask to Start this execution.
|
|
22
|
+
//
|
|
23
|
+
const res = await remote.start({
|
|
24
|
+
operationId,
|
|
25
|
+
streamId,
|
|
26
|
+
retentionPeriodSec: 60,
|
|
27
|
+
argument: Buffer.from(JSON.stringify(input)),
|
|
28
|
+
});
|
|
29
|
+
if (res.completed !== undefined) {
|
|
30
|
+
return unwrap(res.completed);
|
|
31
|
+
}
|
|
32
|
+
//
|
|
33
|
+
// 2. rebuild the previous execution state
|
|
34
|
+
//
|
|
35
|
+
const messages = (0, decoder_1.decodeMessagesBuffer)(res.executing ?? Buffer.alloc(0));
|
|
36
|
+
const journalBuilder = new invocation_1.InvocationBuilder(method);
|
|
37
|
+
messages.forEach((e) => journalBuilder.handleMessage(e));
|
|
38
|
+
const journal = journalBuilder.build();
|
|
39
|
+
//
|
|
40
|
+
// 3. resume the execution state machine
|
|
41
|
+
//
|
|
42
|
+
const connection = new embedded_connection_1.EmbeddedConnection(operationId, streamId, remote);
|
|
43
|
+
const stateMachine = new state_machine_1.StateMachine(connection, journal, discovery_1.ProtocolMode.BIDI_STREAM);
|
|
44
|
+
//
|
|
45
|
+
// 4. track the state machine execution result
|
|
46
|
+
//
|
|
47
|
+
let done = false;
|
|
48
|
+
const invocation = stateMachine.invoke().finally(() => (done = true));
|
|
49
|
+
//
|
|
50
|
+
// 5. keep pulling for input and feeding this to the fsm.
|
|
51
|
+
//
|
|
52
|
+
try {
|
|
53
|
+
while (!done) {
|
|
54
|
+
const recv = await remote.recv({
|
|
55
|
+
operationId,
|
|
56
|
+
streamId,
|
|
57
|
+
});
|
|
58
|
+
if (recv.invalidStream !== undefined) {
|
|
59
|
+
throw new embedded_connection_1.FencedOffError();
|
|
60
|
+
}
|
|
61
|
+
if (recv.invocationCompleted !== undefined) {
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
const buffer = recv.messages ?? Buffer.alloc(0);
|
|
65
|
+
const messages = (0, decoder_1.decodeMessagesBuffer)(buffer);
|
|
66
|
+
messages.forEach((m) => stateMachine.handleMessage(m));
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
catch (e) {
|
|
70
|
+
stateMachine.handleStreamError(e);
|
|
71
|
+
throw e;
|
|
72
|
+
}
|
|
73
|
+
//
|
|
74
|
+
// 6. wait for the state machine to complete the invocation
|
|
75
|
+
//
|
|
76
|
+
const maybeResult = await invocation;
|
|
77
|
+
if (maybeResult instanceof Buffer) {
|
|
78
|
+
return JSON.parse(maybeResult.toString());
|
|
79
|
+
}
|
|
80
|
+
// TODO: no sure what to do here. The state machine has decided to be suspended?
|
|
81
|
+
throw new Error("suspended");
|
|
82
|
+
};
|
|
83
|
+
exports.doInvoke = doInvoke;
|
|
84
|
+
const unwrap = (response) => {
|
|
85
|
+
if (response.success === undefined) {
|
|
86
|
+
throw new Error(response.failure?.message ?? "");
|
|
87
|
+
}
|
|
88
|
+
return JSON.parse(response.success.toString());
|
|
89
|
+
};
|
|
90
|
+
//# sourceMappingURL=invocation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invocation.js","sourceRoot":"","sources":["../../src/embedded/invocation.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AAEH,2CAAqD;AAGrD,8CAAkD;AAElD,oDAAgD;AAChD,4DAA4D;AAC5D,2EAG2C;AAEpC,MAAM,QAAQ,GAAG,KAAK,EAC3B,MAAqB,EACrB,WAAmB,EACnB,QAAgB,EAChB,MAAqC,EACrC,KAAQ,EACI,EAAE;IACd,EAAE;IACF,kCAAkC;IAClC,EAAE;IAEF,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC;QAC7B,WAAW;QACX,QAAQ;QACR,kBAAkB,EAAE,EAAE;QACtB,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;KAC7C,CAAC,CAAC;IAEH,IAAI,GAAG,CAAC,SAAS,KAAK,SAAS,EAAE;QAC/B,OAAO,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;KAC9B;IAED,EAAE;IACF,0CAA0C;IAC1C,EAAE;IAEF,MAAM,QAAQ,GAAG,IAAA,8BAAoB,EAAC,GAAG,CAAC,SAAS,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IACxE,MAAM,cAAc,GAAG,IAAI,8BAAiB,CAAC,MAAM,CAAC,CAAC;IACrD,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAU,EAAE,EAAE,CAAC,cAA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C;KACT;IAED,EAAE;IACF,2DAA2D;IAC3D,EAAE;IACF,MAAM,WAAW,GAAG,MAAM,UAAU,CAAC;IACrC,IAAI,WAAW,YAAY,MAAM,EAAE;QACjC,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC,CAAC;KAC3C;IAED,gFAAgF;IAChF,MAAM,IAAI,KAAK,CAAC,WAAW,CAAC,CAAC;AAC/B,CAAC,CAAC;AAnFW,QAAA,QAAQ,YAmFnB;AAEF,MAAM,MAAM,GAAG,CAAI,QAA2B,EAAK,EAAE;IACnD,IAAI,QAAQ,CAAC,OAAO,KAAK,SAAS,EAAE;QAClC,MAAM,IAAI,KAAK,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,IAAI,EAAE,CAAC,CAAC;KAClD;IACD,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAM,CAAC;AACtD,CAAC,CAAC"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import _m0 from "protobufjs/minimal";
|
|
3
|
+
import { FileDescriptorProto as FileDescriptorProto1 } from "ts-proto-descriptors";
|
|
4
|
+
export declare const protobufPackage = "dev.restate";
|
|
5
|
+
export interface Event {
|
|
6
|
+
orderingKey: Buffer;
|
|
7
|
+
key: Buffer;
|
|
8
|
+
payload: Buffer;
|
|
9
|
+
attributes: {
|
|
10
|
+
[key: string]: string;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export interface Event_AttributesEntry {
|
|
14
|
+
key: string;
|
|
15
|
+
value: string;
|
|
16
|
+
}
|
|
17
|
+
export declare const Event: {
|
|
18
|
+
encode(message: Event, writer?: _m0.Writer): _m0.Writer;
|
|
19
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): Event;
|
|
20
|
+
fromJSON(object: any): Event;
|
|
21
|
+
toJSON(message: Event): unknown;
|
|
22
|
+
create(base?: DeepPartial<Event>): Event;
|
|
23
|
+
fromPartial(object: DeepPartial<Event>): Event;
|
|
24
|
+
};
|
|
25
|
+
export declare const Event_AttributesEntry: {
|
|
26
|
+
encode(message: Event_AttributesEntry, writer?: _m0.Writer): _m0.Writer;
|
|
27
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): Event_AttributesEntry;
|
|
28
|
+
fromJSON(object: any): Event_AttributesEntry;
|
|
29
|
+
toJSON(message: Event_AttributesEntry): unknown;
|
|
30
|
+
create(base?: DeepPartial<Event_AttributesEntry>): Event_AttributesEntry;
|
|
31
|
+
fromPartial(object: DeepPartial<Event_AttributesEntry>): Event_AttributesEntry;
|
|
32
|
+
};
|
|
33
|
+
type ProtoMetaMessageOptions = {
|
|
34
|
+
options?: {
|
|
35
|
+
[key: string]: any;
|
|
36
|
+
};
|
|
37
|
+
fields?: {
|
|
38
|
+
[key: string]: {
|
|
39
|
+
[key: string]: any;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
oneof?: {
|
|
43
|
+
[key: string]: {
|
|
44
|
+
[key: string]: any;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
nested?: {
|
|
48
|
+
[key: string]: ProtoMetaMessageOptions;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
export interface ProtoMetadata {
|
|
52
|
+
fileDescriptor: FileDescriptorProto1;
|
|
53
|
+
references: {
|
|
54
|
+
[key: string]: any;
|
|
55
|
+
};
|
|
56
|
+
dependencies?: ProtoMetadata[];
|
|
57
|
+
options?: {
|
|
58
|
+
options?: {
|
|
59
|
+
[key: string]: any;
|
|
60
|
+
};
|
|
61
|
+
services?: {
|
|
62
|
+
[key: string]: {
|
|
63
|
+
options?: {
|
|
64
|
+
[key: string]: any;
|
|
65
|
+
};
|
|
66
|
+
methods?: {
|
|
67
|
+
[key: string]: {
|
|
68
|
+
[key: string]: any;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
messages?: {
|
|
74
|
+
[key: string]: ProtoMetaMessageOptions;
|
|
75
|
+
};
|
|
76
|
+
enums?: {
|
|
77
|
+
[key: string]: {
|
|
78
|
+
options?: {
|
|
79
|
+
[key: string]: any;
|
|
80
|
+
};
|
|
81
|
+
values?: {
|
|
82
|
+
[key: string]: {
|
|
83
|
+
[key: string]: any;
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
export declare const protoMetadata: ProtoMetadata;
|
|
91
|
+
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
92
|
+
export type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
|
|
93
|
+
[K in keyof T]?: DeepPartial<T[K]>;
|
|
94
|
+
} : Partial<T>;
|
|
95
|
+
export {};
|
|
96
|
+
//# sourceMappingURL=events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../../src/generated/dev/restate/events.ts"],"names":[],"mappings":";AACA,OAAO,GAAG,MAAM,oBAAoB,CAAC;AACrC,OAAO,EAAE,mBAAmB,IAAI,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAGnF,eAAO,MAAM,eAAe,gBAAgB,CAAC;AAE7C,MAAM,WAAW,KAAK;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;CACvC;AAED,MAAM,WAAW,qBAAqB;IACpC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf;AAMD,eAAO,MAAM,KAAK;oBACA,KAAK,WAAU,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