{"version":3,"file":"constants-C9xZJ9YW.mjs","names":[],"sources":["../src/lib/requests/constants.ts"],"sourcesContent":["import { LOCALE_KEY } from '@transcend-io/internationalization';\nimport {\n  CompletedRequestStatus,\n  RequestAction,\n  IsoCountryCode,\n  IsoCountrySubdivisionCode,\n} from '@transcend-io/privacy-types';\nimport { applyEnum, valuesOf } from '@transcend-io/type-utils';\nimport * as t from 'io-ts';\n\nexport const NONE = '[NONE]' as const;\nexport const BULK_APPLY = '[APPLY VALUE TO ALL ROWS]' as const;\nexport const BLANK = '<blank>' as const;\n\n/** These are uploaded at the top level of the request */\nexport const IDENTIFIER_BLOCK_LIST = ['email', 'coreIdentifier'];\n\n/**\n * Column names to map\n */\nexport enum ColumnName {\n  /** The title of the email column */\n  Email = 'email',\n  /** The title of the core identifier column */\n  CoreIdentifier = 'coreIdentifier',\n  /** The title of the requestType column */\n  RequestType = 'requestType',\n  /** The title of the subjectType column */\n  SubjectType = 'subjectType',\n  /** The title of the locale column */\n  Locale = 'locale',\n  /** The country */\n  Country = 'country',\n  /** The country sub division */\n  CountrySubDivision = 'countrySubDivision',\n  /** The title of the requestStatus column */\n  RequestStatus = 'requestStatus',\n  /** The title of the createdAt column */\n  CreatedAt = 'createdAt',\n  /** The title of the dataSiloIds column */\n  DataSiloIds = 'dataSiloIds',\n}\n\n/** These parameters are required in the Transcend DSR API */\nexport const IS_REQUIRED: { [k in ColumnName]: boolean } = {\n  [ColumnName.Email]: false,\n  [ColumnName.CoreIdentifier]: true,\n  [ColumnName.RequestType]: true,\n  [ColumnName.SubjectType]: true,\n  [ColumnName.RequestStatus]: false,\n  [ColumnName.CreatedAt]: false,\n  [ColumnName.DataSiloIds]: false,\n  [ColumnName.Locale]: false,\n  [ColumnName.Country]: false,\n  [ColumnName.CountrySubDivision]: false,\n};\n\n/** These parameters can be specified for the entire CSV set if needed */\nexport const CAN_APPLY_IN_BULK: { [k in ColumnName]?: boolean } = {\n  [ColumnName.RequestType]: true,\n  [ColumnName.SubjectType]: true,\n};\n\n// Cache state\nexport const CachedFileState = t.type({\n  /** Mapping between the default request input column names and the CSV column name for that input */\n  columnNames: t.partial(applyEnum(ColumnName, () => t.string)),\n  /** Mapping between the identifier names and the CSV column name for that input */\n  identifierNames: t.record(t.string, t.string),\n  /** Mapping between the request attribute inputs and the CSV column name for that input */\n  attributeNames: t.record(t.string, t.string),\n  /** Mapping between CSV request type and Transcend Request Action */\n  requestTypeToRequestAction: t.record(t.string, valuesOf(RequestAction)),\n  /** Mapping between CSV data subject type and the name of the data subject in Transcend */\n  subjectTypeToSubjectName: t.record(t.string, t.string),\n  /** Mapping between language imported and Transcend locale code */\n  languageToLocale: t.record(t.string, valuesOf(LOCALE_KEY)),\n  /** Mapping between region and country code */\n  regionToCountry: t.record(t.string, valuesOf({ ...IsoCountryCode, [NONE]: NONE })),\n  /** Mapping between region and country sub division code */\n  regionToCountrySubDivision: t.record(\n    t.string,\n    valuesOf({ ...IsoCountrySubdivisionCode, [NONE]: NONE }),\n  ),\n  /** Mapping between request status in import to Transcend request status */\n  statusToRequestStatus: t.record(t.string, valuesOf({ ...CompletedRequestStatus, [NONE]: NONE })),\n});\n\n/** Type override */\nexport type CachedFileState = t.TypeOf<typeof CachedFileState>;\n\n/**\n * Successfully processed request\n */\nexport const SuccessfulRequest = t.type({\n  id: t.string,\n  link: t.string,\n  rowIndex: t.number,\n  coreIdentifier: t.string,\n  attemptedAt: t.string,\n});\n\n/** Type override */\nexport type SuccessfulRequest = t.TypeOf<typeof SuccessfulRequest>;\n\n// Cache state\nexport const CachedRequestState = t.type({\n  /** Set of privacy requests that failed to upload */\n  failingRequests: t.array(t.record(t.string, t.any)),\n  /** Successfully uploaded requests */\n  successfulRequests: t.array(SuccessfulRequest),\n  /** Duplicate requests */\n  duplicateRequests: t.array(\n    t.type({\n      rowIndex: t.number,\n      coreIdentifier: t.string,\n      attemptedAt: t.string,\n    }),\n  ),\n});\n\n/** Type override */\nexport type CachedRequestState = t.TypeOf<typeof CachedRequestState>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