Skip to content

Commit

Permalink
Datapoint owner/team syncing
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelfarrell76 committed Oct 18, 2023
1 parent cf30ee4 commit d737886
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 48 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"author": "Transcend Inc.",
"name": "@transcend-io/cli",
"description": "Small package containing useful typescript utilities.",
"version": "4.109.1",
"version": "4.110.0",
"homepage": "https://github.com/transcend-io/cli",
"repository": {
"type": "git",
Expand Down
13 changes: 13 additions & 0 deletions src/codecs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,19 @@ export const DatapointInput = t.intersection([
* This is often the column metadata
*/
fields: t.array(FieldInput),
/**
* The email addresses of the employees within your company that are the go-to individuals
* for managing this datapoint
*/
owners: t.array(t.string),
/**
* The names of teams within your Transcend instance that should be responsible
* for managing this datapoint
*
* @see https://docs.transcend.io/docs/security/access-control#teams
* for more information about how to create and manage teams
*/
teams: t.array(t.string),
}),
]);

Expand Down
6 changes: 6 additions & 0 deletions src/graphql/gqls/dataPoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ export const DATA_POINTS = gql`
description {
defaultMessage
}
owners {
email
}
teams {
name
}
name
path
actionSettings {
Expand Down
99 changes: 52 additions & 47 deletions src/graphql/pullTranscendConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
AssessmentTemplateInput,
AssessmentInput,
PromptInput,
DatapointInput,
} from '../codecs';
import { ENABLED_ON_TO_ATTRIBUTE_KEY } from '../tmp-attribute-key';
import {
Expand Down Expand Up @@ -688,53 +689,57 @@ export async function pullTranscendConfiguration(
: undefined,

datapoints: dataPoints
.map((dataPoint) => ({
key: dataPoint.name,
title: dataPoint.title?.defaultMessage,
description: dataPoint.description?.defaultMessage,
...(dataPoint.path.length > 0 ? { path: dataPoint.path } : {}),
...(dataPoint.dataCollection?.title
? {
'data-collection-tag':
dataPoint.dataCollection.title.defaultMessage,
}
: {}),
...(dataPoint.dbIntegrationQueries.length > 0
? {
'privacy-action-queries': mapValues(
keyBy(dataPoint.dbIntegrationQueries, 'requestType'),
(databaseIntegrationQuery) =>
databaseIntegrationQuery.suggestedQuery ||
databaseIntegrationQuery.query ||
undefined,
),
}
: {}),
...(dataPoint.subDataPoints.length > 0
? {
fields: dataPoint.subDataPoints
.map((field) => ({
key: field.name,
description: field.description,
purposes: field.purposes,
categories: field.categories,
'access-request-visibility-enabled':
field.accessRequestVisibilityEnabled,
'erasure-request-redaction-enabled':
field.erasureRequestRedactionEnabled,
attributes:
field.attributeValues !== undefined &&
field.attributeValues.length > 0
? formatAttributeValues(field.attributeValues)
: undefined,
}))
.sort((a, b) => a.key.localeCompare(b.key)),
}
: {}),
'privacy-actions': dataPoint.actionSettings
.filter(({ active }) => active)
.map(({ type }) => type),
}))
.map(
(dataPoint): DatapointInput => ({
key: dataPoint.name,
title: dataPoint.title?.defaultMessage,
description: dataPoint.description?.defaultMessage,
owners: dataPoint.owners.map(({ email }) => email),
teams: dataPoint.teams.map(({ name }) => name),
...(dataPoint.path.length > 0 ? { path: dataPoint.path } : {}),
...(dataPoint.dataCollection?.title
? {
'data-collection-tag':
dataPoint.dataCollection.title.defaultMessage,
}
: {}),
...(dataPoint.dbIntegrationQueries.length > 0
? {
'privacy-action-queries': mapValues(
keyBy(dataPoint.dbIntegrationQueries, 'requestType'),
(databaseIntegrationQuery) =>
databaseIntegrationQuery.suggestedQuery ||
databaseIntegrationQuery.query ||
undefined,
),
}
: {}),
...(dataPoint.subDataPoints.length > 0
? {
fields: dataPoint.subDataPoints
.map((field) => ({
key: field.name,
description: field.description,
purposes: field.purposes,
categories: field.categories,
'access-request-visibility-enabled':
field.accessRequestVisibilityEnabled,
'erasure-request-redaction-enabled':
field.erasureRequestRedactionEnabled,
attributes:
field.attributeValues !== undefined &&
field.attributeValues.length > 0
? formatAttributeValues(field.attributeValues)
: undefined,
}))
.sort((a, b) => a.key.localeCompare(b.key)),
}
: {}),
'privacy-actions': dataPoint.actionSettings
.filter(({ active }) => active)
.map(({ type }) => type),
}),
)
.sort((a, b) =>
[...(a.path ?? []), a.key]
.join('.')
Expand Down
10 changes: 10 additions & 0 deletions src/graphql/syncDataSilos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,16 @@ interface DataPoint {
/** Whether the data silo supports automated vendor coordination */
hasAvcFunctionality: boolean;
};
/** Owners of the datapoint */
owners: {
/** Email address of the owner */
email: string;
}[];
/** Teams that own the datapoint */
teams: {
/** Name of the team */
name: string;
}[];
/** Database integration queries */
dbIntegrationQueries: {
/** Approved query */
Expand Down

0 comments on commit d737886

Please sign in to comment.