@pnp/cli-microsoft365 12.0.0-beta.d0b29c1 → 12.0.0-beta.d58fb77

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 (39) hide show
  1. package/allCommands.json +1 -1
  2. package/allCommandsFull.json +1 -1
  3. package/dist/Auth.js +15 -1
  4. package/dist/m365/cli/commands/cli-consent.js +9 -2
  5. package/dist/m365/spfx/commands/SpfxCompatibilityMatrix.js +1 -1
  6. package/dist/m365/spfx/commands/project/project-doctor/{doctor-1.24.0-rc.0.js → doctor-1.24.0.js} +1 -1
  7. package/dist/m365/spfx/commands/project/project-doctor.js +1 -1
  8. package/dist/m365/spfx/commands/project/project-upgrade/{upgrade-1.24.0-rc.0.js → upgrade-1.24.0.js} +27 -27
  9. package/dist/m365/spfx/commands/project/project-upgrade.js +11 -11
  10. package/dist/m365/spo/commands/commandset/commandset-add.js +17 -59
  11. package/dist/m365/spo/commands/commandset/commandset-get.js +24 -62
  12. package/dist/m365/spo/commands/commandset/commandset-list.js +11 -34
  13. package/dist/m365/spo/commands/commandset/commandset-remove.js +21 -54
  14. package/dist/m365/spo/commands/commandset/commandset-set.js +30 -83
  15. package/dist/m365/spo/commands/sitescript/sitescript-add.js +22 -37
  16. package/dist/m365/spo/commands/sitescript/sitescript-get.js +9 -26
  17. package/dist/m365/spo/commands/sitescript/sitescript-list.js +5 -0
  18. package/dist/m365/spo/commands/sitescript/sitescript-remove.js +9 -33
  19. package/dist/m365/spo/commands/sitescript/sitescript-set.js +29 -56
  20. package/dist/m365/spp/commands/contentcenter/contentcenter-list.js +5 -0
  21. package/dist/m365/spp/commands/model/model-get.js +25 -45
  22. package/dist/m365/spp/commands/model/model-list.js +12 -23
  23. package/dist/m365/spp/commands/model/model-remove.js +25 -45
  24. package/dist/m365/teams/commands/meeting/meeting-add.js +57 -68
  25. package/dist/m365/teams/commands/meeting/meeting-attendancereport-get.js +33 -58
  26. package/dist/m365/teams/commands/meeting/meeting-attendancereport-list.js +14 -38
  27. package/dist/m365/teams/commands/meeting/meeting-get.js +14 -38
  28. package/dist/m365/teams/commands/meeting/meeting-list.js +34 -59
  29. package/dist/m365/teams/commands/meeting/meeting-transcript-get.js +34 -58
  30. package/dist/m365/teams/commands/meeting/meeting-transcript-list.js +29 -50
  31. package/dist/m365/teams/commands/message/message-get.js +19 -30
  32. package/dist/m365/teams/commands/message/message-list.js +26 -43
  33. package/dist/m365/teams/commands/message/message-remove.js +43 -58
  34. package/dist/m365/teams/commands/message/message-reply-list.js +19 -30
  35. package/dist/m365/teams/commands/message/message-restore.js +40 -50
  36. package/dist/m365/teams/commands/message/message-send.js +19 -30
  37. package/docs/docs/cmd/login.mdx +15 -2
  38. package/docs/docs/cmd/spfx/project/project-upgrade.mdx +1 -1
  39. package/package.json +2 -1
package/dist/Auth.js CHANGED
@@ -606,8 +606,22 @@ export class Auth {
606
606
  const federationToken = await this.getFederationTokenFromAzureDevOps(logger, debug, serviceConnectionId);
607
607
  return this.getAccessTokenWithFederatedToken(resource, federationToken, logger, debug);
608
608
  }
609
+ else if (process.env.GITLAB_CI) {
610
+ if (debug) {
611
+ await logger.logToStderr('GITLAB_CI env variable found. The context is GitLab CI/CD...');
612
+ }
613
+ if (!process.env.GITLAB_OIDC_TOKEN) {
614
+ throw new CommandError('The `GITLAB_OIDC_TOKEN` environment variable is not available. Please add an id_tokens entry named GITLAB_OIDC_TOKEN with audience `api://AzureADTokenExchange` to the job.');
615
+ }
616
+ if (!this.connection.appId || this.connection.tenant === 'common') {
617
+ throw new CommandError('The appId and tenant parameters are required when using federated identity in GitLab CI/CD.');
618
+ }
619
+ // GitLab's id_tokens feature mints the OIDC JWT directly into the configured job variable, so no
620
+ // separate request to GitLab is needed to obtain the federation token before exchanging it with Entra ID.
621
+ return this.getAccessTokenWithFederatedToken(resource, process.env.GITLAB_OIDC_TOKEN, logger, debug);
622
+ }
609
623
  else {
610
- throw new CommandError('Federated identity is currently only supported in GitHub Actions and Azure DevOps.');
624
+ throw new CommandError('Federated identity is currently only supported in GitHub Actions, Azure DevOps and GitLab.');
611
625
  }
612
626
  }
