@restatedev/restate-sdk 0.9.2 → 1.0.0
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/README.md +10 -0
- package/dist/src/connection/buffered_connection.d.ts +1 -2
- package/dist/src/connection/buffered_connection.d.ts.map +1 -1
- package/dist/src/connection/buffered_connection.js.map +1 -1
- package/dist/src/connection/connection.d.ts +1 -0
- package/dist/src/connection/connection.d.ts.map +1 -1
- package/dist/src/connection/http_connection.d.ts +6 -2
- package/dist/src/connection/http_connection.d.ts.map +1 -1
- package/dist/src/connection/http_connection.js +8 -3
- package/dist/src/connection/http_connection.js.map +1 -1
- package/dist/src/connection/lambda_connection.d.ts +3 -1
- package/dist/src/connection/lambda_connection.d.ts.map +1 -1
- package/dist/src/connection/lambda_connection.js +6 -1
- package/dist/src/connection/lambda_connection.js.map +1 -1
- package/dist/src/context.d.ts +149 -44
- package/dist/src/context.d.ts.map +1 -1
- package/dist/src/context.js.map +1 -1
- package/dist/src/context_impl.d.ts +15 -12
- package/dist/src/context_impl.d.ts.map +1 -1
- package/dist/src/context_impl.js +109 -19
- package/dist/src/context_impl.js.map +1 -1
- package/dist/src/endpoint/endpoint_impl.d.ts +5 -6
- package/dist/src/endpoint/endpoint_impl.d.ts.map +1 -1
- package/dist/src/endpoint/endpoint_impl.js +44 -18
- package/dist/src/endpoint/endpoint_impl.js.map +1 -1
- package/dist/src/endpoint/http2_handler.d.ts.map +1 -1
- package/dist/src/endpoint/http2_handler.js +42 -9
- package/dist/src/endpoint/http2_handler.js.map +1 -1
- package/dist/src/endpoint/lambda_handler.d.ts.map +1 -1
- package/dist/src/endpoint/lambda_handler.js +34 -12
- package/dist/src/endpoint/lambda_handler.js.map +1 -1
- package/dist/src/endpoint.d.ts +5 -3
- package/dist/src/endpoint.d.ts.map +1 -1
- package/dist/src/endpoint.js.map +1 -1
- package/dist/src/generated/proto/discovery_pb.d.ts +18 -0
- package/dist/src/generated/proto/discovery_pb.d.ts.map +1 -0
- package/dist/src/generated/proto/discovery_pb.js +40 -0
- package/dist/src/generated/proto/discovery_pb.js.map +1 -0
- package/dist/src/generated/proto/protocol_pb.d.ts +186 -0
- package/dist/src/generated/proto/protocol_pb.d.ts.map +1 -1
- package/dist/src/generated/proto/protocol_pb.js +177 -1
- package/dist/src/generated/proto/protocol_pb.js.map +1 -1
- package/dist/src/generated/version.d.ts +1 -1
- package/dist/src/generated/version.js +1 -1
- package/dist/src/io/decoder.d.ts +0 -1
- package/dist/src/io/decoder.d.ts.map +1 -1
- package/dist/src/io/decoder.js +2 -8
- package/dist/src/io/decoder.js.map +1 -1
- package/dist/src/io/encoder.d.ts.map +1 -1
- package/dist/src/io/encoder.js +1 -2
- package/dist/src/io/encoder.js.map +1 -1
- package/dist/src/journal.d.ts.map +1 -1
- package/dist/src/journal.js +17 -0
- package/dist/src/journal.js.map +1 -1
- package/dist/src/logger.d.ts.map +1 -1
- package/dist/src/logger.js +0 -7
- package/dist/src/logger.js.map +1 -1
- package/dist/src/public_api.d.ts +4 -4
- package/dist/src/public_api.d.ts.map +1 -1
- package/dist/src/public_api.js +3 -26
- package/dist/src/public_api.js.map +1 -1
- package/dist/src/state_machine.d.ts +3 -2
- package/dist/src/state_machine.d.ts.map +1 -1
- package/dist/src/state_machine.js +9 -9
- package/dist/src/state_machine.js.map +1 -1
- package/dist/src/types/components.d.ts +31 -19
- package/dist/src/types/components.d.ts.map +1 -1
- package/dist/src/types/components.js +127 -30
- package/dist/src/types/components.js.map +1 -1
- package/dist/src/types/discovery.d.ts +6 -3
- package/dist/src/types/discovery.d.ts.map +1 -1
- package/dist/src/types/discovery.js +2 -0
- package/dist/src/types/discovery.js.map +1 -1
- package/dist/src/types/protocol.d.ts +13 -4
- package/dist/src/types/protocol.d.ts.map +1 -1
- package/dist/src/types/protocol.js +95 -5
- package/dist/src/types/protocol.js.map +1 -1
- package/dist/src/types/rpc.d.ts +276 -26
- package/dist/src/types/rpc.d.ts.map +1 -1
- package/dist/src/types/rpc.js +385 -5
- package/dist/src/types/rpc.js.map +1 -1
- package/dist/src/types/types.d.ts +2 -4
- package/dist/src/types/types.d.ts.map +1 -1
- package/dist/src/types/types.js +3 -14
- package/dist/src/types/types.js.map +1 -1
- package/dist/src/utils/serde.d.ts +2 -0
- package/dist/src/utils/serde.d.ts.map +1 -1
- package/dist/src/utils/serde.js +28 -4
- package/dist/src/utils/serde.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/dist/src/clients/workflow_client.d.ts +0 -77
- package/dist/src/clients/workflow_client.d.ts.map +0 -1
- package/dist/src/clients/workflow_client.js +0 -172
- package/dist/src/clients/workflow_client.js.map +0 -1
- package/dist/src/workflows/workflow.d.ts +0 -101
- package/dist/src/workflows/workflow.d.ts.map +0 -1
- package/dist/src/workflows/workflow.js +0 -84
- package/dist/src/workflows/workflow.js.map +0 -1
- package/dist/src/workflows/workflow_state_service.d.ts +0 -35
- package/dist/src/workflows/workflow_state_service.d.ts.map +0 -1
- package/dist/src/workflows/workflow_state_service.js +0 -201
- package/dist/src/workflows/workflow_state_service.js.map +0 -1
- package/dist/src/workflows/workflow_wrapper_service.d.ts +0 -10
- package/dist/src/workflows/workflow_wrapper_service.d.ts.map +0 -1
- package/dist/src/workflows/workflow_wrapper_service.js +0 -285
- package/dist/src/workflows/workflow_wrapper_service.js.map +0 -1
package/README.md
CHANGED
|
@@ -46,3 +46,13 @@ For brand-new projects, we recommend using the [Restate Node Template](https://g
|
|
|
46
46
|
```shell
|
|
47
47
|
npx -y @restatedev/create-app@latest
|
|
48
48
|
```
|
|
49
|
+
|
|
50
|
+
## Versions
|
|
51
|
+
|
|
52
|
+
This library follows [Semantic Versioning](https://semver.org/).
|
|
53
|
+
|
|
54
|
+
The compatibility with Restate is described in the following table:
|
|
55
|
+
|
|
56
|
+
| Restate Server\sdk-typescript | 1.0 |
|
|
57
|
+
|-------------------------------|-----|
|
|
58
|
+
| 1.0 | ✅ |
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { Message } from "../types/types";
|
|
3
|
-
import { Connection } from "./connection";
|
|
4
3
|
import { Buffer } from "node:buffer";
|
|
5
|
-
export declare class BufferedConnection
|
|
4
|
+
export declare class BufferedConnection {
|
|
6
5
|
private readonly flushFn;
|
|
7
6
|
private queue;
|
|
8
7
|
private flushing;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buffered_connection.d.ts","sourceRoot":"","sources":["../../../src/connection/buffered_connection.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"buffered_connection.d.ts","sourceRoot":"","sources":["../../../src/connection/buffered_connection.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,qBAAa,kBAAkB;IAIjB,OAAO,CAAC,QAAQ,CAAC,OAAO;IAHpC,OAAO,CAAC,KAAK,CAAiB;IAC9B,OAAO,CAAC,QAAQ,CAAoC;gBAEvB,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC;IAEvE,IAAI,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAajC,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IAKpB,OAAO,CAAC,aAAa;YASP,KAAK;CASpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buffered_connection.js","sourceRoot":"","sources":["../../../src/connection/buffered_connection.ts"],"names":[],"mappings":";;;AAAA,2CAA+C;
|
|
1
|
+
{"version":3,"file":"buffered_connection.js","sourceRoot":"","sources":["../../../src/connection/buffered_connection.ts"],"names":[],"mappings":";;;AAAA,2CAA+C;AAI/C,MAAa,kBAAkB;IAIA;IAHr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AAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC9B,CAAC;CACF;AA1CD,gDA0CC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../../../src/connection/connection.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAElC,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../../../src/connection/connection.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAElC,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAErB,OAAO,IAAI,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC;CAC/D;AAED;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC,aAAa,CAAC,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC;IAEnC,iBAAiB,CAAC,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC;IAElC,iBAAiB,IAAI,IAAI,CAAC;CAC3B"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
2
3
|
import stream from "node:stream";
|
|
3
4
|
import { Connection, RestateStreamConsumer } from "./connection";
|
|
4
5
|
import { Message } from "../types/types";
|
|
6
|
+
import { Http2ServerRequest, IncomingHttpHeaders } from "node:http2";
|
|
5
7
|
/**
|
|
6
8
|
* A duplex stream with Restate Messages over HTTP2.
|
|
7
9
|
*
|
|
@@ -25,18 +27,20 @@ import { Message } from "../types/types";
|
|
|
25
27
|
* notifications for cleanly closed input (to trigger suspension).
|
|
26
28
|
*/
|
|
27
29
|
export declare class RestateHttp2Connection implements Connection {
|
|
30
|
+
private readonly attemptHeaders;
|
|
28
31
|
private readonly rawStream;
|
|
29
32
|
/**
|
|
30
33
|
* create a RestateDuplex stream from an http2 (duplex) stream.
|
|
31
34
|
*/
|
|
32
|
-
static from(http2stream: stream.Duplex): RestateHttp2Connection;
|
|
35
|
+
static from(request: Http2ServerRequest, http2stream: stream.Duplex): RestateHttp2Connection;
|
|
33
36
|
private readonly sdkInput;
|
|
34
37
|
private currentConsumer;
|
|
35
38
|
private inputBuffer;
|
|
36
39
|
private consumerError?;
|
|
37
40
|
private consumerInputClosed;
|
|
38
41
|
private outputBuffer;
|
|
39
|
-
constructor(rawStream: stream.Duplex);
|
|
42
|
+
constructor(attemptHeaders: IncomingHttpHeaders, rawStream: stream.Duplex);
|
|
43
|
+
headers(): ReadonlyMap<string, string | string[] | undefined>;
|
|
40
44
|
/**
|
|
41
45
|
* Pipes the messages from this connection to the given consumer. The consumer
|
|
42
46
|
* will also receive error and stream closing notifications.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http_connection.d.ts","sourceRoot":"","sources":["../../../src/connection/http_connection.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"http_connection.d.ts","sourceRoot":"","sources":["../../../src/connection/http_connection.ts"],"names":[],"mappings":";;AAWA,OAAO,MAAM,MAAM,aAAa,CAAC;AAEjC,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAIzC,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAKrE;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,qBAAa,sBAAuB,YAAW,UAAU;IAyBrD,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,SAAS;IAzB5B;;OAEG;WACW,IAAI,CAChB,OAAO,EAAE,kBAAkB,EAC3B,WAAW,EAAE,MAAM,CAAC,MAAM,GACzB,sBAAsB;IAOzB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAkB;IAG3C,OAAO,CAAC,eAAe,CAAsC;IAC7D,OAAO,CAAC,WAAW,CAAiB;IACpC,OAAO,CAAC,aAAa,CAAC,CAAQ;IAC9B,OAAO,CAAC,mBAAmB,CAAS;IAEpC,OAAO,CAAC,YAAY,CAAqB;gBAGtB,cAAc,EAAE,mBAAmB,EACnC,SAAS,EAAE,MAAM,CAAC,MAAM;IA4E3C,OAAO,IAAI,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC;IAQ7D;;;;;;;;OAQG;IACI,cAAc,CAAC,QAAQ,EAAE,qBAAqB,GAAG,IAAI;IA+B5D;;OAEG;IACI,qBAAqB,IAAI,IAAI;IAQpC;;;;;;;;;;;;OAYG;IACI,IAAI,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAIxC;;OAEG;IACU,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAYlC"}
|
|
@@ -40,12 +40,13 @@ const RESOLVED = Promise.resolve();
|
|
|
40
40
|
* notifications for cleanly closed input (to trigger suspension).
|
|
41
41
|
*/
|
|
42
42
|
class RestateHttp2Connection {
|
|
43
|
+
attemptHeaders;
|
|
43
44
|
rawStream;
|
|
44
45
|
/**
|
|
45
46
|
* create a RestateDuplex stream from an http2 (duplex) stream.
|
|
46
47
|
*/
|
|
47
|
-
static from(http2stream) {
|
|
48
|
-
return new RestateHttp2Connection(http2stream);
|
|
48
|
+
static from(request, http2stream) {
|
|
49
|
+
return new RestateHttp2Connection(request.headers, http2stream);
|
|
49
50
|
}
|
|
50
51
|
// --------------------------------------------------------------------------
|
|
51
52
|
// input as decoded messages
|
|
@@ -56,7 +57,8 @@ class RestateHttp2Connection {
|
|
|
56
57
|
consumerError;
|
|
57
58
|
consumerInputClosed = false;
|
|
58
59
|
outputBuffer;
|
|
59
|
-
constructor(rawStream) {
|
|
60
|
+
constructor(attemptHeaders, rawStream) {
|
|
61
|
+
this.attemptHeaders = attemptHeaders;
|
|
60
62
|
this.rawStream = rawStream;
|
|
61
63
|
this.sdkInput = rawStream.pipe((0, decoder_1.streamDecoder)());
|
|
62
64
|
this.outputBuffer = new buffered_connection_1.BufferedConnection((buffer) => {
|
|
@@ -122,6 +124,9 @@ class RestateHttp2Connection {
|
|
|
122
124
|
}
|
|
123
125
|
});
|
|
124
126
|
}
|
|
127
|
+
headers() {
|
|
128
|
+
return new Map(Object.entries(this.attemptHeaders));
|
|
129
|
+
}
|
|
125
130
|
// --------------------------------------------------------------------------
|
|
126
131
|
// input stream handling
|
|
127
132
|
// --------------------------------------------------------------------------
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http_connection.js","sourceRoot":"","sources":["../../../src/connection/http_connection.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AAGH,2CAA8C;AAG9C,sCAAiC;AACjC,mDAAgD;AAChD,+DAA2D;
|
|
1
|
+
{"version":3,"file":"http_connection.js","sourceRoot":"","sources":["../../../src/connection/http_connection.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AAGH,2CAA8C;AAG9C,sCAAiC;AACjC,mDAAgD;AAChD,+DAA2D;AAG3D,kFAAkF;AAClF,MAAM,QAAQ,GAAkB,OAAO,CAAC,OAAO,EAAE,CAAC;AAElD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAa,sBAAsB;IAyBd;IACA;IAzBnB;;OAEG;IACI,MAAM,CAAC,IAAI,CAChB,OAA2B,EAC3B,WAA0B;QAE1B,OAAO,IAAI,sBAAsB,CAAC,OAAO,CAAC,OAAO,EAAE,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CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;SACxE;IACH,CAAC;IAED;;OAEG;IACI,qBAAqB;QAC1B,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;IAC9B,CAAC;IAED,6EAA6E;IAC7E,0BAA0B;IAC1B,6EAA6E;IAE7E;;;;;;;;;;;;OAYG;IACI,IAAI,CAAC,GAAY;QACtB,OAAO,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACrC,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,GAAG;QACd,MAAM,IAAI,CAAC,YAAY,CAAC,GAAG,EAAE,CAAC;QAE9B,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC;QAErB,MAAM,OAAO,GAAG;YACd,KAAK,EAAE,IAAI;YACX,OAAO,EAAE,IAAI;SACd,CAAC;QAEF,MAAM,IAAA,mBAAQ,EAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAC1C,CAAC;CACF;AAjMD,wDAiMC"}
|
|
@@ -3,11 +3,13 @@ import { Connection } from "./connection";
|
|
|
3
3
|
import { Message } from "../types/types";
|
|
4
4
|
import { Buffer } from "node:buffer";
|
|
5
5
|
export declare class LambdaConnection implements Connection {
|
|
6
|
+
private readonly attemptHeaders;
|
|
6
7
|
private suspendedOrCompleted;
|
|
7
8
|
private outputBuffer;
|
|
8
9
|
private readonly completionPromise;
|
|
9
10
|
private resolveOnCompleted;
|
|
10
|
-
constructor(suspendedOrCompleted?: boolean);
|
|
11
|
+
constructor(attemptHeaders: Record<string, string | string[] | undefined>, suspendedOrCompleted?: boolean);
|
|
12
|
+
headers(): ReadonlyMap<string, string | string[] | undefined>;
|
|
11
13
|
send(msg: Message): Promise<void>;
|
|
12
14
|
getResult(): Promise<Buffer>;
|
|
13
15
|
end(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lambda_connection.d.ts","sourceRoot":"","sources":["../../../src/connection/lambda_connection.ts"],"names":[],"mappings":";AAWA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAO1C,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAIrC,qBAAa,gBAAiB,YAAW,UAAU;
|
|
1
|
+
{"version":3,"file":"lambda_connection.d.ts","sourceRoot":"","sources":["../../../src/connection/lambda_connection.ts"],"names":[],"mappings":";AAWA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAO1C,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAIrC,qBAAa,gBAAiB,YAAW,UAAU;IAS/C,OAAO,CAAC,QAAQ,CAAC,cAAc;IAI/B,OAAO,CAAC,oBAAoB;IAX9B,OAAO,CAAC,YAAY,CAA2B;IAG/C,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAkB;IACpD,OAAO,CAAC,kBAAkB,CAAiD;gBAGxD,cAAc,EAAE,MAAM,CACrC,MAAM,EACN,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAC9B,EACO,oBAAoB,UAAQ;IAQtC,OAAO,IAAI,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC;IAK7D,IAAI,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAiBjC,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC;IAI5B,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAQrB"}
|
|
@@ -17,19 +17,24 @@ const logger_1 = require("../logger");
|
|
|
17
17
|
const node_buffer_1 = require("node:buffer");
|
|
18
18
|
const RESOLVED = Promise.resolve();
|
|
19
19
|
class LambdaConnection {
|
|
20
|
+
attemptHeaders;
|
|
20
21
|
suspendedOrCompleted;
|
|
21
22
|
// Empty buffer to store journal output messages
|
|
22
23
|
outputBuffer = node_buffer_1.Buffer.alloc(0);
|
|
23
24
|
// Callback to resolve the invocation promise of the Lambda handler when the response is ready
|
|
24
25
|
completionPromise;
|
|
25
26
|
resolveOnCompleted;
|
|
26
|
-
constructor(suspendedOrCompleted = false) {
|
|
27
|
+
constructor(attemptHeaders, suspendedOrCompleted = false) {
|
|
28
|
+
this.attemptHeaders = attemptHeaders;
|
|
27
29
|
this.suspendedOrCompleted = suspendedOrCompleted;
|
|
28
30
|
// Promise that signals when the invocation is over, to then flush the messages
|
|
29
31
|
this.completionPromise = new Promise((resolve) => {
|
|
30
32
|
this.resolveOnCompleted = resolve;
|
|
31
33
|
});
|
|
32
34
|
}
|
|
35
|
+
headers() {
|
|
36
|
+
return new Map(Object.entries(this.attemptHeaders));
|
|
37
|
+
}
|
|
33
38
|
// Send a message back to the runtime
|
|
34
39
|
send(msg) {
|
|
35
40
|
// Add the header and the body to buffer and add to the output buffer
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lambda_connection.js","sourceRoot":"","sources":["../../../src/connection/lambda_connection.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AAGH,2CAA8C;AAC9C,gDAI2B;AAE3B,sCAAiC;AACjC,6CAAqC;AAErC,MAAM,QAAQ,GAAkB,OAAO,CAAC,OAAO,EAAE,CAAC;AAElD,MAAa,gBAAgB;
|
|
1
|
+
{"version":3,"file":"lambda_connection.js","sourceRoot":"","sources":["../../../src/connection/lambda_connection.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AAGH,2CAA8C;AAC9C,gDAI2B;AAE3B,sCAAiC;AACjC,6CAAqC;AAErC,MAAM,QAAQ,GAAkB,OAAO,CAAC,OAAO,EAAE,CAAC;AAElD,MAAa,gBAAgB;IASR;IAIT;IAZV,gDAAgD;IACxC,YAAY,GAAW,oBAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;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AClB,CAAC;CACF;AAvDD,4CAuDC"}
|
package/dist/src/context.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
|
|
3
|
-
import {
|
|
2
|
+
import type { Client, SendClient } from "./types/rpc";
|
|
3
|
+
import type { RestateContext, RestateObjectContext, RestateObjectSharedContext, RestateWorkflowContext, RestateWorkflowSharedContext, Service, ServiceDefinitionFrom, VirtualObject, VirtualObjectDefinitionFrom, Workflow, WorkflowDefinitionFrom } from "@restatedev/restate-sdk-core";
|
|
4
4
|
/**
|
|
5
5
|
* Represents the original request as sent to this handler.
|
|
6
6
|
*
|
|
@@ -12,11 +12,18 @@ export interface Request {
|
|
|
12
12
|
* The unique id that identifies the current function invocation. This id is guaranteed to be
|
|
13
13
|
* unique across invocations, but constant across reties and suspensions.
|
|
14
14
|
*/
|
|
15
|
-
readonly id:
|
|
15
|
+
readonly id: Uint8Array;
|
|
16
16
|
/**
|
|
17
|
-
* Request headers
|
|
17
|
+
* Request headers - the following headers capture the original invocation headers, as provided to
|
|
18
|
+
* the ingress.
|
|
18
19
|
*/
|
|
19
20
|
readonly headers: ReadonlyMap<string, string>;
|
|
21
|
+
/**
|
|
22
|
+
* Attempt headers - the following headers are sent by the restate runtime.
|
|
23
|
+
* These headers are attempt specific, generated by the restate runtime uniquely for each attempt.
|
|
24
|
+
* These headers might contain information such as the W3C trace context, and attempt specific information.
|
|
25
|
+
*/
|
|
26
|
+
readonly attemptHeaders: ReadonlyMap<string, string | string[] | undefined>;
|
|
20
27
|
/**
|
|
21
28
|
* Raw unparsed request body
|
|
22
29
|
*/
|
|
@@ -89,16 +96,8 @@ export interface SendOptions {
|
|
|
89
96
|
* hence recover this handler and (through the durable execution) recover the message to be sent.
|
|
90
97
|
*
|
|
91
98
|
* @example
|
|
92
|
-
* *Service Side:*
|
|
93
|
-
* ```ts
|
|
94
|
-
* const service = restate.service({
|
|
95
|
-
* ...
|
|
96
|
-
* });
|
|
97
|
-
*
|
|
98
|
-
* ```
|
|
99
|
-
* **Client side:**
|
|
100
99
|
* ```ts
|
|
101
|
-
* ctx.
|
|
100
|
+
* ctx.serviceSendClient(Service, {delay: 60_000}).anotherAction(1337);
|
|
102
101
|
* ```
|
|
103
102
|
*/
|
|
104
103
|
delay?: number;
|
|
@@ -108,11 +107,14 @@ export interface ContextDate {
|
|
|
108
107
|
* This is equivalent to Date.now()
|
|
109
108
|
*/
|
|
110
109
|
now(): Promise<number>;
|
|
111
|
-
/** Returns the JSON
|
|
110
|
+
/** Returns the JSON representation of the current date.
|
|
112
111
|
* This is equivalent to new Date().toJSON()
|
|
113
112
|
**/
|
|
114
113
|
toJSON(): Promise<string>;
|
|
115
114
|
}
|
|
115
|
+
/**
|
|
116
|
+
* A function that can be run and its result durably persisted by Restate.
|
|
117
|
+
*/
|
|
116
118
|
export type RunAction<T> = (() => Promise<T>) | (() => T);
|
|
117
119
|
/**
|
|
118
120
|
* The context that gives access to all Restate-backed operations, for example
|
|
@@ -125,7 +127,7 @@ export type RunAction<T> = (() => Promise<T>) | (() => T);
|
|
|
125
127
|
* Virtual objects can also access their key-value store using the {@link ObjectContext}.
|
|
126
128
|
*
|
|
127
129
|
*/
|
|
128
|
-
export interface Context {
|
|
130
|
+
export interface Context extends RestateContext {
|
|
129
131
|
/**
|
|
130
132
|
* Deterministic random methods; these are inherently predictable (seeded on the invocation ID, which is not secret)
|
|
131
133
|
* and so should not be used for any cryptographic purposes. They are useful for identifiers, idempotency keys,
|
|
@@ -164,22 +166,28 @@ export interface Context {
|
|
|
164
166
|
* described above).
|
|
165
167
|
*
|
|
166
168
|
* @example
|
|
169
|
+
* ```ts
|
|
167
170
|
* const result = await ctx.run(someExternalAction)
|
|
168
|
-
|
|
171
|
+
*```
|
|
172
|
+
|
|
169
173
|
* @example
|
|
170
|
-
*
|
|
171
|
-
*
|
|
172
|
-
*
|
|
173
|
-
*
|
|
174
|
-
*
|
|
175
|
-
*
|
|
176
|
-
*
|
|
177
|
-
*
|
|
178
|
-
*
|
|
179
|
-
*
|
|
174
|
+
* ```ts
|
|
175
|
+
* await ctx.run("payment action", async () => {
|
|
176
|
+
* const result = await paymentProvider.charge(txId, paymentInfo);
|
|
177
|
+
* if (result.paymentRejected) {
|
|
178
|
+
* // this action will not be retried anymore
|
|
179
|
+
* throw new TerminalError("Payment failed");
|
|
180
|
+
* } else if (result.paymentGatewayBusy) {
|
|
181
|
+
* // restate will retry automatically
|
|
182
|
+
* throw new Exception("Payment gateway busy");
|
|
183
|
+
* } else {
|
|
184
|
+
* // success!
|
|
185
|
+
* }
|
|
186
|
+
* });
|
|
187
|
+
*
|
|
188
|
+
* ```
|
|
180
189
|
*
|
|
181
190
|
* @param action The function to run.
|
|
182
|
-
* @param nameOrOptions the operation's name or a run configuration
|
|
183
191
|
*/
|
|
184
192
|
run<T>(action: RunAction<T>): Promise<T>;
|
|
185
193
|
/**
|
|
@@ -265,35 +273,48 @@ export interface Context {
|
|
|
265
273
|
* const service = restate.service(
|
|
266
274
|
* name: "myservice",
|
|
267
275
|
* handlers: {
|
|
268
|
-
* someAction: async(ctx: restate.
|
|
269
|
-
* anotherAction: async(ctx: restate.
|
|
276
|
+
* someAction: async(ctx: restate.Context, req: string) => { ... },
|
|
277
|
+
* anotherAction: async(ctx: restate.Context, count: number) => { ... }
|
|
270
278
|
* });
|
|
271
279
|
*
|
|
272
|
-
* // option 1: export only the type signature
|
|
273
|
-
* export type
|
|
280
|
+
* // option 1: export only the type signature
|
|
281
|
+
* export type Service = typeof service;
|
|
274
282
|
*
|
|
275
|
-
* // option 2: export the API definition with type and name (name)
|
|
276
|
-
* const MyService: MyApi = { name: "myservice" };
|
|
277
283
|
*
|
|
278
|
-
* restate.
|
|
284
|
+
* restate.endpoint().bind(service).listen(9080);
|
|
279
285
|
* ```
|
|
280
286
|
* **Client side:**
|
|
281
287
|
* ```ts
|
|
282
288
|
* // option 1: use only types and supply service name separately
|
|
283
|
-
* const result1 = await ctx.serviceClient<
|
|
289
|
+
* const result1 = await ctx.serviceClient<Service>({name: "myservice"}).someAction("hello!");
|
|
284
290
|
*
|
|
285
291
|
* // option 2: use full API spec
|
|
286
|
-
*
|
|
292
|
+
* type MyService: Service = { name: "myservice" };
|
|
293
|
+
* const result2 = await ctx.serviceClient(Service).anotherAction(1337);
|
|
287
294
|
* ```
|
|
288
295
|
*/
|
|
289
|
-
serviceClient<
|
|
296
|
+
serviceClient<D>(opts: ServiceDefinitionFrom<D>): Client<Service<D>>;
|
|
290
297
|
/**
|
|
291
298
|
* Same as {@link serviceClient} but for virtual objects.
|
|
292
299
|
*
|
|
293
300
|
* @param opts
|
|
294
301
|
* @param key the virtual object key
|
|
295
302
|
*/
|
|
296
|
-
objectClient<
|
|
303
|
+
objectClient<D>(opts: VirtualObjectDefinitionFrom<D>, key: string): Client<VirtualObject<D>>;
|
|
304
|
+
/**
|
|
305
|
+
* Same as {@link serviceClient} but for workflows.
|
|
306
|
+
*
|
|
307
|
+
* @param opts
|
|
308
|
+
* @param key the workflow key
|
|
309
|
+
*/
|
|
310
|
+
workflowClient<D>(opts: WorkflowDefinitionFrom<D>, key: string): Client<Workflow<D>>;
|
|
311
|
+
/**
|
|
312
|
+
* Same as {@link objectSendClient} but for workflows.
|
|
313
|
+
*
|
|
314
|
+
* @param opts
|
|
315
|
+
* @param key the workflow key
|
|
316
|
+
*/
|
|
317
|
+
workflowSendClient<D>(opts: WorkflowDefinitionFrom<D>, key: string): SendClient<Workflow<D>>;
|
|
297
318
|
/**
|
|
298
319
|
* Makes a type-safe one-way RPC to the specified target service. This method effectively behaves
|
|
299
320
|
* like enqueuing the message in a message queue.
|
|
@@ -314,8 +335,8 @@ export interface Context {
|
|
|
314
335
|
* const service = restate.service(
|
|
315
336
|
* name: "myservice",
|
|
316
337
|
* handlers: {
|
|
317
|
-
* someAction: async(ctx: restate.
|
|
318
|
-
* anotherAction: async(ctx: restate.
|
|
338
|
+
* someAction: async(ctx: restate.Context, req: string) => { ... },
|
|
339
|
+
* anotherAction: async(ctx: restate.Context, count: number) => { ... }
|
|
319
340
|
* });
|
|
320
341
|
*
|
|
321
342
|
* // option 1: export only the type signature of the router
|
|
@@ -324,7 +345,7 @@ export interface Context {
|
|
|
324
345
|
* // option 2: export the API definition with type and name (name)
|
|
325
346
|
* const MyService: MyApi = { name: "myservice" };
|
|
326
347
|
*
|
|
327
|
-
* restate.
|
|
348
|
+
* restate.endpoint().bind(service).listen(9080);
|
|
328
349
|
* ```
|
|
329
350
|
* **Client side:**
|
|
330
351
|
* ```ts
|
|
@@ -335,7 +356,7 @@ export interface Context {
|
|
|
335
356
|
* ctx.serviceSendClient(MyService).anotherAction(1337);
|
|
336
357
|
* ```
|
|
337
358
|
*/
|
|
338
|
-
serviceSendClient<
|
|
359
|
+
serviceSendClient<D>(service: ServiceDefinitionFrom<D>, opts?: SendOptions): SendClient<Service<D>>;
|
|
339
360
|
/**
|
|
340
361
|
* Same as {@link serviceSendClient} but for virtual objects.
|
|
341
362
|
*
|
|
@@ -343,7 +364,7 @@ export interface Context {
|
|
|
343
364
|
* @param key the virtual object key
|
|
344
365
|
* @param opts Send options
|
|
345
366
|
*/
|
|
346
|
-
objectSendClient<
|
|
367
|
+
objectSendClient<D>(obj: VirtualObjectDefinitionFrom<D>, key: string, opts?: SendOptions): SendClient<VirtualObject<D>>;
|
|
347
368
|
/**
|
|
348
369
|
* Returns the raw request that triggered that handler.
|
|
349
370
|
* Use that object to inspect the original request headers
|
|
@@ -362,9 +383,39 @@ export interface Context {
|
|
|
362
383
|
* This context can be used only within virtual objects.
|
|
363
384
|
*
|
|
364
385
|
*/
|
|
365
|
-
export interface ObjectContext extends Context, KeyValueStore {
|
|
386
|
+
export interface ObjectContext extends Context, KeyValueStore, RestateObjectContext {
|
|
366
387
|
key: string;
|
|
367
388
|
}
|
|
389
|
+
/**
|
|
390
|
+
* The context that gives access to all Restate-backed operations, for example
|
|
391
|
+
* - sending reliable messages / RPC through Restate
|
|
392
|
+
* - execute non-deterministic closures and memoize their result
|
|
393
|
+
* - sleeps and delayed calls
|
|
394
|
+
* - awakeables
|
|
395
|
+
* - ...
|
|
396
|
+
*
|
|
397
|
+
* This context can be used only within a shared virtual objects.
|
|
398
|
+
*
|
|
399
|
+
*/
|
|
400
|
+
export interface ObjectSharedContext extends Context, RestateObjectSharedContext {
|
|
401
|
+
key: string;
|
|
402
|
+
/**
|
|
403
|
+
* Get/retrieve state from the Restate runtime.
|
|
404
|
+
* Note that state objects are serialized with `Buffer.from(JSON.stringify(theObject))`
|
|
405
|
+
* and deserialized with `JSON.parse(value.toString()) as T`.
|
|
406
|
+
*
|
|
407
|
+
* @param name key of the state to retrieve
|
|
408
|
+
* @returns a Promise that is resolved with the value of the state key
|
|
409
|
+
*
|
|
410
|
+
* @example
|
|
411
|
+
* const state = await ctx.get<string>("STATE");
|
|
412
|
+
*/
|
|
413
|
+
get<T>(name: string): Promise<T | null>;
|
|
414
|
+
/**
|
|
415
|
+
* Retrieve all the state keys for this object.
|
|
416
|
+
*/
|
|
417
|
+
stateKeys(): Promise<Array<string>>;
|
|
418
|
+
}
|
|
368
419
|
export interface Rand {
|
|
369
420
|
/**
|
|
370
421
|
* Equivalent of JS `Math.random()` but deterministic; seeded by the invocation ID of the current invocation,
|
|
@@ -433,4 +484,58 @@ export declare const CombineablePromise: {
|
|
|
433
484
|
*/
|
|
434
485
|
allSettled<T_3 extends [] | readonly CombineablePromise<unknown>[]>(values: T_3): Promise<{ -readonly [P_1 in keyof T_3]: PromiseSettledResult<Awaited<T_3[P_1]>>; }>;
|
|
435
486
|
};
|
|
487
|
+
/**
|
|
488
|
+
* Workflow bound durable promise
|
|
489
|
+
*
|
|
490
|
+
* See {@link WorkflowSharedContext} promise..
|
|
491
|
+
*/
|
|
492
|
+
export type DurablePromise<T> = Promise<T> & {
|
|
493
|
+
/**
|
|
494
|
+
* Returns the value of the promise, if it has been resolved.
|
|
495
|
+
*/
|
|
496
|
+
peek(): Promise<T | undefined>;
|
|
497
|
+
/**
|
|
498
|
+
* Resolve the promise with the given value.
|
|
499
|
+
* @param value the value to resolve the promise with
|
|
500
|
+
*/
|
|
501
|
+
resolve(value?: T): Promise<void>;
|
|
502
|
+
/**
|
|
503
|
+
* Reject the promise with the given error message.
|
|
504
|
+
* @param errorMsg the error message to use for rejection.
|
|
505
|
+
*/
|
|
506
|
+
reject(errorMsg: string): Promise<void>;
|
|
507
|
+
/**
|
|
508
|
+
* Obtain a {@link CombineablePromise} variant of this promise.
|
|
509
|
+
*/
|
|
510
|
+
get(): CombineablePromise<T>;
|
|
511
|
+
};
|
|
512
|
+
export interface WorkflowSharedContext extends ObjectSharedContext, RestateWorkflowSharedContext {
|
|
513
|
+
/**
|
|
514
|
+
* Create a durable promise that can be resolved or rejected during the workflow execution.
|
|
515
|
+
* The promise is bound to the workflow and will be persisted across suspensions and retries.
|
|
516
|
+
*
|
|
517
|
+
* @example
|
|
518
|
+
* ```ts
|
|
519
|
+
* const wf = restate.workflow({
|
|
520
|
+
* name: "myWorkflow",
|
|
521
|
+
* handlers: {
|
|
522
|
+
* run: async (ctx: restate.WorkflowContext) => {
|
|
523
|
+
* // ... do some work ...
|
|
524
|
+
* const payment = await ctx.promise<Payment>("payment.succeeded");
|
|
525
|
+
* // ... do some more work ...
|
|
526
|
+
* },
|
|
527
|
+
*
|
|
528
|
+
* onPaymentSucceeded: async (ctx: restate.WorkflowContext, payment) => {
|
|
529
|
+
* // ... handle payment succeeded ...
|
|
530
|
+
* await ctx.promise("payment.succeeded").resolve(payment);
|
|
531
|
+
* }
|
|
532
|
+
* });
|
|
533
|
+
* ```
|
|
534
|
+
*
|
|
535
|
+
* @param name the name of the durable promise
|
|
536
|
+
*/
|
|
537
|
+
promise<T = void>(name: string): DurablePromise<T>;
|
|
538
|
+
}
|
|
539
|
+
export interface WorkflowContext extends WorkflowSharedContext, ObjectContext, RestateWorkflowContext {
|
|
540
|
+
}
|
|
436
541
|
//# sourceMappingURL=context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/context.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/context.ts"],"names":[],"mappings":";AAWA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,KAAK,EACV,cAAc,EACd,oBAAoB,EACpB,0BAA0B,EAC1B,sBAAsB,EACtB,4BAA4B,EAC5B,OAAO,EACP,qBAAqB,EACrB,aAAa,EACb,2BAA2B,EAC3B,QAAQ,EACR,sBAAsB,EACvB,MAAM,8BAA8B,CAAC;AAGtC;;;;;GAKG;AACH,MAAM,WAAW,OAAO;IACtB;;;OAGG;IACH,QAAQ,CAAC,EAAE,EAAE,UAAU,CAAC;IAExB;;;OAGG;IACH,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAE9C;;;;OAIG;IACH,QAAQ,CAAC,cAAc,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC;IAE5E;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;;;;;;;;;OAUG;IACH,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;IAExC,SAAS,IAAI,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;IAEpC;;;;;;;;;;OAUG;IACH,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC;IAErC;;;;;;OAMG;IACH,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAE1B;;;;;OAKG;IACH,QAAQ,IAAI,IAAI,CAAC;CAClB;AAED,MAA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EG;IACH,GAAG,IAAI,kBAAkB,CAAC,CAAC,CAAC,CAAC;CAC9B,CAAC;AAEF,MAAM,WAAW,qBACf,SAAQ,mBAAmB,EACzB,4BAA4B;IAC9B;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,OAAO,CAAC,CAAC,GAAG,IAAI,EAAE,IAAI,EAAE,MAAM,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC;CACpD;AAED,MAAM,WAAW,eACf,SAAQ,qBAAqB,EAC3B,aAAa,EACb,sBAAsB;CAAG"}
|
package/dist/src/context.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/context.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/context.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AAgBH,iDAA6C;AA+ehC,QAAA,kBAAkB,GAAG;IAChC;;;;;;;;OAQG;IACH,GAAG,CACD,MAAS;QAET,IAAI,MAAM,CAAC,MAAM,IAAI,CAAC,EAAE;YACtB,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;SAC5B;QACD,OAAO,0BAAW,CAAC,gBAAgB,CACjC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,EACzB,MAAM,CAGN,CAAC;IACL,CAAC;IAED;;;;;;;;OAQG;IACH,IAAI,CACF,MAAS;QAET,IAAI,MAAM,CAAC,MAAM,IAAI,CAAC,EAAE;YACtB,OAAO,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;SAC7B;QACD,OAAO,0BAAW,CAAC,gBAAgB,CACjC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,EAC1B,MAAM,CACwB,CAAC;IACnC,CAAC;IAED;;;;;;;;;OASG;IACH,GAAG,CACD,MAAS;QAET,IAAI,MAAM,CAAC,MAAM,IAAI,CAAC,EAAE;YACtB,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;SAC5B;QACD,OAAO,0BAAW,CAAC,gBAAgB,CACjC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,EACzB,MAAM,CACwB,CAAC;IACnC,CAAC;IAED;;;;;;;;OAQG;IACH,UAAU,CACR,MAAS;QAIT,IAAI,MAAM,CAAC,MAAM,IAAI,CAAC,EAAE;YACtB,OAAO,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;SACnC;QACD,OAAO,0BAAW,CAAC,gBAAgB,CACjC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,EAChC,MAAM,CAGN,CAAC;IACL,CAAC;CACF,CAAC"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
/// <reference types="node" />
|
|
3
3
|
/// <reference types="node" />
|
|
4
|
-
import { CombineablePromise, ContextDate, ObjectContext, Rand, Request, RunAction, SendOptions } from "./context";
|
|
4
|
+
import { CombineablePromise, ContextDate, DurablePromise, ObjectContext, Rand, Request, RunAction, SendOptions, WorkflowContext } from "./context";
|
|
5
5
|
import { StateMachine } from "./state_machine";
|
|
6
6
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
7
|
-
import { Client,
|
|
7
|
+
import { Client, HandlerKind, SendClient } from "./types/rpc";
|
|
8
|
+
import type { Service, ServiceDefinitionFrom, VirtualObjectDefinitionFrom, VirtualObject, WorkflowDefinitionFrom, Workflow } from "@restatedev/restate-sdk-core";
|
|
8
9
|
import { WrappedPromise } from "./utils/promises";
|
|
9
10
|
import { Buffer } from "node:buffer";
|
|
10
11
|
export declare enum CallContextType {
|
|
@@ -18,17 +19,19 @@ export interface CallContext {
|
|
|
18
19
|
export type InternalCombineablePromise<T> = CombineablePromise<T> & {
|
|
19
20
|
journalIndex: number;
|
|
20
21
|
};
|
|
21
|
-
export declare class ContextImpl implements ObjectContext {
|
|
22
|
+
export declare class ContextImpl implements ObjectContext, WorkflowContext {
|
|
22
23
|
readonly console: Console;
|
|
23
|
-
readonly
|
|
24
|
+
readonly handlerKind: HandlerKind;
|
|
24
25
|
readonly keyedContextKey: string | undefined;
|
|
25
|
-
|
|
26
|
+
readonly stateMachine: StateMachine;
|
|
26
27
|
readonly rand: Rand;
|
|
27
28
|
static callContext: AsyncLocalStorage<CallContext>;
|
|
28
29
|
private executingRun;
|
|
29
30
|
private readonly invocationRequest;
|
|
30
31
|
readonly date: ContextDate;
|
|
31
|
-
constructor(id: Buffer, console: Console,
|
|
32
|
+
constructor(id: Buffer, console: Console, handlerKind: HandlerKind, keyedContextKey: string | undefined, invocationValue: Uint8Array, invocationHeaders: ReadonlyMap<string, string>, attemptHeaders: ReadonlyMap<string, string | string[] | undefined>, stateMachine: StateMachine, rand?: Rand);
|
|
33
|
+
workflowClient<D>(opts: WorkflowDefinitionFrom<D>, key: string): Client<Workflow<D>>;
|
|
34
|
+
promise<T = void>(name: string): DurablePromise<T>;
|
|
32
35
|
get key(): string;
|
|
33
36
|
request(): Request;
|
|
34
37
|
get<T>(name: string): Promise<T | null>;
|
|
@@ -38,10 +41,11 @@ export declare class ContextImpl implements ObjectContext {
|
|
|
38
41
|
clearAll(): void;
|
|
39
42
|
private invoke;
|
|
40
43
|
private invokeOneWay;
|
|
41
|
-
serviceClient<
|
|
42
|
-
objectClient<
|
|
43
|
-
serviceSendClient<
|
|
44
|
-
objectSendClient<
|
|
44
|
+
serviceClient<D>({ name }: ServiceDefinitionFrom<D>): Client<Service<D>>;
|
|
45
|
+
objectClient<D>({ name }: VirtualObjectDefinitionFrom<D>, key: string): Client<VirtualObject<D>>;
|
|
46
|
+
serviceSendClient<D>(service: ServiceDefinitionFrom<D>, opts?: SendOptions): SendClient<Service<D>>;
|
|
47
|
+
objectSendClient<D>(obj: VirtualObjectDefinitionFrom<D>, key: string, opts?: SendOptions): SendClient<VirtualObject<D>>;
|
|
48
|
+
workflowSendClient<D>(def: WorkflowDefinitionFrom<D>, key: string, opts?: SendOptions): SendClient<Workflow<D>>;
|
|
45
49
|
run<T>(nameOrAction: string | RunAction<T>, actionSecondParameter?: RunAction<T>): Promise<T>;
|
|
46
50
|
sleep(millis: number): CombineablePromise<void>;
|
|
47
51
|
private sleepInternal;
|
|
@@ -56,7 +60,6 @@ export declare class ContextImpl implements ObjectContext {
|
|
|
56
60
|
private isInRun;
|
|
57
61
|
private checkNotExecutingRun;
|
|
58
62
|
private checkState;
|
|
59
|
-
|
|
60
|
-
private markCombineablePromise;
|
|
63
|
+
markCombineablePromise<T>(p: WrappedPromise<T>): InternalCombineablePromise<T>;
|
|
61
64
|
}
|
|
62
65
|
//# sourceMappingURL=context_impl.d.ts.map
|