@transcend-io/cli 8.24.0 → 8.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -15
- package/dist/bin/bash-complete.cjs +1 -1
- package/dist/bin/cli.cjs +1 -1
- package/dist/bin/deprecated-command.cjs +2 -2
- package/dist/{chunk-IWZ2HIHK.cjs → chunk-2Q7ADV5Y.cjs} +2 -2
- package/dist/{chunk-IWZ2HIHK.cjs.map → chunk-2Q7ADV5Y.cjs.map} +1 -1
- package/dist/{chunk-CYGC567Y.cjs → chunk-5PTFTN6J.cjs} +11 -11
- package/dist/{chunk-CYGC567Y.cjs.map → chunk-5PTFTN6J.cjs.map} +1 -1
- package/dist/chunk-7ZGJ4MJF.cjs +12 -0
- package/dist/{chunk-OKWH7Y2Z.cjs.map → chunk-7ZGJ4MJF.cjs.map} +1 -1
- package/dist/{chunk-7A6YW7SF.cjs → chunk-BGZ6TA6C.cjs} +2 -2
- package/dist/{chunk-7A6YW7SF.cjs.map → chunk-BGZ6TA6C.cjs.map} +1 -1
- package/dist/{chunk-C5AAGXZE.cjs → chunk-COKHIMLO.cjs} +2 -2
- package/dist/{chunk-C5AAGXZE.cjs.map → chunk-COKHIMLO.cjs.map} +1 -1
- package/dist/chunk-F3BRFYKD.cjs +2 -0
- package/dist/chunk-F3BRFYKD.cjs.map +1 -0
- package/dist/{chunk-AVZBE2R3.cjs → chunk-GG7P2RO6.cjs} +2 -2
- package/dist/{chunk-AVZBE2R3.cjs.map → chunk-GG7P2RO6.cjs.map} +1 -1
- package/dist/{chunk-LFAJZQET.cjs → chunk-HRNCQV6G.cjs} +4 -4
- package/dist/{chunk-LFAJZQET.cjs.map → chunk-HRNCQV6G.cjs.map} +1 -1
- package/dist/{chunk-DCLHMZWV.cjs → chunk-KYVDLURL.cjs} +4 -4
- package/dist/{chunk-DCLHMZWV.cjs.map → chunk-KYVDLURL.cjs.map} +1 -1
- package/dist/{chunk-7IN5X2S4.cjs → chunk-MOWFESXN.cjs} +2 -2
- package/dist/{chunk-7IN5X2S4.cjs.map → chunk-MOWFESXN.cjs.map} +1 -1
- package/dist/{chunk-UJPJAASL.cjs → chunk-MPMKY5NF.cjs} +22 -22
- package/dist/chunk-MPMKY5NF.cjs.map +1 -0
- package/dist/{chunk-4DYEWT53.cjs → chunk-NI434OII.cjs} +2 -2
- package/dist/{chunk-4DYEWT53.cjs.map → chunk-NI434OII.cjs.map} +1 -1
- package/dist/{chunk-CFFB56DK.cjs → chunk-RGBVP433.cjs} +2 -2
- package/dist/{chunk-CFFB56DK.cjs.map → chunk-RGBVP433.cjs.map} +1 -1
- package/dist/chunk-WWJHUHSQ.cjs +12 -0
- package/dist/chunk-WWJHUHSQ.cjs.map +1 -0
- package/dist/{impl-DD246CUP.cjs → impl-32ZRDOCN.cjs} +5 -5
- package/dist/{impl-DD246CUP.cjs.map → impl-32ZRDOCN.cjs.map} +1 -1
- package/dist/{impl-WV34A76M.cjs → impl-3VTN6SPE.cjs} +3 -3
- package/dist/{impl-WV34A76M.cjs.map → impl-3VTN6SPE.cjs.map} +1 -1
- package/dist/{impl-U4XXZKTL.cjs → impl-4YI4ERPI.cjs} +2 -2
- package/dist/{impl-U4XXZKTL.cjs.map → impl-4YI4ERPI.cjs.map} +1 -1
- package/dist/{impl-NTMCDOS7.cjs → impl-5H724WN5.cjs} +2 -2
- package/dist/{impl-NTMCDOS7.cjs.map → impl-5H724WN5.cjs.map} +1 -1
- package/dist/{impl-DEJ7Q25E.cjs → impl-6S3K72GP.cjs} +2 -2
- package/dist/{impl-DEJ7Q25E.cjs.map → impl-6S3K72GP.cjs.map} +1 -1
- package/dist/{impl-2RF3CQYJ.cjs → impl-7G2TDJGL.cjs} +2 -2
- package/dist/{impl-2RF3CQYJ.cjs.map → impl-7G2TDJGL.cjs.map} +1 -1
- package/dist/{impl-VE2OJ6VL.cjs → impl-7WCN5RAN.cjs} +2 -2
- package/dist/{impl-VE2OJ6VL.cjs.map → impl-7WCN5RAN.cjs.map} +1 -1
- package/dist/{impl-5YHZWUVM.cjs → impl-7ZGTTYG5.cjs} +2 -2
- package/dist/{impl-5YHZWUVM.cjs.map → impl-7ZGTTYG5.cjs.map} +1 -1
- package/dist/impl-AI276JNQ.cjs +2 -0
- package/dist/impl-AI276JNQ.cjs.map +1 -0
- package/dist/{impl-EMPK5SP4.cjs → impl-AQY6F4SC.cjs} +2 -2
- package/dist/{impl-EMPK5SP4.cjs.map → impl-AQY6F4SC.cjs.map} +1 -1
- package/dist/{impl-F7TSRMCF.cjs → impl-CLA7WK6U.cjs} +2 -2
- package/dist/{impl-F7TSRMCF.cjs.map → impl-CLA7WK6U.cjs.map} +1 -1
- package/dist/{impl-PDZTOIGB.cjs → impl-CP2GLGVZ.cjs} +2 -2
- package/dist/{impl-PDZTOIGB.cjs.map → impl-CP2GLGVZ.cjs.map} +1 -1
- package/dist/impl-CRQ4DYII.cjs +2 -0
- package/dist/impl-CRQ4DYII.cjs.map +1 -0
- package/dist/{impl-SKGYIPGE.cjs → impl-EQ4EH4QJ.cjs} +2 -2
- package/dist/{impl-SKGYIPGE.cjs.map → impl-EQ4EH4QJ.cjs.map} +1 -1
- package/dist/{impl-3PVAU2SZ.cjs → impl-FD5CDY7Y.cjs} +2 -2
- package/dist/{impl-3PVAU2SZ.cjs.map → impl-FD5CDY7Y.cjs.map} +1 -1
- package/dist/{impl-R2KE5BYZ.cjs → impl-FJ4XWHLE.cjs} +2 -2
- package/dist/{impl-R2KE5BYZ.cjs.map → impl-FJ4XWHLE.cjs.map} +1 -1
- package/dist/{impl-OGY3N3JL.cjs → impl-G6WAGNDN.cjs} +2 -2
- package/dist/{impl-OGY3N3JL.cjs.map → impl-G6WAGNDN.cjs.map} +1 -1
- package/dist/{impl-FS3K2DMH.cjs → impl-GIPZ5EW5.cjs} +2 -2
- package/dist/{impl-FS3K2DMH.cjs.map → impl-GIPZ5EW5.cjs.map} +1 -1
- package/dist/{impl-JX55JUEK.cjs → impl-HCY5MWEP.cjs} +2 -2
- package/dist/{impl-JX55JUEK.cjs.map → impl-HCY5MWEP.cjs.map} +1 -1
- package/dist/{impl-A5WFSC3U.cjs → impl-HEPMD6RG.cjs} +2 -2
- package/dist/{impl-A5WFSC3U.cjs.map → impl-HEPMD6RG.cjs.map} +1 -1
- package/dist/{impl-PWMPWKRC.cjs → impl-JREQ3SEN.cjs} +2 -2
- package/dist/{impl-PWMPWKRC.cjs.map → impl-JREQ3SEN.cjs.map} +1 -1
- package/dist/{impl-TYNSXOHT.cjs → impl-K5LDQF7V.cjs} +2 -2
- package/dist/{impl-TYNSXOHT.cjs.map → impl-K5LDQF7V.cjs.map} +1 -1
- package/dist/{impl-5273O2PM.cjs → impl-KPZSEHQG.cjs} +2 -2
- package/dist/{impl-5273O2PM.cjs.map → impl-KPZSEHQG.cjs.map} +1 -1
- package/dist/{impl-YE7X5MSV.cjs → impl-LGUMGRRA.cjs} +2 -2
- package/dist/{impl-YE7X5MSV.cjs.map → impl-LGUMGRRA.cjs.map} +1 -1
- package/dist/{impl-GWQDOEQM.cjs → impl-LI3SHHAQ.cjs} +2 -2
- package/dist/{impl-GWQDOEQM.cjs.map → impl-LI3SHHAQ.cjs.map} +1 -1
- package/dist/{impl-MYKXOHZB.cjs → impl-MH7OR57S.cjs} +2 -2
- package/dist/{impl-MYKXOHZB.cjs.map → impl-MH7OR57S.cjs.map} +1 -1
- package/dist/{impl-H7PE22UA.cjs → impl-OIXVXSLU.cjs} +2 -2
- package/dist/{impl-H7PE22UA.cjs.map → impl-OIXVXSLU.cjs.map} +1 -1
- package/dist/{impl-H2HELZXJ.cjs → impl-OXOU2A27.cjs} +2 -2
- package/dist/{impl-H2HELZXJ.cjs.map → impl-OXOU2A27.cjs.map} +1 -1
- package/dist/impl-PZ3JDEQN.cjs +2 -0
- package/dist/{impl-CVF67V6C.cjs.map → impl-PZ3JDEQN.cjs.map} +1 -1
- package/dist/{impl-55HR73CO.cjs → impl-QSTK5NYY.cjs} +3 -3
- package/dist/{impl-55HR73CO.cjs.map → impl-QSTK5NYY.cjs.map} +1 -1
- package/dist/{impl-ODHDBZ66.cjs → impl-QZHQCQ3B.cjs} +2 -2
- package/dist/{impl-ODHDBZ66.cjs.map → impl-QZHQCQ3B.cjs.map} +1 -1
- package/dist/{impl-NSQG5ZE2.cjs → impl-SYXFCDZC.cjs} +4 -4
- package/dist/{impl-NSQG5ZE2.cjs.map → impl-SYXFCDZC.cjs.map} +1 -1
- package/dist/{impl-BTCB55I2.cjs → impl-TCN6BRVK.cjs} +2 -2
- package/dist/{impl-BTCB55I2.cjs.map → impl-TCN6BRVK.cjs.map} +1 -1
- package/dist/{impl-KGR5OOIL.cjs → impl-TFAARXUG.cjs} +2 -2
- package/dist/{impl-KGR5OOIL.cjs.map → impl-TFAARXUG.cjs.map} +1 -1
- package/dist/{impl-M353HLO7.cjs → impl-VAQF5Y6W.cjs} +2 -2
- package/dist/{impl-M353HLO7.cjs.map → impl-VAQF5Y6W.cjs.map} +1 -1
- package/dist/{impl-2ZXK4G3X.cjs → impl-VGJPIZZY.cjs} +2 -2
- package/dist/{impl-2ZXK4G3X.cjs.map → impl-VGJPIZZY.cjs.map} +1 -1
- package/dist/impl-VGOV6N6A.cjs +2 -0
- package/dist/impl-VGOV6N6A.cjs.map +1 -0
- package/dist/{impl-CACU53DW.cjs → impl-X6Z7MKVJ.cjs} +2 -2
- package/dist/{impl-CACU53DW.cjs.map → impl-X6Z7MKVJ.cjs.map} +1 -1
- package/dist/{impl-YQ6LBC3S.cjs → impl-YIYW7STX.cjs} +2 -2
- package/dist/{impl-YQ6LBC3S.cjs.map → impl-YIYW7STX.cjs.map} +1 -1
- package/dist/{impl-XPH46QYI.cjs → impl-ZGACCLWF.cjs} +2 -2
- package/dist/{impl-XPH46QYI.cjs.map → impl-ZGACCLWF.cjs.map} +1 -1
- package/dist/{impl-EGBXUZEX.cjs → impl-ZV4VREIU.cjs} +2 -2
- package/dist/{impl-EGBXUZEX.cjs.map → impl-ZV4VREIU.cjs.map} +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +43 -89
- package/package.json +1 -1
- package/dist/chunk-4Y2OJ475.cjs +0 -2
- package/dist/chunk-4Y2OJ475.cjs.map +0 -1
- package/dist/chunk-OKWH7Y2Z.cjs +0 -12
- package/dist/chunk-UJPJAASL.cjs.map +0 -1
- package/dist/impl-7Q7N7MEL.cjs +0 -12
- package/dist/impl-7Q7N7MEL.cjs.map +0 -1
- package/dist/impl-CVF67V6C.cjs +0 -2
- package/dist/impl-DUFE2SD3.cjs +0 -2
- package/dist/impl-DUFE2SD3.cjs.map +0 -1
- package/dist/impl-QPOOCXTZ.cjs +0 -2
- package/dist/impl-QPOOCXTZ.cjs.map +0 -1
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/cli/cli/dist/index.cjs","../src/lib/ai/TranscendPromptManager.ts","../src/lib/graphql/fetchLargeLanguageModels.ts","../src/lib/ai/getGitFilesThatChanged.ts"],"names":["PAGE_SIZE","fetchAllLargeLanguageModels","client","largeLanguageModels","offset","shouldContinue","nodes","makeGraphQLRequest","LARGE_LANGUAGE_MODELS","a","b","createRegexForTag","tagName","defineTranscendPrompts","prompts","jsonParseSafe","obj","TranscendPromptManager","handlebarsOptions","transcendUrl","DEFAULT_TRANSCEND_API","transcendApiKey","requireApproval","cacheDuration","defaultVariables","buildTranscendGraphQLClient","createHandlebarsWithHelpers","promptDefinitions","getValues","promptIds","id","x","promptTitles","title","agentNames","uniq_default","response","agents","fetchPromptsWithVariables","fetchAllAgents","keyBy_default","model","promptByTitle","promptById","acc","v","partial","apply","result","name","agent","remoteAgent","ts","thread","fetchAllPromptThreads","names","hasCache","missingCache","groupBy_default","cachedAgents","chunkedNames","chunk_default","remoteAgents","mapSeries","chunkedName","pageOfAgents","filterBy","fetchAllAgentFiles","largeLanguageModel","matching"],"mappings":"AAAA,6OAAiE,wDAAkD,wD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AU,CAC9B,IAAA,CAAK,YAAA,CAAaA,CAAAA,CAAM,IAAI,CAAA,CAAIA,CAAAA,CAChC,IAAA,CAAK,eAAA,CAAgBA,CAAAA,CAAM,OAAO,CAAA,CAAIA,CACxC,CAAC,CAAA,CACDY,CAAAA,CAAa,IAAA,CAAK,GAAGG,CAAY,CACnC,CAAC,CAAA,CACM,CAAC,GAAGN,CAAAA,CAAc,GAAGG,CAAY,CAC1C,CAQA,aAAA,CAAcI,CAAAA,CAAmD,CAC/D,OAAOC,kCAAAA,IAAmB,CAAK,aAAA,CAAeD,CAAQ,CACxD,CAQA,qBAAA,CACEE,CAAAA,CACoB,CACpB,IAAMC,CAAAA,CAAW,IAAA,CAAK,mBAAA,CAAoB,IAAA,CAAM5B,CAAAA,EAC9C,OAAO2B,CAAAA,EAAuB,QAAA,CAC1B3B,CAAAA,CAAM,EAAA,GAAO2B,CAAAA,CACb3B,CAAAA,CAAM,IAAA,GAAS2B,CAAAA,CAAmB,IAAA,EAClC3B,CAAAA,CAAM,MAAA,GAAW2B,CAAAA,CAAmB,MAC1C,CAAA,CACA,EAAA,CAAI,CAACC,CAAAA,CACH,MAAM,IAAI,KAAA,CACR,CAAA,+BAAA,EACE,OAAOD,CAAAA,EAAuB,QAAA,CAC1BA,CAAAA,CACA,IAAA,CAAK,SAAA,CAAUA,CAAkB,CACvC,CAAA,CAAA;AE1ZG;AAiBI;AA4Bf","file":"/home/runner/work/cli/cli/dist/index.cjs","sourcesContent":[null,"/* eslint-disable max-lines */\nimport {\n Optionalize,\n Requirize,\n apply,\n decodeCodec,\n getValues,\n} from '@transcend-io/type-utils';\nimport type { Handlebars } from '@transcend-io/handlebars-utils';\nimport { Secret } from '@transcend-io/secret-value';\nimport * as t from 'io-ts';\nimport { DEFAULT_TRANSCEND_API } from '../../constants';\nimport {\n Agent,\n AgentFile,\n AgentFileFilterBy,\n ReportPromptRunInput,\n buildTranscendGraphQLClient,\n fetchAllAgentFiles,\n fetchAllAgents,\n reportPromptRun,\n} from '../graphql';\nimport {\n HandlebarsInput,\n createHandlebarsWithHelpers,\n} from '@transcend-io/handlebars-utils';\nimport {\n TranscendPromptTemplated,\n TranscendPromptsAndVariables,\n fetchPromptsWithVariables,\n} from '../graphql/fetchPrompts';\nimport { GraphQLClient } from 'graphql-request';\nimport {\n PromptStatus,\n ChatCompletionRole,\n PromptRunProductArea,\n QueueStatus,\n LargeLanguageModelClient,\n} from '@transcend-io/privacy-types';\nimport {\n LargeLanguageModel,\n fetchAllLargeLanguageModels,\n} from '../graphql/fetchLargeLanguageModels';\nimport { groupBy, keyBy, uniq, chunk } from 'lodash-es';\nimport { mapSeries } from 'bluebird';\nimport {\n PromptThread,\n fetchAllPromptThreads,\n} from '../graphql/fetchPromptThreads';\n\n/**\n * An LLM Prompt definition\n */\nexport type TranscendPrompt<\n TInputParams extends t.Any,\n TOutputCodec extends t.Any,\n> = (\n | {\n /** ID of the prompt */\n id: string;\n /** Title of the prompt */\n title?: string;\n }\n | {\n /** ID of the prompt */\n id?: string;\n /** Title of the prompt */\n title: string;\n }\n) & {\n /** The names of the agents that should be loaded along with the prompt */\n agentNames?: string[];\n /** Codec to validate runtime input shape */\n paramCodec: TInputParams;\n /** Codec to validate output response */\n outputCodec: TOutputCodec;\n /**\n * If the output that needs to be parsed is returned within a tag\n * e.g. <tag> or <json> - this is the name of the tag\n */\n extractFromTag?: string;\n};\n\nexport interface PromptRunResult {\n /** The ID of the prompt run created on Transcend */\n promptRunId: string;\n /** The URL of the prompt run on Transcend */\n promptRunUrl: string;\n}\n\n/**\n * Create a regex to extract data from a tag\n *\n * Input:\n * \"here is some data <tag>Data</tag>...\"\n *\n * @param tagName - Name of tag\n * @returns Data within the tag\n */\nexport function createRegexForTag(tagName: string): RegExp {\n return new RegExp(`<${tagName}>([\\\\s\\\\S]+?)<\\\\/${tagName}>`);\n}\n\n/**\n * Helper function to declare prompts\n *\n * @param prompts - Prompt config\n * @returns Prompts as identity function - but type enforced\n */\nexport function defineTranscendPrompts<\n TPromptNames extends string,\n TPrompts extends { [k in TPromptNames]: TranscendPrompt<t.Any, t.Any> },\n>(prompts: TPrompts): TPrompts {\n return prompts;\n}\n\n/**\n * Helper to get the type of the parameter for a given prompt\n */\nexport type GetPromptParamType<\n TPromptName extends keyof TPrompts,\n TPrompts extends { [k in TPromptName]: TranscendPrompt<t.Any, t.Any> },\n> = t.TypeOf<TPrompts[TPromptName]['paramCodec']>;\n\n/**\n * Helper to get the type of the parameter for a given prompt\n */\nexport type GetPromptResponseType<\n TPromptName extends keyof TPrompts,\n TPrompts extends { [k in TPromptName]: TranscendPrompt<t.Any, t.Any> },\n> = t.TypeOf<TPrompts[TPromptName]['outputCodec']>;\n\n/**\n * Input for reporting a prompt run\n */\nexport interface ReportPromptRunOptions\n extends Optionalize<\n Omit<ReportPromptRunInput, 'status' | 'promptId' | 'largeLanguageModelId'>,\n 'name' | 'productArea'\n > {\n /** The large language model being run. Either the ID of the LLM or the client/name pairing */\n largeLanguageModel:\n | string\n | {\n /** Name of client */\n client: LargeLanguageModelClient;\n /** Name of the model */\n name: string;\n };\n}\n\nconst jsonParseSafe = (obj: string): unknown => {\n try {\n return JSON.parse(obj);\n } catch (e) {\n return obj;\n }\n};\n\n/**\n * A class that is capable of loading and insert variables into prompts from\n * Transcend's Prompt Manager\n */\nexport class TranscendPromptManager<\n TPromptNames extends string,\n TPrompts extends { [k in TPromptNames]: TranscendPrompt<t.Any, t.Any> },\n> {\n /** Prompt definitions */\n public prompts: TPrompts;\n\n /** Options for configuring handlebars */\n public handlebarsOptions!: HandlebarsInput;\n\n /** Prompt name -> content map, populated by call to Transcend API */\n public promptContentMap?: { [k in TPromptNames]: TranscendPromptTemplated };\n\n /** The large language models that are registered to this organization for reporting */\n public largeLanguageModels: LargeLanguageModel[] = [];\n\n /** The agent definitions registered to this organization */\n private agentsByName: { [name in string]: Agent } = {};\n\n /** The agent definitions registered to this organization */\n private agentsByAgentId: { [id in string]: Agent } = {};\n\n /** The GraphQL client that can be used to call Transcend */\n public graphQLClient: GraphQLClient;\n\n /** The set of variables to expose in handlebars context specified at class initiation */\n public defaultVariables: { [k in string]: unknown };\n\n /**\n * The set of variables to expose in handlebars context,\n * merges defaults with calculated variables from the inventory\n */\n public variables: { [k in string]: unknown };\n\n /** Handlebars compiler */\n public handlebars: typeof Handlebars;\n\n /** The Transcend API key */\n public transcendApiKey: string | Secret<string>;\n\n /** API of Transcend to call */\n public transcendUrl: string;\n\n /** When true, throw an error if the prompt is not approved */\n public requireApproval: boolean;\n\n /**\n * The cache duration in ms for how long prompts and associated metadata should be cached\n * When undefined - prompts are cached indefinitely unless explicitly re-requested\n * When 0, prompts and metadata are fetched every time (not recommended)\n * Setting this to be an hour is a good rate that optimizes for performance and keeping up to date\n */\n public cacheDuration?: number;\n\n /**\n * The last time the metadata was fetched\n */\n public lastUpdatedAt?: Date;\n\n /**\n * Constructor\n *\n * @param options - Options\n */\n constructor({\n prompts,\n handlebarsOptions = {},\n transcendUrl = DEFAULT_TRANSCEND_API,\n transcendApiKey,\n requireApproval = true,\n cacheDuration,\n defaultVariables = {},\n }: {\n /** Prompt definitions to load */\n prompts: TPrompts;\n /** Options for configuring handlebars */\n handlebarsOptions?: HandlebarsInput;\n /** The Transcend API key */\n transcendApiKey: string | Secret<string>;\n /** API of Transcend to call */\n transcendUrl?: string;\n /** When true, throw an error if the prompt is not approved */\n requireApproval?: boolean;\n /** The set of variables to expose in handlebars context specified at class initiation */\n defaultVariables?: { [k in string]: unknown };\n /**\n * The cache duration in ms for how long prompts and associated metadata should be cached\n * When undefined - prompts are cached indefinitely unless explicitly re-requested\n * When 0, prompts and metadata are fetched every time (not recommended)\n * Setting this to be an hour is a good rate that optimizes for performance and keeping up to date\n */\n cacheDuration?: number;\n }) {\n this.prompts = prompts;\n this.transcendUrl = transcendUrl;\n this.transcendApiKey = transcendApiKey;\n this.variables = defaultVariables;\n this.defaultVariables = defaultVariables;\n this.graphQLClient = buildTranscendGraphQLClient(\n transcendUrl,\n typeof transcendApiKey === 'object'\n ? transcendApiKey.release()\n : transcendApiKey,\n );\n this.requireApproval = requireApproval;\n this.cacheDuration = cacheDuration;\n this.handlebarsOptions = handlebarsOptions;\n this.handlebars = createHandlebarsWithHelpers(handlebarsOptions);\n }\n\n /**\n * Fetch prompt metadata from Transcend and cache to the class definition\n *\n * @returns A function that can be used to call the prompt\n */\n async fetchPromptsAndMetadata(): Promise<TranscendPromptsAndVariables> {\n // Determine what to fetch\n const promptDefinitions = getValues(this.prompts) as TranscendPrompt<\n t.Any,\n t.Any\n >[];\n const promptIds = promptDefinitions\n .map(({ id }) => id)\n .filter((x): x is string => !!x);\n const promptTitles = promptDefinitions\n .map(({ title }) => title)\n .filter((x): x is string => !!x);\n const agentNames = uniq(\n promptDefinitions.map(({ agentNames }) => agentNames || []).flat(),\n );\n\n // Fetch prompts and data\n const [response, largeLanguageModels, agents] = await Promise.all([\n fetchPromptsWithVariables(this.graphQLClient, {\n promptIds,\n promptTitles,\n }),\n fetchAllLargeLanguageModels(this.graphQLClient),\n fetchAllAgents(this.graphQLClient, { names: agentNames }),\n ]);\n this.agentsByName = keyBy(agents, 'name');\n this.agentsByAgentId = keyBy(agents, 'agentId');\n this.largeLanguageModels = largeLanguageModels.filter(\n (model) => model.isTranscendHosted === false,\n );\n\n // Lookup prompts by id/title\n const promptByTitle = keyBy(response.prompts, 'title');\n const promptById = keyBy(response.prompts, 'id');\n\n // Update variables\n this.variables = {\n ...response.calculatedVariables.reduce(\n (acc, v) =>\n Object.assign(acc, {\n [v.name]: v.data ? JSON.parse(v.data) : v.data,\n }),\n {},\n ),\n ...this.defaultVariables,\n };\n\n // Update partials\n this.handlebars = createHandlebarsWithHelpers({\n ...this.handlebarsOptions,\n templates: [\n ...(this.handlebarsOptions.templates || []),\n ...response.promptPartials.map((partial) => ({\n name: partial.slug,\n content: partial.content,\n })),\n ],\n });\n\n // Create mapping from prompt to content\n this.promptContentMap = apply(this.prompts, ({ id, title }) => {\n const result = id\n ? promptById[id]\n : title\n ? promptByTitle[title]\n : undefined;\n if (!result) {\n throw new Error(\n `Failed to find prompt with title: \"${title}\" and id: \"${id}\"`,\n );\n }\n return result;\n });\n\n // For cache\n this.lastUpdatedAt = new Date();\n\n return response;\n }\n\n /**\n * Get an agent definition by name\n *\n * @param name - Name of the agent to grab\n * @returns Large language model configuration\n */\n async getAgentByName(name: string): Promise<Agent | undefined> {\n const agent = this.agentsByName[name];\n if (agent) {\n return agent;\n }\n const [remoteAgent] = await fetchAllAgents(this.graphQLClient, {\n names: [name],\n });\n if (!remoteAgent) {\n return undefined;\n }\n this.agentsByName[remoteAgent.name] = remoteAgent;\n this.agentsByAgentId[remoteAgent.agentId] = remoteAgent;\n return remoteAgent;\n }\n\n /**\n * Get a prompt thread by ts\n *\n * @param ts - the slack message timestamp to look up thread for\n * @returns Large language model configuration\n */\n async getPromptThreadBySlackTs(\n ts: string,\n ): Promise<PromptThread | undefined> {\n const [thread] = await fetchAllPromptThreads(this.graphQLClient, {\n slackMessageTs: [ts],\n });\n return thread;\n }\n\n /**\n * Get a list of agent definitions by name.\n * Pulls from cache and may return less agents\n * than requested if some are not found\n *\n * @param names - Names of agents to fetch\n * @returns The agents that were found matching the names\n */\n async getAgentsByName(names: string[]): Promise<Agent[]> {\n if (names.length < 1) {\n throw new Error('Expected at least one name to be provided');\n }\n const { hasCache = [], missingCache = [] } = groupBy(names, (name) =>\n this.agentsByName[name] ? 'hasCache' : 'missingCache',\n );\n const cachedAgents = hasCache.map((name) => this.agentsByName[name]);\n if (missingCache.length === 0) {\n return cachedAgents;\n }\n const chunkedNames = chunk(missingCache, 50);\n const remoteAgents: Agent[] = [];\n await mapSeries(chunkedNames, async (chunkedName) => {\n const pageOfAgents = await fetchAllAgents(this.graphQLClient, {\n names: chunkedName,\n });\n pageOfAgents.forEach((agent) => {\n this.agentsByName[agent.name] = agent;\n this.agentsByAgentId[agent.agentId] = agent;\n });\n remoteAgents.push(...pageOfAgents);\n });\n return [...cachedAgents, ...remoteAgents];\n }\n\n /**\n * Fetch metadata on agent files\n *\n * @param filterBy - Filter by parameters\n * @returns The files found matching the filter\n */\n getAgentFiles(filterBy: AgentFileFilterBy): Promise<AgentFile[]> {\n return fetchAllAgentFiles(this.graphQLClient, filterBy);\n }\n\n /**\n * Look up the large language model to report on\n *\n * @param largeLanguageModel - Input\n * @returns Large language model configuration\n */\n getLargeLanguageModel(\n largeLanguageModel: ReportPromptRunOptions['largeLanguageModel'],\n ): LargeLanguageModel {\n const matching = this.largeLanguageModels.find((model) =>\n typeof largeLanguageModel === 'string'\n ? model.id === largeLanguageModel\n : model.name === largeLanguageModel.name &&\n model.client === largeLanguageModel.client,\n );\n if (!matching) {\n throw new Error(\n `Failed to find model matching: ${\n typeof largeLanguageModel === 'string'\n ? largeLanguageModel\n : JSON.stringify(largeLanguageModel)\n }`,\n );\n }\n return matching;\n }\n\n /**\n * Get a prompt definition by name\n *\n * @param promptName - Prompt to compile\n * @returns Parsed content\n */\n async getPromptDefinition<TPromptName extends TPromptNames>(\n promptName: TPromptName,\n ): Promise<TranscendPromptTemplated> {\n // Determine if prompts need to be fetched\n if (\n // never been fetched\n !this.lastUpdatedAt ||\n // fetch every run\n this.cacheDuration === 0 ||\n // If cache duration met\n (this.cacheDuration &&\n Date.now() - this.lastUpdatedAt.getTime() > this.cacheDuration)\n ) {\n await this.fetchPromptsAndMetadata();\n }\n\n // Lookup prompt\n const { promptContentMap } = this;\n if (!promptContentMap) {\n throw new Error('Expected this.promptContentMap to be defined');\n }\n const promptTemplate = promptContentMap[promptName];\n if (!promptTemplate) {\n throw new Error(\n `Expected this.promptContentMap[${promptName}] to be defined`,\n );\n }\n return promptTemplate;\n }\n\n /**\n * Validate the shape of the response from AI\n *\n * @param promptName - Prompt to compile\n * @param params - Runtime parameters\n * @returns Parsed content\n */\n async compilePrompt<TPromptName extends TPromptNames>(\n promptName: TPromptName,\n params: t.TypeOf<TPrompts[TPromptName]['paramCodec']>,\n ): Promise<string> {\n // Grab the prompt\n const promptTemplate = await this.getPromptDefinition(promptName);\n const promptInput = this.prompts[promptName];\n if (!promptInput) {\n throw new Error(`Expected this.prompts[${promptName}] to be defined`);\n }\n\n // Ensure prompt is approved\n if (\n this.requireApproval &&\n promptTemplate.status !== PromptStatus.Approved\n ) {\n throw new Error(\n `Assessment \"${promptTemplate.title}\" cannot be used because its in status: \"${promptTemplate.status}\"`,\n );\n }\n\n // If prompt is rejected, throw error\n if (promptTemplate.status === PromptStatus.Rejected) {\n throw new Error(\n `Assessment \"${promptTemplate.title}\" cannot be used because it's in status: \"${promptTemplate.status}\"`,\n );\n }\n\n // Validate params\n decodeCodec(promptInput.paramCodec, params);\n\n // Compile prompt and template\n return this.handlebars.compile(promptTemplate.content)({\n // template in currentDate by default\n currentDate: new Date().toISOString(),\n ...this.variables,\n ...params,\n });\n }\n\n /**\n * Validate the shape of the response from AI\n *\n * @param promptName - Prompt to parse\n * @param response - AI response as string\n * @returns Parsed content\n */\n parseAiResponse<TPromptName extends TPromptNames>(\n promptName: TPromptName,\n response: string,\n ): t.TypeOf<TPrompts[TPromptName]['outputCodec']> {\n // Look up prompt info\n const promptInput = this.prompts[promptName];\n if (!promptInput) {\n throw new Error(`Expected this.prompts[${promptName}] to be defined`);\n }\n\n // Extract from tag if needed\n const extracted = promptInput.extractFromTag\n ? (createRegexForTag(promptInput.extractFromTag).exec(response) ||\n [])[1] || response\n : response;\n\n // Parse via codec\n return decodeCodec(\n promptInput.outputCodec,\n jsonParseSafe(extracted),\n false,\n );\n }\n\n /**\n * Parse the AI response and report back to Transcend\n *\n * @param promptName - Prompt to parse\n * @param options - Options for reporting\n * @returns Parsed content\n */\n async reportAndParsePromptRun<TPromptName extends TPromptNames>(\n promptName: TPromptName,\n { largeLanguageModel, ...options }: ReportPromptRunOptions,\n ): Promise<\n PromptRunResult & {\n /** Resulting prompt run */\n result: t.TypeOf<TPrompts[TPromptName]['outputCodec']>;\n }\n > {\n // Determine if prompts need to be fetched\n if (\n // never been fetched\n !this.lastUpdatedAt ||\n // fetch every run\n this.cacheDuration === 0 ||\n // If cache duration met\n (this.cacheDuration &&\n Date.now() - this.lastUpdatedAt.getTime() > this.cacheDuration)\n ) {\n await this.fetchPromptsAndMetadata();\n }\n\n const name =\n options.name ||\n `@transcend-io/cli-prompt-run-${new Date().toISOString()}`;\n\n if (!this.promptContentMap) {\n throw new Error('Expected this.promptContentMap to be defined');\n }\n // Look up prompt info\n const promptInput = this.promptContentMap[promptName];\n if (!promptInput) {\n throw new Error(`Expected this.prompts[${promptName}] to be defined`);\n }\n\n // Ensure the first message in `promptRunMessages` is of type=system\n if (options.promptRunMessages.length === 0) {\n throw new Error('promptRunMessages is expected to have length > 0');\n }\n if (options.promptRunMessages[0].role !== ChatCompletionRole.System) {\n throw new Error(\n `promptRunMessages[0].role is expected to be = ${ChatCompletionRole.System}`,\n );\n }\n if (\n options.promptRunMessages[options.promptRunMessages.length - 1].role !==\n ChatCompletionRole.Assistant\n ) {\n throw new Error(\n `promptRunMessages[${\n options.promptRunMessages.length - 1\n }].role is expected to be = ${ChatCompletionRole.Assistant}`,\n );\n }\n const response =\n options.promptRunMessages[options.promptRunMessages.length - 1].content;\n\n let parsed: t.TypeOf<TPrompts[TPromptName]['outputCodec']>;\n try {\n // Parse the response\n parsed = this.parseAiResponse(promptName, response);\n } catch (err) {\n await reportPromptRun(this.graphQLClient, {\n productArea: PromptRunProductArea.PromptManager,\n ...options,\n name,\n error: err.message,\n status: QueueStatus.Error,\n ...(typeof largeLanguageModel === 'string'\n ? { largeLanguageModelId: largeLanguageModel }\n : {\n largeLanguageModelName: largeLanguageModel.name,\n largeLanguageModelClient: largeLanguageModel.client,\n }),\n promptId: promptInput.id,\n promptRunMessages: options.promptRunMessages.map((message, ind) => ({\n ...message,\n ...(ind === 0 ? { template: promptInput.content } : {}),\n })),\n });\n throw err;\n }\n\n // report successful run\n const promptRunId = await reportPromptRun(this.graphQLClient, {\n productArea: PromptRunProductArea.PromptManager,\n ...options,\n name,\n status: QueueStatus.Resolved,\n ...(typeof largeLanguageModel === 'string'\n ? { largeLanguageModelId: largeLanguageModel }\n : {\n largeLanguageModelName: largeLanguageModel.name,\n largeLanguageModelClient: largeLanguageModel.client,\n }),\n promptId: promptInput.id,\n promptRunMessages: options.promptRunMessages.map((message, ind) => ({\n ...message,\n ...(ind === 0 ? { template: promptInput.content } : {}),\n })),\n });\n\n return {\n result: parsed,\n promptRunId,\n promptRunUrl: `https://app.transcend.io/prompts/runs/${promptRunId}`,\n };\n }\n\n /**\n * Report an error for a particular prompt\n *\n * @param promptName - Prompt to parse\n * @param options - Options for reporting\n * @returns Parsed content\n */\n async reportPromptRunError<TPromptName extends TPromptNames>(\n promptName: TPromptName,\n {\n largeLanguageModel,\n ...options\n }: Requirize<ReportPromptRunOptions, 'error'>,\n ): Promise<PromptRunResult> {\n // Determine if prompts need to be fetched\n if (\n // never been fetched\n !this.lastUpdatedAt ||\n // fetch every run\n this.cacheDuration === 0 ||\n // If cache duration met\n (this.cacheDuration &&\n Date.now() - this.lastUpdatedAt.getTime() > this.cacheDuration)\n ) {\n await this.fetchPromptsAndMetadata();\n }\n\n const name =\n options.name ||\n `@transcend-io/cli-prompt-run-${new Date().toISOString()}`;\n\n if (!this.promptContentMap) {\n throw new Error('Expected this.promptContentMap to be defined');\n }\n // Look up prompt info\n const promptInput = this.promptContentMap[promptName];\n if (!promptInput) {\n throw new Error(`Expected this.prompts[${promptName}] to be defined`);\n }\n\n // Ensure the first message in `promptRunMessages` is of type=system\n if (options.promptRunMessages.length === 0) {\n throw new Error('promptRunMessages is expected to have length > 0');\n }\n if (options.promptRunMessages[0].role !== ChatCompletionRole.System) {\n throw new Error(\n `promptRunMessages[0].role is expected to be = ${ChatCompletionRole.System}`,\n );\n }\n\n const promptRunId = await reportPromptRun(this.graphQLClient, {\n productArea: PromptRunProductArea.PromptManager,\n ...options,\n name,\n status: QueueStatus.Error,\n ...(typeof largeLanguageModel === 'string'\n ? { largeLanguageModelId: largeLanguageModel }\n : {\n largeLanguageModelName: largeLanguageModel.name,\n largeLanguageModelClient: largeLanguageModel.client,\n }),\n promptId: promptInput.id,\n promptRunMessages: options.promptRunMessages.map((message, ind) => ({\n ...message,\n ...(ind === 0 ? { template: promptInput.content } : {}),\n })),\n });\n\n return {\n promptRunId,\n promptRunUrl: `https://app.transcend.io/prompts/runs/${promptRunId}`,\n };\n }\n}\n/* eslint-enable max-lines */\n","import { GraphQLClient } from 'graphql-request';\nimport { LargeLanguageModelClient } from '@transcend-io/privacy-types';\nimport { LARGE_LANGUAGE_MODELS } from './gqls';\nimport { makeGraphQLRequest } from './makeGraphQLRequest';\n\nexport interface LargeLanguageModel {\n /** ID of prompts */\n id: string;\n /** The name of the large language model. */\n name: string;\n /** The content of the prompt template. */\n client: LargeLanguageModelClient;\n /** Whether hosted by Transcend or not */\n isTranscendHosted: boolean;\n}\n\nconst PAGE_SIZE = 20;\n\n/**\n * Fetch all LargeLanguageModels in the organization\n *\n * @param client - GraphQL client\n * @returns All LargeLanguageModels in the organization\n */\nexport async function fetchAllLargeLanguageModels(\n client: GraphQLClient,\n): Promise<LargeLanguageModel[]> {\n const largeLanguageModels: LargeLanguageModel[] = [];\n let offset = 0;\n\n // Whether to continue looping\n let shouldContinue = false;\n do {\n const {\n largeLanguageModels: { nodes },\n } = await makeGraphQLRequest<{\n /** LargeLanguageModels */\n largeLanguageModels: {\n /** List */\n nodes: LargeLanguageModel[];\n };\n }>(client, LARGE_LANGUAGE_MODELS, {\n first: PAGE_SIZE,\n offset,\n });\n largeLanguageModels.push(...nodes);\n offset += PAGE_SIZE;\n shouldContinue = nodes.length === PAGE_SIZE;\n } while (shouldContinue);\n\n return largeLanguageModels.sort((a, b) => a.name.localeCompare(b.name));\n}\n","import { difference } from 'lodash-es';\nimport fastGlob from 'fast-glob';\nimport { execSync } from 'child_process';\n\n/**\n * Function thats gets the git files that have changed\n * and returns the code\n *\n * @param options - Options\n * @returns Changes files and diffs\n */\nexport function getGitFilesThatChanged({\n baseBranch,\n rootDirectory,\n githubRepo,\n excludedGlob = [],\n fileBlockList = [],\n}: {\n /** Base branch */\n baseBranch: string;\n /** Github repo name */\n githubRepo: string;\n /** Root directory */\n rootDirectory: string;\n /** A glob that excludes files */\n excludedGlob?: string[];\n /** Block list of files to not process */\n fileBlockList?: string[];\n}): {\n /** The list of files that changed */\n changedFiles: string[];\n /** Github repo name */\n repoName: string;\n /** Current commit */\n commit: string;\n /** File diffs */\n fileDiffs: { [k in string]: string };\n} {\n // Pull base branch\n execSync(`git fetch origin ${baseBranch}`);\n\n // Latest commit on base branch. If we are on the base branch, we take the prior commit\n const latestBasedCommit = execSync(\n `git ls-remote ${githubRepo} \"refs/heads/${baseBranch}\" | cut -f 1`,\n { encoding: 'utf-8' },\n ).split('\\n')[0];\n\n // This commit\n const latestThisCommit = execSync('git rev-parse HEAD', {\n encoding: 'utf-8',\n }).split('\\n')[0];\n\n // Ensure commits are present\n if (!latestBasedCommit || !latestThisCommit) {\n throw new Error('FAILED TO FIND COMMIT RANGE');\n }\n\n // Get the diff between the given branch and base branch\n const diff = execSync(\n `git fetch && git diff --name-only \"${\n baseBranch || latestBasedCommit\n }...${latestThisCommit}\" -- ${rootDirectory}`,\n { encoding: 'utf-8' },\n );\n\n // Filter out block list\n const changedFiles = difference(\n diff.split('\\n').filter((f) => f),\n fileBlockList,\n );\n\n // Filter out globs\n const filteredChanges =\n excludedGlob.length > 0\n ? fastGlob.sync(changedFiles, { ignore: excludedGlob })\n : changedFiles;\n\n // Get the contents of only the changed files\n const fileDiffs: { [k in string]: string } = {};\n filteredChanges.forEach((file) => {\n const contents = execSync(`git show ${latestThisCommit}:${file}`, {\n encoding: 'utf-8',\n });\n fileDiffs[file] = contents;\n });\n\n // Pull the github repo name\n const repoName = githubRepo.split('/').pop()!.split('.')[0];\n\n return {\n changedFiles,\n fileDiffs,\n repoName,\n commit: latestThisCommit,\n };\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/cli/cli/dist/index.cjs","../src/lib/ai/TranscendPromptManager.ts","../src/lib/graphql/fetchLargeLanguageModels.ts","../src/lib/ai/getGitFilesThatChanged.ts"],"names":["PAGE_SIZE","fetchAllLargeLanguageModels","client","largeLanguageModels","offset","shouldContinue","nodes","makeGraphQLRequest","LARGE_LANGUAGE_MODELS","a","b","createRegexForTag","tagName","defineTranscendPrompts","prompts","jsonParseSafe","obj","TranscendPromptManager","handlebarsOptions","transcendUrl","DEFAULT_TRANSCEND_API","transcendApiKey","requireApproval","cacheDuration","defaultVariables","buildTranscendGraphQLClient","createHandlebarsWithHelpers","promptDefinitions","getValues","promptIds","id","x","promptTitles","title","agentNames","uniq_default","response","agents","fetchPromptsWithVariables","fetchAllAgents","keyBy_default","model","promptByTitle","promptById","acc","v","partial","apply","result","name","agent","remoteAgent","ts","thread","fetchAllPromptThreads","names","hasCache","missingCache","groupBy_default","cachedAgents","chunkedNames","chunk_default","remoteAgents","mapSeries","chunkedName","pageOfAgents","filterBy","fetchAllAgentFiles","largeLanguageModel","matching"],"mappings":"AAAA,6OAAiE,wDAAkD,wDAA0C,wDAA0E,wDAA0F,wDAA0E,wDAAkG,wDAAkE,wDAAkE,wDAAknB,wDAA46G,wDAAgD,gCAA6B,wDAAuL,wDAA4E,qDCOx9J,iEAkBA,2DAaA,ICtBDA,CAAAA,CAAY,EAAA,CAQlB,MAAA,SAAsBC,CAAAA,CACpBC,CAAAA,CAC+B,CAC/B,IAAMC,CAAAA,CAA4C,CAAC,CAAA,CAC/CC,CAAAA,CAAS,CAAA,CAGTC,CAAAA,CAAiB,CAAA,CAAA,CACrB,EAAG,CACD,GAAM,CACJ,mBAAA,CAAqB,CAAE,KAAA,CAAAC,CAAM,CAC/B,CAAA,CAAI,MAAMC,kCAAAA,CAMPL,CAAQM,oBAAAA,CAAuB,CAChC,KAAA,CAAOR,CAAAA,CACP,MAAA,CAAAI,CACF,CAAC,CAAA,CACDD,CAAAA,CAAoB,IAAA,CAAK,GAAGG,CAAK,CAAA,CACjCF,CAAAA,EAAU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AAA,GAAS2B,CAAAA,CAAmB,IAAA,EAClC3B,CAAAA,CAAM,MAAA,GAAW2B,CAAAA,CAAmB,MAC1C,CAAA,CACA,EAAA,CAAI,CAACC,CAAAA,CACH,MAAM,IAAI,KAAA,CACR,CAAA,+BAAA,EACE,OAAOD,CAAAA,EAAuB,QAAA,CAC1BA,CAAAA,CACA,IAAA,CAAK,SAAA,CAAUA,CAAkB,CACvC,CAAA,CAAA;AE1ZG;AAiBI;AA4Bf","file":"/home/runner/work/cli/cli/dist/index.cjs","sourcesContent":[null,"/* eslint-disable max-lines */\nimport {\n Optionalize,\n Requirize,\n apply,\n decodeCodec,\n getValues,\n} from '@transcend-io/type-utils';\nimport type { Handlebars } from '@transcend-io/handlebars-utils';\nimport { Secret } from '@transcend-io/secret-value';\nimport * as t from 'io-ts';\nimport { DEFAULT_TRANSCEND_API } from '../../constants';\nimport {\n Agent,\n AgentFile,\n AgentFileFilterBy,\n ReportPromptRunInput,\n buildTranscendGraphQLClient,\n fetchAllAgentFiles,\n fetchAllAgents,\n reportPromptRun,\n} from '../graphql';\nimport {\n HandlebarsInput,\n createHandlebarsWithHelpers,\n} from '@transcend-io/handlebars-utils';\nimport {\n TranscendPromptTemplated,\n TranscendPromptsAndVariables,\n fetchPromptsWithVariables,\n} from '../graphql/fetchPrompts';\nimport { GraphQLClient } from 'graphql-request';\nimport {\n PromptStatus,\n ChatCompletionRole,\n PromptRunProductArea,\n QueueStatus,\n LargeLanguageModelClient,\n} from '@transcend-io/privacy-types';\nimport {\n LargeLanguageModel,\n fetchAllLargeLanguageModels,\n} from '../graphql/fetchLargeLanguageModels';\nimport { groupBy, keyBy, uniq, chunk } from 'lodash-es';\nimport { mapSeries } from 'bluebird';\nimport {\n PromptThread,\n fetchAllPromptThreads,\n} from '../graphql/fetchPromptThreads';\n\n/**\n * An LLM Prompt definition\n */\nexport type TranscendPrompt<\n TInputParams extends t.Any,\n TOutputCodec extends t.Any,\n> = (\n | {\n /** ID of the prompt */\n id: string;\n /** Title of the prompt */\n title?: string;\n }\n | {\n /** ID of the prompt */\n id?: string;\n /** Title of the prompt */\n title: string;\n }\n) & {\n /** The names of the agents that should be loaded along with the prompt */\n agentNames?: string[];\n /** Codec to validate runtime input shape */\n paramCodec: TInputParams;\n /** Codec to validate output response */\n outputCodec: TOutputCodec;\n /**\n * If the output that needs to be parsed is returned within a tag\n * e.g. <tag> or <json> - this is the name of the tag\n */\n extractFromTag?: string;\n};\n\nexport interface PromptRunResult {\n /** The ID of the prompt run created on Transcend */\n promptRunId: string;\n /** The URL of the prompt run on Transcend */\n promptRunUrl: string;\n}\n\n/**\n * Create a regex to extract data from a tag\n *\n * Input:\n * \"here is some data <tag>Data</tag>...\"\n *\n * @param tagName - Name of tag\n * @returns Data within the tag\n */\nexport function createRegexForTag(tagName: string): RegExp {\n return new RegExp(`<${tagName}>([\\\\s\\\\S]+?)<\\\\/${tagName}>`);\n}\n\n/**\n * Helper function to declare prompts\n *\n * @param prompts - Prompt config\n * @returns Prompts as identity function - but type enforced\n */\nexport function defineTranscendPrompts<\n TPromptNames extends string,\n TPrompts extends { [k in TPromptNames]: TranscendPrompt<t.Any, t.Any> },\n>(prompts: TPrompts): TPrompts {\n return prompts;\n}\n\n/**\n * Helper to get the type of the parameter for a given prompt\n */\nexport type GetPromptParamType<\n TPromptName extends keyof TPrompts,\n TPrompts extends { [k in TPromptName]: TranscendPrompt<t.Any, t.Any> },\n> = t.TypeOf<TPrompts[TPromptName]['paramCodec']>;\n\n/**\n * Helper to get the type of the parameter for a given prompt\n */\nexport type GetPromptResponseType<\n TPromptName extends keyof TPrompts,\n TPrompts extends { [k in TPromptName]: TranscendPrompt<t.Any, t.Any> },\n> = t.TypeOf<TPrompts[TPromptName]['outputCodec']>;\n\n/**\n * Input for reporting a prompt run\n */\nexport interface ReportPromptRunOptions\n extends Optionalize<\n Omit<ReportPromptRunInput, 'status' | 'promptId' | 'largeLanguageModelId'>,\n 'name' | 'productArea'\n > {\n /** The large language model being run. Either the ID of the LLM or the client/name pairing */\n largeLanguageModel:\n | string\n | {\n /** Name of client */\n client: LargeLanguageModelClient;\n /** Name of the model */\n name: string;\n };\n}\n\nconst jsonParseSafe = (obj: string): unknown => {\n try {\n return JSON.parse(obj);\n } catch (e) {\n return obj;\n }\n};\n\n/**\n * A class that is capable of loading and insert variables into prompts from\n * Transcend's Prompt Manager\n */\nexport class TranscendPromptManager<\n TPromptNames extends string,\n TPrompts extends { [k in TPromptNames]: TranscendPrompt<t.Any, t.Any> },\n> {\n /** Prompt definitions */\n public prompts: TPrompts;\n\n /** Options for configuring handlebars */\n public handlebarsOptions!: HandlebarsInput;\n\n /** Prompt name -> content map, populated by call to Transcend API */\n public promptContentMap?: { [k in TPromptNames]: TranscendPromptTemplated };\n\n /** The large language models that are registered to this organization for reporting */\n public largeLanguageModels: LargeLanguageModel[] = [];\n\n /** The agent definitions registered to this organization */\n private agentsByName: { [name in string]: Agent } = {};\n\n /** The agent definitions registered to this organization */\n private agentsByAgentId: { [id in string]: Agent } = {};\n\n /** The GraphQL client that can be used to call Transcend */\n public graphQLClient: GraphQLClient;\n\n /** The set of variables to expose in handlebars context specified at class initiation */\n public defaultVariables: { [k in string]: unknown };\n\n /**\n * The set of variables to expose in handlebars context,\n * merges defaults with calculated variables from the inventory\n */\n public variables: { [k in string]: unknown };\n\n /** Handlebars compiler */\n public handlebars: typeof Handlebars;\n\n /** The Transcend API key */\n public transcendApiKey: string | Secret<string>;\n\n /** API of Transcend to call */\n public transcendUrl: string;\n\n /** When true, throw an error if the prompt is not approved */\n public requireApproval: boolean;\n\n /**\n * The cache duration in ms for how long prompts and associated metadata should be cached\n * When undefined - prompts are cached indefinitely unless explicitly re-requested\n * When 0, prompts and metadata are fetched every time (not recommended)\n * Setting this to be an hour is a good rate that optimizes for performance and keeping up to date\n */\n public cacheDuration?: number;\n\n /**\n * The last time the metadata was fetched\n */\n public lastUpdatedAt?: Date;\n\n /**\n * Constructor\n *\n * @param options - Options\n */\n constructor({\n prompts,\n handlebarsOptions = {},\n transcendUrl = DEFAULT_TRANSCEND_API,\n transcendApiKey,\n requireApproval = true,\n cacheDuration,\n defaultVariables = {},\n }: {\n /** Prompt definitions to load */\n prompts: TPrompts;\n /** Options for configuring handlebars */\n handlebarsOptions?: HandlebarsInput;\n /** The Transcend API key */\n transcendApiKey: string | Secret<string>;\n /** API of Transcend to call */\n transcendUrl?: string;\n /** When true, throw an error if the prompt is not approved */\n requireApproval?: boolean;\n /** The set of variables to expose in handlebars context specified at class initiation */\n defaultVariables?: { [k in string]: unknown };\n /**\n * The cache duration in ms for how long prompts and associated metadata should be cached\n * When undefined - prompts are cached indefinitely unless explicitly re-requested\n * When 0, prompts and metadata are fetched every time (not recommended)\n * Setting this to be an hour is a good rate that optimizes for performance and keeping up to date\n */\n cacheDuration?: number;\n }) {\n this.prompts = prompts;\n this.transcendUrl = transcendUrl;\n this.transcendApiKey = transcendApiKey;\n this.variables = defaultVariables;\n this.defaultVariables = defaultVariables;\n this.graphQLClient = buildTranscendGraphQLClient(\n transcendUrl,\n typeof transcendApiKey === 'object'\n ? transcendApiKey.release()\n : transcendApiKey,\n );\n this.requireApproval = requireApproval;\n this.cacheDuration = cacheDuration;\n this.handlebarsOptions = handlebarsOptions;\n this.handlebars = createHandlebarsWithHelpers(handlebarsOptions);\n }\n\n /**\n * Fetch prompt metadata from Transcend and cache to the class definition\n *\n * @returns A function that can be used to call the prompt\n */\n async fetchPromptsAndMetadata(): Promise<TranscendPromptsAndVariables> {\n // Determine what to fetch\n const promptDefinitions = getValues(this.prompts) as TranscendPrompt<\n t.Any,\n t.Any\n >[];\n const promptIds = promptDefinitions\n .map(({ id }) => id)\n .filter((x): x is string => !!x);\n const promptTitles = promptDefinitions\n .map(({ title }) => title)\n .filter((x): x is string => !!x);\n const agentNames = uniq(\n promptDefinitions.map(({ agentNames }) => agentNames || []).flat(),\n );\n\n // Fetch prompts and data\n const [response, largeLanguageModels, agents] = await Promise.all([\n fetchPromptsWithVariables(this.graphQLClient, {\n promptIds,\n promptTitles,\n }),\n fetchAllLargeLanguageModels(this.graphQLClient),\n fetchAllAgents(this.graphQLClient, { names: agentNames }),\n ]);\n this.agentsByName = keyBy(agents, 'name');\n this.agentsByAgentId = keyBy(agents, 'agentId');\n this.largeLanguageModels = largeLanguageModels.filter(\n (model) => model.isTranscendHosted === false,\n );\n\n // Lookup prompts by id/title\n const promptByTitle = keyBy(response.prompts, 'title');\n const promptById = keyBy(response.prompts, 'id');\n\n // Update variables\n this.variables = {\n ...response.calculatedVariables.reduce(\n (acc, v) =>\n Object.assign(acc, {\n [v.name]: v.data ? JSON.parse(v.data) : v.data,\n }),\n {},\n ),\n ...this.defaultVariables,\n };\n\n // Update partials\n this.handlebars = createHandlebarsWithHelpers({\n ...this.handlebarsOptions,\n templates: [\n ...(this.handlebarsOptions.templates || []),\n ...response.promptPartials.map((partial) => ({\n name: partial.slug,\n content: partial.content,\n })),\n ],\n });\n\n // Create mapping from prompt to content\n this.promptContentMap = apply(this.prompts, ({ id, title }) => {\n const result = id\n ? promptById[id]\n : title\n ? promptByTitle[title]\n : undefined;\n if (!result) {\n throw new Error(\n `Failed to find prompt with title: \"${title}\" and id: \"${id}\"`,\n );\n }\n return result;\n });\n\n // For cache\n this.lastUpdatedAt = new Date();\n\n return response;\n }\n\n /**\n * Get an agent definition by name\n *\n * @param name - Name of the agent to grab\n * @returns Large language model configuration\n */\n async getAgentByName(name: string): Promise<Agent | undefined> {\n const agent = this.agentsByName[name];\n if (agent) {\n return agent;\n }\n const [remoteAgent] = await fetchAllAgents(this.graphQLClient, {\n names: [name],\n });\n if (!remoteAgent) {\n return undefined;\n }\n this.agentsByName[remoteAgent.name] = remoteAgent;\n this.agentsByAgentId[remoteAgent.agentId] = remoteAgent;\n return remoteAgent;\n }\n\n /**\n * Get a prompt thread by ts\n *\n * @param ts - the slack message timestamp to look up thread for\n * @returns Large language model configuration\n */\n async getPromptThreadBySlackTs(\n ts: string,\n ): Promise<PromptThread | undefined> {\n const [thread] = await fetchAllPromptThreads(this.graphQLClient, {\n slackMessageTs: [ts],\n });\n return thread;\n }\n\n /**\n * Get a list of agent definitions by name.\n * Pulls from cache and may return less agents\n * than requested if some are not found\n *\n * @param names - Names of agents to fetch\n * @returns The agents that were found matching the names\n */\n async getAgentsByName(names: string[]): Promise<Agent[]> {\n if (names.length < 1) {\n throw new Error('Expected at least one name to be provided');\n }\n const { hasCache = [], missingCache = [] } = groupBy(names, (name) =>\n this.agentsByName[name] ? 'hasCache' : 'missingCache',\n );\n const cachedAgents = hasCache.map((name) => this.agentsByName[name]);\n if (missingCache.length === 0) {\n return cachedAgents;\n }\n const chunkedNames = chunk(missingCache, 50);\n const remoteAgents: Agent[] = [];\n await mapSeries(chunkedNames, async (chunkedName) => {\n const pageOfAgents = await fetchAllAgents(this.graphQLClient, {\n names: chunkedName,\n });\n pageOfAgents.forEach((agent) => {\n this.agentsByName[agent.name] = agent;\n this.agentsByAgentId[agent.agentId] = agent;\n });\n remoteAgents.push(...pageOfAgents);\n });\n return [...cachedAgents, ...remoteAgents];\n }\n\n /**\n * Fetch metadata on agent files\n *\n * @param filterBy - Filter by parameters\n * @returns The files found matching the filter\n */\n getAgentFiles(filterBy: AgentFileFilterBy): Promise<AgentFile[]> {\n return fetchAllAgentFiles(this.graphQLClient, filterBy);\n }\n\n /**\n * Look up the large language model to report on\n *\n * @param largeLanguageModel - Input\n * @returns Large language model configuration\n */\n getLargeLanguageModel(\n largeLanguageModel: ReportPromptRunOptions['largeLanguageModel'],\n ): LargeLanguageModel {\n const matching = this.largeLanguageModels.find((model) =>\n typeof largeLanguageModel === 'string'\n ? model.id === largeLanguageModel\n : model.name === largeLanguageModel.name &&\n model.client === largeLanguageModel.client,\n );\n if (!matching) {\n throw new Error(\n `Failed to find model matching: ${\n typeof largeLanguageModel === 'string'\n ? largeLanguageModel\n : JSON.stringify(largeLanguageModel)\n }`,\n );\n }\n return matching;\n }\n\n /**\n * Get a prompt definition by name\n *\n * @param promptName - Prompt to compile\n * @returns Parsed content\n */\n async getPromptDefinition<TPromptName extends TPromptNames>(\n promptName: TPromptName,\n ): Promise<TranscendPromptTemplated> {\n // Determine if prompts need to be fetched\n if (\n // never been fetched\n !this.lastUpdatedAt ||\n // fetch every run\n this.cacheDuration === 0 ||\n // If cache duration met\n (this.cacheDuration &&\n Date.now() - this.lastUpdatedAt.getTime() > this.cacheDuration)\n ) {\n await this.fetchPromptsAndMetadata();\n }\n\n // Lookup prompt\n const { promptContentMap } = this;\n if (!promptContentMap) {\n throw new Error('Expected this.promptContentMap to be defined');\n }\n const promptTemplate = promptContentMap[promptName];\n if (!promptTemplate) {\n throw new Error(\n `Expected this.promptContentMap[${promptName}] to be defined`,\n );\n }\n return promptTemplate;\n }\n\n /**\n * Validate the shape of the response from AI\n *\n * @param promptName - Prompt to compile\n * @param params - Runtime parameters\n * @returns Parsed content\n */\n async compilePrompt<TPromptName extends TPromptNames>(\n promptName: TPromptName,\n params: t.TypeOf<TPrompts[TPromptName]['paramCodec']>,\n ): Promise<string> {\n // Grab the prompt\n const promptTemplate = await this.getPromptDefinition(promptName);\n const promptInput = this.prompts[promptName];\n if (!promptInput) {\n throw new Error(`Expected this.prompts[${promptName}] to be defined`);\n }\n\n // Ensure prompt is approved\n if (\n this.requireApproval &&\n promptTemplate.status !== PromptStatus.Approved\n ) {\n throw new Error(\n `Assessment \"${promptTemplate.title}\" cannot be used because its in status: \"${promptTemplate.status}\"`,\n );\n }\n\n // If prompt is rejected, throw error\n if (promptTemplate.status === PromptStatus.Rejected) {\n throw new Error(\n `Assessment \"${promptTemplate.title}\" cannot be used because it's in status: \"${promptTemplate.status}\"`,\n );\n }\n\n // Validate params\n decodeCodec(promptInput.paramCodec, params);\n\n // Compile prompt and template\n return this.handlebars.compile(promptTemplate.content)({\n // template in currentDate by default\n currentDate: new Date().toISOString(),\n ...this.variables,\n ...params,\n });\n }\n\n /**\n * Validate the shape of the response from AI\n *\n * @param promptName - Prompt to parse\n * @param response - AI response as string\n * @returns Parsed content\n */\n parseAiResponse<TPromptName extends TPromptNames>(\n promptName: TPromptName,\n response: string,\n ): t.TypeOf<TPrompts[TPromptName]['outputCodec']> {\n // Look up prompt info\n const promptInput = this.prompts[promptName];\n if (!promptInput) {\n throw new Error(`Expected this.prompts[${promptName}] to be defined`);\n }\n\n // Extract from tag if needed\n const extracted = promptInput.extractFromTag\n ? (createRegexForTag(promptInput.extractFromTag).exec(response) ||\n [])[1] || response\n : response;\n\n // Parse via codec\n return decodeCodec(\n promptInput.outputCodec,\n jsonParseSafe(extracted),\n false,\n );\n }\n\n /**\n * Parse the AI response and report back to Transcend\n *\n * @param promptName - Prompt to parse\n * @param options - Options for reporting\n * @returns Parsed content\n */\n async reportAndParsePromptRun<TPromptName extends TPromptNames>(\n promptName: TPromptName,\n { largeLanguageModel, ...options }: ReportPromptRunOptions,\n ): Promise<\n PromptRunResult & {\n /** Resulting prompt run */\n result: t.TypeOf<TPrompts[TPromptName]['outputCodec']>;\n }\n > {\n // Determine if prompts need to be fetched\n if (\n // never been fetched\n !this.lastUpdatedAt ||\n // fetch every run\n this.cacheDuration === 0 ||\n // If cache duration met\n (this.cacheDuration &&\n Date.now() - this.lastUpdatedAt.getTime() > this.cacheDuration)\n ) {\n await this.fetchPromptsAndMetadata();\n }\n\n const name =\n options.name ||\n `@transcend-io/cli-prompt-run-${new Date().toISOString()}`;\n\n if (!this.promptContentMap) {\n throw new Error('Expected this.promptContentMap to be defined');\n }\n // Look up prompt info\n const promptInput = this.promptContentMap[promptName];\n if (!promptInput) {\n throw new Error(`Expected this.prompts[${promptName}] to be defined`);\n }\n\n // Ensure the first message in `promptRunMessages` is of type=system\n if (options.promptRunMessages.length === 0) {\n throw new Error('promptRunMessages is expected to have length > 0');\n }\n if (options.promptRunMessages[0].role !== ChatCompletionRole.System) {\n throw new Error(\n `promptRunMessages[0].role is expected to be = ${ChatCompletionRole.System}`,\n );\n }\n if (\n options.promptRunMessages[options.promptRunMessages.length - 1].role !==\n ChatCompletionRole.Assistant\n ) {\n throw new Error(\n `promptRunMessages[${\n options.promptRunMessages.length - 1\n }].role is expected to be = ${ChatCompletionRole.Assistant}`,\n );\n }\n const response =\n options.promptRunMessages[options.promptRunMessages.length - 1].content;\n\n let parsed: t.TypeOf<TPrompts[TPromptName]['outputCodec']>;\n try {\n // Parse the response\n parsed = this.parseAiResponse(promptName, response);\n } catch (err) {\n await reportPromptRun(this.graphQLClient, {\n productArea: PromptRunProductArea.PromptManager,\n ...options,\n name,\n error: err.message,\n status: QueueStatus.Error,\n ...(typeof largeLanguageModel === 'string'\n ? { largeLanguageModelId: largeLanguageModel }\n : {\n largeLanguageModelName: largeLanguageModel.name,\n largeLanguageModelClient: largeLanguageModel.client,\n }),\n promptId: promptInput.id,\n promptRunMessages: options.promptRunMessages.map((message, ind) => ({\n ...message,\n ...(ind === 0 ? { template: promptInput.content } : {}),\n })),\n });\n throw err;\n }\n\n // report successful run\n const promptRunId = await reportPromptRun(this.graphQLClient, {\n productArea: PromptRunProductArea.PromptManager,\n ...options,\n name,\n status: QueueStatus.Resolved,\n ...(typeof largeLanguageModel === 'string'\n ? { largeLanguageModelId: largeLanguageModel }\n : {\n largeLanguageModelName: largeLanguageModel.name,\n largeLanguageModelClient: largeLanguageModel.client,\n }),\n promptId: promptInput.id,\n promptRunMessages: options.promptRunMessages.map((message, ind) => ({\n ...message,\n ...(ind === 0 ? { template: promptInput.content } : {}),\n })),\n });\n\n return {\n result: parsed,\n promptRunId,\n promptRunUrl: `https://app.transcend.io/prompts/runs/${promptRunId}`,\n };\n }\n\n /**\n * Report an error for a particular prompt\n *\n * @param promptName - Prompt to parse\n * @param options - Options for reporting\n * @returns Parsed content\n */\n async reportPromptRunError<TPromptName extends TPromptNames>(\n promptName: TPromptName,\n {\n largeLanguageModel,\n ...options\n }: Requirize<ReportPromptRunOptions, 'error'>,\n ): Promise<PromptRunResult> {\n // Determine if prompts need to be fetched\n if (\n // never been fetched\n !this.lastUpdatedAt ||\n // fetch every run\n this.cacheDuration === 0 ||\n // If cache duration met\n (this.cacheDuration &&\n Date.now() - this.lastUpdatedAt.getTime() > this.cacheDuration)\n ) {\n await this.fetchPromptsAndMetadata();\n }\n\n const name =\n options.name ||\n `@transcend-io/cli-prompt-run-${new Date().toISOString()}`;\n\n if (!this.promptContentMap) {\n throw new Error('Expected this.promptContentMap to be defined');\n }\n // Look up prompt info\n const promptInput = this.promptContentMap[promptName];\n if (!promptInput) {\n throw new Error(`Expected this.prompts[${promptName}] to be defined`);\n }\n\n // Ensure the first message in `promptRunMessages` is of type=system\n if (options.promptRunMessages.length === 0) {\n throw new Error('promptRunMessages is expected to have length > 0');\n }\n if (options.promptRunMessages[0].role !== ChatCompletionRole.System) {\n throw new Error(\n `promptRunMessages[0].role is expected to be = ${ChatCompletionRole.System}`,\n );\n }\n\n const promptRunId = await reportPromptRun(this.graphQLClient, {\n productArea: PromptRunProductArea.PromptManager,\n ...options,\n name,\n status: QueueStatus.Error,\n ...(typeof largeLanguageModel === 'string'\n ? { largeLanguageModelId: largeLanguageModel }\n : {\n largeLanguageModelName: largeLanguageModel.name,\n largeLanguageModelClient: largeLanguageModel.client,\n }),\n promptId: promptInput.id,\n promptRunMessages: options.promptRunMessages.map((message, ind) => ({\n ...message,\n ...(ind === 0 ? { template: promptInput.content } : {}),\n })),\n });\n\n return {\n promptRunId,\n promptRunUrl: `https://app.transcend.io/prompts/runs/${promptRunId}`,\n };\n }\n}\n/* eslint-enable max-lines */\n","import { GraphQLClient } from 'graphql-request';\nimport { LargeLanguageModelClient } from '@transcend-io/privacy-types';\nimport { LARGE_LANGUAGE_MODELS } from './gqls';\nimport { makeGraphQLRequest } from './makeGraphQLRequest';\n\nexport interface LargeLanguageModel {\n /** ID of prompts */\n id: string;\n /** The name of the large language model. */\n name: string;\n /** The content of the prompt template. */\n client: LargeLanguageModelClient;\n /** Whether hosted by Transcend or not */\n isTranscendHosted: boolean;\n}\n\nconst PAGE_SIZE = 20;\n\n/**\n * Fetch all LargeLanguageModels in the organization\n *\n * @param client - GraphQL client\n * @returns All LargeLanguageModels in the organization\n */\nexport async function fetchAllLargeLanguageModels(\n client: GraphQLClient,\n): Promise<LargeLanguageModel[]> {\n const largeLanguageModels: LargeLanguageModel[] = [];\n let offset = 0;\n\n // Whether to continue looping\n let shouldContinue = false;\n do {\n const {\n largeLanguageModels: { nodes },\n } = await makeGraphQLRequest<{\n /** LargeLanguageModels */\n largeLanguageModels: {\n /** List */\n nodes: LargeLanguageModel[];\n };\n }>(client, LARGE_LANGUAGE_MODELS, {\n first: PAGE_SIZE,\n offset,\n });\n largeLanguageModels.push(...nodes);\n offset += PAGE_SIZE;\n shouldContinue = nodes.length === PAGE_SIZE;\n } while (shouldContinue);\n\n return largeLanguageModels.sort((a, b) => a.name.localeCompare(b.name));\n}\n","import { difference } from 'lodash-es';\nimport fastGlob from 'fast-glob';\nimport { execSync } from 'child_process';\n\n/**\n * Function thats gets the git files that have changed\n * and returns the code\n *\n * @param options - Options\n * @returns Changes files and diffs\n */\nexport function getGitFilesThatChanged({\n baseBranch,\n rootDirectory,\n githubRepo,\n excludedGlob = [],\n fileBlockList = [],\n}: {\n /** Base branch */\n baseBranch: string;\n /** Github repo name */\n githubRepo: string;\n /** Root directory */\n rootDirectory: string;\n /** A glob that excludes files */\n excludedGlob?: string[];\n /** Block list of files to not process */\n fileBlockList?: string[];\n}): {\n /** The list of files that changed */\n changedFiles: string[];\n /** Github repo name */\n repoName: string;\n /** Current commit */\n commit: string;\n /** File diffs */\n fileDiffs: { [k in string]: string };\n} {\n // Pull base branch\n execSync(`git fetch origin ${baseBranch}`);\n\n // Latest commit on base branch. If we are on the base branch, we take the prior commit\n const latestBasedCommit = execSync(\n `git ls-remote ${githubRepo} \"refs/heads/${baseBranch}\" | cut -f 1`,\n { encoding: 'utf-8' },\n ).split('\\n')[0];\n\n // This commit\n const latestThisCommit = execSync('git rev-parse HEAD', {\n encoding: 'utf-8',\n }).split('\\n')[0];\n\n // Ensure commits are present\n if (!latestBasedCommit || !latestThisCommit) {\n throw new Error('FAILED TO FIND COMMIT RANGE');\n }\n\n // Get the diff between the given branch and base branch\n const diff = execSync(\n `git fetch && git diff --name-only \"${\n baseBranch || latestBasedCommit\n }...${latestThisCommit}\" -- ${rootDirectory}`,\n { encoding: 'utf-8' },\n );\n\n // Filter out block list\n const changedFiles = difference(\n diff.split('\\n').filter((f) => f),\n fileBlockList,\n );\n\n // Filter out globs\n const filteredChanges =\n excludedGlob.length > 0\n ? fastGlob.sync(changedFiles, { ignore: excludedGlob })\n : changedFiles;\n\n // Get the contents of only the changed files\n const fileDiffs: { [k in string]: string } = {};\n filteredChanges.forEach((file) => {\n const contents = execSync(`git show ${latestThisCommit}:${file}`, {\n encoding: 'utf-8',\n });\n fileDiffs[file] = contents;\n });\n\n // Pull the github repo name\n const repoName = githubRepo.split('/').pop()!.split('.')[0];\n\n return {\n changedFiles,\n fileDiffs,\n repoName,\n commit: latestThisCommit,\n };\n}\n"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -145344,7 +145344,7 @@ declare function removeUnverifiedRequestIdentifiers({ requestActions, identifier
|
|
|
145344
145344
|
}): Promise<number>;
|
|
145345
145345
|
|
|
145346
145346
|
var description = "A command line interface for programmatic operations across Transcend.";
|
|
145347
|
-
var version = "8.
|
|
145347
|
+
var version = "8.25.0";
|
|
145348
145348
|
|
|
145349
145349
|
/**
|
|
145350
145350
|
* The name of the main binary for the CLI
|
|
@@ -145540,7 +145540,7 @@ declare const domainToHost: (domain: string) => string;
|
|
|
145540
145540
|
*/
|
|
145541
145541
|
declare function createConsentToken(userId: string, base64EncryptionKey: string, base64SigningKey: string): string;
|
|
145542
145542
|
|
|
145543
|
-
declare const ConsentPreferenceUpload: t.IntersectionC<[t.
|
|
145543
|
+
declare const ConsentPreferenceUpload: t.IntersectionC<[t.TypeC<{
|
|
145544
145544
|
/** User ID */
|
|
145545
145545
|
userId: t.StringC;
|
|
145546
145546
|
/** Has the consent been updated (including no-change confirmation) since default resolution */
|
|
@@ -145562,7 +145562,6 @@ declare const ConsentPreferenceUpload: t.IntersectionC<[t.IntersectionC<[t.TypeC
|
|
|
145562
145562
|
usp: t.UnionC<[t.StringC, t.NullC]>;
|
|
145563
145563
|
/** IAB GPP String */
|
|
145564
145564
|
gpp: t.UnionC<[t.StringC, t.NullC]>;
|
|
145565
|
-
}>]>, t.PartialC<{
|
|
145566
145565
|
/**
|
|
145567
145566
|
* Purpose map
|
|
145568
145567
|
* This is a stringified JSON object with keys as purpose names and values as booleans or 'Auto'
|
|
@@ -145571,91 +145570,6 @@ declare const ConsentPreferenceUpload: t.IntersectionC<[t.IntersectionC<[t.TypeC
|
|
|
145571
145570
|
}>]>;
|
|
145572
145571
|
/** Type override */
|
|
145573
145572
|
type ConsentPreferenceUpload = t.TypeOf<typeof ConsentPreferenceUpload>;
|
|
145574
|
-
declare const ConsentPreferenceFetch: t.IntersectionC<[t.IntersectionC<[t.TypeC<{
|
|
145575
|
-
/** User ID */
|
|
145576
|
-
userId: t.StringC;
|
|
145577
|
-
/** Has the consent been updated (including no-change confirmation) since default resolution */
|
|
145578
|
-
timestamp: t.StringC;
|
|
145579
|
-
}>, t.PartialC<{
|
|
145580
|
-
/** Was tracking consent confirmed by the user? If this is false, the consent was resolved from defaults & is not yet confirmed */
|
|
145581
|
-
confirmed: t.UnionC<[t.LiteralC<"true">, t.LiteralC<"false">]>;
|
|
145582
|
-
/**
|
|
145583
|
-
* Has the consent been updated (including no-change confirmation) since default resolution
|
|
145584
|
-
*/
|
|
145585
|
-
updated: t.UnionC<[t.LiteralC<"true">, t.LiteralC<"false">]>;
|
|
145586
|
-
/**
|
|
145587
|
-
* Whether or not the UI has been shown to the end-user (undefined in older versions of airgap.js)
|
|
145588
|
-
*/
|
|
145589
|
-
prompted: t.UnionC<[t.LiteralC<"true">, t.LiteralC<"false">]>;
|
|
145590
|
-
/** Consent metadata */
|
|
145591
|
-
metadata: t.StringC;
|
|
145592
|
-
/** US Privacy (USP) String */
|
|
145593
|
-
usp: t.UnionC<[t.StringC, t.NullC]>;
|
|
145594
|
-
/** IAB GPP String */
|
|
145595
|
-
gpp: t.UnionC<[t.StringC, t.NullC]>;
|
|
145596
|
-
}>]>, t.TypeC<{
|
|
145597
|
-
/** This is the partition key used for the dynamo entry */
|
|
145598
|
-
partition: t.StringC;
|
|
145599
|
-
}>, t.PartialC<{
|
|
145600
|
-
/** IAB TCF String */
|
|
145601
|
-
tcf: t.UnionC<[t.StringC, t.NullC]>;
|
|
145602
|
-
/**
|
|
145603
|
-
* Purpose map
|
|
145604
|
-
* This is a JSON object with keys as purpose names and values as booleans or 'Auto'
|
|
145605
|
-
*/
|
|
145606
|
-
purposes: t.RecordC<t.StringC, t.UnionC<[t.BooleanC, t.StringC]>>;
|
|
145607
|
-
}>]>;
|
|
145608
|
-
/** Type override */
|
|
145609
|
-
type ConsentPreferenceFetch = t.TypeOf<typeof ConsentPreferenceFetch>;
|
|
145610
|
-
|
|
145611
|
-
declare const ConsentPreferenceResponse: t.IntersectionC<[t.TypeC<{
|
|
145612
|
-
nodes: t.ArrayC<t.IntersectionC<[t.IntersectionC<[t.TypeC<{
|
|
145613
|
-
userId: t.StringC;
|
|
145614
|
-
timestamp: t.StringC;
|
|
145615
|
-
}>, t.PartialC<{
|
|
145616
|
-
confirmed: t.UnionC<[t.LiteralC<"true">, t.LiteralC<"false">]>;
|
|
145617
|
-
updated: t.UnionC<[t.LiteralC<"true">, t.LiteralC<"false">]>;
|
|
145618
|
-
prompted: t.UnionC<[t.LiteralC<"true">, t.LiteralC<"false">]>;
|
|
145619
|
-
metadata: t.StringC;
|
|
145620
|
-
usp: t.UnionC<[t.StringC, t.NullC]>;
|
|
145621
|
-
gpp: t.UnionC<[t.StringC, t.NullC]>;
|
|
145622
|
-
}>]>, t.TypeC<{
|
|
145623
|
-
partition: t.StringC;
|
|
145624
|
-
}>, t.PartialC<{
|
|
145625
|
-
tcf: t.UnionC<[t.StringC, t.NullC]>;
|
|
145626
|
-
purposes: t.RecordC<t.StringC, t.UnionC<[t.BooleanC, t.StringC]>>;
|
|
145627
|
-
}>]>>;
|
|
145628
|
-
}>, t.PartialC<{
|
|
145629
|
-
lastKey: t.PartialC<{
|
|
145630
|
-
userId: t.StringC;
|
|
145631
|
-
partition: t.StringC;
|
|
145632
|
-
timestamp: t.StringC;
|
|
145633
|
-
}>;
|
|
145634
|
-
}>]>;
|
|
145635
|
-
/** Type override */
|
|
145636
|
-
type ConsentPreferenceResponse = t.TypeOf<typeof ConsentPreferenceResponse>;
|
|
145637
|
-
/**
|
|
145638
|
-
* Fetch consent preferences for the managed consent database
|
|
145639
|
-
*
|
|
145640
|
-
* @param sombra - Sombra instance configured to make requests
|
|
145641
|
-
* @param options - Additional options
|
|
145642
|
-
* @returns The consent preferences
|
|
145643
|
-
*/
|
|
145644
|
-
declare function fetchConsentPreferences(sombra: Got, { partition, filterBy, limit, }: {
|
|
145645
|
-
/** Partition key to fetch */
|
|
145646
|
-
partition: string;
|
|
145647
|
-
/** Filter consent preferences */
|
|
145648
|
-
filterBy?: {
|
|
145649
|
-
/** Fetch specific identifiers */
|
|
145650
|
-
identifiers?: string[];
|
|
145651
|
-
/** Filter before timestamp */
|
|
145652
|
-
timestampBefore?: string;
|
|
145653
|
-
/** Filter after timestamp */
|
|
145654
|
-
timestampAfter?: string;
|
|
145655
|
-
};
|
|
145656
|
-
/** Number of items to pull back at once */
|
|
145657
|
-
limit?: number;
|
|
145658
|
-
}): Promise<ConsentPreferenceFetch[]>;
|
|
145659
145573
|
|
|
145660
145574
|
declare const USP_STRING_REGEX: RegExp;
|
|
145661
145575
|
declare const PurposeMap: t.RecordC<t.StringC, t.UnionC<[t.BooleanC, t.LiteralC<"Auto">]>>;
|
|
@@ -145932,6 +145846,46 @@ type ParquetToCsvOneFileOptions = {
|
|
|
145932
145846
|
*/
|
|
145933
145847
|
declare function parquetToCsvOneFile(opts: ParquetToCsvOneFileOptions): Promise<void>;
|
|
145934
145848
|
|
|
145849
|
+
declare const DAY_MS: number;
|
|
145850
|
+
declare const HOUR_MS: number;
|
|
145851
|
+
/**
|
|
145852
|
+
* Clamp 1..50 per API spec
|
|
145853
|
+
*
|
|
145854
|
+
* @param n - Number
|
|
145855
|
+
* @returns Clamped number
|
|
145856
|
+
*/
|
|
145857
|
+
declare const clampPageSize: (n?: number) => number;
|
|
145858
|
+
/**
|
|
145859
|
+
* TRUE UTC day start (00:00:00Z)
|
|
145860
|
+
*
|
|
145861
|
+
* @param d - Date
|
|
145862
|
+
* @returns Day start
|
|
145863
|
+
*/
|
|
145864
|
+
declare const startOfUtcDay: (d: Date) => Date;
|
|
145865
|
+
/**
|
|
145866
|
+
* TRUE UTC hour start (HH:00:00Z)
|
|
145867
|
+
*
|
|
145868
|
+
* @param d - Date
|
|
145869
|
+
* @returns Hour start
|
|
145870
|
+
*/
|
|
145871
|
+
declare const startOfHour: (d: Date) => Date;
|
|
145872
|
+
/**
|
|
145873
|
+
* Add ms safely
|
|
145874
|
+
*
|
|
145875
|
+
* @param d - Date
|
|
145876
|
+
* @param ms - Milliseconds to add
|
|
145877
|
+
* @returns New date
|
|
145878
|
+
*/
|
|
145879
|
+
declare const addMs: (d: Date, ms: number) => Date;
|
|
145880
|
+
/**
|
|
145881
|
+
* Add whole UTC days (exclusive bound helper)
|
|
145882
|
+
*
|
|
145883
|
+
* @param d - Date
|
|
145884
|
+
* @param n - Number of days to add
|
|
145885
|
+
* @returns New date
|
|
145886
|
+
*/
|
|
145887
|
+
declare const addDaysUtc: (d: Date, n: number) => Date;
|
|
145888
|
+
|
|
145935
145889
|
declare const CronIdentifier: t.TypeC<{
|
|
145936
145890
|
/** The identifier value */
|
|
145937
145891
|
identifier: t.StringC;
|
|
@@ -146698,4 +146652,4 @@ type EnrichPrivacyRequest = t.TypeOf<typeof EnrichPrivacyRequest>;
|
|
|
146698
146652
|
*/
|
|
146699
146653
|
declare function enrichPrivacyRequest(sombra: Got, { id: rawId, ...rest }: EnrichPrivacyRequest, enricherId: string, index?: number): Promise<boolean>;
|
|
146700
146654
|
|
|
146701
|
-
export { ACTIONS, ADD_MESSAGES_TO_PROMPT_RUN, ADD_SILO_DISCOVERY_RESULTS, ADMIN_DASH, ADMIN_DASH_DATAPOINTS, ADMIN_DASH_INTEGRATIONS, AGENTS, AGENT_FILES, AGENT_FUNCTIONS, type AIIntegrationC, API_KEYS, APPROVE_PRIVACY_REQUEST, ASSESSMENTS, ASSESSMENT_SECTION_FIELDS, ASSESSMENT_TEMPLATES, ASSUME_ROLE, ATTRIBUTES, ATTRIBUTE_KEYS_REQUESTS, ATTRIBUTE_VALUES, type Action, ActionInput, type ActionItem, ActionItemCollectionInput, ActionItemInput, type ActionItemRaw, type AddMessagesToPromptRunInput, type Agent, type AgentFile, type AgentFileFilterBy, AgentFileInput, type AgentFunction, AgentFunctionInput, AgentInput, type ApiKey, type ApiKeyGenerateError, ApiKeyInput, type Assessment, AssessmentAction, type AssessmentAnswer, type AssessmentAnswerOption, AssessmentAnswerOptionInput, type AssessmentComment, AssessmentDisplayLogicInput, type AssessmentGroup, AssessmentInput, AssessmentNestedRule, AssessmentNestedRuleInput, type AssessmentPreviousSubmission, type AssessmentQuestion, type AssessmentResource, AssessmentResourceInput, AssessmentRetentionScheduleInput, AssessmentRiskLogic, AssessmentRule, AssessmentRuleInput, AssessmentRuleWithOperands, AssessmentRuleWithoutOperands, type AssessmentSection, AssessmentSectionInput, AssessmentSectionQuestionInput, type AssessmentTemplate, AssessmentTemplateInput, AttestedExtraIdentifiers, type Attribute, AttributeInput, type AttributeKey, type AttributeNameMap, AttributePreview, type AttributeValue, AttributeValueInput, BLANK, BULK_APPLY, BULK_REQUEST_FILES, BUSINESS_ENTITIES, type BusinessEntity, BusinessEntityInput, CANCEL_PRIVACY_REQUEST, CAN_APPLY_IN_BULK, CATALOGS, CHANGE_REQUEST_DATA_SILO_STATUS, CODE_PACKAGES, CONSENT_MANAGER_ANALYTICS_DATA, CONSENT_PARTITIONS, COOKIES, CREATE_ACTION_ITEMS, CREATE_ACTION_ITEM_COLLECTION, CREATE_AGENT, CREATE_AGENT_FILE, CREATE_AGENT_FUNCTION, CREATE_API_KEY, CREATE_ATTRIBUTE, CREATE_ATTRIBUTE_VALUES, CREATE_BUSINESS_ENTITY, CREATE_CODE_PACKAGE, CREATE_CONSENT_EXPERIENCE, CREATE_CONSENT_MANAGER, CREATE_CONSENT_PARTITION, CREATE_DATA_FLOWS, CREATE_DATA_SILOS, CREATE_DATA_SUBJECT, CREATE_DATA_SUB_CATEGORY, CREATE_ENRICHER, CREATE_IDENTIFIER, CREATE_PREFERENCE_ACCESS_TOKENS, CREATE_PROCESSING_ACTIVITY, CREATE_PROCESSING_PURPOSE_SUB_CATEGORY, CREATE_PROMPT, CREATE_PROMPT_GROUP, CREATE_PROMPT_PARTIAL, CREATE_REPOSITORY, CREATE_SOFTWARE_DEVELOPMENT_KIT, CREATE_TEAM, CREATE_TEMPLATE, CREATE_VENDOR, CachedFileState, CachedRequestState, type Catalog, CodePackageInput, CodePackageSdk, ColumnName, type ColumnNameMap, type ConsentExperience, ConsentManageExperienceInput, type ConsentManager, ConsentManagerInput, type ConsentManagerMetric, ConsentManagerMetricBin, ConsentManagerServiceMetadata, type ConsentManagerTheme, ConsentPreferenceResponse, ConsentPreferenceTopic, ConsentPreferenceTopicOptionValue, ConsentPurpose, type Cookie, CookieCsvInput, CookieInput, type CreatedApiKey, CronIdentifier, CronIdentifierPush, type CronIdentifierWithAction, type CsvFormattedIdentifier, DATAPOINT_EXPORT, DATA_FLOWS, DATA_POINTS, DATA_POINT_COUNT, DATA_SILOS, DATA_SILOS_ENRICHED, DATA_SILO_EXPORT, DATA_SUBJECTS, DATA_SUB_CATEGORIES, DEBUG, DEFAULT_TRANSCEND_API, DEFAULT_TRANSCEND_CONSENT_API, DEFAULT_TRANSCEND_PULL_RESOURCES, DELETE_API_KEY, DELETE_ATTRIBUTE_VALUE, DEPLOYED_PRIVACY_CENTER_URL, DEPLOY_CONSENT_MANAGER, DETERMINE_LOGIN_METHOD, DataCategoryGuessInput, DataCategoryInput, DataCategoryPreviewInput, DataCategoryRecommendationInput, type DataFlow, DataFlowCsvInput, DataFlowInput, type DataPointCsvPreview, type DataSilo, type DataSiloAttributeValue, type DataSiloCsvPreview, type DataSiloEnriched, DataSiloInput, type DataSubCategory, type DataSubject, DataSubjectInput, type DatapointFilterOptions, DatapointInput, ENABLED_PLUGINS, ENRICHERS, ENTRY_COUNT, EXPERIENCES, type EnabledRouteC, type EnabledRoutesC, EnrichPrivacyRequest, type Enricher, EnricherInput, type ExportedPrivacyRequest, type ExternalUser, FETCH_CONSENT_MANAGER, FETCH_CONSENT_MANAGER_ID, FETCH_CONSENT_MANAGER_THEME, FETCH_PRIVACY_CENTER_ID, FieldInput, type FormattedAttribute, GLOBAL_ACTION_ITEMS, GLOBAL_ACTION_ITEM_COLLECTIONS, type GetPromptParamType, type GetPromptResponseType, IDENTIFIERS, IDENTIFIER_BLOCK_LIST, IMPORT_ONE_TRUST_ASSESSMENT_FORMS, INITIALIZER, IP_ADDRESS_REGEX, IS_REQUIRED, type Identifier, IdentifierInput, type IdentifierNameMap, ImportOnetrustAssessmentsInput, type IndexedCatalogs, type Initializer, IntlMessage, IntlMessageInput, LARGE_LANGUAGE_MODELS, LOGIN, MESSAGES, type Message, NEW_IDENTIFIER_TYPES, NONE, NOTIFY_ADDITIONAL_TIME, ORGANIZATION, OneTrustFileFormat, OneTrustPullResource, OneTrustPullSource, OpenAIEnabledRoute, OpenAIEnabledRoutes, OpenAIIntegration, OpenAIRouteName, type OrganizationPreview, POLICIES, PREFERENCE_TOPICS, PRIVACY_CENTER, PROCESSING_ACTIVITIES, PROCESSING_PURPOSE_SUB_CATEGORIES, PROMPTS, PROMPTS_WITH_VARIABLES, PROMPT_GROUPS, PROMPT_PARTIALS, PROMPT_THREADS, PURPOSES, type ParquetToCsvOneFileOptions, ParsedAttributeInput, PartitionInput, PathfinderPolicy, PathfinderPolicyName, PathfinderPolicyNameC, PathfinderPromptRunMetadata, type Plugin, type PluginResponse, type Policy, PolicyInput, type PreferenceAccessTokenInput, type PreferenceTopic, type PrivacyCenter, PrivacyCenterInput, PrivacyRequest, PrivacyRequestInput, PrivacyRequestResponse, type PrivacyRequestWithIdentifiers, type ProcessingActivity, ProcessingActivityInput, ProcessingPurposeInput, ProcessingPurposePreviewInput, type ProcessingPurposeSubCategory, type Prompt, PromptAVendorEmailSettings, type PromptCalculatedVariable, type PromptGroup, PromptGroupInput, PromptInput, type PromptPartial, PromptPartialInput, type PromptRunResult, type PromptRuntimeVariable, type PromptThread, type Purpose, PurposeMap, type PurposeWithPreferences, REDUCED_REQUESTS_FOR_DATA_SILO_COUNT, REMOVE_REQUEST_IDENTIFIERS, REPORT_PROMPT_RUN, REPOSITORIES, REQUESTS, REQUEST_DATA_SILOS, REQUEST_ENRICHERS, REQUEST_FILES, REQUEST_IDENTIFIERS, RETRYABLE_BATCH_STATUSES, RETRY_REQUEST_DATA_SILO, RETRY_REQUEST_ENRICHER, RateCounter, RegionInput, type ReportPromptRunInput, type ReportPromptRunOptions, RepositoryInput, type RequestDataSilo, type RequestDataSiloFilters, type RequestEnricher, type RequestFile, type RequestFileCursor, RequestFileMetadata, RequestFileMetadataResponse, type RequestFileResponse, RequestIdentifier, type RequestIdentifierMetadata, RequestIdentifiersResponse, RequestPurposeTrigger, type RetentionSchedule, type RetryPolicy, RiskAssignmentInput, type RiskCategory, type RiskFramework, type RiskLevel, RiskLogicInput, type RiskMatrix, type RiskMatrixColumn, type RiskMatrixRow, SCOPES_BY_TITLE, SCOPE_TITLES, SET_RESOURCE_ATTRIBUTES, SKIP_REQUEST_ENRICHER, SOFTWARE_DEVELOPMENT_KITS, SOMBRA_VERSION, SUB_DATA_POINTS, SUB_DATA_POINTS_COUNT, SUB_DATA_POINTS_WITH_GUESSES, SYNC_ATTRIBUTE_TYPES, SoftwareDevelopmentKitInput, StoredApiKey, type SubDataPoint, type SubDataPointCsvPreview, SuccessfulRequest, TEAMS, TEMPLATES, TOGGLE_CONSENT_PRECEDENCE, TOGGLE_DATA_SUBJECT, TOGGLE_TELEMETRY_PARTITION_STRATEGY, TOGGLE_UNKNOWN_COOKIE_POLICY, TOGGLE_UNKNOWN_REQUEST_POLICY, TR_PULL_RESOURCE_SCOPE_MAP, TR_PUSH_RESOURCE_SCOPE_MAP, TR_YML_RESOURCE_TO_FIELD_NAME, type Team, TeamInput, type Template, TemplateInput, TranscendInput, type TranscendPartition, type TranscendPrompt, TranscendPromptManager, type TranscendPromptPartialTemplated, type TranscendPromptTemplated, type TranscendPromptsAndVariables, type TranscendPullConfigurationInput, TranscendPullResource, UPDATE_ACTION, UPDATE_ACTION_ITEMS, UPDATE_ACTION_ITEM_COLLECTION, UPDATE_AGENTS, UPDATE_AGENT_FILES, UPDATE_AGENT_FUNCTIONS, UPDATE_ATTRIBUTE, UPDATE_ATTRIBUTE_VALUES, UPDATE_BUSINESS_ENTITIES, UPDATE_CODE_PACKAGES, UPDATE_CONSENT_EXPERIENCE, UPDATE_CONSENT_MANAGER_DOMAINS, UPDATE_CONSENT_MANAGER_PARTITION, UPDATE_CONSENT_MANAGER_THEME, UPDATE_CONSENT_MANAGER_TO_LATEST, UPDATE_CONSENT_MANAGER_VERSION, UPDATE_DATA_FLOWS, UPDATE_DATA_SILOS, UPDATE_DATA_SUBJECT, UPDATE_DATA_SUB_CATEGORIES, UPDATE_ENRICHER, UPDATE_IDENTIFIER, UPDATE_INTL_MESSAGES, UPDATE_LOAD_OPTIONS, UPDATE_OR_CREATE_COOKIES, UPDATE_OR_CREATE_DATA_POINT, UPDATE_POLICIES, UPDATE_PRIVACY_CENTER, UPDATE_PRIVACY_REQUEST, UPDATE_PROCESSING_ACTIVITIES, UPDATE_PROCESSING_PURPOSE_SUB_CATEGORIES, UPDATE_PROMPTS, UPDATE_PROMPT_GROUPS, UPDATE_PROMPT_PARTIALS, UPDATE_REPOSITORIES, UPDATE_SOFTWARE_DEVELOPMENT_KITS, UPDATE_TEAM, UPDATE_VENDORS, USERS, USP_STRING_REGEX, type User, type UserPreview, type UserRole, VARIABLE_PARAMETERS_NAME, VARIABLE_PARAMETERS_REGEXP, VENDORS, type Vendor, VendorInput, WebhookHeader, type XdiSyncGroups, addMessagesToPromptRun, appendCsvSync, approvePrivacyRequests, assumeRole, buildAIIntegrationType, buildEnabledRouteType, buildTranscendGraphQLClient, buildTranscendGraphQLClientGeneric, buildXdiSyncEndpoint, bulkRestartRequests, bulkRetryEnrichers, cancelPrivacyRequests, collectParquetFilesOrExit, consentManagersToBusinessEntities, convertToDataSubjectAllowlist, convertToDataSubjectBlockList, createActionItemCollection, createActionItems, createAgent, createAgentFile, createAgentFunction, createApiKey, createBusinessEntity, createCodePackage, createConsentToken, createDataCategory, createDataFlows, createPreferenceAccessTokens, createProcessingPurpose, createPrompt, createRegexForTag, createRepository, createSoftwareDevelopmentKit, createSombraGotInstance, createTranscendConsentGotInstance, createVendor, defineTranscendPrompts, deleteApiKey, deployConsentManager, description, domainToHost, downloadPrivacyRequestFiles, enrichPrivacyRequest, ensureAllDataSubjectsExist, extractClientError, extractErrorMessage, fetchActiveSiloDiscoPlugin, fetchAllActionItems, fetchAllActions, fetchAllAgentFiles, fetchAllAgentFunctions, fetchAllAgents, fetchAllApiKeys, fetchAllAssessmentTemplates, fetchAllAssessments, fetchAllAttributeValues, fetchAllAttributes, fetchAllBusinessEntities, fetchAllCatalogs, fetchAllCookies, fetchAllDataCategories, fetchAllDataFlows, fetchAllDataPoints, fetchAllDataSilos, fetchAllDataSubjects, fetchAllEnrichers, fetchAllIdentifiers, fetchAllMessages, fetchAllPolicies, fetchAllPreferenceTopics, fetchAllPrivacyCenters, fetchAllProcessingActivities, fetchAllProcessingPurposes, fetchAllPromptGroups, fetchAllPromptPartials, fetchAllPromptThreads, fetchAllPrompts, fetchAllPurposes, fetchAllPurposesAndPreferences, fetchAllRequestAttributeKeys, fetchAllRequestEnrichers, fetchAllRequestIdentifierMetadata, fetchAllRequestIdentifiers, fetchAllRequests, fetchAllSubDataPoints, fetchAllTeams, fetchAllTemplates, fetchAllUsers, fetchAllVendors, fetchAndIndexCatalogs, fetchApiKeys, fetchConsentManager, fetchConsentManagerAnalyticsData, fetchConsentManagerExperiences, fetchConsentManagerId, fetchConsentManagerTheme, fetchConsentPreferences, fetchEnrichedDataSilos, fetchIdentifiersAndCreateMissing, fetchPartitions, fetchPrivacyCenterId, fetchPrivacyCenterUrl, fetchPromptsWithVariables, fetchRequestDataSilo, fetchRequestDataSiloActiveCount, fetchRequestDataSilos, fetchRequestDataSilosCount, fetchRequestFilesForRequest, filterNullishValuesFromObject, filterRows, formatAttributeValues, fuzzyMatchColumns, fuzzySearch, generateCrossAccountApiKeys, getErrorStatus, getFileMetadataForPrivacyRequests, getGitFilesThatChanged, getUniqueValuesForColumn, inquirerAutoComplete, inquirerConfirmBoolean, inquirerConfirmText, limitRecords, listDirectories, listFiles, loginUser, makeGraphQLRequest, mapColumnsToAttributes, mapColumnsToIdentifiers, mapCsvColumnsToApi, mapCsvRowsToRequestInputs, mapEnumValues, mapRequestEnumValues, markCronIdentifierCompleted, markRequestDataSiloIdsCompleted, markSilentPrivacyRequests, mergeTranscendInputs, name, normalizeIdentifierValue, notifyPrivacyRequestsAdditionalTime, parquetToCsvOneFile, parseAssessmentDisplayLogic, parseAssessmentRiskLogic, parseAttributesFromString, parseFilePath, parseVariablesFromString, pullAllDatapoints, pullChunkedCustomSiloOutstandingIdentifiers, pullConsentManagerMetrics, pullCronPageOfIdentifiers, pullManualEnrichmentIdentifiersToCsv, pullPrivacyRequests, pullTranscendConfiguration, pullUnstructuredSubDataPointRecommendations, pushCronIdentifiersFromCsv, pushManualEnrichmentIdentifiersFromCsv, readCsv, readSafe, readTranscendYaml, removeLinks, removeUnverifiedRequestIdentifiers, replaceVariablesInYaml, reportPromptRun, restartPrivacyRequest, retryRequestDataSilos, retryRequestEnricher, retrySamePromise, setResourceAttributes, skipPreflightJobs, skipRequestDataSilos, sleepPromise, splitCsvToList, splitInHalf, streamPrivacyRequestFiles, submitPrivacyRequest, syncAction, syncActionItemCollections, syncActionItems, syncAgentFiles, syncAgentFunctions, syncAgents, syncAttribute, syncBusinessEntities, syncCodePackages, syncConfigurationToTranscend, syncConsentManager, syncConsentManagerExperiences, syncCookies, syncDataCategories, syncDataFlows, syncDataSiloDependencies, syncDataSilos, syncDataSubject, syncEnricher, syncIdentifier, syncIntlMessages, syncPartitions, syncPolicies, syncPrivacyCenter, syncProcessingActivities, syncProcessingPurposes, syncPrompts, syncRepositories, syncSoftwareDevelopmentKits, syncTemplate, syncVendors, updateActionItem, updateActionItemCollection, updateAgentFiles, updateAgentFunctions, updateAgents, updateBusinessEntities, updateCodePackages, updateConsentManagerToLatest, updateConsentManagerVersionToLatest, updateDataCategories, updateDataFlows, updateIntlMessages, updateOrCreateCookies, updatePolicies, updateProcessingPurposes, updatePrompts, updateRepositories, updateSoftwareDevelopmentKits, updateVendors, uploadConsents, uploadCookiesFromCsv, uploadDataFlowsFromCsv, uploadPrivacyRequestsFromCsv, uploadSiloDiscoveryResults, validateTranscendAuth, version, writeCsv, writeCsvSync, writeLargeCsv, writeTranscendYaml };
|
|
146655
|
+
export { ACTIONS, ADD_MESSAGES_TO_PROMPT_RUN, ADD_SILO_DISCOVERY_RESULTS, ADMIN_DASH, ADMIN_DASH_DATAPOINTS, ADMIN_DASH_INTEGRATIONS, AGENTS, AGENT_FILES, AGENT_FUNCTIONS, type AIIntegrationC, API_KEYS, APPROVE_PRIVACY_REQUEST, ASSESSMENTS, ASSESSMENT_SECTION_FIELDS, ASSESSMENT_TEMPLATES, ASSUME_ROLE, ATTRIBUTES, ATTRIBUTE_KEYS_REQUESTS, ATTRIBUTE_VALUES, type Action, ActionInput, type ActionItem, ActionItemCollectionInput, ActionItemInput, type ActionItemRaw, type AddMessagesToPromptRunInput, type Agent, type AgentFile, type AgentFileFilterBy, AgentFileInput, type AgentFunction, AgentFunctionInput, AgentInput, type ApiKey, type ApiKeyGenerateError, ApiKeyInput, type Assessment, AssessmentAction, type AssessmentAnswer, type AssessmentAnswerOption, AssessmentAnswerOptionInput, type AssessmentComment, AssessmentDisplayLogicInput, type AssessmentGroup, AssessmentInput, AssessmentNestedRule, AssessmentNestedRuleInput, type AssessmentPreviousSubmission, type AssessmentQuestion, type AssessmentResource, AssessmentResourceInput, AssessmentRetentionScheduleInput, AssessmentRiskLogic, AssessmentRule, AssessmentRuleInput, AssessmentRuleWithOperands, AssessmentRuleWithoutOperands, type AssessmentSection, AssessmentSectionInput, AssessmentSectionQuestionInput, type AssessmentTemplate, AssessmentTemplateInput, AttestedExtraIdentifiers, type Attribute, AttributeInput, type AttributeKey, type AttributeNameMap, AttributePreview, type AttributeValue, AttributeValueInput, BLANK, BULK_APPLY, BULK_REQUEST_FILES, BUSINESS_ENTITIES, type BusinessEntity, BusinessEntityInput, CANCEL_PRIVACY_REQUEST, CAN_APPLY_IN_BULK, CATALOGS, CHANGE_REQUEST_DATA_SILO_STATUS, CODE_PACKAGES, CONSENT_MANAGER_ANALYTICS_DATA, CONSENT_PARTITIONS, COOKIES, CREATE_ACTION_ITEMS, CREATE_ACTION_ITEM_COLLECTION, CREATE_AGENT, CREATE_AGENT_FILE, CREATE_AGENT_FUNCTION, CREATE_API_KEY, CREATE_ATTRIBUTE, CREATE_ATTRIBUTE_VALUES, CREATE_BUSINESS_ENTITY, CREATE_CODE_PACKAGE, CREATE_CONSENT_EXPERIENCE, CREATE_CONSENT_MANAGER, CREATE_CONSENT_PARTITION, CREATE_DATA_FLOWS, CREATE_DATA_SILOS, CREATE_DATA_SUBJECT, CREATE_DATA_SUB_CATEGORY, CREATE_ENRICHER, CREATE_IDENTIFIER, CREATE_PREFERENCE_ACCESS_TOKENS, CREATE_PROCESSING_ACTIVITY, CREATE_PROCESSING_PURPOSE_SUB_CATEGORY, CREATE_PROMPT, CREATE_PROMPT_GROUP, CREATE_PROMPT_PARTIAL, CREATE_REPOSITORY, CREATE_SOFTWARE_DEVELOPMENT_KIT, CREATE_TEAM, CREATE_TEMPLATE, CREATE_VENDOR, CachedFileState, CachedRequestState, type Catalog, CodePackageInput, CodePackageSdk, ColumnName, type ColumnNameMap, type ConsentExperience, ConsentManageExperienceInput, type ConsentManager, ConsentManagerInput, type ConsentManagerMetric, ConsentManagerMetricBin, ConsentManagerServiceMetadata, type ConsentManagerTheme, ConsentPreferenceTopic, ConsentPreferenceTopicOptionValue, ConsentPurpose, type Cookie, CookieCsvInput, CookieInput, type CreatedApiKey, CronIdentifier, CronIdentifierPush, type CronIdentifierWithAction, type CsvFormattedIdentifier, DATAPOINT_EXPORT, DATA_FLOWS, DATA_POINTS, DATA_POINT_COUNT, DATA_SILOS, DATA_SILOS_ENRICHED, DATA_SILO_EXPORT, DATA_SUBJECTS, DATA_SUB_CATEGORIES, DAY_MS, DEBUG, DEFAULT_TRANSCEND_API, DEFAULT_TRANSCEND_CONSENT_API, DEFAULT_TRANSCEND_PULL_RESOURCES, DELETE_API_KEY, DELETE_ATTRIBUTE_VALUE, DEPLOYED_PRIVACY_CENTER_URL, DEPLOY_CONSENT_MANAGER, DETERMINE_LOGIN_METHOD, DataCategoryGuessInput, DataCategoryInput, DataCategoryPreviewInput, DataCategoryRecommendationInput, type DataFlow, DataFlowCsvInput, DataFlowInput, type DataPointCsvPreview, type DataSilo, type DataSiloAttributeValue, type DataSiloCsvPreview, type DataSiloEnriched, DataSiloInput, type DataSubCategory, type DataSubject, DataSubjectInput, type DatapointFilterOptions, DatapointInput, ENABLED_PLUGINS, ENRICHERS, ENTRY_COUNT, EXPERIENCES, type EnabledRouteC, type EnabledRoutesC, EnrichPrivacyRequest, type Enricher, EnricherInput, type ExportedPrivacyRequest, type ExternalUser, FETCH_CONSENT_MANAGER, FETCH_CONSENT_MANAGER_ID, FETCH_CONSENT_MANAGER_THEME, FETCH_PRIVACY_CENTER_ID, FieldInput, type FormattedAttribute, GLOBAL_ACTION_ITEMS, GLOBAL_ACTION_ITEM_COLLECTIONS, type GetPromptParamType, type GetPromptResponseType, HOUR_MS, IDENTIFIERS, IDENTIFIER_BLOCK_LIST, IMPORT_ONE_TRUST_ASSESSMENT_FORMS, INITIALIZER, IP_ADDRESS_REGEX, IS_REQUIRED, type Identifier, IdentifierInput, type IdentifierNameMap, ImportOnetrustAssessmentsInput, type IndexedCatalogs, type Initializer, IntlMessage, IntlMessageInput, LARGE_LANGUAGE_MODELS, LOGIN, MESSAGES, type Message, NEW_IDENTIFIER_TYPES, NONE, NOTIFY_ADDITIONAL_TIME, ORGANIZATION, OneTrustFileFormat, OneTrustPullResource, OneTrustPullSource, OpenAIEnabledRoute, OpenAIEnabledRoutes, OpenAIIntegration, OpenAIRouteName, type OrganizationPreview, POLICIES, PREFERENCE_TOPICS, PRIVACY_CENTER, PROCESSING_ACTIVITIES, PROCESSING_PURPOSE_SUB_CATEGORIES, PROMPTS, PROMPTS_WITH_VARIABLES, PROMPT_GROUPS, PROMPT_PARTIALS, PROMPT_THREADS, PURPOSES, type ParquetToCsvOneFileOptions, ParsedAttributeInput, PartitionInput, PathfinderPolicy, PathfinderPolicyName, PathfinderPolicyNameC, PathfinderPromptRunMetadata, type Plugin, type PluginResponse, type Policy, PolicyInput, type PreferenceAccessTokenInput, type PreferenceTopic, type PrivacyCenter, PrivacyCenterInput, PrivacyRequest, PrivacyRequestInput, PrivacyRequestResponse, type PrivacyRequestWithIdentifiers, type ProcessingActivity, ProcessingActivityInput, ProcessingPurposeInput, ProcessingPurposePreviewInput, type ProcessingPurposeSubCategory, type Prompt, PromptAVendorEmailSettings, type PromptCalculatedVariable, type PromptGroup, PromptGroupInput, PromptInput, type PromptPartial, PromptPartialInput, type PromptRunResult, type PromptRuntimeVariable, type PromptThread, type Purpose, PurposeMap, type PurposeWithPreferences, REDUCED_REQUESTS_FOR_DATA_SILO_COUNT, REMOVE_REQUEST_IDENTIFIERS, REPORT_PROMPT_RUN, REPOSITORIES, REQUESTS, REQUEST_DATA_SILOS, REQUEST_ENRICHERS, REQUEST_FILES, REQUEST_IDENTIFIERS, RETRYABLE_BATCH_STATUSES, RETRY_REQUEST_DATA_SILO, RETRY_REQUEST_ENRICHER, RateCounter, RegionInput, type ReportPromptRunInput, type ReportPromptRunOptions, RepositoryInput, type RequestDataSilo, type RequestDataSiloFilters, type RequestEnricher, type RequestFile, type RequestFileCursor, RequestFileMetadata, RequestFileMetadataResponse, type RequestFileResponse, RequestIdentifier, type RequestIdentifierMetadata, RequestIdentifiersResponse, RequestPurposeTrigger, type RetentionSchedule, type RetryPolicy, RiskAssignmentInput, type RiskCategory, type RiskFramework, type RiskLevel, RiskLogicInput, type RiskMatrix, type RiskMatrixColumn, type RiskMatrixRow, SCOPES_BY_TITLE, SCOPE_TITLES, SET_RESOURCE_ATTRIBUTES, SKIP_REQUEST_ENRICHER, SOFTWARE_DEVELOPMENT_KITS, SOMBRA_VERSION, SUB_DATA_POINTS, SUB_DATA_POINTS_COUNT, SUB_DATA_POINTS_WITH_GUESSES, SYNC_ATTRIBUTE_TYPES, SoftwareDevelopmentKitInput, StoredApiKey, type SubDataPoint, type SubDataPointCsvPreview, SuccessfulRequest, TEAMS, TEMPLATES, TOGGLE_CONSENT_PRECEDENCE, TOGGLE_DATA_SUBJECT, TOGGLE_TELEMETRY_PARTITION_STRATEGY, TOGGLE_UNKNOWN_COOKIE_POLICY, TOGGLE_UNKNOWN_REQUEST_POLICY, TR_PULL_RESOURCE_SCOPE_MAP, TR_PUSH_RESOURCE_SCOPE_MAP, TR_YML_RESOURCE_TO_FIELD_NAME, type Team, TeamInput, type Template, TemplateInput, TranscendInput, type TranscendPartition, type TranscendPrompt, TranscendPromptManager, type TranscendPromptPartialTemplated, type TranscendPromptTemplated, type TranscendPromptsAndVariables, type TranscendPullConfigurationInput, TranscendPullResource, UPDATE_ACTION, UPDATE_ACTION_ITEMS, UPDATE_ACTION_ITEM_COLLECTION, UPDATE_AGENTS, UPDATE_AGENT_FILES, UPDATE_AGENT_FUNCTIONS, UPDATE_ATTRIBUTE, UPDATE_ATTRIBUTE_VALUES, UPDATE_BUSINESS_ENTITIES, UPDATE_CODE_PACKAGES, UPDATE_CONSENT_EXPERIENCE, UPDATE_CONSENT_MANAGER_DOMAINS, UPDATE_CONSENT_MANAGER_PARTITION, UPDATE_CONSENT_MANAGER_THEME, UPDATE_CONSENT_MANAGER_TO_LATEST, UPDATE_CONSENT_MANAGER_VERSION, UPDATE_DATA_FLOWS, UPDATE_DATA_SILOS, UPDATE_DATA_SUBJECT, UPDATE_DATA_SUB_CATEGORIES, UPDATE_ENRICHER, UPDATE_IDENTIFIER, UPDATE_INTL_MESSAGES, UPDATE_LOAD_OPTIONS, UPDATE_OR_CREATE_COOKIES, UPDATE_OR_CREATE_DATA_POINT, UPDATE_POLICIES, UPDATE_PRIVACY_CENTER, UPDATE_PRIVACY_REQUEST, UPDATE_PROCESSING_ACTIVITIES, UPDATE_PROCESSING_PURPOSE_SUB_CATEGORIES, UPDATE_PROMPTS, UPDATE_PROMPT_GROUPS, UPDATE_PROMPT_PARTIALS, UPDATE_REPOSITORIES, UPDATE_SOFTWARE_DEVELOPMENT_KITS, UPDATE_TEAM, UPDATE_VENDORS, USERS, USP_STRING_REGEX, type User, type UserPreview, type UserRole, VARIABLE_PARAMETERS_NAME, VARIABLE_PARAMETERS_REGEXP, VENDORS, type Vendor, VendorInput, WebhookHeader, type XdiSyncGroups, addDaysUtc, addMessagesToPromptRun, addMs, appendCsvSync, approvePrivacyRequests, assumeRole, buildAIIntegrationType, buildEnabledRouteType, buildTranscendGraphQLClient, buildTranscendGraphQLClientGeneric, buildXdiSyncEndpoint, bulkRestartRequests, bulkRetryEnrichers, cancelPrivacyRequests, clampPageSize, collectParquetFilesOrExit, consentManagersToBusinessEntities, convertToDataSubjectAllowlist, convertToDataSubjectBlockList, createActionItemCollection, createActionItems, createAgent, createAgentFile, createAgentFunction, createApiKey, createBusinessEntity, createCodePackage, createConsentToken, createDataCategory, createDataFlows, createPreferenceAccessTokens, createProcessingPurpose, createPrompt, createRegexForTag, createRepository, createSoftwareDevelopmentKit, createSombraGotInstance, createTranscendConsentGotInstance, createVendor, defineTranscendPrompts, deleteApiKey, deployConsentManager, description, domainToHost, downloadPrivacyRequestFiles, enrichPrivacyRequest, ensureAllDataSubjectsExist, extractClientError, extractErrorMessage, fetchActiveSiloDiscoPlugin, fetchAllActionItems, fetchAllActions, fetchAllAgentFiles, fetchAllAgentFunctions, fetchAllAgents, fetchAllApiKeys, fetchAllAssessmentTemplates, fetchAllAssessments, fetchAllAttributeValues, fetchAllAttributes, fetchAllBusinessEntities, fetchAllCatalogs, fetchAllCookies, fetchAllDataCategories, fetchAllDataFlows, fetchAllDataPoints, fetchAllDataSilos, fetchAllDataSubjects, fetchAllEnrichers, fetchAllIdentifiers, fetchAllMessages, fetchAllPolicies, fetchAllPreferenceTopics, fetchAllPrivacyCenters, fetchAllProcessingActivities, fetchAllProcessingPurposes, fetchAllPromptGroups, fetchAllPromptPartials, fetchAllPromptThreads, fetchAllPrompts, fetchAllPurposes, fetchAllPurposesAndPreferences, fetchAllRequestAttributeKeys, fetchAllRequestEnrichers, fetchAllRequestIdentifierMetadata, fetchAllRequestIdentifiers, fetchAllRequests, fetchAllSubDataPoints, fetchAllTeams, fetchAllTemplates, fetchAllUsers, fetchAllVendors, fetchAndIndexCatalogs, fetchApiKeys, fetchConsentManager, fetchConsentManagerAnalyticsData, fetchConsentManagerExperiences, fetchConsentManagerId, fetchConsentManagerTheme, fetchEnrichedDataSilos, fetchIdentifiersAndCreateMissing, fetchPartitions, fetchPrivacyCenterId, fetchPrivacyCenterUrl, fetchPromptsWithVariables, fetchRequestDataSilo, fetchRequestDataSiloActiveCount, fetchRequestDataSilos, fetchRequestDataSilosCount, fetchRequestFilesForRequest, filterNullishValuesFromObject, filterRows, formatAttributeValues, fuzzyMatchColumns, fuzzySearch, generateCrossAccountApiKeys, getErrorStatus, getFileMetadataForPrivacyRequests, getGitFilesThatChanged, getUniqueValuesForColumn, inquirerAutoComplete, inquirerConfirmBoolean, inquirerConfirmText, limitRecords, listDirectories, listFiles, loginUser, makeGraphQLRequest, mapColumnsToAttributes, mapColumnsToIdentifiers, mapCsvColumnsToApi, mapCsvRowsToRequestInputs, mapEnumValues, mapRequestEnumValues, markCronIdentifierCompleted, markRequestDataSiloIdsCompleted, markSilentPrivacyRequests, mergeTranscendInputs, name, normalizeIdentifierValue, notifyPrivacyRequestsAdditionalTime, parquetToCsvOneFile, parseAssessmentDisplayLogic, parseAssessmentRiskLogic, parseAttributesFromString, parseFilePath, parseVariablesFromString, pullAllDatapoints, pullChunkedCustomSiloOutstandingIdentifiers, pullConsentManagerMetrics, pullCronPageOfIdentifiers, pullManualEnrichmentIdentifiersToCsv, pullPrivacyRequests, pullTranscendConfiguration, pullUnstructuredSubDataPointRecommendations, pushCronIdentifiersFromCsv, pushManualEnrichmentIdentifiersFromCsv, readCsv, readSafe, readTranscendYaml, removeLinks, removeUnverifiedRequestIdentifiers, replaceVariablesInYaml, reportPromptRun, restartPrivacyRequest, retryRequestDataSilos, retryRequestEnricher, retrySamePromise, setResourceAttributes, skipPreflightJobs, skipRequestDataSilos, sleepPromise, splitCsvToList, splitInHalf, startOfHour, startOfUtcDay, streamPrivacyRequestFiles, submitPrivacyRequest, syncAction, syncActionItemCollections, syncActionItems, syncAgentFiles, syncAgentFunctions, syncAgents, syncAttribute, syncBusinessEntities, syncCodePackages, syncConfigurationToTranscend, syncConsentManager, syncConsentManagerExperiences, syncCookies, syncDataCategories, syncDataFlows, syncDataSiloDependencies, syncDataSilos, syncDataSubject, syncEnricher, syncIdentifier, syncIntlMessages, syncPartitions, syncPolicies, syncPrivacyCenter, syncProcessingActivities, syncProcessingPurposes, syncPrompts, syncRepositories, syncSoftwareDevelopmentKits, syncTemplate, syncVendors, updateActionItem, updateActionItemCollection, updateAgentFiles, updateAgentFunctions, updateAgents, updateBusinessEntities, updateCodePackages, updateConsentManagerToLatest, updateConsentManagerVersionToLatest, updateDataCategories, updateDataFlows, updateIntlMessages, updateOrCreateCookies, updatePolicies, updateProcessingPurposes, updatePrompts, updateRepositories, updateSoftwareDevelopmentKits, updateVendors, uploadConsents, uploadCookiesFromCsv, uploadDataFlowsFromCsv, uploadPrivacyRequestsFromCsv, uploadSiloDiscoveryResults, validateTranscendAuth, version, writeCsv, writeCsvSync, writeLargeCsv, writeTranscendYaml };
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"author": "Transcend Inc.",
|
|
3
3
|
"name": "@transcend-io/cli",
|
|
4
4
|
"description": "A command line interface for programmatic operations across Transcend.",
|
|
5
|
-
"version": "8.
|
|
5
|
+
"version": "8.25.0",
|
|
6
6
|
"homepage": "https://github.com/transcend-io/cli",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
package/dist/chunk-4Y2OJ475.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkCYGC567Ycjs = require('./chunk-CYGC567Y.cjs');var _chunkZUNVPK23cjs = require('./chunk-ZUNVPK23.cjs');var _chunk4DYEWT53cjs = require('./chunk-4DYEWT53.cjs');var _crypto = require('crypto'); var U = _interopRequireWildcard(_crypto);var _jsonwebtoken = require('jsonwebtoken'); var E = _interopRequireWildcard(_jsonwebtoken);function $(c,l,n){let o=Buffer.from(n,"base64"),f=Buffer.from(l,"base64"),u="id-aes256-wrap-pad",d=Buffer.from("A65959A6","hex"),s=U.createCipheriv(u,f,d),i={encryptedIdentifier:Buffer.concat([s.update(c),s.final()]).toString("base64")};return E.sign(i,o,{algorithm:"HS384"})}var _iots = require('io-ts'); var e = _interopRequireWildcard(_iots); var r = _interopRequireWildcard(_iots);var B=e.intersection([e.type({userId:e.string,timestamp:e.string}),e.partial({confirmed:e.union([e.literal("true"),e.literal("false")]),updated:e.union([e.literal("true"),e.literal("false")]),prompted:e.union([e.literal("true"),e.literal("false")]),metadata:e.string,usp:e.union([e.string,e.null]),gpp:e.union([e.string,e.null])})]),Y= exports.b =e.intersection([B,e.partial({purposes:e.string})]),G= exports.c =e.intersection([B,e.type({partition:e.string}),e.partial({tcf:e.union([e.string,e.null]),purposes:e.record(e.string,e.union([e.boolean,e.string]))})]);var _colors = require('colors'); var _colors2 = _interopRequireDefault(_colors);var _bluebird = require('bluebird');var _cliprogress = require('cli-progress'); var _cliprogress2 = _interopRequireDefault(_cliprogress);var _typeutils = require('@transcend-io/type-utils');var I=/^[0-9][Y|N]([Y|N])[Y|N]$/,R= exports.e =r.record(r.string,r.union([r.boolean,r.literal("Auto")]));async function Z({base64EncryptionKey:c,base64SigningKey:l,preferences:n,partition:o,concurrency:f=100,transcendUrl:u=_chunk4DYEWT53cjs.s}){let d=_chunkCYGC567Ycjs.yc.call(void 0, u),s=n.filter(t=>t.usp&&!I.test(t.usp));if(s.length>0)throw new Error(`Received invalid usp strings: ${JSON.stringify(s,null,2)}`);let m=n.map((t,y)=>[t,y]).filter(([t])=>{if(!t.purposes)return!1;try{return _typeutils.decodeCodec.call(void 0, R,t.purposes),!1}catch (e2){return!0}});if(m.length>0)throw new Error(`Received invalid purpose maps: ${JSON.stringify(m,null,2)}`);let i=n.filter(t=>!t.usp&&!t.purposes);if(i.length>0)throw new Error(`Received invalid inputs, expected either purposes or usp to be defined: ${JSON.stringify(i,null,2)}`);_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Uploading ${n.length} user preferences to partition ${o}`));let w=new Date().getTime(),g=new _cliprogress2.default.SingleBar({},_cliprogress2.default.Presets.shades_classic),S=0;g.start(n.length,0),await _bluebird.map.call(void 0, n,async({userId:t,confirmed:y="true",updated:T,prompted:v,purposes:x,...p})=>{let j=$(t,c,l),[,k]=p.usp?I.exec(p.usp)||[]:[],D={token:j,partition:o,consent:{confirmed:y==="true",purposes:x?_typeutils.decodeCodec.call(void 0, R,x):p.usp?{SaleOfInfo:k==="Y"}:{},...T?{updated:T==="true"}:{},...v?{prompted:v==="true"}:{},...p}};try{await d.post("sync",{json:D}).json()}catch(h){try{let C=JSON.parse(_optionalChain([h, 'optionalAccess', _2 => _2.response, 'optionalAccess', _3 => _3.body])||"{}");C.error&&_chunkZUNVPK23cjs.a.error(_colors2.default.red(`Error: ${C.error}`))}catch (e3){}throw new Error(`Received an error from server: ${_optionalChain([h, 'optionalAccess', _4 => _4.response, 'optionalAccess', _5 => _5.body])||_optionalChain([h, 'optionalAccess', _6 => _6.message])}`)}S+=1,g.update(S)},{concurrency:f}),g.stop();let _=new Date().getTime()-w;_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Successfully uploaded ${n.length} user preferences to partition ${o} in "${_/1e3}" seconds!`))}exports.a = $; exports.b = Y; exports.c = G; exports.d = I; exports.e = R; exports.f = Z;
|
|
2
|
-
//# sourceMappingURL=chunk-4Y2OJ475.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/cli/cli/dist/chunk-4Y2OJ475.cjs","../src/lib/consent-manager/createConsentToken.ts","../src/lib/consent-manager/types.ts","../src/lib/consent-manager/uploadConsents.ts"],"names":["createConsentToken","userId","base64EncryptionKey","base64SigningKey","signingKey","encryptionKey","encryptionAlgorithm","iv","cipher","jwtPayload","ConsentPreferenceBase","ConsentPreferenceUpload","ConsentPreferenceFetch","USP_STRING_REGEX","PurposeMap","uploadConsents","preferences","partition","concurrency","trans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CAAA,KAAA,CAAM,CAAG,CAAA,CAAA,OAAA,CAAW,CAAA,CAAA,OAAA,CAAQ,MAAM,CAAC,CAAC,CACxC,CAAA,CAOA,MAAA,SAAsBC,CAAAA,CAAe,CACnC,mBAAA,CAAAb,CAAAA,CACA,gBAAA,CAAAC,CAAAA,CACA,WAAA,CAAAa,CAAAA,CACA,SAAA,CAAAC,CAAAA,CACA,WAAA,CAAAC,CAAAA,CAAc,GAAA,CACd,YAAA,CAAAC,CAAAA,CAAeC,mBACjB,CAAA,CAakB,CAEhB,IAAMC,CAAAA,CAAsBC,kCAAAA,CAA8C,CAAA,CAGpEC,CAAAA,CAAoBP,CAAAA,CAAY,MAAA,CACnCQ,CAAAA,EAASA,CAAAA,CAAK,GAAA,EAAO,CAACX,CAAAA,CAAiB,IAAA,CAAKW,CAAAA,CAAK,GAAG,CACvD,CAAA,CACA,EAAA,CAAID,CAAAA,CAAkB,MAAA,CAAS,CAAA,CAC7B,MAAM,IAAI,KAAA,CACR,CAAA,8BAAA,EAAiC,IAAA,CAAK,SAAA,CACpCA,CAAAA,CACA,IAAA,CACA,CACF,CAAC,CAAA,CAAA","file":"/home/runner/work/cli/cli/dist/chunk-4Y2OJ475.cjs","sourcesContent":[null,"import * as crypto from 'crypto';\nimport * as jwt from 'jsonwebtoken';\n\n/**\n * Function to create a consent manager token\n *\n * @see https://docs.transcend.io/docs/consent/reference/managed-consent-database\n * @param userId - User ID\n * @param base64EncryptionKey - Encryption key\n * @param base64SigningKey - Signing key\n * @returns Token\n */\nexport function createConsentToken(\n userId: string,\n base64EncryptionKey: string,\n base64SigningKey: string,\n): string {\n // Read on for where to find these keys\n const signingKey = Buffer.from(base64SigningKey, 'base64');\n const encryptionKey = Buffer.from(base64EncryptionKey, 'base64');\n\n // NIST's AES-KWP implementation { aes 48 } - see https://tools.ietf.org/html/rfc5649\n const encryptionAlgorithm = 'id-aes256-wrap-pad';\n // Initial Value for AES-KWP integrity check - see https://tools.ietf.org/html/rfc5649#section-3\n const iv = Buffer.from('A65959A6', 'hex');\n // Set up encryption algorithm\n const cipher = crypto.createCipheriv(encryptionAlgorithm, encryptionKey, iv);\n\n // Encrypt the userId and base64-encode the result\n const encryptedIdentifier = Buffer.concat([\n cipher.update(userId),\n cipher.final(),\n ]).toString('base64');\n\n // Create the JWT content - jwt.sign will add a 'iat' (issued at) field to the payload\n // If you wanted to add something manually, consider\n // const issued: Date = new Date();\n // const isoDate = issued.toISOString();\n const jwtPayload = {\n encryptedIdentifier,\n };\n\n // Create a JSON web token and HMAC it with SHA-384\n const consentToken = jwt.sign(jwtPayload, signingKey, {\n algorithm: 'HS384',\n });\n\n return consentToken;\n}\n","import * as t from 'io-ts';\n\nexport const ConsentPreferenceBase = 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]);\n\n/** Type override */\nexport type ConsentPreferenceBase = t.TypeOf<typeof ConsentPreferenceUpload>;\n\nexport const ConsentPreferenceUpload = t.intersection([\n ConsentPreferenceBase,\n t.partial({\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\nexport const ConsentPreferenceFetch = t.intersection([\n ConsentPreferenceBase,\n t.type({\n /** This is the partition key used for the dynamo entry */\n partition: t.string,\n }),\n t.partial({\n /** IAB TCF String */\n tcf: t.union([t.string, t.null]),\n /**\n * Purpose map\n * This is a JSON object with keys as purpose names and values as booleans or 'Auto'\n */\n purposes: t.record(t.string, t.union([t.boolean, t.string])),\n }),\n]);\n\n/** Type override */\nexport type ConsentPreferenceFetch = t.TypeOf<typeof ConsentPreferenceFetch>;\n","import { createTranscendConsentGotInstance } from '../graphql';\nimport colors from 'colors';\nimport * as t from 'io-ts';\nimport { DEFAULT_TRANSCEND_CONSENT_API } from '../../constants';\nimport { map } from 'bluebird';\nimport { createConsentToken } from './createConsentToken';\nimport { logger } from '../../logger';\nimport cliProgress from 'cli-progress';\nimport { decodeCodec } from '@transcend-io/type-utils';\nimport type { ConsentPreferenceUpload } from './types';\nimport { ConsentPreferencesBody } from '@transcend-io/airgap.js-types';\n\nexport const USP_STRING_REGEX = /^[0-9][Y|N]([Y|N])[Y|N]$/;\n\nexport const PurposeMap = t.record(\n t.string,\n t.union([t.boolean, t.literal('Auto')]),\n);\n\n/**\n * Upload a set of consent preferences\n *\n * @param options - Options\n */\nexport async function uploadConsents({\n base64EncryptionKey,\n base64SigningKey,\n preferences,\n partition,\n concurrency = 100,\n transcendUrl = DEFAULT_TRANSCEND_CONSENT_API,\n}: {\n /** base64 encryption key */\n base64EncryptionKey: string;\n /** base64 signing key */\n base64SigningKey: string;\n /** Partition key */\n partition: string;\n /** Sombra API key authentication */\n preferences: ConsentPreferenceUpload[];\n /** API URL for Transcend backend */\n transcendUrl?: string;\n /** Concurrency limit for approving */\n concurrency?: number;\n}): Promise<void> {\n // Create connection to API\n const transcendConsentApi = createTranscendConsentGotInstance(transcendUrl);\n\n // Ensure usp strings are valid\n const invalidUspStrings = preferences.filter(\n (pref) => pref.usp && !USP_STRING_REGEX.test(pref.usp),\n );\n if (invalidUspStrings.length > 0) {\n throw new Error(\n `Received invalid usp strings: ${JSON.stringify(\n invalidUspStrings,\n null,\n 2,\n )}`,\n );\n }\n\n // Ensure purpose maps are valid\n const invalidPurposeMaps = preferences\n .map((pref, ind) => [pref, ind] as [ConsentPreferenceUpload, number])\n .filter(([pref]) => {\n if (!pref.purposes) {\n return false;\n }\n try {\n decodeCodec(PurposeMap, pref.purposes);\n return false;\n } catch {\n return true;\n }\n });\n if (invalidPurposeMaps.length > 0) {\n throw new Error(\n `Received invalid purpose maps: ${JSON.stringify(\n invalidPurposeMaps,\n null,\n 2,\n )}`,\n );\n }\n\n // Ensure usp or preferences are provided\n const invalidInputs = preferences.filter(\n (pref) => !pref.usp && !pref.purposes,\n );\n if (invalidInputs.length > 0) {\n throw new Error(\n `Received invalid inputs, expected either purposes or usp to be defined: ${JSON.stringify(\n invalidInputs,\n null,\n 2,\n )}`,\n );\n }\n\n logger.info(\n colors.magenta(\n `Uploading ${preferences.length} user preferences to partition ${partition}`,\n ),\n );\n\n // Time duration\n const t0 = new Date().getTime();\n // create a new progress bar instance and use shades_classic theme\n const progressBar = new cliProgress.SingleBar(\n {},\n cliProgress.Presets.shades_classic,\n );\n\n // Build a GraphQL client\n let total = 0;\n progressBar.start(preferences.length, 0);\n await map(\n preferences,\n async ({\n userId,\n confirmed = 'true',\n updated,\n prompted,\n purposes,\n ...consent\n }) => {\n const token = createConsentToken(\n userId,\n base64EncryptionKey,\n base64SigningKey,\n );\n\n // parse usp string\n const [, saleStatus] = consent.usp\n ? USP_STRING_REGEX.exec(consent.usp) || []\n : [];\n\n const input = {\n token,\n partition,\n consent: {\n confirmed: confirmed === 'true',\n purposes: purposes\n ? decodeCodec(PurposeMap, purposes)\n : consent.usp\n ? { SaleOfInfo: saleStatus === 'Y' }\n : {},\n ...(updated ? { updated: updated === 'true' } : {}),\n ...(prompted ? { prompted: prompted === 'true' } : {}),\n ...consent,\n },\n } as ConsentPreferencesBody;\n\n // Make the request\n try {\n await transcendConsentApi\n .post('sync', {\n json: input,\n })\n .json();\n } catch (err) {\n try {\n const parsed = JSON.parse(err?.response?.body || '{}');\n if (parsed.error) {\n logger.error(colors.red(`Error: ${parsed.error}`));\n }\n } catch (e) {\n // continue\n }\n throw new Error(\n `Received an error from server: ${\n err?.response?.body || err?.message\n }`,\n );\n }\n\n total += 1;\n progressBar.update(total);\n },\n { concurrency },\n );\n\n progressBar.stop();\n const t1 = new Date().getTime();\n const totalTime = t1 - t0;\n\n logger.info(\n colors.green(\n `Successfully uploaded ${\n preferences.length\n } user preferences to partition ${partition} in \"${\n totalTime / 1000\n }\" seconds!`,\n ),\n );\n}\n"]}
|
package/dist/chunk-OKWH7Y2Z.cjs
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunk4Y2OJ475cjs = require('./chunk-4Y2OJ475.cjs');var _chunk5UBGZNDCcjs = require('./chunk-5UBGZNDC.cjs');var _chunkCYGC567Ycjs = require('./chunk-CYGC567Y.cjs');var _chunkZUNVPK23cjs = require('./chunk-ZUNVPK23.cjs');var _chunk4DYEWT53cjs = require('./chunk-4DYEWT53.cjs');var _privacytypes = require('@transcend-io/privacy-types');var _bluebird = require('bluebird');var _colors = require('colors'); var _colors2 = _interopRequireDefault(_colors);async function at({auth:e,deploy:i=!1,transcendUrl:o=_chunk4DYEWT53cjs.r,bundleTypes:t=Object.values(_privacytypes.ConsentBundleType)}){let r=_chunkCYGC567Ycjs.wc.call(void 0, o,e),n=await _chunkCYGC567Ycjs.Qc.call(void 0, r);await _bluebird.mapSeries.call(void 0, t,async a=>{_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Update Consent Manager bundle with ID "${n}" and type "${a}" to latest version...`)),await _chunkCYGC567Ycjs.Ac.call(void 0, r,{id:n,bundleType:a}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Updated Consent Manager bundle with ID "${n}" and type "${a}" to latest version!`))}),i&&await _bluebird.mapSeries.call(void 0, t,async a=>{_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Deploying Consent Manager bundle with ID "${n}" and type "${a}"...`)),await _chunkCYGC567Ycjs.zc.call(void 0, r,{id:n,bundleType:a}),_chunkZUNVPK23cjs.a.info(_colors2.default.green(`Deployed Consent Manager bundle with ID "${n}" and type "${a}"!`))})}var K=["ID","Activity","Encounters","Last Seen At","Has Native Do Not Sell/Share Support","IAB USP API Support","Service Description","Website URL","Categories of Recipients"];async function Ct({auth:e,trackerStatus:i,file:o,classifyService:t=!1,transcendUrl:r=_chunk4DYEWT53cjs.r}){let n=_chunkCYGC567Ycjs.wc.call(void 0, r,e);_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Reading "${o}" from disk`));let l=_chunkCYGC567Ycjs.rc.call(void 0, o,_chunk5UBGZNDCcjs.ia).map(({Type:d,Notes:m,Service:f,Purpose:E,Status:g,Owners:I,Teams:T,"Connections Made To":v,...y})=>({value:v,type:d,description:m,trackingPurposes:_chunkCYGC567Ycjs.oc.call(void 0, E),status:g||i,owners:I?_chunkCYGC567Ycjs.oc.call(void 0, I):void 0,teams:T?_chunkCYGC567Ycjs.oc.call(void 0, T):void 0,attributes:Object.entries(y).filter(([h])=>!K.includes(h)).map(([h,B])=>({key:h,values:_chunkCYGC567Ycjs.oc.call(void 0, B)}))}));await _chunkCYGC567Ycjs.We.call(void 0, n,l,t)||(_chunkZUNVPK23cjs.a.error(_colors2.default.red("Encountered error(s) syncing data flows from CSV, see logs above for more info. ")),process.exit(1))}var j=["ID","Activity","Encounters","Last Seen At","Has Native Do Not Sell/Share Support","IAB USP API Support","Service Description","Website URL","Categories of Recipients"];async function vt({auth:e,trackerStatus:i,file:o,transcendUrl:t=_chunk4DYEWT53cjs.r}){let r=_chunkCYGC567Ycjs.wc.call(void 0, t,e);_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Reading "${o}" from disk`));let a=_chunkCYGC567Ycjs.rc.call(void 0, o,_chunk5UBGZNDCcjs.ja).map(({"Is Regex?":s,Notes:d,Service:m,Purpose:f,Status:E,Owners:g,Teams:I,Name:T,...v})=>({...typeof s=="string"?{isRegex:s.toLowerCase()==="true"}:{},name:T,description:d,trackingPurposes:_chunkCYGC567Ycjs.oc.call(void 0, f),status:E||i,owners:g?_chunkCYGC567Ycjs.oc.call(void 0, g):void 0,teams:I?_chunkCYGC567Ycjs.oc.call(void 0, I):void 0,attributes:Object.entries(v).filter(([y])=>!j.includes(y)).map(([y,h])=>({key:y,values:_chunkCYGC567Ycjs.oc.call(void 0, h)}))}));await _chunkCYGC567Ycjs.Qe.call(void 0, r,a)||(_chunkZUNVPK23cjs.a.error(_colors2.default.red("Encountered error(s) syncing cookies from CSV, see logs above for more info. ")),process.exit(1))}var Y=1e3,Q=60*Y,V=60*Q,X=24*V,z=7*X;async function Lt(e,{bin:i,start:o,end:t=new Date}){let r=await _chunkCYGC567Ycjs.Qc.call(void 0, e),n=Math.floor(o.getTime()/1e3),a=Math.floor(t.getTime()/1e3);if(n>a)throw new Error('Received "end" date that happened before "start" date');if(i==="1h"&&t.getTime()-o.getTime()>z*2)throw new Error("When using bin=1h, start and end time can be no more than 2 weeks apart");let l=o.toISOString(),s=t.toISOString(),[d,m,f]=await Promise.all([_chunkCYGC567Ycjs.Tc.call(void 0, e,{dataSource:"PRIVACY_SIGNAL_TIMESERIES",startDate:l,endDate:s,forceRefetch:!0,airgapBundleId:r,binInterval:i,smoothTimeseries:!1}),_chunkCYGC567Ycjs.Tc.call(void 0, e,{dataSource:"CONSENT_CHANGES_TIMESERIES",startDate:l,endDate:s,forceRefetch:!0,airgapBundleId:r,binInterval:i,smoothTimeseries:!1}),_chunkCYGC567Ycjs.Tc.call(void 0, e,{dataSource:"CONSENT_SESSIONS_BY_REGIME",startDate:l,endDate:s,forceRefetch:!0,airgapBundleId:r,binInterval:i,smoothTimeseries:!1})]);return{PRIVACY_SIGNAL_TIMESERIES:d,CONSENT_CHANGES_TIMESERIES:m,CONSENT_SESSIONS_BY_REGIME:f}}var $=e=>new URL(`https://${e}`).hostname.split(".").slice(-2).join(".");var J=/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/;async function Ht(e,{xdiLocation:i,transcendUrl:o=_chunk4DYEWT53cjs.r,removeIpAddresses:t=!0,domainBlockList:r=["localhost"],xdiAllowedCommands:n="ConsentManager:Sync"}){let a=Array.isArray(e)?e:[{apiKey:e,organizationId:"",organizationName:""}],l=await _bluebird.map.call(void 0, a,async m=>{_chunkZUNVPK23cjs.a.info(_colors2.default.magenta(`Pulling consent metadata for organization - ${m.organizationName}`));let f=_chunkCYGC567Ycjs.wc.call(void 0, o,m.apiKey);return await _chunkCYGC567Ycjs.Pc.call(void 0, f)},{concurrency:5}),s={};return l.forEach(m=>{let f=_optionalChain([m, 'access', _2 => _2.partition, 'optionalAccess', _3 => _3.partition])||m.bundleURL.split("/").reverse()[1];s[f]||(s[f]=[]);let E=_chunk4DYEWT53cjs.c.call(void 0, m.configuration.domains.filter(g=>!t||!J.test(g)).map(g=>$(g)),r);s[f]=[...new Set([...s[f]||[],...E])]}),{html:`
|
|
2
|
-
<!DOCTYPE html>
|
|
3
|
-
<script
|
|
4
|
-
src="${i}"
|
|
5
|
-
data-sync-groups='${JSON.stringify(s,null,2)}'
|
|
6
|
-
data-xdi-commands="${n}"
|
|
7
|
-
></script>
|
|
8
|
-
`,syncGroups:s}}function Yt(e){let i=e.map(({name:o,input:t})=>({title:o.replace(".yml",""),attributes:[..._optionalChain([t, 'optionalAccess', _4 => _4.domains])?[{key:"Transcend Domain List",values:[...new Set(t.domains)]}]:[],..._optionalChain([t, 'optionalAccess', _5 => _5.bundleUrls])?[{key:"Airgap Production URL",values:[t.bundleUrls.PRODUCTION]},{key:"Airgap Test URL",values:[t.bundleUrls.TEST]},{key:"Airgap XDI URL",values:[t.bundleUrls.PRODUCTION.replace("airgap.js","xdi.js")]}]:[],..._optionalChain([t, 'optionalAccess', _6 => _6.partition])?[{key:"Consent Partition Key",values:[t.partition]}]:[]]}));return _chunkZUNVPK23cjs.a.info(`
|
|
9
|
-
|
|
10
|
-
~~~~~~~~~~~
|
|
11
|
-
Airgap scripts to host:`),i.forEach(({attributes:o,title:t},r)=>{_optionalChain([o, 'optionalAccess', _7 => _7.find, 'call', _8 => _8(n=>n.key==="Airgap Production URL"), 'optionalAccess', _9 => _9.values, 'optionalAccess', _10 => _10.forEach, 'call', _11 => _11(n=>{_chunkZUNVPK23cjs.a.info(`${r}) ${t} - ${n}`)})])}),i}var _iots = require('io-ts'); var p = _interopRequireWildcard(_iots);var _typeutils = require('@transcend-io/type-utils');var tt=p.intersection([p.type({nodes:p.array(_chunk4Y2OJ475cjs.c)}),p.partial({lastKey:p.partial({userId:p.string,partition:p.string,timestamp:p.string})})]);async function zt(e,{partition:i,filterBy:o={},limit:t=50}){let r,n=[],a=!0;for(;a;){let l=await e.post("v1/consent-preferences",{json:{partition:i,...o,startKey:r||void 0,limit:t}}).json(),{nodes:s,lastKey:d}=_typeutils.decodeCodec.call(void 0, tt,l);if(!s||s.length===0)break;n.push(...s),r=d,a=!!d&&Object.keys(d).length>0}return n}exports.a = at; exports.b = Ct; exports.c = vt; exports.d = Lt; exports.e = $; exports.f = J; exports.g = Ht; exports.h = Yt; exports.i = tt; exports.j = zt;
|
|
12
|
-
//# sourceMappingURL=chunk-OKWH7Y2Z.cjs.map
|