@ms-cloudpack/cli 0.72.13 → 0.72.15

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 (46) hide show
  1. package/lib/commands/bundle/execute.js +1 -1
  2. package/lib/commands/bundle/execute.js.map +1 -1
  3. package/lib/commands/init/evaluatePath.d.ts +2 -2
  4. package/lib/commands/init/evaluatePath.d.ts.map +1 -1
  5. package/lib/commands/init/evaluatePath.js +2 -2
  6. package/lib/commands/init/evaluatePath.js.map +1 -1
  7. package/lib/commands/init/init.js +148 -146
  8. package/lib/commands/init/init.js.map +1 -1
  9. package/lib/commands/link/getSessionToLink.js +1 -1
  10. package/lib/commands/link/getSessionToLink.js.map +1 -1
  11. package/lib/commands/start/execute.d.ts.map +1 -1
  12. package/lib/commands/start/execute.js +14 -4
  13. package/lib/commands/start/execute.js.map +1 -1
  14. package/lib/commands/start/getStartingAppPath.d.ts +5 -2
  15. package/lib/commands/start/getStartingAppPath.d.ts.map +1 -1
  16. package/lib/commands/start/getStartingAppPath.js +36 -9
  17. package/lib/commands/start/getStartingAppPath.js.map +1 -1
  18. package/lib/commands/sync/execute.d.ts.map +1 -1
  19. package/lib/commands/sync/execute.js +35 -33
  20. package/lib/commands/sync/execute.js.map +1 -1
  21. package/lib/types/CommandAction.d.ts +8 -0
  22. package/lib/types/CommandAction.d.ts.map +1 -1
  23. package/lib/types/CommandAction.js.map +1 -1
  24. package/lib/utilities/CommandExecutor.d.ts +2 -0
  25. package/lib/utilities/CommandExecutor.d.ts.map +1 -1
  26. package/lib/utilities/CommandExecutor.js +19 -22
  27. package/lib/utilities/CommandExecutor.js.map +1 -1
  28. package/lib/utilities/runPrerequisites.js +1 -1
  29. package/lib/utilities/runPrerequisites.js.map +1 -1
  30. package/package.json +10 -10
  31. package/lib/commands/start/createPathToChoiceMap.d.ts +0 -16
  32. package/lib/commands/start/createPathToChoiceMap.d.ts.map +0 -1
  33. package/lib/commands/start/createPathToChoiceMap.js +0 -29
  34. package/lib/commands/start/createPathToChoiceMap.js.map +0 -1
  35. package/lib/commands/start/getAppPathFromUser.d.ts +0 -9
  36. package/lib/commands/start/getAppPathFromUser.d.ts.map +0 -1
  37. package/lib/commands/start/getAppPathFromUser.js +0 -28
  38. package/lib/commands/start/getAppPathFromUser.js.map +0 -1
  39. package/lib/commands/start/getMatchingApps.d.ts +0 -9
  40. package/lib/commands/start/getMatchingApps.d.ts.map +0 -1
  41. package/lib/commands/start/getMatchingApps.js +0 -10
  42. package/lib/commands/start/getMatchingApps.js.map +0 -1
  43. package/lib/performance/registerPerformanceObservers.d.ts +0 -7
  44. package/lib/performance/registerPerformanceObservers.d.ts.map +0 -1
  45. package/lib/performance/registerPerformanceObservers.js +0 -20
  46. package/lib/performance/registerPerformanceObservers.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"runPrerequisites.js","sourceRoot":"","sources":["../../src/utilities/runPrerequisites.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,aAAa,CAAC;AAEhC;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAIhC;IACC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC;IAErD,eAAe,CAAC,WAAW,CAAC,KAAK,CAAC,mBAAmB,EAAE,GAAG,EAAE;QAC1D,MAAM,SAAS,GAAG,MAAM,EAAE,SAAS,CAAC;QACpC,IAAI,SAAS,EAAE,CAAC;YACd,KAAK,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,SAAS,EAAE,CAAC;gBACxC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;YAC7E,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { CloudpackConfig } from '@ms-cloudpack/common-types';\nimport type { TelemetryClient } from '@ms-cloudpack/telemetry';\nimport spawn from 'cross-spawn';\n\n/**\n * Runs the pre-requisites specified in the given Cloudpack config\n * @param config - The Cloudpack config of containing a list of prerequisites to run\n */\nexport function runPrerequisites(options: {\n config: CloudpackConfig | undefined;\n appPath: string;\n telemetryClient: TelemetryClient;\n}) {\n const { config, appPath, telemetryClient } = options;\n\n telemetryClient.performance.track('RUN_PREREQUISITES', () => {\n const dependsOn = config?.dependsOn;\n if (dependsOn) {\n for (const [command, args] of dependsOn) {\n spawn.sync(command, args, { stdio: 'inherit', cwd: appPath, shell: true });\n }\n }\n });\n}\n"]}
