@pnp/cli-microsoft365 8.0.0-beta.e6f9331 → 8.1.0-beta.3a80e6f

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.
Files changed (107) hide show
  1. package/.eslintrc.cjs +1 -0
  2. package/allCommands.json +1 -1
  3. package/allCommandsFull.json +1 -1
  4. package/dist/Auth.js +10 -18
  5. package/dist/Command.js +49 -2
  6. package/dist/chili/chili.js +0 -23
  7. package/dist/cli/cli.js +61 -101
  8. package/dist/m365/commands/login.js +44 -96
  9. package/dist/m365/commands/setup.js +0 -4
  10. package/dist/m365/connection/commands/connection-remove.js +6 -2
  11. package/dist/m365/connection/commands/connection-set.js +4 -1
  12. package/dist/m365/connection/commands/connection-use.js +25 -4
  13. package/dist/m365/entra/commands/m365group/m365group-set.js +66 -29
  14. package/dist/m365/entra/commands/m365group/m365group-user-add.js +109 -32
  15. package/dist/m365/entra/commands/m365group/m365group-user-set.js +159 -84
  16. package/dist/m365/entra/commands/multitenant/MultitenantOrganization.js +2 -0
  17. package/dist/m365/entra/commands/multitenant/multitenant-add.js +65 -0
  18. package/dist/m365/entra/commands/multitenant/multitenant-get.js +32 -0
  19. package/dist/m365/entra/commands/multitenant/multitenant-remove.js +118 -0
  20. package/dist/m365/entra/commands/multitenant/multitenant-set.js +72 -0
  21. package/dist/m365/entra/commands.js +4 -0
  22. package/dist/m365/external/commands/connection/connection-doctor.js +10 -24
  23. package/dist/m365/flow/commands/flow-get.js +1 -1
  24. package/dist/m365/flow/commands/flow-list.js +2 -1
  25. package/dist/m365/graph/commands/subscription/subscription-add.js +4 -2
  26. package/dist/m365/spe/ContainerTypeProperties.js +2 -0
  27. package/dist/m365/spe/commands/containertype/containertype-list.js +49 -0
  28. package/dist/m365/spe/commands.js +2 -1
  29. package/dist/m365/spfx/commands/project/base-project-command.js +36 -126
  30. package/dist/m365/spo/commands/applicationcustomizer/applicationcustomizer-get.js +16 -21
  31. package/dist/m365/spo/commands/commandset/commandset-get.js +31 -17
  32. package/dist/m365/spo/commands/contenttype/contenttype-field-list.js +124 -0
  33. package/dist/m365/spo/commands/field/field-list.js +1 -1
  34. package/dist/m365/spo/commands/file/file-roleassignment-add.js +1 -1
  35. package/dist/m365/spo/commands/file/file-roleinheritance-break.js +1 -1
  36. package/dist/m365/spo/commands/file/file-roleinheritance-reset.js +1 -1
  37. package/dist/m365/spo/commands/folder/folder-retentionlabel-ensure.js +1 -1
  38. package/dist/m365/spo/commands/folder/folder-sharinglink-get.js +86 -0
  39. package/dist/m365/spo/commands/folder/folder-sharinglink-list.js +110 -0
  40. package/dist/m365/spo/commands/list/ListInstance.js +6 -1
  41. package/dist/m365/spo/commands/list/list-get.js +9 -3
  42. package/dist/m365/spo/commands/list/list-roleassignment-add.js +46 -21
  43. package/dist/m365/spo/commands/list/list-roleassignment-remove.js +48 -46
  44. package/dist/m365/spo/commands/page/page-clientsidewebpart-add.js +2 -3
  45. package/dist/m365/spo/commands/page/page-text-add.js +2 -3
  46. package/dist/m365/spo/commands/spo-search.js +3 -4
  47. package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-get.js +19 -5
  48. package/dist/m365/spo/commands/tenant/tenant-commandset-get.js +20 -6
  49. package/dist/m365/spo/commands.js +3 -0
  50. package/dist/m365/teams/commands/meeting/meeting-attendancereport-get.js +119 -0
  51. package/dist/m365/teams/commands/message/message-remove.js +112 -0
  52. package/dist/m365/teams/commands.js +2 -0
  53. package/dist/m365/viva/commands/engage/engage-community-add.js +166 -0
  54. package/dist/m365/viva/commands.js +1 -0
  55. package/dist/utils/drive.js +61 -0
  56. package/dist/utils/formatting.js +30 -1
  57. package/dist/utils/spo.js +69 -6
  58. package/dist/utils/teams.js +49 -0
  59. package/dist/utils/zod.js +124 -0
  60. package/docs/docs/cmd/connection/connection-use.mdx +8 -2
  61. package/docs/docs/cmd/entra/m365group/m365group-set.mdx +37 -7
  62. package/docs/docs/cmd/entra/m365group/m365group-user-add.mdx +28 -10
  63. package/docs/docs/cmd/entra/m365group/m365group-user-set.mdx +35 -11
  64. package/docs/docs/cmd/entra/multitenant/multitenant-add.mdx +107 -0
  65. package/docs/docs/cmd/entra/multitenant/multitenant-get.mdx +94 -0
  66. package/docs/docs/cmd/entra/multitenant/multitenant-remove.mdx +58 -0
  67. package/docs/docs/cmd/entra/multitenant/multitenant-set.mdx +53 -0
  68. package/docs/docs/cmd/external/connection/connection-doctor.mdx +9 -9
  69. package/docs/docs/cmd/flow/flow-get.mdx +149 -283
  70. package/docs/docs/cmd/graph/subscription/subscription-add.mdx +18 -0
  71. package/docs/docs/cmd/planner/plan/plan-remove.mdx +1 -1
  72. package/docs/docs/cmd/spe/containertype/containertype-list.mdx +102 -0
  73. package/docs/docs/cmd/spo/applicationcustomizer/applicationcustomizer-get.mdx +87 -38
  74. package/docs/docs/cmd/spo/applicationcustomizer/applicationcustomizer-list.mdx +22 -28
  75. package/docs/docs/cmd/spo/commandset/commandset-get.mdx +75 -24
  76. package/docs/docs/cmd/spo/commandset/commandset-list.mdx +26 -32
  77. package/docs/docs/cmd/spo/contenttype/contenttype-field-list.mdx +172 -0
  78. package/docs/docs/cmd/spo/contenttype/contenttype-list.mdx +3 -3
  79. package/docs/docs/cmd/spo/field/field-list.mdx +3 -3
  80. package/docs/docs/cmd/spo/file/file-retentionlabel-ensure.mdx +1 -1
  81. package/docs/docs/cmd/spo/file/file-roleassignment-add.mdx +2 -2
  82. package/docs/docs/cmd/spo/file/file-roleassignment-remove.mdx +1 -1
  83. package/docs/docs/cmd/spo/file/file-roleinheritance-break.mdx +1 -1
  84. package/docs/docs/cmd/spo/file/file-roleinheritance-reset.mdx +1 -1
  85. package/docs/docs/cmd/spo/folder/folder-retentionlabel-ensure.mdx +2 -2
  86. package/docs/docs/cmd/spo/folder/folder-sharinglink-get.mdx +110 -0
  87. package/docs/docs/cmd/spo/folder/folder-sharinglink-list.mdx +114 -0
  88. package/docs/docs/cmd/spo/list/list-get.mdx +6 -0
  89. package/docs/docs/cmd/spo/list/list-roleassignment-add.mdx +15 -3
  90. package/docs/docs/cmd/spo/list/list-roleassignment-remove.mdx +15 -3
  91. package/docs/docs/cmd/spo/listitem/listitem-retentionlabel-ensure.mdx +4 -4
  92. package/docs/docs/cmd/spo/listitem/listitem-retentionlabel-remove.mdx +1 -1
  93. package/docs/docs/cmd/spo/listitem/listitem-roleassignment-add.mdx +9 -9
  94. package/docs/docs/cmd/spo/listitem/listitem-roleassignment-remove.mdx +7 -7
  95. package/docs/docs/cmd/spo/site/site-recyclebinitem-list.mdx +1 -1
  96. package/docs/docs/cmd/spo/tenant/tenant-applicationcustomizer-get.mdx +79 -30
  97. package/docs/docs/cmd/spo/tenant/tenant-applicationcustomizer-list.mdx +20 -19
  98. package/docs/docs/cmd/spo/tenant/tenant-commandset-get.mdx +84 -38
  99. package/docs/docs/cmd/spo/tenant/tenant-commandset-list.mdx +20 -19
  100. package/docs/docs/cmd/spo/web/web-roleassignment-add.mdx +1 -1
  101. package/docs/docs/cmd/spo/web/web-roleassignment-remove.mdx +1 -1
  102. package/docs/docs/cmd/teams/meeting/meeting-attendancereport-get.mdx +138 -0
  103. package/docs/docs/cmd/teams/meeting/meeting-list.mdx +7 -3
  104. package/docs/docs/cmd/teams/message/message-remove.mdx +63 -0
  105. package/docs/docs/cmd/viva/engage/engage-community-add.mdx +168 -0
  106. package/npm-shrinkwrap.json +590 -1024
  107. package/package.json +7 -3