613
627
  async getFederationTokenFromGithub(logger, debug) {
@@ -1,6 +1,7 @@
1
1
  import { z } from 'zod';
2
+ import auth from '../../../Auth.js';
2
3
  import { cli } from '../../../cli/cli.js';
3
- import { globalOptionsZod } from '../../../Command.js';
4
+ import { CommandError, globalOptionsZod } from '../../../Command.js';
4
5
  import AnonymousCommand from '../../base/AnonymousCommand.js';
5
6
  import commands from '../commands.js';
6
7
  export const options = z.strictObject({
@@ -22,9 +23,15 @@ class CliConsentCommand extends AnonymousCommand {
22
23
  if (args.options.service === 'VivaEngage') {
23
24
  scope = 'https://api.yammer.com/user_impersonation';
24
25
  }
25
- await logger.log(`To consent permissions for executing ${args.options.service} commands, navigate in your web browser to https://login.microsoftonline.com/${cli.getTenant()}/oauth2/v2.0/authorize?client_id=${cli.getClientId()}&response_type=code&scope=${encodeURIComponent(scope)}`);
26
+ const appId = auth.connection.active ? auth.connection.appId : cli.getClientId();
27
+ if (!appId) {
28
+ throw new CommandError(`Unable to determine the client ID of the Microsoft Entra application used by the CLI. Log in to Microsoft 365 first or store the client ID using 'm365 cli config set --key clientId --value <appId>'.`);
29
+ }
30
+ const tenant = auth.connection.active ? auth.connection.tenant : cli.getTenant();
31
+ await logger.log(`To consent permissions for executing ${args.options.service} commands, navigate in your web browser to https://login.microsoftonline.com/${tenant}/oauth2/v2.0/authorize?client_id=${appId}&response_type=code&scope=${encodeURIComponent(scope)}`);
26
32
  }
27
33
  async action(logger, args) {
34
+ await auth.restoreAuth();
28
35
  await this.initAction(args, logger);
29
36
  await this.commandAction(logger, args);
30
37
  }
@@ -654,7 +654,7 @@ export const versions = {
654
654
  fix: 'npm i -g yo@7'
655
655
  }
656
656
  },
657
- '1.24.0-rc.0': {
657
+ '1.24.0': {
658
658
  heft: {
659
659
  range: '^1',
660
660
  fix: 'npm i -g @rushstack/heft@1'
@@ -16,4 +16,4 @@ export default [
16
16
  new FN002022_DEVDEP_typescript({ supportedRange: '~5.8.0' }),
17
17
  new FN021001_PKG_spfx_deps_versions_match_project_version({ includeDevDeps: true })
18
18
  ];
19
- //# sourceMappingURL=doctor-1.24.0-rc.0.js.map
19
+ //# sourceMappingURL=doctor-1.24.0.js.map
@@ -79,7 +79,7 @@ class SpfxProjectDoctorCommand extends BaseProjectCommand {
79
79
  '1.22.2',
80
80
  '1.23.0',
81
81
  '1.23.2',
82
- '1.24.0-rc.0'
82
+ '1.24.0'
83
83
  ];
84
84
  __classPrivateFieldGet(this, _SpfxProjectDoctorCommand_instances, "m", _SpfxProjectDoctorCommand_initTelemetry).call(this);
85
85
  __classPrivateFieldGet(this, _SpfxProjectDoctorCommand_instances, "m", _SpfxProjectDoctorCommand_initOptions).call(this);
@@ -36,37 +36,37 @@ import { FN027001_OVERRIDES_rushstack_heft } from './rules/FN027001_OVERRIDES_ru
36
36
  import { FN027002_OVERRIDES_qs } from './rules/FN027002_OVERRIDES_qs.js';
37
37
  import { FN027003_OVERRIDES_uuid } from './rules/FN027003_OVERRIDES_uuid.js';
38
38
  export default [
39
- new FN001001_DEP_microsoft_sp_core_library({ packageVersion: '1.24.0-rc.0' }),
40
- new FN001002_DEP_microsoft_sp_lodash_subset({ packageVersion: '1.24.0-rc.0' }),
41
- new FN001003_DEP_microsoft_sp_office_ui_fabric_core({ packageVersion: '1.24.0-rc.0' }),
42
- new FN001004_DEP_microsoft_sp_webpart_base({ packageVersion: '1.24.0-rc.0' }),
39
+ new FN001001_DEP_microsoft_sp_core_library({ packageVersion: '1.24.0' }),
40
+ new FN001002_DEP_microsoft_sp_lodash_subset({ packageVersion: '1.24.0' }),
41
+ new FN001003_DEP_microsoft_sp_office_ui_fabric_core({ packageVersion: '1.24.0' }),
42
+ new FN001004_DEP_microsoft_sp_webpart_base({ packageVersion: '1.24.0' }),
43
43
  new FN001008_DEP_react({ packageVersion: '18.3.1' }),
44
44
  new FN001009_DEP_react_dom({ packageVersion: '18.3.1' }),
45
- new FN001011_DEP_microsoft_sp_dialog({ packageVersion: '1.24.0-rc.0' }),
46
- new FN001012_DEP_microsoft_sp_application_base({ packageVersion: '1.24.0-rc.0' }),
47
- new FN001014_DEP_microsoft_sp_listview_extensibility({ packageVersion: '1.24.0-rc.0' }),
48
- new FN001021_DEP_microsoft_sp_property_pane({ packageVersion: '1.24.0-rc.0' }),
49
- new FN001023_DEP_microsoft_sp_component_base({ packageVersion: '1.24.0-rc.0' }),
50
- new FN001024_DEP_microsoft_sp_diagnostics({ packageVersion: '1.24.0-rc.0' }),
51
- new FN001025_DEP_microsoft_sp_dynamic_data({ packageVersion: '1.24.0-rc.0' }),
52
- new FN001026_DEP_microsoft_sp_extension_base({ packageVersion: '1.24.0-rc.0' }),
53
- new FN001027_DEP_microsoft_sp_http({ packageVersion: '1.24.0-rc.0' }),
54
- new FN001028_DEP_microsoft_sp_list_subscription({ packageVersion: '1.24.0-rc.0' }),
55
- new FN001029_DEP_microsoft_sp_loader({ packageVersion: '1.24.0-rc.0' }),
56
- new FN001030_DEP_microsoft_sp_module_interfaces({ packageVersion: '1.24.0-rc.0' }),
57
- new FN001031_DEP_microsoft_sp_odata_types({ packageVersion: '1.24.0-rc.0' }),
58
- new FN001032_DEP_microsoft_sp_page_context({ packageVersion: '1.24.0-rc.0' }),
59
- new FN001013_DEP_microsoft_decorators({ packageVersion: '1.24.0-rc.0' }),
60
- new FN001034_DEP_microsoft_sp_adaptive_card_extension_base({ packageVersion: '1.24.0-rc.0' }),
61
- new FN002002_DEVDEP_microsoft_sp_module_interfaces({ packageVersion: '1.24.0-rc.0' }),
45
+ new FN001011_DEP_microsoft_sp_dialog({ packageVersion: '1.24.0' }),
46
+ new FN001012_DEP_microsoft_sp_application_base({ packageVersion: '1.24.0' }),
47
+ new FN001014_DEP_microsoft_sp_listview_extensibility({ packageVersion: '1.24.0' }),
48
+ new FN001021_DEP_microsoft_sp_property_pane({ packageVersion: '1.24.0' }),
49
+ new FN001023_DEP_microsoft_sp_component_base({ packageVersion: '1.24.0' }),
50
+ new FN001024_DEP_microsoft_sp_diagnostics({ packageVersion: '1.24.0' }),
51
+ new FN001025_DEP_microsoft_sp_dynamic_data({ packageVersion: '1.24.0' }),
52
+ new FN001026_DEP_microsoft_sp_extension_base({ packageVersion: '1.24.0' }),
53
+ new FN001027_DEP_microsoft_sp_http({ packageVersion: '1.24.0' }),
54
+ new FN001028_DEP_microsoft_sp_list_subscription({ packageVersion: '1.24.0' }),
55
+ new FN001029_DEP_microsoft_sp_loader({ packageVersion: '1.24.0' }),
56
+ new FN001030_DEP_microsoft_sp_module_interfaces({ packageVersion: '1.24.0' }),
57
+ new FN001031_DEP_microsoft_sp_odata_types({ packageVersion: '1.24.0' }),
58
+ new FN001032_DEP_microsoft_sp_page_context({ packageVersion: '1.24.0' }),
59
+ new FN001013_DEP_microsoft_decorators({ packageVersion: '1.24.0' }),
60
+ new FN001034_DEP_microsoft_sp_adaptive_card_extension_base({ packageVersion: '1.24.0' }),
61
+ new FN002002_DEVDEP_microsoft_sp_module_interfaces({ packageVersion: '1.24.0' }),
62
62
  new FN002015_DEVDEP_types_react({ packageVersion: '18.2.79' }),
63
63
  new FN002016_DEVDEP_types_react_dom({ packageVersion: '18.2.25' }),
64
- new FN002022_DEVDEP_microsoft_eslint_plugin_spfx({ packageVersion: '1.24.0-rc.0' }),
65
- new FN002023_DEVDEP_microsoft_eslint_config_spfx({ packageVersion: '1.24.0-rc.0' }),
66
- new FN002030_DEVDEP_microsoft_spfx_web_build_rig({ packageVersion: '1.24.0-rc.0' }),
64
+ new FN002022_DEVDEP_microsoft_eslint_plugin_spfx({ packageVersion: '1.24.0' }),
65
+ new FN002023_DEVDEP_microsoft_eslint_config_spfx({ packageVersion: '1.24.0' }),
66
+ new FN002030_DEVDEP_microsoft_spfx_web_build_rig({ packageVersion: '1.24.0' }),
67
67
  new FN002031_DEVDEP_rushstack_heft({ packageVersion: '1.3.2' }),
68
- new FN002034_DEVDEP_microsoft_spfx_heft_plugins({ packageVersion: '1.24.0-rc.0' }),
69
- new FN010001_YORC_version({ version: '1.24.0-rc.0' }),
68
+ new FN002034_DEVDEP_microsoft_spfx_heft_plugins({ packageVersion: '1.24.0' }),
69
+ new FN010001_YORC_version({ version: '1.24.0' }),
70
70
  new FN012021_TSC_excludeDirectories({ directories: ['**/teams', '**/temp/copilot'] }),
71
71
  new FN020001_RES_types_react({ packageVersion: '18.2.79' }),
72
72
  new FN021003_PKG_engines_node({ version: '>=22.14.0 <23.0.0 || >=24.0.0 <25.0.0 || >=26.0.0 <27.0.0' }),
@@ -74,4 +74,4 @@ export default [
74
74
  new FN027002_OVERRIDES_qs({ version: '>=6.15.2' }),
75
75
  new FN027003_OVERRIDES_uuid({ version: '>=11.1.1' })
76
76
  ];
77
- //# sourceMappingURL=upgrade-1.24.0-rc.0.js.map
77
+ //# sourceMappingURL=upgrade-1.24.0.js.map
@@ -2,7 +2,7 @@ import fs from 'fs';
2
2
  import os from 'os';
3
3
  import path from 'path';
4
4
  // Uncomment to support upgrading to preview releases
5
- import { prerelease } from 'semver';
5
+ // import { prerelease } from 'semver';
6
6
  import { z } from 'zod';
7
7
  import { CommandError, globalOptionsZod } from '../../../../Command.js';
8
8
  import { fsUtil } from '../../../../utils/fsUtil.js';
@@ -88,7 +88,7 @@ class SpfxProjectUpgradeCommand extends BaseProjectCommand {
88
88
  '1.22.2',
89
89
  '1.23.0',
90
90
  '1.23.2',
91
- '1.24.0-rc.0'
91
+ '1.24.0'
92
92
  ];
93
93
  }
94
94
  async commandAction(logger, args) {
@@ -98,15 +98,15 @@ class SpfxProjectUpgradeCommand extends BaseProjectCommand {
98
98
  }
99
99
  this.toVersion = args.options.toVersion ? args.options.toVersion : this.supportedVersions[this.supportedVersions.length - 1];
100
100
  // Uncomment to support upgrading to preview releases
101
- if (!args.options.toVersion &&
102
- !args.options.preview &&
103
- prerelease(this.toVersion)) {
104
- // no version and no preview specified while the current version to
105
- // upgrade to is a prerelease so let's grab the first non-preview version
106
- // since we're supporting only one preview version, it's sufficient for
107
- // us to take second to last version
108
- this.toVersion = this.supportedVersions[this.supportedVersions.length - 2];
109
- }
101
+ // if (!args.options.toVersion &&
102
+ // !args.options.preview &&
103
+ // prerelease(this.toVersion)) {
104
+ // // no version and no preview specified while the current version to
105
+ // // upgrade to is a prerelease so let's grab the first non-preview version
106
+ // // since we're supporting only one preview version, it's sufficient for
107
+ // // us to take second to last version
108
+ // this.toVersion = this.supportedVersions[this.supportedVersions.length - 2];
109
+ // }
110
110
  this.packageManager = args.options.packageManager || 'npm';
111
111
  this.shell = args.options.shell || 'powershell';
112
112
  if (this.supportedVersions.indexOf(this.toVersion) < 0) {
@@ -1,13 +1,22 @@
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 _SpoCommandSetAddCommand_instances, _a, _SpoCommandSetAddCommand_initTelemetry, _SpoCommandSetAddCommand_initOptions, _SpoCommandSetAddCommand_initValidators;
1
+ import { globalOptionsZod } from '../../../../Command.js';
7
2
  import commands from '../../commands.js';
8
3
  import { validation } from '../../../../utils/validation.js';
9
4
  import SpoCommand from '../../../base/SpoCommand.js';
10
5
  import request from '../../../../request.js';
6
+ import { z } from 'zod';
7
+ export const options = z.strictObject({
8
+ ...globalOptionsZod.shape,
9
+ title: z.string().alias('t'),
10
+ webUrl: z.string().refine(url => validation.isValidSharePointUrl(url) === true, {
11
+ error: e => `'${e.input}' is not a valid SharePoint Online site URL.`
12
+ }).alias('u'),
13
+ listType: z.enum(['List', 'Library', 'SitePages']).alias('l'),
14
+ clientSideComponentId: z.string().refine(validation.isValidGuid, { message: 'The value must be a valid GUID.' }).alias('i'),
15
+ description: z.string().optional(),
16
+ clientSideComponentProperties: z.string().optional(),
17
+ scope: z.enum(['Site', 'Web']).optional().alias('s'),
18
+ location: z.enum(['ContextMenu', 'CommandBar', 'Both']).optional()
19
+ });
11
20
  class SpoCommandSetAddCommand extends SpoCommand {
12
21
  get name() {
13
22
  return commands.COMMANDSET_ADD;
@@ -15,12 +24,8 @@ class SpoCommandSetAddCommand extends SpoCommand {
15
24
  get description() {
16
25
  return 'Adds a ListView Command Set to a site.';
17
26
  }
18
- constructor() {
19
- super();
20
- _SpoCommandSetAddCommand_instances.add(this);
21
- __classPrivateFieldGet(this, _SpoCommandSetAddCommand_instances, "m", _SpoCommandSetAddCommand_initTelemetry).call(this);
22
- __classPrivateFieldGet(this, _SpoCommandSetAddCommand_instances, "m", _SpoCommandSetAddCommand_initOptions).call(this);
23
- __classPrivateFieldGet(this, _SpoCommandSetAddCommand_instances, "m", _SpoCommandSetAddCommand_initValidators).call(this);
27
+ get schema() {
28
+ return options;
24
29
  }
25
30
  async commandAction(logger, args) {
26
31
  if (this.verbose) {
@@ -79,52 +84,5 @@ class SpoCommandSetAddCommand extends SpoCommand {
79
84
  }
80
85
  }
81
86
  }
82
- _a = SpoCommandSetAddCommand, _SpoCommandSetAddCommand_instances = new WeakSet(), _SpoCommandSetAddCommand_initTelemetry = function _SpoCommandSetAddCommand_initTelemetry() {
83
- this.telemetry.push((args) => {
84
- Object.assign(this.telemetryProperties, {
85
- description: typeof args.options.description !== 'undefined',
86
- clientSideComponentProperties: typeof args.options.clientSideComponentProperties !== 'undefined',
87
- scope: typeof args.options.scope !== 'undefined',
88
- location: typeof args.options.location !== 'undefined'
89
- });
90
- });
91
- }, _SpoCommandSetAddCommand_initOptions = function _SpoCommandSetAddCommand_initOptions() {
92
- this.options.unshift({
93
- option: '-t, --title <title>'
94
- }, {
95
- option: '-u, --webUrl <webUrl>'
96
- }, {
97
- option: '-l, --listType <listType>', autocomplete: _a.listTypes
98
- }, {
99
- option: '-i, --clientSideComponentId <clientSideComponentId>'
100
- }, {
101
- option: '--description [description]'
102
- }, {
103
- option: '--clientSideComponentProperties [clientSideComponentProperties]'
104
- }, {
105
- option: '-s, --scope [scope]', autocomplete: _a.scopes
106
- }, {
107
- option: '--location [location]', autocomplete: _a.locations
108
- });
109
- }, _SpoCommandSetAddCommand_initValidators = function _SpoCommandSetAddCommand_initValidators() {
110
- this.validators.push(async (args) => {
111
- if (args.options.clientSideComponentId && !validation.isValidGuid(args.options.clientSideComponentId)) {
112
- return `${args.options.clientSideComponentId} is not a valid GUID`;
113
- }
114
- if (_a.listTypes.indexOf(args.options.listType) < 0) {
115
- return `${args.options.listType} is not a valid list type. Allowed values are ${_a.listTypes.join(', ')}`;
116
- }
117
- if (args.options.scope && _a.scopes.indexOf(args.options.scope) < 0) {
118
- return `${args.options.scope} is not a valid scope. Allowed values are ${_a.scopes.join(', ')}`;
119
- }
120
- if (args.options.location && _a.locations.indexOf(args.options.location) < 0) {
121
- return `${args.options.location} is not a valid location. Allowed values are ${_a.locations.join(', ')}`;
122
- }
123
- return validation.isValidSharePointUrl(args.options.webUrl);
124
- });
125
- };
126
- SpoCommandSetAddCommand.listTypes = ['List', 'Library', 'SitePages'];
127
- SpoCommandSetAddCommand.scopes = ['Site', 'Web'];
128
- SpoCommandSetAddCommand.locations = ['ContextMenu', 'CommandBar', 'Both'];
129
87
  export default new SpoCommandSetAddCommand();
130
88
  //# sourceMappingURL=commandset-add.js.map
@@ -1,15 +1,22 @@
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 _SpoCommandSetGetCommand_instances, _a, _SpoCommandSetGetCommand_initTelemetry, _SpoCommandSetGetCommand_initOptions, _SpoCommandSetGetCommand_initValidators, _SpoCommandSetGetCommand_initOptionSets, _SpoCommandSetGetCommand_initTypes;
1
+ import { globalOptionsZod } from '../../../../Command.js';
7
2
  import { formatting } from '../../../../utils/formatting.js';
8
3
  import { spo } from '../../../../utils/spo.js';
9
4
  import { validation } from '../../../../utils/validation.js';
10
5
  import SpoCommand from '../../../base/SpoCommand.js';
11
6
  import commands from '../../commands.js';
12
7
  import { cli } from '../../../../cli/cli.js';
8
+ import { z } from 'zod';
9
+ export const options = z.strictObject({
10
+ ...globalOptionsZod.shape,
11
+ webUrl: z.string().refine(url => validation.isValidSharePointUrl(url) === true, {
12
+ error: e => `'${e.input}' is not a valid SharePoint Online site URL.`
13
+ }).alias('u'),
14
+ title: z.string().optional().alias('t'),
15
+ id: z.string().refine(validation.isValidGuid, { message: 'The value must be a valid GUID.' }).optional().alias('i'),
16
+ clientSideComponentId: z.string().refine(validation.isValidGuid, { message: 'The value must be a valid GUID.' }).optional().alias('c'),
17
+ scope: z.enum(['All', 'Site', 'Web']).optional().alias('s'),
18
+ clientSideComponentProperties: z.boolean().optional().alias('p')
19
+ });
13
20
  class SpoCommandSetGetCommand extends SpoCommand {
14
21
  get name() {
15
22
  return commands.COMMANDSET_GET;
@@ -17,14 +24,14 @@ class SpoCommandSetGetCommand extends SpoCommand {
17
24
  get description() {
18
25
  return 'Gets a ListView Command Set that is added to a site.';
19
26
  }
20
- constructor() {
21
- super();
22
- _SpoCommandSetGetCommand_instances.add(this);
23
- __classPrivateFieldGet(this, _SpoCommandSetGetCommand_instances, "m", _SpoCommandSetGetCommand_initTelemetry).call(this);
24
- __classPrivateFieldGet(this, _SpoCommandSetGetCommand_instances, "m", _SpoCommandSetGetCommand_initOptions).call(this);
25
- __classPrivateFieldGet(this, _SpoCommandSetGetCommand_instances, "m", _SpoCommandSetGetCommand_initValidators).call(this);
26
- __classPrivateFieldGet(this, _SpoCommandSetGetCommand_instances, "m", _SpoCommandSetGetCommand_initOptionSets).call(this);
27
- __classPrivateFieldGet(this, _SpoCommandSetGetCommand_instances, "m", _SpoCommandSetGetCommand_initTypes).call(this);
27
+ get schema() {
28
+ return options;
29
+ }
30
+ getRefinedSchema(schema) {
31
+ return schema.refine(opts => [opts.title, opts.id, opts.clientSideComponentId].filter(x => x !== undefined).length === 1, {
32
+ message: `Specify either 'title', 'id' or 'clientSideComponentId', but not multiple.`,
33
+ params: { customCode: 'optionSet', options: ['title', 'id', 'clientSideComponentId'] }
34
+ });
28
35
  }
29
36
  async commandAction(logger, args) {
30
37
  try {
@@ -37,7 +44,7 @@ class SpoCommandSetGetCommand extends SpoCommand {
37
44
  if (customAction === undefined) {
38
45
  throw `Command set with id ${args.options.id} can't be found.`;
39
46
  }
40
- else if (!_a.allowedCommandSetLocations.some(allowedLocation => allowedLocation === customAction.Location)) {
47
+ else if (!SpoCommandSetGetCommand.allowedCommandSetLocations.some(allowedLocation => allowedLocation === customAction.Location)) {
41
48
  throw `Custom action with id ${args.options.id} is not a command set.`;
42
49
  }
43
50
  commandSet = customAction;
@@ -77,55 +84,10 @@ class SpoCommandSetGetCommand extends SpoCommand {
77
84
  }
78
85
  }
79
86
  getBaseFilter() {
80
- return `startswith(Location,'${_a.baseLocation}') and`;
87
+ return `startswith(Location,'${SpoCommandSetGetCommand.baseLocation}') and`;
81
88
  }
82
89
  }
83
- _a = SpoCommandSetGetCommand, _SpoCommandSetGetCommand_instances = new WeakSet(), _SpoCommandSetGetCommand_initTelemetry = function _SpoCommandSetGetCommand_initTelemetry() {
84
- this.telemetry.push((args) => {
85
- Object.assign(this.telemetryProperties, {
86
- title: typeof args.options.title !== 'undefined',
87
- id: typeof args.options.id !== 'undefined',
88
- clientSideComponentId: typeof args.options.clientSideComponentId !== 'undefined',
89
- scope: typeof args.options.scope !== 'undefined',
90
- clientSideComponentProperties: !!args.options.clientSideComponentProperties
91
- });
92
- });
93
- }, _SpoCommandSetGetCommand_initOptions = function _SpoCommandSetGetCommand_initOptions() {
94
- this.options.unshift({
95
- option: '-u, --webUrl <webUrl>'
96
- }, {
97
- option: '-t, --title [title]'
98
- }, {
99
- option: '-i, --id [id]'
100
- }, {
101
- option: '-c, --clientSideComponentId [clientSideComponentId]'
102
- }, {
103
- option: '-s, --scope [scope]',
104
- autocomplete: _a.scopes
105
- }, {
106
- option: '-p, --clientSideComponentProperties'
107
- });
108
- }, _SpoCommandSetGetCommand_initValidators = function _SpoCommandSetGetCommand_initValidators() {
109
- this.validators.push(async (args) => {
110
- if (args.options.id && !validation.isValidGuid(args.options.id)) {
111
- return `${args.options.id} is not a valid GUID.`;
112
- }
113
- if (args.options.clientSideComponentId && !validation.isValidGuid(args.options.clientSideComponentId)) {
114
- return `${args.options.clientSideComponentId} is not a valid GUID.`;
115
- }
116
- if (args.options.scope && _a.scopes.indexOf(args.options.scope) < 0) {
117
- return `${args.options.scope} is not a valid scope. Valid scopes are ${_a.scopes.join(', ')}`;
118
- }
119
- return validation.isValidSharePointUrl(args.options.webUrl);
120
- });
121
- }, _SpoCommandSetGetCommand_initOptionSets = function _SpoCommandSetGetCommand_initOptionSets() {
122
- this.optionSets.push({ options: ['title', 'id', 'clientSideComponentId'] });
123
- }, _SpoCommandSetGetCommand_initTypes = function _SpoCommandSetGetCommand_initTypes() {
124
- this.types.string.push('webUrl', 'title', 'id', 'clientSideComponentId', 'scope');
125
- this.types.boolean.push('clientSideComponentProperties');
126
- };
127
- SpoCommandSetGetCommand.scopes = ['All', 'Site', 'Web'];
128
90
  SpoCommandSetGetCommand.baseLocation = 'ClientSideExtension.ListViewCommandSet';
129
- SpoCommandSetGetCommand.allowedCommandSetLocations = [_a.baseLocation, `${_a.baseLocation}.CommandBar`, `${_a.baseLocation}.ContextMenu`];
91
+ SpoCommandSetGetCommand.allowedCommandSetLocations = [SpoCommandSetGetCommand.baseLocation, `${SpoCommandSetGetCommand.baseLocation}.CommandBar`, `${SpoCommandSetGetCommand.baseLocation}.ContextMenu`];
130
92
  export default new SpoCommandSetGetCommand();
131
93
  //# sourceMappingURL=commandset-get.js.map
@@ -1,13 +1,16 @@
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 _SpoCommandSetListCommand_instances, _a, _SpoCommandSetListCommand_initTelemetry, _SpoCommandSetListCommand_initOptions, _SpoCommandSetListCommand_initValidators;
1
+ import { globalOptionsZod } from '../../../../Command.js';
7
2
  import { spo } from '../../../../utils/spo.js';
8
3
  import { validation } from '../../../../utils/validation.js';
9
4
  import SpoCommand from '../../../base/SpoCommand.js';
10
5
  import commands from '../../commands.js';
6
+ import { z } from 'zod';
7
+ export const options = z.strictObject({
8
+ ...globalOptionsZod.shape,
9
+ webUrl: z.string().refine(url => validation.isValidSharePointUrl(url) === true, {
10
+ error: e => `'${e.input}' is not a valid SharePoint Online site URL.`
11
+ }).alias('u'),
12
+ scope: z.enum(['All', 'Site', 'Web']).optional().alias('s')
13
+ });
11
14
  class SpoCommandSetListCommand extends SpoCommand {
12
15
  get name() {
13
16
  return commands.COMMANDSET_LIST;
@@ -18,12 +21,8 @@ class SpoCommandSetListCommand extends SpoCommand {
18
21
  defaultProperties() {
19
22
  return ['Name', 'Location', 'Scope', 'Id'];
20
23
  }
21
- constructor() {
22
- super();
23
- _SpoCommandSetListCommand_instances.add(this);
24
- __classPrivateFieldGet(this, _SpoCommandSetListCommand_instances, "m", _SpoCommandSetListCommand_initTelemetry).call(this);
25
- __classPrivateFieldGet(this, _SpoCommandSetListCommand_instances, "m", _SpoCommandSetListCommand_initOptions).call(this);
26
- __classPrivateFieldGet(this, _SpoCommandSetListCommand_instances, "m", _SpoCommandSetListCommand_initValidators).call(this);
24
+ get schema() {
25
+ return options;
27
26
  }
28
27
  async commandAction(logger, args) {
29
28
  try {
@@ -38,27 +37,5 @@ class SpoCommandSetListCommand extends SpoCommand {
38
37
  }
39
38
  }
40
39
  }
41
- _a = SpoCommandSetListCommand, _SpoCommandSetListCommand_instances = new WeakSet(), _SpoCommandSetListCommand_initTelemetry = function _SpoCommandSetListCommand_initTelemetry() {
42
- this.telemetry.push((args) => {
43
- Object.assign(this.telemetryProperties, {
44
- scope: args.options.scope || 'All'
45
- });
46
- });
47
- }, _SpoCommandSetListCommand_initOptions = function _SpoCommandSetListCommand_initOptions() {
48
- this.options.unshift({
49
- option: '-u, --webUrl <webUrl>'
50
- }, {
51
- option: '-s, --scope [scope]',
52
- autocomplete: _a.scopes
53
- });
54
- }, _SpoCommandSetListCommand_initValidators = function _SpoCommandSetListCommand_initValidators() {
55
- this.validators.push(async (args) => {
56
- if (args.options.scope && _a.scopes.indexOf(args.options.scope) < 0) {
57
- return `${args.options.scope} is not a valid scope. Valid scopes are ${_a.scopes.join(', ')}`;
58
- }
59
- return validation.isValidSharePointUrl(args.options.webUrl);
60
- });
61
- };
62
- SpoCommandSetListCommand.scopes = ['All', 'Site', 'Web'];
63
40
  export default new SpoCommandSetListCommand();
64
41
  //# sourceMappingURL=commandset-list.js.map
@@ -1,9 +1,4 @@
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 _SpoCommandSetRemoveCommand_instances, _a, _SpoCommandSetRemoveCommand_initTelemetry, _SpoCommandSetRemoveCommand_initOptions, _SpoCommandSetRemoveCommand_initValidators, _SpoCommandSetRemoveCommand_initOptionSets;
1
+ import { globalOptionsZod } from '../../../../Command.js';
7
2
  import commands from '../../commands.js';
8
3
  import { validation } from '../../../../utils/validation.js';
9
4
  import SpoCommand from '../../../base/SpoCommand.js';
@@ -11,6 +6,18 @@ import request from '../../../../request.js';
11
6
  import { formatting } from '../../../../utils/formatting.js';
12
7
  import { spo } from '../../../../utils/spo.js';
13
8
  import { cli } from '../../../../cli/cli.js';
9
+ import { z } from 'zod';
10
+ export const options = z.strictObject({
11
+ ...globalOptionsZod.shape,
12
+ webUrl: z.string().refine(url => validation.isValidSharePointUrl(url) === true, {
13
+ error: e => `'${e.input}' is not a valid SharePoint Online site URL.`
14
+ }).alias('u'),
15
+ title: z.string().optional().alias('t'),
16
+ id: z.string().refine(validation.isValidGuid, { message: 'The value must be a valid GUID.' }).optional().alias('i'),
17
+ clientSideComponentId: z.string().refine(validation.isValidGuid, { message: 'The value must be a valid GUID.' }).optional().alias('c'),
18
+ scope: z.enum(['All', 'Site', 'Web']).optional().alias('s'),
19
+ force: z.boolean().optional().alias('f')
20
+ });
14
21
  class SpoCommandSetRemoveCommand extends SpoCommand {
15
22
  get name() {
16
23
  return commands.COMMANDSET_REMOVE;
@@ -18,13 +25,14 @@ class SpoCommandSetRemoveCommand extends SpoCommand {
18
25
  get description() {
19
26
  return 'Removes a ListView Command Set that is added to a site.';
20
27
  }
21
- constructor() {
22
- super();
23
- _SpoCommandSetRemoveCommand_instances.add(this);
24
- __classPrivateFieldGet(this, _SpoCommandSetRemoveCommand_instances, "m", _SpoCommandSetRemoveCommand_initTelemetry).call(this);
25
- __classPrivateFieldGet(this, _SpoCommandSetRemoveCommand_instances, "m", _SpoCommandSetRemoveCommand_initOptions).call(this);
26
- __classPrivateFieldGet(this, _SpoCommandSetRemoveCommand_instances, "m", _SpoCommandSetRemoveCommand_initValidators).call(this);
27
- __classPrivateFieldGet(this, _SpoCommandSetRemoveCommand_instances, "m", _SpoCommandSetRemoveCommand_initOptionSets).call(this);
28
+ get schema() {
29
+ return options;
30
+ }
31
+ getRefinedSchema(schema) {
32
+ return schema.refine(opts => [opts.title, opts.id, opts.clientSideComponentId].filter(x => x !== undefined).length === 1, {
33
+ message: `Specify either 'title', 'id' or 'clientSideComponentId', but not multiple.`,
34
+ params: { customCode: 'optionSet', options: ['title', 'id', 'clientSideComponentId'] }
35
+ });
28
36
  }
29
37
  async commandAction(logger, args) {
30
38
  if (this.verbose) {
@@ -83,46 +91,5 @@ class SpoCommandSetRemoveCommand extends SpoCommand {
83
91
  }
84
92
  }
85
93
  }
86
- _a = SpoCommandSetRemoveCommand, _SpoCommandSetRemoveCommand_instances = new WeakSet(), _SpoCommandSetRemoveCommand_initTelemetry = function _SpoCommandSetRemoveCommand_initTelemetry() {
87
- this.telemetry.push((args) => {
88
- Object.assign(this.telemetryProperties, {
89
- title: typeof args.options.title !== 'undefined',
90
- id: typeof args.options.id !== 'undefined',
91
- clientSideComponentId: typeof args.options.clientSideComponentId !== 'undefined',
92
- scope: typeof args.options.scope !== 'undefined',
93
- force: !!args.options.force
94
- });
95
- });
96
- }, _SpoCommandSetRemoveCommand_initOptions = function _SpoCommandSetRemoveCommand_initOptions() {
97
- this.options.unshift({
98
- option: '-u, --webUrl <webUrl>'
99
- }, {
100
- option: '-t, --title [title]'
101
- }, {
102
- option: '-i, --id [id]'
103
- }, {
104
- option: '-c, --clientSideComponentId [clientSideComponentId]'
105
- }, {
106
- option: '-s, --scope [scope]', autocomplete: _a.scopes
107
- }, {
108
- option: '-f, --force'
109
- });
110
- }, _SpoCommandSetRemoveCommand_initValidators = function _SpoCommandSetRemoveCommand_initValidators() {
111
- this.validators.push(async (args) => {
112
- if (args.options.id && !validation.isValidGuid(args.options.id)) {
113
- return `${args.options.id} is not a valid GUID`;
114
- }
115
- if (args.options.clientSideComponentId && !validation.isValidGuid(args.options.clientSideComponentId)) {
116
- return `${args.options.clientSideComponentId} is not a valid GUID`;
117
- }
118
- if (args.options.scope && _a.scopes.indexOf(args.options.scope) < 0) {
119
- return `${args.options.scope} is not a valid scope. Allowed values are ${_a.scopes.join(', ')}`;
120
- }
121
- return validation.isValidSharePointUrl(args.options.webUrl);
122
- });
123
- }, _SpoCommandSetRemoveCommand_initOptionSets = function _SpoCommandSetRemoveCommand_initOptionSets() {
124
- this.optionSets.push({ options: ['id', 'title', 'clientSideComponentId'] });
125
- };
126
- SpoCommandSetRemoveCommand.scopes = ['All', 'Site', 'Web'];
127
94
  export default new SpoCommandSetRemoveCommand();
128
95
  //# sourceMappingURL=commandset-remove.js.map