{"version":3,"file":"notifications.cjs","names":[],"sources":["../../../../src/rest/commands/read/notifications.ts"],"sourcesContent":["import type { DirectusNotification } from '../../../schema/notification.js';\nimport type { ApplyQueryFields, Query } from '../../../types/index.js';\nimport type { RestCommand } from '../../types.js';\nimport { throwIfEmpty } from '../../utils/index.js';\n\nexport type ReadNotificationOutput<\n\tSchema,\n\tTQuery extends Query<Schema, Item>,\n\tItem extends object = DirectusNotification<Schema>,\n> = ApplyQueryFields<Schema, Item, TQuery['fields']>;\n\n/**\n * List all notifications that exist in Directus.\n * @param query The query parameters\n * @returns An array of up to limit notification objects. If no items are available, data will be an empty array.\n */\nexport const readNotifications =\n\t<Schema, const TQuery extends Query<Schema, DirectusNotification<Schema>>>(\n\t\tquery?: TQuery,\n\t): RestCommand<ReadNotificationOutput<Schema, TQuery>[], Schema> =>\n\t() => ({\n\t\tpath: `/notifications`,\n\t\tparams: query ?? {},\n\t\tmethod: 'GET',\n\t});\n\n/**\n * List an existing notification by primary key.\n * @param key The primary key of the dashboard\n * @param query The query parameters\n * @returns Returns the requested notification object.\n * @throws Will throw if key is empty\n */\nexport const readNotification =\n\t<Schema, const TQuery extends Query<Schema, DirectusNotification<Schema>>>(\n\t\tkey: DirectusNotification<Schema>['id'],\n\t\tquery?: TQuery,\n\t): RestCommand<ReadNotificationOutput<Schema, TQuery>, Schema> =>\n\t() => {\n\t\tthrowIfEmpty(String(key), 'Key cannot be empty');\n\n\t\treturn {\n\t\t\tpath: `/notifications/${key}`,\n\t\t\tparams: query ?? {},\n\t\t\tmethod: 'GET',\n\t\t};\n\t};\n"],"mappings":"kDAgBa,EAEX,QAEM,CACN,KAAM,iBACN,OAAQ,GAAS,EAAE,CACnB,OAAQ,MACR,EASW,GAEX,EACA,SAGA,EAAA,aAAa,OAAO,EAAI,CAAE,sBAAsB,CAEzC,CACN,KAAM,kBAAkB,IACxB,OAAQ,GAAS,EAAE,CACnB,OAAQ,MACR"}