@go-mailer/jarvis 4.0.1 → 4.0.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.
@@ -57,7 +57,6 @@ function RequestLogger() {
57
57
  };
58
58
 
59
59
  let error = payload ? payload.error : statusMessage;
60
- console.log(pathname, hashLogData(log))
61
60
  // if (error) {
62
61
  // log.error = error;
63
62
  // logtail.error(pathname, hashLogData(log));
@@ -86,7 +85,7 @@ class ProcessLogger {
86
85
  // params,
87
86
  // }));
88
87
  // logtail.flush();
89
- console.log(`${this.service}:${method}:${error.message}`)
88
+ console.log(`${this.service}:${method}:${error.message}`, error.stack)
90
89
  }
91
90
 
92
91
  info(info, method = "unspecified_method", params = {}) {
@@ -1,4 +1,5 @@
1
- const { Client } = require('redis-om')
1
+ const { createClient } = require('redis')
2
+ const { Repository } = require('redis-om')
2
3
  const Schemas = require('./schemas')
3
4
 
4
5
  class RedisClient {
@@ -8,7 +9,9 @@ class RedisClient {
8
9
 
9
10
  async connect (url = '') {
10
11
  try {
11
- this.client = await new Client().open(url)
12
+ this.client = createClient({ url })
13
+ this.client.on('error', e => console.log(`Redis connection: ${e.message}`))
14
+ await this.client.connect()
12
15
  console.log('Redis connection established')
13
16
  } catch (e) {
14
17
  console.log(`Redis connection: ${e.message}`)
@@ -19,14 +22,15 @@ class RedisClient {
19
22
  return this.client
20
23
  }
21
24
 
22
- register_schema (schema = {}) {
23
- const repo = this.client.fetchRepository(schema)
24
- repo.createIndex()
25
+ async register_schema (schema = {}) {
26
+ const repo = new Repository(schema, this.client)
27
+ await repo.createIndex()
25
28
  return repo
26
29
  }
27
30
  }
28
31
  //
32
+ const redisClient = new RedisClient()
29
33
  module.exports ={
30
- RedisClient: new RedisClient(),
34
+ RedisClient: redisClient,
31
35
  Schemas
32
36
  }
@@ -1,11 +1,10 @@
1
- const { Schema, Repository } = require('redis-om')
2
- const client = require('../index')
1
+ const { Schema } = require('redis-om')
3
2
 
4
3
  const CampaignSchema = new Schema('campaign', {
5
- id: {type: 'number'},
6
- status: {type: 'number'}
4
+ id: { type: 'number' },
5
+ status: { type: 'string' }
7
6
  })
8
7
 
9
8
  module.exports = {
10
- CampaignRepo: new Repository(CampaignSchema, client)
9
+ CampaignSchema
11
10
  }
@@ -1,10 +1,9 @@
1
- const { Schema, Repository } = require('redis-om')
2
- const client = require('../index')
1
+ const { Schema } = require('redis-om')
3
2
 
4
3
  const ContactImportSchema = new Schema('contactimport', {
5
4
  data: { type: 'string' }
6
5
  })
7
6
 
8
7
  module.exports = {
9
- contactImportRepo: new Repository(ContactImportSchema, client)
8
+ ContactImportSchema
10
9
  }
@@ -1,7 +1,7 @@
1
- const { CampaignRepo } = require('./Campaign')
2
- const { contactImportRepo } = require('./Contact')
1
+ const { CampaignSchema } = require('./Campaign')
2
+ const { ContactImportSchema } = require('./Contact')
3
3
 
4
4
  module.exports = {
5
- CampaignRepo,
6
- contactImportRepo
5
+ CampaignSchema,
6
+ ContactImportSchema
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@go-mailer/jarvis",
3
- "version": "4.0.1",
3
+ "version": "4.0.2",
4
4
  "main": "index.js",
5
5
  "repository": "git@github.com:go-mailer-ltd/jarvis-node.git",
6
6
  "author": "Nathan Oguntuberu <nateoguns.work@gmail.com>",