@dbos-inc/drizzle-datasource 5.2.11 → 5.3.0
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/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/index.ts +0 -368
- package/jest.config.js +0 -8
- package/tests/config.test.ts +0 -31
- package/tests/custom-pool.test.ts +0 -130
- package/tests/datasource.test.ts +0 -754
- package/tests/esm-consumer.mts +0 -8
- package/tests/esmtypes.test.ts +0 -27
- package/tests/test-helpers.ts +0 -13
- package/tests/tsconfig.esmcheck.json +0 -11
- package/tsconfig.json +0 -9
package/tests/esm-consumer.mts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
// Typechecked by esmtypes.test.ts, never executed: .mts makes it ESM regardless of the package type.
|
|
2
|
-
import { DrizzleDataSource } from '@dbos-inc/drizzle-datasource';
|
|
3
|
-
import type { NodePgDatabase } from 'drizzle-orm/node-postgres';
|
|
4
|
-
|
|
5
|
-
declare const dataSource: DrizzleDataSource;
|
|
6
|
-
|
|
7
|
-
export const instanceClient: NodePgDatabase<{ [key: string]: object }> = dataSource.client;
|
|
8
|
-
export const staticClient: NodePgDatabase<{ [key: string]: object }> = DrizzleDataSource.client;
|
package/tests/esmtypes.test.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { execFileSync } from 'child_process';
|
|
2
|
-
import { readFileSync } from 'fs';
|
|
3
|
-
import path from 'path';
|
|
4
|
-
|
|
5
|
-
const packageRoot = path.join(__dirname, '..');
|
|
6
|
-
|
|
7
|
-
describe('ESM type declarations', () => {
|
|
8
|
-
test('an ESM consumer under NodeNext typechecks against the built declarations', () => {
|
|
9
|
-
const tsc = require.resolve('typescript/bin/tsc');
|
|
10
|
-
const project = path.join(__dirname, 'tsconfig.esmcheck.json');
|
|
11
|
-
try {
|
|
12
|
-
execFileSync(process.execPath, [tsc, '--project', project], { cwd: packageRoot, stdio: 'pipe' });
|
|
13
|
-
} catch (error) {
|
|
14
|
-
const { stdout } = error as { stdout?: Buffer };
|
|
15
|
-
throw new Error(`ESM consumer failed to typecheck. Run 'npm run build' first.\n${stdout?.toString() ?? ''}`);
|
|
16
|
-
}
|
|
17
|
-
}, 120000);
|
|
18
|
-
|
|
19
|
-
test('the ESM declarations carry no reference to the CommonJS declaration map', () => {
|
|
20
|
-
const declarations = readFileSync(path.join(packageRoot, 'dist', 'index.d.mts'), 'utf8');
|
|
21
|
-
expect(declarations).not.toContain('sourceMappingURL');
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
test('the exports map still resolves the package manifest', () => {
|
|
25
|
-
expect(() => require.resolve('@dbos-inc/drizzle-datasource/package.json')).not.toThrow();
|
|
26
|
-
});
|
|
27
|
-
});
|
package/tests/test-helpers.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Client } from 'pg';
|
|
2
|
-
|
|
3
|
-
export async function ensureDB(client: Client, name: string) {
|
|
4
|
-
const results = await client.query('SELECT 1 FROM pg_database WHERE datname = $1', [name]);
|
|
5
|
-
if (results.rows.length === 0) {
|
|
6
|
-
await client.query(`CREATE DATABASE ${name}`);
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export async function dropDB(client: Client, name: string, force: boolean = false) {
|
|
11
|
-
const withForce = force ? ' WITH (FORCE)' : '';
|
|
12
|
-
await client.query(`DROP DATABASE IF EXISTS ${name} ${withForce}`);
|
|
13
|
-
}
|