Skip to content

Commit 885f102

Browse files
authored
Merge pull request #1122 from JupiterOne/readonly-iterate-graph-object
Mark graph object readonly
2 parents 9a26d11 + 1347ff9 commit 885f102

18 files changed

Lines changed: 127 additions & 89 deletions

File tree

CHANGELOG.md

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

1010
# Unreleased
1111

12+
# 13.6.0 - 2024-09-19
13+
14+
- Minor breaking change to JobState methods iterateEntities and
15+
iterateRelationships function signatures. The graph object passed to the
16+
iteratee is now Readonly. The intention is to prevent modification of the
17+
object during iteration. This is not a breaking change since the long-standing
18+
understanding is that these objects should never be modified once added to the
19+
jobState.
20+
21+
```diff
22+
- export type GraphObjectIteratee<T> = (obj: T) => void | Promise<void>;
23+
+ export type GraphObjectIteratee<T> = (obj: Readonly<T>) => void | Promise<void>;
24+
```
25+
1226
# 13.5.2 - 2024-09-17
1327

1428
- Temporary logging that should be removed after investigation.

lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
"packages/integration-sdk-*",
55
"packages/cli"
66
],
7-
"version": "13.5.2"
7+
"version": "13.6.0"
88
}

package-lock.json

Lines changed: 31 additions & 31 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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": "13.5.2",
3+
"version": "13.6.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": "^13.5.2",
28-
"@jupiterone/integration-sdk-runtime": "^13.5.2",
27+
"@jupiterone/integration-sdk-core": "^13.6.0",
28+
"@jupiterone/integration-sdk-runtime": "^13.6.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": "13.5.2",
3+
"version": "13.6.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 npm run prebenchmark && node $file; done"
1616
},
1717
"dependencies": {
18-
"@jupiterone/integration-sdk-core": "^13.5.2",
19-
"@jupiterone/integration-sdk-runtime": "^13.5.2",
18+
"@jupiterone/integration-sdk-core": "^13.6.0",
19+
"@jupiterone/integration-sdk-runtime": "^13.6.0",
2020
"benchmark": "^2.1.4"
2121
}
2222
}

packages/integration-sdk-cli/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@jupiterone/integration-sdk-cli",
3-
"version": "13.5.2",
3+
"version": "13.6.0",
44
"description": "The SDK for developing JupiterOne integrations",
55
"main": "dist/src/index.js",
66
"types": "dist/src/index.d.ts",
@@ -26,8 +26,8 @@
2626
},
2727
"dependencies": {
2828
"@jupiterone/data-model": "^0.61.11",
29-
"@jupiterone/integration-sdk-core": "^13.5.2",
30-
"@jupiterone/integration-sdk-runtime": "^13.5.2",
29+
"@jupiterone/integration-sdk-core": "^13.6.0",
30+
"@jupiterone/integration-sdk-runtime": "^13.6.0",
3131
"chalk": "^4",
3232
"commander": "^9.4.0",
3333
"ejs": "^3.1.9",
@@ -45,7 +45,7 @@
4545
"url-exists": "^1.0.3"
4646
},
4747
"devDependencies": {
48-
"@jupiterone/integration-sdk-private-test-utils": "^13.5.2",
48+
"@jupiterone/integration-sdk-private-test-utils": "^13.6.0",
4949
"@pollyjs/adapter-node-http": "^6.0.5",
5050
"@pollyjs/core": "^6.0.5",
5151
"@pollyjs/persister-fs": "^6.0.5",

packages/integration-sdk-core/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@jupiterone/integration-sdk-core",
3-
"version": "13.5.2",
3+
"version": "13.6.0",
44
"description": "The SDK for developing JupiterOne integrations",
55
"main": "dist/src/index.js",
66
"types": "dist/src/index.d.ts",
@@ -24,7 +24,7 @@
2424
},
2525
"dependencies": {
2626
"@jupiterone/data-model": "^0.61.11",
27-
"@jupiterone/integration-sdk-entity-validator": "^13.5.2",
27+
"@jupiterone/integration-sdk-entity-validator": "^13.6.0",
2828
"@sinclair/typebox": "^0.32.30",
2929
"lodash": "^4.17.21"
3030
},

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export interface GraphObjectFilter {
44
_type: string;
55
}
66

7-
export type GraphObjectIteratee<T> = (obj: T) => void | Promise<void>;
7+
export type GraphObjectIteratee<T> = (obj: Readonly<T>) => void | Promise<void>;
88
export type GraphObjectIterateeOptions = {
99
concurrency?: number;
1010
};
@@ -104,6 +104,11 @@ export interface JobState {
104104
* have run and therefore entities collected by those other steps should not
105105
* be expected to exist.
106106
*
107+
* The graph object parameter passed to the iteratee is marked as Readonly.
108+
* Once created and added to the JobState, graph objects should be considered immutable.
109+
* Modifying a graph object during iteration can result in undesirable behavior
110+
* since objects are upload to JupiterOne at non-regular intervals.
111+
*
107112
* If concurrency is specified (defaults to 1), the iteratee will be executed
108113
* concurrently for graph objects that are found in memory and for
109114
* graph objects found in a given graph file. No specific ordering is guaranteed.
@@ -136,6 +141,11 @@ export interface JobState {
136141
* may not have run and therefore relationships collected by those other steps
137142
* should not be expected to exist.
138143
*
144+
* The graph object parameter passed to the iteratee is marked as Readonly.
145+
* Once created and added to the JobState, graph objects should be considered immutable.
146+
* Modifying a graph object during iteration can result in undesirable behavior
147+
* since objects are upload to JupiterOne at non-regular intervals.
148+
*
139149
* If concurrency is specified (defaults to 1), the iteratee will be executed
140150
* concurrently for graph objects that are found in memory and for
141151
* graph objects found in a given graph file. No specific ordering is guaranteed.

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": "13.5.2",
3+
"version": "13.6.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": "^13.5.2",
19-
"@jupiterone/integration-sdk-testing": "^13.5.2",
18+
"@jupiterone/integration-sdk-cli": "^13.6.0",
19+
"@jupiterone/integration-sdk-testing": "^13.6.0",
2020
"@types/jest": "^29.5.3",
2121
"@types/node": "^18",
2222
"@typescript-eslint/eslint-plugin": "^6.2.1",

packages/integration-sdk-entities/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-entities",
3-
"version": "13.5.2",
3+
"version": "13.6.0",
44
"description": "Generated types for the JupiterOne data-model",
55
"main": "dist/src/index.js",
66
"types": "dist/src/index.d.ts",

0 commit comments

Comments
 (0)