@geekmidas/events 1.1.1 → 1.1.2
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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @geekmidas/events
|
|
2
2
|
|
|
3
|
+
## 1.1.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 🐛 [`aeba918`](https://github.com/geekmidas/toolbox/commit/aeba918fc258f6ccdb96b8273b2bc01bd2190553) Thanks [@geekmidas](https://github.com/geekmidas)! - Fix schema, openapi generation and events testkit
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`aeba918`](https://github.com/geekmidas/toolbox/commit/aeba918fc258f6ccdb96b8273b2bc01bd2190553)]:
|
|
10
|
+
- @geekmidas/schema@1.0.1
|
|
11
|
+
|
|
3
12
|
## 1.1.1
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geekmidas/events",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"@aws-sdk/client-sqs": "~3.908.0",
|
|
51
51
|
"@aws-sdk/client-sns": "~3.908.0",
|
|
52
52
|
"pg-boss": ">=12.0.0",
|
|
53
|
-
"@geekmidas/schema": "^1.0.
|
|
53
|
+
"@geekmidas/schema": "^1.0.1"
|
|
54
54
|
},
|
|
55
55
|
"peerDependenciesMeta": {
|
|
56
56
|
"@geekmidas/schema": {
|
|
@@ -72,7 +72,9 @@
|
|
|
72
72
|
"devDependencies": {
|
|
73
73
|
"@types/amqplib": "~0.10.7",
|
|
74
74
|
"@types/lodash.chunk": "~4.2.0",
|
|
75
|
+
"@types/pg": "~8.15.6",
|
|
76
|
+
"pg": "~8.20.0",
|
|
75
77
|
"pg-boss": "~12.18.1",
|
|
76
|
-
"@geekmidas/schema": "^1.0.
|
|
78
|
+
"@geekmidas/schema": "^1.0.1"
|
|
77
79
|
}
|
|
78
80
|
}
|
|
@@ -3,6 +3,7 @@ import type { PublishableMessage } from '../../types';
|
|
|
3
3
|
import { PgBossConnection } from '../PgBossConnection';
|
|
4
4
|
import { PgBossPublisher } from '../PgBossPublisher';
|
|
5
5
|
import { PgBossSubscriber } from '../PgBossSubscriber';
|
|
6
|
+
import { dropSchemas } from './setup';
|
|
6
7
|
|
|
7
8
|
type TestMessage =
|
|
8
9
|
| PublishableMessage<'user.created', { userId: string }>
|
|
@@ -12,6 +13,18 @@ const POSTGRES_URL = 'postgres://geekmidas:geekmidas@localhost:5432/geekmidas';
|
|
|
12
13
|
const PGBOSS_CONNECTION_STRING =
|
|
13
14
|
'pgboss://geekmidas:geekmidas@localhost:5432/geekmidas?schema=pgboss_test';
|
|
14
15
|
|
|
16
|
+
const TEST_SCHEMAS = [
|
|
17
|
+
'pgboss_conn_test',
|
|
18
|
+
'pgboss_conn_test2',
|
|
19
|
+
'pgboss_test',
|
|
20
|
+
'pgboss_pub_test',
|
|
21
|
+
'pgboss_sub_test',
|
|
22
|
+
];
|
|
23
|
+
|
|
24
|
+
beforeAll(async () => {
|
|
25
|
+
await dropSchemas(POSTGRES_URL, TEST_SCHEMAS);
|
|
26
|
+
});
|
|
27
|
+
|
|
15
28
|
const uniqueQueue = () =>
|
|
16
29
|
`test-${Date.now()}-${Math.random().toString(36).substring(7)}`;
|
|
17
30
|
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Client } from 'pg';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Drop the named schemas if they exist. Run before pg-boss tests so that
|
|
5
|
+
* pg-boss's contractor performs a fresh `create` rather than attempting to
|
|
6
|
+
* migrate from a stale layout left behind by an older pg-boss version.
|
|
7
|
+
*/
|
|
8
|
+
export async function dropSchemas(
|
|
9
|
+
connectionString: string,
|
|
10
|
+
schemas: string[],
|
|
11
|
+
): Promise<void> {
|
|
12
|
+
const client = new Client({ connectionString });
|
|
13
|
+
await client.connect();
|
|
14
|
+
try {
|
|
15
|
+
for (const schema of schemas) {
|
|
16
|
+
await client.query(`DROP SCHEMA IF EXISTS "${schema}" CASCADE`);
|
|
17
|
+
}
|
|
18
|
+
} finally {
|
|
19
|
+
await client.end();
|
|
20
|
+
}
|
|
21
|
+
}
|