@dbos-inc/create 1.29.4-preview → 1.29.11-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.
Files changed (33) hide show
  1. package/package.json +1 -1
  2. package/templates/hello/README.md +33 -7
  3. package/templates/hello/src/operations.ts +7 -5
  4. package/templates/hello-express/README.md +75 -0
  5. package/templates/hello-express/dbos-config.yaml +20 -0
  6. package/templates/hello-express/eslint.config.js +28 -0
  7. package/templates/hello-express/gitignore.template +144 -0
  8. package/templates/hello-express/jest.config.js +8 -0
  9. package/templates/hello-express/knexfile.js +20 -0
  10. package/templates/hello-express/migrations/20240212161006_create_dbos_hello_tables.js +18 -0
  11. package/templates/hello-express/nodemon.json +7 -0
  12. package/templates/hello-express/package.json +24 -0
  13. package/templates/hello-express/src/main.test.ts +36 -0
  14. package/templates/hello-express/src/main.ts +16 -0
  15. package/templates/hello-express/src/operations.ts +81 -0
  16. package/templates/hello-express/start_postgres_docker.js +40 -0
  17. package/templates/hello-express/tsconfig.json +25 -0
  18. package/templates/hello-v2/.vscode/extensions.json +7 -0
  19. package/templates/hello-v2/.vscode/launch.json +21 -0
  20. package/templates/hello-v2/.vscode/tasks.json +19 -0
  21. package/templates/hello-v2/README.md +55 -0
  22. package/templates/hello-v2/dbos-config.yaml +20 -0
  23. package/templates/hello-v2/eslint.config.js +28 -0
  24. package/templates/hello-v2/gitignore.template +144 -0
  25. package/templates/hello-v2/jest.config.js +8 -0
  26. package/templates/hello-v2/knexfile.js +20 -0
  27. package/templates/hello-v2/migrations/20240212161006_create_dbos_hello_tables.js +18 -0
  28. package/templates/hello-v2/nodemon.json +7 -0
  29. package/templates/hello-v2/package.json +23 -0
  30. package/templates/hello-v2/src/operations.test.ts +36 -0
  31. package/templates/hello-v2/src/operations.ts +64 -0
  32. package/templates/hello-v2/start_postgres_docker.js +40 -0
  33. package/templates/hello-v2/tsconfig.json +25 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dbos-inc/create",
3
- "version": "1.29.4-preview",
3
+ "version": "1.29.11-preview",
4
4
  "description": "Tool for performing project initialization from template",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -14,7 +14,21 @@ node start_postgres_docker.js
14
14
 
15
15
  If successful, the script should print `Database started successfully!`.
16
16
 
17
- Next, build the app:
17
+ Next, you can build and run the app in one step under `nodemon`:
18
+
19
+ ```bash
20
+ npm run dev
21
+ ```
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
+ ## Production build
30
+
31
+ In production, instead of using `nodemon`, the following separate steps should be used to build, run database setup, and start the app.
18
32
 
19
33
  ```bash
20
34
  npm run build
@@ -34,15 +48,27 @@ Finally, run the app:
34
48
  npx dbos-sdk start
35
49
  ```
36
50
 
37
- To see that it's working, visit this URL in your browser: [`http://localhost:3000/greeting/dbos`](http://localhost:3000/greeting/dbos).
38
- You should get this message: `Hello, dbos! You have been greeted 1 times.`
39
- Each time you refresh the page, the counter should go up by one!
51
+ ## The application
40
52
 
