From 4a22f25f6bb0d6acbd28d4c54d6c59fc0bae572f Mon Sep 17 00:00:00 2001 From: Nev <54870357+MSNev@users.noreply.github.com> Date: Fri, 6 Feb 2026 15:58:43 -0800 Subject: [PATCH 1/2] Phase 1: Initial Move to sync with OTel-Sdk structure (to keep file history) --- .../Tests/Unit/src/{Common => ai}/AppInsightsCommon.tests.ts | 0 .../Tests/Unit/src/{ => ai}/AppInsightsCoreSize.Tests.ts | 0 .../Tests/Unit/src/{ => ai}/ApplicationInsightsCore.Tests.ts | 0 .../Tests/Unit/src/{Common => ai}/ConnectionStringParser.tests.ts | 0 .../Tests/Unit/src/{ => ai}/CookieManager.Tests.ts | 0 .../AppInsightsCore/Tests/Unit/src/{ => ai}/EventHelper.Tests.ts | 0 .../Tests/Unit/src/{ => ai}/EventsDiscardedReason.Tests.ts | 0 .../Tests/Unit/src/{Common => ai}/Exception.tests.ts | 0 .../Tests/Unit/src/{ => ai}/GlobalTestHooks.Test.ts | 0 .../AppInsightsCore/Tests/Unit/src/{ => ai}/HelperFunc.Tests.ts | 0 .../AppInsightsCore/Tests/Unit/src/{ => ai}/LoggingEnum.Tests.ts | 0 .../Tests/Unit/src/{Common => ai}/RequestHeaders.tests.ts | 0 .../Tests/Unit/src/{ => ai}/SendPostManager.Tests.ts | 0 .../Tests/Unit/src/{Common => ai}/SeverityLevel.tests.ts | 0 shared/AppInsightsCore/Tests/Unit/src/{ => ai}/StatsBeat.Tests.ts | 0 shared/AppInsightsCore/Tests/Unit/src/{ => ai}/TestPlugins.ts | 0 .../Tests/Unit/src/{Common => ai}/ThrottleMgr.tests.ts | 0 .../AppInsightsCore/Tests/Unit/src/{ => ai}/UpdateConfig.Tests.ts | 0 .../AppInsightsCore/Tests/Unit/src/{Common => ai}/Util.tests.ts | 0 .../src/{OpenTelemetry => attribute}/attributeContainer.Tests.ts | 0 .../AppInsightsCore/Tests/Unit/src/{ => config}/Dynamic.Tests.ts | 0 .../Tests/Unit/src/{ => config}/DynamicConfig.Tests.ts | 0 .../Tests/Unit/src/{Common => trace}/W3CTraceStateModes.tests.ts | 0 .../Tests/Unit/src/{ => trace}/W3cTraceParentTests.ts | 0 .../src/{W3TraceState.Tests.ts => trace/W3cTraceState.Tests.ts} | 0 .../Tests/Unit/src/{OpenTelemetry => trace}/span.Tests.ts | 0 .../Tests/Unit/src/{OpenTelemetry => trace}/traceState.Tests.ts | 0 .../Tests/Unit/src/{OpenTelemetry => trace}/traceUtils.Tests.ts | 0 .../src/interfaces/{otel/IOTelException.ts => IException.ts} | 0 29 files changed, 0 insertions(+), 0 deletions(-) rename shared/AppInsightsCore/Tests/Unit/src/{Common => ai}/AppInsightsCommon.tests.ts (100%) rename shared/AppInsightsCore/Tests/Unit/src/{ => ai}/AppInsightsCoreSize.Tests.ts (100%) rename shared/AppInsightsCore/Tests/Unit/src/{ => ai}/ApplicationInsightsCore.Tests.ts (100%) rename shared/AppInsightsCore/Tests/Unit/src/{Common => ai}/ConnectionStringParser.tests.ts (100%) rename shared/AppInsightsCore/Tests/Unit/src/{ => ai}/CookieManager.Tests.ts (100%) rename shared/AppInsightsCore/Tests/Unit/src/{ => ai}/EventHelper.Tests.ts (100%) rename shared/AppInsightsCore/Tests/Unit/src/{ => ai}/EventsDiscardedReason.Tests.ts (100%) rename shared/AppInsightsCore/Tests/Unit/src/{Common => ai}/Exception.tests.ts (100%) rename shared/AppInsightsCore/Tests/Unit/src/{ => ai}/GlobalTestHooks.Test.ts (100%) rename shared/AppInsightsCore/Tests/Unit/src/{ => ai}/HelperFunc.Tests.ts (100%) rename shared/AppInsightsCore/Tests/Unit/src/{ => ai}/LoggingEnum.Tests.ts (100%) rename shared/AppInsightsCore/Tests/Unit/src/{Common => ai}/RequestHeaders.tests.ts (100%) rename shared/AppInsightsCore/Tests/Unit/src/{ => ai}/SendPostManager.Tests.ts (100%) rename shared/AppInsightsCore/Tests/Unit/src/{Common => ai}/SeverityLevel.tests.ts (100%) rename shared/AppInsightsCore/Tests/Unit/src/{ => ai}/StatsBeat.Tests.ts (100%) rename shared/AppInsightsCore/Tests/Unit/src/{ => ai}/TestPlugins.ts (100%) rename shared/AppInsightsCore/Tests/Unit/src/{Common => ai}/ThrottleMgr.tests.ts (100%) rename shared/AppInsightsCore/Tests/Unit/src/{ => ai}/UpdateConfig.Tests.ts (100%) rename shared/AppInsightsCore/Tests/Unit/src/{Common => ai}/Util.tests.ts (100%) rename shared/AppInsightsCore/Tests/Unit/src/{OpenTelemetry => attribute}/attributeContainer.Tests.ts (100%) rename shared/AppInsightsCore/Tests/Unit/src/{ => config}/Dynamic.Tests.ts (100%) rename shared/AppInsightsCore/Tests/Unit/src/{ => config}/DynamicConfig.Tests.ts (100%) rename shared/AppInsightsCore/Tests/Unit/src/{Common => trace}/W3CTraceStateModes.tests.ts (100%) rename shared/AppInsightsCore/Tests/Unit/src/{ => trace}/W3cTraceParentTests.ts (100%) rename shared/AppInsightsCore/Tests/Unit/src/{W3TraceState.Tests.ts => trace/W3cTraceState.Tests.ts} (100%) rename shared/AppInsightsCore/Tests/Unit/src/{OpenTelemetry => trace}/span.Tests.ts (100%) rename shared/AppInsightsCore/Tests/Unit/src/{OpenTelemetry => trace}/traceState.Tests.ts (100%) rename shared/AppInsightsCore/Tests/Unit/src/{OpenTelemetry => trace}/traceUtils.Tests.ts (100%) rename shared/AppInsightsCore/src/interfaces/{otel/IOTelException.ts => IException.ts} (100%) diff --git a/shared/AppInsightsCore/Tests/Unit/src/Common/AppInsightsCommon.tests.ts b/shared/AppInsightsCore/Tests/Unit/src/ai/AppInsightsCommon.tests.ts similarity index 100% rename from shared/AppInsightsCore/Tests/Unit/src/Common/AppInsightsCommon.tests.ts rename to shared/AppInsightsCore/Tests/Unit/src/ai/AppInsightsCommon.tests.ts diff --git a/shared/AppInsightsCore/Tests/Unit/src/AppInsightsCoreSize.Tests.ts b/shared/AppInsightsCore/Tests/Unit/src/ai/AppInsightsCoreSize.Tests.ts similarity index 100% rename from shared/AppInsightsCore/Tests/Unit/src/AppInsightsCoreSize.Tests.ts rename to shared/AppInsightsCore/Tests/Unit/src/ai/AppInsightsCoreSize.Tests.ts diff --git a/shared/AppInsightsCore/Tests/Unit/src/ApplicationInsightsCore.Tests.ts b/shared/AppInsightsCore/Tests/Unit/src/ai/ApplicationInsightsCore.Tests.ts similarity index 100% rename from shared/AppInsightsCore/Tests/Unit/src/ApplicationInsightsCore.Tests.ts rename to shared/AppInsightsCore/Tests/Unit/src/ai/ApplicationInsightsCore.Tests.ts diff --git a/shared/AppInsightsCore/Tests/Unit/src/Common/ConnectionStringParser.tests.ts b/shared/AppInsightsCore/Tests/Unit/src/ai/ConnectionStringParser.tests.ts similarity index 100% rename from shared/AppInsightsCore/Tests/Unit/src/Common/ConnectionStringParser.tests.ts rename to shared/AppInsightsCore/Tests/Unit/src/ai/ConnectionStringParser.tests.ts diff --git a/shared/AppInsightsCore/Tests/Unit/src/CookieManager.Tests.ts b/shared/AppInsightsCore/Tests/Unit/src/ai/CookieManager.Tests.ts similarity index 100% rename from shared/AppInsightsCore/Tests/Unit/src/CookieManager.Tests.ts rename to shared/AppInsightsCore/Tests/Unit/src/ai/CookieManager.Tests.ts diff --git a/shared/AppInsightsCore/Tests/Unit/src/EventHelper.Tests.ts b/shared/AppInsightsCore/Tests/Unit/src/ai/EventHelper.Tests.ts similarity index 100% rename from shared/AppInsightsCore/Tests/Unit/src/EventHelper.Tests.ts rename to shared/AppInsightsCore/Tests/Unit/src/ai/EventHelper.Tests.ts diff --git a/shared/AppInsightsCore/Tests/Unit/src/EventsDiscardedReason.Tests.ts b/shared/AppInsightsCore/Tests/Unit/src/ai/EventsDiscardedReason.Tests.ts similarity index 100% rename from shared/AppInsightsCore/Tests/Unit/src/EventsDiscardedReason.Tests.ts rename to shared/AppInsightsCore/Tests/Unit/src/ai/EventsDiscardedReason.Tests.ts diff --git a/shared/AppInsightsCore/Tests/Unit/src/Common/Exception.tests.ts b/shared/AppInsightsCore/Tests/Unit/src/ai/Exception.tests.ts similarity index 100% rename from shared/AppInsightsCore/Tests/Unit/src/Common/Exception.tests.ts rename to shared/AppInsightsCore/Tests/Unit/src/ai/Exception.tests.ts diff --git a/shared/AppInsightsCore/Tests/Unit/src/GlobalTestHooks.Test.ts b/shared/AppInsightsCore/Tests/Unit/src/ai/GlobalTestHooks.Test.ts similarity index 100% rename from shared/AppInsightsCore/Tests/Unit/src/GlobalTestHooks.Test.ts rename to shared/AppInsightsCore/Tests/Unit/src/ai/GlobalTestHooks.Test.ts diff --git a/shared/AppInsightsCore/Tests/Unit/src/HelperFunc.Tests.ts b/shared/AppInsightsCore/Tests/Unit/src/ai/HelperFunc.Tests.ts similarity index 100% rename from shared/AppInsightsCore/Tests/Unit/src/HelperFunc.Tests.ts rename to shared/AppInsightsCore/Tests/Unit/src/ai/HelperFunc.Tests.ts diff --git a/shared/AppInsightsCore/Tests/Unit/src/LoggingEnum.Tests.ts b/shared/AppInsightsCore/Tests/Unit/src/ai/LoggingEnum.Tests.ts similarity index 100% rename from shared/AppInsightsCore/Tests/Unit/src/LoggingEnum.Tests.ts rename to shared/AppInsightsCore/Tests/Unit/src/ai/LoggingEnum.Tests.ts diff --git a/shared/AppInsightsCore/Tests/Unit/src/Common/RequestHeaders.tests.ts b/shared/AppInsightsCore/Tests/Unit/src/ai/RequestHeaders.tests.ts similarity index 100% rename from shared/AppInsightsCore/Tests/Unit/src/Common/RequestHeaders.tests.ts rename to shared/AppInsightsCore/Tests/Unit/src/ai/RequestHeaders.tests.ts diff --git a/shared/AppInsightsCore/Tests/Unit/src/SendPostManager.Tests.ts b/shared/AppInsightsCore/Tests/Unit/src/ai/SendPostManager.Tests.ts similarity index 100% rename from shared/AppInsightsCore/Tests/Unit/src/SendPostManager.Tests.ts rename to shared/AppInsightsCore/Tests/Unit/src/ai/SendPostManager.Tests.ts diff --git a/shared/AppInsightsCore/Tests/Unit/src/Common/SeverityLevel.tests.ts b/shared/AppInsightsCore/Tests/Unit/src/ai/SeverityLevel.tests.ts similarity index 100% rename from shared/AppInsightsCore/Tests/Unit/src/Common/SeverityLevel.tests.ts rename to shared/AppInsightsCore/Tests/Unit/src/ai/SeverityLevel.tests.ts diff --git a/shared/AppInsightsCore/Tests/Unit/src/StatsBeat.Tests.ts b/shared/AppInsightsCore/Tests/Unit/src/ai/StatsBeat.Tests.ts similarity index 100% rename from shared/AppInsightsCore/Tests/Unit/src/StatsBeat.Tests.ts rename to shared/AppInsightsCore/Tests/Unit/src/ai/StatsBeat.Tests.ts diff --git a/shared/AppInsightsCore/Tests/Unit/src/TestPlugins.ts b/shared/AppInsightsCore/Tests/Unit/src/ai/TestPlugins.ts similarity index 100% rename from shared/AppInsightsCore/Tests/Unit/src/TestPlugins.ts rename to shared/AppInsightsCore/Tests/Unit/src/ai/TestPlugins.ts diff --git a/shared/AppInsightsCore/Tests/Unit/src/Common/ThrottleMgr.tests.ts b/shared/AppInsightsCore/Tests/Unit/src/ai/ThrottleMgr.tests.ts similarity index 100% rename from shared/AppInsightsCore/Tests/Unit/src/Common/ThrottleMgr.tests.ts rename to shared/AppInsightsCore/Tests/Unit/src/ai/ThrottleMgr.tests.ts diff --git a/shared/AppInsightsCore/Tests/Unit/src/UpdateConfig.Tests.ts b/shared/AppInsightsCore/Tests/Unit/src/ai/UpdateConfig.Tests.ts similarity index 100% rename from shared/AppInsightsCore/Tests/Unit/src/UpdateConfig.Tests.ts rename to shared/AppInsightsCore/Tests/Unit/src/ai/UpdateConfig.Tests.ts diff --git a/shared/AppInsightsCore/Tests/Unit/src/Common/Util.tests.ts b/shared/AppInsightsCore/Tests/Unit/src/ai/Util.tests.ts similarity index 100% rename from shared/AppInsightsCore/Tests/Unit/src/Common/Util.tests.ts rename to shared/AppInsightsCore/Tests/Unit/src/ai/Util.tests.ts diff --git a/shared/AppInsightsCore/Tests/Unit/src/OpenTelemetry/attributeContainer.Tests.ts b/shared/AppInsightsCore/Tests/Unit/src/attribute/attributeContainer.Tests.ts similarity index 100% rename from shared/AppInsightsCore/Tests/Unit/src/OpenTelemetry/attributeContainer.Tests.ts rename to shared/AppInsightsCore/Tests/Unit/src/attribute/attributeContainer.Tests.ts diff --git a/shared/AppInsightsCore/Tests/Unit/src/Dynamic.Tests.ts b/shared/AppInsightsCore/Tests/Unit/src/config/Dynamic.Tests.ts similarity index 100% rename from shared/AppInsightsCore/Tests/Unit/src/Dynamic.Tests.ts rename to shared/AppInsightsCore/Tests/Unit/src/config/Dynamic.Tests.ts diff --git a/shared/AppInsightsCore/Tests/Unit/src/DynamicConfig.Tests.ts b/shared/AppInsightsCore/Tests/Unit/src/config/DynamicConfig.Tests.ts similarity index 100% rename from shared/AppInsightsCore/Tests/Unit/src/DynamicConfig.Tests.ts rename to shared/AppInsightsCore/Tests/Unit/src/config/DynamicConfig.Tests.ts diff --git a/shared/AppInsightsCore/Tests/Unit/src/Common/W3CTraceStateModes.tests.ts b/shared/AppInsightsCore/Tests/Unit/src/trace/W3CTraceStateModes.tests.ts similarity index 100% rename from shared/AppInsightsCore/Tests/Unit/src/Common/W3CTraceStateModes.tests.ts rename to shared/AppInsightsCore/Tests/Unit/src/trace/W3CTraceStateModes.tests.ts diff --git a/shared/AppInsightsCore/Tests/Unit/src/W3cTraceParentTests.ts b/shared/AppInsightsCore/Tests/Unit/src/trace/W3cTraceParentTests.ts similarity index 100% rename from shared/AppInsightsCore/Tests/Unit/src/W3cTraceParentTests.ts rename to shared/AppInsightsCore/Tests/Unit/src/trace/W3cTraceParentTests.ts diff --git a/shared/AppInsightsCore/Tests/Unit/src/W3TraceState.Tests.ts b/shared/AppInsightsCore/Tests/Unit/src/trace/W3cTraceState.Tests.ts similarity index 100% rename from shared/AppInsightsCore/Tests/Unit/src/W3TraceState.Tests.ts rename to shared/AppInsightsCore/Tests/Unit/src/trace/W3cTraceState.Tests.ts diff --git a/shared/AppInsightsCore/Tests/Unit/src/OpenTelemetry/span.Tests.ts b/shared/AppInsightsCore/Tests/Unit/src/trace/span.Tests.ts similarity index 100% rename from shared/AppInsightsCore/Tests/Unit/src/OpenTelemetry/span.Tests.ts rename to shared/AppInsightsCore/Tests/Unit/src/trace/span.Tests.ts diff --git a/shared/AppInsightsCore/Tests/Unit/src/OpenTelemetry/traceState.Tests.ts b/shared/AppInsightsCore/Tests/Unit/src/trace/traceState.Tests.ts similarity index 100% rename from shared/AppInsightsCore/Tests/Unit/src/OpenTelemetry/traceState.Tests.ts rename to shared/AppInsightsCore/Tests/Unit/src/trace/traceState.Tests.ts diff --git a/shared/AppInsightsCore/Tests/Unit/src/OpenTelemetry/traceUtils.Tests.ts b/shared/AppInsightsCore/Tests/Unit/src/trace/traceUtils.Tests.ts similarity index 100% rename from shared/AppInsightsCore/Tests/Unit/src/OpenTelemetry/traceUtils.Tests.ts rename to shared/AppInsightsCore/Tests/Unit/src/trace/traceUtils.Tests.ts diff --git a/shared/AppInsightsCore/src/interfaces/otel/IOTelException.ts b/shared/AppInsightsCore/src/interfaces/IException.ts similarity index 100% rename from shared/AppInsightsCore/src/interfaces/otel/IOTelException.ts rename to shared/AppInsightsCore/src/interfaces/IException.ts From ec7ed5310bb674650292dcb6ce8b839225730f99 Mon Sep 17 00:00:00 2001 From: Nev <54870357+MSNev@users.noreply.github.com> Date: Fri, 6 Feb 2026 16:04:22 -0800 Subject: [PATCH 2/2] chore: Update build dependencies and rework tests to match moved layout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: - Update Rush to 5.167.0 and @nevware21 grunt plugins to 0.5.1 - Reorganize AppInsightsCore test structure with proper folder organization - Add missing copyright headers across multiple files - Code cleanup and TypeScript strict mode fixes Changes: Dependency Updates: - Rush: 5.166.0 → 5.167.0 - @nevware21/grunt-ts-plugin: 0.4.3 → 0.5.1 - @nevware21/grunt-eslint-ts: 0.2.2 → 0.5.1 Test Reorganization: - Update test imports to use new folder structure (ai/, config/, trace/, attribute/) - Remove duplicate test runner file (appinsights-common.tests.ts) - Fix relative import paths from ../../../src/ to ../../../../src/ OpenTelemetry Enhancements: - Add IOTelSpanContext interface for OTel span context support - Add createOTelSpanContext() utility function - Update IDistributedTraceContext to support IOTelSpanContext parents - Export new INVALID_TRACE_ID and INVALID_SPAN_ID constants Code Cleanup: - Remove unused _trackAjaxAttempts variable from AnalyticsPlugin - Consolidate isTimeSpan function into HelperFuncs.ts - Delete empty/obsolete files (HelperFuncsCore.ts, IEnvelope.ts, tsc-errors.txt) - Fix whitespace and formatting inconsistencies - Add proper TypeScript type casts for strict mode compliance --- AISKU/package.json | 4 +- AISKULight/package.json | 4 +- .../Tests/Unit/src/Sender.tests.ts | 91 ++++++++ .../package.json | 4 +- channels/offline-channel-js/package.json | 4 +- channels/tee-channel-js/package.json | 4 +- common/Tests/Framework/package.json | 2 +- common/config/rush/npm-shrinkwrap.json | 194 +++++++-------- common/scripts/install-run-rush.js | 18 +- common/scripts/install-run.js | 221 +++++++++++++----- examples/cfgSync/package.json | 4 +- examples/shared-worker/package.json | 4 +- .../package.json | 4 +- .../src/JavaScriptSDK/AnalyticsPlugin.ts | 42 ++-- .../package.json | 4 +- .../package.json | 4 +- .../package.json | 4 +- .../package.json | 4 +- .../src/ajax.ts | 2 +- .../package.json | 4 +- .../package.json | 4 +- package.json | 6 +- rush.json | 2 +- shared/AppInsightsCommon/package.json | 4 +- .../StartSpan_Implementation.md | 0 .../src/Common/appinsights-common.tests.ts | 21 -- .../src/ai/ApplicationInsightsCore.Tests.ts | 17 +- .../Tests/Unit/src/ai/CookieManager.Tests.ts | 6 +- .../Tests/Unit/src/ai/EventHelper.Tests.ts | 8 +- .../src/ai/EventsDiscardedReason.Tests.ts | 2 +- .../Tests/Unit/src/ai/GlobalTestHooks.Test.ts | 2 +- .../Tests/Unit/src/ai/HelperFunc.Tests.ts | 10 +- .../Tests/Unit/src/ai/LoggingEnum.Tests.ts | 4 +- .../Unit/src/ai/SendPostManager.Tests.ts | 8 +- .../Tests/Unit/src/ai/StatsBeat.Tests.ts | 22 +- .../Tests/Unit/src/ai/TestPlugins.ts | 24 +- .../Tests/Unit/src/ai/UpdateConfig.Tests.ts | 8 +- .../Tests/Unit/src/aiunittests.ts | 62 ++--- .../Tests/Unit/src/config/Dynamic.Tests.ts | 22 +- .../Unit/src/config/DynamicConfig.Tests.ts | 32 +-- .../Unit/src/trace/W3cTraceParentTests.ts | 6 +- .../Unit/src/trace/W3cTraceState.Tests.ts | 2 +- .../Tests/Unit/src/trace/span.Tests.ts | 24 +- .../Tests/Unit/src/trace/traceUtils.Tests.ts | 2 +- shared/AppInsightsCore/package.json | 4 +- shared/AppInsightsCore/rollup.config.js | 40 ++-- .../src/config/DynamicConfig.ts | 4 +- .../src/config/DynamicSupport.ts | 1 + .../src/core/AppInsightsCore.ts | 31 ++- shared/AppInsightsCore/src/core/CookieMgr.ts | 4 +- .../src/core/ResponseHelpers.ts | 3 +- .../src/core/SenderPostManager.ts | 15 +- .../src/core/TelemetryHelpers.ts | 51 +++- .../src/core/TelemetryInitializerPlugin.ts | 4 +- .../src/diagnostics/ThrottleMgr.ts | 3 + .../src/enums/ai/FeatureOptInEnums.ts | 3 + .../src/enums/ai/InitActiveStatusEnum.ts | 3 + .../src/enums/ai/LoggingEnums.ts | 3 +- shared/AppInsightsCore/src/index.ts | 39 ++-- .../src/interfaces/IException.ts | 2 + .../src/interfaces/IOTelHrTime.ts | 2 + .../src/interfaces/ai/ConnectionString.ts | 3 + .../src/interfaces/ai/IDiagnosticLogger.ts | 12 +- .../interfaces/ai/IDistributedTraceContext.ts | 15 +- .../src/interfaces/ai/IEventTelemetry.ts | 4 +- .../src/interfaces/ai/IFeatureOptIn.ts | 3 + .../src/interfaces/ai/IMetricTelemetry.ts | 3 + .../ai/IPageViewPerformanceTelemetry.ts | 4 +- .../src/interfaces/ai/IPageViewTelemetry.ts | 3 + .../src/interfaces/ai/IRequestContext.ts | 3 + .../src/interfaces/ai/ISenderPostManager.ts | 3 + .../src/interfaces/ai/IStorageBuffer.ts | 3 + .../interfaces/ai/ITelemetryInitializers.ts | 3 + .../src/interfaces/ai/IThrottleMgr.ts | 2 + .../src/interfaces/ai/IXDomainRequest.ts | 3 + .../src/interfaces/ai/IXHROverride.ts | 10 +- .../src/interfaces/ai/PartAExtensions.ts | 3 + .../src/interfaces/ai/context/ISample.ts | 1 + .../ai/contracts/AvailabilityData.ts | 4 +- .../src/interfaces/ai/contracts/IEnvelope.ts | 50 ---- .../config/_IDynamicConfigHandlerState.ts | 3 + .../src/interfaces/otel/IOTelApi.ts | 3 + .../src/interfaces/otel/IOTelApiCtx.ts | 3 + .../src/interfaces/otel/IOTelAttributes.ts | 2 + .../otel/config/IOTelAttributeLimits.ts | 3 +- .../src/interfaces/otel/config/IOTelConfig.ts | 3 + .../otel/config/IOTelErrorHandlers.ts | 3 +- .../interfaces/otel/config/IOTelSpanLimits.ts | 3 + .../interfaces/otel/config/IOTelTraceCfg.ts | 3 + .../src/interfaces/otel/trace/IOTelSpan.ts | 2 +- .../interfaces/otel/trace/IOTelSpanContext.ts | 23 ++ .../src/interfaces/otel/trace/IOTelSpanCtx.ts | 9 +- .../interfaces/otel/trace/IOTelSpanOptions.ts | 3 +- .../interfaces/otel/trace/IOTelSpanStatus.ts | 3 + .../interfaces/otel/trace/IOTelTraceApi.ts | 12 +- .../src/interfaces/otel/trace/IOTelTracer.ts | 1 - .../otel/trace/IOTelTracerOptions.ts | 9 + .../otel/trace/IOTelTracerProvider.ts | 9 +- .../src/internal/attributeHelpers.ts | 3 + .../src/internal/commonUtils.ts | 37 ++- .../src/internal/handleErrors.ts | 3 + .../src/internal/noopHelpers.ts | 3 +- .../src/internal/timeHelpers.ts | 40 +--- .../AppInsightsCore/src/otel/api/OTelApi.ts | 3 + .../src/otel/api/errors/OTelError.ts | 3 + .../api/errors/OTelInvalidAttributeError.ts | 3 + .../src/otel/api/errors/OTelSpanError.ts | 3 + .../src/otel/api/trace/span.ts | 3 +- .../src/otel/api/trace/spanContext.ts | 65 ++++++ .../src/otel/api/trace/traceApi.ts | 3 + .../src/otel/api/trace/traceState.ts | 5 +- .../src/otel/api/trace/utils.ts | 12 +- .../src/telemetry/TelemetryItemCreator.ts | 6 +- .../src/telemetry/ai/Common/DataSanitizer.ts | 4 +- .../src/telemetry/ai/Exception.ts | 4 +- .../src/telemetry/ai/PageView.ts | 2 +- .../src/telemetry/ai/RemoteDependencyData.ts | 2 +- .../src/utils/DomHelperFuncs.ts | 1 + .../AppInsightsCore/src/utils/HelperFuncs.ts | 96 +++++++- .../src/utils/HelperFuncsCore.ts | 64 ----- shared/AppInsightsCore/src/utils/Offline.ts | 5 +- .../src/utils/StorageHelperFuncs.ts | 2 +- .../AppInsightsCore/src/utils/TraceParent.ts | 9 +- shared/AppInsightsCore/tsc-errors.txt | 17 -- .../package.json | 4 +- tools/chrome-debug-extension/package.json | 4 +- tools/rollup-es5/package.json | 4 +- tools/rollup-plugin-uglify3-js/package.json | 4 +- tools/shims/package.json | 4 +- 129 files changed, 1087 insertions(+), 692 deletions(-) delete mode 100644 shared/AppInsightsCore/StartSpan_Implementation.md delete mode 100644 shared/AppInsightsCore/Tests/Unit/src/Common/appinsights-common.tests.ts delete mode 100644 shared/AppInsightsCore/src/interfaces/ai/contracts/IEnvelope.ts create mode 100644 shared/AppInsightsCore/src/interfaces/otel/trace/IOTelSpanContext.ts create mode 100644 shared/AppInsightsCore/src/interfaces/otel/trace/IOTelTracerOptions.ts create mode 100644 shared/AppInsightsCore/src/otel/api/trace/spanContext.ts delete mode 100644 shared/AppInsightsCore/src/utils/HelperFuncsCore.ts delete mode 100644 shared/AppInsightsCore/tsc-errors.txt diff --git a/AISKU/package.json b/AISKU/package.json index 7d4bbcabd..d0be298f9 100644 --- a/AISKU/package.json +++ b/AISKU/package.json @@ -41,8 +41,8 @@ "grunt": "^1.5.3", "grunt-cli": "^1.4.3", "@nevware21/ts-async": ">= 0.5.5 < 2.x", - "@nevware21/grunt-ts-plugin": "^0.4.3", - "@nevware21/grunt-eslint-ts": "^0.2.2", + "@nevware21/grunt-ts-plugin": "^0.5.1", + "@nevware21/grunt-eslint-ts": "^0.5.1", "globby": "^11.0.0", "magic-string": "^0.25.7", "pako": "^2.0.3", diff --git a/AISKULight/package.json b/AISKULight/package.json index e249b0624..67f22a7ca 100644 --- a/AISKULight/package.json +++ b/AISKULight/package.json @@ -36,8 +36,8 @@ "@microsoft/api-extractor": "^7.40.0", "grunt": "^1.5.3", "grunt-cli": "^1.4.3", - "@nevware21/grunt-ts-plugin": "^0.4.3", - "@nevware21/grunt-eslint-ts": "^0.2.2", + "@nevware21/grunt-ts-plugin": "^0.5.1", + "@nevware21/grunt-eslint-ts": "^0.5.1", "globby": "^11.0.0", "magic-string": "^0.25.7", "pako": "^2.0.3", diff --git a/channels/applicationinsights-channel-js/Tests/Unit/src/Sender.tests.ts b/channels/applicationinsights-channel-js/Tests/Unit/src/Sender.tests.ts index 625047318..f1faeabc9 100644 --- a/channels/applicationinsights-channel-js/Tests/Unit/src/Sender.tests.ts +++ b/channels/applicationinsights-channel-js/Tests/Unit/src/Sender.tests.ts @@ -444,6 +444,97 @@ export class SenderTests extends AITestClass { } }); + this.testCase({ + name: "zip test: gzip encode is working and content-encode header is set (feature opt-in)", + pollDelay: 10, + useFakeTimers: true, + useFakeServer: true, + test: () => { + this.genericSpy = this.sandbox.spy(this.xhrOverride, 'sendPOST'); + let core = new AppInsightsCore(); + + let coreConfig = { + instrumentationKey: "000e0000-e000-0000-a000-000000000000", + featureOptIn : {["zipPayload"]: {mode: 3}}, + extensionConfig: { + [this._sender.identifier]: { + httpXHROverride: this.xhrOverride, + alwaysUseXhrOverride: true, + } + } + } + + core.initialize(coreConfig, [this._sender]); + + const telemetryItem: ITelemetryItem = { + name: 'fake item with some really long name to take up space quickly', + iKey: 'iKey', + baseType: 'some type', + baseData: {} + }; + this._sender.processTelemetry(telemetryItem); + this._sender.flush(); + this.clock.tick(10); + + return this._asyncQueue().concat(PollingAssert.asyncTaskPollingAssert(() => { + if (this.genericSpy.called) { + let request = this.genericSpy.getCall(0).args[0]; + let gzipData = request.data; + QUnit.assert.ok(gzipData, "data should be set"); + QUnit.assert.equal(true, gzipData[0] === 0x1F && gzipData[1] === 0x8B, "telemetry should be gzip encoded"); + QUnit.assert.equal(request.headers["Content-Encoding"], "gzip", "telemetry should be gzip encoded"); + return true; + } + return false; + }, "Wait for promise response" + new Date().toISOString(), 60, 1000)); + } + }); + + this.testCase({ + name: "zip test: gzip encode is disabled (feature opt-in not set)", + pollDelay: 10, + useFakeTimers: true, + useFakeServer: true, + test: () => { + this.genericSpy = this.sandbox.spy(this.xhrOverride, 'sendPOST'); + let core = new AppInsightsCore(); + + let coreConfig = { + instrumentationKey: "000e0000-e000-0000-a000-000000000000", + extensionConfig: { + [this._sender.identifier]: { + httpXHROverride: this.xhrOverride, + alwaysUseXhrOverride: true, + } + } + } + + core.initialize(coreConfig, [this._sender]); + + const telemetryItem: ITelemetryItem = { + name: 'fake item with some really long name to take up space quickly', + iKey: 'iKey', + baseType: 'some type', + baseData: {} + }; + this._sender.processTelemetry(telemetryItem); + this._sender.flush(); + this.clock.tick(10); + + return this._asyncQueue().concat(PollingAssert.asyncTaskPollingAssert(() => { + if (this.genericSpy.called){ + let request = this.genericSpy.getCall(0).args[0]; + let gzipData = request.data; + QUnit.assert.ok(gzipData, "data should be set"); + QUnit.assert.equal(false, gzipData[0] === 0x1F && gzipData[1] === 0x8B, "telemetry should not be gzip encoded"); + QUnit.assert.ok(!("Content-Encoding" in request.headers), "telemetry should not be gzip encoded"); + return true; + } + return false; + }, "Wait for promise response" + new Date().toISOString(), 60, 1000)); + } + }); + this.testCase({ name: "Channel Config: Endpoint Url can be set from root dynamically", useFakeTimers: true, diff --git a/channels/applicationinsights-channel-js/package.json b/channels/applicationinsights-channel-js/package.json index ef0d085c8..ec9509e3e 100644 --- a/channels/applicationinsights-channel-js/package.json +++ b/channels/applicationinsights-channel-js/package.json @@ -36,8 +36,8 @@ "@types/sinon": "4.3.3", "grunt": "^1.5.3", "grunt-cli": "^1.4.3", - "@nevware21/grunt-ts-plugin": "^0.4.3", - "@nevware21/grunt-eslint-ts": "^0.2.2", + "@nevware21/grunt-ts-plugin": "^0.5.1", + "@nevware21/grunt-eslint-ts": "^0.5.1", "globby": "^11.0.0", "magic-string": "^0.25.7", "@rollup/plugin-commonjs": "^24.0.0", diff --git a/channels/offline-channel-js/package.json b/channels/offline-channel-js/package.json index 346fa7001..35e6b12de 100644 --- a/channels/offline-channel-js/package.json +++ b/channels/offline-channel-js/package.json @@ -46,8 +46,8 @@ "@types/sinon": "4.3.3", "grunt": "^1.5.3", "grunt-cli": "^1.4.3", - "@nevware21/grunt-ts-plugin": "^0.4.3", - "@nevware21/grunt-eslint-ts": "^0.2.2", + "@nevware21/grunt-ts-plugin": "^0.5.1", + "@nevware21/grunt-eslint-ts": "^0.5.1", "globby": "^11.0.0", "magic-string": "^0.25.7", "@rollup/plugin-commonjs": "^24.0.0", diff --git a/channels/tee-channel-js/package.json b/channels/tee-channel-js/package.json index 4d943ca4f..55128b4d0 100644 --- a/channels/tee-channel-js/package.json +++ b/channels/tee-channel-js/package.json @@ -37,8 +37,8 @@ "@types/sinon": "4.3.3", "grunt": "^1.5.3", "grunt-cli": "^1.4.3", - "@nevware21/grunt-ts-plugin": "^0.4.3", - "@nevware21/grunt-eslint-ts": "^0.2.2", + "@nevware21/grunt-ts-plugin": "^0.5.1", + "@nevware21/grunt-eslint-ts": "^0.5.1", "globby": "^11.0.0", "magic-string": "^0.25.7", "@rollup/plugin-commonjs": "^24.0.0", diff --git a/common/Tests/Framework/package.json b/common/Tests/Framework/package.json index bd8b25913..5ed7a15dd 100644 --- a/common/Tests/Framework/package.json +++ b/common/Tests/Framework/package.json @@ -33,7 +33,7 @@ "@types/qunit": "^2.19.3", "@types/sinon": "4.3.3", "grunt": "^1.5.3", - "@nevware21/grunt-ts-plugin": "^0.4.3", + "@nevware21/grunt-ts-plugin": "^0.5.1", "@rollup/plugin-commonjs": "^24.0.0", "@rollup/plugin-node-resolve": "^15.0.1", "@rollup/plugin-replace": "^5.0.2", diff --git a/common/config/rush/npm-shrinkwrap.json b/common/config/rush/npm-shrinkwrap.json index 9c3327460..a40e874c5 100644 --- a/common/config/rush/npm-shrinkwrap.json +++ b/common/config/rush/npm-shrinkwrap.json @@ -10,8 +10,8 @@ "dependencies": { "@microsoft/api-extractor": "^7.40.0", "@microsoft/dynamicproto-js": "^2.0.3", - "@nevware21/grunt-eslint-ts": "^0.2.2", - "@nevware21/grunt-ts-plugin": "^0.4.3", + "@nevware21/grunt-eslint-ts": "^0.5.1", + "@nevware21/grunt-ts-plugin": "^0.5.1", "@nevware21/ts-async": ">= 0.5.5 < 2.x", "@nevware21/ts-utils": ">= 0.12.6 < 2.x", "@rollup/plugin-commonjs": "^24.0.0", @@ -431,9 +431,9 @@ "integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==" }, "node_modules/@microsoft/api-extractor": { - "version": "7.56.0", - "resolved": "https://registry.npmjs.org/@microsoft/api-extractor/-/api-extractor-7.56.0.tgz", - "integrity": "sha512-H0V69QG5jIb9Ayx35NVBv2lOgFSS3q+Eab2oyGEy0POL3ovYPST+rCNPbwYoczOZXNG8IKjWUmmAMxmDTsXlQA==", + "version": "7.56.2", + "resolved": "https://registry.npmjs.org/@microsoft/api-extractor/-/api-extractor-7.56.2.tgz", + "integrity": "sha512-d94f7S+H43jDxY/YIyp5UOE9N12HZmEPP5Ct96us+fw1FVKBoy4itTopdVM1VrcpduuA7fK/t31CgA2jM8AqSA==", "dependencies": { "@microsoft/api-extractor-model": "7.32.2", "@microsoft/tsdoc": "~0.16.0", @@ -441,10 +441,10 @@ "@rushstack/node-core-library": "5.19.1", "@rushstack/rig-package": "0.6.0", "@rushstack/terminal": "0.21.0", - "@rushstack/ts-command-line": "5.1.7", + "@rushstack/ts-command-line": "5.2.0", "diff": "~8.0.2", "lodash": "~4.17.15", - "minimatch": "10.0.3", + "minimatch": "10.1.2", "resolve": "~1.22.1", "semver": "~7.5.4", "source-map": "~0.6.1", @@ -501,9 +501,9 @@ } }, "node_modules/@nevware21/grunt-eslint-ts": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/@nevware21/grunt-eslint-ts/-/grunt-eslint-ts-0.2.5.tgz", - "integrity": "sha512-LuFyzLF8Txpqsjg1l/WzYXmiEOD/K1HnFQoM7qjYSxwJm06ZwgbsR12OQmUOBReRFigAoNRyyY8YfNA0MC2PCg==", + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/@nevware21/grunt-eslint-ts/-/grunt-eslint-ts-0.5.1.tgz", + "integrity": "sha512-Ita/SqAURvKj0SlyyxZAXyUAscDieMUD1tf+O9pzc/2P3Q2NSXWHeCRw+cOdBYnTRKxW4miGCJwlVst8p93ULA==", "dependencies": { "@nevware21/ts-async": ">= 0.5.2 < 2.x", "@nevware21/ts-utils": ">= 0.11.3 < 2.x", @@ -522,9 +522,9 @@ } }, "node_modules/@nevware21/grunt-ts-plugin": { - "version": "0.4.6", - "resolved": "https://registry.npmjs.org/@nevware21/grunt-ts-plugin/-/grunt-ts-plugin-0.4.6.tgz", - "integrity": "sha512-Ujkx9EK0dtQGFTJATt57GP1DFZEKft3lpmQNm/m4uC2j9D8WQyN/syOkfaGA3Biz2jbUqHiJjHwv84/GmiMX3w==", + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/@nevware21/grunt-ts-plugin/-/grunt-ts-plugin-0.5.1.tgz", + "integrity": "sha512-ezNls+4NTWOI4D4WLeEWeGOKAQdJ1PnEpj+DpGaP0FJAEk5aXhx4tRGIhXr8wE7bNuUDI3lctZjR+GONbAgekg==", "dependencies": { "@nevware21/ts-async": ">= 0.5.2 < 2.x", "@nevware21/ts-utils": ">= 0.11.3 < 2.x" @@ -603,9 +603,9 @@ } }, "node_modules/@puppeteer/browsers/node_modules/semver": { - "version": "7.7.3", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.3.tgz", - "integrity": "sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q==", + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.4.tgz", + "integrity": "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==", "bin": { "semver": "bin/semver.js" }, @@ -774,10 +774,10 @@ "node_modules/@rush-temp/ai-test-framework": { "version": "0.0.0", "resolved": "file:projects/ai-test-framework.tgz", - "integrity": "sha512-LrTIJ1nC55SeW6KjK/eaHgOgl0Gf5ckTItecXx5SlFgH43HqiCl3ZAqOXIs43IzgF6CJHOtCF6d2lIssgz0Yvg==", + "integrity": "sha512-ycSF6hI9aJD/nJzfa2R5KxTGk2mQWVCCiT3k/enALCC8ZXFNnpq+U8bUB7vkKrS0doB3wB8ENCv8COIoU59Izw==", "dependencies": { "@microsoft/dynamicproto-js": "^2.0.3", - "@nevware21/grunt-ts-plugin": "^0.4.3", + "@nevware21/grunt-ts-plugin": "^0.5.1", "@nevware21/ts-async": ">= 0.5.5 < 2.x", "@nevware21/ts-utils": ">= 0.12.6 < 2.x", "@rollup/plugin-commonjs": "^24.0.0", @@ -800,12 +800,12 @@ "node_modules/@rush-temp/applicationinsights-analytics-js": { "version": "0.0.0", "resolved": "file:projects/applicationinsights-analytics-js.tgz", - "integrity": "sha512-wfJb7njpoWhFawjGUq/8n1oSWczxT2zheUxxjINFuwi2zNsTnhvEU2geN01Rv1F87ZyMLouc6UNBNN6rH38P4w==", + "integrity": "sha512-7+OlbhIyNOXUI5d2j15nOaTlRQ3PK66GCZs+c5BTyCU3nt1eXz5UZm4+r9DM7yMKh4OXLBvsSxOpPcqjZt+KVg==", "dependencies": { "@microsoft/api-extractor": "^7.40.0", "@microsoft/dynamicproto-js": "^2.0.3", - "@nevware21/grunt-eslint-ts": "^0.2.2", - "@nevware21/grunt-ts-plugin": "^0.4.3", + "@nevware21/grunt-eslint-ts": "^0.5.1", + "@nevware21/grunt-ts-plugin": "^0.5.1", "@nevware21/ts-utils": ">= 0.12.6 < 2.x", "@rollup/plugin-commonjs": "^24.0.0", "@rollup/plugin-node-resolve": "^15.0.1", @@ -828,12 +828,12 @@ "node_modules/@rush-temp/applicationinsights-cfgsync-js": { "version": "0.0.0", "resolved": "file:projects/applicationinsights-cfgsync-js.tgz", - "integrity": "sha512-uP5pd87yqb+qT7KS+xex41Nafw3zx/RaiC+XybpP5Xyx2zLUrX4dda9QVdKDjxAMzGTplEY1kRz01XC3X08iWA==", + "integrity": "sha512-0DgwfhowN2QkOBFT4sOlWV+4o2trFgSE9VP8Aci6X8i6dHaMFlKJe9s8tUgU26fl28Me1HIHgWA/5GEiHB9T+A==", "dependencies": { "@microsoft/api-extractor": "^7.40.0", "@microsoft/dynamicproto-js": "^2.0.3", - "@nevware21/grunt-eslint-ts": "^0.2.2", - "@nevware21/grunt-ts-plugin": "^0.4.3", + "@nevware21/grunt-eslint-ts": "^0.5.1", + "@nevware21/grunt-ts-plugin": "^0.5.1", "@nevware21/ts-async": ">= 0.5.5 < 2.x", "@nevware21/ts-utils": ">= 0.12.6 < 2.x", "@rollup/plugin-commonjs": "^24.0.0", @@ -857,12 +857,12 @@ "node_modules/@rush-temp/applicationinsights-channel-js": { "version": "0.0.0", "resolved": "file:projects/applicationinsights-channel-js.tgz", - "integrity": "sha512-H59C3nak4fwjdK3KlOzVlIZkkOkOMYvvnxJIzdw2LUMPJrgVLgNDRDGC5O74tMGIQKlrcuod41TtnIrYluNLIg==", + "integrity": "sha512-WXRMuLhL0ZcMteVhZFkSDuPvQF+1Vyn1JDQATBetlt3zjcymtpvhvjdWpJS0WkUQqOsHoG4qiLcPtJFN+aIjEA==", "dependencies": { "@microsoft/api-extractor": "^7.40.0", "@microsoft/dynamicproto-js": "^2.0.3", - "@nevware21/grunt-eslint-ts": "^0.2.2", - "@nevware21/grunt-ts-plugin": "^0.4.3", + "@nevware21/grunt-eslint-ts": "^0.5.1", + "@nevware21/grunt-ts-plugin": "^0.5.1", "@nevware21/ts-async": ">= 0.5.5 < 2.x", "@nevware21/ts-utils": ">= 0.12.6 < 2.x", "@rollup/plugin-commonjs": "^24.0.0", @@ -885,11 +885,11 @@ "node_modules/@rush-temp/applicationinsights-chrome-debug-extension": { "version": "0.0.0", "resolved": "file:projects/applicationinsights-chrome-debug-extension.tgz", - "integrity": "sha512-hiG0yG4DFdGaRILqkbUaUseG9B5qNROhFmVIzpoQ7b7p9UTG+ihcYOJGC6AiBRdLbjpY2RHGr27ujYzH8Cfzdw==", + "integrity": "sha512-t3AbTelVC6ELQyUe4dGRy8WrW0GjyCyqa+OvhHFxtqiQzeh4ltZxpXXZjx/7eT8opVx93cUsQmiDRr8s4mfrBQ==", "dependencies": { "@microsoft/dynamicproto-js": "^2.0.3", - "@nevware21/grunt-eslint-ts": "^0.2.2", - "@nevware21/grunt-ts-plugin": "^0.4.3", + "@nevware21/grunt-eslint-ts": "^0.5.1", + "@nevware21/grunt-ts-plugin": "^0.5.1", "@nevware21/ts-async": ">= 0.5.5 < 2.x", "@nevware21/ts-utils": ">= 0.12.6 < 2.x", "@rollup/plugin-commonjs": "^24.0.0", @@ -921,12 +921,12 @@ "node_modules/@rush-temp/applicationinsights-clickanalytics-js": { "version": "0.0.0", "resolved": "file:projects/applicationinsights-clickanalytics-js.tgz", - "integrity": "sha512-aIeQwariRHMO6X3znhk/nKC3AcOjxImNZxwYbGuqEscve5h1dF5i4FolWBiBz11jRg6JMHlJ8phhqmdHB5oZFA==", + "integrity": "sha512-Xjjf9MR8UYOabl0OK5TWGrk09d4Jy6v+rNBOExO/cBLSvEcXyAoLcmGkbwps0mYn9RX/iFCu3K4p6xCAeJgXGg==", "dependencies": { "@microsoft/api-extractor": "^7.40.0", "@microsoft/dynamicproto-js": "^2.0.3", - "@nevware21/grunt-eslint-ts": "^0.2.2", - "@nevware21/grunt-ts-plugin": "^0.4.3", + "@nevware21/grunt-eslint-ts": "^0.5.1", + "@nevware21/grunt-ts-plugin": "^0.5.1", "@nevware21/ts-utils": ">= 0.12.6 < 2.x", "@rollup/plugin-commonjs": "^24.0.0", "@rollup/plugin-node-resolve": "^15.0.1", @@ -946,12 +946,12 @@ "node_modules/@rush-temp/applicationinsights-common": { "version": "0.0.0", "resolved": "file:projects/applicationinsights-common.tgz", - "integrity": "sha512-eAM+wMN+qARD4Ta7DGq5ynV3PgRbD+yvEFp6dyIvyfNMxlznzDG04ysGD+EQUlfUsQAiYfGnGarbBHf5d3/vCg==", + "integrity": "sha512-2+3KNklw5223ekQQiICtonMsiFe663Jw2DU0pGlzpaoGUWnNpXh51341TmpdmBGx80kv/zex1OM/LWzk+yvX1Q==", "dependencies": { "@microsoft/api-extractor": "^7.40.0", "@microsoft/dynamicproto-js": "^2.0.3", - "@nevware21/grunt-eslint-ts": "^0.2.2", - "@nevware21/grunt-ts-plugin": "^0.4.3", + "@nevware21/grunt-eslint-ts": "^0.5.1", + "@nevware21/grunt-ts-plugin": "^0.5.1", "@nevware21/ts-utils": ">= 0.12.6 < 2.x", "@rollup/plugin-commonjs": "^24.0.0", "@rollup/plugin-node-resolve": "^15.0.1", @@ -972,12 +972,12 @@ "node_modules/@rush-temp/applicationinsights-core-js": { "version": "0.0.0", "resolved": "file:projects/applicationinsights-core-js.tgz", - "integrity": "sha512-wJBmltVy6LDrUiBUo2fDA5kEsftT9Q7gIuqfE53Dsf+s7ue5bAgvCKKvn5ChrjY9EANNb25CCx3lLZ+LkuE1RA==", + "integrity": "sha512-3OTo0U/bWdMwWLpnwwurrXjPpH8Q2qcjKlAxmVyAbxsFyHkCTAgbggC/OozM793stDWsqpswb188mUkDISTDNA==", "dependencies": { "@microsoft/api-extractor": "^7.40.0", "@microsoft/dynamicproto-js": "^2.0.3", - "@nevware21/grunt-eslint-ts": "^0.2.2", - "@nevware21/grunt-ts-plugin": "^0.4.3", + "@nevware21/grunt-eslint-ts": "^0.5.1", + "@nevware21/grunt-ts-plugin": "^0.5.1", "@nevware21/ts-async": ">= 0.5.5 < 2.x", "@nevware21/ts-utils": ">= 0.12.6 < 2.x", "@rollup/plugin-commonjs": "^24.0.0", @@ -1001,12 +1001,12 @@ "node_modules/@rush-temp/applicationinsights-debugplugin-js": { "version": "0.0.0", "resolved": "file:projects/applicationinsights-debugplugin-js.tgz", - "integrity": "sha512-g3yxVCq8Zng45+lLFcHGiWAxdiERgLIoUNVg4I7RZtkjH6npBahDIMSfneOxyJEPOZzN09J2ra1RI0yIGh4FYA==", + "integrity": "sha512-f8NK9+jYgxhwiqdFGocmPOAV47Dz5V/zaslFdn9yWYiF4w22Pqgi4RbH2Bs56PRl4FZLBR1eJ+GAfS0qqOsDkQ==", "dependencies": { "@microsoft/api-extractor": "^7.40.0", "@microsoft/dynamicproto-js": "^2.0.3", - "@nevware21/grunt-eslint-ts": "^0.2.2", - "@nevware21/grunt-ts-plugin": "^0.4.3", + "@nevware21/grunt-eslint-ts": "^0.5.1", + "@nevware21/grunt-ts-plugin": "^0.5.1", "@nevware21/ts-utils": ">= 0.12.6 < 2.x", "@rollup/plugin-commonjs": "^24.0.0", "@rollup/plugin-node-resolve": "^15.0.1", @@ -1026,12 +1026,12 @@ "node_modules/@rush-temp/applicationinsights-dependencies-js": { "version": "0.0.0", "resolved": "file:projects/applicationinsights-dependencies-js.tgz", - "integrity": "sha512-Az3r/mDVmEWo/BgVgyRq1OeMJFpwLE7+qoS0p3i6rwr59ocDlHBQipBmcWO4BOO/WGIcKE9/RfFbDsfwUcaStw==", + "integrity": "sha512-3NhR9UTh0cc+dH31N0Vz9bZdvf369C8oCsvMyOy2vmPqQOEEMAQALQQy9817qQu8BNDGw+Txg0aP4QfJu2CGMQ==", "dependencies": { "@microsoft/api-extractor": "^7.40.0", "@microsoft/dynamicproto-js": "^2.0.3", - "@nevware21/grunt-eslint-ts": "^0.2.2", - "@nevware21/grunt-ts-plugin": "^0.4.3", + "@nevware21/grunt-eslint-ts": "^0.5.1", + "@nevware21/grunt-ts-plugin": "^0.5.1", "@nevware21/ts-async": ">= 0.5.5 < 2.x", "@nevware21/ts-utils": ">= 0.12.6 < 2.x", "@rollup/plugin-commonjs": "^24.0.0", @@ -1073,11 +1073,11 @@ "node_modules/@rush-temp/applicationinsights-example-cfgsync": { "version": "0.0.0", "resolved": "file:projects/applicationinsights-example-cfgsync.tgz", - "integrity": "sha512-7dEnYnyD5ZhWCuong2ZUMTS89n0ub4HxFtW4hJzpD7n74onG/VD7qM0oWfrYEyRBUAyARuLOF75cZhg+9mmYAQ==", + "integrity": "sha512-LOMiKZOUqwzDOR2i8vwCQv+HatpHVIGFHEpYn47uCxUY8NdwUpLO4ZYzcGUwkfe+JVowC1yMc0dlDjmZSNd4YA==", "dependencies": { "@microsoft/dynamicproto-js": "^2.0.3", - "@nevware21/grunt-eslint-ts": "^0.2.2", - "@nevware21/grunt-ts-plugin": "^0.4.3", + "@nevware21/grunt-eslint-ts": "^0.5.1", + "@nevware21/grunt-ts-plugin": "^0.5.1", "@nevware21/ts-utils": ">= 0.12.6 < 2.x", "@rollup/plugin-commonjs": "^24.0.0", "@rollup/plugin-node-resolve": "^15.0.1", @@ -1118,11 +1118,11 @@ "node_modules/@rush-temp/applicationinsights-example-shared-worker": { "version": "0.0.0", "resolved": "file:projects/applicationinsights-example-shared-worker.tgz", - "integrity": "sha512-MmD/A8thCanYxfbH/YRQq8qH9aAz0AuHHisfvq5EaVywqEcoSvPt8uzzPnr8Bdxpr8uQotI5GaWCbbwMGUlH+g==", + "integrity": "sha512-8n8IYHQDo/qBH9TMHgWquXf2bQ/YnE89Au9yfGX8C8pbVawedAtcjviEVfuDm7tEjGC6lSAgX7e/LQ4UfOYcKw==", "dependencies": { "@microsoft/dynamicproto-js": "^2.0.3", - "@nevware21/grunt-eslint-ts": "^0.2.2", - "@nevware21/grunt-ts-plugin": "^0.4.3", + "@nevware21/grunt-eslint-ts": "^0.5.1", + "@nevware21/grunt-ts-plugin": "^0.5.1", "@nevware21/ts-utils": ">= 0.12.6 < 2.x", "@rollup/plugin-commonjs": "^24.0.0", "@rollup/plugin-node-resolve": "^15.0.1", @@ -1172,12 +1172,12 @@ "node_modules/@rush-temp/applicationinsights-offlinechannel-js": { "version": "0.0.0", "resolved": "file:projects/applicationinsights-offlinechannel-js.tgz", - "integrity": "sha512-HPT+sfK1IHa482G1+kfZg756FITSgFnkJ9TfJQOixBguWzQS6QB5L871MVXThCKRZdSmjzb6eZYl8wLVs7RvnQ==", + "integrity": "sha512-jsrICHwv+xKbxcPQSSF9hTaPyy/f1z7oqC6a5gM3GP/ahZLijPLmYyTHi6rsfjpA1pk2rPHelogyVocbiysPdQ==", "dependencies": { "@microsoft/api-extractor": "^7.40.0", "@microsoft/dynamicproto-js": "^2.0.3", - "@nevware21/grunt-eslint-ts": "^0.2.2", - "@nevware21/grunt-ts-plugin": "^0.4.3", + "@nevware21/grunt-eslint-ts": "^0.5.1", + "@nevware21/grunt-ts-plugin": "^0.5.1", "@nevware21/ts-async": ">= 0.5.5 < 2.x", "@nevware21/ts-utils": ">= 0.12.6 < 2.x", "@rollup/plugin-commonjs": "^24.0.0", @@ -1223,12 +1223,12 @@ "node_modules/@rush-temp/applicationinsights-perfmarkmeasure-js": { "version": "0.0.0", "resolved": "file:projects/applicationinsights-perfmarkmeasure-js.tgz", - "integrity": "sha512-ducECCRjLtdd7+Iqw3x/1lGdo18oBTVDnViJuqjrjNQg0Fb2W5TVi1sVciiyN3vjVKe1QIho9L8a7mPvQJBB9Q==", + "integrity": "sha512-uA+hP9YTJDyeCTwUZf2821kSEJDvVFKH/z/h4xWlaytaEYQuCGotdWjXIi3U6l59XyjmaMyMBTMg7mELVqc7xQ==", "dependencies": { "@microsoft/api-extractor": "^7.40.0", "@microsoft/dynamicproto-js": "^2.0.3", - "@nevware21/grunt-eslint-ts": "^0.2.2", - "@nevware21/grunt-ts-plugin": "^0.4.3", + "@nevware21/grunt-eslint-ts": "^0.5.1", + "@nevware21/grunt-ts-plugin": "^0.5.1", "@nevware21/ts-utils": ">= 0.12.6 < 2.x", "@rollup/plugin-commonjs": "^24.0.0", "@rollup/plugin-node-resolve": "^15.0.1", @@ -1249,12 +1249,12 @@ "node_modules/@rush-temp/applicationinsights-properties-js": { "version": "0.0.0", "resolved": "file:projects/applicationinsights-properties-js.tgz", - "integrity": "sha512-MtCaHhrGxUHyyJwgNkbRg4Wegrk0vH91Rd+I6Iv3CSks4pyxed9kcNn3N/HIdWEMkS1n3XevK7GWC0UzG5BrUw==", + "integrity": "sha512-/7LkDvsXdkt3bliNiYxdD1xHbKdsLDRL+CdW05Mevlbg+I6DSkeZpFDHlNjNknRq+vCURpmkFIW6cOxaoULgyw==", "dependencies": { "@microsoft/api-extractor": "^7.40.0", "@microsoft/dynamicproto-js": "^2.0.3", - "@nevware21/grunt-eslint-ts": "^0.2.2", - "@nevware21/grunt-ts-plugin": "^0.4.3", + "@nevware21/grunt-eslint-ts": "^0.5.1", + "@nevware21/grunt-ts-plugin": "^0.5.1", "@nevware21/ts-utils": ">= 0.12.6 < 2.x", "@rollup/plugin-commonjs": "^24.0.0", "@rollup/plugin-node-resolve": "^15.0.1", @@ -1277,11 +1277,11 @@ "node_modules/@rush-temp/applicationinsights-rollup-es5": { "version": "0.0.0", "resolved": "file:projects/applicationinsights-rollup-es5.tgz", - "integrity": "sha512-SoP645U0ufg4uLtl0q+qSmr4G5udWJkNhsioT7RKU82eTllfmWXDyuUYAGyYJ1YXS1KPufnZKCvlRrad6oXUrQ==", + "integrity": "sha512-m2JyBLynQOZF2tAvYOdxXuv6TKRKtbsPTirNqPzy/wrlDbwJMjuJ8nQvX7arGNYs5RV+DowZbKorpfhxIllwyA==", "dependencies": { "@microsoft/dynamicproto-js": "^2.0.3", - "@nevware21/grunt-eslint-ts": "^0.2.2", - "@nevware21/grunt-ts-plugin": "^0.4.3", + "@nevware21/grunt-eslint-ts": "^0.5.1", + "@nevware21/grunt-ts-plugin": "^0.5.1", "@rollup/plugin-commonjs": "^24.0.0", "@rollup/plugin-node-resolve": "^15.0.1", "@rollup/plugin-replace": "^5.0.2", @@ -1300,10 +1300,10 @@ "node_modules/@rush-temp/applicationinsights-rollup-plugin-uglify3-js": { "version": "0.0.0", "resolved": "file:projects/applicationinsights-rollup-plugin-uglify3-js.tgz", - "integrity": "sha512-jtetfWC0tK7IC/M5QaJBukyZ3E92LZbOcjhq5ZD5s3INaQ7h2h1rz85NNVF8YgRKk7dg29yOmC8U8ShT+p9ong==", + "integrity": "sha512-DSU3flaXUMqhGViYU/A7msqHr+vIRO+7Mfl8tQfuKX1CAyfJoeWZyZmoP7rndpXqSCEyW6TCeM/jEv6O+PglFQ==", "dependencies": { - "@nevware21/grunt-eslint-ts": "^0.2.2", - "@nevware21/grunt-ts-plugin": "^0.4.3", + "@nevware21/grunt-eslint-ts": "^0.5.1", + "@nevware21/grunt-ts-plugin": "^0.5.1", "@rollup/plugin-commonjs": "^24.0.0", "@rollup/plugin-node-resolve": "^15.0.1", "@rollup/plugin-replace": "^5.0.2", @@ -1320,11 +1320,11 @@ "node_modules/@rush-temp/applicationinsights-shims": { "version": "0.0.0", "resolved": "file:projects/applicationinsights-shims.tgz", - "integrity": "sha512-LtOFSdv4T85zQ0iZErWcX1a7BONsx2QUqjpWtWhf2Qp/eWBZwoyLKpDAuFkxgByr/FUBXUzjL86D5/+RUEYOjQ==", + "integrity": "sha512-9KEZKu7txNSGPJ95bdrrhQE1gObs3LydbrtWT/G3FJe77gU/48anDxEAG0er/nsva/LIUxUzOIsj26elaKO8OQ==", "dependencies": { "@microsoft/dynamicproto-js": "^2.0.3", - "@nevware21/grunt-eslint-ts": "^0.2.2", - "@nevware21/grunt-ts-plugin": "^0.4.3", + "@nevware21/grunt-eslint-ts": "^0.5.1", + "@nevware21/grunt-ts-plugin": "^0.5.1", "@nevware21/ts-utils": ">= 0.12.6 < 2.x", "@rollup/plugin-commonjs": "^24.0.0", "@rollup/plugin-node-resolve": "^15.0.1", @@ -1342,12 +1342,12 @@ "node_modules/@rush-temp/applicationinsights-teechannel-js": { "version": "0.0.0", "resolved": "file:projects/applicationinsights-teechannel-js.tgz", - "integrity": "sha512-wKeg3Gr8N2TT/VdPyfdKiTQIiPVKc0bNwaBxiEfsm7QlQVKleLXT+kPhUN9D9OSW1H5wXYttNy/+BRkRsnJq5A==", + "integrity": "sha512-u+HV6H5yUIpTalTE1hGuT0GVaK1SabndQu8WBa+fAf/DUsdlM66YVolMXnyFF0wuIa1E8Jjpt4A701YOsgWXAg==", "dependencies": { "@microsoft/api-extractor": "^7.40.0", "@microsoft/dynamicproto-js": "^2.0.3", - "@nevware21/grunt-eslint-ts": "^0.2.2", - "@nevware21/grunt-ts-plugin": "^0.4.3", + "@nevware21/grunt-eslint-ts": "^0.5.1", + "@nevware21/grunt-ts-plugin": "^0.5.1", "@nevware21/ts-async": ">= 0.5.5 < 2.x", "@nevware21/ts-utils": ">= 0.12.6 < 2.x", "@rollup/plugin-commonjs": "^24.0.0", @@ -1379,12 +1379,12 @@ "node_modules/@rush-temp/applicationinsights-web": { "version": "0.0.0", "resolved": "file:projects/applicationinsights-web.tgz", - "integrity": "sha512-BFsG8eHPbdUGncBp1dAY528MvdQ4AnEBwjZByKoXcI+gQGulBF7ptvrdbvAJ/4nmPhVGEfbZaN6T0jbKggG/5g==", + "integrity": "sha512-3lmT1b0u9kIOL5savVS6FfL6KKl2l/tDE6gTOs+qGrGhdBk0y3ytNqtRcsXtE0cI3vvcJ9OvmWeqbpV32ixeRw==", "dependencies": { "@microsoft/api-extractor": "^7.40.0", "@microsoft/dynamicproto-js": "^2.0.3", - "@nevware21/grunt-eslint-ts": "^0.2.2", - "@nevware21/grunt-ts-plugin": "^0.4.3", + "@nevware21/grunt-eslint-ts": "^0.5.1", + "@nevware21/grunt-ts-plugin": "^0.5.1", "@nevware21/ts-async": ">= 0.5.5 < 2.x", "@nevware21/ts-utils": ">= 0.12.6 < 2.x", "@rollup/plugin-commonjs": "^24.0.0", @@ -1411,12 +1411,12 @@ "node_modules/@rush-temp/applicationinsights-web-basic": { "version": "0.0.0", "resolved": "file:projects/applicationinsights-web-basic.tgz", - "integrity": "sha512-8pSCt+QP4Iyrj7lf73EZYVqe2nn8iAdDLgtDsE8+LuRUrI+pkvEDY6RwItjgJZ6jV+glvmdWs9Gka293cJ3lYA==", + "integrity": "sha512-njild5OHq4BA3/iiKq517FT85IBNSY10bmRcdCqiWPT27mStQfFKF+s/PLiQ3m8DWx/Bgw5FZPCGYD/myWLavw==", "dependencies": { "@microsoft/api-extractor": "^7.40.0", "@microsoft/dynamicproto-js": "^2.0.3", - "@nevware21/grunt-eslint-ts": "^0.2.2", - "@nevware21/grunt-ts-plugin": "^0.4.3", + "@nevware21/grunt-eslint-ts": "^0.5.1", + "@nevware21/grunt-ts-plugin": "^0.5.1", "@nevware21/ts-async": ">= 0.5.5 < 2.x", "@nevware21/ts-utils": ">= 0.12.6 < 2.x", "@rollup/plugin-commonjs": "^24.0.0", @@ -1444,12 +1444,12 @@ "node_modules/@rush-temp/applicationinsights-web-snippet": { "version": "0.0.0", "resolved": "file:projects/applicationinsights-web-snippet.tgz", - "integrity": "sha512-/PtsA8Q9K9jXPra/imxYII5nf0xxttVkO4xRT9MpxZvz3OvTkmWakDQpdEIXTQ3Y6j2cZYJOQCkLKmvyqL9tsQ==", + "integrity": "sha512-ebBPHKONGUyjqovB8Lb+VerxpbpASHibIUv5s397PyZAI4Enpjgh7ApvunMusBPetsClxYZKFCbfFoXAIqLShA==", "dependencies": { "@microsoft/api-extractor": "^7.40.0", "@microsoft/dynamicproto-js": "^2.0.3", - "@nevware21/grunt-eslint-ts": "^0.2.2", - "@nevware21/grunt-ts-plugin": "^0.4.3", + "@nevware21/grunt-eslint-ts": "^0.5.1", + "@nevware21/grunt-ts-plugin": "^0.5.1", "@rollup/plugin-commonjs": "^24.0.0", "@rollup/plugin-node-resolve": "^15.0.1", "@rollup/plugin-replace": "^5.0.2", @@ -1544,9 +1544,9 @@ } }, "node_modules/@rushstack/ts-command-line": { - "version": "5.1.7", - "resolved": "https://registry.npmjs.org/@rushstack/ts-command-line/-/ts-command-line-5.1.7.tgz", - "integrity": "sha512-Ugwl6flarZcL2nqH5IXFYk3UR3mBVDsVFlCQW/Oaqidvdb/5Ota6b/Z3JXWIdqV3rOR2/JrYoAHanWF5rgenXA==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@rushstack/ts-command-line/-/ts-command-line-5.2.0.tgz", + "integrity": "sha512-lYxCX0nDdkDtCkVpvF0m25ymf66SaMWuppbD6b7MdkIzvGXKBXNIVZlwBH/C0YfkanrupnICWf2n4z3AKSfaHw==", "dependencies": { "@rushstack/terminal": "0.21.0", "@types/argparse": "1.0.38", @@ -1764,9 +1764,9 @@ "integrity": "sha512-N4xp3v4s7f0jb2Oij6+6xw5QhH7/IgHCoGIFLCWtbEWoPkGYp8Te4mIwIP21qaurr6ed5JiPMiy2/ZoiGPkLIw==" }, "node_modules/@types/react": { - "version": "16.14.68", - "resolved": "https://registry.npmjs.org/@types/react/-/react-16.14.68.tgz", - "integrity": "sha512-GEe60JEJg7wIvnUzXBX/A++ieyum98WXF/q2oFr1RVar8OK8JxU/uEYBXgv7jF87SoaDdxtAq3KUaJFlu02ziw==", + "version": "16.14.69", + "resolved": "https://registry.npmjs.org/@types/react/-/react-16.14.69.tgz", + "integrity": "sha512-NdnAamzkxLX9LBssSdt9Q0tQ3LR94hYxotI4/sRUs1vHKFXaDx9xDbK8S4wuw5bwrxiiXbTYyhKeITtFnwDvEA==", "dependencies": { "@types/prop-types": "*", "@types/scheduler": "^0.16", @@ -2005,9 +2005,9 @@ } }, "node_modules/@typescript-eslint/typescript-estree/node_modules/semver": { - "version": "7.7.3", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.3.tgz", - "integrity": "sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q==", + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.4.tgz", + "integrity": "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==", "peer": true, "bin": { "semver": "bin/semver.js" @@ -2586,9 +2586,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001767", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001767.tgz", - "integrity": "sha512-34+zUAMhSH+r+9eKmYG+k2Rpt8XttfE4yXAjoZvkAPs15xcYQhyBYdalJ65BzivAvGRMViEjy6oKr/S91loekQ==", + "version": "1.0.30001769", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001769.tgz", + "integrity": "sha512-BCfFL1sHijQlBGWBMuJyhZUhzo7wer5sVj9hqekB/7xn0Ypy+pER/edCYQm4exbXj4WiySGp40P8UuTh6w1srg==", "funding": [ { "type": "opencollective", @@ -4892,11 +4892,11 @@ } }, "node_modules/minimatch": { - "version": "10.0.3", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.0.3.tgz", - "integrity": "sha512-IPZ167aShDZZUMdRk66cyQAW3qr0WzbHkPdMYa8bzZhlHhO3jALbKdxcaak7W9FfT2rZNpQuUu4Od7ILEpXSaw==", + "version": "10.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.1.2.tgz", + "integrity": "sha512-fu656aJ0n2kcXwsnwnv9g24tkU5uSmOlTjd6WyyaKm2Z+h1qmY6bAjrcaIxF/BslFqbZ8UBtbJi7KgQOZD2PTw==", "dependencies": { - "@isaacs/brace-expansion": "^5.0.0" + "@isaacs/brace-expansion": "^5.0.1" }, "engines": { "node": "20 || >=22" diff --git a/common/scripts/install-run-rush.js b/common/scripts/install-run-rush.js index dc8980d1a..ab7defd16 100644 --- a/common/scripts/install-run-rush.js +++ b/common/scripts/install-run-rush.js @@ -16,25 +16,25 @@ /******/ "use strict"; /******/ var __webpack_modules__ = ({ -/***/ 176760: +/***/ 176760 /*!****************************!*\ !*** external "node:path" ***! \****************************/ -/***/ ((module) => { +(module) { module.exports = require("node:path"); -/***/ }), +/***/ }, -/***/ 973024: +/***/ 973024 /*!**************************!*\ !*** external "node:fs" ***! \**************************/ -/***/ ((module) => { +(module) { module.exports = require("node:fs"); -/***/ }) +/***/ } /******/ }); /************************************************************************/ @@ -48,6 +48,12 @@ module.exports = require("node:fs"); /******/ if (cachedModule !== undefined) { /******/ return cachedModule.exports; /******/ } +/******/ // Check if module exists (development only) +/******/ if (__webpack_modules__[moduleId] === undefined) { +/******/ var e = new Error("Cannot find module '" + moduleId + "'"); +/******/ e.code = 'MODULE_NOT_FOUND'; +/******/ throw e; +/******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { /******/ // no module.id needed diff --git a/common/scripts/install-run.js b/common/scripts/install-run.js index 2b2b91aca..9274e7038 100644 --- a/common/scripts/install-run.js +++ b/common/scripts/install-run.js @@ -16,11 +16,11 @@ /******/ "use strict"; /******/ var __webpack_modules__ = ({ -/***/ 90178: +/***/ 90178 /*!****************************************************!*\ !*** ./lib-esnext/utilities/executionUtilities.js ***! \****************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { +(__unused_webpack_module, __webpack_exports__, __webpack_require__) { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { @@ -47,33 +47,33 @@ function escapeArgumentIfNeeded(command, isWindows = IS_WINDOWS) { } //# sourceMappingURL=executionUtilities.js.map -/***/ }), +/***/ }, -/***/ 176760: +/***/ 176760 /*!****************************!*\ !*** external "node:path" ***! \****************************/ -/***/ ((module) => { +(module) { module.exports = require("node:path"); -/***/ }), +/***/ }, -/***/ 731421: +/***/ 731421 /*!*************************************!*\ !*** external "node:child_process" ***! \*************************************/ -/***/ ((module) => { +(module) { module.exports = require("node:child_process"); -/***/ }), +/***/ }, -/***/ 832286: +/***/ 832286 /*!************************************************!*\ !*** ./lib-esnext/utilities/npmrcUtilities.js ***! \************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { +(__unused_webpack_module, __webpack_exports__, __webpack_require__) { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { @@ -100,7 +100,7 @@ __webpack_require__.r(__webpack_exports__); // create a global _combinedNpmrc for cache purpose const _combinedNpmrcMap = new Map(); function _trimNpmrcFile(options) { - const { sourceNpmrcPath, linesToPrepend, linesToAppend, supportEnvVarFallbackSyntax } = options; + const { sourceNpmrcPath, linesToPrepend, linesToAppend, supportEnvVarFallbackSyntax, filterNpmIncompatibleProperties, env = process.env } = options; const combinedNpmrcFromCache = _combinedNpmrcMap.get(sourceNpmrcPath); if (combinedNpmrcFromCache !== undefined) { return combinedNpmrcFromCache; @@ -116,21 +116,63 @@ function _trimNpmrcFile(options) { npmrcFileLines.push(...linesToAppend); } npmrcFileLines = npmrcFileLines.map((line) => (line || '').trim()); - const resultLines = trimNpmrcFileLines(npmrcFileLines, process.env, supportEnvVarFallbackSyntax); + const resultLines = trimNpmrcFileLines(npmrcFileLines, env, supportEnvVarFallbackSyntax, filterNpmIncompatibleProperties); const combinedNpmrc = resultLines.join('\n'); //save the cache _combinedNpmrcMap.set(sourceNpmrcPath, combinedNpmrc); return combinedNpmrc; } +/** + * List of npmrc properties that are not supported by npm but may be present in the config. + * These include pnpm-specific properties and deprecated npm properties. + */ +const NPM_INCOMPATIBLE_PROPERTIES = new Set([ + // pnpm-specific hoisting configuration + 'hoist', + 'hoist-pattern', + 'public-hoist-pattern', + 'shamefully-hoist', + // Deprecated or unknown npm properties that cause warnings + 'email', + 'publish-branch' +]); +/** + * List of registry-scoped npmrc property suffixes that are pnpm-specific. + * These are properties like "//registry.example.com/:tokenHelper" where "tokenHelper" + * is the suffix after the last colon. + */ +const NPM_INCOMPATIBLE_REGISTRY_SCOPED_PROPERTIES = new Set([ + // pnpm-specific token helper properties + 'tokenHelper', + 'urlTokenHelper' +]); +/** + * Regular expression to extract property names from .npmrc lines. + * Matches everything before '=', '[', or whitespace to capture the property name. + * Note: The 'g' flag is intentionally omitted since we only need the first match. + * Examples: + * "registry=https://..." -> matches "registry" + * "hoist-pattern[]=..." -> matches "hoist-pattern" + */ +const PROPERTY_NAME_REGEX = /^([^=\[\s]+)/; +/** + * Regular expression to extract environment variable names and optional fallback values. + * Matches patterns like: + * nameString -> group 1: nameString, group 2: undefined + * nameString-fallbackString -> group 1: nameString, group 2: fallbackString + * nameString:-fallbackString -> group 1: nameString, group 2: fallbackString + */ +const ENV_VAR_WITH_FALLBACK_REGEX = /^(?[^:-]+)(?::?-(?.+))?$/; /** * * @param npmrcFileLines The npmrc file's lines * @param env The environment variables object * @param supportEnvVarFallbackSyntax Whether to support fallback values in the form of `${VAR_NAME:-fallback}` - * @returns + * @param filterNpmIncompatibleProperties Whether to filter out properties that npm doesn't understand + * @returns An array of processed npmrc file lines with undefined environment variables and npm-incompatible properties commented out */ -function trimNpmrcFileLines(npmrcFileLines, env, supportEnvVarFallbackSyntax) { - var _a; +function trimNpmrcFileLines(npmrcFileLines, env, supportEnvVarFallbackSyntax, filterNpmIncompatibleProperties = false) { + var _a, _b, _c; const resultLines = []; // This finds environment variable tokens that look like "${VAR_NAME}" const expansionRegExp = /\$\{([^\}]+)\}/g; @@ -139,6 +181,7 @@ function trimNpmrcFileLines(npmrcFileLines, env, supportEnvVarFallbackSyntax) { // Trim out lines that reference environment variables that aren't defined for (let line of npmrcFileLines) { let lineShouldBeTrimmed = false; + let trimReason = ''; //remove spaces before or after key and value line = line .split('=') @@ -146,49 +189,89 @@ function trimNpmrcFileLines(npmrcFileLines, env, supportEnvVarFallbackSyntax) { .join('='); // Ignore comment lines if (!commentRegExp.test(line)) { - const environmentVariables = line.match(expansionRegExp); - if (environmentVariables) { - for (const token of environmentVariables) { - /** - * Remove the leading "${" and the trailing "}" from the token - * - * ${nameString} -> nameString - * ${nameString-fallbackString} -> name-fallbackString - * ${nameString:-fallbackString} -> name:-fallbackString - */ - const nameWithFallback = token.substring(2, token.length - 1); - let environmentVariableName; - let fallback; - if (supportEnvVarFallbackSyntax) { - /** - * Get the environment variable name and fallback value. - * - * name fallback - * nameString -> nameString undefined - * nameString-fallbackString -> nameString fallbackString - * nameString:-fallbackString -> nameString fallbackString - */ - const matched = nameWithFallback.match(/^([^:-]+)(?:\:?-(.+))?$/); - // matched: [originStr, variableName, fallback] - environmentVariableName = (_a = matched === null || matched === void 0 ? void 0 : matched[1]) !== null && _a !== void 0 ? _a : nameWithFallback; - fallback = matched === null || matched === void 0 ? void 0 : matched[2]; + // Check if this is a property that npm doesn't understand + if (filterNpmIncompatibleProperties) { + // Extract the property name (everything before the '=' or '[') + const match = line.match(PROPERTY_NAME_REGEX); + if (match) { + const propertyName = match[1]; + // Check if this is a registry-scoped property (starts with "//" like "//registry.npmjs.org/:_authToken") + const isRegistryScoped = propertyName.startsWith('//'); + if (isRegistryScoped) { + // For registry-scoped properties, check if the suffix (after the last colon) is npm-incompatible + // Example: "//registry.example.com/:tokenHelper" -> suffix is "tokenHelper" + const lastColonIndex = propertyName.lastIndexOf(':'); + if (lastColonIndex !== -1) { + const registryPropertySuffix = propertyName.substring(lastColonIndex + 1); + if (NPM_INCOMPATIBLE_REGISTRY_SCOPED_PROPERTIES.has(registryPropertySuffix)) { + lineShouldBeTrimmed = true; + trimReason = 'NPM_INCOMPATIBLE_PROPERTY'; + } + } } else { - environmentVariableName = nameWithFallback; + // For non-registry-scoped properties, check the full property name + if (NPM_INCOMPATIBLE_PROPERTIES.has(propertyName)) { + lineShouldBeTrimmed = true; + trimReason = 'NPM_INCOMPATIBLE_PROPERTY'; + } } - // Is the environment variable and fallback value defined. - if (!env[environmentVariableName] && !fallback) { - // No, so trim this line - lineShouldBeTrimmed = true; - break; + } + } + // Check for undefined environment variables + if (!lineShouldBeTrimmed) { + const environmentVariables = line.match(expansionRegExp); + if (environmentVariables) { + for (const token of environmentVariables) { + /** + * Remove the leading "${" and the trailing "}" from the token + * + * ${nameString} -> nameString + * ${nameString-fallbackString} -> name-fallbackString + * ${nameString:-fallbackString} -> name:-fallbackString + */ + const nameWithFallback = token.slice(2, -1); + let environmentVariableName; + let fallback; + if (supportEnvVarFallbackSyntax) { + /** + * Get the environment variable name and fallback value. + * + * name fallback + * nameString -> nameString undefined + * nameString-fallbackString -> nameString fallbackString + * nameString:-fallbackString -> nameString fallbackString + */ + const matched = nameWithFallback.match(ENV_VAR_WITH_FALLBACK_REGEX); + environmentVariableName = (_b = (_a = matched === null || matched === void 0 ? void 0 : matched.groups) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : nameWithFallback; + fallback = (_c = matched === null || matched === void 0 ? void 0 : matched.groups) === null || _c === void 0 ? void 0 : _c.fallback; + } + else { + environmentVariableName = nameWithFallback; + } + // Is the environment variable and fallback value defined. + if (!env[environmentVariableName] && !fallback) { + // No, so trim this line + lineShouldBeTrimmed = true; + trimReason = 'MISSING_ENVIRONMENT_VARIABLE'; + break; + } } } } } if (lineShouldBeTrimmed) { - // Example output: - // "; MISSING ENVIRONMENT VARIABLE: //my-registry.com/npm/:_authToken=${MY_AUTH_TOKEN}" - resultLines.push('; MISSING ENVIRONMENT VARIABLE: ' + line); + // Comment out the line with appropriate reason + if (trimReason === 'NPM_INCOMPATIBLE_PROPERTY') { + // Example output: + // "; UNSUPPORTED BY NPM: email=test@example.com" + resultLines.push('; UNSUPPORTED BY NPM: ' + line); + } + else { + // Example output: + // "; MISSING ENVIRONMENT VARIABLE: //my-registry.com/npm/:_authToken=${MY_AUTH_TOKEN}" + resultLines.push('; MISSING ENVIRONMENT VARIABLE: ' + line); + } } else { resultLines.push(line); @@ -242,33 +325,37 @@ function isVariableSetInNpmrcFile(sourceNpmrcFolder, variableKey, supportEnvVarF if (!node_fs__WEBPACK_IMPORTED_MODULE_0__.existsSync(sourceNpmrcPath)) { return false; } - const trimmedNpmrcFile = _trimNpmrcFile({ sourceNpmrcPath, supportEnvVarFallbackSyntax }); + const trimmedNpmrcFile = _trimNpmrcFile({ + sourceNpmrcPath, + supportEnvVarFallbackSyntax, + filterNpmIncompatibleProperties: false + }); const variableKeyRegExp = new RegExp(`^${variableKey}=`, 'm'); return trimmedNpmrcFile.match(variableKeyRegExp) !== null; } //# sourceMappingURL=npmrcUtilities.js.map -/***/ }), +/***/ }, -/***/ 848161: +/***/ 848161 /*!**************************!*\ !*** external "node:os" ***! \**************************/ -/***/ ((module) => { +(module) { module.exports = require("node:os"); -/***/ }), +/***/ }, -/***/ 973024: +/***/ 973024 /*!**************************!*\ !*** external "node:fs" ***! \**************************/ -/***/ ((module) => { +(module) { module.exports = require("node:fs"); -/***/ }) +/***/ } /******/ }); /************************************************************************/ @@ -282,6 +369,12 @@ module.exports = require("node:fs"); /******/ if (cachedModule !== undefined) { /******/ return cachedModule.exports; /******/ } +/******/ // Check if module exists (development only) +/******/ if (__webpack_modules__[moduleId] === undefined) { +/******/ var e = new Error("Cannot find module '" + moduleId + "'"); +/******/ e.code = 'MODULE_NOT_FOUND'; +/******/ throw e; +/******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { /******/ // no module.id needed @@ -509,7 +602,10 @@ function _resolvePackageVersion(logger, rushCommonFolder, { name, version }) { sourceNpmrcFolder, targetNpmrcFolder: rushTempFolder, logger, - supportEnvVarFallbackSyntax: false + supportEnvVarFallbackSyntax: false, + // Always filter npm-incompatible properties in install-run scripts. + // Any warnings will be shown when running Rush commands directly. + filterNpmIncompatibleProperties: true }); // This returns something that looks like: // ``` @@ -745,7 +841,10 @@ function installAndRun(logger, packageName, packageVersion, packageBinName, pack sourceNpmrcFolder, targetNpmrcFolder: packageInstallFolder, logger, - supportEnvVarFallbackSyntax: false + supportEnvVarFallbackSyntax: false, + // Always filter npm-incompatible properties in install-run scripts. + // Any warnings will be shown when running Rush commands directly. + filterNpmIncompatibleProperties: true }); _createPackageJson(packageInstallFolder, packageName, packageVersion); const installCommand = lockFilePath ? 'ci' : 'install'; diff --git a/examples/cfgSync/package.json b/examples/cfgSync/package.json index c3b11959d..a2bdc58c5 100644 --- a/examples/cfgSync/package.json +++ b/examples/cfgSync/package.json @@ -41,8 +41,8 @@ "@microsoft/applicationinsights-rollup-es5": "1.0.2", "grunt": "^1.5.3", "grunt-cli": "^1.4.3", - "@nevware21/grunt-ts-plugin": "^0.4.3", - "@nevware21/grunt-eslint-ts": "^0.2.2", + "@nevware21/grunt-ts-plugin": "^0.5.1", + "@nevware21/grunt-eslint-ts": "^0.5.1", "globby": "^11.0.0", "magic-string": "^0.25.7", "pako": "^2.0.3", diff --git a/examples/shared-worker/package.json b/examples/shared-worker/package.json index 3f835b04c..bfc748df4 100644 --- a/examples/shared-worker/package.json +++ b/examples/shared-worker/package.json @@ -41,8 +41,8 @@ "@microsoft/applicationinsights-rollup-es5": "1.0.2", "grunt": "^1.5.3", "grunt-cli": "^1.4.3", - "@nevware21/grunt-ts-plugin": "^0.4.3", - "@nevware21/grunt-eslint-ts": "^0.2.2", + "@nevware21/grunt-ts-plugin": "^0.5.1", + "@nevware21/grunt-eslint-ts": "^0.5.1", "globby": "^11.0.0", "magic-string": "^0.25.7", "pako": "^2.0.3", diff --git a/extensions/applicationinsights-analytics-js/package.json b/extensions/applicationinsights-analytics-js/package.json index 85552db69..bafcd4b19 100644 --- a/extensions/applicationinsights-analytics-js/package.json +++ b/extensions/applicationinsights-analytics-js/package.json @@ -49,8 +49,8 @@ "rollup-plugin-sourcemaps": "^0.6.3", "grunt": "^1.5.3", "grunt-cli": "^1.4.3", - "@nevware21/grunt-ts-plugin": "^0.4.3", - "@nevware21/grunt-eslint-ts": "^0.2.2", + "@nevware21/grunt-ts-plugin": "^0.5.1", + "@nevware21/grunt-eslint-ts": "^0.5.1", "qunit": "^2.11.2", "typedoc": "^0.26.6", "sinon": "^7.3.1" diff --git a/extensions/applicationinsights-analytics-js/src/JavaScriptSDK/AnalyticsPlugin.ts b/extensions/applicationinsights-analytics-js/src/JavaScriptSDK/AnalyticsPlugin.ts index d81c9f218..8cd0ad012 100644 --- a/extensions/applicationinsights-analytics-js/src/JavaScriptSDK/AnalyticsPlugin.ts +++ b/extensions/applicationinsights-analytics-js/src/JavaScriptSDK/AnalyticsPlugin.ts @@ -128,12 +128,6 @@ export class AnalyticsPlugin extends BaseTelemetryPlugin implements IAppInsights // New configuration variables for trace context management let _routeTraceStrategy: eRouteTraceStrategy; - // Counts number of trackAjax invocations. - // By default we only monitor X ajax call per view to avoid too much load. - // Default value is set in config. - // This counter keeps increasing even after the limit is reached. - let _trackAjaxAttempts: number = 0; - // array with max length of 2 that store current url and previous url for SPA page route change trackPageview use. let _prevUri: string; // Assigned in the constructor let _currUri: string; @@ -153,7 +147,7 @@ export class AnalyticsPlugin extends BaseTelemetryPlugin implements IAppInsights _self.processTelemetry = (env: ITelemetryItem, itemCtx?: IProcessTelemetryContext) => { _self.processNext(env, itemCtx); }; - + _self.trackEvent = (event: IEventTelemetry, customProperties?: ICustomProperties): void => { try { let telemetryItem = createTelemetryItem( @@ -218,7 +212,7 @@ export class AnalyticsPlugin extends BaseTelemetryPlugin implements IAppInsights TraceEnvelopeType, _self.diagLog(), customProperties); - + _self.core.track(telemetryItem); } catch (e) { _throwInternal(eLoggingSeverity.WARNING, @@ -247,7 +241,7 @@ export class AnalyticsPlugin extends BaseTelemetryPlugin implements IAppInsights _self.diagLog(), customProperties ); - + _self.core.track(telemetryItem); } catch (e) { _throwInternal(eLoggingSeverity.CRITICAL, @@ -269,7 +263,7 @@ export class AnalyticsPlugin extends BaseTelemetryPlugin implements IAppInsights if (_self.core && _self.core.config) { inPv.uri = fieldRedaction(inPv.uri, _self.core.config); } - _pageViewManager.trackPageView(inPv, {...inPv.properties, ...inPv.measurements, ...customProperties}); + _pageViewManager.trackPageView(inPv, { ...inPv.properties, ...inPv.measurements, ...customProperties }); if (_autoTrackPageVisitTime) { _pageVisitTimeManager.trackPreviousPageVisit(inPv.name, inPv.uri); @@ -328,7 +322,7 @@ export class AnalyticsPlugin extends BaseTelemetryPlugin implements IAppInsights _self.diagLog(), properties, systemProperties); - + _self.core.track(telemetryItem); }; @@ -363,7 +357,7 @@ export class AnalyticsPlugin extends BaseTelemetryPlugin implements IAppInsights let doc = getDocument(); name = doc && doc.title || ""; } - + _pageTracking.start(name); } catch (e) { _throwInternal( @@ -388,7 +382,7 @@ export class AnalyticsPlugin extends BaseTelemetryPlugin implements IAppInsights let doc = getDocument(); name = doc && doc.title || ""; } - + if (typeof url !== "string") { let loc = getLocation(); url = loc && loc.href || ""; @@ -397,7 +391,7 @@ export class AnalyticsPlugin extends BaseTelemetryPlugin implements IAppInsights url = fieldRedaction(url, _self.core.config); } _pageTracking.stop(name, url, properties, measurement); - + if (_autoTrackPageVisitTime) { _pageVisitTimeManager.trackPreviousPageVisit(name, url); } @@ -470,7 +464,7 @@ export class AnalyticsPlugin extends BaseTelemetryPlugin implements IAppInsights if (exception && !exception.exception && (exception as any).error) { exception.exception = (exception as any).error; } - + try { _self.sendExceptionInternal(exception, customProperties); } catch (e) { @@ -507,7 +501,7 @@ export class AnalyticsPlugin extends BaseTelemetryPlugin implements IAppInsights columnNumber: exception.columnNumber || 0, message: exception.message }; - + if (isCrossOriginError(exception.message, exception.url, exception.lineNumber, exception.columnNumber, exception.error)) { _sendCORSException(Exception.CreateAutoException( "Script error: The browser's same-origin policy prevents us from getting the details of this exception. Consider using the 'crossorigin' attribute.", @@ -527,7 +521,7 @@ export class AnalyticsPlugin extends BaseTelemetryPlugin implements IAppInsights } } catch (e) { const errorString = error ? (error.name + ", " + error.message) : "null"; - + _throwInternal( eLoggingSeverity.CRITICAL, _eInternalMessageId.ExceptionWhileLoggingError, @@ -552,7 +546,7 @@ export class AnalyticsPlugin extends BaseTelemetryPlugin implements IAppInsights _preInitTelemetryInitializers.push(telemetryInitializer); }; - _self.initialize = (config: IConfiguration & IConfig, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?:ITelemetryPluginChain) => { + _self.initialize = (config: IConfiguration & IConfig, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?: ITelemetryPluginChain) => { if (_self.isInitialized()) { return; } @@ -568,12 +562,12 @@ export class AnalyticsPlugin extends BaseTelemetryPlugin implements IAppInsights arrForEach(_preInitTelemetryInitializers, (initializer) => { core.addTelemetryInitializer(initializer); }); - + _preInitTelemetryInitializers = null; } _populateDefaults(config); - + _pageViewPerformanceManager = createPageViewPerformanceManager(_self.core); _pageViewManager = createPageViewManager(_self, _extConfig.overridePageViewDuration, _self.core, _pageViewPerformanceManager); _pageVisitTimeManager = createPageVisitTimeManager(_self.diagLog(), (pageName, pageUrl, pageVisitTime) => trackPageVisitTime(pageName, pageUrl, pageVisitTime)); @@ -584,19 +578,19 @@ export class AnalyticsPlugin extends BaseTelemetryPlugin implements IAppInsights if (!properties) { properties = {}; } - + if (!measurements) { measurements = {}; } - + properties.duration = duration.toString(); _self.trackEvent({ name, properties, measurements } as IEventTelemetry); } - + // initialize page view timing _pageTracking = createTiming(_self.diagLog(), "trackPageView"); _pageTracking.action = (name, url, duration, properties, measurements) => { - + // duration must be a custom property in order for the collector to extract it if (isNullOrUndefined(properties)) { properties = {}; diff --git a/extensions/applicationinsights-cfgsync-js/package.json b/extensions/applicationinsights-cfgsync-js/package.json index dec4a65a7..bd3aaba4d 100644 --- a/extensions/applicationinsights-cfgsync-js/package.json +++ b/extensions/applicationinsights-cfgsync-js/package.json @@ -36,8 +36,8 @@ "tslib": "^2.0.0", "grunt": "^1.5.3", "grunt-cli": "^1.4.3", - "@nevware21/grunt-ts-plugin": "^0.4.3", - "@nevware21/grunt-eslint-ts": "^0.2.2", + "@nevware21/grunt-ts-plugin": "^0.5.1", + "@nevware21/grunt-eslint-ts": "^0.5.1", "globby": "^11.0.0", "magic-string": "^0.25.7", "pako": "^2.0.3", diff --git a/extensions/applicationinsights-clickanalytics-js/package.json b/extensions/applicationinsights-clickanalytics-js/package.json index 6bcad9f61..1287b71de 100644 --- a/extensions/applicationinsights-clickanalytics-js/package.json +++ b/extensions/applicationinsights-clickanalytics-js/package.json @@ -42,8 +42,8 @@ "typedoc": "^0.26.6", "grunt": "^1.5.3", "grunt-cli": "^1.4.3", - "@nevware21/grunt-ts-plugin": "^0.4.3", - "@nevware21/grunt-eslint-ts": "^0.2.2" + "@nevware21/grunt-ts-plugin": "^0.5.1", + "@nevware21/grunt-eslint-ts": "^0.5.1" }, "peerDependencies": { "tslib": ">= 1.0.0" diff --git a/extensions/applicationinsights-debugplugin-js/package.json b/extensions/applicationinsights-debugplugin-js/package.json index 4d455352e..95d7dd44d 100644 --- a/extensions/applicationinsights-debugplugin-js/package.json +++ b/extensions/applicationinsights-debugplugin-js/package.json @@ -35,8 +35,8 @@ "tslib": "^2.0.0", "grunt": "^1.5.3", "grunt-cli": "^1.4.3", - "@nevware21/grunt-ts-plugin": "^0.4.3", - "@nevware21/grunt-eslint-ts": "^0.2.2", + "@nevware21/grunt-ts-plugin": "^0.5.1", + "@nevware21/grunt-eslint-ts": "^0.5.1", "globby": "^11.0.0", "magic-string": "^0.25.7", "@rollup/plugin-commonjs": "^24.0.0", diff --git a/extensions/applicationinsights-dependencies-js/package.json b/extensions/applicationinsights-dependencies-js/package.json index ec228aca7..0fd63cee3 100644 --- a/extensions/applicationinsights-dependencies-js/package.json +++ b/extensions/applicationinsights-dependencies-js/package.json @@ -37,8 +37,8 @@ "tslib": "^2.0.0", "grunt": "^1.5.3", "grunt-cli": "^1.4.3", - "@nevware21/grunt-ts-plugin": "^0.4.3", - "@nevware21/grunt-eslint-ts": "^0.2.2", + "@nevware21/grunt-ts-plugin": "^0.5.1", + "@nevware21/grunt-eslint-ts": "^0.5.1", "globby": "^11.0.0", "magic-string": "^0.25.7", "@rollup/plugin-commonjs": "^24.0.0", diff --git a/extensions/applicationinsights-dependencies-js/src/ajax.ts b/extensions/applicationinsights-dependencies-js/src/ajax.ts index 6cc0d50fa..2453191e3 100644 --- a/extensions/applicationinsights-dependencies-js/src/ajax.ts +++ b/extensions/applicationinsights-dependencies-js/src/ajax.ts @@ -28,7 +28,7 @@ const STR_FETCH = "fetch"; const ERROR_HEADER = "Failed to monitor XMLHttpRequest"; const ERROR_PREFIX = ", monitoring data for this ajax call "; -const ERROR_POSTFIX = ERROR_PREFIX + "may be incorrect."; +const ERROR_POSTFIX = ERROR_PREFIX + "may be incorrect."; const ERROR_NOT_SENT = ERROR_PREFIX + "won't be sent."; const CORRELATION_HEADER_ERROR = "Failed to get Request-Context correlation header as it may be not included in the response or not accessible."; const CUSTOM_REQUEST_CONTEXT_ERROR = "Failed to add custom defined request context as configured call back may missing a null check."; diff --git a/extensions/applicationinsights-perfmarkmeasure-js/package.json b/extensions/applicationinsights-perfmarkmeasure-js/package.json index ef2789c0a..cd0e59068 100644 --- a/extensions/applicationinsights-perfmarkmeasure-js/package.json +++ b/extensions/applicationinsights-perfmarkmeasure-js/package.json @@ -37,8 +37,8 @@ "tslib": "^2.0.0", "grunt": "^1.5.3", "grunt-cli": "^1.4.3", - "@nevware21/grunt-ts-plugin": "^0.4.3", - "@nevware21/grunt-eslint-ts": "^0.2.2", + "@nevware21/grunt-ts-plugin": "^0.5.1", + "@nevware21/grunt-eslint-ts": "^0.5.1", "globby": "^11.0.0", "magic-string": "^0.25.7", "pako": "^2.0.3", diff --git a/extensions/applicationinsights-properties-js/package.json b/extensions/applicationinsights-properties-js/package.json index b8187efb0..884c29306 100644 --- a/extensions/applicationinsights-properties-js/package.json +++ b/extensions/applicationinsights-properties-js/package.json @@ -37,8 +37,8 @@ "tslib": "^2.0.0", "grunt": "^1.5.3", "grunt-cli": "^1.4.3", - "@nevware21/grunt-ts-plugin": "^0.4.3", - "@nevware21/grunt-eslint-ts": "^0.2.2", + "@nevware21/grunt-ts-plugin": "^0.5.1", + "@nevware21/grunt-eslint-ts": "^0.5.1", "globby": "^11.0.0", "magic-string": "^0.25.7", "pako": "^2.0.3", diff --git a/package.json b/package.json index 38048b3d4..bbb1dc21a 100644 --- a/package.json +++ b/package.json @@ -48,9 +48,9 @@ }, "homepage": "https://github.com/microsoft/ApplicationInsights-JS#readme", "devDependencies": { - "@microsoft/rush": "5.166.0", - "@nevware21/grunt-eslint-ts": "^0.2.2", - "@nevware21/grunt-ts-plugin": "^0.4.3", + "@microsoft/rush": "5.167.0", + "@nevware21/grunt-eslint-ts": "^0.5.1", + "@nevware21/grunt-ts-plugin": "^0.5.1", "@rollup/plugin-commonjs": "^24.0.0", "@rollup/plugin-node-resolve": "^15.0.1", "@rollup/plugin-replace": "^5.0.2", diff --git a/rush.json b/rush.json index 340db740f..486241cee 100644 --- a/rush.json +++ b/rush.json @@ -1,7 +1,7 @@ { "$schema": "https://developer.microsoft.com/json-schemas/rush/v5/rush.schema.json", "npmVersion": "9.9.3", - "rushVersion": "5.166.0", + "rushVersion": "5.167.0", "projectFolderMaxDepth": 4, "projects": [ { diff --git a/shared/AppInsightsCommon/package.json b/shared/AppInsightsCommon/package.json index eebc93d87..7fd723184 100644 --- a/shared/AppInsightsCommon/package.json +++ b/shared/AppInsightsCommon/package.json @@ -34,8 +34,8 @@ "@microsoft/api-extractor": "^7.40.0", "grunt": "^1.5.3", "grunt-cli": "^1.4.3", - "@nevware21/grunt-ts-plugin": "^0.4.3", - "@nevware21/grunt-eslint-ts": "^0.2.2", + "@nevware21/grunt-ts-plugin": "^0.5.1", + "@nevware21/grunt-eslint-ts": "^0.5.1", "@rollup/plugin-commonjs": "^24.0.0", "@rollup/plugin-node-resolve": "^15.0.1", "@rollup/plugin-replace": "^5.0.2", diff --git a/shared/AppInsightsCore/StartSpan_Implementation.md b/shared/AppInsightsCore/StartSpan_Implementation.md deleted file mode 100644 index e69de29bb..000000000 diff --git a/shared/AppInsightsCore/Tests/Unit/src/Common/appinsights-common.tests.ts b/shared/AppInsightsCore/Tests/Unit/src/Common/appinsights-common.tests.ts deleted file mode 100644 index e3475cae6..000000000 --- a/shared/AppInsightsCore/Tests/Unit/src/Common/appinsights-common.tests.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { ApplicationInsightsTests } from "./AppInsightsCommon.tests"; -import { ExceptionTests } from "./Exception.tests"; -import { UtilTests } from "./Util.tests"; -import { ConnectionStringParserTests } from "./ConnectionStringParser.tests"; -import { SeverityLevelTests } from "./SeverityLevel.tests"; -import { RequestHeadersTests } from "./RequestHeaders.tests"; -import { ThrottleMgrTest } from "./ThrottleMgr.tests"; -import { GlobalTestHooks } from "../GlobalTestHooks.Test"; -import { W3CTraceStateModesTests } from "./W3CTraceStateModes.tests"; - -export function runTests() { - new GlobalTestHooks().registerTests(); - new ThrottleMgrTest().registerTests(); - new ApplicationInsightsTests().registerTests(); - new ExceptionTests().registerTests(); - new UtilTests().registerTests(); - new ConnectionStringParserTests().registerTests(); - new SeverityLevelTests().registerTests(); - new RequestHeadersTests().registerTests(); - new W3CTraceStateModesTests().registerTests(); -} diff --git a/shared/AppInsightsCore/Tests/Unit/src/ai/ApplicationInsightsCore.Tests.ts b/shared/AppInsightsCore/Tests/Unit/src/ai/ApplicationInsightsCore.Tests.ts index 22937cb82..15826fc36 100644 --- a/shared/AppInsightsCore/Tests/Unit/src/ai/ApplicationInsightsCore.Tests.ts +++ b/shared/AppInsightsCore/Tests/Unit/src/ai/ApplicationInsightsCore.Tests.ts @@ -2,15 +2,14 @@ import { Assert, AITestClass, PollingAssert } from "@microsoft/ai-test-framework import { IConfiguration, ITelemetryPlugin, ITelemetryItem, IPlugin, IAppInsightsCore, normalizeJsName, random32, mwcRandomSeed, newId, randomValue, mwcRandom32, isNullOrUndefined, SenderPostManager, - OnCompleteCallback, IPayloadData, _ISenderOnComplete, TransportType, _ISendPostMgrConfig, fieldRedaction, - isString -} from "../../../src/index" -import { AppInsightsCore } from "../../../src/core/AppInsightsCore"; -import { IChannelControls } from "../../../src/interfaces/ai/IChannelControls"; -import { _eInternalMessageId, LoggingSeverity } from "../../../src/enums/ai/LoggingEnums"; -import { _InternalLogMessage, DiagnosticLogger } from "../../../src/diagnostics/DiagnosticLogger"; -import { ActiveStatus } from "../../../src/enums/ai/InitActiveStatusEnum"; -import { createAsyncPromise, createAsyncRejectedPromise, createAsyncResolvedPromise, createPromise, createTimeoutPromise, doAwait, doAwaitResponse } from "@nevware21/ts-async"; + OnCompleteCallback, IPayloadData, _ISenderOnComplete, TransportType, _ISendPostMgrConfig, fieldRedaction +} from "../../../../src/index" +import { AppInsightsCore } from "../../../../src/core/AppInsightsCore"; +import { IChannelControls } from "../../../../src/interfaces/ai/IChannelControls"; +import { _eInternalMessageId, LoggingSeverity } from "../../../../src/enums/ai/LoggingEnums"; +import { _InternalLogMessage, DiagnosticLogger } from "../../../../src/diagnostics/DiagnosticLogger"; +import { ActiveStatus } from "../../../../src/enums/ai/InitActiveStatusEnum"; +import { createAsyncPromise, createAsyncRejectedPromise, createAsyncResolvedPromise, createTimeoutPromise, doAwaitResponse } from "@nevware21/ts-async"; import { setBypassLazyCache } from "@nevware21/ts-utils"; const AIInternalMessagePrefix = "AITR_"; diff --git a/shared/AppInsightsCore/Tests/Unit/src/ai/CookieManager.Tests.ts b/shared/AppInsightsCore/Tests/Unit/src/ai/CookieManager.Tests.ts index 32bfe6074..a07f2af40 100644 --- a/shared/AppInsightsCore/Tests/Unit/src/ai/CookieManager.Tests.ts +++ b/shared/AppInsightsCore/Tests/Unit/src/ai/CookieManager.Tests.ts @@ -1,7 +1,7 @@ import { Assert, AITestClass } from "@microsoft/ai-test-framework"; -import { AppInsightsCore, createCookieMgr, IAppInsightsCore, IConfiguration, ICookieMgrConfig, IPlugin, ITelemetryItem, newId, objExtend } from "../../../src/index" -import { _eInternalMessageId } from "../../../src/enums/ai/LoggingEnums"; -import { _InternalLogMessage } from "../../../src/diagnostics/DiagnosticLogger"; +import { AppInsightsCore, createCookieMgr, IAppInsightsCore, IConfiguration, ICookieMgrConfig, IPlugin, ITelemetryItem, newId, objExtend } from "../../../../src/index" +import { _eInternalMessageId } from "../../../../src/enums/ai/LoggingEnums"; +import { _InternalLogMessage } from "../../../../src/diagnostics/DiagnosticLogger"; import { setBypassLazyCache } from "@nevware21/ts-utils"; export class CookieManagerTests extends AITestClass { diff --git a/shared/AppInsightsCore/Tests/Unit/src/ai/EventHelper.Tests.ts b/shared/AppInsightsCore/Tests/Unit/src/ai/EventHelper.Tests.ts index a91f419f2..91233c3b1 100644 --- a/shared/AppInsightsCore/Tests/Unit/src/ai/EventHelper.Tests.ts +++ b/shared/AppInsightsCore/Tests/Unit/src/ai/EventHelper.Tests.ts @@ -1,8 +1,8 @@ import { Assert, AITestClass } from "@microsoft/ai-test-framework"; -import { addEventHandler, createUniqueNamespace, removeEventHandler } from "../../../src/index"; -import { _eInternalMessageId } from "../../../src/enums/ai/LoggingEnums"; -import { _InternalLogMessage } from "../../../src/diagnostics/DiagnosticLogger"; -import { mergeEvtNamespace, __getRegisteredEvents } from "../../../src/internal/EventHelpers"; +import { addEventHandler, createUniqueNamespace, removeEventHandler } from "../../../../src/index"; +import { _eInternalMessageId } from "../../../../src/enums/ai/LoggingEnums"; +import { _InternalLogMessage } from "../../../../src/diagnostics/DiagnosticLogger"; +import { mergeEvtNamespace, __getRegisteredEvents } from "../../../../src/internal/EventHelpers"; import { setBypassLazyCache } from "@nevware21/ts-utils"; export class EventHelperTests extends AITestClass { diff --git a/shared/AppInsightsCore/Tests/Unit/src/ai/EventsDiscardedReason.Tests.ts b/shared/AppInsightsCore/Tests/Unit/src/ai/EventsDiscardedReason.Tests.ts index 1ff46d9f5..b48486d99 100644 --- a/shared/AppInsightsCore/Tests/Unit/src/ai/EventsDiscardedReason.Tests.ts +++ b/shared/AppInsightsCore/Tests/Unit/src/ai/EventsDiscardedReason.Tests.ts @@ -1,5 +1,5 @@ import { Assert, AITestClass } from "@microsoft/ai-test-framework"; -import { eEventsDiscardedReason, EventsDiscardedReason } from "../../../src/enums/ai/EventsDiscardedReason"; +import { eEventsDiscardedReason, EventsDiscardedReason } from "../../../../src/enums/ai/EventsDiscardedReason"; export class EventsDiscardedReasonTests extends AITestClass { diff --git a/shared/AppInsightsCore/Tests/Unit/src/ai/GlobalTestHooks.Test.ts b/shared/AppInsightsCore/Tests/Unit/src/ai/GlobalTestHooks.Test.ts index 2b4370171..1b1f56955 100644 --- a/shared/AppInsightsCore/Tests/Unit/src/ai/GlobalTestHooks.Test.ts +++ b/shared/AppInsightsCore/Tests/Unit/src/ai/GlobalTestHooks.Test.ts @@ -1,5 +1,5 @@ import { Assert } from "@microsoft/ai-test-framework"; -import { _testHookMaxUnloadHooksCb } from "../../../src/core/UnloadHookContainer"; +import { _testHookMaxUnloadHooksCb } from "../../../../src/core/UnloadHookContainer"; import { dumpObj } from "@nevware21/ts-utils"; export class GlobalTestHooks { diff --git a/shared/AppInsightsCore/Tests/Unit/src/ai/HelperFunc.Tests.ts b/shared/AppInsightsCore/Tests/Unit/src/ai/HelperFunc.Tests.ts index 8ebec0710..2b157734e 100644 --- a/shared/AppInsightsCore/Tests/Unit/src/ai/HelperFunc.Tests.ts +++ b/shared/AppInsightsCore/Tests/Unit/src/ai/HelperFunc.Tests.ts @@ -1,10 +1,10 @@ import { Assert, AITestClass } from "@microsoft/ai-test-framework"; -import { _eInternalMessageId } from "../../../src/enums/ai/LoggingEnums"; -import { _InternalLogMessage } from "../../../src/diagnostics/DiagnosticLogger"; -import { normalizeJsName, objExtend, _getObjProto, isFeatureEnabled } from "../../../src/utils/HelperFuncs"; -import { AppInsightsCore } from "../../../src/core/AppInsightsCore"; +import { _eInternalMessageId } from "../../../../src/enums/ai/LoggingEnums"; +import { _InternalLogMessage } from "../../../../src/diagnostics/DiagnosticLogger"; +import { normalizeJsName, objExtend, _getObjProto, isFeatureEnabled } from "../../../../src/utils/HelperFuncs"; +import { AppInsightsCore } from "../../../../src/core/AppInsightsCore"; import { isArray, isObject, objKeys, strEndsWith, strStartsWith, isPlainObject, utcNow } from "@nevware21/ts-utils"; -import { FeatureOptInMode, IConfiguration, IFeatureOptInDetails, dumpObj } from "../../../src/index"; +import { FeatureOptInMode, IConfiguration, IFeatureOptInDetails, dumpObj } from "../../../../src/index"; diff --git a/shared/AppInsightsCore/Tests/Unit/src/ai/LoggingEnum.Tests.ts b/shared/AppInsightsCore/Tests/Unit/src/ai/LoggingEnum.Tests.ts index 3a47e7b01..1608fe7f6 100644 --- a/shared/AppInsightsCore/Tests/Unit/src/ai/LoggingEnum.Tests.ts +++ b/shared/AppInsightsCore/Tests/Unit/src/ai/LoggingEnum.Tests.ts @@ -1,7 +1,7 @@ import { Assert, AITestClass } from "@microsoft/ai-test-framework"; import { isString, objForEachKey } from "@nevware21/ts-utils"; -import { LoggingSeverity, eLoggingSeverity, _eInternalMessageId } from "../../../src/enums/ai/LoggingEnums"; -import { _InternalLogMessage } from "../../../src/diagnostics/DiagnosticLogger"; +import { LoggingSeverity, eLoggingSeverity, _eInternalMessageId } from "../../../../src/enums/ai/LoggingEnums"; +import { _InternalLogMessage } from "../../../../src/diagnostics/DiagnosticLogger"; type NoRepeats = { [M in keyof T]: { [N in keyof T]: N extends M ? never : T[M] extends T[N] ? unknown : never diff --git a/shared/AppInsightsCore/Tests/Unit/src/ai/SendPostManager.Tests.ts b/shared/AppInsightsCore/Tests/Unit/src/ai/SendPostManager.Tests.ts index cad8d04d5..40c0ca24f 100644 --- a/shared/AppInsightsCore/Tests/Unit/src/ai/SendPostManager.Tests.ts +++ b/shared/AppInsightsCore/Tests/Unit/src/ai/SendPostManager.Tests.ts @@ -1,8 +1,8 @@ import { Assert, AITestClass } from "@microsoft/ai-test-framework"; -import { _eInternalMessageId } from "../../../src/enums/ai/LoggingEnums"; -import { _InternalLogMessage } from "../../../src/diagnostics/DiagnosticLogger"; -import { SenderPostManager } from "../../../src/core/SenderPostManager"; -import { IPayloadData } from "../../../src/interfaces/ai/IXHROverride"; +import { _eInternalMessageId } from "../../../../src/enums/ai/LoggingEnums"; +import { _InternalLogMessage } from "../../../../src/diagnostics/DiagnosticLogger"; +import { SenderPostManager } from "../../../../src/core/SenderPostManager"; +import { IPayloadData } from "../../../../src/interfaces/ai/IXHROverride"; import { getInst, isFunction, mathRandom } from "@nevware21/ts-utils"; import { createPromise, doAwaitResponse } from "@nevware21/ts-async"; diff --git a/shared/AppInsightsCore/Tests/Unit/src/ai/StatsBeat.Tests.ts b/shared/AppInsightsCore/Tests/Unit/src/ai/StatsBeat.Tests.ts index 9d66d0166..fef4337fa 100644 --- a/shared/AppInsightsCore/Tests/Unit/src/ai/StatsBeat.Tests.ts +++ b/shared/AppInsightsCore/Tests/Unit/src/ai/StatsBeat.Tests.ts @@ -1,16 +1,16 @@ // import * as sinon from "sinon"; // import { Assert, AITestClass } from "@microsoft/ai-test-framework"; -// import { IPayloadData } from "../../../src/interfaces/ai/IXHROverride"; -// import { IStatsMgr } from "../../../src/JavaScriptSDK.Interfaces/IStatsMgr"; -// import { AppInsightsCore } from "../../../src/core/AppInsightsCore"; -// import { IConfiguration } from "../../../src/interfaces/ai/IConfiguration"; -// import { createStatsMgr } from "../../../src/JavaScriptSDK/StatsBeat"; -// import { IStatsBeatState } from "../../../src/JavaScriptSDK.Interfaces/IStatsBeat"; -// import { eStatsType } from "../../../src/JavaScriptSDK.Enums/StatsType"; -// import { ITelemetryItem } from "../../../src/interfaces/ai/ITelemetryItem"; -// import { IPlugin } from "../../../src/interfaces/ai/ITelemetryPlugin"; -// import { IAppInsightsCore } from "../../../src/interfaces/ai/IAppInsightsCore"; -// import { FeatureOptInMode } from "../../../src/JavaScriptSDK.Enums/FeatureOptInEnums"; +// import { IPayloadData } from "../../../../src/interfaces/ai/IXHROverride"; +// import { IStatsMgr } from "../../../../src/JavaScriptSDK.Interfaces/IStatsMgr"; +// import { AppInsightsCore } from "../../../../src/core/AppInsightsCore"; +// import { IConfiguration } from "../../../../src/interfaces/ai/IConfiguration"; +// import { createStatsMgr } from "../../../../src/JavaScriptSDK/StatsBeat"; +// import { IStatsBeatState } from "../../../../src/JavaScriptSDK.Interfaces/IStatsBeat"; +// import { eStatsType } from "../../../../src/JavaScriptSDK.Enums/StatsType"; +// import { ITelemetryItem } from "../../../../src/interfaces/ai/ITelemetryItem"; +// import { IPlugin } from "../../../../src/interfaces/ai/ITelemetryPlugin"; +// import { IAppInsightsCore } from "../../../../src/interfaces/ai/IAppInsightsCore"; +// import { FeatureOptInMode } from "../../../../src/JavaScriptSDK.Enums/FeatureOptInEnums"; // const STATS_COLLECTION_SHORT_INTERVAL: number = 900; // 15 minutes diff --git a/shared/AppInsightsCore/Tests/Unit/src/ai/TestPlugins.ts b/shared/AppInsightsCore/Tests/Unit/src/ai/TestPlugins.ts index b81c3a3f8..f3277c0f6 100644 --- a/shared/AppInsightsCore/Tests/Unit/src/ai/TestPlugins.ts +++ b/shared/AppInsightsCore/Tests/Unit/src/ai/TestPlugins.ts @@ -1,16 +1,16 @@ import { Assert, AITestClass } from "@microsoft/ai-test-framework"; -import { _eInternalMessageId } from "../../../src/enums/ai/LoggingEnums"; -import { _InternalLogMessage } from "../../../src/diagnostics/DiagnosticLogger"; -import { ITelemetryItem } from "../../../src/interfaces/ai/ITelemetryItem"; -import { IProcessTelemetryContext, IProcessTelemetryUpdateContext } from "../../../src/interfaces/ai/IProcessTelemetryContext"; -import { TelemetryUpdateReason } from "../../../src/enums/ai/TelemetryUpdateReason"; -import { IConfiguration } from "../../../src/interfaces/ai/IConfiguration"; -import { IPlugin, ITelemetryPlugin } from "../../../src/interfaces/ai/ITelemetryPlugin"; -import { BaseTelemetryPlugin } from "../../../src/core/BaseTelemetryPlugin"; -import { IAppInsightsCore } from "../../../src/interfaces/ai/IAppInsightsCore"; -import { ITelemetryPluginChain } from "../../../src/interfaces/ai/ITelemetryPluginChain"; -import { ITelemetryUpdateState } from "../../../src/interfaces/ai/ITelemetryUpdateState"; -import { IChannelControls } from "../../../src/interfaces/ai/IChannelControls"; +import { _eInternalMessageId } from "../../../../src/enums/ai/LoggingEnums"; +import { _InternalLogMessage } from "../../../../src/diagnostics/DiagnosticLogger"; +import { ITelemetryItem } from "../../../../src/interfaces/ai/ITelemetryItem"; +import { IProcessTelemetryContext, IProcessTelemetryUpdateContext } from "../../../../src/interfaces/ai/IProcessTelemetryContext"; +import { TelemetryUpdateReason } from "../../../../src/enums/ai/TelemetryUpdateReason"; +import { IConfiguration } from "../../../../src/interfaces/ai/IConfiguration"; +import { IPlugin, ITelemetryPlugin } from "../../../../src/interfaces/ai/ITelemetryPlugin"; +import { BaseTelemetryPlugin } from "../../../../src/core/BaseTelemetryPlugin"; +import { IAppInsightsCore } from "../../../../src/interfaces/ai/IAppInsightsCore"; +import { ITelemetryPluginChain } from "../../../../src/interfaces/ai/ITelemetryPluginChain"; +import { ITelemetryUpdateState } from "../../../../src/interfaces/ai/ITelemetryUpdateState"; +import { IChannelControls } from "../../../../src/interfaces/ai/IChannelControls"; export class TestPlugin implements IPlugin { diff --git a/shared/AppInsightsCore/Tests/Unit/src/ai/UpdateConfig.Tests.ts b/shared/AppInsightsCore/Tests/Unit/src/ai/UpdateConfig.Tests.ts index 9d6d08de4..d6fce3c81 100644 --- a/shared/AppInsightsCore/Tests/Unit/src/ai/UpdateConfig.Tests.ts +++ b/shared/AppInsightsCore/Tests/Unit/src/ai/UpdateConfig.Tests.ts @@ -1,9 +1,9 @@ import { Assert, AITestClass } from "@microsoft/ai-test-framework"; import { dumpObj } from "@nevware21/ts-utils"; -import { AppInsightsCore } from "../../../src/core/AppInsightsCore"; -import { _eInternalMessageId } from "../../../src/enums/ai/LoggingEnums"; -import { _InternalLogMessage } from "../../../src/diagnostics/DiagnosticLogger"; -import { IConfiguration } from "../../../src/interfaces/ai/IConfiguration"; +import { AppInsightsCore } from "../../../../src/core/AppInsightsCore"; +import { _eInternalMessageId } from "../../../../src/enums/ai/LoggingEnums"; +import { _InternalLogMessage } from "../../../../src/diagnostics/DiagnosticLogger"; +import { IConfiguration } from "../../../../src/interfaces/ai/IConfiguration"; import { OldTrackPlugin, TestChannelPlugin, TestPlugin, TestSamplingPlugin, TrackPlugin } from "./TestPlugins"; const AIInternalMessagePrefix = "AITR_"; diff --git a/shared/AppInsightsCore/Tests/Unit/src/aiunittests.ts b/shared/AppInsightsCore/Tests/Unit/src/aiunittests.ts index 575a29a4a..90ae0a7da 100644 --- a/shared/AppInsightsCore/Tests/Unit/src/aiunittests.ts +++ b/shared/AppInsightsCore/Tests/Unit/src/aiunittests.ts @@ -1,36 +1,36 @@ -import '@microsoft/applicationinsights-shims'; -import { ApplicationInsightsCoreTests } from "./ApplicationInsightsCore.Tests"; -import { CookieManagerTests } from "./CookieManager.Tests"; -import { GlobalTestHooks } from "./GlobalTestHooks.Test"; -import { HelperFuncTests } from './HelperFunc.Tests'; -import { AppInsightsCoreSizeCheck } from "./AppInsightsCoreSize.Tests"; -import { EventHelperTests } from "./EventHelper.Tests"; -import { LoggingEnumTests } from "./LoggingEnum.Tests"; -import { DynamicTests } from "./Dynamic.Tests"; -import { UpdateConfigTests } from "./UpdateConfig.Tests"; -import { EventsDiscardedReasonTests } from "./EventsDiscardedReason.Tests"; -import { W3cTraceParentTests } from "./W3cTraceParentTests"; -import { DynamicConfigTests } from "./DynamicConfig.Tests"; -import { SendPostManagerTests } from './SendPostManager.Tests'; -// import { StatsBeatTests } from './StatsBeat.Tests'; -import { OTelTraceApiTests } from './OpenTelemetry/traceState.Tests'; -import { CommonUtilsTests } from './OpenTelemetry/commonUtils.Tests'; -import { OpenTelemetryErrorsTests } from './OpenTelemetry/errors.Tests'; -import { SpanTests } from './OpenTelemetry/span.Tests'; -import { AttributeContainerTests } from './OpenTelemetry/attributeContainer.Tests'; -import { W3cTraceStateTests } from './W3TraceState.Tests'; -import { OTelNegativeTests } from './OpenTelemetry/otelNegative.Tests'; -import { TraceUtilsTests } from './OpenTelemetry/traceUtils.Tests'; +import "@microsoft/applicationinsights-shims"; +import { ApplicationInsightsCoreTests } from "./ai/ApplicationInsightsCore.Tests"; +import { CookieManagerTests } from "./ai/CookieManager.Tests"; +import { GlobalTestHooks } from "./ai/GlobalTestHooks.Test"; +import { HelperFuncTests } from "./ai/HelperFunc.Tests"; +import { AppInsightsCoreSizeCheck } from "./ai/AppInsightsCoreSize.Tests"; +import { EventHelperTests } from "./ai/EventHelper.Tests"; +import { LoggingEnumTests } from "./ai/LoggingEnum.Tests"; +import { DynamicTests } from "./config/Dynamic.Tests"; +import { UpdateConfigTests } from "./ai/UpdateConfig.Tests"; +import { EventsDiscardedReasonTests } from "./ai/EventsDiscardedReason.Tests"; +import { W3cTraceParentTests } from "./trace/W3cTraceParentTests"; +import { DynamicConfigTests } from "./config/DynamicConfig.Tests"; +import { SendPostManagerTests } from "./ai/SendPostManager.Tests"; +// import { StatsBeatTests } from "./StatsBeat.Tests"; +import { OTelTraceApiTests } from "./trace/traceState.Tests"; +import { CommonUtilsTests } from "./OpenTelemetry/commonUtils.Tests"; +import { OpenTelemetryErrorsTests } from "./OpenTelemetry/errors.Tests"; +import { SpanTests } from "./trace/span.Tests"; +import { AttributeContainerTests } from "./attribute/attributeContainer.Tests"; +import { W3cTraceStateTests } from "./trace/W3cTraceState.Tests"; +import { OTelNegativeTests } from "./OpenTelemetry/otelNegative.Tests"; +import { TraceUtilsTests } from "./trace/traceUtils.Tests"; // Application Insights Common tests (merged from AppInsightsCommon) -import { ApplicationInsightsTests } from './Common/AppInsightsCommon.tests'; -import { ConnectionStringParserTests } from './Common/ConnectionStringParser.tests'; -import { ExceptionTests } from './Common/Exception.tests'; -import { RequestHeadersTests } from './Common/RequestHeaders.tests'; -import { SeverityLevelTests } from './Common/SeverityLevel.tests'; -import { ThrottleMgrTest } from './Common/ThrottleMgr.tests'; -import { UtilTests } from './Common/Util.tests'; -import { W3CTraceStateModesTests } from './Common/W3CTraceStateModes.tests'; +import { ApplicationInsightsTests } from "./ai/AppInsightsCommon.tests"; +import { ConnectionStringParserTests } from "./ai/ConnectionStringParser.tests"; +import { ExceptionTests } from "./ai/Exception.tests"; +import { RequestHeadersTests } from "./ai/RequestHeaders.tests"; +import { SeverityLevelTests } from "./ai/SeverityLevel.tests"; +import { ThrottleMgrTest } from "./ai/ThrottleMgr.tests"; +import { UtilTests } from "./ai/Util.tests"; +import { W3CTraceStateModesTests } from "./trace/W3CTraceStateModes.tests"; export function runTests() { new GlobalTestHooks().registerTests(); diff --git a/shared/AppInsightsCore/Tests/Unit/src/config/Dynamic.Tests.ts b/shared/AppInsightsCore/Tests/Unit/src/config/Dynamic.Tests.ts index 22d6b024e..916234bb2 100644 --- a/shared/AppInsightsCore/Tests/Unit/src/config/Dynamic.Tests.ts +++ b/shared/AppInsightsCore/Tests/Unit/src/config/Dynamic.Tests.ts @@ -1,16 +1,16 @@ import { Assert, AITestClass } from "@microsoft/ai-test-framework"; import { dumpObj } from "@nevware21/ts-utils"; -import { AppInsightsCore } from "../../../src/core/AppInsightsCore"; -import { _eInternalMessageId } from "../../../src/enums/ai/LoggingEnums"; -import { _InternalLogMessage } from "../../../src/diagnostics/DiagnosticLogger"; -import { IConfiguration } from "../../../src/interfaces/ai/IConfiguration"; -import { IPlugin, ITelemetryPlugin } from "../../../src/interfaces/ai/ITelemetryPlugin"; -import { ITelemetryItem } from "../../../src/interfaces/ai/ITelemetryItem"; -import { BaseTelemetryPlugin } from "../../../src/core/BaseTelemetryPlugin"; -import { IAppInsightsCore } from "../../../src/interfaces/ai/IAppInsightsCore"; -import { ITelemetryPluginChain } from "../../../src/interfaces/ai/ITelemetryPluginChain"; -import { IProcessTelemetryContext } from "../../../src/interfaces/ai/IProcessTelemetryContext"; -import { OldTrackPlugin, TestChannelPlugin, TestPlugin } from "./TestPlugins"; +import { AppInsightsCore } from "../../../../src/core/AppInsightsCore"; +import { _eInternalMessageId } from "../../../../src/enums/ai/LoggingEnums"; +import { _InternalLogMessage } from "../../../../src/diagnostics/DiagnosticLogger"; +import { IConfiguration } from "../../../../src/interfaces/ai/IConfiguration"; +import { IPlugin, ITelemetryPlugin } from "../../../../src/interfaces/ai/ITelemetryPlugin"; +import { ITelemetryItem } from "../../../../src/interfaces/ai/ITelemetryItem"; +import { BaseTelemetryPlugin } from "../../../../src/core/BaseTelemetryPlugin"; +import { IAppInsightsCore } from "../../../../src/interfaces/ai/IAppInsightsCore"; +import { ITelemetryPluginChain } from "../../../../src/interfaces/ai/ITelemetryPluginChain"; +import { IProcessTelemetryContext } from "../../../../src/interfaces/ai/IProcessTelemetryContext"; +import { OldTrackPlugin, TestChannelPlugin, TestPlugin } from "../ai/TestPlugins"; export class DynamicTests extends AITestClass { diff --git a/shared/AppInsightsCore/Tests/Unit/src/config/DynamicConfig.Tests.ts b/shared/AppInsightsCore/Tests/Unit/src/config/DynamicConfig.Tests.ts index e80c745f3..9e1b2ee03 100644 --- a/shared/AppInsightsCore/Tests/Unit/src/config/DynamicConfig.Tests.ts +++ b/shared/AppInsightsCore/Tests/Unit/src/config/DynamicConfig.Tests.ts @@ -1,21 +1,21 @@ import { Assert, AITestClass } from "@microsoft/ai-test-framework"; -import { eLoggingSeverity, _eInternalMessageId, LoggingSeverity, _InternalMessageId } from "../../../src/enums/ai/LoggingEnums"; -import { _InternalLogMessage } from "../../../src/diagnostics/DiagnosticLogger"; -import { IConfigDefaults } from "../../../src/interfaces/config/IConfigDefaults"; -import { IConfiguration } from "../../../src/interfaces/ai/IConfiguration"; -import { blockDynamicConversion, forceDynamicConversion, getDynamicConfigHandler } from "../../../src/config/DynamicSupport"; -import { createDynamicConfig, onConfigChange } from "../../../src/config/DynamicConfig"; +import { eLoggingSeverity, _eInternalMessageId, LoggingSeverity, _InternalMessageId } from "../../../../src/enums/ai/LoggingEnums"; +import { _InternalLogMessage } from "../../../../src/diagnostics/DiagnosticLogger"; +import { IConfigDefaults } from "../../../../src/interfaces/config/IConfigDefaults"; +import { IConfiguration } from "../../../../src/interfaces/ai/IConfiguration"; +import { blockDynamicConversion, forceDynamicConversion, getDynamicConfigHandler } from "../../../../src/config/DynamicSupport"; +import { createDynamicConfig, onConfigChange } from "../../../../src/config/DynamicConfig"; import { arrForEach, dumpObj, isArray, isFunction, objForEachKey, objKeys, isPlainObject, objHasOwn, objDeepFreeze, objDefineProps, strContains } from "@nevware21/ts-utils"; -import { IAppInsightsCore } from "../../../src/interfaces/ai/IAppInsightsCore"; -import { INotificationManager } from "../../../src/interfaces/ai/INotificationManager"; -import { IPerfManager } from "../../../src/interfaces/ai/IPerfManager"; -import { AppInsightsCore, DiagnosticLogger, IDiagnosticLogger, IProcessTelemetryContext } from "../../../src/index"; -import { ITelemetryItem } from "../../../src/interfaces/ai/ITelemetryItem"; -import { ITelemetryPluginChain } from "../../../src/interfaces/ai/ITelemetryPluginChain"; -import { ITelemetryPlugin } from "../../../src/interfaces/ai/ITelemetryPlugin"; -import { IChannelControls } from "../../../src/interfaces/ai/IChannelControls"; -import { TestPlugin, TestSamplingPlugin, TrackPlugin } from "./TestPlugins"; -import { STR_CHANNELS, STR_CREATE_PERF_MGR, STR_EXTENSIONS, STR_EXTENSION_CONFIG, UNDEFINED_VALUE } from "../../../src/constants/InternalConstants"; +import { IAppInsightsCore } from "../../../../src/interfaces/ai/IAppInsightsCore"; +import { INotificationManager } from "../../../../src/interfaces/ai/INotificationManager"; +import { IPerfManager } from "../../../../src/interfaces/ai/IPerfManager"; +import { AppInsightsCore, DiagnosticLogger, IDiagnosticLogger, IProcessTelemetryContext } from "../../../../src/index"; +import { ITelemetryItem } from "../../../../src/interfaces/ai/ITelemetryItem"; +import { ITelemetryPluginChain } from "../../../../src/interfaces/ai/ITelemetryPluginChain"; +import { ITelemetryPlugin } from "../../../../src/interfaces/ai/ITelemetryPlugin"; +import { IChannelControls } from "../../../../src/interfaces/ai/IChannelControls"; +import { TestPlugin, TestSamplingPlugin, TrackPlugin } from "../ai/TestPlugins"; +import { STR_CHANNELS, STR_CREATE_PERF_MGR, STR_EXTENSIONS, STR_EXTENSION_CONFIG, UNDEFINED_VALUE } from "../../../../src/constants/InternalConstants"; const coreDefaultConfig: IConfigDefaults = objDeepFreeze({ cookieCfg: {}, diff --git a/shared/AppInsightsCore/Tests/Unit/src/trace/W3cTraceParentTests.ts b/shared/AppInsightsCore/Tests/Unit/src/trace/W3cTraceParentTests.ts index 99c02f9ea..06e5411dd 100644 --- a/shared/AppInsightsCore/Tests/Unit/src/trace/W3cTraceParentTests.ts +++ b/shared/AppInsightsCore/Tests/Unit/src/trace/W3cTraceParentTests.ts @@ -1,8 +1,8 @@ import { Assert, AITestClass } from "@microsoft/ai-test-framework"; import { utcNow } from "@nevware21/ts-utils"; -import { ITraceParent } from "../../../src/interfaces/ai/ITraceParent"; -import { generateW3CId, newGuid } from "../../../src/utils/CoreUtils"; -import { formatTraceParent, isSampledFlag, isValidSpanId, isValidTraceId, isValidTraceParent, parseTraceParent } from "../../../src/utils/TraceParent"; +import { ITraceParent } from "../../../../src/interfaces/ai/ITraceParent"; +import { generateW3CId, newGuid } from "../../../../src/utils/CoreUtils"; +import { formatTraceParent, isSampledFlag, isValidSpanId, isValidTraceId, isValidTraceParent, parseTraceParent } from "../../../../src/utils/TraceParent"; export class W3cTraceParentTests extends AITestClass { diff --git a/shared/AppInsightsCore/Tests/Unit/src/trace/W3cTraceState.Tests.ts b/shared/AppInsightsCore/Tests/Unit/src/trace/W3cTraceState.Tests.ts index 46afae8d9..711ef1880 100644 --- a/shared/AppInsightsCore/Tests/Unit/src/trace/W3cTraceState.Tests.ts +++ b/shared/AppInsightsCore/Tests/Unit/src/trace/W3cTraceState.Tests.ts @@ -1,6 +1,6 @@ import { Assert, AITestClass } from "@microsoft/ai-test-framework"; import { asString, strRepeat } from "@nevware21/ts-utils"; -import { createW3cTraceState, isW3cTraceState, snapshotW3cTraceState } from "../../../src/telemetry/W3cTraceState"; +import { createW3cTraceState, isW3cTraceState, snapshotW3cTraceState } from "../../../../src/telemetry/W3cTraceState"; export class W3cTraceStateTests extends AITestClass { diff --git a/shared/AppInsightsCore/Tests/Unit/src/trace/span.Tests.ts b/shared/AppInsightsCore/Tests/Unit/src/trace/span.Tests.ts index 83e5b7cdc..20c195960 100644 --- a/shared/AppInsightsCore/Tests/Unit/src/trace/span.Tests.ts +++ b/shared/AppInsightsCore/Tests/Unit/src/trace/span.Tests.ts @@ -558,10 +558,10 @@ export class SpanTests extends AITestClass { // Assert Assert.ok(span, "Span should be created via core.startSpan"); - const readableSpan = span! as IReadableSpan; + const readableSpan = span as IReadableSpan; Assert.equal(readableSpan.name, "integration-test-span", "Span name should match"); Assert.equal(readableSpan.kind, eOTelSpanKind.SERVER, "Span kind should match"); - Assert.ok(span!.isRecording(), "Span should be recording"); + Assert.ok(span?.isRecording(), "Span should be recording"); Assert.ok(!readableSpan.ended, "Span should not be ended initially"); } }); @@ -576,10 +576,10 @@ export class SpanTests extends AITestClass { // Act Assert.ok(span, "Span should be created"); - span!.end(); + span?.end(); // Assert - const readableSpan = span! as IReadableSpan; + const readableSpan = span as IReadableSpan; Assert.ok(readableSpan.ended, "Span should be ended"); Assert.equal(this._onEndCalls.length, 1, "onEnd callback should be called once"); Assert.equal(this._onEndCalls[0].name, "callback-test-span", "onEnd should receive the correct span"); @@ -605,9 +605,9 @@ export class SpanTests extends AITestClass { // Assert Assert.ok(span, "Child span should be created"); - const spanContext = span!.spanContext(); - Assert.equal(spanContext.traceId, parentTraceContext.traceId, "Child span should inherit parent trace ID"); - Assert.notEqual(spanContext.spanId, parentTraceContext.spanId, "Child span should have different span ID"); + const spanContext = span?.spanContext(); + Assert.equal(spanContext?.traceId, parentTraceContext.traceId, "Child span should inherit parent trace ID"); + Assert.notEqual(spanContext?.spanId, parentTraceContext.spanId, "Child span should have different span ID"); } }); @@ -627,8 +627,8 @@ export class SpanTests extends AITestClass { // Assert Assert.ok(span, "Span should still be created when suppressTracing is enabled"); - const readableSpan = span! as IReadableSpan; - Assert.ok(!span!.isRecording(), "Span should not be recording when suppressTracing is enabled"); + const readableSpan = span as IReadableSpan; + Assert.ok(!span?.isRecording(), "Span should not be recording when suppressTracing is enabled"); Assert.equal(readableSpan.name, "suppressed-span", "Span name should be set correctly"); } }); @@ -646,16 +646,16 @@ export class SpanTests extends AITestClass { Assert.ok(span, "Span should be created"); // Debug: Check if trace provider exists - const traceProvider = core.getTraceProvider!(); + const traceProvider = core.getTraceProvider(); Assert.ok(traceProvider, "Trace provider should exist"); - Assert.ok(traceProvider!.isAvailable(), "Trace provider should be available"); + Assert.ok(traceProvider?.isAvailable(), "Trace provider should be available"); // Debug: Check trace provider before setActiveSpan const providerActiveSpanBefore = core.getActiveSpan(); Assert.equal(providerActiveSpanBefore, initialActiveSpan, "Trace provider should return the initially active span before setActiveSpan"); // Manually set as active span (this would normally be done by startActiveSpan) - const scope = core.setActiveSpan(span!); + const scope = core.setActiveSpan(span); // Assert scope object Assert.ok(scope, "Scope should be returned"); diff --git a/shared/AppInsightsCore/Tests/Unit/src/trace/traceUtils.Tests.ts b/shared/AppInsightsCore/Tests/Unit/src/trace/traceUtils.Tests.ts index 5c5d341b0..4e53d2e4c 100644 --- a/shared/AppInsightsCore/Tests/Unit/src/trace/traceUtils.Tests.ts +++ b/shared/AppInsightsCore/Tests/Unit/src/trace/traceUtils.Tests.ts @@ -12,7 +12,7 @@ import { createSpan } from "../../../../src/otel/api/trace/span"; import { createW3cTraceState } from "../../../../src/telemetry/W3cTraceState"; import { createDistributedTraceContext } from "../../../../src/core/TelemetryHelpers"; import { IAppInsightsCore } from "../../../../src/interfaces/ai/IAppInsightsCore"; -import { AppInsightsCore, ITraceHost } from "../../../../src/index"; +import { AppInsightsCore } from "../../../../src/index"; import { IChannelControls } from "../../../../src/interfaces/ai/IChannelControls"; function _createDistributedContext(traceId: string, spanId: string, traceFlags: number, traceState?: string): IDistributedTraceContext { diff --git a/shared/AppInsightsCore/package.json b/shared/AppInsightsCore/package.json index bbb1ad671..22a5b066e 100644 --- a/shared/AppInsightsCore/package.json +++ b/shared/AppInsightsCore/package.json @@ -46,8 +46,8 @@ "@microsoft/api-extractor": "^7.40.0", "grunt": "^1.5.3", "grunt-cli": "^1.4.3", - "@nevware21/grunt-ts-plugin": "^0.4.3", - "@nevware21/grunt-eslint-ts": "^0.2.2", + "@nevware21/grunt-ts-plugin": "^0.5.1", + "@nevware21/grunt-eslint-ts": "^0.5.1", "globby": "^11.0.0", "magic-string": "^0.25.7", "pako": "^2.0.3", diff --git a/shared/AppInsightsCore/rollup.config.js b/shared/AppInsightsCore/rollup.config.js index 2561bfe5e..c4d0270c6 100644 --- a/shared/AppInsightsCore/rollup.config.js +++ b/shared/AppInsightsCore/rollup.config.js @@ -5,32 +5,32 @@ const version = require("./package.json").version; const entryPointName = "index"; const browserOutputName = "applicationinsights-core-js"; // MUST NOT CHANGE - CDN compatibility const banner = [ - "/*!", - ` * Application Insights JavaScript SDK - Core, ${version}`, - " * Copyright (c) Microsoft and contributors. All rights reserved.", - " */" + "/*!", + ` * Application Insights JavaScript SDK - Core, ${version}`, + " * Copyright (c) Microsoft and contributors. All rights reserved.", + " */" ].join("\n"); const replaceValues = { - "// Copyright (c) Microsoft Corporation. All rights reserved.": "", - "// Licensed under the MIT License.": "" + "// Copyright (c) Microsoft Corporation. All rights reserved.": "", + "// Licensed under the MIT License.": "" }; updateDistEsmFiles(replaceValues, banner, true, true, "dist-es5"); -export default createUnVersionedConfig(banner, - { - namespace: "Microsoft.ApplicationInsights", - version: version, - node: { - entryPoint: entryPointName, - outputName: entryPointName // Node output uses index +export default createUnVersionedConfig(banner, + { + namespace: "Microsoft.ApplicationInsights", + version: version, + node: { + entryPoint: entryPointName, + outputName: entryPointName + }, + browser: { + entryPoint: entryPointName, + outputName: browserOutputName // Browser keeps original name for CDN + } }, - browser: { - entryPoint: entryPointName, - outputName: browserOutputName // Browser keeps original name for CDN - }, - }, - ["index"], - false + ["index", "applicationinsights-core-js"], + false ); \ No newline at end of file diff --git a/shared/AppInsightsCore/src/config/DynamicConfig.ts b/shared/AppInsightsCore/src/config/DynamicConfig.ts index e8856cc95..ad1fcbce5 100644 --- a/shared/AppInsightsCore/src/config/DynamicConfig.ts +++ b/shared/AppInsightsCore/src/config/DynamicConfig.ts @@ -2,7 +2,7 @@ // Licensed under the MIT License. import { dumpObj, isUndefined, objDefine, objForEachKey } from "@nevware21/ts-utils"; -import { STR_NOT_DYNAMIC_ERROR } from "../constants/InternalConstants"; +import { STR_EMPTY, STR_NOT_DYNAMIC_ERROR } from "../constants/InternalConstants"; import { _eInternalMessageId, eLoggingSeverity } from "../enums/ai/LoggingEnums"; import { IConfiguration } from "../interfaces/ai/IConfiguration"; import { IDiagnosticLogger } from "../interfaces/ai/IDiagnosticLogger"; @@ -36,7 +36,7 @@ function _createAndUseHandler(state: _IDynamicConfigHandlerState, configHa } }; - objDefine(handler, "toJSON", { v: () => "WatcherHandler" + (handler.fn ? "" : "[X]") }); + objDefine(handler, "toJSON", { v: () => "WatcherHandler" + (handler.fn ? STR_EMPTY : "[X]") }); state.use(handler, configHandler); diff --git a/shared/AppInsightsCore/src/config/DynamicSupport.ts b/shared/AppInsightsCore/src/config/DynamicSupport.ts index 127473d5f..5a7cad09d 100644 --- a/shared/AppInsightsCore/src/config/DynamicSupport.ts +++ b/shared/AppInsightsCore/src/config/DynamicSupport.ts @@ -53,6 +53,7 @@ export function _cfgDeepCopy(source: T): T { } /** + * @internal * Get the dynamic config handler if the value is already dynamic * @param value - The value to check for dynamic config handler * @returns The dynamic config handler if present, null otherwise diff --git a/shared/AppInsightsCore/src/core/AppInsightsCore.ts b/shared/AppInsightsCore/src/core/AppInsightsCore.ts index fb120e136..171574e46 100644 --- a/shared/AppInsightsCore/src/core/AppInsightsCore.ts +++ b/shared/AppInsightsCore/src/core/AppInsightsCore.ts @@ -44,8 +44,10 @@ import { IConfigDefaults } from "../interfaces/config/IConfigDefaults"; import { IDynamicConfigHandler, _IInternalDynamicConfigHandler } from "../interfaces/config/IDynamicConfigHandler"; import { IWatchDetails, WatcherFunction } from "../interfaces/config/IDynamicWatcher"; import { ITraceCfg } from "../interfaces/otel/config/IOTelTraceCfg"; +import { IOTelSpanContext } from "../interfaces/otel/trace/IOTelSpanContext"; import { IOTelSpanOptions } from "../interfaces/otel/trace/IOTelSpanOptions"; import { IReadableSpan } from "../interfaces/otel/trace/IReadableSpan"; +import { _noopVoid } from "../internal/noopHelpers"; import { findW3cTraceState } from "../telemetry/W3cTraceState"; import { createUniqueNamespace } from "../utils/DataCacheHelper"; import { getSetValue, isNotNullOrUndefined, proxyFunctionAs, proxyFunctions, toISOString } from "../utils/HelperFuncs"; @@ -101,7 +103,7 @@ const maxAttributeCount = 128; const defaultConfig: IConfigDefaults = objDeepFreeze({ cookieCfg: {}, [STR_EXTENSIONS]: { rdOnly: true, ref: true, v: [] }, - [STR_CHANNELS]: { rdOnly: true, ref: true, v:[] }, + [STR_CHANNELS]: { rdOnly: true, ref: true, v: [] }, [STR_EXTENSION_CONFIG]: { ref: true, v: {} }, [STR_CREATE_PERF_MGR]: UNDEFINED_VALUE, loggingLevelConsole: eLoggingSeverity.DISABLED, @@ -238,7 +240,7 @@ function _deepMergeConfig(details: IWatchDetails, target: any, n _deepMergeConfig(details, target[key], value, merge); } } - + if (merge && isPlainObject(value) && isPlainObject(target[key])) { // The target is an object and it has a value _deepMergeConfig(details, target[key], value, merge); @@ -251,8 +253,8 @@ function _deepMergeConfig(details: IWatchDetails, target: any, n } /*#__NO_SIDE_EFFECTS__*/ -function _findWatcher(listeners: { rm: () => void, w: WatcherFunction}[], newWatcher: WatcherFunction) { - let theListener: { rm: () => void, w: WatcherFunction} = null; +function _findWatcher(listeners: { rm: () => void, w: WatcherFunction }[], newWatcher: WatcherFunction) { + let theListener: { rm: () => void, w: WatcherFunction } = null; let idx: number = -1; arrForEach(listeners, (listener, lp) => { if (listener.w === newWatcher) { @@ -265,7 +267,7 @@ function _findWatcher(listeners: { rm: () => void, w: WatcherFunction void, w: WatcherFunction}[], newWatcher: WatcherFunction) { +function _addDelayedCfgListener(listeners: { rm: () => void, w: WatcherFunction }[], newWatcher: WatcherFunction) { let theListener = _findWatcher(listeners, newWatcher).l; if (!theListener) { @@ -284,7 +286,7 @@ function _addDelayedCfgListener(listeners: { rm: () => void, w: WatcherFunction< return theListener; } -function _registerDelayedCfgListener(config: IConfiguration, listeners: { rm: () => void, w: WatcherFunction}[], logger: IDiagnosticLogger) { +function _registerDelayedCfgListener(config: IConfiguration, listeners: { rm: () => void, w: WatcherFunction }[], logger: IDiagnosticLogger) { arrForEach(listeners, (listener) => { let unloadHdl = onConfigChange(config, listener.w, logger); delete listener.w; // Clear the listener reference so it will get garbage collected. @@ -331,7 +333,7 @@ function _getParentTraceCtx(mode: eTraceHeadersMode): IDistributedTraceContext | let spanContext: IDistributedTraceContext | null = null; const parentTrace = (mode & eTraceHeadersMode.TraceParent) ? findW3cTraceParent() : null; const parentTraceState = (mode & eTraceHeadersMode.TraceState) ? findW3cTraceState() : null; - + if (parentTrace || parentTraceState) { spanContext = createDistributedTraceContext({ traceId: parentTrace ? parentTrace.traceId : null, @@ -345,11 +347,6 @@ function _getParentTraceCtx(mode: eTraceHeadersMode): IDistributedTraceContext | return spanContext; } -/*#__NO_SIDE_EFFECTS__*/ -function _noOpFunc() { - // No-op function -} - /** * @group Classes * @group Entrypoint @@ -407,7 +404,7 @@ export class AppInsightsCore im let _traceProvider: ICachedValue | null; let _activeSpan: IReadableSpan | null; let _instrumentationKey: string | null; - let _cfgListeners: { rm: () => void, w: WatcherFunction}[]; + let _cfgListeners: { rm: () => void, w: WatcherFunction }[]; let _extensions: IPlugin[]; let _pluginVersionStringArr: string[]; let _pluginVersionString: string; @@ -416,7 +413,7 @@ export class AppInsightsCore im let _initInMemoMaxSize: number; // max event count limit during wait for init promises to be resolved let _isStatusSet: boolean; // track if active status is set in case of init timeout and init promises setting the status twice let _initTimer: ITimerHandler; - + /** * Internal log poller */ @@ -450,7 +447,7 @@ export class AppInsightsCore im if (_isUnloading) { throwError(strSdkUnloadingError); } - + // Make sure core is only initialized once if (_self.isInitialized()) { throwError("Core cannot be initialized more than once"); @@ -1108,7 +1105,7 @@ export class AppInsightsCore im let scope: ISpanScope; if (span) { - let otelSpanContext: IDistributedTraceContext = null; + let otelSpanContext: IDistributedTraceContext | IOTelSpanContext = null; if (span.spanContext) { // May be a valid IDistributedTraceContext or an OpenTelemetry SpanContext otelSpanContext = span.spanContext(); @@ -1173,7 +1170,7 @@ export class AppInsightsCore im } // Clear the restore function, so that multiple calls to restore do not have any effect - scope.restore = _noOpFunc; + scope.restore = _noopVoid; } }; diff --git a/shared/AppInsightsCore/src/core/CookieMgr.ts b/shared/AppInsightsCore/src/core/CookieMgr.ts index 8f8915490..1184a3c10 100644 --- a/shared/AppInsightsCore/src/core/CookieMgr.ts +++ b/shared/AppInsightsCore/src/core/CookieMgr.ts @@ -154,8 +154,8 @@ export function safeGetCookieMgr(core: IAppInsightsCore, config?: IConfiguration cookieMgr = core.getCookieMgr(); } else if (config) { let cookieCfg = config.cookieCfg; - if (cookieCfg && cookieCfg[strConfigCookieMgr]) { - cookieMgr = cookieCfg[strConfigCookieMgr]; + if (cookieCfg && (cookieCfg as any)[strConfigCookieMgr]) { + cookieMgr = (cookieCfg as any)[strConfigCookieMgr]; } else { cookieMgr = createCookieMgr(config); } diff --git a/shared/AppInsightsCore/src/core/ResponseHelpers.ts b/shared/AppInsightsCore/src/core/ResponseHelpers.ts index f645124ac..a81cce235 100644 --- a/shared/AppInsightsCore/src/core/ResponseHelpers.ts +++ b/shared/AppInsightsCore/src/core/ResponseHelpers.ts @@ -2,6 +2,7 @@ // Licensed under the MIT License. import { dumpObj } from "@nevware21/ts-utils"; +import { STR_EMPTY } from "../constants/InternalConstants"; import { _throwInternal } from "../diagnostics/DiagnosticLogger"; import { _eInternalMessageId, eLoggingSeverity } from "../enums/ai/LoggingEnums"; import { IDiagnosticLogger } from "../interfaces/ai/IDiagnosticLogger"; @@ -14,7 +15,7 @@ import { getJSON } from "../utils/EnvUtils"; */ export function parseResponse(response: any, diagLog?: IDiagnosticLogger): IBackendResponse { try { - if (response && response !== "") { + if (response && response !== STR_EMPTY) { const result = getJSON().parse(response); if (result && result.itemsReceived && result.itemsReceived >= result.itemsAccepted && diff --git a/shared/AppInsightsCore/src/core/SenderPostManager.ts b/shared/AppInsightsCore/src/core/SenderPostManager.ts index 01538fb83..43977e2ff 100644 --- a/shared/AppInsightsCore/src/core/SenderPostManager.ts +++ b/shared/AppInsightsCore/src/core/SenderPostManager.ts @@ -5,6 +5,7 @@ import dynamicProto from "@microsoft/dynamicproto-js"; import { AwaitResponse, IPromise, createPromise, doAwaitResponse } from "@nevware21/ts-async"; import { arrForEach, dumpObj, getInst, getNavigator, getWindow, isFunction, isString, objKeys } from "@nevware21/ts-utils"; import { DisabledPropertyName } from "../constants/Constants"; +import { STR_EMPTY } from "../constants/InternalConstants"; import { _throwInternal, _warnToConsole } from "../diagnostics/DiagnosticLogger"; import { _eInternalMessageId, eLoggingSeverity } from "../enums/ai/LoggingEnums"; import { SendRequestReason, TransportType } from "../enums/ai/SendRequestReason"; @@ -20,7 +21,6 @@ import { _noopVoid } from "../internal/noopHelpers"; import { getLocation, isBeaconsSupported, isFetchSupported, isXhrSupported, useXDomainRequest } from "../utils/EnvUtils"; import { _getAllResponseHeaders, formatErrorMessageXdr, formatErrorMessageXhr, getResponseText, openXhr } from "../utils/HelperFuncs"; -const STR_EMPTY = ""; const STR_NO_RESPONSE_BODY = "NoResponseBody"; const _noResponseQs = "&" + STR_NO_RESPONSE_BODY + "=true"; const STR_POST_METHOD = "POST"; @@ -31,7 +31,10 @@ declare var XDomainRequest: { /** - * Manager for SendPost functions + * This Internal component + * Manager SendPost functions + * SendPostManger + * @internal for internal use only * @since 3.0.0 */ export class SenderPostManager { @@ -469,7 +472,7 @@ export class SenderPostManager { _syncFetchPayload += batchLength; if (_isOneDs) { - if (payload["_sendReason"] === SendRequestReason.Unload) { + if ((payload as any)["_sendReason"] === SendRequestReason.Unload) { // As a sync request (during unload), it is unlikely that we will get a chance to process the response so // just like beacon send assume that the events have been accepted and processed ignoreResponse = true; @@ -486,7 +489,7 @@ export class SenderPostManager { const request = new Request(endPointUrl, init); try { // Also try and tag the request (just in case the value in init is not copied over) - request[DisabledPropertyName] = true; + (request as any)[DisabledPropertyName] = true; } catch(e) { // If the environment has locked down the XMLHttpRequest (preventExtensions and/or freeze), this would // cause the request to fail and we no telemetry would be sent @@ -653,7 +656,7 @@ export class SenderPostManager { // XDomainRequest requires the same protocol as the hosting page. // If the protocol doesn't match, we can't send the telemetry :(. - const hostingProtocol = _window && _window.location && _window.location.protocol || ""; + const hostingProtocol = _window && _window.location && _window.location.protocol || STR_EMPTY; let endpoint = payload.urlString; if (!endpoint) { _onNoPayloadUrl(oncomplete); @@ -669,7 +672,7 @@ export class SenderPostManager { return; } - const endpointUrl = _isOneDs? endpoint : endpoint.replace(/^(https?:)/, ""); + const endpointUrl = _isOneDs? endpoint : endpoint.replace(/^(https?:)/, STR_EMPTY); xdr.open(STR_POST_METHOD, endpointUrl); if (payload.timeout) { xdr.timeout = payload.timeout; diff --git a/shared/AppInsightsCore/src/core/TelemetryHelpers.ts b/shared/AppInsightsCore/src/core/TelemetryHelpers.ts index 7b6c43166..f1ce02ccf 100644 --- a/shared/AppInsightsCore/src/core/TelemetryHelpers.ts +++ b/shared/AppInsightsCore/src/core/TelemetryHelpers.ts @@ -11,6 +11,9 @@ import { ITelemetryPluginChain } from "../interfaces/ai/ITelemetryPluginChain"; import { ITelemetryUnloadState } from "../interfaces/ai/ITelemetryUnloadState"; import { IUnloadableComponent } from "../interfaces/ai/IUnloadableComponent"; import { IW3cTraceState } from "../interfaces/ai/IW3cTraceState"; +import { IOTelSpanContext } from "../interfaces/otel/trace/IOTelSpanContext"; +import { createOTelSpanContext } from "../otel/api/trace/spanContext"; +import { isOTelTraceState } from "../otel/api/trace/traceState"; import { createW3cTraceState } from "../telemetry/W3cTraceState"; import { generateW3CId } from "../utils/CoreUtils"; import { createElmNodeData } from "../utils/DataCacheHelper"; @@ -92,7 +95,7 @@ export function initializePlugins(processContext: IProcessTelemetryContext, exte }); } -export function sortPlugins(plugins:T[]) { +export function sortPlugins(plugins: T[]) { // Sort by priority return plugins.sort((extA: any, extB: any) => { let result = 0; @@ -158,10 +161,14 @@ export function isDistributedTraceContext(obj: any): obj is IDistributedTraceCon * Creates an IDistributedTraceContext instance that ensures a valid traceId is always available. * The traceId will be inherited from the parent context if valid, otherwise a new random W3C trace ID is generated. * - * @param parent - An optional parent {@link IDistributedTraceContext} to inherit trace context values from. If - * provided, the traceId and spanId will be copied from the parent if they are valid. + * @param parent - An optional parent {@link IDistributedTraceContext} or {@link IOTelSpanContext} to inherit + * trace context values from. If provided, the traceId and spanId will be copied from the parent if they are valid. * When the parent is an {@link IDistributedTraceContext}, it will be set as the parentCtx property to maintain * hierarchical relationships and enable parent context updates. + * When the parent is an {@link IOTelSpanContext}, the parentCtx will be null because OpenTelemetry span contexts + * are read-only data sources that don't support the same hierarchical management methods as IDistributedTraceContext. + * The core instance will create a wrapped IDistributedTraceContext instance from the IOTelSpanContext data + * to enable Application Insights distributed tracing functionality while maintaining OpenTelemetry compatibility. * * @returns A new IDistributedTraceContext instance with the following behavior: * - **traceId**: Always present - either inherited from parent (if valid) or newly generated W3C trace ID @@ -175,11 +182,14 @@ export function isDistributedTraceContext(obj: any): obj is IDistributedTraceCon * which is essential for the refactored W3C trace state implementation. The spanId may be empty until a * specific span is created, which is normal behavior for trace contexts. * + * The distinction between IDistributedTraceContext and IOTelSpanContext parents is important: + * - IDistributedTraceContext parents enable bidirectional updates and hierarchical management + * - IOTelSpanContext parents are used only for initial data extraction and OpenTelemetry compatibility */ /*#__NO_SIDE_EFFECTS__*/ -export function createDistributedTraceContext(parent?: IDistributedTraceContext | IDistributedTraceInit | undefined | null): IDistributedTraceContext { +export function createDistributedTraceContext(parent?: IDistributedTraceContext | IOTelSpanContext | IDistributedTraceInit | undefined | null): IDistributedTraceContext { let parentCtx: IDistributedTraceContext = null; - let initCtx: IDistributedTraceInit = null; + let initCtx: IDistributedTraceInit | IOTelSpanContext = null; let traceId = (parent && isValidTraceId(parent.traceId)) ? parent.traceId : generateW3CId(); let spanId = (parent && isValidSpanId(parent.spanId)) ? parent.spanId : STR_EMPTY; let traceFlags = parent ? parent.traceFlags : UNDEFINED_VALUE; @@ -267,12 +277,29 @@ export function createDistributedTraceContext(parent?: IDistributedTraceContext function _getTraceState(): IW3cTraceState { if (!traceState) { - traceState = createW3cTraceState(STR_EMPTY, parentCtx ? parentCtx.traceState : (initCtx ? initCtx.traceState : undefined)); + if (!parentCtx) { + // The passed in parent was not an IDistributedTraceContext + if (initCtx) { + if (isOTelTraceState(initCtx.traceState)) { + // This looks like an IOTelSpanContext, so we have to just use the passed traceState as-is as it doesn't support + // the W3cTraceState heirarchy methods + traceState = createW3cTraceState(initCtx.traceState.serialize() || STR_EMPTY, parentCtx ? parentCtx.traceState : undefined); + } else { + // This looks like an IDistributedTraceInit, so we can create a new W3cTraceState + traceState = createW3cTraceState(STR_EMPTY, initCtx.traceState || (parentCtx ? parentCtx.traceState : undefined)); + } + } + } + + if (!traceState) { + traceState = createW3cTraceState(STR_EMPTY, parentCtx ? parentCtx.traceState : undefined); + } } return traceState; } + let otelSpanCtx: IOTelSpanContext = null; let traceCtx: IDistributedTraceContext = setProtoTypeName({ getName: _getName, setName: _setPageNameFn(true), @@ -287,7 +314,15 @@ export function createDistributedTraceContext(parent?: IDistributedTraceContext traceFlags, traceState, isRemote, - pageName + pageName, + getOTelSpanContext: () => { + if (!otelSpanCtx) { + // Lazily create the OTel Span Context + otelSpanCtx = createOTelSpanContext(traceCtx); + } + + return otelSpanCtx; + } }, "DistributedTraceContext"); return objDefineProps(traceCtx, { @@ -330,7 +365,7 @@ export function createDistributedTraceContext(parent?: IDistributedTraceContext result = { t: "initCtx", v: initCtx - } + }; } return result; } diff --git a/shared/AppInsightsCore/src/core/TelemetryInitializerPlugin.ts b/shared/AppInsightsCore/src/core/TelemetryInitializerPlugin.ts index d40df7182..783cfe6f4 100644 --- a/shared/AppInsightsCore/src/core/TelemetryInitializerPlugin.ts +++ b/shared/AppInsightsCore/src/core/TelemetryInitializerPlugin.ts @@ -1,5 +1,5 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// // Licensed under the MIT License. +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. import dynamicProto from "@microsoft/dynamicproto-js"; import { arrAppend, arrForEach, dumpObj } from "@nevware21/ts-utils"; diff --git a/shared/AppInsightsCore/src/diagnostics/ThrottleMgr.ts b/shared/AppInsightsCore/src/diagnostics/ThrottleMgr.ts index 179e7a779..4f669fd4b 100644 --- a/shared/AppInsightsCore/src/diagnostics/ThrottleMgr.ts +++ b/shared/AppInsightsCore/src/diagnostics/ThrottleMgr.ts @@ -1,3 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + import { arrForEach, arrIndexOf, isNullOrUndefined, mathFloor, mathMin, objForEachKey, strTrim } from "@nevware21/ts-utils"; import { onConfigChange } from "../config/DynamicConfig"; import { _throwInternal, safeGetLogger } from "../diagnostics/DiagnosticLogger"; diff --git a/shared/AppInsightsCore/src/enums/ai/FeatureOptInEnums.ts b/shared/AppInsightsCore/src/enums/ai/FeatureOptInEnums.ts index a0e1756bd..bec50ef13 100644 --- a/shared/AppInsightsCore/src/enums/ai/FeatureOptInEnums.ts +++ b/shared/AppInsightsCore/src/enums/ai/FeatureOptInEnums.ts @@ -1,3 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + export const enum FeatureOptInMode { /** * not set, completely depends on cdn cfg diff --git a/shared/AppInsightsCore/src/enums/ai/InitActiveStatusEnum.ts b/shared/AppInsightsCore/src/enums/ai/InitActiveStatusEnum.ts index cdaa5353d..d2725aca0 100644 --- a/shared/AppInsightsCore/src/enums/ai/InitActiveStatusEnum.ts +++ b/shared/AppInsightsCore/src/enums/ai/InitActiveStatusEnum.ts @@ -1,3 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + import { createEnumStyle } from "../EnumHelperFuncs"; export const enum eActiveStatus { diff --git a/shared/AppInsightsCore/src/enums/ai/LoggingEnums.ts b/shared/AppInsightsCore/src/enums/ai/LoggingEnums.ts index 5a727601a..82f50a817 100644 --- a/shared/AppInsightsCore/src/enums/ai/LoggingEnums.ts +++ b/shared/AppInsightsCore/src/enums/ai/LoggingEnums.ts @@ -133,7 +133,8 @@ export const enum _eInternalMessageId { AttributeError = 115, SpanError = 116, TraceError = 117, - NotImplementedError = 118 + NotImplementedError = 118, + VersionMismatch = 119 } export type _InternalMessageId = number | _eInternalMessageId; diff --git a/shared/AppInsightsCore/src/index.ts b/shared/AppInsightsCore/src/index.ts index cc0749698..cb5abe5d9 100644 --- a/shared/AppInsightsCore/src/index.ts +++ b/shared/AppInsightsCore/src/index.ts @@ -1,5 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. + export { IConfiguration } from "./interfaces/ai/IConfiguration"; export { IChannelControls, MinChannelPriorty, IInternalOfflineSupport } from "./interfaces/ai/IChannelControls"; export { IChannelControlsHost } from "./interfaces/ai/IChannelControlsHost"; @@ -13,7 +14,7 @@ export { ITelemetryPluginChain } from "./interfaces/ai/ITelemetryPluginChain"; export { IDiagnosticLogger } from "./interfaces/ai/IDiagnosticLogger"; export { InstrumentorHooksCallback, IInstrumentHooksCallbacks, IInstrumentHooks, IInstrumentHook, IInstrumentCallDetails } from "./interfaces/ai/IInstrumentHooks"; export { IUnloadableComponent } from "./interfaces/ai/IUnloadableComponent"; -export { IPayloadData, SendPOSTFunction, IXHROverride, OnCompleteCallback } from "./interfaces/ai/IXHROverride" +export { IPayloadData, SendPOSTFunction, IXHROverride, OnCompleteCallback } from "./interfaces/ai/IXHROverride"; export { IUnloadHook, ILegacyUnloadHook } from "./interfaces/ai/IUnloadHook"; export { eEventsDiscardedReason, EventsDiscardedReason, eBatchDiscardedReason, BatchDiscardedReason } from "./enums/ai/EventsDiscardedReason"; export { eDependencyTypes, DependencyTypes } from "./enums/ai/DependencyTypes"; @@ -21,7 +22,7 @@ export { SendRequestReason, TransportType } from "./enums/ai/SendRequestReason"; //export { StatsType, eStatsType } from "./enums/ai/StatsType"; export { TelemetryUpdateReason } from "./enums/ai/TelemetryUpdateReason"; export { TelemetryUnloadReason } from "./enums/ai/TelemetryUnloadReason"; -export { eActiveStatus, ActiveStatus } from "./enums/ai/InitActiveStatusEnum" +export { eActiveStatus, ActiveStatus } from "./enums/ai/InitActiveStatusEnum"; export { throwAggregationError } from "./core/AggregationError"; export { AppInsightsCore } from "./core/AppInsightsCore"; export { BaseTelemetryPlugin } from "./core/BaseTelemetryPlugin"; @@ -32,7 +33,7 @@ export { normalizeJsName, toISOString, getExceptionName, strContains, setValue, getSetValue, proxyAssign, proxyFunctions, proxyFunctionAs, createClassFromInterface, optimizeObject, isNotUndefined, isNotNullOrUndefined, objExtend, isFeatureEnabled, getResponseText, formatErrorMessageXdr, formatErrorMessageXhr, prependTransports, - openXhr, _appendHeader, _getAllResponseHeaders, setObjStringTag, setProtoTypeName + openXhr, _appendHeader, _getAllResponseHeaders, setObjStringTag, setProtoTypeName, isTimeSpan } from "./utils/HelperFuncs"; export { parseResponse } from "./core/ResponseHelpers"; export { IXDomainRequest, IBackendResponse } from "./interfaces/ai/IXDomainRequest"; @@ -77,7 +78,7 @@ export { IPerfEvent } from "./interfaces/ai/IPerfEvent"; export { IPerfManager, IPerfManagerProvider } from "./interfaces/ai/IPerfManager"; export { PerfEvent, PerfManager, doPerf, getGblPerfMgr, setGblPerfMgr } from "./core/PerfManager"; export { IFeatureOptInDetails, IFeatureOptIn } from "./interfaces/ai/IFeatureOptIn"; -export { FeatureOptInMode, CdnFeatureMode } from "./enums/ai/FeatureOptInEnums" +export { FeatureOptInMode, CdnFeatureMode } from "./enums/ai/FeatureOptInEnums"; export { safeGetLogger, DiagnosticLogger, _InternalLogMessage, _throwInternal, _warnToConsole, _logInternalMessage } from "./diagnostics/DiagnosticLogger"; export { createProcessTelemetryContext @@ -91,18 +92,18 @@ export { createCookieMgr, safeGetCookieMgr, uaDisallowsSameSiteNone, areCookiesSupported } from "./core/CookieMgr"; export { IDbgExtension } from "./interfaces/ai/IDbgExtension"; -export { getDebugListener, getDebugExt } from "./core/DbgExtensionUtils" +export { getDebugListener, getDebugExt } from "./core/DbgExtensionUtils"; export { TelemetryInitializerFunction, ITelemetryInitializerHandler, ITelemetryInitializerContainer } from "./interfaces/ai/ITelemetryInitializers"; export { createUniqueNamespace } from "./utils/DataCacheHelper"; export { UnloadHandler, IUnloadHandlerContainer, createUnloadHandlerContainer } from "./core/UnloadHandlerContainer"; -export { IUnloadHookContainer, createUnloadHookContainer, _testHookMaxUnloadHooksCb } from "./core/UnloadHookContainer"; +export { IUnloadHookContainer, createUnloadHookContainer, _testHookMaxUnloadHooksCb } from "./core/UnloadHookContainer"; export { ITelemetryUpdateState } from "./interfaces/ai/ITelemetryUpdateState"; export { ITelemetryUnloadState } from "./interfaces/ai/ITelemetryUnloadState"; export { IDistributedTraceContext, IDistributedTraceInit } from "./interfaces/ai/IDistributedTraceContext"; export { ITraceParent } from "./interfaces/ai/ITraceParent"; export { createTraceParent, parseTraceParent, isValidTraceId, isValidSpanId, isValidTraceParent, isSampledFlag, formatTraceParent, findW3cTraceParent, - findAllScripts + findAllScripts, INVALID_TRACE_ID, INVALID_SPAN_ID, scriptsInfo } from "./utils/TraceParent"; // Dynamic Config definitions @@ -119,17 +120,25 @@ export { eW3CTraceFlags } from "./enums/W3CTraceFlags"; export { IW3cTraceState } from "./interfaces/ai/IW3cTraceState"; export { createW3cTraceState, findW3cTraceState, isW3cTraceState, snapshotW3cTraceState } from "./telemetry/W3cTraceState"; +// ========================================================================== +// OpenTelemetry exports +// ========================================================================== + // OpenTelemetry Trace support export { IOTelTraceState } from "./interfaces/otel/trace/IOTelTraceState"; export { IOTelSpan } from "./interfaces/otel/trace/IOTelSpan"; export { IOTelTracer } from "./interfaces/otel/trace/IOTelTracer"; -export { IOTelTracerProvider, IOTelTracerOptions } from "./interfaces/otel/trace/IOTelTracerProvider"; +export { IOTelTracerProvider } from "./interfaces/otel/trace/IOTelTracerProvider"; +export { IOTelTracerOptions } from "./interfaces/otel/trace/IOTelTracerOptions"; export { ITraceProvider, ITraceHost, ISpanScope } from "./interfaces/ai/ITraceProvider"; export { IOTelSpanOptions } from "./interfaces/otel/trace/IOTelSpanOptions"; -export { createOTelTraceState } from "./otel/api/trace/traceState"; +export { createOTelTraceState, isOTelTraceState } from "./otel/api/trace/traceState"; export { createSpan } from "./otel/api/trace/span"; export { createTraceProvider } from "./otel/api/trace/traceProvider"; -export { isSpanContextValid, wrapSpanContext, isReadableSpan, suppressTracing, unsuppressTracing, isTracingSuppressed, useSpan, withSpan, startActiveSpan } from "./otel/api/trace/utils"; +export { + createNonRecordingSpan, isSpanContextValid, + wrapSpanContext, isReadableSpan, isTracingSuppressed, suppressTracing, unsuppressTracing, useSpan, withSpan, startActiveSpan +} from "./otel/api/trace/utils"; export { AzureMonitorSampleRate, ApplicationInsightsCustomEventName, MicrosoftClientIp, ApplicationInsightsMessageName, @@ -158,7 +167,7 @@ export { export { IOTelApi } from "./interfaces/otel/IOTelApi"; export { IOTelApiCtx } from "./interfaces/otel/IOTelApiCtx"; export { IOTelAttributes, OTelAttributeValue, ExtendedOTelAttributeValue } from "./interfaces/otel/IOTelAttributes"; -export { OTelException } from "./interfaces/otel/IOTelException"; +export { OTelException, IOTelExceptionWithCode, IOTelExceptionWithMessage, IOTelExceptionWithName } from "./interfaces/IException"; export { IOTelHrTime, OTelTimeInput } from "./interfaces/IOTelHrTime"; export { createOTelApi } from "./otel/api/OTelApi"; @@ -167,6 +176,7 @@ export { ITraceApi } from "./interfaces/otel/trace/IOTelTraceApi"; export { IOTelSpanCtx } from "./interfaces/otel/trace/IOTelSpanCtx"; export { IOTelSpanStatus } from "./interfaces/otel/trace/IOTelSpanStatus"; export { IReadableSpan } from "./interfaces/otel/trace/IReadableSpan"; +export { IOTelSpanContext } from "./interfaces/otel/trace/IOTelSpanContext"; // OpenTelemetry Configuration Interfaces export { IOTelConfig } from "./interfaces/otel/config/IOTelConfig"; @@ -187,7 +197,7 @@ export { eOTelSpanStatusCode, OTelSpanStatusCode } from "./enums/otel/OTelSpanSt // OpenTelemetry Helper Utilities export { hrTime, hrTimeToTimeStamp, hrTimeDuration, hrTimeToMilliseconds, timeInputToHrTime, millisToHrTime, hrTimeToNanoseconds, - addHrTimes, hrTimeToMicroseconds, zeroHrTime, nanosToHrTime, isTimeInput, isTimeInputHrTime, isTimeSpan + addHrTimes, hrTimeToMicroseconds, zeroHrTime, nanosToHrTime, isTimeInput, isTimeInputHrTime } from "./internal/timeHelpers"; export { isAttributeValue, isAttributeKey, sanitizeAttributes } from "./internal/attributeHelpers"; export { @@ -220,7 +230,7 @@ export { export { ThrottleMgr } from "./diagnostics/ThrottleMgr"; export { parseConnectionString, ConnectionStringParser } from "./telemetry/ConnectionStringParser"; -export type { ConnectionString } from "./interfaces/ai/ConnectionString"; +export { ConnectionString } from "./interfaces/ai/ConnectionString"; export { FieldType } from "./enums/ai/Enums"; export { IRequestHeaders, RequestHeaders, eRequestHeaders } from "./telemetry/RequestResponseHeaders"; export { @@ -323,9 +333,10 @@ export { ITelemetryTrace } from "./interfaces/ai/context/ITelemetryTrace"; // Enums export { eDistributedTracingModes, DistributedTracingModes, EventPersistence } from "./enums/ai/Enums"; +export { eTraceHeadersMode } from "./enums/ai/TraceHeadersMode"; // Helper functions -export { stringToBoolOrDefault, msToTimeSpan, getExtensionByName, isCrossOriginError } from "./utils/HelperFuncsCore"; +export { stringToBoolOrDefault, msToTimeSpan, getExtensionByName, isCrossOriginError } from "./utils/HelperFuncs"; export { createDomEvent } from "./utils/DomHelperFuncs"; // Storage helpers diff --git a/shared/AppInsightsCore/src/interfaces/IException.ts b/shared/AppInsightsCore/src/interfaces/IException.ts index 6e41000e7..7636f0caf 100644 --- a/shared/AppInsightsCore/src/interfaces/IException.ts +++ b/shared/AppInsightsCore/src/interfaces/IException.ts @@ -1,3 +1,5 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. export interface IOTelExceptionWithCode { code: string | number; diff --git a/shared/AppInsightsCore/src/interfaces/IOTelHrTime.ts b/shared/AppInsightsCore/src/interfaces/IOTelHrTime.ts index e1a3da855..b2b329ff8 100644 --- a/shared/AppInsightsCore/src/interfaces/IOTelHrTime.ts +++ b/shared/AppInsightsCore/src/interfaces/IOTelHrTime.ts @@ -1,3 +1,5 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. /** * High-resolution time represented as a tuple of [seconds, nanoseconds]. diff --git a/shared/AppInsightsCore/src/interfaces/ai/ConnectionString.ts b/shared/AppInsightsCore/src/interfaces/ai/ConnectionString.ts index a878724a4..c5b781800 100644 --- a/shared/AppInsightsCore/src/interfaces/ai/ConnectionString.ts +++ b/shared/AppInsightsCore/src/interfaces/ai/ConnectionString.ts @@ -1,3 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + export type ConnectionStringKey = "authorization" | "instrumentationkey" | "ingestionendpoint" | "location" | "endpointsuffix"; export type ConnectionString = { [key in ConnectionStringKey]?: string }; \ No newline at end of file diff --git a/shared/AppInsightsCore/src/interfaces/ai/IDiagnosticLogger.ts b/shared/AppInsightsCore/src/interfaces/ai/IDiagnosticLogger.ts index 32a93593f..54ce5c17d 100644 --- a/shared/AppInsightsCore/src/interfaces/ai/IDiagnosticLogger.ts +++ b/shared/AppInsightsCore/src/interfaces/ai/IDiagnosticLogger.ts @@ -1,10 +1,14 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. import { IPromise } from "@nevware21/ts-async"; -import { _InternalLogMessage } from "../../diagnostics/DiagnosticLogger"; import { LoggingSeverity, _InternalMessageId } from "../../enums/ai/LoggingEnums"; import { ITelemetryUpdateState } from "./ITelemetryUpdateState"; +export interface IInternalLogMessage { + message: string; + messageId: _InternalMessageId; +} + export interface IDiagnosticLogger { /** @@ -17,7 +21,7 @@ export interface IDiagnosticLogger { /** * The internal logging queue */ - queue: _InternalLogMessage[]; + queue: IInternalLogMessage[]; /** * This method will throw exceptions in debug mode or attempt to log the error as a console warning. @@ -30,7 +34,7 @@ export interface IDiagnosticLogger { * This will write a debug message to the console if possible * @param message - The debug message */ - debugToConsole? (message: string): void + debugToConsole?(message: string): void /** * This will write a warning to the console if possible @@ -56,7 +60,7 @@ export interface IDiagnosticLogger { * @param severity - The severity of the log message * @param message - The message to log. */ - logInternalMessage?(severity: LoggingSeverity, message: _InternalLogMessage): void; + logInternalMessage?(severity: LoggingSeverity, message: IInternalLogMessage): void; /** * Optional Callback hook to allow the diagnostic logger to update it's configuration diff --git a/shared/AppInsightsCore/src/interfaces/ai/IDistributedTraceContext.ts b/shared/AppInsightsCore/src/interfaces/ai/IDistributedTraceContext.ts index ccb28ce4d..a19d0be4e 100644 --- a/shared/AppInsightsCore/src/interfaces/ai/IDistributedTraceContext.ts +++ b/shared/AppInsightsCore/src/interfaces/ai/IDistributedTraceContext.ts @@ -1,11 +1,13 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +import { IOTelTraceState } from "../otel/trace/IOTelTraceState"; import { IW3cTraceState } from "./IW3cTraceState"; /** * An object that can be used to populate a new {@link IDistributedTraceContext} instance, - * the included {@link IW3cTraceState} is used as the parent of the created instances traceState + * the included {@link IW3cTraceState} or {@link IOTelTraceState} is used as the parent of the + * created instances traceState */ export interface IDistributedTraceInit { /** @@ -127,7 +129,7 @@ export interface IDistributedTraceInit { * const traceparent = `00-${traceId}-${spanId}-${traceFlags.toString(16).padStart(2, '0')}`; * ``` */ - traceFlags: number; + traceFlags?: number; /** * Vendor-specific trace state information for cross-system trace correlation. @@ -170,14 +172,17 @@ export interface IDistributedTraceInit { * const rojoValue = spanContext.traceState?.get('rojo'); * const serialized = spanContext.traceState?.serialize(); * - * // HTTP header format + * // HTTP header format (When the traceState is an IOTelTraceState) * headers['tracestate'] = spanContext.traceState?.serialize() || ''; + * + * // HTTP header format (When the traceState is an IW3cTraceState) + * headers['tracestate'] = spanContext.traceState?.hdrs()[0] || ''; * ``` */ - traceState?: IW3cTraceState; + traceState?: IW3cTraceState | IOTelTraceState; } -export interface IDistributedTraceContext { +export interface IDistributedTraceContext extends IDistributedTraceInit { /** * Returns the current name of the page diff --git a/shared/AppInsightsCore/src/interfaces/ai/IEventTelemetry.ts b/shared/AppInsightsCore/src/interfaces/ai/IEventTelemetry.ts index f072867f1..6cbfd5923 100644 --- a/shared/AppInsightsCore/src/interfaces/ai/IEventTelemetry.ts +++ b/shared/AppInsightsCore/src/interfaces/ai/IEventTelemetry.ts @@ -1,8 +1,8 @@ -import { IPartC } from "./IPartC"; - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +import { IPartC } from "./IPartC"; + export interface IEventTelemetry extends IPartC { /** * @description An event name string diff --git a/shared/AppInsightsCore/src/interfaces/ai/IFeatureOptIn.ts b/shared/AppInsightsCore/src/interfaces/ai/IFeatureOptIn.ts index c78147735..f05fd9173 100644 --- a/shared/AppInsightsCore/src/interfaces/ai/IFeatureOptIn.ts +++ b/shared/AppInsightsCore/src/interfaces/ai/IFeatureOptIn.ts @@ -1,3 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + import { FeatureOptInMode } from "../../enums/ai/FeatureOptInEnums"; export interface IFeatureOptInDetails { diff --git a/shared/AppInsightsCore/src/interfaces/ai/IMetricTelemetry.ts b/shared/AppInsightsCore/src/interfaces/ai/IMetricTelemetry.ts index 0c391b723..0146009fb 100644 --- a/shared/AppInsightsCore/src/interfaces/ai/IMetricTelemetry.ts +++ b/shared/AppInsightsCore/src/interfaces/ai/IMetricTelemetry.ts @@ -1,3 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + import { IPartC } from "./IPartC"; // Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/shared/AppInsightsCore/src/interfaces/ai/IPageViewPerformanceTelemetry.ts b/shared/AppInsightsCore/src/interfaces/ai/IPageViewPerformanceTelemetry.ts index 044b3d908..c5ba738b4 100644 --- a/shared/AppInsightsCore/src/interfaces/ai/IPageViewPerformanceTelemetry.ts +++ b/shared/AppInsightsCore/src/interfaces/ai/IPageViewPerformanceTelemetry.ts @@ -1,8 +1,8 @@ -import { IPartC } from "./IPartC"; - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +import { IPartC } from "./IPartC"; + export interface IPageViewPerformanceTelemetry extends IPartC { /** * name String - The name of the page. Defaults to the document title. diff --git a/shared/AppInsightsCore/src/interfaces/ai/IPageViewTelemetry.ts b/shared/AppInsightsCore/src/interfaces/ai/IPageViewTelemetry.ts index 4a43926b4..aff08109f 100644 --- a/shared/AppInsightsCore/src/interfaces/ai/IPageViewTelemetry.ts +++ b/shared/AppInsightsCore/src/interfaces/ai/IPageViewTelemetry.ts @@ -1,3 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + import { IPartC } from "./IPartC"; // Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/shared/AppInsightsCore/src/interfaces/ai/IRequestContext.ts b/shared/AppInsightsCore/src/interfaces/ai/IRequestContext.ts index 1f20f7751..14823ef1d 100644 --- a/shared/AppInsightsCore/src/interfaces/ai/IRequestContext.ts +++ b/shared/AppInsightsCore/src/interfaces/ai/IRequestContext.ts @@ -1,3 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + export interface IRequestContext { status?: number; xhr?: XMLHttpRequest; diff --git a/shared/AppInsightsCore/src/interfaces/ai/ISenderPostManager.ts b/shared/AppInsightsCore/src/interfaces/ai/ISenderPostManager.ts index aeb9b4bbf..38d4135c6 100644 --- a/shared/AppInsightsCore/src/interfaces/ai/ISenderPostManager.ts +++ b/shared/AppInsightsCore/src/interfaces/ai/ISenderPostManager.ts @@ -1,3 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + import { ITimerHandler } from "@nevware21/ts-utils"; import { TransportType } from "../../enums/ai/SendRequestReason"; import { IXDomainRequest } from "./IXDomainRequest"; diff --git a/shared/AppInsightsCore/src/interfaces/ai/IStorageBuffer.ts b/shared/AppInsightsCore/src/interfaces/ai/IStorageBuffer.ts index e7aaa1281..ce7e80a3c 100644 --- a/shared/AppInsightsCore/src/interfaces/ai/IStorageBuffer.ts +++ b/shared/AppInsightsCore/src/interfaces/ai/IStorageBuffer.ts @@ -1,3 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + import { IDiagnosticLogger } from "./IDiagnosticLogger"; /** diff --git a/shared/AppInsightsCore/src/interfaces/ai/ITelemetryInitializers.ts b/shared/AppInsightsCore/src/interfaces/ai/ITelemetryInitializers.ts index cdcad6b81..21d7787f2 100644 --- a/shared/AppInsightsCore/src/interfaces/ai/ITelemetryInitializers.ts +++ b/shared/AppInsightsCore/src/interfaces/ai/ITelemetryInitializers.ts @@ -1,3 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + import { ITelemetryItem } from "./ITelemetryItem"; import { ILegacyUnloadHook } from "./IUnloadHook"; diff --git a/shared/AppInsightsCore/src/interfaces/ai/IThrottleMgr.ts b/shared/AppInsightsCore/src/interfaces/ai/IThrottleMgr.ts index 9fe41a91a..12a836235 100644 --- a/shared/AppInsightsCore/src/interfaces/ai/IThrottleMgr.ts +++ b/shared/AppInsightsCore/src/interfaces/ai/IThrottleMgr.ts @@ -1,3 +1,5 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. /** * Identifies limit number/percentage of items sent per time diff --git a/shared/AppInsightsCore/src/interfaces/ai/IXDomainRequest.ts b/shared/AppInsightsCore/src/interfaces/ai/IXDomainRequest.ts index 6d58d3548..b14c9cafa 100644 --- a/shared/AppInsightsCore/src/interfaces/ai/IXDomainRequest.ts +++ b/shared/AppInsightsCore/src/interfaces/ai/IXDomainRequest.ts @@ -1,3 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + export interface IBackendResponse { /** * Number of items received by the backend diff --git a/shared/AppInsightsCore/src/interfaces/ai/IXHROverride.ts b/shared/AppInsightsCore/src/interfaces/ai/IXHROverride.ts index e8946434d..b56547709 100644 --- a/shared/AppInsightsCore/src/interfaces/ai/IXHROverride.ts +++ b/shared/AppInsightsCore/src/interfaces/ai/IXHROverride.ts @@ -1,3 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + import { IPromise } from "@nevware21/ts-async"; import { SendRequestReason } from "../../enums/ai/SendRequestReason"; @@ -20,9 +23,7 @@ export interface IPayloadData { */ export type SendPOSTFunction = (payload: IPayloadData, oncomplete: OnCompleteCallback, sync?: boolean) => void | IPromise; -export type OnCompleteCallback = (status: number, headers: { [headerName: string]: string; }, response?: string) => void; - - +export type OnCompleteCallback = (status: number, headers: { [headerName: string]: string; }, response?: string, payload?: IPayloadData) => void; /** * The IXHROverride interface overrides the way HTTP requests are sent. @@ -30,6 +31,3 @@ export type OnCompleteCallback = (status: number, headers: { [headerName: string export interface IXHROverride { sendPOST: SendPOSTFunction; } - - - diff --git a/shared/AppInsightsCore/src/interfaces/ai/PartAExtensions.ts b/shared/AppInsightsCore/src/interfaces/ai/PartAExtensions.ts index 771cd4eb5..7905a6501 100644 --- a/shared/AppInsightsCore/src/interfaces/ai/PartAExtensions.ts +++ b/shared/AppInsightsCore/src/interfaces/ai/PartAExtensions.ts @@ -1,3 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + import { ContextTagKeys } from "./contracts/ContextTagKeys"; export const Extensions = { diff --git a/shared/AppInsightsCore/src/interfaces/ai/context/ISample.ts b/shared/AppInsightsCore/src/interfaces/ai/context/ISample.ts index e322fbdae..8da501828 100644 --- a/shared/AppInsightsCore/src/interfaces/ai/context/ISample.ts +++ b/shared/AppInsightsCore/src/interfaces/ai/context/ISample.ts @@ -8,5 +8,6 @@ export interface ISample { * Sample rate */ sampleRate: number; + isSampledIn(envelope: ITelemetryItem): boolean; } \ No newline at end of file diff --git a/shared/AppInsightsCore/src/interfaces/ai/contracts/AvailabilityData.ts b/shared/AppInsightsCore/src/interfaces/ai/contracts/AvailabilityData.ts index abf701029..bd1165c5b 100644 --- a/shared/AppInsightsCore/src/interfaces/ai/contracts/AvailabilityData.ts +++ b/shared/AppInsightsCore/src/interfaces/ai/contracts/AvailabilityData.ts @@ -1,5 +1,5 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// // Licensed under the MIT License. +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. // // THIS FILE WAS AUTOGENERATED // import { Domain } from "./Domain"; diff --git a/shared/AppInsightsCore/src/interfaces/ai/contracts/IEnvelope.ts b/shared/AppInsightsCore/src/interfaces/ai/contracts/IEnvelope.ts deleted file mode 100644 index 916f65649..000000000 --- a/shared/AppInsightsCore/src/interfaces/ai/contracts/IEnvelope.ts +++ /dev/null @@ -1,50 +0,0 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// // Licensed under the MIT License. - -// import { IBase } from "./IBase"; - -// /** -// * System variables for a telemetry item. -// */ -// export interface IEnvelope { - -// /** -// * Envelope version. For internal use only. By assigning this the default, it will not be serialized within the payload unless changed to a value other than #1. -// */ -// ver: number; /* 1 */ - -// /** -// * Type name of telemetry data item. -// */ -// name: string; - -// /** -// * Event date time when telemetry item was created. This is the wall clock time on the client when the event was generated. There is no guarantee that the client's time is accurate. This field must be formatted in UTC ISO 8601 format, with a trailing 'Z' character, as described publicly on https://en.wikipedia.org/wiki/ISO_8601#UTC. Note: the number of decimal seconds digits provided are variable (and unspecified). Consumers should handle this, i.e. managed code consumers should not use format 'O' for parsing as it specifies a fixed length. Example: 2009-06-15T13:45:30.0000000Z. -// */ -// time: string; - -// /** -// * Sampling rate used in application. This telemetry item represents 1 / sampleRate actual telemetry items. -// */ -// sampleRate: number; /* 100.0 */ - -// /** -// * Sequence field used to track absolute order of uploaded events. -// */ -// seq: string; - -// /** -// * The application's instrumentation key. The key is typically represented as a GUID, but there are cases when it is not a guid. No code should rely on iKey being a GUID. Instrumentation key is case insensitive. -// */ -// iKey: string; - -// /** -// * Key/value collection of context properties. See ContextTagKeys for information on available properties. -// */ -// tags: any; /* {} */ - -// /** -// * Telemetry data item. -// */ -// data: IBase; -// } diff --git a/shared/AppInsightsCore/src/interfaces/config/_IDynamicConfigHandlerState.ts b/shared/AppInsightsCore/src/interfaces/config/_IDynamicConfigHandlerState.ts index 4c2f6dbe5..77b96cdb2 100644 --- a/shared/AppInsightsCore/src/interfaces/config/_IDynamicConfigHandlerState.ts +++ b/shared/AppInsightsCore/src/interfaces/config/_IDynamicConfigHandlerState.ts @@ -1,3 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + import { IDynamicConfigHandler } from "./IDynamicConfigHandler"; import { IDynamicPropertyHandler } from "./IDynamicPropertyHandler"; import { IWatcherHandler, WatcherFunction, _IDynamicDetail } from "./IDynamicWatcher"; diff --git a/shared/AppInsightsCore/src/interfaces/otel/IOTelApi.ts b/shared/AppInsightsCore/src/interfaces/otel/IOTelApi.ts index 95055cef5..2ec0f7cc7 100644 --- a/shared/AppInsightsCore/src/interfaces/otel/IOTelApi.ts +++ b/shared/AppInsightsCore/src/interfaces/otel/IOTelApi.ts @@ -1,3 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + import { ITraceHost } from "../ai/ITraceProvider"; import { IOTelConfig } from "./config/IOTelConfig"; import { ITraceApi } from "./trace/IOTelTraceApi"; diff --git a/shared/AppInsightsCore/src/interfaces/otel/IOTelApiCtx.ts b/shared/AppInsightsCore/src/interfaces/otel/IOTelApiCtx.ts index 07f2d4b55..03775557b 100644 --- a/shared/AppInsightsCore/src/interfaces/otel/IOTelApiCtx.ts +++ b/shared/AppInsightsCore/src/interfaces/otel/IOTelApiCtx.ts @@ -1,3 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + import { ITraceHost } from "../ai/ITraceProvider"; /** diff --git a/shared/AppInsightsCore/src/interfaces/otel/IOTelAttributes.ts b/shared/AppInsightsCore/src/interfaces/otel/IOTelAttributes.ts index ad2073535..163451cb9 100644 --- a/shared/AppInsightsCore/src/interfaces/otel/IOTelAttributes.ts +++ b/shared/AppInsightsCore/src/interfaces/otel/IOTelAttributes.ts @@ -1,3 +1,5 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. /** * Attribute values may be any non-nullish primitive value except an object. diff --git a/shared/AppInsightsCore/src/interfaces/otel/config/IOTelAttributeLimits.ts b/shared/AppInsightsCore/src/interfaces/otel/config/IOTelAttributeLimits.ts index 702315f97..f99515228 100644 --- a/shared/AppInsightsCore/src/interfaces/otel/config/IOTelAttributeLimits.ts +++ b/shared/AppInsightsCore/src/interfaces/otel/config/IOTelAttributeLimits.ts @@ -1,4 +1,5 @@ - +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. /** * Configuration interface for OpenTelemetry attribute limits. diff --git a/shared/AppInsightsCore/src/interfaces/otel/config/IOTelConfig.ts b/shared/AppInsightsCore/src/interfaces/otel/config/IOTelConfig.ts index f264d7215..befeeb957 100644 --- a/shared/AppInsightsCore/src/interfaces/otel/config/IOTelConfig.ts +++ b/shared/AppInsightsCore/src/interfaces/otel/config/IOTelConfig.ts @@ -1,3 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + import { IOTelErrorHandlers } from "./IOTelErrorHandlers"; import { ITraceCfg } from "./IOTelTraceCfg"; diff --git a/shared/AppInsightsCore/src/interfaces/otel/config/IOTelErrorHandlers.ts b/shared/AppInsightsCore/src/interfaces/otel/config/IOTelErrorHandlers.ts index 6688c287a..697c11e3b 100644 --- a/shared/AppInsightsCore/src/interfaces/otel/config/IOTelErrorHandlers.ts +++ b/shared/AppInsightsCore/src/interfaces/otel/config/IOTelErrorHandlers.ts @@ -1,4 +1,5 @@ - +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. /** * Configuration interface for OpenTelemetry error handling callbacks. diff --git a/shared/AppInsightsCore/src/interfaces/otel/config/IOTelSpanLimits.ts b/shared/AppInsightsCore/src/interfaces/otel/config/IOTelSpanLimits.ts index 14e189630..0a94d23bf 100644 --- a/shared/AppInsightsCore/src/interfaces/otel/config/IOTelSpanLimits.ts +++ b/shared/AppInsightsCore/src/interfaces/otel/config/IOTelSpanLimits.ts @@ -1,3 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + // import { IOTelAttributeLimits } from "./IOTelAttributeLimits"; // /** diff --git a/shared/AppInsightsCore/src/interfaces/otel/config/IOTelTraceCfg.ts b/shared/AppInsightsCore/src/interfaces/otel/config/IOTelTraceCfg.ts index 7f6b96ea8..c66ad552e 100644 --- a/shared/AppInsightsCore/src/interfaces/otel/config/IOTelTraceCfg.ts +++ b/shared/AppInsightsCore/src/interfaces/otel/config/IOTelTraceCfg.ts @@ -1,3 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + import { IOTelAttributeLimits } from "./IOTelAttributeLimits"; /** diff --git a/shared/AppInsightsCore/src/interfaces/otel/trace/IOTelSpan.ts b/shared/AppInsightsCore/src/interfaces/otel/trace/IOTelSpan.ts index 250a3314c..0f3bd6196 100644 --- a/shared/AppInsightsCore/src/interfaces/otel/trace/IOTelSpan.ts +++ b/shared/AppInsightsCore/src/interfaces/otel/trace/IOTelSpan.ts @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +import { OTelException } from "../../IException"; import { OTelTimeInput } from "../../IOTelHrTime"; import { IDistributedTraceContext } from "../../ai/IDistributedTraceContext"; import { IOTelAttributes, OTelAttributeValue } from "../IOTelAttributes"; -import { OTelException } from "../IOTelException"; import { IAttributeContainer } from "../attribute/IAttributeContainer"; import { IOTelSpanStatus } from "./IOTelSpanStatus"; diff --git a/shared/AppInsightsCore/src/interfaces/otel/trace/IOTelSpanContext.ts b/shared/AppInsightsCore/src/interfaces/otel/trace/IOTelSpanContext.ts new file mode 100644 index 000000000..9da8f4b90 --- /dev/null +++ b/shared/AppInsightsCore/src/interfaces/otel/trace/IOTelSpanContext.ts @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +import { IDistributedTraceInit } from "../../ai/IDistributedTraceContext"; + +/** + * A SpanContext represents the portion of a {@link IOTelSpan} which must be + * serialized and propagated along side of a {@link IOTelBaggage}. + */ +export interface IOTelSpanContext extends IDistributedTraceInit { + + /** + * Trace flags to propagate. + * + * It is represented as 1 byte (bitmap). Bit to represent whether trace is + * sampled or not. When set, the least significant bit documents that the + * caller may have recorded trace data. A caller who does not record trace + * data out-of-band leaves this flag unset. + * + * see {@link eW3CTraceFlags} for valid flag values. + */ + traceFlags: number; +} diff --git a/shared/AppInsightsCore/src/interfaces/otel/trace/IOTelSpanCtx.ts b/shared/AppInsightsCore/src/interfaces/otel/trace/IOTelSpanCtx.ts index 7826093d9..162b76b33 100644 --- a/shared/AppInsightsCore/src/interfaces/otel/trace/IOTelSpanCtx.ts +++ b/shared/AppInsightsCore/src/interfaces/otel/trace/IOTelSpanCtx.ts @@ -1,8 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +import { OTelException } from "../../IException"; import { OTelTimeInput } from "../../IOTelHrTime"; import { IDistributedTraceContext } from "../../ai/IDistributedTraceContext"; import { IOTelApi } from "../IOTelApi"; import { IOTelAttributes } from "../IOTelAttributes"; -import { OTelException } from "../IOTelException"; import { IReadableSpan } from "./IReadableSpan"; /** @@ -17,13 +20,13 @@ export interface IOTelSpanCtx { // /** // * The current {@link IOTelResource} instance to use for this Span Context // */ - // resource: IOTelResource; + // resource?: IOTelResource; // /** // * The current {@link IOTelInstrumentationScope} instrumentationScope instance to // * use for this Span Context // */ - // instrumentationScope: IOTelInstrumentationScope; + // instrumentationScope?: IOTelInstrumentationScope; // /** // * The context for the current instance (not currently used) diff --git a/shared/AppInsightsCore/src/interfaces/otel/trace/IOTelSpanOptions.ts b/shared/AppInsightsCore/src/interfaces/otel/trace/IOTelSpanOptions.ts index b88ff46a5..bc4d550cb 100644 --- a/shared/AppInsightsCore/src/interfaces/otel/trace/IOTelSpanOptions.ts +++ b/shared/AppInsightsCore/src/interfaces/otel/trace/IOTelSpanOptions.ts @@ -6,7 +6,8 @@ import { OTelTimeInput } from "../../IOTelHrTime"; import { IOTelAttributes } from "../IOTelAttributes"; /** - * Options for creating a span. + * Provides an OpenTelemetry like Interface for the Open Telemetry Api (1.9.0) SpanOptions + * type. Where SpanOptions are options that can be used to configure a span. */ export interface IOTelSpanOptions { /** diff --git a/shared/AppInsightsCore/src/interfaces/otel/trace/IOTelSpanStatus.ts b/shared/AppInsightsCore/src/interfaces/otel/trace/IOTelSpanStatus.ts index c48080a91..4bfdeb170 100644 --- a/shared/AppInsightsCore/src/interfaces/otel/trace/IOTelSpanStatus.ts +++ b/shared/AppInsightsCore/src/interfaces/otel/trace/IOTelSpanStatus.ts @@ -1,3 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + import { eOTelSpanStatusCode } from "../../../enums/otel/OTelSpanStatus"; export interface IOTelSpanStatus { diff --git a/shared/AppInsightsCore/src/interfaces/otel/trace/IOTelTraceApi.ts b/shared/AppInsightsCore/src/interfaces/otel/trace/IOTelTraceApi.ts index c6813ec5b..3eab1e73f 100644 --- a/shared/AppInsightsCore/src/interfaces/otel/trace/IOTelTraceApi.ts +++ b/shared/AppInsightsCore/src/interfaces/otel/trace/IOTelTraceApi.ts @@ -1,7 +1,11 @@ -import { IDistributedTraceContext } from "../../ai/IDistributedTraceContext"; +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +import { IDistributedTraceContext, IDistributedTraceInit } from "../../ai/IDistributedTraceContext"; import { ISpanScope } from "../../ai/ITraceProvider"; +import { IOTelSpanContext } from "./IOTelSpanContext"; import { IOTelTracer } from "./IOTelTracer"; -import { IOTelTracerOptions } from "./IOTelTracerProvider"; +import { IOTelTracerOptions } from "./IOTelTracerOptions"; import { IReadableSpan } from "./IReadableSpan"; /** @@ -25,13 +29,13 @@ export interface ITraceApi { * @param spanContext - The {@link IDistributedTraceContext} to be wrapped * @returns a new non-recording {@link IReadableSpan} with the provided context */ - wrapSpanContext(spanContext: IDistributedTraceContext): IReadableSpan; + wrapSpanContext(spanContext: IDistributedTraceContext | IDistributedTraceInit | IOTelSpanContext): IReadableSpan; /** * Returns true if this {@link IDistributedTraceContext} is valid. * @return true if this {@link IDistributedTraceContext} is valid. */ - isSpanContextValid(spanContext: IDistributedTraceContext): boolean; + isSpanContextValid(spanContext: IDistributedTraceContext | IDistributedTraceInit | IOTelSpanContext): boolean; /** * Gets the span from the current context, if one exists. diff --git a/shared/AppInsightsCore/src/interfaces/otel/trace/IOTelTracer.ts b/shared/AppInsightsCore/src/interfaces/otel/trace/IOTelTracer.ts index ff2d4207c..a4cf84eea 100644 --- a/shared/AppInsightsCore/src/interfaces/otel/trace/IOTelTracer.ts +++ b/shared/AppInsightsCore/src/interfaces/otel/trace/IOTelTracer.ts @@ -47,7 +47,6 @@ export interface IOTelTracer { * * @param name - The name of the span, should be descriptive of the operation being traced * @param options - Optional configuration for span creation (parent context, attributes, etc.) - * @param context - Optional context to use for extracting the parent span; if not provided, uses current context * * @returns The newly created span, or null if span creation failed * diff --git a/shared/AppInsightsCore/src/interfaces/otel/trace/IOTelTracerOptions.ts b/shared/AppInsightsCore/src/interfaces/otel/trace/IOTelTracerOptions.ts new file mode 100644 index 000000000..348d64ed2 --- /dev/null +++ b/shared/AppInsightsCore/src/interfaces/otel/trace/IOTelTracerOptions.ts @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +export interface IOTelTracerOptions { + /** + * The schemaUrl of the tracer or instrumentation library + */ + schemaUrl?: string; +} diff --git a/shared/AppInsightsCore/src/interfaces/otel/trace/IOTelTracerProvider.ts b/shared/AppInsightsCore/src/interfaces/otel/trace/IOTelTracerProvider.ts index 8e4430fb9..c986902ee 100644 --- a/shared/AppInsightsCore/src/interfaces/otel/trace/IOTelTracerProvider.ts +++ b/shared/AppInsightsCore/src/interfaces/otel/trace/IOTelTracerProvider.ts @@ -3,13 +3,7 @@ import { IPromise } from "@nevware21/ts-async"; import { IOTelTracer } from "./IOTelTracer"; - -export declare interface IOTelTracerOptions { - /** - * The schemaUrl of the tracer or instrumentation library - */ - schemaUrl?: string; -} +import { IOTelTracerOptions } from "./IOTelTracerOptions"; /** * OpenTelemetry Trace API for getting tracers. @@ -42,3 +36,4 @@ export interface IOTelTracerProvider { */ shutdown?: () => IPromise | void; } + diff --git a/shared/AppInsightsCore/src/internal/attributeHelpers.ts b/shared/AppInsightsCore/src/internal/attributeHelpers.ts index 0ff7326e1..2d6bdb2de 100644 --- a/shared/AppInsightsCore/src/internal/attributeHelpers.ts +++ b/shared/AppInsightsCore/src/internal/attributeHelpers.ts @@ -1,3 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + import { arrForEach, arrSlice, isArray, isObject, isString, objForEachKey } from "@nevware21/ts-utils"; import { IOTelApi } from "../interfaces/otel/IOTelApi"; import { IOTelAttributes, OTelAttributeValue } from "../interfaces/otel/IOTelAttributes"; diff --git a/shared/AppInsightsCore/src/internal/commonUtils.ts b/shared/AppInsightsCore/src/internal/commonUtils.ts index 898ad9543..c0047d7a4 100644 --- a/shared/AppInsightsCore/src/internal/commonUtils.ts +++ b/shared/AppInsightsCore/src/internal/commonUtils.ts @@ -1,15 +1,18 @@ -// Copyright (c) Microsoft Corporation. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +import { IPromise, createRacePromise, createTimeoutPromise } from "@nevware21/ts-async"; import { ILazyValue, asString, dumpObj, isError, isObject, isPrimitive, safe, safeGetLazy } from "@nevware21/ts-utils"; import { STR_EMPTY } from "../constants/InternalConstants"; import { OTelAttributeValue } from "../interfaces/otel/IOTelAttributes"; import { IAttributeContainer } from "../interfaces/otel/attribute/IAttributeContainer"; +import { IOTelErrorHandlers } from "../interfaces/otel/config/IOTelErrorHandlers"; import { DBSYSTEMVALUES_DB2, DBSYSTEMVALUES_DERBY, DBSYSTEMVALUES_H2, DBSYSTEMVALUES_HSQLDB, DBSYSTEMVALUES_MARIADB, DBSYSTEMVALUES_MSSQL, DBSYSTEMVALUES_ORACLE, DBSYSTEMVALUES_OTHER_SQL, DBSYSTEMVALUES_SQLITE } from "../otel/attribute/SemanticConventions"; import { getJSON } from "../utils/EnvUtils"; +import { handleError } from "./handleErrors"; const _hasJsonStringify: ILazyValue = (/*#__PURE__*/ safeGetLazy(() => !!getJSON().stringify, null)); @@ -292,3 +295,35 @@ export function isSqlDB(dbSystem: string): boolean { dbSystem === DBSYSTEMVALUES_H2 ); } + +/** + * Adds a timeout to a promise and rejects if the specified timeout has elapsed. + * Reports the timeout through the configured error handlers before rejecting. + * + * @param handlers - The configured error handlers to notify. + * @param promise - The promise to guard with the timeout. + * @param timeout - Timeout in milliseconds before the promise is rejected. + */ +export function callWithTimeout( + handlers: IOTelErrorHandlers, + promise: Promise, + timeout: number +): IPromise { + const timeoutMessage = "Operation timed out."; + const timeoutError = new Error(timeoutMessage); + timeoutError.name = "TimeoutError"; + (timeoutError as { __otelTimeout?: boolean }).__otelTimeout = true; + + const racedPromise = createRacePromise([ + promise, + createTimeoutPromise(timeout, false, timeoutError) as unknown as PromiseLike + ]); + + return racedPromise.catch((error) => { + if (error && (error === timeoutError || (error as { __otelTimeout?: boolean }).__otelTimeout)) { + handleError(handlers, timeoutMessage); + } + + throw error; + }); +} diff --git a/shared/AppInsightsCore/src/internal/handleErrors.ts b/shared/AppInsightsCore/src/internal/handleErrors.ts index 89f0707d5..c035a7698 100644 --- a/shared/AppInsightsCore/src/internal/handleErrors.ts +++ b/shared/AppInsightsCore/src/internal/handleErrors.ts @@ -1,3 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + import { dumpObj, fnApply } from "@nevware21/ts-utils"; import { IOTelErrorHandlers } from "../interfaces/otel/config/IOTelErrorHandlers"; diff --git a/shared/AppInsightsCore/src/internal/noopHelpers.ts b/shared/AppInsightsCore/src/internal/noopHelpers.ts index 0b34a2a27..d675ef456 100644 --- a/shared/AppInsightsCore/src/internal/noopHelpers.ts +++ b/shared/AppInsightsCore/src/internal/noopHelpers.ts @@ -1,4 +1,5 @@ - +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. /** * A simple function that does nothing and returns the current this (if any). diff --git a/shared/AppInsightsCore/src/internal/timeHelpers.ts b/shared/AppInsightsCore/src/internal/timeHelpers.ts index b0e98123e..818fb4d5a 100644 --- a/shared/AppInsightsCore/src/internal/timeHelpers.ts +++ b/shared/AppInsightsCore/src/internal/timeHelpers.ts @@ -1,6 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + import { ICachedValue, ObjDefinePropDescriptor, createCachedValue, getDeferred, getPerformance, isArray, isDate, isNullOrUndefined, isNumber, - isString, mathFloor, mathRound, objDefineProps, objFreeze, perfNow, strLeft, strRight, strSplit, throwTypeError + mathFloor, mathRound, objDefineProps, objFreeze, perfNow, strLeft, strRight, throwTypeError } from "@nevware21/ts-utils"; import { IOTelHrTime, OTelTimeInput } from "../interfaces/IOTelHrTime"; import { setObjStringTag, toISOString } from "../utils/HelperFuncs"; @@ -346,41 +349,6 @@ export function isTimeInput(value: unknown): value is OTelTimeInput { return !isNullOrUndefined(value) && (isTimeInputHrTime(value) || isNumber(value) || isDate(value)); } -/** - * A helper method to determine whether the provided value is in a ISO time span format (DD.HH:MM:SS.MMMMMM) - * @param value - The value to check - * @returns True if the value is in a time span format; false otherwise - */ -/*#__NO_SIDE_EFFECTS__*/ -export function isTimeSpan(value: any): value is string { - let result = false; - - if (isString(value)) { - const parts = strSplit(value, ":"); - if (parts.length === 3) { - // Looks like a candidate, now validate each part - const daysHours = strSplit(parts[0], "."); - if (daysHours.length === 2) { - result = !isNaN(parseInt(daysHours[0] || "0")) && !isNaN(parseInt(daysHours[1] || "0")); - } else { - result = !isNaN(parseInt(daysHours[0] || "0")); - } - - result = result && !isNaN(parseInt(parts[1] || "0")); - - const secondsParts = strSplit(parts[2], "."); - if (secondsParts.length === 2) { - result = result && !isNaN(parseInt(secondsParts[0] || "0")) && !isNaN(parseInt(secondsParts[1] || "0")); - } else { - result = result && !isNaN(parseInt(secondsParts[0] || "0")); - } - } - } - - return result; -} - - /** * Given 2 HrTime formatted times, return their sum as an HrTime. * @param time1 - The first HrTime to add diff --git a/shared/AppInsightsCore/src/otel/api/OTelApi.ts b/shared/AppInsightsCore/src/otel/api/OTelApi.ts index dd694da5f..b379cebb8 100644 --- a/shared/AppInsightsCore/src/otel/api/OTelApi.ts +++ b/shared/AppInsightsCore/src/otel/api/OTelApi.ts @@ -1,3 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + import { ILazyValue, objDefineProps } from "@nevware21/ts-utils"; import { IOTelApi } from "../../interfaces/otel/IOTelApi"; import { IOTelApiCtx } from "../../interfaces/otel/IOTelApiCtx"; diff --git a/shared/AppInsightsCore/src/otel/api/errors/OTelError.ts b/shared/AppInsightsCore/src/otel/api/errors/OTelError.ts index e6a5b6e61..7ce1d8868 100644 --- a/shared/AppInsightsCore/src/otel/api/errors/OTelError.ts +++ b/shared/AppInsightsCore/src/otel/api/errors/OTelError.ts @@ -1,3 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + import { CustomErrorConstructor, createCustomError } from "@nevware21/ts-utils"; let otelErrorType: OpenTelemetryErrorConstructor; diff --git a/shared/AppInsightsCore/src/otel/api/errors/OTelInvalidAttributeError.ts b/shared/AppInsightsCore/src/otel/api/errors/OTelInvalidAttributeError.ts index 3339db753..ce726dc81 100644 --- a/shared/AppInsightsCore/src/otel/api/errors/OTelInvalidAttributeError.ts +++ b/shared/AppInsightsCore/src/otel/api/errors/OTelInvalidAttributeError.ts @@ -1,3 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + import { createCustomError } from "@nevware21/ts-utils"; import { STR_EMPTY } from "../../../constants/InternalConstants"; import { OpenTelemetryError, OpenTelemetryErrorConstructor, getOpenTelemetryError } from "./OTelError"; diff --git a/shared/AppInsightsCore/src/otel/api/errors/OTelSpanError.ts b/shared/AppInsightsCore/src/otel/api/errors/OTelSpanError.ts index 13fa48408..473cbe549 100644 --- a/shared/AppInsightsCore/src/otel/api/errors/OTelSpanError.ts +++ b/shared/AppInsightsCore/src/otel/api/errors/OTelSpanError.ts @@ -1,3 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + import { createCustomError } from "@nevware21/ts-utils"; import { STR_EMPTY } from "../../../constants/InternalConstants"; import { OpenTelemetryError, OpenTelemetryErrorConstructor, getOpenTelemetryError } from "./OTelError"; diff --git a/shared/AppInsightsCore/src/otel/api/trace/span.ts b/shared/AppInsightsCore/src/otel/api/trace/span.ts index 6d66c5afc..52be737eb 100644 --- a/shared/AppInsightsCore/src/otel/api/trace/span.ts +++ b/shared/AppInsightsCore/src/otel/api/trace/span.ts @@ -7,9 +7,9 @@ import { import { STR_EMPTY, UNDEFINED_VALUE } from "../../../constants/InternalConstants"; import { OTelSpanKind, eOTelSpanKind } from "../../../enums/otel/OTelSpanKind"; import { eOTelSpanStatusCode } from "../../../enums/otel/OTelSpanStatus"; +import { OTelException } from "../../../interfaces/IException"; import { IOTelHrTime, OTelTimeInput } from "../../../interfaces/IOTelHrTime"; import { IOTelAttributes } from "../../../interfaces/otel/IOTelAttributes"; -import { OTelException } from "../../../interfaces/otel/IOTelException"; import { IAttributeContainer } from "../../../interfaces/otel/attribute/IAttributeContainer"; import { IOTelSpanCtx } from "../../../interfaces/otel/trace/IOTelSpanCtx"; import { IOTelSpanStatus } from "../../../interfaces/otel/trace/IOTelSpanStatus"; @@ -46,6 +46,7 @@ export function createSpan(spanCtx: IOTelSpanCtx, orgName: string, kind: OTelSpa // let droppedEvents = 0; // let droppedLinks = 0; let isRecording = spanCtx.isRecording !== false; + if (otelCfg.traceCfg && otelCfg.traceCfg.suppressTracing) { // Automatically disable the span from recording isRecording = false; diff --git a/shared/AppInsightsCore/src/otel/api/trace/spanContext.ts b/shared/AppInsightsCore/src/otel/api/trace/spanContext.ts new file mode 100644 index 000000000..123f708fe --- /dev/null +++ b/shared/AppInsightsCore/src/otel/api/trace/spanContext.ts @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +import { isNullOrUndefined, isNumber, isObject, isString, objDefineProps } from "@nevware21/ts-utils"; +import { eW3CTraceFlags } from "../../../enums/W3CTraceFlags"; +import { IDistributedTraceContext } from "../../../interfaces/ai/IDistributedTraceContext"; +import { IOTelSpanContext } from "../../../interfaces/otel/trace/IOTelSpanContext"; +import { IOTelTraceState } from "../../../interfaces/otel/trace/IOTelTraceState"; +import { INVALID_SPAN_ID, INVALID_TRACE_ID, isValidSpanId, isValidTraceId } from "../../../utils/TraceParent"; +import { createOTelTraceState } from "./traceState"; + +export function createOTelSpanContext(traceContext: IDistributedTraceContext | IOTelSpanContext): IOTelSpanContext { + + let traceId = isValidTraceId(traceContext.traceId) ? traceContext.traceId : INVALID_TRACE_ID; + let spanId = isValidSpanId(traceContext.spanId) ? traceContext.spanId : INVALID_SPAN_ID; + let isRemote = traceContext.isRemote; + let traceFlags = (!isNullOrUndefined(traceContext.traceFlags) ? traceContext.traceFlags : eW3CTraceFlags.Sampled); + let otTraceState: IOTelTraceState | null = null; + + let traceContextObj: IOTelSpanContext = { + traceId, + spanId, + traceFlags + }; + + return objDefineProps(traceContextObj, { + traceId: { + g: () => traceId, + s: (value: string) => traceId = isValidTraceId(value) ? value : INVALID_TRACE_ID + }, + spanId: { + g: () => spanId, + s: (value: string) => spanId = isValidSpanId(value) ? value : INVALID_SPAN_ID + }, + isRemote: { + g: () => isRemote + }, + traceFlags: { + g: () => traceFlags, + s: (value: number) => traceFlags = value + }, + traceState: { + g: () => { + if (!otTraceState) { + // The Trace State has changed, update the local copy + otTraceState = createOTelTraceState(traceContext.traceState); + } + + return otTraceState; + }, + s: (value: IOTelTraceState) => { + // The Trace State has changed, update the local copy + otTraceState = value; + } + } + }); +} + +export function isSpanContext(spanContext: any): spanContext is IOTelSpanContext { + return spanContext && isObject(spanContext) && isString(spanContext.traceId) && isString(spanContext.spanId) && isNumber(spanContext.traceFlags); +} + +export function wrapDistributedTrace(traceContext: IDistributedTraceContext): IOTelSpanContext { + return createOTelSpanContext(traceContext); +} diff --git a/shared/AppInsightsCore/src/otel/api/trace/traceApi.ts b/shared/AppInsightsCore/src/otel/api/trace/traceApi.ts index 657ed142e..3aff40129 100644 --- a/shared/AppInsightsCore/src/otel/api/trace/traceApi.ts +++ b/shared/AppInsightsCore/src/otel/api/trace/traceApi.ts @@ -1,3 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + import { ICachedValue, fnBind, getDeferred } from "@nevware21/ts-utils"; import { UNDEFINED_VALUE } from "../../../constants/InternalConstants"; import { IDistributedTraceContext } from "../../../interfaces/ai/IDistributedTraceContext"; diff --git a/shared/AppInsightsCore/src/otel/api/trace/traceState.ts b/shared/AppInsightsCore/src/otel/api/trace/traceState.ts index a9d5d05e1..6e733687a 100644 --- a/shared/AppInsightsCore/src/otel/api/trace/traceState.ts +++ b/shared/AppInsightsCore/src/otel/api/trace/traceState.ts @@ -1,3 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + import { ICachedValue, createCachedValue, isFunction, isString, objDefine, symbolFor } from "@nevware21/ts-utils"; import { STR_EMPTY } from "../../../constants/InternalConstants"; import { IW3cTraceState } from "../../../interfaces/ai/IW3cTraceState"; @@ -66,7 +69,7 @@ export function isOTelTraceState(value: any): value is IOTelTraceState { return true; } - return value && isFunction(value.serialize) && isFunction(value.unset)&& isFunction(value.get)&& isFunction(value.set); + return value && isFunction(value.serialize) && isFunction(value.unset) && isFunction(value.get) && isFunction(value.set); } /** diff --git a/shared/AppInsightsCore/src/otel/api/trace/utils.ts b/shared/AppInsightsCore/src/otel/api/trace/utils.ts index ecac13be1..0b537ac6d 100644 --- a/shared/AppInsightsCore/src/otel/api/trace/utils.ts +++ b/shared/AppInsightsCore/src/otel/api/trace/utils.ts @@ -1,3 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + import { doAwait, doFinally } from "@nevware21/ts-async"; import { arrSlice, fnApply, isFunction, isObject, isPromiseLike } from "@nevware21/ts-utils"; import { createDistributedTraceContext, isDistributedTraceContext } from "../../../core/TelemetryHelpers"; @@ -9,6 +12,7 @@ import { IDistributedTraceContext, IDistributedTraceInit } from "../../../interf import { ISpanScope, ITraceHost } from "../../../interfaces/ai/ITraceProvider"; import { IOTelApi } from "../../../interfaces/otel/IOTelApi"; import { ITraceCfg } from "../../../interfaces/otel/config/IOTelTraceCfg"; +import { IOTelSpanContext } from "../../../interfaces/otel/trace/IOTelSpanContext"; import { IOTelSpanCtx } from "../../../interfaces/otel/trace/IOTelSpanCtx"; import { IOTelSpanOptions } from "../../../interfaces/otel/trace/IOTelSpanOptions"; import { IReadableSpan } from "../../../interfaces/otel/trace/IReadableSpan"; @@ -243,7 +247,7 @@ export function startActiveSpan(item: T, } let iKey = ""; - if (item[strIkey]) { - iKey = item[strIkey]; - delete item[strIkey]; + if ((item as any)[strIkey]) { + iKey = (item as any)[strIkey]; + delete (item as any)[strIkey]; } const telemetryItem: ITelemetryItem = { diff --git a/shared/AppInsightsCore/src/telemetry/ai/Common/DataSanitizer.ts b/shared/AppInsightsCore/src/telemetry/ai/Common/DataSanitizer.ts index ef9f34001..efce32458 100644 --- a/shared/AppInsightsCore/src/telemetry/ai/Common/DataSanitizer.ts +++ b/shared/AppInsightsCore/src/telemetry/ai/Common/DataSanitizer.ts @@ -148,7 +148,7 @@ export function dataSanitizeException(logger: IDiagnosticLogger, exception: any) /*#__NO_SIDE_EFFECTS__*/ export function dataSanitizeProperties(logger: IDiagnosticLogger, properties: any) { if (properties) { - const tempProps = {}; + const tempProps: any = {}; objForEachKey(properties, (prop, value) => { if (isObject(value) && hasJSON()) { // Stringify any part C properties @@ -171,7 +171,7 @@ export function dataSanitizeProperties(logger: IDiagnosticLogger, properties: an /*#__NO_SIDE_EFFECTS__*/ export function dataSanitizeMeasurements(logger: IDiagnosticLogger, measurements: any) { if (measurements) { - const tempMeasurements = {}; + const tempMeasurements: any = {}; objForEachKey(measurements, (measure, value) => { measure = dataSanitizeKeyAndAddUniqueness(logger, measure, tempMeasurements); tempMeasurements[measure] = value; diff --git a/shared/AppInsightsCore/src/telemetry/ai/Exception.ts b/shared/AppInsightsCore/src/telemetry/ai/Exception.ts index 2b4f9d02e..1514fa009 100644 --- a/shared/AppInsightsCore/src/telemetry/ai/Exception.ts +++ b/shared/AppInsightsCore/src/telemetry/ai/Exception.ts @@ -373,7 +373,7 @@ function _getStackFromErrorObj(errorObj:any): IStackDetails { details = errorObj; } else if (_isStackDetails(errorObj[strStackDetails])) { details = errorObj[strStackDetails]; - } else if (getWindow() && getWindow()["opera"] && errorObj[strMessage]) { + } else if (getWindow() && (getWindow() as any)["opera"] && errorObj[strMessage]) { // Opera details = _getOperaStack(errorObj.message); } else if (errorObj["reason"] && errorObj.reason[strStack]) { @@ -756,7 +756,7 @@ export function _createExceptionDetails(logger: IDiagnosticLogger, exception: Er typeName = dataSanitizeString(logger, _getErrorType(error)) || strNotSpecified; message = dataSanitizeMessage(logger, _formatMessage(exception || error, typeName)) || strNotSpecified; - const stack = exception[strStackDetails] || _getStackFromErrorObj(exception); + const stack = (exception as any)[strStackDetails] || _getStackFromErrorObj(exception); parsedStack = _parseStack(stack); // after parsedStack is inited, iterate over each frame object, sanitize its assembly field diff --git a/shared/AppInsightsCore/src/telemetry/ai/PageView.ts b/shared/AppInsightsCore/src/telemetry/ai/PageView.ts index 279c3fde7..9c101f09c 100644 --- a/shared/AppInsightsCore/src/telemetry/ai/PageView.ts +++ b/shared/AppInsightsCore/src/telemetry/ai/PageView.ts @@ -6,7 +6,7 @@ import { FieldType } from "../../enums/ai/Enums"; import { IDiagnosticLogger } from "../../interfaces/ai/IDiagnosticLogger"; import { IPageViewData } from "../../interfaces/ai/contracts/IPageViewData"; import { ISerializable } from "../../interfaces/ai/telemetry/ISerializable"; -import { msToTimeSpan } from "../../utils/HelperFuncsCore"; +import { msToTimeSpan } from "../../utils/HelperFuncs"; import { dataSanitizeId, dataSanitizeMeasurements, dataSanitizeProperties, dataSanitizeString, dataSanitizeUrl } from "./Common/DataSanitizer"; diff --git a/shared/AppInsightsCore/src/telemetry/ai/RemoteDependencyData.ts b/shared/AppInsightsCore/src/telemetry/ai/RemoteDependencyData.ts index bf9e337d7..f27c2db3e 100644 --- a/shared/AppInsightsCore/src/telemetry/ai/RemoteDependencyData.ts +++ b/shared/AppInsightsCore/src/telemetry/ai/RemoteDependencyData.ts @@ -5,7 +5,7 @@ import { FieldType } from "../../enums/ai/Enums"; import { IDiagnosticLogger } from "../../interfaces/ai/IDiagnosticLogger"; import { IRemoteDependencyData } from "../../interfaces/ai/contracts/IRemoteDependencyData"; import { ISerializable } from "../../interfaces/ai/telemetry/ISerializable"; -import { msToTimeSpan } from "../../utils/HelperFuncsCore"; +import { msToTimeSpan } from "../../utils/HelperFuncs"; import { AjaxHelperParseDependencyPath } from "../../utils/Util"; import { dataSanitizeMeasurements, dataSanitizeProperties, dataSanitizeString, dataSanitizeUrl } from "./Common/DataSanitizer"; import { RemoteDependencyDataType } from "./DataTypes"; diff --git a/shared/AppInsightsCore/src/utils/DomHelperFuncs.ts b/shared/AppInsightsCore/src/utils/DomHelperFuncs.ts index d5f323ec3..a4acf42c8 100644 --- a/shared/AppInsightsCore/src/utils/DomHelperFuncs.ts +++ b/shared/AppInsightsCore/src/utils/DomHelperFuncs.ts @@ -1,5 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. + import { getDocument, isFunction } from "@nevware21/ts-utils"; export function createDomEvent(eventName: string): Event { diff --git a/shared/AppInsightsCore/src/utils/HelperFuncs.ts b/shared/AppInsightsCore/src/utils/HelperFuncs.ts index 650741089..f28c6aa2c 100644 --- a/shared/AppInsightsCore/src/utils/HelperFuncs.ts +++ b/shared/AppInsightsCore/src/utils/HelperFuncs.ts @@ -3,13 +3,14 @@ import { ObjAssign, ObjClass, ObjProto } from "@microsoft/applicationinsights-shims"; import { ICachedValue, WellKnownSymbols, arrForEach, asString as asString21, createCachedValue, getKnownSymbol, isArray, isBoolean, isError, - isFunction, isNullOrUndefined, isNumber, isObject, isPlainObject, isString, isUndefined, newSymbol, objCreate, objDeepFreeze, objDefine, - objForEachKey, objGetPrototypeOf, objHasOwn, objSetPrototypeOf, safe, strIndexOf, strTrim + isFunction, isNullOrUndefined, isNumber, isObject, isPlainObject, isString, isUndefined, mathFloor, mathRound, newSymbol, objCreate, + objDeepFreeze, objDefine, objForEachKey, objGetPrototypeOf, objHasOwn, objSetPrototypeOf, safe, strIndexOf, strSplit, strTrim } from "@nevware21/ts-utils"; import { STR_EMPTY } from "../constants/InternalConstants"; import { FeatureOptInMode } from "../enums/ai/FeatureOptInEnums"; import { TransportType } from "../enums/ai/SendRequestReason"; import { IConfiguration } from "../interfaces/ai/IConfiguration"; +import { IPlugin } from "../interfaces/ai/ITelemetryPlugin"; import { IXDomainRequest } from "../interfaces/ai/IXDomainRequest"; // RESTRICT and AVOID circular dependencies you should not import other contained modules or export the contents of this file directly @@ -645,3 +646,94 @@ export function _getAllResponseHeaders(xhr: XMLHttpRequest, isOneDs?: boolean) { return theHeaders; } + +/*#__NO_SIDE_EFFECTS__*/ +export function stringToBoolOrDefault(str: any, defaultValue = false): boolean { + if (str === undefined || str === null) { + return defaultValue; + } + + return str.toString().toLowerCase() === "true"; +} + +/** + * Convert ms to c# time span format + */ +/*#__NO_SIDE_EFFECTS__*/ +export function msToTimeSpan(totalms: number | string): string { + if (isTimeSpan(totalms)) { + // Already in time span format + return totalms; + } + + if (isNaN(totalms) || totalms < 0) { + totalms = 0; + } + + totalms = mathRound(totalms); + + let ms = STR_EMPTY + totalms % 1000; + let sec = STR_EMPTY + mathFloor(totalms / 1000) % 60; + let min = STR_EMPTY + mathFloor(totalms / (1000 * 60)) % 60; + let hour = STR_EMPTY + mathFloor(totalms / (1000 * 60 * 60)) % 24; + const days = mathFloor(totalms / (1000 * 60 * 60 * 24)); + + ms = ms.length === 1 ? "00" + ms : ms.length === 2 ? "0" + ms : ms; + sec = sec.length < 2 ? "0" + sec : sec; + min = min.length < 2 ? "0" + min : min; + hour = hour.length < 2 ? "0" + hour : hour; + + return (days > 0 ? days + "." : STR_EMPTY) + hour + ":" + min + ":" + sec + "." + ms; +} + +/*#__NO_SIDE_EFFECTS__*/ +export function getExtensionByName(extensions: IPlugin[], identifier: string): IPlugin | null { + let extension: IPlugin = null; + arrForEach(extensions, (value) => { + if (value.identifier === identifier) { + extension = value; + return -1; + } + }); + + return extension; +} + +/*#__NO_SIDE_EFFECTS__*/ +export function isCrossOriginError(message: string|Event, url: string, lineNumber: number, columnNumber: number, error: Error | Event): boolean { + return !error && isString(message) && (message === "Script error." || message === "Script error"); +} + +/** + * A helper method to determine whether the provided value is in a ISO time span format (DD.HH:MM:SS.MMMMMM) + * @param value - The value to check + * @returns True if the value is in a time span format; false otherwise + */ +/*#__NO_SIDE_EFFECTS__*/ +export function isTimeSpan(value: any): value is string { + let result = false; + + if (isString(value)) { + const parts = strSplit(value, ":"); + if (parts.length === 3) { + // Looks like a candidate, now validate each part + const daysHours = strSplit(parts[0], "."); + if (daysHours.length === 2) { + result = !isNaN(parseInt(daysHours[0] || "0")) && !isNaN(parseInt(daysHours[1] || "0")); + } else { + result = !isNaN(parseInt(daysHours[0] || "0")); + } + + result = result && !isNaN(parseInt(parts[1] || "0")); + + const secondsParts = strSplit(parts[2], "."); + if (secondsParts.length === 2) { + result = result && !isNaN(parseInt(secondsParts[0] || "0")) && !isNaN(parseInt(secondsParts[1] || "0")); + } else { + result = result && !isNaN(parseInt(secondsParts[0] || "0")); + } + } + } + + return result; +} diff --git a/shared/AppInsightsCore/src/utils/HelperFuncsCore.ts b/shared/AppInsightsCore/src/utils/HelperFuncsCore.ts deleted file mode 100644 index ae356c75b..000000000 --- a/shared/AppInsightsCore/src/utils/HelperFuncsCore.ts +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -import { arrForEach, isString, mathFloor, mathRound } from "@nevware21/ts-utils"; -import { STR_EMPTY } from "../constants/InternalConstants"; -import { IPlugin } from "../interfaces/ai/ITelemetryPlugin"; -import { isTimeSpan } from "../internal/timeHelpers"; - -/*#__NO_SIDE_EFFECTS__*/ -export function stringToBoolOrDefault(str: any, defaultValue = false): boolean { - if (str === undefined || str === null) { - return defaultValue; - } - - return str.toString().toLowerCase() === "true"; -} - -/** - * Convert ms to c# time span format - */ -/*#__NO_SIDE_EFFECTS__*/ -export function msToTimeSpan(totalms: number | string): string { - if (isTimeSpan(totalms)) { - // Already in time span format - return totalms; - } - - if (isNaN(totalms) || totalms < 0) { - totalms = 0; - } - - totalms = mathRound(totalms); - - let ms = STR_EMPTY + totalms % 1000; - let sec = STR_EMPTY + mathFloor(totalms / 1000) % 60; - let min = STR_EMPTY + mathFloor(totalms / (1000 * 60)) % 60; - let hour = STR_EMPTY + mathFloor(totalms / (1000 * 60 * 60)) % 24; - const days = mathFloor(totalms / (1000 * 60 * 60 * 24)); - - ms = ms.length === 1 ? "00" + ms : ms.length === 2 ? "0" + ms : ms; - sec = sec.length < 2 ? "0" + sec : sec; - min = min.length < 2 ? "0" + min : min; - hour = hour.length < 2 ? "0" + hour : hour; - - return (days > 0 ? days + "." : STR_EMPTY) + hour + ":" + min + ":" + sec + "." + ms; -} - -/*#__NO_SIDE_EFFECTS__*/ -export function getExtensionByName(extensions: IPlugin[], identifier: string): IPlugin | null { - let extension: IPlugin = null; - arrForEach(extensions, (value) => { - if (value.identifier === identifier) { - extension = value; - return -1; - } - }); - - return extension; -} - -/*#__NO_SIDE_EFFECTS__*/ -export function isCrossOriginError(message: string|Event, url: string, lineNumber: number, columnNumber: number, error: Error | Event): boolean { - return !error && isString(message) && (message === "Script error." || message === "Script error"); -} diff --git a/shared/AppInsightsCore/src/utils/Offline.ts b/shared/AppInsightsCore/src/utils/Offline.ts index c08279793..cdc90ce59 100644 --- a/shared/AppInsightsCore/src/utils/Offline.ts +++ b/shared/AppInsightsCore/src/utils/Offline.ts @@ -1,7 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + import { arrForEach, arrIndexOf, getDocument, getNavigator, getWindow, isNullOrUndefined, isUndefined } from "@nevware21/ts-utils"; import { IUnloadHook } from "../interfaces/ai/IUnloadHook"; import { eventOff, eventOn, mergeEvtNamespace } from "../internal/EventHelpers"; -import { createUniqueNamespace } from "../utils/DataCacheHelper"; +import { createUniqueNamespace } from "./DataCacheHelper"; /** * this is the callback that will be called when the network status changes diff --git a/shared/AppInsightsCore/src/utils/StorageHelperFuncs.ts b/shared/AppInsightsCore/src/utils/StorageHelperFuncs.ts index 6e51aa5b9..45380cba3 100644 --- a/shared/AppInsightsCore/src/utils/StorageHelperFuncs.ts +++ b/shared/AppInsightsCore/src/utils/StorageHelperFuncs.ts @@ -7,7 +7,7 @@ import { _throwInternal } from "../diagnostics/DiagnosticLogger"; import { StorageType } from "../enums/ai/Enums"; import { _eInternalMessageId, eLoggingSeverity } from "../enums/ai/LoggingEnums"; import { IDiagnosticLogger } from "../interfaces/ai/IDiagnosticLogger"; -import { getExceptionName } from "../utils/HelperFuncs"; +import { getExceptionName } from "./HelperFuncs"; let _canUseLocalStorage: boolean = undefined; let _canUseSessionStorage: boolean = undefined; diff --git a/shared/AppInsightsCore/src/utils/TraceParent.ts b/shared/AppInsightsCore/src/utils/TraceParent.ts index 28d6ce6ae..3b0b27ec4 100644 --- a/shared/AppInsightsCore/src/utils/TraceParent.ts +++ b/shared/AppInsightsCore/src/utils/TraceParent.ts @@ -1,3 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + import { arrForEach, isArray, isNullOrUndefined, isString, strIndexOf, strLeft, strTrim } from "@nevware21/ts-utils"; import { STR_EMPTY } from "../constants/InternalConstants"; import { eW3CTraceFlags } from "../enums/W3CTraceFlags"; @@ -52,7 +55,6 @@ function _formatFlags(value: number): string { */ /*#__NO_SIDE_EFFECTS__*/ export function createTraceParent(traceId?: string, spanId?: string, flags?: number, version?: string): ITraceParent { - return { version: _isValid(version, 2, INVALID_VERSION) ? version : DEFAULT_VERSION, traceId: isValidTraceId(traceId) ? traceId : generateW3CId(), @@ -105,7 +107,7 @@ export function parseTraceParent(value: string, selectIdx?: number): ITraceParen traceId: (match[2] || STR_EMPTY).toLowerCase(), spanId: (match[3] || STR_EMPTY).toLowerCase(), traceFlags: parseInt(match[4], 16) - } + }; } /** @@ -225,7 +227,7 @@ export interface scriptsInfo { * @param doc - The document to search for script tags * @returns */ -export function findAllScripts(doc: any) { +export function findAllScripts(doc: any): scriptsInfo[] { let scripts = doc.getElementsByTagName("script"); let result: scriptsInfo[] = []; arrForEach(scripts, (script: any) => { @@ -251,5 +253,6 @@ export function findAllScripts(doc: any) { result.push(info); } }); + return result; } diff --git a/shared/AppInsightsCore/tsc-errors.txt b/shared/AppInsightsCore/tsc-errors.txt deleted file mode 100644 index 73c321f75..000000000 --- a/shared/AppInsightsCore/tsc-errors.txt +++ /dev/null @@ -1,17 +0,0 @@ -src/core/AppInsightsCore.ts(4,26): error TS2307: Cannot find module '@microsoft/dynamicproto-js' or its corresponding type declarations. -src/core/AppInsightsCore.ts(421,46): error TS7006: Parameter '_self' implicitly has an 'any' type. -src/core/BaseTelemetryPlugin.ts(5,26): error TS2307: Cannot find module '@microsoft/dynamicproto-js' or its corresponding type declarations. -src/core/BaseTelemetryPlugin.ts(135,51): error TS7006: Parameter '_self' implicitly has an 'any' type. -src/core/NotificationManager.ts(3,26): error TS2307: Cannot find module '@microsoft/dynamicproto-js' or its corresponding type declarations. -src/core/NotificationManager.ts(78,50): error TS7006: Parameter '_self' implicitly has an 'any' type. -src/core/NotificationManager.ts(203,29): error TS2554: Expected 1 arguments, but got 0. -src/core/PerfManager.ts(3,26): error TS2307: Cannot find module '@microsoft/dynamicproto-js' or its corresponding type declarations. -src/core/PerfManager.ts(148,42): error TS7006: Parameter '_self' implicitly has an 'any' type. -src/core/SenderPostManager.ts(4,26): error TS2307: Cannot find module '@microsoft/dynamicproto-js' or its corresponding type declarations. -src/core/SenderPostManager.ts(58,48): error TS7006: Parameter '_self' implicitly has an 'any' type. -src/core/SenderPostManager.ts(58,55): error TS7006: Parameter '_base' implicitly has an 'any' type. -src/core/TelemetryInitializerPlugin.ts(4,26): error TS2307: Cannot find module '@microsoft/dynamicproto-js' or its corresponding type declarations. -src/core/TelemetryInitializerPlugin.ts(85,57): error TS7006: Parameter '_self' implicitly has an 'any' type. -src/core/TelemetryInitializerPlugin.ts(85,64): error TS7006: Parameter '_base' implicitly has an 'any' type. -src/diagnostics/DiagnosticLogger.ts(4,26): error TS2307: Cannot find module '@microsoft/dynamicproto-js' or its corresponding type declarations. -src/diagnostics/DiagnosticLogger.ts(128,47): error TS7006: Parameter '_self' implicitly has an 'any' type. diff --git a/tools/applicationinsights-web-snippet/package.json b/tools/applicationinsights-web-snippet/package.json index 019eebfc7..d418856ed 100644 --- a/tools/applicationinsights-web-snippet/package.json +++ b/tools/applicationinsights-web-snippet/package.json @@ -52,7 +52,7 @@ "grunt": "^1.5.3", "typedoc": "^0.26.6", "grunt-cli": "^1.4.3", - "@nevware21/grunt-ts-plugin": "^0.4.3", - "@nevware21/grunt-eslint-ts": "^0.2.2" + "@nevware21/grunt-ts-plugin": "^0.5.1", + "@nevware21/grunt-eslint-ts": "^0.5.1" } } diff --git a/tools/chrome-debug-extension/package.json b/tools/chrome-debug-extension/package.json index 27478b609..38cfa95e7 100644 --- a/tools/chrome-debug-extension/package.json +++ b/tools/chrome-debug-extension/package.json @@ -72,8 +72,8 @@ "rollup-plugin-peer-deps-external": "^2.2.4", "rollup": "^3.20.0", "rollup-plugin-sourcemaps": "^0.6.3", - "@nevware21/grunt-ts-plugin": "^0.4.3", - "@nevware21/grunt-eslint-ts": "^0.2.2", + "@nevware21/grunt-ts-plugin": "^0.5.1", + "@nevware21/grunt-eslint-ts": "^0.5.1", "typescript": "^4.9.3", "archiver": "^5.3.0" } diff --git a/tools/rollup-es5/package.json b/tools/rollup-es5/package.json index 73e834bcc..bf6c83bde 100644 --- a/tools/rollup-es5/package.json +++ b/tools/rollup-es5/package.json @@ -39,8 +39,8 @@ "@microsoft/applicationinsights-rollup-plugin-uglify3-js": "1.0.0", "grunt": "^1.5.3", "grunt-cli": "^1.4.3", - "@nevware21/grunt-ts-plugin": "^0.4.3", - "@nevware21/grunt-eslint-ts": "^0.2.2", + "@nevware21/grunt-ts-plugin": "^0.5.1", + "@nevware21/grunt-eslint-ts": "^0.5.1", "@rollup/plugin-commonjs": "^24.0.0", "@rollup/plugin-node-resolve": "^15.0.1", "@rollup/plugin-replace": "^5.0.2", diff --git a/tools/rollup-plugin-uglify3-js/package.json b/tools/rollup-plugin-uglify3-js/package.json index a2467cce3..703b9520c 100644 --- a/tools/rollup-plugin-uglify3-js/package.json +++ b/tools/rollup-plugin-uglify3-js/package.json @@ -27,8 +27,8 @@ "devDependencies": { "grunt": "^1.5.3", "grunt-cli": "^1.4.3", - "@nevware21/grunt-ts-plugin": "^0.4.3", - "@nevware21/grunt-eslint-ts": "^0.2.2", + "@nevware21/grunt-ts-plugin": "^0.5.1", + "@nevware21/grunt-eslint-ts": "^0.5.1", "@rollup/plugin-commonjs": "^24.0.0", "@rollup/plugin-node-resolve": "^15.0.1", "@rollup/plugin-replace": "^5.0.2", diff --git a/tools/shims/package.json b/tools/shims/package.json index c03fb37e0..deb0c3a72 100644 --- a/tools/shims/package.json +++ b/tools/shims/package.json @@ -42,8 +42,8 @@ "@microsoft/applicationinsights-rollup-es5": "1.0.2", "grunt": "^1.5.3", "grunt-cli": "^1.4.3", - "@nevware21/grunt-ts-plugin": "^0.4.3", - "@nevware21/grunt-eslint-ts": "^0.2.2", + "@nevware21/grunt-ts-plugin": "^0.5.1", + "@nevware21/grunt-eslint-ts": "^0.5.1", "@rollup/plugin-commonjs": "^24.0.0", "@rollup/plugin-node-resolve": "^15.0.1", "@rollup/plugin-replace": "^5.0.2",