@pnp/cli-microsoft365 10.4.0-beta.c93f9cd → 10.5.0-beta.395d550

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/Command.js CHANGED
@@ -335,7 +335,7 @@ class Command {
335
335
  if (this.debug && auth.connection.identityName !== undefined) {
336
336
  await logger.logToStderr(`Executing command as '${auth.connection.identityName}', appId: ${auth.connection.appId}, tenantId: ${auth.connection.identityTenantId}`);
337
337
  }
338
- telemetry.trackEvent(this.getUsedCommandName(), this.getTelemetryProperties(args));
338
+ await telemetry.trackEvent(this.getUsedCommandName(), this.getTelemetryProperties(args));
339
339
  }
340
340
  getUnknownOptions(options) {
341
341
  const unknownOptions = JSON.parse(JSON.stringify(options));
@@ -3,6 +3,8 @@
3
3
  process.env.APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL = 'none';
4
4
  // prevents tests from hanging
5
5
  process.env.APPLICATION_INSIGHTS_NO_STATSBEAT = 'true';
6
+ // suppress all logging
7
+ process.env.APPLICATIONINSIGHTS_INSTRUMENTATION_LOGGING_LEVEL = 'NONE';
6
8
  import * as appInsights from 'applicationinsights';
7
9
  import crypto from 'crypto';
8
10
  import fs from 'fs';
package/dist/cli/cli.js CHANGED
@@ -627,7 +627,7 @@ async function printHelp(helpMode, exitCode = 0) {
627
627
  properties.command = 'commandList';
628
628
  cli.printAvailableCommands();
629
629
  }
630
- telemetry.trackEvent('help', properties);
630
+ await telemetry.trackEvent('help', properties);
631
631
  process.exit(exitCode);
632
632
  }
