@axinom/mosaic-cli 0.22.0-rc.15 → 0.22.0-rc.16

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/dist/cli/index.js CHANGED
@@ -12,6 +12,7 @@ const msg_codegen_1 = require("../commands/msg-codegen");
12
12
  const msg_diff_1 = require("../commands/msg-diff");
13
13
  const pg_dump_1 = require("../commands/pg-dump");
14
14
  const publish_schema_to_db_1 = require("../commands/publish-schema-to-db");
15
+ const unpublish_pilet_1 = require("../commands/unpublish-pilet");
15
16
  const run = () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
16
17
  yargs
17
18
  .scriptName('mosaic')
@@ -24,7 +25,8 @@ const run = () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
24
25
  .command(msg_diff_1.msgDiff)
25
26
  .command(create_extension_config_1.createExtensionConfigCommand)
26
27
  .command(graphql_diff_1.graphqlDiff)
27
- .command(hosting_1.hosting);
28
+ .command(hosting_1.hosting)
29
+ .command(unpublish_pilet_1.unpublishPilet);
28
30
  //adding cli extensions:
29
31
  yield Promise.all((0, create_extension_config_1.getExtensions)().map((library) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
30
32
  try {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";;;;AAAA,+BAA+B;AAC/B,iEAA6D;AAC7D,iFAG6C;AAC7C,mEAA8D;AAC9D,2DAAuD;AACvD,iDAA8C;AAC9C,yDAAqD;AACrD,mDAA+C;AAC/C,iDAA6C;AAC7C,2EAAqE;AAE9D,MAAM,GAAG,GAAG,GAAwB,EAAE;IAC3C,KAAK;SACF,UAAU,CAAC,QAAQ,CAAC;SACpB,GAAG,EAAE;SACL,OAAO,CAAC,gCAAc,CAAC;SACvB,OAAO,CAAC,iCAAc,CAAC;SACvB,OAAO,CAAC,wCAAiB,CAAC;SAC1B,OAAO,CAAC,gBAAM,CAAC;SACf,OAA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ACnB,OAAO,CAAC,kBAAO,CAAC;SAChB,OAAO,CAAC,sDAA4B,CAAC;SACrC,OAAO,CAAC,0BAAW,CAAC;SACpB,OAAO,CAAC,iBAAO,CAAC;SAChB,OAAO,CAAC,gCAAc,CAAC,CAAC;IAE3B,wBAAwB;IACxB,MAAM,OAAO,CAAC,GAAG,CACf,IAAA,uCAAa,GAAE,CAAC,GAAG,CAAC,CAAO,OAAO,EAAE,EAAE;QACpC,IAAI;YACF,MAAM,EAAE,YAAY,EAAE,GAAG,yBAAa,OAAO,yBAAC,CAAC;YAC/C,IAAI,YAAY,EAAE;gBAChB,YAAY,EAAE,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;oBACzB,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;gBACrB,CAAC,CAAC,CAAC;aACJ;SACF;QAAC,OAAO,KAAK,EAAE;YACd,gEAAgE;SACjE;IACH,CAAC,CAAA,CAAC,CACH,CAAC;IAEF,KAAK;SACF,aAAa,EAAE;SACf,IAAI,EAAE;SACN,MAAM,CAAC,wDAAwD,CAAC,CAAC,IAAI,CAAC;AAC3E,CAAC,CAAA,CAAC;AAnCW,QAAA,GAAG,OAmCd"}
@@ -0,0 +1,3 @@
1
+ import { CommandModule } from 'yargs';
2
+ import { UnpublishPiletOptions } from './unpublish-pilet-options';
3
+ export declare const unpublishPilet: CommandModule<unknown, UnpublishPiletOptions>;
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.unpublishPilet = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const mosaic_service_common_1 = require("@axinom/mosaic-service-common");
6
+ const chalk = require("chalk");
7
+ const unpublish_pilet_1 = require("./unpublish-pilet");
8
+ exports.unpublishPilet = {
9
+ command: 'unpublish-pilet',
10
+ describe: 'Unpublishes a pilet from Mosaic Micro Frontend Service',
11
+ builder: (yargs) => yargs
12
+ .option('tenantId', {
13
+ alias: ['t'],
14
+ describe: 'Tenant ID',
15
+ string: true,
16
+ demandOption: true,
17
+ })
18
+ .option('environmentId', {
19
+ alias: ['e'],
20
+ describe: 'Environment ID',
21
+ string: true,
22
+ demandOption: true,
23
+ })
24
+ .option('apiKey', {
25
+ alias: ['a', 'apiKey'],
26
+ describe: 'Base 64 encoded credentials for a Service Account with permission Pilet: Delete',
27
+ string: true,
28
+ demandOption: true,
29
+ })
30
+ .option('microFrontendServiceBaseUrl', {
31
+ alias: ['m', 'microFrontendServiceBaseUrl'],
32
+ describe: 'Base URL of Mosaic Micro Frontend Service.',
33
+ string: true,
34
+ demandOption: true,
35
+ })
36
+ .option('name', {
37
+ alias: ['n'],
38
+ describe: 'Name of the pilet to unpublish.',
39
+ string: true,
40
+ demandOption: true,
41
+ }),
42
+ handler: (options) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
43
+ try {
44
+ const result = yield (0, unpublish_pilet_1.callUnpublishPilet)(options);
45
+ if (result) {
46
+ console.log(chalk.green('Pilet successfully unpublished.'));
47
+ console.log(chalk.green(JSON.stringify({
48
+ tenantId: options.tenantId,
49
+ environmentId: options.environmentId,
50
+ piletName: options.name,
51
+ })));
52
+ }
53
+ }
54
+ catch (err) {
55
+ (0, mosaic_service_common_1.assertError)(err);
56
+ console.log(chalk.red('Command failed:'), err.message, err.response.data.message);
57
+ }
58
+ }),
59
+ };
60
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/unpublish-pilet/index.ts"],"names":[],"mappings":";;;;AAAA,yEAA4D;AAC5D,+BAA+B;AAE/B,uDAAuD;AAG1C,QAAA,cAAc,GAAkD;IAC3E,OAAO,EAAE,iBAAiB;IAC1B,QAAQ,EAAE,wDAAwD;IAClE,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CACjB,KAAK;SACF,MAAM,CAAC,UAAU,EAAE;QAClB,KAAK,EAAE,CAAC,GAAG,CAAC;QACZ,QAAQ,EAAE,WAA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;YACjB,OAAO,CAAC,GAAG,CACT,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,EAC5B,GAAG,CAAC,OAAO,EACV,GAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CACnC,CAAC;SACH;IACH,CAAC,CAAA;CACF,CAAC"}
@@ -0,0 +1,7 @@
1
+ export interface UnpublishPiletOptions {
2
+ microFrontendServiceBaseUrl: string;
3
+ tenantId: string;
4
+ environmentId: string;
5
+ apiKey: string;
6
+ name: string;
7
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=unpublish-pilet-options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unpublish-pilet-options.js","sourceRoot":"","sources":["../../../src/commands/unpublish-pilet/unpublish-pilet-options.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ import { UnpublishPiletOptions } from './unpublish-pilet-options';
2
+ export declare const callUnpublishPilet: (options: UnpublishPiletOptions) => Promise<boolean>;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.callUnpublishPilet = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const axios_1 = require("axios");
6
+ const callUnpublishPilet = (options) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
7
+ const apiKeyCredentials = Buffer.from(options.apiKey, 'base64')
8
+ .toString()
9
+ .split(':');
10
+ const response = yield axios_1.default.delete(new URL(`v1/pilets/${options.tenantId}/${options.environmentId}/${options.name}`, options.microFrontendServiceBaseUrl).toString(), {
11
+ auth: {
12
+ username: apiKeyCredentials[0],
13
+ password: apiKeyCredentials[1],
14
+ },
15
+ });
16
+ return response.data.success;
17
+ });
18
+ exports.callUnpublishPilet = callUnpublishPilet;
19
+ //# sourceMappingURL=unpublish-pilet.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unpublish-pilet.js","sourceRoot":"","sources":["../../../src/commands/unpublish-pilet/unpublish-pilet.ts"],"names":[],"mappings":";;;;AAAA,iCAA0B;AAGnB,MAAM,kBAAkB,GAAG,CAChC,OAA8B,EACZ,EAAE;IACpB,MAAM,iBAAiB,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,QAAQ,CAAC;SAC5D,QAAQ,EAAE;SACV,KAAK,CAAC,GAAG,CAAC,CAAC;IAEd,MAAM,QAAQ,GAAG,MAAM,eAAK,CAAC,MAAM,CACjC,IAAI,GAAG,CACL,aAAa,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,aAAa,IAAI,OAAO,CAAC,IAAI,EAAE,EACxE,OAAO,CAAC,2BAA2B,CACpC,CAAC,QAAQ,EAAE,EACZ;QACE,IAAI,EAAE;YACJ,QAAQ,EAAE,iBAAiB,CAAC,CAAC,CAAC;YAC9B,QAAQ,EAAE,iBAAiB,CAAC,CAAC,CAAC;SAC/B;KACF,CACF,CAAC;IACF,OAAO,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC;AAC/B,CAAC,CAAA,CAAC;AApBW,QAAA,kBAAkB,sBAoB7B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axinom/mosaic-cli",
3
- "version": "0.22.0-rc.15",
3
+ "version": "0.22.0-rc.16",
4
4
  "description": "The Axinom Mosaic CLI",
