@superhero/eventflow-db 4.7.23 → 4.7.26

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,3 +1,21 @@
1
+ ---
2
+ #### v4.7.26
3
+ ---\n\nVersion alignment...
4
+
5
+ ---
6
+ #### v4.7.26
7
+ ---\n\nVersion alignment...
8
+
9
+ ---
10
+ #### v4.7.25
11
+ ---\n\nVersion alignment...
12
+
13
+ ---
14
+ #### v4.7.24
15
+ ---
16
+
17
+ ...
18
+
1
19
  ---
2
20
  #### v4.7.23
3
21
  ---\n\nVersion alignment...
package/index.js CHANGED
@@ -7,15 +7,8 @@ import { fileURLToPath } from 'node:url'
7
7
 
8
8
  export function locate(locator)
9
9
  {
10
- const
11
- config = locator.config.find('eventflow/db', {}),
12
- adapterFactory = new AdapterFactory(),
13
- adapter = adapterFactory.create(mysql2, config),
14
- filePath = fileURLToPath(path.join(path.dirname(import.meta.url), 'sql')),
15
- fileSuffix = '.sql',
16
- gateway = new Gateway(adapter, filePath, fileSuffix)
17
-
18
- return new DB(gateway)
10
+ const config = locator.config.find('eventflow/db', {})
11
+ return new DB(config)
19
12
  }
20
13
 
21
14
  /**
@@ -25,8 +18,15 @@ export default class DB
25
18
  {
26
19
  escape = mysql2.escape
27
20
 
28
- constructor(gateway)
21
+ constructor(config)
29
22
  {
23
+ const
24
+ adapterFactory = new AdapterFactory(),
25
+ adapter = adapterFactory.create(mysql2, config),
26
+ filePath = fileURLToPath(path.join(path.dirname(import.meta.url), 'sql')),
27
+ fileSuffix = '.sql',
28
+ gateway = new Gateway(adapter, filePath, fileSuffix)
29
+
30
30
  this.gateway = gateway
31
31
  }
32
32
 
package/index.test.js CHANGED
@@ -137,7 +137,7 @@ suite('@superhero/eventflow-db', async () =>
137
137
  await sub.test('Persist event cpid association', async (sub) =>
138
138
  {
139
139
  const cpid = 'test_cpid'
140
- const success = await db.persistEventCpid(event.id, cpid)
140
+ const success = await db.persistEventCpid(event.id, event.domain, cpid)
141
141
  assert.ok(success, 'Event cpid association should be persisted')
142
142
 
143
143
  await sub.test('Read events by domain and cpid', async () =>
@@ -150,12 +150,12 @@ suite('@superhero/eventflow-db', async () =>
150
150
  {
151
151
  const readCpid = await db.readEventCpidByEventId(event.id)
152
152
  assert.ok(readCpid.length > 0, 'Event cpid association should be found')
153
- assert.equal(readCpid[0], cpid)
153
+ assert.deepEqual(readCpid[0], { cpid, domain:event.domain })
154
154
  })
155
155
 
156
156
  await sub.test('Delete associated cpid by event id', async () =>
157
157
  {
158
- const success = await db.deleteEventCpid(event.id, cpid)
158
+ const success = await db.deleteEventCpid(event.id, event.domain, cpid)
159
159
  assert.ok(success, 'Event cpid association should be deleted')
160
160
  })
161
161
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superhero/eventflow-db",
3
- "version": "4.7.23",
3
+ "version": "4.7.26",
4
4
  "description": "Eventflow db is a set of common database logic in the eventflow ecosystem.",
5
5
  "keywords": [
6
6
  "eventflow"
@@ -21,9 +21,9 @@
21
21
  "@superhero/db": "^0.5.2"
22
22
  },
23
23
  "devDependencies": {
24
- "@superhero/audit": "4.7.23",
24
+ "@superhero/audit": "4.7.26",
25
25
  "@superhero/syntax-check": "0.0.2",
26
- "@superhero/locator": "4.7.23"
26
+ "@superhero/locator": "4.7.26"
27
27
  },
28
28
  "author": {
29
29
  "name": "Erik Landvall",