@jupiterone/integration-sdk-cli 12.7.1 → 12.8.3

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.
Files changed (174) hide show
  1. package/dist/src/bocchi/actions/steps.d.ts +4 -0
  2. package/dist/src/bocchi/actions/steps.js +20 -0
  3. package/dist/src/bocchi/actions/steps.js.map +1 -0
  4. package/dist/src/bocchi/bocchi.d.ts +1 -0
  5. package/dist/src/bocchi/bocchi.js +260 -0
  6. package/dist/src/bocchi/bocchi.js.map +1 -0
  7. package/dist/src/bocchi/templates/partials/directRelationships.hbs +26 -0
  8. package/dist/src/bocchi/templates/partials/mappedRelationships.hbs +36 -0
  9. package/dist/src/bocchi/templates/partials/stepMap.hbs +47 -0
  10. package/dist/src/bocchi/templates/steps/child-singleton.ts.hbs +47 -0
  11. package/dist/src/bocchi/templates/steps/fetch-child-entities.ts.hbs +58 -0
  12. package/dist/src/bocchi/templates/steps/fetch-entities.ts.hbs +47 -0
  13. package/dist/src/bocchi/templates/steps/index.test.ts.hbs +41 -0
  14. package/dist/src/bocchi/templates/steps/singleton.ts.hbs +45 -0
  15. package/dist/src/bocchi/templates/steps/spec.ts.hbs +73 -0
  16. package/dist/src/bocchi/templates/top-level/.env.example.hbs +3 -0
  17. package/dist/src/bocchi/templates/top-level/.eslintignore.hbs +1 -0
  18. package/dist/src/bocchi/templates/top-level/.eslintrc.hbs +6 -0
  19. package/dist/src/bocchi/templates/top-level/.github/workflows/build.yml.hbs +29 -0
  20. package/dist/src/bocchi/templates/top-level/.github/workflows/questions.yml.hbs +40 -0
  21. package/dist/src/bocchi/templates/top-level/.gitignore.hbs +8 -0
  22. package/dist/src/bocchi/templates/top-level/.node-version.hbs +1 -0
  23. package/dist/src/bocchi/templates/top-level/.prettierignore.hbs +6 -0
  24. package/dist/src/bocchi/templates/top-level/CHANGELOG.md.hbs +9 -0
  25. package/dist/src/bocchi/templates/top-level/CODEOWNERS.hbs +3 -0
  26. package/dist/src/bocchi/templates/top-level/Dockerfile.hbs +25 -0
  27. package/dist/src/bocchi/templates/top-level/LICENSE.hbs +373 -0
  28. package/dist/src/bocchi/templates/top-level/README.md.hbs +114 -0
  29. package/dist/src/bocchi/templates/top-level/docs/development.md.hbs +28 -0
  30. package/dist/src/bocchi/templates/top-level/docs/jupiterone.md.hbs +1 -0
  31. package/dist/src/bocchi/templates/top-level/docs/spec/index.ts.hbs +14 -0
  32. package/dist/src/bocchi/templates/top-level/husky.config.js.hbs +1 -0
  33. package/dist/src/bocchi/templates/top-level/jest.config.js.hbs +1 -0
  34. package/dist/src/bocchi/templates/top-level/jupiterone/questions/questions.yaml.hbs +16 -0
  35. package/dist/src/bocchi/templates/top-level/lint-staged.config.js.hbs +1 -0
  36. package/dist/src/bocchi/templates/top-level/package.json.hbs +49 -0
  37. package/dist/src/bocchi/templates/top-level/prettier.config.js.hbs +1 -0
  38. package/dist/src/bocchi/templates/top-level/src/client.ts.hbs +116 -0
  39. package/dist/src/bocchi/templates/top-level/src/config.ts.hbs +41 -0
  40. package/dist/src/bocchi/templates/top-level/src/index.test.ts.hbs +6 -0
  41. package/dist/src/bocchi/templates/top-level/src/index.ts.hbs +14 -0
  42. package/dist/src/bocchi/templates/top-level/src/steps/constants.ts.hbs +60 -0
  43. package/dist/src/bocchi/templates/top-level/src/steps/converters.ts.hbs +37 -0
  44. package/dist/src/bocchi/templates/top-level/src/steps/index.ts.hbs +13 -0
  45. package/dist/src/bocchi/templates/top-level/src/steps/types.ts.hbs +6 -0
  46. package/dist/src/bocchi/templates/top-level/test/README.md.hbs +5 -0
  47. package/dist/src/bocchi/templates/top-level/test/config.ts.hbs +30 -0
  48. package/dist/src/bocchi/templates/top-level/test/recording.ts.hbs +74 -0
  49. package/dist/src/bocchi/templates/top-level/tsconfig.dist.json.hbs +13 -0
  50. package/dist/src/bocchi/templates/top-level/tsconfig.json.hbs +7 -0
  51. package/dist/src/bocchi/utils/types.d.ts +98 -0
  52. package/dist/src/bocchi/utils/types.js +10 -0
  53. package/dist/src/bocchi/utils/types.js.map +1 -0
  54. package/dist/src/commands/bocchi.d.ts +1 -0
  55. package/dist/src/commands/bocchi.js +29 -0
  56. package/dist/src/commands/bocchi.js.map +1 -0
  57. package/dist/src/commands/collect.js.map +1 -1
  58. package/dist/src/commands/diff.js.map +1 -1
  59. package/dist/src/commands/document.js.map +1 -1
  60. package/dist/src/commands/generate-ingestion-sources-config.js.map +1 -1
  61. package/dist/src/commands/generate-integration-graph-schema.d.ts +2 -1
  62. package/dist/src/commands/generate-integration-graph-schema.js +1 -0
  63. package/dist/src/commands/generate-integration-graph-schema.js.map +1 -1
  64. package/dist/src/commands/generate.js +1 -1
  65. package/dist/src/commands/generate.js.map +1 -1
  66. package/dist/src/commands/index.d.ts +1 -0
  67. package/dist/src/commands/index.js +1 -0
  68. package/dist/src/commands/index.js.map +1 -1
  69. package/dist/src/commands/options.js.map +1 -1
  70. package/dist/src/commands/run.js.map +1 -1
  71. package/dist/src/commands/validate-question-file.js.map +1 -1
  72. package/dist/src/commands/visualize-types.js.map +1 -1
  73. package/dist/src/config.js.map +1 -1
  74. package/dist/src/generator/actions.d.ts +5 -1
  75. package/dist/src/generator/actions.js +19 -1
  76. package/dist/src/generator/actions.js.map +1 -1
  77. package/dist/src/generator/entitiesFlow.js.map +1 -1
  78. package/dist/src/generator/newIntegration.js +17 -3
  79. package/dist/src/generator/newIntegration.js.map +1 -1
  80. package/dist/src/generator/relationshipsFlow.js.map +1 -1
  81. package/dist/src/generator/stepsFlow.js.map +1 -1
  82. package/dist/src/generator/template/.github/workflows/build.yml.hbs +18 -0
  83. package/dist/src/generator/template/.github/workflows/questions.yml.hbs +12 -1
  84. package/dist/src/generator/template/Dockerfile.hbs +16 -0
  85. package/dist/src/generator/template/README.md.hbs +19 -5
  86. package/dist/src/generator/template/package.json.hbs +8 -2
  87. package/dist/src/generator/util.js.map +1 -1
  88. package/dist/src/index.js +2 -1
  89. package/dist/src/index.js.map +1 -1
  90. package/dist/src/log.js.map +1 -1
  91. package/dist/src/neo4j/neo4jGraphStore.js.map +1 -1
  92. package/dist/src/neo4j/neo4jUtilities.js.map +1 -1
  93. package/dist/src/neo4j/uploadToNeo4j.js.map +1 -1
  94. package/dist/src/neo4j/wipeNeo4j.js.map +1 -1
  95. package/dist/src/questions/managedQuestionFileValidator.js.map +1 -1
  96. package/dist/src/services/queryLanguage.js.map +1 -1
  97. package/dist/src/troubleshoot/utils.js.map +1 -1
  98. package/dist/src/utils/generateVisHTML.js.map +1 -1
  99. package/dist/src/utils/getSortedJupiterOneTypes.js.map +1 -1
  100. package/dist/src/visualization/createMappedRelationshipNodesAndEdges.js.map +1 -1
  101. package/dist/src/visualization/generateDependencyVisualization.js.map +1 -1
  102. package/dist/src/visualization/generateVisualization.js.map +1 -1
  103. package/dist/src/visualization/retrieveIntegrationData.js.map +1 -1
  104. package/dist/src/visualization/utils.js.map +1 -1
  105. package/dist/tsconfig.dist.tsbuildinfo +1 -1
  106. package/package.json +11 -9
  107. package/src/bocchi/README.md +95 -0
  108. package/src/bocchi/actions/steps.ts +17 -0
  109. package/src/bocchi/bocchi.ts +311 -0
  110. package/src/bocchi/docs/template/README.md +140 -0
  111. package/src/bocchi/docs/template/authentication.md +100 -0
  112. package/src/bocchi/docs/template/examples/example.json +127 -0
  113. package/src/bocchi/docs/template/examples/signalSciences.json +128 -0
  114. package/src/bocchi/docs/template/steps.md +656 -0
  115. package/src/bocchi/templates/partials/directRelationships.hbs +26 -0
  116. package/src/bocchi/templates/partials/mappedRelationships.hbs +36 -0
  117. package/src/bocchi/templates/partials/stepMap.hbs +47 -0
  118. package/src/bocchi/templates/steps/child-singleton.ts.hbs +47 -0
  119. package/src/bocchi/templates/steps/fetch-child-entities.ts.hbs +58 -0
  120. package/src/bocchi/templates/steps/fetch-entities.ts.hbs +47 -0
  121. package/src/bocchi/templates/steps/index.test.ts.hbs +41 -0
  122. package/src/bocchi/templates/steps/singleton.ts.hbs +45 -0
  123. package/src/bocchi/templates/steps/spec.ts.hbs +73 -0
  124. package/src/bocchi/templates/top-level/.env.example.hbs +3 -0
  125. package/src/bocchi/templates/top-level/.eslintignore.hbs +1 -0
  126. package/src/bocchi/templates/top-level/.eslintrc.hbs +6 -0
  127. package/src/bocchi/templates/top-level/.github/workflows/build.yml.hbs +29 -0
  128. package/src/bocchi/templates/top-level/.github/workflows/questions.yml.hbs +40 -0
  129. package/src/bocchi/templates/top-level/.gitignore.hbs +8 -0
  130. package/src/bocchi/templates/top-level/.node-version.hbs +1 -0
  131. package/src/bocchi/templates/top-level/.prettierignore.hbs +6 -0
  132. package/src/bocchi/templates/top-level/CHANGELOG.md.hbs +9 -0
  133. package/src/bocchi/templates/top-level/CODEOWNERS.hbs +3 -0
  134. package/src/bocchi/templates/top-level/Dockerfile.hbs +25 -0
  135. package/src/bocchi/templates/top-level/LICENSE.hbs +373 -0
  136. package/src/bocchi/templates/top-level/README.md.hbs +114 -0
  137. package/src/bocchi/templates/top-level/docs/development.md.hbs +28 -0
  138. package/src/bocchi/templates/top-level/docs/jupiterone.md.hbs +1 -0
  139. package/src/bocchi/templates/top-level/docs/spec/index.ts.hbs +14 -0
  140. package/src/bocchi/templates/top-level/husky.config.js.hbs +1 -0
  141. package/src/bocchi/templates/top-level/jest.config.js.hbs +1 -0
  142. package/src/bocchi/templates/top-level/jupiterone/questions/questions.yaml.hbs +16 -0
  143. package/src/bocchi/templates/top-level/lint-staged.config.js.hbs +1 -0
  144. package/src/bocchi/templates/top-level/package.json.hbs +49 -0
  145. package/src/bocchi/templates/top-level/prettier.config.js.hbs +1 -0
  146. package/src/bocchi/templates/top-level/src/client.ts.hbs +116 -0
  147. package/src/bocchi/templates/top-level/src/config.ts.hbs +41 -0
  148. package/src/bocchi/templates/top-level/src/index.test.ts.hbs +6 -0
  149. package/src/bocchi/templates/top-level/src/index.ts.hbs +14 -0
  150. package/src/bocchi/templates/top-level/src/steps/constants.ts.hbs +60 -0
  151. package/src/bocchi/templates/top-level/src/steps/converters.ts.hbs +37 -0
  152. package/src/bocchi/templates/top-level/src/steps/index.ts.hbs +13 -0
  153. package/src/bocchi/templates/top-level/src/steps/types.ts.hbs +6 -0
  154. package/src/bocchi/templates/top-level/test/README.md.hbs +5 -0
  155. package/src/bocchi/templates/top-level/test/config.ts.hbs +30 -0
  156. package/src/bocchi/templates/top-level/test/recording.ts.hbs +74 -0
  157. package/src/bocchi/templates/top-level/tsconfig.dist.json.hbs +13 -0
  158. package/src/bocchi/templates/top-level/tsconfig.json.hbs +7 -0
  159. package/src/bocchi/utils/types.ts +106 -0
  160. package/src/commands/bocchi.ts +28 -0
  161. package/src/commands/generate-ingestion-sources-config.ts +4 -5
  162. package/src/commands/generate-integration-graph-schema.test.ts +56 -0
  163. package/src/commands/generate-integration-graph-schema.ts +3 -0
  164. package/src/commands/generate.ts +1 -1
  165. package/src/commands/index.ts +1 -0
  166. package/src/generator/actions.ts +28 -1
  167. package/src/generator/newIntegration.ts +28 -4
  168. package/src/generator/template/.github/workflows/build.yml.hbs +18 -0
  169. package/src/generator/template/.github/workflows/questions.yml.hbs +12 -1
  170. package/src/generator/template/Dockerfile.hbs +16 -0
  171. package/src/generator/template/README.md.hbs +19 -5
  172. package/src/generator/template/package.json.hbs +8 -2
  173. package/src/index.ts +3 -1
  174. package/src/neo4j/README.md +2 -1
