@clxmedia/credstore-client 1.0.5 → 1.0.6

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/dist/client.d.ts CHANGED
@@ -4,13 +4,10 @@ export interface CredStoreConfig {
4
4
  }
5
5
  export declare class CredStoreClient {
6
6
  private apiServer;
7
- private apiKey;
7
+ private headerConfig;
8
8
  private httpService;
9
9
  constructor(config: CredStoreConfig);
10
- fetchUpdatedCredential(guid: string, master_id: number): Promise<any>;
10
+ fetchCredential(guid: string, master_id: number): Promise<any>;
11
11
  createCredential(master_id: number, provider: string, credData: any, name?: string): Promise<any>;
12
12
  updateCredential(guid: string, data: any): Promise<any>;
13
- patchData(url: string, data: any): Promise<any>;
14
- postData(url: string, data: any): Promise<any>;
15
- fetchData(url: string): Promise<any>;
16
13
  }
package/dist/client.js CHANGED
@@ -16,11 +16,15 @@ class CredStoreClient {
16
16
  constructor(config) {
17
17
  this.httpService = new axios_1.HttpService();
18
18
  this.apiServer = config.api_server;
19
- this.apiKey = config.api_key;
19
+ this.headerConfig = {
20
+ headers: { 'x-credstore-admin-key': config.api_key },
21
+ };
20
22
  }
21
- fetchUpdatedCredential(guid, master_id) {
23
+ fetchCredential(guid, master_id) {
22
24
  return __awaiter(this, void 0, void 0, function* () {
23
- return yield this.fetchData(`credentials/${master_id}/${guid}`);
25
+ return yield (0, rxjs_1.lastValueFrom)(this.httpService.get(`${this.apiServer}/credentials/${master_id}/${guid}`, this.headerConfig).pipe((0, rxjs_1.map)((response) => {
26
+ return response.data;
27
+ })));
24
28
  });
25
29
  }
26
30
  createCredential(master_id, provider, credData, name) {
@@ -30,48 +34,16 @@ class CredStoreClient {
30
34
  name,
31
35
  payload: credData
32
36
  };
33
- return yield this.postData(`credentials/${master_id}`, data);
34
- });
35
- }
36
- updateCredential(guid, data) {
37
- return __awaiter(this, void 0, void 0, function* () {
38
- return yield this.patchData(`credentials/${guid}`, data);
39
- });
40
- }
41
- patchData(url, data) {
42
- return __awaiter(this, void 0, void 0, function* () {
43
- const config = {
44
- headers: { 'x-credstore-admin-key': this.apiKey },
45
- };
46
- const requestUrl = `${this.apiServer}/${url}`;
47
- const response = yield (0, rxjs_1.lastValueFrom)(this.httpService.patch(requestUrl, data, config).pipe((0, rxjs_1.map)((response) => {
37
+ return yield (0, rxjs_1.lastValueFrom)(this.httpService.post(`${this.apiServer}/credentials/${master_id}`, data, this.headerConfig).pipe((0, rxjs_1.map)((response) => {
48
38
  return response.data;
49
39
  })));
50
- return response;
51
40
  });
52
41
  }
53
- postData(url, data) {
54
- return __awaiter(this, void 0, void 0, function* () {
55
- const config = {
56
- headers: { 'x-credstore-admin-key': this.apiKey },
57
- };
58
- const requestUrl = `${this.apiServer}/${url}`;
59
- const response = yield (0, rxjs_1.lastValueFrom)(this.httpService.post(requestUrl, data, config).pipe((0, rxjs_1.map)((response) => {
60
- return response.data;
61
- })));
62
- return response;
63
- });
64
- }
65
- fetchData(url) {
42
+ updateCredential(guid, data) {
66
43
  return __awaiter(this, void 0, void 0, function* () {
67
- const config = {
68
- headers: { 'x-credstore-admin-key': this.apiKey },
69
- };
70
- const requestUrl = `${this.apiServer}/${url}`;
71
- const response = yield (0, rxjs_1.lastValueFrom)(this.httpService.get(requestUrl, config).pipe((0, rxjs_1.map)((response) => {
44
+ return yield (0, rxjs_1.lastValueFrom)(this.httpService.patch(`${this.apiServer}/credentials/${guid}`, data, this.headerConfig).pipe((0, rxjs_1.map)((response) => {
72
45
  return response.data;
73
46
  })));
74
- return response;
75
47
  });
76
48
  }
77
49
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clxmedia/credstore-client",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "CLXperience CredStore Client",
5
5
  "author": "Brandon Thompson <brandont@clxmedia.com>",
6
6
  "license": "MIT",
@@ -30,9 +30,9 @@
30
30
  },
31
31
  "repository": {
32
32
  "type": "git",
33
- "url": "https://github.com/btaustin/credstore-client"
33
+ "url": "https://github.com/adsupnow/xperience-cred-store/client"
34
34
  },
35
- "bugs": "https://github.com/btaustin/credstore-client",
35
+ "bugs": "https://github.com/adsupnow/xperience-cred-store/client",
36
36
  "peerDependencies": {
37
37
  "@nestjs/common": "^8.1.1"
38
38
  },