Skip to content

Commit 86e6990

Browse files
Run format
1 parent 46612dc commit 86e6990

File tree

8 files changed

+116
-112
lines changed

8 files changed

+116
-112
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
"turbo": "^2.7.2",
6666
"typedoc": "^0.28.15",
6767
"typescript": "^5.9.3",
68-
"typescript-eslint": "^8.51.0",
68+
"typescript-eslint": "^8.52.0",
6969
"vitest": "^3.2.4",
7070
"wasm-pack": "^0.0.0",
7171
"wasm-pack-inline": "^0.1.4"

packages/examples/node/src/zod_greeter.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ const greeter = restate.service({
2525
name: "Greeter",
2626
handlers: {
2727
greet: restate.createServiceHandler(
28-
{ input: restate.serde.schema(Greeting), output: restate.serde.schema(GreetingResponse) },
28+
{
29+
input: restate.serde.schema(Greeting),
30+
output: restate.serde.schema(GreetingResponse),
31+
},
2932
async (ctx: restate.Context, { name }) => {
3033
return { result: `You said hi to ${name}!` };
3134
}

packages/libs/restate-sdk-core/src/core.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,9 @@ export interface RestateObjectContext {}
1818
export interface RestateObjectSharedContext {}
1919

2020
// workflow
21-
export interface RestateWorkflowSharedContext
22-
extends RestateObjectSharedContext {}
21+
export interface RestateWorkflowSharedContext extends RestateObjectSharedContext {}
2322
export interface RestateWorkflowContext
24-
extends RestateObjectContext,
25-
RestateWorkflowSharedContext {}
23+
extends RestateObjectContext, RestateWorkflowSharedContext {}
2624

2725
// ----------- service -------------------------------------------------------
2826

packages/libs/restate-sdk-core/src/serde_api.ts

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@
1212
/* eslint-disable @typescript-eslint/no-explicit-any */
1313
/* eslint-disable @typescript-eslint/no-namespace */
1414

15-
import type {StandardJSONSchemaV1, StandardSchemaV1} from "@standard-schema/spec";
15+
import type {
16+
StandardJSONSchemaV1,
17+
StandardSchemaV1,
18+
} from "@standard-schema/spec";
1619

1720
export interface Serde<T> {
1821
contentType?: string;
@@ -52,20 +55,25 @@ class VoidSerde implements Serde<void> {
5255

5356
class StandardSchemaSerde<
5457
T extends { "~standard": StandardSchemaV1.Props },
55-
> implements Serde<StandardSchemaV1.InferOutput<T>>
56-
{
58+
> implements Serde<StandardSchemaV1.InferOutput<T>> {
5759
contentType? = "application/json";
5860
jsonSchema?: object | undefined;
5961

60-
constructor(private readonly schema: T, private readonly validateOptions?: Record<string, unknown>, jsonSchemaOptions?: Record<string, unknown>) {
62+
constructor(
63+
private readonly schema: T,
64+
private readonly validateOptions?: Record<string, unknown>,
65+
jsonSchemaOptions?: Record<string, unknown>
66+
) {
6167
// Extract JSON schema if available
6268
const standard = schema["~standard"];
6369
if (isStandardJSONSchemaV1(standard)) {
6470
try {
65-
this.jsonSchema = (standard as unknown as StandardJSONSchemaV1.Props).jsonSchema.output({
71+
this.jsonSchema = (
72+
standard as unknown as StandardJSONSchemaV1.Props
73+
).jsonSchema.output({
6674
target: "draft-2020-12",
67-
libraryOptions: jsonSchemaOptions
68-
})
75+
libraryOptions: jsonSchemaOptions,
76+
});
6977
} catch {
7078
// If JSON schema generation fails, leave it undefined
7179
this.jsonSchema = undefined;
@@ -112,23 +120,23 @@ class StandardSchemaSerde<
112120
const errorMessages = result.issues
113121
.map((issue: StandardSchemaV1.Issue) => issue.message)
114122
.join(", ");
115-
throw new TypeError(`Standard schema validation failed: [${errorMessages}]`);
123+
throw new TypeError(
124+
`Standard schema validation failed: [${errorMessages}]`
125+
);
116126
}
117127

118128
return result.value as StandardSchemaV1.InferOutput<T>;
119129
}
120130
}
121131

122-
function isStandardJSONSchemaV1(
123-
standard: StandardSchemaV1.Props
124-
): boolean {
132+
function isStandardJSONSchemaV1(standard: StandardSchemaV1.Props): boolean {
125133
return (
126-
standard != undefined &&
127-
"jsonSchema" in standard &&
128-
typeof standard.jsonSchema === "object" &&
129-
standard.jsonSchema !== null &&
130-
"output" in standard.jsonSchema &&
131-
typeof standard.jsonSchema.output === "function"
134+
standard != undefined &&
135+
"jsonSchema" in standard &&
136+
typeof standard.jsonSchema === "object" &&
137+
standard.jsonSchema !== null &&
138+
"output" in standard.jsonSchema &&
139+
typeof standard.jsonSchema.output === "function"
132140
);
133141
}
134142

@@ -169,12 +177,10 @@ export namespace serde {
169177
* @param jsonSchemaOptions options passed to `StandardJsonSchemaV1.Options.libraryOptions` for code generation
170178
* @returns a serde that will validate the data with the standard schema
171179
*/
172-
export const schema = <
173-
T extends { "~standard": StandardSchemaV1.Props },
174-
>(
175-
schema: T,
176-
validateOptions?: Record<string, unknown>,
177-
jsonSchemaOptions?: Record<string, unknown>
180+
export const schema = <T extends { "~standard": StandardSchemaV1.Props }>(
181+
schema: T,
182+
validateOptions?: Record<string, unknown>,
183+
jsonSchemaOptions?: Record<string, unknown>
178184
): Serde<StandardSchemaV1.InferOutput<T>> => {
179185
return new StandardSchemaSerde(schema, jsonSchemaOptions);
180186
};

packages/libs/restate-sdk-zod/src/serde_api.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ function printZod3Warning() {
2929
}
3030
}
3131

32-
class ZodSerde<T extends z3.ZodTypeAny | z4.$ZodType>
33-
implements Serde<T extends z3.ZodTypeAny ? z3.infer<T> : z4.infer<T>>
34-
{
32+
class ZodSerde<T extends z3.ZodTypeAny | z4.$ZodType> implements Serde<
33+
T extends z3.ZodTypeAny ? z3.infer<T> : z4.infer<T>
34+
> {
3535
contentType? = "application/json";
3636
jsonSchema?: object | undefined;
3737

packages/libs/restate-sdk/src/context.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -610,9 +610,7 @@ export interface Context extends RestateContext {
610610
*
611611
*/
612612
export interface ObjectContext<TState extends TypedState = UntypedState>
613-
extends Context,
614-
KeyValueStore<TState>,
615-
RestateObjectContext {
613+
extends Context, KeyValueStore<TState>, RestateObjectContext {
616614
key: string;
617615
}
618616

@@ -628,8 +626,7 @@ export interface ObjectContext<TState extends TypedState = UntypedState>
628626
*
629627
*/
630628
export interface ObjectSharedContext<TState extends TypedState = UntypedState>
631-
extends Context,
632-
RestateObjectSharedContext {
629+
extends Context, RestateObjectSharedContext {
633630
key: string;
634631

635632
/**
@@ -857,8 +854,7 @@ export type DurablePromise<T> = Promise<T> & {
857854
};
858855

859856
export interface WorkflowSharedContext<TState extends TypedState = UntypedState>
860-
extends ObjectSharedContext<TState>,
861-
RestateWorkflowSharedContext {
857+
extends ObjectSharedContext<TState>, RestateWorkflowSharedContext {
862858
/**
863859
* Create a durable promise that can be resolved or rejected during the workflow execution.
864860
* The promise is bound to the workflow and will be persisted across suspensions and retries.
@@ -886,6 +882,7 @@ export interface WorkflowSharedContext<TState extends TypedState = UntypedState>
886882
}
887883

888884
export interface WorkflowContext<TState extends TypedState = UntypedState>
889-
extends WorkflowSharedContext<TState>,
885+
extends
886+
WorkflowSharedContext<TState>,
890887
ObjectContext<TState>,
891888
RestateWorkflowContext {}

0 commit comments

Comments
 (0)