{"version":3,"file":"sort.cjs","names":[],"sources":["../../../../src/rest/commands/utils/sort.ts"],"sourcesContent":["import type { RestCommand } from '../../types.js';\nimport { throwIfEmpty } from '../../utils/index.js';\n\n/**\n * If a collection has a sort field, this util can be used to move items in that manual order.\n * @param collection The collection to sort\n * @param item Id of the item to move\n * @param to Id of the item to move to\n * @returns Nothing\n * @throws Will throw if collection is empty\n */\nexport const utilitySort =\n\t<Schema>(collection: keyof Schema, item: string | number, to: string | number): RestCommand<void, Schema> =>\n\t() => {\n\t\tthrowIfEmpty(collection as string, 'Collection cannot be empty');\n\n\t\treturn {\n\t\t\tmethod: 'POST',\n\t\t\tpath: `/utils/sort/${collection as string}`,\n\t\t\tbody: JSON.stringify({ item, to }),\n\t\t};\n\t};\n"],"mappings":"kDAWa,GACH,EAA0B,EAAuB,SAEzD,EAAA,aAAa,EAAsB,6BAA6B,CAEzD,CACN,OAAQ,OACR,KAAM,eAAe,IACrB,KAAM,KAAK,UAAU,CAAE,OAAM,KAAI,CAAC,CAClC"}