@sipgate/integration-bridge 0.1.1 → 0.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/README.md CHANGED
@@ -27,7 +27,7 @@ const { ServerError } = bridge;
27
27
 
28
28
  const adapter = {
29
29
  getContacts: async ({ apiKey, apiUrl }) => {
30
- // Fetch contacts using apiKey and apiUrl or throw on error
30
+ // Fetch contacts using apiUrl and apiKey
31
31
  const response = await fetch(`${apiUrl}/api/contacts`, {
32
32
  headers: { Authorization: `Bearer ${apiKey}` },
33
33
  });
@@ -40,8 +40,8 @@ const adapter = {
40
40
  throw new ServerError(500, "Could not fetch contacts");
41
41
  }
42
42
 
43
+ // TODO: Convert contacts to the structure below
43
44
  const contacts = await response.json();
44
- // TODO: Convert contact to the structure below
45
45
  return contacts;
46
46
  },
47
47
  };
@@ -75,8 +75,8 @@ Contacts are accepted in this format:
75
75
 
76
76
  The sipgate Integration Bridge supports configuration through the following environment variables:
77
77
 
78
- - `OAUTH2_REDIRECT_URL`: URL for to redirect the user at the end of the OAuth2 flow
79
- - `OAUTH2_IDENTIFIER`: Name of the Integration to identify credentials
78
+ - `OAUTH2_REDIRECT_URL`: URL to redirect the user at the end of the OAuth2 flow
79
+ - `OAUTH2_IDENTIFIER`: Name of the Integration to identify credentials in uppercase e. g. "MY_CRM"
80
80
  - `REDIS_URL`: URL of a Redis instance to cache responses, otherwise memory cache will be used
81
81
  - `CACHE_DISABLED`: Disable caching
82
82
  - `CACHE_REFRESH_INTERVAL`: Time a contact in cache is not refreshed (in seconds), only used if redis or memory cache is active
@@ -8,12 +8,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
11
  Object.defineProperty(exports, "__esModule", { value: true });
15
12
  exports.RedisStorageAdapter = void 0;
16
- const redis_1 = __importDefault(require("redis"));
13
+ const redis_1 = require("redis");
17
14
  const util_1 = require("util");
18
15
  const zlib_1 = require("zlib");
19
16
  const inflate = (0, util_1.promisify)(zlib_1.inflate);
@@ -21,7 +18,7 @@ const deflate = (0, util_1.promisify)(zlib_1.deflate);
21
18
  const CACHE_TTL = 60 * 60 * 24 * 30; // 30 days
22
19
  class RedisStorageAdapter {
23
20
  constructor(url) {
24
- this.client = redis_1.default.createClient({ url });
21
+ this.client = (0, redis_1.createClient)({ url });
25
22
  console.log(`Initialized Redis storage with URL ${url}`);
26
23
  this.client.on("error", (error) => {
27
24
  console.warn("Redis error: ", error.message);
@@ -1 +1 @@
1
- {"version":3,"file":"redis-storage-adapter.js","sourceRoot":"","sources":["../../../src/cache/storage/redis-storage-adapter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,kDAA+C;AAC/C,+BAAiC;AACjC,+BAIc;AAGd,MAAM,OAAO,GAAG,IAAA,gBAAS,EAAoB,cAAW,CAAC,CAAC;AAC1D,MAAM,OAAO,GAAG,IAAA,gBAAS,EAAoB,cAAW,CAAC,CAAC;AAE1D,MAAM,SAAS,GAAW,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,UAAU;AAEvD,MAAa,mBAAmB;IAG9B,YAAY,GAAW;QACrB,IAAI,CAAC,MAAM,GAAG,eAAK,CAAC,YAAY,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;QAE1C,OAAO,CAAC,GAAG,CAAC,sCAAsC,GAAG,EAAE,CAAC,CAAC;QACzD,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;YAChC,OAAO,CAAC,IAAI,CAAC,eAAe,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;QAC/C,CAAC,CAAC,CAAC;IACL,CAAC;IAEY,GAAG,CAAC,GAAW;;YAC1B,IAAI;gBACF,MAAM,KAAK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ANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sipgate/integration-bridge",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "sipgate Integration Bridge Framework",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",