New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@logto/app-insights

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@logto/app-insights - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

2

lib/node.d.ts

@@ -5,3 +5,3 @@ import type { TelemetryClient } from 'applicationinsights';

client?: TelemetryClient;
setup(cloudRole: string): boolean;
setup(cloudRole: string): Promise<boolean>;
trackException(error: unknown): void;

@@ -8,0 +8,0 @@ }

import { trySafe } from '@silverhand/essentials';
import applicationinsights from 'applicationinsights';
export const normalizeError = (error) => {

@@ -12,6 +11,10 @@ const normalized = error instanceof Error ? error : new Error(String(error));

class AppInsights {
setup(cloudRole) {
async setup(cloudRole) {
if (this.client) {
return true;
}
if (!process.env.APPLICATIONINSIGHTS_CONNECTION_STRING) {
return false;
}
const { default: applicationinsights } = await import('applicationinsights');
const ok = trySafe(() => applicationinsights.setup());

@@ -18,0 +21,0 @@ if (!ok) {

@@ -1,3 +0,3 @@

import { ReactPlugin } from '@microsoft/applicationinsights-react-js';
import { ApplicationInsights } from '@microsoft/applicationinsights-web';
import type { ReactPlugin, withAITracking } from '@microsoft/applicationinsights-react-js';
import type { ApplicationInsights } from '@microsoft/applicationinsights-web';
import { type Optional } from '@silverhand/essentials';

@@ -7,6 +7,7 @@ import { type ComponentType } from 'react';

protected reactPlugin?: ReactPlugin;
protected withAITracking?: typeof withAITracking;
protected appInsights?: ApplicationInsights;
get instance(): Optional<ApplicationInsights>;
get trackPageView(): Optional<ApplicationInsights['trackPageView']>;
setup(): boolean;
setup(): Promise<boolean>;
withAppInsights<P>(Component: ComponentType<P>): ComponentType<P>;

@@ -13,0 +14,0 @@ }

@@ -1,3 +0,1 @@

import { ReactPlugin, withAITracking } from '@microsoft/applicationinsights-react-js';
import { ApplicationInsights } from '@microsoft/applicationinsights-web';
class AppInsightsReact {

@@ -10,3 +8,3 @@ get instance() {

}
setup() {
async setup() {
// The string needs to be normalized since it may contain '"'

@@ -21,3 +19,6 @@ const connectionString = process.env.APPLICATIONINSIGHTS_CONNECTION_STRING?.replace(/^"?(.*)"?$/g, '$1');

try {
const { ReactPlugin, withAITracking } = await import('@microsoft/applicationinsights-react-js');
const { ApplicationInsights } = await import('@microsoft/applicationinsights-web');
// https://github.com/microsoft/applicationinsights-react-js#readme
this.withAITracking = withAITracking;
this.reactPlugin = new ReactPlugin();

@@ -41,8 +42,8 @@ this.appInsights = new ApplicationInsights({

withAppInsights(Component) {
if (!this.reactPlugin) {
if (!this.reactPlugin || !this.withAITracking) {
return Component;
}
return withAITracking(this.reactPlugin, Component, undefined, 'appInsightsWrapper');
return this.withAITracking(this.reactPlugin, Component, undefined, 'appInsightsWrapper');
}
}
export const appInsightsReact = new AppInsightsReact();
{
"name": "@logto/app-insights",
"version": "1.0.0",
"version": "1.0.1",
"main": "lib/index.js",

@@ -12,9 +12,11 @@ "author": "Silverhand Inc. <contact@silverhand.io>",

"exports": {
".": {
"import": "./lib/index.js"
},
"./*": {
"import": "./lib/*"
"import": "./lib/*.js",
"types": "./lib/*.d.ts"
}
},
"//": "This field is for parcel. Remove after https://github.com/parcel-bundler/parcel/pull/8807 published.",
"alias": {
"./react": "./lib/react.js"
},
"publishConfig": {

@@ -24,3 +26,3 @@ "access": "public"

"devDependencies": {
"@silverhand/eslint-config": "3.0.0",
"@silverhand/eslint-config": "3.0.1",
"@silverhand/ts-config": "3.0.0",

@@ -27,0 +29,0 @@ "@types/node": "^18.11.18",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc