{"version":3,"file":"pullTranscendConfiguration-DbRVLKq5.mjs","names":[],"sources":["../src/lib/graphql/gqls/assessmentTemplate.ts","../src/lib/graphql/fetchAllAssessmentTemplates.ts","../src/lib/graphql/buildDeletionDependencies.ts","../src/lib/graphql/pullTranscendConfiguration.ts"],"sourcesContent":["import { ASSESSMENT_SECTION_FIELDS } from '@transcend-io/sdk';\nimport { gql } from 'graphql-request';\n\n// TODO: https://transcend.height.app/T-27909 - enable optimizations\n// isExportCsv: true\n// useMaster: false\n// orderBy: [\n//   { field: createdAt, direction: ASC }\n//   { field: name, direction: ASC }\n// ]\nexport const ASSESSMENT_TEMPLATES = gql`\n  query TranscendCliAssessmentTemplates(\n    $first: Int!\n    $offset: Int!\n    $filterBy: AssessmentFormTemplateFiltersInput\n  ) {\n    assessmentFormTemplates(\n      first: $first\n      offset: $offset\n      filterBy: $filterBy\n    ) {\n      nodes {\n        id\n        creator {\n          id\n          email\n          name\n        }\n        lastEditor {\n          id\n          email\n          name\n        }\n        title\n        description\n        status\n        source\n        parentId\n        isLocked\n        isArchived\n        createdAt\n        updatedAt\n        retentionSchedule {\n          id\n          type\n          durationDays\n          operation\n          createdAt\n          updatedAt\n        }\n        assessmentEmailSet {\n          id\n          title\n          description\n          isDefault\n          templates {\n            id\n            title\n          }\n        }\n        sections {\n          ${ASSESSMENT_SECTION_FIELDS}\n        }\n      }\n    }\n  }\n`;\n","import {\n  AssessmentFormTemplateSource,\n  AssessmentFormTemplateStatus,\n} from '@transcend-io/privacy-types';\nimport {\n  makeGraphQLRequest,\n  type AssessmentSection,\n  type RetentionSchedule,\n  type UserPreview,\n} from '@transcend-io/sdk';\nimport { GraphQLClient } from 'graphql-request';\n\nimport { logger } from '../../logger.js';\nimport { ASSESSMENT_TEMPLATES } from './gqls/index.js';\n\n/**\n * Represents an assessment template with various properties and metadata.\n */\nexport interface AssessmentTemplate {\n  /** The ID of the assessment template */\n  id: string;\n  /** The user who created the assessment template */\n  creator: UserPreview;\n  /** The user who last edited the assessment template */\n  lastEditor: UserPreview;\n  /** The title of the assessment template */\n  title: string;\n  /** The description of the assessment template */\n  description: string;\n  /** The current status of the assessment template */\n  status: AssessmentFormTemplateStatus;\n  /** The source fo the form template */\n  source: AssessmentFormTemplateSource;\n  /** ID of parent template */\n  parentId: string;\n  /** Indicates if the assessment template is locked */\n  isLocked: boolean;\n  /** Indicates if the assessment template is archived */\n  isArchived: boolean;\n  /** The date when the assessment template was created */\n  createdAt: string;\n  /** The date when the assessment template was last updated */\n  updatedAt: string;\n  /** The retention schedule of the assessment template */\n  retentionSchedule?: RetentionSchedule;\n  /** The sections of the assessment template */\n  sections: AssessmentSection[];\n}\n\nconst PAGE_SIZE = 20;\n\n/**\n * Fetch all assessment templates in the organization\n *\n * @param client - GraphQL client\n * @returns All assessment templates in the organization\n */\nexport async function fetchAllAssessmentTemplates(\n  client: GraphQLClient,\n): Promise<AssessmentTemplate[]> {\n  const assessmentTemplates: AssessmentTemplate[] = [];\n  let offset = 0;\n\n  let shouldContinue = false;\n  do {\n    const {\n      assessmentFormTemplates: { nodes },\n    } = await makeGraphQLRequest<{\n      /** Templates */\n      assessmentFormTemplates: {\n        /** Nodes */\n        nodes: AssessmentTemplate[];\n      };\n    }>(client, ASSESSMENT_TEMPLATES, {\n      variables: { first: PAGE_SIZE, offset },\n      logger,\n    });\n    assessmentTemplates.push(...nodes);\n    offset += PAGE_SIZE;\n    shouldContinue = nodes.length === PAGE_SIZE;\n  } while (shouldContinue);\n\n  return assessmentTemplates.sort((a, b) => a.title.localeCompare(b.title));\n}\n","import type { DataSiloEnriched } from '@transcend-io/sdk';\n\nimport type { DataSiloInput } from '../../codecs.js';\n\n/**\n * Build the `deletion-dependencies` entries for a data silo being pulled into transcend.yml.\n *\n * With no per-workflow overrides, global dependencies stay as a list of titles so existing\n * configurations round-trip unchanged. When overrides exist, the whole field is a list of\n * objects (`{ titles }` for global, `{ workflow, titles }` for each override).\n *\n * @param dataSilo - The data silo being pulled\n * @returns The `deletion-dependencies` field, or an empty object when there is nothing to write\n */\nexport function buildDeletionDependenciesInput(\n  dataSilo: Pick<DataSiloEnriched, 'dependentDataSilos' | 'dependedOnDataSilosPerWorkflow'>,\n): Pick<DataSiloInput, 'deletion-dependencies'> {\n  const { dependentDataSilos, dependedOnDataSilosPerWorkflow } = dataSilo;\n\n  const globalTitles = dependentDataSilos.map(({ title }) => title);\n\n  const workflowOverrides = dependedOnDataSilosPerWorkflow.map(\n    ({ workflowInternalName, dependedOnDataSilos }) => ({\n      workflow: workflowInternalName,\n      titles: dependedOnDataSilos.map(({ title }) => title),\n    }),\n  );\n\n  // If there are no global or workflow dependencies, return an empty object\n  if (globalTitles.length === 0 && workflowOverrides.length === 0) {\n    return {};\n  }\n\n  // If there are no workflow overrides, return the global titles as string[], to keep legacy behavior\n  if (workflowOverrides.length === 0) {\n    return { 'deletion-dependencies': globalTitles };\n  }\n\n  // If there are workflow overrides, return a list of objects\n  return {\n    'deletion-dependencies': [\n      ...(globalTitles.length > 0 ? [{ titles: globalTitles }] : []),\n      ...workflowOverrides,\n    ],\n  };\n}\n","import { LocaleValue } from '@transcend-io/internationalization';\nimport {\n  RequestAction,\n  ConsentTrackerStatus,\n  ActionItemCode,\n  RetentionType,\n  PreferenceTopicType,\n  WorkflowConfigType,\n  type ConsentThemeInput,\n  type ConsentVariantInput,\n} from '@transcend-io/privacy-types';\nimport {\n  fetchAllActionItemCollections,\n  fetchAllActionItems,\n  fetchAllActions,\n  fetchAllAssessments,\n  fetchAllAttributes,\n  fetchAllBusinessEntities,\n  fetchAllCookies,\n  fetchAllDataCategories,\n  fetchAllDataFlows,\n  fetchAllPolicies,\n  fetchAllPrivacyCenters,\n  fetchAllProcessingPurposes,\n  fetchAllSiloDiscoveryResults,\n  fetchAllTemplates,\n  fetchConsentManager,\n  fetchConsentManagerExperiences,\n  fetchConsentVariants,\n  fetchConsentThemes,\n  fetchConsentManagerTheme,\n  fetchAllEnrichers,\n  fetchAllIdentifiers,\n  fetchAllMessages,\n  fetchAllProcessingActivities,\n  fetchAllPurposesAndPreferences,\n  fetchAllConsentWorkflowTriggers,\n  fetchAllPreferenceOptionValues,\n  fetchAllWorkflowConfigs,\n  fetchPartitions,\n  fetchAllTeams,\n  fetchAllVendors,\n  fetchApiKeys,\n  formatAttributeValues,\n  formatRegions,\n  parseAssessmentDisplayLogic,\n  parseAssessmentRiskLogic,\n  parsePurposesFromTriggerCondition,\n  resolveWorkflowTitleFromId,\n  convertToDataSubjectAllowlist,\n  fetchAllDataSubjects,\n  fetchEnrichedDataSilos,\n  workflowConfigMatchKey,\n  type AssessmentRule,\n} from '@transcend-io/sdk';\nimport colors from 'colors';\nimport { GraphQLClient } from 'graphql-request';\nimport { flatten, groupBy, keyBy, mapValues } from 'lodash-es';\n\n/* eslint-disable max-lines */\nimport {\n  TranscendInput,\n  ApiKeyInput,\n  DataSiloInput,\n  AttributeInput,\n  ActionInput,\n  IdentifierInput,\n  BusinessEntityInput,\n  EnricherInput,\n  DataFlowInput,\n  DataSubjectInput,\n  CookieInput,\n  DatapointInput,\n  FieldInput,\n  ProcessingPurposeInput,\n  ProcessingActivityInput,\n  DataCategoryInput,\n  VendorInput,\n  PolicyInput,\n  IntlMessageInput,\n  ActionItemInput,\n  TeamInput,\n  ActionItemCollectionInput,\n  AssessmentInput,\n  AssessmentTemplateInput,\n  AssessmentSectionInput,\n  AssessmentSectionQuestionInput,\n  RiskLogicInput,\n  ConsentPurpose,\n  PreferenceWorkflowConfigInput,\n  WorkflowConfigInput,\n  ConsentPreferenceTopic,\n  ConsentPreferenceTopicOptionValue,\n  type SiloDiscoveryResultInput,\n} from '../../codecs.js';\nimport { TranscendPullResource } from '../../enums.js';\nimport { logger } from '../../logger.js';\nimport { buildDeletionDependenciesInput } from './buildDeletionDependencies.js';\nimport { fetchAllAssessmentTemplates } from './fetchAllAssessmentTemplates.js';\n\nexport const DEFAULT_TRANSCEND_PULL_RESOURCES = [\n  TranscendPullResource.DataSilos,\n  TranscendPullResource.Enrichers,\n  TranscendPullResource.Templates,\n  TranscendPullResource.ApiKeys,\n];\n\nexport interface TranscendPullConfigurationInput {\n  /** Page size */\n  pageSize: number;\n  /** Enable debug logs */\n  debug: boolean;\n  /** The data silo IDs to sync. If empty list, pull all. */\n  dataSiloIds: string[];\n  /** Resources to pull in */\n  resources?: TranscendPullResource[];\n  /** The data silo types to sync.If empty list, pull all.  */\n  integrationNames: string[];\n  /** The tracker statuses to pull */\n  trackerStatuses?: ConsentTrackerStatus[];\n  /** Skip fetching of datapoints */\n  skipDatapoints?: boolean;\n  /** Skip fetching of subdatapoints */\n  skipSubDatapoints?: boolean;\n  /** When true, metadata around guessed data categories should be included */\n  includeGuessedCategories?: boolean;\n}\n\n/**\n * Pull a yaml configuration from Transcend\n *\n * @param client - GraphQL client\n * @param dataSiloIds - The data silos to sync. If empty list, pull all.\n * @returns The configuration\n */\nexport async function pullTranscendConfiguration(\n  client: GraphQLClient,\n  {\n    dataSiloIds,\n    integrationNames,\n    debug,\n    resources = DEFAULT_TRANSCEND_PULL_RESOURCES,\n    pageSize,\n    skipDatapoints,\n    includeGuessedCategories,\n    skipSubDatapoints,\n    trackerStatuses = Object.values(ConsentTrackerStatus),\n  }: TranscendPullConfigurationInput,\n): Promise<TranscendInput> {\n  if (dataSiloIds.length > 0 && integrationNames.length > 0) {\n    throw new Error('Only 1 of integrationNames OR dataSiloIds can be provided');\n  }\n\n  logger.info(colors.magenta(`Fetching data with page size ${pageSize}...`));\n\n  // Fetch all data, but only conditional fetch data that is requested\n  const [\n    dataSubjects,\n    apiKeyTitleMap,\n    dataSilos,\n    enrichers,\n    dataFlows,\n    cookies,\n    attributes,\n    templates,\n    identifiers,\n    actions,\n    businessEntities,\n    processingActivities,\n    consentManager,\n    consentManagerExperiences,\n    consentVariants,\n    consentThemes,\n    vendors,\n    dataCategories,\n    processingPurposes,\n    actionItems,\n    actionItemCollections,\n    teams,\n    policies,\n    privacyCenters,\n    messages,\n    partitions,\n    assessments,\n    assessmentTemplates,\n    purposes,\n    preferenceWorkflowConfigs,\n    workflowConfigs,\n    preferenceOptionValues,\n    siloDiscoveryResults,\n  ] = await Promise.all([\n    // Grab all data subjects in the organization\n    resources.includes(TranscendPullResource.DataSilos) ||\n    resources.includes(TranscendPullResource.DataSubjects)\n      ? fetchAllDataSubjects(client, { logger })\n      : [],\n    // Grab API keys\n    resources.includes(TranscendPullResource.ApiKeys)\n      ? fetchApiKeys(client, { fetchAll: true, logger })\n      : [],\n    // Fetch the data silos\n    resources.includes(TranscendPullResource.DataSilos)\n      ? fetchEnrichedDataSilos(client, {\n          ids: dataSiloIds,\n          integrationNames,\n          pageSize,\n          debug,\n          includeGuessedCategories,\n          skipDatapoints,\n          skipSubDatapoints,\n          logger,\n        })\n      : [],\n    // Fetch enrichers\n    resources.includes(TranscendPullResource.Enrichers)\n      ? fetchAllEnrichers(client, { logger })\n      : [],\n    // Fetch data flows\n    resources.includes(TranscendPullResource.DataFlows)\n      ? [\n          ...(trackerStatuses.includes(ConsentTrackerStatus.Live)\n            ? await fetchAllDataFlows(client, {\n                logger,\n                filterBy: { status: ConsentTrackerStatus.Live },\n              })\n            : []),\n          ...(trackerStatuses.includes(ConsentTrackerStatus.NeedsReview)\n            ? await fetchAllDataFlows(client, {\n                logger,\n                filterBy: { status: ConsentTrackerStatus.NeedsReview },\n              })\n            : []),\n        ]\n      : [],\n    // Fetch data flows\n    resources.includes(TranscendPullResource.Cookies)\n      ? [\n          ...(trackerStatuses.includes(ConsentTrackerStatus.Live)\n            ? await fetchAllCookies(client, {\n                logger,\n                filterBy: { status: ConsentTrackerStatus.Live },\n              })\n            : []),\n          ...(trackerStatuses.includes(ConsentTrackerStatus.NeedsReview)\n            ? await fetchAllCookies(client, {\n                logger,\n                filterBy: { status: ConsentTrackerStatus.NeedsReview },\n              })\n            : []),\n        ]\n      : [],\n    // Fetch attributes\n    resources.includes(TranscendPullResource.Attributes)\n      ? fetchAllAttributes(client, { logger })\n      : [],\n    // Fetch email templates\n    resources.includes(TranscendPullResource.Templates)\n      ? fetchAllTemplates(client, { logger })\n      : [],\n    // Fetch identifiers\n    resources.includes(TranscendPullResource.Identifiers)\n      ? fetchAllIdentifiers(client, { logger })\n      : [],\n    // Fetch actions\n    resources.includes(TranscendPullResource.Actions) ? fetchAllActions(client, { logger }) : [],\n    // Fetch business entities\n    resources.includes(TranscendPullResource.BusinessEntities)\n      ? fetchAllBusinessEntities(client, { logger })\n      : [],\n    // Fetch processing activities\n    resources.includes(TranscendPullResource.ProcessingActivities)\n      ? fetchAllProcessingActivities(client, { logger })\n      : [],\n    // Fetch consent manager\n    resources.includes(TranscendPullResource.ConsentManager)\n      ? fetchConsentManager(client, { logger })\n      : undefined,\n    // Fetch consent manager experiences\n    resources.includes(TranscendPullResource.ConsentManager)\n      ? fetchConsentManagerExperiences(client, { logger })\n      : [],\n    // Fetch consent manager consent variants\n    resources.includes(TranscendPullResource.ConsentManager)\n      ? fetchConsentVariants(client, { logger })\n      : [],\n    // Fetch consent manager consent themes\n    resources.includes(TranscendPullResource.ConsentManager)\n      ? fetchConsentThemes(client, { logger })\n      : [],\n    // Fetch vendors\n    resources.includes(TranscendPullResource.Vendors) ? fetchAllVendors(client, { logger }) : [],\n    // Fetch dataCategories\n    resources.includes(TranscendPullResource.DataCategories)\n      ? fetchAllDataCategories(client, { logger })\n      : [],\n    // Fetch dataCategories\n    resources.includes(TranscendPullResource.ProcessingPurposes)\n      ? fetchAllProcessingPurposes(client, { logger })\n      : [],\n    // Fetch actionItems\n    resources.includes(TranscendPullResource.ActionItems)\n      ? fetchAllActionItems(client, {\n          logger,\n          filterBy: { type: [ActionItemCode.Onboarding] },\n        })\n      : [],\n    // Fetch actionItemCollections\n    resources.includes(TranscendPullResource.ActionItemCollections)\n      ? fetchAllActionItemCollections(client, { logger })\n      : [],\n    // Fetch teams\n    resources.includes(TranscendPullResource.Teams) ? fetchAllTeams(client, { logger }) : [],\n    // Fetch policies\n    resources.includes(TranscendPullResource.Policies) ? fetchAllPolicies(client, { logger }) : [],\n    // Fetch privacy centers\n    resources.includes(TranscendPullResource.PrivacyCenters)\n      ? fetchAllPrivacyCenters(client, { logger })\n      : [],\n    // Fetch messages\n    resources.includes(TranscendPullResource.Messages) ? fetchAllMessages(client, { logger }) : [],\n    // Fetch partitions\n    resources.includes(TranscendPullResource.Partitions) ? fetchPartitions(client, { logger }) : [],\n    // Fetch assessments\n    resources.includes(TranscendPullResource.Assessments)\n      ? fetchAllAssessments(client, { logger })\n      : [],\n    // Fetch assessmentTemplates\n    resources.includes(TranscendPullResource.AssessmentTemplates)\n      ? fetchAllAssessmentTemplates(client)\n      : [],\n    // Fetch purpose and preferences\n    resources.includes(TranscendPullResource.Purposes)\n      ? fetchAllPurposesAndPreferences(client, { logger })\n      : [],\n    resources.includes(TranscendPullResource.PreferenceWorkflowConfigs)\n      ? fetchAllConsentWorkflowTriggers(client, { logger })\n      : [],\n    resources.includes(TranscendPullResource.WorkflowConfigs)\n      ? fetchAllWorkflowConfigs(client, {\n          logger,\n          workflowConfigType: WorkflowConfigType.DSR,\n        })\n      : [],\n    resources.includes(TranscendPullResource.PreferenceOptions)\n      ? fetchAllPreferenceOptionValues(client, { logger })\n      : [],\n    // Fetch silo discovery results\n    resources.includes(TranscendPullResource.SystemDiscovery)\n      ? fetchAllSiloDiscoveryResults(client, { logger })\n      : [],\n  ]);\n\n  const consentManagerTheme =\n    resources.includes(TranscendPullResource.ConsentManager) && consentManager\n      ? await fetchConsentManagerTheme(client, {\n          logger,\n          filterBy: { airgapBundleId: consentManager.id },\n        })\n      : undefined;\n\n  const result: TranscendInput = {};\n\n  // Save API keys\n  const apiKeyTitles = flatten(dataSilos.map(([{ apiKeys }]) => apiKeys.map(({ title }) => title)));\n  const relevantApiKeys = Object.values(apiKeyTitleMap).filter(({ title }) =>\n    resources.includes(TranscendPullResource.ApiKeys) ? true : apiKeyTitles.includes(title),\n  );\n  if (relevantApiKeys.length > 0 && resources.includes(TranscendPullResource.ApiKeys)) {\n    result['api-keys'] = relevantApiKeys.map(\n      ({ title }): ApiKeyInput => ({\n        title,\n      }),\n    );\n  }\n\n  // Save Partitions\n  if (partitions.length > 0 && resources.includes(TranscendPullResource.Partitions)) {\n    result.partitions = partitions.map(({ name, partition }) => ({\n      name,\n      partition,\n    }));\n  }\n\n  // Save Consent Manager\n  if (consentManager && resources.includes(TranscendPullResource.ConsentManager)) {\n    result['consent-manager'] = {\n      bundleUrls: {\n        TEST: consentManager.testBundleURL,\n        PRODUCTION: consentManager.bundleURL,\n      },\n      domains: consentManager.configuration.domains || undefined,\n      partition: consentManager.configuration.partition || undefined,\n      consentPrecedence: consentManager.configuration.consentPrecedence || undefined,\n      unknownRequestPolicy: consentManager.configuration.unknownRequestPolicy || undefined,\n      unknownCookiePolicy: consentManager.configuration.unknownCookiePolicy || undefined,\n      syncEndpoint: consentManager.configuration.syncEndpoint || undefined,\n      telemetryPartitioning: consentManager.configuration.telemetryPartitioning || undefined,\n      signedIabAgreement: consentManager.configuration.signedIabAgreement || undefined,\n      // TODO: https://transcend.height.app/T-23919 - reconsider simpler yml shape\n      syncGroups: consentManager.configuration.syncGroups || undefined,\n      theme: !consentManagerTheme\n        ? undefined\n        : {\n            primaryColor: consentManagerTheme.primaryColor || undefined,\n            fontColor: consentManagerTheme.fontColor || undefined,\n            privacyPolicy: consentManagerTheme.privacyPolicy || undefined,\n            prompt: consentManagerTheme.prompt,\n          },\n      experiences: consentManagerExperiences.map((experience) => ({\n        name: experience.name,\n        displayName: experience.displayName || undefined,\n        regions: experience.regions.map((region) => ({\n          countrySubDivision: region.countrySubDivision || undefined,\n          country: region.country || undefined,\n        })),\n        onConsentExpiry: experience.onConsentExpiry,\n        consentExpiry: experience.consentExpiry,\n        operator: experience.operator,\n        displayPriority: experience.displayPriority,\n        viewState: experience.viewState,\n        purposes: experience.purposes.map((purpose) => ({\n          trackingType: purpose.trackingType,\n        })),\n        optedOutPurposes: experience.optedOutPurposes.map((purpose) => ({\n          trackingType: purpose.trackingType,\n        })),\n        browserLanguages: experience.browserLanguages,\n        browserTimeZones: experience.browserTimeZones,\n        consentUiVariantSlug: experience.consentUiVariant?.slug,\n      })),\n      consentVariants: consentVariants.map(\n        (variant): ConsentVariantInput => ({\n          id: variant.id,\n          name: variant.name,\n          slug: variant.slug,\n          // Backend returns null when unset; omit from yaml rather than writing null\n          description: variant.description || undefined,\n          configuration: JSON.stringify(variant.configuration),\n          locales: variant.locales as LocaleValue[],\n          status: variant.status,\n          userFlow: variant.userFlow || undefined,\n          themeSlug: variant.theme?.slug || undefined,\n        }),\n      ),\n      consentThemes: consentThemes.map(\n        (theme): ConsentThemeInput => ({\n          id: theme.id,\n          name: theme.name,\n          slug: theme.slug,\n          configuration: JSON.stringify(theme.configuration),\n        }),\n      ),\n    };\n  }\n\n  // Save assessments\n  if (assessments.length > 0 && resources.includes(TranscendPullResource.Assessments)) {\n    result.assessments = assessments.map(\n      ({\n        title,\n        assessmentGroup,\n        sections,\n        creator,\n        description,\n        status,\n        assignees,\n        externalAssignees,\n        reviewers,\n        isLocked,\n        isArchived,\n        isExternallyCreated,\n        dueDate,\n        createdAt,\n        assignedAt,\n        submittedAt,\n        approvedAt,\n        rejectedAt,\n        titleIsInternal,\n        retentionSchedule,\n        attributeValues,\n        resources,\n        syncedRows,\n      }): AssessmentInput => ({\n        title,\n        group: assessmentGroup.title,\n        sections: sections.map(\n          ({\n            title,\n            status,\n            questions,\n            assignees,\n            isReviewed,\n            externalAssignees,\n          }): AssessmentSectionInput => ({\n            title,\n            status,\n            questions: questions.map(\n              ({\n                title,\n                type,\n                subType,\n                placeholder,\n                description,\n                isRequired,\n                referenceId,\n                displayLogic,\n                riskLogic,\n                riskCategories,\n                riskFramework,\n                answerOptions,\n                selectedAnswers,\n                allowedMimeTypes,\n                allowSelectOther,\n                syncModel,\n                syncColumn,\n                attributeKey,\n                requireRiskEvaluation,\n                requireRiskMatrixEvaluation,\n              }): AssessmentSectionQuestionInput => {\n                const displayLogicParsed = displayLogic\n                  ? parseAssessmentDisplayLogic(displayLogic)\n                  : undefined;\n                return {\n                  title,\n                  type,\n                  'sub-type': subType,\n                  placeholder,\n                  description,\n                  'is-required': isRequired,\n                  'reference-id': referenceId,\n                  'display-logic':\n                    displayLogicParsed && Object.keys(displayLogicParsed).length > 0\n                      ? {\n                          action: displayLogicParsed.action!,\n                          rule: displayLogicParsed.rule\n                            ? {\n                                'depends-on-question-reference-id':\n                                  displayLogicParsed.rule.dependsOnQuestionReferenceId,\n                                'comparison-operator': displayLogicParsed.rule.comparisonOperator,\n                                'comparison-operands':\n                                  // Safely access property with a check\n                                  'comparisonOperands' in displayLogicParsed.rule\n                                    ? displayLogicParsed.rule.comparisonOperands\n                                    : undefined,\n                              }\n                            : undefined,\n                          'nested-rule': displayLogicParsed.nestedRule\n                            ? {\n                                'logic-operator': displayLogicParsed.nestedRule.logicOperator,\n                                rules: (displayLogicParsed.nestedRule.rules || []).map(\n                                  (rule: AssessmentRule) => ({\n                                    'depends-on-question-reference-id':\n                                      rule.dependsOnQuestionReferenceId,\n                                    'comparison-operator': rule.comparisonOperator,\n                                    'comparison-operands':\n                                      // Safely access property on the nested rule\n                                      'comparisonOperands' in rule\n                                        ? rule.comparisonOperands\n                                        : undefined,\n                                  }),\n                                ),\n                              }\n                            : undefined,\n                        }\n                      : undefined,\n                  'risk-logic': riskLogic.map((logic): RiskLogicInput => {\n                    const parsed = parseAssessmentRiskLogic(logic);\n                    return {\n                      'risk-level': parsed.riskAssignment?.riskLevelId,\n                      'comparison-operands': parsed.comparisonOperands,\n                      'comparison-operator': parsed.comparisonOperator,\n                    };\n                  }),\n                  'risk-categories': riskCategories.map(({ title }) => title),\n                  'risk-framework': riskFramework?.title,\n                  'answer-options': answerOptions.map(({ value }) => ({\n                    value,\n                  })),\n                  'selected-answers': selectedAnswers.map(({ value }) => value),\n                  'allowed-mime-types': allowedMimeTypes,\n                  'allow-select-other': allowSelectOther,\n                  'sync-model': syncModel || undefined,\n                  'sync-column': syncColumn || undefined,\n                  'attribute-key': attributeKey?.name,\n                  'require-risk-evaluation': requireRiskEvaluation,\n                  'require-risk-matrix-evaluation': requireRiskMatrixEvaluation,\n                };\n              },\n            ),\n            assignees: assignees.map(({ email }) => email),\n            'external-assignees': externalAssignees.map(({ email }) => email),\n            'is-reviewed': isReviewed,\n          }),\n        ),\n        creator: creator?.email,\n        description,\n        status,\n        assignees: assignees.map(({ email }) => email),\n        'external-assignees': externalAssignees.map(({ email }) => email),\n        reviewers: reviewers.map(({ email }) => email),\n        locked: isLocked,\n        archived: isArchived,\n        external: isExternallyCreated,\n        'title-is-internal': titleIsInternal,\n        'due-date': dueDate || undefined,\n        'created-at': createdAt || undefined,\n        'assigned-at': assignedAt || undefined,\n        'submitted-at': submittedAt || undefined,\n        'approved-at': approvedAt || undefined,\n        'rejected-at': rejectedAt || undefined,\n        'retention-schedule': retentionSchedule\n          ? {\n              type: retentionSchedule.type,\n              'duration-days': retentionSchedule.durationDays,\n              operand: retentionSchedule.operation,\n            }\n          : undefined,\n        attributes:\n          attributeValues !== undefined && attributeValues.length > 0\n            ? formatAttributeValues(attributeValues)\n            : undefined,\n        resources: resources.map(({ resourceType, title, name, category, type, purpose }) => ({\n          type: resourceType,\n          title: category\n            ? `${category} - ${name}`\n            : purpose\n              ? `${purpose} - ${name}`\n              : title || name || type || '',\n        })),\n        rows: syncedRows.map(({ resourceType, title, name, category, type, purpose }) => ({\n          type: resourceType,\n          title: category\n            ? `${category} - ${name}`\n            : purpose\n              ? `${purpose} - ${name}`\n              : title || name || type || '',\n        })),\n      }),\n    );\n  }\n\n  // Save assessmentTemplates\n  if (\n    assessmentTemplates.length > 0 &&\n    resources.includes(TranscendPullResource.AssessmentTemplates)\n  ) {\n    result['assessment-templates'] = assessmentTemplates.map(\n      ({\n        title,\n        description,\n        sections,\n        status,\n        source,\n        creator,\n        isLocked,\n        isArchived,\n        createdAt,\n        retentionSchedule,\n      }): AssessmentTemplateInput => ({\n        title,\n        description,\n        sections: sections.map(\n          ({ title, questions }): AssessmentSectionInput => ({\n            title,\n            questions: questions.map(\n              ({\n                title,\n                type,\n                subType,\n                placeholder,\n                description,\n                isRequired,\n                referenceId,\n                displayLogic,\n                riskLogic,\n                riskCategories,\n                riskFramework,\n                answerOptions,\n                allowedMimeTypes,\n                allowSelectOther,\n                syncModel,\n                syncColumn,\n                attributeKey,\n                requireRiskEvaluation,\n                requireRiskMatrixEvaluation,\n              }): AssessmentSectionQuestionInput => {\n                const displayLogicParsed = displayLogic\n                  ? parseAssessmentDisplayLogic(displayLogic)\n                  : undefined;\n                return {\n                  title,\n                  type,\n                  'sub-type': subType,\n                  placeholder,\n                  description,\n                  'is-required': isRequired,\n                  'reference-id': referenceId,\n                  'display-logic':\n                    displayLogicParsed && Object.keys(displayLogicParsed).length > 0\n                      ? {\n                          action: displayLogicParsed.action!,\n                          rule: displayLogicParsed.rule\n                            ? {\n                                'depends-on-question-reference-id':\n                                  displayLogicParsed.rule.dependsOnQuestionReferenceId,\n                                'comparison-operator': displayLogicParsed.rule.comparisonOperator,\n                                'comparison-operands':\n                                  // Safely access property with a check\n                                  'comparisonOperands' in displayLogicParsed.rule\n                                    ? displayLogicParsed.rule.comparisonOperands\n                                    : undefined,\n                              }\n                            : undefined,\n                          'nested-rule': displayLogicParsed.nestedRule\n                            ? {\n                                'logic-operator': displayLogicParsed.nestedRule.logicOperator,\n                                rules: (displayLogicParsed.nestedRule.rules || []).map(\n                                  (rule: AssessmentRule) => ({\n                                    'depends-on-question-reference-id':\n                                      rule.dependsOnQuestionReferenceId,\n                                    'comparison-operator': rule.comparisonOperator,\n                                    'comparison-operands':\n                                      // Safely access property on the nested rule\n                                      'comparisonOperands' in rule\n                                        ? rule.comparisonOperands\n                                        : undefined,\n                                  }),\n                                ),\n                              }\n                            : undefined,\n                        }\n                      : undefined,\n                  'risk-logic': riskLogic.map((logic): RiskLogicInput => {\n                    const parsed = parseAssessmentRiskLogic(logic);\n                    return {\n                      'risk-level': parsed.riskAssignment?.riskLevelId,\n                      'risk-matrix-row': parsed.riskAssignment?.riskMatrixRowId,\n                      'risk-matrix-column': parsed.riskAssignment?.riskMatrixColumnId,\n                      'comparison-operands': parsed.comparisonOperands,\n                      'comparison-operator': parsed.comparisonOperator,\n                    };\n                  }),\n                  'risk-categories': riskCategories.map(({ title }) => title),\n                  'risk-framework': riskFramework?.title,\n                  'answer-options': answerOptions.map(({ value }) => ({\n                    value,\n                  })),\n                  'allowed-mime-types': allowedMimeTypes,\n                  'allow-select-other': allowSelectOther,\n                  'sync-model': syncModel || undefined,\n                  'sync-column': syncColumn || undefined,\n                  'attribute-key': attributeKey?.name,\n                  'require-risk-evaluation': requireRiskEvaluation,\n                  'require-risk-matrix-evaluation': requireRiskMatrixEvaluation,\n                };\n              },\n            ),\n          }),\n        ),\n        status,\n        source,\n        creator: creator?.email,\n        locked: isLocked,\n        archived: isArchived,\n        'created-at': createdAt || undefined,\n        'retention-schedule': retentionSchedule\n          ? {\n              type: retentionSchedule.type,\n              'duration-days': retentionSchedule.durationDays,\n              operand: retentionSchedule.operation,\n            }\n          : undefined,\n      }),\n    );\n  }\n\n  // Save Silo Discovery Results\n  if (\n    siloDiscoveryResults.length > 0 &&\n    resources.includes(TranscendPullResource.SystemDiscovery)\n  ) {\n    result['system-discovery'] = siloDiscoveryResults.map(\n      ({\n        title,\n        resourceId,\n        suggestedCatalog: { title: suggestedCatalogTitle },\n        plugin: {\n          dataSilo: { title: dataSiloTitle },\n        },\n        country,\n        countrySubDivision,\n        plaintextContext,\n        containsSensitiveData,\n        status,\n      }): SiloDiscoveryResultInput => ({\n        title,\n        resourceId,\n        suggestedCatalog: suggestedCatalogTitle,\n        plugin: dataSiloTitle,\n        country: country || undefined,\n        countrySubDivision: countrySubDivision || undefined,\n        plaintextContext,\n        containsSensitiveData,\n        status,\n      }),\n    );\n  }\n\n  // Save teams\n  if (teams.length > 0 && resources.includes(TranscendPullResource.Teams)) {\n    result.teams = teams.map(\n      ({\n        name,\n        description,\n        ssoDepartment,\n        ssoGroup,\n        ssoTitle,\n        users,\n        scopes,\n        parentTeam,\n      }): TeamInput => ({\n        name,\n        description,\n        'sso-department': ssoDepartment || undefined,\n        'sso-group': ssoGroup || undefined,\n        'sso-title': ssoTitle || undefined,\n        'parent-team-name': parentTeam?.name,\n        users: users.map(({ email }) => email),\n        scopes: scopes.map(({ name }) => name),\n      }),\n    );\n  }\n\n  // Save Data Subjects\n  if (dataSubjects.length > 0 && resources.includes(TranscendPullResource.DataSubjects)) {\n    result['data-subjects'] = dataSubjects.map(\n      ({\n        type,\n        title,\n        active,\n        adminDashboardDefaultSilentMode,\n        supportsAuthorizedAgent,\n        actions,\n      }): DataSubjectInput => ({\n        type,\n        title: title?.defaultMessage,\n        active,\n        adminDashboardDefaultSilentMode,\n        supportsAuthorizedAgent,\n        actions: actions.map(({ type }) => type),\n      }),\n    );\n  }\n\n  // Save privacy policies\n  if (policies.length > 0) {\n    result.policies = policies.map(\n      ({ title, type, versions, disabledLocales }): PolicyInput => ({\n        title: title?.defaultMessage,\n        type,\n        content: versions?.[0]?.content?.defaultMessage,\n        disabledLocales,\n      }),\n    );\n  }\n\n  // Save messages\n  if (messages.length > 0) {\n    result.messages = messages.map(\n      ({ id, defaultMessage, targetReactIntlId, description, translations }): IntlMessageInput => ({\n        id,\n        defaultMessage,\n        description,\n        targetReactIntlId: targetReactIntlId || undefined,\n        translations: translations.reduce(\n          (acc, { locale, value }) => Object.assign(acc, { [locale]: value }),\n          {} as Record<LocaleValue, string>,\n        ),\n      }),\n    );\n  }\n\n  // Save privacy center\n  if (privacyCenters.length > 0) {\n    const privacyCenter = privacyCenters[0];\n    result['privacy-center'] = {\n      isDisabled: privacyCenter.isDisabled,\n      showPrivacyRequestButton: privacyCenter.showPrivacyRequestButton,\n      showPolicies: privacyCenter.showPolicies,\n      showTrackingTechnologies: privacyCenter.showTrackingTechnologies,\n      showCookies: privacyCenter.showCookies,\n      showDataFlows: privacyCenter.showDataFlows,\n      showConsentManager: privacyCenter.showConsentManager,\n      showManageYourPrivacy: privacyCenter.showManageYourPrivacy,\n      showMarketingPreferences: privacyCenter.showMarketingPreferences,\n      locales: privacyCenter.locales,\n      defaultLocale: privacyCenter.defaultLocale,\n      preferBrowserDefaultLocale: privacyCenter.preferBrowserDefaultLocale,\n      supportEmail: privacyCenter.supportEmail || undefined,\n      replyToEmail: privacyCenter.replyToEmail || undefined,\n      useNoReplyEmailAddress: privacyCenter.useNoReplyEmailAddress,\n      useCustomEmailDomain: privacyCenter.useCustomEmailDomain,\n      transformAccessReportJsonToCsv: privacyCenter.transformAccessReportJsonToCsv,\n      home: privacyCenter.home || undefined,\n      expandSideMenuByDefault: privacyCenter.expandSideMenuByDefault,\n      workflowsCustomFieldsRequired: privacyCenter.workflowsCustomFieldsRequired,\n      footerLayout: privacyCenter.footerLayout,\n      ...(privacyCenter.childOrganizations.length > 0\n        ? {\n            displayedChildOrganizationUris: privacyCenter.childOrganizations.map(\n              (child) => child.uri,\n            ),\n          }\n        : {}),\n      ...(privacyCenter.footerLinks.length > 0\n        ? {\n            footerLinks: [...privacyCenter.footerLinks]\n              .sort((a, b) => a.displayOrder - b.displayOrder)\n              .map((link) => ({\n                title: link.title.defaultMessage,\n                ...(link.url ? { url: link.url } : {}),\n                ...(link.iconOnly ? { iconOnly: link.iconOnly } : {}),\n              })),\n          }\n        : {}),\n      theme: privacyCenter.theme,\n    };\n  }\n\n  // Save business entities\n  if (businessEntities.length > 0 && resources.includes(TranscendPullResource.BusinessEntities)) {\n    result['business-entities'] = businessEntities.map(\n      ({\n        title,\n        description,\n        address,\n        headquarterCountry,\n        headquarterSubDivision,\n        dataProtectionOfficerName,\n        dataProtectionOfficerEmail,\n        attributeValues,\n      }): BusinessEntityInput => ({\n        title,\n        description: description || undefined,\n        address: address || undefined,\n        headquarterCountry: headquarterCountry || undefined,\n        headquarterSubDivision: headquarterSubDivision || undefined,\n        dataProtectionOfficerName: dataProtectionOfficerName || undefined,\n        dataProtectionOfficerEmail: dataProtectionOfficerEmail || undefined,\n        attributes:\n          attributeValues !== undefined && attributeValues.length > 0\n            ? formatAttributeValues(attributeValues)\n            : undefined,\n      }),\n    );\n  }\n\n  // Save processing activities\n  if (\n    processingActivities.length > 0 &&\n    resources.includes(TranscendPullResource.ProcessingActivities)\n  ) {\n    result['processing-activities'] = processingActivities.map(\n      ({\n        title,\n        description,\n        securityMeasureDetails,\n        controllerships,\n        storageRegions,\n        transferRegions,\n        retentionType,\n        retentionPeriod,\n        dataProtectionImpactAssessmentLink,\n        dataProtectionImpactAssessmentStatus,\n        attributeValues,\n        dataSilos,\n        dataSubjects,\n        teams,\n        owners,\n        processingPurposeSubCategories,\n        dataSubCategories,\n        saaSCategories,\n      }): ProcessingActivityInput => ({\n        title,\n        description,\n        securityMeasureDetails: securityMeasureDetails ?? undefined,\n        controllerships: controllerships.length > 0 ? controllerships : undefined,\n        storageRegions: storageRegions.length > 0 ? formatRegions(storageRegions) : undefined,\n        transferRegions: transferRegions.length > 0 ? formatRegions(transferRegions) : undefined,\n        retentionType,\n        retentionPeriod: retentionType === RetentionType.StatedPeriod ? retentionPeriod : undefined,\n        dataProtectionImpactAssessmentLink: dataProtectionImpactAssessmentLink ?? undefined,\n        dataProtectionImpactAssessmentStatus,\n        attributes:\n          attributeValues !== undefined && attributeValues.length > 0\n            ? formatAttributeValues(attributeValues)\n            : undefined,\n        dataSiloTitles: dataSilos.length > 0 ? dataSilos.map(({ title }) => title) : undefined,\n        dataSubjectTypes:\n          dataSubjects.length > 0 ? dataSubjects.map(({ type }) => type) : undefined,\n        teamNames: teams.length > 0 ? teams.map(({ name }) => name) : undefined,\n        ownerEmails: owners.length > 0 ? owners.map(({ email }) => email) : undefined,\n        processingSubPurposes:\n          processingPurposeSubCategories.length > 0\n            ? processingPurposeSubCategories.map(({ name, purpose }) => ({\n                purpose,\n                ...(name ? { name } : {}),\n              }))\n            : undefined,\n        dataSubCategories:\n          dataSubCategories.length > 0\n            ? dataSubCategories.map(({ name, category }) => ({\n                category,\n                ...(name ? { name } : {}),\n              }))\n            : undefined,\n        saaSCategories:\n          saaSCategories.length > 0 ? saaSCategories.map(({ title }) => title) : undefined,\n      }),\n    );\n  }\n\n  // Save Actions\n  if (actions.length > 0 && resources.includes(TranscendPullResource.Actions)) {\n    result.actions = actions.map(\n      ({\n        type,\n        skipSecondaryIfNoFiles,\n        skipDownloadableStep,\n        requiresReview,\n        regionList,\n        regionDetectionMethod,\n        waitingPeriod,\n      }): ActionInput => ({\n        type,\n        ...(type === RequestAction.Erasure\n          ? {\n              skipSecondaryIfNoFiles,\n              skipDownloadableStep,\n            }\n          : {}),\n        requiresReview,\n        waitingPeriod,\n        regionDetectionMethod,\n        regionList: regionList.length > 0 ? regionList : undefined,\n      }),\n    );\n  }\n\n  // Save identifiers\n  if (identifiers.length > 0 && resources.includes(TranscendPullResource.Identifiers)) {\n    result.identifiers = identifiers.map(\n      ({\n        name,\n        type,\n        regex,\n        selectOptions,\n        privacyCenterVisibility,\n        isRequiredInForm,\n        placeholder,\n        displayTitle,\n        dataSubjects,\n        displayDescription,\n        displayOrder,\n        isUniqueOnPreferenceStore,\n      }): IdentifierInput => ({\n        name,\n        type,\n        regex,\n        selectOptions: selectOptions.length > 0 ? selectOptions : undefined,\n        privacyCenterVisibility:\n          privacyCenterVisibility.length > 0 ? privacyCenterVisibility : undefined,\n        isRequiredInForm,\n        placeholder: placeholder || undefined,\n        dataSubjects: dataSubjects.length > 0 ? dataSubjects.map(({ type }) => type) : undefined,\n        displayTitle: displayTitle?.defaultMessage,\n        displayDescription: displayDescription?.defaultMessage,\n        displayOrder,\n        isUniqueOnPreferenceStore,\n      }),\n    );\n  }\n\n  // Save action items\n  if (actionItems.length > 0 && resources.includes(TranscendPullResource.ActionItems)) {\n    result['action-items'] = actionItems.map(\n      ({\n        teams,\n        users,\n        customerExperienceActionItemIds: [customerExperienceActionItemId],\n        dueDate,\n        priority,\n        resolved,\n        collections,\n        notes,\n        link,\n        title,\n        type,\n        attributeValues,\n      }): ActionItemInput => ({\n        teams: teams.map(({ name }) => name),\n        users: users.map(({ email }) => email),\n        dueDate: dueDate || undefined,\n        title,\n        notes,\n        customerExperienceActionItemId,\n        collections: collections.map(({ title }) => title),\n        link,\n        priority: priority || undefined,\n        resolved,\n        type,\n        attributes:\n          attributeValues !== undefined && attributeValues.length > 0\n            ? formatAttributeValues(attributeValues)\n            : undefined,\n      }),\n    );\n  }\n\n  // Save action item collections\n  if (\n    actionItemCollections.length > 0 &&\n    resources.includes(TranscendPullResource.ActionItemCollections)\n  ) {\n    result['action-item-collections'] = actionItemCollections.map(\n      ({ title, description, hidden, productLine }): ActionItemCollectionInput => ({\n        title,\n        description: description || undefined,\n        hidden,\n        productLine,\n      }),\n    );\n  }\n\n  // Save vendors\n  if (vendors.length > 0 && resources.includes(TranscendPullResource.Vendors)) {\n    result.vendors = vendors.map(\n      ({\n        title,\n        description,\n        dataProcessingAgreementLink,\n        contactName,\n        contactPhone,\n        address,\n        headquarterCountry,\n        headquarterSubDivision,\n        websiteUrl,\n        businessEntity,\n        teams,\n        owners,\n        attributeValues,\n      }): VendorInput => ({\n        title,\n        description: description || undefined,\n        dataProcessingAgreementLink: dataProcessingAgreementLink || undefined,\n        contactName: contactName || undefined,\n        contactPhone: contactPhone || undefined,\n        address: address || undefined,\n        headquarterCountry: headquarterCountry || undefined,\n        headquarterSubDivision: headquarterSubDivision || undefined,\n        websiteUrl: websiteUrl || undefined,\n        businessEntity: businessEntity?.title,\n        teams: teams && teams.length > 0 ? teams.map(({ name }) => name) : undefined,\n        owners: owners && owners.length > 0 ? owners.map(({ email }) => email) : undefined,\n        attributes:\n          attributeValues !== undefined && attributeValues.length > 0\n            ? formatAttributeValues(attributeValues)\n            : undefined,\n      }),\n    );\n  }\n\n  // Save data categories\n  if (dataCategories.length > 0 && resources.includes(TranscendPullResource.DataCategories)) {\n    result['data-categories'] = dataCategories.map(\n      ({\n        name,\n        category,\n        description,\n        regex,\n        owners,\n        teams,\n        attributeValues,\n      }): DataCategoryInput => ({\n        name,\n        category,\n        description: description || undefined,\n        regex: regex || undefined,\n        owners: owners && owners.length > 0 ? owners.map(({ email }) => email) : undefined,\n        teams: teams && teams.length > 0 ? teams.map(({ name }) => name) : undefined,\n        attributes:\n          attributeValues !== undefined && attributeValues.length > 0\n            ? formatAttributeValues(attributeValues)\n            : undefined,\n      }),\n    );\n  }\n\n  // Save processing purposes\n  if (\n    processingPurposes.length > 0 &&\n    resources.includes(TranscendPullResource.ProcessingPurposes)\n  ) {\n    result['processing-purposes'] = processingPurposes.map(\n      ({ name, purpose, description, owners, teams, attributeValues }): ProcessingPurposeInput => ({\n        name,\n        purpose,\n        description: description || undefined,\n        owners: owners && owners.length > 0 ? owners.map(({ email }) => email) : undefined,\n        teams: teams && teams.length > 0 ? teams.map(({ name }) => name) : undefined,\n        attributes:\n          attributeValues !== undefined && attributeValues.length > 0\n            ? formatAttributeValues(attributeValues)\n            : undefined,\n      }),\n    );\n  }\n\n  // Save data flows\n  if (dataFlows.length > 0 && resources.includes(TranscendPullResource.DataFlows)) {\n    result['data-flows'] = dataFlows.map(\n      ({\n        value,\n        type,\n        description,\n        trackingType,\n        service,\n        status,\n        owners,\n        teams,\n        attributeValues,\n      }): DataFlowInput => ({\n        value,\n        type,\n        description: description || undefined,\n        trackingPurposes: trackingType,\n        status,\n        service: service?.integrationName,\n        owners: owners.map(({ email }) => email),\n        teams: teams.map(({ name }) => name),\n        attributes:\n          attributeValues !== undefined && attributeValues.length > 0\n            ? formatAttributeValues(attributeValues)\n            : undefined,\n      }),\n    );\n  }\n\n  // Save cookies\n  if (cookies.length > 0 && resources.includes(TranscendPullResource.Cookies)) {\n    result.cookies = cookies.map(\n      ({\n        name,\n        isRegex,\n        description,\n        trackingPurposes,\n        service,\n        status,\n        owners,\n        teams,\n        attributeValues,\n      }): CookieInput => ({\n        name,\n        isRegex,\n        description: description || undefined,\n        trackingPurposes,\n        status,\n        service: service?.integrationName,\n        owners: owners.map(({ email }) => email),\n        teams: teams.map(({ name }) => name),\n        attributes:\n          attributeValues !== undefined && attributeValues.length > 0\n            ? formatAttributeValues(attributeValues)\n            : undefined,\n      }),\n    );\n  }\n\n  // Save attributes\n  if (attributes.length > 0 && resources.includes(TranscendPullResource.Attributes)) {\n    result.attributes = attributes.map(\n      ({ description, name, type, values, enabledOn = [] }): AttributeInput => ({\n        description: description || undefined,\n        resources: enabledOn,\n        name,\n        type,\n        values: values.map(({ name, color, description }) => ({\n          name,\n          color: color || undefined,\n          description,\n        })),\n      }),\n    );\n  }\n\n  // save purposes\n  if (purposes.length > 0) {\n    result.purposes = purposes.map(\n      ({\n        name,\n        description,\n        trackingType,\n        defaultConsent,\n        configurable,\n        showInConsentManager,\n        isActive,\n        displayOrder,\n        optOutSignals,\n        authLevel,\n        topics,\n        showInPrivacyCenter,\n        title,\n      }): ConsentPurpose => ({\n        name,\n        title,\n        description: description || undefined,\n        trackingType,\n        'default-consent': defaultConsent,\n        configurable,\n        'show-in-consent-manager': showInConsentManager,\n        'show-in-privacy-center': showInPrivacyCenter,\n        'is-active': isActive,\n        'display-order': displayOrder,\n        'opt-out-signals': optOutSignals.length > 0 ? optOutSignals : undefined,\n        'auth-level': authLevel || undefined,\n        'preference-topics': topics.map(\n          ({\n            slug,\n            title,\n            type,\n            color,\n            displayDescription,\n            defaultConfiguration,\n            showInPrivacyCenter,\n            preferenceOptionValues,\n          }): ConsentPreferenceTopic => ({\n            slug,\n            title: title.defaultMessage,\n            type,\n            color,\n            description: displayDescription.defaultMessage,\n            'default-configuration': defaultConfiguration,\n            'show-in-privacy-center': showInPrivacyCenter,\n            options:\n              type === PreferenceTopicType.Boolean\n                ? []\n                : preferenceOptionValues.map(({ title, slug }) => ({\n                    title: title.defaultMessage,\n                    slug,\n                  })),\n          }),\n        ),\n      }),\n    );\n  }\n\n  if (workflowConfigs.length > 0 && resources.includes(TranscendPullResource.WorkflowConfigs)) {\n    const pulledWorkflowConfigs = workflowConfigs.map(\n      (config): WorkflowConfigInput => ({\n        title: config.title.defaultMessage,\n        'action-type': config.action.type,\n        ...(config.internalName ? { 'internal-name': config.internalName } : {}),\n        ...(config.subtitle ? { subtitle: config.subtitle.defaultMessage } : {}),\n        ...(config.description ? { description: config.description.defaultMessage } : {}),\n        ...(config.subject ? { 'data-subject-type': config.subject.type } : {}),\n        visibility: config.workflowConfigVisibility,\n        type: config.workflowConfigType,\n        ...(config.collectDataSubjectRegions\n          ? {\n              'collect-data-subject-regions': config.collectDataSubjectRegions,\n            }\n          : {}),\n        ...(config.regionList.length > 0 ? { 'region-list': config.regionList } : {}),\n        ...(config.expiryTime && config.expiryTime.length > 0\n          ? { 'expiry-time': config.expiryTime }\n          : {}),\n        ...(config.WorkflowConfigAttributeKeys && config.WorkflowConfigAttributeKeys.length > 0\n          ? {\n              'attribute-keys': config.WorkflowConfigAttributeKeys.map(\n                ({ attributeKey }) => attributeKey.name,\n              ),\n            }\n          : {}),\n      }),\n    );\n    // TODO: https://linear.app/transcend/issue/WAL-10312 - remove once internalName is unique in DB\n    const configsByMatchKey = groupBy(workflowConfigs, workflowConfigMatchKey);\n    for (const configs of Object.values(configsByMatchKey)) {\n      if (configs.length > 1) {\n        const sample = configs[0];\n        logger.warn(\n          `Found \"${configs.length}\" workflow configs with the same title, action-type, ` +\n            `data-subject-type, and region-list for \"${sample.title.defaultMessage}\" ` +\n            `(${sample.action.type}). Push will fail until they are disambiguated ` +\n            '(for example with unique internal names).',\n        );\n      }\n    }\n    if (pulledWorkflowConfigs.length > 0) {\n      result['workflow-configs'] = pulledWorkflowConfigs;\n    }\n  }\n\n  if (\n    preferenceWorkflowConfigs.length > 0 &&\n    resources.includes(TranscendPullResource.PreferenceWorkflowConfigs)\n  ) {\n    const needsWorkflowTitles = preferenceWorkflowConfigs.some(\n      (trigger) => trigger.workflowConfigId,\n    );\n    const dsrWorkflows = needsWorkflowTitles\n      ? await fetchAllWorkflowConfigs(client, {\n          logger,\n          workflowConfigType: WorkflowConfigType.DSR,\n        })\n      : [];\n\n    result['preference-workflow-configs'] = preferenceWorkflowConfigs.map(\n      (trigger): PreferenceWorkflowConfigInput => {\n        const purposes = parsePurposesFromTriggerCondition(trigger.triggerCondition);\n        const shared = {\n          name: trigger.name,\n          'data-subject-type': trigger.subject.type,\n          'is-silent': trigger.isSilent,\n          'allow-unauthenticated': trigger.allowUnauthenticated,\n          'is-active': trigger.isActive,\n          purposes,\n        };\n\n        if (trigger.workflowConfigId) {\n          const workflowTitle = resolveWorkflowTitleFromId(dsrWorkflows, trigger.workflowConfigId);\n          if (workflowTitle) {\n            return {\n              ...shared,\n              'workflow-title': workflowTitle,\n            };\n          }\n          // Workflow deleted or unreadable — fall back to legacy fields so YAML stays usable\n        }\n\n        return {\n          ...shared,\n          'action-type': trigger.action.type,\n          'data-silo-titles':\n            trigger.dataSilos.length > 0 ? trigger.dataSilos.map((ds) => ds.title) : undefined,\n        };\n      },\n    );\n  }\n\n  if (\n    preferenceOptionValues.length > 0 &&\n    resources.includes(TranscendPullResource.PreferenceOptions)\n  ) {\n    result['preference-options'] = preferenceOptionValues.map(\n      ({ slug, title }): ConsentPreferenceTopicOptionValue => ({\n        slug,\n        title: title.defaultMessage,\n      }),\n    );\n  }\n\n  // save email templates\n  if (\n    dataSiloIds.length === 0 &&\n    templates.length > 0 &&\n    resources.includes(TranscendPullResource.Templates)\n  ) {\n    result.templates = templates.map(({ title }) => ({ title }));\n  }\n\n  // Save enrichers\n  if (enrichers.length > 0 && resources.includes(TranscendPullResource.Enrichers)) {\n    result.enrichers = enrichers.map(\n      ({\n        title,\n        url,\n        type,\n        inputIdentifier,\n        identifiers,\n        actions,\n        testRegex,\n        dataSubjects,\n        expirationDuration,\n        lookerQueryTitle,\n        transitionRequestStatus,\n        phoneNumbers,\n        regionList,\n      }): EnricherInput => ({\n        title,\n        url: url || undefined,\n        type,\n        'input-identifier': inputIdentifier?.name,\n        'output-identifiers': identifiers.map(({ name }) => name),\n        'privacy-actions':\n          Object.values(RequestAction).length === actions.length ? undefined : actions,\n        testRegex: testRegex || undefined,\n        lookerQueryTitle: lookerQueryTitle || undefined,\n        expirationDuration: parseInt(expirationDuration, 10),\n        transitionRequestStatus: transitionRequestStatus || undefined,\n        phoneNumbers: phoneNumbers && phoneNumbers.length > 0 ? phoneNumbers : undefined,\n        regionList: regionList && regionList.length > 0 ? regionList : undefined,\n        'data-subjects': dataSubjects.map(({ type }) => type),\n      }),\n    );\n  }\n\n  // Save data silos\n  if (dataSilos.length > 0 && resources.includes(TranscendPullResource.DataSilos)) {\n    const indexedDataSubjects = keyBy(dataSubjects, 'type');\n    result['data-silos'] = dataSilos.map(\n      ([\n        {\n          title,\n          description,\n          url,\n          type,\n          outerType,\n          apiKeys,\n          notifyEmailAddress,\n          identifiers,\n          dependentDataSilos,\n          dependedOnDataSilosPerWorkflow,\n          owners,\n          country,\n          countrySubDivision,\n          teams,\n          subjectBlocklist,\n          isLive,\n          promptAVendorEmailSendFrequency,\n          promptAVendorEmailSendType,\n          promptAVendorEmailIncludeIdentifiersAttachment,\n          promptAVendorEmailCompletionLinkType,\n          manualWorkRetryFrequency,\n          catalog,\n          attributeValues,\n          discoveredBy,\n          businessEntities,\n          sombra,\n        },\n        dataPoints,\n      ]): DataSiloInput => ({\n        title,\n        description,\n        integrationName: type,\n        'outer-type': outerType || undefined,\n        url: url || undefined,\n        'api-key-title': apiKeys[0]?.title,\n        'sombra-id': sombra?.id || undefined,\n        'identity-keys': identifiers\n          .filter(({ isConnected }) => isConnected)\n          .map(({ name }) => name),\n        ...buildDeletionDependenciesInput({\n          dependentDataSilos,\n          dependedOnDataSilosPerWorkflow,\n        }),\n        ...(owners.length > 0 ? { owners: owners.map(({ email }) => email) } : {}),\n        ...(teams.length > 0 ? { teams: teams.map(({ name }) => name) } : {}),\n        ...(discoveredBy.length > 0\n          ? { discoveredBy: discoveredBy.map(({ title }) => title) }\n          : {}),\n        ...(businessEntities.length > 0\n          ? {\n              businessEntities: businessEntities.map(({ title }) => title),\n            }\n          : {}),\n        country: country || undefined,\n        countrySubDivision: countrySubDivision || undefined,\n        disabled: !isLive,\n        'data-subjects':\n          subjectBlocklist.length > 0\n            ? convertToDataSubjectAllowlist(\n                subjectBlocklist.map(({ type }) => type),\n                indexedDataSubjects,\n              )\n            : undefined,\n        ...(catalog.hasAvcFunctionality\n          ? {\n              'email-settings': {\n                'notify-email-address': notifyEmailAddress || undefined,\n                'send-frequency': promptAVendorEmailSendFrequency,\n                'send-type': promptAVendorEmailSendType,\n                'include-identifiers-attachment': promptAVendorEmailIncludeIdentifiersAttachment,\n                'completion-link-type': promptAVendorEmailCompletionLinkType,\n                'manual-work-retry-frequency': manualWorkRetryFrequency,\n              },\n            }\n          : {}),\n        attributes:\n          attributeValues !== undefined && attributeValues.length > 0\n            ? formatAttributeValues(attributeValues)\n            : undefined,\n\n        datapoints: dataPoints\n          .map(\n            (dataPoint): DatapointInput => ({\n              key: dataPoint.name,\n              title: dataPoint.title?.defaultMessage,\n              description: dataPoint.description?.defaultMessage,\n              owners: dataPoint.owners.map(({ email }) => email),\n              teams: dataPoint.teams.map(({ name }) => name),\n              ...(dataPoint.path.length > 0 ? { path: dataPoint.path } : {}),\n              ...(dataPoint.dataCollection?.title\n                ? {\n                    'data-collection-tag': dataPoint.dataCollection.title.defaultMessage,\n                  }\n                : {}),\n              ...(dataPoint.dbIntegrationQueries.length > 0\n                ? {\n                    'privacy-action-queries': mapValues(\n                      keyBy(dataPoint.dbIntegrationQueries, 'requestType'),\n                      (databaseIntegrationQuery) =>\n                        databaseIntegrationQuery.suggestedQuery ||\n                        databaseIntegrationQuery.query ||\n                        undefined,\n                    ),\n                  }\n                : {}),\n              ...(dataPoint.subDataPoints.length > 0\n                ? {\n                    fields: dataPoint.subDataPoints\n                      .map(\n                        (field): FieldInput => ({\n                          key: field.name,\n                          description: field.description,\n                          purposes: field.purposes,\n                          categories: field.categories,\n                          ...(includeGuessedCategories && field.pendingCategoryGuesses\n                            ? {\n                                'guessed-categories': field.pendingCategoryGuesses\n                                  .filter((guess) => guess.status === 'PENDING')\n                                  .map((guess) => ({\n                                    category: {\n                                      name: guess.category.name,\n                                      category: guess.category.category,\n                                    },\n                                    status: guess.status,\n                                    confidence: guess.confidence,\n                                    classifierVersion: guess.classifierVersion || undefined,\n                                  })),\n                              }\n                            : {}),\n                          'access-request-visibility-enabled': field.accessRequestVisibilityEnabled,\n                          'erasure-request-redaction-enabled': field.erasureRequestRedactionEnabled,\n                          attributes:\n                            field.attributeValues !== undefined && field.attributeValues.length > 0\n                              ? formatAttributeValues(field.attributeValues)\n                              : undefined,\n                        }),\n                      )\n                      .sort((a, b) => a.key.localeCompare(b.key)),\n                  }\n                : {}),\n              'privacy-actions': dataPoint.actionSettings\n                .filter(({ active }) => active)\n                .map(({ type }) => type),\n            }),\n          )\n          .sort((a, b) =>\n            [...(a.path ?? []), a.key]\n              .join('.')\n              .localeCompare([...(b.path ?? []), b.key].join('.')),\n          ),\n      }),\n    );\n  }\n  return result;\n}\n/* eslint-enable max-lines */\n"],"mappings":"+kDAUA,MAAa,EAAuB,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAmD3B,EAA0B;;;;;ECJtC,eAAsB,EACpB,EAC+B,CAC/B,IAAM,EAA4C,EAAE,CAChD,EAAS,EAET,EAAiB,GACrB,EAAG,CACD,GAAM,CACJ,wBAAyB,CAAE,UACzB,MAAM,EAMP,EAAQ,EAAsB,CAC/B,UAAW,CAAE,MAAO,GAAW,SAAQ,CACvC,SACD,CAAC,CACF,EAAoB,KAAK,GAAG,EAAM,CAClC,GAAU,GACV,EAAiB,EAAM,SAAW,SAC3B,GAET,OAAO,EAAoB,MAAM,EAAG,IAAM,EAAE,MAAM,cAAc,EAAE,MAAM,CAAC,CCpE3E,SAAgB,GACd,EAC8C,CAC9C,GAAM,CAAE,qBAAoB,kCAAmC,EAEzD,EAAe,EAAmB,KAAK,CAAE,WAAY,EAAM,CAE3D,EAAoB,EAA+B,KACtD,CAAE,uBAAsB,0BAA2B,CAClD,SAAU,EACV,OAA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