@payloadcms/plugin-cloud-storage 3.32.0-canary.0 → 3.32.0-canary.2

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 +1 @@
1
- {"version":3,"file":"initClientUploads.d.ts","sourceRoot":"","sources":["../../src/utilities/initClientUploads.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAErD,eAAO,MAAM,iBAAiB,GAAI,UAAU,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC,+GAQ5E;IACD,sCAAsC;IACtC,aAAa,EAAE,MAAM,CAAA;IACrB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAA;IAC9B,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,OAAO,CAAA;IAChB,gDAAgD;IAChD,uBAAuB,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC,KAAK,UAAU,CAAA;IACvD,aAAa,EAAE,cAAc,CAAA;IAC7B,iBAAiB,EAAE,MAAM,CAAA;CAC1B,SAoEA,CAAA"}
1
+ {"version":3,"file":"initClientUploads.d.ts","sourceRoot":"","sources":["../../src/utilities/initClientUploads.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAErD,eAAO,MAAM,iBAAiB,GAAI,UAAU,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC,+GAQ5E;IACD,sCAAsC;IACtC,aAAa,EAAE,MAAM,CAAA;IACrB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAA;IAC9B,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,OAAO,CAAA;IAChB,gDAAgD;IAChD,uBAAuB,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC,KAAK,UAAU,CAAA;IACvD,aAAa,EAAE,cAAc,CAAA;IAC7B,iBAAiB,EAAE,MAAM,CAAA;CAC1B,SA8EA,CAAA"}
@@ -26,6 +26,15 @@ export const initClientUploads = ({ clientHandler, collections, config, enabled,
26
26
  if (!config.admin) {
27
27
  config.admin = {};
28
28
  }
29
+ if (!config.admin.dependencies) {
30
+ config.admin.dependencies = {};
31
+ }
32
+ // Ensure client handler is always part of the import map, to avoid
33
+ // import map discrepancies between dev and prod
34
+ config.admin.dependencies[clientHandler] = {
35
+ type: 'function',
36
+ path: clientHandler
37
+ };
29
38
  if (!config.admin.components) {
30
39
  config.admin.components = {};
31
40
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utilities/initClientUploads.ts"],"sourcesContent":["import type { Config, PayloadHandler } from 'payload'\n\nexport const initClientUploads = <ExtraProps extends Record<string, unknown>, T>({\n clientHandler,\n collections,\n config,\n enabled,\n extraClientHandlerProps,\n serverHandler,\n serverHandlerPath,\n}: {\n /** Path to clientHandler component */\n clientHandler: string\n collections: Record<string, T>\n config: Config\n enabled: boolean\n /** extra props to pass to the client handler */\n extraClientHandlerProps?: (collection: T) => ExtraProps\n serverHandler: PayloadHandler\n serverHandlerPath: string\n}) => {\n if (enabled) {\n if (!config.endpoints) {\n config.endpoints = []\n }\n\n /**\n * Tracks how many times the same handler was already applied.\n * This allows to apply the same plugin multiple times, for example\n * to use different buckets for different collections.\n */\n let handlerCount = 0\n\n for (const endpoint of config.endpoints) {\n // We want to match on 'path', 'path-1', 'path-2', etc.\n if (endpoint.path?.startsWith(serverHandlerPath)) {\n handlerCount++\n }\n }\n\n if (handlerCount) {\n serverHandlerPath = `${serverHandlerPath}-${handlerCount}`\n }\n\n config.endpoints.push({\n handler: serverHandler,\n method: 'post',\n path: serverHandlerPath,\n })\n }\n\n if (!config.admin) {\n config.admin = {}\n }\n\n if (!config.admin.components) {\n config.admin.components = {}\n }\n\n if (!config.admin.components.providers) {\n config.admin.components.providers = []\n }\n\n for (const collectionSlug in collections) {\n const collection = collections[collectionSlug]\n\n let prefix: string | undefined\n\n if (\n collection &&\n typeof collection === 'object' &&\n 'prefix' in collection &&\n typeof collection.prefix === 'string'\n ) {\n prefix = collection.prefix\n }\n\n config.admin.components.providers.push({\n clientProps: {\n collectionSlug,\n enabled,\n extra: extraClientHandlerProps ? extraClientHandlerProps(collection) : undefined,\n prefix,\n serverHandlerPath,\n },\n path: clientHandler,\n })\n }\n}\n"],"names":["initClientUploads","clientHandler","collections","config","enabled","extraClientHandlerProps","serverHandler","serverHandlerPath","endpoints","handlerCount","endpoint","path","startsWith","push","handler","method","admin","components","providers","collectionSlug","collection","prefix","clientProps","extra","undefined"],"mappings":"AAEA,OAAO,MAAMA,oBAAoB,CAAgD,EAC/EC,aAAa,EACbC,WAAW,EACXC,MAAM,EACNC,OAAO,EACPC,uBAAuB,EACvBC,aAAa,EACbC,iBAAiB,EAWlB;IACC,IAAIH,SAAS;QACX,IAAI,CAACD,OAAOK,SAAS,EAAE;YACrBL,OAAOK,SAAS,GAAG,EAAE;QACvB;QAEA;;;;KAIC,GACD,IAAIC,eAAe;QAEnB,KAAK,MAAMC,YAAYP,OAAOK,SAAS,CAAE;YACvC,uDAAuD;YACvD,IAAIE,SAASC,IAAI,EAAEC,WAAWL,oBAAoB;gBAChDE;YACF;QACF;QAEA,IAAIA,cAAc;YAChBF,oBAAoB,GAAGA,kBAAkB,CAAC,EAAEE,cAAc;QAC5D;QAEAN,OAAOK,SAAS,CAACK,IAAI,CAAC;YACpBC,SAASR;YACTS,QAAQ;YACRJ,MAAMJ;QACR;IACF;IAEA,IAAI,CAACJ,OAAOa,KAAK,EAAE;QACjBb,OAAOa,KAAK,GAAG,CAAC;IAClB;IAEA,IAAI,CAACb,OAAOa,KAAK,CAACC,UAAU,EAAE;QAC5Bd,OAAOa,KAAK,CAACC,UAAU,GAAG,CAAC;IAC7B;IAEA,IAAI,CAACd,OAAOa,KAAK,CAACC,UAAU,CAACC,SAAS,EAAE;QACtCf,OAAOa,KAAK,CAACC,UAAU,CAACC,SAAS,GAAG,EAAE;IACxC;IAEA,IAAK,MAAMC,kBAAkBjB,YAAa;QACxC,MAAMkB,aAAalB,WAAW,CAACiB,eAAe;QAE9C,IAAIE;QAEJ,IACED,cACA,OAAOA,eAAe,YACtB,YAAYA,cACZ,OAAOA,WAAWC,MAAM,KAAK,UAC7B;YACAA,SAASD,WAAWC,MAAM;QAC5B;QAEAlB,OAAOa,KAAK,CAACC,UAAU,CAACC,SAAS,CAACL,IAAI,CAAC;YACrCS,aAAa;gBACXH;gBACAf;gBACAmB,OAAOlB,0BAA0BA,wBAAwBe,cAAcI;gBACvEH;gBACAd;YACF;YACAI,MAAMV;QACR;IACF;AACF,EAAC"}
1
+ {"version":3,"sources":["../../src/utilities/initClientUploads.ts"],"sourcesContent":["import type { Config, PayloadHandler } from 'payload'\n\nexport const initClientUploads = <ExtraProps extends Record<string, unknown>, T>({\n clientHandler,\n collections,\n config,\n enabled,\n extraClientHandlerProps,\n serverHandler,\n serverHandlerPath,\n}: {\n /** Path to clientHandler component */\n clientHandler: string\n collections: Record<string, T>\n config: Config\n enabled: boolean\n /** extra props to pass to the client handler */\n extraClientHandlerProps?: (collection: T) => ExtraProps\n serverHandler: PayloadHandler\n serverHandlerPath: string\n}) => {\n if (enabled) {\n if (!config.endpoints) {\n config.endpoints = []\n }\n\n /**\n * Tracks how many times the same handler was already applied.\n * This allows to apply the same plugin multiple times, for example\n * to use different buckets for different collections.\n */\n let handlerCount = 0\n\n for (const endpoint of config.endpoints) {\n // We want to match on 'path', 'path-1', 'path-2', etc.\n if (endpoint.path?.startsWith(serverHandlerPath)) {\n handlerCount++\n }\n }\n\n if (handlerCount) {\n serverHandlerPath = `${serverHandlerPath}-${handlerCount}`\n }\n\n config.endpoints.push({\n handler: serverHandler,\n method: 'post',\n path: serverHandlerPath,\n })\n }\n\n if (!config.admin) {\n config.admin = {}\n }\n\n if (!config.admin.dependencies) {\n config.admin.dependencies = {}\n }\n // Ensure client handler is always part of the import map, to avoid\n // import map discrepancies between dev and prod\n config.admin.dependencies[clientHandler] = {\n type: 'function',\n path: clientHandler,\n }\n\n if (!config.admin.components) {\n config.admin.components = {}\n }\n\n if (!config.admin.components.providers) {\n config.admin.components.providers = []\n }\n\n for (const collectionSlug in collections) {\n const collection = collections[collectionSlug]\n\n let prefix: string | undefined\n\n if (\n collection &&\n typeof collection === 'object' &&\n 'prefix' in collection &&\n typeof collection.prefix === 'string'\n ) {\n prefix = collection.prefix\n }\n\n config.admin.components.providers.push({\n clientProps: {\n collectionSlug,\n enabled,\n extra: extraClientHandlerProps ? extraClientHandlerProps(collection) : undefined,\n prefix,\n serverHandlerPath,\n },\n path: clientHandler,\n })\n }\n}\n"],"names":["initClientUploads","clientHandler","collections","config","enabled","extraClientHandlerProps","serverHandler","serverHandlerPath","endpoints","handlerCount","endpoint","path","startsWith","push","handler","method","admin","dependencies","type","components","providers","collectionSlug","collection","prefix","clientProps","extra","undefined"],"mappings":"AAEA,OAAO,MAAMA,oBAAoB,CAAgD,EAC/EC,aAAa,EACbC,WAAW,EACXC,MAAM,EACNC,OAAO,EACPC,uBAAuB,EACvBC,aAAa,EACbC,iBAAiB,EAWlB;IACC,IAAIH,SAAS;QACX,IAAI,CAACD,OAAOK,SAAS,EAAE;YACrBL,OAAOK,SAAS,GAAG,EAAE;QACvB;QAEA;;;;KAIC,GACD,IAAIC,eAAe;QAEnB,KAAK,MAAMC,YAAYP,OAAOK,SAAS,CAAE;YACvC,uDAAuD;YACvD,IAAIE,SAASC,IAAI,EAAEC,WAAWL,oBAAoB;gBAChDE;YACF;QACF;QAEA,IAAIA,cAAc;YAChBF,oBAAoB,GAAGA,kBAAkB,CAAC,EAAEE,cAAc;QAC5D;QAEAN,OAAOK,SAAS,CAACK,IAAI,CAAC;YACpBC,SAASR;YACTS,QAAQ;YACRJ,MAAMJ;QACR;IACF;IAEA,IAAI,CAACJ,OAAOa,KAAK,EAAE;QACjBb,OAAOa,KAAK,GAAG,CAAC;IAClB;IAEA,IAAI,CAACb,OAAOa,KAAK,CAACC,YAAY,EAAE;QAC9Bd,OAAOa,KAAK,CAACC,YAAY,GAAG,CAAC;IAC/B;IACA,mEAAmE;IACnE,gDAAgD;IAChDd,OAAOa,KAAK,CAACC,YAAY,CAAChB,cAAc,GAAG;QACzCiB,MAAM;QACNP,MAAMV;IACR;IAEA,IAAI,CAACE,OAAOa,KAAK,CAACG,UAAU,EAAE;QAC5BhB,OAAOa,KAAK,CAACG,UAAU,GAAG,CAAC;IAC7B;IAEA,IAAI,CAAChB,OAAOa,KAAK,CAACG,UAAU,CAACC,SAAS,EAAE;QACtCjB,OAAOa,KAAK,CAACG,UAAU,CAACC,SAAS,GAAG,EAAE;IACxC;IAEA,IAAK,MAAMC,kBAAkBnB,YAAa;QACxC,MAAMoB,aAAapB,WAAW,CAACmB,eAAe;QAE9C,IAAIE;QAEJ,IACED,cACA,OAAOA,eAAe,YACtB,YAAYA,cACZ,OAAOA,WAAWC,MAAM,KAAK,UAC7B;YACAA,SAASD,WAAWC,MAAM;QAC5B;QAEApB,OAAOa,KAAK,CAACG,UAAU,CAACC,SAAS,CAACP,IAAI,CAAC;YACrCW,aAAa;gBACXH;gBACAjB;gBACAqB,OAAOpB,0BAA0BA,wBAAwBiB,cAAcI;gBACvEH;gBACAhB;YACF;YACAI,MAAMV;QACR;IACF;AACF,EAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/plugin-cloud-storage",
3
- "version": "3.32.0-canary.0",
3
+ "version": "3.32.0-canary.2",
4
4
  "description": "The official cloud storage plugin for Payload CMS",
5
5
  "homepage": "https://payloadcms.com",
6
6
  "repository": {
@@ -50,18 +50,18 @@
50
50
  "dependencies": {
51
51
  "find-node-modules": "^2.1.3",
52
52
  "range-parser": "^1.2.1",
53
- "@payloadcms/ui": "3.32.0-canary.0"
53
+ "@payloadcms/ui": "3.32.0-canary.2"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@types/find-node-modules": "^2.1.2",
57
57
  "@types/react": "19.0.12",
58
58
  "@types/react-dom": "19.0.4",
59
- "payload": "3.32.0-canary.0"
59
+ "payload": "3.32.0-canary.2"
60
60
  },
61
61
  "peerDependencies": {
62
62
  "react": "^19.0.0 || ^19.0.0-rc-65a56d0e-20241020",
63
63
  "react-dom": "^19.0.0 || ^19.0.0-rc-65a56d0e-20241020",
64
- "payload": "3.32.0-canary.0"
64
+ "payload": "3.32.0-canary.2"
65
65
  },
66
66
  "publishConfig": {
67
67
  "registry": "https://registry.npmjs.org/"