Socket
Socket
Sign inDemoInstall

@jupiterone/integration-sdk-runtime

Package Overview
Dependencies
Maintainers
2
Versions
268
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jupiterone/integration-sdk-runtime - npm Package Compare versions

Comparing version 3.2.0 to 3.2.1

25

dist/src/logger/index.d.ts
/// <reference types="node" />
import Logger from 'bunyan';
import { EventEmitter } from 'events';
import { ExecutionContext, IntegrationError, IntegrationEvent, IntegrationExecutionContext, IntegrationInvocationConfig, IntegrationLogger as IntegrationLoggerType, IntegrationProviderAuthenticationError, IntegrationProviderAuthorizationError, IntegrationStepExecutionContext, IntegrationValidationError, InvocationConfig, Metric, StepExecutionContext, StepMetadata, SynchronizationJob } from '@jupiterone/integration-sdk-core';
import { ExecutionContext, IntegrationError, IntegrationEvent, IntegrationExecutionContext, IntegrationInvocationConfig, IntegrationLogger as IntegrationLoggerType, IntegrationStepExecutionContext, InvocationConfig, Metric, StepExecutionContext, StepMetadata, SynchronizationJob } from '@jupiterone/integration-sdk-core';
export declare const PROVIDER_AUTH_ERROR_HELP: string;
interface CreateLoggerInput<TExecutionContext extends ExecutionContext, TStepExecutionContext extends StepExecutionContext> {

@@ -32,2 +33,20 @@ name: string;

constructor(input: IntegrationLoggerInput);
/**
* Answers `true` when the err has been reported to the logger instance
* through these functions:
*
* * warn(err, ...)
* * error(err, ...)
*
* This can be used by outer `try/catch` blocks to avoid logging the same
* error twice:
*
* ```js
* if (!logger.isHandledError(err)) {
* logger.error(err);
* }
* ```
*
* @param err a caught Error
*/
isHandledError(err: Error): boolean;

@@ -62,6 +81,2 @@ debug(...params: any[]): any;

};
declare type UserConfigError = IntegrationValidationError | IntegrationProviderAuthenticationError;
export declare function isUserConfigError(err: Error): err is UserConfigError;
declare type ProviderAuthError = IntegrationProviderAuthorizationError | IntegrationProviderAuthenticationError;
export declare function isProviderAuthError(err: Error): err is ProviderAuthError;
export {};

43

dist/src/logger/index.js

@@ -6,3 +6,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.isProviderAuthError = exports.isUserConfigError = exports.createErrorEventDescription = exports.IntegrationLogger = exports.createIntegrationLogger = exports.createLogger = void 0;
exports.createErrorEventDescription = exports.IntegrationLogger = exports.createIntegrationLogger = exports.createLogger = exports.PROVIDER_AUTH_ERROR_HELP = void 0;
const bunyan_1 = __importDefault(require("bunyan"));

@@ -12,2 +12,5 @@ const events_1 = require("events");

const integration_sdk_core_1 = require("@jupiterone/integration-sdk-core");
exports.PROVIDER_AUTH_ERROR_HELP = ' Failed to access provider resource.' +
' This integration is likely misconfigured or has insufficient permissions required to access the resource.' +
" Please ensure your integration's configuration settings are set up correctly.";
// eslint-disable-next-line

@@ -88,2 +91,20 @@ const bunyanFormat = require('bunyan-format');

}
/**
* Answers `true` when the err has been reported to the logger instance
* through these functions:
*
* * warn(err, ...)
* * error(err, ...)
*
* This can be used by outer `try/catch` blocks to avoid logging the same
* error twice:
*
* ```js
* if (!logger.isHandledError(err)) {
* logger.error(err);
* }
* ```
*
* @param err a caught Error
*/
isHandledError(err) {

@@ -175,7 +196,7 @@ return this._errorSet.has(err);

const { errorId, description } = createErrorEventDescription(err, `Error occurred while validating integration configuration.`);
if (isUserConfigError(err)) {
this.warn({ errorId, err }, description);
if (integration_sdk_core_1.shouldReportErrorToOperator(err)) {
this.error({ errorId, err }, description);
}
else {
this.error({ errorId, err }, description);
this.warn({ errorId, err }, description);
}

@@ -235,6 +256,6 @@ this.publishEvent({ name, description });

}
if (isProviderAuthError(err)) {
if (integration_sdk_core_1.isProviderAuthError(err)) {
// add additional instructions to the displayed message
// if we know that this is an auth error
message += integration_sdk_core_1.PROVIDER_AUTH_ERROR_DESCRIPTION;
message += exports.PROVIDER_AUTH_ERROR_HELP;
}

@@ -262,12 +283,2 @@ const nameValuePairs = [

exports.createErrorEventDescription = createErrorEventDescription;
function isUserConfigError(err) {
return (err instanceof integration_sdk_core_1.IntegrationValidationError ||
err instanceof integration_sdk_core_1.IntegrationProviderAuthenticationError);
}
exports.isUserConfigError = isUserConfigError;
function isProviderAuthError(err) {
return (err instanceof integration_sdk_core_1.IntegrationProviderAuthorizationError ||
err instanceof integration_sdk_core_1.IntegrationProviderAuthenticationError);
}
exports.isProviderAuthError = isProviderAuthError;
//# sourceMappingURL=index.js.map
{
"name": "@jupiterone/integration-sdk-runtime",
"version": "3.2.0",
"version": "3.2.1",
"description": "The SDK for developing JupiterOne integrations",

@@ -26,3 +26,3 @@ "main": "dist/src/index.js",

"dependencies": {
"@jupiterone/integration-sdk-core": "^3.2.0",
"@jupiterone/integration-sdk-core": "^3.2.1",
"@lifeomic/alpha": "^1.1.3",

@@ -46,3 +46,3 @@ "async-sema": "^3.1.0",

"devDependencies": {
"@jupiterone/integration-sdk-private-test-utils": "^3.2.0",
"@jupiterone/integration-sdk-private-test-utils": "^3.2.1",
"@types/uuid": "^7.0.2",

@@ -53,3 +53,3 @@ "get-port": "^5.1.1",

},
"gitHead": "6da9ded98f0a9baf4491b72db1aa3dcd07542473"
"gitHead": "880cc901d70a1afa14ccadd52cd371a55ce9810d"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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