@pnp/cli-microsoft365 6.0.0-beta.d557a48 → 6.0.0-beta.da9cd2c

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.
@@ -80,6 +80,7 @@ _AadUserGetCommand_instances = new WeakSet(), _AadUserGetCommand_initTelemetry =
80
80
  Object.assign(this.telemetryProperties, {
81
81
  id: typeof args.options.id !== 'undefined',
82
82
  userName: typeof args.options.userName !== 'undefined',
83
+ email: typeof args.options.email !== 'undefined',
83
84
  properties: args.options.properties
84
85
  });
85
86
  });
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
12
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
13
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
14
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
15
+ };
16
+ var _PpDataverseTableGetCommand_instances, _PpDataverseTableGetCommand_initTelemetry, _PpDataverseTableGetCommand_initOptions;
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ const request_1 = require("../../../../request");
19
+ const powerPlatform_1 = require("../../../../utils/powerPlatform");
20
+ const PowerPlatformCommand_1 = require("../../../base/PowerPlatformCommand");
21
+ const commands_1 = require("../../commands");
22
+ class PpDataverseTableGetCommand extends PowerPlatformCommand_1.default {
23
+ constructor() {
24
+ super();
25
+ _PpDataverseTableGetCommand_instances.add(this);
26
+ __classPrivateFieldGet(this, _PpDataverseTableGetCommand_instances, "m", _PpDataverseTableGetCommand_initTelemetry).call(this);
27
+ __classPrivateFieldGet(this, _PpDataverseTableGetCommand_instances, "m", _PpDataverseTableGetCommand_initOptions).call(this);
28
+ }
29
+ get name() {
30
+ return commands_1.default.DATAVERSE_TABLE_GET;
31
+ }
32
+ get description() {
33
+ return 'Gets a dataverse table in a given environment';
34
+ }
35
+ defaultProperties() {
36
+ return ['SchemaName', 'EntitySetName', 'LogicalName', 'IsManaged'];
37
+ }
38
+ commandAction(logger, args) {
39
+ return __awaiter(this, void 0, void 0, function* () {
40
+ if (this.verbose) {
41
+ logger.logToStderr(`Retrieving a table for which the user is an admin...`);
42
+ }
43
+ try {
44
+ const dynamicsApiUrl = yield powerPlatform_1.powerPlatform.getDynamicsInstanceApiUrl(args.options.environment, args.options.asAdmin);
45
+ const requestOptions = {
46
+ url: `${dynamicsApiUrl}/api/data/v9.0/EntityDefinitions(LogicalName='${args.options.name}')?$select=MetadataId,IsCustomEntity,IsManaged,SchemaName,IconVectorName,LogicalName,EntitySetName,IsActivity,DataProviderId,IsRenameable,IsCustomizable,CanCreateForms,CanCreateViews,CanCreateCharts,CanCreateAttributes,CanChangeTrackingBeEnabled,CanModifyAdditionalSettings,CanChangeHierarchicalRelationship,CanEnableSyncToExternalSearchIndex&api-version=9.1`,
47
+ headers: {
48
+ accept: 'application/json;odata.metadata=none'
49
+ },
50
+ responseType: 'json'
51
+ };
52
+ const res = yield request_1.default.get(requestOptions);
53
+ logger.log(res);
54
+ }
55
+ catch (err) {
56
+ this.handleRejectedODataJsonPromise(err);
57
+ }
58
+ });
59
+ }
60
+ }
61
+ _PpDataverseTableGetCommand_instances = new WeakSet(), _PpDataverseTableGetCommand_initTelemetry = function _PpDataverseTableGetCommand_initTelemetry() {
62
+ this.telemetry.push((args) => {
63
+ Object.assign(this.telemetryProperties, {
64
+ asAdmin: !!args.options.asAdmin
65
+ });
66
+ });
67
+ }, _PpDataverseTableGetCommand_initOptions = function _PpDataverseTableGetCommand_initOptions() {
68
+ this.options.unshift({
69
+ option: '-e, --environment <environment>'
70
+ }, {
71
+ option: '-n, --name <name>'
72
+ }, {
73
+ option: '-a, --asAdmin'
74
+ });
75
+ };
76
+ module.exports = new PpDataverseTableGetCommand();
77
+ //# sourceMappingURL=dataverse-table-get.js.map
@@ -0,0 +1,107 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
12
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
13
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
14
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
15
+ };
16
+ var _PpSolutionPublisherGetCommand_instances, _PpSolutionPublisherGetCommand_initTelemetry, _PpSolutionPublisherGetCommand_initOptions, _PpSolutionPublisherGetCommand_initOptionSets, _PpSolutionPublisherGetCommand_initValidators;
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ const request_1 = require("../../../../request");
19
+ const powerPlatform_1 = require("../../../../utils/powerPlatform");
20
+ const validation_1 = require("../../../../utils/validation");
21
+ const PowerPlatformCommand_1 = require("../../../base/PowerPlatformCommand");
22
+ const commands_1 = require("../../commands");
23
+ class PpSolutionPublisherGetCommand extends PowerPlatformCommand_1.default {
24
+ constructor() {
25
+ super();
26
+ _PpSolutionPublisherGetCommand_instances.add(this);
27
+ __classPrivateFieldGet(this, _PpSolutionPublisherGetCommand_instances, "m", _PpSolutionPublisherGetCommand_initTelemetry).call(this);
28
+ __classPrivateFieldGet(this, _PpSolutionPublisherGetCommand_instances, "m", _PpSolutionPublisherGetCommand_initOptions).call(this);
29
+ __classPrivateFieldGet(this, _PpSolutionPublisherGetCommand_instances, "m", _PpSolutionPublisherGetCommand_initValidators).call(this);
30
+ __classPrivateFieldGet(this, _PpSolutionPublisherGetCommand_instances, "m", _PpSolutionPublisherGetCommand_initOptionSets).call(this);
31
+ }
32
+ get name() {
33
+ return commands_1.default.SOLUTION_PUBLISHER_GET;
34
+ }
35
+ get description() {
36
+ return 'Get information about the specified publisher in a given environment.';
37
+ }
38
+ defaultProperties() {
39
+ return ['publisherid', 'uniquename', 'friendlyname'];
40
+ }
41
+ commandAction(logger, args) {
42
+ return __awaiter(this, void 0, void 0, function* () {
43
+ if (this.verbose) {
44
+ logger.logToStderr(`Retrieving a specific publisher '${args.options.id || args.options.name}'...`);
45
+ }
46
+ const res = yield this.getSolutionPublisher(args);
47
+ logger.log(res);
48
+ });
49
+ }
50
+ getSolutionPublisher(args) {
51
+ return __awaiter(this, void 0, void 0, function* () {
52
+ const requestOptions = {
53
+ headers: {
54
+ accept: 'application/json;odata.metadata=none'
55
+ },
56
+ responseType: 'json'
57
+ };
58
+ try {
59
+ const dynamicsApiUrl = yield powerPlatform_1.powerPlatform.getDynamicsInstanceApiUrl(args.options.environment, args.options.asAdmin);
60
+ if (args.options.id) {
61
+ requestOptions.url = `${dynamicsApiUrl}/api/data/v9.0/publishers(${args.options.id})?$select=publisherid,uniquename,friendlyname,versionnumber,isreadonly,description,customizationprefix,customizationoptionvalueprefix&api-version=9.1`;
62
+ const result = yield request_1.default.get(requestOptions);
63
+ return result;
64
+ }
65
+ requestOptions.url = `${dynamicsApiUrl}/api/data/v9.0/publishers?$filter=friendlyname eq \'${args.options.name}\'&$select=publisherid,uniquename,friendlyname,versionnumber,isreadonly,description,customizationprefix,customizationoptionvalueprefix&api-version=9.1`;
66
+ const result = yield request_1.default.get(requestOptions);
67
+ if (result.value.length === 0) {
68
+ throw `The specified publisher '${args.options.name}' does not exist.`;
69
+ }
70
+ return result.value[0];
71
+ }
72
+ catch (err) {
73
+ this.handleRejectedODataJsonPromise(err);
74
+ }
75
+ });
76
+ }
77
+ }
78
+ _PpSolutionPublisherGetCommand_instances = new WeakSet(), _PpSolutionPublisherGetCommand_initTelemetry = function _PpSolutionPublisherGetCommand_initTelemetry() {
79
+ this.telemetry.push((args) => {
80
+ Object.assign(this.telemetryProperties, {
81
+ id: typeof args.options.id !== 'undefined',
82
+ name: typeof args.options.name !== 'undefined',
83
+ asAdmin: !!args.options.asAdmin
84
+ });
85
+ });
86
+ }, _PpSolutionPublisherGetCommand_initOptions = function _PpSolutionPublisherGetCommand_initOptions() {
87
+ this.options.unshift({
88
+ option: '-e, --environment <environment>'
89
+ }, {
90
+ option: '-i, --id [id]'
91
+ }, {
92
+ option: '-n, --name [name]'
93
+ }, {
94
+ option: '-a, --asAdmin'
95
+ });
96
+ }, _PpSolutionPublisherGetCommand_initOptionSets = function _PpSolutionPublisherGetCommand_initOptionSets() {
97
+ this.optionSets.push(['id', 'name']);
98
+ }, _PpSolutionPublisherGetCommand_initValidators = function _PpSolutionPublisherGetCommand_initValidators() {
99
+ this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
100
+ if (args.options.id && !validation_1.validation.isValidGuid(args.options.id)) {
101
+ return `${args.options.id} is not a valid GUID`;
102
+ }
103
+ return true;
104
+ }));
105
+ };
106
+ module.exports = new PpSolutionPublisherGetCommand();
107
+ //# sourceMappingURL=solution-publisher-get.js.map
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
12
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
13
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
14
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
15
+ };
16
+ var _PpSolutionPublisherListCommand_instances, _PpSolutionPublisherListCommand_initTelemetry, _PpSolutionPublisherListCommand_initOptions;
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ const request_1 = require("../../../../request");
19
+ const powerPlatform_1 = require("../../../../utils/powerPlatform");
20
+ const PowerPlatformCommand_1 = require("../../../base/PowerPlatformCommand");
21
+ const commands_1 = require("../../commands");
22
+ class PpSolutionPublisherListCommand extends PowerPlatformCommand_1.default {
23
+ constructor() {
24
+ super();
25
+ _PpSolutionPublisherListCommand_instances.add(this);
26
+ __classPrivateFieldGet(this, _PpSolutionPublisherListCommand_instances, "m", _PpSolutionPublisherListCommand_initTelemetry).call(this);
27
+ __classPrivateFieldGet(this, _PpSolutionPublisherListCommand_instances, "m", _PpSolutionPublisherListCommand_initOptions).call(this);
28
+ }
29
+ get name() {
30
+ return commands_1.default.SOLUTION_PUBLISHER_LIST;
31
+ }
32
+ get description() {
33
+ return 'Lists publishers in a given environment.';
34
+ }
35
+ defaultProperties() {
36
+ return ['publisherid', 'uniquename', 'friendlyname'];
37
+ }
38
+ commandAction(logger, args) {
39
+ return __awaiter(this, void 0, void 0, function* () {
40
+ if (this.verbose) {
41
+ logger.logToStderr(`Retrieving list of publishers...`);
42
+ }
43
+ try {
44
+ const dynamicsApiUrl = yield powerPlatform_1.powerPlatform.getDynamicsInstanceApiUrl(args.options.environment, args.options.asAdmin);
45
+ const requestOptions = {
46
+ url: `${dynamicsApiUrl}/api/data/v9.0/publishers?$select=publisherid,uniquename,friendlyname,versionnumber,isreadonly,description,customizationprefix,customizationoptionvalueprefix${!args.options.includeMicrosoftPublishers ? `&$filter=publisherid ne 'd21aab70-79e7-11dd-8874-00188b01e34f'` : ''}&api-version=9.1`,
47
+ headers: {
48
+ accept: 'application/json;odata.metadata=none'
49
+ },
50
+ responseType: 'json'
51
+ };
52
+ const res = yield request_1.default.get(requestOptions);
53
+ logger.log(res.value);
54
+ }
55
+ catch (err) {
56
+ this.handleRejectedODataJsonPromise(err);
57
+ }
58
+ });
59
+ }
60
+ }
61
+ _PpSolutionPublisherListCommand_instances = new WeakSet(), _PpSolutionPublisherListCommand_initTelemetry = function _PpSolutionPublisherListCommand_initTelemetry() {
62
+ this.telemetry.push((args) => {
63
+ Object.assign(this.telemetryProperties, {
64
+ includeMicrosoftPublishers: typeof args.options.includeMicrosoftPublishers !== 'undefined',
65
+ asAdmin: !!args.options.asAdmin
66
+ });
67
+ });
68
+ }, _PpSolutionPublisherListCommand_initOptions = function _PpSolutionPublisherListCommand_initOptions() {
69
+ this.options.unshift({
70
+ option: '-e, --environment <environment>'
71
+ }, {
72
+ option: '--includeMicrosoftPublishers'
73
+ }, {
74
+ option: '-a, --asAdmin'
75
+ });
76
+ };
77
+ module.exports = new PpSolutionPublisherListCommand();
78
+ //# sourceMappingURL=solution-publisher-list.js.map
@@ -0,0 +1,130 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
12
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
13
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
14
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
15
+ };
16
+ var _PpSolutionPublisherRemoveCommand_instances, _PpSolutionPublisherRemoveCommand_initTelemetry, _PpSolutionPublisherRemoveCommand_initOptions, _PpSolutionPublisherRemoveCommand_initOptionSets, _PpSolutionPublisherRemoveCommand_initValidators;
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ const powerPlatform_1 = require("../../../../utils/powerPlatform");
19
+ const PowerPlatformCommand_1 = require("../../../base/PowerPlatformCommand");
20
+ const commands_1 = require("../../commands");
21
+ const request_1 = require("../../../../request");
22
+ const validation_1 = require("../../../../utils/validation");
23
+ const Cli_1 = require("../../../../cli/Cli");
24
+ const PpSolutionPublisherGetCommand = require("./solution-publisher-get");
25
+ class PpSolutionPublisherRemoveCommand extends PowerPlatformCommand_1.default {
26
+ constructor() {
27
+ super();
28
+ _PpSolutionPublisherRemoveCommand_instances.add(this);
29
+ __classPrivateFieldGet(this, _PpSolutionPublisherRemoveCommand_instances, "m", _PpSolutionPublisherRemoveCommand_initTelemetry).call(this);
30
+ __classPrivateFieldGet(this, _PpSolutionPublisherRemoveCommand_instances, "m", _PpSolutionPublisherRemoveCommand_initOptions).call(this);
31
+ __classPrivateFieldGet(this, _PpSolutionPublisherRemoveCommand_instances, "m", _PpSolutionPublisherRemoveCommand_initValidators).call(this);
32
+ __classPrivateFieldGet(this, _PpSolutionPublisherRemoveCommand_instances, "m", _PpSolutionPublisherRemoveCommand_initOptionSets).call(this);
33
+ }
34
+ get name() {
35
+ return commands_1.default.SOLUTION_PUBLISHER_REMOVE;
36
+ }
37
+ get description() {
38
+ return 'Removes a specific publisher in the specified Power Platform environment.';
39
+ }
40
+ commandAction(logger, args) {
41
+ return __awaiter(this, void 0, void 0, function* () {
42
+ if (this.verbose) {
43
+ logger.logToStderr(`Removes a publisher '${args.options.id || args.options.name}'...`);
44
+ }
45
+ if (args.options.confirm) {
46
+ yield this.deletePublisher(args);
47
+ }
48
+ else {
49
+ const result = yield Cli_1.Cli.prompt({
50
+ type: 'confirm',
51
+ name: 'continue',
52
+ default: false,
53
+ message: `Are you sure you want to remove publisher '${args.options.id || args.options.name}'?`
54
+ });
55
+ if (result.continue) {
56
+ yield this.deletePublisher(args);
57
+ }
58
+ }
59
+ });
60
+ }
61
+ getPublisherId(args) {
62
+ return __awaiter(this, void 0, void 0, function* () {
63
+ if (args.options.id) {
64
+ return args.options.id;
65
+ }
66
+ const options = {
67
+ environment: args.options.environment,
68
+ name: args.options.name,
69
+ output: 'json',
70
+ debug: this.debug,
71
+ verbose: this.verbose
72
+ };
73
+ const output = yield Cli_1.Cli.executeCommandWithOutput(PpSolutionPublisherGetCommand, { options: Object.assign(Object.assign({}, options), { _: [] }) });
74
+ const getPublisherOutput = JSON.parse(output.stdout);
75
+ return getPublisherOutput.publisherid;
76
+ });
77
+ }
78
+ deletePublisher(args) {
79
+ return __awaiter(this, void 0, void 0, function* () {
80
+ try {
81
+ const dynamicsApiUrl = yield powerPlatform_1.powerPlatform.getDynamicsInstanceApiUrl(args.options.environment, args.options.asAdmin);
82
+ const publisherId = yield this.getPublisherId(args);
83
+ const requestOptions = {
84
+ url: `${dynamicsApiUrl}/api/data/v9.1/publishers(${publisherId})`,
85
+ headers: {
86
+ accept: 'application/json;odata.metadata=none'
87
+ },
88
+ responseType: 'json'
89
+ };
90
+ yield request_1.default.delete(requestOptions);
91
+ }
92
+ catch (err) {
93
+ this.handleRejectedODataJsonPromise(err);
94
+ }
95
+ });
96
+ }
97
+ }
98
+ _PpSolutionPublisherRemoveCommand_instances = new WeakSet(), _PpSolutionPublisherRemoveCommand_initTelemetry = function _PpSolutionPublisherRemoveCommand_initTelemetry() {
99
+ this.telemetry.push((args) => {
100
+ Object.assign(this.telemetryProperties, {
101
+ id: typeof args.options.id !== 'undefined',
102
+ name: typeof args.options.name !== 'undefined',
103
+ asAdmin: !!args.options.asAdmin,
104
+ confirm: !!args.options.confirm
105
+ });
106
+ });
107
+ }, _PpSolutionPublisherRemoveCommand_initOptions = function _PpSolutionPublisherRemoveCommand_initOptions() {
108
+ this.options.unshift({
109
+ option: '-e, --environment <environment>'
110
+ }, {
111
+ option: '-i, --id [id]'
112
+ }, {
113
+ option: '-n, --name [name]'
114
+ }, {
115
+ option: '-a, --asAdmin'
116
+ }, {
117
+ option: '--confirm'
118
+ });
119
+ }, _PpSolutionPublisherRemoveCommand_initOptionSets = function _PpSolutionPublisherRemoveCommand_initOptionSets() {
120
+ this.optionSets.push(['id', 'name']);
121
+ }, _PpSolutionPublisherRemoveCommand_initValidators = function _PpSolutionPublisherRemoveCommand_initValidators() {
122
+ this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
123
+ if (args.options.id && !validation_1.validation.isValidGuid(args.options.id)) {
124
+ return `${args.options.id} is not a valid GUID`;
125
+ }
126
+ return true;
127
+ }));
128
+ };
129
+ module.exports = new PpSolutionPublisherRemoveCommand();
130
+ //# sourceMappingURL=solution-publisher-remove.js.map
@@ -0,0 +1,130 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
12
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
13
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
14
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
15
+ };
16
+ var _PpSolutionRemoveCommand_instances, _PpSolutionRemoveCommand_initTelemetry, _PpSolutionRemoveCommand_initOptions, _PpSolutionRemoveCommand_initOptionSets, _PpSolutionRemoveCommand_initValidators;
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ const powerPlatform_1 = require("../../../../utils/powerPlatform");
19
+ const PowerPlatformCommand_1 = require("../../../base/PowerPlatformCommand");
20
+ const commands_1 = require("../../commands");
21
+ const request_1 = require("../../../../request");
22
+ const validation_1 = require("../../../../utils/validation");
23
+ const Cli_1 = require("../../../../cli/Cli");
24
+ const PpSolutionGetCommand = require("./solution-get");
25
+ class PpSolutionRemoveCommand extends PowerPlatformCommand_1.default {
26
+ constructor() {
27
+ super();
28
+ _PpSolutionRemoveCommand_instances.add(this);
29
+ __classPrivateFieldGet(this, _PpSolutionRemoveCommand_instances, "m", _PpSolutionRemoveCommand_initTelemetry).call(this);
30
+ __classPrivateFieldGet(this, _PpSolutionRemoveCommand_instances, "m", _PpSolutionRemoveCommand_initOptions).call(this);
31
+ __classPrivateFieldGet(this, _PpSolutionRemoveCommand_instances, "m", _PpSolutionRemoveCommand_initValidators).call(this);
32
+ __classPrivateFieldGet(this, _PpSolutionRemoveCommand_instances, "m", _PpSolutionRemoveCommand_initOptionSets).call(this);
33
+ }
34
+ get name() {
35
+ return commands_1.default.SOLUTION_REMOVE;
36
+ }
37
+ get description() {
38
+ return 'Removes a specific solution in the specified Power Platform environment.';
39
+ }
40
+ commandAction(logger, args) {
41
+ return __awaiter(this, void 0, void 0, function* () {
42
+ if (this.verbose) {
43
+ logger.logToStderr(`Removing solution '${args.options.id || args.options.name}'...`);
44
+ }
45
+ if (args.options.confirm) {
46
+ yield this.deleteSolution(args);
47
+ }
48
+ else {
49
+ const result = yield Cli_1.Cli.prompt({
50
+ type: 'confirm',
51
+ name: 'continue',
52
+ default: false,
53
+ message: `Are you sure you want to remove solution '${args.options.id || args.options.name}'?`
54
+ });
55
+ if (result.continue) {
56
+ yield this.deleteSolution(args);
57
+ }
58
+ }
59
+ });
60
+ }
61
+ getSolutionId(args) {
62
+ return __awaiter(this, void 0, void 0, function* () {
63
+ if (args.options.id) {
64
+ return args.options.id;
65
+ }
66
+ const options = {
67
+ environment: args.options.environment,
68
+ name: args.options.name,
69
+ output: 'json',
70
+ debug: this.debug,
71
+ verbose: this.verbose
72
+ };
73
+ const output = yield Cli_1.Cli.executeCommandWithOutput(PpSolutionGetCommand, { options: Object.assign(Object.assign({}, options), { _: [] }) });
74
+ const getSolutionOutput = JSON.parse(output.stdout);
75
+ return getSolutionOutput.solutionid;
76
+ });
77
+ }
78
+ deleteSolution(args) {
79
+ return __awaiter(this, void 0, void 0, function* () {
80
+ try {
81
+ const dynamicsApiUrl = yield powerPlatform_1.powerPlatform.getDynamicsInstanceApiUrl(args.options.environment, args.options.asAdmin);
82
+ const solutionId = yield this.getSolutionId(args);
83
+ const requestOptions = {
84
+ url: `${dynamicsApiUrl}/api/data/v9.1/solutions(${solutionId})`,
85
+ headers: {
86
+ accept: 'application/json;odata.metadata=none'
87
+ },
88
+ responseType: 'json'
89
+ };
90
+ yield request_1.default.delete(requestOptions);
91
+ }
92
+ catch (err) {
93
+ this.handleRejectedODataJsonPromise(err);
94
+ }
95
+ });
96
+ }
97
+ }
98
+ _PpSolutionRemoveCommand_instances = new WeakSet(), _PpSolutionRemoveCommand_initTelemetry = function _PpSolutionRemoveCommand_initTelemetry() {
99
+ this.telemetry.push((args) => {
100
+ Object.assign(this.telemetryProperties, {
101
+ id: typeof args.options.id !== 'undefined',
102
+ name: typeof args.options.name !== 'undefined',
103
+ asAdmin: !!args.options.asAdmin,
104
+ confirm: !!args.options.confirm
105
+ });
106
+ });
107
+ }, _PpSolutionRemoveCommand_initOptions = function _PpSolutionRemoveCommand_initOptions() {
108
+ this.options.unshift({
109
+ option: '-e, --environment <environment>'
110
+ }, {
111
+ option: '-i, --id [id]'
112
+ }, {
113
+ option: '-n, --name [name]'
114
+ }, {
115
+ option: '-a, --asAdmin'
116
+ }, {
117
+ option: '--confirm'
118
+ });
119
+ }, _PpSolutionRemoveCommand_initOptionSets = function _PpSolutionRemoveCommand_initOptionSets() {
120
+ this.optionSets.push(['id', 'name']);
121
+ }, _PpSolutionRemoveCommand_initValidators = function _PpSolutionRemoveCommand_initValidators() {
122
+ this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
123
+ if (args.options.id && !validation_1.validation.isValidGuid(args.options.id)) {
124
+ return `${args.options.id} is not a valid GUID`;
125
+ }
126
+ return true;
127
+ }));
128
+ };
129
+ module.exports = new PpSolutionRemoveCommand();
130
+ //# sourceMappingURL=solution-remove.js.map
@@ -7,6 +7,7 @@ exports.default = {
7
7
  CARD_LIST: `${prefix} card list`,
8
8
  CARD_REMOVE: `${prefix} card remove`,
9
9
  DATAVERSE_TABLE_LIST: `${prefix} dataverse table list`,
10
+ DATAVERSE_TABLE_GET: `${prefix} dataverse table get`,
10
11
  ENVIRONMENT_GET: `${prefix} environment get`,
11
12
  ENVIRONMENT_LIST: `${prefix} environment list`,
12
13
  GATEWAY_GET: `${prefix} gateway get`,
@@ -15,6 +16,10 @@ exports.default = {
15
16
  MANAGEMENTAPP_LIST: `${prefix} managementapp list`,
16
17
  SOLUTION_GET: `${prefix} solution get`,
17
18
  SOLUTION_LIST: `${prefix} solution list`,
19
+ SOLUTION_REMOVE: `${prefix} solution remove`,
20
+ SOLUTION_PUBLISHER_GET: `${prefix} solution publisher get`,
21
+ SOLUTION_PUBLISHER_LIST: `${prefix} solution publisher list`,
22
+ SOLUTION_PUBLISHER_REMOVE: `${prefix} solution publisher remove`,
18
23
  TENANT_SETTINGS_LIST: `${prefix} tenant settings list`
19
24
  };
20
25
  //# sourceMappingURL=commands.js.map
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
12
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
13
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
14
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
15
+ };
16
+ var _SpoFileVersionListCommand_instances, _SpoFileVersionListCommand_initTelemetry, _SpoFileVersionListCommand_initOptions, _SpoFileVersionListCommand_initValidators, _SpoFileVersionListCommand_initOptionSets;
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ const request_1 = require("../../../../request");
19
+ const formatting_1 = require("../../../../utils/formatting");
20
+ const urlUtil_1 = require("../../../../utils/urlUtil");
21
+ const validation_1 = require("../../../../utils/validation");
22
+ const SpoCommand_1 = require("../../../base/SpoCommand");
23
+ const commands_1 = require("../../commands");
24
+ class SpoFileVersionListCommand extends SpoCommand_1.default {
25
+ constructor() {
26
+ super();
27
+ _SpoFileVersionListCommand_instances.add(this);
28
+ __classPrivateFieldGet(this, _SpoFileVersionListCommand_instances, "m", _SpoFileVersionListCommand_initTelemetry).call(this);
29
+ __classPrivateFieldGet(this, _SpoFileVersionListCommand_instances, "m", _SpoFileVersionListCommand_initOptions).call(this);
30
+ __classPrivateFieldGet(this, _SpoFileVersionListCommand_instances, "m", _SpoFileVersionListCommand_initValidators).call(this);
31
+ __classPrivateFieldGet(this, _SpoFileVersionListCommand_instances, "m", _SpoFileVersionListCommand_initOptionSets).call(this);
32
+ }
33
+ get name() {
34
+ return commands_1.default.FILE_VERSION_LIST;
35
+ }
36
+ get description() {
37
+ return 'Retrieves all versions of a file';
38
+ }
39
+ commandAction(logger, args) {
40
+ return __awaiter(this, void 0, void 0, function* () {
41
+ if (this.verbose) {
42
+ logger.logToStderr(`Retrieving all versions of file ${args.options.fileUrl || args.options.fileId} at site ${args.options.webUrl}...`);
43
+ }
44
+ try {
45
+ let requestUrl = `${args.options.webUrl}/_api/web`;
46
+ if (args.options.fileUrl) {
47
+ const serverRelativeUrl = urlUtil_1.urlUtil.getServerRelativePath(args.options.webUrl, args.options.fileUrl);
48
+ requestUrl += `/GetFileByServerRelativeUrl('${formatting_1.formatting.encodeQueryParameter(serverRelativeUrl)}')`;
49
+ }
50
+ else {
51
+ requestUrl += `/GetFileById('${args.options.fileId}')`;
52
+ }
53
+ requestUrl += `/versions?$top=5000`;
54
+ const requestOptions = {
55
+ url: requestUrl,
56
+ headers: {
57
+ 'accept': 'application/json;odata=nometadata'
58
+ },
59
+ responseType: 'json'
60
+ };
61
+ const response = yield request_1.default.get(requestOptions);
62
+ logger.log(response.value);
63
+ }
64
+ catch (err) {
65
+ this.handleRejectedODataJsonPromise(err);
66
+ }
67
+ });
68
+ }
69
+ }
70
+ _SpoFileVersionListCommand_instances = new WeakSet(), _SpoFileVersionListCommand_initTelemetry = function _SpoFileVersionListCommand_initTelemetry() {
71
+ this.telemetry.push((args) => {
72
+ Object.assign(this.telemetryProperties, {
73
+ fileUrl: typeof args.options.fileUrl !== 'undefined',
74
+ fileId: typeof args.options.fileId !== 'undefined'
75
+ });
76
+ });
77
+ }, _SpoFileVersionListCommand_initOptions = function _SpoFileVersionListCommand_initOptions() {
78
+ this.options.unshift({
79
+ option: '-w, --webUrl <webUrl>'
80
+ }, {
81
+ option: '-u, --fileUrl [fileUrl]'
82
+ }, {
83
+ option: '-i, --fileId [fileId]'
84
+ });
85
+ }, _SpoFileVersionListCommand_initValidators = function _SpoFileVersionListCommand_initValidators() {
86
+ this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
87
+ if (args.options.fileId && !validation_1.validation.isValidGuid(args.options.fileId)) {
88
+ return `${args.options.fileId} is not a valid GUID`;
89
+ }
90
+ return validation_1.validation.isValidSharePointUrl(args.options.webUrl);
91
+ }));
92
+ }, _SpoFileVersionListCommand_initOptionSets = function _SpoFileVersionListCommand_initOptionSets() {
93
+ this.optionSets.push(['fileUrl', 'fileId']);
94
+ };
95
+ module.exports = new SpoFileVersionListCommand();
96
+ //# sourceMappingURL=file-version-list.js.map