@@ -0,0 +1,118 @@
1
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
2
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
3
+ 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");
4
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
+ };
6
+ var _EntraMultitenantRemoveCommand_instances, _EntraMultitenantRemoveCommand_initTelemetry, _EntraMultitenantRemoveCommand_initOptions;
7
+ import request from '../../../../request.js';
8
+ import GraphCommand from '../../../base/GraphCommand.js';
9
+ import commands from '../../commands.js';
10
+ import { odata } from '../../../../utils/odata.js';
11
+ import { cli } from '../../../../cli/cli.js';
12
+ class EntraMultitenantRemoveCommand extends GraphCommand {
13
+ get name() {
14
+ return commands.MULTITENANT_REMOVE;
15
+ }
16
+ get description() {
17
+ return 'Removes a multitenant organization';
18
+ }
19
+ constructor() {
20
+ super();
21
+ _EntraMultitenantRemoveCommand_instances.add(this);
22
+ __classPrivateFieldGet(this, _EntraMultitenantRemoveCommand_instances, "m", _EntraMultitenantRemoveCommand_initTelemetry).call(this);
23
+ __classPrivateFieldGet(this, _EntraMultitenantRemoveCommand_instances, "m", _EntraMultitenantRemoveCommand_initOptions).call(this);
24
+ }
25
+ async commandAction(logger, args) {
26
+ const removeMultitenantOrg = async () => {
27
+ try {
28
+ const tenantId = await this.getCurrentTenantId();
29
+ let tenantsId = await this.getAllTenantsIds();
30
+ const tenantsCount = tenantsId.length;
31
+ if (tenantsCount > 0) {
32
+ const tasks = tenantsId
33
+ .filter(x => x !== tenantId)
34
+ .map(t => this.removeTenant(logger, t));
35
+ await Promise.all(tasks);
36
+ do {
37
+ if (this.verbose) {
38
+ await logger.logToStderr(`Waiting 30 seconds...`);
39
+ }
40
+ await new Promise(resolve => setTimeout(resolve, 30000));
41
+ // from current behavior, removing tenant can take a few seconds
42
+ // current tenant must be removed once all previous ones were removed
43
+ if (this.verbose) {
44
+ await logger.logToStderr(`Checking all tenants were removed...`);
45
+ }
46
+ tenantsId = await this.getAllTenantsIds();
47
+ if (this.verbose) {
48
+ await logger.logToStderr(`Number of removed tenants: ${tenantsCount - tenantsId.length}`);
49
+ }
50
+ } while (tenantsId.length !== 1);
51
+ // current tenant must be removed as the last one
52
+ await this.removeTenant(logger, tenantId);
53
+ await logger.logToStderr('Your Multi-Tenant organization is being removed. This can take up to 2 hours.');
54
+ }
55
+ }
56
+ catch (err) {
57
+ this.handleRejectedODataJsonPromise(err);
58
+ }
59
+ };
60
+ if (args.options.force) {
61
+ await removeMultitenantOrg();
62
+ }
63
+ else {
64
+ const result = await cli.promptForConfirmation({ message: 'Are you sure you want to remove multitenant organization?' });
65
+ if (result) {
66
+ await removeMultitenantOrg();
67
+ }
68
+ }
69
+ }
70
+ async getAllTenantsIds() {
71
+ const requestOptions = {
72
+ url: `${this.resource}/v1.0/tenantRelationships/multiTenantOrganization/tenants?$select=tenantId`,
73
+ headers: {
74
+ accept: 'application/json;odata.metadata=none'
75
+ },
76
+ responseType: 'json'
77
+ };
78
+ const tenants = await odata.getAllItems(requestOptions);
79
+ return tenants.map(x => x.tenantId);
80
+ }
81
+ async getCurrentTenantId() {
82
+ const requestOptions = {
83
+ url: `${this.resource}/v1.0/organization?$select=id`,
84
+ headers: {
85
+ accept: 'application/json;odata.metadata=none'
86
+ },
87
+ responseType: 'json'
88
+ };
89
+ const organizations = await odata.getAllItems(requestOptions);
90
+ return organizations[0].id;
91
+ }
92
+ async removeTenant(logger, tenantId) {
93
+ if (this.verbose) {
94
+ await logger.logToStderr(`Removing tenant: ${tenantId}`);
95
+ }
96
+ const requestOptions = {
97
+ url: `${this.resource}/v1.0/tenantRelationships/multiTenantOrganization/tenants/${tenantId}`,
98
+ headers: {
99
+ accept: 'application/json;odata.metadata=none'
100
+ },
101
+ responseType: 'json'
102
+ };
103
+ await request.delete(requestOptions);
104
+ }
105
+ }
106
+ _EntraMultitenantRemoveCommand_instances = new WeakSet(), _EntraMultitenantRemoveCommand_initTelemetry = function _EntraMultitenantRemoveCommand_initTelemetry() {
107
+ this.telemetry.push((args) => {
108
+ Object.assign(this.telemetryProperties, {
109
+ force: !!args.options.force
110
+ });
111
+ });
112
+ }, _EntraMultitenantRemoveCommand_initOptions = function _EntraMultitenantRemoveCommand_initOptions() {
113
+ this.options.unshift({
114
+ option: '-f, --force'
115
+ });
116
+ };
117
+ export default new EntraMultitenantRemoveCommand();
118
+ //# sourceMappingURL=multitenant-remove.js.map
@@ -0,0 +1,72 @@
1
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
2
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
3
+ 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");
4
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
+ };
6
+ var _EntraMultitenantSetCommand_instances, _EntraMultitenantSetCommand_initTelemetry, _EntraMultitenantSetCommand_initOptions, _EntraMultitenantSetCommand_initValidators, _EntraMultitenantSetCommand_initTypes;
7
+ import request from '../../../../request.js';
8
+ import GraphCommand from '../../../base/GraphCommand.js';
9
+ import commands from '../../commands.js';
10
+ class EntraMultitenantSetCommand extends GraphCommand {
11
+ get name() {
12
+ return commands.MULTITENANT_SET;
13
+ }
14
+ get description() {
15
+ return 'Updates the properties of a multitenant organization';
16
+ }
17
+ constructor() {
18
+ super();
19
+ _EntraMultitenantSetCommand_instances.add(this);
20
+ __classPrivateFieldGet(this, _EntraMultitenantSetCommand_instances, "m", _EntraMultitenantSetCommand_initTelemetry).call(this);
21
+ __classPrivateFieldGet(this, _EntraMultitenantSetCommand_instances, "m", _EntraMultitenantSetCommand_initOptions).call(this);
22
+ __classPrivateFieldGet(this, _EntraMultitenantSetCommand_instances, "m", _EntraMultitenantSetCommand_initValidators).call(this);
23
+ __classPrivateFieldGet(this, _EntraMultitenantSetCommand_instances, "m", _EntraMultitenantSetCommand_initTypes).call(this);
24
+ }
25
+ async commandAction(logger, args) {
26
+ if (this.verbose) {
27
+ await logger.logToStderr('Updating multitenant organization...');
28
+ }
29
+ const requestOptions = {
30
+ url: `${this.resource}/v1.0/tenantRelationships/multiTenantOrganization`,
31
+ headers: {
32
+ accept: 'application/json;odata.metadata=none'
33
+ },
34
+ responseType: 'json',
35
+ data: {
36
+ description: args.options.description,
37
+ displayName: args.options.displayName
38
+ }
39
+ };
40
+ try {
41
+ await request.patch(requestOptions);
42
+ }
43
+ catch (err) {
44
+ this.handleRejectedODataJsonPromise(err);
45
+ }
46
+ }
47
+ }
48
+ _EntraMultitenantSetCommand_instances = new WeakSet(), _EntraMultitenantSetCommand_initTelemetry = function _EntraMultitenantSetCommand_initTelemetry() {
49
+ this.telemetry.push((args) => {
50
+ Object.assign(this.telemetryProperties, {
51
+ displayName: typeof args.options.displayName !== 'undefined',
52
+ description: typeof args.options.description !== 'undefined'
53
+ });
54
+ });
55
+ }, _EntraMultitenantSetCommand_initOptions = function _EntraMultitenantSetCommand_initOptions() {
56
+ this.options.unshift({
57
+ option: '-n, --displayName [displayName]'
58
+ }, {
59
+ option: '-d, --description [description]'
60
+ });
61
+ }, _EntraMultitenantSetCommand_initValidators = function _EntraMultitenantSetCommand_initValidators() {
62
+ this.validators.push(async (args) => {
63
+ if (!args.options.displayName && !args.options.description) {
64
+ return 'Specify either displayName or description or both.';
65
+ }
66
+ return true;
67
+ });
68
+ }, _EntraMultitenantSetCommand_initTypes = function _EntraMultitenantSetCommand_initTypes() {
69
+ this.types.string.push('displayName', 'description');
70
+ };
71
+ export default new EntraMultitenantSetCommand();
72
+ //# sourceMappingURL=multitenant-set.js.map
@@ -72,6 +72,10 @@ export default {
72
72
  M365GROUP_USER_LIST: `${prefix} m365group user list`,
73
73
  M365GROUP_USER_REMOVE: `${prefix} m365group user remove`,
74
74
  M365GROUP_USER_SET: `${prefix} m365group user set`,
75
+ MULTITENANT_ADD: `${prefix} multitenant add`,
76
+ MULTITENANT_GET: `${prefix} multitenant get`,
77
+ MULTITENANT_REMOVE: `${prefix} multitenant remove`,
78
+ MULTITENANT_SET: `${prefix} multitenant set`,
75
79
  OAUTH2GRANT_ADD: `${prefix} oauth2grant add`,
76
80
  OAUTH2GRANT_LIST: `${prefix} oauth2grant list`,
77
81
  OAUTH2GRANT_REMOVE: `${prefix} oauth2grant remove`,
@@ -5,11 +5,10 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
5
5
  };
