@pnp/cli-microsoft365 12.1.0-beta.0c2915d → 12.1.0-beta.81e442d
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/allCommands.json +1 -1
- package/allCommandsFull.json +1 -1
- package/dist/cli/cli.js +12 -7
- package/dist/m365/entra/commands/app/app-add.js +106 -150
- package/dist/m365/entra/commands/app/app-get.js +22 -38
- package/dist/m365/entra/commands/app/app-list.js +10 -22
- package/dist/m365/entra/commands/app/app-permission-add.js +36 -50
- package/dist/m365/entra/commands/app/app-permission-list.js +29 -48
- package/dist/m365/entra/commands/app/app-permission-remove.js +44 -82
- package/dist/m365/entra/commands/app/app-remove.js +21 -38
- package/dist/m365/entra/commands/app/app-role-add.js +32 -46
- package/dist/m365/entra/commands/app/app-role-list.js +20 -25
- package/dist/m365/entra/commands/app/app-role-remove.js +33 -41
- package/dist/m365/entra/commands/app/app-set.js +46 -69
- package/dist/m365/spfx/commands/package/package-generate.js +30 -51
- package/dist/m365/spfx/commands/project/project-azuredevops-pipeline-add.js +27 -62
- package/dist/m365/spfx/commands/project/project-doctor.js +20 -51
- package/dist/m365/spfx/commands/project/project-externalize.js +16 -26
- package/dist/m365/spfx/commands/project/project-github-workflow-add.js +28 -65
- package/dist/m365/spfx/commands/project/project-permissions-grant.js +4 -2
- package/dist/m365/spfx/commands/project/project-rename.js +17 -29
- package/dist/m365/spfx/commands/project/project-upgrade.js +0 -3
- package/dist/m365/spfx/commands/spfx-doctor.js +23 -47
- package/dist/m365/spo/commands/page/page-add.js +31 -68
- package/dist/m365/spo/commands/page/page-clientsidewebpart-add.js +74 -101
- package/dist/m365/spo/commands/page/page-column-get.js +15 -32
- package/dist/m365/spo/commands/page/page-column-list.js +14 -27
- package/dist/m365/spo/commands/page/page-control-get.js +18 -27
- package/dist/m365/spo/commands/page/page-control-list.js +13 -20
- package/dist/m365/spo/commands/page/page-control-remove.js +1 -1
- package/dist/m365/spo/commands/page/page-control-set.js +51 -61
- package/dist/m365/spo/commands/page/page-copy.js +15 -31
- package/dist/m365/spo/commands/page/page-header-set.js +25 -89
- package/dist/m365/spo/commands/page/page-list.js +12 -18
- package/dist/m365/spo/commands/page/page-remove.js +16 -39
- package/dist/m365/spo/commands/page/page-section-add.js +108 -173
- package/dist/m365/spo/commands/page/page-section-get.js +17 -27
- package/dist/m365/spo/commands/page/page-section-list.js +13 -20
- package/dist/m365/spo/commands/page/page-section-remove.js +4 -1
- package/dist/m365/spo/commands/page/page-set.js +50 -100
- package/dist/m365/spo/commands/page/page-template-list.js +12 -18
- package/dist/m365/spo/commands/page/page-text-add.js +23 -45
- package/dist/m365/viva/commands/connections/connections-app-create.js +36 -42
- package/dist/m365/viva/commands/engage/engage-community-add.js +75 -71
- package/dist/m365/viva/commands/engage/engage-community-get.js +8 -16
- package/dist/m365/viva/commands/engage/engage-community-list.js +5 -0
- package/dist/m365/viva/commands/engage/engage-community-remove.js +28 -48
- package/dist/m365/viva/commands/engage/engage-community-set.js +43 -66
- package/dist/m365/viva/commands/engage/engage-community-user-add.js +7 -12
- package/dist/m365/viva/commands/engage/engage-community-user-list.js +1 -1
- package/dist/m365/viva/commands/engage/engage-community-user-remove.js +4 -2
- package/dist/m365/viva/commands/engage/engage-message-add.js +22 -52
- package/dist/m365/viva/commands/engage/engage-message-get.js +8 -23
- package/dist/m365/viva/commands/engage/engage-message-like-set.js +10 -39
- package/dist/m365/viva/commands/engage/engage-message-list.js +22 -66
- package/dist/m365/viva/commands/engage/engage-message-remove.js +9 -32
- package/dist/m365/viva/commands/engage/engage-network-list.js +8 -22
- package/dist/m365/viva/commands/engage/engage-report-activitycounts.js +2 -1
- package/dist/m365/viva/commands/engage/engage-report-activityusercounts.js +2 -1
- package/dist/m365/viva/commands/engage/engage-report-activityuserdetail.js +2 -1
- package/dist/m365/viva/commands/engage/engage-report-deviceusagedistributionusercounts.js +2 -1
- package/dist/m365/viva/commands/engage/engage-report-deviceusageusercounts.js +2 -1
- package/dist/m365/viva/commands/engage/engage-report-deviceusageuserdetail.js +2 -1
- package/dist/m365/viva/commands/engage/engage-report-groupsactivitycounts.js +2 -1
- package/dist/m365/viva/commands/engage/engage-report-groupsactivitydetail.js +2 -1
- package/dist/m365/viva/commands/engage/engage-report-groupsactivitygroupcounts.js +2 -1
- package/dist/m365/viva/commands/engage/engage-role-list.js +5 -0
- package/dist/m365/viva/commands/engage/engage-role-member-add.js +3 -5
- package/dist/m365/viva/commands/engage/engage-role-member-list.js +1 -1
- package/dist/m365/viva/commands/engage/engage-role-member-remove.js +4 -2
- package/dist/m365/viva/commands/engage/engage-search.js +16 -65
- package/dist/m365/viva/commands/engage/engage-user-get.js +15 -33
- package/dist/m365/viva/commands/engage/engage-user-list.js +22 -57
- package/docs/docs/cmd/spo/listitem/listitem-record-declare.mdx +19 -0
- package/docs/docs/cmd/spo/listitem/listitem-record-lock.mdx +21 -0
- package/docs/docs/cmd/spo/listitem/listitem-record-undeclare.mdx +21 -0
- package/docs/docs/cmd/spo/listitem/listitem-record-unlock.mdx +21 -0
- package/docs/docs/cmd/spo/page/page-text-add.mdx +1 -1
- package/docs/docs/cmd/viva/engage/engage-community-add.mdx +19 -0
- package/docs/docs/cmd/viva/engage/engage-community-get.mdx +19 -0
- package/docs/docs/cmd/viva/engage/engage-community-remove.mdx +21 -0
- package/docs/docs/cmd/viva/engage/engage-community-set.mdx +19 -0
- package/package.json +1 -1
|
@@ -1,13 +1,8 @@
|
|
|
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 _SpfxProjectGithubWorkflowAddCommand_instances, _a, _SpfxProjectGithubWorkflowAddCommand_initTelemetry, _SpfxProjectGithubWorkflowAddCommand_initOptions, _SpfxProjectGithubWorkflowAddCommand_initValidators;
|
|
7
1
|
import fs from 'fs';
|
|
8
2
|
import path from 'path';
|
|
9
3
|
import yaml from 'yaml';
|
|
10
|
-
import {
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
import { globalOptionsZod, CommandError } from '../../../../Command.js';
|
|
11
6
|
import { fsUtil } from '../../../../utils/fsUtil.js';
|
|
12
7
|
import { validation } from '../../../../utils/validation.js';
|
|
13
8
|
import commands from '../../commands.js';
|
|
@@ -15,6 +10,16 @@ import { workflow } from './DeployWorkflow.js';
|
|
|
15
10
|
import { BaseProjectCommand } from './base-project-command.js';
|
|
16
11
|
import { versions } from '../SpfxCompatibilityMatrix.js';
|
|
17
12
|
import { spfx } from '../../../../utils/spfx.js';
|
|
13
|
+
export const options = z.strictObject({
|
|
14
|
+
...globalOptionsZod.shape,
|
|
15
|
+
name: z.string().alias('n').optional(),
|
|
16
|
+
branchName: z.string().alias('b').optional(),
|
|
17
|
+
manuallyTrigger: z.boolean().alias('m').optional(),
|
|
18
|
+
loginMethod: z.enum(['application', 'user']).alias('l').optional(),
|
|
19
|
+
scope: z.enum(['tenant', 'sitecollection']).alias('s').optional(),
|
|
20
|
+
siteUrl: z.string().alias('u').optional(),
|
|
21
|
+
skipFeatureDeployment: z.boolean().optional()
|
|
22
|
+
});
|
|
18
23
|
class SpfxProjectGithubWorkflowAddCommand extends BaseProjectCommand {
|
|
19
24
|
get name() {
|
|
20
25
|
return commands.PROJECT_GITHUB_WORKFLOW_ADD;
|
|
@@ -22,17 +27,26 @@ class SpfxProjectGithubWorkflowAddCommand extends BaseProjectCommand {
|
|
|
22
27
|
get description() {
|
|
23
28
|
return 'Adds a GitHub workflow for a SharePoint Framework project.';
|
|
24
29
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
get schema() {
|
|
31
|
+
return options;
|
|
32
|
+
}
|
|
33
|
+
getRefinedSchema(schema) {
|
|
34
|
+
return schema
|
|
35
|
+
.refine(opts => !opts.scope || opts.scope !== 'sitecollection' || opts.siteUrl, {
|
|
36
|
+
error: `siteUrl option has to be defined when scope set to sitecollection`,
|
|
37
|
+
params: {
|
|
38
|
+
customCode: 'required'
|
|
39
|
+
},
|
|
40
|
+
path: ['siteUrl']
|
|
41
|
+
})
|
|
42
|
+
.refine(opts => !opts.scope || opts.scope !== 'sitecollection' || !opts.siteUrl || validation.isValidSharePointUrl(opts.siteUrl) === true, {
|
|
43
|
+
error: issue => validation.isValidSharePointUrl(issue.input.siteUrl)
|
|
44
|
+
});
|
|
31
45
|
}
|
|
32
46
|
async commandAction(logger, args) {
|
|
33
47
|
this.projectRootPath = this.getProjectRoot(process.cwd());
|
|
34
48
|
if (this.projectRootPath === null) {
|
|
35
|
-
throw new CommandError(`Couldn't find project root folder`,
|
|
49
|
+
throw new CommandError(`Couldn't find project root folder`, SpfxProjectGithubWorkflowAddCommand.ERROR_NO_PROJECT_ROOT_FOLDER);
|
|
36
50
|
}
|
|
37
51
|
try {
|
|
38
52
|
const project = { path: this.projectRootPath };
|
|
@@ -122,57 +136,6 @@ class SpfxProjectGithubWorkflowAddCommand extends BaseProjectCommand {
|
|
|
122
136
|
return workflow.jobs['build-and-deploy'].steps;
|
|
123
137
|
}
|
|
124
138
|
}
|
|
125
|
-
_a = SpfxProjectGithubWorkflowAddCommand, _SpfxProjectGithubWorkflowAddCommand_instances = new WeakSet(), _SpfxProjectGithubWorkflowAddCommand_initTelemetry = function _SpfxProjectGithubWorkflowAddCommand_initTelemetry() {
|
|
126
|
-
this.telemetry.push((args) => {
|
|
127
|
-
Object.assign(this.telemetryProperties, {
|
|
128
|
-
name: typeof args.options.name !== 'undefined',
|
|
129
|
-
branchName: typeof args.options.branchName !== 'undefined',
|
|
130
|
-
manuallyTrigger: !!args.options.manuallyTrigger,
|
|
131
|
-
loginMethod: typeof args.options.loginMethod !== 'undefined',
|
|
132
|
-
scope: typeof args.options.scope !== 'undefined',
|
|
133
|
-
skipFeatureDeployment: !!args.options.skipFeatureDeployment
|
|
134
|
-
});
|
|
135
|
-
});
|
|
136
|
-
}, _SpfxProjectGithubWorkflowAddCommand_initOptions = function _SpfxProjectGithubWorkflowAddCommand_initOptions() {
|
|
137
|
-
this.options.unshift({
|
|
138
|
-
option: '-n, --name [name]'
|
|
139
|
-
}, {
|
|
140
|
-
option: '-b, --branchName [branchName]'
|
|
141
|
-
}, {
|
|
142
|
-
option: '-m, --manuallyTrigger'
|
|
143
|
-
}, {
|
|
144
|
-
option: '-l, --loginMethod [loginMethod]',
|
|
145
|
-
autocomplete: _a.loginMethod
|
|
146
|
-
}, {
|
|
147
|
-
option: '-s, --scope [scope]',
|
|
148
|
-
autocomplete: _a.scope
|
|
149
|
-
}, {
|
|
150
|
-
option: '-u, --siteUrl [siteUrl]'
|
|
151
|
-
}, {
|
|
152
|
-
option: '--skipFeatureDeployment'
|
|
153
|
-
});
|
|
154
|
-
}, _SpfxProjectGithubWorkflowAddCommand_initValidators = function _SpfxProjectGithubWorkflowAddCommand_initValidators() {
|
|
155
|
-
this.validators.push(async (args) => {
|
|
156
|
-
if (args.options.scope && args.options.scope === 'sitecollection') {
|
|
157
|
-
if (!args.options.siteUrl) {
|
|
158
|
-
return `siteUrl option has to be defined when scope set to ${args.options.scope}`;
|
|
159
|
-
}
|
|
160
|
-
const isValidSharePointUrl = validation.isValidSharePointUrl(args.options.siteUrl);
|
|
161
|
-
if (isValidSharePointUrl !== true) {
|
|
162
|
-
return isValidSharePointUrl;
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
if (args.options.loginMethod && _a.loginMethod.indexOf(args.options.loginMethod) < 0) {
|
|
166
|
-
return `${args.options.loginMethod} is not a valid login method. Allowed values are ${_a.loginMethod.join(', ')}`;
|
|
167
|
-
}
|
|
168
|
-
if (args.options.scope && _a.scope.indexOf(args.options.scope) < 0) {
|
|
169
|
-
return `${args.options.scope} is not a valid scope. Allowed values are ${_a.scope.join(', ')}`;
|
|
170
|
-
}
|
|
171
|
-
return true;
|
|
172
|
-
});
|
|
173
|
-
};
|
|
174
|
-
SpfxProjectGithubWorkflowAddCommand.loginMethod = ['application', 'user'];
|
|
175
|
-
SpfxProjectGithubWorkflowAddCommand.scope = ['tenant', 'sitecollection'];
|
|
176
139
|
SpfxProjectGithubWorkflowAddCommand.ERROR_NO_PROJECT_ROOT_FOLDER = 1;
|
|
177
140
|
export default new SpfxProjectGithubWorkflowAddCommand();
|
|
178
141
|
//# sourceMappingURL=project-github-workflow-add.js.map
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import path from 'path';
|
|
3
|
+
import { globalOptionsZod } from '../../../../Command.js';
|
|
3
4
|
import { cli } from '../../../../cli/cli.js';
|
|
4
5
|
import { CommandError } from '../../../../Command.js';
|
|
5
6
|
import spoServicePrincipalGrantAddCommand from '../../../spo/commands/serviceprincipal/serviceprincipal-grant-add.js';
|
|
6
7
|
import commands from '../../commands.js';
|
|
7
8
|
import { BaseProjectCommand } from './base-project-command.js';
|
|
9
|
+
export const options = globalOptionsZod.strict();
|
|
8
10
|
class SpfxProjectPermissionSGrantCommand extends BaseProjectCommand {
|
|
9
11
|
get name() {
|
|
10
12
|
return commands.PROJECT_PERMISSIONS_GRANT;
|
|
@@ -12,8 +14,8 @@ class SpfxProjectPermissionSGrantCommand extends BaseProjectCommand {
|
|
|
12
14
|
get description() {
|
|
13
15
|
return 'Grants API permissions defined in the current SPFx project';
|
|
14
16
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
get schema() {
|
|
18
|
+
return options;
|
|
17
19
|
}
|
|
18
20
|
async commandAction(logger) {
|
|
19
21
|
this.projectRootPath = this.getProjectRoot(process.cwd());
|
|
@@ -1,25 +1,19 @@
|
|
|
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 _SpfxProjectRenameCommand_instances, _SpfxProjectRenameCommand_initTelemetry, _SpfxProjectRenameCommand_initOptions;
|
|
7
1
|
import fs from 'fs';
|
|
8
2
|
import path from 'path';
|
|
9
3
|
import { v4 } from 'uuid';
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
import { globalOptionsZod } from '../../../../Command.js';
|
|
10
6
|
import { CommandError } from '../../../../Command.js';
|
|
11
7
|
import commands from '../../commands.js';
|
|
12
8
|
import { BaseProjectCommand } from './base-project-command.js';
|
|
9
|
+
export const options = z.strictObject({
|
|
10
|
+
...globalOptionsZod.shape,
|
|
11
|
+
newName: z.string().alias('n'),
|
|
12
|
+
generateNewId: z.boolean().optional()
|
|
13
|
+
});
|
|
13
14
|
class SpfxProjectRenameCommand extends BaseProjectCommand {
|
|
14
|
-
get name() {
|
|
15
|
-
return commands.PROJECT_RENAME;
|
|
16
|
-
}
|
|
17
|
-
get description() {
|
|
18
|
-
return 'Renames SharePoint Framework project';
|
|
19
|
-
}
|
|
20
15
|
constructor() {
|
|
21
|
-
super();
|
|
22
|
-
_SpfxProjectRenameCommand_instances.add(this);
|
|
16
|
+
super(...arguments);
|
|
23
17
|
this.generateNewId = () => {
|
|
24
18
|
return v4();
|
|
25
19
|
};
|
|
@@ -132,8 +126,15 @@ class SpfxProjectRenameCommand extends BaseProjectCommand {
|
|
|
132
126
|
}
|
|
133
127
|
}
|
|
134
128
|
};
|
|
135
|
-
|
|
136
|
-
|
|
129
|
+
}
|
|
130
|
+
get name() {
|
|
131
|
+
return commands.PROJECT_RENAME;
|
|
132
|
+
}
|
|
133
|
+
get description() {
|
|
134
|
+
return 'Renames SharePoint Framework project';
|
|
135
|
+
}
|
|
136
|
+
get schema() {
|
|
137
|
+
return options;
|
|
137
138
|
}
|
|
138
139
|
async commandAction(logger, args) {
|
|
139
140
|
this.projectRootPath = this.getProjectRoot(process.cwd());
|
|
@@ -165,19 +166,6 @@ class SpfxProjectRenameCommand extends BaseProjectCommand {
|
|
|
165
166
|
}
|
|
166
167
|
}
|
|
167
168
|
}
|
|
168
|
-
_SpfxProjectRenameCommand_instances = new WeakSet(), _SpfxProjectRenameCommand_initTelemetry = function _SpfxProjectRenameCommand_initTelemetry() {
|
|
169
|
-
this.telemetry.push((args) => {
|
|
170
|
-
Object.assign(this.telemetryProperties, {
|
|
171
|
-
generateNewId: args.options.generateNewId
|
|
172
|
-
});
|
|
173
|
-
});
|
|
174
|
-
}, _SpfxProjectRenameCommand_initOptions = function _SpfxProjectRenameCommand_initOptions() {
|
|
175
|
-
this.options.unshift({
|
|
176
|
-
option: '-n, --newName <newName>'
|
|
177
|
-
}, {
|
|
178
|
-
option: '--generateNewId'
|
|
179
|
-
});
|
|
180
|
-
};
|
|
181
169
|
SpfxProjectRenameCommand.ERROR_NO_PROJECT_ROOT_FOLDER = 1;
|
|
182
170
|
export default new SpfxProjectRenameCommand();
|
|
183
171
|
//# sourceMappingURL=project-rename.js.map
|
|
@@ -25,9 +25,6 @@ class SpfxProjectUpgradeCommand extends BaseProjectCommand {
|
|
|
25
25
|
get description() {
|
|
26
26
|
return 'Upgrades SharePoint Framework project to the specified version';
|
|
27
27
|
}
|
|
28
|
-
get allowedOutputs() {
|
|
29
|
-
return ['json', 'text', 'md', 'tour'];
|
|
30
|
-
}
|
|
31
28
|
get schema() {
|
|
32
29
|
return options;
|
|
33
30
|
}
|
|
@@ -1,15 +1,26 @@
|
|
|
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 _SpfxDoctorCommand_instances, _SpfxDoctorCommand_initTelemetry, _SpfxDoctorCommand_initOptions, _SpfxDoctorCommand_initValidators;
|
|
7
1
|
import child_process from 'child_process';
|
|
8
2
|
import { satisfies } from 'semver';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import { globalOptionsZod } from '../../../Command.js';
|
|
9
5
|
import { CheckStatus, formatting } from '../../../utils/formatting.js';
|
|
6
|
+
import { zod } from '../../../utils/zod.js';
|
|
10
7
|
import commands from '../commands.js';
|
|
11
8
|
import { BaseProjectCommand } from './project/base-project-command.js';
|
|
12
9
|
import { SharePointVersion, versions } from './SpfxCompatibilityMatrix.js';
|
|
10
|
+
const environments = {
|
|
11
|
+
sp2016: 'sp2016',
|
|
12
|
+
sp2019: 'sp2019',
|
|
13
|
+
spo: 'spo'
|
|
14
|
+
};
|
|
15
|
+
const spfxVersions = Object.keys(versions);
|
|
16
|
+
export const options = z.strictObject({
|
|
17
|
+
...globalOptionsZod.shape,
|
|
18
|
+
env: zod.coercedEnum(environments).optional().alias('e'),
|
|
19
|
+
spfxVersion: z.enum(spfxVersions, {
|
|
20
|
+
error: `The specified version is not a supported SharePoint Framework version. Supported versions are ${spfxVersions.join(', ')}`
|
|
21
|
+
}).optional().alias('v'),
|
|
22
|
+
output: z.enum(['text', 'json']).optional().alias('o')
|
|
23
|
+
});
|
|
13
24
|
/**
|
|
14
25
|
* Where to search for the particular npm package: only in the current project,
|
|
15
26
|
* in global packages or both
|
|
@@ -29,8 +40,10 @@ var HandlePromise;
|
|
|
29
40
|
HandlePromise[HandlePromise["Continue"] = 1] = "Continue";
|
|
30
41
|
})(HandlePromise || (HandlePromise = {}));
|
|
31
42
|
class SpfxDoctorCommand extends BaseProjectCommand {
|
|
32
|
-
|
|
33
|
-
|
|
43
|
+
constructor() {
|
|
44
|
+
super(...arguments);
|
|
45
|
+
this.output = '';
|
|
46
|
+
this.resultsObject = [];
|
|
34
47
|
}
|
|
35
48
|
get name() {
|
|
36
49
|
return commands.DOCTOR;
|
|
@@ -38,14 +51,8 @@ class SpfxDoctorCommand extends BaseProjectCommand {
|
|
|
38
51
|
get description() {
|
|
39
52
|
return 'Verifies environment configuration for using the specific version of the SharePoint Framework';
|
|
40
53
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
_SpfxDoctorCommand_instances.add(this);
|
|
44
|
-
this.output = '';
|
|
45
|
-
this.resultsObject = [];
|
|
46
|
-
__classPrivateFieldGet(this, _SpfxDoctorCommand_instances, "m", _SpfxDoctorCommand_initTelemetry).call(this);
|
|
47
|
-
__classPrivateFieldGet(this, _SpfxDoctorCommand_instances, "m", _SpfxDoctorCommand_initOptions).call(this);
|
|
48
|
-
__classPrivateFieldGet(this, _SpfxDoctorCommand_instances, "m", _SpfxDoctorCommand_initValidators).call(this);
|
|
54
|
+
get schema() {
|
|
55
|
+
return options;
|
|
49
56
|
}
|
|
50
57
|
async commandAction(logger, args) {
|
|
51
58
|
if (!args.options.output) {
|
|
@@ -430,36 +437,5 @@ class SpfxDoctorCommand extends BaseProjectCommand {
|
|
|
430
437
|
}
|
|
431
438
|
}
|
|
432
439
|
}
|
|
433
|
-
_SpfxDoctorCommand_instances = new WeakSet(), _SpfxDoctorCommand_initTelemetry = function _SpfxDoctorCommand_initTelemetry() {
|
|
434
|
-
this.telemetry.push((args) => {
|
|
435
|
-
Object.assign(this.telemetryProperties, {
|
|
436
|
-
env: args.options.env,
|
|
437
|
-
spfxVersion: args.options.spfxVersion
|
|
438
|
-
});
|
|
439
|
-
});
|
|
440
|
-
}, _SpfxDoctorCommand_initOptions = function _SpfxDoctorCommand_initOptions() {
|
|
441
|
-
this.options.unshift({
|
|
442
|
-
option: '-e, --env [env]',
|
|
443
|
-
autocomplete: ['sp2016', 'sp2019', 'spo']
|
|
444
|
-
}, {
|
|
445
|
-
option: '-v, --spfxVersion [spfxVersion]',
|
|
446
|
-
autocomplete: Object.keys(versions)
|
|
447
|
-
});
|
|
448
|
-
}, _SpfxDoctorCommand_initValidators = function _SpfxDoctorCommand_initValidators() {
|
|
449
|
-
this.validators.push(async (args) => {
|
|
450
|
-
if (args.options.env) {
|
|
451
|
-
const sp = this.spVersionStringToEnum(args.options.env);
|
|
452
|
-
if (!sp) {
|
|
453
|
-
return `${args.options.env} is not a valid SharePoint version. Valid versions are sp2016, sp2019 or spo`;
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
if (args.options.spfxVersion) {
|
|
457
|
-
if (!versions[args.options.spfxVersion]) {
|
|
458
|
-
return `${args.options.spfxVersion} is not a supported SharePoint Framework version. Supported versions are ${Object.keys(versions).join(', ')}`;
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
return true;
|
|
462
|
-
});
|
|
463
|
-
};
|
|
464
440
|
export default new SpfxDoctorCommand();
|
|
465
441
|
//# sourceMappingURL=spfx-doctor.js.map
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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 _SpoPageAddCommand_instances, _SpoPageAddCommand_initTelemetry, _SpoPageAddCommand_initOptions, _SpoPageAddCommand_initValidators;
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { globalOptionsZod } from '../../../../Command.js';
|
|
7
3
|
import request from '../../../../request.js';
|
|
8
4
|
import { formatting } from '../../../../utils/formatting.js';
|
|
9
5
|
import { spo } from '../../../../utils/spo.js';
|
|
@@ -12,6 +8,22 @@ import { validation } from '../../../../utils/validation.js';
|
|
|
12
8
|
import SpoCommand from '../../../base/SpoCommand.js';
|
|
13
9
|
import commands from '../../commands.js';
|
|
14
10
|
import { Page, supportedPageLayouts, supportedPromoteAs } from './Page.js';
|
|
11
|
+
export const options = z.strictObject({
|
|
12
|
+
...globalOptionsZod.shape,
|
|
13
|
+
webUrl: z.string()
|
|
14
|
+
.refine(url => validation.isValidSharePointUrl(url) === true, {
|
|
15
|
+
error: e => `'${e.input}' is not a valid SharePoint Online site URL.`
|
|
16
|
+
})
|
|
17
|
+
.alias('u'),
|
|
18
|
+
name: z.string().alias('n'),
|
|
19
|
+
title: z.string().optional().alias('t'),
|
|
20
|
+
layoutType: z.enum(supportedPageLayouts).optional().alias('l'),
|
|
21
|
+
promoteAs: z.enum(supportedPromoteAs).optional().alias('p'),
|
|
22
|
+
commentsEnabled: z.boolean().optional(),
|
|
23
|
+
publish: z.boolean().optional(),
|
|
24
|
+
publishMessage: z.string().optional(),
|
|
25
|
+
description: z.string().optional()
|
|
26
|
+
});
|
|
15
27
|
class SpoPageAddCommand extends SpoCommand {
|
|
16
28
|
get name() {
|
|
17
29
|
return commands.PAGE_ADD;
|
|
@@ -19,12 +31,19 @@ class SpoPageAddCommand extends SpoCommand {
|
|
|
19
31
|
get description() {
|
|
20
32
|
return 'Creates modern page';
|
|
21
33
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
34
|
+
get schema() {
|
|
35
|
+
return options;
|
|
36
|
+
}
|
|
37
|
+
getRefinedSchema(schema) {
|
|
38
|
+
return schema
|
|
39
|
+
.refine(opts => opts.promoteAs !== 'HomePage' || opts.layoutType === 'Home', {
|
|
40
|
+
error: 'You can only promote home pages as site home page',
|
|
41
|
+
path: ['promoteAs']
|
|
42
|
+
})
|
|
43
|
+
.refine(opts => opts.promoteAs !== 'NewsPage' || !opts.layoutType || opts.layoutType === 'Article', {
|
|
44
|
+
error: 'You can only promote article pages as news article',
|
|
45
|
+
path: ['promoteAs']
|
|
46
|
+
});
|
|
28
47
|
}
|
|
29
48
|
async commandAction(logger, args) {
|
|
30
49
|
let pageName = args.options.name;
|
|
@@ -207,61 +226,5 @@ class SpoPageAddCommand extends SpoCommand {
|
|
|
207
226
|
}
|
|
208
227
|
}
|
|
209
228
|
}
|
|
210
|
-
_SpoPageAddCommand_instances = new WeakSet(), _SpoPageAddCommand_initTelemetry = function _SpoPageAddCommand_initTelemetry() {
|
|
211
|
-
this.telemetry.push((args) => {
|
|
212
|
-
Object.assign(this.telemetryProperties, {
|
|
213
|
-
layoutType: args.options.layoutType,
|
|
214
|
-
promoteAs: args.options.promoteAs,
|
|
215
|
-
commentsEnabled: args.options.commentsEnabled || false,
|
|
216
|
-
publish: args.options.publish || false,
|
|
217
|
-
publishMessage: typeof args.options.publishMessage !== 'undefined',
|
|
218
|
-
description: typeof args.options.description !== 'undefined'
|
|
219
|
-
});
|
|
220
|
-
});
|
|
221
|
-
}, _SpoPageAddCommand_initOptions = function _SpoPageAddCommand_initOptions() {
|
|
222
|
-
this.options.unshift({
|
|
223
|
-
option: '-n, --name <name>'
|
|
224
|
-
}, {
|
|
225
|
-
option: '-u, --webUrl <webUrl>'
|
|
226
|
-
}, {
|
|
227
|
-
option: '-t, --title [title]'
|
|
228
|
-
}, {
|
|
229
|
-
option: '-l, --layoutType [layoutType]',
|
|
230
|
-
autocomplete: supportedPageLayouts
|
|
231
|
-
}, {
|
|
232
|
-
option: '-p, --promoteAs [promoteAs]',
|
|
233
|
-
autocomplete: supportedPromoteAs
|
|
234
|
-
}, {
|
|
235
|
-
option: '--commentsEnabled'
|
|
236
|
-
}, {
|
|
237
|
-
option: '--publish'
|
|
238
|
-
}, {
|
|
239
|
-
option: '--publishMessage [publishMessage]'
|
|
240
|
-
}, {
|
|
241
|
-
option: '--description [description]'
|
|
242
|
-
});
|
|
243
|
-
}, _SpoPageAddCommand_initValidators = function _SpoPageAddCommand_initValidators() {
|
|
244
|
-
this.validators.push(async (args) => {
|
|
245
|
-
const isValidSharePointUrl = validation.isValidSharePointUrl(args.options.webUrl);
|
|
246
|
-
if (isValidSharePointUrl !== true) {
|
|
247
|
-
return isValidSharePointUrl;
|
|
248
|
-
}
|
|
249
|
-
if (args.options.layoutType &&
|
|
250
|
-
supportedPageLayouts.indexOf(args.options.layoutType) < 0) {
|
|
251
|
-
return `${args.options.layoutType} is not a valid option for layoutType. Allowed values ${supportedPageLayouts.join(', ')}`;
|
|
252
|
-
}
|
|
253
|
-
if (args.options.promoteAs &&
|
|
254
|
-
supportedPromoteAs.indexOf(args.options.promoteAs) < 0) {
|
|
255
|
-
return `${args.options.promoteAs} is not a valid option for promoteAs. Allowed values ${supportedPromoteAs.join(', ')}`;
|
|
256
|
-
}
|
|
257
|
-
if (args.options.promoteAs === 'HomePage' && args.options.layoutType !== 'Home') {
|
|
258
|
-
return 'You can only promote home pages as site home page';
|
|
259
|
-
}
|
|
260
|
-
if (args.options.promoteAs === 'NewsPage' && args.options.layoutType && args.options.layoutType !== 'Article') {
|
|
261
|
-
return 'You can only promote article pages as news article';
|
|
262
|
-
}
|
|
263
|
-
return true;
|
|
264
|
-
});
|
|
265
|
-
};
|
|
266
229
|
export default new SpoPageAddCommand();
|
|
267
230
|
//# sourceMappingURL=page-add.js.map
|
|
@@ -1,10 +1,6 @@
|
|
|
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 _SpoPageClientSideWebPartAddCommand_instances, _SpoPageClientSideWebPartAddCommand_initTelemetry, _SpoPageClientSideWebPartAddCommand_initOptions, _SpoPageClientSideWebPartAddCommand_initValidators, _SpoPageClientSideWebPartAddCommand_initOptionSets;
|
|
7
1
|
import { v4 } from 'uuid';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { globalOptionsZod } from '../../../../Command.js';
|
|
8
4
|
import request from '../../../../request.js';
|
|
9
5
|
import { formatting } from '../../../../utils/formatting.js';
|
|
10
6
|
import { validation } from '../../../../utils/validation.js';
|
|
@@ -12,6 +8,55 @@ import SpoCommand from '../../../base/SpoCommand.js';
|
|
|
12
8
|
import commands from '../../commands.js';
|
|
13
9
|
import { StandardWebPartUtils } from '../../StandardWebPartTypes.js';
|
|
14
10
|
import { Page } from './Page.js';
|
|
11
|
+
export const options = z.strictObject({
|
|
12
|
+
...globalOptionsZod.shape,
|
|
13
|
+
pageName: z.string().alias('n'),
|
|
14
|
+
webUrl: z.string()
|
|
15
|
+
.refine(url => validation.isValidSharePointUrl(url) === true, {
|
|
16
|
+
error: e => `'${e.input}' is not a valid SharePoint Online site URL.`
|
|
17
|
+
})
|
|
18
|
+
.alias('u'),
|
|
19
|
+
standardWebPart: z.string()
|
|
20
|
+
.refine(webPart => StandardWebPartUtils.isValidStandardWebPartType(webPart), {
|
|
21
|
+
error: e => `${e.input} is not a valid standard web part type`
|
|
22
|
+
})
|
|
23
|
+
.optional(),
|
|
24
|
+
webPartData: z.string()
|
|
25
|
+
.refine(data => {
|
|
26
|
+
try {
|
|
27
|
+
JSON.parse(data);
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
}, {
|
|
34
|
+
error: 'Specified webPartData is not a valid JSON string.'
|
|
35
|
+
})
|
|
36
|
+
.optional(),
|
|
37
|
+
webPartId: z.string()
|
|
38
|
+
.refine(id => validation.isValidGuid(id), {
|
|
39
|
+
error: e => `The webPartId '${e.input}' is not a valid GUID`
|
|
40
|
+
})
|
|
41
|
+
.optional(),
|
|
42
|
+
webPartProperties: z.string()
|
|
43
|
+
.refine(properties => {
|
|
44
|
+
try {
|
|
45
|
+
JSON.parse(properties);
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
}, {
|
|
52
|
+
error: 'Specified webPartProperties is not a valid JSON string.'
|
|
53
|
+
})
|
|
54
|
+
.optional(),
|
|
55
|
+
section: z.number().int().min(1, { error: 'The value of parameter section must be 1 or higher' }).optional(),
|
|
56
|
+
column: z.number().int().min(1, { error: 'The value of parameter column must be 1 or higher' }).optional(),
|
|
57
|
+
order: z.number().optional(),
|
|
58
|
+
verticalSection: z.boolean().optional()
|
|
59
|
+
});
|
|
15
60
|
class SpoPageClientSideWebPartAddCommand extends SpoCommand {
|
|
16
61
|
get name() {
|
|
17
62
|
return commands.PAGE_CLIENTSIDEWEBPART_ADD;
|
|
@@ -19,13 +64,27 @@ class SpoPageClientSideWebPartAddCommand extends SpoCommand {
|
|
|
19
64
|
get description() {
|
|
20
65
|
return 'Adds a client-side web part to a modern page';
|
|
21
66
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
67
|
+
get schema() {
|
|
68
|
+
return options;
|
|
69
|
+
}
|
|
70
|
+
getRefinedSchema(schema) {
|
|
71
|
+
return schema
|
|
72
|
+
.refine(opts => [opts.standardWebPart, opts.webPartId].filter(o => o !== undefined).length === 1, {
|
|
73
|
+
error: 'Specify one of the following options: standardWebPart, webPartId.',
|
|
74
|
+
params: {
|
|
75
|
+
customCode: 'optionSet',
|
|
76
|
+
options: ['standardWebPart', 'webPartId']
|
|
77
|
+
}
|
|
78
|
+
})
|
|
79
|
+
.refine(opts => !(opts.webPartProperties && opts.webPartData), {
|
|
80
|
+
error: 'Specify webPartProperties or webPartData but not both'
|
|
81
|
+
})
|
|
82
|
+
.refine(opts => !(opts.section && opts.verticalSection), {
|
|
83
|
+
error: 'Specify section or verticalSection but not both'
|
|
84
|
+
})
|
|
85
|
+
.refine(opts => !(opts.column && opts.verticalSection), {
|
|
86
|
+
error: 'Use column in combination with section, not with verticalSection'
|
|
87
|
+
});
|
|
29
88
|
}
|
|
30
89
|
async commandAction(logger, args) {
|
|
31
90
|
let canvasContent;
|
|
@@ -228,13 +287,8 @@ class SpoPageClientSideWebPartAddCommand extends SpoCommand {
|
|
|
228
287
|
await logger.logToStderr(args.options.webPartProperties);
|
|
229
288
|
await logger.logToStderr('');
|
|
230
289
|
}
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
webPart.webPartData.properties = this.extend(webPart.webPartData.properties, properties);
|
|
234
|
-
}
|
|
235
|
-
catch {
|
|
236
|
-
// Do nothing
|
|
237
|
-
}
|
|
290
|
+
const properties = JSON.parse(args.options.webPartProperties) ?? {};
|
|
291
|
+
webPart.webPartData.properties = this.extend(webPart.webPartData.properties, properties);
|
|
238
292
|
}
|
|
239
293
|
if (args.options.webPartData) {
|
|
240
294
|
if (this.debug) {
|
|
@@ -332,86 +386,5 @@ class SpoPageClientSideWebPartAddCommand extends SpoCommand {
|
|
|
332
386
|
}, target);
|
|
333
387
|
}
|
|
334
388
|
}
|
|
335
|
-
_SpoPageClientSideWebPartAddCommand_instances = new WeakSet(), _SpoPageClientSideWebPartAddCommand_initTelemetry = function _SpoPageClientSideWebPartAddCommand_initTelemetry() {
|
|
336
|
-
this.telemetry.push((args) => {
|
|
337
|
-
Object.assign(this.telemetryProperties, {
|
|
338
|
-
standardWebPart: args.options.standardWebPart,
|
|
339
|
-
webPartData: typeof args.options.webPartData !== 'undefined',
|
|
340
|
-
webPartId: typeof args.options.webPartId !== 'undefined',
|
|
341
|
-
webPartProperties: typeof args.options.webPartProperties !== 'undefined',
|
|
342
|
-
section: typeof args.options.section !== 'undefined',
|
|
343
|
-
column: typeof args.options.column !== 'undefined',
|
|
344
|
-
order: typeof args.options.order !== 'undefined',
|
|
345
|
-
verticalSection: !!args.options.verticalSection
|
|
346
|
-
});
|
|
347
|
-
});
|
|
348
|
-
}, _SpoPageClientSideWebPartAddCommand_initOptions = function _SpoPageClientSideWebPartAddCommand_initOptions() {
|
|
349
|
-
this.options.unshift({
|
|
350
|
-
option: '-u, --webUrl <webUrl>'
|
|
351
|
-
}, {
|
|
352
|
-
option: '-n, --pageName <pageName>'
|
|
353
|
-
}, {
|
|
354
|
-
option: '--standardWebPart [standardWebPart]'
|
|
355
|
-
}, {
|
|
356
|
-
option: '--webPartId [webPartId]'
|
|
357
|
-
}, {
|
|
358
|
-
option: '--webPartProperties [webPartProperties]'
|
|
359
|
-
}, {
|
|
360
|
-
option: '--webPartData [webPartData]'
|
|
361
|
-
}, {
|
|
362
|
-
option: '--section [section]'
|
|
363
|
-
}, {
|
|
364
|
-
option: '--column [column]'
|
|
365
|
-
}, {
|
|
366
|
-
option: '--order [order]'
|
|
367
|
-
}, {
|
|
368
|
-
option: '--verticalSection'
|
|
369
|
-
});
|
|
370
|
-
}, _SpoPageClientSideWebPartAddCommand_initValidators = function _SpoPageClientSideWebPartAddCommand_initValidators() {
|
|
371
|
-
this.validators.push(async (args) => {
|
|
372
|
-
if (args.options.webPartId && !validation.isValidGuid(args.options.webPartId)) {
|
|
373
|
-
return `The webPartId '${args.options.webPartId}' is not a valid GUID`;
|
|
374
|
-
}
|
|
375
|
-
if (args.options.standardWebPart && !StandardWebPartUtils.isValidStandardWebPartType(args.options.standardWebPart)) {
|
|
376
|
-
return `${args.options.standardWebPart} is not a valid standard web part type`;
|
|
377
|
-
}
|
|
378
|
-
if (args.options.webPartProperties && args.options.webPartData) {
|
|
379
|
-
return 'Specify webPartProperties or webPartData but not both';
|
|
380
|
-
}
|
|
381
|
-
if (args.options.webPartProperties) {
|
|
382
|
-
try {
|
|
383
|
-
JSON.parse(args.options.webPartProperties);
|
|
384
|
-
}
|
|
385
|
-
catch (e) {
|
|
386
|
-
return `Specified webPartProperties is not a valid JSON string. Input: ${args.options
|
|
387
|
-
.webPartProperties}. Error: ${e}`;
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
if (args.options.webPartData) {
|
|
391
|
-
try {
|
|
392
|
-
JSON.parse(args.options.webPartData);
|
|
393
|
-
}
|
|
394
|
-
catch (e) {
|
|
395
|
-
return `Specified webPartData is not a valid JSON string. Input: ${args.options
|
|
396
|
-
.webPartData}. Error: ${e}`;
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
if (args.options.section && (!Number.isInteger(args.options.section) || args.options.section < 1)) {
|
|
400
|
-
return 'The value of parameter section must be 1 or higher';
|
|
401
|
-
}
|
|
402
|
-
if (args.options.column && (!Number.isInteger(args.options.column) || args.options.column < 1)) {
|
|
403
|
-
return 'The value of parameter column must be 1 or higher';
|
|
404
|
-
}
|
|
405
|
-
if (args.options.section && args.options.verticalSection) {
|
|
406
|
-
return 'Specify section or verticalSection but not both';
|
|
407
|
-
}
|
|
408
|
-
if (args.options.column && args.options.verticalSection) {
|
|
409
|
-
return 'Use column in combination with section, not with verticalSection';
|
|
410
|
-
}
|
|
411
|
-
return validation.isValidSharePointUrl(args.options.webUrl);
|
|
412
|
-
});
|
|
413
|
-
}, _SpoPageClientSideWebPartAddCommand_initOptionSets = function _SpoPageClientSideWebPartAddCommand_initOptionSets() {
|
|
414
|
-
this.optionSets.push({ options: ['standardWebPart', 'webPartId'] });
|
|
415
|
-
};
|
|
416
389
|
export default new SpoPageClientSideWebPartAddCommand();
|
|
417
390
|
//# sourceMappingURL=page-clientsidewebpart-add.js.map
|