@pnp/cli-microsoft365 12.1.0-beta.0c2915d → 12.1.0-beta.dbc076e

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 (53) hide show
  1. package/allCommands.json +1 -1
  2. package/allCommandsFull.json +1 -1
  3. package/dist/m365/spo/commands/file/file-add.js +77 -51
  4. package/dist/m365/spo/commands/file/file-archive.js +1 -1
  5. package/dist/m365/spo/commands/file/file-checkin.js +64 -35
  6. package/dist/m365/spo/commands/file/file-checkout-undo.js +49 -25
  7. package/dist/m365/spo/commands/file/file-checkout.js +47 -24
  8. package/dist/m365/spo/commands/file/file-copy.js +68 -37
  9. package/dist/m365/spo/commands/file/file-get.js +79 -44
  10. package/dist/m365/spo/commands/file/file-list.js +39 -16
  11. package/dist/m365/spo/commands/file/file-move.js +68 -30
  12. package/dist/m365/spo/commands/file/file-remove.js +56 -27
  13. package/dist/m365/spo/commands/file/file-rename.js +36 -15
  14. package/dist/m365/spo/commands/file/file-retentionlabel-ensure.js +51 -26
  15. package/dist/m365/spo/commands/file/file-retentionlabel-remove.js +50 -25
  16. package/dist/m365/spo/commands/file/file-roleassignment-add.js +75 -47
  17. package/dist/m365/spo/commands/file/file-roleassignment-remove.js +70 -39
  18. package/dist/m365/spo/commands/file/file-roleinheritance-break.js +52 -26
  19. package/dist/m365/spo/commands/file/file-roleinheritance-reset.js +49 -25
  20. package/dist/m365/spo/commands/file/file-sharinginfo-get.js +47 -24
  21. package/dist/m365/spo/commands/file/file-sharinglink-add.js +70 -46
  22. package/dist/m365/spo/commands/file/file-sharinglink-clear.js +57 -33
  23. package/dist/m365/spo/commands/file/file-sharinglink-get.js +47 -25
  24. package/dist/m365/spo/commands/file/file-sharinglink-list.js +53 -32
  25. package/dist/m365/spo/commands/file/file-sharinglink-remove.js +51 -26
  26. package/dist/m365/spo/commands/file/file-sharinglink-set.js +55 -29
  27. package/dist/m365/spo/commands/file/file-unarchive.js +1 -1
  28. package/dist/m365/spo/commands/file/file-version-clear.js +45 -25
  29. package/dist/m365/spo/commands/file/file-version-get.js +43 -25
  30. package/dist/m365/spo/commands/file/file-version-keep.js +1 -1
  31. package/dist/m365/spo/commands/file/file-version-list.js +41 -24
  32. package/dist/m365/spo/commands/file/file-version-remove.js +47 -26
  33. package/dist/m365/spo/commands/file/file-version-restore.js +47 -26
  34. package/dist/m365/spo/commands/folder/folder-add.js +48 -19
  35. package/dist/m365/spo/commands/folder/folder-copy.js +62 -36
  36. package/dist/m365/spo/commands/folder/folder-get.js +51 -30
  37. package/dist/m365/spo/commands/folder/folder-list.js +39 -16
  38. package/dist/m365/spo/commands/folder/folder-move.js +62 -36
  39. package/dist/m365/spo/commands/folder/folder-remove.js +36 -15
  40. package/dist/m365/spo/commands/folder/folder-retentionlabel-ensure.js +48 -30
  41. package/dist/m365/spo/commands/folder/folder-retentionlabel-remove.js +50 -30
  42. package/dist/m365/spo/commands/folder/folder-roleassignment-add.js +79 -49
  43. package/dist/m365/spo/commands/folder/folder-roleassignment-remove.js +67 -37
  44. package/dist/m365/spo/commands/folder/folder-roleinheritance-break.js +36 -15
  45. package/dist/m365/spo/commands/folder/folder-roleinheritance-reset.js +33 -14
  46. package/dist/m365/spo/commands/folder/folder-set.js +48 -28
  47. package/dist/m365/spo/commands/folder/folder-sharinglink-add.js +86 -58
  48. package/dist/m365/spo/commands/folder/folder-sharinglink-clear.js +50 -33
  49. package/dist/m365/spo/commands/folder/folder-sharinglink-get.js +42 -33
  50. package/dist/m365/spo/commands/folder/folder-sharinglink-list.js +47 -32
  51. package/dist/m365/spo/commands/folder/folder-sharinglink-remove.js +41 -34
  52. package/dist/m365/spo/commands/folder/folder-sharinglink-set.js +43 -38
  53. package/package.json +1 -1
@@ -1,6 +1,10 @@
1
- import { z } from 'zod';
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 _SpoFileSharingInfoGetCommand_instances, _SpoFileSharingInfoGetCommand_initTelemetry, _SpoFileSharingInfoGetCommand_initOptions, _SpoFileSharingInfoGetCommand_initValidators, _SpoFileSharingInfoGetCommand_initOptionSets, _SpoFileSharingInfoGetCommand_initTypes;
2
7
  import { cli } from '../../../../cli/cli.js';
3
- import { globalOptionsZod } from '../../../../Command.js';
4
8
  import request from '../../../../request.js';
5
9
  import { formatting } from '../../../../utils/formatting.js';
