@pnp/cli-microsoft365 11.4.0-beta.87732f5 → 11.4.0-beta.f54089d

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 (131) hide show
  1. package/.devproxy/api-specs/sharepoint.yaml +43 -0
  2. package/README.md +1 -1
  3. package/allCommands.json +1 -1
  4. package/allCommandsFull.json +1 -1
  5. package/dist/Auth.js +1 -1
  6. package/dist/AuthServer.js +2 -4
  7. package/dist/Command.js +2 -2
  8. package/dist/cli/cli.js +9 -9
  9. package/dist/m365/adaptivecard/commands/adaptivecard-send.js +10 -11
  10. package/dist/m365/app/commands/app-open.js +3 -4
  11. package/dist/m365/app/commands/permission/permission-add.js +4 -5
  12. package/dist/m365/base/AppCommand.js +3 -3
  13. package/dist/m365/booking/commands/business/business-get.js +6 -8
  14. package/dist/m365/booking/commands/business/business-list.js +2 -1
  15. package/dist/m365/cli/commands/app/app-add.js +5 -7
  16. package/dist/m365/commands/docs.js +1 -1
  17. package/dist/m365/commands/login.js +22 -19
  18. package/dist/m365/commands/logout.js +1 -1
  19. package/dist/m365/commands/status.js +2 -1
  20. package/dist/m365/connection/commands/connection-list.js +2 -1
  21. package/dist/m365/connection/commands/connection-set.js +15 -29
  22. package/dist/m365/context/commands/context-remove.js +4 -6
  23. package/dist/m365/context/commands/option/option-remove.js +5 -7
  24. package/dist/m365/entra/commands/administrativeunit/administrativeunit-add.js +5 -7
  25. package/dist/m365/entra/commands/administrativeunit/administrativeunit-get.js +7 -9
  26. package/dist/m365/entra/commands/administrativeunit/administrativeunit-list.js +4 -5
  27. package/dist/m365/entra/commands/administrativeunit/administrativeunit-remove.js +8 -10
  28. package/dist/m365/entra/commands/license/license-list.js +1 -1
  29. package/dist/m365/entra/commands/m365group/m365group-remove.js +1 -1
  30. package/dist/m365/entra/commands/multitenant/multitenant-add.js +3 -4
  31. package/dist/m365/entra/commands/organization/organization-list.js +4 -6
  32. package/dist/m365/entra/commands/organization/organization-set.js +24 -26
  33. package/dist/m365/entra/commands/roleassignment/roleassignment-add.js +21 -34
  34. package/dist/m365/entra/commands/roledefinition/roledefinition-add.js +8 -10
  35. package/dist/m365/entra/commands/roledefinition/roledefinition-get.js +11 -13
  36. package/dist/m365/entra/commands/roledefinition/roledefinition-list.js +5 -7
  37. package/dist/m365/entra/commands/roledefinition/roledefinition-remove.js +11 -13
  38. package/dist/m365/entra/commands/roledefinition/roledefinition-set.js +15 -17
  39. package/dist/m365/entra/commands/rolepermission/rolepermission-list.js +5 -7
  40. package/dist/m365/entra/commands/user/user-session-revoke.js +9 -13
  41. package/dist/m365/exo/commands/approleassignment/approleassignment-add.js +29 -31
  42. package/dist/m365/flow/commands/environment/environment-get.js +5 -7
  43. package/dist/m365/flow/commands/environment/environment-list.js +2 -1
  44. package/dist/m365/flow/commands/recyclebinitem/recyclebinitem-list.js +4 -6
  45. package/dist/m365/flow/commands/recyclebinitem/recyclebinitem-restore.js +5 -11
  46. package/dist/m365/graph/commands/directoryextension/directoryextension-add.js +11 -13
  47. package/dist/m365/graph/commands/directoryextension/directoryextension-get.js +10 -19
  48. package/dist/m365/graph/commands/directoryextension/directoryextension-list.js +6 -12
  49. package/dist/m365/graph/commands/directoryextension/directoryextension-remove.js +11 -20
  50. package/dist/m365/graph/commands/openextension/openextension-add.js +12 -13
  51. package/dist/m365/graph/commands/openextension/openextension-get.js +12 -14
  52. package/dist/m365/graph/commands/openextension/openextension-list.js +11 -13
  53. package/dist/m365/graph/commands/openextension/openextension-remove.js +13 -15
  54. package/dist/m365/graph/commands/openextension/openextension-set.js +16 -17
  55. package/dist/m365/onedrive/commands/onedrive-list.js +2 -1
  56. package/dist/m365/outlook/commands/mail/mail-searchfolder-add.js +9 -14
  57. package/dist/m365/outlook/commands/mailbox/mailbox-settings-get.js +8 -12
  58. package/dist/m365/outlook/commands/mailbox/mailbox-settings-set.js +15 -15
  59. package/dist/m365/outlook/commands/roomlist/roomlist-list.js +2 -1
  60. package/dist/m365/pa/commands/environment/environment-get.js +5 -7
  61. package/dist/m365/pa/commands/environment/environment-list.js +2 -1
  62. package/dist/m365/planner/commands/tenant/tenant-settings-list.js +1 -1
  63. package/dist/m365/pp/commands/environment/environment-get.js +5 -7
  64. package/dist/m365/pp/commands/environment/environment-list.js +3 -4
  65. package/dist/m365/pp/commands/gateway/gateway-list.js +1 -1
  66. package/dist/m365/pp/commands/tenant/tenant-settings-list.js +1 -1
  67. package/dist/m365/pp/commands/website/website-get.js +12 -12
  68. package/dist/m365/purview/commands/retentionevent/retentionevent-list.js +2 -1
  69. package/dist/m365/purview/commands/retentioneventtype/retentioneventtype-list.js +1 -1
  70. package/dist/m365/purview/commands/retentionlabel/retentionlabel-list.js +1 -1
  71. package/dist/m365/spe/commands/container/container-add.js +10 -15
  72. package/dist/m365/spe/commands/container/container-permission-list.js +4 -6
  73. package/dist/m365/spe/commands/container/container-recyclebinitem-list.js +5 -10
  74. package/dist/m365/spe/commands/container/container-recyclebinitem-restore.js +7 -12
  75. package/dist/m365/spe/commands/container/container-remove.js +10 -16
  76. package/dist/m365/spe/commands/containertype/containertype-add.js +15 -20
  77. package/dist/m365/spe/commands/containertype/containertype-get.js +6 -13
  78. package/dist/m365/spe/commands/containertype/containertype-remove.js +7 -14
  79. package/dist/m365/spfx/commands/project/project-upgrade/rules/DependencyRule.js +56 -14
  80. package/dist/m365/spfx/commands/project/project-upgrade.js +4 -6
  81. package/dist/m365/spo/commands/file/file-add.js +49 -11
  82. package/dist/m365/spo/commands/file/file-version-keep.js +10 -14
  83. package/dist/m365/spo/commands/homesite/homesite-add.js +13 -15
  84. package/dist/m365/spo/commands/homesite/homesite-get.js +8 -9
  85. package/dist/m365/spo/commands/homesite/homesite-remove.js +9 -10
  86. package/dist/m365/spo/commands/homesite/homesite-set.js +13 -14
  87. package/dist/m365/spo/commands/list/DefaultColumnValue.js +2 -0
  88. package/dist/m365/spo/commands/list/list-defaultvalue-clear.js +13 -17
  89. package/dist/m365/spo/commands/list/list-defaultvalue-get.js +124 -0
  90. package/dist/m365/spo/commands/list/list-defaultvalue-list.js +13 -37
  91. package/dist/m365/spo/commands/list/list-defaultvalue-remove.js +12 -16
  92. package/dist/m365/spo/commands/list/list-defaultvalue-set.js +11 -15
  93. package/dist/m365/spo/commands/list/list-view-add.js +16 -20
  94. package/dist/m365/spo/commands/listitem/listitem-set.js +1 -1
  95. package/dist/m365/spo/commands/page/page-control-remove.js +11 -15
  96. package/dist/m365/spo/commands/page/page-get.js +10 -11
  97. package/dist/m365/spo/commands/page/page-header-set.js +97 -89
  98. package/dist/m365/spo/commands/page/page-publish.js +9 -10
  99. package/dist/m365/spo/commands/page/page-section-remove.js +11 -12
  100. package/dist/m365/spo/commands/page/page-set.js +26 -26
  101. package/dist/m365/spo/commands/site/site-appcatalog-list.js +4 -6
  102. package/dist/m365/spo/commands/site/site-get.js +6 -8
  103. package/dist/m365/spo/commands/site/site-sharingpermission-set.js +7 -9
  104. package/dist/m365/spo/commands/site/site-versionpolicy-get.js +11 -13
  105. package/dist/m365/spo/commands/web/web-alert-list.js +20 -27
  106. package/dist/m365/spo/commands/web/web-alert-remove.js +15 -20
  107. package/dist/m365/spo/commands.js +1 -0
  108. package/dist/m365/spp/commands/model/model-apply.js +18 -24
  109. package/dist/m365/teams/commands/callrecord/callrecord-list.js +5 -9
  110. package/dist/m365/teams/commands/chat/chat-message-list.js +26 -27
  111. package/dist/m365/teams/commands/chat/chat-message-send.js +12 -3
  112. package/dist/m365/teams/commands/chat/chatUtil.js +1 -1
  113. package/dist/m365/tenant/commands/people/people-pronouns-set.js +4 -6
  114. package/dist/m365/tenant/commands/report/report-settings-set.js +4 -6
  115. package/dist/m365/viva/commands/engage/engage-community-user-add.js +17 -22
  116. package/dist/m365/viva/commands/engage/engage-community-user-list.js +8 -14
  117. package/dist/m365/viva/commands/engage/engage-community-user-remove.js +14 -22
  118. package/dist/m365/viva/commands/engage/engage-role-member-list.js +6 -11
  119. package/dist/utils/spo.js +30 -2
  120. package/dist/utils/zod.js +41 -76
  121. package/docs/docs/cmd/entra/app/app-permission-add.mdx +19 -0
  122. package/docs/docs/cmd/entra/app/app-permission-list.mdx +19 -0
  123. package/docs/docs/cmd/entra/app/app-permission-remove.mdx +21 -0
  124. package/docs/docs/cmd/spo/file/file-add.mdx +140 -1
  125. package/docs/docs/cmd/spo/list/list-defaultvalue-get.mdx +118 -0
  126. package/docs/docs/cmd/spo/page/page-header-set.mdx +28 -8
  127. package/docs/docs/cmd/spo/page/page-set.mdx +35 -5
  128. package/docs/docs/cmd/teams/chat/chat-message-list.mdx +34 -7
  129. package/docs/docs/cmd/teams/chat/chat-message-send.mdx +23 -1
  130. package/npm-shrinkwrap.json +274 -248
  131. package/package.json +12 -11
