@clxmedia/credstore-client 1.0.1 → 1.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.
- package/README.md +3 -25
- package/package.json +1 -1
- package/dist/service.d.ts +0 -11
- package/dist/service.js +0 -81
- package/dist/test.d.ts +0 -1
- package/dist/test.js +0 -7
package/README.md
CHANGED
|
@@ -1,40 +1,18 @@
|
|
|
1
1
|
<h1 align="center"></h1>
|
|
2
2
|
|
|
3
|
-
<
|
|
4
|
-
<a href="http://nestjs.com/" target="_blank">
|
|
5
|
-
<img src="https://nestjs.com/img/logo_text.svg" width="150" alt="Nest Logo" />
|
|
6
|
-
</a>
|
|
7
|
-
</div>
|
|
8
|
-
|
|
9
|
-
<h3 align="center">NestJS npm Package Starter</h3>
|
|
10
|
-
|
|
11
|
-
<div align="center">
|
|
12
|
-
<a href="https://nestjs.com" target="_blank">
|
|
13
|
-
<img src="https://img.shields.io/badge/built%20with-NestJs-red.svg" alt="Built with NestJS">
|
|
14
|
-
</a>
|
|
15
|
-
</div>
|
|
3
|
+
<h3 align="center">CLXperience CredStore Client</h3>
|
|
16
4
|
|
|
17
5
|
### Installation
|
|
18
6
|
|
|
19
|
-
|
|
20
|
-
2. Run npm/yarn install
|
|
21
|
-
|
|
22
|
-
```bash
|
|
23
|
-
cd nestjs-package-starter
|
|
24
|
-
npm install
|
|
25
|
-
```
|
|
7
|
+
TODO
|
|
26
8
|
|
|
27
9
|
## Change Log
|
|
28
10
|
|
|
29
11
|
See [Changelog](CHANGELOG.md) for more information.
|
|
30
12
|
|
|
31
|
-
## Contributing
|
|
32
|
-
|
|
33
|
-
Contributions welcome! See [Contributing](CONTRIBUTING.md).
|
|
34
|
-
|
|
35
13
|
## Author
|
|
36
14
|
|
|
37
|
-
**
|
|
15
|
+
**Brandon Thompson**
|
|
38
16
|
|
|
39
17
|
## License
|
|
40
18
|
|
package/package.json
CHANGED
package/dist/service.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { HttpService } from '@nestjs/axios';
|
|
2
|
-
export declare class CredStoreClientService {
|
|
3
|
-
private readonly httpService;
|
|
4
|
-
constructor(httpService: HttpService);
|
|
5
|
-
fetchUpdatedCredential(guid: string, master_id: number): Promise<any>;
|
|
6
|
-
createCredential(master_id: number, provider: string, credData: any, name?: string): Promise<any>;
|
|
7
|
-
updateCredential(guid: string, data: any): Promise<any>;
|
|
8
|
-
patchData(url: string, data: any): Promise<any>;
|
|
9
|
-
postData(url: string, data: any): Promise<any>;
|
|
10
|
-
fetchData(url: string): Promise<any>;
|
|
11
|
-
}
|
package/dist/service.js
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.CredStoreClientService = void 0;
|
|
13
|
-
const rxjs_1 = require("rxjs");
|
|
14
|
-
class CredStoreClientService {
|
|
15
|
-
constructor(httpService) {
|
|
16
|
-
this.httpService = httpService;
|
|
17
|
-
}
|
|
18
|
-
fetchUpdatedCredential(guid, master_id) {
|
|
19
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
-
return yield this.fetchData(`credentials/${master_id}/${guid}`);
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
createCredential(master_id, provider, credData, name) {
|
|
24
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
25
|
-
const data = {
|
|
26
|
-
provider,
|
|
27
|
-
name,
|
|
28
|
-
payload: credData
|
|
29
|
-
};
|
|
30
|
-
return yield this.postData(`credentials/${master_id}`, data);
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
updateCredential(guid, data) {
|
|
34
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
-
return yield this.patchData(`credentials/${guid}`, data);
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
patchData(url, data) {
|
|
39
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
-
const apiServer = 'this.configService.get<string>(ConfigKeys.credstore.api_server)';
|
|
41
|
-
const apiKey = 'this.configService.get<string>(ConfigKeys.xperience.admin_key)';
|
|
42
|
-
const config = {
|
|
43
|
-
headers: { 'x-credstore-admin-key': apiKey },
|
|
44
|
-
};
|
|
45
|
-
const requestUrl = `${apiServer}/${url}`;
|
|
46
|
-
const response = yield (0, rxjs_1.lastValueFrom)(this.httpService.patch(requestUrl, data, config).pipe((0, rxjs_1.map)((response) => {
|
|
47
|
-
return response.data;
|
|
48
|
-
})));
|
|
49
|
-
return response;
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
postData(url, data) {
|
|
53
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
54
|
-
const apiServer = 'this.configService.get<string>(ConfigKeys.credstore.api_server)';
|
|
55
|
-
const apiKey = 'this.configService.get<string>(ConfigKeys.xperience.admin_key)';
|
|
56
|
-
const config = {
|
|
57
|
-
headers: { 'x-credstore-admin-key': apiKey },
|
|
58
|
-
};
|
|
59
|
-
const requestUrl = `${apiServer}/${url}`;
|
|
60
|
-
const response = yield (0, rxjs_1.lastValueFrom)(this.httpService.post(requestUrl, data, config).pipe((0, rxjs_1.map)((response) => {
|
|
61
|
-
return response.data;
|
|
62
|
-
})));
|
|
63
|
-
return response;
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
fetchData(url) {
|
|
67
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
68
|
-
const apiServer = 'this.configService.get<string>(ConfigKeys.credstore.api_server)';
|
|
69
|
-
const apiKey = 'this.configService.get<string>(ConfigKeys.xperience.admin_key)';
|
|
70
|
-
const config = {
|
|
71
|
-
headers: { 'x-credstore-admin-key': apiKey },
|
|
72
|
-
};
|
|
73
|
-
const requestUrl = `${apiServer}/${url}`;
|
|
74
|
-
const response = yield (0, rxjs_1.lastValueFrom)(this.httpService.get(requestUrl, config).pipe((0, rxjs_1.map)((response) => {
|
|
75
|
-
return response.data;
|
|
76
|
-
})));
|
|
77
|
-
return response;
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
exports.CredStoreClientService = CredStoreClientService;
|
package/dist/test.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function getHello(): string;
|