{"version":3,"file":"impl-0_NDQrqL.mjs","names":[],"sources":["../src/lib/consent-manager/types.ts","../src/commands/consent/upload-consent-preferences/impl.ts"],"sourcesContent":["import * as t from 'io-ts';\n\nexport const ConsentPreferenceUpload = t.intersection([\n  t.type({\n    /** User ID */\n    userId: t.string,\n    /** Has the consent been updated (including no-change confirmation) since default resolution */\n    timestamp: t.string,\n  }),\n  t.partial({\n    /** Was tracking consent confirmed by the user? If this is false, the consent was resolved from defaults & is not yet confirmed */\n    confirmed: t.union([t.literal('true'), t.literal('false')]),\n    /**\n     * Has the consent been updated (including no-change confirmation) since default resolution\n     */\n    updated: t.union([t.literal('true'), t.literal('false')]),\n    /**\n     * Whether or not the UI has been shown to the end-user (undefined in older versions of airgap.js)\n     */\n    prompted: t.union([t.literal('true'), t.literal('false')]),\n    /** Consent metadata */\n    metadata: t.string,\n    /** US Privacy (USP) String */\n    usp: t.union([t.string, t.null]),\n    /** IAB GPP String */\n    gpp: t.union([t.string, t.null]),\n    /**\n     * Purpose map\n     * This is a stringified JSON object with keys as purpose names and values as booleans or 'Auto'\n     */\n    purposes: t.string,\n  }),\n]);\n\n/** Type override */\nexport type ConsentPreferenceUpload = t.TypeOf<typeof ConsentPreferenceUpload>;\n","import type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { ConsentPreferenceUpload } from '../../../lib/consent-manager/types.js';\nimport { uploadConsents } from '../../../lib/consent-manager/uploadConsents.js';\nimport { readCsv } from '../../../lib/requests/index.js';\n\nexport interface UploadConsentPreferencesCommandFlags {\n  base64EncryptionKey: string;\n  base64SigningKey: string;\n  partition: string;\n  file: string;\n  consentUrl: string;\n  concurrency: number;\n}\n\nexport async function uploadConsentPreferences(\n  this: LocalContext,\n  {\n    base64EncryptionKey,\n    base64SigningKey,\n    partition,\n    file,\n    consentUrl,\n    concurrency,\n  }: UploadConsentPreferencesCommandFlags,\n): Promise<void> {\n  doneInputValidation(this.process.exit);\n\n  // Load in preferences from csv\n  const preferences = readCsv(file, ConsentPreferenceUpload);\n\n  // Upload cookies\n  await uploadConsents({\n    base64EncryptionKey,\n    base64SigningKey,\n    preferences,\n    partition,\n    concurrency,\n    transcendUrl: consentUrl,\n  });\n}\n"],"mappings":"8KAEA,MAAa,EAA0B,EAAE,aAAa,CACpD,EAAE,KAAK,CAEL,OAAQ,EAAE,OAEV,UAAW,EAAE,OACd,CAAC,CACF,EAAE,QAAQ,CAER,UAAW,EAAE,MAAM,CAAC,EAAE,QAAQ,OAAO,CAAE,EAAE,QAAQ,QAAQ,CAAC,CAAC,CAI3D,QAAS,EAAE,MAAM,CAAC,EAAE,QAAQ,OAAO,CAAE,EAAE,QAAQ,QAAQ,CAAC,CAAC,CAIzD,SAAU,EAAE,MAAM,CAAC,EAAE,QAAQ,OAAO,CAAE,EAAE,QAAQ,QAAQ,CAAC,CAAC,CAE1D,SAAU,EAAE,OAEZ,IAAK,EAAE,MAAM,CAAC,EAAE,OAAQ,EAAE,KAAK,CAAC,CAEhC,IAAK,EAAE,MAAM,CAAC,EAAE,OAAQ,EAAE,KAAK,CAAC,CAKhC,SAAU,EAAE,OACb,CAAC,CACH,CAAC,CCjBF,eAAsB,EAEpB,CACE,sBACA,mBACA,YACA,OACA,aACA,eAEa,CACf,EAAoB,KAAK,QAAQ,KAAK,CAMtC,MAAM,EAAe,CACnB,sBACA,mBACA,YANkB,EAAQ,EAAM,EAMrB,CACX,YACA,cACA,aAAc,EACf,CAAC"}