{"version":3,"file":"extensions.cjs","names":[],"sources":["../../../../src/rest/commands/update/extensions.ts"],"sourcesContent":["import type { DirectusExtension } from '../../../schema/extension.js';\nimport type { NestedPartial } from '../../../types/index.js';\nimport type { RestCommand } from '../../types.js';\nimport { throwIfEmpty } from '../../utils/index.js';\n\n/**\n * Update an existing extension.\n * @param bundle - Bundle this extension is in\n * @param name - Unique name of the extension\n * @param data - Partial extension object\n * @returns Returns the extension that was updated\n */\nexport const updateExtension =\n\t<Schema>(\n\t\tbundle: string | null,\n\t\tname: string,\n\t\tdata: NestedPartial<DirectusExtension<Schema>>,\n\t): RestCommand<DirectusExtension<Schema>, Schema> =>\n\t() => {\n\t\tif (bundle !== null) throwIfEmpty(bundle, 'Bundle cannot be an empty string');\n\t\tthrowIfEmpty(name, 'Name cannot be empty');\n\n\t\treturn {\n\t\t\tpath: bundle ? `/extensions/${bundle}/${name}` : `/extensions/${name}`,\n\t\t\tparams: {},\n\t\t\tbody: JSON.stringify(data),\n\t\t\tmethod: 'PATCH',\n\t\t};\n\t};\n"],"mappings":"kDAYa,GAEX,EACA,EACA,SAGI,IAAW,MAAM,EAAA,aAAa,EAAQ,mCAAmC,CAC7E,EAAA,aAAa,EAAM,uBAAuB,CAEnC,CACN,KAAM,EAAS,eAAe,EAAO,GAAG,IAAS,eAAe,IAChE,OAAQ,EAAE,CACV,KAAM,KAAK,UAAU,EAAK,CAC1B,OAAQ,QACR"}