@jupiterone/integration-sdk-cli 10.7.1 → 11.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jupiterone/integration-sdk-cli",
3
- "version": "10.7.1",
3
+ "version": "11.0.2",
4
4
  "description": "The SDK for developing JupiterOne integrations",
5
5
  "main": "dist/src/index.js",
6
6
  "types": "dist/src/index.d.ts",
@@ -25,8 +25,8 @@
25
25
  },
26
26
  "dependencies": {
27
27
  "@jupiterone/data-model": "^0.54.0",
28
- "@jupiterone/integration-sdk-core": "^10.7.1",
29
- "@jupiterone/integration-sdk-runtime": "^10.7.1",
28
+ "@jupiterone/integration-sdk-core": "^11.0.2",
29
+ "@jupiterone/integration-sdk-runtime": "^11.0.2",
30
30
  "chalk": "^4",
31
31
  "commander": "^9.4.0",
32
32
  "fs-extra": "^10.1.0",
@@ -44,7 +44,7 @@
44
44
  "vis": "^4.21.0-EOL"
45
45
  },
46
46
  "devDependencies": {
47
- "@jupiterone/integration-sdk-private-test-utils": "^10.7.1",
47
+ "@jupiterone/integration-sdk-private-test-utils": "^11.0.2",
48
48
  "@pollyjs/adapter-node-http": "^6.0.5",
49
49
  "@pollyjs/core": "^6.0.5",
50
50
  "@pollyjs/persister-fs": "^6.0.5",
@@ -56,5 +56,5 @@
56
56
  "memfs": "^3.2.0",
57
57
  "neo-forgery": "^2.0.0"
58
58
  },
59
- "gitHead": "3866d5d186616eaedbe2d4dc9ef5401b3df276e5"
59
+ "gitHead": "73d005410944da3889d5b41812deb3a48ae5ba89"
60
60
  }
@@ -9,15 +9,12 @@ import {
9
9
  validateSyncOptions,
10
10
  } from '../commands/options';
11
11
  import {
12
- DEFAULT_UPLOAD_BATCH_SIZE,
13
12
  JUPITERONE_DEV_API_BASE_URL,
14
13
  JUPITERONE_PROD_API_BASE_URL,
15
14
  } from '@jupiterone/integration-sdk-runtime';
16
15
 
17
16
  const syncOptions = (values?: Partial<SyncOptions>): SyncOptions => ({
18
17
  source: 'integration-managed',
19
- uploadBatchSize: DEFAULT_UPLOAD_BATCH_SIZE,
20
- uploadRelationshipBatchSize: DEFAULT_UPLOAD_BATCH_SIZE,
21
18
  skipFinalize: false,
22
19
  ...values,
23
20
  });
@@ -1,5 +1,4 @@
1
1
  import {
2
- DEFAULT_UPLOAD_BATCH_SIZE,
3
2
  getAccountFromEnvironment,
4
3
  getApiKeyFromEnvironment,
5
4
  JUPITERONE_DEV_API_BASE_URL,
@@ -39,8 +38,6 @@ export interface SyncOptions {
39
38
  source: 'integration-managed' | 'integration-external' | 'api';
40
39
  scope?: string | undefined;
41
40
  integrationInstanceId?: string | undefined;
42
- uploadBatchSize: number;
43
- uploadRelationshipBatchSize: number;
44
41
  skipFinalize: boolean;
45
42
  }
46
43
 
@@ -69,18 +66,6 @@ export function addSyncOptionsToCommand(command: Command): Command {
69
66
  'integration-managed',
70
67
  )
71
68
  .option('--scope <anystring>', 'specify synchronization job scope value')
72
- .option(
73
- '-u, --upload-batch-size <number>',
74
- 'specify number of entities and relationships per upload batch',
75
- (value, _previous: Number) => Number(value),
76
- DEFAULT_UPLOAD_BATCH_SIZE,
77
- )
78
- .option(
79
- '-ur, --upload-relationship-batch-size <number>',
80
- 'specify number of relationships per upload batch, overrides --upload-batch-size',
81
- (value, _previous: Number) => Number(value),
82
- DEFAULT_UPLOAD_BATCH_SIZE,
83
- )
84
69
  .option(
85
70
  '--skip-finalize',
86
71
  'skip synchronization finalization to leave job open for additional uploads',
@@ -127,8 +112,6 @@ export function getSyncOptions(options: OptionValues): SyncOptions {
127
112
  source: options.source,
128
113
  scope: options.scope,
129
114
  integrationInstanceId: options.integrationInstanceId,
130
- uploadBatchSize: options.uploadBatchSize,
131
- uploadRelationshipBatchSize: options.uploadRelationshipBatchSize,
132
115
  skipFinalize: options.skipFinalize,
133
116
  };
134
117
  }
@@ -109,9 +109,6 @@ export function run(): Command {
109
109
  stepId,
110
110
  synchronizationJobContext: synchronizationContext,
111
111
  uploadConcurrency: DEFAULT_UPLOAD_CONCURRENCY,
112
- uploadBatchSize: options.uploadBatchSize,
113
- uploadRelationshipsBatchSize:
114
- options.uploadRelationshipBatchSize,
115
112
  });