@@ -1,8 +1,15 @@
1
- import { lt, valid, validRange } from 'semver';
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 _DependencyRule_instances, _DependencyRule_needsUpdate, _DependencyRule_getMaxVersion;
7
+ import semver from 'semver';
2
8
  import { JsonRule } from '../../JsonRule.js';
3
9
  export class DependencyRule extends JsonRule {
4
10
  constructor(packageName, packageVersion, isDevDep = false, isOptional = false, add = true) {
5
11
  super();
12
+ _DependencyRule_instances.add(this);
6
13
  this.packageName = packageName;
7
14
  this.packageVersion = packageVersion;
8
15
  this.isDevDep = isDevDep;
@@ -39,23 +46,13 @@ export class DependencyRule extends JsonRule {
39
46
  }
40
47
  const projectDependencies = this.isDevDep ? project.packageJson.devDependencies : project.packageJson.dependencies;
41
48
  const versionEntry = projectDependencies ? projectDependencies[this.packageName] : '';
42
- const packageVersion = valid(versionEntry);
43
- const versionRange = validRange(versionEntry);
44
49
  if (this.add) {
45
50
  let jsonProperty = this.isDevDep ? 'devDependencies' : 'dependencies';
46
51
  if (versionEntry) {
47
52
  jsonProperty += `.${this.packageName}`;
48
- if (packageVersion) {
49
- if (lt(packageVersion, this.packageVersion)) {
50
- const node = this.getAstNodeFromFile(project.packageJson, jsonProperty);
51
- this.addFindingWithPosition(findings, node);
52
- }
53
- }
54
- else {
55
- if (versionRange) {
56
- const node = this.getAstNodeFromFile(project.packageJson, jsonProperty);
57
- this.addFindingWithPosition(findings, node);
58
- }
53
+ if (__classPrivateFieldGet(this, _DependencyRule_instances, "m", _DependencyRule_needsUpdate).call(this, this.packageVersion, versionEntry)) {
54
+ const node = this.getAstNodeFromFile(project.packageJson, jsonProperty);
55
+ this.addFindingWithPosition(findings, node);
59
56
  }
60
57
  }
61
58
  else {
@@ -78,4 +75,49 @@ export class DependencyRule extends JsonRule {
78
75
  }
79
76
  }
80
77
  }
78
+ _DependencyRule_instances = new WeakSet(), _DependencyRule_needsUpdate = function _DependencyRule_needsUpdate(ruleVersion, currentVersion) {
79
+ try {
80
+ // Get minimum versions for both
81
+ const ruleMin = semver.minVersion(ruleVersion);
82
+ const currentMin = semver.minVersion(currentVersion);
83
+ // Check if ranges overlap
84
+ const rangesOverlap = semver.intersects(ruleVersion, currentVersion);
85
+ if (rangesOverlap) {
86
+ // Even if they overlap, update if rule requires a higher minimum version
87
+ if (ruleMin && currentMin && semver.gt(ruleMin, currentMin)) {
88
+ return true;
89
+ }
90
+ return false;
91
+ }
92
+ // Ranges don't overlap - check if rule range is greater
93
+ // Get the maximum version that satisfies the current range
94
+ const currentMax = __classPrivateFieldGet(this, _DependencyRule_instances, "m", _DependencyRule_getMaxVersion).call(this, currentVersion);
95
+ // If rule's minimum is greater than current's maximum, update is needed
96
+ return !!(ruleMin && currentMax && semver.gt(ruleMin, currentMax));
97
+ }
98
+ catch {
99
+ return false;
100
+ }
101
+ }, _DependencyRule_getMaxVersion = function _DependencyRule_getMaxVersion(range) {
102
+ const rangeObj = new semver.Range(range);
103
+ // If it's a specific version (no range operators), return it
104
+ if (semver.valid(range)) {
105
+ return semver.parse(range);
106
+ }
107
+ // For ranges, get the highest version from the set
108
+ // Check the range set to find upper bounds
109
+ let maxVer = null;
110
+ for (const comparatorSet of rangeObj.set) {
111
+ for (const comparator of comparatorSet) {
112
+ if (comparator.operator === '<' || comparator.operator === '<=') {
113
+ const ver = comparator.semver;
114
+ if (!maxVer || semver.gt(ver, maxVer)) {
115
+ maxVer = ver;
116
+ }
117
+ }
118
+ }
119
+ }
120
+ // If no upper bound found, use minVersion as fallback
121
+ return maxVer || semver.minVersion(range);
122
+ };
81
123
  //# sourceMappingURL=DependencyRule.js.map
@@ -7,19 +7,17 @@ import { z } from 'zod';
7
7
  import { CommandError, globalOptionsZod } from '../../../../Command.js';
8
8
  import { fsUtil } from '../../../../utils/fsUtil.js';
9
9
  import { packageManager } from '../../../../utils/packageManager.js';
10
- import { zod } from '../../../../utils/zod.js';
11
10
  import commands from '../../commands.js';
12
11
  import { BaseProjectCommand } from './base-project-command.js';
13
12
  import { FN017001_MISC_npm_dedupe } from './project-upgrade/rules/FN017001_MISC_npm_dedupe.js';
14
- const options = globalOptionsZod
15
- .extend({
13
+ export const options = z.strictObject({
14
+ ...globalOptionsZod.shape,
16
15
  packageManager: z.enum(['npm', 'pnpm', 'yarn']).default('npm'),
17
16
  preview: z.boolean().optional(),
18
- toVersion: zod.alias('v', z.string().optional()),
17
+ toVersion: z.string().optional().alias('v'),
19
18
  shell: z.enum(['bash', 'powershell', 'cmd']).default('powershell'),
20
19
  output: z.enum(['json', 'text', 'md', 'tour', 'csv', 'none']).optional()
21
- })
22
- .strict();
20
+ });
23
21
  class SpfxProjectUpgradeCommand extends BaseProjectCommand {
24
22
  get name() {
25
23
  return commands.PROJECT_UPGRADE;
@@ -39,14 +39,38 @@ class SpoFileAddCommand extends SpoCommand {
39
39
  async commandAction(logger, args) {
40
40
  const folderPath = urlUtil.getServerRelativePath(args.options.webUrl, args.options.folder);
41
41
  const fullPath = path.resolve(args.options.path);
42
- const fileName = fsUtil.getSafeFileName(path.basename(fullPath));
42
+ const fileName = fsUtil.getSafeFileName(args.options.fileName ?? path.basename(fullPath));
43
43
  let isCheckedOut = false;
44
44
  let listSettings;
45
45
  if (this.verbose) {
46
46
  await logger.logToStderr(`file name: ${fileName}...`);
47
47
  await logger.logToStderr(`folder path: ${folderPath}...`);
48
48
  }
49
+ if (args.options.overwrite === undefined) {
50
+ await this.warn(logger, 'In the next major version, the --overwrite option will default to false. To avoid this warning, please set the --overwrite option explicitly to true or false.');
51
+ }
49
52
  try {
53
+ if (args.options.overwrite === false) {
54
+ try {
55
+ const requestOptions = {
56
+ url: `${args.options.webUrl}/_api/Web/GetFileByServerRelativePath(DecodedUrl='${formatting.encodeQueryParameter(folderPath + '/' + fileName)}')?$select=Exists`,
57
+ headers: {
58
+ accept: 'application/json;odata=nometadata'
59
+ },
60
+ responseType: 'json'
61
+ };
62
+ await request.get(requestOptions);
63
+ throw `File '${fileName}' already exists in folder '${folderPath}'. To overwrite the file, use the --overwrite option.`;
64
+ }
65
+ catch (err) {
66
+ if (typeof err === 'string') {
67
+ throw err;
68
+ }
69
+ if (this.verbose) {
70
+ await logger.logToStderr(`File '${fileName}' does not exist in folder '${folderPath}'. Proceeding with upload.`);
71
+ }
72
+ }
73
+ }
50
74
  try {
51
75
  if (this.verbose) {
52
76
  await logger.logToStderr('Check if the specified folder exists.');
@@ -78,6 +102,7 @@ class SpoFileAddCommand extends SpoCommand {
78
102
  if (this.verbose) {
79
103
  await logger.logToStderr(`File size is ${fileSize} bytes`);
80
104
  }
105
+ let fileUploadResult;
81
106
  // only up to 250 MB are allowed in a single request
82
107
  if (fileSize > this.fileChunkingThreshold) {
83
108
  const fileChunkCount = Math.ceil(fileSize / this.fileChunkSize);
@@ -106,7 +131,7 @@ class SpoFileAddCommand extends SpoCommand {
106
131
  Size: fileSize
107
132
  };
108
133
  try {
109
- await this.uploadFileChunks(fileUploadInfo, logger);
134
+ fileUploadResult = await this.uploadFileChunks(fileUploadInfo, logger);
110
135
  if (this.verbose) {
111
136
  await logger.logToStderr(`Finished uploading ${fileUploadInfo.Position} bytes in ${fileChunkCount} chunks`);
112
137
  }
@@ -127,7 +152,7 @@ class SpoFileAddCommand extends SpoCommand {
127
152
  throw err;
128
153
  }
129
154
  catch (err) {
130
- if (this.debug) {
155
+ if (this.verbose) {
131
156
  await logger.logToStderr(`Failed to cancel upload session: ${err}`);
132
157
  }
133
158
  throw err;
@@ -145,9 +170,10 @@ class SpoFileAddCommand extends SpoCommand {
145
170
  accept: 'application/json;odata=nometadata',
146
171
  'content-length': bodyLength
147
172
  },
148
- maxBodyLength: this.fileChunkingThreshold
173
+ maxBodyLength: this.fileChunkingThreshold,
174
+ responseType: 'json'
149
175
  };
150
- await request.post(requestOptions);
176
+ fileUploadResult = await request.post(requestOptions);
151
177
  }
152
178
  if (args.options.contentType || args.options.publish || args.options.approve) {
153
179
  listSettings = await this.getFileParentList(fileName, args.options.webUrl, folderPath, logger);
@@ -206,6 +232,7 @@ class SpoFileAddCommand extends SpoCommand {
206
232
  };
207
233
  await request.post(requestOptions);
208
234
  }
235
+ await logger.log(fileUploadResult);
209
236
  }
210
237
  catch (err) {
211
238
  if (isCheckedOut) {
@@ -292,15 +319,16 @@ class SpoFileAddCommand extends SpoCommand {
292
319
  accept: 'application/json;odata=nometadata',
293
320
  'content-length': readCount
294
321
  },
295
- maxBodyLength: this.fileChunkingThreshold
322
+ maxBodyLength: this.fileChunkingThreshold,
323
+ responseType: 'json'
296
324
  };
297
325
  try {
298
- await request.post(requestOptions);
326
+ const uploadResponse = await request.post(requestOptions);
299
327
  if (this.verbose) {
300
328
  await logger.logToStderr(`Uploaded ${info.Position} of ${info.Size} bytes (${Math.round(100 * info.Position / info.Size)}%)`);
301
329
  }
302
330
  if (isLastChunk) {
303
- return;
331
+ return uploadResponse;
304
332
  }
305
333
  else {
306
334
  return this.uploadFileChunks(info, logger);
@@ -407,9 +435,12 @@ class SpoFileAddCommand extends SpoCommand {
407
435
  'approveComment',
408
436
  'publish',
409
437
  'publishComment',
438
+ 'overwrite',
439
+ 'fileName',
410
440
  'debug',
411
441
  'verbose',
412
442
  'output',
443
+ 'query',
413
444
  '_',
414
445
  'u',
415
446
  'p',
@@ -434,7 +465,9 @@ _SpoFileAddCommand_instances = new WeakSet(), _SpoFileAddCommand_initTelemetry =
434
465
  approve: !!args.options.approve,
435
466
  approveComment: typeof args.options.approveComment !== 'undefined',
436
467
  publish: !!args.options.publish,
437
- publishComment: typeof args.options.publishComment !== 'undefined'
468
+ publishComment: typeof args.options.publishComment !== 'undefined',
469
+ overwrite: !!args.options.overwrite,
470
+ fileName: typeof args.options.fileName !== 'undefined'
438
471
  });
439
472
  });
440
473
  }, _SpoFileAddCommand_initOptions = function _SpoFileAddCommand_initOptions() {
@@ -458,6 +491,11 @@ _SpoFileAddCommand_instances = new WeakSet(), _SpoFileAddCommand_initTelemetry =
458
491
  option: '--publish'
459
492
  }, {
460
493
  option: '--publishComment [publishComment]'
494
+ }, {
495
+ option: '--overwrite [overwrite]',
496
+ autocomplete: ['true', 'false']
497
+ }, {
498
+ option: '--fileName [fileName]'
461
499
  });
462
500
  }, _SpoFileAddCommand_initValidators = function _SpoFileAddCommand_initValidators() {
463
501
  this.validators.push(async (args) => {
@@ -477,8 +515,8 @@ _SpoFileAddCommand_instances = new WeakSet(), _SpoFileAddCommand_initTelemetry =
477
515
  return true;
478
516
  });
479
517
  }, _SpoFileAddCommand_initTypes = function _SpoFileAddCommand_initTypes() {
480
- this.types.string.push('webUrl', 'folder', 'path', 'contentType', 'checkInComment', 'approveComment', 'publishComment');
481
- this.types.boolean.push('checkOut', 'approve', 'publish');
518
+ this.types.string.push('webUrl', 'folder', 'path', 'contentType', 'checkInComment', 'approveComment', 'publishComment', 'fileName');
519
+ this.types.boolean.push('checkOut', 'approve', 'publish', 'overwrite');
482
520
  };
483
521
  export default new SpoFileAddCommand();
484
522
  //# sourceMappingURL=file-add.js.map
@@ -2,26 +2,22 @@ import commands from '../../commands.js';
2
2
  import SpoCommand from '../../../base/SpoCommand.js';
3
3
  import { globalOptionsZod } from '../../../../Command.js';
4
4
  import { z } from 'zod';
5
- import { zod } from '../../../../utils/zod.js';
6
5
  import { validation } from '../../../../utils/validation.js';
7
6
  import { urlUtil } from '../../../../utils/urlUtil.js';
8
7
  import request from '../../../../request.js';
9
8
  import { formatting } from '../../../../utils/formatting.js';
10
9
  import { odata } from '../../../../utils/odata.js';
11
- export const options = globalOptionsZod
12
- .extend({
13
- webUrl: zod.alias('u', z.string()
14
- .refine(url => validation.isValidSharePointUrl(url) === true, url => ({
15
- message: `'${url}' is not a valid SharePoint Online site URL.`
16
- }))),
10
+ export const options = z.strictObject({
11
+ ...globalOptionsZod.shape,
12
+ webUrl: z.string()
13
+ .refine(url => validation.isValidSharePointUrl(url) === true, {
14
+ error: e => `'${e.input}' is not a valid SharePoint Online site URL.`
15
+ })
16
+ .alias('u'),
17
17
  fileUrl: z.string().optional(),
18
- fileId: zod.alias('i', z.string()
19
- .refine(id => validation.isValidGuid(id), id => ({
20
- message: `'${id}' is not a valid GUID.`
21
- })).optional()),
18
+ fileId: z.uuid().optional().alias('i'),
22
19
  label: z.string()
23
- })
24
- .strict();
20
+ });
25
21
  class SpoFileVersionKeepCommand extends SpoCommand {
26
22
  get name() {
27
23
  return commands.FILE_VERSION_KEEP;
@@ -35,7 +31,7 @@ class SpoFileVersionKeepCommand extends SpoCommand {
35
31
  getRefinedSchema(schema) {
36
32
  return schema
37
33
  .refine(options => [options.fileUrl, options.fileId].filter(o => o !== undefined).length === 1, {
38
- message: `Specify 'fileUrl' or 'fileId', but not both.`
34
+ error: `Specify 'fileUrl' or 'fileId', but not both.`
39
35
  });
40
36
  }
41
37
  async commandAction(logger, args) {
@@ -1,5 +1,4 @@
1
1
  import { z } from 'zod';
2
- import { zod } from '../../../../utils/zod.js';
3
2
  import { globalOptionsZod } from '../../../../Command.js';
4
3
  import { spo } from '../../../../utils/spo.js';
5
4
  import { validation } from '../../../../utils/validation.js';
@@ -7,25 +6,24 @@ import SpoCommand from '../../../base/SpoCommand.js';
7
6
  import commands from '../../commands.js';
8
7
  import request from '../../../../request.js';
9
8
  import { entraGroup } from '../../../../utils/entraGroup.js';
10
- const options = globalOptionsZod
11
- .extend({
12
- url: zod.alias('u', z.string()
13
- .refine((url) => validation.isValidSharePointUrl(url) === true, url => ({
14
- message: `'${url}' is not a valid SharePoint Online site URL.`
15
- }))),
9
+ export const options = z.strictObject({
10
+ ...globalOptionsZod.shape,
11
+ url: z.string()
12
+ .refine(url => validation.isValidSharePointUrl(url) === true, {
13
+ error: e => `'${e.input}' is not a valid SharePoint Online site URL.`
14
+ }).alias('u'),
16
15
  audienceIds: z.string()
17
- .refine(audiences => validation.isValidGuidArray(audiences) === true, audiences => ({
18
- message: `The following GUIDs are invalid: ${validation.isValidGuidArray(audiences)}.`
19
- })).optional(),
16
+ .refine(audiences => validation.isValidGuidArray(audiences) === true, {
17
+ error: e => `The following GUIDs are invalid: ${e.input}.`
18
+ }).optional(),
20
19
  audienceNames: z.string().optional(),
21
20
  vivaConnectionsDefaultStart: z.boolean().optional(),
22
21
  isInDraftMode: z.boolean().optional(),
23
22
  order: z.number()
24
- .refine(order => validation.isValidPositiveInteger(order) === true, order => ({
25
- message: `'${order}' is not a positive integer.`
26
- })).optional()
27
- })
28
- .strict();
23
+ .refine(order => validation.isValidPositiveInteger(order) === true, {
24
+ error: e => `'${e.input}' is not a positive integer.`
25
+ }).optional()
26
+ });
29
27
  class SpoHomeSiteAddCommand extends SpoCommand {
30
28
  get name() {
31
29
  return commands.HOMESITE_ADD;
@@ -1,5 +1,4 @@
1
1
  import { z } from 'zod';
2
- import { zod } from '../../../../utils/zod.js';
3
2
  import { globalOptionsZod } from '../../../../Command.js';
4
3
  import { validation } from '../../../../utils/validation.js';
5
4
  import { spo } from '../../../../utils/spo.js';
@@ -7,14 +6,14 @@ import SpoCommand from '../../../base/SpoCommand.js';
7
6
  import commands from '../../commands.js';
8
7
  import { odata } from '../../../../utils/odata.js';
9
8
  import { urlUtil } from '../../../../utils/urlUtil.js';
10
- const options = globalOptionsZod
11
- .extend({
12
- url: zod.alias('u', z.string()
13
- .refine(url => validation.isValidSharePointUrl(url) === true, url => ({
14
- message: `'${url}' is not a valid SharePoint Online site URL.`
15
- })))
16
- })
17
- .strict();
9
+ export const options = z.strictObject({
10
+ ...globalOptionsZod.shape,
11
+ url: z.string()
12
+ .refine(url => validation.isValidSharePointUrl(url) === true, {
13
+ error: e => `'${e.input}' is not a valid SharePoint Online site URL.`
14
+ })
15
+ .alias('u')
16
+ });
18
17
  class SpoHomeSiteGetCommand extends SpoCommand {
19
18
  get name() {
20
19
  return commands.HOMESITE_GET;
@@ -1,5 +1,4 @@
1
1
  import { z } from 'zod';
2
- import { zod } from '../../../../utils/zod.js';
3
2
  import { globalOptionsZod } from '../../../../Command.js';
4
3
  import { validation } from '../../../../utils/validation.js';
5
4
  import { cli } from '../../../../cli/cli.js';
@@ -7,15 +6,15 @@ import request from '../../../../request.js';
7
6
  import { spo } from '../../../../utils/spo.js';
8
7
  import SpoCommand from '../../../base/SpoCommand.js';
9
8
  import commands from '../../commands.js';
10
- const options = globalOptionsZod
11
- .extend({
12
- url: zod.alias('u', z.string()
13
- .refine(url => validation.isValidSharePointUrl(url) === true, url => ({
14
- message: `'${url}' is not a valid SharePoint Online site URL.`
15
- }))),
16
- force: zod.alias('f', z.boolean().optional())
17
- })
18
- .strict();
9
+ export const options = z.strictObject({
10
+ ...globalOptionsZod.shape,
11
+ url: z.string()
12
+ .refine(url => validation.isValidSharePointUrl(url) === true, {
13
+ error: e => `'${e.input}' is not a valid SharePoint Online site URL.`
14
+ })
15
+ .alias('u'),
16
+ force: z.boolean().optional().alias('f')
17
+ });
19
18
  class SpoHomeSiteRemoveCommand extends SpoCommand {
20
19
  get name() {
21
20
  return commands.HOMESITE_REMOVE;
@@ -1,5 +1,4 @@
1
1
  import { z } from 'zod';
2
- import { zod } from '../../../../utils/zod.js';
3
2
  import { globalOptionsZod } from '../../../../Command.js';
4
3
  import request from '../../../../request.js';
5
4
  import { spo } from '../../../../utils/spo.js';
@@ -7,24 +6,24 @@ import { validation } from '../../../../utils/validation.js';
7
6
  import SpoCommand from '../../../base/SpoCommand.js';
8
7
  import commands from '../../commands.js';
9
8
  import { entraGroup } from '../../../../utils/entraGroup.js';
10
- const optionsSchema = globalOptionsZod
11
- .extend({
12
- url: zod.alias('u', z.string()
13
- .refine((url) => validation.isValidSharePointUrl(url) === true, url => ({
14
- message: `'${url}' is not a valid SharePoint Online site URL.`
15
- }))),
9
+ export const options = z.strictObject({
10
+ ...globalOptionsZod.shape,
11
+ url: z.string()
12
+ .refine(url => validation.isValidSharePointUrl(url) === true, {
13
+ error: e => `'${e.input}' is not a valid SharePoint Online site URL.`
14
+ }).alias('u'),
16
15
  vivaConnectionsDefaultStart: z.boolean().optional(),
17
16
  draftMode: z.boolean().optional(),
18
17
  audienceIds: z.string()
19
- .refine(audiences => validation.isValidGuidArray(audiences) === true, audiences => ({
20
- message: `The following GUIDs are invalid: ${validation.isValidGuidArray(audiences)}.`
21
- })).optional(),
18
+ .refine(audiences => validation.isValidGuidArray(audiences) === true, {
19
+ error: e => `The following GUIDs are invalid: ${e.input}.`
20
+ }).optional(),
22
21
  audienceNames: z.string().optional(),
23
22
  targetedLicenseType: z.enum(['everyone', 'frontLineWorkers', 'informationWorkers']).optional(),
24
23
  order: z.number()
25
- .refine(order => validation.isValidPositiveInteger(order) === true, order => ({
26
- message: `'${order}' is not a positive integer.`
27
- })).optional()
24
+ .refine(order => validation.isValidPositiveInteger(order) === true, {
25
+ error: e => `'${e.input}' is not a positive integer.`
26
+ }).optional()
28
27
  });
29
28
  class SpoHomeSiteSetCommand extends SpoCommand {
30
29
  get name() {
@@ -34,7 +33,7 @@ class SpoHomeSiteSetCommand extends SpoCommand {
34
33
  return 'Updates an existing SharePoint home site.';
35
34
  }
36
35
  get schema() {
37
- return optionsSchema;
36
+ return options;
38
37
  }
39
38
  getRefinedSchema(schema) {
40
39
  return schema
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=DefaultColumnValue.js.map
@@ -1,7 +1,6 @@
1
1
  import SpoCommand from '../../../base/SpoCommand.js';
2
2
  import { globalOptionsZod } from '../../../../Command.js';
3
3
  import { z } from 'zod';
4
- import { zod } from '../../../../utils/zod.js';
5
4
  import commands from '../../commands.js';
6
5
  import { DOMParser } from '@xmldom/xmldom';
7
6
  import { validation } from '../../../../utils/validation.js';
@@ -9,23 +8,20 @@ import { urlUtil } from '../../../../utils/urlUtil.js';
9
8
  import request from '../../../../request.js';
10
9
  import { formatting } from '../../../../utils/formatting.js';
11
10
  import { cli } from '../../../../cli/cli.js';
12
- const options = globalOptionsZod
13
- .extend({
14
- webUrl: zod.alias('u', z.string()
15
- .refine(url => validation.isValidSharePointUrl(url) === true, url => ({
16
- message: `'${url}' is not a valid SharePoint Online site URL.`
17
- }))),
18
- listId: zod.alias('i', z.string().optional()
19
- .refine(id => id === undefined || validation.isValidGuid(id), id => ({
20
- message: `'${id}' is not a valid GUID.`
21
- }))),
22
- listTitle: zod.alias('t', z.string().optional()),
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
+ listId: z.uuid().optional().alias('i'),
19
+ listTitle: z.string().optional().alias('t'),
23
20
  listUrl: z.string().optional(),
24
21
  fieldName: z.string().optional(),
25
22
  folderUrl: z.string().optional(),
26
- force: zod.alias('f', z.boolean().optional())
27
- })
28
- .strict();
23
+ force: z.boolean().optional().alias('f')
24
+ });
29
25
  class SpoListDefaultValueClearCommand extends SpoCommand {
30
26
  get name() {
31
27
  return commands.LIST_DEFAULTVALUE_CLEAR;
@@ -39,10 +35,10 @@ class SpoListDefaultValueClearCommand extends SpoCommand {
39
35
  getRefinedSchema(schema) {
40
36
  return schema
41
37
  .refine(options => [options.listId, options.listTitle, options.listUrl].filter(o => o !== undefined).length === 1, {
42
- message: 'Use one of the following options: listId, listTitle, listUrl.'
38
+ error: 'Use one of the following options: listId, listTitle, listUrl.'
43
39
  })
44
40
  .refine(options => (options.fieldName !== undefined) !== (options.folderUrl !== undefined) || (options.fieldName === undefined && options.folderUrl === undefined), {
45
- message: `Specify 'fieldName' or 'folderUrl', but not both.`
41
+ error: `Specify 'fieldName' or 'folderUrl', but not both.`
46
42
  });
47
43
  }
48
44
  async commandAction(logger, args) {