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