@celonis/content-cli 1.14.1 → 1.15.0
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/commands/asset-registry/asset-registry-api.js +0 -7
- package/commands/asset-registry/asset-registry.service.js +0 -49
- package/commands/asset-registry/module.js +0 -21
- package/commands/git-profile/module.js +2 -1
- package/commands/profile/module.js +2 -1
- package/content-cli.js +10 -2
- package/core/command/module-handler.js +14 -1
- package/core/http/http-client.js +6 -3
- package/core/profile/profile.service.js +35 -21
- package/core/profile/profile.validator.js +19 -9
- package/lib/commands/asset-registry/asset-registry-api.d.ts +0 -1
- package/lib/commands/asset-registry/asset-registry.interfaces.d.ts +0 -8
- package/lib/commands/asset-registry/asset-registry.service.d.ts +0 -5
- package/lib/commands/asset-registry/module.d.ts +0 -1
- package/lib/content-cli.d.ts +1 -0
- package/lib/core/command/module-handler.d.ts +2 -0
- package/lib/core/profile/profile.service.d.ts +2 -0
- package/lib/core/profile/profile.validator.d.ts +3 -0
- package/package.json +1 -1
|
@@ -52,13 +52,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
52
52
|
.catch((e) => (0, asset_registry_error_1.handleAssetRegistryApiError)(`getting examples for asset type '${assetType}'`, e));
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
|
-
validate(assetType, body) {
|
|
56
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
57
|
-
return this.httpClient()
|
|
58
|
-
.post(AssetRegistryApi.endpointUrl("validate", encodeURIComponent(assetType)), body)
|
|
59
|
-
.catch((e) => (0, asset_registry_error_1.handleAssetRegistryApiError)(`validating asset type '${assetType}'`, e));
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
55
|
static endpointUrl(...segments) {
|
|
63
56
|
return `${AssetRegistryApi.BASE_URL}/${segments.join("/")}`;
|
|
64
57
|
}
|
|
@@ -74,54 +74,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
74
74
|
yield this.outputResponse(data, jsonResponse);
|
|
75
75
|
});
|
|
76
76
|
}
|
|
77
|
-
validate(opts) {
|
|
78
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
79
|
-
const payload = this.buildValidatePayload(opts);
|
|
80
|
-
const data = yield this.api.validate(opts.assetType, payload);
|
|
81
|
-
yield this.outputResponse(data, opts.json);
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
buildValidatePayload(opts) {
|
|
85
|
-
const hasNodeKey = !!opts.nodeKey;
|
|
86
|
-
const hasConfig = !!opts.configuration;
|
|
87
|
-
const hasFile = !!opts.file;
|
|
88
|
-
if (hasFile && (hasNodeKey || hasConfig || !!opts.packageKey)) {
|
|
89
|
-
throw new logger_1.FatalError("Option -f is mutually exclusive with --packageKey, --nodeKey and --configuration.");
|
|
90
|
-
}
|
|
91
|
-
if (hasFile) {
|
|
92
|
-
return this.parseJson(file_service_1.fileService.readFile(opts.file), `-f ${opts.file}`);
|
|
93
|
-
}
|
|
94
|
-
if (hasNodeKey && hasConfig) {
|
|
95
|
-
throw new logger_1.FatalError("Options --nodeKey and --configuration are mutually exclusive. Use --nodeKey to validate a stored node, or --configuration to validate a configuration. For full control, use -f.");
|
|
96
|
-
}
|
|
97
|
-
if (!hasNodeKey && !hasConfig) {
|
|
98
|
-
throw new logger_1.FatalError("Provide --packageKey with one of --nodeKey (validate a stored node) or --configuration (validate a configuration), or use -f for a full request file.");
|
|
99
|
-
}
|
|
100
|
-
if (!opts.packageKey) {
|
|
101
|
-
throw new logger_1.FatalError("--packageKey is required when using --nodeKey or --configuration.");
|
|
102
|
-
}
|
|
103
|
-
if (hasNodeKey) {
|
|
104
|
-
return {
|
|
105
|
-
assetType: opts.assetType,
|
|
106
|
-
packageKey: opts.packageKey,
|
|
107
|
-
nodeKeys: [opts.nodeKey],
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
const configJson = this.parseJson(opts.configuration, "--configuration");
|
|
111
|
-
return {
|
|
112
|
-
assetType: opts.assetType,
|
|
113
|
-
packageKey: opts.packageKey,
|
|
114
|
-
nodes: [{ key: AssetRegistryService.INLINE_VALIDATION_NODE_KEY, configuration: configJson }],
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
parseJson(raw, source) {
|
|
118
|
-
try {
|
|
119
|
-
return JSON.parse(raw);
|
|
120
|
-
}
|
|
121
|
-
catch (_a) {
|
|
122
|
-
throw new logger_1.FatalError(`Invalid JSON in ${source}.`);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
77
|
outputResponse(data, jsonResponse) {
|
|
126
78
|
return __awaiter(this, void 0, void 0, function* () {
|
|
127
79
|
if (jsonResponse) {
|
|
@@ -164,5 +116,4 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
164
116
|
}
|
|
165
117
|
}
|
|
166
118
|
exports.AssetRegistryService = AssetRegistryService;
|
|
167
|
-
AssetRegistryService.INLINE_VALIDATION_NODE_KEY = "validation-node";
|
|
168
119
|
});
|
|
@@ -42,15 +42,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
42
42
|
.requiredOption("--assetType <assetType>", "The asset type identifier (e.g., BOARD_V2)")
|
|
43
43
|
.option("--json", "Return the response as a JSON file")
|
|
44
44
|
.action(this.getExamples);
|
|
45
|
-
assetRegistryCommand.command("validate")
|
|
46
|
-
.description("Validate asset configuration against the asset service's validate endpoint.")
|
|
47
|
-
.requiredOption("--assetType <assetType>", "The asset type identifier (e.g., BOARD_V2)")
|
|
48
|
-
.option("--packageKey <packageKey>", "Package key. Required when validating with --nodeKey or --configuration.")
|
|
49
|
-
.option("--nodeKey <nodeKey>", "Key of an already-stored node to validate (use with --packageKey).")
|
|
50
|
-
.option("--configuration <configuration>", "Inline JSON of a configuration to validate (use with --packageKey).")
|
|
51
|
-
.option("-f, --file <file>", "Path to a JSON file containing a full ValidateRequest body. Mutually exclusive with the build-from-options flags.")
|
|
52
|
-
.option("--json", "Return the response as a JSON file")
|
|
53
|
-
.action(this.validate);
|
|
54
45
|
}
|
|
55
46
|
listTypes(context, command, options) {
|
|
56
47
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -67,18 +58,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
67
58
|
yield new asset_registry_service_1.AssetRegistryService(context).getSchema(options.assetType, !!options.json);
|
|
68
59
|
});
|
|
69
60
|
}
|
|
70
|
-
validate(context, command, options) {
|
|
71
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
72
|
-
yield new asset_registry_service_1.AssetRegistryService(context).validate({
|
|
73
|
-
assetType: options.assetType,
|
|
74
|
-
packageKey: options.packageKey,
|
|
75
|
-
nodeKey: options.nodeKey,
|
|
76
|
-
configuration: options.configuration,
|
|
77
|
-
file: options.file,
|
|
78
|
-
json: !!options.json,
|
|
79
|
-
});
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
61
|
getExamples(context, command, options) {
|
|
83
62
|
return __awaiter(this, void 0, void 0, function* () {
|
|
84
63
|
yield new asset_registry_service_1.AssetRegistryService(context).getExamples(options.assetType, !!options.json);
|
|
@@ -27,7 +27,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
27
27
|
const gitCommand = configurator.command("git")
|
|
28
28
|
.description("Commands related to Git settings");
|
|
29
29
|
const gitProfileCommand = gitCommand.command("profile")
|
|
30
|
-
.description("Manage Git profiles required to use git-related operations.")
|
|
30
|
+
.description("Manage Git profiles required to use git-related operations.")
|
|
31
|
+
.skipProfileLoading();
|
|
31
32
|
gitProfileCommand.command("list")
|
|
32
33
|
.description("Command to list all stored Git profiles")
|
|
33
34
|
.action(this.listProfiles);
|
|
@@ -26,7 +26,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
26
26
|
class Module extends module_handler_1.IModule {
|
|
27
27
|
register(context, configurator) {
|
|
28
28
|
const command = configurator.command("profile")
|
|
29
|
-
.description("Manage profiles required to access a system.")
|
|
29
|
+
.description("Manage profiles required to access a system.")
|
|
30
|
+
.skipProfileLoading();
|
|
30
31
|
command.command("list")
|
|
31
32
|
.description("Command to list all stored profiles")
|
|
32
33
|
.action(this.listProfiles);
|
package/content-cli.js
CHANGED
|
@@ -19,7 +19,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
19
19
|
})(function (require, exports) {
|
|
20
20
|
"use strict";
|
|
21
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.createProgram = void 0;
|
|
22
|
+
exports.loadProfileOnDemand = exports.createProgram = void 0;
|
|
23
23
|
const semverSatisfies = require("semver/functions/satisfies");
|
|
24
24
|
const commander_1 = require("commander");
|
|
25
25
|
const module_handler_1 = require("./core/command/module-handler");
|
|
@@ -69,6 +69,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
69
69
|
return program;
|
|
70
70
|
}
|
|
71
71
|
exports.createProgram = createProgram;
|
|
72
|
+
function loadProfileOnDemand(program, context) {
|
|
73
|
+
program.hook("preAction", (_program, actionCommand) => __awaiter(this, void 0, void 0, function* () {
|
|
74
|
+
if ((0, module_handler_1.shouldLoadProfile)(actionCommand)) {
|
|
75
|
+
yield context.init();
|
|
76
|
+
}
|
|
77
|
+
}));
|
|
78
|
+
}
|
|
79
|
+
exports.loadProfileOnDemand = loadProfileOnDemand;
|
|
72
80
|
/**
|
|
73
81
|
* To support the legacy command structure, we have to configure some root commands
|
|
74
82
|
* that the individual modules will extend.
|
|
@@ -103,8 +111,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
103
111
|
});
|
|
104
112
|
}
|
|
105
113
|
const context = new cli_context_1.Context(globalOpts);
|
|
106
|
-
yield context.init();
|
|
107
114
|
const program = createProgram(context, { devMode: !!globalOpts.dev });
|
|
115
|
+
loadProfileOnDemand(program, context);
|
|
108
116
|
try {
|
|
109
117
|
yield program.parseAsync(process.argv);
|
|
110
118
|
}
|
|
@@ -18,7 +18,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
18
18
|
})(function (require, exports) {
|
|
19
19
|
"use strict";
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.CommandConfig = exports.Configurator = exports.ModuleHandler = exports.IModule = void 0;
|
|
21
|
+
exports.CommandConfig = exports.Configurator = exports.shouldLoadProfile = exports.ModuleHandler = exports.IModule = void 0;
|
|
22
22
|
const path = require("path");
|
|
23
23
|
const fs = require("fs");
|
|
24
24
|
const commander_1 = require("commander");
|
|
@@ -120,6 +120,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
122
|
exports.ModuleHandler = ModuleHandler;
|
|
123
|
+
function shouldLoadProfile(command) {
|
|
124
|
+
for (let cmd = command; cmd; cmd = cmd.parent) {
|
|
125
|
+
if (cmd.skipsProfileLoading) {
|
|
126
|
+
return false;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return true;
|
|
130
|
+
}
|
|
131
|
+
exports.shouldLoadProfile = shouldLoadProfile;
|
|
123
132
|
/**
|
|
124
133
|
* Allows the creation of root level commands.
|
|
125
134
|
*/
|
|
@@ -192,6 +201,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
192
201
|
this.cmd.isBeta = true;
|
|
193
202
|
return this;
|
|
194
203
|
}
|
|
204
|
+
skipProfileLoading() {
|
|
205
|
+
this.cmd.skipsProfileLoading = true;
|
|
206
|
+
return this;
|
|
207
|
+
}
|
|
195
208
|
action(handler) {
|
|
196
209
|
this.cmd.action(() => __awaiter(this, void 0, void 0, function* () {
|
|
197
210
|
try {
|
package/core/http/http-client.js
CHANGED
|
@@ -246,11 +246,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
246
246
|
return Object.assign(Object.assign(Object.assign({}, this.buildAuthorizationHeaders(this.context.profile, contentType)), tracing_1.TracingUtils.getTracingHeaders()), { "User-Agent": "content-cli v" + version_1.VersionUtils.getCurrentCliVersion() });
|
|
247
247
|
}
|
|
248
248
|
buildAuthorizationHeaders(profile, contentType) {
|
|
249
|
-
const
|
|
250
|
-
return {
|
|
251
|
-
Authorization: `${authenticationType} ${profile.apiToken}`,
|
|
249
|
+
const headers = {
|
|
252
250
|
"Content-Type": contentType !== null && contentType !== void 0 ? contentType : "application/json",
|
|
253
251
|
};
|
|
252
|
+
if (profile.apiToken) {
|
|
253
|
+
const authenticationType = profile.authenticationType || profile_interface_1.AuthenticationType.BEARER;
|
|
254
|
+
headers.Authorization = `${authenticationType} ${profile.apiToken}`;
|
|
255
|
+
}
|
|
256
|
+
return headers;
|
|
254
257
|
}
|
|
255
258
|
}
|
|
256
259
|
exports.HttpClient = HttpClient;
|
|
@@ -72,15 +72,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
72
72
|
.catch(() => reject(`The profile ${profileName} couldn't be resolved.`));
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
|
-
else if (process.env.TEAM_URL && process.env.API_TOKEN) {
|
|
76
|
-
resolve(this.buildProfileFromEnvVariables());
|
|
77
|
-
}
|
|
78
|
-
else if (process.env.CELONIS_URL && process.env.CELONIS_API_TOKEN) {
|
|
79
|
-
this.mapCelonisEnvProfile();
|
|
80
|
-
resolve(this.buildProfileFromEnvVariables());
|
|
81
|
-
}
|
|
82
75
|
else {
|
|
83
|
-
|
|
76
|
+
const envProfileSource = this.selectEnvProfileSource();
|
|
77
|
+
if (envProfileSource) {
|
|
78
|
+
if (envProfileSource.requiresCelonisMapping) {
|
|
79
|
+
this.mapCelonisEnvProfile();
|
|
80
|
+
}
|
|
81
|
+
resolve(this.buildProfileFromEnvVariables());
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
reject(`The profile ${profileName} couldn't be resolved due to missing environment variables.`);
|
|
85
|
+
}
|
|
84
86
|
}
|
|
85
87
|
}
|
|
86
88
|
catch (e) {
|
|
@@ -136,6 +138,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
136
138
|
});
|
|
137
139
|
});
|
|
138
140
|
}
|
|
141
|
+
selectEnvProfileSource() {
|
|
142
|
+
var _a, _b;
|
|
143
|
+
const sources = [
|
|
144
|
+
{ teamUrl: process.env.TEAM_URL, apiToken: process.env.API_TOKEN, requiresCelonisMapping: false },
|
|
145
|
+
{ teamUrl: process.env.CELONIS_URL, apiToken: process.env.CELONIS_API_TOKEN, requiresCelonisMapping: true },
|
|
146
|
+
].filter(source => !!source.teamUrl);
|
|
147
|
+
return (_b = (_a = sources.find(source => !!source.apiToken)) !== null && _a !== void 0 ? _a : sources[0]) !== null && _b !== void 0 ? _b : null;
|
|
148
|
+
}
|
|
139
149
|
buildProfileFromEnvVariables() {
|
|
140
150
|
return __awaiter(this, void 0, void 0, function* () {
|
|
141
151
|
const profileVariables = this.getProfileEnvVariables();
|
|
@@ -146,7 +156,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
146
156
|
authenticationType: profile_interface_1.AuthenticationType.BEARER,
|
|
147
157
|
type: profile_interface_1.ProfileType.KEY
|
|
148
158
|
};
|
|
149
|
-
|
|
159
|
+
profile_validator_1.ProfileValidator.validateEnvironmentProfile(profile);
|
|
160
|
+
if (!profile.apiToken) {
|
|
161
|
+
logger_1.logger.warn(`No API token provided. Requests to ${profile.team} will be sent without an authorization header.`);
|
|
162
|
+
}
|
|
150
163
|
return profile;
|
|
151
164
|
});
|
|
152
165
|
}
|
|
@@ -266,9 +279,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
266
279
|
if (!this.isProfileExpired(profile, expiryBuffer)) {
|
|
267
280
|
return;
|
|
268
281
|
}
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
282
|
+
try {
|
|
283
|
+
const issuer = yield openid_client_1.Issuer.discover(profile.team);
|
|
284
|
+
if (profile.type === profile_interface_1.ProfileType.DEVICE_CODE) {
|
|
272
285
|
const oauthClient = new issuer.Client({
|
|
273
286
|
client_id: "content-cli",
|
|
274
287
|
token_endpoint_auth_method: "none",
|
|
@@ -278,12 +291,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
278
291
|
profile.expiresAt = tokenSet.expires_at;
|
|
279
292
|
profile.refreshToken = tokenSet.refresh_token;
|
|
280
293
|
}
|
|
281
|
-
|
|
282
|
-
logger_1.logger.error(new logger_1.FatalError("The profile cannot be refreshed. Please retry or recreate profile."));
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
else {
|
|
286
|
-
try {
|
|
294
|
+
else {
|
|
287
295
|
const oauthClient = new issuer.Client({
|
|
288
296
|
client_id: profile.clientId,
|
|
289
297
|
client_secret: profile.clientSecret,
|
|
@@ -296,13 +304,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
296
304
|
profile.apiToken = tokenSet.access_token;
|
|
297
305
|
profile.expiresAt = tokenSet.expires_at;
|
|
298
306
|
}
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
307
|
+
}
|
|
308
|
+
catch (err) {
|
|
309
|
+
throw this.unrefreshableProfile(profile.name, err);
|
|
302
310
|
}
|
|
303
311
|
yield this.storeProfile(profile);
|
|
304
312
|
});
|
|
305
313
|
}
|
|
314
|
+
unrefreshableProfile(profileName, err) {
|
|
315
|
+
const cause = err instanceof Error ? err.message : "an unrecognised error";
|
|
316
|
+
logger_1.logger.debug(`Refreshing the profile ${profileName} failed: ${cause}`);
|
|
317
|
+
logger_1.logger.warn(`The profile ${profileName} cannot be refreshed. Retry, or recreate it.`);
|
|
318
|
+
return new Error(`The profile ${profileName} cannot be refreshed.`);
|
|
319
|
+
}
|
|
306
320
|
getProfileEnvVariables() {
|
|
307
321
|
return {
|
|
308
322
|
teamUrl: this.getBaseTeamUrl(process.env.TEAM_URL),
|
|
@@ -25,23 +25,33 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
25
25
|
class ProfileValidator {
|
|
26
26
|
static validateProfile(profile) {
|
|
27
27
|
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
-
|
|
29
|
-
logger_1.logger.error(new logger_1.FatalError("The name can not be empty"));
|
|
30
|
-
}
|
|
31
|
-
if (profile.team == null) {
|
|
32
|
-
logger_1.logger.error(new logger_1.FatalError("The team can not be empty"));
|
|
33
|
-
}
|
|
28
|
+
this.validateIdentity(profile);
|
|
34
29
|
if (profile.type === profile_interface_1.ProfileType.KEY && profile.apiToken == null) {
|
|
35
30
|
logger_1.logger.error(new logger_1.FatalError("The api token can not be empty for this profile type"));
|
|
36
31
|
}
|
|
37
32
|
if (profile.type === profile_interface_1.ProfileType.CLIENT_CREDENTIALS && (profile.clientId == null || profile.clientSecret == null)) {
|
|
38
33
|
logger_1.logger.error(new logger_1.FatalError("The client id and secret can not be empty for this profile type"));
|
|
39
34
|
}
|
|
40
|
-
|
|
41
|
-
logger_1.logger.error(new logger_1.FatalError("The provided url is not a valid url."));
|
|
42
|
-
}
|
|
35
|
+
this.validateTeamUrl(profile);
|
|
43
36
|
});
|
|
44
37
|
}
|
|
38
|
+
static validateEnvironmentProfile(profile) {
|
|
39
|
+
this.validateIdentity(profile);
|
|
40
|
+
this.validateTeamUrl(profile);
|
|
41
|
+
}
|
|
42
|
+
static validateIdentity(profile) {
|
|
43
|
+
if (profile.name == null) {
|
|
44
|
+
logger_1.logger.error(new logger_1.FatalError("The name can not be empty"));
|
|
45
|
+
}
|
|
46
|
+
if (profile.team == null) {
|
|
47
|
+
logger_1.logger.error(new logger_1.FatalError("The team can not be empty"));
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
static validateTeamUrl(profile) {
|
|
51
|
+
if (!validUrl.isUri(profile.team)) {
|
|
52
|
+
logger_1.logger.error(new logger_1.FatalError("The provided url is not a valid url."));
|
|
53
|
+
}
|
|
54
|
+
}
|
|
45
55
|
}
|
|
46
56
|
exports.ProfileValidator = ProfileValidator;
|
|
47
57
|
});
|
|
@@ -8,6 +8,5 @@ export declare class AssetRegistryApi {
|
|
|
8
8
|
getType(assetType: string): Promise<AssetRegistryDescriptor>;
|
|
9
9
|
getSchema(assetType: string): Promise<any>;
|
|
10
10
|
getExamples(assetType: string): Promise<any>;
|
|
11
|
-
validate(assetType: string, body: any): Promise<any>;
|
|
12
11
|
private static endpointUrl;
|
|
13
12
|
}
|
|
@@ -28,11 +28,3 @@ export interface AssetContributions {
|
|
|
28
28
|
dataPipelineEntityTypes: string[];
|
|
29
29
|
actionTypes: string[];
|
|
30
30
|
}
|
|
31
|
-
export interface ValidateOptions {
|
|
32
|
-
assetType: string;
|
|
33
|
-
packageKey?: string;
|
|
34
|
-
nodeKey?: string;
|
|
35
|
-
configuration?: string;
|
|
36
|
-
file?: string;
|
|
37
|
-
json: boolean;
|
|
38
|
-
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ValidateOptions } from "./asset-registry.interfaces";
|
|
2
1
|
import { Context } from "../../core/command/cli-context";
|
|
3
2
|
export declare class AssetRegistryService {
|
|
4
3
|
private readonly api;
|
|
@@ -8,10 +7,6 @@ export declare class AssetRegistryService {
|
|
|
8
7
|
getType(assetType: string, jsonResponse: boolean): Promise<void>;
|
|
9
8
|
getSchema(assetType: string, jsonResponse: boolean): Promise<void>;
|
|
10
9
|
getExamples(assetType: string, jsonResponse: boolean): Promise<void>;
|
|
11
|
-
validate(opts: ValidateOptions): Promise<void>;
|
|
12
|
-
private static readonly INLINE_VALIDATION_NODE_KEY;
|
|
13
|
-
private buildValidatePayload;
|
|
14
|
-
private parseJson;
|
|
15
10
|
private outputResponse;
|
|
16
11
|
private logDescriptorSummary;
|
|
17
12
|
private logDescriptorDetail;
|
package/lib/content-cli.d.ts
CHANGED
|
@@ -14,3 +14,4 @@ export interface CreateProgramOptions {
|
|
|
14
14
|
* Build a fully-configured Commander program without parsing argv
|
|
15
15
|
*/
|
|
16
16
|
export declare function createProgram(context: Context, opts?: CreateProgramOptions): Command;
|
|
17
|
+
export declare function loadProfileOnDemand(program: Command, context: Context): void;
|
|
@@ -20,6 +20,7 @@ export declare class ModuleHandler {
|
|
|
20
20
|
discoverAndRegisterModules(rootPath: string, devMode?: boolean): void;
|
|
21
21
|
}
|
|
22
22
|
type CommandHandler = (context: Context, command: Command, options: OptionValues) => Promise<void>;
|
|
23
|
+
export declare function shouldLoadProfile(command: Command): boolean;
|
|
23
24
|
/**
|
|
24
25
|
* Allows the creation of root level commands.
|
|
25
26
|
*/
|
|
@@ -53,6 +54,7 @@ export declare class CommandConfig {
|
|
|
53
54
|
requiredOption(flags: string, description?: string, defaultValue?: string | boolean | string[]): CommandConfig;
|
|
54
55
|
deprecationNotice(deprecationMessage: string): CommandConfig;
|
|
55
56
|
beta(): CommandConfig;
|
|
57
|
+
skipProfileLoading(): this;
|
|
56
58
|
action(handler: CommandHandler): void;
|
|
57
59
|
private printDeprecationNoticeIfDeprecated;
|
|
58
60
|
private printBetaNoticeIfBetaCommand;
|
|
@@ -10,6 +10,7 @@ export declare class ProfileService {
|
|
|
10
10
|
makeDefaultProfile(profileName: string): Promise<Profile>;
|
|
11
11
|
getDefaultProfile(): string;
|
|
12
12
|
storeProfile(profile: Profile): Promise<void>;
|
|
13
|
+
private selectEnvProfileSource;
|
|
13
14
|
private buildProfileFromEnvVariables;
|
|
14
15
|
private storeConfig;
|
|
15
16
|
private createProfileContainerIfNotExists;
|
|
@@ -18,6 +19,7 @@ export declare class ProfileService {
|
|
|
18
19
|
getAllFilesInDirectory(): string[];
|
|
19
20
|
authorizeProfile(profile: Profile): Promise<void>;
|
|
20
21
|
refreshProfile(profile: Profile): Promise<void>;
|
|
22
|
+
private unrefreshableProfile;
|
|
21
23
|
private getProfileEnvVariables;
|
|
22
24
|
private getBaseTeamUrl;
|
|
23
25
|
private isProfileExpired;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { Profile } from "./profile.interface";
|
|
2
2
|
export declare class ProfileValidator {
|
|
3
3
|
static validateProfile(profile: Profile): Promise<any>;
|
|
4
|
+
static validateEnvironmentProfile(profile: Profile): void;
|
|
5
|
+
private static validateIdentity;
|
|
6
|
+
private static validateTeamUrl;
|
|
4
7
|
}
|