@contrail/cli 2.4.0-alpha → 2.4.0-alpha-0.1
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
CHANGED
|
@@ -17,7 +17,7 @@ $ npm install -g @contrail/cli
|
|
|
17
17
|
$ contrail COMMAND
|
|
18
18
|
running command...
|
|
19
19
|
$ contrail (--version)
|
|
20
|
-
@contrail/cli/2.4.0-alpha darwin-arm64 node-
|
|
20
|
+
@contrail/cli/2.4.0-alpha-0.1 darwin-arm64 node-v21.7.1
|
|
21
21
|
$ contrail --help [COMMAND]
|
|
22
22
|
USAGE
|
|
23
23
|
$ contrail COMMAND
|
package/dist/auth/login.js
CHANGED
|
@@ -15,6 +15,7 @@ const CONFIGURATION = {
|
|
|
15
15
|
async function authUser() {
|
|
16
16
|
logger_1.default.debug('authorizing user...');
|
|
17
17
|
const config = await (0, config_1.getConfig)();
|
|
18
|
+
console.log('config', config);
|
|
18
19
|
if (config && config.apiUserToken && config.apiGateway && config.orgSlug) {
|
|
19
20
|
logger_1.default.debug('populating auth config from fs config...');
|
|
20
21
|
auth_1.Auth.config = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ExternalLink } from '@contrail/entity-types';
|
|
2
|
-
import { AppDeclaration, TriggerKeyDefinition, ConfigPropertyElements,
|
|
2
|
+
import { AppDeclaration, TriggerKeyDefinition, ConfigPropertyElements, CreateAppAccessGrantDTO } from '../../interfaces';
|
|
3
3
|
export declare class TriggerKeyDefinitionParser {
|
|
4
4
|
static buildTriggersArray(appDeclaration: AppDeclaration): Array<TriggerKeyDefinition>;
|
|
5
5
|
}
|
|
@@ -10,5 +10,5 @@ export declare class ExternalLinkParser {
|
|
|
10
10
|
static validateAndGetExternalLinks(externalLinks: ExternalLink[]): ExternalLink[];
|
|
11
11
|
}
|
|
12
12
|
export declare class AccessGrantsParser {
|
|
13
|
-
static buildAccessGrants(appDeclaration: AppDeclaration): Promise<
|
|
13
|
+
static buildAccessGrants(appDeclaration: AppDeclaration): Promise<CreateAppAccessGrantDTO[]>;
|
|
14
14
|
}
|
|
@@ -84,14 +84,17 @@ class AccessGrantsParser {
|
|
|
84
84
|
let currentOrg = currentUser.orgs.find((o) => o.orgSlug === sdk_1.Auth.config.orgSlug);
|
|
85
85
|
currentOrgId = currentOrg.orgId;
|
|
86
86
|
}
|
|
87
|
-
const orgs = await new sdk_1.Entities().get({
|
|
88
|
-
entityName: 'org',
|
|
89
|
-
});
|
|
90
87
|
for (const accessGrant of appDeclaration.accessGrants) {
|
|
91
|
-
const recipientOrg = orgs.find((o) => o.
|
|
88
|
+
const recipientOrg = currentUser.orgs.find((o) => o.orgSlug === accessGrant.orgSlug);
|
|
89
|
+
if (!recipientOrg) {
|
|
90
|
+
throw new Error(`You don't have access to the ${accessGrant.orgSlug} organization`);
|
|
91
|
+
}
|
|
92
|
+
if (recipientOrg.role !== 'ADMIN') {
|
|
93
|
+
throw new Error(`Only administrators of the ${accessGrant.orgSlug} organization can share the app`);
|
|
94
|
+
}
|
|
92
95
|
const grant = {
|
|
93
96
|
issuerReference: `org:${currentOrgId}`,
|
|
94
|
-
recipientReference: `org:${recipientOrg.
|
|
97
|
+
recipientReference: `org:${recipientOrg.orgId}`,
|
|
95
98
|
scope: interfaces_1.AppAccessGrantScope.install,
|
|
96
99
|
};
|
|
97
100
|
accessGrants.push(grant);
|
package/dist/interfaces.d.ts
CHANGED
|
@@ -32,11 +32,13 @@ export interface AccessGrantConfiguration {
|
|
|
32
32
|
orgSlug: string;
|
|
33
33
|
permissions: AppAccessPermission[];
|
|
34
34
|
}
|
|
35
|
-
export
|
|
35
|
+
export type CreateAppAccessGrantDTO = {
|
|
36
36
|
issuerReference: string;
|
|
37
37
|
recipientReference: string;
|
|
38
|
-
appId?: string;
|
|
39
38
|
scope: AppAccessGrantScope;
|
|
39
|
+
};
|
|
40
|
+
export interface AppAccessGrant extends CreateAppAccessGrantDTO {
|
|
41
|
+
appId: string;
|
|
40
42
|
}
|
|
41
43
|
export declare enum AppAccessGrantScope {
|
|
42
44
|
install = "INSTALL"
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contrail/cli",
|
|
3
|
-
"version": "2.4.0-alpha",
|
|
3
|
+
"version": "2.4.0-alpha-0.1",
|
|
4
4
|
"description": "VibeIQ's Contrail Platform CLI.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"contrail-cli": "./bin/run",
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
"axios": "^1.3.5",
|
|
38
38
|
"chalk": "^4.0.0",
|
|
39
39
|
"command-line-usage": "^6.1.1",
|
|
40
|
+
"csv-parse": "^5.5.6",
|
|
40
41
|
"csvtojson": "^2.0.10",
|
|
41
42
|
"esm": "^3.2.25",
|
|
42
43
|
"execa": "^5.0.0",
|
|
@@ -139,4 +140,4 @@
|
|
|
139
140
|
"coverageDirectory": "../coverage",
|
|
140
141
|
"testEnvironment": "node"
|
|
141
142
|
}
|
|
142
|
-
}
|
|
143
|
+
}
|