@jupiterone/integration-sdk-core
Advanced tools
Comparing version 2.5.0 to 2.6.0
@@ -1,2 +0,2 @@ | ||
import { Entity, Relationship, RelationshipDirection, RelationshipMapping, TargetEntityProperties, TargetFilterKey } from '../types'; | ||
import { Entity, ExplicitRelationship, MappedRelationship, Relationship, RelationshipDirection, RelationshipMapping, TargetEntityProperties, TargetFilterKey } from '../types'; | ||
declare type DirectRelationshipOptions = { | ||
@@ -105,10 +105,20 @@ _class: string; | ||
/** | ||
* Create an `IntegrationRelationship`. | ||
* | ||
* `DirectRelationshipOptions` and `MappedRelationshipOptions` are recommended | ||
* over literal forms. Older integrations may need to use the literal forms to | ||
* control values for some reason or other. | ||
* @deprecated | ||
* @see createDirectRelationship | ||
* @see createMappedRelationship | ||
*/ | ||
export declare function createIntegrationRelationship(options: DirectRelationshipOptions | DirectRelationshipLiteralOptions | MappedRelationshipOptions | MappedRelationshipLiteralOptions): Relationship; | ||
/** | ||
* Create a direct `IntegrationRelationship` between two entities | ||
* | ||
* `DirectRelationshipOptions` is recommended over `DirectRelationshipOptionsLiteral`. Older integrations may need to use the literal forms to control values for some reason or other. | ||
*/ | ||
export declare function createDirectRelationship(options: DirectRelationshipOptions | DirectRelationshipLiteralOptions): ExplicitRelationship; | ||
/** | ||
* Create a mapped `IntegrationRelationship`. | ||
* | ||
* `MappedRelationshipOptions` is recommended over `MappedRelationshipOptionsLiteral`. Older integrations may need to use the literal forms to control values for some reason or other. | ||
*/ | ||
export declare function createMappedRelationship(options: MappedRelationshipOptions | MappedRelationshipLiteralOptions): MappedRelationship; | ||
/** | ||
* Relationship `_type` can be generated from the `_type`s of related entities. | ||
@@ -115,0 +125,0 @@ * The relationship `_class` is required to ensure that the relationship `_type` |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.generateRelationshipKey = exports.generateRelationshipType = exports.createIntegrationRelationship = void 0; | ||
exports.generateRelationshipKey = exports.generateRelationshipType = exports.createMappedRelationship = exports.createDirectRelationship = exports.createIntegrationRelationship = void 0; | ||
const errors_1 = require("../errors"); | ||
const types_1 = require("../types"); | ||
/** | ||
* Create an `IntegrationRelationship`. | ||
* | ||
* `DirectRelationshipOptions` and `MappedRelationshipOptions` are recommended | ||
* over literal forms. Older integrations may need to use the literal forms to | ||
* control values for some reason or other. | ||
* @deprecated | ||
* @see createDirectRelationship | ||
* @see createMappedRelationship | ||
*/ | ||
function createIntegrationRelationship(options) { | ||
if ('_mapping' in options) { | ||
if ('_mapping' in options || 'target' in options) { | ||
return createMappedRelationship(options); | ||
} | ||
else if ('target' in options) { | ||
return createMappedRelationship({ | ||
_class: options._class, | ||
_type: options._type, | ||
_key: options._key, | ||
_mapping: { | ||
relationshipDirection: options.relationshipDirection || types_1.RelationshipDirection.FORWARD, | ||
sourceEntityKey: options.source._key, | ||
targetEntity: options.target, | ||
targetFilterKeys: options.targetFilterKeys || [['_type', '_key']], | ||
skipTargetCreation: options.skipTargetCreation, | ||
}, | ||
properties: options.properties, | ||
}); | ||
else { | ||
return createDirectRelationship(options); | ||
} | ||
else if ('fromType' in options) { | ||
} | ||
exports.createIntegrationRelationship = createIntegrationRelationship; | ||
/** | ||
* Create a direct `IntegrationRelationship` between two entities | ||
* | ||
* `DirectRelationshipOptions` is recommended over `DirectRelationshipOptionsLiteral`. Older integrations may need to use the literal forms to control values for some reason or other. | ||
*/ | ||
function createDirectRelationship(options) { | ||
if ('fromType' in options) { | ||
return createRelationship(options); | ||
@@ -46,4 +40,31 @@ } | ||
} | ||
exports.createIntegrationRelationship = createIntegrationRelationship; | ||
exports.createDirectRelationship = createDirectRelationship; | ||
/** | ||
* Create a mapped `IntegrationRelationship`. | ||
* | ||
* `MappedRelationshipOptions` is recommended over `MappedRelationshipOptionsLiteral`. Older integrations may need to use the literal forms to control values for some reason or other. | ||
*/ | ||
function createMappedRelationship(options) { | ||
if ('_mapping' in options) { | ||
return createMappedRelationshipLiteral(options); | ||
} | ||
else { | ||
return createMappedRelationshipLiteral({ | ||
_class: options._class, | ||
_type: options._type, | ||
_key: options._key, | ||
_mapping: { | ||
relationshipDirection: options.relationshipDirection || types_1.RelationshipDirection.FORWARD, | ||
sourceEntityKey: options.source._key, | ||
sourceEntityType: options.source._type, | ||
targetEntity: options.target, | ||
targetFilterKeys: options.targetFilterKeys || [['_type', '_key']], | ||
skipTargetCreation: options.skipTargetCreation, | ||
}, | ||
properties: options.properties, | ||
}); | ||
} | ||
} | ||
exports.createMappedRelationship = createMappedRelationship; | ||
function createMappedRelationshipLiteral(options) { | ||
const mapping = options._mapping; | ||
@@ -56,3 +77,3 @@ if (mapping.skipTargetCreation === undefined) { | ||
const _type = options._type || | ||
type(options.properties, options._class, 'mapping_source', mapping.targetEntity._type); | ||
type(options.properties, options._class, mapping.sourceEntityType || 'mapping_source', mapping.targetEntity._type); | ||
const relationshipClass = options._class.toUpperCase(); | ||
@@ -59,0 +80,0 @@ const mappedRelationship = { |
@@ -98,2 +98,5 @@ export declare const UNEXPECTED_ERROR_CODE = "UNEXPECTED_ERROR"; | ||
} | ||
export declare class IntegrationMissingKeyError extends IntegrationError { | ||
constructor(message: string); | ||
} | ||
/** | ||
@@ -100,0 +103,0 @@ * An error that may be thrown by an integration during `validateInvocation`, |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.IntegrationProviderAPIError = exports.IntegrationProviderAuthorizationError = exports.IntegrationProviderAuthenticationError = exports.IntegrationValidationError = exports.IntegrationDuplicateKeyError = exports.UnaccountedStepStartStatesError = exports.StepStartStateUnknownStepIdsError = exports.IntegrationConfigLoadError = exports.IntegrationLocalConfigFieldTypeMismatchError = exports.IntegrationLocalConfigFieldMissingError = exports.IntegrationError = exports.PROVIDER_AUTH_ERROR_DESCRIPTION = exports.UNEXPECTED_ERROR_REASON = exports.UNEXPECTED_ERROR_CODE = void 0; | ||
exports.IntegrationProviderAPIError = exports.IntegrationProviderAuthorizationError = exports.IntegrationProviderAuthenticationError = exports.IntegrationValidationError = exports.IntegrationMissingKeyError = exports.IntegrationDuplicateKeyError = exports.UnaccountedStepStartStatesError = exports.StepStartStateUnknownStepIdsError = exports.IntegrationConfigLoadError = exports.IntegrationLocalConfigFieldTypeMismatchError = exports.IntegrationLocalConfigFieldMissingError = exports.IntegrationError = exports.PROVIDER_AUTH_ERROR_DESCRIPTION = exports.UNEXPECTED_ERROR_REASON = exports.UNEXPECTED_ERROR_CODE = void 0; | ||
exports.UNEXPECTED_ERROR_CODE = 'UNEXPECTED_ERROR'; | ||
@@ -116,2 +116,11 @@ exports.UNEXPECTED_ERROR_REASON = 'Unexpected error occurred executing integration! Please contact us in Slack or at https://support.jupiterone.io if the problem continues to occur.'; | ||
exports.IntegrationDuplicateKeyError = IntegrationDuplicateKeyError; | ||
class IntegrationMissingKeyError extends IntegrationError { | ||
constructor(message) { | ||
super({ | ||
code: 'MISSING_KEY_ERROR', | ||
message, | ||
}); | ||
} | ||
} | ||
exports.IntegrationMissingKeyError = IntegrationMissingKeyError; | ||
/** | ||
@@ -118,0 +127,0 @@ * An error that may be thrown by an integration during `validateInvocation`, |
@@ -5,2 +5,6 @@ import { Entity, Relationship } from '../types'; | ||
} | ||
export interface GraphObjectLookupKey { | ||
_type: string; | ||
_key: string; | ||
} | ||
export declare type GraphObjectIteratee<T> = (obj: T) => void | Promise<void>; | ||
@@ -60,2 +64,7 @@ /** | ||
/** | ||
* Gets an entity by _key and _type | ||
* Throws when !== 1 entity | ||
*/ | ||
getEntity: (lookupKey: GraphObjectLookupKey) => Promise<Entity>; | ||
/** | ||
* Allows a step to iterate all entities collected into the job state, limited | ||
@@ -62,0 +71,0 @@ * to those that match the provided `filter`. |
@@ -65,2 +65,6 @@ import { PersistedObject } from './persistedObject'; | ||
/** | ||
* The `_type` value of the entity managed by the integration. This allows generated relationship types to match entity types. | ||
*/ | ||
sourceEntityType?: string; | ||
/** | ||
* Identifies properties in the `targetEntity` that are used to locate the | ||
@@ -67,0 +71,0 @@ * entites to connect to the `sourceEntityKey`. For example, if you know that |
{ | ||
"name": "@jupiterone/integration-sdk-core", | ||
"version": "2.5.0", | ||
"version": "2.6.0", | ||
"description": "The SDK for developing JupiterOne integrations", | ||
@@ -32,3 +32,3 @@ "main": "dist/src/index.js", | ||
}, | ||
"gitHead": "716e708faf160222cde0c601738d6e1bdbd77e1d" | ||
"gitHead": "c8ef69a39352312065aea6d7c8d54334995936d9" | ||
} |
Sorry, the diff of this file is not supported yet
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
354185
2158