@superhero/eventflow-spoke 4.8.1 → 4.8.2-rc.0.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.
Files changed (3) hide show
  1. package/config.js +1 -1
  2. package/index.js +20 -20
  3. package/package.json +2 -2
package/config.js CHANGED
@@ -36,7 +36,7 @@ export default
36
36
  {
37
37
  NAME : process.env.EVENTFLOW_SPOKE_NAME ?? 'EVENTFLOW-SPOKE',
38
38
  TCP_SOCKET_CLIENT_OPTIONS : process.env.EVENTFLOW_SPOKE_TCP_SOCKET_CLIENT_OPTIONS,
39
-
39
+ SERDE : process.env.EVENTFLOW_SPOKE_SERDE,
40
40
  consume:
41
41
  {
42
42
  // '<event_domain>' : '*',
package/index.js CHANGED
@@ -372,16 +372,16 @@ export default class Spoke
372
372
  return this.idNameGenerator.generateId()
373
373
  }
374
374
 
375
- async publish(event)
375
+ async publish(event, serialize = this.config.SERDE)
376
376
  {
377
- const eventID = await this.persist(event)
377
+ const eventID = await this.persist(event, serialize)
378
378
  await this.db.persistEventPublished({ event_id:eventID, publisher:this.#spokeID })
379
379
  this.#broadcast('publish', event.domain, eventID, event.name, event.pid)
380
380
  this.log.info`published event ${eventID} › ${event.domain} › ${event.name} › ${event.pid}`
381
381
  return eventID
382
382
  }
383
383
 
384
- async schedule(scheduled, event)
384
+ async schedule(scheduled, event, serialize = this.config.SERDE)
385
385
  {
386
386
  const scheduledDate = new Date(scheduled)
387
387
 
@@ -395,15 +395,15 @@ export default class Spoke
395
395
 
396
396
  scheduled = scheduledDate.toJSON().replace('T', ' ').substring(0, 19)
397
397
 
398
- const eventID = await this.persist(event)
398
+ const eventID = await this.persist(event, serialize)
399
399
  await this.db.persistEventPublished({ event_id:eventID, publisher:this.#spokeID })
400
400
  await this.db.persistEventScheduled({ event_id:eventID, scheduled })
401
401
  this.log.info`scheduled event ${eventID} › ${event.domain} › ${event.name} › ${scheduled}`
402
402
  }
403
403
 
404
- async persist(event)
404
+ async persist(event, serialize = this.config.SERDE)
405
405
  {
406
- return await this.db.persistEvent(event)
406
+ return await this.db.persistEvent(event, serialize)
407
407
  }
408
408
 
409
409
  async persistEntityAssociation(event_id, eid)
@@ -426,39 +426,39 @@ export default class Spoke
426
426
  return await this.db.deleteEventByDomainAndPid(domain, pid)
427
427
  }
428
428
 
429
- async read(eventID)
429
+ async read(eventID, deserialize = this.config.SERDE)
430
430
  {
431
- return await this.db.readEvent(eventID)
431
+ return await this.db.readEvent(eventID, deserialize)
432
432
  }
433
433
 
434
- async readEventlog(domain, pid)
434
+ async readEventlog(domain, pid, deserialize = this.config.SERDE)
435
435
  {
436
- return await this.db.readEventsByDomainAndPid(domain, pid)
436
+ return await this.db.readEventsByDomainAndPid(domain, pid, deserialize)
437
437
  }
438
438
 
439
- async readEventlogByTimestamp(domain, pid, timestampMin, timestampMax)
439
+ async readEventlogByTimestamp(domain, pid, timestampMin, timestampMax, deserialize = this.config.SERDE)
440
440
  {
441
- return await this.db.readEventsByDomainAndPidBetweenTimestamps(domain, pid, timestampMin, timestampMax)
441
+ return await this.db.readEventsByDomainAndPidBetweenTimestamps(domain, pid, timestampMin, timestampMax, deserialize)
442
442
  }
443
443
 
444
- async readEventlogFilteredByNames(domain, pid, names)
444
+ async readEventlogFilteredByNames(domain, pid, names, deserialize = this.config.SERDE)
445
445
  {
446
- return await this.db.readEventsByDomainAndPidAndNames(domain, pid, names)
446
+ return await this.db.readEventsByDomainAndPidAndNames(domain, pid, names, deserialize)
447
447
  }
448
448
 
449
- async readEventlogByChildProcess(domain, cpid)
449
+ async readEventlogByChildProcess(domain, cpid, deserialize = this.config.SERDE)
450
450
  {
451
- return await this.db.readEventsByDomainAndCpid(domain, cpid)
451
+ return await this.db.readEventsByDomainAndCpid(domain, cpid, deserialize)
452
452
  }
453
453
 
454
- async readEventlogByEid(eid)
454
+ async readEventlogByEid(eid, deserialize = this.config.SERDE)
455
455
  {
456
- return await this.db.readEventsByEid(eid)
456
+ return await this.db.readEventsByEid(eid, deserialize)
457
457
  }
458
458
 
459
- async readEventlogByDomainAndEid(domain, eid)
459
+ async readEventlogByDomainAndEid(domain, eid, deserialize = this.config.SERDE)
460
460
  {
461
- return await this.db.readEventsByDomainAndEid(domain, eid)
461
+ return await this.db.readEventsByDomainAndEid(domain, eid, deserialize)
462
462
  }
463
463
 
464
464
  async readEventlogState(domain, pid)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superhero/eventflow-spoke",
3
- "version": "4.8.1",
3
+ "version": "4.8.2-rc.0.0",
4
4
  "description": "Eventflow spoke is the client component in the eventflow ecosystem.",
5
5
  "keywords": [
6
6
  "eventflow",
@@ -24,7 +24,7 @@
24
24
  "dependencies": {
25
25
  "@superhero/deep": "4.8.1",
26
26
  "@superhero/eventflow-certificates": "4.8.1",
27
- "@superhero/eventflow-db": "4.8.1",
27
+ "@superhero/eventflow-db": "4.8.2-rc.0.0",
28
28
  "@superhero/id-name-generator": "4.8.1",
29
29
  "@superhero/log": "4.8.1",
30
30
  "@superhero/tcp-record-channel": "4.8.1"