@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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"syncConfigurationToTranscend.js","sourceRoot":"","sources":["../src/syncConfigurationToTranscend.ts"],"names":[],"mappings":";;;;;;AAEA,qCAAkC;AAClC,oDAA4B;AAC5B,uCAAqC;AACrC,yDAAsE;AACtE,mDAA+C;AAC/C,mDAAyD;AACzD,2DAAwD;AACxD,iDAA8C;AAC9C,iCAA0C;AAE1C;;;;;;GAMG;AACI,KAAK,UAAU,4BAA4B,CAChD,KAAqB,EACrB,MAAqB;IAErB,IAAI,gBAAgB,GAAG,KAAK,CAAC;IAE7B,MAAM,CAAC,gBAAgB,EAAE,YAAY,EAAE,cAAc,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QACzE,iFAAiF;QACjF,IAAA,mDAAgC,EAAC,KAAK,EAAE,MAAM,CAAC;QAC/C,6CAA6C;QAC7C,IAAA,qCAAiB,EAAC,KAAK,EAAE,MAAM,CAAC;QAChC,gBAAgB;QAChB,IAAA,2BAAY,EAAC,KAAK,EAAE,MAAM,CAAC;KAC5B,CAAC,CAAC;IAEH,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS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,CAAC,EAAE;oBACf,wBAAwB,EAAE,gBAAgB;iBAC3C,CAAC,CAAC;aACJ;YAAC,OAAO,GAAG,EAAE;gBACZ,gBAAgB,GAAG,IAAI,CAAC;gBACxB,eAAM,CAAC,IAAI,CACT,gBAAM,CAAC,GAAG,CACR,8CAA8C,QAAQ,CAAC,KAAK,QAAQ,GAAG,CAAC,OAAO,EAAE,CAClF,CACF,CAAC;aACH;QACH,CAAC,CAAC,CAAC;QACH,eAAM,CAAC,IAAI,CACT,gBAAM,CAAC,KAAK,CAAC,WAAW,iBAAiB,CAAC,MAAM,eAAe,CAAC,CACjE,CAAC;KACH;IAED,OAAO,gBAAgB,CAAC;AAC1B,CAAC;AAhHD,oEAgHC"}
@@ -0,0 +1,144 @@
1
+ import { DataSiloInput } from './codecs';
2
+ import { GraphQLClient } from 'graphql-request';
3
+ import { DataSubject } from './fetchDataSubjects';
4
+ import { ApiKey } from './fetchApiKeys';
5
+ import { DataCategoryType, ProcessingPurpose, RequestActionObjectResolver } from '@transcend-io/privacy-types';
6
+ export interface DataSilo {
7
+ /** ID of dataSilo */
8
+ id: string;
9
+ /** Title of dataSilo */
10
+ title: string;
11
+ /** Type of silo */
12
+ type: string;
13
+ /** The link to the data silo */
14
+ link: string;
15
+ }
16
+ /**
17
+ * Fetch all dataSilos in the organization
18
+ *
19
+ * @param client - GraphQL client
20
+ * @param title - Filter by title
21
+ * @returns All dataSilos in the organization
22
+ */
23
+ export declare function fetchAllDataSilos(client: GraphQLClient, { title, ids, }: {
24
+ /** Title */
25
+ title?: string;
26
+ /** IDs */
27
+ ids?: string[];
28
+ }): Promise<DataSilo[]>;
29
+ interface DataPoint {
30
+ /** ID of dataPoint */
31
+ id: string;
32
+ /** Title of dataPoint */
33
+ title: {
34
+ /** Default message */
35
+ defaultMessage: string;
36
+ };
37
+ /** Description */
38
+ description: {
39
+ /** Default message */
40
+ defaultMessage: string;
41
+ };
42
+ /** Name */
43
+ name: string;
44
+ /** Purpose */
45
+ purpose: ProcessingPurpose;
46
+ /** Category */
47
+ category: DataCategoryType;
48
+ /** Global actions */
49
+ actionSettings: {
50
+ /** Action type */
51
+ type: RequestActionObjectResolver;
52
+ /** Is enabled */
53
+ active: boolean;
54
+ }[];
55
+ /** Database integration queries */
56
+ dbIntegrationQueries: {
57
+ /** Approved query */
58
+ query: string | null;
59
+ /** Suggested query */
60
+ suggestedQuery: string | null;
61
+ /** Request action */
62
+ requestType: RequestActionObjectResolver;
63
+ }[];
64
+ }
65
+ /**
66
+ * Fetch all datapoints for a data silo
67
+ *
68
+ * @param client - GraphQL client
69
+ * @param dataSiloId - Data silo ID
70
+ * @returns List of datapoints
71
+ */
72
+ export declare function fetchAllDataPoints(client: GraphQLClient, dataSiloId: string): Promise<DataPoint[]>;
73
+ export interface DataSiloEnriched {
74
+ /** ID of dataSilo */
75
+ id: string;
76
+ /** Title of dataSilo */
77
+ title: string;
78
+ /** Type of silo */
79
+ type: string;
80
+ /** Description of data silo */
81
+ description: string;
82
+ /** Webhook URL */
83
+ url?: string;
84
+ /** Email address of user to notify for prompt a person use case */
85
+ notifyEmailAddress?: string;
86
+ /** Associated API keys */
87
+ apiKeys: {
88
+ /** Title */
89
+ title: string;
90
+ }[];
91
+ /** Data subject block list */
92
+ subjectBlocklist: {
93
+ /** Type of data subject */
94
+ type: string;
95
+ }[];
96
+ /** Identifiers */
97
+ identifiers: {
98
+ /** Name of identifier */
99
+ name: string;
100
+ /** True if identifier is wired */
101
+ isConnected: boolean;
102
+ }[];
103
+ /** Dependent data silos */
104
+ dependentDataSilos: {
105
+ /** Title of silo */
106
+ title: string;
107
+ }[];
108
+ /** Silo owners */
109
+ owners: {
110
+ /** Email owners */
111
+ email: string;
112
+ }[];
113
+ /** Silo is live */
114
+ isLive: boolean;
115
+ }
116
+ /**
117
+ * Fetch all dataSilos with additional metadata
118
+ *
119
+ * @param client - GraphQL client
120
+ * @param options - Filter options
121
+ * @returns All dataSilos in the organization
122
+ */
123
+ export declare function fetchEnrichedDataSilos(client: GraphQLClient, { ids, title, }?: {
124
+ /** Filter by IDs */
125
+ ids?: string[];
126
+ /** Filter by title */
127
+ title?: string;
128
+ }): Promise<[DataSiloEnriched, DataPoint[]][]>;
129
+ /**
130
+ * Sync a data silo configuration
131
+ *
132
+ * @param input - The transcend input definition
133
+ * @param client - GraphQL client
134
+ * @param dataSubjectsByName - The data subjects in the organization
135
+ * @param apiKeysByTitle - API key title to API key
136
+ * @returns Data silo info
137
+ */
138
+ export declare function syncDataSilo({ datapoints, ...dataSilo }: DataSiloInput, client: GraphQLClient, dataSubjectsByName: {
139
+ [type in string]: DataSubject;
140
+ }, apiKeysByTitle: {
141
+ [title in string]: ApiKey;
142
+ }): Promise<DataSilo>;
143
+ export {};
144
+ //# sourceMappingURL=syncDataSilos.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"syncDataSilos.d.ts","sourceRoot":"","sources":["../src/syncDataSilos.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAYhD,OAAO,EAEL,WAAW,EACZ,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,2BAA2B,EAC5B,MAAM,6BAA6B,CAAC;AAErC,MAAM,WAAW,QAAQ;IACvB,qBAAqB;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,wBAAwB;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,mBAAmB;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAC;CACd;AAID;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,aAAa,EACrB,EACE,KAAK,EACL,GAAQ,GACT,EAAE;IACD,YAAY;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAA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
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.syncDataSilo = exports.fetchEnrichedDataSilos = exports.fetchAllDataPoints = exports.fetchAllDataSilos = void 0;
7
+ const logger_1 = require("./logger");
8
+ const colors_1 = __importDefault(require("colors"));
9
+ const bluebird_1 = require("bluebird");
10
+ const gqls_1 = require("./gqls");
11
+ const fetchDataSubjects_1 = require("./fetchDataSubjects");
12
+ const PAGE_SIZE = 20;
13
+ /**
14
+ * Fetch all dataSilos in the organization
15
+ *
16
+ * @param client - GraphQL client
17
+ * @param title - Filter by title
18
+ * @returns All dataSilos in the organization
19
+ */
20
+ async function fetchAllDataSilos(client, { title, ids = [], }) {
21
+ logger_1.logger.info(colors_1.default.magenta(`Fetching ${ids.length === 0 ? 'all' : ids.length} Data Silos...`));
22
+ const dataSilos = [];
23
+ let offset = 0;
24
+ // Try to fetch an enricher with the same title
25
+ let shouldContinue = false;
26
+ do {
27
+ const { dataSilos: { nodes },
28
+ // eslint-disable-next-line no-await-in-loop
29
+ } = await client.request(gqls_1.DATA_SILOS, {
30
+ first: PAGE_SIZE,
31
+ ids: ids.length > 0 ? ids : undefined,
32
+ offset,
33
+ title,
34
+ });
35
+ dataSilos.push(...nodes);
36
+ offset += PAGE_SIZE;
37
+ shouldContinue = nodes.length === PAGE_SIZE;
38
+ } while (shouldContinue);
39
+ return dataSilos;
40
+ }
41
+ exports.fetchAllDataSilos = fetchAllDataSilos;
42
+ /**
43
+ * Fetch all datapoints for a data silo
44
+ *
45
+ * @param client - GraphQL client
46
+ * @param dataSiloId - Data silo ID
47
+ * @returns List of datapoints
48
+ */
49
+ async function fetchAllDataPoints(client, dataSiloId) {
50
+ const dataPoints = [];
51
+ let offset = 0;
52
+ // Try to fetch an enricher with the same title
53
+ let shouldContinue = false;
54
+ do {
55
+ const { dataPoints: { nodes },
56
+ // eslint-disable-next-line no-await-in-loop
57
+ } = await client.request(gqls_1.DATA_POINTS, {
58
+ first: PAGE_SIZE,
59
+ dataSiloIds: [dataSiloId],
60
+ offset,
61
+ });
62
+ dataPoints.push(...nodes);
63
+ offset += PAGE_SIZE;
64
+ shouldContinue = nodes.length === PAGE_SIZE;
65
+ } while (shouldContinue);
66
+ return dataPoints;
67
+ }
68
+ exports.fetchAllDataPoints = fetchAllDataPoints;
69
+ /**
70
+ * Fetch all dataSilos with additional metadata
71
+ *
72
+ * @param client - GraphQL client
73
+ * @param options - Filter options
74
+ * @returns All dataSilos in the organization
75
+ */
76
+ async function fetchEnrichedDataSilos(client, { ids, title, } = {}) {
77
+ const dataSilos = [];
78
+ const silos = await fetchAllDataSilos(client, { title, ids });
79
+ await (0, bluebird_1.mapSeries)(silos, async (silo) => {
80
+ const { dataSilo } = await client.request(gqls_1.DATA_SILO, {
81
+ id: silo.id,
82
+ });
83
+ const dataPoints = await fetchAllDataPoints(client, dataSilo.id);
84
+ dataSilos.push([dataSilo, dataPoints]);
85
+ });
86
+ return dataSilos;
87
+ }
88
+ exports.fetchEnrichedDataSilos = fetchEnrichedDataSilos;
89
+ /**
90
+ * Sync a data silo configuration
91
+ *
92
+ * @param input - The transcend input definition
93
+ * @param client - GraphQL client
94
+ * @param dataSubjectsByName - The data subjects in the organization
95
+ * @param apiKeysByTitle - API key title to API key
96
+ * @returns Data silo info
97
+ */
98
+ async function syncDataSilo({ datapoints, ...dataSilo }, client, dataSubjectsByName, apiKeysByTitle) {
99
+ // Try to fetch an dataSilo with the same title
100
+ const matches = await fetchAllDataSilos(client, { title: dataSilo.title });
101
+ let existingDataSilo = matches.find(({ title }) => title === dataSilo.title);
102
+ // If data silo exists, update it, else create new
103
+ if (existingDataSilo) {
104
+ await client.request(gqls_1.UPDATE_DATA_SILO, {
105
+ id: existingDataSilo.id,
106
+ title: dataSilo.title,
107
+ url: dataSilo.url,
108
+ description: dataSilo.description,
109
+ identifiers: dataSilo['identity-keys'],
110
+ isLive: !dataSilo.disabled,
111
+ ownerEmails: dataSilo.owners,
112
+ notifyEmailAddress: dataSilo['notify-email-address'],
113
+ // clear out if not specified, otherwise the update needs to be applied after
114
+ // all data silos are created
115
+ dependedOnDataSiloTitles: dataSilo['deletion-dependencies']
116
+ ? undefined
117
+ : [],
118
+ apiKeyId: dataSilo['api-key-title']
119
+ ? apiKeysByTitle[dataSilo['api-key-title']].id
120
+ : undefined,
121
+ dataSubjectBlockListIds: dataSilo['data-subjects']
122
+ ? (0, fetchDataSubjects_1.convertToDataSubjectBlockList)(dataSilo['data-subjects'], dataSubjectsByName)
123
+ : undefined,
124
+ });
125
+ }
126
+ else {
127
+ const { connectDataSilo } = await client.request(gqls_1.CREATE_DATA_SILO, {
128
+ title: dataSilo.title,
129
+ url: dataSilo.url,
130
+ type: dataSilo.integrationName,
131
+ description: dataSilo.description || '',
132
+ identifiers: dataSilo['identity-keys'],
133
+ isLive: !dataSilo.disabled,
134
+ ownerEmails: dataSilo.owners,
135
+ notifyEmailAddress: dataSilo['notify-email-address'],
136
+ // clear out if not specified, otherwise the update needs to be applied after
137
+ // all data silos are created
138
+ dependedOnDataSiloTitles: dataSilo['deletion-dependencies']
139
+ ? undefined
140
+ : [],
141
+ apiKeyId: dataSilo['api-key-title']
142
+ ? apiKeysByTitle[dataSilo['api-key-title']].id
143
+ : undefined,
144
+ dataSubjectBlockListIds: dataSilo['data-subjects']
145
+ ? (0, fetchDataSubjects_1.convertToDataSubjectBlockList)(dataSilo['data-subjects'], dataSubjectsByName)
146
+ : undefined,
147
+ });
148
+ existingDataSilo = connectDataSilo.dataSilo;
149
+ }
150
+ // Sync datapoints
151
+ if (datapoints) {
152
+ logger_1.logger.info(colors_1.default.magenta(`Syncing "${datapoints.length}" datapoints for data silo ${dataSilo.title}...`));
153
+ await (0, bluebird_1.mapSeries)(datapoints, async (datapoint) => {
154
+ logger_1.logger.info(colors_1.default.magenta(`Syncing datapoint "${datapoint.key}"...`));
155
+ await client.request(gqls_1.UPDATE_OR_CREATE_DATA_POINT, {
156
+ dataSiloId: existingDataSilo.id,
157
+ name: datapoint.key,
158
+ title: datapoint.title,
159
+ description: datapoint.description,
160
+ category: datapoint.category,
161
+ querySuggestions: !datapoint['privacy-action-queries']
162
+ ? undefined
163
+ : Object.entries(datapoint['privacy-action-queries']).map(([key, value]) => ({
164
+ requestType: key,
165
+ suggestedQuery: value,
166
+ })),
167
+ purpose: datapoint.purpose,
168
+ enabledActions: datapoint['privacy-actions'] || [], // clear out when not specified
169
+ });
170
+ // TODO:https://transcend.height.app/T-10773 - obj.fields
171
+ logger_1.logger.info(colors_1.default.green(`Synced datapoint "${datapoint.key}"!`));
172
+ });
173
+ }
174
+ return existingDataSilo;
175
+ }
176
+ exports.syncDataSilo = syncDataSilo;
177
+ /* eslint-enable max-lines */
178
+ //# sourceMappingURL=syncDataSilos.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"syncDataSilos.js","sourceRoot":"","sources":["../src/syncDataSilos.ts"],"names":[],"mappings":";;;;;;AAGA,qCAAkC;AAClC,oDAA4B;AAC5B,uCAAqC;AACrC,iCAOgB;AAChB,2DAG6B;AAmB7B,MAAM,SAAS,GAAG,EAAE,CAAC;AAErB;;;;;;GAMG;AACI,KAAK,UAAU,iBAAiB,CACrC,MAAqB,EACrB,EACE,KAAK,EACL,GAAG,GAAG,EAAE,GAMT;IAED,eAAM,CAAC,IAAI,CACT,gBAAM,CAAC,OAAO,CACZ,YAAY,GAAG,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,gBAAgB,CAClE,CACF,CAAC;IAEF,MAAM,SAAS,GAAe,EAAE,CAAC;IACjC,IAAI,MAAM,GAAG,CAAC,CAAC;IAEf,+CAA+C;IAC/C,IAAI,cAAc,GAAG,KAAK,CAAC;IAC3B,GAAG;QACD,MAAM,EACJ,SAAS,EAAE,EAAE,KAAK,EAAE;QACpB,4CAA4C;UAC7C,GAAG,MAAM,MAAM,CAAC,OAAO,CAMrB,iBAAU,EA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,IAAI,CAAC,gBAAM,CAAC,KAAK,CAAC,qBAAqB,SAAS,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;QACpE,CAAC,CAAC,CAAC;KACJ;IAED,OAAO,gBAAgB,CAAC;AAC1B,CAAC;AAxGD,oCAwGC;AACD,6BAA6B"}
@@ -0,0 +1,45 @@
1
+ import { EnricherInput } from './codecs';
2
+ import { GraphQLClient } from 'graphql-request';
3
+ import { RequestAction } from '@transcend-io/privacy-types';
4
+ import { Identifier } from './fetchIdentifiers';
5
+ export interface Enricher {
6
+ /** ID of enricher */
7
+ id: string;
8
+ /** Title of enricher */
9
+ title: string;
10
+ /** URL of enricher */
11
+ url: string;
12
+ /** Server silo */
13
+ type: 'SERVER' | 'PERSON';
14
+ /** Input identifier */
15
+ inputIdentifier: {
16
+ /** Identifier name */
17
+ name: string;
18
+ };
19
+ /** The selected actions */
20
+ actions: RequestAction[];
21
+ /** Output identifiers */
22
+ identifiers: {
23
+ /** Identifier name */
24
+ name: string;
25
+ }[];
26
+ }
27
+ /**
28
+ * Fetch all enrichers in the organization
29
+ *
30
+ * @param client - GraphQL client
31
+ * @param title - Filter by title
32
+ * @returns All enrichers in the organization
33
+ */
34
+ export declare function fetchAllEnrichers(client: GraphQLClient, title?: string): Promise<Enricher[]>;
35
+ /**
36
+ * Sync an enricher configuration
37
+ *
38
+ * @param enricher - The enricher input
39
+ * @param client - GraphQL client
40
+ * @param identifiersByName - Index of identifiers in the organization
41
+ */
42
+ export declare function syncEnricher(enricher: EnricherInput, client: GraphQLClient, identifiersByName: {
43
+ [name in string]: Identifier;
44
+ }): Promise<void>;
45
+ //# sourceMappingURL=syncEnrichers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"syncEnrichers.d.ts","sourceRoot":"","sources":["../src/syncEnrichers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,MAAM,WAAW,QAAQ;IACvB,qBAAqB;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,wBAAwB;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,sBAAsB;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,kBAAkB;IAClB,IAAI,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC1B,uBAAuB;IACvB,eAAe,EAAE;QACf,sBAAsB;QACtB,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IACF,2BAA2B;IAC3B,OAAO,EAAE,aAAa,EAAE,CAAC;IACzB,yBAAyB;IACzB,WAAW,EAAE;QACX,sBAAsB;QACtB,IAAI,EAAE,MAAM,CAAC;KACd,EAAE,CAAC;CACL;AAID;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,aAAa,EACrB,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,QAAQ,EAAE,CAAC,CA2BrB;AAED;;;;;;GAMG;AACH,wBAAsB,YAAY,CAChC,QAAQ,EAAE,aAAa,EACvB,MAAM,EAAE,aAAa,EACrB,iBAAiB,EAAE;KAAG,IAAI,IAAI,MAAM,GAAG,UAAU;CAAE,GAClD,OAAO,CAAC,IAAI,CAAC,CAgCf"}
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.syncEnricher = exports.fetchAllEnrichers = void 0;
4
+ const gqls_1 = require("./gqls");
5
+ const privacy_types_1 = require("@transcend-io/privacy-types");
6
+ const PAGE_SIZE = 20;
7
+ /**
8
+ * Fetch all enrichers in the organization
9
+ *
10
+ * @param client - GraphQL client
11
+ * @param title - Filter by title
12
+ * @returns All enrichers in the organization
13
+ */
14
+ async function fetchAllEnrichers(client, title) {
15
+ const enrichers = [];
16
+ let offset = 0;
17
+ // Try to fetch an enricher with the same title
18
+ let shouldContinue = false;
19
+ do {
20
+ const { enrichers: { nodes },
21
+ // eslint-disable-next-line no-await-in-loop
22
+ } = await client.request(gqls_1.ENRICHERS, {
23
+ first: PAGE_SIZE,
24
+ offset,
25
+ title,
26
+ });
27
+ enrichers.push(...nodes);
28
+ offset += PAGE_SIZE;
29
+ shouldContinue = nodes.length === PAGE_SIZE;
30
+ } while (shouldContinue);
31
+ return enrichers;
32
+ }
33
+ exports.fetchAllEnrichers = fetchAllEnrichers;
34
+ /**
35
+ * Sync an enricher configuration
36
+ *
37
+ * @param enricher - The enricher input
38
+ * @param client - GraphQL client
39
+ * @param identifiersByName - Index of identifiers in the organization
40
+ */
41
+ async function syncEnricher(enricher, client, identifiersByName) {
42
+ // Try to fetch an enricher with the same title
43
+ const matches = await fetchAllEnrichers(client, enricher.title);
44
+ const existingEnricher = matches.find(({ title }) => title === enricher.title);
45
+ // If enricher exists, update it, else create new
46
+ if (existingEnricher) {
47
+ await client.request(gqls_1.UPDATE_ENRICHER, {
48
+ id: existingEnricher.id,
49
+ title: enricher.title,
50
+ url: enricher.url,
51
+ description: enricher.description || '',
52
+ inputIdentifier: identifiersByName[enricher['input-identifier']].id,
53
+ identifiers: enricher['output-identifiers'].map((id) => identifiersByName[id].id),
54
+ actions: enricher['privacy-actions'] || Object.values(privacy_types_1.RequestAction),
55
+ });
56
+ }
57
+ else {
58
+ await client.request(gqls_1.CREATE_ENRICHER, {
59
+ title: enricher.title,
60
+ url: enricher.url,
61
+ description: enricher.description || '',
62
+ inputIdentifier: identifiersByName[enricher['input-identifier']].id,
63
+ identifiers: enricher['output-identifiers'].map((id) => identifiersByName[id].id),
64
+ actions: enricher['privacy-actions'] || Object.values(privacy_types_1.RequestAction),
65
+ });
66
+ }
67
+ }
68
+ exports.syncEnricher = syncEnricher;
69
+ //# sourceMappingURL=syncEnrichers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"syncEnrichers.js","sourceRoot":"","sources":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YACjB,WAAW,EAAE,QAAQ,CAAC,WAAW,IAAI,EAAE;YACvC,eAAe,EAAE,iBAAiB,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC,CAAC,EAAE;YACnE,WAAW,EAAE,QAAQ,CAAC,oBAAoB,CAAC,CAAC,GAAG,CAC7C,CAAC,EAAE,EAAE,EAAE,CAAC,iBAAiB,CAAC,EAAE,CAAC,CAAC,EAAE,CACjC;YACD,OAAO,EAAE,QAAQ,CAAC,iBAAiB,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC,6BAAa,CAAC;SACrE,CAAC,CAAC;KACJ;SAAM;QACL,MAAM,MAAM,CAAC,OAAO,CAAC,sBAAe,EAAE;YACpC,KAAK,EAAE,QAAQ,CAAC,KAAK;YACrB,GAAG,EAAE,QAAQ,CAAC,GAAG;YACjB,WAAW,EAAE,QAAQ,CAAC,WAAW,IAAI,EAAE;YACvC,eAAe,EAAE,iBAAiB,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC,CAAC,EAAE;YACnE,WAAW,EAAE,QAAQ,CAAC,oBAAoB,CAAC,CAAC,GAAG,CAC7C,CAAC,EAAE,EAAE,EAAE,CAAC,iBAAiB,CAAC,EAAE,CAAC,CAAC,EAAE,CACjC;YACD,OAAO,EAAE,QAAQ,CAAC,iBAAiB,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC,6BAAa,CAAC;SACrE,CAAC,CAAC;KACJ;AACH,CAAC;AApCD,oCAoCC"}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=fetchApiKeys.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetchApiKeys.test.d.ts","sourceRoot":"","sources":["../../src/tests/fetchApiKeys.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // TODO: https://transcend.height.app/T-10772 - fetchApiKeys test
3
+ //# sourceMappingURL=fetchApiKeys.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetchApiKeys.test.js","sourceRoot":"","sources":["../../src/tests/fetchApiKeys.test.ts"],"names":[],"mappings":";AAAA,iEAAiE"}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=fetchDataSubjects.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetchDataSubjects.test.d.ts","sourceRoot":"","sources":["../../src/tests/fetchDataSubjects.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // TODO: https://transcend.height.app/T-10772 - fetchDataSubjects test
3
+ //# sourceMappingURL=fetchDataSubjects.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetchDataSubjects.test.js","sourceRoot":"","sources":["../../src/tests/fetchDataSubjects.test.ts"],"names":[],"mappings":";AAAA,sEAAsE"}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=fetchIdentifiers.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetchIdentifiers.test.d.ts","sourceRoot":"","sources":["../../src/tests/fetchIdentifiers.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // TODO: https://transcend.height.app/T-10772 - fetchIdentifiers test
3
+ //# sourceMappingURL=fetchIdentifiers.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetchIdentifiers.test.js","sourceRoot":"","sources":["../../src/tests/fetchIdentifiers.test.ts"],"names":[],"mappings":";AAAA,qEAAqE"}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=main.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.test.d.ts","sourceRoot":"","sources":["../../src/tests/main.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ // TODO: https://transcend.height.app/T-10772
3
+ // yarn ts-node ./src/main.ts --file=./examples/simple.yml
4
+ // yarn ts-node ./src/main.ts --file=./examples/invalid.yml
5
+ // yarn ts-node ./src/main.ts
6
+ //# sourceMappingURL=main.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.test.js","sourceRoot":"","sources":["../../src/tests/main.test.ts"],"names":[],"mappings":";AAAA,6CAA6C;AAC7C,0DAA0D;AAC1D,2DAA2D;AAC3D,6BAA6B"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=readTranscendYaml.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"readTranscendYaml.test.d.ts","sourceRoot":"","sources":["../../src/tests/readTranscendYaml.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const chai_1 = require("chai");
4
+ const path_1 = require("path");
5
+ const index_1 = require("../index");
6
+ const EXAMPLE_DIR = (0, path_1.join)(__dirname, '..', '..', 'examples');
7
+ describe('readTranscendYaml', () => {
8
+ it('simple.yml should pass the codec validation for TranscendInput', () => {
9
+ (0, chai_1.expect)(() => (0, index_1.readTranscendYaml)((0, path_1.join)(EXAMPLE_DIR, 'simple.yml'))).to.not.throw();
10
+ });
11
+ it('invalid.yml should fail the codec validation for TranscendInput', () => {
12
+ (0, chai_1.expect)(() => (0, index_1.readTranscendYaml)((0, path_1.join)(EXAMPLE_DIR, 'invalid.yml'))).to
13
+ .throw(` ".enrichers.0.0.title expected type 'string'",
14
+ ".enrichers.0.0.url expected type 'string'",
15
+ ".enrichers.1.0.url expected type 'string'",
16
+ ".enrichers.1.0.input-identifier expected type 'string'",
17
+ ".enrichers.1.0.output-identifiers expected type 'Array<string>'",
18
+ ".data-silos.0.0.title expected type 'string'",
19
+ ".data-silos.0.1.deletion-dependencies expected type 'Array<string>'",
20
+ ".data-silos.0.1.datapoints.0.0.title expected type 'string'",
21
+ ".data-silos.0.1.datapoints.0.0.key expected type 'string'",
22
+ ".data-silos.0.1.datapoints.0.1.fields.0.0.key expected type 'string'",
23
+ ".data-silos.1.1.disabled expected type 'boolean'"`);
24
+ });
25
+ it('multi-instance.yml should fail when no variables are provided', () => {
26
+ (0, chai_1.expect)(() => (0, index_1.readTranscendYaml)((0, path_1.join)(EXAMPLE_DIR, 'multi-instance.yml'))).to.throw('Found variable that was not set: domain');
27
+ });
28
+ it('multi-instance.yml should be successful when variables are provided', () => {
29
+ const result = (0, index_1.readTranscendYaml)((0, path_1.join)(EXAMPLE_DIR, 'multi-instance.yml'), {
30
+ domain: 'acme.com',
31
+ stage: 'Staging',
32
+ });
33
+ (0, chai_1.expect)(result.enrichers[0].url).to.equal('https://example.acme.com/transcend-enrichment-webhook');
34
+ (0, chai_1.expect)(result.enrichers[1].url).to.equal('https://example.acme.com/transcend-fraud-check');
35
+ (0, chai_1.expect)(result['data-silos'][0].description).to.equal('The mega-warehouse that contains a copy over all SQL backed databases - Staging');
36
+ });
37
+ });
38
+ //# sourceMappingURL=readTranscendYaml.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"readTranscendYaml.test.js","sourceRoot":"","sources":["../../src/tests/readTranscendYaml.test.ts"],"names":[],"mappings":";;AAAA,+BAA8B;AAC9B,+BAA4B;AAE5B,oCAA6C;AAE7C,MAAM,WAAW,GAAG,IAAA,WAAI,EAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC;AAE5D,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;IACjC,EAAE,CAAC,gEAAgE,EAAE,GAAG,EAAE;QACxE,IAAA,aAAM,EAAC,GAAG,EAAE,CACV,IAAA,yBAAiB,EAAC,IAAA,WAAI,EAAC,WAAW,EAAE,YAAY,CAAC,CAAC,CACnD,CAAC,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC;IACnB,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,iEAAiE,EAAE,GAAG,EAAE;QACzE,IAAA,aAAM,EAAC,GAAG,EAAE,CAAC,IAAA,yBAAiB,EAAC,IAAA,WAAI,EAAC,WAAW,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,EAAE;aACjE,KAAK,CAAC;;;;;;;;;;qDAUwC,CAAC,CAAC;IACrD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,+DAA+D,EAAE,GAAG,EAAE;QACvE,IAAA,aAAM,EAAC,GAAG,EAAE,CACV,IAAA,yBAAiB,EAAC,IAAA,WAAI,EAAC,WAAW,EAAE,oBAAoB,CAAC,CAAC,CAC3D,CAAC,EAAE,CAAC,KAAK,CAAC,yCAAyC,CAAC,CAAC;IACxD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,qEAAqE,EAAE,GAAG,EAAE;QAC7E,MAAM,MAAM,GAAG,IAAA,yBAAiB,EAAC,IAAA,WAAI,EAAC,WAAW,EAAE,oBAAoB,CAAC,EAAE;YACxE,MAAM,EAAE,UAAU;YAClB,KAAK,EAAE,SAAS;SACjB,CAAC,CAAC;QAEH,IAAA,aAAM,EAAC,MAAO,CAAC,SAAU,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK,CACxC,uDAAuD,CACxD,CAAC;QACF,IAAA,aAAM,EAAC,MAAO,CAAC,SAAU,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK,CACxC,gDAAgD,CACjD,CAAC;QACF,IAAA,aAAM,EAAC,MAAO,CAAC,YAAY,CAAE,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,KAAK,CACpD,iFAAiF,CAClF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=syncDataSilos.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"syncDataSilos.test.d.ts","sourceRoot":"","sources":["../../src/tests/syncDataSilos.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // TODO: https://transcend.height.app/T-10772 - syncEnrichers test
3
+ //# sourceMappingURL=syncDataSilos.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"syncDataSilos.test.js","sourceRoot":"","sources":["../../src/tests/syncDataSilos.test.ts"],"names":[],"mappings":";AAAA,kEAAkE"}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=syncEnrichers.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"syncEnrichers.test.d.ts","sourceRoot":"","sources":["../../src/tests/syncEnrichers.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // TODO: https://transcend.height.app/T-10772 - syncEnrichers test
3
+ //# sourceMappingURL=syncEnrichers.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"syncEnrichers.test.js","sourceRoot":"","sources":["../../src/tests/syncEnrichers.test.ts"],"names":[],"mappings":";AAAA,kEAAkE"}