@dbos-inc/create 1.19.5-preview → 1.19.8-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 +3 -4
- package/templates/hello/src/operations.ts +13 -1
- package/templates/hello-prisma/package.json +3 -4
- package/templates/hello-prisma/src/operations.ts +12 -1
- package/templates/hello-typeorm/package.json +3 -4
- package/templates/hello-typeorm/src/operations.ts +12 -1
package/package.json
CHANGED
|
@@ -10,16 +10,15 @@
|
|
|
10
10
|
"start": "npx dbos start"
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
13
|
-
"@dbos-inc/eslint-plugin": "^
|
|
13
|
+
"@dbos-inc/eslint-plugin": "^3.1.0",
|
|
14
14
|
"@types/jest": "^29.5.12",
|
|
15
15
|
"@types/supertest": "^2.0.16",
|
|
16
|
-
"eslint": "^
|
|
16
|
+
"eslint": "^8.57.0",
|
|
17
17
|
"jest": "^29.7.0",
|
|
18
18
|
"nodemon": "^3.1.0",
|
|
19
19
|
"supertest": "^7.0.0",
|
|
20
20
|
"ts-jest": "^29.1.2",
|
|
21
|
-
"typescript": "^5.4.5"
|
|
22
|
-
"typescript-eslint": "^8.0.0-alpha.30"
|
|
21
|
+
"typescript": "^5.4.5"
|
|
23
22
|
},
|
|
24
23
|
"dependencies": {
|
|
25
24
|
"@dbos-inc/dbos-sdk": "file:../../../..",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TransactionContext, Transaction, GetApi, ArgSource, ArgSources } from '@dbos-inc/dbos-sdk';
|
|
1
|
+
import { HandlerContext, TransactionContext, Transaction, GetApi, ArgSource, ArgSources } from '@dbos-inc/dbos-sdk';
|
|
2
2
|
import { Knex } from 'knex';
|
|
3
3
|
|
|
4
4
|
// The schema of the database table used in this example.
|
|
@@ -9,6 +9,18 @@ export interface dbos_hello {
|
|
|
9
9
|
|
|
10
10
|
export class Hello {
|
|
11
11
|
|
|
12
|
+
@GetApi('/') // Serve a quick readme for the app
|
|
13
|
+
static async readme(_ctxt: HandlerContext) {
|
|
14
|
+
const readme = '<html><body><p>' +
|
|
15
|
+
'Welcome to the DBOS Hello App!<br><br>' +
|
|
16
|
+
'Visit the route /greeting/:name to be greeted!<br>' +
|
|
17
|
+
'For example, visit <a href="/greeting/dbos">/greeting/dbos</a>.<br>' +
|
|
18
|
+
'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.' +
|
|
20
|
+
'</p></body></html>';
|
|
21
|
+
return Promise.resolve(readme);
|
|
22
|
+
}
|
|
23
|
+
|
|
12
24
|
@GetApi('/greeting/:user') // Serve this function from HTTP GET requests to the /greeting endpoint with 'user' as a path parameter
|
|
13
25
|
@Transaction() // Run this function as a database transaction
|
|
14
26
|
static async helloTransaction(ctxt: TransactionContext<Knex>, @ArgSource(ArgSources.URL) user: string) {
|
|
@@ -12,17 +12,16 @@
|
|
|
12
12
|
"author": "",
|
|
13
13
|
"license": "ISC",
|
|
14
14
|
"devDependencies": {
|
|
15
|
-
"@dbos-inc/eslint-plugin": "^
|
|
15
|
+
"@dbos-inc/eslint-plugin": "^3.1.0",
|
|
16
16
|
"@types/jest": "^29.5.12",
|
|
17
17
|
"@types/supertest": "^6.0.2",
|
|
18
|
-
"eslint": "^
|
|
18
|
+
"eslint": "^8.57.0",
|
|
19
19
|
"jest": "^29.7.0",
|
|
20
20
|
"nodemon": "^3.1.0",
|
|
21
21
|
"prisma": "^5.15.0",
|
|
22
22
|
"supertest": "^7.0.0",
|
|
23
23
|
"ts-jest": "^29.1.2",
|
|
24
|
-
"typescript": "^5.4.5"
|
|
25
|
-
"typescript-eslint": "^8.0.0-alpha.30"
|
|
24
|
+
"typescript": "^5.4.5"
|
|
26
25
|
},
|
|
27
26
|
"dependencies": {
|
|
28
27
|
"@dbos-inc/dbos-sdk": "file:../../../..",
|
|
@@ -1,8 +1,19 @@
|
|
|
1
|
-
import { TransactionContext, Transaction, GetApi } from '@dbos-inc/dbos-sdk';
|
|
1
|
+
import { HandlerContext, TransactionContext, Transaction, GetApi } from '@dbos-inc/dbos-sdk';
|
|
2
2
|
import { PrismaClient } from "@prisma/client";
|
|
3
3
|
|
|
4
4
|
export class Hello {
|
|
5
5
|
|
|
6
|
+
@GetApi('/') // Serve a quick readme for the app
|
|
7
|
+
static async readme(_ctxt: HandlerContext) {
|
|
8
|
+
const readme = '<html><body><p>' +
|
|
9
|
+
'Welcome to the DBOS Hello App!<br><br>' +
|
|
10
|
+
'Visit the route /greeting/:name to be greeted!<br>' +
|
|
11
|
+
'For example, visit <a href="/greeting/dbos">/greeting/dbos</a>.<br>' +
|
|
12
|
+
'The counter increments with each page visit.' +
|
|
13
|
+
'</p></body></html>';
|
|
14
|
+
return Promise.resolve(readme);
|
|
15
|
+
}
|
|
16
|
+
|
|
6
17
|
@GetApi('/greeting/:name')
|
|
7
18
|
@Transaction()
|
|
8
19
|
static async helloTransaction(txnCtxt: TransactionContext<PrismaClient>, name: string) {
|
|
@@ -12,16 +12,15 @@
|
|
|
12
12
|
"author": "",
|
|
13
13
|
"license": "ISC",
|
|
14
14
|
"devDependencies": {
|
|
15
|
-
"@dbos-inc/eslint-plugin": "^
|
|
15
|
+
"@dbos-inc/eslint-plugin": "^3.1.0",
|
|
16
16
|
"@types/jest": "^29.5.12",
|
|
17
17
|
"@types/supertest": "^6.0.2",
|
|
18
|
-
"eslint": "^
|
|
18
|
+
"eslint": "^8.57.0",
|
|
19
19
|
"jest": "^29.7.0",
|
|
20
20
|
"nodemon": "^3.1.0",
|
|
21
21
|
"supertest": "^7.0.0",
|
|
22
22
|
"ts-jest": "^29.1.2",
|
|
23
|
-
"typescript": "^5.4.5"
|
|
24
|
-
"typescript-eslint": "^8.0.0-alpha.30"
|
|
23
|
+
"typescript": "^5.4.5"
|
|
25
24
|
},
|
|
26
25
|
"dependencies": {
|
|
27
26
|
"@dbos-inc/dbos-sdk": "file:../../../..",
|
|
@@ -1,10 +1,21 @@
|
|
|
1
|
-
import { TransactionContext, Transaction, GetApi, OrmEntities } from '@dbos-inc/dbos-sdk';
|
|
1
|
+
import { HandlerContext, TransactionContext, Transaction, GetApi, OrmEntities } from '@dbos-inc/dbos-sdk';
|
|
2
2
|
import { EntityManager } from "typeorm";
|
|
3
3
|
import { DBOSHello } from '../entities/DBOSHello';
|
|
4
4
|
|
|
5
5
|
@OrmEntities([DBOSHello])
|
|
6
6
|
export class Hello {
|
|
7
7
|
|
|
8
|
+
@GetApi('/') // Serve a quick readme for the app
|
|
9
|
+
static async readme(_ctxt: HandlerContext) {
|
|
10
|
+
const readme = '<html><body><p>' +
|
|
11
|
+
'Welcome to the DBOS Hello App!<br><br>' +
|
|
12
|
+
'Visit the route /greeting/:name to be greeted!<br>' +
|
|
13
|
+
'For example, visit <a href="/greeting/dbos">/greeting/dbos</a>.<br>' +
|
|
14
|
+
'The counter increments with each page visit.' +
|
|
15
|
+
'</p></body></html>';
|
|
16
|
+
return Promise.resolve(readme);
|
|
17
|
+
}
|
|
18
|
+
|
|
8
19
|
@GetApi('/greeting/:name')
|
|
9
20
|
@Transaction()
|
|
10
21
|
static async helloTransaction(txnCtxt: TransactionContext<EntityManager>, name: string) {
|