{"version":3,"file":"constants-Cdvbd9wA.mjs","names":[],"sources":["../package.json","../src/constants.ts"],"sourcesContent":["","import { ScopeName, TRANSCEND_SCOPES, type ScopeDefinition } from '@transcend-io/privacy-types';\nimport { keyBy } from 'lodash-es';\n\nimport { TranscendInput } from './codecs.js';\nimport { TranscendPullResource } from './enums.js';\n\nexport { description, version } from '../package.json';\n/**\n * The name of the main binary for the CLI\n */\nexport const name = 'transcend';\n\nexport const ADMIN_DASH = 'https://app.transcend.io';\n\nexport const ADMIN_DASH_INTEGRATIONS = `${ADMIN_DASH}/infrastructure/integrations`;\nexport const ADMIN_DASH_DATAPOINTS = `${ADMIN_DASH}/data-map/data-inventory/data-points`;\n\n/**\n * Override default transcend API url using\n * TRANSCEND_API_URL=https://api.us.transcend.io transcend ...\n */\nexport const DEFAULT_TRANSCEND_API = process.env.TRANSCEND_API_URL || 'https://api.transcend.io';\n\n/**\n * Default the `--auth` flag to the `TRANSCEND_API_KEY` environment variable\n * when it is set, so callers do not need to pass `--auth` on every invocation:\n *   TRANSCEND_API_KEY=... transcend policy bundles\n * When unset, `--auth` remains required.\n */\nexport const DEFAULT_TRANSCEND_API_KEY = process.env.TRANSCEND_API_KEY || undefined;\n\n/**\n * Override default transcend API url using\n * TRANSCEND_CONSENT_API_URL=https://consent.us.transcend.io transcend ...\n */\nexport const DEFAULT_TRANSCEND_CONSENT_API =\n  process.env.TRANSCEND_CONSENT_API_URL || 'https://consent.transcend.io';\n\n/**\n * Mapping between resource type and scopes required for cli\n */\nexport const TR_PUSH_RESOURCE_SCOPE_MAP: {\n  [k in TranscendPullResource]: ScopeName[];\n} = {\n  [TranscendPullResource.ApiKeys]: [ScopeName.ViewApiKeys],\n  [TranscendPullResource.Templates]: [ScopeName.ManageEmailTemplates],\n  // ViewApiKeys — resolve api-key-title → apiKeyId when present on data silos\n  [TranscendPullResource.DataSilos]: [\n    ScopeName.ManageDataMap,\n    ScopeName.ConnectDataSilos,\n    ScopeName.ViewApiKeys,\n  ],\n  [TranscendPullResource.Enrichers]: [ScopeName.ManageRequestIdentities],\n  [TranscendPullResource.BusinessEntities]: [ScopeName.ManageDataInventory],\n  [TranscendPullResource.ProcessingActivities]: [ScopeName.ManageDataMap],\n  [TranscendPullResource.Identifiers]: [ScopeName.ManageRequestIdentities],\n  [TranscendPullResource.Attributes]: [ScopeName.ManageGlobalAttributes],\n  [TranscendPullResource.DataFlows]: [ScopeName.ManageDataFlow],\n  [TranscendPullResource.Cookies]: [ScopeName.ManageDataFlow],\n  [TranscendPullResource.ConsentManager]: [ScopeName.ManageConsentManagerDeveloperSettings],\n  [TranscendPullResource.Partitions]: [ScopeName.ManageConsentManagerDeveloperSettings],\n  [TranscendPullResource.Actions]: [ScopeName.ManageDataSubjectRequestSettings],\n  [TranscendPullResource.DataSubjects]: [ScopeName.ManageDataSubjectRequestSettings],\n  [TranscendPullResource.Vendors]: [ScopeName.ManageDataInventory],\n  [TranscendPullResource.DataCategories]: [ScopeName.ManageDataInventory],\n  [TranscendPullResource.ProcessingPurposes]: [ScopeName.ManageDataInventory],\n  [TranscendPullResource.ActionItems]: [\n    ScopeName.ManageAllActionItems,\n    ScopeName.ViewGlobalAttributes,\n  ],\n  [TranscendPullResource.ActionItemCollections]: [ScopeName.ManageActionItemCollections],\n  [TranscendPullResource.Teams]: [ScopeName.ManageAccessControl],\n  [TranscendPullResource.Messages]: [ScopeName.ManageIntlMessages],\n  [TranscendPullResource.PrivacyCenters]: [ScopeName.ManagePrivacyCenter],\n  [TranscendPullResource.Policies]: [ScopeName.ManagePolicies],\n  [TranscendPullResource.Assessments]: [ScopeName.ManageAssessments],\n  [TranscendPullResource.AssessmentTemplates]: [ScopeName.ManageAssessments],\n  [TranscendPullResource.Purposes]: [\n    ScopeName.ManageConsentManager,\n    ScopeName.ManagePreferenceStoreSettings,\n  ],\n  [TranscendPullResource.PreferenceOptions]: [ScopeName.ManagePreferenceStoreSettings],\n  [TranscendPullResource.SystemDiscovery]: [ScopeName.ManageDataMap],\n  // Primary: ManagePreferenceStoreSettings (createOrUpdateConsentWorkflowTrigger).\n  // Related fetches used during sync:\n  // - ViewDataSubjectRequestSettings — resolve action-type / data-subject-type (legacy)\n  // - ViewConsentManager — resolve purposes[].tracking-type → purposeId\n  // - ViewDataMap — resolve data-silo-titles (legacy, only when present)\n  // - ManageWorkflows — list DSR workflows when workflow-title is set (V2)\n  [TranscendPullResource.PreferenceWorkflowConfigs]: [\n    ScopeName.ManagePreferenceStoreSettings,\n    ScopeName.ViewDataSubjectRequestSettings,\n    ScopeName.ViewConsentManager,\n    ScopeName.ViewDataMap,\n    ScopeName.ManageWorkflows,\n  ],\n  // ManageWorkflows inherits ViewDataSubjectRequestSettings and ViewGlobalAttributes\n  // (needed to resolve action/data-subject/attribute-key names to IDs on push)\n  [TranscendPullResource.WorkflowConfigs]: [ScopeName.ManageWorkflows],\n};\n\n/**\n * Mapping between resource type and scopes required for cli\n */\nexport const TR_PULL_RESOURCE_SCOPE_MAP: {\n  [k in TranscendPullResource]: ScopeName[];\n} = {\n  [TranscendPullResource.ApiKeys]: [ScopeName.ViewApiKeys],\n  [TranscendPullResource.Templates]: [ScopeName.ViewEmailTemplates],\n  // ViewApiKeys — dataSilos.apiKeys on the enriched pull query\n  [TranscendPullResource.DataSilos]: [\n    ScopeName.ViewDataMap,\n    ScopeName.ViewDataSubjectRequestSettings,\n    ScopeName.ViewApiKeys,\n  ],\n  [TranscendPullResource.Enrichers]: [ScopeName.ViewRequestIdentitySettings],\n  [TranscendPullResource.BusinessEntities]: [ScopeName.ViewDataInventory],\n  [TranscendPullResource.ProcessingActivities]: [ScopeName.ViewDataInventory],\n  [TranscendPullResource.Identifiers]: [ScopeName.ViewRequestIdentitySettings],\n  [TranscendPullResource.Attributes]: [ScopeName.ViewGlobalAttributes],\n  [TranscendPullResource.DataFlows]: [ScopeName.ViewDataFlow],\n  [TranscendPullResource.Cookies]: [ScopeName.ViewDataFlow],\n  [TranscendPullResource.ConsentManager]: [ScopeName.ViewConsentManager],\n  [TranscendPullResource.Partitions]: [ScopeName.ViewConsentManager],\n  [TranscendPullResource.Actions]: [ScopeName.ViewDataSubjectRequestSettings],\n  [TranscendPullResource.DataSubjects]: [ScopeName.ViewDataSubjectRequestSettings],\n  [TranscendPullResource.Vendors]: [ScopeName.ViewDataInventory],\n  [TranscendPullResource.DataCategories]: [ScopeName.ViewDataInventory],\n  [TranscendPullResource.ProcessingPurposes]: [ScopeName.ViewDataInventory],\n  [TranscendPullResource.ActionItemCollections]: [ScopeName.ViewAllActionItems],\n  [TranscendPullResource.ActionItems]: [ScopeName.ViewAllActionItems],\n  [TranscendPullResource.Teams]: [ScopeName.ViewScopes],\n  [TranscendPullResource.Messages]: [ScopeName.ViewIntlMessages],\n  [TranscendPullResource.PrivacyCenters]: [ScopeName.ViewPrivacyCenter],\n  [TranscendPullResource.Policies]: [ScopeName.ViewPolicies],\n  [TranscendPullResource.Assessments]: [ScopeName.ViewAssessments],\n  [TranscendPullResource.AssessmentTemplates]: [ScopeName.ViewAssessments],\n  [TranscendPullResource.Purposes]: [\n    ScopeName.ViewConsentManager,\n    ScopeName.ViewPreferenceStoreSettings,\n  ],\n  [TranscendPullResource.PreferenceOptions]: [ScopeName.ViewPreferenceStoreSettings],\n  [TranscendPullResource.SystemDiscovery]: [ScopeName.ViewDataMap],\n  // ViewPreferenceStoreSettings — consentWorkflowTriggers GraphQL query\n  // ManageWorkflows — resolve workflowConfigId → workflow-title for V2 configs\n  [TranscendPullResource.PreferenceWorkflowConfigs]: [\n    ScopeName.ViewPreferenceStoreSettings,\n    ScopeName.ManageWorkflows,\n  ],\n  [TranscendPullResource.WorkflowConfigs]: [ScopeName.ViewWorkflows],\n};\n\nexport const TR_YML_RESOURCE_TO_FIELD_NAME: Record<TranscendPullResource, keyof TranscendInput> = {\n  [TranscendPullResource.ApiKeys]: 'api-keys',\n  [TranscendPullResource.Attributes]: 'attributes',\n  [TranscendPullResource.DataFlows]: 'data-flows',\n  [TranscendPullResource.Cookies]: 'cookies',\n  [TranscendPullResource.ConsentManager]: 'consent-manager',\n  [TranscendPullResource.Partitions]: 'partitions',\n  [TranscendPullResource.Actions]: 'actions',\n  [TranscendPullResource.DataSubjects]: 'data-subjects',\n  [TranscendPullResource.BusinessEntities]: 'business-entities',\n  [TranscendPullResource.ProcessingActivities]: 'processing-activities',\n  [TranscendPullResource.Identifiers]: 'identifiers',\n  [TranscendPullResource.Enrichers]: 'enrichers',\n  [TranscendPullResource.DataSilos]: 'data-silos',\n  [TranscendPullResource.Templates]: 'templates',\n  [TranscendPullResource.Vendors]: 'vendors',\n  [TranscendPullResource.DataCategories]: 'data-categories',\n  [TranscendPullResource.ProcessingPurposes]: 'processing-purposes',\n  [TranscendPullResource.ActionItems]: 'action-items',\n  [TranscendPullResource.ActionItemCollections]: 'action-item-collections',\n  [TranscendPullResource.Teams]: 'teams',\n  [TranscendPullResource.Messages]: 'messages',\n  [TranscendPullResource.PrivacyCenters]: 'privacy-center',\n  [TranscendPullResource.Policies]: 'policies',\n  [TranscendPullResource.Assessments]: 'assessments',\n  [TranscendPullResource.AssessmentTemplates]: 'assessment-templates',\n  [TranscendPullResource.Purposes]: 'purposes',\n  [TranscendPullResource.PreferenceOptions]: 'preference-options',\n  [TranscendPullResource.SystemDiscovery]: 'system-discovery',\n  [TranscendPullResource.PreferenceWorkflowConfigs]: 'preference-workflow-configs',\n  [TranscendPullResource.WorkflowConfigs]: 'workflow-configs',\n};\n\nexport const SCOPES_BY_TITLE = keyBy(\n  Object.entries(TRANSCEND_SCOPES).map(([name, value]) => ({\n    ...value,\n    name,\n  })),\n  'title',\n) as Record<\n  string,\n  ScopeDefinition & {\n    /** The camelCased name which identifies the scope */\n    name: ScopeName;\n  }\n>;\n\nexport const SCOPE_TITLES = Object.keys(SCOPES_BY_TITLE);\n\n/**\n * HTTP statuses that should be retried *in place* without splitting.\n * 429: Rate-limited\n * 502: Upstream/edge gateway error\n * 329: Reserved for custom infra (kept defensively)\n */\nexport const RETRYABLE_BATCH_STATUSES = new Set([429, 502, 500, 504, 329] as const);\n\n/**\n * Debugging\n */\nexport const DEBUG = process.env.DEBUG === '1';\n"],"mappings":"wOCUA,MAAa,EAAO,YAEP,EAAa,2BAEb,EAA0B,GAAG,EAAW,8BACxC,EAAwB,GAAG,EAAW,sCAMtC,EAAwB,QAAQ,IAAI,mBAAqB,2BAQzD,EAA4B,QAAQ,IAAI,mBAAqB,IAAA,GAM7D,EACX,QAAQ,IAAI,2BAA6B,+BAK9B,EAET,SAC+B,CAAC,EAAU,YAAY,WACrB,CAAC,EAAU,qBAAqB,WAEhC,CACjC,EAAU,cACV,EAAU,iBACV,EAAU,YACX,WACkC,CAAC,EAAU,wBAAwB,kBAC5B,CAAC,EAAU,oBAAoB,sBAC3B,CAAC,EAAU,cAAc,aAClC,CAAC,EAAU,wBAAwB,cACpC,CAAC,EAAU,uBAAuB,WACnC,CAAC,EAAU,eAAe,SAC5B,CAAC,EAAU,eAAe,gBACnB,CAAC,EAAU,sCAAsC,YACrD,CAAC,EAAU,sCAAsC,SACpD,CAAC,EAAU,iCAAiC,cACvC,CAAC,EAAU,iCAAiC,SACjD,CAAC,EAAU,oBAAoB,gBACxB,CAAC,EAAU,oBAAoB,oBAC3B,CAAC,EAAU,oBAAoB,aACtC,CACnC,EAAU,qBACV,EAAU,qBACX,uBAC8C,CAAC,EAAU,4BAA4B,OACvD,CAAC,EAAU,oBAAoB,UAC5B,CAAC,EAAU,mBAAmB,gBACxB,CAAC,EAAU,oBAAoB,UACrC,CAAC,EAAU,eAAe,aACvB,CAAC,EAAU,kBAAkB,qBACrB,CAAC,EAAU,kBAAkB,UACxC,CAChC,EAAU,qBACV,EAAU,8BACX,mBAC0C,CAAC,EAAU,8BAA8B,iBAC3C,CAAC,EAAU,cAAc,2BAOf,CACjD,EAAU,8BACV,EAAU,+BACV,EAAU,mBACV,EAAU,YACV,EAAU,gBACX,iBAGwC,CAAC,EAAU,gBAAgB,CACrE,CAKY,EAET,SAC+B,CAAC,EAAU,YAAY,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