@@ -0,0 +1,656 @@
1
+ # Steps
2
+
3
+ Defines the steps that should be created for the graph project. Each step object
4
+ defines the API request and response needed to create graph objects, the
5
+ entities and relationships that should be made, as well as parent entity
6
+ association.
7
+
8
+ Contents:
9
+
10
+ - [Format](#format)
11
+ - [Fields](#fields)
12
+ - [id](#id)
13
+ - [name](#name)
14
+ - [entity](#entity)
15
+ - [name](#name-1)
16
+ - [\_type](#_type)
17
+ - [\_class](#_class)
18
+ - [\_keyPath](#_keyPath)
19
+ - [fieldMappings](#fieldMappings)
20
+ - [staticFields](#staticFields)
21
+ - [parentAssociation](#parentAssociation)
22
+ - [parentEntityType](#parentEntityType)
23
+ - [relationshipClass](#relationshipClass)
24
+ - [request](#request)
25
+ - [urlTemplate](#urlTemplate)
26
+ - [method](#method)
27
+ - [params](#parms)
28
+ - [response](#response)
29
+ - [dataPath](#dataPath)
30
+ - [responseType](#responseType)
31
+ - [nextTokenPath](#nextTokenPath)
32
+ - [directRelationships](#directrelationships)
33
+ - [targetKey](#targetKey)
34
+ - [targetType](#targetType)
35
+ - [\_class](#_class-1)
36
+ - [direction](#direction)
37
+ - [mappedRelationships](#mappedrelationships)
38
+ - [\_class](#_class-2)
39
+ - [direction](#direction-1)
40
+ - [mappings](#mappings)
41
+ - [dependsOn](#dependson)
42
+
43
+ # Format
44
+
45
+ ```ts
46
+ {
47
+ id: string,
48
+ name: string,
49
+ entity: {
50
+ _type: string,
51
+ _class: string | Array<string>,
52
+ _keyFormat: string,
53
+ staticFields?: {
54
+ [fieldName: string]: string | boolean | number | string[] | boolean[] | number[]
55
+ },
56
+ fieldMappings?: {
57
+ [entityProperty: string]: string
58
+ },
59
+ parentRelationship?: {
60
+ _class: RelationshipClass
61
+ }
62
+ },
63
+ request: {
64
+ urlTemplate: string,
65
+ method?: 'GET' | 'POST',
66
+ params?:
67
+ },
68
+ dataPath: string,
69
+ nextTokenPath?: string,
70
+ tokens?: number,
71
+ directRelationships?: {
72
+ targetKey: string,
73
+ targetType: string,
74
+ _class: RelationshipClass
75
+ direction: 'FORWARD' | 'REVERSE'
76
+ }[],
77
+ mappedRelationships?: {
78
+ _class: RelationshipClass,
79
+ direction: 'FORWARD' | 'REVERSE',
80
+ fieldMappings: {
81
+ sourceProperty: string,
82
+ targetProperty: string
83
+ } | {
84
+ targetValue: string,
85
+ targetProperty: string
86
+ }
87
+ }[],
88
+ dependsOn?: Array<string>
89
+ }
90
+ ```
91
+
92
+ # Fields
93
+
94
+ ## id
95
+
96
+ | | |
97
+ | -------- | -------- |
98
+ | Property | `id` |
99
+ | Type | `String` |
100
+ | Required | `true` |
101
+
102
+ Unique identifier of the step
103
+
104
+ Example: `fetch-github-users`
105
+
106
+ ## name
107
+
108
+ | | |
109
+ | -------- | -------- |
110
+ | Property | `name` |
111
+ | Type | `String` |
112
+ | Required | `true` |
113
+
114
+ User-facing name of the step
115
+
116
+ Example: `Fetch GitHub Users`
117
+
118
+ ## entity
119
+
120
+ | | |
121
+ | -------- | -------- |
122
+ | Property | `entity` |
123
+ | Type | `Object` |
124
+ | Required | `true` |
125
+
126
+ The type entity that will be ingested for this step.
127
+
128
+ ### name
129
+
130
+ | | |
131
+ | -------- | -------- |
132
+ | Property | `name` |
133
+ | Type | `String` |
134
+ | Required | `true` |
135
+
136
+ Name of the entity.
137
+
138
+ Example: `Cloud WAF Instance`
139
+
140
+ ### \_type
141
+
142
+ | | |
143
+ | -------- | -------- |
144
+ | Property | `_type` |
145
+ | Type | `String` |
146
+ | Required | `true` |
147
+
148
+ Type of the entity.
149
+
150
+ Example: `github_user`
151
+
152
+ ### \_class
153
+
154
+ | | |
155
+ | -------- | ------------------- |
156
+ | Property | `_class` |
157
+ | Type | `String` `String[]` |
158
+ | Required | `true` |
159
+
160
+ Class(es) of the entity.
161
+
162
+ Example: `User`
163
+
164
+ ### \_keyPath
165
+
166
+ | | |
167
+ | -------- | ---------- |
168
+ | Property | `_keyPath` |
169
+ | Type | `String` |
170
+ | Required | `true` |
171
+
172
+ The property path in the entity that should serve as the entity's \_key.
173
+
174
+ Example: `email`
175
+
176
+ Note: You do <b>not</b> need to use templating here (i.e. `%entity.id%`). You
177
+ simply need to enter the name of the property you would like to use as the
178
+ entity's \_key.
179
+
180
+ ### staticFields
181
+
182
+ | | |
183
+ | -------- | -------------- |
184
+ | Property | `staticFields` |
185
+ | Type | `Object` |
186
+ | Required | `false` |
187
+
188
+ Properties that will appear on all generated entities in the step.
189
+
190
+ Example:
191
+
192
+ ```
193
+ {
194
+ bocchi: "the rock"
195
+ shiba: "inu"
196
+ }
197
+ ```
198
+
199
+ ### fieldMappings
200
+
201
+ | | |
202
+ | -------- | --------------- |
203
+ | Property | `fieldMappings` |
204
+ | Type | `Object` |
205
+ | Required | `false` |
206
+
207
+ Optionally specify mappings to convert data to entity properties.
208
+
209
+ Example:
210
+
211
+ <i>Original data:</i>
212
+
213
+ ```json
214
+ {
215
+ "id": 1,
216
+ "foo": {
217
+ "bar": 2,
218
+ "baz": ["123"]
219
+ }
220
+ }
221
+ ```
222
+
223
+ <i>fieldMappings:</i>
224
+
225
+ ```json
226
+ {
227
+ "id": "id",
228
+ "name": "foo.bar",
229
+ "groups": "foo.baz"
230
+ }
231
+ ```
232
+
233
+ <i>Resulting entity:</i>
234
+
235
+ ```json
236
+ {
237
+ "id": 1,
238
+ "name": 2,
239
+ "groups": ["123"]
240
+ }
241
+ ```
242
+
243
+ ## parentAssociation
244
+
245
+ | | |
246
+ | -------- | ------------------ |
247
+ | Property | `parentEntityType` |
248
+ | Type | `Object` |
249
+ | Required | `false` |
250
+
251
+ To be used if the step follows the
252
+ [Fetch Child Entities](https://github.com/JupiterOne/sdk/blob/main/docs/integrations/step-patterns.md#fetch-child-entities-step-pattern)
253
+ pattern - that is, to get the entities associated with this step, a parent
254
+ entity's \_key is needed.
255
+
256
+ Note: while `parentAssociation` is optional, if it is provided, then both of its
257
+ fields, `parentEntityType` and `relationshipClass` (below), are required.
258
+
259
+ Example:
260
+
261
+ ```
262
+ {
263
+ "parentEntityType": "bocchi_organization",
264
+ "relationshipClass": "HAS"
265
+ }
266
+ ```
267
+
268
+ ### parentEntityType
269
+
270
+ | | |
271
+ | -------- | ------------------ |
272
+ | Property | `parentEntityType` |
273
+ | Type | `string` |
274
+ | Required | `true` |
275
+
276
+ The type of the parent entity.
277
+
278
+ Example: `signal_sciences_organization`
279
+
280
+ ### relationshipClass
281
+
282
+ | | |
283
+ | -------- | ------------------- |
284
+ | Property | `relationshipClass` |
285
+ | Type | `string` |
286
+ | Required | `true` |
287
+
288
+ The class of relationship to the parent entity. The value should be a valid
289
+ relationship class.
290
+
291
+ Example: `HAS`
292
+
293
+ ## request
294
+
295
+ | | |
296
+ | -------- | --------- |
297
+ | Property | `request` |
298
+ | Type | `Object` |
299
+ | Required | `true` |
300
+
301
+ Information about the API request for this step.
302
+
303
+ Example:
304
+
305
+ ```json
306
+ {
307
+ "urlTemplate": "/users",
308
+ "method": "GET"
309
+ }
310
+ ```
311
+
312
+ ### urlTemplate
313
+
314
+ | | |
315
+ | ------------------- | -------------------- |
316
+ | Property | `urlTemplate` |
317
+ | Type | `String` |
318
+ | Required | `true` |
319
+ | Available templates | `parent` `nextToken` |
320
+
321
+ The URL to make a request to. You can iterate entities with this step by
322
+ including the format `%parent.PROPERTY%` in the URL.
323
+
324
+ Example:
325
+
326
+ ```json
327
+ {
328
+ "urlTemplate": "/users?nextPage=%nextToken%&limit=100"
329
+ }
330
+ ```
331
+
332
+ ```json
333
+ {
334
+ "urlTemplate": "/corps/%parent._key%/test/%parent._otherKey%/cloudwafInstances"
335
+ }
336
+ ```
337
+
338
+ ### method
339
+
340
+ | | |
341
+ | -------- | -------- |
342
+ | Property | `method` |
343
+ | Type | `String` |
344
+ | Required | `false` |
345
+
346
+ The request method. Accepts `GET` or `POST`. Defaults to `GET`.
347
+
348
+ ### params
349
+
350
+ | | |
351
+ | ------------------- | ----------- |
352
+ | Property | `params` |
353
+ | Type | `Object` |
354
+ | Required | `false` |
355
+ | Available templates | `nextToken` |
356
+
357
+ Specifies the POST body.
358
+
359
+ Example:
360
+
361
+ ```json
362
+ {
363
+ "urlTemplate": "/findings",
364
+ "method": "POST",
365
+ "params": {
366
+ "nextPage": "%nextToken%",
367
+ "filter": {
368
+ "active": true
369
+ }
370
+ }
371
+ }
372
+ ```
373
+
374
+ ## response
375
+
376
+ | | |
377
+ | -------- | ---------- |
378
+ | Property | `response` |
379
+ | Type | `Object` |
380
+ | Required | `true` |
381
+
382
+ Information about the API response for this step.
383
+
384
+ Example:
385
+
386
+ ```json
387
+ {
388
+ "dataPath": "data",
389
+ "responseType": "LIST",
390
+ "nextTokenPath": "next"
391
+ }
392
+ ```
393
+
394
+ ### dataPath
395
+
396
+ | | |
397
+ | -------- | ---------- |
398
+ | Property | `dataPath` |
399
+ | Type | `String` |
400
+ | Required | `true` |
401
+
402
+ Path in the API response to iterate.
403
+
404
+ Example:
405
+
406
+ <i>API Response</i>:
407
+
408
+ ```json
409
+ {
410
+ "response": {
411
+ "data": [
412
+ { "..." },
413
+ { "..." },
414
+ { "..." },
415
+ "..."
416
+ ]
417
+ }
418
+ }
419
+ ```
420
+
421
+ <i>Template:</i>
422
+
423
+ ```json
424
+ {
425
+ "dataPath": "response.data"
426
+ }
427
+ ```
428
+
429
+ ### responseType
430
+
431
+ | | |
432
+ | -------- | -------------- |
433
+ | Property | `responseType` |
434
+ | Type | `String` |
435
+ | Required | `true` |
436
+
437
+ The type of response object. `SINGLETON` means that there is only a single thing
438
+ in the response we should make an entity for. `LIST` means that there are
439
+ multiple things we need to make entities for.
440
+
441
+ Example:
442
+
443
+ <i>Original Response:</i>
444
+
445
+ ```json
446
+ {
447
+ "data": { "bocchi": "the rock" }
448
+ }
449
+ ```
450
+
451
+ Should be a `SINGLETON`. Whereas,
452
+
453
+ <i>Original Response:</i>
454
+
455
+ ```json
456
+ {
457
+ "data": [{ "bocchi": "the rock" }, { "japan": "is nice" }]
458
+ }
459
+ ```
460
+
461
+ would be a `LIST`.
462
+
463
+ ### nextTokenPath
464
+
465
+ | | |
466
+ | -------- | ---------- |
467
+ | Property | `dataPath` |
468
+ | Type | `String` |
469
+ | Required | `false` |
470
+
471
+ Path in the API response to the nextToken.
472
+
473
+ Example:
474
+
475
+ <i>API Response:</i>
476
+
477
+ ```json
478
+ {
479
+ "response": {
480
+ "data": ["..."],
481
+ "pagination": {
482
+ "limit": 100,
483
+ "cursor": "abcd1234"
484
+ }
485
+ }
486
+ }
487
+ ```
488
+
489
+ <i>Template:</i>
490
+
491
+ ```json
492
+ {
493
+ "nextTokenPath": "response.pagination.cursor"
494
+ }
495
+ ```
496
+
497
+ ## directRelationships
498
+
499
+ | | |
500
+ | -------- | --------------------- |
501
+ | Property | `directRelationships` |
502
+ | Type | `Object[]` |
503
+ | Required | `false` |
504
+
505
+ Example:
506
+
507
+ ```json
508
+ [
509
+ {
510
+ "targetKey": "corps",
511
+ "targetType": "signal_sciences_user",
512
+ "_class": "HAS",
513
+ "direction": "FORWARD"
514
+ },
515
+ {
516
+ "targetKey": "corps",
517
+ "targetType": "signal_sciences_user",
518
+ "_class": "HAS",
519
+ "direction": "REVERSE"
520
+ }
521
+ ]
522
+ ```
523
+
524
+ ### targetKey
525
+
526
+ | | |
527
+ | -------- | ----------- |
528
+ | Property | `targetKey` |
529
+ | Type | `String` |
530
+ | Required | `true` |
531
+
532
+ The `_key` property of the target entity.
533
+
534
+ Example: `%entity.organizationId%`
535
+
536
+ ### targetType
537
+
538
+ | | |
539
+ | -------- | ------------ |
540
+ | Property | `targetType` |
541
+ | Type | `String` |
542
+ | Required | `true` |
543
+
544
+ The `_type` of the target entity.
545
+
546
+ ### \_class
547
+
548
+ | | |
549
+ | -------- | -------- |
550
+ | Property | `_class` |
551
+ | Type | `String` |
552
+ | Required | `true` |
553
+
554
+ The `_class` of the relationship.
555
+
556
+ ### direction
557
+
558
+ | | |
559
+ | -------- | ----------- |
560
+ | Property | `direction` |
561
+ | Type | `String` |
562
+ | Required | `true` |
563
+
564
+ The direction of the relationship. `FORWARD` to build the relationship FROM
565
+ entity TO target. `REVERSE` to build the relationship TO target FROM reverse.
566
+
567
+ ## mappedRelationships
568
+
569
+ | | |
570
+ | -------- | --------------------- |
571
+ | Property | `mappedRelationships` |
572
+ | Type | `Object[]` |
573
+ | Required | `false` |
574
+
575
+ Example:
576
+
577
+ ```json
578
+ [
579
+ {
580
+ "_class": "IS",
581
+ "direction": "REVERSE",
582
+ "fieldMappings": [
583
+ {
584
+ "targetValue": "google_user",
585
+ "targetProperty": "_type"
586
+ },
587
+ {
588
+ "sourceProperty": "email",
589
+ "targetProperty": "email"
590
+ }
591
+ ]
592
+ }
593
+ ]
594
+ ```
595
+
596
+ ### \_class
597
+
598
+ | | |
599
+ | -------- | -------- |
600
+ | Property | `_class` |
601
+ | Type | `String` |
602
+ | Required | `true` |
603
+
604
+ `_class` of the relationship. Should be a valid relationship class.
605
+
606
+ ### direction
607
+
608
+ | | |
609
+ | -------- | ----------- |
610
+ | Property | `direction` |
611
+ | Type | `String` |
612
+ | Required | `true` |
613
+
614
+ The direction of the mapped relationship. `FORWARD` to build the relationship
615
+ FROM entity TO target. `REVERSE` to build the relationship TO target FROM
616
+ reverse.
617
+
618
+ ### mappings
619
+
620
+ | | |
621
+ | -------- | ---------- |
622
+ | Property | `mappings` |
623
+ | Type | `Object` |
624
+ | Required | `true` |
625
+
626
+ `targetProperty` are the `targetFilterKeys` of the mapped relationship.
627
+
628
+ You can use `sourceProperty` to use a property from the current entity or
629
+ `targetValue` to use a static value.
630
+
631
+ Example:
632
+
633
+ ```json
634
+ [
635
+ {
636
+ "targetProperty": "_type",
637
+ "targetValue": "CIDR"
638
+ },
639
+ {
640
+ "targetProperty": "cidr",
641
+ "sourceProperty": "_key"
642
+ }
643
+ ]
644
+ ```
645
+
646
+ ## dependsOn
647
+
648
+ | | |
649
+ | -------- | ----------- |
650
+ | Property | `dependsOn` |
651
+ | Type | `String[]` |
652
+ | Required | `false` |
653
+
654
+ List of steps this step depends on.
655
+
656
+ Example: `["fetch-organizations"]`
@@ -0,0 +1,26 @@
1
+ {{#if directRelationships}}
2
+ {{#with (getDirectRelationships this)}}
3
+ {{#each this}}
4
+ export async function build{{pascalCase sourceStep.entity.name}}{{pascalCase relationshipClass}}{{pascalCase targetStep.entity.name}}Relationships({
5
+ jobState,
6
+ }: IntegrationStepExecutionContext<IntegrationConfig>): Promise<void> {
7
+ await jobState.iterateEntities(
8
+ { _type: Entities.{{constantCase step.entity.name}}._type },
9
+ async (entity) => {
10
+ const relatedEntity = await jobState.findEntity(entity.{{targetKey}} as string);
11
+ if (!relatedEntity) return;
12
+
13
+ await jobState.addRelationship(
14
+ createDirectRelationship({
15
+ from: {{#if forward}}entity{{else}}relatedEntity{{/if}},
16
+ _class: RelationshipClass.{{constantCase relationshipClass}},
17
+ to: {{#if forward}}relatedEntity{{else}}entity{{/if}},
18
+ }),
19
+ );
20
+ },
21
+ );
22
+ }
23
+
24
+ {{/each}}
25
+ {{/with}}
26
+ {{/if}}
@@ -0,0 +1,36 @@
1
+ {{#if mappedRelationships}}
2
+ export async function build{{pascalCase entity.name}}MappedRelationships({
3
+ jobState,
4
+ }: IntegrationStepExecutionContext<IntegrationConfig>): Promise<void> {
5
+ await jobState.iterateEntities(
6
+ { _type: Entities.{{constantCase entity.name}}._type },
7
+ async (entity: PrimitiveEntity) => {
8
+ {{#each mappedRelationships}}
9
+ await jobState.addRelationship(createMappedRelationship({
10
+ _class: RelationshipClass.{{constantCase _class}},
11
+ _mapping: {
12
+ sourceEntityKey: entity._key,
13
+ relationshipDirection: RelationshipDirection.{{constantCase direction}},
14
+ targetFilterKeys: [[
15
+ {{#each mappings}}
16
+ '{{targetProperty}}',
17
+ {{/each}}
18
+ ]],
19
+ targetEntity: {
20
+ {{#each mappings}}
21
+ {{#if targetValue}}
22
+ {{targetProperty}}: '{{targetValue}}',
23
+ {{/if}}
24
+ {{#if sourceProperty}}
25
+ {{targetProperty}}: entity.{{sourceProperty}},
26
+ {{/if}}
27
+ {{/each}}
28
+ }
29
+ }
30
+ }))
31
+ {{/each}}
32
+ },
33
+ );
34
+ }
35
+
36
+ {{/if}}