@maas/payload-plugin-media-cloud 0.0.41 → 0.0.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,9 @@
1
1
  import { MediaCloudErrors } from "../types/errors.mjs";
2
2
  import { useErrorHandler } from "../hooks/useErrorHandler.mjs";
3
- import { buildThumbnailURL } from "../utils/buildThumbnailURL.mjs";
4
3
  import { s3Store } from "../plugin.mjs";
5
4
 
6
5
  //#region src/collectionHooks/afterChange.ts
7
- const afterChangeHook = async ({ collection, doc, previousDoc, req }) => {
6
+ const afterChangeHook = async ({ doc, previousDoc, req }) => {
8
7
  const { throwError } = useErrorHandler();
9
8
  if (req.context?._mediaCloudPluginInternal) return doc;
10
9
  if (doc.path !== previousDoc?.path) {
@@ -19,29 +18,6 @@ const afterChangeHook = async ({ collection, doc, previousDoc, req }) => {
19
18
  });
20
19
  }
21
20
  }
22
- if (!doc.thumbnail || previousDoc?.path !== doc.path) try {
23
- const thumbnail = buildThumbnailURL({
24
- storage: doc.storage,
25
- playbackId: doc.storage === "mux" ? doc.mux.playbackId : void 0,
26
- s3Key: doc.storage === "s3" ? doc.path ?? doc.filename : void 0,
27
- s3Store
28
- });
29
- req.context = { ...req.context };
30
- req.context._mediaCloudPluginInternal = true;
31
- const update = await req.payload.update({
32
- collection: collection.slug,
33
- id: doc.id,
34
- data: { thumbnail },
35
- req
36
- });
37
- delete req.context._mediaCloudPluginInternal;
38
- return update;
39
- } catch (error) {
40
- throwError({
41
- ...MediaCloudErrors.THUMBNAIL_GENERATION_ERROR,
42
- cause: error
43
- });
44
- }
45
21
  return doc;
46
22
  };
47
23
 
