diff --git a/package.json b/package.json index 6e396507..61e1424f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@restatedev/restate-sdk", - "version": "0.7.0", + "version": "0.8.0", "description": "Typescript SDK for Restate", "engines": { "node": ">= 10" diff --git a/src/restate_context_impl.ts b/src/restate_context_impl.ts index 7b39f23e..5371f390 100644 --- a/src/restate_context_impl.ts +++ b/src/restate_context_impl.ts @@ -28,6 +28,7 @@ import { } from "./generated/proto/protocol"; import { AWAKEABLE_ENTRY_MESSAGE_TYPE, + AWAKEABLE_IDENTIFIER_PREFIX, BACKGROUND_INVOKE_ENTRY_MESSAGE_TYPE, CLEAR_STATE_ENTRY_MESSAGE_TYPE, COMPLETE_AWAKEABLE_ENTRY_MESSAGE_TYPE, @@ -59,7 +60,7 @@ import { import { rlog } from "./utils/logger"; import { Client, SendClient } from "./types/router"; import { RpcRequest, RpcResponse } from "./generated/proto/dynrpc"; -import { requestFromArgs } from "./utils/assumpsions"; +import { requestFromArgs } from "./utils/assumptions"; import { RandImpl } from "./utils/rand"; export enum CallContexType { @@ -364,7 +365,7 @@ export class RestateGrpcContextImpl implements RestateGrpcContext { ); return { - id: Buffer.concat([this.id, encodedEntryIndex]).toString("base64url"), + id: AWAKEABLE_IDENTIFIER_PREFIX + Buffer.concat([this.id, encodedEntryIndex]).toString("base64url"), promise: promise, }; } diff --git a/src/server/base_restate_server.ts b/src/server/base_restate_server.ts index 578cc555..de0596ee 100644 --- a/src/server/base_restate_server.ts +++ b/src/server/base_restate_server.ts @@ -46,7 +46,7 @@ import { } from "../generated/proto/dynrpc"; import { RestateContext, useContext } from "../restate_context"; import { RpcContextImpl } from "../restate_context_impl"; -import { verifyAssumptions } from "../utils/assumpsions"; +import { verifyAssumptions } from "../utils/assumptions"; import { TerminalError } from "../public_api"; import { isEventHandler } from "../types/router"; import { jsonSafeAny } from "../utils/utils"; diff --git a/src/types/protocol.ts b/src/types/protocol.ts index 82e35831..61ac82f8 100644 --- a/src/types/protocol.ts +++ b/src/types/protocol.ts @@ -67,6 +67,8 @@ export const BACKGROUND_INVOKE_ENTRY_MESSAGE_TYPE = 0x0c02n; export const AWAKEABLE_ENTRY_MESSAGE_TYPE = 0x0c03n; export const COMPLETE_AWAKEABLE_ENTRY_MESSAGE_TYPE = 0x0c04n; +export const AWAKEABLE_IDENTIFIER_PREFIX = "awk_1"; + // Export the custom message types // Side effects are custom messages because the runtime does not need to inspect them export const SIDE_EFFECT_ENTRY_MESSAGE_TYPE = 0xfc01n; diff --git a/src/utils/assumpsions.ts b/src/utils/assumptions.ts similarity index 96% rename from src/utils/assumpsions.ts rename to src/utils/assumptions.ts index ddf04caf..2f03b1fa 100644 --- a/src/utils/assumpsions.ts +++ b/src/utils/assumptions.ts @@ -76,8 +76,8 @@ export const verifyAssumptions = ( isKeyed: boolean, request: RpcRequest ): { key?: string; request?: JsType } => { - const assumpsion = request.senderAssumes ?? 0; - switch (assumpsion) { + const assumption = request.senderAssumes ?? 0; + switch (assumption) { case 0: { // no assumption: this comes from an ingress. const hasKeyProperty = @@ -124,7 +124,7 @@ export const verifyAssumptions = ( } default: { throw new TerminalError( - `Unknown assumption id ${assumpsion}. This indicates an incorrect (or involuntary) setting of the assumption property at the ingress request, or an SDK bug.` + `Unknown assumption id ${assumption}. This indicates an incorrect (or involuntary) setting of the assumption property at the ingress request, or an SDK bug.` ); } }