Files
klz-cables.com/.pnpm-store/v10/files/d2/ff637106c6d5661581e7b8af53414c28bf2375fd823e6b77de06a0a1b4bd8ebde192bb128b23cd7674ab287fdafaac5e0b51af4330e158dd5bbb2294f64ae7
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

1 line
3.1 KiB
Plaintext

{"version":3,"file":"files.js","names":[],"sources":["../../../../src/rest/commands/update/files.ts"],"sourcesContent":["import type { DirectusFile } from '../../../schema/file.js';\nimport type { ApplyQueryFields, NestedPartial, Query } from '../../../types/index.js';\nimport type { RestCommand } from '../../types.js';\nimport { throwIfEmpty } from '../../utils/index.js';\n\nexport type UpdateFileOutput<\n\tSchema,\n\tTQuery extends Query<Schema, Item>,\n\tItem extends object = DirectusFile<Schema>,\n> = ApplyQueryFields<Schema, Item, TQuery['fields']>;\n\n/**\n * Update multiple files at the same time.\n * @param keys\n * @param item\n * @param query\n * @returns Returns the file objects for the updated files.\n * @throws Will throw if keys is empty\n */\nexport const updateFiles =\n\t<Schema, const TQuery extends Query<Schema, DirectusFile<Schema>>>(\n\t\tkeys: DirectusFile<Schema>['id'][],\n\t\titem: NestedPartial<DirectusFile<Schema>>,\n\t\tquery?: TQuery,\n\t): RestCommand<UpdateFileOutput<Schema, TQuery>[], Schema> =>\n\t() => {\n\t\tthrowIfEmpty(keys, 'Keys cannot be empty');\n\n\t\treturn {\n\t\t\tpath: `/files`,\n\t\t\tparams: query ?? {},\n\t\t\tbody: JSON.stringify({ keys, data: item }),\n\t\t\tmethod: 'PATCH',\n\t\t};\n\t};\n\n/**\n * Update multiple files as batch.\n * @param items\n * @param query\n * @returns Returns the file objects for the updated files.\n */\nexport const updateFilesBatch =\n\t<Schema, const TQuery extends Query<Schema, DirectusFile<Schema>>>(\n\t\titems: NestedPartial<DirectusFile<Schema>>[],\n\t\tquery?: TQuery,\n\t): RestCommand<UpdateFileOutput<Schema, TQuery>[], Schema> =>\n\t() => ({\n\t\tpath: `/files`,\n\t\tparams: query ?? {},\n\t\tbody: JSON.stringify(items),\n\t\tmethod: 'PATCH',\n\t});\n\n/**\n * Update an existing file, and/or replace it's file contents.\n * @param key\n * @param item\n * @param query\n * @returns Returns the file object for the updated file.\n * @throws Will throw if key is empty\n */\nexport const updateFile =\n\t<Schema, const TQuery extends Query<Schema, DirectusFile<Schema>>>(\n\t\tkey: DirectusFile<Schema>['id'],\n\t\titem: NestedPartial<DirectusFile<Schema>> | FormData,\n\t\tquery?: TQuery,\n\t): RestCommand<UpdateFileOutput<Schema, TQuery>, Schema> =>\n\t() => {\n\t\tthrowIfEmpty(key, 'Key cannot be empty');\n\n\t\tif (item instanceof FormData) {\n\t\t\treturn {\n\t\t\t\tpath: `/files/${key}`,\n\t\t\t\tparams: query ?? {},\n\t\t\t\tbody: item,\n\t\t\t\tmethod: 'PATCH',\n\t\t\t\theaders: { 'Content-Type': 'multipart/form-data' },\n\t\t\t};\n\t\t}\n\n\t\treturn {\n\t\t\tpath: `/files/${key}`,\n\t\t\tparams: query ?? {},\n\t\t\tbody: JSON.stringify(item),\n\t\t\tmethod: 'PATCH',\n\t\t};\n\t};\n"],"mappings":"6DAmBA,MAAa,GAEX,EACA,EACA,SAGA,EAAa,EAAM,uBAAuB,CAEnC,CACN,KAAM,SACN,OAAQ,GAAS,EAAE,CACnB,KAAM,KAAK,UAAU,CAAE,OAAM,KAAM,EAAM,CAAC,CAC1C,OAAQ,QACR,EASU,GAEX,EACA,SAEM,CACN,KAAM,SACN,OAAQ,GAAS,EAAE,CACnB,KAAM,KAAK,UAAU,EAAM,CAC3B,OAAQ,QACR,EAUW,GAEX,EACA,EACA,SAGA,EAAa,EAAK,sBAAsB,CAEpC,aAAgB,SACZ,CACN,KAAM,UAAU,IAChB,OAAQ,GAAS,EAAE,CACnB,KAAM,EACN,OAAQ,QACR,QAAS,CAAE,eAAgB,sBAAuB,CAClD,CAGK,CACN,KAAM,UAAU,IAChB,OAAQ,GAAS,EAAE,CACnB,KAAM,KAAK,UAAU,EAAK,CAC1B,OAAQ,QACR"}