@@ -1 +1 @@
1
- {"version":3,"file":"afterChange.mjs","names":["afterChangeHook: CollectionAfterChangeHook"],"sources":["../../src/collectionHooks/afterChange.ts"],"sourcesContent":["import { buildThumbnailURL } from '../utils/buildThumbnailURL'\nimport { s3Store } from '../plugin'\nimport { MediaCloudErrors } from '../types/errors'\nimport { useErrorHandler } from '../hooks/useErrorHandler'\n\nimport type { CollectionAfterChangeHook } from 'payload'\n\nexport const afterChangeHook: CollectionAfterChangeHook = async ({\n collection,\n doc,\n previousDoc,\n req,\n}) => {\n const { throwError } = useErrorHandler()\n\n // Skip if this is an internal update to prevent infinite loop\n if (req.context?._mediaCloudPluginInternal) {\n return doc\n }\n\n // Move asset in S3 if path has changed\n if (doc.path !== previousDoc?.path) {\n if (doc.storage === 's3' && s3Store) {\n try {\n const oldKey = previousDoc?.path ?? previousDoc?.filename\n const newKey = doc.path\n\n await s3Store.copy(oldKey, newKey)\n } catch (error) {\n throwError({ ...MediaCloudErrors.S3_MOVE_ERROR, cause: error })\n }\n }\n }\n\n // Handle thumbnail\n if (!doc.thumbnail || previousDoc?.path !== doc.path) {\n try {\n const thumbnail = buildThumbnailURL({\n storage: doc.storage,\n playbackId: doc.storage === 'mux' ? doc.mux.playbackId : undefined,\n s3Key: doc.storage === 's3' ? (doc.path ?? doc.filename) : undefined,\n s3Store,\n })\n\n req.context = { ...req.context }\n req.context._mediaCloudPluginInternal = true\n\n const update = await req.payload.update({\n collection: collection.slug,\n id: doc.id,\n data: { thumbnail },\n req,\n })\n\n delete req.context._mediaCloudPluginInternal\n\n return update\n } catch (error) {\n throwError({\n ...MediaCloudErrors.THUMBNAIL_GENERATION_ERROR,\n cause: error,\n })\n }\n }\n\n return doc\n}\n"],"mappings":";;;;;;AAOA,MAAaA,kBAA6C,OAAO,EAC/D,YACA,KACA,aACA,UACI;CACJ,MAAM,EAAE,eAAe,iBAAiB;AAGxC,KAAI,IAAI,SAAS,0BACf,QAAO;AAIT,KAAI,IAAI,SAAS,aAAa,MAC5B;MAAI,IAAI,YAAY,QAAQ,QAC1B,KAAI;GACF,MAAM,SAAS,aAAa,QAAQ,aAAa;GACjD,MAAM,SAAS,IAAI;AAEnB,SAAM,QAAQ,KAAK,QAAQ,OAAO;WAC3B,OAAO;AACd,cAAW;IAAE,GAAG,iBAAiB;IAAe,OAAO;IAAO,CAAC;;;AAMrE,KAAI,CAAC,IAAI,aAAa,aAAa,SAAS,IAAI,KAC9C,KAAI;EACF,MAAM,YAAY,kBAAkB;GAClC,SAAS,IAAI;GACb,YAAY,IAAI,YAAY,QAAQ,IAAI,IAAI,aAAa;GACzD,OAAO,IAAI,YAAY,OAAQ,IAAI,QAAQ,IAAI,WAAY;GAC3D;GACD,CAAC;AAEF,MAAI,UAAU,EAAE,GAAG,IAAI,SAAS;AAChC,MAAI,QAAQ,4BAA4B;EAExC,MAAM,SAAS,MAAM,IAAI,QAAQ,OAAO;GACtC,YAAY,WAAW;GACvB,IAAI,IAAI;GACR,MAAM,EAAE,WAAW;GACnB;GACD,CAAC;AAEF,SAAO,IAAI,QAAQ;AAEnB,SAAO;UACA,OAAO;AACd,aAAW;GACT,GAAG,iBAAiB;GACpB,OAAO;GACR,CAAC;;AAIN,QAAO"}
1
+ {"version":3,"file":"afterChange.mjs","names":["afterChangeHook: CollectionAfterChangeHook"],"sources":["../../src/collectionHooks/afterChange.ts"],"sourcesContent":["import { buildThumbnailURL } from '../utils/buildThumbnailURL'\nimport { s3Store } from '../plugin'\nimport { MediaCloudErrors } from '../types/errors'\nimport { useErrorHandler } from '../hooks/useErrorHandler'\n\nimport type { CollectionAfterChangeHook } from 'payload'\n\nexport const afterChangeHook: CollectionAfterChangeHook = async ({\n doc,\n previousDoc,\n req,\n}) => {\n const { throwError } = useErrorHandler()\n\n // Skip if this is an internal update to prevent infinite loop\n if (req.context?._mediaCloudPluginInternal) {\n return doc\n }\n\n // Move asset in S3 if path has changed\n if (doc.path !== previousDoc?.path) {\n if (doc.storage === 's3' && s3Store) {\n try {\n const oldKey = previousDoc?.path ?? previousDoc?.filename\n const newKey = doc.path\n\n await s3Store.copy(oldKey, newKey)\n } catch (error) {\n throwError({ ...MediaCloudErrors.S3_MOVE_ERROR, cause: error })\n }\n }\n }\n\n return doc\n}\n"],"mappings":";;;;;AAOA,MAAaA,kBAA6C,OAAO,EAC/D,KACA,aACA,UACI;CACJ,MAAM,EAAE,eAAe,iBAAiB;AAGxC,KAAI,IAAI,SAAS,0BACf,QAAO;AAIT,KAAI,IAAI,SAAS,aAAa,MAC5B;MAAI,IAAI,YAAY,QAAQ,QAC1B,KAAI;GACF,MAAM,SAAS,aAAa,QAAQ,aAAa;GACjD,MAAM,SAAS,IAAI;AAEnB,SAAM,QAAQ,KAAK,QAAQ,OAAO;WAC3B,OAAO;AACd,cAAW;IAAE,GAAG,iBAAiB;IAAe,OAAO;IAAO,CAAC;;;AAKrE,QAAO"}
@@ -0,0 +1,7 @@
1
+ import { CollectionAfterChangeHook } from "payload";
2
+
3
+ //#region src/collectionHooks/thumbnail.d.ts
4
+ declare const thumbnailHook: CollectionAfterChangeHook;
5
+ //#endregion
6
+ export { thumbnailHook };
7
+ //# sourceMappingURL=thumbnail.d.mts.map
@@ -0,0 +1,38 @@
1
+ import { MediaCloudErrors } from "../types/errors.mjs";
2
+ import { useErrorHandler } from "../hooks/useErrorHandler.mjs";
3
+ import { buildThumbnailURL } from "../utils/buildThumbnailURL.mjs";
4
+ import { s3Store } from "../plugin.mjs";
5
+
6
+ //#region src/collectionHooks/thumbnail.ts
7
+ const thumbnailHook = async ({ collection, doc, previousDoc, req }) => {
8
+ const { throwError } = useErrorHandler();
9
+ if (req.context?._mediaCloudPluginInternal) return doc;
10
+ if (!doc.thumbnail || previousDoc?.path !== doc.path) try {
11
+ const thumbnail = buildThumbnailURL({
12
+ storage: doc.storage,
13
+ playbackId: doc.storage === "mux" ? doc.mux.playbackId : void 0,
14
+ s3Key: doc.storage === "s3" ? doc.path ?? doc.filename : void 0,
15
+ s3Store
16
+ });
17
+ req.context = { ...req.context };
18
+ req.context._mediaCloudPluginInternal = true;
19
+ const update = await req.payload.update({
20
+ collection: collection.slug,
21
+ id: doc.id,
22
+ data: { thumbnail },
23
+ req
24
+ });
25
+ delete req.context._mediaCloudPluginInternal;
26
+ return update;
27
+ } catch (error) {
28
+ throwError({
29
+ ...MediaCloudErrors.THUMBNAIL_GENERATION_ERROR,
30
+ cause: error
31
+ });
32
+ }
33
+ return doc;
34
+ };
35
+
36
+ //#endregion
37
+ export { thumbnailHook };
38
+ //# sourceMappingURL=thumbnail.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"thumbnail.mjs","names":["thumbnailHook: CollectionAfterChangeHook"],"sources":["../../src/collectionHooks/thumbnail.ts"],"sourcesContent":["import { buildThumbnailURL } from '../utils/buildThumbnailURL'\nimport { s3Store } from '../plugin'\nimport { MediaCloudErrors } from '../types/errors'\nimport { useErrorHandler } from '../hooks/useErrorHandler'\n\nimport type { CollectionAfterChangeHook } from 'payload'\n\nexport const thumbnailHook: CollectionAfterChangeHook = async ({\n collection,\n doc,\n previousDoc,\n req,\n}) => {\n const { throwError } = useErrorHandler()\n\n // Skip if this is an internal update to prevent infinite loop\n if (req.context?._mediaCloudPluginInternal) {\n return doc\n }\n\n // Handle thumbnail\n if (!doc.thumbnail || previousDoc?.path !== doc.path) {\n try {\n const thumbnail = buildThumbnailURL({\n storage: doc.storage,\n playbackId: doc.storage === 'mux' ? doc.mux.playbackId : undefined,\n s3Key: doc.storage === 's3' ? (doc.path ?? doc.filename) : undefined,\n s3Store,\n })\n\n req.context = { ...req.context }\n req.context._mediaCloudPluginInternal = true\n\n const update = await req.payload.update({\n collection: collection.slug,\n id: doc.id,\n data: { thumbnail },\n req,\n })\n\n delete req.context._mediaCloudPluginInternal\n\n return update\n } catch (error) {\n throwError({\n ...MediaCloudErrors.THUMBNAIL_GENERATION_ERROR,\n cause: error,\n })\n }\n }\n\n return doc\n}\n"],"mappings":";;;;;;AAOA,MAAaA,gBAA2C,OAAO,EAC7D,YACA,KACA,aACA,UACI;CACJ,MAAM,EAAE,eAAe,iBAAiB;AAGxC,KAAI,IAAI,SAAS,0BACf,QAAO;AAIT,KAAI,CAAC,IAAI,aAAa,aAAa,SAAS,IAAI,KAC9C,KAAI;EACF,MAAM,YAAY,kBAAkB;GAClC,SAAS,IAAI;GACb,YAAY,IAAI,YAAY,QAAQ,IAAI,IAAI,aAAa;GACzD,OAAO,IAAI,YAAY,OAAQ,IAAI,QAAQ,IAAI,WAAY;GAC3D;GACD,CAAC;AAEF,MAAI,UAAU,EAAE,GAAG,IAAI,SAAS;AAChC,MAAI,QAAQ,4BAA4B;EAExC,MAAM,SAAS,MAAM,IAAI,QAAQ,OAAO;GACtC,YAAY,WAAW;GACvB,IAAI,IAAI;GACR,MAAM,EAAE,WAAW;GACnB;GACD,CAAC;AAEF,SAAO,IAAI,QAAQ;AAEnB,SAAO;UACA,OAAO;AACd,aAAW;GACT,GAAG,iBAAiB;GACpB,OAAO;GACR,CAAC;;AAIN,QAAO"}
@@ -8,6 +8,7 @@ import { storageField } from "../fields/storage.mjs";
8
8
  import { muxField } from "../fields/mux.mjs";