41
- Congratulations! You just launched a DBOS application.
53
+ The core of the application resides in `src/operations.ts`. It declares an "hello world" DBOS workflow served at `/greetings/:user`. To add more functionality, modify `src/operations.ts`. If you used `npm run dev`, it will automatically rebuild and restart.
54
+
55
+ ## Running in DBOS Cloud
56
+
57
+ To deploy this app to DBOS Cloud, first install the DBOS Cloud CLI (example with [npm](https://www.npmjs.com/)):
58
+
59
+ ```shell
60
+ npm i -g @dbos-inc/dbos-cloud
61
+ ```
62
+
63
+ Then, run this command to deploy your app:
64
+
65
+ ```shell
66
+ dbos-cloud app deploy
67
+ ```
68
+
69
+ functionality to this application, modify `src/operations.ts`. If you used `npm run dev`, it will automatically rebuild and restart.
42
70
 
43
71
  ## Next Steps
44
72
 
45
- - 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`.
46
73
  - For a detailed tutorial, check out our [programming quickstart](https://docs.dbos.dev/getting-started/quickstart-programming).
47
- - To learn how to deploy your application to DBOS Cloud, visit our [cloud quickstart](https://docs.dbos.dev/getting-started/quickstart-cloud/)
48
74
  - 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).
@@ -4,8 +4,8 @@
4
4
  // It greets visitors and keeps track of how many times each visitor has been greeted.
5
5
  // To run this app, visit our Quickstart: https://docs.dbos.dev/getting-started/quickstart
6
6
 
7
- import { HandlerContext, TransactionContext, Transaction, GetApi, ArgSource, ArgSources } from '@dbos-inc/dbos-sdk';
8
- import { Knex } from 'knex';
7
+ import { HandlerContext, TransactionContext, Transaction, GetApi, ArgSource, ArgSources } from "@dbos-inc/dbos-sdk";
8
+ import { Knex } from "knex";
9
9
 
10
10
  // The schema of the database table used in this example.
11
11
  export interface dbos_hello {
@@ -14,10 +14,10 @@ export interface dbos_hello {
14
14
  }
15
15
 
16
16
  export class Hello {
17
-
18
17
  // Serve this function from HTTP GET requests at the /greeting endpoint with 'user' as a path parameter
19
- @GetApi('/greeting/:user')
20
- @Transaction() // Run this function as a database transaction
18
+ // The @Transaction() decorator ensures that this function runs as a database transaction.
19
+ @GetApi("/greeting/:user")
20
+ @Transaction() // Run this function as a database transaction
21
21
  static async helloTransaction(ctxt: TransactionContext<Knex>, @ArgSource(ArgSources.URL) user: string) {
22
22
  // Retrieve and increment the number of times this user has been greeted.
23
23
  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;";
@@ -27,6 +27,8 @@ export class Hello {
27
27
  return Hello.makeHTML(greeting);
28
28
  }
29
29
 
30
+ // Let's declare helper functions to serve static HTML
31
+
30
32
  // Serve a quick readme for the app at the / endpoint
31
33
  @GetApi('/')
32
34
  static async readme(_ctxt: HandlerContext) {
@@ -0,0 +1,75 @@
1
+ # DBOS Hello
2
+
3
+ This is a [DBOS app](https://docs.dbos.dev/) bootstrapped with `npx @dbos-inc/create`, using [Express.js](https://expressjs.com/) and [Knex](https://docs.dbos.dev/tutorials/using-knex) to interact with postgres.
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, you can build and run the app in one step under `nodemon`:
18
+
19
+ ```bash
20
+ npm run dev
21
+ ```
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
+ ## Production build
30
+
31
+ In production, instead of using `nodemon`, the following separate steps should be used to build, run database setup, and start the app.
32
+
33
+ ```bash
34
+ npm run build
35
+ ```
36
+
37
+ Then, run a schema migration to create some tables:
38
+
39
+ ```bash
40
+ npx dbos-sdk migrate
41
+ ```
42
+
43
+ If successful, the migration should print `Migration successful!`.
44
+
45
+ Finally, run the app:
46
+
47
+ ```bash
48
+ npx dbos-sdk start
49
+ ```
50
+
51
+ ## The application
52
+
53
+ - In `src/operations.ts`, the Express app object is created and configured to serve an "hello world" DBOS workflow on `/greetings/:user`. This file also hosts the code of said DBOS workflow: an `Hello` class with a single `helloTransaction` method.
54
+ - `src/main.ts` declares the code to start a DBOS instance and an Express application. When you pass the Express app object as parameter to `DBOS.launch()`, DBOS will wrap all routes with an [OpenTelemetry](https://opentelemetry.io/) tracing middleware and tie HTTP traces to DBOS workflow traces.
55
+
56
+ To add more functionality to this application, modify `src/operations.ts`. If you used `npm run dev`, it will automatically rebuild and restart.
57
+
58
+ ## Running in DBOS Cloud
59
+
60
+ To deploy this app to DBOS Cloud, first install the DBOS Cloud CLI (example with [npm](https://www.npmjs.com/)):
61
+
62
+ ```shell
63
+ npm i -g @dbos-inc/dbos-cloud
64
+ ```
65
+
66
+ Then, run this command to deploy your app:
67
+
68
+ ```shell
69
+ dbos-cloud app deploy
70
+ ```
71
+
72
+ ## Next Steps
73
+
74
+ - For a detailed tutorial, check out our [programming quickstart](https://docs.dbos.dev/getting-started/quickstart-programming).
75
+ - 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,20 @@
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
+ start:
20
+ - dist/main.js
@@ -0,0 +1,28 @@
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
+ });
@@ -0,0 +1,144 @@
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
@@ -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,20 @@
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;
@@ -0,0 +1,18 @@
1
+ const { Knex } = require("knex");
2
+
3
+ exports.up = async function(knex) {
4
+ await knex.schema.createTable('dbos_hello', table => {
5
+ table.text('name').primary();
6
+ table.integer('greet_count').defaultTo(0);
7
+ });
8
+
9
+ return knex.schema.createTable('dbos_greetings', table => {
10
+ table.text('greeting_name');
11
+ table.text('greeting_note_content');
12
+ });
13
+ };
14
+
15
+ exports.down = async function(knex) {
16
+ await knex.schema.dropTable('dbos_greetings');
17
+ return knex.schema.dropTable('dbos_hello');
18
+ };
@@ -0,0 +1,7 @@
1
+ {
2
+ "watch": ["src/","migrations/"],
3
+ "ext": "ts,json",
4
+ "ignore": ["src/**/*.test.ts"],
5
+ "exec": "npm run build && npx dbos migrate && node dist/main.js"
6
+ }
7
+
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "dbos-hello-express",
3
+ "version": "0.0.1",
4
+ "scripts": {
5
+ "build": "tsc",
6
+ "test": "npx dbos rollback && npx dbos migrate && jest",
7
+ "dev": "nodemon",
8
+ "start": "npx dbos start"
9
+ },
10
+ "devDependencies": {
11
+ "@types/jest": "^29.5.12",
12
+ "@types/supertest": "^2.0.16",
13
+ "jest": "^29.7.0",
14
+ "nodemon": "^3.1.0",
15
+ "supertest": "^7.0.0",
16
+ "ts-jest": "^29.1.2",
17
+ "typescript": "^5.4.5"
18
+ },
19
+ "dependencies": {
20
+ "@dbos-inc/dbos-sdk": "file:../../../..",
21
+ "express": "^4.21.1",
22
+ "knex": "3.1.0"
23
+ }
24
+ }
@@ -0,0 +1,36 @@
1
+ import { DBOS } from "@dbos-inc/dbos-sdk";
2
+ import { app, dbos_hello, Hello } from "./operations";
3
+ import request from "supertest";
4
+
5
+ describe("operations-test", () => {
6
+ beforeAll(async () => {
7
+ await DBOS.launch({expressApp: app});
8
+ });
9
+
10
+ afterAll(async () => {
11
+ await DBOS.shutdown();
12
+ });
13
+
14
+ /**
15
+ * Test the transaction.
16
+ */
17
+ test("test-transaction", async () => {
18
+ const res = await Hello.helloTransaction("dbos");
19
+ expect(res).toMatch("Hello, dbos! You have been greeted");
20
+
21
+ // Check the greet count.
22
+ const rows = await DBOS.executor.queryUserDB("SELECT * FROM dbos_hello WHERE name=$1", ["dbos"]) as dbos_hello[];
23
+ expect(rows[0].greet_count).toBe(1);
24
+ });
25
+
26
+ /**
27
+ * Test the HTTP endpoint.
28
+ */
29
+ test("test-endpoint", async () => {
30
+ const res = await request(app).get(
31
+ "/greeting/dbos"
32
+ );
33
+ expect(res.statusCode).toBe(200);
34
+ expect(res.text).toMatch("Hello, dbos! You have been greeted");
35
+ });
36
+ });
@@ -0,0 +1,16 @@
1
+ import { app } from './operations';
2
+ import { DBOS } from '@dbos-inc/dbos-sdk';
3
+
4
+ async function main() {
5
+ await DBOS.launch({expressApp: app});
6
+
7
+ const PORT = DBOS.runtimeConfig?.port ?? 3000;
8
+ const ENV = process.env.NODE_ENV || 'development';
9
+
10
+ app.listen(PORT, () => {
11
+ console.log(`🚀 Server is running on http://localhost:${PORT}`);
12
+ console.log(`🌟 Environment: ${ENV}`);
13
+ });
14
+ }
15
+
16
+ main().catch(console.log);
@@ -0,0 +1,81 @@
1
+ // Welcome to DBOS!
2
+
3
+ // This is a sample "Hello" app built with DBOS, Express.js, and Knex.
4
+ // It greets visitors and keeps track of how many times each visitor has been greeted.
5
+
6
+ // First let's import express and DBOS
7
+ import express from "express";
8
+ import { DBOS } from "@dbos-inc/dbos-sdk";
9
+
10
+ // Then, let's declare a type representing the "dbos_hello" database table
11
+ export interface dbos_hello {
12
+ name: string;
13
+ greet_count: number;
14
+ }
15
+
16
+ // Now let's define a class with some static functions.
17
+ // DBOS uses TypeScript decorators to automatically make your functions reliable, so they need to be static.
18
+ export class Hello {
19
+ // This function greets a user and increments the greet count in the database.
20
+ // The @DBOS.transaction() decorator ensures that this function runs as a database transaction.
21
+ @DBOS.transaction()
22
+ static async helloTransaction(user: string) {
23
+ 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;";
24
+ const { rows } = (await DBOS.knexClient.raw(query, [user])) as { rows: dbos_hello[] };
25
+ const greet_count = rows[0].greet_count;
26
+ const greeting = `Hello, ${user}! You have been greeted ${greet_count} times.`;
27
+ return Hello.makeHTML(greeting);
28
+ }
29
+
30
+ // Finally, we will declare helper functions to serve static HTML to user.s
31
+
32
+ static async readme() {
33
+ const message = Hello.makeHTML(
34
+ `Visit the route <code class="bg-gray-100 px-1 rounded">/greeting/{name}</code> to be greeted!<br>
35
+ 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>
36
+ The counter increments with each page visit.`
37
+ );
38
+ return Promise.resolve(message);
39
+ }
40
+
41
+ // A helper function to create HTML pages with some styling
42
+ static makeHTML(message: string) {
43
+ const page = `
44
+ <!DOCTYPE html>
45
+ <html lang="en">
46
+ <head>
47
+ <title>DBOS Template App</title>
48
+ <script src="https://cdn.tailwindcss.com"></script>
49
+ </head>
50
+ <body class="font-sans text-gray-800 p-6 max-w-2xl mx-auto">
51
+ <h1 class="text-3xl font-semibold mb-4">Welcome to DBOS!</h1>
52
+ <p class="mt-8 mb-8">` + message + `</p>
53
+ <p class="mb-2">
54
+ To learn how to run this app yourself, visit our
55
+ <a href="https://docs.dbos.dev/quickstart?language=typescript" class="text-blue-600 hover:underline">Quickstart</a>.
56
+ </p><p class="mb-2">
57
+ Then, to learn how to build crashproof apps, continue to our
58
+ <a href="https://docs.dbos.dev/typescript/programming-guide" class="text-blue-600 hover:underline">Programming Guide</a>.<br>
59
+ </p>
60
+ </body>
61
+ </html>`;
62
+ return page;
63
+ }
64
+ }
65
+
66
+ // Now, let's create an Express app and define some routes.
67
+ export const app = express();
68
+ // Parse JSON payloads and make it available to req.body
69
+ app.use(express.json());
70
+
71
+ // We'll serve the README at the root of the app
72
+ app.get("/", async (_, res) => {
73
+ res.send(await Hello.readme());
74
+ });
75
+
76
+ // Serve this function from HTTP GET requests at the /greeting endpoint with 'user' as a path parameter
77
+ // The handler will in turn call a reliable DBOS operation (helloTransaction) to greet the user
78
+ app.get("/greeting/:user", async (req, res) => {
79
+ const { user } = req.params;
80
+ res.send(await Hello.helloTransaction(user));
81
+ });
@@ -0,0 +1,40 @@
1
+ const { execSync } = require('child_process');
2
+
3
+ // Default PostgreSQL port
4
+ let port = '5432';
5
+
6
+ // Set the host PostgreSQL port with the -p/--port flag.
7
+ process.argv.forEach((val, index) => {
8
+ if (val === '-p' || val === '--port') {
9
+ if (process.argv[index + 1]) {
10
+ port = process.argv[index + 1];
11
+ }
12
+ }
13
+ });
14
+
15
+ if (!process.env.PGPASSWORD) {
16
+ console.error("Error: PGPASSWORD is not set.");
17
+ process.exit(1);
18
+ }
19
+
20
+ try {
21
+ execSync(`docker run --rm --name=dbos-db --env=POSTGRES_PASSWORD="${process.env.PGPASSWORD}" --env=PGDATA=/var/lib/postgresql/data --volume=/var/lib/postgresql/data -p ${port}:5432 -d sibedge/postgres-plv8`);
22
+ console.log("Waiting for PostgreSQL to start...");
23
+
24
+ let attempts = 30;
25
+ const checkDatabase = setInterval(() => {
26
+ try {
27
+ execSync('docker exec dbos-db psql -U postgres -c "SELECT 1;"', { stdio: 'ignore' });
28
+ console.log("PostgreSQL started!");
29
+ clearInterval(checkDatabase);
30
+ console.log("Database started successfully!");
31
+ } catch (error) {
32
+ if (--attempts === 0) {
33
+ clearInterval(checkDatabase);
34
+ console.error("Failed to start PostgreSQL.");
35
+ }
36
+ }
37
+ }, 1000);
38
+ } catch (error) {
39
+ console.error("Error starting PostgreSQL in Docker:", error.message);
40
+ }
@@ -0,0 +1,25 @@
1
+ /* Visit https://aka.ms/tsconfig to read more about this file */
2
+ {
3
+ "compilerOptions": {
4
+ "target": "esnext", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
5
+ "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
6
+ "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
7
+ "module": "Node16", /* Specify what module code is generated. */
8
+ "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
9
+ "declarationMap": true, /* Create sourcemaps for d.ts files. */
10
+ "sourceMap": true, /* Create source map files for emitted JavaScript files. */
11
+ "outDir": "./dist", /* Specify an output folder for all emitted files. */
12
+ "newLine": "lf", /* Set the newline character for emitting files. */
13
+ "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
14
+ "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
15
+ "strict": true, /* Enable all strict type-checking options. */
16
+ "skipLibCheck": true /* Skip type checking all .d.ts files. */
17
+ },
18
+ "include": [ /* Specifies an array of filenames or patterns to include in the program. */
19
+ "src"
20
+ ],
21
+ "exclude": [
22
+ "**/*.test.ts",
23
+ "dist"
24
+ ]
25
+ }
@@ -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,55 @@
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/tutorials/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-sdk migrate
40
+ ```
41
+
42
+ If successful, the migration should print `Migration successful!`.
43
+
44
+ Finally, run the app:
45
+
46
+ ```bash
47
+ npx dbos-sdk 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/getting-started/quickstart-programming).
54
+ - To learn how to deploy your application to DBOS Cloud, visit our [cloud quickstart](https://docs.dbos.dev/getting-started/quickstart-cloud/)
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/dbos-transact).
@@ -0,0 +1,20 @@
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
@@ -0,0 +1,28 @@
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
+ });
@@ -0,0 +1,144 @@
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
@@ -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,20 @@
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;
@@ -0,0 +1,18 @@
1
+ const { Knex } = require("knex");
2
+
3
+ exports.up = async function(knex) {
4
+ await knex.schema.createTable('dbos_hello', table => {
5
+ table.text('name').primary();
6
+ table.integer('greet_count').defaultTo(0);
7
+ });
8
+
9
+ return knex.schema.createTable('dbos_greetings', table => {
10
+ table.text('greeting_name');
11
+ table.text('greeting_note_content');
12
+ });
13
+ };
14
+
15
+ exports.down = async function(knex) {
16
+ await knex.schema.dropTable('dbos_greetings');
17
+ return knex.schema.dropTable('dbos_hello');
18
+ };
@@ -0,0 +1,7 @@
1
+ {
2
+ "watch": ["src/","migrations/"],
3
+ "ext": "ts,json",
4
+ "ignore": ["src/**/*.test.ts"],
5
+ "exec": "npm run build && npx dbos migrate && npm run start"
6
+ }
7
+
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "dbos-hello-v2",
3
+ "version": "0.0.1",
4
+ "scripts": {
5
+ "build": "tsc",
6
+ "test": "npx dbos rollback && npx dbos migrate && jest",
7
+ "dev": "nodemon",
8
+ "start": "npx dbos start"
9
+ },
10
+ "devDependencies": {
11
+ "@types/jest": "^29.5.12",
12
+ "@types/supertest": "^2.0.16",
13
+ "jest": "^29.7.0",
14
+ "nodemon": "^3.1.0",
15
+ "supertest": "^7.0.0",
16
+ "ts-jest": "^29.1.2",
17
+ "typescript": "^5.4.5"
18
+ },
19
+ "dependencies": {
20
+ "@dbos-inc/dbos-sdk": "file:../../../..",
21
+ "knex": "3.1.0"
22
+ }
23
+ }
@@ -0,0 +1,36 @@
1
+ import { DBOS } from "@dbos-inc/dbos-sdk";
2
+ import { Hello, dbos_hello } from "./operations";
3
+ import request from "supertest";
4
+
5
+ describe("operations-test", () => {
6
+ beforeAll(async () => {
7
+ await DBOS.launch();
8
+ });
9
+
10
+ afterAll(async () => {
11
+ await DBOS.shutdown();
12
+ });
13
+
14
+ /**
15
+ * Test the transaction.
16
+ */
17
+ test("test-transaction", async () => {
18
+ const res = await Hello.helloTransaction("dbos");
19
+ expect(res).toMatch("Hello, dbos! You have been greeted");
20
+
21
+ // Check the greet count.
22
+ const rows = await DBOS.executor.queryUserDB("SELECT * FROM dbos_hello WHERE name=$1", ["dbos"]) as dbos_hello[];
23
+ expect(rows[0].greet_count).toBe(1);
24
+ });
25
+
26
+ /**
27
+ * Test the HTTP endpoint.
28
+ */
29
+ test("test-endpoint", async () => {
30
+ const res = await request(DBOS.getHTTPHandlersCallback()).get(
31
+ "/greeting/dbos"
32
+ );
33
+ expect(res.statusCode).toBe(200);
34
+ expect(res.text).toMatch("Hello, dbos! You have been greeted");
35
+ });
36
+ });
@@ -0,0 +1,64 @@
1
+ // Welcome to DBOS!
2
+
3
+ // This is a sample "Hello" app built with DBOS.
4
+ // It greets visitors and keeps track of how many times each visitor has been greeted.
5
+
6
+ // First, let's import DBOS
7
+ import { DBOS } from "@dbos-inc/dbos-sdk";
8
+
9
+ // Then, let's declare a type representing the "dbos_hello" database table
10
+ export interface dbos_hello {
11
+ name: string;
12
+ greet_count: number;
13
+ }
14
+
15
+ // Now let's define a class with some static functions.
16
+ // DBOS uses TypeScript decorators to automatically make your functions reliable, so they need to be static.
17
+ export class Hello {
18
+ // Serve this function from HTTP GET requests at the /greeting endpoint with 'user' as a path parameter
19
+ @DBOS.getApi("/greeting/:user")
20
+ @DBOS.transaction() // Run this function as a database transaction
21
+ static async helloTransaction(user: string) {
22
+ // Retrieve and increment the number of times this user has been greeted.
23
+ 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;";
24
+ const { rows } = (await DBOS.knexClient.raw(query, [user])) as { rows: dbos_hello[] };
25
+ const greet_count = rows[0].greet_count;
26
+ const greeting = `Hello, ${user}! You have been greeted ${greet_count} times.`;
27
+ return Hello.makeHTML(greeting);
28
+ }
29
+
30
+ // Serve a quick readme for the app at the / endpoint
31
+ @DBOS.getApi("/")
32
+ static async readme() {
33
+ const message = Hello.makeHTML(
34
+ `Visit the route <code class="bg-gray-100 px-1 rounded">/greeting/{name}</code> to be greeted!<br>
35
+ 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>
36
+ The counter increments with each page visit.`
37
+ );
38
+ return Promise.resolve(message);
39
+ }
40
+
41
+ // A helper function to create HTML pages with some styling
42
+ static makeHTML(message: string) {
43
+ const page = `
44
+ <!DOCTYPE html>
45
+ <html lang="en">
46
+ <head>
47
+ <title>DBOS Template App</title>
48
+ <script src="https://cdn.tailwindcss.com"></script>
49
+ </head>
50
+ <body class="font-sans text-gray-800 p-6 max-w-2xl mx-auto">
51
+ <h1 class="text-3xl font-semibold mb-4">Welcome to DBOS!</h1>
52
+ <p class="mt-8 mb-8">` + message + `</p>
53
+ <p class="mb-2">
54
+ To learn how to run this app yourself, visit our
55
+ <a href="https://docs.dbos.dev/quickstart?language=typescript" class="text-blue-600 hover:underline">Quickstart</a>.
56
+ </p><p class="mb-2">
57
+ Then, to learn how to build crashproof apps, continue to our
58
+ <a href="https://docs.dbos.dev/typescript/programming-guide" class="text-blue-600 hover:underline">Programming Guide</a>.<br>
59
+ </p>
60
+ </body>
61
+ </html>`;
62
+ return page;
63
+ }
64
+ }
@@ -0,0 +1,40 @@
1
+ const { execSync } = require('child_process');
2
+
3
+ // Default PostgreSQL port
4
+ let port = '5432';
5
+
6
+ // Set the host PostgreSQL port with the -p/--port flag.
7
+ process.argv.forEach((val, index) => {
8
+ if (val === '-p' || val === '--port') {
9
+ if (process.argv[index + 1]) {
10
+ port = process.argv[index + 1];
11
+ }
12
+ }
13
+ });
14
+
15
+ if (!process.env.PGPASSWORD) {
16
+ console.error("Error: PGPASSWORD is not set.");
17
+ process.exit(1);
18
+ }
19
+
20
+ try {
21
+ execSync(`docker run --rm --name=dbos-db --env=POSTGRES_PASSWORD="${process.env.PGPASSWORD}" --env=PGDATA=/var/lib/postgresql/data --volume=/var/lib/postgresql/data -p ${port}:5432 -d sibedge/postgres-plv8`);
22
+ console.log("Waiting for PostgreSQL to start...");
23
+
24
+ let attempts = 30;
25
+ const checkDatabase = setInterval(() => {
26
+ try {
27
+ execSync('docker exec dbos-db psql -U postgres -c "SELECT 1;"', { stdio: 'ignore' });
28
+ console.log("PostgreSQL started!");
29
+ clearInterval(checkDatabase);
30
+ console.log("Database started successfully!");
31
+ } catch (error) {
32
+ if (--attempts === 0) {
33
+ clearInterval(checkDatabase);
34
+ console.error("Failed to start PostgreSQL.");
35
+ }
36
+ }
37
+ }, 1000);
38
+ } catch (error) {
39
+ console.error("Error starting PostgreSQL in Docker:", error.message);
40
+ }
@@ -0,0 +1,25 @@
1
+ /* Visit https://aka.ms/tsconfig to read more about this file */
2
+ {
3
+ "compilerOptions": {
4
+ "target": "esnext", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
5
+ "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
6
+ "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
7
+ "module": "Node16", /* Specify what module code is generated. */
8
+ "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
9
+ "declarationMap": true, /* Create sourcemaps for d.ts files. */
10
+ "sourceMap": true, /* Create source map files for emitted JavaScript files. */
11
+ "outDir": "./dist", /* Specify an output folder for all emitted files. */
12
+ "newLine": "lf", /* Set the newline character for emitting files. */
13
+ "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
14
+ "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
15
+ "strict": true, /* Enable all strict type-checking options. */
16
+ "skipLibCheck": true /* Skip type checking all .d.ts files. */
17
+ },
18
+ "include": [ /* Specifies an array of filenames or patterns to include in the program. */
19
+ "src"
20
+ ],
21
+ "exclude": [
22
+ "**/*.test.ts",
23
+ "dist"
24
+ ]
25
+ }