116
113
  },
117
114
  },
@@ -2,4 +2,5 @@ dist
2
2
  coverage/
3
3
  .j1-integration
4
4
  .j1-integration-cache
5
- .gitleaks.yml
5
+ .gitleaks.yml
6
+ CHANGELOG.md
@@ -6,8 +6,11 @@ import {
6
6
  StepMappedRelationshipMetadata,
7
7
  StepRelationshipMetadata,
8
8
  } from '@jupiterone/integration-sdk-core';
9
- import { collectGraphObjectMetadataFromSteps } from './getSortedJupiterOneTypes';
10
9
  import { randomUUID as uuid } from 'crypto';
10
+ import {
11
+ alphabetizeMetadataProperties,
12
+ collectGraphObjectMetadataFromSteps,
13
+ } from './getSortedJupiterOneTypes';
11
14
 
12
15
  function createIntegrationStep({
13
16
  entities = [],
@@ -214,3 +217,63 @@ describe('collectGraphObjectMetadataFromSteps', () => {
214
217
  });
215
218
  });
216
219
  });
220
+
221
+ describe('alphabetizeMetadataProperties', () => {
222
+ it('should correctly sort an array of StepRelationshipMetadata', () => {
223
+ const { relationships } = alphabetizeMetadataProperties(
224
+ collectGraphObjectMetadataFromSteps([
225
+ createIntegrationStep({
226
+ relationships: [
227
+ {
228
+ _type: 'aws_account_has_service',
229
+ sourceType: 'aws_account',
230
+ _class: RelationshipClass.HAS,
231
+ targetType: 'aws_waf',
232
+ },
233
+ ],
234
+ }),
235
+ createIntegrationStep({
236
+ relationships: [
237
+ {
238
+ _type: 'aws_account_owns_service',
239
+ sourceType: 'aws_account',
240
+ _class: RelationshipClass.OWNS,
241
+ targetType: 'aws_apigateway',
242
+ },
243
+ ],
244
+ }),
245
+ createIntegrationStep({
246
+ relationships: [
247
+ {
248
+ _type: 'aws_account_has_service',
249
+ sourceType: 'aws_account',
250
+ _class: RelationshipClass.HAS,
251
+ targetType: 'aws_apigateway',
252
+ },
253
+ ],
254
+ }),
255
+ ]),
256
+ );
257
+
258
+ expect(relationships).toEqual([
259
+ {
260
+ _type: 'aws_account_has_service',
261
+ sourceType: 'aws_account',
262
+ _class: 'HAS',
263
+ targetType: 'aws_apigateway',
264
+ },
265
+ {
266
+ _type: 'aws_account_owns_service',
267
+ sourceType: 'aws_account',
268
+ _class: 'OWNS',
269
+ targetType: 'aws_apigateway',
270
+ },
271
+ {
272
+ _type: 'aws_account_has_service',
273
+ sourceType: 'aws_account',
274
+ _class: 'HAS',
275
+ targetType: 'aws_waf',
276
+ },
277
+ ]);
278
+ });
279
+ });
@@ -1,14 +1,14 @@
1
- import { loadConfig } from '../config';
2
- import * as path from 'path';
3
- import { buildStepDependencyGraph } from '@jupiterone/integration-sdk-runtime';
4
1
  import {
5
2
  IntegrationStepExecutionContext,
6
3
  Step,
7
- StepGraphObjectMetadataProperties,
8
4
  StepEntityMetadata,
9
- StepRelationshipMetadata,
5
+ StepGraphObjectMetadataProperties,
10
6
  StepMappedRelationshipMetadata,
7
+ StepRelationshipMetadata,
11
8
  } from '@jupiterone/integration-sdk-core';
9
+ import { buildStepDependencyGraph } from '@jupiterone/integration-sdk-runtime';
10
+ import * as path from 'path';
11
+ import { loadConfig } from '../config';
12
12
 
