@dbos-inc/create 3.0.45-preview.g34e483ff45 → 3.0.50-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": "3.0.45-preview.g34e483ff45",
3
+ "version": "3.0.50-preview",
4
4
  "description": "Tool for performing project initialization from template",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -5,7 +5,6 @@
5
5
 
6
6
  name: dbos-drizzle
7
7
  language: node
8
- database_url: ${DBOS_DATABASE_URL}
9
8
  database:
10
9
  migrate:
11
10
  - npx drizzle-kit migrate
@@ -1,6 +1,7 @@
1
1
  import { DBOS } from '@dbos-inc/dbos-sdk';
2
- import { app, Hello } from './main';
2
+ import { app, config, Hello } from './main';
3
3
  import request from 'supertest';
4
+ import { Client } from 'pg';
4
5
 
5
6
  describe('operations-test', () => {
6
7
  beforeAll(async () => {
@@ -18,9 +19,14 @@ describe('operations-test', () => {
18
19
  const res = await Hello.helloTransaction('dbos');
19
20
  expect(res).toMatch('Hello, dbos! We have made');
20
21
 
21
- // Check the greet count.
22
- const rows = await DBOS.queryUserDB('SELECT * FROM dbos_hello WHERE greet_count=1');
23
- expect(rows.length).toEqual(1);
22
+ const client = new Client(config);
23
+ try {
24
+ await client.connect();
25
+ const rows = await client.query('SELECT * FROM dbos_hello WHERE greet_count=1');
26
+ expect(rows.rows.length).toEqual(1);
27
+ } finally {
28
+ await client.end();
29
+ }
24
30
  });
25
31
 
26
32
  /**
@@ -10,12 +10,10 @@ import { dbosHello } from './schema';
10
10
  import { DrizzleDataSource } from '@dbos-inc/drizzle-datasource';
11
11
  import { NodePgDatabase } from 'drizzle-orm/node-postgres';
12
12
 
13
- const config = {
14
- host: process.env.PGHOST || 'localhost',
15
- port: parseInt(process.env.PGPORT || '5432'),
16
- database: process.env.PGDATABASE || 'dbos_drizzle',
17
- user: process.env.PGUSER || 'postgres',
18
- password: process.env.PGPASSWORD || 'dbos',
13
+ export const config = {
14
+ connectionString:
15
+ process.env.DBOS_DATABASE_URL ||
16
+ `postgresql://${process.env.PGUSER || 'postgres'}:${process.env.PGPASSWORD || 'dbos'}@${process.env.PGHOST || 'localhost'}:${process.env.PGPORT || '5432'}/${process.env.PGDATABASE || 'dbos_drizzle'}`,
19
17
  };
20
18
 
21
19
  const drizzleds = new DrizzleDataSource<NodePgDatabase>('app-db', config);
@@ -95,7 +93,7 @@ async function main() {
95
93
  name: 'dbos-drizzle',
96
94
  databaseUrl: process.env.DBOS_DATABASE_URL,
97
95
  });
98
- await DBOS.launch({ expressApp: app });
96
+ await DBOS.launch();
99
97
  const PORT = parseInt(process.env.NODE_PORT || '3000');
100
98
  const ENV = process.env.NODE_ENV || 'development';
101
99
 
@@ -5,7 +5,6 @@
5
5
 
6
6
  name: dbos-knex
7
7
  language: node
8
- database_url: ${DBOS_DATABASE_URL}
9
8
  database:
10
9
  migrate:
11
10
  - npx knex migrate:latest
@@ -4,7 +4,7 @@ import request from 'supertest';
4
4
 
5
5
  describe('operations-test', () => {
6
6
  beforeAll(async () => {
7
- await DBOS.launch({ expressApp: app });
7
+ await DBOS.launch();
8
8
  });
9
9
 
10
10
  afterAll(async () => {
@@ -9,13 +9,9 @@ import { KnexDataSource } from '@dbos-inc/knex-datasource';
9
9
 
10
10
  const config = {
11
11
  client: 'pg',
12
- connection: {
13
- host: process.env.PGHOST || 'localhost',
14
- port: parseInt(process.env.PGPORT || '5432'),
15
- database: process.env.PGDATABASE || 'dbos_knex',
16
- user: process.env.PGUSER || 'postgres',
17
- password: process.env.PGPASSWORD || 'dbos',
18
- },
12
+ connection:
13
+ process.env.DBOS_DATABASE_URL ||
14
+ `postgresql://${process.env.PGUSER || 'postgres'}:${process.env.PGPASSWORD || 'dbos'}@${process.env.PGHOST || 'localhost'}:${process.env.PGPORT || '5432'}/${process.env.PGDATABASE || 'dbos_knex'}`,
19
15
  };
20
16
 
21
17
  const knexds = new KnexDataSource('app-db', config);
@@ -110,7 +106,7 @@ async function main() {
110
106
  name: 'dbos-knex',
111
107
  databaseUrl: process.env.DBOS_DATABASE_URL,
112
108
  });
113
- await DBOS.launch({ expressApp: app });
109
+ await DBOS.launch();
114
110
  const PORT = parseInt(process.env.NODE_PORT || '3000');
115
111
  const ENV = process.env.NODE_ENV || 'development';
116
112
 
@@ -5,7 +5,6 @@
5
5
 
6
6
  name: dbos-prisma
7
7
  language: node
8
- database_url: ${DBOS_DATABASE_URL}
9
8
  database:
10
9
  migrate:
11
10
  - npx prisma migrate deploy
@@ -10,6 +10,7 @@ import { PrismaClient } from '@prisma/client';
10
10
  import { PrismaDataSource } from '@dbos-inc/prisma-datasource';
11
11
 
12
12
  process.env['DATABASE_URL'] =
13
+ process.env['DBOS_DATABASE_URL'] ||
13
14
  process.env['DATABASE_URL'] ||
14
15
  `postgresql://${process.env.PGUSER || 'postgres'}:${process.env.PGPASSWORD || 'dbos'}@${process.env.PGHOST || 'localhost'}:${process.env.PGPORT || '5432'}/${process.env.PGDATABASE || 'dbos_prisma'}`;
15
16
 
@@ -93,7 +94,7 @@ async function main() {
93
94
  name: 'dbos-prisma',
94
95
  databaseUrl: process.env.DBOS_DATABASE_URL,
95
96
  });
96
- await DBOS.launch({ expressApp: app });
97
+ await DBOS.launch();
97
98
  const PORT = parseInt(process.env.NODE_PORT || '3000');
98
99
  const ENV = process.env.NODE_ENV || 'development';
99
100
 
@@ -5,7 +5,6 @@
5
5
 
6
6
  name: dbos-typeorm
7
7
  language: node
8
- database_url: ${DBOS_DATABASE_URL}
9
8
  database:
10
9
  migrate:
11
10
  - npx typeorm migration:run -d dist/datasource.js
@@ -10,11 +10,9 @@ import { DBOSHello } from '../entities/DBOSHello';
10
10
  import { TypeOrmDataSource } from '@dbos-inc/typeorm-datasource';
11
11
 
12
12
  const config = {
13
- host: process.env.PGHOST || 'localhost',
14
- port: parseInt(process.env.PGPORT || '5432'),
15
- database: process.env.PGDATABASE || 'dbos_typeorm',
16
- user: process.env.PGUSER || 'postgres',
17
- password: process.env.PGPASSWORD || 'dbos',
13
+ connectionString:
14
+ process.env.DBOS_DATABASE_URL ||
15
+ `postgresql://${process.env.PGUSER || 'postgres'}:${process.env.PGPASSWORD || 'dbos'}@${process.env.PGHOST || 'localhost'}:${process.env.PGPORT || '5432'}/${process.env.PGDATABASE || 'dbos_typeorm'}`,
18
16
  };
19
17
 
20
18
  const dataSource = new TypeOrmDataSource('app-db', config, [DBOSHello]);
@@ -93,7 +91,7 @@ async function main() {
93
91
  name: 'dbos-typeorm',
94
92
  databaseUrl: process.env.DBOS_DATABASE_URL,
95
93
  });
96
- await DBOS.launch({ expressApp: app });
94
+ await DBOS.launch();
97
95
  const PORT = parseInt(process.env.NODE_PORT || '3000');
98
96
  const ENV = process.env.NODE_ENV || 'development';
99
97