@dbos-inc/create 1.22.6 → 1.23.4-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/package.json +1 -1
- package/templates/hello/package.json +1 -1
- package/templates/hello/src/operations.ts +11 -2
- package/templates/hello-drizzle/package.json +1 -1
- package/templates/hello-drizzle/src/operations.ts +11 -2
- package/templates/hello-prisma/package.json +1 -1
- package/templates/hello-prisma/src/operations.ts +11 -2
- package/templates/hello-typeorm/package.json +1 -1
- package/templates/hello-typeorm/src/operations.ts +11 -2
package/package.json
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { HandlerContext, TransactionContext, Transaction, GetApi, ArgSource, ArgSources } from '@dbos-inc/dbos-sdk';
|
|
2
2
|
import { Knex } from 'knex';
|
|
3
3
|
|
|
4
|
+
const app_notes = `
|
|
5
|
+
To learn how to run this app on your computer, visit the
|
|
6
|
+
<a href="https://docs.dbos.dev/getting-started/quickstart" >DBOS Quickstart</a>.<br>
|
|
7
|
+
After that, to learn how to build apps, visit the
|
|
8
|
+
<a href="https://docs.dbos.dev/getting-started/quickstart-programming" >DBOS Programming Guide</a>.`;
|
|
9
|
+
|
|
4
10
|
// The schema of the database table used in this example.
|
|
5
11
|
export interface dbos_hello {
|
|
6
12
|
name: string;
|
|
@@ -16,7 +22,8 @@ export class Hello {
|
|
|
16
22
|
Visit the route /greeting/:name to be greeted!<br>
|
|
17
23
|
For example, visit <a href="/greeting/dbos">/greeting/dbos</a>.<br>
|
|
18
24
|
The counter increments with each page visit.<br>
|
|
19
|
-
If you visit a new name like <a href="/greeting/alice">/greeting/alice</a>, the counter starts at 1
|
|
25
|
+
If you visit a new name like <a href="/greeting/alice">/greeting/alice</a>, the counter starts at 1.<br><br>
|
|
26
|
+
${app_notes}
|
|
20
27
|
</p></body></html>`;
|
|
21
28
|
return Promise.resolve(readme);
|
|
22
29
|
}
|
|
@@ -28,6 +35,8 @@ export class Hello {
|
|
|
28
35
|
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;";
|
|
29
36
|
const { rows } = await ctxt.client.raw(query, [user]) as { rows: dbos_hello[] };
|
|
30
37
|
const greet_count = rows[0].greet_count;
|
|
31
|
-
|
|
38
|
+
const greeting = `Hello, ${user}! You have been greeted ${greet_count} times.`;
|
|
39
|
+
const page = `<html><body><p>${greeting}<br><br>${app_notes}</p></body></html>`;
|
|
40
|
+
return page;
|
|
32
41
|
}
|
|
33
42
|
}
|
|
@@ -2,6 +2,12 @@ import { HandlerContext, TransactionContext, Transaction, GetApi } from '@dbos-i
|
|
|
2
2
|
import { dbosHello } from './schema';
|
|
3
3
|
import { NodePgDatabase } from 'drizzle-orm/node-postgres';
|
|
4
4
|
|
|
5
|
+
const app_notes = `
|
|
6
|
+
To learn how to run this app on your computer, visit the
|
|
7
|
+
<a href="https://docs.dbos.dev/getting-started/quickstart" >DBOS Quickstart</a>.<br>
|
|
8
|
+
After that, to learn how to build apps, visit the
|
|
9
|
+
<a href="https://docs.dbos.dev/getting-started/quickstart-programming" >DBOS Programming Guide</a>.`;
|
|
10
|
+
|
|
5
11
|
export class Hello {
|
|
6
12
|
|
|
7
13
|
@GetApi('/') // Serve a quick readme for the app
|
|
@@ -10,7 +16,8 @@ export class Hello {
|
|
|
10
16
|
Welcome to the DBOS Hello App!<br><br>
|
|
11
17
|
Visit the route /greeting/:name to be greeted!<br>
|
|
12
18
|
For example, visit <a href="/greeting/dbos">/greeting/dbos</a>.<br>
|
|
13
|
-
The counter increments with each page visit.<br>
|
|
19
|
+
The counter increments with each page visit.<br><br>
|
|
20
|
+
${app_notes}
|
|
14
21
|
</p></body></html>`;
|
|
15
22
|
return Promise.resolve(readme);
|
|
16
23
|
}
|
|
@@ -20,6 +27,8 @@ export class Hello {
|
|
|
20
27
|
static async helloTransaction(ctxt: TransactionContext<NodePgDatabase>, user: string) {
|
|
21
28
|
const greeting = `Hello, ${user}!`;
|
|
22
29
|
const greetings_output = await ctxt.client.insert(dbosHello).values({greeting}).returning({greet_count: dbosHello.greet_count});
|
|
23
|
-
|
|
30
|
+
const greeting_message = `${greeting} We have made ${greetings_output[0].greet_count} greetings.`;
|
|
31
|
+
const page = `<html><body><p>${greeting_message}<br><br>${app_notes}</p></body></html>`;
|
|
32
|
+
return page;
|
|
24
33
|
}
|
|
25
34
|
}
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { HandlerContext, TransactionContext, Transaction, GetApi } from '@dbos-inc/dbos-sdk';
|
|
2
2
|
import { PrismaClient } from "@prisma/client";
|
|
3
3
|
|
|
4
|
+
const app_notes = `
|
|
5
|
+
To learn how to run this app on your computer, visit the
|
|
6
|
+
<a href="https://docs.dbos.dev/getting-started/quickstart" >DBOS Quickstart</a>.<br>
|
|
7
|
+
After that, to learn how to build apps, visit the
|
|
8
|
+
<a href="https://docs.dbos.dev/getting-started/quickstart-programming" >DBOS Programming Guide</a>.`;
|
|
9
|
+
|
|
4
10
|
export class Hello {
|
|
5
11
|
|
|
6
12
|
@GetApi('/') // Serve a quick readme for the app
|
|
@@ -9,7 +15,8 @@ export class Hello {
|
|
|
9
15
|
Welcome to the DBOS Hello App!<br><br>
|
|
10
16
|
Visit the route /greeting/:name to be greeted!<br>
|
|
11
17
|
For example, visit <a href="/greeting/dbos">/greeting/dbos</a>.<br>
|
|
12
|
-
The counter increments with each page visit.<br>
|
|
18
|
+
The counter increments with each page visit.<br><br>
|
|
19
|
+
${app_notes}
|
|
13
20
|
</p></body></html>`;
|
|
14
21
|
return Promise.resolve(readme);
|
|
15
22
|
}
|
|
@@ -23,6 +30,8 @@ export class Hello {
|
|
|
23
30
|
greeting: greeting,
|
|
24
31
|
},
|
|
25
32
|
});
|
|
26
|
-
|
|
33
|
+
const greeting_note = `Greeting ${res.greeting_id}: ${greeting}`;
|
|
34
|
+
const page = `<html><body><p>${greeting_note}<br><br>${app_notes}</p></body></html>`;
|
|
35
|
+
return page;
|
|
27
36
|
}
|
|
28
37
|
}
|
|
@@ -2,6 +2,12 @@ import { HandlerContext, TransactionContext, Transaction, GetApi, OrmEntities }
|
|
|
2
2
|
import { EntityManager } from "typeorm";
|
|
3
3
|
import { DBOSHello } from '../entities/DBOSHello';
|
|
4
4
|
|
|
5
|
+
const app_notes = `
|
|
6
|
+
To learn how to run this app on your computer, visit the
|
|
7
|
+
<a href="https://docs.dbos.dev/getting-started/quickstart" >DBOS Quickstart</a>.<br>
|
|
8
|
+
After that, to learn how to build apps, visit the
|
|
9
|
+
<a href="https://docs.dbos.dev/getting-started/quickstart-programming" >DBOS Programming Guide</a>.`;
|
|
10
|
+
|
|
5
11
|
@OrmEntities([DBOSHello])
|
|
6
12
|
export class Hello {
|
|
7
13
|
|
|
@@ -11,7 +17,8 @@ export class Hello {
|
|
|
11
17
|
Welcome to the DBOS Hello App!<br><br>
|
|
12
18
|
Visit the route /greeting/:name to be greeted!<br>
|
|
13
19
|
For example, visit <a href="/greeting/dbos">/greeting/dbos</a>.<br>
|
|
14
|
-
The counter increments with each page visit.<br>
|
|
20
|
+
The counter increments with each page visit.<br><br>
|
|
21
|
+
${app_notes}
|
|
15
22
|
</p></body></html>`;
|
|
16
23
|
return Promise.resolve(readme);
|
|
17
24
|
}
|
|
@@ -23,6 +30,8 @@ export class Hello {
|
|
|
23
30
|
let entity = new DBOSHello();
|
|
24
31
|
entity.greeting = greeting;
|
|
25
32
|
entity = await txnCtxt.client.save(entity);
|
|
26
|
-
|
|
33
|
+
const greeting_note = `Greeting ${entity.greeting_id}: ${greeting}`;
|
|
34
|
+
const page = `<html><body><p>${greeting_note}<br><br>${app_notes}</p></body></html>`;
|
|
35
|
+
return page;
|
|
27
36
|
}
|
|
28
37
|
}
|