@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,60 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/**
|
|
3
|
+
* Simple extension of the Console interface, to add debug logging per message.
|
|
4
|
+
* Because per-message logging can be very expensive, it is not active by default.
|
|
5
|
+
*
|
|
6
|
+
* This method also supports lazy construction of stringified message object,
|
|
7
|
+
* because constructing that stringified representation is even more expensive.
|
|
8
|
+
*/
|
|
9
|
+
export interface RestateConsole extends Console {
|
|
10
|
+
/**
|
|
11
|
+
* Called to log per-invocation debug messages.
|
|
12
|
+
*
|
|
13
|
+
* Under load, this can generate a large amount of log output. Due to that, this
|
|
14
|
+
* function by default logs only if the 'NODE_ENV' environment is not set to
|
|
15
|
+
* 'production', or if explicitly configured via the restate 'RESTATE_DEBUG_LOGGING'
|
|
16
|
+
* environment variable. See {@link DEBUG_LOG_LEVEL} for details.
|
|
17
|
+
*/
|
|
18
|
+
debugInvokeMessage(invocationInfo: string, logMessage: string): void;
|
|
19
|
+
/**
|
|
20
|
+
* Called to log per-jounral action debug messages.
|
|
21
|
+
*
|
|
22
|
+
* Under load, this can generate an insane amount of log output. Due to that, this
|
|
23
|
+
* function doesn't actually output log entries unless configured via the 'RESTATE_DEBUG_LOGGING'
|
|
24
|
+
* environment variable. See {@link DEBUG_LOG_LEVEL} for details.
|
|
25
|
+
*/
|
|
26
|
+
debugJournalMessage(invocationInfo: string, logMessage: string, messageType?: bigint, message?: any): void;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The environment variable which is read to determine the debug log settings.
|
|
30
|
+
*/
|
|
31
|
+
export declare const DEBUG_LOGGING_ENV = "RESTATE_DEBUG_LOGGING";
|
|
32
|
+
/**
|
|
33
|
+
* The values for the {@link DEBUG_LOGGING_ENV} variable.
|
|
34
|
+
*/
|
|
35
|
+
export declare enum DEBUG_LOG_LEVEL {
|
|
36
|
+
/** No debug logging at all. Good for performance and avoid per-invocation log volume */
|
|
37
|
+
OFF = "OFF",
|
|
38
|
+
/** Logs debug information for every Restate function invocation. */
|
|
39
|
+
INVOKE = "INVOKE",
|
|
40
|
+
/** Logs debug information for every Restate effect (=journal event) inside an invocation,
|
|
41
|
+
* like RPC, state access, sideEffect, ... */
|
|
42
|
+
JOURNAL = "JOURNAL",
|
|
43
|
+
/** Logs debug information for every Restate effect (=journal event) inside an invocation,
|
|
44
|
+
* like RPC, state access, sideEffect, ... Additionally, this adds a JSON representation
|
|
45
|
+
* of the journal message to the log. */
|
|
46
|
+
JOURNAL_VERBOSE = "JOURNAL_VERBOSE"
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* The RestateLogger lets us add some extra information to logging statements:
|
|
50
|
+
* [restate] [timestamp] INFO/WARN/ERROR/DEBUG/TRACE <log-message>.
|
|
51
|
+
*
|
|
52
|
+
* It also adds the methods {@link RestateConsole.debugInvokeMessage} and *
|
|
53
|
+
* {@link RestateConsole.debugJournalMessage} for optional intensive (per
|
|
54
|
+
* invocation / per journal message) logging.
|
|
55
|
+
*
|
|
56
|
+
* We don't override the console here, to make sure that this only applies to Restate
|
|
57
|
+
* log lines, and not to logging from application code.
|
|
58
|
+
*/
|
|
59
|
+
export declare const rlog: RestateConsole;
|
|
60
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":";AAiBA;;;;;;GAMG;AACH,MAAM,WAAW,cAAe,SAAQ,OAAO;IAC7C;;;;;;;OAOG;IACH,kBAAkB,CAAC,cAAc,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAErE;;;;;;OAMG;IACH,mBAAmB,CACjB,cAAc,EAAE,MAAM,EACtB,UAAU,EAAE,MAAM,EAClB,WAAW,CAAC,EAAE,MAAM,EACpB,OAAO,CAAC,EAAE,GAAG,GACZ,IAAI,CAAC;CACT;AAED;;GAEG;AACH,eAAO,MAAM,iBAAiB,0BAA0B,CAAC;AAEzD;;GAEG;AACH,oBAAY,eAAe;IACzB,wFAAwF;IACxF,GAAG,QAAQ;IAEX,oEAAoE;IACpE,MAAM,WAAW;IAEjB;kDAC8C;IAC9C,OAAO,YAAY;IAEnB;;6CAEyC;IACzC,eAAe,oBAAoB;CACpC;AAiGD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,IAAI,gBAAmC,CAAC"}
|
|
@@ -0,0 +1,102 @@
|
|
|
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.rlog = exports.DEBUG_LOG_LEVEL = exports.DEBUG_LOGGING_ENV = void 0;
|
|
14
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
15
|
+
/* eslint-disable no-console */
|
|
16
|
+
const protocol_1 = require("../types/protocol");
|
|
17
|
+
const utils_1 = require("./utils");
|
|
18
|
+
/**
|
|
19
|
+
* The environment variable which is read to determine the debug log settings.
|
|
20
|
+
*/
|
|
21
|
+
exports.DEBUG_LOGGING_ENV = "RESTATE_DEBUG_LOGGING";
|
|
22
|
+
/**
|
|
23
|
+
* The values for the {@link DEBUG_LOGGING_ENV} variable.
|
|
24
|
+
*/
|
|
25
|
+
var DEBUG_LOG_LEVEL;
|
|
26
|
+
(function (DEBUG_LOG_LEVEL) {
|
|
27
|
+
/** No debug logging at all. Good for performance and avoid per-invocation log volume */
|
|
28
|
+
DEBUG_LOG_LEVEL["OFF"] = "OFF";
|
|
29
|
+
/** Logs debug information for every Restate function invocation. */
|
|
30
|
+
DEBUG_LOG_LEVEL["INVOKE"] = "INVOKE";
|
|
31
|
+
/** Logs debug information for every Restate effect (=journal event) inside an invocation,
|
|
32
|
+
* like RPC, state access, sideEffect, ... */
|
|
33
|
+
DEBUG_LOG_LEVEL["JOURNAL"] = "JOURNAL";
|
|
34
|
+
/** Logs debug information for every Restate effect (=journal event) inside an invocation,
|
|
35
|
+
* like RPC, state access, sideEffect, ... Additionally, this adds a JSON representation
|
|
36
|
+
* of the journal message to the log. */
|
|
37
|
+
DEBUG_LOG_LEVEL["JOURNAL_VERBOSE"] = "JOURNAL_VERBOSE";
|
|
38
|
+
})(DEBUG_LOG_LEVEL = exports.DEBUG_LOG_LEVEL || (exports.DEBUG_LOG_LEVEL = {}));
|
|
39
|
+
const log_setting = process.env[exports.DEBUG_LOGGING_ENV]?.toUpperCase();
|
|
40
|
+
const verbose_journal_event_logging = log_setting == DEBUG_LOG_LEVEL.JOURNAL_VERBOSE;
|
|
41
|
+
const journal_event_logging = verbose_journal_event_logging || log_setting == DEBUG_LOG_LEVEL.JOURNAL;
|
|
42
|
+
const invoke_event_logging = journal_event_logging ||
|
|
43
|
+
log_setting == DEBUG_LOG_LEVEL.INVOKE ||
|
|
44
|
+
(log_setting != DEBUG_LOG_LEVEL.OFF &&
|
|
45
|
+
process.env["NODE_ENV"]?.toLowerCase() !== "production");
|
|
46
|
+
// ----------------------------------------------------------------------------
|
|
47
|
+
// build restate logger
|
|
48
|
+
// ----------------------------------------------------------------------------
|
|
49
|
+
// effectively duplicate the console object (new object with same prototype)
|
|
50
|
+
// to override some specific methods
|
|
51
|
+
const restate_logger = Object.create(console);
|
|
52
|
+
restate_logger.log = (message, ...optionalParams) => {
|
|
53
|
+
console.log(`[restate] [${new Date().toISOString()}] LOG: ${message}`, ...optionalParams);
|
|
54
|
+
};
|
|
55
|
+
restate_logger.info = (message, ...optionalParams) => {
|
|
56
|
+
console.info(`[restate] [${new Date().toISOString()}] INFO: ${message}`, ...optionalParams);
|
|
57
|
+
};
|
|
58
|
+
restate_logger.warn = (message, ...optionalParams) => {
|
|
59
|
+
console.warn(`[restate] [${new Date().toISOString()}] WARN: ${message}`, ...optionalParams);
|
|
60
|
+
};
|
|
61
|
+
restate_logger.error = (message, ...optionalParams) => {
|
|
62
|
+
console.error(`[restate] [${new Date().toISOString()}] ERROR: ${message}`, ...optionalParams);
|
|
63
|
+
};
|
|
64
|
+
restate_logger.debug = (message, ...optionalParams) => {
|
|
65
|
+
console.debug(`[restate] [${new Date().toISOString()}] DEBUG: ${message}`, ...optionalParams);
|
|
66
|
+
};
|
|
67
|
+
restate_logger.trace = (message, ...optionalParams) => {
|
|
68
|
+
console.trace(`[restate] [${new Date().toISOString()}] TRACE: ${message}`, ...optionalParams);
|
|
69
|
+
};
|
|
70
|
+
restate_logger.debugInvokeMessage = function (invocationInfo, logMessage) {
|
|
71
|
+
if (!invoke_event_logging) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
const msg = `[restate] [${new Date().toISOString()}] DEBUG: ${invocationInfo} : ${logMessage}`;
|
|
75
|
+
console.debug(msg);
|
|
76
|
+
};
|
|
77
|
+
restate_logger.debugJournalMessage = function (invocationInfo, logMessage, messageType, message) {
|
|
78
|
+
if (!journal_event_logging) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
const type = messageType !== undefined
|
|
82
|
+
? " ; " + protocol_1.PROTOBUF_MESSAGE_NAME_BY_TYPE.get(messageType) ||
|
|
83
|
+
"" + messageType
|
|
84
|
+
: "";
|
|
85
|
+
const journalEvent = verbose_journal_event_logging && message !== undefined
|
|
86
|
+
? " : " + (0, utils_1.printMessageAsJson)(message)
|
|
87
|
+
: "";
|
|
88
|
+
console.debug(`[restate] [${new Date().toISOString()}] DEBUG: ${invocationInfo} : ${logMessage}${type}${journalEvent}`);
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* The RestateLogger lets us add some extra information to logging statements:
|
|
92
|
+
* [restate] [timestamp] INFO/WARN/ERROR/DEBUG/TRACE <log-message>.
|
|
93
|
+
*
|
|
94
|
+
* It also adds the methods {@link RestateConsole.debugInvokeMessage} and *
|
|
95
|
+
* {@link RestateConsole.debugJournalMessage} for optional intensive (per
|
|
96
|
+
* invocation / per journal message) logging.
|
|
97
|
+
*
|
|
98
|
+
* We don't override the console here, to make sure that this only applies to Restate
|
|
99
|
+
* log lines, and not to logging from application code.
|
|
100
|
+
*/
|
|
101
|
+
exports.rlog = restate_logger;
|
|
102
|
+
//# sourceMappingURL=logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AAEH,uDAAuD;AACvD,+BAA+B;AAE/B,gDAAkE;AAClE,mCAA6C;AAmC7C;;GAEG;AACU,QAAA,iBAAiB,GAAG,uBAAuB,CAAC;AAEzD;;GAEG;AACH,IAAY,eAeX;AAfD,WAAY,eAAe;IACzB,wFAAwF;IACxF,8BAAW,CAAA;IAEX,oEAAoE;IACpE,oCAAiB,CAAA;IAEjB;kDAC8C;IAC9C,sCAAmB,CAAA;IAEnB;;6CAEyC;IACzC,sDAAmC,CAAA;AACrC,CAAC,EAfW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAe1B;AAED,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,yBAAiB,CAAC,EAAE,WAAW,EAAE,CAAC;AAClE,MAAM,6BAA6B,GACjC,WAAW,IAAI,eAAe,CAAC,eAAe,CAAC;AACjD,MAAM,qBAAqB,GACzB,6BAA6B,IAAI,WAAW,IAAI,eAAe,CAAC,OAAO,CAAC;AAC1E,MAAM,oBAAoB,GACxB,qBAAqB;IACrB,WAAW,IAAI,eAAe,CAAC,MAAM;IACrC,CAAC,WAAW,IAAI,eAAe,CAAC,GAAG;QACjC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,WAAW,EAAE,KAAK,YAAY,CAAC,CAAC;AAE7D,+EAA+E;AAC/E,wBAAwB;AACxB,+EAA+E;AAE/E,4EAA4E;AAC5E,oCAAoC;AACpC,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AAE9C,cAAc,CAAC,GAAG,GAAG,CAAC,OAAa,EAAE,GAAG,cAAqB,EAAE,EAAE;IAC/D,OAAO,CAAC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AAkB;IAElB,IAAI,CAAC,oBAAoB,EAAE;QACzB,OAAO;KACR;IACD,MAAM,GAAG,GAAG,cAAc,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,YAAY,cAAc,MAAM,UAAU,EAAE,CAAC;IAC/F,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;AACrB,CAAC,CAAC;AAEF,cAAc,CAAC,mBAAmB,GAAG,UACnC,cAAsB,EACtB,UAAkB,EAClB,WAAoB,EACpB,OAAa;IAEb,IAAI,CAAC,qBAAqB,EAAE;QAC1B,OAAO;KACR;IACD,MAAM,IAAI,GACR,WAAW,KAAK,SAAS;QACvB,CAAC,CAAC,KAAK,GAAG,wCAA6B,CAAC,GAAG,CAAC,WAAW,CAAC;YACtD,EAAE,GAAG,WAAW;QAClB,CAAC,CAAC,EAAE,CAAC;IACT,MAAM,YAAY,GAChB,6BAA6B,IAAI,OAAO,KAAK,SAAS;QACpD,CAAC,CAAC,KAAK,GAAG,IAAA,0BAAkB,EAAC,OAAO,CAAC;QACrC,CAAC,CAAC,EAAE,CAAC;IACT,OAAO,CAAC,KAAK,CACX,cAAc,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,YAAY,cAAc,MAAM,UAAU,GAAG,IAAI,GAAG,YAAY,EAAE,CACzG,CAAC;AACJ,CAAC,CAAC;AAEF;;;;;;;;;;GAUG;AACU,QAAA,IAAI,GAAG,cAAgC,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Retry policy that decides how to delay between retries.
|
|
3
|
+
*/
|
|
4
|
+
export interface RetryPolicy {
|
|
5
|
+
computeNextDelay(previousDelayMs: number): number;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* A {@link RetryPolicy} that keeps a fixed delay between retries.
|
|
9
|
+
*/
|
|
10
|
+
export declare const FIXED_DELAY: RetryPolicy;
|
|
11
|
+
/**
|
|
12
|
+
* A {@link RetryPolicy} that does an exponential backoff delay between retries.
|
|
13
|
+
* Each delay is twice as long as the previous delay.
|
|
14
|
+
*/
|
|
15
|
+
export declare const EXPONENTIAL_BACKOFF: RetryPolicy;
|
|
16
|
+
/**
|
|
17
|
+
* All properties related to retrying, like the policy (exponential, fixed, ...), the
|
|
18
|
+
* initial delay, the maximum number of retries.
|
|
19
|
+
*/
|
|
20
|
+
export interface RetrySettings {
|
|
21
|
+
/**
|
|
22
|
+
* The initial delay between retries. As more retries happen, the delay may change per the policy.
|
|
23
|
+
*/
|
|
24
|
+
initialDelayMs?: number;
|
|
25
|
+
/**
|
|
26
|
+
* Optionally, the maximum delay between retries. No matter what the policy says, this is the maximum time
|
|
27
|
+
* that Restate sleeps between retries.
|
|
28
|
+
* If not set, there is effectively no limit (internally the limit is Number.MAX_SAFE_INTEGER).
|
|
29
|
+
*/
|
|
30
|
+
maxDelayMs?: number;
|
|
31
|
+
/**
|
|
32
|
+
* Optionally, the maximum number of retries before this function fails with an exception.
|
|
33
|
+
* If not set, there is effectively no limit (internally the limit is Number.MAX_SAFE_INTEGER).
|
|
34
|
+
*/
|
|
35
|
+
maxRetries?: number;
|
|
36
|
+
/**
|
|
37
|
+
* Optionally, the {@link RetryPolicy} to use. Defaults to {@link EXPONENTIAL_BACKOFF}.
|
|
38
|
+
*/
|
|
39
|
+
policy?: RetryPolicy;
|
|
40
|
+
/**
|
|
41
|
+
* Optionally, the name of side effect action that is used in error- and log messages around retries.
|
|
42
|
+
*/
|
|
43
|
+
name?: string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* The default initial delay between retries: 10 milliseconds.
|
|
47
|
+
*/
|
|
48
|
+
export declare const DEFAULT_INITIAL_DELAY_MS = 10;
|
|
49
|
+
/**
|
|
50
|
+
* Default retry policy that retries an infinite number of times, with exponential backoff
|
|
51
|
+
* and a starting delay of 10 milliseconds.
|
|
52
|
+
*/
|
|
53
|
+
export declare const DEFAULT_INFINITE_EXPONENTIAL_BACKOFF: RetrySettings;
|
|
54
|
+
/**
|
|
55
|
+
* Retry policy that does no retries.
|
|
56
|
+
*/
|
|
57
|
+
export declare const NO_RETRIES: RetrySettings;
|
|
58
|
+
//# sourceMappingURL=public_utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public_utils.d.ts","sourceRoot":"","sources":["../../src/utils/public_utils.ts"],"names":[],"mappings":"AAWA;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,gBAAgB,CAAC,eAAe,EAAE,MAAM,GAAG,MAAM,CAAC;CACnD;AAED;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,WAIzB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,mBAAmB,EAAE,WAIjC,CAAC;AAEF;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IAErB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,eAAO,MAAM,wBAAwB,KAAK,CAAC;AAE3C;;;GAGG;AACH,eAAO,MAAM,oCAAoC,EAAE,aAKlD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,UAAU,EAAE,aAAiC,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
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.NO_RETRIES = exports.DEFAULT_INFINITE_EXPONENTIAL_BACKOFF = exports.DEFAULT_INITIAL_DELAY_MS = exports.EXPONENTIAL_BACKOFF = exports.FIXED_DELAY = void 0;
|
|
14
|
+
/**
|
|
15
|
+
* A {@link RetryPolicy} that keeps a fixed delay between retries.
|
|
16
|
+
*/
|
|
17
|
+
exports.FIXED_DELAY = {
|
|
18
|
+
computeNextDelay(previousDelayMs) {
|
|
19
|
+
return previousDelayMs;
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* A {@link RetryPolicy} that does an exponential backoff delay between retries.
|
|
24
|
+
* Each delay is twice as long as the previous delay.
|
|
25
|
+
*/
|
|
26
|
+
exports.EXPONENTIAL_BACKOFF = {
|
|
27
|
+
computeNextDelay(previousDelayMs) {
|
|
28
|
+
return 2 * previousDelayMs;
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* The default initial delay between retries: 10 milliseconds.
|
|
33
|
+
*/
|
|
34
|
+
exports.DEFAULT_INITIAL_DELAY_MS = 10;
|
|
35
|
+
/**
|
|
36
|
+
* Default retry policy that retries an infinite number of times, with exponential backoff
|
|
37
|
+
* and a starting delay of 10 milliseconds.
|
|
38
|
+
*/
|
|
39
|
+
exports.DEFAULT_INFINITE_EXPONENTIAL_BACKOFF = {
|
|
40
|
+
initialDelayMs: exports.DEFAULT_INITIAL_DELAY_MS,
|
|
41
|
+
maxDelayMs: Number.MAX_SAFE_INTEGER,
|
|
42
|
+
maxRetries: Number.MAX_SAFE_INTEGER,
|
|
43
|
+
policy: exports.EXPONENTIAL_BACKOFF,
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Retry policy that does no retries.
|
|
47
|
+
*/
|
|
48
|
+
exports.NO_RETRIES = { maxRetries: 0 };
|
|
49
|
+
//# sourceMappingURL=public_utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public_utils.js","sourceRoot":"","sources":["../../src/utils/public_utils.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AASH;;GAEG;AACU,QAAA,WAAW,GAAgB;IACtC,gBAAgB,CAAC,eAAuB;QACtC,OAAO,eAAe,CAAC;IACzB,CAAC;CACF,CAAC;AAEF;;;GAGG;AACU,QAAA,mBAAmB,GAAgB;IAC9C,gBAAgB,CAAC,eAAuB;QACtC,OAAO,CAAC,GAAG,eAAe,CAAC;IAC7B,CAAC;CACF,CAAC;AAoCF;;GAEG;AACU,QAAA,wBAAwB,GAAG,EAAE,CAAC;AAE3C;;;GAGG;AACU,QAAA,oCAAoC,GAAkB;IACjE,cAAc,EAAE,gCAAwB;IACxC,UAAU,EAAE,MAAM,CAAC,gBAAgB;IACnC,UAAU,EAAE,MAAM,CAAC,gBAAgB;IACnC,MAAM,EAAE,2BAAmB;CAC5B,CAAC;AAEF;;GAEG;AACU,QAAA,UAAU,GAAkB,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare class CompletablePromise<T> {
|
|
2
|
+
private success;
|
|
3
|
+
private failure;
|
|
4
|
+
readonly promise: Promise<T>;
|
|
5
|
+
constructor();
|
|
6
|
+
resolve(value: T): void;
|
|
7
|
+
reject(reason?: any): void;
|
|
8
|
+
}
|
|
9
|
+
export declare function jsonSerialize(obj: any): string;
|
|
10
|
+
export declare function jsonDeserialize<T>(json: string): T;
|
|
11
|
+
export declare function printMessageAsJson(obj: any): string;
|
|
12
|
+
export declare function makeFqServiceName(pckg: string, name: string): string;
|
|
13
|
+
export declare const equalityCheckers: Map<bigint, (msg1: any, msg2: any) => boolean>;
|
|
14
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils/utils.ts"],"names":[],"mappings":"AAmCA,qBAAa,kBAAkB,CAAC,CAAC;IAC/B,OAAO,CAAC,OAAO,CAAuC;IACtD,OAAO,CAAC,OAAO,CAA0B;IAEzC,SAAgB,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;;IAS7B,OAAO,CAAC,KAAK,EAAE,CAAC;IAIhB,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG;CAG3B;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM,CAI9C;AAED,wBAAgB,eAAe,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,CAMlD;AAED,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM,CAWnD;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAEpE;AA+ED,eAAO,MAAM,gBAAgB,qBAEpB,GAAG,QAAQ,GAAG,KAAK,OAAO,CAYjC,CAAC"}
|
|
@@ -0,0 +1,119 @@
|
|
|
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.equalityCheckers = exports.makeFqServiceName = exports.printMessageAsJson = exports.jsonDeserialize = exports.jsonSerialize = exports.CompletablePromise = void 0;
|
|
14
|
+
const protocol_1 = require("../types/protocol");
|
|
15
|
+
class CompletablePromise {
|
|
16
|
+
success;
|
|
17
|
+
failure;
|
|
18
|
+
promise;
|
|
19
|
+
constructor() {
|
|
20
|
+
this.promise = new Promise((resolve, reject) => {
|
|
21
|
+
this.success = resolve;
|
|
22
|
+
this.failure = reject;
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
resolve(value) {
|
|
26
|
+
this.success(value);
|
|
27
|
+
}
|
|
28
|
+
reject(reason) {
|
|
29
|
+
this.failure(reason);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.CompletablePromise = CompletablePromise;
|
|
33
|
+
function jsonSerialize(obj) {
|
|
34
|
+
return JSON.stringify(obj, (_, v) => typeof v === "bigint" ? "BIGINT::" + v.toString() : v);
|
|
35
|
+
}
|
|
36
|
+
exports.jsonSerialize = jsonSerialize;
|
|
37
|
+
function jsonDeserialize(json) {
|
|
38
|
+
return JSON.parse(json, (_, v) => typeof v === "string" && v.startsWith("BIGINT::")
|
|
39
|
+
? BigInt(v.substring(8))
|
|
40
|
+
: v);
|
|
41
|
+
}
|
|
42
|
+
exports.jsonDeserialize = jsonDeserialize;
|
|
43
|
+
function printMessageAsJson(obj) {
|
|
44
|
+
const newObj = { ...obj };
|
|
45
|
+
for (const [key, value] of Object.entries(newObj)) {
|
|
46
|
+
if (Buffer.isBuffer(value)) {
|
|
47
|
+
newObj[key] = value.toString().trim();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
// Stringify object. Replace bigintToString serializer to prevent "BigInt not serializable" errors
|
|
51
|
+
return JSON.stringify(obj, (_, v) => typeof v === "bigint" ? v.toString() + "n" : v);
|
|
52
|
+
}
|
|
53
|
+
exports.printMessageAsJson = printMessageAsJson;
|
|
54
|
+
function makeFqServiceName(pckg, name) {
|
|
55
|
+
return pckg ? `${pckg}.${name}` : name;
|
|
56
|
+
}
|
|
57
|
+
exports.makeFqServiceName = makeFqServiceName;
|
|
58
|
+
/**
|
|
59
|
+
* Equality functions
|
|
60
|
+
* @param msg1 the current message from user code
|
|
61
|
+
* @param msg2 the replayed message
|
|
62
|
+
*/
|
|
63
|
+
// These functions are used to check whether a replayed message matches the current user code.
|
|
64
|
+
// We check the fields which we can check
|
|
65
|
+
// (the fields which do not contain results, because these might be filled in the result)
|
|
66
|
+
const getStateMsgEquality = (msg1, msg2) => {
|
|
67
|
+
return msg1.key.equals(msg2.key);
|
|
68
|
+
};
|
|
69
|
+
const invokeMsgEquality = (msg1, msg2) => {
|
|
70
|
+
return (msg1.serviceName === msg2.serviceName &&
|
|
71
|
+
msg1.methodName === msg2.methodName &&
|
|
72
|
+
msg1.parameter.equals(msg2.parameter));
|
|
73
|
+
};
|
|
74
|
+
const setStateMsgEquality = (msg1, msg2) => {
|
|
75
|
+
return msg1.key.equals(msg2.key) && msg1.value.equals(msg2.value);
|
|
76
|
+
};
|
|
77
|
+
const clearStateMsgEquality = (msg1, msg2) => {
|
|
78
|
+
return msg1.key.equals(msg2.key);
|
|
79
|
+
};
|
|
80
|
+
const completeAwakeableMsgEquality = (msg1, msg2) => {
|
|
81
|
+
if (!(msg1.id === msg2.id)) {
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
if (msg1.value && msg2.value) {
|
|
85
|
+
return msg1.value.equals(msg2.value);
|
|
86
|
+
}
|
|
87
|
+
else if (msg1.failure && msg2.failure) {
|
|
88
|
+
return (msg1.failure?.code === msg2.failure?.code &&
|
|
89
|
+
msg1.failure?.message === msg2.failure?.message);
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
const outputMsgEquality = (msg1, msg2) => {
|
|
96
|
+
if (msg1.value && msg2.value) {
|
|
97
|
+
return msg1.value.equals(msg2.value);
|
|
98
|
+
}
|
|
99
|
+
else if (msg1.failure && msg2.failure) {
|
|
100
|
+
return (msg1.failure?.code === msg2.failure?.code &&
|
|
101
|
+
msg1.failure?.message === msg2.failure?.message);
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
exports.equalityCheckers = new Map([
|
|
108
|
+
[protocol_1.GET_STATE_ENTRY_MESSAGE_TYPE, getStateMsgEquality],
|
|
109
|
+
[protocol_1.SET_STATE_ENTRY_MESSAGE_TYPE, setStateMsgEquality],
|
|
110
|
+
[protocol_1.CLEAR_STATE_ENTRY_MESSAGE_TYPE, clearStateMsgEquality],
|
|
111
|
+
[protocol_1.INVOKE_ENTRY_MESSAGE_TYPE, invokeMsgEquality],
|
|
112
|
+
[protocol_1.BACKGROUND_INVOKE_ENTRY_MESSAGE_TYPE, invokeMsgEquality],
|
|
113
|
+
[protocol_1.COMPLETE_AWAKEABLE_ENTRY_MESSAGE_TYPE, completeAwakeableMsgEquality],
|
|
114
|
+
[protocol_1.OUTPUT_STREAM_ENTRY_MESSAGE_TYPE, outputMsgEquality],
|
|
115
|
+
[protocol_1.AWAKEABLE_ENTRY_MESSAGE_TYPE, () => true],
|
|
116
|
+
[protocol_1.SIDE_EFFECT_ENTRY_MESSAGE_TYPE, () => true],
|
|
117
|
+
[protocol_1.SLEEP_ENTRY_MESSAGE_TYPE, () => true],
|
|
118
|
+
]);
|
|
119
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils/utils.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AAaH,gDAW2B;AAE3B,MAAa,kBAAkB;IACrB,OAAO,CAAuC;IAC9C,OAAO,CAA0B;IAEzB,OAAO,CAAa;IAEpC;QACE,IAAI,CAAC,OAAO,GAAG,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAC7C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;YACvB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACxB,CAAC,CAAC,CAAC;IACL,CAAC;IAEM,OAAO,CAAC,KAAQ;QACrB,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACtB,CAAC;IAEM,MAA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C;IACrE,CAAC,2CAAgC,EAAE,iBAAiB,CAAC;IACrD,CAAC,uCAA4B,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC;IAC1C,CAAC,yCAA8B,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC;IAC5C,CAAC,mCAAwB,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC;CACvC,CAAC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@restatedev/restate-sdk",
|
|
3
|
+
"version": "0.0.0-SNAPSHOT-20231025205407",
|
|
4
|
+
"description": "Typescript SDK for Restate",
|
|
5
|
+
"engines": {
|
|
6
|
+
"node": ">= 10"
|
|
7
|
+
},
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/restatedev/sdk-typescript.git"
|
|
11
|
+
},
|
|
12
|
+
"release-it": {
|
|
13
|
+
"git": {
|
|
14
|
+
"pushRepo": "https://github.com/restatedev/sdk-typescript.git"
|
|
15
|
+
},
|
|
16
|
+
"github": {
|
|
17
|
+
"release": true
|
|
18
|
+
},
|
|
19
|
+
"npm": {
|
|
20
|
+
"publish": false
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"publishConfig": {
|
|
24
|
+
"@restatedev:registry": "https://registry.npmjs.org"
|
|
25
|
+
},
|
|
26
|
+
"type": "commonjs",
|
|
27
|
+
"main": "dist/public_api.js",
|
|
28
|
+
"types": "dist/public_api.d.ts",
|
|
29
|
+
"author": "Restate Developers",
|
|
30
|
+
"license": "MIT",
|
|
31
|
+
"email": "code@restate.dev",
|
|
32
|
+
"scripts": {
|
|
33
|
+
"proto": "npx buf mod update && npx buf generate",
|
|
34
|
+
"build": "tsc --noEmitOnError",
|
|
35
|
+
"test": "jest --silent --maxWorkers=1",
|
|
36
|
+
"lint": "eslint --ignore-path .eslintignore --ext .ts .",
|
|
37
|
+
"format": "prettier --ignore-path .eslintignore --write \"**/*.+(js|ts|json)\"",
|
|
38
|
+
"verify": "npm run format -- --check && npm run test && npm run lint && npm run build",
|
|
39
|
+
"release": "release-it",
|
|
40
|
+
"example": "RESTATE_DEBUG_LOGGING=JOURNAL ts-node-dev --respawn --transpile-only ./examples/example.ts",
|
|
41
|
+
"grpcexample": "RESTATE_DEBUG_LOGGING=JOURNAL ts-node-dev --respawn --transpile-only ./examples/grpc_example.ts",
|
|
42
|
+
"handlerexample": "RESTATE_DEBUG_LOGGING=JOURNAL ts-node-dev --respawn --transpile-only ./examples/handler_example.ts",
|
|
43
|
+
"expressexample": "RESTATE_DEBUG_LOGGING=JOURNAL ts-node-dev --respawn --transpile-only ./examples/embedded_example.ts"
|
|
44
|
+
},
|
|
45
|
+
"files": [
|
|
46
|
+
"dist"
|
|
47
|
+
],
|
|
48
|
+
"dependencies": {
|
|
49
|
+
"protobufjs": "^7.2.2",
|
|
50
|
+
"ts-proto": "^1.140.0"
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@bufbuild/buf": "^1.15.0",
|
|
54
|
+
"@types/aws-lambda": "^8.10.115",
|
|
55
|
+
"@types/jest": "^29.4.0",
|
|
56
|
+
"@types/node": "^18.14.2",
|
|
57
|
+
"@typescript-eslint/eslint-plugin": "^5.53.0",
|
|
58
|
+
"@typescript-eslint/parser": "^5.53.0",
|
|
59
|
+
"eslint": "^8.35.0",
|
|
60
|
+
"prettier": "^2.8.4",
|
|
61
|
+
"release-it": "^16.1.4",
|
|
62
|
+
"ts-jest": "^29.0.5",
|
|
63
|
+
"ts-node-dev": "^2.0.0",
|
|
64
|
+
"typescript": "^4.9.5",
|
|
65
|
+
"express": "*"
|
|
66
|
+
},
|
|
67
|
+
"bugs": {
|
|
68
|
+
"url": "https://github.com/restatedev/sdk-typescript/issues"
|
|
69
|
+
},
|
|
70
|
+
"homepage": "https://github.com/restatedev/sdk-typescript#readme",
|
|
71
|
+
"directories": {
|
|
72
|
+
"example": "examples",
|
|
73
|
+
"test": "test"
|
|
74
|
+
}
|
|
75
|
+
}
|