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

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 (40) 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 +1 -9
  5. package/dist/chili/chili.js +0 -23
  6. package/dist/cli/cli.js +1 -63
  7. package/dist/m365/commands/setup.js +0 -4
  8. package/dist/m365/entra/commands/m365group/m365group-set.js +66 -29
  9. package/dist/m365/entra/commands/multitenant/MultitenantOrganization.js +2 -0
  10. package/dist/m365/entra/commands/multitenant/multitenant-get.js +32 -0
  11. package/dist/m365/entra/commands.js +1 -0
  12. package/dist/m365/external/commands/connection/connection-doctor.js +10 -24
  13. package/dist/m365/flow/commands/flow-list.js +2 -1
  14. package/dist/m365/graph/commands/subscription/subscription-add.js +4 -2
  15. package/dist/m365/spfx/commands/project/base-project-command.js +36 -126
  16. package/dist/m365/spo/commands/contenttype/contenttype-field-list.js +124 -0
  17. package/dist/m365/spo/commands/field/field-list.js +1 -1
  18. package/dist/m365/spo/commands/page/page-clientsidewebpart-add.js +2 -3
  19. package/dist/m365/spo/commands/page/page-text-add.js +2 -3
  20. package/dist/m365/spo/commands/spo-search.js +3 -4
  21. package/dist/m365/spo/commands.js +1 -0
  22. package/dist/m365/teams/commands/meeting/meeting-attendancereport-get.js +119 -0
  23. package/dist/m365/teams/commands/message/message-remove.js +112 -0
  24. package/dist/m365/teams/commands.js +2 -0
  25. package/dist/m365/viva/commands/engage/engage-community-add.js +166 -0
  26. package/dist/m365/viva/commands.js +1 -0
  27. package/dist/utils/formatting.js +14 -1
  28. package/dist/utils/teams.js +49 -0
  29. package/docs/docs/cmd/entra/m365group/m365group-set.mdx +37 -7
  30. package/docs/docs/cmd/entra/multitenant/multitenant-get.mdx +94 -0
  31. package/docs/docs/cmd/external/connection/connection-doctor.mdx +9 -9
  32. package/docs/docs/cmd/graph/subscription/subscription-add.mdx +18 -0
  33. package/docs/docs/cmd/spo/contenttype/contenttype-field-list.mdx +172 -0
  34. package/docs/docs/cmd/spo/contenttype/contenttype-list.mdx +3 -3
  35. package/docs/docs/cmd/spo/field/field-list.mdx +3 -3
  36. package/docs/docs/cmd/teams/meeting/meeting-attendancereport-get.mdx +138 -0
  37. package/docs/docs/cmd/teams/message/message-remove.mdx +63 -0
  38. package/docs/docs/cmd/viva/engage/engage-community-add.mdx +168 -0
  39. package/npm-shrinkwrap.json +2 -197
  40. package/package.json +2 -2
