@pnp/cli-microsoft365 12.0.0-beta.e4f7675 → 12.0.0-beta.feb621e

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 (188) hide show
  1. package/.devproxy/generate-openapi-spec.json +1 -1
  2. package/allCommands.json +1 -1
  3. package/allCommandsFull.json +1 -1
  4. package/dist/Auth.js +2 -6
  5. package/dist/auth/FileTokenStorage.js +0 -3
  6. package/dist/auth/msalCachePlugin.js +201 -12
  7. package/dist/googleAnalytics.js +96 -0
  8. package/dist/m365/commands/logout.js +2 -4
  9. package/dist/m365/entra/commands/m365group/m365group-remove.js +4 -3
  10. package/dist/m365/spe/commands/container/container-remove.js +6 -7
  11. package/dist/m365/spfx/commands/SpfxCompatibilityMatrix.js +15 -0
  12. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.24.0-rc.0.js +19 -0
  13. package/dist/m365/spfx/commands/project/project-doctor.js +2 -1
  14. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN012021_TSC_excludeDirectories.js +43 -0
  15. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN027002_OVERRIDES_qs.js +33 -0
  16. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN027003_OVERRIDES_uuid.js +33 -0
  17. package/dist/m365/spfx/commands/project/project-upgrade/upgrade-1.24.0-rc.0.js +77 -0
  18. package/dist/m365/spfx/commands/project/project-upgrade.js +12 -11
  19. package/dist/m365/spo/commands/app/app-add.js +35 -56
  20. package/dist/m365/spo/commands/app/app-deploy.js +41 -59
  21. package/dist/m365/spo/commands/app/app-get.js +40 -56
  22. package/dist/m365/spo/commands/app/app-install.js +20 -41
  23. package/dist/m365/spo/commands/app/app-instance-list.js +12 -24
  24. package/dist/m365/spo/commands/app/app-list.js +26 -44
  25. package/dist/m365/spo/commands/app/app-remove.js +32 -52
  26. package/dist/m365/spo/commands/app/app-retract.js +32 -51
  27. package/dist/m365/spo/commands/app/app-teamspackage-download.js +35 -54
  28. package/dist/m365/spo/commands/app/app-uninstall.js +21 -44
  29. package/dist/m365/spo/commands/app/app-upgrade.js +20 -41
  30. package/dist/m365/spo/commands/feature/feature-disable.js +20 -50
  31. package/dist/m365/spo/commands/feature/feature-enable.js +22 -50
  32. package/dist/m365/spo/commands/feature/feature-list.js +11 -36
  33. package/dist/m365/spo/commands/field/field-add.js +33 -62
  34. package/dist/m365/spo/commands/field/field-get.js +30 -57
  35. package/dist/m365/spo/commands/field/field-list.js +21 -46
  36. package/dist/m365/spo/commands/field/field-remove.js +32 -63
  37. package/dist/m365/spo/commands/field/field-set.js +34 -66
  38. package/dist/m365/spo/commands/file/file-archive.js +1 -1
  39. package/dist/m365/spo/commands/file/file-get.js +4 -3
  40. package/dist/m365/spo/commands/file/file-remove.js +5 -5
  41. package/dist/m365/spo/commands/file/file-unarchive.js +1 -1
  42. package/dist/m365/spo/commands/folder/folder-archive.js +1 -1
  43. package/dist/m365/spo/commands/folder/folder-remove.js +5 -5
  44. package/dist/m365/spo/commands/folder/folder-unarchive.js +90 -0
  45. package/dist/m365/spo/commands/hidedefaultthemes/hidedefaultthemes-get.js +5 -0
  46. package/dist/m365/spo/commands/hidedefaultthemes/hidedefaultthemes-set.js +8 -26
  47. package/dist/m365/spo/commands/homesite/homesite-list.js +5 -0
  48. package/dist/m365/spo/commands/hubsite/hubsite-connect.js +38 -63
  49. package/dist/m365/spo/commands/hubsite/hubsite-data-get.js +11 -27
  50. package/dist/m365/spo/commands/hubsite/hubsite-disconnect.js +25 -47
  51. package/dist/m365/spo/commands/hubsite/hubsite-get.js +25 -37
  52. package/dist/m365/spo/commands/hubsite/hubsite-list.js +12 -24
  53. package/dist/m365/spo/commands/hubsite/hubsite-register.js +10 -18
  54. package/dist/m365/spo/commands/hubsite/hubsite-rights-grant.js +14 -32
  55. package/dist/m365/spo/commands/hubsite/hubsite-rights-revoke.js +12 -29
  56. package/dist/m365/spo/commands/hubsite/hubsite-set.js +19 -46
  57. package/dist/m365/spo/commands/hubsite/hubsite-unregister.js +11 -27
  58. package/dist/m365/spo/commands/list/list-remove.js +4 -4
  59. package/dist/m365/spo/commands/listitem/listitem-batch-remove.js +5 -4
  60. package/dist/m365/spo/commands/listitem/listitem-get.js +1 -12
  61. package/dist/m365/spo/commands/listitem/listitem-remove.js +8 -5
  62. package/dist/m365/spo/commands/navigation/navigation-node-list.js +6 -4
  63. package/dist/m365/spo/commands/page/page-remove.js +7 -7
  64. package/dist/m365/spo/commands/site/site-remove.js +7 -7
  65. package/dist/m365/spo/commands/spo-get.js +5 -0
  66. package/dist/m365/spo/commands/spo-set.js +10 -21
  67. package/dist/m365/spo/commands/tenant/tenant-appcatalog-add.js +1 -1
  68. package/dist/m365/spo/commands/user/user-ensure.js +24 -60
  69. package/dist/m365/spo/commands/user/user-get.js +25 -65
  70. package/dist/m365/spo/commands/user/user-list.js +10 -18
  71. package/dist/m365/spo/commands/user/user-remove.js +26 -68
  72. package/dist/m365/spo/commands/userprofile/userprofile-get.js +10 -23
  73. package/dist/m365/spo/commands/userprofile/userprofile-set.js +10 -19
  74. package/dist/m365/spo/commands/web/web-add.js +20 -55
  75. package/dist/m365/spo/commands/web/web-clientsidewebpart-list.js +10 -18
  76. package/dist/m365/spo/commands/web/web-get.js +12 -30
  77. package/dist/m365/spo/commands/web/web-installedlanguage-list.js +10 -18
  78. package/dist/m365/spo/commands/web/web-list.js +10 -18
  79. package/dist/m365/spo/commands/web/web-reindex.js +10 -18
  80. package/dist/m365/spo/commands/web/web-remove.js +11 -27
  81. package/dist/m365/spo/commands/web/web-retentionlabel-list.js +10 -18
  82. package/dist/m365/spo/commands/web/web-roleassignment-add.js +40 -64
  83. package/dist/m365/spo/commands/web/web-roleassignment-remove.js +31 -58
  84. package/dist/m365/spo/commands/web/web-roleinheritance-break.js +12 -36
  85. package/dist/m365/spo/commands/web/web-roleinheritance-reset.js +11 -29
  86. package/dist/m365/spo/commands/web/web-rule-get.js +47 -0
  87. package/dist/m365/spo/commands/web/web-rule-list.js +6 -4
  88. package/dist/m365/spo/commands/web/web-rule-remove.js +0 -3
  89. package/dist/m365/spo/commands/web/web-set.js +26 -96
  90. package/dist/m365/spo/commands.js +3 -3
  91. package/dist/m365/teams/commands/channel/channel-add.js +46 -57
  92. package/dist/m365/teams/commands/channel/channel-get.js +41 -48
  93. package/dist/m365/teams/commands/channel/channel-list.js +28 -42
  94. package/dist/m365/teams/commands/channel/channel-member-add.js +53 -54
  95. package/dist/m365/teams/commands/channel/channel-member-list.js +47 -55
  96. package/dist/m365/teams/commands/channel/channel-member-remove.js +62 -62
  97. package/dist/m365/teams/commands/channel/channel-member-set.js +61 -65
  98. package/dist/m365/teams/commands/channel/channel-remove.js +47 -49
  99. package/dist/m365/teams/commands/channel/channel-set.js +47 -54
  100. package/dist/m365/teams/commands/chat/chat-get.js +30 -45
  101. package/dist/m365/teams/commands/chat/chat-list.js +22 -42
  102. package/dist/m365/teams/commands/chat/chat-member-add.js +43 -64
  103. package/dist/m365/teams/commands/chat/chat-member-list.js +10 -23
  104. package/dist/m365/teams/commands/chat/chat-member-remove.js +28 -50
  105. package/dist/m365/teams/commands/chat/chat-message-send.js +32 -55
  106. package/dist/m365/util/commands/accesstoken/accesstoken-get.js +10 -28
  107. package/dist/telemetry.js +7 -11
  108. package/dist/utils/spo.js +1 -3
  109. package/dist/utils/urlUtil.js +2 -2
  110. package/docs/docs/cmd/entra/m365group/m365group-remove.mdx +4 -4
  111. package/docs/docs/cmd/spe/container/container-remove.mdx +5 -5
  112. package/docs/docs/cmd/spo/file/file-archive.mdx +9 -1
  113. package/docs/docs/cmd/spo/file/file-checkin.mdx +2 -2
  114. package/docs/docs/cmd/spo/file/file-checkout-undo.mdx +1 -1
  115. package/docs/docs/cmd/spo/file/file-checkout.mdx +2 -2
  116. package/docs/docs/cmd/spo/file/file-copy.mdx +2 -2
  117. package/docs/docs/cmd/spo/file/file-get.mdx +6 -6
  118. package/docs/docs/cmd/spo/file/file-remove.mdx +4 -4
  119. package/docs/docs/cmd/spo/file/file-retentionlabel-ensure.mdx +1 -1
  120. package/docs/docs/cmd/spo/file/file-retentionlabel-remove.mdx +1 -1
  121. package/docs/docs/cmd/spo/file/file-roleassignment-add.mdx +1 -1
  122. package/docs/docs/cmd/spo/file/file-roleassignment-remove.mdx +1 -1
  123. package/docs/docs/cmd/spo/file/file-roleinheritance-break.mdx +3 -3
  124. package/docs/docs/cmd/spo/file/file-roleinheritance-reset.mdx +2 -2
  125. package/docs/docs/cmd/spo/file/file-sharinginfo-get.mdx +2 -2
  126. package/docs/docs/cmd/spo/file/file-sharinglink-add.mdx +22 -1
  127. package/docs/docs/cmd/spo/file/file-sharinglink-clear.mdx +24 -1
  128. package/docs/docs/cmd/spo/file/file-sharinglink-get.mdx +22 -1
  129. package/docs/docs/cmd/spo/file/file-sharinglink-list.mdx +22 -1
  130. package/docs/docs/cmd/spo/file/file-sharinglink-remove.mdx +24 -1
  131. package/docs/docs/cmd/spo/file/file-sharinglink-set.mdx +22 -1
  132. package/docs/docs/cmd/spo/file/file-unarchive.mdx +9 -1
  133. package/docs/docs/cmd/spo/file/file-version-clear.mdx +1 -1
  134. package/docs/docs/cmd/spo/file/file-version-get.mdx +1 -1
  135. package/docs/docs/cmd/spo/file/file-version-keep.mdx +1 -1
  136. package/docs/docs/cmd/spo/file/file-version-list.mdx +1 -1
  137. package/docs/docs/cmd/spo/file/file-version-remove.mdx +1 -1
  138. package/docs/docs/cmd/spo/file/file-version-restore.mdx +1 -1
  139. package/docs/docs/cmd/spo/folder/folder-archive.mdx +7 -1
  140. package/docs/docs/cmd/spo/folder/folder-copy.mdx +1 -1
  141. package/docs/docs/cmd/spo/folder/folder-get.mdx +2 -2
  142. package/docs/docs/cmd/spo/folder/folder-remove.mdx +4 -4
  143. package/docs/docs/cmd/spo/folder/folder-retentionlabel-ensure.mdx +1 -1
  144. package/docs/docs/cmd/spo/folder/folder-retentionlabel-remove.mdx +1 -1
  145. package/docs/docs/cmd/spo/folder/folder-sharinglink-add.mdx +22 -1
  146. package/docs/docs/cmd/spo/folder/folder-sharinglink-clear.mdx +23 -0
  147. package/docs/docs/cmd/spo/folder/folder-sharinglink-get.mdx +21 -0
  148. package/docs/docs/cmd/spo/folder/folder-sharinglink-list.mdx +22 -1
  149. package/docs/docs/cmd/spo/folder/folder-sharinglink-remove.mdx +24 -1
  150. package/docs/docs/cmd/spo/folder/folder-sharinglink-set.mdx +21 -0
  151. package/docs/docs/cmd/spo/folder/folder-unarchive.mdx +76 -0
  152. package/docs/docs/cmd/spo/list/list-remove.mdx +4 -4
  153. package/docs/docs/cmd/spo/listitem/listitem-batch-remove.mdx +8 -2
  154. package/docs/docs/cmd/spo/listitem/listitem-get.mdx +0 -6
  155. package/docs/docs/cmd/spo/listitem/listitem-remove.mdx +8 -2
  156. package/docs/docs/cmd/spo/navigation/navigation-node-list.mdx +37 -27
  157. package/docs/docs/cmd/spo/page/page-remove.mdx +4 -4
  158. package/docs/docs/cmd/spo/site/site-apppermission-add.mdx +52 -21
  159. package/docs/docs/cmd/spo/site/site-remove.mdx +3 -3
  160. package/docs/docs/cmd/spo/web/web-rule-get.mdx +108 -0
  161. package/docs/docs/cmd/spo/web/web-rule-list.mdx +8 -12
  162. package/docs/docs/cmd/spo/web/web-rule-remove.mdx +0 -6
  163. package/docs/docs/cmd/spp/model/model-get.mdx +1 -1
  164. package/docs/docs/cmd/spp/model/model-remove.mdx +1 -1
  165. package/docs/docs/cmd/teams/app/app-install.mdx +21 -0
  166. package/docs/docs/cmd/teams/app/app-list.mdx +19 -0
  167. package/docs/docs/cmd/teams/app/app-publish.mdx +17 -0
  168. package/docs/docs/cmd/teams/app/app-remove.mdx +19 -0
  169. package/docs/docs/cmd/teams/app/app-uninstall.mdx +21 -0
  170. package/docs/docs/cmd/teams/app/app-update.mdx +19 -0
  171. package/docs/docs/cmd/tenant/people/people-profilecardproperty-add.mdx +19 -0
  172. package/docs/docs/cmd/tenant/people/people-profilecardproperty-get.mdx +19 -0
  173. package/docs/docs/cmd/tenant/people/people-profilecardproperty-list.mdx +19 -0
  174. package/docs/docs/cmd/tenant/people/people-profilecardproperty-remove.mdx +19 -0
  175. package/docs/docs/cmd/tenant/people/people-profilecardproperty-set.mdx +19 -0
  176. package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-health-get.mdx +19 -0
  177. package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-health-list.mdx +19 -0
  178. package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-healthissue-get.mdx +19 -0
  179. package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-healthissue-list.mdx +19 -0
  180. package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-message-get.mdx +19 -0
  181. package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-message-list.mdx +19 -0
  182. package/docs/docs/cmd/viva/engage/engage-message-add.mdx +17 -0
  183. package/docs/docs/cmd/viva/engage/engage-message-get.mdx +17 -0
  184. package/docs/docs/cmd/viva/engage/engage-message-list.mdx +17 -0
  185. package/docs/docs/cmd/viva/engage/engage-message-remove.mdx +19 -0
  186. package/npm-shrinkwrap.json +1120 -3216
  187. package/package.json +24 -38
  188. package/dist/appInsights.js +0 -43
