{"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 * Reinstall an extension from the registry.\n * @param extensionId - Registry extension ID\n * @returns Nothing\n * @throws Will throw if extensionId is empty\n */\nexport const reinstallRegistryExtension =\n\t<Schema>(extensionId: string): RestCommand<void, Schema> =>\n\t() => {\n\t\tthrowIfEmpty(extensionId, 'Extension id cannot be empty');\n\n\t\treturn {\n\t\t\tpath: `/extensions/registry/reinstall`,\n\t\t\tbody: JSON.stringify({ extension: extensionId }),\n\t\t\tmethod: 'POST',\n\t\t};\n\t};\n\n/**\n * Update an existing extension.\n * @param id - UUID 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\tid: DirectusExtension<Schema>['id'],\n\t\tdata: NestedPartial<DirectusExtension<Schema>>,\n\t): RestCommand<DirectusExtension<Schema>, Schema> =>\n\t() => {\n\t\tthrowIfEmpty(id, 'Id cannot be empty');\n\n\t\treturn {\n\t\t\tpath: `/extensions/${id}`,\n\t\t\tparams: {},\n\t\t\tbody: JSON.stringify(data),\n\t\t\tmethod: 'PATCH',\n\t\t};\n\t};\n"],"mappings":"kDAWa,EACH,QAER,EAAA,aAAa,EAAa,+BAA+B,CAElD,CACN,KAAM,iCACN,KAAM,KAAK,UAAU,CAAE,UAAW,EAAa,CAAC,CAChD,OAAQ,OACR,EASU,GAEX,EACA,SAGA,EAAA,aAAa,EAAI,qBAAqB,CAE/B,CACN,KAAM,eAAe,IACrB,OAAQ,EAAE,CACV,KAAM,KAAK,UAAU,EAAK,CAC1B,OAAQ,QACR"}