{"version":3,"file":"operations.cjs","names":[],"sources":["../../../../src/rest/commands/create/operations.ts"],"sourcesContent":["import type { DirectusOperation } from '../../../schema/operation.js';\nimport type { ApplyQueryFields, NestedPartial, Query } from '../../../types/index.js';\nimport type { RestCommand } from '../../types.js';\n\nexport type CreateOperationOutput<\n\tSchema,\n\tTQuery extends Query<Schema, Item>,\n\tItem extends object = DirectusOperation<Schema>,\n> = ApplyQueryFields<Schema, Item, TQuery['fields']>;\n\n/**\n * Create multiple new operations.\n *\n * @param items The operation to create\n * @param query Optional return data query\n *\n * @returns Returns the operation object for the created operation.\n */\nexport const createOperations =\n\t<Schema, const TQuery extends Query<Schema, DirectusOperation<Schema>>>(\n\t\titems: NestedPartial<DirectusOperation<Schema>>[],\n\t\tquery?: TQuery,\n\t): RestCommand<CreateOperationOutput<Schema, TQuery>[], Schema> =>\n\t() => ({\n\t\tpath: `/operations`,\n\t\tparams: query ?? {},\n\t\tbody: JSON.stringify(items),\n\t\tmethod: 'POST',\n\t});\n\n/**\n * Create a new operation.\n *\n * @param item The operation to create\n * @param query Optional return data query\n *\n * @returns Returns the operation object for the created operation.\n */\nexport const createOperation =\n\t<Schema, const TQuery extends Query<Schema, DirectusOperation<Schema>>>(\n\t\titem: NestedPartial<DirectusOperation<Schema>>,\n\t\tquery?: TQuery,\n\t): RestCommand<CreateOperationOutput<Schema, TQuery>, Schema> =>\n\t() => ({\n\t\tpath: `/operations`,\n\t\tparams: query ?? {},\n\t\tbody: JSON.stringify(item),\n\t\tmethod: 'POST',\n\t});\n"],"mappings":"AAkBA,MAAa,GAEX,EACA,SAEM,CACN,KAAM,cACN,OAAQ,GAAS,EAAE,CACnB,KAAM,KAAK,UAAU,EAAM,CAC3B,OAAQ,OACR,EAUW,GAEX,EACA,SAEM,CACN,KAAM,cACN,OAAQ,GAAS,EAAE,CACnB,KAAM,KAAK,UAAU,EAAK,CAC1B,OAAQ,OACR"}