@codiac.io/codiac-cli 1.2.153-0 → 1.2.153
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/lib/k8s-command-base.d.ts +15 -25
- package/lib/k8s-command-base.js +20 -92
- package/lib/k8s-command-base.js.map +1 -1
- package/lib/relay/data/aws-regions.d.ts +6 -0
- package/lib/relay/data/aws-regions.js +32 -32
- package/lib/relay/data/aws-regions.js.map +1 -1
- package/lib/uilogic/cloud-resource-configurators/aws-k8s-versions.d.ts +11 -0
- package/lib/uilogic/cloud-resource-configurators/aws-k8s-versions.js +14 -13
- package/lib/uilogic/cloud-resource-configurators/aws-k8s-versions.js.map +1 -1
- package/lib/uilogic/cloud-resource-configurators/aws-node-types.d.ts +1 -33
- package/lib/uilogic/cloud-resource-configurators/aws-node-types.js +2 -3712
- package/lib/uilogic/cloud-resource-configurators/aws-node-types.js.map +1 -1
- package/oclif.manifest.json +1 -1
- package/package.json +2 -2
- package/lib/api-clients/common/api-user-creds.d.ts +0 -7
- package/lib/api-clients/common/api-user-creds.js +0 -19
- package/lib/api-clients/common/api-user-creds.js.map +0 -1
- package/lib/api-clients/common/config-loader.d.ts +0 -6
- package/lib/api-clients/common/config-loader.js +0 -19
- package/lib/api-clients/common/config-loader.js.map +0 -1
- package/lib/api-clients/common/security/auth-constants.d.ts +0 -15
- package/lib/api-clients/common/security/auth-constants.js +0 -22
- package/lib/api-clients/common/security/auth-constants.js.map +0 -1
- package/lib/api-clients/common/security/i-auth-client.d.ts +0 -44
- package/lib/api-clients/common/security/i-auth-client.js +0 -3
- package/lib/api-clients/common/security/i-auth-client.js.map +0 -1
- package/lib/api-clients/common/security/rest-client-base-with-auth.d.ts +0 -84
- package/lib/api-clients/common/security/rest-client-base-with-auth.js +0 -361
- package/lib/api-clients/common/security/rest-client-base-with-auth.js.map +0 -1
- package/lib/api-clients/common/security/token-holder.d.ts +0 -13
- package/lib/api-clients/common/security/token-holder.js +0 -18
- package/lib/api-clients/common/security/token-holder.js.map +0 -1
- package/lib/api-clients/common/utils.d.ts +0 -23
- package/lib/api-clients/common/utils.js +0 -83
- package/lib/api-clients/common/utils.js.map +0 -1
- package/lib/api-clients/contracts/index.d.ts +0 -1
- package/lib/api-clients/contracts/index.js +0 -5
- package/lib/api-clients/contracts/index.js.map +0 -1
- package/lib/api-clients/gen/client-config.d.ts +0 -10
- package/lib/api-clients/gen/client-config.js +0 -29
- package/lib/api-clients/gen/client-config.js.map +0 -1
- package/lib/api-clients/gen/client.d.ts +0 -45
- package/lib/api-clients/gen/client.js +0 -331
- package/lib/api-clients/gen/client.js.map +0 -1
- package/lib/api-clients/gen/contracts.d.ts +0 -2529
- package/lib/api-clients/gen/contracts.js +0 -370
- package/lib/api-clients/gen/contracts.js.map +0 -1
- package/lib/api-clients/gen/endpoints.d.ts +0 -3
- package/lib/api-clients/gen/endpoints.js +0 -3150
- package/lib/api-clients/gen/endpoints.js.map +0 -1
- package/lib/api-clients/index.d.ts +0 -2
- package/lib/api-clients/index.js +0 -6
- package/lib/api-clients/index.js.map +0 -1
- package/lib/apis/codiac-api/common/security/rest-client-base-with-auth.d.ts +0 -84
- package/lib/apis/codiac-api/common/security/rest-client-base-with-auth.js +0 -361
- package/lib/apis/codiac-api/common/security/rest-client-base-with-auth.js.map +0 -1
- package/lib/apis/codiac-api/gen/endpoints.d.ts +0 -3
- package/lib/apis/codiac-api/gen/endpoints.js +0 -3150
- package/lib/apis/codiac-api/gen/endpoints.js.map +0 -1
- package/lib/apis/over-gen/temp-mods.d.ts +0 -33
- package/lib/apis/over-gen/temp-mods.js +0 -91
- package/lib/apis/over-gen/temp-mods.js.map +0 -1
- package/lib/relay/wsclient/bus-listener.ervice.d.ts +0 -71
- package/lib/relay/wsclient/bus-listener.ervice.js +0 -150
- package/lib/relay/wsclient/bus-listener.ervice.js.map +0 -1
- package/lib/uilogic/enterprise-contextualizer-machine-scope.d.ts +0 -69
- package/lib/uilogic/enterprise-contextualizer-machine-scope.js +0 -596
- package/lib/uilogic/enterprise-contextualizer-machine-scope.js.map +0 -1
- package/lib/uilogic/registry-configurator-factory.d.ts +0 -12
- package/lib/uilogic/registry-configurator-factory.js +0 -68
- package/lib/uilogic/registry-configurator-factory.js.map +0 -1
- package/lib/uilogic/registry-configurator.d.ts +0 -17
- package/lib/uilogic/registry-configurator.js +0 -145
- package/lib/uilogic/registry-configurator.js.map +0 -1
- package/lib/uilogic/registry-configurators/aws-registry-configurator.d.ts +0 -15
- package/lib/uilogic/registry-configurators/aws-registry-configurator.js +0 -67
- package/lib/uilogic/registry-configurators/aws-registry-configurator.js.map +0 -1
- package/lib/uilogic/registry-configurators/azure-registry-configurator.d.ts +0 -25
- package/lib/uilogic/registry-configurators/azure-registry-configurator.js +0 -72
- package/lib/uilogic/registry-configurators/azure-registry-configurator.js.map +0 -1
- package/lib/uilogic/registry-configurators/docker-hub-registry-configurator.d.ts +0 -18
- package/lib/uilogic/registry-configurators/docker-hub-registry-configurator.js +0 -55
- package/lib/uilogic/registry-configurators/docker-hub-registry-configurator.js.map +0 -1
- package/lib/uilogic/registry-configurators/helm-registry-configurator.d.ts +0 -16
- package/lib/uilogic/registry-configurators/helm-registry-configurator.js +0 -44
- package/lib/uilogic/registry-configurators/helm-registry-configurator.js.map +0 -1
- package/lib/uilogic/registry-configurators/unsupported-registry-configurator.d.ts +0 -17
- package/lib/uilogic/registry-configurators/unsupported-registry-configurator.js +0 -60
- package/lib/uilogic/registry-configurators/unsupported-registry-configurator.js.map +0 -1
|
@@ -1,361 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var RestClientBaseWithAuth_1;
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.RestClientBaseWithAuth = void 0;
|
|
5
|
-
const tslib_1 = require("tslib");
|
|
6
|
-
const path = require("path");
|
|
7
|
-
const inversify_1 = require("inversify");
|
|
8
|
-
const axios_1 = require("axios");
|
|
9
|
-
const contracts = require("@codiac.io/codiac-common/contracts");
|
|
10
|
-
const codiac_common_1 = require("@codiac.io/codiac-common");
|
|
11
|
-
const jwt_lib_1 = require("@codiac.io/jwt-lib");
|
|
12
|
-
const api_client_base_1 = require("@codiac.io/api-client-base");
|
|
13
|
-
const auth_constants_1 = require("./auth-constants");
|
|
14
|
-
const token_holder_1 = require("./token-holder");
|
|
15
|
-
/** Contains Codiac Auth methods. */
|
|
16
|
-
let RestClientBaseWithAuth = RestClientBaseWithAuth_1 = class RestClientBaseWithAuth extends api_client_base_1.RestClientBase {
|
|
17
|
-
/**
|
|
18
|
-
* @param apiRootUrl The base url of the api. That is, prepending it to any individual endpoint route will yield the fully qualified url for that endpoint.
|
|
19
|
-
* @param authToken Either a Principal or TenantUser token for the api this client is targeting. NOTE: Also gets hydrated on successful attempts of authenticate / switchTenant / refreshToken / registerTenant.
|
|
20
|
-
*/
|
|
21
|
-
constructor(logger, apiRootUrl, authToken) {
|
|
22
|
-
super(logger, apiRootUrl, authToken);
|
|
23
|
-
this.authConstants = new auth_constants_1.AuthConstants();
|
|
24
|
-
this.tokenHeaderName = RestClientBaseWithAuth_1.TOKEN_HEADER_PARAM; // Right now this is redundant bc this class and the apiClientBase have the same value for tokenHeaderName. But it's here bc the auth client should explicitly declare it anyway and the base is just a default.
|
|
25
|
-
}
|
|
26
|
-
/** Logs in remotely with the given credentials.
|
|
27
|
-
* Returns a valid token in the headers of the response
|
|
28
|
-
* and the user info in the body of the response.
|
|
29
|
-
* NOTE: If successful, keeps the returned auth token in scope for this client instance.
|
|
30
|
-
* @param login The human readable unique identifier for the user.
|
|
31
|
-
* @param password the secret held for this particular user.
|
|
32
|
-
* @param tenantCode (optional) Unique identifier of the tenant to activate with this authentication.
|
|
33
|
-
*/
|
|
34
|
-
authenticate(login, password, tenantCode) {
|
|
35
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
36
|
-
return new Promise((resolve, reject) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
37
|
-
var _a, _b, _c, _d, _e;
|
|
38
|
-
try {
|
|
39
|
-
let url = path.join(this.authConstants.ROUTE_PREFIX, this.authConstants.ROUTE_SUBPATH_LOGIN);
|
|
40
|
-
let req = { login: login, password: password, tenantCode: tenantCode };
|
|
41
|
-
let options = {
|
|
42
|
-
"baseURL": this.apiRootUrl,
|
|
43
|
-
"headers": { "content-type": "application/json" }
|
|
44
|
-
};
|
|
45
|
-
// let apiResponse = await axios.post<contracts.SingleResult<TenantUser>>(url, req, options);
|
|
46
|
-
// let result = this.convertToTokenHolderResponse(apiResponse);
|
|
47
|
-
let httpResp = yield this.executeAxiosRequest(codiac_common_1.httpRestVerb.POST, (contracts.SingleResult), url, req, options);
|
|
48
|
-
if (httpResp.data === undefined) {
|
|
49
|
-
throw new Error(`Authentication request did not return an output object. HttpStatus: ${(_a = httpResp.status) !== null && _a !== void 0 ? _a : ""} ${(_b = httpResp.statusText) !== null && _b !== void 0 ? _b : ""}`);
|
|
50
|
-
}
|
|
51
|
-
let result = this.convertToTokenHolderResult(httpResp.data, httpResp.headers);
|
|
52
|
-
if ((_c = result.output) === null || _c === void 0 ? void 0 : _c.token) {
|
|
53
|
-
this.authToken = result.output.token;
|
|
54
|
-
}
|
|
55
|
-
resolve(result);
|
|
56
|
-
}
|
|
57
|
-
catch (err) {
|
|
58
|
-
let output = new contracts.SingleResult(false, `Error during authenticate: ${(_d = err.name) !== null && _d !== void 0 ? _d : ""} ${(_e = err.message) !== null && _e !== void 0 ? _e : "(no error message available)"}`, err);
|
|
59
|
-
this.logger.debug(output.message);
|
|
60
|
-
resolve(output);
|
|
61
|
-
}
|
|
62
|
-
}));
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
/** Traps the errors thrown by axios on non-200 statuses. */
|
|
66
|
-
executeAxiosRequest(verb, responseType, url, request, options) {
|
|
67
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
68
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
69
|
-
try {
|
|
70
|
-
let axr;
|
|
71
|
-
switch (verb) {
|
|
72
|
-
case codiac_common_1.httpRestVerb.POST:
|
|
73
|
-
axr = yield axios_1.default.post(url, request, options);
|
|
74
|
-
break;
|
|
75
|
-
case codiac_common_1.httpRestVerb.PUT:
|
|
76
|
-
axr = yield axios_1.default.put(url, request, options);
|
|
77
|
-
break;
|
|
78
|
-
case codiac_common_1.httpRestVerb.PATCH:
|
|
79
|
-
axr = yield axios_1.default.patch(url, request, options);
|
|
80
|
-
break;
|
|
81
|
-
case codiac_common_1.httpRestVerb.DELETE:
|
|
82
|
-
axr = yield axios_1.default.delete(url, options);
|
|
83
|
-
break;
|
|
84
|
-
default: // GET
|
|
85
|
-
axr = yield axios_1.default.get(url, options);
|
|
86
|
-
break;
|
|
87
|
-
}
|
|
88
|
-
let expected = responseType; // <-- just to satisfy TS (we want to infer the generics, dont want the caller to have to explicitly type them)
|
|
89
|
-
return axr; // { data: axr.data, headers: axr.headers, status: axr.status, statusText: axr.statusText };
|
|
90
|
-
}
|
|
91
|
-
catch (err) {
|
|
92
|
-
if (err.isAxiosError === true && err.response) {
|
|
93
|
-
let axErrResponse = (err.response);
|
|
94
|
-
this.logger.debug(`Remote api returned failure http status: ${axErrResponse.status || ""} ${axErrResponse.statusText || ""}.`); // , stringify(axr); // need json-safe-stringify
|
|
95
|
-
return { data: axErrResponse.data, headers: axErrResponse.headers, status: axErrResponse.status, statusText: axErrResponse.statusText };
|
|
96
|
-
}
|
|
97
|
-
else {
|
|
98
|
-
let result = new contracts.Result(false, `Error communicating with remote api: ${(_a = err.name) !== null && _a !== void 0 ? _a : ""} ${(_b = err.message) !== null && _b !== void 0 ? _b : "unspecified error."}`, err);
|
|
99
|
-
return { data: result, headers: (_d = (_c = err.response) === null || _c === void 0 ? void 0 : _c.headers) !== null && _d !== void 0 ? _d : {}, status: (_f = (_e = err.response) === null || _e === void 0 ? void 0 : _e.status) !== null && _f !== void 0 ? _f : -1, statusText: (_h = (_g = err.response) === null || _g === void 0 ? void 0 : _g.statusText) !== null && _h !== void 0 ? _h : "" };
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
/** Replaces the user in the output with a TokenHolder so that they client consumer has access to the token.
|
|
105
|
-
* throws if the axios response does not contain a data property. */
|
|
106
|
-
convertToTokenHolderResult(apiResponse, headers) {
|
|
107
|
-
let result = new contracts.SingleResult(apiResponse.success, apiResponse.message, apiResponse.error, undefined, apiResponse.validation);
|
|
108
|
-
if (apiResponse.output) {
|
|
109
|
-
let token = headers[this.tokenHeaderName];
|
|
110
|
-
if (!token)
|
|
111
|
-
throw new Error(`Authentication service did not provide a user token.`);
|
|
112
|
-
let exp = this.extractTokenExpiration(token);
|
|
113
|
-
result.output = new token_holder_1.TokenHolder(apiResponse.output, token, exp);
|
|
114
|
-
}
|
|
115
|
-
return result;
|
|
116
|
-
}
|
|
117
|
-
/** Replaces the user in the output with a TokenHolder so that they client consumer has access to the token.
|
|
118
|
-
* throws if the axios response does not contain a data property.
|
|
119
|
-
* @deprecated Use `convertToTokenHolderResult()` instead.*/
|
|
120
|
-
convertToTokenHolderResponse(apiResponse) {
|
|
121
|
-
if (apiResponse.data) {
|
|
122
|
-
// TODO: Dont construct new - just cast or ducktype and replace the output property.
|
|
123
|
-
let result = new contracts.SingleResult(apiResponse.data.success, apiResponse.data.message, apiResponse.data.error, undefined, apiResponse.data.validation);
|
|
124
|
-
if (apiResponse.data.output) {
|
|
125
|
-
let token = apiResponse.headers[this.tokenHeaderName];
|
|
126
|
-
if (!token)
|
|
127
|
-
throw new Error(`Authentication service did not provide a user token.`);
|
|
128
|
-
let exp = this.extractTokenExpiration(token);
|
|
129
|
-
result.output = new token_holder_1.TokenHolder(apiResponse.data.output, token, exp);
|
|
130
|
-
}
|
|
131
|
-
return result;
|
|
132
|
-
}
|
|
133
|
-
else {
|
|
134
|
-
throw new Error(`Authentication request did not return an output object. HttpStatus: ${apiResponse.status} ${apiResponse.statusText}`);
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
/** Determines whether the given token is expired.
|
|
138
|
-
* @param throwOnError throws any encountered errors, including token parsing errors.
|
|
139
|
-
*/
|
|
140
|
-
isExpired(token, throwOnError = false) {
|
|
141
|
-
try {
|
|
142
|
-
const exp = this.extractTokenExpiration(token);
|
|
143
|
-
return (exp == undefined) || !(0, codiac_common_1.isFuture)(exp);
|
|
144
|
-
}
|
|
145
|
-
catch (err) {
|
|
146
|
-
let newErr = new contracts.CodiacError(`Error determining expiry status: ${err.message || ""}`, err);
|
|
147
|
-
this.logger.detail(newErr.message);
|
|
148
|
-
if (throwOnError) {
|
|
149
|
-
throw newErr;
|
|
150
|
-
}
|
|
151
|
-
else {
|
|
152
|
-
return true;
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
extractTokenExpiration(token) {
|
|
157
|
-
let exp;
|
|
158
|
-
try {
|
|
159
|
-
const encoder = new jwt_lib_1.JwtEncoder();
|
|
160
|
-
const tokenObj = encoder.tryDecode(token);
|
|
161
|
-
const CLAIM_KEY_FOR_EXPIRATION = "exp"; // this is just a standard claim so it ought to come from the jwt lib
|
|
162
|
-
const rawExp = tokenObj === null || tokenObj === void 0 ? void 0 : tokenObj.payload[CLAIM_KEY_FOR_EXPIRATION];
|
|
163
|
-
if (rawExp) {
|
|
164
|
-
try {
|
|
165
|
-
exp = new Date(rawExp);
|
|
166
|
-
this.logger.trace(`Exracted token expiration (utc): ${(exp === null || exp === void 0 ? void 0 : exp.toUTCString()) || "undefined"}`);
|
|
167
|
-
}
|
|
168
|
-
catch (_a) {
|
|
169
|
-
this.logger.trace(`Invalid date format in token expiration: [${rawExp}]`);
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
return exp;
|
|
173
|
-
}
|
|
174
|
-
catch (err) {
|
|
175
|
-
throw new Error(`Error parsing expiration from token: ${err.message}`);
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
/** Provides the ability to extend an existing token.
|
|
179
|
-
* Returns failure for invalid or revoked tokens.
|
|
180
|
-
* Returns any errors encountered refreshing.
|
|
181
|
-
* NOTE: If successful, keeps the returned auth token in scope for this client instance.
|
|
182
|
-
* @param currentToken The JWT token returned in a prior request.
|
|
183
|
-
* */
|
|
184
|
-
refreshToken(currentToken) {
|
|
185
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
186
|
-
return new Promise((resolve, reject) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
187
|
-
var _a, _b, _c, _d, _e;
|
|
188
|
-
try {
|
|
189
|
-
let url = path.join(this.authConstants.ROUTE_PREFIX, this.authConstants.ROUTE_SUBPATH_TOKEN_REFRESH);
|
|
190
|
-
let req = {};
|
|
191
|
-
let options = {
|
|
192
|
-
"baseURL": this.apiRootUrl,
|
|
193
|
-
"headers": {
|
|
194
|
-
"content-type": "application/json",
|
|
195
|
-
[this.tokenHeaderName]: currentToken
|
|
196
|
-
}
|
|
197
|
-
};
|
|
198
|
-
// let apiResponse = await axios.post<contracts.SingleResult<TenantUser>>(url, req, options);
|
|
199
|
-
// let result = this.convertToTokenHolderResponse(apiResponse);
|
|
200
|
-
let httpResp = yield this.executeAxiosRequest(codiac_common_1.httpRestVerb.POST, (contracts.SingleResult), url, req, options);
|
|
201
|
-
if (httpResp.data === undefined) {
|
|
202
|
-
throw new Error(`refreshToken request did not return an output object. HttpStatus: ${(_a = httpResp.status) !== null && _a !== void 0 ? _a : ""} ${(_b = httpResp.statusText) !== null && _b !== void 0 ? _b : ""}`);
|
|
203
|
-
}
|
|
204
|
-
let result = this.convertToTokenHolderResult(httpResp.data, httpResp.headers);
|
|
205
|
-
if ((_c = result.output) === null || _c === void 0 ? void 0 : _c.token) {
|
|
206
|
-
this.authToken = result.output.token;
|
|
207
|
-
}
|
|
208
|
-
resolve(result);
|
|
209
|
-
}
|
|
210
|
-
catch (err) {
|
|
211
|
-
let output = new contracts.SingleResult(false, `Error during refreshToken: ${(_d = err.name) !== null && _d !== void 0 ? _d : ""} ${(_e = err.message) !== null && _e !== void 0 ? _e : "(no error message available)"}`, err);
|
|
212
|
-
this.logger.debug(output.message);
|
|
213
|
-
resolve(output);
|
|
214
|
-
}
|
|
215
|
-
}));
|
|
216
|
-
});
|
|
217
|
-
}
|
|
218
|
-
/** Retrieves the full account info for the current user (minus any passwords),
|
|
219
|
-
* including all tenant profiles.
|
|
220
|
-
* Returns failure for invalid or revoked tokens.
|
|
221
|
-
* Returns any errors encountered refreshing.
|
|
222
|
-
* NOTE: keeps the returned auth token in scope for this client instance.
|
|
223
|
-
* @param currentToken (optional if the client instance has already authenticated) The JWT token returned in a prior request.
|
|
224
|
-
*/
|
|
225
|
-
whoAmI(currentToken) {
|
|
226
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
227
|
-
return new Promise((resolve, reject) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
228
|
-
var _a, _b, _c, _d, _e;
|
|
229
|
-
try {
|
|
230
|
-
let url = path.join(this.authConstants.ROUTE_PREFIX, this.authConstants.ROUTE_SUBPATH_TOKEN_WHOAMI);
|
|
231
|
-
let options = {
|
|
232
|
-
"baseURL": this.apiRootUrl,
|
|
233
|
-
"headers": {
|
|
234
|
-
"content-type": "application/json"
|
|
235
|
-
}
|
|
236
|
-
};
|
|
237
|
-
if (currentToken || this.authToken)
|
|
238
|
-
options.headers[RestClientBaseWithAuth_1.TOKEN_HEADER_PARAM] = currentToken || this.authToken;
|
|
239
|
-
// let apiResponse = await axios.get<contracts.SingleResult<TenantUser>>(url, options);
|
|
240
|
-
// let result = apiResponse.data;
|
|
241
|
-
// if (apiResponse.headers[RestClientBaseWithAuth.TOKEN_HEADER_PARAM]) {
|
|
242
|
-
// this.authToken = apiResponse.headers[RestClientBaseWithAuth.TOKEN_HEADER_PARAM];
|
|
243
|
-
// }
|
|
244
|
-
let httpResp = yield this.executeAxiosRequest(codiac_common_1.httpRestVerb.GET, (contracts.SingleResult), url, undefined, options);
|
|
245
|
-
if (httpResp.data === undefined) {
|
|
246
|
-
throw new Error(`whoAmI request did not return an output object. HttpStatus: ${(_a = httpResp.status) !== null && _a !== void 0 ? _a : ""} ${(_b = httpResp.statusText) !== null && _b !== void 0 ? _b : ""}`);
|
|
247
|
-
}
|
|
248
|
-
let result = this.convertToTokenHolderResult(httpResp.data, httpResp.headers);
|
|
249
|
-
if ((_c = result.output) === null || _c === void 0 ? void 0 : _c.token) {
|
|
250
|
-
this.authToken = result.output.token;
|
|
251
|
-
}
|
|
252
|
-
resolve(httpResp.data); // result); // this method should have returned a tokenHolder, not a tenantUser.
|
|
253
|
-
}
|
|
254
|
-
catch (err) {
|
|
255
|
-
let output = new contracts.SingleResult(false, `Error during whoAmI: ${(_d = err.name) !== null && _d !== void 0 ? _d : ""} ${(_e = err.message) !== null && _e !== void 0 ? _e : "(no error message available)"}`, err);
|
|
256
|
-
this.logger.debug(output.message);
|
|
257
|
-
resolve(output);
|
|
258
|
-
}
|
|
259
|
-
}));
|
|
260
|
-
});
|
|
261
|
-
}
|
|
262
|
-
/** Provides the ability to extend an existing token.
|
|
263
|
-
* Returns failure for invalid or revoked tokens.
|
|
264
|
-
* NOTE: If successful, keeps the returned auth token in scope for this client instance.
|
|
265
|
-
* @param currentToken The JWT token returned in a prior request.
|
|
266
|
-
* @param tenantCode Unique identifier of the tenant being switched to.
|
|
267
|
-
* Returns any errors encountered refreshing. */
|
|
268
|
-
switchTenant(currentToken, tenantCode) {
|
|
269
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
270
|
-
return new Promise((resolve, reject) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
271
|
-
var _a, _b, _c, _d, _e;
|
|
272
|
-
try {
|
|
273
|
-
let url = path.join(this.authConstants.ROUTE_PREFIX, this.authConstants.ROUTE_SUBPATH_SWITCH_TENANT);
|
|
274
|
-
let req = { newTenantCode: tenantCode };
|
|
275
|
-
let options = {
|
|
276
|
-
"baseURL": this.apiRootUrl,
|
|
277
|
-
"headers": {
|
|
278
|
-
"content-type": "application/json",
|
|
279
|
-
[this.tokenHeaderName]: currentToken
|
|
280
|
-
}
|
|
281
|
-
};
|
|
282
|
-
let httpResp = yield this.executeAxiosRequest(codiac_common_1.httpRestVerb.POST, (contracts.SingleResult), url, req, options);
|
|
283
|
-
if (httpResp.data === undefined) {
|
|
284
|
-
throw new Error(`switchTenant request did not return an output object. HttpStatus: ${(_a = httpResp.status) !== null && _a !== void 0 ? _a : ""} ${(_b = httpResp.statusText) !== null && _b !== void 0 ? _b : ""}`);
|
|
285
|
-
}
|
|
286
|
-
let result = this.convertToTokenHolderResult(httpResp.data, httpResp.headers);
|
|
287
|
-
if ((_c = result.output) === null || _c === void 0 ? void 0 : _c.token) {
|
|
288
|
-
this.authToken = result.output.token;
|
|
289
|
-
}
|
|
290
|
-
resolve(result);
|
|
291
|
-
}
|
|
292
|
-
catch (err) {
|
|
293
|
-
let output = new contracts.SingleResult(false, `Error during switchTenant: ${(_d = err.name) !== null && _d !== void 0 ? _d : ""} ${(_e = err.message) !== null && _e !== void 0 ? _e : "(no error message available)"}`, err);
|
|
294
|
-
this.logger.debug(output.message);
|
|
295
|
-
resolve(output);
|
|
296
|
-
}
|
|
297
|
-
}));
|
|
298
|
-
});
|
|
299
|
-
}
|
|
300
|
-
/** Declares a new organization in the toyhauler system.
|
|
301
|
-
* The given user account is made the administrator for that organization,
|
|
302
|
-
* and if the new user flag is given,
|
|
303
|
-
* the user account will get created.
|
|
304
|
-
* NOTE: If successful, keeps the returned auth token in scope for this client instance.
|
|
305
|
-
* @param tenantName Human readable friendly title for the tenant. NOT used for system identification.
|
|
306
|
-
* @param newUser Flag to create a new user account with the given credentials.
|
|
307
|
-
* @param userName User to be the adminstrator for the new tenant.
|
|
308
|
-
* @param password Password for the given user (desired password if the newuser flag is set).
|
|
309
|
-
* @param tenantCode (optional) Desired unique identifier for the new tenant (if omitted one will be generated).
|
|
310
|
-
* @param currentToken The JWT token returned in a prior request.
|
|
311
|
-
* */
|
|
312
|
-
registerTenant(tenantName, newUser, userName, password, tenantCode, currentToken) {
|
|
313
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
314
|
-
return new Promise((resolve, reject) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
315
|
-
var _a, _b, _c, _d;
|
|
316
|
-
try {
|
|
317
|
-
let url = path.join(this.authConstants.ROUTE_PREFIX, this.authConstants.ROUTE_SUBPATH_TENANT_REGISTER);
|
|
318
|
-
let req = { tenantName: tenantName, newUser: newUser, userName: userName, password: password, tenantCode: tenantCode };
|
|
319
|
-
let options = {
|
|
320
|
-
"baseURL": this.apiRootUrl,
|
|
321
|
-
"headers": {
|
|
322
|
-
"content-type": "application/json"
|
|
323
|
-
}
|
|
324
|
-
};
|
|
325
|
-
if (currentToken)
|
|
326
|
-
options.headers[this.tokenHeaderName] = currentToken;
|
|
327
|
-
// let response = await axios.post<contracts.SingleResult<AuthTenant>>(url, req, options);
|
|
328
|
-
// let opResult = response.data;
|
|
329
|
-
// if (opResult && opResult.success && response.headers[this.tokenHeaderName]) {
|
|
330
|
-
// this.authToken = response.headers[this.tokenHeaderName];
|
|
331
|
-
// }
|
|
332
|
-
// resolve(response.data);
|
|
333
|
-
let httpResp = yield this.executeAxiosRequest(codiac_common_1.httpRestVerb.POST, (contracts.SingleResult), url, req, options);
|
|
334
|
-
if (httpResp.data === undefined) {
|
|
335
|
-
throw new Error(`registerTenant request did not return an output object. HttpStatus: ${(_a = httpResp.status) !== null && _a !== void 0 ? _a : ""} ${(_b = httpResp.statusText) !== null && _b !== void 0 ? _b : ""}`);
|
|
336
|
-
}
|
|
337
|
-
let result = httpResp.data;
|
|
338
|
-
if (result.success && httpResp.headers[this.tokenHeaderName]) {
|
|
339
|
-
this.authToken = httpResp.headers[this.tokenHeaderName];
|
|
340
|
-
}
|
|
341
|
-
resolve(result); // this should have been a tokenHolder result instead of an AuthTenant.
|
|
342
|
-
}
|
|
343
|
-
catch (err) {
|
|
344
|
-
let output = new contracts.SingleResult(false, `Error during registerTenant: ${(_c = err.name) !== null && _c !== void 0 ? _c : ""} ${(_d = err.message) !== null && _d !== void 0 ? _d : "(no error message available)"}`, err);
|
|
345
|
-
this.logger.debug(output.message);
|
|
346
|
-
resolve(output);
|
|
347
|
-
}
|
|
348
|
-
}));
|
|
349
|
-
});
|
|
350
|
-
}
|
|
351
|
-
};
|
|
352
|
-
/** Hardcoded to match the current setting on the server.
|
|
353
|
-
* TODO: Get this from a config that is copied from the server project to the client project on build.
|
|
354
|
-
*/
|
|
355
|
-
RestClientBaseWithAuth.TOKEN_HEADER_PARAM = "authorization";
|
|
356
|
-
RestClientBaseWithAuth = RestClientBaseWithAuth_1 = tslib_1.__decorate([
|
|
357
|
-
(0, inversify_1.injectable)(),
|
|
358
|
-
tslib_1.__metadata("design:paramtypes", [Object, String, String])
|
|
359
|
-
], RestClientBaseWithAuth);
|
|
360
|
-
exports.RestClientBaseWithAuth = RestClientBaseWithAuth;
|
|
361
|
-
//# sourceMappingURL=rest-client-base-with-auth.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rest-client-base-with-auth.js","sourceRoot":"","sources":["../../../../src/api-clients/common/security/rest-client-base-with-auth.ts"],"names":[],"mappings":";;;;;AAAA,6BAA6B;AAC7B,yCAAuC;AACvC,iCAAiE;AAEjE,gEAAgE;AAChE,4DAA2F;AAE3F,gDAAgD;AAChD,gEAA4D;AAG5D,qDAAiD;AACjD,iDAA6C;AAI7C,oCAAoC;AAE7B,IAAe,sBAAsB,8BAArC,MAAe,sBAAuB,SAAQ,gCAAc;IAOjE;;;OAGG;IACH,YAAY,MAAqB,EAAE,UAAmB,EAAE,SAAkB;QACxE,KAAK,CAAC,MAAM,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;QAI7B,kBAAa,GAAkB,IAAI,8BAAa,EAAE,CAAC;QAH3D,IAAI,CAAC,eAAe,GAAG,wBAAsB,CAAC,kBAAkB,CAAC,CAAE,iN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IAAI,MAAM,CAAC,OAAO,IAAI,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,eAAe,CAAC,EAAE;wBAC5D,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;qBACzD;oBAED,OAAO,CAAC,MAAM,CAAC,CAAC,CAAE,uEAAuE;iBAC1F;gBAAC,OAAO,GAAG,EAAE;oBACZ,IAAI,MAAM,GAAG,IAAI,SAAS,CAAC,YAAY,CAAa,KAAK,EAAE,gCAAgC,MAAA,GAAG,CAAC,IAAI,mCAAI,EAAE,IAAI,MAAA,GAAG,CAAC,OAAO,mCAAI,8BAA8B,EAAE,EAAE,GAAG,CAAC,CAAC;oBACnK,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,OAAQ,CAAC,CAAA;oBAClC,OAAO,CAAC,MAAM,CAAC,CAAC;iBACjB;YACH,CAAC,CAAA,CAAC,CAAC;QACL,CAAC;KAAA;;AApVD;;GAEG;AACI,yCAAkB,GAAG,eAAe,CAAC;AALxB,sBAAsB;IAD3C,IAAA,sBAAU,GAAE;;GACS,sBAAsB,CAuV3C;AAvVqB,wDAAsB"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { TenantUser } from "@codiac.io/codiac-common/security";
|
|
2
|
-
export declare class TokenHolder {
|
|
3
|
-
user: TenantUser;
|
|
4
|
-
token: string;
|
|
5
|
-
expiration: Date | undefined;
|
|
6
|
-
/**
|
|
7
|
-
* @param user A user or principal (ie: tenantCode is optional)
|
|
8
|
-
* @param token The JWT returned by the auth api. If there's a tenantCode,
|
|
9
|
-
* then the token is a tenant-user token. Otherwise just a user token.
|
|
10
|
-
* @param expiration in GMT
|
|
11
|
-
*/
|
|
12
|
-
constructor(user: TenantUser, token: string, expiration: Date | undefined);
|
|
13
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TokenHolder = void 0;
|
|
4
|
-
class TokenHolder {
|
|
5
|
-
/**
|
|
6
|
-
* @param user A user or principal (ie: tenantCode is optional)
|
|
7
|
-
* @param token The JWT returned by the auth api. If there's a tenantCode,
|
|
8
|
-
* then the token is a tenant-user token. Otherwise just a user token.
|
|
9
|
-
* @param expiration in GMT
|
|
10
|
-
*/
|
|
11
|
-
constructor(user, token, expiration) {
|
|
12
|
-
this.user = user;
|
|
13
|
-
this.token = token;
|
|
14
|
-
this.expiration = expiration;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
exports.TokenHolder = TokenHolder;
|
|
18
|
-
//# sourceMappingURL=token-holder.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"token-holder.js","sourceRoot":"","sources":["../../../../src/api-clients/common/security/token-holder.ts"],"names":[],"mappings":";;;AAEA,MAAa,WAAW;IACtB;;;;;OAKG;IACH,YAAmB,IAAgB,EAAS,KAAa,EAAS,UAA0B;QAAzE,SAAI,GAAJ,IAAI,CAAY;QAAS,UAAK,GAAL,KAAK,CAAQ;QAAS,eAAU,GAAV,UAAU,CAAgB;IAE5F,CAAC;CACF;AAVD,kCAUC"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export declare class utils {
|
|
2
|
-
/** Returns the instantiated object or array.
|
|
3
|
-
* Returns undefined for both an empty or missing source file.
|
|
4
|
-
* Uses JSON.parse and does not perform any explicit casting.
|
|
5
|
-
* Throws encountered exceptions. Resolves tilde (~) path prefixes.
|
|
6
|
-
* @param pathName Fully qualified path and filename of the json file.
|
|
7
|
-
* @param allowComments (default: false) Flag to use a json comment parser to support comments in the json file.
|
|
8
|
-
*/
|
|
9
|
-
static deserializeJsonFile<T>(pathName: string, allowComments?: boolean): T | undefined;
|
|
10
|
-
/** Uses JSON.stringify() to write the given object to a file. Resolves tilde (~) path prefixes.
|
|
11
|
-
* @param subject The object to serialize.
|
|
12
|
-
* @param pathName Fully-qualified path and filename (eg "/users/JoeCool/.config/app-config.json").
|
|
13
|
-
* @param allowComments (default: false) Flag to use a json comment parser to support comments in the json file.
|
|
14
|
-
*/
|
|
15
|
-
static serializeJsonFile(subject: any, pathName: string, allowComments?: boolean): void;
|
|
16
|
-
/** Replaces the leading tilde (~) in the given file path
|
|
17
|
-
* with the absolute path to the os.homedir (eg: "/Users/JoeCool").
|
|
18
|
-
* NOTE: Relative paths will slide through this function untouched:
|
|
19
|
-
* this function does not necessarily return an absolute path! */
|
|
20
|
-
static resolveHomeDir(pathName: string): string;
|
|
21
|
-
/** */
|
|
22
|
-
static smashMergeConfg<TSettings>(defaults: TSettings, configsInPriorityOrder?: Partial<TSettings>[]): TSettings;
|
|
23
|
-
}
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.utils = void 0;
|
|
4
|
-
const path = require("path");
|
|
5
|
-
const fs = require("fs");
|
|
6
|
-
const os = require("os");
|
|
7
|
-
const commentJson = require("comment-json");
|
|
8
|
-
const lodash_1 = require("lodash");
|
|
9
|
-
// TODO: Promote this to a shared pkg
|
|
10
|
-
class utils {
|
|
11
|
-
/** Returns the instantiated object or array.
|
|
12
|
-
* Returns undefined for both an empty or missing source file.
|
|
13
|
-
* Uses JSON.parse and does not perform any explicit casting.
|
|
14
|
-
* Throws encountered exceptions. Resolves tilde (~) path prefixes.
|
|
15
|
-
* @param pathName Fully qualified path and filename of the json file.
|
|
16
|
-
* @param allowComments (default: false) Flag to use a json comment parser to support comments in the json file.
|
|
17
|
-
*/
|
|
18
|
-
static deserializeJsonFile(pathName, allowComments = false) {
|
|
19
|
-
try {
|
|
20
|
-
let targetPathName = this.resolveHomeDir(pathName);
|
|
21
|
-
if (!path.isAbsolute(targetPathName)) {
|
|
22
|
-
throw new Error(`Cannot deserialize: the pathName [${pathName}] is not a fully qualified path.`);
|
|
23
|
-
}
|
|
24
|
-
if (fs.existsSync(targetPathName)) {
|
|
25
|
-
let json = fs.readFileSync(targetPathName, { encoding: 'utf-8' });
|
|
26
|
-
if (allowComments) {
|
|
27
|
-
let obj = commentJson.parse(json);
|
|
28
|
-
return obj;
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
let obj = JSON.parse(json);
|
|
32
|
-
return obj;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
return undefined;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
catch (err) {
|
|
40
|
-
throw err;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
/** Uses JSON.stringify() to write the given object to a file. Resolves tilde (~) path prefixes.
|
|
44
|
-
* @param subject The object to serialize.
|
|
45
|
-
* @param pathName Fully-qualified path and filename (eg "/users/JoeCool/.config/app-config.json").
|
|
46
|
-
* @param allowComments (default: false) Flag to use a json comment parser to support comments in the json file.
|
|
47
|
-
*/
|
|
48
|
-
static serializeJsonFile(subject, pathName, allowComments = false) {
|
|
49
|
-
let targetPathName = this.resolveHomeDir(pathName);
|
|
50
|
-
if (!path.isAbsolute(targetPathName)) {
|
|
51
|
-
throw new Error(`Cannot serialize: the pathName [${pathName}] is not a fully qaulified path`);
|
|
52
|
-
}
|
|
53
|
-
if (allowComments) {
|
|
54
|
-
commentJson.stringify(subject, undefined, ' ');
|
|
55
|
-
}
|
|
56
|
-
else {
|
|
57
|
-
fs.writeFileSync(targetPathName, JSON.stringify(subject, undefined, ' '));
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
/** Replaces the leading tilde (~) in the given file path
|
|
61
|
-
* with the absolute path to the os.homedir (eg: "/Users/JoeCool").
|
|
62
|
-
* NOTE: Relative paths will slide through this function untouched:
|
|
63
|
-
* this function does not necessarily return an absolute path! */
|
|
64
|
-
static resolveHomeDir(pathName) {
|
|
65
|
-
if (pathName.startsWith("~")) {
|
|
66
|
-
return path.join(os.homedir(), pathName.slice(2));
|
|
67
|
-
}
|
|
68
|
-
else {
|
|
69
|
-
return pathName;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
/** */
|
|
73
|
-
static smashMergeConfg(defaults, configsInPriorityOrder) {
|
|
74
|
-
if (!configsInPriorityOrder || configsInPriorityOrder.length == 0)
|
|
75
|
-
return defaults;
|
|
76
|
-
else {
|
|
77
|
-
let ultimate = lodash_1.default.assignIn(defaults, ...configsInPriorityOrder.reverse());
|
|
78
|
-
return ultimate;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
exports.utils = utils;
|
|
83
|
-
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/api-clients/common/utils.ts"],"names":[],"mappings":";;;AAAA,6BAA4B;AAC5B,yBAAwB;AACxB,yBAAwB;AACxB,4CAA2C;AAC3C,mCAAuB;AAGvB,sCAAsC;AAEtC,MAAa,KAAK;IAEhB;;;;;;OAMG;IACI,MAAM,CAAC,mBAAmB,CAAI,QAAgB,EAAE,gBAAyB,KAAK;QACnF,IAAI;YACF,IAAI,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;YACnD,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,EAAE;gBACpC,MAAM,IAAI,KAAK,CAAC,qCAAqC,QAAQ,kCAAkC,CAAC,CAAC;aAClG;YACD,IAAI,EAAE,CAAC,UAAU,CAAC,cAAc,CAAC,EAAE;gBACjC,IAAI,IAAI,GAAG,EAAE,CAAC,YAAY,CAAC,cAAc,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAC,CAAC,CAAC;gBACjE,IAAI,aAAa,EAAE;oBACjB,IAAI,GAAG,GAAG,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;oBAClC,OAAO,GAAG,CAAC;iBACZ;qBAAM;oBACL,IAAI,GAAG,GAAG,IAAI,CAAC,KAAK,C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AC,CAAC;YACzE,OAAkB,QAAQ,CAAC;SAC5B;IACH,CAAC;CAEF;AAzED,sBAyEC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "../gen/contracts";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api-clients/contracts/index.ts"],"names":[],"mappings":";;;AAAA,2DAAiC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/** The in-memory representation of the api client config file.
|
|
2
|
-
*/
|
|
3
|
-
export declare class CodiacClientConfig {
|
|
4
|
-
static readonly CONFIG_PATH: string;
|
|
5
|
-
static readonly CONFIG_FILENAME = "config.json";
|
|
6
|
-
private static loader;
|
|
7
|
-
static load(): CodiacClientConfig | undefined;
|
|
8
|
-
constructor();
|
|
9
|
-
apiBaseUrl: string | undefined;
|
|
10
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var CodiacClientConfig_1;
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.CodiacClientConfig = void 0;
|
|
5
|
-
const tslib_1 = require("tslib");
|
|
6
|
-
const os = require("os");
|
|
7
|
-
const path = require("path");
|
|
8
|
-
const inversify_1 = require("inversify");
|
|
9
|
-
const config_loader_1 = require("../common/config-loader");
|
|
10
|
-
/** The in-memory representation of the api client config file.
|
|
11
|
-
*/
|
|
12
|
-
let CodiacClientConfig = CodiacClientConfig_1 = class CodiacClientConfig {
|
|
13
|
-
constructor() {
|
|
14
|
-
}
|
|
15
|
-
static load() {
|
|
16
|
-
const os = require('os');
|
|
17
|
-
let cfg = this.loader.load(); // yeah this is real helpful - maybe we should just accept the .loader.load() syntax and expose the loader itself?
|
|
18
|
-
return cfg;
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
CodiacClientConfig.CONFIG_PATH = path.posix.join(os.homedir(), `.config`, `codiac-api-client`);
|
|
22
|
-
CodiacClientConfig.CONFIG_FILENAME = "config.json";
|
|
23
|
-
CodiacClientConfig.loader = new config_loader_1.ConfigLoader(CodiacClientConfig_1.CONFIG_PATH, CodiacClientConfig_1.CONFIG_FILENAME);
|
|
24
|
-
CodiacClientConfig = CodiacClientConfig_1 = tslib_1.__decorate([
|
|
25
|
-
(0, inversify_1.injectable)(),
|
|
26
|
-
tslib_1.__metadata("design:paramtypes", [])
|
|
27
|
-
], CodiacClientConfig);
|
|
28
|
-
exports.CodiacClientConfig = CodiacClientConfig;
|
|
29
|
-
//# sourceMappingURL=client-config.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client-config.js","sourceRoot":"","sources":["../../../src/api-clients/gen/client-config.ts"],"names":[],"mappings":";;;;;AAAA,yBAAyB;AACzB,6BAA6B;AAC7B,yCAAuC;AACvC,2DAAuD;AAGvD;GACG;AAEI,IAAM,kBAAkB,0BAAxB,MAAM,kBAAkB;IAY7B;IAEA,CAAC;IATD,MAAM,CAAC,IAAI;QACT,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;QAEzB,IAAI,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAE,kHAAkH;QACjJ,OAAO,GAAG,CAAC;IACb,CAAC;;AATsB,8BAAW,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,mBAAmB,CAAC,CAAC;AAC5E,kCAAe,GAAG,aAAa,CAAC;AACxC,yBAAM,GAAG,IAAI,4BAAY,CAAqB,oBAAkB,CAAC,WAAW,EAAE,oBAAkB,CAAC,eAAe,CAAC,CAAA;AAHrH,kBAAkB;IAD9B,IAAA,sBAAU,GAAE;;GACA,kBAAkB,CAgB9B;AAhBY,gDAAkB"}
|