@@ -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
@@ -0,0 +1,124 @@
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 _SpoContentTypeFieldListCommand_instances, _SpoContentTypeFieldListCommand_initTelemetry, _SpoContentTypeFieldListCommand_initOptions, _SpoContentTypeFieldListCommand_initValidators, _SpoContentTypeFieldListCommand_initTypes, _SpoContentTypeFieldListCommand_initOptionSets;
7
+ import { formatting } from '../../../../utils/formatting.js';
8
+ import { odata } from '../../../../utils/odata.js';
9
+ import { urlUtil } from '../../../../utils/urlUtil.js';
10
+ import { validation } from '../../../../utils/validation.js';
11
+ import SpoCommand from '../../../base/SpoCommand.js';
12
+ import commands from '../../commands.js';
13
+ class SpoContentTypeFieldListCommand extends SpoCommand {
14
+ get name() {
15
+ return commands.CONTENTTYPE_FIELD_LIST;
16
+ }
17
+ get description() {
18
+ return 'Lists fields for a given site or list content type';
19
+ }
20
+ defaultProperties() {
21
+ return ['Id', 'Title', 'InternalName', 'Hidden'];
22
+ }
23
+ constructor() {
24
+ super();
25
+ _SpoContentTypeFieldListCommand_instances.add(this);
26
+ __classPrivateFieldGet(this, _SpoContentTypeFieldListCommand_instances, "m", _SpoContentTypeFieldListCommand_initTelemetry).call(this);
27
+ __classPrivateFieldGet(this, _SpoContentTypeFieldListCommand_instances, "m", _SpoContentTypeFieldListCommand_initOptions).call(this);
28
+ __classPrivateFieldGet(this, _SpoContentTypeFieldListCommand_instances, "m", _SpoContentTypeFieldListCommand_initValidators).call(this);
29
+ __classPrivateFieldGet(this, _SpoContentTypeFieldListCommand_instances, "m", _SpoContentTypeFieldListCommand_initTypes).call(this);
30
+ __classPrivateFieldGet(this, _SpoContentTypeFieldListCommand_instances, "m", _SpoContentTypeFieldListCommand_initOptionSets).call(this);
31
+ }
32
+ async commandAction(logger, args) {
33
+ try {
34
+ if (this.verbose) {
35
+ await logger.logToStderr(`Retrieving fields for content type '${args.options.contentTypeId || args.options.contentTypeName}' in site ${args.options.webUrl}...`);
36
+ }
37
+ let requestUrl = `${args.options.webUrl}/_api/web`;
38
+ if (args.options.listId) {
39
+ requestUrl += `/lists(guid'${formatting.encodeQueryParameter(args.options.listId)}')`;
40
+ }
41
+ else if (args.options.listTitle) {
42
+ requestUrl += `/lists/getByTitle('${formatting.encodeQueryParameter(args.options.listTitle)}')`;
43
+ }
44
+ else if (args.options.listUrl) {
45
+ const listServerRelativeUrl = urlUtil.getServerRelativePath(args.options.webUrl, args.options.listUrl);
46
+ requestUrl += `/GetList('${formatting.encodeQueryParameter(listServerRelativeUrl)}')`;
47
+ }
48
+ requestUrl += '/contentTypes';
49
+ const contentTypeId = await this.getContentTypeId(requestUrl, logger, args.options.contentTypeId, args.options.contentTypeName);
50
+ requestUrl += `('${formatting.encodeQueryParameter(contentTypeId)}')/fields`;
51
+ if (args.options.properties) {
52
+ requestUrl += `?$select=${args.options.properties}`;
53
+ }
54
+ const res = await odata.getAllItems(requestUrl);
55
+ await logger.log(res);
56
+ }
57
+ catch (err) {
58
+ this.handleRejectedODataJsonPromise(err);
59
+ }
60
+ }
61
+ async getContentTypeId(requestUrl, logger, contentTypeId, contentTypeName) {
62
+ if (contentTypeId) {
63
+ return contentTypeId;
64
+ }
65
+ if (this.verbose) {
66
+ await logger.logToStderr(`Retrieving content type id for content type '${contentTypeName}'.`);
67
+ }
68
+ const res = await odata.getAllItems(`${requestUrl}?$filter=Name eq '${formatting.encodeQueryParameter(contentTypeName)}'&$select=StringId`);
69
+ if (res.length === 0) {
70
+ throw `Content type with name ${contentTypeName} not found.`;
71
+ }
72
+ return res[0].StringId;
73
+ }
74
+ }
75
+ _SpoContentTypeFieldListCommand_instances = new WeakSet(), _SpoContentTypeFieldListCommand_initTelemetry = function _SpoContentTypeFieldListCommand_initTelemetry() {
76
+ this.telemetry.push((args) => {
77
+ Object.assign(this.telemetryProperties, {
78
+ contentTypeId: typeof args.options.contentTypeId !== 'undefined',
79
+ contentTypeName: typeof args.options.contentTypeName !== 'undefined',
80
+ listId: typeof args.options.listId !== 'undefined',
81
+ listTitle: typeof args.options.listTitle !== 'undefined',
82
+ listUrl: typeof args.options.listUrl !== 'undefined',
83
+ properties: typeof args.options.properties !== 'undefined'
84
+ });
85
+ });
86
+ }, _SpoContentTypeFieldListCommand_initOptions = function _SpoContentTypeFieldListCommand_initOptions() {
87
+ this.options.unshift({
88
+ option: '-u, --webUrl <webUrl>'
89
+ }, {
90
+ option: '-i, --contentTypeId [contentTypeId]'
91
+ }, {
92
+ option: '-n, --contentTypeName [contentTypeName]'
93
+ }, {
94
+ option: '-l, --listTitle [listTitle]'
95
+ }, {
96
+ option: '--listId [listId]'
97
+ }, {
98
+ option: '--listUrl [listUrl]'
99
+ }, {
100
+ option: '-p, --properties [properties]'
101
+ });
102
+ }, _SpoContentTypeFieldListCommand_initValidators = function _SpoContentTypeFieldListCommand_initValidators() {
103
+ this.validators.push(async (args) => {
104
+ const isValidSharePointUrl = validation.isValidSharePointUrl(args.options.webUrl);
105
+ if (isValidSharePointUrl !== true) {
106
+ return isValidSharePointUrl;
107
+ }
108
+ if (args.options.listId && !validation.isValidGuid(args.options.listId)) {
109
+ return `${args.options.listId} is not a valid GUID for option 'listId'.`;
110
+ }
111
+ return true;
112
+ });
113
+ }, _SpoContentTypeFieldListCommand_initTypes = function _SpoContentTypeFieldListCommand_initTypes() {
114
+ this.types.string.push('webUrl', 'contentTypeId', 'contentTypeName', 'listTitle', 'listId', 'listUrl', 'properties');
115
+ }, _SpoContentTypeFieldListCommand_initOptionSets = function _SpoContentTypeFieldListCommand_initOptionSets() {
116
+ this.optionSets.push({
117
+ options: ['contentTypeId', 'contentTypeName']
118
+ }, {
119
+ options: ['listId', 'listTitle', 'listUrl'],
120
+ runsWhen: (args) => args.options.listId || args.options.listTitle || args.options.listUrl
121
+ });
122
+ };
123
+ export default new SpoContentTypeFieldListCommand();
124
+ //# sourceMappingURL=contenttype-field-list.js.map
@@ -18,7 +18,7 @@ class SpoFieldListCommand extends SpoCommand {
18
18
  return 'Retrieves columns for the specified list or site';
19
19
  }
