Skip to content

Commit 2139b03

Browse files
Merge pull request #762 from JupiterOne/INT-4666-beforeAddRelationship-async
INT-4666 - Support async `beforeAddRelationship` hook
2 parents 8da3485 + c016de3 commit 2139b03

File tree

15 files changed

+186
-44
lines changed

15 files changed

+186
-44
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ and this project adheres to
99

1010
## Unreleased
1111

12+
## 8.22.0 - 2021-07-20
13+
14+
- Support async `beforeAddRelationship` hook in `IntegrationInvocationConfig`.
15+
See the development documentation for more information on its usage.
16+
1217
## 8.21.0 - 2021-07-20
1318

1419
### Added

docs/integrations/development.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ data retrieved in the step as a partial dataset. See the
286286
[Failure handling](#failure-handling) section below for more information on
287287
partial datasets.
288288

289-
#### `beforeAddEntity`
289+
#### `beforeAddEntity(context: IntegrationExecutionContext<IntegrationConfig>, e: Entity): Entity`
290290

291291
`beforeAddEntity` is an optional hook function that can be provided. The
292292
function is called before an entity is added to the job state internally and the
@@ -323,7 +323,7 @@ export const invocationConfig: IntegrationInvocationConfig<IntegrationConfig> =
323323
};
324324
```
325325

326-
#### `beforeAddRelationship`
326+
#### `beforeAddRelationship(context: IntegrationExecutionContext<IntegrationConfig>, r: Relationship): Promise<Relationship> | Relationship`
327327

328328
`beforeAddRelationship` is an optional hook function that can be provided. The
329329
function is called before a relationship is added to the job state internally

packages/cli/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@jupiterone/cli",
3-
"version": "8.21.0",
3+
"version": "8.22.0",
44
"description": "The JupiterOne cli",
55
"main": "dist/src/index.js",
66
"types": "dist/src/index.d.ts",
@@ -24,8 +24,8 @@
2424
"test": "jest"
2525
},
2626
"dependencies": {
27-
"@jupiterone/integration-sdk-core": "^8.21.0",
28-
"@jupiterone/integration-sdk-runtime": "^8.21.0",
27+
"@jupiterone/integration-sdk-core": "^8.22.0",
28+
"@jupiterone/integration-sdk-runtime": "^8.22.0",
2929
"@lifeomic/attempt": "^3.0.3",
3030
"commander": "^5.0.0",
3131
"globby": "^11.0.1",

packages/integration-sdk-benchmark/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@jupiterone/integration-sdk-benchmark",
3-
"version": "8.21.0",
3+
"version": "8.22.0",
44
"private": true,
55
"description": "SDK benchmarking scripts",
66
"main": "./src/index.js",
@@ -15,8 +15,8 @@
1515
"benchmark": "for file in ./src/benchmarks/*; do yarn prebenchmark && node $file; done"
1616
},
1717
"dependencies": {
18-
"@jupiterone/integration-sdk-core": "^8.21.0",
19-
"@jupiterone/integration-sdk-runtime": "^8.21.0",
18+
"@jupiterone/integration-sdk-core": "^8.22.0",
19+
"@jupiterone/integration-sdk-runtime": "^8.22.0",
2020
"benchmark": "^2.1.4"
2121
}
2222
}

packages/integration-sdk-cli/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@jupiterone/integration-sdk-cli",
3-
"version": "8.21.0",
3+
"version": "8.22.0",
44
"description": "The SDK for developing JupiterOne integrations",
55
"main": "dist/src/index.js",
66
"types": "dist/src/index.d.ts",
@@ -22,7 +22,7 @@
2222
"prepack": "yarn build:dist"
2323
},
2424
"dependencies": {
25-
"@jupiterone/integration-sdk-runtime": "^8.21.0",
25+
"@jupiterone/integration-sdk-runtime": "^8.22.0",
2626
"chalk": "^4",
2727
"commander": "^5.0.0",
2828
"fs-extra": "^10.1.0",
@@ -37,7 +37,7 @@
3737
"vis": "^4.21.0-EOL"
3838
},
3939
"devDependencies": {
40-
"@jupiterone/integration-sdk-private-test-utils": "^8.21.0",
40+
"@jupiterone/integration-sdk-private-test-utils": "^8.22.0",
4141
"@pollyjs/adapter-node-http": "^6.0.5",
4242
"@pollyjs/core": "^6.0.5",
4343
"@pollyjs/persister-fs": "^6.0.5",

packages/integration-sdk-core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@jupiterone/integration-sdk-core",
3-
"version": "8.21.0",
3+
"version": "8.22.0",
44
"description": "The SDK for developing JupiterOne integrations",
55
"main": "dist/src/index.js",
66
"types": "dist/src/index.d.ts",

packages/integration-sdk-core/src/types/config.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ export type BeforeAddEntityHookFunction<
2828

2929
export type BeforeAddRelationshipHookFunction<
3030
TExecutionContext extends ExecutionContext,
31-
> = (context: TExecutionContext, relationship: Relationship) => Relationship;
31+
> = (
32+
context: TExecutionContext,
33+
relationship: Relationship,
34+
) => Promise<Relationship> | Relationship;
3235

3336
export type LoadExecutionConfigFunction<
3437
TInstanceConfig extends IntegrationInstanceConfig = IntegrationInstanceConfig,

packages/integration-sdk-dev-tools/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@jupiterone/integration-sdk-dev-tools",
3-
"version": "8.21.0",
3+
"version": "8.22.0",
44
"description": "A collection of developer tools that will assist with building integrations.",
55
"repository": "git@github.com:JupiterOne/sdk.git",
66
"author": "JupiterOne <dev@jupiterone.io>",
@@ -15,8 +15,8 @@
1515
"access": "public"
1616
},
1717
"dependencies": {
18-
"@jupiterone/integration-sdk-cli": "^8.21.0",
19-
"@jupiterone/integration-sdk-testing": "^8.21.0",
18+
"@jupiterone/integration-sdk-cli": "^8.22.0",
19+
"@jupiterone/integration-sdk-testing": "^8.22.0",
2020
"@types/jest": "^27.1.0",
2121
"@types/node": "^14.0.5",
2222
"@typescript-eslint/eslint-plugin": "^4.22.0",

packages/integration-sdk-http-client/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@jupiterone/integration-sdk-http-client",
3-
"version": "8.21.0",
3+
"version": "8.22.0",
44
"description": "The HTTP client for use in JupiterOne integrations",
55
"main": "dist/src/index.js",
66
"types": "dist/src/index.d.ts",
@@ -27,8 +27,8 @@
2727
"node-fetch": "^2.6.0"
2828
},
2929
"devDependencies": {
30-
"@jupiterone/integration-sdk-dev-tools": "^8.21.0",
31-
"@jupiterone/integration-sdk-private-test-utils": "^8.21.0",
30+
"@jupiterone/integration-sdk-dev-tools": "^8.22.0",
31+
"@jupiterone/integration-sdk-private-test-utils": "^8.22.0",
3232
"fetch-mock-jest": "^1.5.1"
3333
},
3434
"bugs": {

packages/integration-sdk-private-test-utils/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@jupiterone/integration-sdk-private-test-utils",
33
"private": true,
4-
"version": "8.21.0",
4+
"version": "8.22.0",
55
"description": "The SDK for developing JupiterOne integrations",
66
"main": "dist/index.js",
77
"types": "dist/index.d.ts",
@@ -15,7 +15,7 @@
1515
"build:dist": "tsc -p tsconfig.json --declaration"
1616
},
1717
"dependencies": {
18-
"@jupiterone/integration-sdk-core": "^8.21.0",
18+
"@jupiterone/integration-sdk-core": "^8.22.0",
1919
"lodash": "^4.17.15",
2020
"uuid": "^7.0.3"
2121
},

0 commit comments

Comments
 (0)