package/dist/Auth.js CHANGED
@@ -262,7 +262,7 @@ export class Auth {
262
262
  return {
263
263
  auth: authConfig,
264
264
  cache: {
265
- cachePlugin: msalCachePlugin
265
+ cachePlugin: await msalCachePlugin.getCachePlugin()
266
266
  },
267
267
  system: {
268
268
  loggerOptions: {
@@ -735,8 +735,7 @@ export class Auth {
735
735
  await allConnectionsStorage.remove();
736
736
  // we need to manually clear MSAL cache, because MSAL doesn't have support
737
737
  // for logging out when using cert-based auth
738
- const msalCache = this.getMsalCacheStorage();
739
- await msalCache.remove();
738
+ await msalCachePlugin.clearMsalCache();
740
739
  }
741
740
  async removeConnectionInfo(connection, logger, debug) {
742
741
  const allConnections = await this.getAllConnections();
@@ -769,9 +768,6 @@ export class Auth {
769
768
  getConnectionStorage() {
770
769
  return new FileTokenStorage(FileTokenStorage.connectionInfoFilePath());
771
770
  }
772
- getMsalCacheStorage() {
773
- return new FileTokenStorage(FileTokenStorage.msalCacheFilePath());
774
- }
775
771
  getAllConnectionsStorage() {
776
772
  return new FileTokenStorage(FileTokenStorage.allConnectionsFilePath());
777
773
  }
@@ -2,9 +2,6 @@ import fs from 'fs';
2
2
  import os from 'os';
3
3
  import path from 'path';
4
4
  export class FileTokenStorage {
5
- static msalCacheFilePath() {
6
- return path.join(os.homedir(), '.cli-m365-msal.json');
7
- }
8
5
  static connectionInfoFilePath() {
9
6
  return path.join(os.homedir(), '.cli-m365-connection.json');
10
7
  }
@@ -1,29 +1,218 @@
1
- import { FileTokenStorage } from './FileTokenStorage.js';
2
- class MsalCachePlugin {
3
- constructor() {
4
- this.fileTokenStorage = new FileTokenStorage(FileTokenStorage.msalCacheFilePath());
1
+ import fs from 'fs';
2
+ import os from 'os';
3
+ import path from 'path';
4
+ import { lock } from 'proper-lockfile';
5
+ const legacyCachePath = path.join(os.homedir(), '.cli-m365-msal.json');
6
+ const fallbackCachePath = path.join(os.homedir(), '.cli-m365-msal-cache.json');
7
+ const lockRetryCount = 500;
8
+ const lockRetryDelay = 100;
9
+ const staleLockThreshold = 10000;
10
+ const persistenceConfiguration = {
11
+ cachePath: fallbackCachePath,
12
+ serviceName: 'cli-microsoft365',
13
+ accountName: 'msal-cache',
14
+ usePlaintextFileOnLinux: true
15
+ };
16
+ export const fileLock = { lock };
17
+ let _initPromise;
18
+ // Fallback ICachePlugin that stores tokens as plain JSON on disk.
19
+ // @azure/msal-node-extensions ships a usePlaintextFileOnLinux option
20
+ // for Linux systems without libsecret, but the package's barrel export
21
+ // eagerly loads LibSecretPersistence which does `import keytar` at the
22
+ // top level. When libsecret is missing, the entire dynamic import of
23
+ // the package fails before any fallback logic can run. This class
24
+ // provides equivalent file-based persistence without depending on the
25
+ // package at all.
26
+ // See: https://github.com/AzureAD/microsoft-authentication-library-for-js/issues/7170
27
+ class FileCachePlugin {
28
+ constructor(cachePath) {
29
+ this.cachePath = cachePath;
5
30
  }
6
31
  async beforeCacheAccess(tokenCacheContext) {
32
+ await this.acquireLock();
7
33
  try {
8
- const data = await this.fileTokenStorage.get();
9
- tokenCacheContext.tokenCache.deserialize(data);
34
+ if (fs.existsSync(this.cachePath)) {
35
+ const data = fs.readFileSync(this.cachePath, 'utf8');
36
+ tokenCacheContext.tokenCache.deserialize(data);
37
+ }
10
38
  }
11
39
  catch {
12
40
  // Do nothing
13
41
  }
14
42
  }
15
43
  async afterCacheAccess(tokenCacheContext) {
16
- if (!tokenCacheContext.cacheHasChanged) {
17
- return;
18
- }
19
44
  try {
20
- await this.fileTokenStorage.set(tokenCacheContext.tokenCache.serialize());
45
+ if (tokenCacheContext.cacheHasChanged) {
46
+ if (fs.existsSync(this.cachePath)) {
47
+ fs.chmodSync(this.cachePath, 0o600);
48
+ }
49
+ fs.writeFileSync(this.cachePath, tokenCacheContext.tokenCache.serialize(), { encoding: 'utf8', mode: 0o600 });
50
+ }
21
51
  }
22
52
  catch {
23
53
  // Do nothing
24
54
  }
55
+ finally {
56
+ await this.releaseLock();
57
+ }
58
+ }
59
+ async clearCache() {
60
+ await this.acquireLock();
61
+ try {
62
+ removeFile(this.cachePath);
63
+ }
64
+ finally {
65
+ await this.releaseLock();
66
+ }
67
+ }
68
+ async acquireLock() {
69
+ this.releaseCacheLock = await msalCachePlugin.acquireFileLock(this.cachePath);
70
+ }
71
+ async releaseLock() {
72
+ if (this.releaseCacheLock === undefined) {
73
+ return;
74
+ }
75
+ const releaseCacheLock = this.releaseCacheLock;
76
+ this.releaseCacheLock = undefined;
77
+ await releaseCacheLock();
78
+ }
79
+ }
80
+ class LockingCachePlugin {
81
+ constructor(plugin, lockPath) {
82
+ this.plugin = plugin;
83
+ this.lockPath = lockPath;
84
+ }
85
+ async beforeCacheAccess(tokenCacheContext) {
86
+ this.releaseCacheLock = await msalCachePlugin.acquireFileLock(this.lockPath);
87
+ try {
88
+ await this.plugin.beforeCacheAccess(tokenCacheContext);
89
+ }
90
+ catch (err) {
91
+ await this.releaseLock();
92
+ throw err;
93
+ }
94
+ }
95
+ async afterCacheAccess(tokenCacheContext) {
96
+ try {
97
+ await this.plugin.afterCacheAccess(tokenCacheContext);
98
+ }
99
+ finally {
100
+ await this.releaseLock();
101
+ }
102
+ }
103
+ async clearCache(clearCache) {
104
+ this.releaseCacheLock = await msalCachePlugin.acquireFileLock(this.lockPath);
105
+ try {
106
+ await clearCache();
107
+ }
108
+ finally {
109
+ await this.releaseLock();
110
+ }
111
+ }
112
+ async releaseLock() {
113
+ if (this.releaseCacheLock === undefined) {
114
+ return;
115
+ }
116
+ const releaseCacheLock = this.releaseCacheLock;
117
+ this.releaseCacheLock = undefined;
118
+ await releaseCacheLock();
25
119
  }
26
120
  }
27
- const msalCachePlugin = new MsalCachePlugin();
28
- export { msalCachePlugin };
121
+ function removeFile(filePath) {
122
+ try {
123
+ fs.unlinkSync(filePath);
124
+ }
125
+ catch (err) {
126
+ if (err.code !== 'ENOENT') {
127
+ throw err;
128
+ }
129
+ }
130
+ }
131
+ export const msalCachePlugin = {
132
+ async acquireFileLock(cachePath) {
133
+ return await fileLock.lock(cachePath, {
134
+ lockfilePath: `${cachePath}.lockfile`,
135
+ realpath: false,
136
+ stale: staleLockThreshold,
137
+ update: staleLockThreshold / 2,
138
+ retries: {
139
+ retries: lockRetryCount,
140
+ factor: 1,
141
+ minTimeout: lockRetryDelay,
142
+ maxTimeout: lockRetryDelay,
143
+ randomize: false
144
+ }
145
+ });
146
+ },
147
+ async importMsalExtensions() {
148
+ return await import('@azure/msal-node-extensions');
149
+ },
150
+ async createNativePersistence() {
151
+ const { DataProtectionScope, PersistenceCachePlugin, PersistenceCreator } = await msalCachePlugin.importMsalExtensions();
152
+ const persistence = await PersistenceCreator.createPersistence({
153
+ ...persistenceConfiguration,
154
+ dataProtectionScope: DataProtectionScope.CurrentUser
155
+ });
156
+ const plugin = new LockingCachePlugin(new PersistenceCachePlugin(persistence), `${persistence.getFilePath()}.cli-m365`);
157
+ return {
158
+ plugin,
159
+ clearCache: async () => { await plugin.clearCache(async () => { await persistence.delete(); }); },
160
+ isFileFallback: false
161
+ };
162
+ },
163
+ createFileFallback() {
164
+ const plugin = new FileCachePlugin(persistenceConfiguration.cachePath);
165
+ return {
166
+ plugin,
167
+ clearCache: async () => { await plugin.clearCache(); },
168
+ isFileFallback: true
169
+ };
170
+ },
171
+ removeLegacyCache() {
172
+ removeFile(legacyCachePath);
173
+ },
174
+ async getCachePlugin() {
175
+ _initPromise ?? (_initPromise = (async () => {
176
+ msalCachePlugin.removeLegacyCache();
177
+ try {
178
+ return await msalCachePlugin.createNativePersistence();
179
+ }
180
+ catch (err) {
181
+ // Fall back to file-based cache only on Linux where libsecret
182
+ // may not be installed. On Windows (DPAPI) and macOS (Keychain)
183
+ // native persistence should always work.
184
+ if (process.platform === 'linux') {
185
+ return msalCachePlugin.createFileFallback();
186
+ }
187
+ throw err;
188
+ }
189
+ })());
190
+ const { plugin } = await _initPromise;
191
+ return plugin;
192
+ },
193
+ async clearMsalCache() {
194
+ _initPromise ?? (_initPromise = (async () => {
195
+ msalCachePlugin.removeLegacyCache();
196
+ try {
197
+ return await msalCachePlugin.createNativePersistence();
198
+ }
199
+ catch (err) {
200
+ if (process.platform === 'linux') {
201
+ return msalCachePlugin.createFileFallback();
202
+ }
203
+ throw err;
204
+ }
205
+ })());
206
+ const { clearCache, isFileFallback } = await _initPromise;
207
+ await clearCache();
208
+ // Also remove the file-based fallback cache to ensure no tokens
209
+ // remain if the machine previously used file-based persistence
210
+ if (!isFileFallback) {
211
+ await msalCachePlugin.createFileFallback().clearCache();
212
+ }
213
+ },
214
+ resetForTesting() {
215
+ _initPromise = undefined;
216
+ }
217
+ };
29
218
  //# sourceMappingURL=msalCachePlugin.js.map
@@ -0,0 +1,96 @@
1
+ import Axios from 'axios';
2
+ import Configstore from 'configstore';
3
+ import crypto from 'crypto';
4
+ import fs from 'fs';
5
+ import os from 'os';
6
+ import path from 'path';
7
+ import url from 'url';
8
+ import config from './config.js';
9
+ import { app } from './utils/app.js';
10
+ const measurementId = 'G-4BNT8MQCYT';
11
+ const apiSecret = 'mm_3WD_TRuO-9MKsuZnhDQ';
12
+ const endpoint = 'https://www.google-analytics.com/mp/collect';
13
+ const clientIdSetting = 'telemetryClientId';
14
+ const requestTimeout = 3000;
15
+ const __dirname = url.fileURLToPath(new URL('.', import.meta.url));
16
+ const commonProperties = {
17
+ version: `${app.packageJson().version}${fs.existsSync(path.join(__dirname, `..${path.sep}src`)) ? '-dev' : ''}`,
18
+ node: process.version,
19
+ os: os.platform(),
20
+ env: process.env.CLIMICROSOFT365_ENV ?? '',
21
+ ci: Boolean(process.env.CI).toString()
22
+ };
23
+ function getClientId() {
24
+ const store = new Configstore(config.configstoreName);
25
+ let clientId = store.get(clientIdSetting);
26
+ if (!clientId) {
27
+ clientId = crypto.randomUUID();
28
+ store.set(clientIdSetting, clientId);
29
+ }
30
+ return clientId;
31
+ }
32
+ function getSessionId(sessionId) {
33
+ return parseInt(crypto.createHash('sha256').update(sessionId).digest('hex').substring(0, 12), 16);
34
+ }
35
+ function toEventValue(value) {
36
+ if (typeof value === 'number') {
37
+ return value;
38
+ }
39
+ return String(value);
40
+ }
41
+ function getEvents(commandName, properties, context) {
42
+ const sessionId = getSessionId(context.sessionId);
43
+ const eventProperties = Object.entries(properties).reduce((result, [name, value]) => {
44
+ if (typeof value !== 'undefined') {
45
+ result[name] = toEventValue(value);
46
+ }
47
+ return result;
48
+ }, {});
49
+ return [{
50
+ name: 'command_used',
51
+ params: {
52
+ ['command_name']: commandName,
53
+ ...commonProperties,
54
+ shell: context.shell,
55
+ ...eventProperties,
56
+ ['session_id']: sessionId,
57
+ ['engagement_time_msec']: 1
58
+ }
59
+ }];
60
+ }
61
+ async function sendEvents(events) {
62
+ const clientId = getClientId();
63
+ const response = await Axios.post(`${endpoint}?measurement_id=${measurementId}&api_secret=${apiSecret}`, {
64
+ ['client_id']: clientId,
65
+ events
66
+ }, {
67
+ headers: {
68
+ 'Content-Type': 'application/json'
69
+ },
70
+ timeout: requestTimeout,
71
+ validateStatus: () => true
72
+ });
73
+ if (response.status < 200 || response.status >= 300) {
74
+ throw new Error(`Google Analytics returned ${response.status}`);
75
+ }
76
+ }
77
+ export const googleAnalytics = {
78
+ commonProperties,
79
+ trackEvent: async (commandName, properties, context) => {
80
+ await sendEvents(getEvents(commandName, properties, context));
81
+ },
82
+ trackException: async (exception, context) => {
83
+ const description = exception instanceof Error ? exception.message : String(exception);
84
+ await sendEvents([{
85
+ name: 'exception',
86
+ params: {
87
+ description: description.substring(0, 100),
88
+ ...commonProperties,
89
+ shell: context.shell,
90
+ ['session_id']: getSessionId(context.sessionId),
91
+ ['engagement_time_msec']: 1
92
+ }
93
+ }]);
94
+ }
95
+ };
96
+ //# sourceMappingURL=googleAnalytics.js.map
@@ -16,7 +16,6 @@ class LogoutCommand extends Command {
16
16
  if (this.verbose) {
17
17
  await logger.logToStderr('Logging out from Microsoft 365...');
18
18
  }
19
- const deactivate = () => auth.connection.deactivate();
20
19
  try {
21
20
  await auth.clearConnectionInfo();
22
21
  }
@@ -24,10 +23,9 @@ class LogoutCommand extends Command {
24
23
  if (this.debug) {
25
24
  await logger.logToStderr(new CommandError(error));
26
25
  }
26
+ throw new CommandError(error);
27
27
  }
28
- finally {
29
- deactivate();
30
- }
28
+ auth.connection.deactivate();
31
29
  }
32
30
  async action(logger, args) {
33
31
  try {
@@ -49,7 +49,7 @@ class EntraM365GroupRemoveCommand extends GraphCommand {
49
49
  const spoAdminUrl = await spo.getSpoAdminUrl(logger, this.debug);
50
50
  // Delete the Microsoft 365 group site. This operation will also delete the group.
51
51
  await this.deleteM365GroupSite(logger, siteUrl, spoAdminUrl);
52
- if (args.options.skipRecycleBin) {
52
+ if (args.options.permanent) {
53
53
  await this.deleteM365GroupFromRecycleBin(logger, groupId);
54
54
  await this.deleteSiteFromRecycleBin(logger, siteUrl, spoAdminUrl);
55
55
  }
@@ -169,7 +169,7 @@ _EntraM365GroupRemoveCommand_instances = new WeakSet(), _EntraM365GroupRemoveCom
169
169
  this.telemetry.push((args) => {
170
170
  Object.assign(this.telemetryProperties, {
171
171
  force: (!(!args.options.force)).toString(),
172
- skipRecycleBin: args.options.skipRecycleBin
172
+ permanent: !!args.options.permanent
173
173
  });
174
174
  });
175
175
  }, _EntraM365GroupRemoveCommand_initOptions = function _EntraM365GroupRemoveCommand_initOptions() {
@@ -180,7 +180,7 @@ _EntraM365GroupRemoveCommand_instances = new WeakSet(), _EntraM365GroupRemoveCom
180
180
  }, {
181
181
  option: '-f, --force'
182
182
  }, {
183
- option: '--skipRecycleBin'
183
+ option: '--permanent'
184
184
  });
185
185
  }, _EntraM365GroupRemoveCommand_initValidators = function _EntraM365GroupRemoveCommand_initValidators() {
186
186
  this.validators.push(async (args) => {
@@ -193,6 +193,7 @@ _EntraM365GroupRemoveCommand_instances = new WeakSet(), _EntraM365GroupRemoveCom
193
193
  this.optionSets.push({ options: ['id', 'displayName'] });
194
194
  }, _EntraM365GroupRemoveCommand_initTypes = function _EntraM365GroupRemoveCommand_initTypes() {
195
195
  this.types.string.push('id', 'displayName');
196
+ this.types.boolean.push('permanent');
196
197
  };
197
198
  EntraM365GroupRemoveCommand.maxRetries = 10;
198
199
  export default new EntraM365GroupRemoveCommand();
@@ -11,7 +11,7 @@ export const options = z.strictObject({
11
11
  name: z.string().optional().alias('n'),
12
12
  containerTypeId: z.uuid().optional(),
13
13
  containerTypeName: z.string().optional(),
14
- recycle: z.boolean().optional(),
14
+ permanent: z.boolean().optional(),
15
15
  force: z.boolean().optional().alias('f')
16
16
  });
17
17
  class SpeContainerRemoveCommand extends GraphCommand {
@@ -46,7 +46,7 @@ class SpeContainerRemoveCommand extends GraphCommand {
46
46
  }
47
47
  async commandAction(logger, args) {
48
48
  if (!args.options.force) {
49
- const result = await cli.promptForConfirmation({ message: `Are you sure you want to remove container '${args.options.id || args.options.name}'${!args.options.recycle ? ' permanently' : ''}?` });
49
+ const result = await cli.promptForConfirmation({ message: `Are you sure you want to ${args.options.permanent ? 'permanently remove' : 'recycle'} container '${args.options.id || args.options.name}'?` });
50
50
  if (!result) {
51
51
  return;
52
52
  }
@@ -63,13 +63,12 @@ class SpeContainerRemoveCommand extends GraphCommand {
63
63
  },
64
64
  responseType: 'json'
65
65
  };
66
- if (args.options.recycle) {
67
- await request.delete(requestOptions);
66
+ if (args.options.permanent) {
67
+ requestOptions.url += '/permanentDelete';
68
+ await request.post(requestOptions);
68
69
  return;
69
70
  }
70
- // Container should be permanently deleted
71
- requestOptions.url += '/permanentDelete';
72
- await request.post(requestOptions);
71
+ await request.delete(requestOptions);
73
72
  }
74
73
  catch (err) {
75
74
  this.handleRejectedODataJsonPromise(err);
@@ -653,6 +653,21 @@ export const versions = {
653
653
  range: '^4 || ^5 || ^6 || ^7',
654
654
  fix: 'npm i -g yo@7'
655
655
  }
656
+ },
657
+ '1.24.0-rc.0': {
658
+ heft: {
659
+ range: '^1',
660
+ fix: 'npm i -g @rushstack/heft@1'
661
+ },
662
+ node: {
663
+ range: '>=22.14.0 <23.0.0 || >=24.0.0 <25.0.0 || >=26.0.0 <27.0.0',
664
+ fix: 'Install Node.js >=22.14.0 <23.0.0 || >=24.0.0 <25.0.0 || >=26.0.0 <27.0.0'
665
+ },
666
+ sp: SharePointVersion.SPO,
667
+ yo: {
668
+ range: '^4 || ^5 || ^6 || ^7',
669
+ fix: 'npm i -g yo@7'
670
+ }
656
671
  }
657
672
  };
658
673
  //# sourceMappingURL=SpfxCompatibilityMatrix.js.map
@@ -0,0 +1,19 @@
1
+ import { FN001008_DEP_react } from './rules/FN001008_DEP_react.js';
2
+ import { FN001009_DEP_react_dom } from './rules/FN001009_DEP_react_dom.js';
3
+ import { FN001035_DEP_fluentui_react } from './rules/FN001035_DEP_fluentui_react.js';
4
+ import { FN002013_DEVDEP_types_webpack_env } from './rules/FN002013_DEVDEP_types_webpack_env.js';
5
+ import { FN002015_DEVDEP_types_react } from './rules/FN002015_DEVDEP_types_react.js';
6
+ import { FN002016_DEVDEP_types_react_dom } from './rules/FN002016_DEVDEP_types_react_dom.js';
7
+ import { FN002022_DEVDEP_typescript } from './rules/FN002022_DEVDEP_typescript.js';
8
+ import { FN021001_PKG_spfx_deps_versions_match_project_version } from './rules/FN021001_PKG_spfx_deps_versions_match_project_version.js';
9
+ export default [
10
+ new FN001008_DEP_react({ supportedRange: '18' }),
11
+ new FN001009_DEP_react_dom({ supportedRange: '18' }),
12
+ new FN001035_DEP_fluentui_react({ supportedRange: '^8.106.4' }),
13
+ new FN002013_DEVDEP_types_webpack_env({ supportedRange: '~1.15.2' }),
14
+ new FN002015_DEVDEP_types_react({ supportedRange: '18' }),
15
+ new FN002016_DEVDEP_types_react_dom({ supportedRange: '18' }),
16
+ new FN002022_DEVDEP_typescript({ supportedRange: '~5.8.0' }),
17
+ new FN021001_PKG_spfx_deps_versions_match_project_version({ includeDevDeps: true })
18
+ ];
19
+ //# sourceMappingURL=doctor-1.24.0-rc.0.js.map
@@ -78,7 +78,8 @@ class SpfxProjectDoctorCommand extends BaseProjectCommand {
78
78
  '1.22.1',
79
79
  '1.22.2',
80
80
  '1.23.0',
81
- '1.23.2'
81
+ '1.23.2',
82
+ '1.24.0-rc.0'
82
83
  ];
83
84
  __classPrivateFieldGet(this, _SpfxProjectDoctorCommand_instances, "m", _SpfxProjectDoctorCommand_initTelemetry).call(this);
84
85
  __classPrivateFieldGet(this, _SpfxProjectDoctorCommand_instances, "m", _SpfxProjectDoctorCommand_initOptions).call(this);
@@ -0,0 +1,43 @@
1
+ import { JsonRule } from '../../JsonRule.js';
2
+ export class FN012021_TSC_excludeDirectories extends JsonRule {
3
+ constructor(options) {
4
+ super();
5
+ this.directories = options.directories;
6
+ }
7
+ get id() {
8
+ return 'FN012021';
9
+ }
10
+ get title() {
11
+ return 'tsconfig.json watchOptions.excludeDirectories property';
12
+ }
13
+ get description() {
14
+ return `Update tsconfig.json watchOptions.excludeDirectories property`;
15
+ }
16
+ get resolution() {
17
+ return `{
18
+ "watchOptions": {
19
+ "excludeDirectories": ${JSON.stringify(this.directories)}
20
+ }
21
+ }`;
22
+ }
23
+ get resolutionType() {
24
+ return 'json';
25
+ }
26
+ get severity() {
27
+ return 'Required';
28
+ }
29
+ get file() {
30
+ return './tsconfig.json';
31
+ }
32
+ visit(project, findings) {
33
+ if (!project.tsConfigJson) {
34
+ return;
35
+ }
36
+ if (!project.tsConfigJson.watchOptions?.excludeDirectories ||
37
+ JSON.stringify(project.tsConfigJson.watchOptions.excludeDirectories) !== JSON.stringify(this.directories)) {
38
+ const node = this.getAstNodeFromFile(project.tsConfigJson, 'watchOptions.excludeDirectories');
39
+ this.addFindingWithPosition(findings, node);
40
+ }
41
+ }
42
+ }
43
+ //# sourceMappingURL=FN012021_TSC_excludeDirectories.js.map
@@ -0,0 +1,33 @@
1
+ import { DependencyRule } from "./DependencyRule.js";
2
+ export class FN027002_OVERRIDES_qs extends DependencyRule {
3
+ constructor(options) {
4
+ super({ packageName: 'qs', packageVersion: options.version, isOverride: true });
5
+ }
6
+ get id() {
7
+ return 'FN027002';
8
+ }
9
+ visit(project, findings) {
10
+ // If an override entry for the package already exists in package.json,
11
+ // emit an extra finding to remove the existing override first. This avoids
12
+ // having to use a separate remove-override rule (e.g. FN027002) in the upgrade scripts.
13
+ if (project.packageJson?.overrides?.[this.packageName] &&
14
+ project.packageJson.overrides[this.packageName] !== this.packageVersion) {
15
+ const node = this.getAstNodeFromFile(project.packageJson, `overrides.${this.packageName}`);
16
+ findings.push({
17
+ id: `${this.id}_REMOVE`,
18
+ title: this.packageName,
19
+ description: `Remove existing SharePoint Framework override dependency package ${this.packageName}`,
20
+ occurrences: [{
21
+ file: this.file,
22
+ resolution: `removeOverride overrides.${this.packageName}`,
23
+ position: this.getPositionFromNode(node)
24
+ }],
25
+ resolutionType: 'cmd',
26
+ severity: 'Required',
27
+ supersedes: []
28
+ });
29
+ }
30
+ super.visit(project, findings);
31
+ }
32
+ }
33
+ //# sourceMappingURL=FN027002_OVERRIDES_qs.js.map
@@ -0,0 +1,33 @@
1
+ import { DependencyRule } from "./DependencyRule.js";
2
+ export class FN027003_OVERRIDES_uuid extends DependencyRule {
3
+ constructor(options) {
4
+ super({ packageName: 'uuid', packageVersion: options.version, isOverride: true });
5
+ }
6
+ get id() {
7
+ return 'FN027003';
8
+ }
9
+ visit(project, findings) {
10
+ // If an override entry for the package already exists in package.json,
11
+ // emit an extra finding to remove the existing override first. This avoids
12
+ // having to use a separate remove-override rule (e.g. FN027003) in the upgrade scripts.
13
+ if (project.packageJson?.overrides?.[this.packageName] &&
14
+ project.packageJson.overrides[this.packageName] !== this.packageVersion) {
15
+ const node = this.getAstNodeFromFile(project.packageJson, `overrides.${this.packageName}`);
16
+ findings.push({
17
+ id: `${this.id}_REMOVE`,
18
+ title: this.packageName,
19
+ description: `Remove existing SharePoint Framework override dependency package ${this.packageName}`,
20
+ occurrences: [{
21
+ file: this.file,
22
+ resolution: `removeOverride overrides.${this.packageName}`,
23
+ position: this.getPositionFromNode(node)
24
+ }],
25
+ resolutionType: 'cmd',
26
+ severity: 'Required',
27
+ supersedes: []
28
+ });
29
+ }
30
+ super.visit(project, findings);
31
+ }
32
+ }
33
+ //# sourceMappingURL=FN027003_OVERRIDES_uuid.js.map