Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: bump to core 3 #42

Merged
merged 5 commits into from
May 6, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions messages/telemetry.js

This file was deleted.

32 changes: 17 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,33 +33,35 @@
"!lib/**/*.map"
],
"dependencies": {
"@salesforce/core": "^2.31.0",
"@salesforce/ts-types": "^1.2.1",
"@salesforce/core": "^3.15.5",
"@salesforce/ts-types": "^1.5.20",
"applicationinsights": "^1.4.0",
"axios": "^0.27.2"
},
"devDependencies": {
"@salesforce/dev-config": "^2.0.0",
"@salesforce/dev-scripts": "^0.9.18",
"@salesforce/dev-config": "^3.0.1",
"@salesforce/dev-scripts": "^2.0.2",
cristiand391 marked this conversation as resolved.
Show resolved Hide resolved
"@salesforce/prettier-config": "^0.0.2",
"@salesforce/ts-sinon": "^1.1.0",
"@typescript-eslint/eslint-plugin": "^2.30.0",
"@typescript-eslint/parser": "^2.30.0",
"@typescript-eslint/eslint-plugin": "^4.2.0",
"@typescript-eslint/parser": "^4.2.0",
"chai": "^4.2.0",
"eslint": "^6.8.0",
"eslint": "^7.27.0",
"eslint-config-prettier": "^6.11.0",
"eslint-config-salesforce": "^0.1.0",
"eslint-config-salesforce-license": "^0.1.0",
"eslint-config-salesforce-typescript": "^0.1.0",
"eslint-config-salesforce": "^0.1.6",
"eslint-config-salesforce-license": "^0.1.6",
"eslint-config-salesforce-typescript": "^0.2.7",
"eslint-plugin-header": "^3.0.0",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-jsdoc": "^27.0.3",
"eslint-plugin-import": "2.24.2",
"eslint-plugin-jsdoc": "^35.1.2",
"eslint-plugin-prettier": "^3.1.3",
"mocha": "^7.2.0",
"husky": "^7.0.4",
"mocha": "^9.1.3",
"nyc": "^15.1.0",
"prettier": "^2.0.5",
"sinon": "^9.0.2",
"ts-node": "^8.10.2",
"pretty-quick": "^3.1.0",
"sinon": "10.0.0",
"ts-node": "^10.0.0",
"typescript": "^4.1.3"
},
"types": "lib/exported.d.ts",
Expand Down
8 changes: 3 additions & 5 deletions src/appInsights.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/
import * as os from 'os';
import { Logger, Messages } from '@salesforce/core';
import { Logger } from '@salesforce/core';
import { AsyncCreatable, Env } from '@salesforce/kit';
import { isBoolean, isNumber, isString, JsonPrimitive } from '@salesforce/ts-types';
import * as appInsights from 'applicationinsights';
Expand Down Expand Up @@ -36,8 +36,6 @@ export interface TelemetryOptions {
waitForConnection?: boolean;
}

Messages.importMessagesDirectory(__dirname);
cristiand391 marked this conversation as resolved.
Show resolved Hide resolved

export function getPlatformVersion(): string {
return (os.release() || '').replace(/^(\d+)(\.\d+)?(\.\d+)?(.*)/, '$1$2$3');
}
Expand Down Expand Up @@ -158,7 +156,7 @@ export class AppInsights extends AsyncCreatable<TelemetryOptions> {
/**
* Publishes diagnostic information to app insights dashboard
*
* @param message {string} - trace message to sen to app insights.
* @param traceMessage {string} - trace message to sen to app insights.
* @param properties {Properties} - map of properties to publish alongside the event.
*/
public sendTelemetryTrace(traceMessage: string, properties?: Properties): void {
Expand All @@ -169,7 +167,7 @@ export class AppInsights extends AsyncCreatable<TelemetryOptions> {
/**
* Publishes metric to app insights dashboard
*
* @param name {string} - name of the metric you want published
* @param metricName {string} - name of the metric you want published
* @param value {number} - value of the metric
* @param properties {Properties} - map of properties to publish alongside the event.
*/
Expand Down
13 changes: 6 additions & 7 deletions src/telemetryReporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ export class TelemetryReporter extends AsyncCreatable<TelemetryOptions> {
}
const configValue = TelemetryReporter.config.getPropertyValue(DISABLE_TELEMETRY);
const sfdxDisableInsights = configValue === 'true' || env.getBoolean('SFDX_DISABLE_INSIGHTS');
const isEnabled = !sfdxDisableInsights;
return isEnabled;
return !sfdxDisableInsights;
}

public async init(): Promise<void> {
Expand Down Expand Up @@ -128,7 +127,7 @@ export class TelemetryReporter extends AsyncCreatable<TelemetryOptions> {
* Sends exception to child process.
*
* @param exception {Error} - exception you want published.
* @param measurements {Measurements} - map of measurements to publish alongside the event.
* @param attributes {Attributes} - map of measurements to publish alongside the event.
*/
public sendTelemetryException(exception: Error, attributes: Attributes = {}): void {
if (this.isSfdxTelemetryEnabled()) {
Expand All @@ -142,7 +141,7 @@ export class TelemetryReporter extends AsyncCreatable<TelemetryOptions> {
/**
* Publishes diagnostic information to app insights dashboard
*
* @param message {string} - trace message to sen to app insights.
* @param traceMessage {string} - trace message to sen to app insights.
* @param properties {Properties} - map of properties to publish alongside the event.
*/
public sendTelemetryTrace(traceMessage: string, properties?: Properties): void {
Expand All @@ -154,7 +153,7 @@ export class TelemetryReporter extends AsyncCreatable<TelemetryOptions> {
/**
* Publishes metric to app insights dashboard
*
* @param name {string} - name of the metric you want published
* @param metricName {string} - name of the metric you want published
* @param value {number} - value of the metric
* @param properties {Properties} - map of properties to publish alongside the event.
*/
Expand All @@ -171,8 +170,8 @@ export class TelemetryReporter extends AsyncCreatable<TelemetryOptions> {
public isSfdxTelemetryEnabled(): boolean {
const configValue = this.config.getPropertyValue(DISABLE_TELEMETRY);
const sfdxDisableInsights = configValue === 'true' || env.getBoolean('SFDX_DISABLE_INSIGHTS');
const isEnabled = !sfdxDisableInsights;
return isEnabled;
// isEnabled = !sfdxDisableInsights
return !sfdxDisableInsights;
}

public logTelemetryStatus(): void {
Expand Down
Loading