1
+ {"version":3,"file":"runPrerequisites.js","sourceRoot":"","sources":["../../src/utilities/runPrerequisites.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,aAAa,CAAC;AAEhC;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAIhC;IACC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC;IAErD,eAAe,CAAC,MAAM,CAAC,eAAe,CAAC,mBAAmB,EAAE,GAAG,EAAE;QAC/D,MAAM,SAAS,GAAG,MAAM,EAAE,SAAS,CAAC;QACpC,IAAI,SAAS,EAAE,CAAC;YACd,KAAK,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,SAAS,EAAE,CAAC;gBACxC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;YAC7E,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { CloudpackConfig } from '@ms-cloudpack/common-types';\nimport type { TelemetryClient } from '@ms-cloudpack/telemetry';\nimport spawn from 'cross-spawn';\n\n/**\n * Runs the pre-requisites specified in the given Cloudpack config\n * @param config - The Cloudpack config of containing a list of prerequisites to run\n */\nexport function runPrerequisites(options: {\n config: CloudpackConfig | undefined;\n appPath: string;\n telemetryClient: TelemetryClient;\n}) {\n const { config, appPath, telemetryClient } = options;\n\n telemetryClient.tracer.startActiveSpan('RUN_PREREQUISITES', () => {\n const dependsOn = config?.dependsOn;\n if (dependsOn) {\n for (const [command, args] of dependsOn) {\n spawn.sync(command, args, { stdio: 'inherit', cwd: appPath, shell: true });\n }\n }\n });\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ms-cloudpack/cli",
3
- "version": "0.72.13",
3
+ "version": "0.72.15",
4
4
  "description": "The Cloudpack command line interface - a tool for managing fast inner and outer looping in web apps.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -10,20 +10,20 @@
10
10
  "cloudpack": "./bin/cloudpack.js"
11
11
  },
12
12
  "dependencies": {
13
- "@ms-cloudpack/api-server": "^0.56.1",
14
- "@ms-cloudpack/app-server": "^0.17.8",
15
- "@ms-cloudpack/bundler": "^0.23.11",
13
+ "@ms-cloudpack/api-server": "^0.56.3",
14
+ "@ms-cloudpack/app-server": "^0.17.10",
15
+ "@ms-cloudpack/bundler": "^0.23.13",
16
16
  "@ms-cloudpack/common-types": "^0.23.3",
17
- "@ms-cloudpack/config": "^0.32.0",
17
+ "@ms-cloudpack/config": "^0.32.1",
18
18
  "@ms-cloudpack/json-utilities": "^0.1.8",
19
- "@ms-cloudpack/overlay": "^0.17.89",
20
- "@ms-cloudpack/package-utilities": "^10.2.8",
19
+ "@ms-cloudpack/overlay": "^0.17.91",
20
+ "@ms-cloudpack/package-utilities": "^10.2.9",
21
21
  "@ms-cloudpack/path-string-parsing": "^1.2.4",
22
22
  "@ms-cloudpack/path-utilities": "^2.7.52",
23
- "@ms-cloudpack/remote-cache": "^0.9.5",
23
+ "@ms-cloudpack/remote-cache": "^0.9.7",
24
24
  "@ms-cloudpack/setup-utilities": "^0.5.1",
25
25
  "@ms-cloudpack/task-reporter": "^0.14.5",
26
- "@ms-cloudpack/telemetry": "^0.8.2",
26
+ "@ms-cloudpack/telemetry": "^0.9.1",
27
27
  "@yarnpkg/lockfile": "^1.1.0",
28
28
  "commander": "^11.1.0",
29
29
  "cross-spawn": "^7.0.3",
@@ -33,7 +33,7 @@
33
33
  "open": "^9.0.0",
34
34
  "prompts": "^2.4.2",
35
35
  "semver": "^7.6.0",
36
- "workspace-tools": "^0.37.0"
36
+ "workspace-tools": "^0.38.0"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@ms-cloudpack/common-types": "^0.23.3",
@@ -1,16 +0,0 @@
1
- import type { Choice } from 'prompts';
2
- /**
3
- *
4
- * @param appPaths (a array of app paths to Cloudpack-enabled apps)
5
- * @returns Promise<Map<string, ChoiceWithConfig>>
6
- * Create a map of app paths (paths to Cloudpack-enabled apps) to Choice objects.
7
- * Choice comes from prompts package and represents a menu choice
8
- * Example:
9
- * /path/to/awesome/app => {
10
- * title: 'awesome-app',
11
- * description: 'what a great app',
12
- * value: '/path/to/awesome/app'
13
- * }
14
- */
15
- export declare function createPathToChoiceMap(appPaths: string[]): Promise<Map<string, Choice>>;
16
- //# sourceMappingURL=createPathToChoiceMap.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createPathToChoiceMap.d.ts","sourceRoot":"","sources":["../../../src/commands/start/createPathToChoiceMap.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEtC;;;;;;;;;;;;GAYG;AACH,wBAAsB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,gCAiB7D"}
@@ -1,29 +0,0 @@
1
- import { PackageDefinitions } from '@ms-cloudpack/package-utilities';
2
- /**
3
- *
4
- * @param appPaths (a array of app paths to Cloudpack-enabled apps)
5
- * @returns Promise<Map<string, ChoiceWithConfig>>
6
- * Create a map of app paths (paths to Cloudpack-enabled apps) to Choice objects.
7
- * Choice comes from prompts package and represents a menu choice
8
- * Example:
9
- * /path/to/awesome/app => {
10
- * title: 'awesome-app',
11
- * description: 'what a great app',
12
- * value: '/path/to/awesome/app'
13
- * }
14
- */
15
- export async function createPathToChoiceMap(appPaths) {
16
- const packages = new PackageDefinitions();
17
- const availableApps = new Map();
18
- for (const dir of appPaths) {
19
- const pkg = await packages.get(dir);
20
- const choice = {
21
- title: pkg.name,
22
- description: pkg?.description ?? 'An awesome app that would be even more awesome with a proper description',
23
- value: dir,
24
- };
25
- availableApps.set(dir, choice);
26
- }
27
- return availableApps;
28
- }
29
- //# sourceMappingURL=createPathToChoiceMap.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createPathToChoiceMap.js","sourceRoot":"","sources":["../../../src/commands/start/createPathToChoiceMap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAGrE;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,QAAkB;IAC5D,MAAM,QAAQ,GAAG,IAAI,kBAAkB,EAAE,CAAC;IAC1C,MAAM,aAAa,GAAG,IAAI,GAAG,EAAkB,CAAC;IAEhD,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE,CAAC;QAC3B,MAAM,GAAG,GAAG,MAAM,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAEpC,MAAM,MAAM,GAAW;YACrB,KAAK,EAAE,GAAG,CAAC,IAAI;YACf,WAAW,EAAE,GAAG,EAAE,WAAW,IAAI,0EAA0E;YAC3G,KAAK,EAAE,GAAG;SACX,CAAC;QAEF,aAAa,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IACjC,CAAC;IAED,OAAO,aAAa,CAAC;AACvB,CAAC","sourcesContent":["import { PackageDefinitions } from '@ms-cloudpack/package-utilities';\nimport type { Choice } from 'prompts';\n\n/**\n *\n * @param appPaths (a array of app paths to Cloudpack-enabled apps)\n * @returns Promise<Map<string, ChoiceWithConfig>>\n * Create a map of app paths (paths to Cloudpack-enabled apps) to Choice objects.\n * Choice comes from prompts package and represents a menu choice\n * Example:\n * /path/to/awesome/app => {\n * title: 'awesome-app',\n * description: 'what a great app',\n * value: '/path/to/awesome/app'\n * }\n */\nexport async function createPathToChoiceMap(appPaths: string[]) {\n const packages = new PackageDefinitions();\n const availableApps = new Map<string, Choice>();\n\n for (const dir of appPaths) {\n const pkg = await packages.get(dir);\n\n const choice: Choice = {\n title: pkg.name,\n description: pkg?.description ?? 'An awesome app that would be even more awesome with a proper description',\n value: dir,\n };\n\n availableApps.set(dir, choice);\n }\n\n return availableApps;\n}\n"]}
@@ -1,9 +0,0 @@
1
- import { type Choice } from 'prompts';
2
- /**
3
- * Gets the app path from user (either implicitly, via command line arg or via menu if needed)
4
- * @param availableApps - a Map of app paths to Choice objects
5
- * @param app - the app (partial name ok) specified via --app arg
6
- * @returns Path to chosen app (could be via --app match or via menu selection)
7
- */
8
- export declare function getAppPathFromUser(availableApps: Map<string, Choice>, app: string | undefined): Promise<string>;
9
- //# sourceMappingURL=getAppPathFromUser.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getAppPathFromUser.d.ts","sourceRoot":"","sources":["../../../src/commands/start/getAppPathFromUser.ts"],"names":[],"mappings":"AAAA,OAAgB,EAAE,KAAK,MAAM,EAAE,MAAM,SAAS,CAAC;AAG/C;;;;;GAKG;AACH,wBAAsB,kBAAkB,CAAC,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,CAwBrH"}
@@ -1,28 +0,0 @@
1
- import prompts from 'prompts';
2
- import { getMatchingApps } from './getMatchingApps.js';
3
- /**
4
- * Gets the app path from user (either implicitly, via command line arg or via menu if needed)
5
- * @param availableApps - a Map of app paths to Choice objects
6
- * @param app - the app (partial name ok) specified via --app arg
7
- * @returns Path to chosen app (could be via --app match or via menu selection)
8
- */
9
- export async function getAppPathFromUser(availableApps, app) {
10
- const matchingApps = getMatchingApps(availableApps, app);
11
- if (matchingApps.length === 1) {
12
- return matchingApps[0].value;
13
- }
14
- const response = await prompts({
15
- type: 'select',
16
- name: 'value',
17
- message: 'Select the app you want to start',
18
- choices: [...availableApps.values()].sort((c1, c2) => c1.title.localeCompare(c2.title)),
19
- initial: 0,
20
- }, {
21
- onCancel: () => {
22
- console.log('Aborting...');
23
- process.exit(0);
24
- },
25
- });
26
- return response.value;
27
- }
28
- //# sourceMappingURL=getAppPathFromUser.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getAppPathFromUser.js","sourceRoot":"","sources":["../../../src/commands/start/getAppPathFromUser.ts"],"names":[],"mappings":"AAAA,OAAO,OAAwB,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,aAAkC,EAAE,GAAuB;IAClG,MAAM,YAAY,GAAG,eAAe,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC;IAEzD,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC9B,OAAO,YAAY,CAAC,CAAC,CAAC,CAAC,KAAe,CAAC;IACzC,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,OAAO,CAC5B;QACE,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,OAAO;QACb,OAAO,EAAE,kCAAkC;QAC3C,OAAO,EAAE,CAAC,GAAG,aAAa,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC,aAAa,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;QACvF,OAAO,EAAE,CAAC;KACX,EACD;QACE,QAAQ,EAAE,GAAG,EAAE;YACb,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;YAC3B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;KACF,CACF,CAAC;IAEF,OAAO,QAAQ,CAAC,KAAe,CAAC;AAClC,CAAC","sourcesContent":["import prompts, { type Choice } from 'prompts';\nimport { getMatchingApps } from './getMatchingApps.js';\n\n/**\n * Gets the app path from user (either implicitly, via command line arg or via menu if needed)\n * @param availableApps - a Map of app paths to Choice objects\n * @param app - the app (partial name ok) specified via --app arg\n * @returns Path to chosen app (could be via --app match or via menu selection)\n */\nexport async function getAppPathFromUser(availableApps: Map<string, Choice>, app: string | undefined): Promise<string> {\n const matchingApps = getMatchingApps(availableApps, app);\n\n if (matchingApps.length === 1) {\n return matchingApps[0].value as string;\n }\n\n const response = await prompts<string>(\n {\n type: 'select',\n name: 'value',\n message: 'Select the app you want to start',\n choices: [...availableApps.values()].sort((c1, c2) => c1.title.localeCompare(c2.title)),\n initial: 0,\n },\n {\n onCancel: () => {\n console.log('Aborting...');\n process.exit(0);\n },\n },\n );\n\n return response.value as string;\n}\n"]}
@@ -1,9 +0,0 @@
1
- import type { Choice } from 'prompts';
2
- /**
3
- *
4
- * @param availableApps - Map of app paths to Choice objects
5
- * @param app - The app specified from --app argument
6
- * @returns An array of app paths whose package.json name property matches (even partially) the --app arg
7
- */
8
- export declare function getMatchingApps(availableApps: Map<string, Choice>, app: string | undefined): Choice[];
9
- //# sourceMappingURL=getMatchingApps.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getMatchingApps.d.ts","sourceRoot":"","sources":["../../../src/commands/start/getMatchingApps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEtC;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,SAAS,YAE1F"}
@@ -1,10 +0,0 @@
1
- /**
2
- *
3
- * @param availableApps - Map of app paths to Choice objects
4
- * @param app - The app specified from --app argument
5
- * @returns An array of app paths whose package.json name property matches (even partially) the --app arg
6
- */
7
- export function getMatchingApps(availableApps, app) {
8
- return [...availableApps.values()].filter((choice) => choice.title?.includes(app ?? ''));
9
- }
10
- //# sourceMappingURL=getMatchingApps.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getMatchingApps.js","sourceRoot":"","sources":["../../../src/commands/start/getMatchingApps.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,aAAkC,EAAE,GAAuB;IACzF,OAAO,CAAC,GAAG,aAAa,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC,CAAC;AAC3F,CAAC","sourcesContent":["import type { Choice } from 'prompts';\n\n/**\n *\n * @param availableApps - Map of app paths to Choice objects\n * @param app - The app specified from --app argument\n * @returns An array of app paths whose package.json name property matches (even partially) the --app arg\n */\nexport function getMatchingApps(availableApps: Map<string, Choice>, app: string | undefined) {\n return [...availableApps.values()].filter((choice) => choice.title?.includes(app ?? ''));\n}\n"]}
@@ -1,7 +0,0 @@
1
- import type { TelemetryClient } from '@ms-cloudpack/telemetry';
2
- /**
3
- * Registers a performance observer that will log all performance measurements and markers to Application Insights.
4
- * @param span The span to add the events to.
5
- */
6
- export declare function registerPerformanceObservers(telemetryClient: TelemetryClient): void;
7
- //# sourceMappingURL=registerPerformanceObservers.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"registerPerformanceObservers.d.ts","sourceRoot":"","sources":["../../src/performance/registerPerformanceObservers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAG/D;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,eAAe,EAAE,eAAe,QAc5E"}
@@ -1,20 +0,0 @@
1
- import { PerformanceObserver } from 'perf_hooks';
2
- /**
3
- * Registers a performance observer that will log all performance measurements and markers to Application Insights.
4
- * @param span The span to add the events to.
5
- */
6
- export function registerPerformanceObservers(telemetryClient) {
7
- const perfMeasurementObserver = new PerformanceObserver((items) => {
8
- for (const { name, duration } of items.getEntries()) {
9
- telemetryClient.performance.record({ name, value: duration });
10
- }
11
- });
12
- perfMeasurementObserver.observe({ entryTypes: ['measure'] });
13
- const perfMarkObserver = new PerformanceObserver((items) => {
14
- for (const { name, startTime } of items.getEntries()) {
15
- telemetryClient.performance.record({ name, value: startTime });
16
- }
17
- });
18
- perfMarkObserver.observe({ entryTypes: ['mark'] });
19
- }
20
- //# sourceMappingURL=registerPerformanceObservers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"registerPerformanceObservers.js","sourceRoot":"","sources":["../../src/performance/registerPerformanceObservers.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEjD;;;GAGG;AACH,MAAM,UAAU,4BAA4B,CAAC,eAAgC;IAC3E,MAAM,uBAAuB,GAAG,IAAI,mBAAmB,CAAC,CAAC,KAAK,EAAE,EAAE;QAChE,KAAK,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,KAAK,CAAC,UAAU,EAAE,EAAE,CAAC;YACpD,eAAe,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;QAChE,CAAC;IACH,CAAC,CAAC,CAAC;IACH,uBAAuB,CAAC,OAAO,CAAC,EAAE,UAAU,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;IAE7D,MAAM,gBAAgB,GAAG,IAAI,mBAAmB,CAAC,CAAC,KAAK,EAAE,EAAE;QACzD,KAAK,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,KAAK,CAAC,UAAU,EAAE,EAAE,CAAC;YACrD,eAAe,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;QACjE,CAAC;IACH,CAAC,CAAC,CAAC;IACH,gBAAgB,CAAC,OAAO,CAAC,EAAE,UAAU,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AACrD,CAAC","sourcesContent":["import type { TelemetryClient } from '@ms-cloudpack/telemetry';\nimport { PerformanceObserver } from 'perf_hooks';\n\n/**\n * Registers a performance observer that will log all performance measurements and markers to Application Insights.\n * @param span The span to add the events to.\n */\nexport function registerPerformanceObservers(telemetryClient: TelemetryClient) {\n const perfMeasurementObserver = new PerformanceObserver((items) => {\n for (const { name, duration } of items.getEntries()) {\n telemetryClient.performance.record({ name, value: duration });\n }\n });\n perfMeasurementObserver.observe({ entryTypes: ['measure'] });\n\n const perfMarkObserver = new PerformanceObserver((items) => {\n for (const { name, startTime } of items.getEntries()) {\n telemetryClient.performance.record({ name, value: startTime });\n }\n });\n perfMarkObserver.observe({ entryTypes: ['mark'] });\n}\n"]}