@payloadcms/next 3.65.0-canary.6 → 3.65.0-internal.d8c3085

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.
@@ -3,6 +3,9 @@ export declare const getDocumentPermissions: (args: {
3
3
  collectionConfig?: SanitizedCollectionConfig;
4
4
  data: Data;
5
5
  globalConfig?: SanitizedGlobalConfig;
6
+ /**
7
+ * When called for creating a new document, id is not provided.
8
+ */
6
9
  id?: number | string;
7
10
  req: PayloadRequest;
8
11
  }) => Promise<{
@@ -1 +1 @@
1
- {"version":3,"file":"getDocumentPermissions.d.ts","sourceRoot":"","sources":["../../../src/views/Document/getDocumentPermissions.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,IAAI,EACJ,cAAc,EACd,yBAAyB,EACzB,4BAA4B,EAC5B,qBAAqB,EACtB,MAAM,SAAS,CAAA;AAQhB,eAAO,MAAM,sBAAsB,SAAgB;IACjD,gBAAgB,CAAC,EAAE,yBAAyB,CAAA;IAC5C,IAAI,EAAE,IAAI,CAAA;IACV,YAAY,CAAC,EAAE,qBAAqB,CAAA;IACpC,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACpB,GAAG,EAAE,cAAc,CAAA;CACpB,KAAG,OAAO,CAAC;IACV,cAAc,EAAE,4BAA4B,CAAA;IAC5C,oBAAoB,EAAE,OAAO,CAAA;IAC7B,iBAAiB,EAAE,OAAO,CAAA;CAC3B,CAqFA,CAAA"}
1
+ {"version":3,"file":"getDocumentPermissions.d.ts","sourceRoot":"","sources":["../../../src/views/Document/getDocumentPermissions.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,IAAI,EACJ,cAAc,EACd,yBAAyB,EACzB,4BAA4B,EAC5B,qBAAqB,EACtB,MAAM,SAAS,CAAA;AAQhB,eAAO,MAAM,sBAAsB,SAAgB;IACjD,gBAAgB,CAAC,EAAE,yBAAyB,CAAA;IAC5C,IAAI,EAAE,IAAI,CAAA;IACV,YAAY,CAAC,EAAE,qBAAqB,CAAA;IACpC;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACpB,GAAG,EAAE,cAAc,CAAA;CACpB,KAAG,OAAO,CAAC;IACV,cAAc,EAAE,4BAA4B,CAAA;IAC5C,oBAAoB,EAAE,OAAO,CAAA;IAC7B,iBAAiB,EAAE,OAAO,CAAA;CAC3B,CAiFA,CAAA"}
@@ -17,28 +17,24 @@ export const getDocumentPermissions = async args => {
17
17
  collection: {
18
18
  config: collectionConfig
19
19
  },
20
- req: {
21
- ...req,
22
- data: {
23
- ...data,
24
- _status: 'draft'
25
- }
26
- }
20
+ data: {
21
+ ...data,
22
+ _status: 'draft'
23
+ },
24
+ req
27
25
  });
28
26
  if (collectionConfig.versions?.drafts) {
29
- hasPublishPermission = await docAccessOperation({
27
+ hasPublishPermission = (await docAccessOperation({
30
28
  id,
31
29
  collection: {
32
30
  config: collectionConfig
33
31
  },
34
- req: {
35
- ...req,
36
- data: {
37
- ...data,
38
- _status: 'published'
39
- }
40
- }
41
- }).then(permissions => permissions.update);
32
+ data: {
33
+ ...data,
34
+ _status: 'published'
35
+ },
36
+ req
37
+ })).update;
42
38
  }
43
39
  } catch (err) {
44
40
  logError({
@@ -50,23 +46,19 @@ export const getDocumentPermissions = async args => {
50
46
  if (globalConfig) {
51
47
  try {
52
48
  docPermissions = await docAccessOperationGlobal({
49
+ data,
53
50
  globalConfig,
54
- req: {
55
- ...req,
56
- data
57
- }
51
+ req
58
52
  });
59
53
  if (globalConfig.versions?.drafts) {
60
- hasPublishPermission = await docAccessOperationGlobal({
54
+ hasPublishPermission = (await docAccessOperationGlobal({
55
+ data: {
56
+ ...data,
57
+ _status: 'published'
58
+ },
61
59
  globalConfig,
62
- req: {
63
- ...req,
64
- data: {
65
- ...data,
66
- _status: 'published'
67
- }
68
- }
69
- }).then(permissions => permissions.update);
60
+ req
61
+ })).update;
70
62
  }
71
63
  } catch (err) {
72
64
  logError({
@@ -1 +1 @@
1
- {"version":3,"file":"getDocumentPermissions.js","names":["hasSavePermission","getHasSavePermission","isEditing","getIsEditing","docAccessOperation","docAccessOperationGlobal","logError","getDocumentPermissions","args","id","collectionConfig","data","globalConfig","req","docPermissions","hasPublishPermission","collection","config","_status","versions","drafts","then","permissions","update","err","payload","collectionSlug","slug","globalSlug"],"sources":["../../../src/views/Document/getDocumentPermissions.tsx"],"sourcesContent":["import type {\n Data,\n PayloadRequest,\n SanitizedCollectionConfig,\n SanitizedDocumentPermissions,\n SanitizedGlobalConfig,\n} from 'payload'\n\nimport {\n hasSavePermission as getHasSavePermission,\n isEditing as getIsEditing,\n} from '@payloadcms/ui/shared'\nimport { docAccessOperation, docAccessOperationGlobal, logError } from 'payload'\n\nexport const getDocumentPermissions = async (args: {\n collectionConfig?: SanitizedCollectionConfig\n data: Data\n globalConfig?: SanitizedGlobalConfig\n id?: number | string\n req: PayloadRequest\n}): Promise<{\n docPermissions: SanitizedDocumentPermissions\n hasPublishPermission: boolean\n hasSavePermission: boolean\n}> => {\n const { id, collectionConfig, data = {}, globalConfig, req } = args\n\n let docPermissions: SanitizedDocumentPermissions\n let hasPublishPermission = false\n\n if (collectionConfig) {\n try {\n docPermissions = await docAccessOperation({\n id,\n collection: {\n config: collectionConfig,\n },\n req: {\n ...req,\n data: {\n ...data,\n _status: 'draft',\n },\n },\n })\n\n if (collectionConfig.versions?.drafts) {\n hasPublishPermission = await docAccessOperation({\n id,\n collection: {\n config: collectionConfig,\n },\n req: {\n ...req,\n data: {\n ...data,\n _status: 'published',\n },\n },\n }).then((permissions) => permissions.update)\n }\n } catch (err) {\n logError({ err, payload: req.payload })\n }\n }\n\n if (globalConfig) {\n try {\n docPermissions = await docAccessOperationGlobal({\n globalConfig,\n req: {\n ...req,\n data,\n },\n })\n\n if (globalConfig.versions?.drafts) {\n hasPublishPermission = await docAccessOperationGlobal({\n globalConfig,\n req: {\n ...req,\n data: {\n ...data,\n _status: 'published',\n },\n },\n }).then((permissions) => permissions.update)\n }\n } catch (err) {\n logError({ err, payload: req.payload })\n }\n }\n\n const hasSavePermission = getHasSavePermission({\n collectionSlug: collectionConfig?.slug,\n docPermissions,\n globalSlug: globalConfig?.slug,\n isEditing: getIsEditing({\n id,\n collectionSlug: collectionConfig?.slug,\n globalSlug: globalConfig?.slug,\n }),\n })\n\n return {\n docPermissions,\n hasPublishPermission,\n hasSavePermission,\n }\n}\n"],"mappings":"AAQA,SACEA,iBAAA,IAAqBC,oBAAoB,EACzCC,SAAA,IAAaC,YAAY,QACpB;AACP,SAASC,kBAAkB,EAAEC,wBAAwB,EAAEC,QAAQ,QAAQ;AAEvE,OAAO,MAAMC,sBAAA,GAAyB,MAAOC,IAAA;EAW3C,MAAM;IAAEC,EAAE;IAAEC,gBAAgB;IAAEC,IAAA,GAAO,CAAC,CAAC;IAAEC,YAAY;IAAEC;EAAG,CAAE,GAAGL,IAAA;EAE/D,IAAIM,cAAA;EACJ,IAAIC,oBAAA,GAAuB;EAE3B,IAAIL,gBAAA,EAAkB;IACpB,IAAI;MACFI,cAAA,GAAiB,MAAMV,kBAAA,CAAmB;QACxCK,EAAA;QACAO,UAAA,EAAY;UACVC,MAAA,EAAQP;QACV;QACAG,GAAA,EAAK;UACH,GAAGA,GAAG;UACNF,IAAA,EAAM;YACJ,GAAGA,IAAI;YACPO,OAAA,EAAS;UACX;QACF;MACF;MAEA,IAAIR,gBAAA,CAAiBS,QAAQ,EAAEC,MAAA,EAAQ;QACrCL,oBAAA,GAAuB,MAAMX,kBAAA,CAAmB;UAC9CK,EAAA;UACAO,UAAA,EAAY;YACVC,MAAA,EAAQP;UACV;UACAG,GAAA,EAAK;YACH,GAAGA,GAAG;YACNF,IAAA,EAAM;cACJ,GAAGA,IAAI;cACPO,OAAA,EAAS;YACX;UACF;QACF,GAAGG,IAAI,CAAEC,WAAA,IAAgBA,WAAA,CAAYC,MAAM;MAC7C;IACF,EAAE,OAAOC,GAAA,EAAK;MACZlB,QAAA,CAAS;QAAEkB,GAAA;QAAKC,OAAA,EAASZ,GAAA,CAAIY;MAAQ;IACvC;EACF;EAEA,IAAIb,YAAA,EAAc;IAChB,IAAI;MACFE,cAAA,GAAiB,MAAMT,wBAAA,CAAyB;QAC9CO,YAAA;QACAC,GAAA,EAAK;UACH,GAAGA,GAAG;UACNF;QACF;MACF;MAEA,IAAIC,YAAA,CAAaO,QAAQ,EAAEC,MAAA,EAAQ;QACjCL,oBAAA,GAAuB,MAAMV,wBAAA,CAAyB;UACpDO,YAAA;UACAC,GAAA,EAAK;YACH,GAAGA,GAAG;YACNF,IAAA,EAAM;cACJ,GAAGA,IAAI;cACPO,OAAA,EAAS;YACX;UACF;QACF,GAAGG,IAAI,CAAEC,WAAA,IAAgBA,WAAA,CAAYC,MAAM;MAC7C;IACF,EAAE,OAAOC,GAAA,EAAK;MACZlB,QAAA,CAAS;QAAEkB,GAAA;QAAKC,OAAA,EAASZ,GAAA,CAAIY;MAAQ;IACvC;EACF;EAEA,MAAMzB,iBAAA,GAAoBC,oBAAA,CAAqB;IAC7CyB,cAAA,EAAgBhB,gBAAA,EAAkBiB,IAAA;IAClCb,cAAA;IACAc,UAAA,EAAYhB,YAAA,EAAce,IAAA;IAC1BzB,SAAA,EAAWC,YAAA,CAAa;MACtBM,EAAA;MACAiB,cAAA,EAAgBhB,gBAAA,EAAkBiB,IAAA;MAClCC,UAAA,EAAYhB,YAAA,EAAce;IAC5B;EACF;EAEA,OAAO;IACLb,cAAA;IACAC,oBAAA;IACAf;EACF;AACF","ignoreList":[]}
1
+ {"version":3,"file":"getDocumentPermissions.js","names":["hasSavePermission","getHasSavePermission","isEditing","getIsEditing","docAccessOperation","docAccessOperationGlobal","logError","getDocumentPermissions","args","id","collectionConfig","data","globalConfig","req","docPermissions","hasPublishPermission","collection","config","_status","versions","drafts","update","err","payload","collectionSlug","slug","globalSlug"],"sources":["../../../src/views/Document/getDocumentPermissions.tsx"],"sourcesContent":["import type {\n Data,\n PayloadRequest,\n SanitizedCollectionConfig,\n SanitizedDocumentPermissions,\n SanitizedGlobalConfig,\n} from 'payload'\n\nimport {\n hasSavePermission as getHasSavePermission,\n isEditing as getIsEditing,\n} from '@payloadcms/ui/shared'\nimport { docAccessOperation, docAccessOperationGlobal, logError } from 'payload'\n\nexport const getDocumentPermissions = async (args: {\n collectionConfig?: SanitizedCollectionConfig\n data: Data\n globalConfig?: SanitizedGlobalConfig\n /**\n * When called for creating a new document, id is not provided.\n */\n id?: number | string\n req: PayloadRequest\n}): Promise<{\n docPermissions: SanitizedDocumentPermissions\n hasPublishPermission: boolean\n hasSavePermission: boolean\n}> => {\n const { id, collectionConfig, data = {}, globalConfig, req } = args\n\n let docPermissions: SanitizedDocumentPermissions\n let hasPublishPermission = false\n\n if (collectionConfig) {\n try {\n docPermissions = await docAccessOperation({\n id,\n collection: {\n config: collectionConfig,\n },\n data: {\n ...data,\n _status: 'draft',\n },\n req,\n })\n\n if (collectionConfig.versions?.drafts) {\n hasPublishPermission = (\n await docAccessOperation({\n id,\n collection: {\n config: collectionConfig,\n },\n data: {\n ...data,\n _status: 'published',\n },\n req,\n })\n ).update\n }\n } catch (err) {\n logError({ err, payload: req.payload })\n }\n }\n\n if (globalConfig) {\n try {\n docPermissions = await docAccessOperationGlobal({\n data,\n globalConfig,\n req,\n })\n\n if (globalConfig.versions?.drafts) {\n hasPublishPermission = (\n await docAccessOperationGlobal({\n data: {\n ...data,\n _status: 'published',\n },\n globalConfig,\n req,\n })\n ).update\n }\n } catch (err) {\n logError({ err, payload: req.payload })\n }\n }\n\n const hasSavePermission = getHasSavePermission({\n collectionSlug: collectionConfig?.slug,\n docPermissions,\n globalSlug: globalConfig?.slug,\n isEditing: getIsEditing({\n id,\n collectionSlug: collectionConfig?.slug,\n globalSlug: globalConfig?.slug,\n }),\n })\n\n return {\n docPermissions,\n hasPublishPermission,\n hasSavePermission,\n }\n}\n"],"mappings":"AAQA,SACEA,iBAAA,IAAqBC,oBAAoB,EACzCC,SAAA,IAAaC,YAAY,QACp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AEgB,GAAA;QAAKC,OAAA,EAASV,GAAA,CAAIU;MAAQ;IACvC;EACF;EAEA,MAAMvB,iBAAA,GAAoBC,oBAAA,CAAqB;IAC7CuB,cAAA,EAAgBd,gBAAA,EAAkBe,IAAA;IAClCX,cAAA;IACAY,UAAA,EAAYd,YAAA,EAAca,IAAA;IAC1BvB,SAAA,EAAWC,YAAA,CAAa;MACtBM,EAAA;MACAe,cAAA,EAAgBd,gBAAA,EAAkBe,IAAA;MAClCC,UAAA,EAAYd,YAAA,EAAca;IAC5B;EACF;EAEA,OAAO;IACLX,cAAA;IACAC,oBAAA;IACAf;EACF;AACF","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/next",
3
- "version": "3.65.0-canary.6",
3
+ "version": "3.65.0-internal.d8c3085",
4
4
  "homepage": "https://payloadcms.com",
5
5
  "repository": {
6
6
  "type": "git",
@@ -97,9 +97,9 @@
97
97
  "qs-esm": "7.0.2",
98
98
  "sass": "1.77.4",
99
99
  "uuid": "10.0.0",
100
- "@payloadcms/graphql": "3.65.0-canary.6",
101
- "@payloadcms/translations": "3.65.0-canary.6",
102
- "@payloadcms/ui": "3.65.0-canary.6"
100
+ "@payloadcms/graphql": "3.65.0-internal.d8c3085",
101
+ "@payloadcms/translations": "3.65.0-internal.d8c3085",
102
+ "@payloadcms/ui": "3.65.0-internal.d8c3085"
103
103
  },
104
104
  "devDependencies": {
105
105
  "@babel/cli": "7.27.2",
@@ -116,13 +116,13 @@
116
116
  "esbuild": "0.25.5",
117
117
  "esbuild-sass-plugin": "3.3.1",
118
118
  "swc-plugin-transform-remove-imports": "4.0.4",
119
- "@payloadcms/eslint-config": "3.28.0",
120
- "payload": "3.65.0-canary.6"
119
+ "payload": "3.65.0-internal.d8c3085",
120
+ "@payloadcms/eslint-config": "3.28.0"
121
121
  },
122
122
  "peerDependencies": {
123
123
  "graphql": "^16.8.1",
124
124
  "next": "^15.2.3",
125
- "payload": "3.65.0-canary.6"
125
+ "payload": "3.65.0-internal.d8c3085"
126
126
  },
127
127
  "engines": {
128
128
  "node": "^18.20.2 || >=20.9.0"