@dbos-inc/create 1.31.24-preview → 1.31.26-preview
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/cli.js +3 -4
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
- package/templates/dbos-drizzle/README.md +23 -0
- package/templates/dbos-drizzle/nodemon.json +7 -0
- package/templates/{hello-drizzle → dbos-drizzle}/package.json +1 -1
- package/templates/dbos-knex/README.md +23 -0
- package/templates/dbos-knex/nodemon.json +7 -0
- package/templates/{hello-contexts → dbos-knex}/package.json +3 -3
- package/templates/dbos-knex/src/main.ts +94 -0
- package/templates/dbos-prisma/README.md +23 -0
- package/templates/{hello-prisma → dbos-prisma}/nodemon.json +1 -1
- package/templates/{hello-prisma → dbos-prisma}/package.json +1 -1
- package/templates/{hello-express → dbos-prisma}/start_postgres_docker.js +0 -0
- package/templates/dbos-typeorm/README.md +23 -0
- package/templates/dbos-typeorm/nodemon.json +8 -0
- package/templates/{hello-typeorm → dbos-typeorm}/package.json +1 -1
- package/templates/{hello-nextjs → dbos-typeorm}/start_postgres_docker.js +0 -0
- package/templates/hello/.vscode/extensions.json +0 -7
- package/templates/hello/.vscode/launch.json +0 -21
- package/templates/hello/.vscode/tasks.json +0 -19
- package/templates/hello/README.md +0 -55
- package/templates/hello/dbos-config.yaml +0 -20
- package/templates/hello/eslint.config.js +0 -28
- package/templates/hello/gitignore.template +0 -144
- package/templates/hello/jest.config.js +0 -8
- package/templates/hello/knexfile.js +0 -20
- package/templates/hello/migrations/20240212161006_create_dbos_hello_tables.js +0 -18
- package/templates/hello/nodemon.json +0 -7
- package/templates/hello/package.json +0 -23
- package/templates/hello/src/operations.test.ts +0 -37
- package/templates/hello/src/operations.ts +0 -64
- package/templates/hello/start_postgres_docker.js +0 -40
- package/templates/hello/tsconfig.json +0 -25
- package/templates/hello-contexts/.vscode/extensions.json +0 -7
- package/templates/hello-contexts/.vscode/launch.json +0 -21
- package/templates/hello-contexts/.vscode/tasks.json +0 -19
- package/templates/hello-contexts/README.md +0 -76
- package/templates/hello-contexts/dbos-config.yaml +0 -20
- package/templates/hello-contexts/nodemon.json +0 -7
- package/templates/hello-contexts/src/operations.test.ts +0 -38
- package/templates/hello-contexts/src/operations.ts +0 -66
- package/templates/hello-drizzle/.vscode/extensions.json +0 -7
- package/templates/hello-drizzle/.vscode/launch.json +0 -21
- package/templates/hello-drizzle/.vscode/tasks.json +0 -19
- package/templates/hello-drizzle/README.md +0 -48
- package/templates/hello-drizzle/nodemon.json +0 -7
- package/templates/hello-express/README.md +0 -77
- package/templates/hello-express/knexfile.js +0 -20
- package/templates/hello-express/migrations/20240212161006_create_dbos_hello_tables.js +0 -18
- package/templates/hello-express/nodemon.json +0 -7
- package/templates/hello-express/package.json +0 -24
- package/templates/hello-express/src/main.ts +0 -99
- package/templates/hello-express/tsconfig.json +0 -25
- package/templates/hello-nextjs/README.md +0 -100
- package/templates/hello-nextjs/dbos-config.yaml +0 -18
- package/templates/hello-nextjs/eslint.config.mjs +0 -16
- package/templates/hello-nextjs/gitignore.template +0 -41
- package/templates/hello-nextjs/knexfile.js +0 -20
- package/templates/hello-nextjs/migrations/20240212161006_create_dbos_hello_tables.js +0 -18
- package/templates/hello-nextjs/next.config.ts +0 -18
- package/templates/hello-nextjs/package.json +0 -32
- package/templates/hello-nextjs/postcss.config.mjs +0 -8
- package/templates/hello-nextjs/public/file.svg +0 -1
- package/templates/hello-nextjs/public/globe.svg +0 -1
- package/templates/hello-nextjs/public/next.svg +0 -1
- package/templates/hello-nextjs/public/vercel.svg +0 -1
- package/templates/hello-nextjs/public/window.svg +0 -1
- package/templates/hello-nextjs/src/actions/dbosWorkflow.ts +0 -12
- package/templates/hello-nextjs/src/actions/hello.ts +0 -15
- package/templates/hello-nextjs/src/app/crash/route.ts +0 -8
- package/templates/hello-nextjs/src/app/favicon.ico +0 -0
- package/templates/hello-nextjs/src/app/globals.css +0 -21
- package/templates/hello-nextjs/src/app/greetings/route.ts +0 -11
- package/templates/hello-nextjs/src/app/layout.tsx +0 -34
- package/templates/hello-nextjs/src/app/page.tsx +0 -73
- package/templates/hello-nextjs/src/app/step/[slug]/route.ts +0 -15
- package/templates/hello-nextjs/src/app/tasks/[slug]/route.ts +0 -18
- package/templates/hello-nextjs/src/components/client/BackGroundTask.tsx +0 -179
- package/templates/hello-nextjs/src/components/client/callDBOSWorkflow.tsx +0 -31
- package/templates/hello-nextjs/src/dbos/background.ts +0 -23
- package/templates/hello-nextjs/src/dbos/hello.ts +0 -24
- package/templates/hello-nextjs/src/dbos/operations.ts +0 -9
- package/templates/hello-nextjs/tailwind.config.ts +0 -18
- package/templates/hello-nextjs/tsconfig.json +0 -29
- package/templates/hello-prisma/.vscode/extensions.json +0 -7
- package/templates/hello-prisma/.vscode/launch.json +0 -21
- package/templates/hello-prisma/.vscode/tasks.json +0 -19
- package/templates/hello-prisma/README.md +0 -51
- package/templates/hello-prisma/start_postgres_docker.js +0 -40
- package/templates/hello-typeorm/.vscode/extensions.json +0 -7
- package/templates/hello-typeorm/.vscode/launch.json +0 -21
- package/templates/hello-typeorm/.vscode/tasks.json +0 -19
- package/templates/hello-typeorm/README.md +0 -51
- package/templates/hello-typeorm/eslint.config.js +0 -28
- package/templates/hello-typeorm/gitignore.template +0 -144
- package/templates/hello-typeorm/jest.config.js +0 -8
- package/templates/hello-typeorm/nodemon.json +0 -8
- package/templates/hello-typeorm/start_postgres_docker.js +0 -40
- /package/templates/{hello-drizzle → dbos-drizzle}/dbos-config.yaml +0 -0
- /package/templates/{hello-drizzle → dbos-drizzle}/drizzle/0000_hello.sql +0 -0
- /package/templates/{hello-drizzle → dbos-drizzle}/drizzle/meta/0000_snapshot.json +0 -0
- /package/templates/{hello-drizzle → dbos-drizzle}/drizzle/meta/_journal.json +0 -0
- /package/templates/{hello-drizzle → dbos-drizzle}/drizzle.config.ts +0 -0
- /package/templates/{hello-contexts → dbos-drizzle}/eslint.config.js +0 -0
- /package/templates/{hello-contexts → dbos-drizzle}/gitignore.template +0 -0
- /package/templates/{hello-contexts → dbos-drizzle}/jest.config.js +0 -0
- /package/templates/{hello-drizzle → dbos-drizzle}/src/operations.test.ts +0 -0
- /package/templates/{hello-drizzle → dbos-drizzle}/src/operations.ts +0 -0
- /package/templates/{hello-drizzle → dbos-drizzle}/src/schema.ts +0 -0
- /package/templates/{hello-contexts → dbos-drizzle}/start_postgres_docker.js +0 -0
- /package/templates/{hello-contexts → dbos-drizzle}/tsconfig.json +0 -0
- /package/templates/{hello-express → dbos-knex}/dbos-config.yaml +0 -0
- /package/templates/{hello-drizzle → dbos-knex}/eslint.config.js +0 -0
- /package/templates/{hello-drizzle → dbos-knex}/gitignore.template +0 -0
- /package/templates/{hello-drizzle → dbos-knex}/jest.config.js +0 -0
- /package/templates/{hello-contexts → dbos-knex}/knexfile.js +0 -0
- /package/templates/{hello-contexts → dbos-knex}/migrations/20240212161006_create_dbos_hello_tables.js +0 -0
- /package/templates/{hello-express → dbos-knex}/src/main.test.ts +0 -0
- /package/templates/{hello-drizzle → dbos-knex}/start_postgres_docker.js +0 -0
- /package/templates/{hello-drizzle → dbos-knex}/tsconfig.json +0 -0
- /package/templates/{hello-prisma → dbos-prisma}/dbos-config.yaml +0 -0
- /package/templates/{hello-express → dbos-prisma}/eslint.config.js +0 -0
- /package/templates/{hello-prisma → dbos-prisma}/generate_env.js +0 -0
- /package/templates/{hello-prisma → dbos-prisma}/gitignore.template +0 -0
- /package/templates/{hello-express → dbos-prisma}/jest.config.js +0 -0
- /package/templates/{hello-prisma → dbos-prisma}/prisma/migrations/20240604184654_init/migration.sql +0 -0
- /package/templates/{hello-prisma → dbos-prisma}/prisma/migrations/migration_lock.toml +0 -0
- /package/templates/{hello-prisma → dbos-prisma}/prisma/schema.prisma +0 -0
- /package/templates/{hello-prisma → dbos-prisma}/src/operations.test.ts +0 -0
- /package/templates/{hello-prisma → dbos-prisma}/src/operations.ts +0 -0
- /package/templates/{hello-prisma → dbos-prisma}/tsconfig.json +0 -0
- /package/templates/{hello-typeorm → dbos-typeorm}/datasource.ts +0 -0
- /package/templates/{hello-typeorm → dbos-typeorm}/dbos-config.yaml +0 -0
- /package/templates/{hello-typeorm → dbos-typeorm}/entities/DBOSHello.ts +0 -0
- /package/templates/{hello-prisma → dbos-typeorm}/eslint.config.js +0 -0
- /package/templates/{hello-express → dbos-typeorm}/gitignore.template +0 -0
- /package/templates/{hello-prisma → dbos-typeorm}/jest.config.js +0 -0
- /package/templates/{hello-typeorm → dbos-typeorm}/migrations/1714934318136-DBOSHello.ts +0 -0
- /package/templates/{hello-typeorm → dbos-typeorm}/src/operations.test.ts +0 -0
- /package/templates/{hello-typeorm → dbos-typeorm}/src/operations.ts +0 -0
- /package/templates/{hello-typeorm → dbos-typeorm}/tsconfig.json +0 -0
package/dist/cli.js
CHANGED
|
@@ -21,9 +21,8 @@ program
|
|
|
21
21
|
throw new Error(`Unexpected arguments: ${command.args.join(',')}; Did you forget '--'?`);
|
|
22
22
|
}
|
|
23
23
|
let { appName, template } = options;
|
|
24
|
-
if (
|
|
25
|
-
appName = appName ||
|
|
26
|
-
template = template || 'hello';
|
|
24
|
+
if (template) {
|
|
25
|
+
appName = appName || template;
|
|
27
26
|
}
|
|
28
27
|
else {
|
|
29
28
|
const templates = listTemplates();
|
|
@@ -34,7 +33,7 @@ program
|
|
|
34
33
|
});
|
|
35
34
|
appName = await input({
|
|
36
35
|
message: 'What is the application/directory name to create?',
|
|
37
|
-
default:
|
|
36
|
+
default: appName || template,
|
|
38
37
|
validate: isValidApplicationName,
|
|
39
38
|
});
|
|
40
39
|
}
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AACxE,OAAO,E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CAAC;QAClC,4CAA4C;QAC5C,QAAQ,GAAG,MAAM,MAAM,CACrB;YACE,OAAO,EAAE,2BAA2B;YACpC,OAAO,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC;SACrD,CAAC,CAAC;QACL,OAAO,GAAG,MAAM,KAAK,CACnB;YACE,OAAO,EAAE,mDAAmD;YAC5D,OAAO,EAAE,OAAO,IAAI,QAAQ;YAC5B,QAAQ,EAAE,sBAAsB;SACjC,CAAC,CAAC;IACP,CAAC;IACD,IAAI,CAAC;QACH,MAAM,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IAChC,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAO,CAAC,KAAK,CAAE,CAAW,CAAC,OAAO,CAAC,CAAC;QACpC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC;KACD,kBAAkB,CAAC,KAAK,CAAC,CAAC;AAE7B,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# DBOS Hello with Drizzle
|
|
2
|
+
|
|
3
|
+
This is a [DBOS app](https://docs.dbos.dev/) bootstrapped with `npx @dbos-inc/create` and using [Drizzle](https://docs.dbos.dev/typescript/tutorials/orms/using-drizzle).
|
|
4
|
+
|
|
5
|
+
## Getting Started
|
|
6
|
+
|
|
7
|
+
Run these commands to build your app, set up its database, then launch it:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm run build
|
|
11
|
+
npx dbos migrate
|
|
12
|
+
npm run start
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
To see that it's working, visit this URL in your browser: [`http://localhost:3000/`](http://localhost:3000/).
|
|
16
|
+
|
|
17
|
+
Congratulations! You just launched a DBOS application.
|
|
18
|
+
|
|
19
|
+
## Next Steps
|
|
20
|
+
|
|
21
|
+
- To add more functionality to this application, modify `src/operations.ts`, then rebuild and restart it. Alternatively, `npm run dev` uses `nodemon` to automatically rebuild and restart the app when source files change, using instructions specified in `nodemon.json`.
|
|
22
|
+
- For a detailed tutorial, check out the [programming guide](https://docs.dbos.dev/typescript/programming-guide).
|
|
23
|
+
- To learn more about DBOS, take a look at [the documentation](https://docs.dbos.dev/) or [source code](https://github.com/dbos-inc/dbos-transact-ts).
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# DBOS Hello
|
|
2
|
+
|
|
3
|
+
This is a [DBOS app](https://docs.dbos.dev/) bootstrapped with `npx @dbos-inc/create` and using [Knex](https://docs.dbos.dev/typescript/tutorials/orms/using-knex).
|
|
4
|
+
|
|
5
|
+
## Getting Started
|
|
6
|
+
|
|
7
|
+
Run these commands to build your app, set up its database, then launch it:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm run build
|
|
11
|
+
npx dbos migrate
|
|
12
|
+
npm run start
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
To see that it's working, visit this URL in your browser: [`http://localhost:3000/`](http://localhost:3000/).
|
|
16
|
+
|
|
17
|
+
Congratulations! You just launched a DBOS application.
|
|
18
|
+
|
|
19
|
+
## Next Steps
|
|
20
|
+
|
|
21
|
+
- To add more functionality to this application, modify `src/main.ts`, then rebuild and restart it. Alternatively, `npm run dev` uses `nodemon` to automatically rebuild and restart the app when source files change, using instructions specified in `nodemon.json`.
|
|
22
|
+
- For a detailed tutorial, check out the [programming guide](https://docs.dbos.dev/typescript/programming-guide).
|
|
23
|
+
- To learn more about DBOS, take a look at [the documentation](https://docs.dbos.dev/) or [source code](https://github.com/dbos-inc/dbos-transact-ts).
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "dbos-
|
|
2
|
+
"name": "dbos-knex",
|
|
3
3
|
"version": "0.0.1",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"build": "tsc",
|
|
6
|
-
"test": "npx dbos
|
|
6
|
+
"test": "npx dbos migrate && jest",
|
|
7
7
|
"lint": "eslint src",
|
|
8
|
-
"lint-fix": "eslint --fix src",
|
|
9
8
|
"dev": "nodemon",
|
|
10
9
|
"start": "npx dbos start"
|
|
11
10
|
},
|
|
@@ -22,6 +21,7 @@
|
|
|
22
21
|
},
|
|
23
22
|
"dependencies": {
|
|
24
23
|
"@dbos-inc/dbos-sdk": "file:../../../..",
|
|
24
|
+
"express": "^4.21.2",
|
|
25
25
|
"knex": "3.1.0"
|
|
26
26
|
}
|
|
27
27
|
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
// Welcome to DBOS!
|
|
2
|
+
|
|
3
|
+
// This is a sample "Hello" app built with DBOS and Knex.
|
|
4
|
+
// It greets visitors and keeps track of how many times each visitor has been greeted.
|
|
5
|
+
|
|
6
|
+
import express, { Request, Response } from 'express';
|
|
7
|
+
import { DBOS } from "@dbos-inc/dbos-sdk";
|
|
8
|
+
|
|
9
|
+
export interface dbos_hello {
|
|
10
|
+
name: string;
|
|
11
|
+
greet_count: number;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export class Hello {
|
|
15
|
+
// This transaction uses DBOS and Knex to perform database operations.
|
|
16
|
+
// It retrieves and increments the number of times a user has been greeted.
|
|
17
|
+
@DBOS.transaction()
|
|
18
|
+
static async helloTransaction(user: string) {
|
|
19
|
+
const query = "INSERT INTO dbos_hello (name, greet_count) VALUES (?, 1) ON CONFLICT (name) DO UPDATE SET greet_count = dbos_hello.greet_count + 1 RETURNING greet_count;";
|
|
20
|
+
const { rows } = (await DBOS.knexClient.raw(query, [user])) as { rows: dbos_hello[] };
|
|
21
|
+
const greet_count = rows[0].greet_count;
|
|
22
|
+
const greeting = `Hello, ${user}! You have been greeted ${greet_count} times.`;
|
|
23
|
+
return makeHTML(greeting);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Let's create an HTML + CSS Readme for our app.
|
|
28
|
+
function readme() {
|
|
29
|
+
return makeHTML(
|
|
30
|
+
`Visit the route <code class="bg-gray-100 px-1 rounded">/greeting/{name}</code> to be greeted!<br>
|
|
31
|
+
For example, visit <code class="bg-gray-100 px-1 rounded"><a href="/greeting/Mike" class="text-blue-600 hover:underline">/greeting/Mike</a></code><br>
|
|
32
|
+
The counter increments with each page visit.`
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function makeHTML(message: string) {
|
|
37
|
+
const page = `
|
|
38
|
+
<!DOCTYPE html>
|
|
39
|
+
<html lang="en">
|
|
40
|
+
<head>
|
|
41
|
+
<title>DBOS Template App</title>
|
|
42
|
+
<script src="https://cdn.tailwindcss.com"></script>
|
|
43
|
+
</head>
|
|
44
|
+
<body class="font-sans text-gray-800 p-6 max-w-2xl mx-auto">
|
|
45
|
+
<h1 class="text-3xl font-semibold mb-4">Welcome to DBOS!</h1>
|
|
46
|
+
<p class="mt-8 mb-8">` + message + `</p>
|
|
47
|
+
<p class="mb-2">
|
|
48
|
+
To learn how to run this app yourself, visit our
|
|
49
|
+
<a href="https://docs.dbos.dev/quickstart?language=typescript" class="text-blue-600 hover:underline">Quickstart</a>.
|
|
50
|
+
</p><p class="mb-2">
|
|
51
|
+
Then, to learn how to build crashproof apps, continue to our
|
|
52
|
+
<a href="https://docs.dbos.dev/typescript/programming-guide" class="text-blue-600 hover:underline">Programming Guide</a>.<br>
|
|
53
|
+
</p>
|
|
54
|
+
</body>
|
|
55
|
+
</html>`;
|
|
56
|
+
return page;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Let's create an HTTP server using Express.js
|
|
60
|
+
export const app = express();
|
|
61
|
+
app.use(express.json());
|
|
62
|
+
|
|
63
|
+
// Serve the Readme from the root path
|
|
64
|
+
app.get('/', (req: Request, res: Response) => {
|
|
65
|
+
res.send(readme());
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
// Serve the transaction from the /greeting/:name path
|
|
69
|
+
app.get('/greeting/:name', (req: Request, res: Response) => {
|
|
70
|
+
const { name } = req.params;
|
|
71
|
+
Hello.helloTransaction(name)
|
|
72
|
+
.then(result => res.send(result))
|
|
73
|
+
.catch(error => {
|
|
74
|
+
console.error(error);
|
|
75
|
+
res.status(500).send('Internal Server Error');
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
// Finally, launch DBOS and start the server
|
|
80
|
+
async function main() {
|
|
81
|
+
await DBOS.launch({expressApp: app});
|
|
82
|
+
const PORT = 3000;
|
|
83
|
+
const ENV = process.env.NODE_ENV || 'development';
|
|
84
|
+
|
|
85
|
+
app.listen(PORT, () => {
|
|
86
|
+
console.log(`🚀 Server is running on http://localhost:${PORT}`);
|
|
87
|
+
console.log(`🌟 Environment: ${ENV}`);
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// Only start the server when this file is run directly from Node
|
|
92
|
+
if (require.main === module) {
|
|
93
|
+
main().catch(console.log);
|
|
94
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# DBOS Hello with Prisma
|
|
2
|
+
|
|
3
|
+
This is a [DBOS app](https://docs.dbos.dev/) bootstrapped with `npx @dbos-inc/create` and using [Prisma](https://docs.dbos.dev/typescript/tutorials/orms/using-prisma).
|
|
4
|
+
|
|
5
|
+
## Getting Started
|
|
6
|
+
|
|
7
|
+
Run these commands to build your app, set up its database, then launch it:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm run build
|
|
11
|
+
npx dbos migrate
|
|
12
|
+
npm run start
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
To see that it's working, visit this URL in your browser: [`http://localhost:3000/`](http://localhost:3000/).
|
|
16
|
+
|
|
17
|
+
Congratulations! You just launched a DBOS application.
|
|
18
|
+
|
|
19
|
+
## Next Steps
|
|
20
|
+
|
|
21
|
+
- To add more functionality to this application, modify `src/operations.ts`, then rebuild and restart it. Alternatively, `npm run dev` uses `nodemon` to automatically rebuild and restart the app when source files change, using instructions specified in `nodemon.json`.
|
|
22
|
+
- For a detailed tutorial, check out the [programming guide](https://docs.dbos.dev/typescript/programming-guide).
|
|
23
|
+
- To learn more about DBOS, take a look at [the documentation](https://docs.dbos.dev/) or [source code](https://github.com/dbos-inc/dbos-transact-ts).
|
|
File without changes
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# DBOS Hello with TypeORM
|
|
2
|
+
|
|
3
|
+
This is a [DBOS app](https://docs.dbos.dev/) bootstrapped with `npx @dbos-inc/create` and using [TypeORM](https://docs.dbos.dev/typescript/tutorials/orms/using-typeorm).
|
|
4
|
+
|
|
5
|
+
## Getting Started
|
|
6
|
+
|
|
7
|
+
Run these commands to build your app, set up its database, then launch it:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm run build
|
|
11
|
+
npx dbos migrate
|
|
12
|
+
npm run start
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
To see that it's working, visit this URL in your browser: [`http://localhost:3000/`](http://localhost:3000/).
|
|
16
|
+
|
|
17
|
+
Congratulations! You just launched a DBOS application.
|
|
18
|
+
|
|
19
|
+
## Next Steps
|
|
20
|
+
|
|
21
|
+
- To add more functionality to this application, modify `src/main.ts`, then rebuild and restart it. Alternatively, `npm run dev` uses `nodemon` to automatically rebuild and restart the app when source files change, using instructions specified in `nodemon.json`.
|
|
22
|
+
- For a detailed tutorial, check out the [programming guide](https://docs.dbos.dev/typescript/programming-guide).
|
|
23
|
+
- To learn more about DBOS, take a look at [the documentation](https://docs.dbos.dev/) or [source code](https://github.com/dbos-inc/dbos-transact-ts).
|
|
File without changes
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
// Automatically configure the VSCode debugger for DBOS projects.
|
|
3
|
-
// Documentation on launch.json: https://go.microsoft.com/fwlink/?linkid=830387
|
|
4
|
-
"version": "0.2.0",
|
|
5
|
-
"configurations": [
|
|
6
|
-
{
|
|
7
|
-
"type": "node-terminal",
|
|
8
|
-
"request": "launch",
|
|
9
|
-
"name": "Local Debug",
|
|
10
|
-
"command": "npx dbos start",
|
|
11
|
-
"preLaunchTask": "npm: build",
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
"type": "node-terminal",
|
|
15
|
-
"request": "launch",
|
|
16
|
-
"name": "Time Travel Debug",
|
|
17
|
-
"command": "npx dbos debug -x ${command:dbos-ttdbg.get-proxy-url} -u ${command:dbos-ttdbg.pick-workflow-id}",
|
|
18
|
-
"preLaunchTask": "npm: build"
|
|
19
|
-
}
|
|
20
|
-
]
|
|
21
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
// Configure the build command for DBOS projects using VSCode.
|
|
3
|
-
// Documentation on tasks.json: https://code.visualstudio.com/docs/editor/tasks
|
|
4
|
-
"version": "2.0.0",
|
|
5
|
-
"tasks": [
|
|
6
|
-
{
|
|
7
|
-
"label": "npm: build",
|
|
8
|
-
"type": "npm",
|
|
9
|
-
"script": "build",
|
|
10
|
-
"group": {
|
|
11
|
-
"kind": "build",
|
|
12
|
-
"isDefault": true
|
|
13
|
-
},
|
|
14
|
-
"problemMatcher": [
|
|
15
|
-
"$tsc"
|
|
16
|
-
]
|
|
17
|
-
}
|
|
18
|
-
]
|
|
19
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
# DBOS Hello
|
|
2
|
-
|
|
3
|
-
This is a [DBOS app](https://docs.dbos.dev/) bootstrapped with `npx @dbos-inc/create` and using [Knex](https://docs.dbos.dev/typescript/tutorials/orms/using-knex).
|
|
4
|
-
|
|
5
|
-
## Getting Started
|
|
6
|
-
|
|
7
|
-
Before you can launch your app, you need a database.
|
|
8
|
-
DBOS works with any Postgres database, but to make things easier, we've provided a script that starts a Docker Postgres container and creates a database.
|
|
9
|
-
Run:
|
|
10
|
-
|
|
11
|
-
```bash
|
|
12
|
-
node start_postgres_docker.js
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
If successful, the script should print `Database started successfully!`.
|
|
16
|
-
|
|
17
|
-
To build the app, set up the database, and run, in one step:
|
|
18
|
-
```bash
|
|
19
|
-
npm run dev
|
|
20
|
-
```
|
|
21
|
-
This uses `nodemon`, so if you change your app it will automatically restart with changes.
|
|
22
|
-
|
|
23
|
-
To see that it's working, visit this URL in your browser: [`http://localhost:3000/greeting/dbos`](http://localhost:3000/greeting/dbos).
|
|
24
|
-
You should get this message: `Hello, dbos! You have been greeted 1 times.`
|
|
25
|
-
Each time you refresh the page, the counter should go up by one!
|
|
26
|
-
|
|
27
|
-
Congratulations! You just launched a DBOS application.
|
|
28
|
-
|
|
29
|
-
### Separate Build and Run Steps
|
|
30
|
-
|
|
31
|
-
To build the app:
|
|
32
|
-
```bash
|
|
33
|
-
npm run build
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
Then, run a schema migration to create some tables:
|
|
37
|
-
|
|
38
|
-
```bash
|
|
39
|
-
npx dbos migrate
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
If successful, the migration should print `Migration successful!`.
|
|
43
|
-
|
|
44
|
-
Finally, run the app:
|
|
45
|
-
|
|
46
|
-
```bash
|
|
47
|
-
npx dbos start
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
## Next Steps
|
|
51
|
-
|
|
52
|
-
- To add more functionality to this application, modify `src/operations.ts`, and save it. If you are using, `npm run dev`, `nodemon` will rebuild and restart the app automatically.
|
|
53
|
-
- For a detailed tutorial, check out our [programming quickstart](https://docs.dbos.dev/typescript/programming-guide).
|
|
54
|
-
- To learn how to deploy your application to DBOS Cloud, visit our [cloud quickstart](https://docs.dbos.dev/quickstart)
|
|
55
|
-
- To learn more about DBOS, take a look at [our documentation](https://docs.dbos.dev/) or our [source code](https://github.com/dbos-inc).
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
# To enable auto-completion and validation for this file in VSCode, install the RedHat YAML extension
|
|
2
|
-
# https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml
|
|
3
|
-
|
|
4
|
-
# yaml-language-server: $schema=https://raw.githubusercontent.com/dbos-inc/dbos-transact/main/dbos-config.schema.json
|
|
5
|
-
|
|
6
|
-
language: node
|
|
7
|
-
database:
|
|
8
|
-
hostname: localhost
|
|
9
|
-
port: 5432
|
|
10
|
-
username: postgres
|
|
11
|
-
password: ${PGPASSWORD}
|
|
12
|
-
connectionTimeoutMillis: 3000
|
|
13
|
-
app_db_client: knex
|
|
14
|
-
migrate:
|
|
15
|
-
- npx knex migrate:latest
|
|
16
|
-
rollback:
|
|
17
|
-
- npx knex migrate:rollback
|
|
18
|
-
runtimeConfig:
|
|
19
|
-
entrypoints:
|
|
20
|
-
- dist/operations.js
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
const { FlatCompat } = require("@eslint/eslintrc");
|
|
2
|
-
const dbosIncEslintPlugin = require("@dbos-inc/eslint-plugin");
|
|
3
|
-
const typescriptEslint = require("typescript-eslint");
|
|
4
|
-
const typescriptEslintParser = require("@typescript-eslint/parser");
|
|
5
|
-
const globals = require("globals");
|
|
6
|
-
const js = require("@eslint/js");
|
|
7
|
-
|
|
8
|
-
const compat = new FlatCompat({
|
|
9
|
-
baseDirectory: __dirname,
|
|
10
|
-
recommendedConfig: js.configs.recommended
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
module.exports = typescriptEslint.config({
|
|
14
|
-
extends: compat.extends("plugin:@dbos-inc/dbosRecommendedConfig"),
|
|
15
|
-
plugins: { "@dbos-inc": dbosIncEslintPlugin },
|
|
16
|
-
|
|
17
|
-
languageOptions: {
|
|
18
|
-
parser: typescriptEslintParser,
|
|
19
|
-
parserOptions: { project: "./tsconfig.json" },
|
|
20
|
-
globals: { ...globals.node, ...globals.es6 }
|
|
21
|
-
},
|
|
22
|
-
|
|
23
|
-
rules: {
|
|
24
|
-
"no-secrets/no-secrets": ["error", { "tolerance": 5 }]
|
|
25
|
-
},
|
|
26
|
-
|
|
27
|
-
ignores: ["**/*.test.ts"]
|
|
28
|
-
});
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
# DBOS-specific
|
|
2
|
-
.dbos
|
|
3
|
-
|
|
4
|
-
# Logs
|
|
5
|
-
**/.DS_Store
|
|
6
|
-
**/prisma/migrations/*
|
|
7
|
-
|
|
8
|
-
logs
|
|
9
|
-
*.log
|
|
10
|
-
npm-debug.log*
|
|
11
|
-
yarn-debug.log*
|
|
12
|
-
yarn-error.log*
|
|
13
|
-
lerna-debug.log*
|
|
14
|
-
.pnpm-debug.log*
|
|
15
|
-
dbos_deploy/
|
|
16
|
-
|
|
17
|
-
# Diagnostic reports (https://nodejs.org/api/report.html)
|
|
18
|
-
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
|
19
|
-
|
|
20
|
-
# Runtime data
|
|
21
|
-
pids
|
|
22
|
-
*.pid
|
|
23
|
-
*.seed
|
|
24
|
-
*.pid.lock
|
|
25
|
-
|
|
26
|
-
# Directory for instrumented libs generated by jscoverage/JSCover
|
|
27
|
-
lib-cov
|
|
28
|
-
|
|
29
|
-
# Coverage directory used by tools like istanbul
|
|
30
|
-
coverage
|
|
31
|
-
*.lcov
|
|
32
|
-
|
|
33
|
-
# nyc test coverage
|
|
34
|
-
.nyc_output
|
|
35
|
-
|
|
36
|
-
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
|
37
|
-
.grunt
|
|
38
|
-
|
|
39
|
-
# Bower dependency directory (https://bower.io/)
|
|
40
|
-
bower_components
|
|
41
|
-
|
|
42
|
-
# node-waf configuration
|
|
43
|
-
.lock-wscript
|
|
44
|
-
|
|
45
|
-
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
|
46
|
-
build/Release
|
|
47
|
-
|
|
48
|
-
# Dependency directories
|
|
49
|
-
node_modules/
|
|
50
|
-
jspm_packages/
|
|
51
|
-
|
|
52
|
-
# Snowpack dependency directory (https://snowpack.dev/)
|
|
53
|
-
web_modules/
|
|
54
|
-
|
|
55
|
-
# TypeScript cache
|
|
56
|
-
*.tsbuildinfo
|
|
57
|
-
|
|
58
|
-
# Optional npm cache directory
|
|
59
|
-
.npm
|
|
60
|
-
|
|
61
|
-
# Optional eslint cache
|
|
62
|
-
.eslintcache
|
|
63
|
-
|
|
64
|
-
# Optional stylelint cache
|
|
65
|
-
.stylelintcache
|
|
66
|
-
|
|
67
|
-
# Microbundle cache
|
|
68
|
-
.rpt2_cache/
|
|
69
|
-
.rts2_cache_cjs/
|
|
70
|
-
.rts2_cache_es/
|
|
71
|
-
.rts2_cache_umd/
|
|
72
|
-
|
|
73
|
-
# Optional REPL history
|
|
74
|
-
.node_repl_history
|
|
75
|
-
|
|
76
|
-
# Output of 'npm pack'
|
|
77
|
-
*.tgz
|
|
78
|
-
|
|
79
|
-
# Yarn Integrity file
|
|
80
|
-
.yarn-integrity
|
|
81
|
-
|
|
82
|
-
# dotenv environment variable files
|
|
83
|
-
.env
|
|
84
|
-
.env.development.local
|
|
85
|
-
.env.test.local
|
|
86
|
-
.env.production.local
|
|
87
|
-
.env.local
|
|
88
|
-
|
|
89
|
-
# parcel-bundler cache (https://parceljs.org/)
|
|
90
|
-
.cache
|
|
91
|
-
.parcel-cache
|
|
92
|
-
|
|
93
|
-
# Next.js build output
|
|
94
|
-
.next
|
|
95
|
-
out
|
|
96
|
-
|
|
97
|
-
# Nuxt.js build / generate output
|
|
98
|
-
.nuxt
|
|
99
|
-
dist
|
|
100
|
-
|
|
101
|
-
# Gatsby files
|
|
102
|
-
.cache/
|
|
103
|
-
# Comment in the public line in if your project uses Gatsby and not Next.js
|
|
104
|
-
# https://nextjs.org/blog/next-9-1#public-directory-support
|
|
105
|
-
# public
|
|
106
|
-
|
|
107
|
-
# vuepress build output
|
|
108
|
-
.vuepress/dist
|
|
109
|
-
|
|
110
|
-
# vuepress v2.x temp and cache directory
|
|
111
|
-
.temp
|
|
112
|
-
.cache
|
|
113
|
-
|
|
114
|
-
# Docusaurus cache and generated files
|
|
115
|
-
.docusaurus
|
|
116
|
-
|
|
117
|
-
# Serverless directories
|
|
118
|
-
.serverless/
|
|
119
|
-
|
|
120
|
-
# FuseBox cache
|
|
121
|
-
.fusebox/
|
|
122
|
-
|
|
123
|
-
# DynamoDB Local files
|
|
124
|
-
.dynamodb/
|
|
125
|
-
|
|
126
|
-
# TernJS port file
|
|
127
|
-
.tern-port
|
|
128
|
-
|
|
129
|
-
# Stores VSCode versions used for testing VSCode extensions
|
|
130
|
-
.vscode-test
|
|
131
|
-
|
|
132
|
-
# VSCode settings
|
|
133
|
-
.vscode/settings.json
|
|
134
|
-
|
|
135
|
-
# yarn v2
|
|
136
|
-
.yarn/cache
|
|
137
|
-
.yarn/unplugged
|
|
138
|
-
.yarn/build-state.yml
|
|
139
|
-
.yarn/install-state.gz
|
|
140
|
-
.pnp.*
|
|
141
|
-
|
|
142
|
-
# Editor temp/recovery files
|
|
143
|
-
*.swp
|
|
144
|
-
*.swo
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
const { parseConfigFile } = require('@dbos-inc/dbos-sdk');
|
|
2
|
-
|
|
3
|
-
const [dbosConfig, ] = parseConfigFile();
|
|
4
|
-
|
|
5
|
-
const config = {
|
|
6
|
-
client: 'pg',
|
|
7
|
-
connection: {
|
|
8
|
-
host: dbosConfig.poolConfig.host,
|
|
9
|
-
port: dbosConfig.poolConfig.port,
|
|
10
|
-
user: dbosConfig.poolConfig.user,
|
|
11
|
-
password: dbosConfig.poolConfig.password,
|
|
12
|
-
database: dbosConfig.poolConfig.database,
|
|
13
|
-
ssl: dbosConfig.poolConfig.ssl,
|
|
14
|
-
},
|
|
15
|
-
migrations: {
|
|
16
|
-
directory: './migrations'
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
module.exports = config;
|