@transcend-io/cli 2.2.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 (95) hide show
  1. package/.yarn/sdks/eslint/package.json +6 -0
  2. package/.yarn/sdks/prettier/package.json +6 -0
  3. package/.yarn/sdks/typescript/package.json +6 -0
  4. package/LICENSE +21 -0
  5. package/README.md +301 -0
  6. package/build/cli-pull.d.ts +3 -0
  7. package/build/cli-pull.d.ts.map +1 -0
  8. package/build/cli-pull.js +53 -0
  9. package/build/cli-pull.js.map +1 -0
  10. package/build/cli-push.d.ts +3 -0
  11. package/build/cli-push.d.ts.map +1 -0
  12. package/build/cli-push.js +82 -0
  13. package/build/cli-push.js.map +1 -0
  14. package/build/codecs.d.ts +541 -0
  15. package/build/codecs.d.ts.map +1 -0
  16. package/build/codecs.js +216 -0
  17. package/build/codecs.js.map +1 -0
  18. package/build/constants.d.ts +2 -0
  19. package/build/constants.d.ts.map +1 -0
  20. package/build/constants.js +5 -0
  21. package/build/constants.js.map +1 -0
  22. package/build/fetchApiKeys.d.ts +21 -0
  23. package/build/fetchApiKeys.d.ts.map +1 -0
  24. package/build/fetchApiKeys.js +56 -0
  25. package/build/fetchApiKeys.js.map +1 -0
  26. package/build/fetchDataSubjects.d.ts +40 -0
  27. package/build/fetchDataSubjects.d.ts.map +1 -0
  28. package/build/fetchDataSubjects.js +85 -0
  29. package/build/fetchDataSubjects.js.map +1 -0
  30. package/build/fetchIdentifiers.d.ts +27 -0
  31. package/build/fetchIdentifiers.d.ts.map +1 -0
  32. package/build/fetchIdentifiers.js +83 -0
  33. package/build/fetchIdentifiers.js.map +1 -0
  34. package/build/gqls.d.ts +16 -0
  35. package/build/gqls.d.ts.map +1 -0
  36. package/build/gqls.js +310 -0
  37. package/build/gqls.js.map +1 -0
  38. package/build/index.d.ts +4 -0
  39. package/build/index.d.ts.map +1 -0
  40. package/build/index.js +16 -0
  41. package/build/index.js.map +1 -0
  42. package/build/logger.d.ts +2 -0
  43. package/build/logger.d.ts.map +1 -0
  44. package/build/logger.js +5 -0
  45. package/build/logger.js.map +1 -0
  46. package/build/pullTranscendConfiguration.d.ts +11 -0
  47. package/build/pullTranscendConfiguration.d.ts.map +1 -0
  48. package/build/pullTranscendConfiguration.js +95 -0
  49. package/build/pullTranscendConfiguration.js.map +1 -0
  50. package/build/readTranscendYaml.d.ts +19 -0
  51. package/build/readTranscendYaml.d.ts.map +1 -0
  52. package/build/readTranscendYaml.js +47 -0
  53. package/build/readTranscendYaml.js.map +1 -0
  54. package/build/syncConfigurationToTranscend.d.ts +11 -0
  55. package/build/syncConfigurationToTranscend.d.ts.map +1 -0
  56. package/build/syncConfigurationToTranscend.js +96 -0
  57. package/build/syncConfigurationToTranscend.js.map +1 -0
  58. package/build/syncDataSilos.d.ts +144 -0
  59. package/build/syncDataSilos.d.ts.map +1 -0
  60. package/build/syncDataSilos.js +178 -0
  61. package/build/syncDataSilos.js.map +1 -0
  62. package/build/syncEnrichers.d.ts +45 -0
  63. package/build/syncEnrichers.d.ts.map +1 -0
  64. package/build/syncEnrichers.js +69 -0
  65. package/build/syncEnrichers.js.map +1 -0
  66. package/build/tests/fetchApiKeys.test.d.ts +1 -0
  67. package/build/tests/fetchApiKeys.test.d.ts.map +1 -0
  68. package/build/tests/fetchApiKeys.test.js +3 -0
  69. package/build/tests/fetchApiKeys.test.js.map +1 -0
  70. package/build/tests/fetchDataSubjects.test.d.ts +1 -0
  71. package/build/tests/fetchDataSubjects.test.d.ts.map +1 -0
  72. package/build/tests/fetchDataSubjects.test.js +3 -0
  73. package/build/tests/fetchDataSubjects.test.js.map +1 -0
  74. package/build/tests/fetchIdentifiers.test.d.ts +1 -0
  75. package/build/tests/fetchIdentifiers.test.d.ts.map +1 -0
  76. package/build/tests/fetchIdentifiers.test.js +3 -0
  77. package/build/tests/fetchIdentifiers.test.js.map +1 -0
  78. package/build/tests/main.test.d.ts +1 -0
  79. package/build/tests/main.test.d.ts.map +1 -0
  80. package/build/tests/main.test.js +6 -0
  81. package/build/tests/main.test.js.map +1 -0
  82. package/build/tests/readTranscendYaml.test.d.ts +2 -0
  83. package/build/tests/readTranscendYaml.test.d.ts.map +1 -0
  84. package/build/tests/readTranscendYaml.test.js +38 -0
  85. package/build/tests/readTranscendYaml.test.js.map +1 -0
  86. package/build/tests/syncDataSilos.test.d.ts +1 -0
  87. package/build/tests/syncDataSilos.test.d.ts.map +1 -0
  88. package/build/tests/syncDataSilos.test.js +3 -0
  89. package/build/tests/syncDataSilos.test.js.map +1 -0
  90. package/build/tests/syncEnrichers.test.d.ts +1 -0
  91. package/build/tests/syncEnrichers.test.d.ts.map +1 -0
  92. package/build/tests/syncEnrichers.test.js +3 -0
  93. package/build/tests/syncEnrichers.test.js.map +1 -0
  94. package/build/tsbuildinfo +1 -0
  95. package/package.json +70 -0