633
633
  async function openHelpInBrowser() {
package/dist/telemetry.js CHANGED
@@ -1,33 +1,37 @@
1
- import child_process from 'child_process';
2
- import path from 'path';
3
- import url from 'url';
1
+ import appInsights from './appInsights.js';
4
2
  import { cli } from './cli/cli.js';
5
3
  import { settingsNames } from './settingsNames.js';
6
4
  import { pid } from './utils/pid.js';
7
5
  import { session } from './utils/session.js';
8
- const __dirname = url.fileURLToPath(new URL('.', import.meta.url));
9
- function trackTelemetry(object) {
6
+ async function trackTelemetry(object) {
10
7
  try {
11
- const child = child_process.spawn('node', [path.join(__dirname, 'telemetryRunner.js')], {
12
- stdio: ['pipe', 'ignore', 'ignore'],
13
- detached: true
14
- });
15
- child.unref();
16
- object.shell = pid.getProcessName(process.ppid) || '';
17
- object.session = session.getId(process.ppid);
18
- child.stdin.write(JSON.stringify(object));
19
- child.stdin.end();
8
+ const { commandName, properties, exception } = object;
9
+ appInsights.commonProperties.shell = pid.getProcessName(process.ppid) || '';
10
+ appInsights.context.tags[appInsights.context.keys.sessionId] = session.getId(process.ppid);
11
+ if (exception) {
12
+ appInsights.trackException({
13
+ exception
14
+ });
15
+ }
16
+ else {
17
+ appInsights.trackEvent({
18
+ name: commandName,
19
+ properties
20
+ });
21
+ }
22
+ await appInsights.flush();
20
23
  }
21
24
  catch { }
22
25
  }
23
26
  export const telemetry = {
24
- trackEvent: (commandName, properties) => {
27
+ trackEvent: async (commandName, properties, exception) => {
25
28
  if (cli.getSettingWithDefaultValue(settingsNames.disableTelemetry, false)) {
26
29
  return;
27
30
  }
28
- trackTelemetry({
31
+ await trackTelemetry({
29
32
  commandName,
30
- properties
33
+ properties,
34
+ exception
31
35
  });
32
36
  }
33
37
  };
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@pnp/cli-microsoft365",
3
- "version": "10.4.0",
3
+ "version": "10.5.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@pnp/cli-microsoft365",
9
- "version": "10.4.0",
9
+ "version": "10.5.0",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@azure/msal-common": "^15.1.0",
@@ -55,7 +55,7 @@
55
55
  "@types/json-schema": "^7.0.15",
56
56
  "@types/json-to-ast": "^2.1.4",
57
57
  "@types/mocha": "^10.0.10",
58
- "@types/node": "^20.17.16",
58
+ "@types/node": "^22.13.4",
59
59
  "@types/node-forge": "^1.3.11",
60
60
  "@types/omelette": "^0.4.4",
61
61
  "@types/semver": "^7.5.8",
@@ -1880,11 +1880,12 @@
1880
1880
  }
1881
1881
  },
1882
1882
  "node_modules/@types/node": {
1883
- "version": "20.17.16",
1884
- "resolved": "https://registry.npmjs.org/@types/node/-/node-20.17.16.tgz",
1885
- "integrity": "sha512-vOTpLduLkZXePLxHiHsBLp98mHGnl8RptV4YAO3HfKO5UHjDvySGbxKtpYfy8Sx5+WKcgc45qNreJJRVM3L6mw==",
1883
+ "version": "22.13.4",
1884
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-22.13.4.tgz",
1885
+ "integrity": "sha512-ywP2X0DYtX3y08eFVx5fNIw7/uIv8hYUKgXoK8oayJlLnKcRfEYCxWMVE1XagUdVtCJlZT1AU4LXEABW+L1Peg==",
1886
+ "license": "MIT",
1886
1887
  "dependencies": {
1887
- "undici-types": "~6.19.2"
1888
+ "undici-types": "~6.20.0"
1888
1889
  }
1889
1890
  },
1890
1891
  "node_modules/@types/node-forge": {
@@ -5959,9 +5960,10 @@
5959
5960
  }
5960
5961
  },
5961
5962
  "node_modules/undici-types": {
5962
- "version": "6.19.8",
5963
- "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz",
5964
- "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw=="
5963
+ "version": "6.20.0",
5964
+ "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.20.0.tgz",
5965
+ "integrity": "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==",
5966
+ "license": "MIT"
5965
5967
  },
5966
5968
  "node_modules/update-notifier": {
5967
5969
  "version": "7.3.1",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pnp/cli-microsoft365",
3
- "version": "10.4.0-beta.c93f9cd",
3
+ "version": "10.5.0-beta.395d550",
4
4
  "description": "Manage Microsoft 365 and SharePoint Framework projects on any platform",
5
5
  "license": "MIT",
6
6
  "main": "./dist/api.js",
@@ -293,7 +293,7 @@
293
293
  "@types/json-schema": "^7.0.15",
294
294
  "@types/json-to-ast": "^2.1.4",
295
295
  "@types/mocha": "^10.0.10",
296
- "@types/node": "^20.17.16",
296
+ "@types/node": "^22.13.4",
297
297
  "@types/node-forge": "^1.3.11",
298
298
  "@types/omelette": "^0.4.4",
299
299
  "@types/semver": "^7.5.8",
@@ -1,26 +0,0 @@
1
- import appInsights from './appInsights.js';
2
- import * as process from 'process';
3
- import * as fs from 'fs';
4
- process.stdin.setEncoding('utf8');
5
- try {
6
- // read from stdin
7
- const input = fs.readFileSync(0, 'utf-8');
8
- const data = JSON.parse(input);
9
- const { commandName, properties, exception, shell, session } = data;
10
- appInsights.commonProperties.shell = shell;
11
- appInsights.context.tags[appInsights.context.keys.sessionId] = session;
12
- if (exception) {
13
- appInsights.trackException({
14
- exception
15
- });
16
- }
17
- else {
18
- appInsights.trackEvent({
19
- name: commandName,
20
- properties
21
- });
22
- }
23
- await appInsights.flush();
24
- }
25
- catch { }
26
- //# sourceMappingURL=telemetryRunner.js.map