@payloadcms/plugin-nested-docs 3.59.0-internal.fae0e05 → 3.59.0

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.
package/dist/types.d.ts CHANGED
@@ -1,11 +1,11 @@
1
- import type { CollectionSlug } from 'payload';
1
+ import type { CollectionSlug, SanitizedCollectionConfig } from 'payload';
2
2
  export type Breadcrumb = {
3
3
  doc: string;
4
4
  label: string;
5
5
  url?: string;
6
6
  };
7
- export type GenerateURL = (docs: Array<Record<string, unknown>>, currentDoc: Record<string, unknown>) => string;
8
- export type GenerateLabel = (docs: Array<Record<string, unknown>>, currentDoc: Record<string, unknown>) => string;
7
+ export type GenerateURL = (docs: Array<Record<string, unknown>>, currentDoc: Record<string, unknown>, collection: SanitizedCollectionConfig) => string;
8
+ export type GenerateLabel = (docs: Array<Record<string, unknown>>, currentDoc: Record<string, unknown>, collection: SanitizedCollectionConfig) => string;
9
9
  export type NestedDocsPluginConfig = {
10
10
  /**
11
11
  * Should be supplied if using an alternative field name for the 'breadcrumbs' field in collections
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAE7C,MAAM,MAAM,UAAU,GAAG;IACvB,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;IACb,GAAG,CAAC,EAAE,MAAM,CAAA;CACb,CAAA;AAED,MAAM,MAAM,WAAW,GAAG,CACxB,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EACpC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAChC,MAAM,CAAA;AAEX,MAAM,MAAM,aAAa,GAAG,CAC1B,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EACpC,UAAU,EAAE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EAAE,MAAM,CAAA;CACzB,CAAA"}
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type { CollectionSlug } from 'payload'\n\nexport type Breadcrumb = {\n doc: string\n label: string\n url?: string\n}\n\nexport type GenerateURL = (\n docs: Array<Record<string, unknown>>,\n currentDoc: Record<string, unknown>,\n) => string\n\nexport type GenerateLabel = (\n docs: Array<Record<string, unknown>>,\n currentDoc: Record<string, unknown>,\n) => string\n\nexport type NestedDocsPluginConfig = {\n /**\n * Should be supplied if using an alternative field name for the 'breadcrumbs' field in collections\n */\n breadcrumbsFieldSlug?: string\n /**\n * The slugs of the collections this plugin should extend. If you need different configs for different collections, this plugin can be added to your config more than once having different collections.\n */\n collections: CollectionSlug[]\n generateLabel?: GenerateLabel\n generateURL?: GenerateURL\n /**\n * Should be supplied if using an alternative field name for the 'parent' field in collections\n */\n parentFieldSlug?: string\n}\n"],"names":[],"mappings":"AAkBA,WAeC"}
1
+ {"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type { CollectionSlug, SanitizedCollectionConfig } from 'payload'\n\nexport type Breadcrumb = {\n doc: string\n label: string\n url?: string\n}\n\nexport type GenerateURL = (\n docs: Array<Record<string, unknown>>,\n currentDoc: Record<string, unknown>,\n collection: SanitizedCollectionConfig,\n) => string\n\nexport type GenerateLabel = (\n docs: Array<Record<string, unknown>>,\n currentDoc: Record<string, unknown>,\n collection: SanitizedCollectionConfig,\n) => string\n\nexport type NestedDocsPluginConfig = {\n /**\n * Should be supplied if using an alternative field name for the 'breadcrumbs' field in collections\n */\n breadcrumbsFieldSlug?: string\n /**\n * The slugs of the collections this plugin should extend. If you need different configs for different collections, this plugin can be added to your config more than once having different collections.\n */\n collections: CollectionSlug[]\n generateLabel?: GenerateLabel\n generateURL?: GenerateURL\n /**\n * Should be supplied if using an alternative field name for the 'parent' field in collections\n */\n parentFieldSlug?: string\n}\n"],"names":[],"mappings":"AAoBA,WAeC"}
@@ -3,10 +3,10 @@ export const formatBreadcrumb = ({ breadcrumb, collection, docs, generateLabel,
3
3
  let label;
4
4
  const lastDoc = docs[docs.length - 1];
5
5
  if (typeof generateURL === 'function') {
6
- url = generateURL(docs, lastDoc);
6
+ url = generateURL(docs, lastDoc, collection);
7
7
  }
8
8
  if (typeof generateLabel === 'function') {
9
- label = generateLabel(docs, lastDoc);
9
+ label = generateLabel(docs, lastDoc, collection);
10
10
  } else {
11
11
  const title = collection.admin?.useAsTitle ? lastDoc[collection.admin.useAsTitle] : '';
12
12
  label = typeof title === 'string' || typeof title === 'number' ? String(title) : '';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utilities/formatBreadcrumb.ts"],"sourcesContent":["import type { SanitizedCollectionConfig } from 'payload'\n\nimport type { Breadcrumb, GenerateLabel, GenerateURL } from '../types.js'\n\ntype Args = {\n /**\n * Existing breadcrumb, if any, to base the new breadcrumb on.\n * This ensures that row IDs are maintained across updates, etc.\n */\n breadcrumb?: Breadcrumb\n collection: SanitizedCollectionConfig\n docs: Record<string, unknown>[]\n generateLabel?: GenerateLabel\n generateURL?: GenerateURL\n}\n\nexport const formatBreadcrumb = ({\n breadcrumb,\n collection,\n docs,\n generateLabel,\n generateURL,\n}: Args): Breadcrumb => {\n let url: string | undefined = undefined\n let label: string\n\n const lastDoc = docs[docs.length - 1]!\n\n if (typeof generateURL === 'function') {\n url = generateURL(docs, lastDoc)\n }\n\n if (typeof generateLabel === 'function') {\n label = generateLabel(docs, lastDoc)\n } else {\n const title = collection.admin?.useAsTitle ? lastDoc[collection.admin.useAsTitle] : ''\n\n label = typeof title === 'string' || typeof title === 'number' ? String(title) : ''\n }\n\n return {\n ...(breadcrumb || {}),\n doc: lastDoc.id as string,\n label,\n url,\n }\n}\n"],"names":["formatBreadcrumb","breadcrumb","collection","docs","generateLabel","generateURL","url","undefined","label","lastDoc","length","title","admin","useAsTitle","String","doc","id"],"mappings":"AAgBA,OAAO,MAAMA,mBAAmB,CAAC,EAC/BC,UAAU,EACVC,UAAU,EACVC,IAAI,EACJC,aAAa,EACbC,WAAW,EACN;IACL,IAAIC,MAA0BC;IAC9B,IAAIC;IAEJ,MAAMC,UAAUN,IAAI,CAACA,KAAKO,MAAM,GAAG,EAAE;IAErC,IAAI,OAAOL,gBAAgB,YAAY;QACrCC,MAAMD,YAAYF,MAAMM;IAC1B;IAEA,IAAI,OAAOL,kBAAkB,YAAY;QACvCI,QAAQJ,cAAcD,MAAMM;IAC9B,OAAO;QACL,MAAME,QAAQT,WAAWU,KAAK,EAAEC,aAAaJ,OAAO,CAACP,WAAWU,KAAK,CAACC,UAAU,CAAC,GAAG;QAEpFL,QAAQ,OAAOG,UAAU,YAAY,OAAOA,UAAU,WAAWG,OAAOH,SAAS;IACnF;IAEA,OAAO;QACL,GAAIV,cAAc,CAAC,CAAC;QACpBc,KAAKN,QAAQO,EAAE;QACfR;QACAF;IACF;AACF,EAAC"}
1
+ {"version":3,"sources":["../../src/utilities/formatBreadcrumb.ts"],"sourcesContent":["import type { SanitizedCollectionConfig } from 'payload'\n\nimport type { Breadcrumb, GenerateLabel, GenerateURL } from '../types.js'\n\ntype Args = {\n /**\n * Existing breadcrumb, if any, to base the new breadcrumb on.\n * This ensures that row IDs are maintained across updates, etc.\n */\n breadcrumb?: Breadcrumb\n collection: SanitizedCollectionConfig\n docs: Record<string, unknown>[]\n generateLabel?: GenerateLabel\n generateURL?: GenerateURL\n}\n\nexport const formatBreadcrumb = ({\n breadcrumb,\n collection,\n docs,\n generateLabel,\n generateURL,\n}: Args): Breadcrumb => {\n let url: string | undefined = undefined\n let label: string\n\n const lastDoc = docs[docs.length - 1]!\n\n if (typeof generateURL === 'function') {\n url = generateURL(docs, lastDoc, collection)\n }\n\n if (typeof generateLabel === 'function') {\n label = generateLabel(docs, lastDoc, collection)\n } else {\n const title = collection.admin?.useAsTitle ? lastDoc[collection.admin.useAsTitle] : ''\n\n label = typeof title === 'string' || typeof title === 'number' ? String(title) : ''\n }\n\n return {\n ...(breadcrumb || {}),\n doc: lastDoc.id as string,\n label,\n url,\n }\n}\n"],"names":["formatBreadcrumb","breadcrumb","collection","docs","generateLabel","generateURL","url","undefined","label","lastDoc","length","title","admin","useAsTitle","String","doc","id"],"mappings":"AAgBA,OAAO,MAAMA,mBAAmB,CAAC,EAC/BC,UAAU,EACVC,UAAU,EACVC,IAAI,EACJC,aAAa,EACbC,WAAW,EACN;IACL,IAAIC,MAA0BC;IAC9B,IAAIC;IAEJ,MAAMC,UAAUN,IAAI,CAACA,KAAKO,MAAM,GAAG,EAAE;IAErC,IAAI,OAAOL,gBAAgB,YAAY;QACrCC,MAAMD,YAAYF,MAAMM,SAASP;IACnC;IAEA,IAAI,OAAOE,kBAAkB,YAAY;QACvCI,QAAQJ,cAAcD,MAAMM,SAASP;IACvC,OAAO;QACL,MAAMS,QAAQT,WAAWU,KAAK,EAAEC,aAAaJ,OAAO,CAACP,WAAWU,KAAK,CAACC,UAAU,CAAC,GAAG;QAEpFL,QAAQ,OAAOG,UAAU,YAAY,OAAOA,UAAU,WAAWG,OAAOH,SAAS;IACnF;IAEA,OAAO;QACL,GAAIV,cAAc,CAAC,CAAC;QACpBc,KAAKN,QAAQO,EAAE;QACfR;QACAF;IACF;AACF,EAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/plugin-nested-docs",
3
- "version": "3.59.0-internal.fae0e05",
3
+ "version": "3.59.0",
4
4
  "description": "The official Nested Docs plugin for Payload",
5
5
  "homepage": "https://payloadcms.com",
6
6
  "repository": {
@@ -38,10 +38,10 @@
38
38
  ],
39
39
  "devDependencies": {
40
40
  "@payloadcms/eslint-config": "3.28.0",
41
- "payload": "3.59.0-internal.fae0e05"
41
+ "payload": "3.59.0"
42
42
  },
43
43
  "peerDependencies": {
44
- "payload": "3.59.0-internal.fae0e05"
44
+ "payload": "3.59.0"
45
45
  },
46
46
  "publishConfig": {
47
47
  "registry": "https://registry.npmjs.org/"