code-share-types 0.7.0 → 0.8.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.
@@ -1,10 +1,16 @@
1
1
  import { z } from '@hono/zod-openapi';
2
- declare const CodeExecutionResultSchema: z.ZodObject<{
3
- code: z.ZodNullable<z.ZodNumber>;
4
- signal: z.ZodNullable<z.ZodString>;
5
- stdout: z.ZodString;
6
- stderr: z.ZodString;
7
- }, z.core.$strip>;
2
+ declare const CodeExecutionResultSchema: z.ZodUnion<readonly [z.ZodObject<{
3
+ status: z.ZodLiteral<"SUCCESS">;
4
+ result: z.ZodObject<{
5
+ code: z.ZodNullable<z.ZodNumber>;
6
+ signal: z.ZodNullable<z.ZodString>;
7
+ stdout: z.ZodString;
8
+ stderr: z.ZodString;
9
+ }, z.core.$strip>;
10
+ }, z.core.$strip>, z.ZodObject<{
11
+ status: z.ZodLiteral<"TIMEOUT">;
12
+ result: z.ZodUndefined;
13
+ }, z.core.$strip>]>;
8
14
  type CodeExecutionResult = z.infer<typeof CodeExecutionResultSchema>;
9
15
  export type { CodeExecutionResult };
10
16
  export { CodeExecutionResultSchema };
@@ -1,10 +1,16 @@
1
1
  import { z } from '@hono/zod-openapi';
2
- const CodeExecutionResultSchema = z.object({
3
- code: z.number().nullable(),
4
- signal: z.string().nullable(),
5
- stdout: z.string(),
6
- stderr: z.string(),
7
- }).openapi({
8
- example: { code: 0, signal: null, stdout: 'Hello World\n', stderr: '' }
2
+ import { ExecutorCodeResultSchema } from '../socket/executor';
3
+ const CodeExecutionResultSchema = z.union([
4
+ z.object({
5
+ status: z.literal("SUCCESS"), result: ExecutorCodeResultSchema,
6
+ }),
7
+ z.object({
8
+ status: z.literal("TIMEOUT"), result: z.undefined(),
9
+ }),
10
+ ]).openapi({
11
+ example: {
12
+ status: "SUCCESS",
13
+ result: { code: 0, signal: null, stdout: 'Hello World\n', stderr: '' },
14
+ }
9
15
  });
10
16
  export { CodeExecutionResultSchema };
@@ -1,9 +1,9 @@
1
1
  import { z } from 'zod';
2
2
  declare const ExecutorCodeResultSchema: z.ZodObject<{
3
- signal: z.ZodNullable<z.ZodAny>;
3
+ code: z.ZodNullable<z.ZodNumber>;
4
+ signal: z.ZodNullable<z.ZodString>;
4
5
  stdout: z.ZodString;
5
6
  stderr: z.ZodString;
6
- code: z.ZodNullable<z.ZodNumber>;
7
7
  }, z.core.$strip>;
8
8
  type ExecutorCodeResult = z.infer<typeof ExecutorCodeResultSchema>;
9
9
  export type { ExecutorCodeResult };
@@ -1,9 +1,9 @@
1
1
  import { z } from 'zod';
2
2
  const ExecutorCodeResultSchema = z.object({
3
- signal: z.any().nullable(),
3
+ code: z.number().nullable(),
4
+ signal: z.string().nullable(),
4
5
  stdout: z.string(),
5
6
  stderr: z.string(),
6
- code: z.number().nullable(),
7
7
  // message: string | null
8
8
  // status: any | null
9
9
  // output: string
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "code-share-types",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "files": [
5
5
  "/dist"
6
6
  ],