@restatedev/restate-sdk-cloudflare-workers 1.16.0 → 1.16.2
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/dist/endpoint/handlers/core_logging.cjs +16 -0
- package/dist/endpoint/handlers/core_logging.js +16 -1
- package/dist/endpoint/handlers/core_logging.js.map +1 -1
- package/dist/endpoint/handlers/vm/sdk_shared_core_wasm_bindings_bg.js +3 -22
- package/dist/endpoint/handlers/vm/sdk_shared_core_wasm_bindings_bg.wasm +0 -0
- package/dist/package.cjs +1 -1
- package/dist/package.js +1 -1
- package/dist/package.js.map +1 -1
- package/package.json +3 -3
|
@@ -30,6 +30,21 @@ function vm_log(level, strBytes, loggerId) {
|
|
|
30
30
|
}, "Unexpected error thrown while trying to log: " + e?.toString());
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Invoked by the shared core's panic hook when it hits a rust panic.
|
|
35
|
+
*/
|
|
36
|
+
function fatal(message) {
|
|
37
|
+
try {
|
|
38
|
+
const stack = (/* @__PURE__ */ new Error()).stack;
|
|
39
|
+
require_console_logger_transport.defaultLoggerTransport({
|
|
40
|
+
level: require_logger_transport.RestateLogLevel.ERROR,
|
|
41
|
+
replaying: false,
|
|
42
|
+
source: require_logger_transport.LogSource.SYSTEM
|
|
43
|
+
}, "FATAL: the SDK shared-core panicked, terminating the process. Reason: \n" + message + (stack ? "\n\nStack:\n" + stack : ""));
|
|
44
|
+
const proc = globalThis.process;
|
|
45
|
+
if (typeof proc?.exit === "function") proc.exit(1);
|
|
46
|
+
} catch {}
|
|
47
|
+
}
|
|
33
48
|
function registerLogger(loggerId, logger) {
|
|
34
49
|
invocationLoggers.set(loggerId, logger);
|
|
35
50
|
}
|
|
@@ -48,5 +63,6 @@ function wasmLogLevelToRestateLogLevel(level) {
|
|
|
48
63
|
|
|
49
64
|
//#endregion
|
|
50
65
|
exports.destroyLogger = destroyLogger;
|
|
66
|
+
exports.fatal = fatal;
|
|
51
67
|
exports.registerLogger = registerLogger;
|
|
52
68
|
exports.vm_log = vm_log;
|
|
@@ -30,6 +30,21 @@ function vm_log(level, strBytes, loggerId) {
|
|
|
30
30
|
}, "Unexpected error thrown while trying to log: " + e?.toString());
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Invoked by the shared core's panic hook when it hits a rust panic.
|
|
35
|
+
*/
|
|
36
|
+
function fatal(message) {
|
|
37
|
+
try {
|
|
38
|
+
const stack = (/* @__PURE__ */ new Error()).stack;
|
|
39
|
+
defaultLoggerTransport({
|
|
40
|
+
level: RestateLogLevel.ERROR,
|
|
41
|
+
replaying: false,
|
|
42
|
+
source: LogSource.SYSTEM
|
|
43
|
+
}, "FATAL: the SDK shared-core panicked, terminating the process. Reason: \n" + message + (stack ? "\n\nStack:\n" + stack : ""));
|
|
44
|
+
const proc = globalThis.process;
|
|
45
|
+
if (typeof proc?.exit === "function") proc.exit(1);
|
|
46
|
+
} catch {}
|
|
47
|
+
}
|
|
33
48
|
function registerLogger(loggerId, logger) {
|
|
34
49
|
invocationLoggers.set(loggerId, logger);
|
|
35
50
|
}
|
|
@@ -47,5 +62,5 @@ function wasmLogLevelToRestateLogLevel(level) {
|
|
|
47
62
|
}
|
|
48
63
|
|
|
49
64
|
//#endregion
|
|
50
|
-
export { destroyLogger, registerLogger, vm_log };
|
|
65
|
+
export { destroyLogger, fatal, registerLogger, vm_log };
|
|
51
66
|
//# sourceMappingURL=core_logging.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core_logging.js","names":["invocationLoggers: Map<number, Logger>"],"sources":["../../../src/endpoint/handlers/core_logging.ts"],"sourcesContent":["import { Logger } from \"../../logging/logger.js\";\nimport { LogSource, RestateLogLevel } from \"../../logging/logger_transport.js\";\nimport * as vm from \"./vm/sdk_shared_core_wasm_bindings.js\";\nimport { defaultLoggerTransport } from \"../../logging/console_logger_transport.js\";\n\n/**\n * This file contains the shared state used to install a logger that the shared-core uses for logging.\n */\n\nconst invocationLoggers: Map<number, Logger> = new Map<number, Logger>();\nconst logsTextDecoder = new TextDecoder(\"utf-8\", { fatal: false });\n\n/**\n * The shared core propagates logs to the SDK invoking this method.\n * When possible, it provides an invocationId, which is used to access the registered invocationLoggers, that should contain the logger per invocation id.\n */\nexport function vm_log(\n level: vm.LogLevel,\n strBytes: Uint8Array,\n loggerId?: number\n) {\n try {\n const logger = (loggerId && invocationLoggers.get(loggerId)) || undefined;\n const str = logsTextDecoder.decode(strBytes);\n if (logger !== undefined) {\n logger.logForLevel(wasmLogLevelToRestateLogLevel(level), str);\n } else {\n defaultLoggerTransport(\n {\n level: wasmLogLevelToRestateLogLevel(level),\n replaying: false,\n source: LogSource.JOURNAL,\n },\n str\n );\n }\n } catch (e) {\n // This function CAN'T EVER propagate an error,\n // because otherwise it will cause an awesome error in the shared core due to concurrent usage of it.\n defaultLoggerTransport(\n {\n level: RestateLogLevel.ERROR,\n replaying: false,\n source: LogSource.SYSTEM,\n },\n \"Unexpected error thrown while trying to log: \" + e?.toString()\n );\n }\n}\n\nexport function registerLogger(loggerId: number, logger: Logger) {\n invocationLoggers.set(loggerId, logger);\n}\n\nexport function destroyLogger(loggerId: number) {\n invocationLoggers.delete(loggerId);\n}\n\nfunction wasmLogLevelToRestateLogLevel(level: vm.LogLevel): RestateLogLevel {\n switch (level) {\n case vm.LogLevel.TRACE:\n return RestateLogLevel.TRACE;\n case vm.LogLevel.DEBUG:\n return RestateLogLevel.DEBUG;\n case vm.LogLevel.INFO:\n return RestateLogLevel.INFO;\n case vm.LogLevel.WARN:\n return RestateLogLevel.WARN;\n case vm.LogLevel.ERROR:\n return RestateLogLevel.ERROR;\n }\n}\n"],"mappings":";;;;;;;;AASA,MAAMA,oCAAyC,IAAI,KAAqB;AACxE,MAAM,kBAAkB,IAAI,YAAY,SAAS,EAAE,OAAO,OAAO,CAAC;;;;;AAMlE,SAAgB,OACd,OACA,UACA,UACA;AACA,KAAI;EACF,MAAM,SAAU,YAAY,kBAAkB,IAAI,SAAS,IAAK;EAChE,MAAM,MAAM,gBAAgB,OAAO,SAAS;AAC5C,MAAI,WAAW,OACb,QAAO,YAAY,8BAA8B,MAAM,EAAE,IAAI;MAE7D,wBACE;GACE,OAAO,8BAA8B,MAAM;GAC3C,WAAW;GACX,QAAQ,UAAU;GACnB,EACD,IACD;UAEI,GAAG;AAGV,yBACE;GACE,OAAO,gBAAgB;GACvB,WAAW;GACX,QAAQ,UAAU;GACnB,EACD,kDAAkD,GAAG,UAAU,CAChE
|
|
1
|
+
{"version":3,"file":"core_logging.js","names":["invocationLoggers: Map<number, Logger>"],"sources":["../../../src/endpoint/handlers/core_logging.ts"],"sourcesContent":["import { Logger } from \"../../logging/logger.js\";\nimport { LogSource, RestateLogLevel } from \"../../logging/logger_transport.js\";\nimport * as vm from \"./vm/sdk_shared_core_wasm_bindings.js\";\nimport { defaultLoggerTransport } from \"../../logging/console_logger_transport.js\";\n\n/**\n * This file contains the shared state used to install a logger that the shared-core uses for logging.\n */\n\nconst invocationLoggers: Map<number, Logger> = new Map<number, Logger>();\nconst logsTextDecoder = new TextDecoder(\"utf-8\", { fatal: false });\n\n/**\n * The shared core propagates logs to the SDK invoking this method.\n * When possible, it provides an invocationId, which is used to access the registered invocationLoggers, that should contain the logger per invocation id.\n */\nexport function vm_log(\n level: vm.LogLevel,\n strBytes: Uint8Array,\n loggerId?: number\n) {\n try {\n const logger = (loggerId && invocationLoggers.get(loggerId)) || undefined;\n const str = logsTextDecoder.decode(strBytes);\n if (logger !== undefined) {\n logger.logForLevel(wasmLogLevelToRestateLogLevel(level), str);\n } else {\n defaultLoggerTransport(\n {\n level: wasmLogLevelToRestateLogLevel(level),\n replaying: false,\n source: LogSource.JOURNAL,\n },\n str\n );\n }\n } catch (e) {\n // This function CAN'T EVER propagate an error,\n // because otherwise it will cause an awesome error in the shared core due to concurrent usage of it.\n defaultLoggerTransport(\n {\n level: RestateLogLevel.ERROR,\n replaying: false,\n source: LogSource.SYSTEM,\n },\n \"Unexpected error thrown while trying to log: \" + e?.toString()\n );\n }\n}\n\n/**\n * Invoked by the shared core's panic hook when it hits a rust panic.\n */\nexport function fatal(message: string) {\n try {\n const stack = new Error().stack;\n defaultLoggerTransport(\n {\n level: RestateLogLevel.ERROR,\n replaying: false,\n source: LogSource.SYSTEM,\n },\n \"FATAL: the SDK shared-core panicked, terminating the process. Reason: \\n\" +\n message +\n (stack ? \"\\n\\nStack:\\n\" + stack : \"\")\n );\n\n const proc = (\n globalThis as typeof globalThis & {\n process?: { exit?: (code?: number) => never };\n }\n ).process;\n if (typeof proc?.exit === \"function\") {\n proc.exit(1);\n }\n } catch {\n // Never throw back into the panic hook (would trigger a double-panic abort).\n }\n}\n\nexport function registerLogger(loggerId: number, logger: Logger) {\n invocationLoggers.set(loggerId, logger);\n}\n\nexport function destroyLogger(loggerId: number) {\n invocationLoggers.delete(loggerId);\n}\n\nfunction wasmLogLevelToRestateLogLevel(level: vm.LogLevel): RestateLogLevel {\n switch (level) {\n case vm.LogLevel.TRACE:\n return RestateLogLevel.TRACE;\n case vm.LogLevel.DEBUG:\n return RestateLogLevel.DEBUG;\n case vm.LogLevel.INFO:\n return RestateLogLevel.INFO;\n case vm.LogLevel.WARN:\n return RestateLogLevel.WARN;\n case vm.LogLevel.ERROR:\n return RestateLogLevel.ERROR;\n }\n}\n"],"mappings":";;;;;;;;AASA,MAAMA,oCAAyC,IAAI,KAAqB;AACxE,MAAM,kBAAkB,IAAI,YAAY,SAAS,EAAE,OAAO,OAAO,CAAC;;;;;AAMlE,SAAgB,OACd,OACA,UACA,UACA;AACA,KAAI;EACF,MAAM,SAAU,YAAY,kBAAkB,IAAI,SAAS,IAAK;EAChE,MAAM,MAAM,gBAAgB,OAAO,SAAS;AAC5C,MAAI,WAAW,OACb,QAAO,YAAY,8BAA8B,MAAM,EAAE,IAAI;MAE7D,wBACE;GACE,OAAO,8BAA8B,MAAM;GAC3C,WAAW;GACX,QAAQ,UAAU;GACnB,EACD,IACD;UAEI,GAAG;AAGV,yBACE;GACE,OAAO,gBAAgB;GACvB,WAAW;GACX,QAAQ,UAAU;GACnB,EACD,kDAAkD,GAAG,UAAU,CAChE;;;;;;AAOL,SAAgB,MAAM,SAAiB;AACrC,KAAI;EACF,MAAM,yBAAQ,IAAI,OAAO,EAAC;AAC1B,yBACE;GACE,OAAO,gBAAgB;GACvB,WAAW;GACX,QAAQ,UAAU;GACnB,EACD,6EACE,WACC,QAAQ,iBAAiB,QAAQ,IACrC;EAED,MAAM,OACJ,WAGA;AACF,MAAI,OAAO,MAAM,SAAS,WACxB,MAAK,KAAK,EAAE;SAER;;AAKV,SAAgB,eAAe,UAAkB,QAAgB;AAC/D,mBAAkB,IAAI,UAAU,OAAO;;AAGzC,SAAgB,cAAc,UAAkB;AAC9C,mBAAkB,OAAO,SAAS;;AAGpC,SAAS,8BAA8B,OAAqC;AAC1E,SAAQ,OAAR;EACE,cAAiB,MACf,QAAO,gBAAgB;EACzB,cAAiB,MACf,QAAO,gBAAgB;EACzB,cAAiB,KACf,QAAO,gBAAgB;EACzB,cAAiB,KACf,QAAO,gBAAgB;EACzB,cAAiB,MACf,QAAO,gBAAgB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { vm_log } from '../core_logging.js';
|
|
1
|
+
import { fatal, vm_log } from '../core_logging.js';
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -1041,16 +1041,8 @@ export function __wbg_entries_564a7e8b1e54ede5(arg0) {
|
|
|
1041
1041
|
const ret = Object.entries(arg0);
|
|
1042
1042
|
return ret;
|
|
1043
1043
|
}
|
|
1044
|
-
export function
|
|
1045
|
-
|
|
1046
|
-
let deferred0_1;
|
|
1047
|
-
try {
|
|
1048
|
-
deferred0_0 = arg0;
|
|
1049
|
-
deferred0_1 = arg1;
|
|
1050
|
-
console.error(getStringFromWasm0(arg0, arg1));
|
|
1051
|
-
} finally {
|
|
1052
|
-
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
1053
|
-
}
|
|
1044
|
+
export function __wbg_fatal_dd3314b57e7713f4(arg0, arg1) {
|
|
1045
|
+
fatal(getStringFromWasm0(arg0, arg1));
|
|
1054
1046
|
}
|
|
1055
1047
|
export function __wbg_from_fa561fa561dc8031(arg0) {
|
|
1056
1048
|
const ret = Array.from(arg0);
|
|
@@ -1131,10 +1123,6 @@ export function __wbg_new_0_2722fcdb71a888a6() {
|
|
|
1131
1123
|
const ret = new Date();
|
|
1132
1124
|
return ret;
|
|
1133
1125
|
}
|
|
1134
|
-
export function __wbg_new_227d7c05414eb861() {
|
|
1135
|
-
const ret = new Error();
|
|
1136
|
-
return ret;
|
|
1137
|
-
}
|
|
1138
1126
|
export function __wbg_new_310879b66b6e95e1() {
|
|
1139
1127
|
const ret = new Array();
|
|
1140
1128
|
return ret;
|
|
@@ -1187,13 +1175,6 @@ export function __wbg_set_6be42768c690e380(arg0, arg1, arg2) {
|
|
|
1187
1175
|
export function __wbg_set_78ea6a19f4818587(arg0, arg1, arg2) {
|
|
1188
1176
|
arg0[arg1 >>> 0] = arg2;
|
|
1189
1177
|
}
|
|
1190
|
-
export function __wbg_stack_3b0d974bbf31e44f(arg0, arg1) {
|
|
1191
|
-
const ret = arg1.stack;
|
|
1192
|
-
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1193
|
-
const len1 = WASM_VECTOR_LEN;
|
|
1194
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1195
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1196
|
-
}
|
|
1197
1178
|
export function __wbg_static_accessor_GLOBAL_THIS_02344c9b09eb08a9() {
|
|
1198
1179
|
const ret = typeof globalThis === 'undefined' ? null : globalThis;
|
|
1199
1180
|
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
Binary file
|
package/dist/package.cjs
CHANGED
package/dist/package.js
CHANGED
package/dist/package.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package.js","names":[],"sources":["../package.json"],"sourcesContent":["{\n \"name\": \"@restatedev/restate-sdk\",\n \"version\": \"1.16.
|
|
1
|
+
{"version":3,"file":"package.js","names":[],"sources":["../package.json"],"sourcesContent":["{\n \"name\": \"@restatedev/restate-sdk\",\n \"version\": \"1.16.2\",\n \"description\": \"Typescript SDK for Restate\",\n \"author\": \"Restate Developers\",\n \"email\": \"code@restate.dev\",\n \"license\": \"MIT\",\n \"homepage\": \"https://github.com/restatedev/sdk-typescript#readme\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/restatedev/sdk-typescript.git\"\n },\n \"bugs\": {\n \"url\": \"https://github.com/restatedev/sdk-typescript/issues\"\n },\n \"type\": \"module\",\n \"main\": \"./dist/index.cjs\",\n \"module\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.cts\",\n \"exports\": {\n \".\": {\n \"import\": \"./dist/index.js\",\n \"require\": \"./dist/index.cjs\"\n },\n \"./fetch\": {\n \"import\": \"./dist/fetch.js\",\n \"require\": \"./dist/fetch.cjs\"\n },\n \"./lambda\": {\n \"import\": \"./dist/lambda.js\",\n \"require\": \"./dist/lambda.cjs\"\n },\n \"./node\": {\n \"import\": \"./dist/node.js\",\n \"require\": \"./dist/node.cjs\"\n },\n \"./package.json\": \"./package.json\"\n },\n \"files\": [\n \"dist\",\n \"README.md\"\n ],\n \"publishConfig\": {\n \"access\": \"public\"\n },\n \"scripts\": {\n \"test\": \"turbo run _test --filter={.}...\",\n \"_test\": \"vitest run\",\n \"build\": \"turbo run _build --filter={.}...\",\n \"_build\": \"tsc --noEmit && tsdown\",\n \"dev\": \"tsc --noEmit --watch\",\n \"clean\": \"rm -rf dist *.tsbuildinfo .turbo\",\n \"check:types\": \"turbo run _check:types --filter={.}...\",\n \"_check:types\": \"tsc --noEmit --project tsconfig.build.json\",\n \"lint\": \"eslint .\",\n \"check:exports\": \"turbo run _check:exports --filter={.}...\",\n \"_check:exports\": \"attw --pack .\",\n \"check:api\": \"turbo run _check:api --filter={.}...\",\n \"_check:api\": \"api-extractor run --local && api-extractor run --local --config api-extractor.fetch.json && api-extractor run --local --config api-extractor.lambda.json && api-extractor run --local --config api-extractor.node.json\",\n \"prepublishOnly\": \"pnpm -w verify\"\n },\n \"dependencies\": {\n \"@restatedev/restate-sdk-core\": \"workspace:*\"\n },\n \"devDependencies\": {\n \"@types/aws-lambda\": \"^8.10.115\"\n },\n \"typesVersions\": {\n \"*\": {\n \"fetch\": [\n \"./dist/fetch.d.ts\"\n ],\n \"lambda\": [\n \"./dist/lambda.d.ts\"\n ],\n \"node\": [\n \"./dist/node.d.ts\"\n ]\n }\n }\n}\n"],"mappings":";cAEa"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@restatedev/restate-sdk-cloudflare-workers",
|
|
3
|
-
"version": "1.16.
|
|
3
|
+
"version": "1.16.2",
|
|
4
4
|
"description": "Typescript SDK for Restate",
|
|
5
5
|
"author": "Restate Developers",
|
|
6
6
|
"email": "code@restate.dev",
|
|
@@ -35,11 +35,11 @@
|
|
|
35
35
|
"access": "public"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@restatedev/restate-sdk-core": "1.16.
|
|
38
|
+
"@restatedev/restate-sdk-core": "1.16.2"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@types/aws-lambda": "^8.10.115",
|
|
42
|
-
"@restatedev/restate-sdk": "1.16.
|
|
42
|
+
"@restatedev/restate-sdk": "1.16.2"
|
|
43
43
|
},
|
|
44
44
|
"typesVersions": {
|
|
45
45
|
"*": {
|