13
13
  export interface TypesCommandArgs {
14
14
  projectPath: string;
@@ -57,15 +57,26 @@ function alphabetizeEntityMetadataPropertyByTypeCompareFn(
57
57
  }
58
58
 
59
59
  function alphabetizeRelationshipMetadataPropertyByTypeCompareFn(
60
- a: StepRelationshipMetadata,
61
- b: StepRelationshipMetadata,
60
+ a: StepRelationshipMetadata | StepMappedRelationshipMetadata,
61
+ b: StepRelationshipMetadata | StepMappedRelationshipMetadata,
62
62
  ): number {
63
- if (a._type > b._type) return 1;
64
- if (a._type < b._type) return -1;
63
+ if (a.sourceType > b.sourceType) return 1;
64
+ if (a.sourceType < b.sourceType) return -1;
65
+
66
+ if (a.targetType > b.targetType) return 1;
67
+ if (a.targetType < b.targetType) return -1;
68
+
69
+ if (a._class > b._class) return 1;
70
+ if (a._class < b._class) return -1;
71
+
72
+ if ('direction' in a && 'direction' in b) {
73
+ if (a.direction > b.direction) return 1;
74
+ if (a.direction < b.direction) return -1;
75
+ }
65
76
  return 0;
66
77
  }
67
78
 
68
- function alphabetizeMetadataProperties(
79
+ export function alphabetizeMetadataProperties(
69
80
  metadata: StepGraphObjectMetadataProperties,
70
81
  ): StepGraphObjectMetadataProperties {
71
82
  return {
@@ -17,7 +17,7 @@ describe('#createMappedRelationshipNodesAndEdges', () => {
17
17
  _mapping: {
18
18
  relationshipDirection: RelationshipDirection.FORWARD,
19
19
  sourceEntityKey: 'key-1',
20
- targetFilterKeys: ['_key'],
20
+ targetFilterKeys: [['_key']],
21
21
  targetEntity: {
22
22
  _key: 'key-2',
23
23
  },
@@ -140,7 +140,7 @@ describe('#createMappedRelationshipNodesAndEdges', () => {
140
140
  _mapping: {
141
141
  relationshipDirection: RelationshipDirection.FORWARD,
142
142
  sourceEntityKey: 'key-1',
143
- targetFilterKeys: ['_key'],
143
+ targetFilterKeys: [['_key']],
144
144
  targetEntity: {
145
145
  _key: '789',
146
146
  },
@@ -154,7 +154,7 @@ describe('#createMappedRelationshipNodesAndEdges', () => {
154
154
  _mapping: {
155
155
  relationshipDirection: RelationshipDirection.FORWARD,
156
156
  sourceEntityKey: 'key-2',
157
- targetFilterKeys: ['_key'],
157
+ targetFilterKeys: [['_key']],
158
158
  targetEntity: {
159
159
  _key: '789',
160
160
  },
@@ -218,7 +218,7 @@ describe('#createMappedRelationshipNodesAndEdges', () => {
218
218
  _mapping: {
219
219
  relationshipDirection: RelationshipDirection.FORWARD,
220
220
  sourceEntityKey: 'key-1',
221
- targetFilterKeys: ['_class'],
221
+ targetFilterKeys: [['_class']],
222
222
  targetEntity: {
223
223
  _class: '789',
224
224
  },
@@ -232,7 +232,7 @@ describe('#createMappedRelationshipNodesAndEdges', () => {
232
232
  _mapping: {
233
233
  relationshipDirection: RelationshipDirection.FORWARD,
234
234
  sourceEntityKey: 'key-2',
235
- targetFilterKeys: ['_class'],
235
+ targetFilterKeys: [['_class']],
236
236
  targetEntity: {
237
237
  _class: '789',
238
238
  },
@@ -299,7 +299,7 @@ describe('#createMappedRelationshipNodesAndEdges', () => {
299
299
  _mapping: {
300
300
  relationshipDirection: RelationshipDirection.FORWARD,
301
301
  sourceEntityKey: 'key-1',
302
- targetFilterKeys: ['_type'],
302
+ targetFilterKeys: [['_type']],
303
303
  targetEntity: {
304
304
  _type: '789',
305
305
  },
@@ -477,13 +477,12 @@ describe('#CreatePlaceholderEntity', () => {
477
477
  id: 'target-id',
478
478
  otherKey: 'otherValue',
479
479
  },
480
- targetFilterKeys: ['_key', 'id', ['_key', '_type']],
480
+ targetFilterKeys: [['_key', '_type']],
481
481
  },
482
482
  };
483
483
 
484
484
  expect(createPlaceholderEntity(mappedRelationship._mapping)).toEqual({
485
485
  _key: 'target-key',
486
- id: 'target-id',
487
486
  _type: 'target-type',
488
487
  });
489
488
  });