@dbos-inc/create 1.12.7-preview → 1.12.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dbos-inc/create",
3
- "version": "1.12.7-preview",
3
+ "version": "1.12.8-preview",
4
4
  "description": "Tool for performing project initialization from template",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -0,0 +1,5 @@
1
+ dist
2
+ *.test.ts
3
+ jest.config.js
4
+ generate_env.js
5
+ start_postgres_docker.js
@@ -0,0 +1,19 @@
1
+ {
2
+ "root": true,
3
+ "extends": [
4
+ "plugin:@dbos-inc/dbosRecommendedConfig"
5
+ ],
6
+ "plugins": [
7
+ "@dbos-inc"
8
+ ],
9
+ "env": {
10
+ "node": true,
11
+ "es6": true
12
+ },
13
+ "rules": {
14
+ },
15
+ "parser": "@typescript-eslint/parser",
16
+ "parserOptions": {
17
+ "project": "./tsconfig.json"
18
+ }
19
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ // Automatically recommend the DBOS extension to VSCode users.
3
+ // Documentation on extensions.json: http://go.microsoft.com/fwlink/?LinkId=827846
4
+ "recommendations": [
5
+ "dbos-inc.dbos-ttdbg"
6
+ ]
7
+ }
@@ -0,0 +1,21 @@
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
+ }
@@ -0,0 +1,19 @@
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
+ }
@@ -0,0 +1,51 @@
1
+ # DBOS Hello with Prisma
2
+
3
+ This is a [DBOS app](https://docs.dbos.dev/) bootstrapped with `npx @dbos-inc/dbos-sdk init` and using [Prisma](https://docs.dbos.dev/tutorials/using-prisma).
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
+ Next, build the app:
18
+
19
+ ```bash
20
+ npm run build
21
+ ```
22
+
23
+ Then, run a schema migration to create some tables.
24
+ Prisma provides rich support for [schema migrations](https://www.prisma.io/docs/orm/prisma-migrate), including automatic generation of migration files from Prisma schema.
25
+ Fore more information, see [our docs](https://docs.dbos.dev/tutorials/using-prisma).
26
+
27
+ ```bash
28
+ npx dbos-sdk migrate
29
+ ```
30
+
31
+ If successful, the migration should print `Migration successful!`.
32
+
33
+ Finally, run the app:
34
+
35
+ ```bash
36
+ npx dbos-sdk start
37
+ ```
38
+
39
+ To see that it's working, visit this URL in your browser: [`http://localhost:3000/greeting/dbos`](http://localhost:3000/greeting/dbos).
40
+ You should get this message: `Hello, dbos! You have been greeted 1 times.`
41
+ Each time you refresh the page, the counter should go up by one!
42
+
43
+ Congratulations! You just launched a DBOS application.
44
+
45
+ ## Next Steps
46
+
47
+ - For more information on using Prisma with DBOS, check out [our docs](https://docs.dbos.dev/tutorials/using-prisma).
48
+ - 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`.
49
+ - For a detailed tutorial, check out our [programming quickstart](https://docs.dbos.dev/getting-started/quickstart-programming).
50
+ - To learn how to deploy your application to DBOS Cloud, visit our [cloud quickstart](https://docs.dbos.dev/getting-started/quickstart-cloud/)
51
+ - To learn more about DBOS, take a look at [our documentation](https://docs.dbos.dev/) or our [source code](https://github.com/dbos-inc/dbos-transact).
@@ -0,0 +1,18 @@
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
+ database:
7
+ hostname: 'localhost'
8
+ port: 5432
9
+ username: 'postgres'
10
+ app_db_name: 'hello_prisma'
11
+ password: ${PGPASSWORD}
12
+ connectionTimeoutMillis: 3000
13
+ app_db_client: prisma
14
+ migrate:
15
+ - npx prisma migrate deploy
16
+ runtimeConfig:
17
+ entrypoints:
18
+ - dist/operations.js
@@ -0,0 +1,16 @@
1
+ const { parseConfigFile } = require('@dbos-inc/dbos-sdk/dist/src/dbos-runtime/config');
2
+ const fs = require('node:fs');
3
+ const path = require('node:path');
4
+
5
+ // Load the configuration file
6
+ const [dbosConfig, ] = parseConfigFile();
7
+
8
+ // Write out the .env file
9
+ const databaseURL = `postgresql://${dbosConfig.poolConfig.user}:${dbosConfig.poolConfig.password}@${dbosConfig.poolConfig.host}:${dbosConfig.poolConfig.port}/${dbosConfig.poolConfig.database}`;
10
+
11
+ try {
12
+ fs.writeFileSync(path.join(process.cwd(), 'prisma', '.env'), `DATABASE_URL="${databaseURL}"`);
13
+ console.log("Wrote database URL to the prisma/.env file.");
14
+ } catch (error) {
15
+ console.error("Error writing prisma/.env file:", error.message);
16
+ }
@@ -0,0 +1,143 @@
1
+ # DBOS-specific
2
+ .dbos
3
+
4
+ # Logs
5
+ **/.DS_Store
6
+
7
+ logs
8
+ *.log
9
+ npm-debug.log*
10
+ yarn-debug.log*
11
+ yarn-error.log*
12
+ lerna-debug.log*
13
+ .pnpm-debug.log*
14
+ dbos_deploy/
15
+
16
+ # Diagnostic reports (https://nodejs.org/api/report.html)
17
+ report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
18
+
19
+ # Runtime data
20
+ pids
21
+ *.pid
22
+ *.seed
23
+ *.pid.lock
24
+
25
+ # Directory for instrumented libs generated by jscoverage/JSCover
26
+ lib-cov
27
+
28
+ # Coverage directory used by tools like istanbul
29
+ coverage
30
+ *.lcov
31
+
32
+ # nyc test coverage
33
+ .nyc_output
34
+
35
+ # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
36
+ .grunt
37
+
38
+ # Bower dependency directory (https://bower.io/)
39
+ bower_components
40
+
41
+ # node-waf configuration
42
+ .lock-wscript
43
+
44
+ # Compiled binary addons (https://nodejs.org/api/addons.html)
45
+ build/Release
46
+
47
+ # Dependency directories
48
+ node_modules/
49
+ jspm_packages/
50
+
51
+ # Snowpack dependency directory (https://snowpack.dev/)
52
+ web_modules/
53
+
54
+ # TypeScript cache
55
+ *.tsbuildinfo
56
+
57
+ # Optional npm cache directory
58
+ .npm
59
+
60
+ # Optional eslint cache
61
+ .eslintcache
62
+
63
+ # Optional stylelint cache
64
+ .stylelintcache
65
+
66
+ # Microbundle cache
67
+ .rpt2_cache/
68
+ .rts2_cache_cjs/
69
+ .rts2_cache_es/
70
+ .rts2_cache_umd/
71
+
72
+ # Optional REPL history
73
+ .node_repl_history
74
+
75
+ # Output of 'npm pack'
76
+ *.tgz
77
+
78
+ # Yarn Integrity file
79
+ .yarn-integrity
80
+
81
+ # dotenv environment variable files
82
+ .env
83
+ .env.development.local
84
+ .env.test.local
85
+ .env.production.local
86
+ .env.local
87
+
88
+ # parcel-bundler cache (https://parceljs.org/)
89
+ .cache
90
+ .parcel-cache
91
+
92
+ # Next.js build output
93
+ .next
94
+ out
95
+
96
+ # Nuxt.js build / generate output
97
+ .nuxt
98
+ dist
99
+
100
+ # Gatsby files
101
+ .cache/
102
+ # Comment in the public line in if your project uses Gatsby and not Next.js
103
+ # https://nextjs.org/blog/next-9-1#public-directory-support
104
+ # public
105
+
106
+ # vuepress build output
107
+ .vuepress/dist
108
+
109
+ # vuepress v2.x temp and cache directory
110
+ .temp
111
+ .cache
112
+
113
+ # Docusaurus cache and generated files
114
+ .docusaurus
115
+
116
+ # Serverless directories
117
+ .serverless/
118
+
119
+ # FuseBox cache
120
+ .fusebox/
121
+
122
+ # DynamoDB Local files
123
+ .dynamodb/
124
+
125
+ # TernJS port file
126
+ .tern-port
127
+
128
+ # Stores VSCode versions used for testing VSCode extensions
129
+ .vscode-test
130
+
131
+ # VSCode settings
132
+ .vscode/settings.json
133
+
134
+ # yarn v2
135
+ .yarn/cache
136
+ .yarn/unplugged
137
+ .yarn/build-state.yml
138
+ .yarn/install-state.gz
139
+ .pnp.*
140
+
141
+ # Editor temp/recovery files
142
+ *.swp
143
+ *.swo
@@ -0,0 +1,8 @@
1
+ /** @type {import('ts-jest').JestConfigWithTsJest} */
2
+ module.exports = {
3
+ preset: 'ts-jest',
4
+ testEnvironment: 'node',
5
+ testRegex: '((\\.|/)(test|spec))\\.ts?$',
6
+ moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
7
+ modulePaths: ["./"],
8
+ };
@@ -0,0 +1,8 @@
1
+ {
2
+ "watch": ["src/", "prisma/"],
3
+ "ext": "ts,json",
4
+ "ignore": ["src/**/*.test.ts"],
5
+ "exec": "npm run build && npx dbos migrate && npm run start"
6
+ }
7
+
8
+