@transcend-io/cli 4.12.0 → 4.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +156 -14
- package/build/cli-request-upload.d.ts +3 -0
- package/build/cli-request-upload.d.ts.map +1 -0
- package/build/cli-request-upload.js +63 -0
- package/build/cli-request-upload.js.map +1 -0
- package/build/graphql/fetchAllAttributeKeys.d.ts +17 -0
- package/build/graphql/fetchAllAttributeKeys.d.ts.map +1 -0
- package/build/graphql/fetchAllAttributeKeys.js +32 -0
- package/build/graphql/fetchAllAttributeKeys.js.map +1 -0
- package/build/graphql/gqls/attributeKey.d.ts +2 -0
- package/build/graphql/gqls/attributeKey.d.ts.map +1 -0
- package/build/graphql/gqls/attributeKey.js +20 -0
- package/build/graphql/gqls/attributeKey.js.map +1 -0
- package/build/graphql/gqls/enricher.d.ts +10 -0
- package/build/graphql/gqls/enricher.d.ts.map +1 -1
- package/build/graphql/gqls/enricher.js +11 -1
- package/build/graphql/gqls/enricher.js.map +1 -1
- package/build/graphql/gqls/index.d.ts +1 -0
- package/build/graphql/gqls/index.d.ts.map +1 -1
- package/build/graphql/gqls/index.js +1 -0
- package/build/graphql/gqls/index.js.map +1 -1
- package/build/graphql/index.d.ts +1 -0
- package/build/graphql/index.d.ts.map +1 -1
- package/build/graphql/index.js +1 -0
- package/build/graphql/index.js.map +1 -1
- package/build/requests/constants.d.ts +56 -5
- package/build/requests/constants.d.ts.map +1 -1
- package/build/requests/constants.js +33 -3
- package/build/requests/constants.js.map +1 -1
- package/build/requests/extractClientError.d.ts +8 -0
- package/build/requests/extractClientError.d.ts.map +1 -0
- package/build/requests/extractClientError.js +15 -0
- package/build/requests/extractClientError.js.map +1 -0
- package/build/requests/fuzzyMatchColumns.d.ts +3 -2
- package/build/requests/fuzzyMatchColumns.d.ts.map +1 -1
- package/build/requests/fuzzyMatchColumns.js +4 -2
- package/build/requests/fuzzyMatchColumns.js.map +1 -1
- package/build/requests/index.d.ts +4 -0
- package/build/requests/index.d.ts.map +1 -1
- package/build/requests/index.js +4 -0
- package/build/requests/index.js.map +1 -1
- package/build/requests/mapColumnsToAttributes.d.ts +22 -0
- package/build/requests/mapColumnsToAttributes.d.ts.map +1 -0
- package/build/requests/mapColumnsToAttributes.js +47 -0
- package/build/requests/mapColumnsToAttributes.js.map +1 -0
- package/build/requests/mapColumnsToIdentifiers.d.ts +20 -0
- package/build/requests/mapColumnsToIdentifiers.d.ts.map +1 -0
- package/build/requests/mapColumnsToIdentifiers.js +51 -0
- package/build/requests/mapColumnsToIdentifiers.js.map +1 -0
- package/build/requests/mapCsvColumnsToApi.d.ts.map +1 -1
- package/build/requests/mapCsvColumnsToApi.js +1 -1
- package/build/requests/mapCsvColumnsToApi.js.map +1 -1
- package/build/requests/mapCsvRowsToRequestInputs.d.ts +31 -7
- package/build/requests/mapCsvRowsToRequestInputs.d.ts.map +1 -1
- package/build/requests/mapCsvRowsToRequestInputs.js +121 -38
- package/build/requests/mapCsvRowsToRequestInputs.js.map +1 -1
- package/build/requests/mapRequestEnumValues.d.ts.map +1 -1
- package/build/requests/mapRequestEnumValues.js +8 -4
- package/build/requests/mapRequestEnumValues.js.map +1 -1
- package/build/requests/parseAttributesFromString.js +1 -1
- package/build/requests/parseAttributesFromString.js.map +1 -1
- package/build/requests/submitPrivacyRequest.d.ts +7 -5
- package/build/requests/submitPrivacyRequest.d.ts.map +1 -1
- package/build/requests/submitPrivacyRequest.js +23 -6
- package/build/requests/submitPrivacyRequest.js.map +1 -1
- package/build/requests/uploadPrivacyRequestsFromCsv.d.ts +43 -0
- package/build/requests/uploadPrivacyRequestsFromCsv.d.ts.map +1 -0
- package/build/requests/uploadPrivacyRequestsFromCsv.js +220 -0
- package/build/requests/uploadPrivacyRequestsFromCsv.js.map +1 -0
- package/build/tsbuildinfo +1 -1
- package/package.json +5 -2
|
@@ -19,12 +19,14 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
19
19
|
return result;
|
|
20
20
|
};
|
|
21
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.CachedState = exports.CachedFileState = exports.IS_REQUIRED = exports.ColumnName = exports.NONE = void 0;
|
|
22
|
+
exports.CachedState = exports.CachedFileState = exports.CAN_APPLY_IN_BULK = exports.IS_REQUIRED = exports.ColumnName = exports.BLANK = exports.BULK_APPLY = exports.NONE = void 0;
|
|
23
23
|
const type_utils_1 = require("@transcend-io/type-utils");
|
|
24
24
|
const internationalization_1 = require("@transcend-io/internationalization");
|
|
25
25
|
const privacy_types_1 = require("@transcend-io/privacy-types");
|
|
26
26
|
const t = __importStar(require("io-ts"));
|
|
27
|
-
exports.NONE = 'NONE';
|
|
27
|
+
exports.NONE = '[NONE]';
|
|
28
|
+
exports.BULK_APPLY = '[APPLY VALUE TO ALL ROWS]';
|
|
29
|
+
exports.BLANK = '<blank>';
|
|
28
30
|
/**
|
|
29
31
|
* Column names to map
|
|
30
32
|
*/
|
|
@@ -47,6 +49,7 @@ var ColumnName;
|
|
|
47
49
|
/** The title of the dataSiloIds column */
|
|
48
50
|
ColumnName["DataSiloIds"] = "dataSiloIds";
|
|
49
51
|
})(ColumnName = exports.ColumnName || (exports.ColumnName = {}));
|
|
52
|
+
/** These parameters are required in the Transcend DSR API */
|
|
50
53
|
exports.IS_REQUIRED = {
|
|
51
54
|
[ColumnName.Email]: false,
|
|
52
55
|
[ColumnName.CoreIdentifier]: true,
|
|
@@ -57,14 +60,41 @@ exports.IS_REQUIRED = {
|
|
|
57
60
|
[ColumnName.DataSiloIds]: false,
|
|
58
61
|
[ColumnName.Locale]: false,
|
|
59
62
|
};
|
|
63
|
+
/** These parameters can be specified for the entire CSV set if needed */
|
|
64
|
+
exports.CAN_APPLY_IN_BULK = {
|
|
65
|
+
[ColumnName.RequestType]: true,
|
|
66
|
+
[ColumnName.SubjectType]: true,
|
|
67
|
+
};
|
|
60
68
|
// Cache state
|
|
61
69
|
exports.CachedFileState = t.type({
|
|
70
|
+
/** Mapping between the default request input column names and the CSV column name for that input */
|
|
62
71
|
columnNames: t.partial((0, type_utils_1.applyEnum)(ColumnName, () => t.string)),
|
|
72
|
+
/** Mapping between the identifier names and the CSV column name for that input */
|
|
73
|
+
identifierNames: t.record(t.string, t.string),
|
|
74
|
+
/** Mapping between the request attribute inputs and the CSV column name for that input */
|
|
75
|
+
attributeNames: t.record(t.string, t.string),
|
|
76
|
+
/** Mapping between CSV request type and Transcend Request Action */
|
|
63
77
|
requestTypeToRequestAction: t.record(t.string, (0, type_utils_1.valuesOf)(privacy_types_1.RequestAction)),
|
|
78
|
+
/** Mapping between CSV data subject type and the name of the data subject in Transcend */
|
|
64
79
|
subjectTypeToSubjectName: t.record(t.string, t.string),
|
|
80
|
+
/** Mapping between language imported and Transcend locale code */
|
|
65
81
|
languageToLocale: t.record(t.string, (0, type_utils_1.valuesOf)(internationalization_1.LanguageKey)),
|
|
66
|
-
|
|
82
|
+
/** Mapping between request status in import to Transcend request status */
|
|
67
83
|
statusToRequestStatus: t.record(t.string, (0, type_utils_1.valuesOf)({ ...privacy_types_1.CompletedRequestStatus, [exports.NONE]: exports.NONE })),
|
|
84
|
+
/** Set of privacy requests that failed to upload */
|
|
85
|
+
failingRequests: t.array(t.record(t.string, t.any)),
|
|
86
|
+
/** Successfully uploaded requests */
|
|
87
|
+
successfulRequests: t.array(t.type({
|
|
88
|
+
id: t.string,
|
|
89
|
+
link: t.string,
|
|
90
|
+
coreIdentifier: t.string,
|
|
91
|
+
attemptedAt: t.string,
|
|
92
|
+
})),
|
|
93
|
+
/** Duplicate requests */
|
|
94
|
+
duplicateRequests: t.array(t.type({
|
|
95
|
+
coreIdentifier: t.string,
|
|
96
|
+
attemptedAt: t.string,
|
|
97
|
+
})),
|
|
68
98
|
});
|
|
69
99
|
exports.CachedState = t.record(t.string, exports.CachedFileState);
|
|
70
100
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/requests/constants.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,yDAA+D;AAC/D,6EAAiE;AACjE,+DAGqC;AACrC,yCAA2B;AAEd,QAAA,IAAI,GAAG,
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/requests/constants.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extractClientError.d.ts","sourceRoot":"","sources":["../../src/requests/extractClientError.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAE7D"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.extractClientError = void 0;
|
|
4
|
+
const CLIENT_ERROR = /{\\"message\\":\\"(.+?)\\",/;
|
|
5
|
+
/**
|
|
6
|
+
* Extract a client error from the request
|
|
7
|
+
*
|
|
8
|
+
* @param err - Error message
|
|
9
|
+
* @returns Client error or null
|
|
10
|
+
*/
|
|
11
|
+
function extractClientError(err) {
|
|
12
|
+
return CLIENT_ERROR.test(err) ? CLIENT_ERROR.exec(err)[1] : null;
|
|
13
|
+
}
|
|
14
|
+
exports.extractClientError = extractClientError;
|
|
15
|
+
//# sourceMappingURL=extractClientError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extractClientError.js","sourceRoot":"","sources":["../../src/requests/extractClientError.ts"],"names":[],"mappings":";;;AAAA,MAAM,YAAY,GAAG,6BAA6B,CAAC;AAEnD;;;;;GAKG;AACH,SAAgB,kBAAkB,CAAC,GAAW;IAC5C,OAAO,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,CAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACpE,CAAC;AAFD,gDAEC"}
|
|
@@ -13,8 +13,9 @@ export declare function fuzzySearch(word1: string, word2: string): boolean;
|
|
|
13
13
|
*
|
|
14
14
|
* @param allColumnNames - List of all column names
|
|
15
15
|
* @param fuzzyMapName - The name of field being mapped to
|
|
16
|
-
* @param isRequired - When
|
|
16
|
+
* @param isRequired - When true, don't include "NONE" as an option
|
|
17
|
+
* @param canApplyAll - When true, include an option to specify the value in bulk
|
|
17
18
|
* @returns The list of suggestions for inquirer
|
|
18
19
|
*/
|
|
19
|
-
export declare function fuzzyMatchColumns(allColumnNames: string[], fuzzyMapName: string, isRequired: boolean): (string | InstanceType<typeof inquirer.Separator>)[];
|
|
20
|
+
export declare function fuzzyMatchColumns(allColumnNames: string[], fuzzyMapName: string, isRequired: boolean, canApplyAll?: boolean): (string | InstanceType<typeof inquirer.Separator>)[];
|
|
20
21
|
//# sourceMappingURL=fuzzyMatchColumns.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fuzzyMatchColumns.d.ts","sourceRoot":"","sources":["../../src/requests/fuzzyMatchColumns.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAKhC;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAKjE;AAED
|
|
1
|
+
{"version":3,"file":"fuzzyMatchColumns.d.ts","sourceRoot":"","sources":["../../src/requests/fuzzyMatchColumns.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAKhC;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAKjE;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAC/B,cAAc,EAAE,MAAM,EAAE,EACxB,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,OAAO,EACnB,WAAW,CAAC,EAAE,OAAO,GACpB,CAAC,MAAM,GAAG,YAAY,CAAC,OAAO,QAAQ,CAAC,SAAS,CAAC,CAAC,EAAE,CAWtD"}
|
|
@@ -25,15 +25,17 @@ exports.fuzzySearch = fuzzySearch;
|
|
|
25
25
|
*
|
|
26
26
|
* @param allColumnNames - List of all column names
|
|
27
27
|
* @param fuzzyMapName - The name of field being mapped to
|
|
28
|
-
* @param isRequired - When
|
|
28
|
+
* @param isRequired - When true, don't include "NONE" as an option
|
|
29
|
+
* @param canApplyAll - When true, include an option to specify the value in bulk
|
|
29
30
|
* @returns The list of suggestions for inquirer
|
|
30
31
|
*/
|
|
31
|
-
function fuzzyMatchColumns(allColumnNames, fuzzyMapName, isRequired) {
|
|
32
|
+
function fuzzyMatchColumns(allColumnNames, fuzzyMapName, isRequired, canApplyAll) {
|
|
32
33
|
const matchingColumnNames = allColumnNames.filter((x) => fuzzySearch(fuzzyMapName.toLowerCase(), x.toLowerCase()));
|
|
33
34
|
return [
|
|
34
35
|
...matchingColumnNames,
|
|
35
36
|
new inquirer_1.default.Separator(),
|
|
36
37
|
...(isRequired ? [] : [constants_1.NONE]),
|
|
38
|
+
...(canApplyAll ? [constants_1.BULK_APPLY] : []),
|
|
37
39
|
...allColumnNames.filter((x) => !matchingColumnNames.includes(x)),
|
|
38
40
|
];
|
|
39
41
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fuzzyMatchColumns.js","sourceRoot":"","sources":["../../src/requests/fuzzyMatchColumns.ts"],"names":[],"mappings":";;;;;;AAAA,wDAAgC;AAChC,
|
|
1
|
+
{"version":3,"file":"fuzzyMatchColumns.js","sourceRoot":"","sources":["../../src/requests/fuzzyMatchColumns.ts"],"names":[],"mappings":";;;;;;AAAA,wDAAgC;AAChC,2CAA+C;AAE/C,8DAAsC;AAEtC;;;;;;;GAOG;AACH,SAAgB,WAAW,CAAC,KAAa,EAAE,KAAa;IACtD,OAAO,CACL,IAAA,qBAAW,EAAC,KAAK,CAAC,WAAW,EAAE,EAAE,KAAK,CAAC,WAAW,EAAE,CAAC;QACrD,IAAA,qBAAW,EAAC,KAAK,CAAC,WAAW,EAAE,EAAE,KAAK,CAAC,WAAW,EAAE,CAAC,CACtD,CAAC;AACJ,CAAC;AALD,kCAKC;AAED;;;;;;;;GAQG;AACH,SAAgB,iBAAiB,CAC/B,cAAwB,EACxB,YAAoB,EACpB,UAAmB,EACnB,WAAqB;IAErB,MAAM,mBAAmB,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CACtD,WAAW,CAAC,YAAY,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC,CACzD,CAAC;IACF,OAAO;QACL,GAAG,mBAAmB;QACtB,IAAI,kBAAQ,CAAC,SAAS,EAAE;QACxB,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,gBAAI,CAAC,CAAC;QAC7B,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,sBAAU,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACpC,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;KAClE,CAAC;AACJ,CAAC;AAhBD,8CAgBC"}
|
|
@@ -10,4 +10,8 @@ export * from './mapCsvColumnsToApi';
|
|
|
10
10
|
export * from './mapRequestEnumValues';
|
|
11
11
|
export * from './mapCsvRowsToRequestInputs';
|
|
12
12
|
export * from './submitPrivacyRequest';
|
|
13
|
+
export * from './mapColumnsToIdentifiers';
|
|
14
|
+
export * from './mapColumnsToAttributes';
|
|
15
|
+
export * from './extractClientError';
|
|
16
|
+
export * from './uploadPrivacyRequestsFromCsv';
|
|
13
17
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/requests/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,WAAW,CAAC;AAC1B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/requests/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,WAAW,CAAC;AAC1B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,gCAAgC,CAAC"}
|
package/build/requests/index.js
CHANGED
|
@@ -22,4 +22,8 @@ __exportStar(require("./mapCsvColumnsToApi"), exports);
|
|
|
22
22
|
__exportStar(require("./mapRequestEnumValues"), exports);
|
|
23
23
|
__exportStar(require("./mapCsvRowsToRequestInputs"), exports);
|
|
24
24
|
__exportStar(require("./submitPrivacyRequest"), exports);
|
|
25
|
+
__exportStar(require("./mapColumnsToIdentifiers"), exports);
|
|
26
|
+
__exportStar(require("./mapColumnsToAttributes"), exports);
|
|
27
|
+
__exportStar(require("./extractClientError"), exports);
|
|
28
|
+
__exportStar(require("./uploadPrivacyRequestsFromCsv"), exports);
|
|
25
29
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/requests/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,sDAAoC;AACpC,8CAA4B;AAC5B,kDAAgC;AAChC,mDAAiC;AACjC,8DAA4C;AAC5C,4CAA0B;AAC1B,6DAA2C;AAC3C,+CAA6B;AAC7B,uDAAqC;AACrC,yDAAuC;AACvC,8DAA4C;AAC5C,yDAAuC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/requests/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,sDAAoC;AACpC,8CAA4B;AAC5B,kDAAgC;AAChC,mDAAiC;AACjC,8DAA4C;AAC5C,4CAA0B;AAC1B,6DAA2C;AAC3C,+CAA6B;AAC7B,uDAAqC;AACrC,yDAAuC;AACvC,8DAA4C;AAC5C,yDAAuC;AACvC,4DAA0C;AAC1C,2DAAyC;AACzC,uDAAqC;AACrC,iEAA+C"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { GraphQLClient } from 'graphql-request';
|
|
2
|
+
import { AttributeKey } from '../graphql';
|
|
3
|
+
import { CachedFileState } from './constants';
|
|
4
|
+
/**
|
|
5
|
+
* Mapping from attribute name to request input parameter
|
|
6
|
+
*/
|
|
7
|
+
export declare type AttributeNameMap = {
|
|
8
|
+
[k in string]: string;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Create a mapping from the attributes names that can be included
|
|
12
|
+
* at request submission, to the names of the columns that map to those
|
|
13
|
+
* attributes.
|
|
14
|
+
*
|
|
15
|
+
* @param client - GraphQL client
|
|
16
|
+
* @param columnNames - The set of all column names
|
|
17
|
+
* @param cached - Cached state of this mapping
|
|
18
|
+
* @param requestAttributeKeys - Attribute keys to map
|
|
19
|
+
* @returns Mapping from attributes name to column name
|
|
20
|
+
*/
|
|
21
|
+
export declare function mapColumnsToAttributes(client: GraphQLClient, columnNames: string[], cached: CachedFileState, requestAttributeKeys: AttributeKey[]): Promise<AttributeNameMap>;
|
|
22
|
+
//# sourceMappingURL=mapColumnsToAttributes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mapColumnsToAttributes.d.ts","sourceRoot":"","sources":["../../src/requests/mapColumnsToAttributes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAG9C;;GAEG;AACH,oBAAY,gBAAgB,GAAG;KAC5B,CAAC,IAAI,MAAM,GAAG,MAAM;CACtB,CAAC;AAEF;;;;;;;;;;GAUG;AACH,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE,aAAa,EACrB,WAAW,EAAE,MAAM,EAAE,EACrB,MAAM,EAAE,eAAe,EACvB,oBAAoB,EAAE,YAAY,EAAE,GACnC,OAAO,CAAC,gBAAgB,CAAC,CAoC3B"}
|
|
@@ -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.mapColumnsToAttributes = void 0;
|
|
7
|
+
const inquirer_1 = __importDefault(require("inquirer"));
|
|
8
|
+
const fuzzyMatchColumns_1 = require("./fuzzyMatchColumns");
|
|
9
|
+
/**
|
|
10
|
+
* Create a mapping from the attributes names that can be included
|
|
11
|
+
* at request submission, to the names of the columns that map to those
|
|
12
|
+
* attributes.
|
|
13
|
+
*
|
|
14
|
+
* @param client - GraphQL client
|
|
15
|
+
* @param columnNames - The set of all column names
|
|
16
|
+
* @param cached - Cached state of this mapping
|
|
17
|
+
* @param requestAttributeKeys - Attribute keys to map
|
|
18
|
+
* @returns Mapping from attributes name to column name
|
|
19
|
+
*/
|
|
20
|
+
async function mapColumnsToAttributes(client, columnNames, cached, requestAttributeKeys) {
|
|
21
|
+
// Determine the columns that should be mapped
|
|
22
|
+
const columnQuestions = requestAttributeKeys.filter(({ name }) => !cached.attributeNames[name]);
|
|
23
|
+
// Skip mapping when everything is mapped
|
|
24
|
+
const attributeNameMap = columnQuestions.length === 0
|
|
25
|
+
? {}
|
|
26
|
+
: // prompt questions to map columns
|
|
27
|
+
await inquirer_1.default.prompt(columnQuestions.map(({ name }) => {
|
|
28
|
+
const matches = (0, fuzzyMatchColumns_1.fuzzyMatchColumns)(columnNames, name, false);
|
|
29
|
+
return {
|
|
30
|
+
name,
|
|
31
|
+
message: `Choose the column that will be used to map in the attribute: ${name}`,
|
|
32
|
+
type: 'list',
|
|
33
|
+
default: matches[0],
|
|
34
|
+
choices: matches,
|
|
35
|
+
};
|
|
36
|
+
}));
|
|
37
|
+
Object.entries(attributeNameMap).forEach(([k, v]) => {
|
|
38
|
+
// eslint-disable-next-line no-param-reassign
|
|
39
|
+
cached.attributeNames[k] = v;
|
|
40
|
+
});
|
|
41
|
+
return {
|
|
42
|
+
...cached.attributeNames,
|
|
43
|
+
...attributeNameMap,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
exports.mapColumnsToAttributes = mapColumnsToAttributes;
|
|
47
|
+
//# sourceMappingURL=mapColumnsToAttributes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mapColumnsToAttributes.js","sourceRoot":"","sources":["../../src/requests/mapColumnsToAttributes.ts"],"names":[],"mappings":";;;;;;AACA,wDAAgC;AAGhC,2DAAwD;AASxD;;;;;;;;;;GAUG;AACI,KAAK,UAAU,sBAAsB,CAC1C,MAAqB,EACrB,WAAqB,EACrB,MAAuB,EACvB,oBAAoC;IAEpC,8CAA8C;IAC9C,MAAM,eAAe,GAAG,oBAAoB,CAAC,MAAM,CACjD,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAC3C,CAAC;IAEF,yCAAyC;IACzC,MAAM,gBAAgB,GACpB,eAAe,CAAC,MAAM,KAAK,CAAC;QAC1B,CAAC,CAAC,EAAE;QACJ,CAAC,CAAC,kCAAkC;YAClC,MAAM,kBAAQ,CAAC,MAAM,CAKnB,eAAe,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE;gBAC/B,MAAM,OAAO,GAAG,IAAA,qCAAiB,EAAC,WAAW,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;gBAC5D,OAAO;oBACL,IAAI;oBACJ,OAAO,EAAE,gEAAgE,IAAI,EAAE;oBAC/E,IAAI,EAAE,MAAM;oBACZ,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;oBACnB,OAAO,EAAE,OAAO;iBACjB,CAAC;YACJ,CAAC,CAAC,CACH,CAAC;IACR,MAAM,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE;QAClD,6CAA6C;QAC7C,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IAC/B,CAAC,CAAC,CAAC;IAEH,OAAO;QACL,GAAG,MAAM,CAAC,cAAc;QACxB,GAAG,gBAAgB;KACpB,CAAC;AACJ,CAAC;AAzCD,wDAyCC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { GraphQLClient } from 'graphql-request';
|
|
2
|
+
import { CachedFileState } from './constants';
|
|
3
|
+
/**
|
|
4
|
+
* Mapping from identifier name to request input parameter
|
|
5
|
+
*/
|
|
6
|
+
export declare type IdentifierNameMap = {
|
|
7
|
+
[k in string]: string;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Create a mapping from the identifier names that can be included
|
|
11
|
+
* at request submission, to the names of the columns that map to those
|
|
12
|
+
* identifiers.
|
|
13
|
+
*
|
|
14
|
+
* @param client - GraphQL client
|
|
15
|
+
* @param columnNames - The set of all column names
|
|
16
|
+
* @param cached - Cached state of this mapping
|
|
17
|
+
* @returns Mapping from identifier name to column name
|
|
18
|
+
*/
|
|
19
|
+
export declare function mapColumnsToIdentifiers(client: GraphQLClient, columnNames: string[], cached: CachedFileState): Promise<IdentifierNameMap>;
|
|
20
|
+
//# sourceMappingURL=mapColumnsToIdentifiers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mapColumnsToIdentifiers.d.ts","sourceRoot":"","sources":["../../src/requests/mapColumnsToIdentifiers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGrD,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAG9C;;GAEG;AACH,oBAAY,iBAAiB,GAAG;KAC7B,CAAC,IAAI,MAAM,GAAG,MAAM;CACtB,CAAC;AAKF;;;;;;;;;GASG;AACH,wBAAsB,uBAAuB,CAC3C,MAAM,EAAE,aAAa,EACrB,WAAW,EAAE,MAAM,EAAE,EACrB,MAAM,EAAE,eAAe,GACtB,OAAO,CAAC,iBAAiB,CAAC,CA2C5B"}
|
|
@@ -0,0 +1,51 @@
|
|
|
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.mapColumnsToIdentifiers = void 0;
|
|
7
|
+
const inquirer_1 = __importDefault(require("inquirer"));
|
|
8
|
+
const graphql_1 = require("../graphql");
|
|
9
|
+
const fuzzyMatchColumns_1 = require("./fuzzyMatchColumns");
|
|
10
|
+
/** These are uploaded at the top level of the request */
|
|
11
|
+
const IDENTIFIER_BLOCK_LIST = ['email', 'coreIdentifier'];
|
|
12
|
+
/**
|
|
13
|
+
* Create a mapping from the identifier names that can be included
|
|
14
|
+
* at request submission, to the names of the columns that map to those
|
|
15
|
+
* identifiers.
|
|
16
|
+
*
|
|
17
|
+
* @param client - GraphQL client
|
|
18
|
+
* @param columnNames - The set of all column names
|
|
19
|
+
* @param cached - Cached state of this mapping
|
|
20
|
+
* @returns Mapping from identifier name to column name
|
|
21
|
+
*/
|
|
22
|
+
async function mapColumnsToIdentifiers(client, columnNames, cached) {
|
|
23
|
+
// Grab the initializer
|
|
24
|
+
const { initializer } = await (0, graphql_1.makeGraphQLRequest)(client, graphql_1.INITIALIZER);
|
|
25
|
+
// Determine the columns that should be mapped
|
|
26
|
+
const columnQuestions = initializer.identifiers.filter(({ name }) => !cached.identifierNames[name] && !IDENTIFIER_BLOCK_LIST.includes(name));
|
|
27
|
+
// Skip mapping when everything is mapped
|
|
28
|
+
const identifierNameMap = columnQuestions.length === 0
|
|
29
|
+
? {}
|
|
30
|
+
: // prompt questions to map columns
|
|
31
|
+
await inquirer_1.default.prompt(columnQuestions.map(({ name }) => {
|
|
32
|
+
const matches = (0, fuzzyMatchColumns_1.fuzzyMatchColumns)(columnNames, name, false);
|
|
33
|
+
return {
|
|
34
|
+
name,
|
|
35
|
+
message: `Choose the column that will be used to map in the identifier: ${name}`,
|
|
36
|
+
type: 'list',
|
|
37
|
+
default: matches[0],
|
|
38
|
+
choices: matches,
|
|
39
|
+
};
|
|
40
|
+
}));
|
|
41
|
+
Object.entries(identifierNameMap).forEach(([k, v]) => {
|
|
42
|
+
// eslint-disable-next-line no-param-reassign
|
|
43
|
+
cached.identifierNames[k] = v;
|
|
44
|
+
});
|
|
45
|
+
return {
|
|
46
|
+
...cached.identifierNames,
|
|
47
|
+
...identifierNameMap,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
exports.mapColumnsToIdentifiers = mapColumnsToIdentifiers;
|
|
51
|
+
//# sourceMappingURL=mapColumnsToIdentifiers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mapColumnsToIdentifiers.js","sourceRoot":"","sources":["../../src/requests/mapColumnsToIdentifiers.ts"],"names":[],"mappings":";;;;;;AACA,wDAAgC;AAChC,wCAA0E;AAE1E,2DAAwD;AASxD,yDAAyD;AACzD,MAAM,qBAAqB,GAAG,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC;AAE1D;;;;;;;;;GASG;AACI,KAAK,UAAU,uBAAuB,CAC3C,MAAqB,EACrB,WAAqB,EACrB,MAAuB;IAEvB,uBAAuB;IACvB,MAAM,EAAE,WAAW,EAAE,GAAG,MAAM,IAAA,4BAAkB,EAG7C,MAAM,EAAE,qBAAW,CAAC,CAAC;IAExB,8CAA8C;IAC9C,MAAM,eAAe,GAAG,WAAW,CAAC,WAAW,CAAC,MAAM,CACpD,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CACX,CAAC,MAAM,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,qBAAqB,CAAC,QAAQ,CAAC,IAAI,CAAC,CACzE,CAAC;IAEF,yCAAyC;IACzC,MAAM,iBAAiB,GACrB,eAAe,CAAC,MAAM,KAAK,CAAC;QAC1B,CAAC,CAAC,EAAE;QACJ,CAAC,CAAC,kCAAkC;YAClC,MAAM,kBAAQ,CAAC,MAAM,CAKnB,eAAe,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE;gBAC/B,MAAM,OAAO,GAAG,IAAA,qCAAiB,EAAC,WAAW,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;gBAC5D,OAAO;oBACL,IAAI;oBACJ,OAAO,EAAE,iEAAiE,IAAI,EAAE;oBAChF,IAAI,EAAE,MAAM;oBACZ,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;oBACnB,OAAO,EAAE,OAAO;iBACjB,CAAC;YACJ,CAAC,CAAC,CACH,CAAC;IACR,MAAM,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE;QACnD,6CAA6C;QAC7C,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IAChC,CAAC,CAAC,CAAC;IAEH,OAAO;QACL,GAAG,MAAM,CAAC,eAAe;QACzB,GAAG,iBAAiB;KACrB,CAAC;AACJ,CAAC;AA/CD,0DA+CC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapCsvColumnsToApi.d.ts","sourceRoot":"","sources":["../../src/requests/mapCsvColumnsToApi.ts"],"names":[],"mappings":"AAGA,OAAO,
|
|
1
|
+
{"version":3,"file":"mapCsvColumnsToApi.d.ts","sourceRoot":"","sources":["../../src/requests/mapCsvColumnsToApi.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,UAAU,EACV,eAAe,EAGhB,MAAM,aAAa,CAAC;AAGrB;;GAEG;AACH,oBAAY,aAAa,GAAG;KACzB,CAAC,IAAI,UAAU,CAAC,CAAC,EAAE,MAAM;CAC3B,CAAC;AAEF;;;;;;GAMG;AACH,wBAAsB,kBAAkB,CACtC,WAAW,EAAE,MAAM,EAAE,EACrB,MAAM,EAAE,eAAe,GACtB,OAAO,CAAC,aAAa,CAAC,CAuCxB"}
|
|
@@ -25,7 +25,7 @@ async function mapCsvColumnsToApi(columnNames, cached) {
|
|
|
25
25
|
: // prompt questions to map columns
|
|
26
26
|
await inquirer_1.default.prompt(columnQuestions.map((name) => {
|
|
27
27
|
const field = (0, startCase_1.default)(name.replace('ColumnName', ''));
|
|
28
|
-
const matches = (0, fuzzyMatchColumns_1.fuzzyMatchColumns)(columnNames, field, constants_1.IS_REQUIRED[name]);
|
|
28
|
+
const matches = (0, fuzzyMatchColumns_1.fuzzyMatchColumns)(columnNames, field, constants_1.IS_REQUIRED[name], !!constants_1.CAN_APPLY_IN_BULK[name]);
|
|
29
29
|
return {
|
|
30
30
|
name,
|
|
31
31
|
message: `Choose the column that will be used to map in the field: ${field}`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapCsvColumnsToApi.js","sourceRoot":"","sources":["../../src/requests/mapCsvColumnsToApi.ts"],"names":[],"mappings":";;;;;;AAAA,yDAAiE;AACjE,wDAAgC;AAChC,iEAAyC;AACzC,
|
|
1
|
+
{"version":3,"file":"mapCsvColumnsToApi.js","sourceRoot":"","sources":["../../src/requests/mapCsvColumnsToApi.ts"],"names":[],"mappings":";;;;;;AAAA,yDAAiE;AACjE,wDAAgC;AAChC,iEAAyC;AACzC,2CAKqB;AACrB,2DAAwD;AASxD;;;;;;GAMG;AACI,KAAK,UAAU,kBAAkB,CACtC,WAAqB,EACrB,MAAuB;IAEvB,8CAA8C;IAC9C,MAAM,eAAe,GAAG,IAAA,sBAAS,EAAC,sBAAU,CAAC,CAAC,MAAM,CAClD,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,CACpC,CAAC;IAEF,yCAAyC;IACzC,MAAM,aAAa,GACjB,eAAe,CAAC,MAAM,KAAK,CAAC;QAC1B,CAAC,CAAC,EAAE;QACJ,CAAC,CAAC,kCAAkC;YAClC,MAAM,kBAAQ,CAAC,MAAM,CAKnB,eAAe,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;gBAC3B,MAAM,KAAK,GAAG,IAAA,mBAAS,EAAC,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC,CAAC;gBACxD,MAAM,OAAO,GAAG,IAAA,qCAAiB,EAC/B,WAAW,EACX,KAAK,EACL,uBAAW,CAAC,IAAI,CAAC,EACjB,CAAC,CAAC,6BAAiB,CAAC,IAAI,CAAC,CAC1B,CAAC;gBACF,OAAO;oBACL,IAAI;oBACJ,OAAO,EAAE,4DAA4D,KAAK,EAAE;oBAC5E,IAAI,EAAE,MAAM;oBACZ,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;oBACnB,OAAO,EAAE,OAAO;iBACjB,CAAC;YACJ,CAAC,CAAC,CACH,CAAC;IAER,IAAA,uBAAU,EAAC,aAAa,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE;QAC3C,6CAA6C;QAC7C,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IAC5B,CAAC,CAAC,CAAC;IACH,OAAO,aAAa,CAAC;AACvB,CAAC;AA1CD,gDA0CC"}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { LanguageKey } from '@transcend-io/internationalization';
|
|
2
|
-
import { ObjByString } from '@transcend-io/type-utils';
|
|
3
2
|
import { CompletedRequestStatus, RequestAction, IdentifierType } from '@transcend-io/privacy-types';
|
|
3
|
+
import { ObjByString } from '@transcend-io/type-utils';
|
|
4
4
|
import { CachedFileState } from './constants';
|
|
5
|
+
import { AttributeKey } from '../graphql';
|
|
5
6
|
import { ColumnNameMap } from './mapCsvColumnsToApi';
|
|
7
|
+
import type { AttributeInput } from './parseAttributesFromString';
|
|
8
|
+
import { AttributeNameMap } from './mapColumnsToAttributes';
|
|
9
|
+
import { IdentifierNameMap } from './mapColumnsToIdentifiers';
|
|
6
10
|
/**
|
|
7
11
|
* Shape of additional identifiers
|
|
8
12
|
*/
|
|
@@ -17,25 +21,34 @@ export declare type AttestedExtraIdentifiers = {
|
|
|
17
21
|
export interface PrivacyRequestInput {
|
|
18
22
|
/** Email of user */
|
|
19
23
|
email: string;
|
|
20
|
-
/**
|
|
21
|
-
|
|
24
|
+
/** Extra identifiers */
|
|
25
|
+
attestedExtraIdentifiers: AttestedExtraIdentifiers;
|
|
22
26
|
/** Core identifier for user */
|
|
23
27
|
coreIdentifier: string;
|
|
24
28
|
/** Action type being submitted */
|
|
25
29
|
requestType: RequestAction;
|
|
26
30
|
/** Type of data subject */
|
|
27
31
|
subjectType: string;
|
|
32
|
+
/** Attribute inputs */
|
|
33
|
+
attributes?: AttributeInput[];
|
|
28
34
|
/** The status that the request should be created as */
|
|
29
35
|
status?: CompletedRequestStatus;
|
|
30
36
|
/** The time that the request was created */
|
|
31
37
|
createdAt?: Date;
|
|
32
|
-
/** Whether in silent mode */
|
|
33
|
-
isSilent: boolean;
|
|
34
38
|
/** Data silo IDs to submit for */
|
|
35
39
|
dataSiloIds?: string[];
|
|
36
40
|
/** Language key to map to */
|
|
37
41
|
locale?: LanguageKey;
|
|
38
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Transform the identifier value based on type
|
|
45
|
+
*
|
|
46
|
+
* @param identifierValue - Value of identifier
|
|
47
|
+
* @param identifierType - Type of identifier
|
|
48
|
+
* @param defaultPhoneCountryCode - Default country code for phone numbers
|
|
49
|
+
* @returns Post-processed identifier
|
|
50
|
+
*/
|
|
51
|
+
export declare function normalizeIdentifierValue(identifierValue: string, identifierType: IdentifierType, defaultPhoneCountryCode: string): string;
|
|
39
52
|
/**
|
|
40
53
|
* Take the raw rows in a CSV upload, and map those rows to the request
|
|
41
54
|
* input shape that can be passed to the Transcend API to submit a privacy
|
|
@@ -43,8 +56,19 @@ export interface PrivacyRequestInput {
|
|
|
43
56
|
*
|
|
44
57
|
* @param requestInputs - CSV of requests to be uploaded
|
|
45
58
|
* @param cached - The cached set of mapping values
|
|
46
|
-
* @param
|
|
59
|
+
* @param options - Options
|
|
47
60
|
* @returns [raw input, request input] list
|
|
48
61
|
*/
|
|
49
|
-
export declare function mapCsvRowsToRequestInputs(requestInputs: ObjByString[], cached: CachedFileState, columnNameMap
|
|
62
|
+
export declare function mapCsvRowsToRequestInputs(requestInputs: ObjByString[], cached: CachedFileState, { columnNameMap, identifierNameMap, attributeNameMap, requestAttributeKeys, defaultPhoneCountryCode, }: {
|
|
63
|
+
/** Default country code */
|
|
64
|
+
defaultPhoneCountryCode?: string;
|
|
65
|
+
/** Mapping of column names */
|
|
66
|
+
columnNameMap: ColumnNameMap;
|
|
67
|
+
/** Mapping of identifier names */
|
|
68
|
+
identifierNameMap: IdentifierNameMap;
|
|
69
|
+
/** Mapping of attribute names */
|
|
70
|
+
attributeNameMap: AttributeNameMap;
|
|
71
|
+
/** Request attribute keys */
|
|
72
|
+
requestAttributeKeys: AttributeKey[];
|
|
73
|
+
}): [Record<string, string>, PrivacyRequestInput][];
|
|
50
74
|
//# sourceMappingURL=mapCsvRowsToRequestInputs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapCsvRowsToRequestInputs.d.ts","sourceRoot":"","sources":["../../src/requests/mapCsvRowsToRequestInputs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"mapCsvRowsToRequestInputs.d.ts","sourceRoot":"","sources":["../../src/requests/mapCsvRowsToRequestInputs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AACjE,OAAO,EAEL,sBAAsB,EACtB,aAAa,EACb,cAAc,EACf,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,OAAO,EACL,eAAe,EAKhB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAE9D;;GAEG;AACH,oBAAY,wBAAwB,GAAG;KACpC,CAAC,IAAI,cAAc,CAAC,CAAC,EAAE;QACtB,yBAAyB;QACzB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,0BAA0B;QAC1B,KAAK,EAAE,MAAM,CAAC;KACf,EAAE;CACJ,CAAC;AAEF,MAAM,WAAW,mBAAmB;IAClC,oBAAoB;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,wBAAwB;IACxB,wBAAwB,EAAE,wBAAwB,CAAC;IACnD,+BAA+B;IAC/B,cAAc,EAAE,MAAM,CAAC;IACvB,mCAAmC;IACnC,WAAW,EAAE,aAAa,CAAC;IAC3B,2BAA2B;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,uBAAuB;IACvB,UAAU,CAAC,EAAE,cAAc,EAAE,CAAC;IAC9B,uDAAuD;IACvD,MAAM,CAAC,EAAE,sBAAsB,CAAC;IAChC,4CAA4C;IAC5C,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,kCAAkC;IAClC,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,6BAA6B;IAC7B,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CACtC,eAAe,EAAE,MAAM,EACvB,cAAc,EAAE,cAAc,EAC9B,uBAAuB,EAAE,MAAM,GAC9B,MAAM,CAoBR;AAED;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,CACvC,aAAa,EAAE,WAAW,EAAE,EAC5B,MAAM,EAAE,eAAe,EACvB,EACE,aAAa,EACb,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB,uBAA6B,GAC9B,EAAE;IACD,2BAA2B;IAC3B,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,8BAA8B;IAC9B,aAAa,EAAE,aAAa,CAAC;IAC7B,kCAAkC;IAClC,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,iCAAiC;IACjC,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,6BAA6B;IAC7B,oBAAoB,EAAE,YAAY,EAAE,CAAC;CACtC,GACA,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,mBAAmB,CAAC,EAAE,CAoHjD"}
|