5
5
  "author": "Axinom",
6
6
  "license": "PROPRIETARY",
@@ -33,8 +33,8 @@
33
33
  "@asyncapi/diff": "^0.4.1",
34
34
  "@asyncapi/modelina": "^1.8.4",
35
35
  "@asyncapi/parser": "^2.0.2",
36
- "@axinom/mosaic-id-link-be": "^0.13.6-rc.15",
37
- "@axinom/mosaic-service-common": "^0.37.0-rc.15",
36
+ "@axinom/mosaic-id-link-be": "^0.13.6-rc.16",
37
+ "@axinom/mosaic-service-common": "^0.37.0-rc.16",
38
38
  "@graphql-inspector/core": "^3.1.2",
39
39
  "@stoplight/spectral": "^5.9.1",
40
40
  "axios": "^0.19.2",
@@ -68,5 +68,5 @@
68
68
  "publishConfig": {
69
69
  "access": "public"
70
70
  },
71
- "gitHead": "b13c9199a8752a429219333fc6ada0a16936177d"
71
+ "gitHead": "83f6ac3d68fa7a58334ef4ef9289110beb5c5e89"
72
72
  }
package/src/cli/index.ts CHANGED
@@ -11,6 +11,7 @@ import { msgCodegen } from '../commands/msg-codegen';
11
11
  import { msgDiff } from '../commands/msg-diff';
