Skip to content

Commit 8fe5991

Browse files
authored
Minor cleanups (#1)
1 parent 3e8213f commit 8fe5991

File tree

23 files changed

+152
-86
lines changed

23 files changed

+152
-86
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ dist
66
.next
77
.swc
88
.well-known
9-
.restate
9+
.restate
10+
restatedev-vercel-world*

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@
3030
"generate:configs": "node scripts/generate-example-configs.mjs",
3131
"deps:check": "pnpm outdated",
3232
"deps:update": "pnpm update --latest --recursive",
33-
"inspect": "pnpm --filter \"./packages/examples/*\" inspect"
33+
"inspect": "pnpm --filter \"./packages/examples/*\" inspect",
34+
"prepackage": "pnpm install && pnpm clean && pnpm build",
35+
"package": "pnpm --filter \"./packages/libs/world\" pack"
3436
},
3537
"devDependencies": {
3638
"@arethetypeswrong/cli": "^0.18.2",
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/// <reference types="next" />
22
/// <reference types="next/image-types/global" />
3-
import "./.next/dev/types/routes.d.ts";
3+
import "./.next/types/routes.d.ts";
44

55
// NOTE: This file should not be edited
66
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.

packages/examples/workflow/package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
{
22
"name": "@restatedev/workflow",
33
"version": "0.0.0",
4-
"description": "TODO: Add description",
5-
"author": "TODO: Add author",
6-
"email": "TODO: Add email",
4+
"description": "Example Next.js application demonstrating Vercel Workflow with Restate",
5+
"author": "Restate Developers",
6+
"email": "[email protected]",
77
"license": "MIT",
8-
"homepage": "TODO: Add homepage URL",
8+
"homepage": "https://github.com/restatedev/vercel-workflow#readme",
99
"repository": {
1010
"type": "git",
11-
"url": "TODO: Add repository URL"
11+
"url": "git+https://github.com/restatedev/vercel-workflow.git"
1212
},
1313
"bugs": {
14-
"url": "TODO: Add bugs URL"
14+
"url": "https://github.com/restatedev/vercel-workflow/issues"
1515
},
1616
"private": true,
1717
"type": "module",
@@ -23,14 +23,14 @@
2323
"dev": "next dev",
2424
"start": "turbo run _start --filter={.}...",
2525
"_start": "next start --port 3000",
26-
"clean": "rm -rf dist *.tsbuildinfo .turbo",
26+
"clean": "rm -rf dist *.tsbuildinfo .turbo .next .swc src/app/.well-known",
2727
"check:types": "turbo run _check:types --filter={.}...",
2828
"_check:types": "tsc --noEmit --project tsconfig.build.json",
2929
"lint": "eslint .",
3030
"inspect": "workflow inspect runs"
3131
},
3232
"dependencies": {
33-
"@restatedev/world": "workspace:*",
33+
"@restatedev/vercel-world": "workspace:*",
3434
"workflow": "catalog:",
3535
"next": "16.0.0"
3636
},

packages/examples/workflow/src/app/api/signup/[runId]/route.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,22 @@
99
* TODO: Add repository URL
1010
*/
1111

12-
import { NextResponse } from "next/server.js";
12+
import { NextResponse, NextRequest } from "next/server.js";
1313
import { getRun } from "workflow/api";
1414

1515
interface RouteParams {
16-
params: {
16+
params: Promise<{
1717
runId: string;
18-
};
18+
}>;
1919
}
2020

21-
export async function GET(request: Request, { params }: RouteParams) {
21+
export async function GET(_request: NextRequest, { params }: RouteParams) {
2222
const { runId } = await params;
2323

2424
const run = getRun(runId);
2525
const status = await run.status;
2626

27-
let res: unknown | undefined = undefined;
27+
let res: unknown = undefined;
2828
if (status === "completed") {
2929
res = await run.returnValue;
3030
}

packages/examples/workflow/src/app/api/signup/[runId]/status/route.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,24 @@
99
* TODO: Add repository URL
1010
*/
1111

12-
import { NextResponse } from "next/server.js";
12+
import { NextResponse, NextRequest } from "next/server.js";
1313
import { getRun } from "workflow/api";
1414

15-
interface RouteParams {
16-
params: {
15+
type RouteParams = {
16+
params: Promise<{
1717
runId: string;
18-
};
19-
}
18+
}>;
19+
};
2020

21-
export async function GET(request: Request, { params }: RouteParams) {
21+
export async function GET(_request: NextRequest, { params }: RouteParams) {
2222
const { runId } = await params;
2323
const run = getRun(runId);
24-
return new NextResponse(run.getReadable({startIndex: 0}), {
24+
return new NextResponse(run.getReadable({ startIndex: 0 }), {
2525
status: 200,
2626
headers: {
27-
'Content-Type': 'text/event-stream',
28-
'Cache-Control': 'no-cache',
29-
'Connection': 'keep-alive',
30-
}
31-
})
27+
"Content-Type": "text/event-stream",
28+
"Cache-Control": "no-cache",
29+
Connection: "keep-alive",
30+
},
31+
});
3232
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"extends": "../../../api-extractor.base.json",
3+
"mainEntryPointFilePath": "<projectFolder>/dist/types.d.ts",
4+
"messages": {
5+
"extractorMessageReporting": {
6+
"ae-forgotten-export": {
7+
"logLevel": "none"
8+
}
9+
}
10+
}
11+
}

packages/libs/backend/package.json

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
{
2-
"name": "@restatedev/backend",
2+
"name": "@restatedev/vercel-backend",
33
"version": "0.0.0",
4-
"description": "TODO: Add description",
5-
"author": "TODO: Add author",
6-
"email": "TODO: Add email",
4+
"description": "Restate backend services and virtual objects for Vercel Workflow integration",
5+
"author": "Restate Developers",
6+
"email": "[email protected]",
77
"license": "MIT",
8-
"homepage": "TODO: Add homepage URL",
8+
"homepage": "https://github.com/restatedev/vercel-workflow#readme",
99
"repository": {
1010
"type": "git",
11-
"url": "TODO: Add repository URL"
11+
"url": "git+https://github.com/restatedev/vercel-workflow.git"
1212
},
1313
"bugs": {
14-
"url": "TODO: Add bugs URL"
14+
"url": "https://github.com/restatedev/vercel-workflow/issues"
1515
},
1616
"type": "module",
1717
"main": "./dist/index.cjs",
@@ -22,6 +22,14 @@
2222
"import": "./dist/index.js",
2323
"require": "./dist/index.cjs"
2424
},
25+
"./serve": {
26+
"import": "./dist/serve.js",
27+
"require": "./dist/serve.cjs"
28+
},
29+
"./types": {
30+
"import": "./dist/types.js",
31+
"require": "./dist/types.cjs"
32+
},
2533
"./package.json": "./package.json"
2634
},
2735
"files": [
@@ -37,15 +45,15 @@
3745
"build": "turbo run _build --filter={.}...",
3846
"_build": "tsc --noEmit && tsdown",
3947
"dev": "tsc --noEmit --watch",
40-
"start": "node ./dist/index.js",
48+
"start": "node ./dist/serve.js",
4149
"clean": "rm -rf dist *.tsbuildinfo .turbo",
4250
"check:types": "turbo run _check:types --filter={.}...",
4351
"_check:types": "tsc --noEmit --project tsconfig.build.json",
4452
"lint": "eslint .",
4553
"check:exports": "turbo run _check:exports --filter={.}...",
4654
"_check:exports": "attw --pack .",
4755
"check:api": "turbo run _check:api --filter={.}...",
48-
"_check:api": "api-extractor run --local",
56+
"_check:api": "api-extractor run --local && api-extractor run --local --config api-extractor.types.json",
4957
"prepublishOnly": "pnpm -w verify"
5058
},
5159
"dependencies": {
@@ -55,5 +63,15 @@
5563
"@restatedev/pubsub": "catalog:",
5664
"@vercel/queue": "catalog:",
5765
"@workflow/world": "catalog:"
66+
},
67+
"typesVersions": {
68+
"*": {
69+
"types": [
70+
"./dist/types.d.ts"
71+
],
72+
"serve": [
73+
"./dist/serve.d.ts"
74+
]
75+
}
5876
}
5977
}

packages/libs/backend/src/index.ts

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
1-
import { serve } from "@restatedev/restate-sdk";
2-
import { createPubsubObject } from "@restatedev/pubsub";
3-
import { index, keyValue, workflow } from "./services.js";
4-
import { queue } from "./queue.js";
5-
6-
export type { WorkflowApi } from "./services.js";
7-
export type { IndexApi } from "./services.js";
8-
export type { QueueService } from "./queue.js";
9-
10-
serve({
11-
services: [workflow, index, queue, keyValue, createPubsubObject("streams")],
12-
});
1+
export { createPubsubObject } from "@restatedev/pubsub";
2+
export { index, keyValue, workflow, type State } from "./services.js";
3+
export { queue } from "./queue.js";

packages/libs/backend/src/serve.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { serve } from "@restatedev/restate-sdk";
2+
import {
3+
workflow,
4+
index,
5+
queue,
6+
keyValue,
7+
createPubsubObject,
8+
} from "./index.js";
9+
10+
void serve({
11+
services: [workflow, index, queue, keyValue, createPubsubObject("streams")],
12+
});

0 commit comments

Comments
 (0)