{"version":3,"file":"collections.cjs","names":[],"sources":["../../../../src/rest/commands/create/collections.ts"],"sourcesContent":["import type { DirectusCollection } from '../../../schema/collection.js';\nimport type { ApplyQueryFields, FieldQuery, NestedPartial, Query } from '../../../types/index.js';\nimport type { RestCommand } from '../../types.js';\n\nexport type CreateCollectionOutput<\n\tSchema,\n\tTQuery extends Query<Schema, Item>,\n\tItem extends object = DirectusCollection<Schema>,\n> = ApplyQueryFields<Schema, Item, TQuery['fields']>;\n\n/**\n * Create a new Collection. This will create a new table in the database as well.\n *\n * @param item This endpoint doesn't currently support any query parameters.\n * @param query Optional return data query\n *\n * @returns The collection object for the collection created in this request.\n */\nexport const createCollection =\n\t<Schema, const TQuery extends FieldQuery<Schema, DirectusCollection<Schema>>>(\n\t\titem: NestedPartial<DirectusCollection<Schema>>,\n\t\tquery?: TQuery,\n\t): RestCommand<CreateCollectionOutput<Schema, TQuery>, Schema> =>\n\t() => ({\n\t\tpath: `/collections`,\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,eACN,OAAQ,GAAS,EAAE,CACnB,KAAM,KAAK,UAAU,EAAK,CAC1B,OAAQ,OACR"}