12
12
  import { pgDump } from '../commands/pg-dump';
13
13
  import { publishSchemaToDb } from '../commands/publish-schema-to-db';
14
+ import { unpublishPilet } from '../commands/unpublish-pilet';
14
15
 
15
16
  export const run = async (): Promise<void> => {
16
17
  yargs
@@ -24,7 +25,8 @@ export const run = async (): Promise<void> => {
24
25
  .command(msgDiff)
25
26
  .command(createExtensionConfigCommand)
26
27
  .command(graphqlDiff)
27
- .command(hosting);
28
+ .command(hosting)
29
+ .command(unpublishPilet);
28
30
 
29
31
  //adding cli extensions:
30
32
  await Promise.all(
@@ -0,0 +1,67 @@
1
+ import { assertError } from '@axinom/mosaic-service-common';
2
+ import * as chalk from 'chalk';
3
+ import { CommandModule } from 'yargs';
4
+ import { callUnpublishPilet } from './unpublish-pilet';
5
+ import { UnpublishPiletOptions } from './unpublish-pilet-options';
6
+
7
+ export const unpublishPilet: CommandModule<unknown, UnpublishPiletOptions> = {
8
+ command: 'unpublish-pilet',
9
+ describe: 'Unpublishes a pilet from Mosaic Micro Frontend Service',
10
+ builder: (yargs) =>
11
+ yargs
12
+ .option('tenantId', {
13
+ alias: ['t'],
14
+ describe: 'Tenant ID',
15
+ string: true,
16
+ demandOption: true,
17
+ })
18
+ .option('environmentId', {
19
+ alias: ['e'],
20
+ describe: 'Environment ID',
21
+ string: true,
22
+ demandOption: true,
23
+ })
24
+ .option('apiKey', {
25
+ alias: ['a', 'apiKey'],
26
+ describe:
27
+ 'Base 64 encoded credentials for a Service Account with permission Pilet: Delete',
28
+ string: true,
29
+ demandOption: true,
30
+ })
31
+ .option('microFrontendServiceBaseUrl', {
32
+ alias: ['m', 'microFrontendServiceBaseUrl'],
33
+ describe: 'Base URL of Mosaic Micro Frontend Service.',
34
+ string: true,
35
+ demandOption: true,
36
+ })
37
+ .option('name', {
38
+ alias: ['n'],
39
+ describe: 'Name of the pilet to unpublish.',
40
+ string: true,
41
+ demandOption: true,
42
+ }),
43
+ handler: async (options: UnpublishPiletOptions): Promise<void> => {
44
+ try {
45
+ const result = await callUnpublishPilet(options);
46
+ if (result) {
47
+ console.log(chalk.green('Pilet successfully unpublished.'));
48
+ console.log(
49
+ chalk.green(
50
+ JSON.stringify({
51
+ tenantId: options.tenantId,
52
+ environmentId: options.environmentId,
53
+ piletName: options.name,
54
+ }),
55
+ ),
56
+ );
57
+ }
58
+ } catch (err) {
59
+ assertError(err);
60
+ console.log(
61
+ chalk.red('Command failed:'),
62
+ err.message,
63
+ (err as any).response.data.message,
64
+ );
65
+ }
66
+ },
67
+ };
@@ -0,0 +1,7 @@
1
+ export interface UnpublishPiletOptions {
2
+ microFrontendServiceBaseUrl: string;
3
+ tenantId: string;
4
+ environmentId: string;
5
+ apiKey: string;
6
+ name: string;
7
+ }
@@ -0,0 +1,24 @@
1
+ import Axios from 'axios';
2
+ import { UnpublishPiletOptions } from './unpublish-pilet-options';
3
+
4
+ export const callUnpublishPilet = async (
5
+ options: UnpublishPiletOptions,
6
+ ): Promise<boolean> => {
7
+ const apiKeyCredentials = Buffer.from(options.apiKey, 'base64')
8
+ .toString()
9
+ .split(':');
10
+
11
+ const response = await Axios.delete(
12
+ new URL(
13
+ `v1/pilets/${options.tenantId}/${options.environmentId}/${options.name}`,
14
+ options.microFrontendServiceBaseUrl,
15
+ ).toString(),
16
+ {
17
+ auth: {
18
+ username: apiKeyCredentials[0],
19
+ password: apiKeyCredentials[1],
20
+ },
21
+ },
22
+ );
23
+ return response.data.success;
24
+ };