@jupiterone/integration-sdk-core
Advanced tools
Comparing version 5.3.0 to 5.4.0
@@ -99,2 +99,13 @@ import { Entity, RawDataTracking } from '../types'; | ||
export declare function createIntegrationEntity(input: IntegrationEntityBuilderInput): GeneratedEntity; | ||
/** | ||
* The whitelisted property names for unique combinations of `_class: Array` | ||
* values seen so far in the program. | ||
*/ | ||
export declare const schemaWhitelists: Map<string, string[]>; | ||
/** | ||
* Answers all the property names defined by the schemas referenced in the set | ||
* of classes. Values are cached to avoid rebuilding, since there could be | ||
* thousands of entities constructed during a single execution. | ||
*/ | ||
export declare function schemaWhitelistedPropertyNames(_class: string[]): string[]; | ||
export {}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createIntegrationEntity = void 0; | ||
exports.schemaWhitelistedPropertyNames = exports.schemaWhitelists = exports.createIntegrationEntity = void 0; | ||
const data_model_1 = require("@jupiterone/data-model"); | ||
@@ -44,6 +44,7 @@ const errors_1 = require("../errors"); | ||
entity.createdOn = | ||
(source.createdAt && converters_1.getTime(source.createdAt)) || | ||
(source.creationDate && converters_1.getTime(source.creationDate)) || | ||
(source.creationTime && converters_1.getTime(source.creationTime)) || | ||
(source.creationTimestamp && converters_1.getTime(source.creationTimestamp)); | ||
(source.createdAt && converters_1.parseTimePropertyValue(source.createdAt)) || | ||
(source.creationDate && converters_1.parseTimePropertyValue(source.creationDate)) || | ||
(source.creationTime && converters_1.parseTimePropertyValue(source.creationTime)) || | ||
(source.creationTimestamp && | ||
converters_1.parseTimePropertyValue(source.creationTimestamp)); | ||
} | ||
@@ -96,2 +97,9 @@ if (entity.active === undefined && source.status) { | ||
} | ||
/** | ||
* Answers a form of the provider data with only the properties supported by the | ||
* data model schema. | ||
* | ||
* @param source resource data from the resource provider/external system | ||
* @param _class entity `_class: string[]` value | ||
*/ | ||
function whitelistedProviderData(source, _class) { | ||
@@ -110,4 +118,8 @@ const whitelistedProviderData = {}; | ||
} | ||
const schemaWhitelists = new Map(); | ||
/** | ||
* The whitelisted property names for unique combinations of `_class: Array` | ||
* values seen so far in the program. | ||
*/ | ||
exports.schemaWhitelists = new Map(); | ||
/** | ||
* Answers all the property names defined by the schemas referenced in the set | ||
@@ -118,3 +130,4 @@ * of classes. Values are cached to avoid rebuilding, since there could be | ||
function schemaWhitelistedPropertyNames(_class) { | ||
let properties = schemaWhitelists.get(_class); | ||
const whitelistKey = _class.join(','); | ||
let properties = exports.schemaWhitelists.get(whitelistKey); | ||
if (!properties) { | ||
@@ -130,8 +143,11 @@ properties = []; | ||
} | ||
properties.push(...schemaPropertyNames(schema)); | ||
for (const name of schemaPropertyNames(schema)) { | ||
properties.push(name); | ||
} | ||
} | ||
schemaWhitelists.set(_class, properties); | ||
exports.schemaWhitelists.set(whitelistKey, properties); | ||
} | ||
return properties; | ||
} | ||
exports.schemaWhitelistedPropertyNames = schemaWhitelistedPropertyNames; | ||
function schemaPropertyNames(schema) { | ||
@@ -138,0 +154,0 @@ const names = []; |
@@ -64,7 +64,19 @@ import { Entity, Relationship } from '../types'; | ||
* Finds an entity by `_key` and returns `null` if the entity does not exist. | ||
* This function will also throw an error if multiple entities are found with | ||
* the same `_key` value. | ||
* | ||
* @see hasKey when the entity is not needed to avoid unnecessary costs | ||
* associated with loading the entity. | ||
* | ||
* @throws IntegrationDuplicateKeyError when multiple entities are found with | ||
* the same `_key` value. Note however, there are mechanisms in place to | ||
* prevent storing duplicates. | ||
*/ | ||
findEntity: (_key: string) => Promise<Entity | null>; | ||
/** | ||
* Answers `true` when an entity OR relationship having `_key` has been added. | ||
* | ||
* @see findEntity when the entity, if present, is needed (there is no need to | ||
* use `hasKey` before `findEntity`). | ||
*/ | ||
hasKey: (_key: string) => boolean | Promise<boolean>; | ||
/** | ||
* Allows a step to iterate all entities collected into the job state, limited | ||
@@ -71,0 +83,0 @@ * to those that match the provided `filter`. |
{ | ||
"name": "@jupiterone/integration-sdk-core", | ||
"version": "5.3.0", | ||
"version": "5.4.0", | ||
"description": "The SDK for developing JupiterOne integrations", | ||
@@ -33,3 +33,3 @@ "main": "dist/src/index.js", | ||
}, | ||
"gitHead": "8061b53472a147e4ca0550483a7ba20bddc5821e" | ||
"gitHead": "57ef7066e548256959c173bc8a6cb41834579e55" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
367130
2371