package/build/gqls.js ADDED
@@ -0,0 +1,310 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CREATE_DATA_SILO = exports.UPDATE_OR_CREATE_DATA_POINT = exports.CREATE_DATA_SUBJECT = exports.DATA_SUBJECTS = exports.UPDATE_DATA_SILO = exports.DATA_POINTS = exports.DATA_SILO = exports.DATA_SILOS = exports.UPDATE_ENRICHER = exports.CREATE_ENRICHER = exports.CREATE_IDENTIFIER = exports.NEW_IDENTIFIER_TYPES = exports.API_KEYS = exports.IDENTIFIERS = exports.ENRICHERS = void 0;
4
+ const graphql_request_1 = require("graphql-request");
5
+ exports.ENRICHERS = (0, graphql_request_1.gql) `
6
+ query SchemaSyncEnrichers($title: String, $first: Int!, $offset: Int!) {
7
+ enrichers(filterBy: { text: $title }, first: $first, offset: $offset) {
8
+ nodes {
9
+ id
10
+ title
11
+ url
12
+ type
13
+ inputIdentifier {
14
+ name
15
+ }
16
+ identifiers {
17
+ name
18
+ }
19
+ actions
20
+ }
21
+ }
22
+ }
23
+ `;
24
+ exports.IDENTIFIERS = (0, graphql_request_1.gql) `
25
+ query SchemaSyncIdentifiers($first: Int!, $offset: Int!) {
26
+ identifiers(first: $first, offset: $offset) {
27
+ nodes {
28
+ id
29
+ name
30
+ }
31
+ }
32
+ }
33
+ `;
34
+ exports.API_KEYS = (0, graphql_request_1.gql) `
35
+ query SchemaSyncApiKeys($first: Int!, $offset: Int!, $titles: [String!]) {
36
+ apiKeys(first: $first, offset: $offset, filterBy: { titles: $titles }) {
37
+ nodes {
38
+ id
39
+ title
40
+ }
41
+ }
42
+ }
43
+ `;
44
+ exports.NEW_IDENTIFIER_TYPES = (0, graphql_request_1.gql) `
45
+ query SchemaSyncNewIdentifierTypes {
46
+ newIdentifierTypes {
47
+ name
48
+ }
49
+ }
50
+ `;
51
+ exports.CREATE_IDENTIFIER = (0, graphql_request_1.gql) `
52
+ mutation SchemaSyncCreateIdentifier($name: String!, $type: IdentifierType!) {
53
+ createIdentifier(input: { name: $name, type: $type }) {
54
+ identifier {
55
+ id
56
+ name
57
+ }
58
+ }
59
+ }
60
+ `;
61
+ exports.CREATE_ENRICHER = (0, graphql_request_1.gql) `
62
+ mutation SchemaSyncCreateEnricher(
63
+ $title: String!
64
+ $description: String!
65
+ $url: String!
66
+ $inputIdentifier: ID!
67
+ $identifiers: [ID!]!
68
+ $actions: [RequestAction!]!
69
+ ) {
70
+ createEnricher(
71
+ input: {
72
+ title: $title
73
+ type: SERVER
74
+ description: $description
75
+ url: $url
76
+ inputIdentifier: $inputIdentifier
77
+ identifiers: $identifiers
78
+ actions: $actions
79
+ }
80
+ ) {
81
+ clientMutationId
82
+ }
83
+ }
84
+ `;
85
+ exports.UPDATE_ENRICHER = (0, graphql_request_1.gql) `
86
+ mutation SchemaSyncUpdateEnricher(
87
+ $id: ID!
88
+ $title: String!
89
+ $description: String!
90
+ $url: String!
91
+ $inputIdentifier: ID!
92
+ $identifiers: [ID!]!
93
+ $actions: [RequestAction!]!
94
+ ) {
95
+ updateEnricher(
96
+ input: {
97
+ id: $id
98
+ title: $title
99
+ description: $description
100
+ url: $url
101
+ inputIdentifier: $inputIdentifier
102
+ identifiers: $identifiers
103
+ actions: $actions
104
+ }
105
+ ) {
106
+ clientMutationId
107
+ }
108
+ }
109
+ `;
110
+ exports.DATA_SILOS = (0, graphql_request_1.gql) `
111
+ query SchemaSyncDataSilos(
112
+ $title: String
113
+ $ids: [ID!]
114
+ $first: Int!
115
+ $offset: Int!
116
+ ) {
117
+ dataSilos(
118
+ filterBy: { text: $title, ids: $ids }
119
+ first: $first
120
+ offset: $offset
121
+ ) {
122
+ nodes {
123
+ id
124
+ title
125
+ link
126
+ type
127
+ }
128
+ }
129
+ }
130
+ `;
131
+ exports.DATA_SILO = (0, graphql_request_1.gql) `
132
+ query SchemaSyncDataSilo($id: String!) {
133
+ dataSilo(id: $id) {
134
+ id
135
+ title
136
+ description
137
+ type
138
+ url
139
+ notifyEmailAddress
140
+ apiKeys {
141
+ title
142
+ }
143
+ subjectBlocklist {
144
+ type
145
+ }
146
+ identifiers {
147
+ name
148
+ isConnected
149
+ }
150
+ dependentDataSilos {
151
+ title
152
+ }
153
+ owners {
154
+ email
155
+ }
156
+ isLive
157
+ }
158
+ }
159
+ `;
160
+ exports.DATA_POINTS = (0, graphql_request_1.gql) `
161
+ query SchemaSyncDataPoints($dataSiloIds: [ID!], $first: Int!, $offset: Int!) {
162
+ dataPoints(
163
+ filterBy: { dataSilos: $dataSiloIds }
164
+ first: $first
165
+ offset: $offset
166
+ ) {
167
+ totalCount
168
+ nodes {
169
+ id
170
+ title {
171
+ defaultMessage
172
+ }
173
+ description {
174
+ defaultMessage
175
+ }
176
+ name
177
+ purpose
178
+ category
179
+ actionSettings {
180
+ type
181
+ active
182
+ }
183
+ dbIntegrationQueries {
184
+ query
185
+ suggestedQuery
186
+ requestType
187
+ }
188
+ }
189
+ }
190
+ }
191
+ `;
192
+ exports.UPDATE_DATA_SILO = (0, graphql_request_1.gql) `
193
+ mutation SchemaSyncUpdateDataSilo(
194
+ $id: ID!
195
+ $title: String
196
+ $description: String
197
+ $url: String
198
+ $notifyEmailAddress: String
199
+ $identifiers: [String!]
200
+ $isLive: Boolean
201
+ $dataSubjectBlockListIds: [ID!]
202
+ $dependedOnDataSiloTitles: [String!]
203
+ $ownerEmails: [String!]
204
+ $apiKeyId: ID
205
+ ) {
206
+ updateDataSilo(
207
+ input: {
208
+ id: $id
209
+ title: $title
210
+ description: $description
211
+ url: $url
212
+ notifyEmailAddress: $notifyEmailAddress
213
+ identifiers: $identifiers
214
+ isLive: $isLive
215
+ dataSubjectBlockListIds: $dataSubjectBlockListIds
216
+ dependedOnDataSiloTitles: $dependedOnDataSiloTitles
217
+ ownerEmails: $ownerEmails
218
+ apiKeyId: $apiKeyId
219
+ }
220
+ ) {
221
+ clientMutationId
222
+ }
223
+ }
224
+ `;
225
+ exports.DATA_SUBJECTS = (0, graphql_request_1.gql) `
226
+ query SchemaDataSubjects {
227
+ internalSubjects {
228
+ id
229
+ type
230
+ }
231
+ }
232
+ `;
233
+ exports.CREATE_DATA_SUBJECT = (0, graphql_request_1.gql) `
234
+ mutation SchemaSyncCreateDataSubject($type: String!) {
235
+ createSubject(input: { type: $type, title: $type, subjectClass: OTHER }) {
236
+ subject {
237
+ id
238
+ type
239
+ }
240
+ }
241
+ }
242
+ `;
243
+ exports.UPDATE_OR_CREATE_DATA_POINT = (0, graphql_request_1.gql) `
244
+ mutation SchemaSyncUpdateOrCreateDataPoint(
245
+ $dataSiloId: ID!
246
+ $name: String!
247
+ $title: String
248
+ $description: String
249
+ $category: DataCategoryType
250
+ $purpose: ProcessingPurpose
251
+ $querySuggestions: [DbIntegrationQuerySuggestionInput!]
252
+ $enabledActions: [RequestActionObjectResolver!]
253
+ ) {
254
+ updateOrCreateDataPoint(
255
+ input: {
256
+ dataSiloId: $dataSiloId
257
+ name: $name
258
+ title: $title
259
+ description: $description
260
+ querySuggestions: $querySuggestions
261
+ category: $category
262
+ purpose: $purpose
263
+ enabledActions: $enabledActions
264
+ }
265
+ ) {
266
+ dataPoint {
267
+ id
268
+ name
269
+ }
270
+ }
271
+ }
272
+ `;
273
+ exports.CREATE_DATA_SILO = (0, graphql_request_1.gql) `
274
+ mutation SchemaSyncCreateDataSilo(
275
+ $title: String!
276
+ $description: String!
277
+ $url: String
278
+ $type: String!
279
+ $identifiers: [String!]
280
+ $isLive: Boolean!
281
+ $notifyEmailAddress: String
282
+ $dataSubjectBlockListIds: [ID!]
283
+ $dependedOnDataSiloTitles: [String!]
284
+ $ownerEmails: [String!]
285
+ $apiKeyId: ID
286
+ ) {
287
+ connectDataSilo(
288
+ input: {
289
+ name: $type
290
+ title: $title
291
+ description: $description
292
+ url: $url
293
+ notifyEmailAddress: $notifyEmailAddress
294
+ identifiers: $identifiers
295
+ isLive: $isLive
296
+ dataSubjectBlockListIds: $dataSubjectBlockListIds
297
+ dependedOnDataSiloTitles: $dependedOnDataSiloTitles
298
+ ownerEmails: $ownerEmails
299
+ apiKeyId: $apiKeyId
300
+ }
301
+ ) {
302
+ dataSilo {
303
+ id
304
+ title
305
+ type
306
+ }
307
+ }
308
+ }
309
+ `;
310
+ //# sourceMappingURL=gqls.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gqls.js","sourceRoot":"","sources":["../src/gqls.ts"],"names":[],"mappings":";;;AAAA,qDAAsC;AAEzB,QAAA,SAAS,GAAG,IAAA,qBAAG,EAAA;;;;;;;;;;;;;;;;;;CAkB3B,CAAC;AAEW,QAAA,WAAW,GAAG,IAAA,qBAAG,EAAA;;;;;;;;;CAS7B,CAAC;AAEW,QAAA,QAAQ,GAAG,IAAA,qBAAG,EAAA;;;;;;;;;CAS1B,CAAC;AAEW,QAAA,oBAAoB,GAAG,IAAA,qBAAG,EAAA;;;;;;CAMtC,CAAC;AAEW,QAAA,iBAAiB,GAAG,IAAA,qBAAG,EAAA;;;;;;;;;CASnC,CAAC;AAEW,QAAA,eAAe,GAAG,IAAA,qBAAG,EAAA;;;;;;;;;;;;;;;;;;;;;;;CAuBjC,CAAC;AAEW,QAAA,eAAe,GAAG,IAAA,qBAAG,EAAA;;;;;;;;;;;;;;;;;;;;;;;;CAwBjC,CAAC;AAEW,QAAA,UAAU,GAAG,IAAA,qBAAG,EAAA;;;;;;;;;;;;;;;;;;;;CAoB5B,CAAC;AAEW,QAAA,SAAS,GAAG,IAAA,qBAAG,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4B3B,CAAC;AAEW,QAAA,WAAW,GAAG,IAAA,qBAAG,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+B7B,CAAC;AAEW,QAAA,gBAAgB,GAAG,IAAA,qBAAG,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgClC,CAAC;AAEW,QAAA,aAAa,GAAG,IAAA,qBAAG,EAAA;;;;;;;CAO/B,CAAC;AAEW,QAAA,mBAAmB,GAAG,IAAA,qBAAG,EAAA;;;;;;;;;CASrC,CAAC;AAEW,QAAA,2BAA2B,GAAG,IAAA,qBAAG,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6B7C,CAAC;AAEW,QAAA,gBAAgB,GAAG,IAAA,qBAAG,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoClC,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from './codecs';
2
+ export * from './readTranscendYaml';
3
+ export * from './syncConfigurationToTranscend';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,qBAAqB,CAAC;AACpC,cAAc,gCAAgC,CAAC"}
package/build/index.js ADDED
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./codecs"), exports);
14
+ __exportStar(require("./readTranscendYaml"), exports);
15
+ __exportStar(require("./syncConfigurationToTranscend"), exports);
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAyB;AACzB,sDAAoC;AACpC,iEAA+C"}
@@ -0,0 +1,2 @@
1
+ export declare const logger: Console;
2
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM,SAAU,CAAC"}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.logger = void 0;
4
+ exports.logger = console;
5
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":";;;AAAa,QAAA,MAAM,GAAG,OAAO,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { TranscendInput } from './codecs';
2
+ import { GraphQLClient } from 'graphql-request';
3
+ /**
4
+ * Pull a yaml configuration from Transcend
5
+ *
6
+ * @param client - GraphQL client
7
+ * @param dataSiloIds - The data silos to sync. If empty list, pull all.
8
+ * @returns The configuration
9
+ */
10
+ export declare function pullTranscendConfiguration(client: GraphQLClient, dataSiloIds: string[]): Promise<TranscendInput>;
11
+ //# sourceMappingURL=pullTranscendConfiguration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pullTranscendConfiguration.d.ts","sourceRoot":"","sources":["../src/pullTranscendConfiguration.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EAIf,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAYhD;;;;;;GAMG;AACH,wBAAsB,0BAA0B,CAC9C,MAAM,EAAE,aAAa,EACrB,WAAW,EAAE,MAAM,EAAE,GACpB,OAAO,CAAC,cAAc,CAAC,CAkHzB"}
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.pullTranscendConfiguration = void 0;
7
+ const flatten_1 = __importDefault(require("lodash/flatten"));
8
+ const keyBy_1 = __importDefault(require("lodash/keyBy"));
9
+ const mapValues_1 = __importDefault(require("lodash/mapValues"));
10
+ const syncDataSilos_1 = require("./syncDataSilos");
11
+ const fetchDataSubjects_1 = require("./fetchDataSubjects");
12
+ const fetchApiKeys_1 = require("./fetchApiKeys");
13
+ const syncEnrichers_1 = require("./syncEnrichers");
14
+ /**
15
+ * Pull a yaml configuration from Transcend
16
+ *
17
+ * @param client - GraphQL client
18
+ * @param dataSiloIds - The data silos to sync. If empty list, pull all.
19
+ * @returns The configuration
20
+ */
21
+ async function pullTranscendConfiguration(client, dataSiloIds) {
22
+ const [dataSubjects, apiKeyTitleMap, dataSilos, enrichers] = await Promise.all([
23
+ // Grab all data subjects in the organization
24
+ (0, fetchDataSubjects_1.fetchDataSubjects)({}, client, true),
25
+ // Grab API keys
26
+ (0, fetchApiKeys_1.fetchApiKeys)({}, client, true),
27
+ // Fetch the data silos
28
+ (0, syncDataSilos_1.fetchEnrichedDataSilos)(client, { ids: dataSiloIds }),
29
+ // Fetch enrichers
30
+ (0, syncEnrichers_1.fetchAllEnrichers)(client),
31
+ ]);
32
+ const result = {};
33
+ // Save API keys
34
+ const apiKeyTitles = (0, flatten_1.default)(dataSilos.map(([{ apiKeys }]) => apiKeys.map(({ title }) => title)));
35
+ const relevantApiKeys = Object.values(apiKeyTitleMap).filter(({ title }) => apiKeyTitles.includes(title));
36
+ if (relevantApiKeys.length > 0) {
37
+ result['api-keys'] = Object.values(apiKeyTitleMap)
38
+ .filter(({ title }) => apiKeyTitles.includes(title))
39
+ .map(({ title }) => ({
40
+ title,
41
+ }));
42
+ }
43
+ // Save enrichers
44
+ if (enrichers.length > 0 && dataSiloIds.length === 0) {
45
+ result.enrichers = enrichers
46
+ .filter(({ type }) => type === 'SERVER')
47
+ .map(({ title, url, inputIdentifier, identifiers, actions, }) => ({
48
+ title,
49
+ url,
50
+ 'input-identifier': inputIdentifier.name,
51
+ 'output-identifiers': identifiers.map(({ name }) => name),
52
+ 'privacy-actions': actions,
53
+ }));
54
+ }
55
+ // Save data silos
56
+ result['data-silos'] = dataSilos.map(([{ title, description, url, type, apiKeys, notifyEmailAddress, identifiers, dependentDataSilos, owners, subjectBlocklist, isLive, }, dataPoints,]) => {
57
+ var _a;
58
+ return ({
59
+ title,
60
+ description,
61
+ integrationName: type,
62
+ url: url || undefined,
63
+ 'api-key-title': (_a = apiKeys[0]) === null || _a === void 0 ? void 0 : _a.title,
64
+ 'identity-keys': identifiers
65
+ .filter(({ isConnected }) => isConnected)
66
+ .map(({ name }) => name),
67
+ 'notify-email-address': notifyEmailAddress,
68
+ 'deletion-dependencies': dependentDataSilos.map(({ title }) => title),
69
+ owners: owners.map(({ email }) => email),
70
+ disabled: !isLive,
71
+ 'data-subjects': subjectBlocklist.length > 0
72
+ ? (0, fetchDataSubjects_1.convertToDataSubjectAllowlist)(subjectBlocklist.map(({ type }) => type), dataSubjects)
73
+ : undefined,
74
+ datapoints: dataPoints.map((dataPoint) => ({
75
+ title: dataPoint.title.defaultMessage,
76
+ description: dataPoint.description.defaultMessage,
77
+ key: dataPoint.name,
78
+ purpose: dataPoint.purpose,
79
+ category: dataPoint.category,
80
+ ...(dataPoint.dbIntegrationQueries.length > 0
81
+ ? {
82
+ 'privacy-action-queries': (0, mapValues_1.default)((0, keyBy_1.default)(dataPoint.dbIntegrationQueries, 'requestType'), (databaseIntegrationQuery) => databaseIntegrationQuery.suggestedQuery ||
83
+ databaseIntegrationQuery.query),
84
+ }
85
+ : {}),
86
+ 'privacy-actions': dataPoint.actionSettings
87
+ .filter(({ active }) => active)
88
+ .map(({ type }) => type),
89
+ })),
90
+ });
91
+ });
92
+ return result;
93
+ }
94
+ exports.pullTranscendConfiguration = pullTranscendConfiguration;
95
+ //# sourceMappingURL=pullTranscendConfiguration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pullTranscendConfiguration.js","sourceRoot":"","sources":["../src/pullTranscendConfiguration.ts"],"names":[],"mappings":";;;;;;AAOA,6DAAqC;AACrC,yDAAiC;AACjC,iEAAyC;AACzC,mDAAyD;AACzD,2DAG6B;AAC7B,iDAA8C;AAC9C,mDAAoD;AAEpD;;;;;;GAMG;AACI,KAAK,UAAU,0BAA0B,CAC9C,MAAqB,EACrB,WAAqB;IAErB,MAAM,CAAC,YAAY,EAAE,cAAc,EAAE,SAAS,EAAE,SAAS,CAAC,GACxD,MAAM,OAAO,CAAC,GAAG,CAAC;QAChB,6CAA6C;QAC7C,IAAA,qCAAiB,EAAC,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC;QACnC,gBAAgB;QAChB,IAAA,2BAAY,EAAC,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC;QAC9B,uBAAuB;QACvB,IAAA,sCAAsB,EAAC,MAAM,EAAE,EAAE,GAAG,EAAE,WAAW,EAAE,CAAC;QACpD,kBAAkB;QAClB,IAAA,iCAAiB,EAAC,MAAM,CAAC;KAC1B,CAAC,CAAC;IAEL,MAAM,MAAM,GAAmB,EAAE,CAAC;IAElC,gBAAgB;IAChB,MAAM,YAAY,GAAG,IAAA,iBAAO,EAC1B,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,C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BAC1B,QAAQ,EAAE,SAAS,CAAC,QAAQ;gBAC5B,GAAG,CAAC,SAAS,CAAC,oBAAoB,CAAC,MAAM,GAAG,CAAC;oBAC3C,CAAC,CAAC;wBACE,wBAAwB,EAAE,IAAA,mBAAS,EACjC,IAAA,eAAK,EAAC,SAAS,CAAC,oBAAoB,EAAE,aAAa,CAAC,EACpD,CAAC,wBAAwB,EAAE,EAAE,CAC3B,wBAAwB,CAAC,cAAc;4BACvC,wBAAwB,CAAC,KAAK,CACjC;qBACF;oBACH,CAAC,CAAC,EAAE,CAAC;gBACP,iBAAiB,EAAE,SAAS,CAAC,cAAc;qBACxC,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC;qBAC9B,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC;aAC3B,CAAC,CAAC;SACJ,CAAC,CAAA;KAAA,CACH,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC;AArHD,gEAqHC"}
@@ -0,0 +1,19 @@
1
+ import { ObjByString } from '@transcend-io/type-utils';
2
+ import { TranscendInput } from './codecs';
3
+ /**
4
+ * Read in the contents of a yaml file and validate that the shape
5
+ * of the yaml file matches the codec API
6
+ *
7
+ * @param filePath - Path to yaml file
8
+ * @param variables - Variables to fill in
9
+ * @returns The contents of the yaml file, type-checked
10
+ */
11
+ export declare function readTranscendYaml(filePath: string, variables?: ObjByString): TranscendInput;
12
+ /**
13
+ * Write a Transcend configuration to disk
14
+ *
15
+ * @param filePath - Path to yaml file
16
+ * @param input - The input to write out
17
+ */
18
+ export declare function writeTranscendYaml(filePath: string, input: TranscendInput): void;
19
+ //# sourceMappingURL=readTranscendYaml.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"readTranscendYaml.d.ts","sourceRoot":"","sources":["../src/readTranscendYaml.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGpE,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAI1C;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,MAAM,EAChB,SAAS,GAAE,WAAgB,GAC1B,cAAc,CAoBhB;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,cAAc,GACpB,IAAI,CAEN"}
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.writeTranscendYaml = exports.readTranscendYaml = void 0;
7
+ const type_utils_1 = require("@transcend-io/type-utils");
8
+ const js_yaml_1 = __importDefault(require("js-yaml"));
9
+ const fs_1 = require("fs");
10
+ const codecs_1 = require("./codecs");
11
+ const PARAMETERS = /<<parameters\.(.+?)>>/;
12
+ /**
13
+ * Read in the contents of a yaml file and validate that the shape
14
+ * of the yaml file matches the codec API
15
+ *
16
+ * @param filePath - Path to yaml file
17
+ * @param variables - Variables to fill in
18
+ * @returns The contents of the yaml file, type-checked
19
+ */
20
+ function readTranscendYaml(filePath, variables = {}) {
21
+ // Read in contents
22
+ let fileContents = (0, fs_1.readFileSync)(filePath, 'utf-8');
23
+ // Replace variables
24
+ Object.entries(variables).forEach(([name, value]) => {
25
+ fileContents = fileContents.split(`<<parameters.${name}>>`).join(value);
26
+ });
27
+ // Throw error if unfilled variables
28
+ if (PARAMETERS.test(fileContents)) {
29
+ const [, name] = PARAMETERS.exec(fileContents) || [];
30
+ throw new Error(`Found variable that was not set: ${name}.
31
+ Make sure you are passing all parameters through the --parameters=${name}:value-for-param flag.
32
+ Also check that there are no extra variables defined in your yaml: ${filePath}`);
33
+ }
34
+ return (0, type_utils_1.decodeCodec)(codecs_1.TranscendInput, js_yaml_1.default.load(fileContents));
35
+ }
36
+ exports.readTranscendYaml = readTranscendYaml;
37
+ /**
38
+ * Write a Transcend configuration to disk
39
+ *
40
+ * @param filePath - Path to yaml file
41
+ * @param input - The input to write out
42
+ */
43
+ function writeTranscendYaml(filePath, input) {
44
+ (0, fs_1.writeFileSync)(filePath, js_yaml_1.default.dump((0, type_utils_1.decodeCodec)(codecs_1.TranscendInput, input)));
45
+ }
46
+ exports.writeTranscendYaml = writeTranscendYaml;
47
+ //# sourceMappingURL=readTranscendYaml.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"readTranscendYaml.js","sourceRoot":"","sources":["../src/readTranscendYaml.ts"],"names":[],"mappings":";;;;;;AAAA,yDAAoE;AACpE,sDAA2B;AAC3B,2BAAiD;AACjD,qCAA0C;AAE1C,MAAM,UAAU,GAAG,uBAAuB,CAAC;AAE3C;;;;;;;GAOG;AACH,SAAgB,iBAAiB,CAC/B,QAAgB,EAChB,YAAyB,EAAE;IAE3B,mBAAmB;IACnB,IAAI,YAAY,GAAG,IAAA,iBAAY,EAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAEnD,oBAAoB;IACpB,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE;QAClD,YAAY,GAAG,YAAY,CAAC,KAAK,CAAC,gBAAgB,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC1E,CAAC,CAAC,CAAC;IAEH,oCAAoC;IACpC,IAAI,UAAU,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE;QACjC,MAAM,CAAC,EAAE,IAAI,CAAC,GAAG,UAAU,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC;QACrD,MAAM,IAAI,KAAK,CACb,oCAAoC,IAAI;oEACsB,IAAI;qEACH,QAAQ,EAAE,CAC1E,CAAC;KACH;IAED,OAAO,IAAA,wBAAW,EAAC,uBAAc,EAAE,iBAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;AAC9D,CAAC;AAvBD,8CAuBC;AAED;;;;;GAKG;AACH,SAAgB,kBAAkB,CAChC,QAAgB,EAChB,KAAqB;IAErB,IAAA,kBAAa,EAAC,QAAQ,EAAE,iBAAI,CAAC,IAAI,CAAC,IAAA,wBAAW,EAAC,uBAAc,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;AACzE,CAAC;AALD,gDAKC"}
@@ -0,0 +1,11 @@
1
+ import { TranscendInput } from './codecs';
2
+ import { GraphQLClient } from 'graphql-request';
3
+ /**
4
+ * Sync the yaml input back to Transcend using the GraphQL APIs
5
+ *
6
+ * @param input - The yml input
7
+ * @param client - GraphQL client
8
+ * @returns True if an error was encountered
9
+ */
10
+ export declare function syncConfigurationToTranscend(input: TranscendInput, client: GraphQLClient): Promise<boolean>;
11
+ //# sourceMappingURL=syncConfigurationToTranscend.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"syncConfigurationToTranscend.d.ts","sourceRoot":"","sources":["../src/syncConfigurationToTranscend.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAWhD;;;;;;GAMG;AACH,wBAAsB,4BAA4B,CAChD,KAAK,EAAE,cAAc,EACrB,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,OAAO,CAAC,CA6GlB"}
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.syncConfigurationToTranscend = void 0;
7
+ const logger_1 = require("./logger");
8
+ const colors_1 = __importDefault(require("colors"));
9
+ const bluebird_1 = require("bluebird");
10
+ const fetchIdentifiers_1 = require("./fetchIdentifiers");
11
+ const syncEnrichers_1 = require("./syncEnrichers");
12
+ const syncDataSilos_1 = require("./syncDataSilos");
13
+ const fetchDataSubjects_1 = require("./fetchDataSubjects");
14
+ const fetchApiKeys_1 = require("./fetchApiKeys");
15
+ const gqls_1 = require("./gqls");
16
+ /**
17
+ * Sync the yaml input back to Transcend using the GraphQL APIs
18
+ *
19
+ * @param input - The yml input
20
+ * @param client - GraphQL client
21
+ * @returns True if an error was encountered
22
+ */
23
+ async function syncConfigurationToTranscend(input, client) {
24
+ let encounteredError = false;
25
+ const [identifierByName, dataSubjects, apiKeyTitleMap] = await Promise.all([
26
+ // Ensure all identifiers are created and create a map from name -> identifier.id
27
+ (0, fetchIdentifiers_1.fetchIdentifiersAndCreateMissing)(input, client),
28
+ // Grab all data subjects in the organization
29
+ (0, fetchDataSubjects_1.fetchDataSubjects)(input, client),
30
+ // Grab API keys
31
+ (0, fetchApiKeys_1.fetchApiKeys)(input, client),
32
+ ]);
33
+ const { enrichers, 'data-silos': dataSilos } = input;
34
+ // Sync enrichers
35
+ if (enrichers) {
36
+ logger_1.logger.info(colors_1.default.magenta(`Syncing "${enrichers.length}" enrichers...`));
37
+ await (0, bluebird_1.mapSeries)(enrichers, async (enricher) => {
38
+ logger_1.logger.info(colors_1.default.magenta(`Syncing enricher "${enricher.title}"...`));
39
+ try {
40
+ await (0, syncEnrichers_1.syncEnricher)(enricher, client, identifierByName);
41
+ logger_1.logger.info(colors_1.default.green(`Successfully synced enricher "${enricher.title}"!`));
42
+ }
43
+ catch (err) {
44
+ encounteredError = true;
45
+ logger_1.logger.info(colors_1.default.red(`Failed to sync enricher "${enricher.title}"! - ${err.message}`));
46
+ }
47
+ });
48
+ logger_1.logger.info(colors_1.default.green(`Synced "${enrichers.length}" enrichers!`));
49
+ }
50
+ // Store dependency updates
51
+ const dependencyUpdates = [];
52
+ // Sync data silos
53
+ if (dataSilos) {
54
+ logger_1.logger.info(colors_1.default.magenta(`Syncing "${dataSilos.length}" data silos...`));
55
+ await (0, bluebird_1.mapSeries)(dataSilos, async (dataSilo) => {
56
+ logger_1.logger.info(colors_1.default.magenta(`Syncing data silo "${dataSilo.title}"...`));
57
+ try {
58
+ const dataSiloInfo = await (0, syncDataSilos_1.syncDataSilo)(dataSilo, client, dataSubjects, apiKeyTitleMap);
59
+ logger_1.logger.info(colors_1.default.green(`Successfully synced data silo "${dataSilo.title}"! View at: ${dataSiloInfo.link}`));
60
+ // Queue up dependency update
61
+ if (dataSilo['deletion-dependencies']) {
62
+ dependencyUpdates.push([
63
+ dataSiloInfo,
64
+ dataSilo['deletion-dependencies'],
65
+ ]);
66
+ }
67
+ }
68
+ catch (err) {
69
+ encounteredError = true;
70
+ logger_1.logger.info(colors_1.default.red(`Failed to sync data silo "${dataSilo.title}"! - ${err.message}`));
71
+ }
72
+ });
73
+ logger_1.logger.info(colors_1.default.green(`Synced "${dataSilos.length}" data silos!`));
74
+ }
75
+ // Dependencies updated at the end after all data silos are created
76
+ if (dependencyUpdates.length > 0) {
77
+ logger_1.logger.info(colors_1.default.magenta(`Syncing "${dependencyUpdates.length}" data silo dependencies...`));
78
+ await (0, bluebird_1.mapSeries)(dependencyUpdates, async ([dataSilo, dependencyTitles]) => {
79
+ logger_1.logger.info(colors_1.default.magenta(`Syncing dependencies for data silo "${dataSilo.title}"...`));
80
+ try {
81
+ await client.request(gqls_1.UPDATE_DATA_SILO, {
82
+ id: dataSilo.id,
83
+ dependedOnDataSiloTitles: dependencyTitles,
84
+ });
85
+ }
86
+ catch (err) {
87
+ encounteredError = true;
88
+ logger_1.logger.info(colors_1.default.red(`Failed to sync dependencies for data silo "${dataSilo.title}"! - ${err.message}`));
89
+ }
90
+ });
91
+ logger_1.logger.info(colors_1.default.green(`Synced "${dependencyUpdates.length}" data silos!`));
92
+ }
93
+ return encounteredError;
94
+ }
95
+ exports.syncConfigurationToTranscend = syncConfigurationToTranscend;
96
+ //# sourceMappingURL=syncConfigurationToTranscend.js.map