Socket
Socket
Sign inDemoInstall

@jupiterone/integration-sdk-core

Package Overview
Dependencies
Maintainers
1
Versions
268
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

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

Comparing version 12.7.0-alpha.0 to 12.7.0

20

dist/src/data/createIntegrationEntity.js

@@ -5,2 +5,3 @@ "use strict";

const data_model_1 = require("@jupiterone/data-model");
const integration_sdk_entity_validator_1 = require("@jupiterone/integration-sdk-entity-validator");
const errors_1 = require("../errors");

@@ -11,2 +12,19 @@ const converters_1 = require("./converters");

const SUPPORTED_TYPES = ['string', 'number', 'boolean'];
const VALIDATOR = new integration_sdk_entity_validator_1.EntityValidator({
schemas: Object.values(data_model_1.entitySchemas),
});
const validateEntityWithSchema = (entity) => {
const { isValid, errors, skippedSchemas } = VALIDATOR.validateEntity(entity);
const classNotFound = skippedSchemas?.find((skippedSchema) => skippedSchema.reason === 'not-found' && skippedSchema.type === 'class');
if (classNotFound) {
throw new Error(`Could not find schema for class ${classNotFound.schemaId.replace('#', '')}!`);
}
const validationType = skippedSchemas?.find((skippedSchema) => skippedSchema.type === 'class' &&
skippedSchema.reason === 'type-already-validated')
? 'type'
: 'class';
if (!isValid) {
throw new Error(`Entity fails to validate as ${validationType} '${validationType === 'type' ? entity._type : entity._class}':\n\n${JSON.stringify(errors, null, 2)}`);
}
};
/**

@@ -19,3 +37,3 @@ * Generates an `Entity` using the provided `entityData`.

if (process.env.ENABLE_GRAPH_OBJECT_SCHEMA_VALIDATION) {
(0, data_model_1.validateEntityWithSchema)(generatedEntity);
validateEntityWithSchema(generatedEntity);
}

@@ -22,0 +40,0 @@ return generatedEntity;

7

package.json
{
"name": "@jupiterone/integration-sdk-core",
"version": "12.7.0-alpha.0",
"version": "12.7.0",
"description": "The SDK for developing JupiterOne integrations",

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

"dependencies": {
"@jupiterone/data-model": "^0.55.0",
"@jupiterone/data-model": "^0.57.0",
"@jupiterone/integration-sdk-entity-validator": "^12.7.0",
"lodash": "^4.17.21"

@@ -33,3 +34,3 @@ },

},
"gitHead": "06d649df85d7212776b998226023517306826141"
"gitHead": "8e59967c9a6a16192605492caa8c6ed760e574a8"
}

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