9
9
  import { beforeChangeHook } from "../collectionHooks/beforeChange.mjs";
10
10
  import { afterChangeHook } from "../collectionHooks/afterChange.mjs";
11
+ import { thumbnailHook } from "../collectionHooks/thumbnail.mjs";
11
12
 
12
13
  //#region src/collections/mediaCollection.ts
13
14
  /**
@@ -17,6 +18,14 @@ import { afterChangeHook } from "../collectionHooks/afterChange.mjs";
17
18
  */
18
19
  function getMediaCollection(args) {
19
20
  const { baseCollection, view, folders } = args;
21
+ const hooks = {
22
+ beforeChange: [],
23
+ afterChange: [thumbnailHook]
24
+ };
25
+ if (folders) {
26
+ hooks.beforeChange = [beforeChangeHook, ...hooks.beforeChange ?? []];
27
+ hooks.afterChange = [afterChangeHook, ...hooks.afterChange ?? []];
28
+ }
20
29
  const config = {
21
30
  slug: "media",
22
31
  access: {
@@ -47,10 +56,7 @@ function getMediaCollection(args) {
47
56
  storageField,
48
57
  muxField
49
58
  ],
50
- hooks: {
51
- beforeChange: [beforeChangeHook],
52
- afterChange: [afterChangeHook]
53
- }
59
+ hooks
54
60
  };
55
61
  if (!baseCollection) return config;
56
62
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"mediaCollection.mjs","names":["config: CollectionConfig"],"sources":["../../src/collections/mediaCollection.ts"],"sourcesContent":["import { thumbnailField } from '../fields/thumbnail'\nimport { pathField } from '../fields/path'\nimport { filenameField } from '../fields/filename'\nimport { altField } from '../fields/alt'\nimport { widthField } from '../fields/width'\nimport { heightField } from '../fields/height'\nimport { storageField } from '../fields/storage'\nimport { muxField } from '../fields/mux'\n\nimport { beforeChangeHook } from '../collectionHooks/beforeChange'\nimport { afterChangeHook } from '../collectionHooks/afterChange'\n\nimport type { CollectionConfig } from 'payload'\nimport type { Document } from 'payload'\nimport type { MediaCloudPluginOptions } from '../types/index'\n\ninterface GetMediaCollectionArgs {\n view: MediaCloudPluginOptions['view']\n folders: MediaCloudPluginOptions['folders']\n baseCollection?: CollectionConfig\n}\n\n/**\n * Creates a media collection configuration for Payload CMS\n * @param args - Arguments including the S3Store instance\n * @returns A configured Payload collection for media files\n */\nexport function getMediaCollection(\n args: GetMediaCollectionArgs\n): CollectionConfig {\n const { baseCollection, view, folders } = args\n\n // Override list view to use grid view if specified\n const components =\n view === 'grid'\n ? {\n views: {\n list: {\n Component: '@maas/payload-plugin-media-cloud/components#GridView',\n },\n },\n }\n : undefined\n\n const config: CollectionConfig = {\n slug: 'media',\n access: {\n read: () => true,\n delete: () => true,\n },\n admin: {\n components,\n group: 'Media Cloud',\n pagination: {\n defaultLimit: 50,\n },\n },\n upload: {\n crop: false,\n displayPreview: true,\n hideRemoveFile: true,\n adminThumbnail({ doc }: { doc: Document }) {\n return doc.thumbnail ?? null\n },\n },\n fields: [\n thumbnailField,\n pathField,\n altField,\n {\n type: 'row',\n fields: [widthField, heightField],\n },\n storageField,\n muxField,\n ],\n hooks: {\n beforeChange: [beforeChangeHook],\n afterChange: [afterChangeHook],\n },\n }\n\n if (!baseCollection) {\n return config\n }\n\n return {\n ...baseCollection,\n slug: baseCollection.slug ?? config.slug,\n admin: {\n ...(config.admin ?? {}),\n ...(baseCollection.admin ?? {}),\n },\n access: {\n ...(config.access ?? {}),\n ...(baseCollection.access ?? {}),\n },\n upload: config.upload,\n fields: [...(baseCollection.fields ?? []), ...config.fields, filenameField],\n hooks: {\n ...baseCollection.hooks,\n beforeChange: [\n ...(baseCollection.hooks?.beforeChange ?? []),\n ...(config.hooks?.beforeChange ?? []),\n ],\n afterChange: [\n ...(baseCollection.hooks?.afterChange ?? []),\n ...(config.hooks?.afterChange ?? []),\n ],\n },\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AA2BA,SAAgB,mBACd,MACkB;CAClB,MAAM,EAAE,gBAAgB,MAAM,YAAY;CAc1C,MAAMA,SAA2B;EAC/B,MAAM;EACN,QAAQ;GACN,YAAY;GACZ,cAAc;GACf;EACD,OAAO;GACL,YAjBF,SAAS,SACL,EACE,OAAO,EACL,MAAM,EACJ,WAAW,wDACZ,EACF,EACF,GACD;GAUF,OAAO;GACP,YAAY,EACV,cAAc,IACf;GACF;EACD,QAAQ;GACN,MAAM;GACN,gBAAgB;GAChB,gBAAgB;GAChB,eAAe,EAAE,OAA0B;AACzC,WAAO,IAAI,aAAa;;GAE3B;EACD,QAAQ;GACN;GACA;GACA;GACA;IACE,MAAM;IACN,QAAQ,CAAC,YAAY,YAAY;IAClC;GACD;GACA;GACD;EACD,OAAO;GACL,cAAc,CAAC,iBAAiB;GAChC,aAAa,CAAC,gBAAgB;GAC/B;EACF;AAED,KAAI,CAAC,eACH,QAAO;AAGT,QAAO;EACL,GAAG;EACH,MAAM,eAAe,QAAQ,OAAO;EACpC,OAAO;GACL,GAAI,OAAO,SAAS,EAAE;GACtB,GAAI,eAAe,SAAS,EAAE;GAC/B;EACD,QAAQ;GACN,GAAI,OAAO,UAAU,EAAE;GACvB,GAAI,eAAe,UAAU,EAAE;GAChC;EACD,QAAQ,OAAO;EACf,QAAQ;GAAC,GAAI,eAAe,UAAU,EAAE;GAAG,GAAG,OAAO;GAAQ;GAAc;EAC3E,OAAO;GACL,GAAG,eAAe;GAClB,cAAc,CACZ,GAAI,eAAe,OAAO,gBAAgB,EAAE,EAC5C,GAAI,OAAO,OAAO,gBAAgB,EAAE,CACrC;GACD,aAAa,CACX,GAAI,eAAe,OAAO,eAAe,EAAE,EAC3C,GAAI,OAAO,OAAO,eAAe,EAAE,CACpC;GACF;EACF"}
1
+ {"version":3,"file":"mediaCollection.mjs","names":["hooks: CollectionConfig['hooks']","config: CollectionConfig"],"sources":["../../src/collections/mediaCollection.ts"],"sourcesContent":["import { thumbnailField } from '../fields/thumbnail'\nimport { pathField } from '../fields/path'\nimport { filenameField } from '../fields/filename'\nimport { altField } from '../fields/alt'\nimport { widthField } from '../fields/width'\nimport { heightField } from '../fields/height'\nimport { storageField } from '../fields/storage'\nimport { muxField } from '../fields/mux'\n\nimport { beforeChangeHook } from '../collectionHooks/beforeChange'\nimport { afterChangeHook } from '../collectionHooks/afterChange'\n\nimport type { CollectionConfig } from 'payload'\nimport type { Document } from 'payload'\nimport type { MediaCloudPluginOptions } from '../types/index'\nimport { before } from 'node:test'\nimport { thumbnailHook } from '../collectionHooks/thumbnail'\n\ninterface GetMediaCollectionArgs {\n view: MediaCloudPluginOptions['view']\n folders: MediaCloudPluginOptions['folders']\n baseCollection?: CollectionConfig\n}\n\n/**\n * Creates a media collection configuration for Payload CMS\n * @param args - Arguments including the S3Store instance\n * @returns A configured Payload collection for media files\n */\nexport function getMediaCollection(\n args: GetMediaCollectionArgs\n): CollectionConfig {\n const { baseCollection, view, folders } = args\n\n const hooks: CollectionConfig['hooks'] = {\n beforeChange: [],\n afterChange: [thumbnailHook],\n }\n\n // Add hooks for folder support if enabled\n if (folders) {\n hooks.beforeChange = [beforeChangeHook, ...(hooks.beforeChange ?? [])]\n hooks.afterChange = [afterChangeHook, ...(hooks.afterChange ?? [])]\n }\n\n // Override list view to use grid view if specified\n const components =\n view === 'grid'\n ? {\n views: {\n list: {\n Component: '@maas/payload-plugin-media-cloud/components#GridView',\n },\n },\n }\n : undefined\n\n const config: CollectionConfig = {\n slug: 'media',\n access: {\n read: () => true,\n delete: () => true,\n },\n admin: {\n components,\n group: 'Media Cloud',\n pagination: {\n defaultLimit: 50,\n },\n },\n upload: {\n crop: false,\n displayPreview: true,\n hideRemoveFile: true,\n adminThumbnail({ doc }: { doc: Document }) {\n return doc.thumbnail ?? null\n },\n },\n fields: [\n thumbnailField,\n pathField,\n altField,\n {\n type: 'row',\n fields: [widthField, heightField],\n },\n storageField,\n muxField,\n ],\n hooks: hooks,\n }\n\n if (!baseCollection) {\n return config\n }\n\n return {\n ...baseCollection,\n slug: baseCollection.slug ?? config.slug,\n admin: {\n ...(config.admin ?? {}),\n ...(baseCollection.admin ?? {}),\n },\n access: {\n ...(config.access ?? {}),\n ...(baseCollection.access ?? {}),\n },\n upload: config.upload,\n fields: [...(baseCollection.fields ?? []), ...config.fields, filenameField],\n hooks: {\n ...baseCollection.hooks,\n beforeChange: [\n ...(baseCollection.hooks?.beforeChange ?? []),\n ...(config.hooks?.beforeChange ?? []),\n ],\n afterChange: [\n ...(baseCollection.hooks?.afterChange ?? []),\n ...(config.hooks?.afterChange ?? []),\n ],\n },\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA6BA,SAAgB,mBACd,MACkB;CAClB,MAAM,EAAE,gBAAgB,MAAM,YAAY;CAE1C,MAAMA,QAAmC;EACvC,cAAc,EAAE;EAChB,aAAa,CAAC,cAAc;EAC7B;AAGD,KAAI,SAAS;AACX,QAAM,eAAe,CAAC,kBAAkB,GAAI,MAAM,gBAAgB,EAAE,CAAE;AACtE,QAAM,cAAc,CAAC,iBAAiB,GAAI,MAAM,eAAe,EAAE,CAAE;;CAerE,MAAMC,SAA2B;EAC/B,MAAM;EACN,QAAQ;GACN,YAAY;GACZ,cAAc;GACf;EACD,OAAO;GACL,YAjBF,SAAS,SACL,EACE,OAAO,EACL,MAAM,EACJ,WAAW,wDACZ,EACF,EACF,GACD;GAUF,OAAO;GACP,YAAY,EACV,cAAc,IACf;GACF;EACD,QAAQ;GACN,MAAM;GACN,gBAAgB;GAChB,gBAAgB;GAChB,eAAe,EAAE,OAA0B;AACzC,WAAO,IAAI,aAAa;;GAE3B;EACD,QAAQ;GACN;GACA;GACA;GACA;IACE,MAAM;IACN,QAAQ,CAAC,YAAY,YAAY;IAClC;GACD;GACA;GACD;EACM;EACR;AAED,KAAI,CAAC,eACH,QAAO;AAGT,QAAO;EACL,GAAG;EACH,MAAM,eAAe,QAAQ,OAAO;EACpC,OAAO;GACL,GAAI,OAAO,SAAS,EAAE;GACtB,GAAI,eAAe,SAAS,EAAE;GAC/B;EACD,QAAQ;GACN,GAAI,OAAO,UAAU,EAAE;GACvB,GAAI,eAAe,UAAU,EAAE;GAChC;EACD,QAAQ,OAAO;EACf,QAAQ;GAAC,GAAI,eAAe,UAAU,EAAE;GAAG,GAAG,OAAO;GAAQ;GAAc;EAC3E,OAAO;GACL,GAAG,eAAe;GAClB,cAAc,CACZ,GAAI,eAAe,OAAO,gBAAgB,EAAE,EAC5C,GAAI,OAAO,OAAO,gBAAgB,EAAE,CACrC;GACD,aAAa,CACX,GAAI,eAAe,OAAO,eAAe,EAAE,EAC3C,GAAI,OAAO,OAAO,eAAe,EAAE,CACpC;GACF;EACF"}
@@ -3,7 +3,7 @@ const defaultOptions = {
3
3
  enabled: true,
4
4
  collection: "media",
5
5
  view: "grid",
6
- folders: true,
6
+ folders: false,
7
7
  storage: { "video/*": "mux" },
8
8
  limits: {
9
9
  mimeTypes: ["image/*", "video/*"],
@@ -1 +1 @@
1
- {"version":3,"file":"defaultOptions.mjs","names":["defaultOptions: MediaCloudDefaultPluginOptions"],"sources":["../../src/utils/defaultOptions.ts"],"sourcesContent":["import { MediaCloudDefaultPluginOptions } from '../types'\n\nexport const defaultOptions: MediaCloudDefaultPluginOptions = {\n enabled: true,\n collection: 'media',\n view: 'grid',\n folders: true,\n storage: {\n 'video/*': 'mux',\n },\n limits: {\n mimeTypes: ['image/*', 'video/*'],\n fileSize: Infinity,\n concurrency: 10,\n },\n}\n"],"mappings":";AAEA,MAAaA,iBAAiD;CAC5D,SAAS;CACT,YAAY;CACZ,MAAM;CACN,SAAS;CACT,SAAS,EACP,WAAW,OACZ;CACD,QAAQ;EACN,WAAW,CAAC,WAAW,UAAU;EACjC,UAAU;EACV,aAAa;EACd;CACF"}
1
+ {"version":3,"file":"defaultOptions.mjs","names":["defaultOptions: MediaCloudDefaultPluginOptions"],"sources":["../../src/utils/defaultOptions.ts"],"sourcesContent":["import { MediaCloudDefaultPluginOptions } from '../types'\n\nexport const defaultOptions: MediaCloudDefaultPluginOptions = {\n enabled: true,\n collection: 'media',\n view: 'grid',\n folders: false,\n storage: {\n 'video/*': 'mux',\n },\n limits: {\n mimeTypes: ['image/*', 'video/*'],\n fileSize: Infinity,\n concurrency: 10,\n },\n}\n"],"mappings":";AAEA,MAAaA,iBAAiD;CAC5D,SAAS;CACT,YAAY;CACZ,MAAM;CACN,SAAS;CACT,SAAS,EACP,WAAW,OACZ;CACD,QAAQ;EACN,WAAW,CAAC,WAAW,UAAU;EACjC,UAAU;EACV,aAAa;EACd;CACF"}
@@ -1,6 +1,6 @@
1
1
  import { MediaCloudPluginOptions, MimeType } from "../types/index.mjs";
2
2
  import { S3Store } from "../tus/stores/s3/s3Store.mjs";
3
- import * as payload3 from "payload";
3
+ import * as payload0 from "payload";
4
4
 
5
5
  //#region src/utils/file.d.ts
6
6
 
@@ -35,7 +35,7 @@ interface CreateFileEndpointsArgs {
35
35
  pluginOptions: MediaCloudPluginOptions;
36
36
  }
37
37
  declare function createFileEndpoints(args: CreateFileEndpointsArgs): {
38
- handler: payload3.PayloadHandler;
38
+ handler: payload0.PayloadHandler;
39
39
  method: "get";
40
40
  path: string;
41
41
  }[];
@@ -1,5 +1,5 @@
1
1
  import { MediaCloudPluginOptions } from "../types/index.mjs";
2
- import * as payload0 from "payload";
2
+ import * as payload2 from "payload";
3
3
  import Mux from "@mux/mux-node";
4
4
 
5
5
  //#region src/utils/mux.d.ts
@@ -14,11 +14,11 @@ interface CreateMuxEndpointsArgs {
14
14
  pluginOptions: MediaCloudPluginOptions;
15
15
  }
16
16
  declare function createMuxEndpoints(args: CreateMuxEndpointsArgs): ({
17
- handler: payload0.PayloadHandler;
17
+ handler: payload2.PayloadHandler;
18
18
  method: "post";
19
19
  path: string;
20
20
  } | {
21
- handler: payload0.PayloadHandler;
21
+ handler: payload2.PayloadHandler;
22
22
  method: "get";
23
23
  path: string;
24
24
  })[];
@@ -1,6 +1,6 @@
1
1
  import { MediaCloudPluginOptions } from "../types/index.mjs";
2
2
  import { S3Store } from "../tus/stores/s3/s3Store.mjs";
3
- import * as payload1 from "payload";
3
+ import * as payload0 from "payload";
4
4
  import { PayloadRequest } from "payload";
5
5
  import { Server } from "@tus/server";
6
6
 
@@ -45,11 +45,11 @@ declare function createTusEndpoints(args: CreateTusEndpointsArgs): ({
45
45
  method: "delete";
46
46
  path: string;
47
47
  } | {
48
- handler: payload1.PayloadHandler;
48
+ handler: payload0.PayloadHandler;
49
49
  method: "get";
50
50
  path: string;
51
51
  } | {
52
- handler: payload1.PayloadHandler;
52
+ handler: payload0.PayloadHandler;
53
53
  method: "post";
54
54
  path: string;
55
55
  })[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maas/payload-plugin-media-cloud",
3
- "version": "0.0.41",
3
+ "version": "0.0.42",
4
4
  "type": "module",
5
5
  "contributors": [
6
6
  {