contensis-cli 1.0.0-beta.5
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/.vscode/launch.json +15 -0
- package/README.md +631 -0
- package/cli.js +7 -0
- package/dist/commands/connect.js +44 -0
- package/dist/commands/connect.js.map +7 -0
- package/dist/commands/create.js +55 -0
- package/dist/commands/create.js.map +7 -0
- package/dist/commands/get.js +121 -0
- package/dist/commands/get.js.map +7 -0
- package/dist/commands/globalOptions.js +139 -0
- package/dist/commands/globalOptions.js.map +7 -0
- package/dist/commands/import.js +95 -0
- package/dist/commands/import.js.map +7 -0
- package/dist/commands/index.js +81 -0
- package/dist/commands/index.js.map +7 -0
- package/dist/commands/list.js +88 -0
- package/dist/commands/list.js.map +7 -0
- package/dist/commands/login.js +56 -0
- package/dist/commands/login.js.map +7 -0
- package/dist/commands/push.js +133 -0
- package/dist/commands/push.js.map +7 -0
- package/dist/commands/remove.js +77 -0
- package/dist/commands/remove.js.map +7 -0
- package/dist/commands/set.js +55 -0
- package/dist/commands/set.js.map +7 -0
- package/dist/index.js +32 -0
- package/dist/index.js.map +7 -0
- package/dist/localisation/en-GB.js +203 -0
- package/dist/localisation/en-GB.js.map +7 -0
- package/dist/models/AppError.d.js +2 -0
- package/dist/models/AppError.d.js.map +7 -0
- package/dist/models/Cache.d.js +2 -0
- package/dist/models/Cache.d.js.map +7 -0
- package/dist/models/JsModules.d.js +2 -0
- package/dist/models/JsModules.d.js.map +7 -0
- package/dist/providers/CredentialProvider.js +87 -0
- package/dist/providers/CredentialProvider.js.map +7 -0
- package/dist/providers/SessionCacheProvider.js +91 -0
- package/dist/providers/SessionCacheProvider.js.map +7 -0
- package/dist/providers/file-provider.js +113 -0
- package/dist/providers/file-provider.js.map +7 -0
- package/dist/services/ContensisAuthService.js +75 -0
- package/dist/services/ContensisAuthService.js.map +7 -0
- package/dist/services/ContensisCliService.js +1110 -0
- package/dist/services/ContensisCliService.js.map +7 -0
- package/dist/shell.js +261 -0
- package/dist/shell.js.map +7 -0
- package/dist/util/console.printer.js +194 -0
- package/dist/util/console.printer.js.map +7 -0
- package/dist/util/csv.formatter.js +50 -0
- package/dist/util/csv.formatter.js.map +7 -0
- package/dist/util/index.js +94 -0
- package/dist/util/index.js.map +7 -0
- package/dist/util/json.formatter.js +29 -0
- package/dist/util/json.formatter.js.map +7 -0
- package/dist/util/logger.js +184 -0
- package/dist/util/logger.js.map +7 -0
- package/dist/util/xml.formatter.js +51 -0
- package/dist/util/xml.formatter.js.map +7 -0
- package/dist/version.js +29 -0
- package/dist/version.js.map +7 -0
- package/esbuild.config.js +49 -0
- package/headless-setup.sh +7 -0
- package/package.json +59 -0
- package/patches/inquirer-command-prompt+0.1.0.patch +27 -0
- package/src/commands/connect.ts +23 -0
- package/src/commands/create.ts +41 -0
- package/src/commands/get.ts +139 -0
- package/src/commands/globalOptions.ts +126 -0
- package/src/commands/import.ts +89 -0
- package/src/commands/index.ts +72 -0
- package/src/commands/list.ts +90 -0
- package/src/commands/login.ts +33 -0
- package/src/commands/push.ts +120 -0
- package/src/commands/remove.ts +77 -0
- package/src/commands/set.ts +40 -0
- package/src/index.ts +19 -0
- package/src/localisation/en-GB.ts +211 -0
- package/src/models/AppError.d.ts +40 -0
- package/src/models/Cache.d.ts +25 -0
- package/src/models/JsModules.d.ts +1 -0
- package/src/providers/CredentialProvider.ts +88 -0
- package/src/providers/SessionCacheProvider.ts +74 -0
- package/src/providers/file-provider.ts +72 -0
- package/src/services/ContensisAuthService.ts +70 -0
- package/src/services/ContensisCliService.ts +1390 -0
- package/src/shell.ts +250 -0
- package/src/util/console.printer.ts +203 -0
- package/src/util/csv.formatter.ts +21 -0
- package/src/util/index.ts +67 -0
- package/src/util/json.formatter.ts +1 -0
- package/src/util/logger.ts +165 -0
- package/src/util/xml.formatter.ts +20 -0
- package/src/version.ts +1 -0
- package/tsconfig.json +22 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var ContensisAuthService_exports = {};
|
|
20
|
+
__export(ContensisAuthService_exports, {
|
|
21
|
+
default: () => ContensisAuthService_default
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(ContensisAuthService_exports);
|
|
24
|
+
var import_client = require("contensis-management-api/lib/client");
|
|
25
|
+
class ContensisAuthService {
|
|
26
|
+
client;
|
|
27
|
+
constructor({
|
|
28
|
+
clientId = "",
|
|
29
|
+
clientSecret = "",
|
|
30
|
+
username,
|
|
31
|
+
password,
|
|
32
|
+
refreshToken,
|
|
33
|
+
projectId,
|
|
34
|
+
rootUrl
|
|
35
|
+
}) {
|
|
36
|
+
let credentials;
|
|
37
|
+
if (username && password) {
|
|
38
|
+
credentials = {
|
|
39
|
+
clientType: "contensis_classic",
|
|
40
|
+
clientDetails: {
|
|
41
|
+
username,
|
|
42
|
+
password
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
} else if (refreshToken) {
|
|
46
|
+
credentials = {
|
|
47
|
+
clientType: "contensis_classic_refresh_token",
|
|
48
|
+
clientDetails: {
|
|
49
|
+
refreshToken
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
} else {
|
|
53
|
+
credentials = {
|
|
54
|
+
clientType: "client_credentials",
|
|
55
|
+
clientDetails: {
|
|
56
|
+
clientId,
|
|
57
|
+
clientSecret
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
this.client = import_client.NodejsClient.create({
|
|
62
|
+
...credentials,
|
|
63
|
+
projectId,
|
|
64
|
+
rootUrl
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
BearerToken = async () => this.client.bearerToken || await this.client.ensureBearerToken();
|
|
68
|
+
RefreshToken = async () => !this.client.isRefreshTokenExpired() ? this.client.refreshToken : null;
|
|
69
|
+
ProjectId = () => this.client.clientConfig.projectId;
|
|
70
|
+
RootUrl = () => this.client.clientConfig.rootUrl;
|
|
71
|
+
}
|
|
72
|
+
var ContensisAuthService_default = ContensisAuthService;
|
|
73
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
74
|
+
0 && (module.exports = {});
|
|
75
|
+
//# sourceMappingURL=ContensisAuthService.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/services/ContensisAuthService.ts"],
|
|
4
|
+
"sourcesContent": ["import { NodejsClient } from 'contensis-management-api/lib/client';\nimport { ClientGrants, ClientGrantType } from 'contensis-core-api';\n\nclass ContensisAuthService {\n private client: NodejsClient;\n\n constructor({\n clientId = '',\n clientSecret = '',\n username,\n password,\n refreshToken,\n projectId,\n rootUrl,\n }: {\n clientId?: string;\n clientSecret?: string;\n username?: string;\n password?: string;\n refreshToken?: string;\n projectId: string;\n rootUrl: string;\n }) {\n let credentials: {\n clientType: ClientGrantType;\n clientDetails: ClientGrants;\n };\n if (username && password) {\n credentials = {\n clientType: 'contensis_classic',\n clientDetails: {\n username,\n password,\n },\n };\n } else if (refreshToken) {\n credentials = {\n clientType: 'contensis_classic_refresh_token',\n clientDetails: {\n refreshToken,\n },\n };\n } else {\n credentials = {\n clientType: 'client_credentials',\n clientDetails: {\n clientId,\n clientSecret,\n },\n };\n }\n\n this.client = NodejsClient.create({\n ...credentials,\n projectId,\n rootUrl,\n });\n }\n\n BearerToken = async () =>\n this.client.bearerToken || (await this.client.ensureBearerToken());\n RefreshToken = async () =>\n !this.client.isRefreshTokenExpired() ? this.client.refreshToken : null;\n\n /* PROJECTS */\n ProjectId = () => this.client.clientConfig.projectId;\n RootUrl = () => this.client.clientConfig.rootUrl;\n}\n\nexport default ContensisAuthService;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAA6B;AAG7B,MAAM,qBAAqB;AAAA,EACjB;AAAA,EAER,YAAY;AAAA,IACV,WAAW;AAAA,IACX,eAAe;AAAA,IACf;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,GAQG;AACD,QAAI;AAIJ,QAAI,YAAY,UAAU;AACxB,oBAAc;AAAA,QACZ,YAAY;AAAA,QACZ,eAAe;AAAA,UACb;AAAA,UACA;AAAA,QACF;AAAA,MACF;AAAA,IACF,WAAW,cAAc;AACvB,oBAAc;AAAA,QACZ,YAAY;AAAA,QACZ,eAAe;AAAA,UACb;AAAA,QACF;AAAA,MACF;AAAA,IACF,OAAO;AACL,oBAAc;AAAA,QACZ,YAAY;AAAA,QACZ,eAAe;AAAA,UACb;AAAA,UACA;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAEA,SAAK,SAAS,2BAAa,OAAO;AAAA,MAChC,GAAG;AAAA,MACH;AAAA,MACA;AAAA,IACF,CAAC;AAAA,EACH;AAAA,EAEA,cAAc,YACZ,KAAK,OAAO,eAAgB,MAAM,KAAK,OAAO,kBAAkB;AAAA,EAClE,eAAe,YACb,CAAC,KAAK,OAAO,sBAAsB,IAAI,KAAK,OAAO,eAAe;AAAA,EAGpE,YAAY,MAAM,KAAK,OAAO,aAAa;AAAA,EAC3C,UAAU,MAAM,KAAK,OAAO,aAAa;AAC3C;AAEA,IAAO,+BAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|