6
6
  var _ExternalConnectionDoctorCommand_instances, _a, _ExternalConnectionDoctorCommand_initOptions, _ExternalConnectionDoctorCommand_initValidators;
7
7
  import os from 'os';
8
- import { cli } from '../../../../cli/cli.js';
9
8
  import request from '../../../../request.js';
10
- import { settingsNames } from '../../../../settingsNames.js';
11
9
  import GraphCommand from '../../../base/GraphCommand.js';
12
10
  import commands from '../../commands.js';
11
+ import { CheckStatus, formatting } from '../../../../utils/formatting.js';
13
12
  class ExternalConnectionDoctorCommand extends GraphCommand {
14
13
  get name() {
15
14
  return commands.CONNECTION_DOCTOR;
@@ -28,9 +27,7 @@ class ExternalConnectionDoctorCommand extends GraphCommand {
28
27
  const ux = args.options.ux ?? 'all';
29
28
  const output = args.options.output;
30
29
  this.checksStatus = [];
31
- const showSpinner = cli.getSettingWithDefaultValue(settingsNames.showSpinner, true) &&
32
- output === 'text' &&
33
- typeof global.it === 'undefined';
30
+ const show = output === 'text';
34
31
  let checks = [
35
32
  {
36
33
  id: 'loadExternalConnection',
@@ -114,17 +111,10 @@ class ExternalConnectionDoctorCommand extends GraphCommand {
114
111
  if (this.debug) {
115
112
  await logger.logToStderr(`Running check ${check.id}...`);
116
113
  }
117
- // don't show spinner if running tests
118
- /* c8 ignore next 3 */
119
- if (showSpinner) {
120
- cli.spinner.start(check.text);
121
- }
122
114
  // only automated checks have functions
123
115
  if (!check.fn) {
124
- // don't show spinner if running tests
125
- /* c8 ignore next 3 */
126
- if (showSpinner) {
127
- cli.spinner.info(`${check.text} (manual)`);
116
+ if (show) {
117
+ await logger.log(formatting.getStatus(CheckStatus.Information, `${check.text} (manual)`));
128
118
  }
129
119
  this.checksStatus.push({
130
120
  ...check,
@@ -135,23 +125,19 @@ class ExternalConnectionDoctorCommand extends GraphCommand {
135
125
  const result = await check.fn.bind(this)(check.id, args);
136
126
  this.checksStatus.push({ ...check, ...result });
137
127
  if (result.status === 'passed') {
138
- // don't show spinner if running tests
139
- /* c8 ignore next 3 */
140
- if (showSpinner) {
141
- cli.spinner.succeed();
128
+ if (show) {
129
+ await logger.log(formatting.getStatus(CheckStatus.Success, check.text));
142
130
  }
143
131
  continue;
144
132
  }
145
133
  if (result.status === 'failed') {
146
- // don't show spinner if running tests
147
- /* c8 ignore next 9 */
148
- if (showSpinner) {
134
+ if (show) {
149
135
  const message = `${check.text}: ${result.errorMessage}`;
150
136
  if (check.type === 'required') {
151
- cli.spinner.fail(message);
137
+ await logger.log(formatting.getStatus(CheckStatus.Failure, message));
152
138
  }
153
139
  else {
154
- cli.spinner.warn(message);
140
+ await logger.log(formatting.getStatus(CheckStatus.Warning, check.text));
155
141
  }
156
142
  }
157
143
  if (result.shouldStop) {
@@ -159,7 +145,7 @@ class ExternalConnectionDoctorCommand extends GraphCommand {
159
145
  }
160
146
  }
161
147
  }
162
- if (output === 'text' || output === 'none') {
148
+ if (show || output === 'none') {
163
149
  return;
164
150
  }
165
151
  this.checksStatus.forEach(s => {
@@ -29,7 +29,7 @@ class FlowGetCommand extends PowerAutomateCommand {
29
29
  await logger.logToStderr(`Retrieving information about Microsoft Flow ${args.options.name}...`);
30
30
  }
31
31
  const requestOptions = {
32
- url: `${this.resource}/providers/Microsoft.ProcessSimple/${args.options.asAdmin ? 'scopes/admin/' : ''}environments/${formatting.encodeQueryParameter(args.options.environmentName)}/flows/${formatting.encodeQueryParameter(args.options.name)}?api-version=2016-11-01`,
32
+ url: `${this.resource}/providers/Microsoft.ProcessSimple/${args.options.asAdmin ? 'scopes/admin/' : ''}environments/${formatting.encodeQueryParameter(args.options.environmentName)}/flows/${formatting.encodeQueryParameter(args.options.name)}?api-version=2016-11-01&$expand=swagger,properties.connectionreferences.apidefinition,properties.definitionsummary.operations.apioperation,operationDefinition,plan,properties.throttleData,properties.estimatedsuspensiondata,properties.licenseData`,
33
33
  headers: {
34
34
  accept: 'application/json'
35
35
  },
@@ -46,7 +46,8 @@ class FlowListCommand extends PowerAutomateCommand {
46
46
  let url = this.getApiUrl(environmentName, asAdmin, includeSolutions, 'personal');
47
47
  items = await odata.getAllItems(url);
48
48
  url = this.getApiUrl(environmentName, asAdmin, includeSolutions, 'team');
49
- items = await odata.getAllItems(url);
49
+ const teamFlows = await odata.getAllItems(url);
50
+ items = items.concat(teamFlows);
50
51
  }
51
52
  else {
52
53
  const url = this.getApiUrl(environmentName, asAdmin, includeSolutions);
@@ -141,8 +141,10 @@ _GraphSubscriptionAddCommand_instances = new WeakSet(), _GraphSubscriptionAddCom
141
141
  });
142
142
  }, _GraphSubscriptionAddCommand_initValidators = function _GraphSubscriptionAddCommand_initValidators() {
143
143
  this.validators.push(async (args) => {
144
- if (args.options.notificationUrl.indexOf('https://') !== 0) {
145
- return `The specified notification URL '${args.options.notificationUrl}' does not start with 'https://'`;
144
+ if (!args.options.notificationUrl.toLowerCase().startsWith('https://')
145
+ && !args.options.notificationUrl.toLowerCase().startsWith('eventhub:https://')
146
+ && !args.options.notificationUrl.toLowerCase().startsWith('eventgrid:?azuresubscriptionid=')) {
147
+ return `The specified notification URL '${args.options.notificationUrl}' does not start with either 'https://' or 'EventHub:https://' or 'EventGrid:?azuresubscriptionid='`;
146
148
  }
147
149
  if (!this.isValidChangeTypes(args.options.changeTypes)) {
148
150
  return `The specified changeTypes are invalid. Valid options are 'created', 'updated' and 'deleted'`;
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ContainerTypeProperties.js.map
@@ -0,0 +1,49 @@
1
+ import config from '../../../../config.js';
2
+ import request from '../../../../request.js';
3
+ import { spo } from '../../../../utils/spo.js';
4
+ import SpoCommand from '../../../base/SpoCommand.js';
5
+ import commands from '../../commands.js';
6
+ class SpeContainertypeListCommand extends SpoCommand {
7
+ get name() {
8
+ return commands.CONTAINERTYPE_LIST;
9
+ }
10
+ get description() {
11
+ return 'Lists all Container Types';
12
+ }
13
+ defaultProperties() {
14
+ return ['ContainerTypeId', 'DisplayName', 'OwningAppId'];
15
+ }
16
+ async commandAction(logger) {
17
+ try {
18
+ const spoAdminUrl = await spo.getSpoAdminUrl(logger, this.debug);
19
+ if (this.verbose) {
20
+ await logger.logToStderr(`Retrieving list of Container types...`);
21
+ }
22
+ const allContainerTypes = await this.getAllContainerTypes(spoAdminUrl, logger);
23
+ await logger.log(allContainerTypes);
24
+ }
25
+ catch (err) {
26
+ this.handleRejectedPromise(err);
27
+ }
28
+ }
29
+ async getAllContainerTypes(spoAdminUrl, logger) {
30
+ const formDigestInfo = await spo.ensureFormDigest(spoAdminUrl, logger, undefined, this.debug);
31
+ const requestOptions = {
32
+ url: `${spoAdminUrl}/_vti_bin/client.svc/ProcessQuery`,
33
+ headers: {
34
+ 'X-RequestDigest': formDigestInfo.FormDigestValue
35
+ },
36
+ data: `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="${config.applicationName}" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009"><Actions><ObjectPath Id="46" ObjectPathId="45" /><Method Name="GetSPOContainerTypes" Id="47" ObjectPathId="45"><Parameters><Parameter Type="Enum">1</Parameter></Parameters></Method></Actions><ObjectPaths><Constructor Id="45" TypeId="{268004ae-ef6b-4e9b-8425-127220d84719}" /></ObjectPaths></Request>`
37
+ };
38
+ const res = await request.post(requestOptions);
39
+ const json = JSON.parse(res);
40
+ const response = json[0];
41
+ if (response.ErrorInfo) {
42
+ throw response.ErrorInfo.ErrorMessage;
43
+ }
44
+ const containerTypes = json[json.length - 1];
45
+ return containerTypes;
46
+ }
47
+ }
48
+ export default new SpeContainertypeListCommand();
49
+ //# sourceMappingURL=containertype-list.js.map
@@ -1,5 +1,6 @@
1
1
  const prefix = 'spe';
2
2
  export default {
3
- CONTAINERTYPE_ADD: `${prefix} containertype add`
3
+ CONTAINERTYPE_ADD: `${prefix} containertype add`,
4
+ CONTAINERTYPE_LIST: `${prefix} containertype list`
4
5
  };
5
6
  //# sourceMappingURL=commands.js.map
@@ -4,6 +4,7 @@ import { formatting } from '../../../../utils/formatting.js';
4
4
  import { fsUtil } from '../../../../utils/fsUtil.js';
5
5
  import AnonymousCommand from "../../../base/AnonymousCommand.js";
6
6
  import { ScssFile, TsFile } from "./project-model/index.js";
7
+ import { CommandError } from '../../../../Command.js';
7
8
  export class BaseProjectCommand extends AnonymousCommand {
8
9
  constructor() {
9
10
  super(...arguments);
@@ -31,105 +32,17 @@ export class BaseProjectCommand extends AnonymousCommand {
31
32
  }
32
33
  catch { }
33
34
  }
34
- const configJsonPath = path.join(projectRootPath, 'config/config.json');
35
- if (fs.existsSync(configJsonPath)) {
36
- try {
37
- const source = formatting.removeSingleLineComments(fs.readFileSync(configJsonPath, 'utf-8'));
38
- project.configJson = JSON.parse(source);
39
- project.configJson.source = source;
40
- }
41
- catch { }
42
- }
43
- const copyAssetsJsonPath = path.join(projectRootPath, 'config/copy-assets.json');
44
- if (fs.existsSync(copyAssetsJsonPath)) {
45
- try {
46
- const source = formatting.removeSingleLineComments(fs.readFileSync(copyAssetsJsonPath, 'utf-8'));
47
- project.copyAssetsJson = JSON.parse(source);
48
- project.copyAssetsJson.source = source;
49
- }
50
- catch { }
51
- }
52
- const deployAzureStorageJsonPath = path.join(projectRootPath, 'config/deploy-azure-storage.json');
53
- if (fs.existsSync(deployAzureStorageJsonPath)) {
54
- try {
55
- const source = formatting.removeSingleLineComments(fs.readFileSync(deployAzureStorageJsonPath, 'utf-8'));
56
- project.deployAzureStorageJson = JSON.parse(source);
57
- project.deployAzureStorageJson.source = source;
58
- }
59
- catch { }
60
- }
61
- const packageJsonPath = path.join(projectRootPath, 'package.json');
62
- if (fs.existsSync(packageJsonPath)) {
63
- try {
64
- const source = formatting.removeSingleLineComments(fs.readFileSync(packageJsonPath, 'utf-8'));
65
- project.packageJson = JSON.parse(source);
66
- project.packageJson.source = source;
67
- }
68
- catch { }
69
- }
70
- const packageSolutionJsonPath = path.join(projectRootPath, 'config/package-solution.json');
71
- if (fs.existsSync(packageSolutionJsonPath)) {
72
- try {
73
- const source = formatting.removeSingleLineComments(fs.readFileSync(packageSolutionJsonPath, 'utf-8'));
74
- project.packageSolutionJson = JSON.parse(source);
75
- project.packageSolutionJson.source = source;
76
- }
77
- catch { }
78
- }
79
- const serveJsonPath = path.join(projectRootPath, 'config/serve.json');
80
- if (fs.existsSync(serveJsonPath)) {
81
- try {
82
- const source = formatting.removeSingleLineComments(fs.readFileSync(serveJsonPath, 'utf-8'));
83
- project.serveJson = JSON.parse(source);
84
- project.serveJson.source = source;
85
- }
86
- catch { }
87
- }
88
- const tsConfigJsonPath = path.join(projectRootPath, 'tsconfig.json');
89
- if (fs.existsSync(tsConfigJsonPath)) {
90
- try {
91
- const source = formatting.removeSingleLineComments(fs.readFileSync(tsConfigJsonPath, 'utf-8'));
92
- project.tsConfigJson = JSON.parse(source);
93
- project.tsConfigJson.source = source;
94
- }
95
- catch { }
96
- }
97
- const tsLintJsonPath = path.join(projectRootPath, 'config/tslint.json');
98
- if (fs.existsSync(tsLintJsonPath)) {
99
- try {
100
- const source = formatting.removeSingleLineComments(fs.readFileSync(tsLintJsonPath, 'utf-8'));
101
- project.tsLintJson = JSON.parse(source);
102
- project.tsLintJson.source = source;
103
- }
104
- catch { }
105
- }
106
- const tsLintJsonRootPath = path.join(projectRootPath, 'tslint.json');
107
- if (fs.existsSync(tsLintJsonRootPath)) {
108
- try {
109
- const source = formatting.removeSingleLineComments(fs.readFileSync(tsLintJsonRootPath, 'utf-8'));
110
- project.tsLintJsonRoot = JSON.parse(source);
111
- project.tsLintJsonRoot.source = source;
112
- }
113
- catch { }
114
- }
115
- const writeManifestJsonPath = path.join(projectRootPath, 'config/write-manifests.json');
116
- if (fs.existsSync(writeManifestJsonPath)) {
117
- try {
118
- const source = formatting.removeSingleLineComments(fs.readFileSync(writeManifestJsonPath, 'utf-8'));
119
- project.writeManifestsJson = JSON.parse(source);
120
- project.writeManifestsJson.source = source;
121
- }
122
- catch { }
123
- }
124
- const yoRcJsonPath = path.join(projectRootPath, '.yo-rc.json');
125
- if (fs.existsSync(yoRcJsonPath)) {
126
- try {
127
- const source = formatting.removeSingleLineComments(fs.readFileSync(yoRcJsonPath, 'utf-8'));
128
- project.yoRcJson = JSON.parse(source);
129
- project.yoRcJson.source = source;
130
- }
131
- catch { }
132
- }
35
+ this.readAndParseJsonFile(path.join(projectRootPath, 'config', 'config.json'), project, 'configJson');
36
+ this.readAndParseJsonFile(path.join(projectRootPath, 'config', 'copy-assets.json'), project, 'copyAssetsJson');
37
+ this.readAndParseJsonFile(path.join(projectRootPath, 'config', 'deploy-azure-storage.json'), project, 'deployAzureStorageJson');
38
+ this.readAndParseJsonFile(path.join(projectRootPath, 'package.json'), project, 'packageJson');
39
+ this.readAndParseJsonFile(path.join(projectRootPath, 'config', 'package-solution.json'), project, 'packageSolutionJson');
40
+ this.readAndParseJsonFile(path.join(projectRootPath, 'config', 'serve.json'), project, 'serveJson');
41
+ this.readAndParseJsonFile(path.join(projectRootPath, 'tsconfig.json'), project, 'tsConfigJson');
42
+ this.readAndParseJsonFile(path.join(projectRootPath, 'config', 'tslint.json'), project, 'tsLintJson');
43
+ this.readAndParseJsonFile(path.join(projectRootPath, 'tslint.json'), project, 'tsLintJsonRoot');
44
+ this.readAndParseJsonFile(path.join(projectRootPath, 'config', 'write-manifests.json'), project, 'writeManifestsJson');
45
+ this.readAndParseJsonFile(path.join(projectRootPath, '.yo-rc.json'), project, 'yoRcJson');
133
46
  const gulpfileJsPath = path.join(projectRootPath, 'gulpfile.js');
134
47
  if (fs.existsSync(gulpfileJsPath)) {
135
48
  project.gulpfileJs = {
@@ -141,33 +54,9 @@ export class BaseProjectCommand extends AnonymousCommand {
141
54
  project.esLintRcJs = new TsFile(esLintRcJsPath);
142
55
  }
143
56
  project.vsCode = {};
144
- const vsCodeSettingsPath = path.join(projectRootPath, '.vscode', 'settings.json');
145
- if (fs.existsSync(vsCodeSettingsPath)) {
146
- try {
147
- const source = formatting.removeSingleLineComments(fs.readFileSync(vsCodeSettingsPath, 'utf-8'));
148
- project.vsCode.settingsJson = JSON.parse(source);
149
- project.vsCode.settingsJson.source = source;
150
- }
151
- catch { }
152
- }
153
- const vsCodeExtensionsPath = path.join(projectRootPath, '.vscode', 'extensions.json');
154
- if (fs.existsSync(vsCodeExtensionsPath)) {
155
- try {
156
- const source = formatting.removeSingleLineComments(fs.readFileSync(vsCodeExtensionsPath, 'utf-8'));
157
- project.vsCode.extensionsJson = JSON.parse(source);
158
- project.vsCode.extensionsJson.source = source;
159
- }
160
- catch { }
161
- }
162
- const vsCodeLaunchPath = path.join(projectRootPath, '.vscode', 'launch.json');
163
- if (fs.existsSync(vsCodeLaunchPath)) {
164
- try {
165
- const source = formatting.removeSingleLineComments(fs.readFileSync(vsCodeLaunchPath, 'utf-8'));
166
- project.vsCode.launchJson = JSON.parse(source);
167
- project.vsCode.launchJson.source = source;
168
- }
169
- catch { }
170
- }
57
+ this.readAndParseJsonFile(path.join(projectRootPath, '.vscode', 'settings.json'), project, 'vsCode.settingsJson');
58
+ this.readAndParseJsonFile(path.join(projectRootPath, '.vscode', 'extensions.json'), project, 'vsCode.extensionsJson');
59
+ this.readAndParseJsonFile(path.join(projectRootPath, '.vscode', 'launch.json'), project, 'vsCode.launchJson');
171
60
  const srcFiles = fsUtil.readdirR(path.join(projectRootPath, 'src'));
172
61
  const manifestFiles = srcFiles.filter(f => f.endsWith('.manifest.json'));
173
62
  const manifests = manifestFiles.map((f) => {
@@ -233,5 +122,26 @@ export class BaseProjectCommand extends AnonymousCommand {
233
122
  catch { }
234
123
  return undefined;
235
124
  }
125
+ readAndParseJsonFile(filePath, project, keyPath) {
126
+ if (fs.existsSync(filePath)) {
127
+ try {
128
+ const source = formatting.removeSingleLineComments(fs.readFileSync(filePath, 'utf-8'));
129
+ const keys = keyPath.split('.');
130
+ let current = project;
131
+ for (let i = 0; i < keys.length - 1; i++) {
132
+ current = current[keys[i]];
133
+ }
134
+ const finalKey = keys[keys.length - 1];
135
+ current[finalKey] = JSON.parse(source);
136
+ if (typeof current[finalKey] === 'object' && current[finalKey] !== null) {
137
+ current[finalKey].source = source;
138
+ }
139
+ }
140
+ catch (error) {
141
+ throw new CommandError(`The file ${filePath} is not a valid JSON file or is not utf-8 encoded. Error: ${error}`);
142
+ }
143
+ }
144
+ return project;
145
+ }
236
146
  }
237
147
  //# sourceMappingURL=base-project-command.js.map
@@ -3,7 +3,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
3
3
  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");
4
4
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
5
  };
6
- var _SpoApplicationCustomizerGetCommand_instances, _SpoApplicationCustomizerGetCommand_initTelemetry, _SpoApplicationCustomizerGetCommand_initOptions, _SpoApplicationCustomizerGetCommand_initValidators, _SpoApplicationCustomizerGetCommand_initOptionSets;
6
+ var _SpoApplicationCustomizerGetCommand_instances, _SpoApplicationCustomizerGetCommand_initTelemetry, _SpoApplicationCustomizerGetCommand_initOptions, _SpoApplicationCustomizerGetCommand_initValidators, _SpoApplicationCustomizerGetCommand_initOptionSets, _SpoApplicationCustomizerGetCommand_initTypes;
7
7
  import { formatting } from '../../../../utils/formatting.js';
8
8
  import { spo } from '../../../../utils/spo.js';
9
9
  import { validation } from '../../../../utils/validation.js';
@@ -25,33 +25,22 @@ class SpoApplicationCustomizerGetCommand extends SpoCommand {
25
25
  __classPrivateFieldGet(this, _SpoApplicationCustomizerGetCommand_instances, "m", _SpoApplicationCustomizerGetCommand_initOptions).call(this);
26
26
  __classPrivateFieldGet(this, _SpoApplicationCustomizerGetCommand_instances, "m", _SpoApplicationCustomizerGetCommand_initValidators).call(this);
27
27
  __classPrivateFieldGet(this, _SpoApplicationCustomizerGetCommand_instances, "m", _SpoApplicationCustomizerGetCommand_initOptionSets).call(this);
28
+ __classPrivateFieldGet(this, _SpoApplicationCustomizerGetCommand_instances, "m", _SpoApplicationCustomizerGetCommand_initTypes).call(this);
28
29
  }
29
30
  async commandAction(logger, args) {
30
31
  try {
31
32
  const customAction = await this.getCustomAction(args.options);
32
- if (customAction) {
33
+ if (!args.options.clientSideComponentProperties) {
33
34
  await logger.log({
34
- ClientSideComponentId: customAction.ClientSideComponentId,
35
- ClientSideComponentProperties: customAction.ClientSideComponentProperties,
36
- CommandUIExtension: customAction.CommandUIExtension,
37
- Description: customAction.Description,
38
- Group: customAction.Group,
39
- Id: customAction.Id,
40
- ImageUrl: customAction.ImageUrl,
41
- Location: customAction.Location,
42
- Name: customAction.Name,
43
- RegistrationId: customAction.RegistrationId,
44
- RegistrationType: customAction.RegistrationType,
35
+ ...customAction,
45
36
  Rights: JSON.stringify(customAction.Rights),
46
- Scope: this.humanizeScope(customAction.Scope),
47
- ScriptBlock: customAction.ScriptBlock,
48
- ScriptSrc: customAction.ScriptSrc,
49
- Sequence: customAction.Sequence,
50
- Title: customAction.Title,
51
- Url: customAction.Url,
52
- VersionOfUserCustomAction: customAction.VersionOfUserCustomAction
37
+ Scope: this.humanizeScope(customAction.Scope)
53
38
  });
54
39
  }
40
+ else {
41
+ const properties = formatting.tryParseJson(customAction.ClientSideComponentProperties);
42
+ await logger.log(properties);
43
+ }
55
44
  }
56
45
  catch (err) {
57
46
  this.handleRejectedPromise(err);
@@ -95,7 +84,8 @@ _SpoApplicationCustomizerGetCommand_instances = new WeakSet(), _SpoApplicationCu
95
84
  title: typeof args.options.title !== 'undefined',
96
85
  id: typeof args.options.id !== 'undefined',
97
86
  clientSideComponentId: typeof args.options.clientSideComponentId !== 'undefined',
98
- scope: typeof args.options.scope !== 'undefined'
87
+ scope: typeof args.options.scope !== 'undefined',
88
+ clientSideComponentProperties: !!args.options.clientSideComponentProperties
99
89
  });
100
90
  });
101
91
  }, _SpoApplicationCustomizerGetCommand_initOptions = function _SpoApplicationCustomizerGetCommand_initOptions() {
@@ -110,6 +100,8 @@ _SpoApplicationCustomizerGetCommand_instances = new WeakSet(), _SpoApplicationCu
110
100
  }, {
111
101
  option: '-s, --scope [scope]',
112
102
  autocomplete: this.allowedScopes
103
+ }, {
104
+ option: '-p, --clientSideComponentProperties'
113
105
  });
114
106
  }, _SpoApplicationCustomizerGetCommand_initValidators = function _SpoApplicationCustomizerGetCommand_initValidators() {
115
107
  this.validators.push(async (args) => {
@@ -126,6 +118,9 @@ _SpoApplicationCustomizerGetCommand_instances = new WeakSet(), _SpoApplicationCu
126
118
  });
127
119
  }, _SpoApplicationCustomizerGetCommand_initOptionSets = function _SpoApplicationCustomizerGetCommand_initOptionSets() {
128
120
  this.optionSets.push({ options: ['title', 'id', 'clientSideComponentId'] });
121
+ }, _SpoApplicationCustomizerGetCommand_initTypes = function _SpoApplicationCustomizerGetCommand_initTypes() {
122
+ this.types.string.push('webUrl', 'title', 'id', 'clientSideComponentId', 'scope');
123
+ this.types.boolean.push('clientSideComponentProperties');
129
124
  };
130
125
  export default new SpoApplicationCustomizerGetCommand();
131
126
  //# sourceMappingURL=applicationcustomizer-get.js.map