6
10
  import { urlUtil } from '../../../../utils/urlUtil.js';
@@ -8,16 +12,6 @@ import { validation } from '../../../../utils/validation.js';
8
12
  import SpoCommand from '../../../base/SpoCommand.js';
9
13
  import commands from '../../commands.js';
10
14
  import { FileSharingPrincipalType } from './FileSharingPrincipalType.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
- fileId: z.guid().optional().alias('i'),
19
- fileUrl: z.string().optional()
20
- });
21
15
  class SpoFileSharingInfoGetCommand extends SpoCommand {
22
16
  get name() {
23
17
  return commands.FILE_SHARINGINFO_GET;
@@ -25,18 +19,14 @@ class SpoFileSharingInfoGetCommand extends SpoCommand {
25
19
  get description() {
26
20
  return 'Generates a sharing information report for the specified file';
27
21
  }
28
- get schema() {
29
- return options;
30
- }
31
- getRefinedSchema(schema) {
32
- return schema
33
- .refine(opts => [opts.fileId, opts.fileUrl].filter(o => o !== undefined).length === 1, {
34
- error: `Specify 'fileId' or 'fileUrl', but not both.`,
35
- params: {
36
- customCode: 'optionSet',
37
- options: ['fileId', 'fileUrl']
38
- }
39
- });
22
+ constructor() {
23
+ super();
24
+ _SpoFileSharingInfoGetCommand_instances.add(this);
25
+ __classPrivateFieldGet(this, _SpoFileSharingInfoGetCommand_instances, "m", _SpoFileSharingInfoGetCommand_initTelemetry).call(this);
26
+ __classPrivateFieldGet(this, _SpoFileSharingInfoGetCommand_instances, "m", _SpoFileSharingInfoGetCommand_initOptions).call(this);
27
+ __classPrivateFieldGet(this, _SpoFileSharingInfoGetCommand_instances, "m", _SpoFileSharingInfoGetCommand_initValidators).call(this);
28
+ __classPrivateFieldGet(this, _SpoFileSharingInfoGetCommand_instances, "m", _SpoFileSharingInfoGetCommand_initOptionSets).call(this);
29
+ __classPrivateFieldGet(this, _SpoFileSharingInfoGetCommand_instances, "m", _SpoFileSharingInfoGetCommand_initTypes).call(this);
40
30
  }
41
31
  getExcludedOptionsWithUrls() {
42
32
  return ['fileUrl'];
@@ -114,5 +104,38 @@ class SpoFileSharingInfoGetCommand extends SpoCommand {
114
104
  };
115
105
  }
116
106
  }
107
+ _SpoFileSharingInfoGetCommand_instances = new WeakSet(), _SpoFileSharingInfoGetCommand_initTelemetry = function _SpoFileSharingInfoGetCommand_initTelemetry() {
108
+ this.telemetry.push((args) => {
109
+ Object.assign(this.telemetryProperties, {
110
+ fileId: typeof args.options.fileId !== 'undefined',
111
+ fileUrl: typeof args.options.fileUrl !== 'undefined'
112
+ });
113
+ });
114
+ }, _SpoFileSharingInfoGetCommand_initOptions = function _SpoFileSharingInfoGetCommand_initOptions() {
115
+ this.options.unshift({
116
+ option: '-u, --webUrl <webUrl>'
117
+ }, {
118
+ option: '-i, --fileId [fileId]'
119
+ }, {
120
+ option: '--fileUrl [fileUrl]'
121
+ });
122
+ }, _SpoFileSharingInfoGetCommand_initValidators = function _SpoFileSharingInfoGetCommand_initValidators() {
123
+ this.validators.push(async (args) => {
124
+ const isValidSharePointUrl = validation.isValidSharePointUrl(args.options.webUrl);
125
+ if (isValidSharePointUrl !== true) {
126
+ return isValidSharePointUrl;
127
+ }
128
+ if (args.options.fileId) {
129
+ if (!validation.isValidGuid(args.options.fileId)) {
130
+ return `${args.options.fileId} is not a valid GUID`;
131
+ }
132
+ }
133
+ return true;
134
+ });
135
+ }, _SpoFileSharingInfoGetCommand_initOptionSets = function _SpoFileSharingInfoGetCommand_initOptionSets() {
136
+ this.optionSets.push({ options: ['fileId', 'fileUrl'] });
137
+ }, _SpoFileSharingInfoGetCommand_initTypes = function _SpoFileSharingInfoGetCommand_initTypes() {
138
+ this.types.string.push('webUrl', 'fileId', 'fileUrl');
139
+ };
117
140
  export default new SpoFileSharingInfoGetCommand();
118
141
  //# sourceMappingURL=file-sharinginfo-get.js.map
@@ -1,38 +1,14 @@
1
- import { z } from 'zod';
2
- import { globalOptionsZod } from '../../../../Command.js';
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 _SpoFileSharingLinkAddCommand_instances, _a, _SpoFileSharingLinkAddCommand_initTelemetry, _SpoFileSharingLinkAddCommand_initOptions, _SpoFileSharingLinkAddCommand_initValidators, _SpoFileSharingLinkAddCommand_initOptionSets, _SpoFileSharingLinkAddCommand_initTypes;
3
7
  import request from '../../../../request.js';
4
8
  import { spo } from '../../../../utils/spo.js';
5
9
  import { validation } from '../../../../utils/validation.js';
6
- import { zod } from '../../../../utils/zod.js';
7
10
  import SpoCommand from '../../../base/SpoCommand.js';
8
11
  import commands from '../../commands.js';
9
- var SharingLinkType;
10
- (function (SharingLinkType) {
11
- SharingLinkType["view"] = "view";
12
- SharingLinkType["edit"] = "edit";
13
- })(SharingLinkType || (SharingLinkType = {}));
14
- var SharingLinkScope;
15
- (function (SharingLinkScope) {
16
- SharingLinkScope["anonymous"] = "anonymous";
17
- SharingLinkScope["organization"] = "organization";
18
- })(SharingLinkScope || (SharingLinkScope = {}));
19
- export const options = z.strictObject({
20
- ...globalOptionsZod.shape,
21
- webUrl: z.string()
22
- .refine(url => validation.isValidSharePointUrl(url) === true, {
23
- error: e => `'${e.input}' is not a valid SharePoint Online site URL.`
24
- })
25
- .alias('u'),
26
- fileId: z.guid().optional(),
27
- fileUrl: z.string().optional(),
28
- type: zod.coercedEnum(SharingLinkType),
29
- expirationDateTime: z.string()
30
- .refine(date => validation.isValidISODateTime(date) === true, {
31
- error: e => `'${e.input}' is not a valid ISO date string.`
32
- })
33
- .optional(),
34
- scope: zod.coercedEnum(SharingLinkScope).optional()
35
- });
36
12
  class SpoFileSharingLinkAddCommand extends SpoCommand {
37
13
  get name() {
38
14
  return commands.FILE_SHARINGLINK_ADD;
@@ -40,22 +16,14 @@ class SpoFileSharingLinkAddCommand extends SpoCommand {
40
16
  get description() {
41
17
  return 'Creates a new sharing link for a file';
42
18
  }
43
- get schema() {
44
- return options;
45
- }
46
- getRefinedSchema(schema) {
47
- return schema
48
- .refine(opts => [opts.fileId, opts.fileUrl].filter(o => o !== undefined).length === 1, {
49
- error: `Specify 'fileId' or 'fileUrl', but not both.`,
50
- params: {
51
- customCode: 'optionSet',
52
- options: ['fileId', 'fileUrl']
53
- }
54
- })
55
- .refine(opts => !opts.scope || opts.scope === 'anonymous' || !opts.expirationDateTime, {
56
- error: `Option expirationDateTime can only be used for links with scope 'anonymous'.`,
57
- path: ['expirationDateTime']
58
- });
19
+ constructor() {
20
+ super();
21
+ _SpoFileSharingLinkAddCommand_instances.add(this);
22
+ __classPrivateFieldGet(this, _SpoFileSharingLinkAddCommand_instances, "m", _SpoFileSharingLinkAddCommand_initTelemetry).call(this);
23
+ __classPrivateFieldGet(this, _SpoFileSharingLinkAddCommand_instances, "m", _SpoFileSharingLinkAddCommand_initOptions).call(this);
24
+ __classPrivateFieldGet(this, _SpoFileSharingLinkAddCommand_instances, "m", _SpoFileSharingLinkAddCommand_initValidators).call(this);
25
+ __classPrivateFieldGet(this, _SpoFileSharingLinkAddCommand_instances, "m", _SpoFileSharingLinkAddCommand_initOptionSets).call(this);
26
+ __classPrivateFieldGet(this, _SpoFileSharingLinkAddCommand_instances, "m", _SpoFileSharingLinkAddCommand_initTypes).call(this);
59
27
  }
60
28
  async commandAction(logger, args) {
61
29
  if (this.verbose) {
@@ -83,5 +51,61 @@ class SpoFileSharingLinkAddCommand extends SpoCommand {
83
51
  }
84
52
  }
85
53
  }
54
+ _a = SpoFileSharingLinkAddCommand, _SpoFileSharingLinkAddCommand_instances = new WeakSet(), _SpoFileSharingLinkAddCommand_initTelemetry = function _SpoFileSharingLinkAddCommand_initTelemetry() {
55
+ this.telemetry.push((args) => {
56
+ Object.assign(this.telemetryProperties, {
57
+ fileId: typeof args.options.fileId !== 'undefined',
58
+ fileUrl: typeof args.options.fileUrl !== 'undefined',
59
+ expirationDateTime: typeof args.options.expirationDateTime !== 'undefined',
60
+ scope: typeof args.options.scope !== 'undefined'
61
+ });
62
+ });
63
+ }, _SpoFileSharingLinkAddCommand_initOptions = function _SpoFileSharingLinkAddCommand_initOptions() {
64
+ this.options.unshift({
65
+ option: '-u, --webUrl <webUrl>'
66
+ }, {
67
+ option: '--fileId [fileId]'
68
+ }, {
69
+ option: '--fileUrl [fileUrl]'
70
+ }, {
71
+ option: '--type <type>',
72
+ autocomplete: _a.types
73
+ }, {
74
+ option: '--expirationDateTime [expirationDateTime]'
75
+ }, {
76
+ option: '--scope [scope]',
77
+ autocomplete: _a.scopes
78
+ });
79
+ }, _SpoFileSharingLinkAddCommand_initValidators = function _SpoFileSharingLinkAddCommand_initValidators() {
80
+ this.validators.push(async (args) => {
81
+ const isValidSharePointUrl = validation.isValidSharePointUrl(args.options.webUrl);
82
+ if (isValidSharePointUrl !== true) {
83
+ return isValidSharePointUrl;
84
+ }
85
+ if (args.options.fileId && !validation.isValidGuid(args.options.fileId)) {
86
+ return `${args.options.fileId} is not a valid GUID`;
87
+ }
88
+ if (_a.types.indexOf(args.options.type) < 0) {
89
+ return `'${args.options.type}' is not a valid type. Allowed types are ${_a.types.join(', ')}`;
90
+ }
91
+ if (args.options.scope &&
92
+ _a.scopes.indexOf(args.options.scope) < 0) {
93
+ return `'${args.options.scope}' is not a valid scope. Allowed scopes are ${_a.scopes.join(', ')}`;
94
+ }
95
+ if (args.options.scope && args.options.scope !== 'anonymous' && args.options.expirationDateTime) {
96
+ return `Option expirationDateTime can only be used for links with scope 'anonymous'.`;
97
+ }
98
+ if (args.options.expirationDateTime && !validation.isValidISODateTime(args.options.expirationDateTime)) {
99
+ return `${args.options.expirationDateTime} is not a valid ISO date string.`;
100
+ }
101
+ return true;
102
+ });
103
+ }, _SpoFileSharingLinkAddCommand_initOptionSets = function _SpoFileSharingLinkAddCommand_initOptionSets() {
104
+ this.optionSets.push({ options: ['fileId', 'fileUrl'] });
105
+ }, _SpoFileSharingLinkAddCommand_initTypes = function _SpoFileSharingLinkAddCommand_initTypes() {
106
+ this.types.string.push('webUrl', 'fileId', 'fileUrl', 'type', 'expirationDateTime', 'scope');
107
+ };
108
+ SpoFileSharingLinkAddCommand.types = ['view', 'edit'];
109
+ SpoFileSharingLinkAddCommand.scopes = ['anonymous', 'organization'];
86
110
  export default new SpoFileSharingLinkAddCommand();
87
111
  //# sourceMappingURL=file-sharinglink-add.js.map
@@ -1,31 +1,16 @@
1
- import { z } from 'zod';
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 _SpoFileSharingLinkClearCommand_instances, _SpoFileSharingLinkClearCommand_initTelemetry, _SpoFileSharingLinkClearCommand_initOptions, _SpoFileSharingLinkClearCommand_initValidators, _SpoFileSharingLinkClearCommand_initOptionSets, _SpoFileSharingLinkClearCommand_initTypes;
2
7
  import { cli } from '../../../../cli/cli.js';
3
- import { globalOptionsZod } from '../../../../Command.js';
4
8
  import request from '../../../../request.js';
5
9
  import { spo } from '../../../../utils/spo.js';
6
10
  import { validation } from '../../../../utils/validation.js';
7
- import { zod } from '../../../../utils/zod.js';
8
11
  import SpoCommand from '../../../base/SpoCommand.js';
9
12
  import commands from '../../commands.js';
10
13
  import spoFileSharingLinkListCommand from './file-sharinglink-list.js';
11
- var SharingLinkScope;
12
- (function (SharingLinkScope) {
13
- SharingLinkScope["anonymous"] = "anonymous";
14
- SharingLinkScope["users"] = "users";
15
- SharingLinkScope["organization"] = "organization";
16
- })(SharingLinkScope || (SharingLinkScope = {}));
17
- export const options = z.strictObject({
18
- ...globalOptionsZod.shape,
19
- webUrl: z.string()
20
- .refine(url => validation.isValidSharePointUrl(url) === true, {
21
- error: e => `'${e.input}' is not a valid SharePoint Online site URL.`
22
- })
23
- .alias('u'),
24
- fileUrl: z.string().optional(),
25
- fileId: z.guid().optional(),
26
- scope: zod.coercedEnum(SharingLinkScope).optional().alias('s'),
27
- force: z.boolean().optional().alias('f')
28
- });
29
14
  class SpoFileSharingLinkClearCommand extends SpoCommand {
30
15
  get name() {
31
16
  return commands.FILE_SHARINGLINK_CLEAR;
@@ -33,18 +18,15 @@ class SpoFileSharingLinkClearCommand extends SpoCommand {
33
18
  get description() {
34
19
  return 'Removes sharing links of a file';
35
20
  }
36
- get schema() {
37
- return options;
38
- }
39
- getRefinedSchema(schema) {
40
- return schema
41
- .refine(opts => [opts.fileUrl, opts.fileId].filter(o => o !== undefined).length === 1, {
42
- error: `Specify 'fileUrl' or 'fileId', but not both.`,
43
- params: {
44
- customCode: 'optionSet',
45
- options: ['fileUrl', 'fileId']
46
- }
47
- });
21
+ constructor() {
22
+ super();
23
+ _SpoFileSharingLinkClearCommand_instances.add(this);
24
+ this.allowedScopes = ['anonymous', 'users', 'organization'];
25
+ __classPrivateFieldGet(this, _SpoFileSharingLinkClearCommand_instances, "m", _SpoFileSharingLinkClearCommand_initTelemetry).call(this);
26
+ __classPrivateFieldGet(this, _SpoFileSharingLinkClearCommand_instances, "m", _SpoFileSharingLinkClearCommand_initOptions).call(this);
27
+ __classPrivateFieldGet(this, _SpoFileSharingLinkClearCommand_instances, "m", _SpoFileSharingLinkClearCommand_initValidators).call(this);
28
+ __classPrivateFieldGet(this, _SpoFileSharingLinkClearCommand_instances, "m", _SpoFileSharingLinkClearCommand_initOptionSets).call(this);
29
+ __classPrivateFieldGet(this, _SpoFileSharingLinkClearCommand_instances, "m", _SpoFileSharingLinkClearCommand_initTypes).call(this);
48
30
  }
49
31
  async commandAction(logger, args) {
50
32
  const clearSharingLinks = async () => {
@@ -93,5 +75,47 @@ class SpoFileSharingLinkClearCommand extends SpoCommand {
93
75
  return outputParsed;
94
76
  }
95
77
  }
78
+ _SpoFileSharingLinkClearCommand_instances = new WeakSet(), _SpoFileSharingLinkClearCommand_initTelemetry = function _SpoFileSharingLinkClearCommand_initTelemetry() {
79
+ this.telemetry.push((args) => {
80
+ Object.assign(this.telemetryProperties, {
81
+ fileUrl: typeof args.options.fileUrl !== 'undefined',
82
+ fileId: typeof args.options.fileId !== 'undefined',
83
+ scope: typeof args.options.scope !== 'undefined',
84
+ force: !!args.options.force
85
+ });
86
+ });
87
+ }, _SpoFileSharingLinkClearCommand_initOptions = function _SpoFileSharingLinkClearCommand_initOptions() {
88
+ this.options.unshift({
89
+ option: '-u, --webUrl <webUrl>'
90
+ }, {
91
+ option: '--fileUrl [fileUrl]'
92
+ }, {
93
+ option: '--fileId [fileId]'
94
+ }, {
95
+ option: '-s, --scope [scope]',
96
+ autocomplete: this.allowedScopes
97
+ }, {
98
+ option: '-f, --force'
99
+ });
100
+ }, _SpoFileSharingLinkClearCommand_initValidators = function _SpoFileSharingLinkClearCommand_initValidators() {
101
+ this.validators.push(async (args) => {
102
+ const isValidSharePointUrl = validation.isValidSharePointUrl(args.options.webUrl);
103
+ if (isValidSharePointUrl !== true) {
104
+ return isValidSharePointUrl;
105
+ }
106
+ if (args.options.fileId && !validation.isValidGuid(args.options.fileId)) {
107
+ return `${args.options.fileId} is not a valid GUID`;
108
+ }
109
+ if (args.options.scope && this.allowedScopes.indexOf(args.options.scope) === -1) {
110
+ return `'${args.options.scope}' is not a valid scope. Allowed values are: ${this.allowedScopes.join(',')}`;
111
+ }
112
+ return true;
113
+ });
114
+ }, _SpoFileSharingLinkClearCommand_initOptionSets = function _SpoFileSharingLinkClearCommand_initOptionSets() {
115
+ this.optionSets.push({ options: ['fileUrl', 'fileId'] });
116
+ }, _SpoFileSharingLinkClearCommand_initTypes = function _SpoFileSharingLinkClearCommand_initTypes() {
117
+ this.types.string.push('webUrl', 'fileUrl', 'fileId', 'scope');
118
+ this.types.boolean.push('force');
119
+ };
96
120
  export default new SpoFileSharingLinkClearCommand();
97
121
  //# sourceMappingURL=file-sharinglink-clear.js.map
@@ -1,21 +1,14 @@
1
- import { z } from 'zod';
2
- import { globalOptionsZod } from '../../../../Command.js';
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 _SpoFileSharingLinkGetCommand_instances, _SpoFileSharingLinkGetCommand_initTelemetry, _SpoFileSharingLinkGetCommand_initOptions, _SpoFileSharingLinkGetCommand_initValidators, _SpoFileSharingLinkGetCommand_initOptionSets, _SpoFileSharingLinkGetCommand_initTypes;
3
7
  import request from '../../../../request.js';
4
8
  import { spo } from '../../../../utils/spo.js';
5
9
  import { validation } from '../../../../utils/validation.js';
6
10
  import SpoCommand from '../../../base/SpoCommand.js';
7
11
  import commands from '../../commands.js';
8
- export const options = z.strictObject({
9
- ...globalOptionsZod.shape,
10
- webUrl: z.string()
11
- .refine(url => validation.isValidSharePointUrl(url) === true, {
12
- error: e => `'${e.input}' is not a valid SharePoint Online site URL.`
13
- })
14
- .alias('u'),
15
- fileUrl: z.string().optional(),
16
- fileId: z.guid().optional(),
17
- id: z.string().alias('i')
18
- });
19
12
  class SpoFileSharingLinkGetCommand extends SpoCommand {
20
13
  get name() {
21
14
  return commands.FILE_SHARINGLINK_GET;
@@ -23,18 +16,14 @@ class SpoFileSharingLinkGetCommand extends SpoCommand {
23
16
  get description() {
24
17
  return 'Gets details about a specific sharing link of a file';
25
18
  }
26
- get schema() {
27
- return options;
28
- }
29
- getRefinedSchema(schema) {
30
- return schema
31
- .refine(opts => [opts.fileUrl, opts.fileId].filter(o => o !== undefined).length === 1, {
32
- error: `Specify 'fileUrl' or 'fileId', but not both.`,
33
- params: {
34
- customCode: 'optionSet',
35
- options: ['fileUrl', 'fileId']
36
- }
37
- });
19
+ constructor() {
20
+ super();
21
+ _SpoFileSharingLinkGetCommand_instances.add(this);
22
+ __classPrivateFieldGet(this, _SpoFileSharingLinkGetCommand_instances, "m", _SpoFileSharingLinkGetCommand_initTelemetry).call(this);
23
+ __classPrivateFieldGet(this, _SpoFileSharingLinkGetCommand_instances, "m", _SpoFileSharingLinkGetCommand_initOptions).call(this);
24
+ __classPrivateFieldGet(this, _SpoFileSharingLinkGetCommand_instances, "m", _SpoFileSharingLinkGetCommand_initValidators).call(this);
25
+ __classPrivateFieldGet(this, _SpoFileSharingLinkGetCommand_instances, "m", _SpoFileSharingLinkGetCommand_initOptionSets).call(this);
26
+ __classPrivateFieldGet(this, _SpoFileSharingLinkGetCommand_instances, "m", _SpoFileSharingLinkGetCommand_initTypes).call(this);
38
27
  }
39
28
  async commandAction(logger, args) {
40
29
  if (this.verbose) {
@@ -57,5 +46,38 @@ class SpoFileSharingLinkGetCommand extends SpoCommand {
57
46
  }
58
47
  }
59
48
  }
49
+ _SpoFileSharingLinkGetCommand_instances = new WeakSet(), _SpoFileSharingLinkGetCommand_initTelemetry = function _SpoFileSharingLinkGetCommand_initTelemetry() {
50
+ this.telemetry.push((args) => {
51
+ Object.assign(this.telemetryProperties, {
52
+ fileUrl: typeof args.options.fileUrl !== 'undefined',
53
+ fileId: typeof args.options.fileId !== 'undefined'
54
+ });
55
+ });
56
+ }, _SpoFileSharingLinkGetCommand_initOptions = function _SpoFileSharingLinkGetCommand_initOptions() {
57
+ this.options.unshift({
58
+ option: '-u, --webUrl <webUrl>'
59
+ }, {
60
+ option: '--fileUrl [fileUrl]'
61
+ }, {
62
+ option: '--fileId [fileId]'
63
+ }, {
64
+ option: '-i, --id <id>'
65
+ });
66
+ }, _SpoFileSharingLinkGetCommand_initValidators = function _SpoFileSharingLinkGetCommand_initValidators() {
67
+ this.validators.push(async (args) => {
68
+ const isValidSharePointUrl = validation.isValidSharePointUrl(args.options.webUrl);
69
+ if (isValidSharePointUrl !== true) {
70
+ return isValidSharePointUrl;
71
+ }
72
+ if (args.options.fileId && !validation.isValidGuid(args.options.fileId)) {
73
+ return `${args.options.fileId} is not a valid GUID`;
74
+ }
75
+ return true;
76
+ });
77
+ }, _SpoFileSharingLinkGetCommand_initOptionSets = function _SpoFileSharingLinkGetCommand_initOptionSets() {
78
+ this.optionSets.push({ options: ['fileUrl', 'fileId'] });
79
+ }, _SpoFileSharingLinkGetCommand_initTypes = function _SpoFileSharingLinkGetCommand_initTypes() {
80
+ this.types.string.push('webUrl', 'fileUrl', 'fileId', 'id');
81
+ };
60
82
  export default new SpoFileSharingLinkGetCommand();
61
83
  //# sourceMappingURL=file-sharinglink-get.js.map
@@ -1,29 +1,15 @@
1
- import { z } from 'zod';
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 _SpoFileSharingLinkListCommand_instances, _a, _SpoFileSharingLinkListCommand_initTelemetry, _SpoFileSharingLinkListCommand_initOptions, _SpoFileSharingLinkListCommand_initValidators, _SpoFileSharingLinkListCommand_initOptionSets, _SpoFileSharingLinkListCommand_initTypes;
2
7
  import { cli } from '../../../../cli/cli.js';
3
- import { globalOptionsZod } from '../../../../Command.js';
4
8
  import { odata } from '../../../../utils/odata.js';
5
9
  import { spo } from '../../../../utils/spo.js';
6
10
  import { validation } from '../../../../utils/validation.js';
7
- import { zod } from '../../../../utils/zod.js';
8
11
  import SpoCommand from '../../../base/SpoCommand.js';
9
12
  import commands from '../../commands.js';
10
- var SharingLinkScope;
11
- (function (SharingLinkScope) {
12
- SharingLinkScope["anonymous"] = "anonymous";
13
- SharingLinkScope["users"] = "users";
14
- SharingLinkScope["organization"] = "organization";
15
- })(SharingLinkScope || (SharingLinkScope = {}));
16
- export const options = z.strictObject({
17
- ...globalOptionsZod.shape,
18
- webUrl: z.string()
19
- .refine(url => validation.isValidSharePointUrl(url) === true, {
20
- error: e => `'${e.input}' is not a valid SharePoint Online site URL.`
21
- })
22
- .alias('u'),
23
- fileId: z.guid().optional(),
24
- fileUrl: z.string().optional(),
25
- scope: zod.coercedEnum(SharingLinkScope).optional().alias('s')
26
- });
27
13
  class SpoFileSharingLinkListCommand extends SpoCommand {
28
14
  get name() {
29
15
  return commands.FILE_SHARINGLINK_LIST;
@@ -34,18 +20,14 @@ class SpoFileSharingLinkListCommand extends SpoCommand {
34
20
  defaultProperties() {
35
21
  return ['id', 'scope', 'roles', 'link'];
36
22
  }
37
- get schema() {
38
- return options;
39
- }
40
- getRefinedSchema(schema) {
41
- return schema
42
- .refine(opts => [opts.fileId, opts.fileUrl].filter(o => o !== undefined).length === 1, {
43
- error: `Specify 'fileId' or 'fileUrl', but not both.`,
44
- params: {
45
- customCode: 'optionSet',
46
- options: ['fileId', 'fileUrl']
47
- }
48
- });
23
+ constructor() {
24
+ super();
25
+ _SpoFileSharingLinkListCommand_instances.add(this);
26
+ __classPrivateFieldGet(this, _SpoFileSharingLinkListCommand_instances, "m", _SpoFileSharingLinkListCommand_initTelemetry).call(this);
27
+ __classPrivateFieldGet(this, _SpoFileSharingLinkListCommand_instances, "m", _SpoFileSharingLinkListCommand_initOptions).call(this);
28
+ __classPrivateFieldGet(this, _SpoFileSharingLinkListCommand_instances, "m", _SpoFileSharingLinkListCommand_initValidators).call(this);
29
+ __classPrivateFieldGet(this, _SpoFileSharingLinkListCommand_instances, "m", _SpoFileSharingLinkListCommand_initOptionSets).call(this);
30
+ __classPrivateFieldGet(this, _SpoFileSharingLinkListCommand_instances, "m", _SpoFileSharingLinkListCommand_initTypes).call(this);
49
31
  }
50
32
  async commandAction(logger, args) {
51
33
  if (this.verbose) {
@@ -78,5 +60,44 @@ class SpoFileSharingLinkListCommand extends SpoCommand {
78
60
  }
79
61
  }
80
62
  }
63
+ _a = SpoFileSharingLinkListCommand, _SpoFileSharingLinkListCommand_instances = new WeakSet(), _SpoFileSharingLinkListCommand_initTelemetry = function _SpoFileSharingLinkListCommand_initTelemetry() {
64
+ this.telemetry.push((args) => {
65
+ Object.assign(this.telemetryProperties, {
66
+ fileId: typeof args.options.fileId !== 'undefined',
67
+ fileUrl: typeof args.options.fileUrl !== 'undefined',
68
+ scope: typeof args.options.scope !== 'undefined'
69
+ });
70
+ });
71
+ }, _SpoFileSharingLinkListCommand_initOptions = function _SpoFileSharingLinkListCommand_initOptions() {
72
+ this.options.unshift({
73
+ option: '-u, --webUrl <webUrl>'
74
+ }, {
75
+ option: '--fileId [fileId]'
76
+ }, {
77
+ option: '--fileUrl [fileUrl]'
78
+ }, {
79
+ option: '-s, --scope [scope]',
80
+ autocomplete: _a.allowedScopes
81
+ });
82
+ }, _SpoFileSharingLinkListCommand_initValidators = function _SpoFileSharingLinkListCommand_initValidators() {
83
+ this.validators.push(async (args) => {
84
+ const isValidSharePointUrl = validation.isValidSharePointUrl(args.options.webUrl);
85
+ if (isValidSharePointUrl !== true) {
86
+ return isValidSharePointUrl;
87
+ }
88
+ if (args.options.fileId && !validation.isValidGuid(args.options.fileId)) {
89
+ return `${args.options.fileId} is not a valid GUID`;
90
+ }
91
+ if (args.options.scope && _a.allowedScopes.indexOf(args.options.scope) === -1) {
92
+ return `'${args.options.scope}' is not a valid scope. Allowed values are: ${_a.allowedScopes.join(',')}`;
93
+ }
94
+ return true;
95
+ });
96
+ }, _SpoFileSharingLinkListCommand_initOptionSets = function _SpoFileSharingLinkListCommand_initOptionSets() {
97
+ this.optionSets.push({ options: ['fileId', 'fileUrl'] });
98
+ }, _SpoFileSharingLinkListCommand_initTypes = function _SpoFileSharingLinkListCommand_initTypes() {
99
+ this.types.string.push('webUrl', 'fileId', 'fileUrl', 'scope');
100
+ };
101
+ SpoFileSharingLinkListCommand.allowedScopes = ['anonymous', 'users', 'organization'];
81
102
  export default new SpoFileSharingLinkListCommand();
82
103
  //# sourceMappingURL=file-sharinglink-list.js.map
@@ -1,23 +1,15 @@
1
- import { z } from 'zod';
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 _SpoFileSharingLinkRemoveCommand_instances, _SpoFileSharingLinkRemoveCommand_initTelemetry, _SpoFileSharingLinkRemoveCommand_initOptions, _SpoFileSharingLinkRemoveCommand_initValidators, _SpoFileSharingLinkRemoveCommand_initOptionSets, _SpoFileSharingLinkRemoveCommand_initTypes;
2
7
  import { cli } from '../../../../cli/cli.js';
3
- import { globalOptionsZod } from '../../../../Command.js';
4
8
  import request from '../../../../request.js';
5
9
  import { spo } from '../../../../utils/spo.js';
6
10
  import { validation } from '../../../../utils/validation.js';
7
11
  import SpoCommand from '../../../base/SpoCommand.js';
8
12
  import commands from '../../commands.js';
9
- export const options = z.strictObject({
10
- ...globalOptionsZod.shape,
11
- webUrl: 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
- fileUrl: z.string().optional(),
17
- fileId: z.guid().optional(),
18
- id: z.string().alias('i'),
19
- force: z.boolean().optional().alias('f')
20
- });
21
13
  class SpoFileSharingLinkRemoveCommand extends SpoCommand {
22
14
  get name() {
23
15
  return commands.FILE_SHARINGLINK_REMOVE;
@@ -25,18 +17,14 @@ class SpoFileSharingLinkRemoveCommand extends SpoCommand {
25
17
  get description() {
26
18
  return 'Removes a specific sharing link of a file';
27
19
  }
28
- get schema() {
29
- return options;
30
- }
31
- getRefinedSchema(schema) {
32
- return schema
33
- .refine(opts => [opts.fileUrl, opts.fileId].filter(o => o !== undefined).length === 1, {
34
- error: `Specify 'fileUrl' or 'fileId', but not both.`,
35
- params: {
36
- customCode: 'optionSet',
37
- options: ['fileUrl', 'fileId']
38
- }
39
- });
20
+ constructor() {
21
+ super();
22
+ _SpoFileSharingLinkRemoveCommand_instances.add(this);
23
+ __classPrivateFieldGet(this, _SpoFileSharingLinkRemoveCommand_instances, "m", _SpoFileSharingLinkRemoveCommand_initTelemetry).call(this);
24
+ __classPrivateFieldGet(this, _SpoFileSharingLinkRemoveCommand_instances, "m", _SpoFileSharingLinkRemoveCommand_initOptions).call(this);
25
+ __classPrivateFieldGet(this, _SpoFileSharingLinkRemoveCommand_instances, "m", _SpoFileSharingLinkRemoveCommand_initValidators).call(this);
26
+ __classPrivateFieldGet(this, _SpoFileSharingLinkRemoveCommand_instances, "m", _SpoFileSharingLinkRemoveCommand_initOptionSets).call(this);
27
+ __classPrivateFieldGet(this, _SpoFileSharingLinkRemoveCommand_instances, "m", _SpoFileSharingLinkRemoveCommand_initTypes).call(this);
40
28
  }
41
29
  async commandAction(logger, args) {
42
30
  const removeSharingLink = async () => {
@@ -69,5 +57,42 @@ class SpoFileSharingLinkRemoveCommand extends SpoCommand {
69
57
  }
70
58
  }
71
59
  }
60
+ _SpoFileSharingLinkRemoveCommand_instances = new WeakSet(), _SpoFileSharingLinkRemoveCommand_initTelemetry = function _SpoFileSharingLinkRemoveCommand_initTelemetry() {
61
+ this.telemetry.push((args) => {
62
+ Object.assign(this.telemetryProperties, {
63
+ fileUrl: typeof args.options.fileUrl !== 'undefined',
64
+ fileId: typeof args.options.fileId !== 'undefined',
65
+ force: !!args.options.force
66
+ });
67
+ });
68
+ }, _SpoFileSharingLinkRemoveCommand_initOptions = function _SpoFileSharingLinkRemoveCommand_initOptions() {
69
+ this.options.unshift({
70
+ option: '-u, --webUrl <webUrl>'
71
+ }, {
72
+ option: '--fileUrl [fileUrl]'
73
+ }, {
74
+ option: '--fileId [fileId]'
75
+ }, {
76
+ option: '-i, --id <id>'
77
+ }, {
78
+ option: '-f, --force'
79
+ });
80
+ }, _SpoFileSharingLinkRemoveCommand_initValidators = function _SpoFileSharingLinkRemoveCommand_initValidators() {
81
+ this.validators.push(async (args) => {
82
+ const isValidSharePointUrl = validation.isValidSharePointUrl(args.options.webUrl);
83
+ if (isValidSharePointUrl !== true) {
84
+ return isValidSharePointUrl;
85
+ }
86
+ if (args.options.fileId && !validation.isValidGuid(args.options.fileId)) {
87
+ return `${args.options.fileId} is not a valid GUID`;
88
+ }
89
+ return true;
90
+ });
91
+ }, _SpoFileSharingLinkRemoveCommand_initOptionSets = function _SpoFileSharingLinkRemoveCommand_initOptionSets() {
92
+ this.optionSets.push({ options: ['fileUrl', 'fileId'] });
93
+ }, _SpoFileSharingLinkRemoveCommand_initTypes = function _SpoFileSharingLinkRemoveCommand_initTypes() {
94
+ this.types.string.push('webUrl', 'fileUrl', 'fileId', 'id');
95
+ this.types.boolean.push('force');
96
+ };
72
97
  export default new SpoFileSharingLinkRemoveCommand();
73
98
  //# sourceMappingURL=file-sharinglink-remove.js.map