20
20
  defaultProperties() {
21
- return ['Id', 'Title', 'Group', 'Hidden'];
21
+ return ['Id', 'Title', 'InternalName', 'Hidden'];
22
22
  }
23
23
  constructor() {
24
24
  super();
@@ -4,7 +4,6 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
4
4
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
5
  };
6
6
  var _SpoPageClientSideWebPartAddCommand_instances, _SpoPageClientSideWebPartAddCommand_initTelemetry, _SpoPageClientSideWebPartAddCommand_initOptions, _SpoPageClientSideWebPartAddCommand_initValidators, _SpoPageClientSideWebPartAddCommand_initOptionSets;
7
- import { isNumber } from 'util';
8
7
  import { v4 } from 'uuid';
9
8
  import request from '../../../../request.js';
10
9
  import { formatting } from '../../../../utils/formatting.js';
@@ -370,10 +369,10 @@ _SpoPageClientSideWebPartAddCommand_instances = new WeakSet(), _SpoPageClientSid
370
369
  .webPartData}. Error: ${e}`;
371
370
  }
372
371
  }
373
- if (args.options.section && (!isNumber(args.options.section) || args.options.section < 1)) {
372
+ if (args.options.section && (!Number.isInteger(args.options.section) || args.options.section < 1)) {
374
373
  return 'The value of parameter section must be 1 or higher';
375
374
  }
376
- if (args.options.column && (!isNumber(args.options.column) || args.options.column < 1)) {
375
+ if (args.options.column && (!Number.isInteger(args.options.column) || args.options.column < 1)) {
377
376
  return 'The value of parameter column must be 1 or higher';
378
377
  }
379
378
  return validation.isValidSharePointUrl(args.options.webUrl);
@@ -4,7 +4,6 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
4
4
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
5
  };
6
6
  var _SpoPageTextAddCommand_instances, _SpoPageTextAddCommand_initTelemetry, _SpoPageTextAddCommand_initOptions, _SpoPageTextAddCommand_initValidators;
7
- import { isNumber } from 'util';
8
7
  import request from '../../../../request.js';
9
8
  import { spo } from '../../../../utils/spo.js';
10
9
  import { urlUtil } from '../../../../utils/urlUtil.js';
@@ -119,10 +118,10 @@ _SpoPageTextAddCommand_instances = new WeakSet(), _SpoPageTextAddCommand_initTel
119
118
  });
120
119
  }, _SpoPageTextAddCommand_initValidators = function _SpoPageTextAddCommand_initValidators() {
121
120
  this.validators.push(async (args) => {
122
- if (args.options.section && (!isNumber(args.options.section) || args.options.section < 1)) {
121
+ if (args.options.section && (!Number.isInteger(args.options.section) || args.options.section < 1)) {
123
122
  return 'The value of parameter section must be 1 or higher';
124
123
  }
125
- if (args.options.column && (!isNumber(args.options.column) || args.options.column < 1)) {
124
+ if (args.options.column && (!Number.isInteger(args.options.column) || args.options.column < 1)) {
126
125
  return 'The value of parameter column must be 1 or higher';
127
126
  }
128
127
  return validation.isValidSharePointUrl(args.options.webUrl);
@@ -4,7 +4,6 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
4
4
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
5
  };
6
6
  var _SpoSearchCommand_instances, _SpoSearchCommand_initTelemetry, _SpoSearchCommand_initOptions, _SpoSearchCommand_initValidators;
7
- import { isNumber } from 'util';
8
7
  import { cli } from '../../../cli/cli.js';
9
8
  import request from '../../../request.js';
10
9
  import { formatting } from '../../../utils/formatting.js';
@@ -266,16 +265,16 @@ _SpoSearchCommand_instances = new WeakSet(), _SpoSearchCommand_initTelemetry = f
266
265
  if (args.options.sortList && !/^([a-z0-9_]+:(ascending|descending))(,([a-z0-9_]+:(ascending|descending)))*$/gi.test(args.options.sortList)) {
267
266
  return `sortlist parameter value '${args.options.sortList}' does not match the required pattern (=comma-separated list of '<property>:(ascending|descending)'-pattern)`;
268
267
  }
269
- if (args.options.rowLimit && !isNumber(args.options.rowLimit)) {
268
+ if (args.options.rowLimit && !Number.isInteger(args.options.rowLimit)) {
270
269
  return `${args.options.rowLimit} is not a valid number`;
271
270
  }
272
- if (args.options.startRow && !isNumber(args.options.startRow)) {
271
+ if (args.options.startRow && !Number.isInteger(args.options.startRow)) {
273
272
  return `${args.options.startRow} is not a valid number`;
274
273
  }
275
274
  if (args.options.startRow && args.options.allResults) {
276
275
  return 'You cannot specify startRow when allResults is set';
277
276
  }
278
- if (args.options.culture && !isNumber(args.options.culture)) {
277
+ if (args.options.culture && !Number.isInteger(args.options.culture)) {
279
278
  return `${args.options.culture} is not a valid number`;
280
279
  }
281
280
  return true;
@@ -31,6 +31,7 @@ export default {
31
31
  COMMANDSET_REMOVE: `${prefix} commandset remove`,
32
32
  COMMANDSET_SET: `${prefix} commandset set`,
33
33
  CONTENTTYPE_ADD: `${prefix} contenttype add`,
34
+ CONTENTTYPE_FIELD_LIST: `${prefix} contenttype field list`,
34
35
  CONTENTTYPE_FIELD_REMOVE: `${prefix} contenttype field remove`,
35
36
  CONTENTTYPE_FIELD_SET: `${prefix} contenttype field set`,
36
37
  CONTENTTYPE_GET: `${prefix} contenttype get`,
@@ -0,0 +1,119 @@
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 _TeamsMeetingAttendancereportGetCommand_instances, _TeamsMeetingAttendancereportGetCommand_initTelemetry, _TeamsMeetingAttendancereportGetCommand_initOptions, _TeamsMeetingAttendancereportGetCommand_initTypes, _TeamsMeetingAttendancereportGetCommand_initValidators, _TeamsMeetingAttendancereportGetCommand_initOptionSets;
7
+ import auth from '../../../../Auth.js';
8
+ import { accessToken } from '../../../../utils/accessToken.js';
9
+ import { validation } from '../../../../utils/validation.js';
10
+ import GraphCommand from "../../../base/GraphCommand.js";
11
+ import commands from '../../commands.js';
12
+ import { entraUser } from '../../../../utils/entraUser.js';
13
+ import request from '../../../../request.js';
14
+ class TeamsMeetingAttendancereportGetCommand extends GraphCommand {
15
+ get name() {
16
+ return commands.MEETING_ATTENDANCEREPORT_GET;
17
+ }
18
+ get description() {
19
+ return 'Gets attendance report for a given meeting';
20
+ }
21
+ constructor() {
22
+ super();
23
+ _TeamsMeetingAttendancereportGetCommand_instances.add(this);
24
+ __classPrivateFieldGet(this, _TeamsMeetingAttendancereportGetCommand_instances, "m", _TeamsMeetingAttendancereportGetCommand_initTelemetry).call(this);
25
+ __classPrivateFieldGet(this, _TeamsMeetingAttendancereportGetCommand_instances, "m", _TeamsMeetingAttendancereportGetCommand_initOptions).call(this);
26
+ __classPrivateFieldGet(this, _TeamsMeetingAttendancereportGetCommand_instances, "m", _TeamsMeetingAttendancereportGetCommand_initTypes).call(this);
27
+ __classPrivateFieldGet(this, _TeamsMeetingAttendancereportGetCommand_instances, "m", _TeamsMeetingAttendancereportGetCommand_initValidators).call(this);
28
+ __classPrivateFieldGet(this, _TeamsMeetingAttendancereportGetCommand_instances, "m", _TeamsMeetingAttendancereportGetCommand_initOptionSets).call(this);
29
+ }
30
+ async commandAction(logger, args) {
31
+ try {
32
+ const isAppOnlyAccessToken = accessToken.isAppOnlyAccessToken(auth.connection.accessTokens[auth.defaultResource].accessToken);
33
+ if (isAppOnlyAccessToken && !args.options.userId && !args.options.userName && !args.options.email) {
34
+ throw `The option 'userId', 'userName' or 'email' is required when retrieving meeting attendance report using app only permissions.`;
35
+ }
36
+ else if (!isAppOnlyAccessToken && (args.options.userId || args.options.userName || args.options.email)) {
37
+ throw `The options 'userId', 'userName' and 'email' cannot be used when retrieving meeting attendance report using delegated permissions.`;
38
+ }
39
+ if (this.verbose) {
40
+ await logger.logToStderr(`Retrieving attendance report for ${isAppOnlyAccessToken ? `specific user ${args.options.userId || args.options.userName || args.options.email}.` : 'currently logged in user'}.`);
41
+ }
42
+ let userUrl = '';
43
+ if (isAppOnlyAccessToken) {
44
+ const userId = await this.getUserId(args.options);
45
+ userUrl += `users/${userId}`;
46
+ }
47
+ else {
48
+ userUrl += 'me';
49
+ }
50
+ const requestOptions = {
51
+ url: `${this.resource}/v1.0/${userUrl}/onlineMeetings/${args.options.meetingId}/attendanceReports/${args.options.id}?$expand=attendanceRecords`,
52
+ headers: {
53
+ accept: 'application/json;odata.metadata=none'
54
+ },
55
+ responseType: 'json'
56
+ };
57
+ const attendanceReport = await request.get(requestOptions);
58
+ await logger.log(attendanceReport);
59
+ }
60
+ catch (err) {
61
+ this.handleRejectedODataJsonPromise(err);
62
+ }
63
+ }
64
+ async getUserId(options) {
65
+ if (options.userId) {
66
+ return options.userId;
67
+ }
68
+ if (options.userName) {
69
+ return entraUser.getUserIdByUpn(options.userName);
70
+ }
71
+ return entraUser.getUserIdByEmail(options.email);
72
+ }
73
+ }
74
+ _TeamsMeetingAttendancereportGetCommand_instances = new WeakSet(), _TeamsMeetingAttendancereportGetCommand_initTelemetry = function _TeamsMeetingAttendancereportGetCommand_initTelemetry() {
75
+ this.telemetry.push((args) => {
76
+ Object.assign(this.telemetryProperties, {
77
+ userId: typeof args.options.userId !== 'undefined',
78
+ userName: typeof args.options.userName !== 'undefined',
79
+ email: typeof args.options.email !== 'undefined'
80
+ });
81
+ });
82
+ }, _TeamsMeetingAttendancereportGetCommand_initOptions = function _TeamsMeetingAttendancereportGetCommand_initOptions() {
83
+ this.options.unshift({
84
+ option: '-u, --userId [userId]'
85
+ }, {
86
+ option: '-n, --userName [userName]'
87
+ }, {
88
+ option: '--email [email]'
89
+ }, {
90
+ option: '-m, --meetingId <meetingId>'
91
+ }, {
92
+ option: '-i, --id <id>'
93
+ });
94
+ }, _TeamsMeetingAttendancereportGetCommand_initTypes = function _TeamsMeetingAttendancereportGetCommand_initTypes() {
95
+ this.types.string.push('userId', 'userName', 'email', 'meetingId', 'id');
96
+ }, _TeamsMeetingAttendancereportGetCommand_initValidators = function _TeamsMeetingAttendancereportGetCommand_initValidators() {
97
+ this.validators.push(async (args) => {
98
+ if (!validation.isValidGuid(args.options.id)) {
99
+ return `${args.options.id} is not a valid GUID for option 'id'.`;
100
+ }
101
+ if (args.options.userId && !validation.isValidGuid(args.options.userId)) {
102
+ return `${args.options.userId} is not a valid GUID for option 'userId'.`;
103
+ }
104
+ if (args.options.userName && !validation.isValidUserPrincipalName(args.options.userName)) {
105
+ return `${args.options.userName} is not a valid UPN.`;
106
+ }
107
+ if (args.options.email && !validation.isValidUserPrincipalName(args.options.email)) {
108
+ return `${args.options.email} is not a valid email.`;
109
+ }
110
+ return true;
111
+ });
112
+ }, _TeamsMeetingAttendancereportGetCommand_initOptionSets = function _TeamsMeetingAttendancereportGetCommand_initOptionSets() {
113
+ this.optionSets.push({
114
+ options: ['userId', 'userName', 'email'],
115
+ runsWhen: (args) => args.options.userId || args.options.userName || args.options.email
116
+ });
117
+ };
118
+ export default new TeamsMeetingAttendancereportGetCommand();
119
+ //# sourceMappingURL=meeting-attendancereport-get.js.map
@@ -0,0 +1,112 @@
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 _TeamsMessageRemoveCommand_instances, _TeamsMessageRemoveCommand_initTelemetry, _TeamsMessageRemoveCommand_initOptions, _TeamsMessageRemoveCommand_initValidators, _TeamsMessageRemoveCommand_initOptionSets, _TeamsMessageRemoveCommand_initTypes;
7
+ import { cli } from '../../../../cli/cli.js';
8
+ import request from '../../../../request.js';
9
+ import { formatting } from '../../../../utils/formatting.js';
10
+ import { teams } from '../../../../utils/teams.js';
11
+ import { validation } from '../../../../utils/validation.js';
12
+ import DelegatedGraphCommand from '../../../base/DelegatedGraphCommand.js';
13
+ import commands from '../../commands.js';
14
+ class TeamsMessageRemoveCommand extends DelegatedGraphCommand {
15
+ get name() {
16
+ return commands.MESSAGE_REMOVE;
17
+ }
18
+ get description() {
19
+ return 'Removes a message from a channel in a Microsoft Teams team';
20
+ }
21
+ constructor() {
22
+ super();
23
+ _TeamsMessageRemoveCommand_instances.add(this);
24
+ __classPrivateFieldGet(this, _TeamsMessageRemoveCommand_instances, "m", _TeamsMessageRemoveCommand_initTelemetry).call(this);
25
+ __classPrivateFieldGet(this, _TeamsMessageRemoveCommand_instances, "m", _TeamsMessageRemoveCommand_initOptions).call(this);
26
+ __classPrivateFieldGet(this, _TeamsMessageRemoveCommand_instances, "m", _TeamsMessageRemoveCommand_initValidators).call(this);
27
+ __classPrivateFieldGet(this, _TeamsMessageRemoveCommand_instances, "m", _TeamsMessageRemoveCommand_initOptionSets).call(this);
28
+ __classPrivateFieldGet(this, _TeamsMessageRemoveCommand_instances, "m", _TeamsMessageRemoveCommand_initTypes).call(this);
29
+ }
30
+ async commandAction(logger, args) {
31
+ const removeTeamMessage = async () => {
32
+ try {
33
+ if (this.verbose) {
34
+ await logger.logToStderr(`Removing message '${args.options.id}' from channel '${args.options.channelId || args.options.channelName}' in team '${args.options.teamId || args.options.teamName}'.`);
35
+ }
36
+ const teamId = args.options.teamId || await teams.getTeamIdByDisplayName(args.options.teamName);
37
+ const channelId = args.options.channelId || await teams.getChannelIdByDisplayName(teamId, args.options.channelName);
38
+ const requestOptions = {
39
+ url: `${this.resource}/v1.0/teams/${teamId}/channels/${formatting.encodeQueryParameter(channelId)}/messages/${args.options.id}/softDelete`,
40
+ headers: {
41
+ accept: 'application/json;odata.metadata=none'
42
+ },
43
+ responseType: 'json'
44
+ };
45
+ await request.post(requestOptions);
46
+ }
47
+ catch (err) {
48
+ if (err.error?.error?.code === 'NotFound') {
49
+ this.handleError('The message was not found in the Teams channel.');
50
+ }
51
+ else {
52
+ this.handleRejectedODataJsonPromise(err);
53
+ }
54
+ }
55
+ };
56
+ if (args.options.force) {
57
+ await removeTeamMessage();
58
+ }
59
+ else {
60
+ const result = await cli.promptForConfirmation({ message: `Are you sure you want to remove this message?` });
61
+ if (result) {
62
+ await removeTeamMessage();
63
+ }
64
+ }
65
+ }
66
+ }
67
+ _TeamsMessageRemoveCommand_instances = new WeakSet(), _TeamsMessageRemoveCommand_initTelemetry = function _TeamsMessageRemoveCommand_initTelemetry() {
68
+ this.telemetry.push((args) => {
69
+ Object.assign(this.telemetryProperties, {
70
+ teamId: typeof args.options.teamId !== 'undefined',
71
+ teamName: typeof args.options.teamName !== 'undefined',
72
+ channelId: typeof args.options.channelId !== 'undefined',
73
+ channelName: typeof args.options.channelName !== 'undefined',
74
+ force: !!args.options.force
75
+ });
76
+ });
77
+ }, _TeamsMessageRemoveCommand_initOptions = function _TeamsMessageRemoveCommand_initOptions() {
78
+ this.options.unshift({
79
+ option: '--teamId [teamId]'
80
+ }, {
81
+ option: '--teamName [teamName]'
82
+ }, {
83
+ option: '--channelId [channelId]'
84
+ }, {
85
+ option: '--channelName [channelName]'
86
+ }, {
87
+ option: '-i, --id <id>'
88
+ }, {
89
+ option: '-f, --force'
90
+ });
91
+ }, _TeamsMessageRemoveCommand_initValidators = function _TeamsMessageRemoveCommand_initValidators() {
92
+ this.validators.push(async (args) => {
93
+ if (args.options.teamId && !validation.isValidGuid(args.options.teamId)) {
94
+ return `'${args.options.teamId}' is not a valid GUID for 'teamId'.`;
95
+ }
96
+ if (args.options.channelId && !validation.isValidTeamsChannelId(args.options.channelId)) {
97
+ return `'${args.options.channelId}' is not a valid ID for 'channelId'.`;
98
+ }
99
+ return true;
100
+ });
101
+ }, _TeamsMessageRemoveCommand_initOptionSets = function _TeamsMessageRemoveCommand_initOptionSets() {
102
+ this.optionSets.push({
103
+ options: ['teamId', 'teamName']
104
+ }, {
105
+ options: ['channelId', 'channelName']
106
+ });
107
+ }, _TeamsMessageRemoveCommand_initTypes = function _TeamsMessageRemoveCommand_initTypes() {
108
+ this.types.string.push('teamId', 'teamName', 'channelId', 'channelName', 'id');
109
+ this.types.boolean.push('force');
110
+ };
111
+ export default new TeamsMessageRemoveCommand();
112
+ //# sourceMappingURL=message-remove.js.map
@@ -30,12 +30,14 @@ export default {
30
30
  MEETING_ADD: `${prefix} meeting add`,
31
31
  MEETING_GET: `${prefix} meeting get`,
32
32
  MEETING_LIST: `${prefix} meeting list`,
33
+ MEETING_ATTENDANCEREPORT_GET: `${prefix} meeting attendancereport get`,
33
34
  MEETING_ATTENDANCEREPORT_LIST: `${prefix} meeting attendancereport list`,
34
35
  MEETING_TRANSCRIPT_LIST: `${prefix} meeting transcript list`,
35
36
  MEMBERSETTINGS_LIST: `${prefix} membersettings list`,
36
37
  MEMBERSETTINGS_SET: `${prefix} membersettings set`,
37
38
  MESSAGE_GET: `${prefix} message get`,
38
39
  MESSAGE_LIST: `${prefix} message list`,
40
+ MESSAGE_REMOVE: `${prefix} message remove`,
39
41
  MESSAGE_REPLY_LIST: `${prefix} message reply list`,
40
42
  MESSAGE_SEND: `${prefix} message send`,
41
43
  MESSAGINGSETTINGS_LIST: `${prefix} messagingsettings list`,