{"version":3,"file":"with-token.cjs","names":[],"sources":["../../../src/rest/helpers/with-token.ts"],"sourcesContent":["import type { RestCommand } from '../types.js';\n\nexport function withToken<Schema, Output>(\n\ttoken: string,\n\tgetOptions: RestCommand<Output, Schema>,\n): RestCommand<Output, Schema> {\n\treturn () => {\n\t\tconst options = getOptions();\n\n\t\tif (token) {\n\t\t\tif (!options.headers) options.headers = {};\n\t\t\toptions.headers['Authorization'] = `Bearer ${token}`;\n\t\t}\n\n\t\treturn options;\n\t};\n}\n"],"mappings":"AAEA,SAAgB,EACf,EACA,EAC8B,CAC9B,UAAa,CACZ,IAAM,EAAU,GAAY,CAO5B,OALI,IACH,AAAsB,EAAQ,UAAU,EAAE,CAC1C,EAAQ,QAAQ,cAAmB,UAAU,KAGvC"}