@dbos-inc/create 3.0.46-preview.g649d101bf0 → 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.46-preview.g649d101bf0",
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,8 +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
- connectionString: process.env.DBOS_DATABASE_URL ?? 'postgres://postgres:dbos@localhost:5432/dbos_drizzle',
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'}`,
15
17
  };
16
18
 
17
19
  const drizzleds = new DrizzleDataSource<NodePgDatabase>('app-db', config);
@@ -91,7 +93,7 @@ async function main() {
91
93
  name: 'dbos-drizzle',
92
94
  databaseUrl: process.env.DBOS_DATABASE_URL,
93
95
  });
94
- await DBOS.launch({ expressApp: app });
96
+ await DBOS.launch();
95
97
  const PORT = parseInt(process.env.NODE_PORT || '3000');
96
98
  const ENV = process.env.NODE_ENV || 'development';
97
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,7 +9,9 @@ import { KnexDataSource } from '@dbos-inc/knex-datasource';
9
9
 
10
10
  const config = {
11
11
  client: 'pg',
12
- connection: process.env.DBOS_DATABASE_URL ?? 'postgres://postgres:dbos@localhost:5432/dbos_knex',
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'}`,
13
15
  };
14
16
 
15
17
  const knexds = new KnexDataSource('app-db', config);
@@ -104,7 +106,7 @@ async function main() {
104
106
  name: 'dbos-knex',
105
107
  databaseUrl: process.env.DBOS_DATABASE_URL,
106
108
  });
107
- await DBOS.launch({ expressApp: app });
109
+ await DBOS.launch();
108
110
  const PORT = parseInt(process.env.NODE_PORT || '3000');
109
111
  const ENV = process.env.NODE_ENV || 'development';
110
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,7 +10,9 @@ import { DBOSHello } from '../entities/DBOSHello';
10
10
  import { TypeOrmDataSource } from '@dbos-inc/typeorm-datasource';
11
11
 
12
12
  const config = {
13
- connectionString: process.env.DBOS_DATABASE_URL ?? 'postgres://postgres:dbos@localhost:5432/dbos_typeorm',
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'}`,
14
16
  };
15
17
 
16
18
  const dataSource = new TypeOrmDataSource('app-db', config, [DBOSHello]);
@@ -89,7 +91,7 @@ async function main() {
89
91
  name: 'dbos-typeorm',
90
92
  databaseUrl: process.env.DBOS_DATABASE_URL,
91
93
  });
92
- await DBOS.launch({ expressApp: app });
94
+ await DBOS.launch();
93
95
  const PORT = parseInt(process.env.NODE_PORT || '3000');
94
96
  const ENV = process.env.NODE_ENV || 'development';
95
97