payload 3.3.0 → 3.4.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.
@@ -1 +1 @@
1
- {"version":3,"file":"forgotPassword.d.ts","sourceRoot":"","sources":["../../../src/auth/operations/forgotPassword.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,gCAAgC,EAChC,UAAU,EACX,MAAM,mCAAmC,CAAA;AAC1C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,KAAK,EAAE,cAAc,EAAS,MAAM,sBAAsB,CAAA;AAUjE,MAAM,MAAM,SAAS,CAAC,KAAK,SAAS,cAAc,IAAI;IACpD,UAAU,EAAE,UAAU,CAAA;IACtB,IAAI,EAAE;QACJ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KACvB,GAAG,gCAAgC,CAAC,KAAK,CAAC,CAAC,gBAAgB,CAAC,CAAA;IAC7D,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,GAAG,EAAE,cAAc,CAAA;CACpB,CAAA;AAED,MAAM,MAAM,MAAM,GAAG,MAAM,CAAA;AAE3B,eAAO,MAAM,uBAAuB,GAAU,KAAK,SAAS,cAAc,gBAC1D,SAAS,CAAC,KAAK,CAAC,KAC7B,OAAO,CAAC,IAAI,GAAG,MAAM,CAoLvB,CAAA"}
1
+ {"version":3,"file":"forgotPassword.d.ts","sourceRoot":"","sources":["../../../src/auth/operations/forgotPassword.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,gCAAgC,EAChC,UAAU,EACX,MAAM,mCAAmC,CAAA;AAC1C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,KAAK,EAAE,cAAc,EAAS,MAAM,sBAAsB,CAAA;AAUjE,MAAM,MAAM,SAAS,CAAC,KAAK,SAAS,cAAc,IAAI;IACpD,UAAU,EAAE,UAAU,CAAA;IACtB,IAAI,EAAE;QACJ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KACvB,GAAG,gCAAgC,CAAC,KAAK,CAAC,CAAC,gBAAgB,CAAC,CAAA;IAC7D,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,GAAG,EAAE,cAAc,CAAA;CACpB,CAAA;AAED,MAAM,MAAM,MAAM,GAAG,MAAM,CAAA;AAE3B,eAAO,MAAM,uBAAuB,GAAU,KAAK,SAAS,cAAc,gBAC1D,SAAS,CAAC,KAAK,CAAC,KAC7B,OAAO,CAAC,IAAI,GAAG,MAAM,CAsLvB,CAAA"}
@@ -70,7 +70,7 @@ export const forgotPasswordOperation = async (incomingArgs)=>{
70
70
  return null;
71
71
  }
72
72
  user.resetPasswordToken = token;
73
- user.resetPasswordExpiration = new Date(expiration || Date.now() + 3600000).toISOString() // 1 hour
73
+ user.resetPasswordExpiration = new Date(collectionConfig.auth?.forgotPassword?.expiration || expiration || Date.now() + 3600000).toISOString() // 1 hour
74
74
  ;
75
75
  user = await payload.update({
76
76
  id: user.id,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/auth/operations/forgotPassword.ts"],"sourcesContent":["import crypto from 'crypto'\nimport httpStatus from 'http-status'\nimport { URL } from 'url'\n\nimport type {\n AuthOperationsFromCollectionSlug,\n Collection,\n} from '../../collections/config/types.js'\nimport type { CollectionSlug } from '../../index.js'\nimport type { PayloadRequest, Where } from '../../types/index.js'\n\nimport { buildAfterOperation } from '../../collections/operations/utils.js'\nimport { APIError } from '../../errors/index.js'\nimport { Forbidden } from '../../index.js'\nimport { commitTransaction } from '../../utilities/commitTransaction.js'\nimport { initTransaction } from '../../utilities/initTransaction.js'\nimport { killTransaction } from '../../utilities/killTransaction.js'\nimport { getLoginOptions } from '../getLoginOptions.js'\n\nexport type Arguments<TSlug extends CollectionSlug> = {\n collection: Collection\n data: {\n [key: string]: unknown\n } & AuthOperationsFromCollectionSlug<TSlug>['forgotPassword']\n disableEmail?: boolean\n expiration?: number\n req: PayloadRequest\n}\n\nexport type Result = string\n\nexport const forgotPasswordOperation = async <TSlug extends CollectionSlug>(\n incomingArgs: Arguments<TSlug>,\n): Promise<null | string> => {\n const loginWithUsername = incomingArgs.collection.config.auth.loginWithUsername\n const { data } = incomingArgs\n\n const { canLoginWithEmail, canLoginWithUsername } = getLoginOptions(loginWithUsername)\n\n const sanitizedEmail =\n (canLoginWithEmail && (incomingArgs.data.email || '').toLowerCase().trim()) || null\n const sanitizedUsername =\n 'username' in data && typeof data?.username === 'string'\n ? data.username.toLowerCase().trim()\n : null\n\n let args = incomingArgs\n\n if (incomingArgs.collection.config.auth.disableLocalStrategy) {\n throw new Forbidden(incomingArgs.req.t)\n }\n if (!sanitizedEmail && !sanitizedUsername) {\n throw new APIError(\n `Missing ${loginWithUsername ? 'username' : 'email'}.`,\n httpStatus.BAD_REQUEST,\n )\n }\n\n try {\n const shouldCommit = await initTransaction(args.req)\n\n // /////////////////////////////////////\n // beforeOperation - Collection\n // /////////////////////////////////////\n\n await args.collection.config.hooks.beforeOperation.reduce(async (priorHook, hook) => {\n await priorHook\n\n args =\n (await hook({\n args,\n collection: args.collection?.config,\n context: args.req.context,\n operation: 'forgotPassword',\n req: args.req,\n })) || args\n }, Promise.resolve())\n\n const {\n collection: { config: collectionConfig },\n disableEmail,\n expiration,\n req: {\n payload: { config, email },\n payload,\n },\n req,\n } = args\n\n // /////////////////////////////////////\n // Forget password\n // /////////////////////////////////////\n\n let token: string = crypto.randomBytes(20).toString('hex')\n type UserDoc = {\n email?: string\n id: number | string\n resetPasswordExpiration?: string\n resetPasswordToken?: string\n }\n\n if (!sanitizedEmail && !sanitizedUsername) {\n throw new APIError(\n `Missing ${loginWithUsername ? 'username' : 'email'}.`,\n httpStatus.BAD_REQUEST,\n )\n }\n\n let whereConstraint: Where = {}\n\n if (canLoginWithEmail && sanitizedEmail) {\n whereConstraint = {\n email: {\n equals: sanitizedEmail,\n },\n }\n } else if (canLoginWithUsername && sanitizedUsername) {\n whereConstraint = {\n username: {\n equals: sanitizedUsername,\n },\n }\n }\n\n let user = await payload.db.findOne<UserDoc>({\n collection: collectionConfig.slug,\n req,\n where: whereConstraint,\n })\n\n // We don't want to indicate specifically that an email was not found,\n // as doing so could lead to the exposure of registered emails.\n // Therefore, we prefer to fail silently.\n if (!user) {\n return null\n }\n\n user.resetPasswordToken = token\n user.resetPasswordExpiration = new Date(expiration || Date.now() + 3600000).toISOString() // 1 hour\n\n user = await payload.update({\n id: user.id,\n collection: collectionConfig.slug,\n data: user,\n req,\n })\n\n if (!disableEmail && user.email) {\n const protocol = new URL(req.url).protocol // includes the final :\n const serverURL =\n config.serverURL !== null && config.serverURL !== ''\n ? config.serverURL\n : `${protocol}//${req.headers.get('host')}`\n\n let html = `${req.t('authentication:youAreReceivingResetPassword')}\n <a href=\"${serverURL}${config.routes.admin}${config.admin.routes.reset}/${token}\">${serverURL}${config.routes.admin}${config.admin.routes.reset}/${token}</a>\n ${req.t('authentication:youDidNotRequestPassword')}`\n\n if (typeof collectionConfig.auth.forgotPassword?.generateEmailHTML === 'function') {\n html = await collectionConfig.auth.forgotPassword.generateEmailHTML({\n req,\n token,\n user,\n })\n }\n\n let subject = req.t('authentication:resetYourPassword')\n\n if (typeof collectionConfig.auth.forgotPassword?.generateEmailSubject === 'function') {\n subject = await collectionConfig.auth.forgotPassword.generateEmailSubject({\n req,\n token,\n user,\n })\n }\n\n await email.sendEmail({\n from: `\"${email.defaultFromName}\" <${email.defaultFromAddress}>`,\n html,\n subject,\n to: user.email,\n })\n }\n\n // /////////////////////////////////////\n // afterForgotPassword - Collection\n // /////////////////////////////////////\n\n await collectionConfig.hooks.afterForgotPassword.reduce(async (priorHook, hook) => {\n await priorHook\n await hook({ args, collection: args.collection?.config, context: req.context })\n }, Promise.resolve())\n\n // /////////////////////////////////////\n // afterOperation - Collection\n // /////////////////////////////////////\n\n token = await buildAfterOperation({\n args,\n collection: args.collection?.config,\n operation: 'forgotPassword',\n result: token,\n })\n\n if (shouldCommit) {\n await commitTransaction(req)\n }\n\n return token\n } catch (error: unknown) {\n await killTransaction(args.req)\n throw error\n }\n}\n"],"names":["crypto","httpStatus","URL","buildAfterOperation","APIError","Forbidden","commitTransaction","initTransaction","killTransaction","getLoginOptions","forgotPasswordOperation","incomingArgs","loginWithUsername","collection","config","auth","data","canLoginWithEmail","canLoginWithUsername","sanitizedEmail","email","toLowerCase","trim","sanitizedUsername","username","args","disableLocalStrategy","req","t","BAD_REQUEST","shouldCommit","hooks","beforeOperation","reduce","priorHook","hook","context","operation","Promise","resolve","collectionConfig","disableEmail","expiration","payload","token","randomBytes","toString","whereConstraint","equals","user","db","findOne","slug","where","resetPasswordToken","resetPasswordExpiration","Date","now","toISOString","update","id","protocol","url","serverURL","headers","get","html","routes","admin","reset","forgotPassword","generateEmailHTML","subject","generateEmailSubject","sendEmail","from","defaultFromName","defaultFromAddress","to","afterForgotPassword","result","error"],"mappings":"AAAA,OAAOA,YAAY,SAAQ;AAC3B,OAAOC,gBAAgB,cAAa;AACpC,SAASC,GAAG,QAAQ,MAAK;AASzB,SAASC,mBAAmB,QAAQ,wCAAuC;AAC3E,SAASC,QAAQ,QAAQ,wBAAuB;AAChD,SAASC,SAAS,QAAQ,iBAAgB;AAC1C,SAASC,iBAAiB,QAAQ,uCAAsC;AACxE,SAASC,eAAe,QAAQ,qCAAoC;AACpE,SAASC,eAAe,QAAQ,qCAAoC;AACpE,SAASC,eAAe,QAAQ,wBAAuB;AAcvD,OAAO,MAAMC,0BAA0B,OACrCC;IAEA,MAAMC,oBAAoBD,aAAaE,UAAU,CAACC,MAAM,CAACC,IAAI,CAACH,iBAAiB;IAC/E,MAAM,EAAEI,IAAI,EAAE,GAAGL;IAEjB,MAAM,EAAEM,iBAAiB,EAAEC,oBAAoB,EAAE,GAAGT,gBAAgBG;IAEpE,MAAMO,iBACJ,AAACF,qBAAqB,AAACN,CA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;QAEA,IAAId,cAAc;YAChB,MAAMxB,kBAAkBqB;QAC1B;QAEA,OAAOiB;IACT,EAAE,OAAOqC,OAAgB;QACvB,MAAMzE,gBAAgBiB,KAAKE,GAAG;QAC9B,MAAMsD;IACR;AACF,EAAC"}
1
+ {"version":3,"sources":["../../../src/auth/operations/forgotPassword.ts"],"sourcesContent":["import crypto from 'crypto'\nimport httpStatus from 'http-status'\nimport { URL } from 'url'\n\nimport type {\n AuthOperationsFromCollectionSlug,\n Collection,\n} from '../../collections/config/types.js'\nimport type { CollectionSlug } from '../../index.js'\nimport type { PayloadRequest, Where } from '../../types/index.js'\n\nimport { buildAfterOperation } from '../../collections/operations/utils.js'\nimport { APIError } from '../../errors/index.js'\nimport { Forbidden } from '../../index.js'\nimport { commitTransaction } from '../../utilities/commitTransaction.js'\nimport { initTransaction } from '../../utilities/initTransaction.js'\nimport { killTransaction } from '../../utilities/killTransaction.js'\nimport { getLoginOptions } from '../getLoginOptions.js'\n\nexport type Arguments<TSlug extends CollectionSlug> = {\n collection: Collection\n data: {\n [key: string]: unknown\n } & AuthOperationsFromCollectionSlug<TSlug>['forgotPassword']\n disableEmail?: boolean\n expiration?: number\n req: PayloadRequest\n}\n\nexport type Result = string\n\nexport const forgotPasswordOperation = async <TSlug extends CollectionSlug>(\n incomingArgs: Arguments<TSlug>,\n): Promise<null | string> => {\n const loginWithUsername = incomingArgs.collection.config.auth.loginWithUsername\n const { data } = incomingArgs\n\n const { canLoginWithEmail, canLoginWithUsername } = getLoginOptions(loginWithUsername)\n\n const sanitizedEmail =\n (canLoginWithEmail && (incomingArgs.data.email || '').toLowerCase().trim()) || null\n const sanitizedUsername =\n 'username' in data && typeof data?.username === 'string'\n ? data.username.toLowerCase().trim()\n : null\n\n let args = incomingArgs\n\n if (incomingArgs.collection.config.auth.disableLocalStrategy) {\n throw new Forbidden(incomingArgs.req.t)\n }\n if (!sanitizedEmail && !sanitizedUsername) {\n throw new APIError(\n `Missing ${loginWithUsername ? 'username' : 'email'}.`,\n httpStatus.BAD_REQUEST,\n )\n }\n\n try {\n const shouldCommit = await initTransaction(args.req)\n\n // /////////////////////////////////////\n // beforeOperation - Collection\n // /////////////////////////////////////\n\n await args.collection.config.hooks.beforeOperation.reduce(async (priorHook, hook) => {\n await priorHook\n\n args =\n (await hook({\n args,\n collection: args.collection?.config,\n context: args.req.context,\n operation: 'forgotPassword',\n req: args.req,\n })) || args\n }, Promise.resolve())\n\n const {\n collection: { config: collectionConfig },\n disableEmail,\n expiration,\n req: {\n payload: { config, email },\n payload,\n },\n req,\n } = args\n\n // /////////////////////////////////////\n // Forget password\n // /////////////////////////////////////\n\n let token: string = crypto.randomBytes(20).toString('hex')\n type UserDoc = {\n email?: string\n id: number | string\n resetPasswordExpiration?: string\n resetPasswordToken?: string\n }\n\n if (!sanitizedEmail && !sanitizedUsername) {\n throw new APIError(\n `Missing ${loginWithUsername ? 'username' : 'email'}.`,\n httpStatus.BAD_REQUEST,\n )\n }\n\n let whereConstraint: Where = {}\n\n if (canLoginWithEmail && sanitizedEmail) {\n whereConstraint = {\n email: {\n equals: sanitizedEmail,\n },\n }\n } else if (canLoginWithUsername && sanitizedUsername) {\n whereConstraint = {\n username: {\n equals: sanitizedUsername,\n },\n }\n }\n\n let user = await payload.db.findOne<UserDoc>({\n collection: collectionConfig.slug,\n req,\n where: whereConstraint,\n })\n\n // We don't want to indicate specifically that an email was not found,\n // as doing so could lead to the exposure of registered emails.\n // Therefore, we prefer to fail silently.\n if (!user) {\n return null\n }\n\n user.resetPasswordToken = token\n user.resetPasswordExpiration = new Date(\n collectionConfig.auth?.forgotPassword?.expiration || expiration || Date.now() + 3600000,\n ).toISOString() // 1 hour\n\n user = await payload.update({\n id: user.id,\n collection: collectionConfig.slug,\n data: user,\n req,\n })\n\n if (!disableEmail && user.email) {\n const protocol = new URL(req.url).protocol // includes the final :\n const serverURL =\n config.serverURL !== null && config.serverURL !== ''\n ? config.serverURL\n : `${protocol}//${req.headers.get('host')}`\n\n let html = `${req.t('authentication:youAreReceivingResetPassword')}\n <a href=\"${serverURL}${config.routes.admin}${config.admin.routes.reset}/${token}\">${serverURL}${config.routes.admin}${config.admin.routes.reset}/${token}</a>\n ${req.t('authentication:youDidNotRequestPassword')}`\n\n if (typeof collectionConfig.auth.forgotPassword?.generateEmailHTML === 'function') {\n html = await collectionConfig.auth.forgotPassword.generateEmailHTML({\n req,\n token,\n user,\n })\n }\n\n let subject = req.t('authentication:resetYourPassword')\n\n if (typeof collectionConfig.auth.forgotPassword?.generateEmailSubject === 'function') {\n subject = await collectionConfig.auth.forgotPassword.generateEmailSubject({\n req,\n token,\n user,\n })\n }\n\n await email.sendEmail({\n from: `\"${email.defaultFromName}\" <${email.defaultFromAddress}>`,\n html,\n subject,\n to: user.email,\n })\n }\n\n // /////////////////////////////////////\n // afterForgotPassword - Collection\n // /////////////////////////////////////\n\n await collectionConfig.hooks.afterForgotPassword.reduce(async (priorHook, hook) => {\n await priorHook\n await hook({ args, collection: args.collection?.config, context: req.context })\n }, Promise.resolve())\n\n // /////////////////////////////////////\n // afterOperation - Collection\n // /////////////////////////////////////\n\n token = await buildAfterOperation({\n args,\n collection: args.collection?.config,\n operation: 'forgotPassword',\n result: token,\n })\n\n if (shouldCommit) {\n await commitTransaction(req)\n }\n\n return token\n } catch (error: unknown) {\n await killTransaction(args.req)\n throw error\n }\n}\n"],"names":["crypto","httpStatus","URL","buildAfterOperation","APIError","Forbidden","commitTransaction","initTransaction","killTransaction","getLoginOptions","forgotPasswordOperation","incomingArgs","loginWithUsername","collection","config","auth","data","canLoginWithEmail","canLoginWithUsername","sanitizedEmail","email","toLowerCase","trim","sanitizedUsername","username","args","disableLocalStrategy","req","t","BAD_REQUEST","shouldCommit","hooks","beforeOperation","reduce","priorHook","hook","context","operation","Promise","resolve","collectionConfig","disableEmail","expiration","payload","token","randomBytes","toString","whereConstraint","equals","user","db","findOne","slug","where","resetPasswordToken","resetPasswordExpiration","Date","forgotPassword","now","toISOString","update","id","protocol","url","serverURL","headers","get","html","routes","admin","reset","generateEmailHTML","subject","generateEmailSubject","sendEmail","from","defaultFromName","defaultFromAddress","to","afterForgotPassword","result","error"],"mappings":"AAAA,OAAOA,YAAY,SAAQ;AAC3B,OAAOC,gBAAgB,cAAa;AACpC,SAASC,GAAG,QAAQ,MAAK;AASzB,SAASC,mBAAmB,QAAQ,wCAAuC;AAC3E,SAASC,QAAQ,QAAQ,wBAAuB;AAChD,SAASC,SAAS,QAAQ,iBAAgB;AAC1C,SAASC,iBAAiB,QAAQ,uCAAsC;AACxE,SAASC,eAAe,QAAQ,qCAAoC;AACpE,SAASC,eAAe,QAAQ,qCAAoC;AACpE,SAASC,eAAe,QAAQ,wBAAuB;AAcvD,OAAO,MAAMC,0BAA0B,OACrCC;IAEA,MAAMC,oBAAoBD,aAAaE,UAAU,CAACC,MAAM,CAACC,IAAI,CAACH,iBAAiB;IAC/E,MAAM,EAAEI,IAAI,EAAE,GAAGL;IAEjB,MAAM,EAAEM,iBAAiB,EAAEC,oBAAoB,EAAE,GAAGT,gBAAgBG;IAEpE,MAAMO,iBACJ,AAACF,qBAAqB,AAACN,CAAAA,aAAaK,IAAI,CAACI,KAAK,IAAI,EAAC,EAAGC,WAAW,GAAGC,IAAI,MAAO;IACjF,MAAMC,oBACJ,cAAcP,QAAQ,OAAOA,MAAMQ,aAAa,WAC5CR,KAAKQ,QAAQ,CAACH,WAAW,GAAGC,IAAI,KAChC;IAEN,IAAIG,OAAOd;IAEX,IAAIA,aAAaE,UAAU,CAACC,MAAM,CAACC,IAAI,CAACW,oBAAoB,EAAE;QAC5D,MAAM,IAAIrB,UAAUM,aAAagB,GAAG,CAACC,CAAC;IACxC;IACA,IAAI,CAACT,kBAAkB,CAACI,mBAAmB;QACzC,MAAM,IAAInB,SACR,CAAC,QAAQ,EAAEQ,oBAAoB,aAAa,QAAQ,CAAC,CAAC,EACtDX,WAAW4B,WAAW;IAE1B;IAEA,IAAI;QACF,MAAMC,eAAe,MAAMvB,gBAAgBkB,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c,EAAEgB,yBAAyB,YAAY;gBACpFD,UAAU,MAAMhC,iBAAiBzB,IAAI,CAAC0C,cAAc,CAACgB,oBAAoB,CAAC;oBACxE9C;oBACAiB;oBACAK;gBACF;YACF;YAEA,MAAM7B,MAAMsD,SAAS,CAAC;gBACpBC,MAAM,CAAC,CAAC,EAAEvD,MAAMwD,eAAe,CAAC,GAAG,EAAExD,MAAMyD,kBAAkB,CAAC,CAAC,CAAC;gBAChEV;gBACAK;gBACAM,IAAI7B,KAAK7B,KAAK;YAChB;QACF;QAEA,wCAAwC;QACxC,mCAAmC;QACnC,wCAAwC;QAExC,MAAMoB,iBAAiBT,KAAK,CAACgD,mBAAmB,CAAC9C,MAAM,CAAC,OAAOC,WAAWC;YACxE,MAAMD;YACN,MAAMC,KAAK;gBAAEV;gBAAMZ,YAAYY,KAAKZ,UAAU,EAAEC;gBAAQsB,SAAST,IAAIS,OAAO;YAAC;QAC/E,GAAGE,QAAQC,OAAO;QAElB,wCAAwC;QACxC,8BAA8B;QAC9B,wCAAwC;QAExCK,QAAQ,MAAMzC,oBAAoB;YAChCsB;YACAZ,YAAYY,KAAKZ,UAAU,EAAEC;YAC7BuB,WAAW;YACX2C,QAAQpC;QACV;QAEA,IAAId,cAAc;YAChB,MAAMxB,kBAAkBqB;QAC1B;QAEA,OAAOiB;IACT,EAAE,OAAOqC,OAAgB;QACvB,MAAMzE,gBAAgBiB,KAAKE,GAAG;QAC9B,MAAMsD;IACR;AACF,EAAC"}
@@ -176,6 +176,11 @@ export interface IncomingAuthType {
176
176
  * @link https://payloadcms.com/docs/authentication/email#forgot-password
177
177
  */
178
178
  forgotPassword?: {
179
+ /**
180
+ * The number of milliseconds that the forgot password token should be valid for.
181
+ * @default 3600000 // 1 hour
182
+ */
183
+ expiration?: number;
179
184
  generateEmailHTML?: GenerateForgotPasswordEmailHTML;
180
185
  generateEmailSubject?: GenerateForgotPasswordEmailSubject;
181
186
  };
@@ -229,6 +234,7 @@ export type VerifyConfig = {
229
234
  };
230
235
  export interface Auth extends Omit<DeepRequired<IncomingAuthType>, 'forgotPassword' | 'loginWithUsername' | 'verify'> {
231
236
  forgotPassword?: {
237
+ expiration?: number;
232
238
  generateEmailHTML?: GenerateForgotPasswordEmailHTML;
233
239
  generateEmailSubject?: GenerateForgotPasswordEmailSubject;
234
240
  };
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/auth/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAEjD,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AACtE,OAAO,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAE9D;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,UAAU,EAAE,OAAO,CAAA;IACnB,KAAK,CAAC,EAAE,KAAK,CAAA;CACd,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,CAAC,SAAS,EAAE,MAAM,GAAG,gBAAgB,CAAA;CACtC,CAAA;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,EAAE,UAAU,CAAA;IAClB,MAAM,EAAE,iBAAiB,CAAA;IACzB,IAAI,EAAE,UAAU,CAAA;IAChB,MAAM,EAAE,UAAU,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,yBAAyB,GACjC;IACE,MAAM,EAAE,0BAA0B,CAAA;CACnC,GACD,IAAI,CAAA;AAER,MAAM,MAAM,iBAAiB,GAAG;IAC9B,CAAC,SAAS,EAAE,MAAM,GAAG,gBAAgB,CAAA;CACtC,CAAA;AAED,MAAM,MAAM,0BAA0B,GAClC;IACE,CAAC,SAAS,EAAE,MAAM,GAAG,yBAAyB,CAAA;CAC/C,GACD,IAAI,CAAA;AAER,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,CAAC,EAAE,iBAAiB,CAAA;IAC1B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ts-essentials'\n\nimport type { CollectionSlug, GlobalSlug, Payload } from '../index.js'\nimport type { PayloadRequest, Where } from '../types/index.js'\n\n/**\n * A permission object that can be used to determine if a user has access to a specific operation.\n */\nexport type Permission = {\n permission: boolean\n where?: Where\n}\n\nexport type FieldsPermissions = {\n [fieldName: string]: FieldPermissions\n}\n\nexport type BlockPermissions = {\n create: Permission\n fields: FieldsPermissions\n read: Permission\n update: Permission\n}\n\nexport type SanitizedBlockPermissions =\n | {\n fields: SanitizedFieldsPermissions\n }\n | true\n\nexport type BlocksPermissions = {\n [blockSlug: string]: BlockPermissions\n}\n\nexport type SanitizedBlocksPermissions =\n | {\n [blockSlug: string]: SanitizedBlockPermissions\n }\n | true\n\nexport type FieldPermissions = {\n blocks?: BlocksPermissions\n create: Permission\n fields?: FieldsPermissions\n read: Permission\n update: Permission\n}\n\nexport type SanitizedFieldPermissions =\n | {\n blocks?: SanitizedBlocksPermissions\n create: true\n fields?: SanitizedFieldsPermissions\n read: true\n update: true\n }\n | true\n\nexport type SanitizedFieldsPermissions =\n | {\n [fieldName: string]: SanitizedFieldPermissions\n }\n | true\n\nexport type CollectionPermission = {\n create: Permission\n delete: Permission\n fields: FieldsPermissions\n read: Permission\n readVersions?: Permission\n update: Permission\n}\n\nexport type SanitizedCollectionPermission = {\n create?: true\n delete?: true\n fields: SanitizedFieldsPermissions\n read?: true\n readVersions?: true\n update?: true\n}\n\nexport type GlobalPermission = {\n fields: FieldsPermissions\n read: Permission\n readVersions?: Permission\n update: Permission\n}\n\nexport type SanitizedGlobalPermission = {\n fields: SanitizedFieldsPermissions\n read?: true\n readVersions?: true\n update?: true\n}\n\nexport type DocumentPermissions = CollectionPermission | GlobalPermission\n\nexport type SanitizedDocumentPermissions = SanitizedCollectionPermission | SanitizedGlobalPermission\n\nexport type Permissions = {\n canAccessAdmin: boolean\n collections?: Record<CollectionSlug, CollectionPermission>\n globals?: Record<GlobalSlug, GlobalPermission>\n}\n\nexport type SanitizedPermissions = {\n canAccessAdmin?: boolean\n collections?: {\n [collectionSlug: string]: SanitizedCollectionPermission\n }\n globals?: {\n [globalSlug: string]: SanitizedGlobalPermission\n }\n}\n\ntype BaseUser = {\n collection: string\n email?: string\n id: number | string\n username?: string\n}\n\nexport type User = {\n [key: string]: any\n} & BaseUser\n\n/**\n * `collection` is not available one the client. It's only available on the server (req.user)\n * On the client, you can access the collection via config.admin.user. Config can be accessed using the useConfig() hook\n */\nexport type ClientUser = {\n [key: string]: any\n} & BaseUser\n\ntype GenerateVerifyEmailHTML<TUser = any> = (args: {\n req: PayloadRequest\n token: string\n user: TUser\n}) => Promise<string> | string\n\ntype GenerateVerifyEmailSubject<TUser = any> = (args: {\n req: PayloadRequest\n token: string\n user: TUser\n}) => Promise<string> | string\n\ntype GenerateForgotPasswordEmailHTML<TUser = any> = (args?: {\n req?: PayloadRequest\n token?: string\n user?: TUser\n}) => Promise<string> | string\n\ntype GenerateForgotPasswordEmailSubject<TUser = any> = (args?: {\n req?: PayloadRequest\n token?: string\n user?: TUser\n}) => Promise<string> | string\n\nexport type AuthStrategyFunctionArgs = {\n headers: Request['headers']\n isGraphQL?: boolean\n payload: Payload\n}\n\nexport type AuthStrategyResult = {\n responseHeaders?: Headers\n user: null | User\n}\n\nexport type AuthStrategyFunction = (\n args: AuthStrategyFunctionArgs,\n) => AuthStrategyResult | Promise<AuthStrategyResult>\nexport type AuthStrategy = {\n authenticate: AuthStrategyFunction\n name: string\n}\n\nexport type LoginWithUsernameOptions =\n | {\n allowEmailLogin?: false\n requireEmail?: boolean\n // If `allowEmailLogin` is false, `requireUsername` must be true (default: true)\n requireUsername?: true\n }\n | {\n allowEmailLogin?: true\n requireEmail?: boolean\n requireUsername?: boolean\n }\n\nexport interface IncomingAuthType {\n /**\n * Set cookie options, including secure, sameSite, and domain. For advanced users.\n */\n cookies?: {\n domain?: string\n sameSite?: 'Lax' | 'None' | 'Strict' | boolean\n secure?: boolean\n }\n /**\n * How many levels deep a user document should be populated when creating the JWT and binding the user to the req. Defaults to 0 and should only be modified if absolutely necessary, as this will affect performance.\n * @default 0\n */\n depth?: number\n /**\n * Advanced - disable Payload's built-in local auth strategy. Only use this property if you have replaced Payload's auth mechanisms with your own.\n */\n disableLocalStrategy?:\n | {\n /**\n * Include auth fields on the collection even though the local strategy is disabled.\n * Useful when you do not want the database or types to vary depending on the auth configuration.\n */\n enableFields?: true\n optionalPassword?: true\n }\n | true\n /**\n * Customize the way that the forgotPassword operation functions.\n * @link https://payloadcms.com/docs/authentication/email#forgot-password\n */\n forgotPassword?: {\n generateEmailHTML?: GenerateForgotPasswordEmailHTML\n generateEmailSubject?: GenerateForgotPasswordEmailSubject\n }\n /**\n * Set the time (in milliseconds) that a user should be locked out if they fail authentication more times than maxLoginAttempts allows for.\n */\n lockTime?: number\n /**\n * Ability to allow users to login with username/password.\n *\n * @link https://payloadcms.com/docs/authentication/overview#login-with-username\n */\n loginWithUsername?: boolean | LoginWithUsernameOptions\n /**\n * Only allow a user to attempt logging in X amount of times. Automatically locks out a user from authenticating if this limit is passed. Set to 0 to disable.\n */\n maxLoginAttempts?: number\n /***\n * Set to true if you want to remove the token from the returned authentication API responses such as login or refresh.\n */\n removeTokenFromResponses?: true\n /**\n * Advanced - an array of custom authentification strategies to extend this collection's authentication with.\n * @link https://payloadcms.com/docs/authentication/custom-strategies\n */\n strategies?: AuthStrategy[]\n /**\n * Controls how many seconds the token will be valid for. Default is 2 hours.\n * @default 7200\n * @link https://payloadcms.com/docs/authentication/overview#config-options\n */\n tokenExpiration?: number\n /**\n * Payload Authentication provides for API keys to be set on each user within an Authentication-enabled Collection.\n * @default false\n * @link https://payloadcms.com/docs/authentication/api-keys\n */\n useAPIKey?: boolean\n /**\n * Set to true or pass an object with verification options to require users to verify by email before they are allowed to log into your app.\n * @link https://payloadcms.com/docs/authentication/email#email-verification\n */\n verify?:\n | {\n generateEmailHTML?: GenerateVerifyEmailHTML\n generateEmailSubject?: GenerateVerifyEmailSubject\n }\n | boolean\n}\n\nexport type VerifyConfig = {\n generateEmailHTML?: GenerateVerifyEmailHTML\n generateEmailSubject?: GenerateVerifyEmailSubject\n}\n\nexport interface Auth\n extends Omit<DeepRequired<IncomingAuthType>, 'forgotPassword' | 'loginWithUsername' | 'verify'> {\n forgotPassword?: {\n generateEmailHTML?: GenerateForgotPasswordEmailHTML\n generateEmailSubject?: GenerateForgotPasswordEmailSubject\n }\n loginWithUsername: false | LoginWithUsernameOptions\n verify?: boolean | VerifyConfig\n}\n\nexport function hasWhereAccessResult(result: boolean | Where): result is Where {\n return result && typeof result === 'object'\n}\n"],"names":["hasWhereAccessResult","result"],"mappings":"AAgSA,OAAO,SAASA,qBAAqBC,MAAuB;IAC1D,OAAOA,UAAU,OAAOA,WAAW;AACrC"}
1
+ {"version":3,"sources":["../../src/auth/types.ts"],"sourcesContent":["import type { DeepRequired } from 'ts-essentials'\n\nimport type { CollectionSlug, GlobalSlug, Payload } from '../index.js'\nimport type { PayloadRequest, Where } from '../types/index.js'\n\n/**\n * A permission object that can be used to determine if a user has access to a specific operation.\n */\nexport type Permission = {\n permission: boolean\n where?: Where\n}\n\nexport type FieldsPermissions = {\n [fieldName: string]: FieldPermissions\n}\n\nexport type BlockPermissions = {\n create: Permission\n fields: FieldsPermissions\n read: Permission\n update: Permission\n}\n\nexport type SanitizedBlockPermissions =\n | {\n fields: SanitizedFieldsPermissions\n }\n | true\n\nexport type BlocksPermissions = {\n [blockSlug: string]: BlockPermissions\n}\n\nexport type SanitizedBlocksPermissions =\n | {\n [blockSlug: string]: SanitizedBlockPermissions\n }\n | true\n\nexport type FieldPermissions = {\n blocks?: BlocksPermissions\n create: Permission\n fields?: FieldsPermissions\n read: Permission\n update: Permission\n}\n\nexport type SanitizedFieldPermissions =\n | {\n blocks?: SanitizedBlocksPermissions\n create: true\n fields?: SanitizedFieldsPermissions\n read: true\n update: true\n }\n | true\n\nexport type SanitizedFieldsPermissions =\n | {\n [fieldName: string]: SanitizedFieldPermissions\n }\n | true\n\nexport type CollectionPermission = {\n create: Permission\n delete: Permission\n fields: FieldsPermissions\n read: Permission\n readVersions?: Permission\n update: Permission\n}\n\nexport type SanitizedCollectionPermission = {\n create?: true\n delete?: true\n fields: SanitizedFieldsPermissions\n read?: true\n readVersions?: true\n update?: true\n}\n\nexport type GlobalPermission = {\n fields: FieldsPermissions\n read: Permission\n readVersions?: Permission\n update: Permission\n}\n\nexport type SanitizedGlobalPermission = {\n fields: SanitizedFieldsPermissions\n read?: true\n readVersions?: true\n update?: true\n}\n\nexport type DocumentPermissions = CollectionPermission | GlobalPermission\n\nexport type SanitizedDocumentPermissions = SanitizedCollectionPermission | SanitizedGlobalPermission\n\nexport type Permissions = {\n canAccessAdmin: boolean\n collections?: Record<CollectionSlug, CollectionPermission>\n globals?: Record<GlobalSlug, GlobalPermission>\n}\n\nexport type SanitizedPermissions = {\n canAccessAdmin?: boolean\n collections?: {\n [collectionSlug: string]: SanitizedCollectionPermission\n }\n globals?: {\n [globalSlug: string]: SanitizedGlobalPermission\n }\n}\n\ntype BaseUser = {\n collection: string\n email?: string\n id: number | string\n username?: string\n}\n\nexport type User = {\n [key: string]: any\n} & BaseUser\n\n/**\n * `collection` is not available one the client. It's only available on the server (req.user)\n * On the client, you can access the collection via config.admin.user. Config can be accessed using the useConfig() hook\n */\nexport type ClientUser = {\n [key: string]: any\n} & BaseUser\n\ntype GenerateVerifyEmailHTML<TUser = any> = (args: {\n req: PayloadRequest\n token: string\n user: TUser\n}) => Promise<string> | string\n\ntype GenerateVerifyEmailSubject<TUser = any> = (args: {\n req: PayloadRequest\n token: string\n user: TUser\n}) => Promise<string> | string\n\ntype GenerateForgotPasswordEmailHTML<TUser = any> = (args?: {\n req?: PayloadRequest\n token?: string\n user?: TUser\n}) => Promise<string> | string\n\ntype GenerateForgotPasswordEmailSubject<TUser = any> = (args?: {\n req?: PayloadRequest\n token?: string\n user?: TUser\n}) => Promise<string> | string\n\nexport type AuthStrategyFunctionArgs = {\n headers: Request['headers']\n isGraphQL?: boolean\n payload: Payload\n}\n\nexport type AuthStrategyResult = {\n responseHeaders?: Headers\n user: null | User\n}\n\nexport type AuthStrategyFunction = (\n args: AuthStrategyFunctionArgs,\n) => AuthStrategyResult | Promise<AuthStrategyResult>\nexport type AuthStrategy = {\n authenticate: AuthStrategyFunction\n name: string\n}\n\nexport type LoginWithUsernameOptions =\n | {\n allowEmailLogin?: false\n requireEmail?: boolean\n // If `allowEmailLogin` is false, `requireUsername` must be true (default: true)\n requireUsername?: true\n }\n | {\n allowEmailLogin?: true\n requireEmail?: boolean\n requireUsername?: boolean\n }\n\nexport interface IncomingAuthType {\n /**\n * Set cookie options, including secure, sameSite, and domain. For advanced users.\n */\n cookies?: {\n domain?: string\n sameSite?: 'Lax' | 'None' | 'Strict' | boolean\n secure?: boolean\n }\n /**\n * How many levels deep a user document should be populated when creating the JWT and binding the user to the req. Defaults to 0 and should only be modified if absolutely necessary, as this will affect performance.\n * @default 0\n */\n depth?: number\n /**\n * Advanced - disable Payload's built-in local auth strategy. Only use this property if you have replaced Payload's auth mechanisms with your own.\n */\n disableLocalStrategy?:\n | {\n /**\n * Include auth fields on the collection even though the local strategy is disabled.\n * Useful when you do not want the database or types to vary depending on the auth configuration.\n */\n enableFields?: true\n optionalPassword?: true\n }\n | true\n /**\n * Customize the way that the forgotPassword operation functions.\n * @link https://payloadcms.com/docs/authentication/email#forgot-password\n */\n forgotPassword?: {\n /**\n * The number of milliseconds that the forgot password token should be valid for.\n * @default 3600000 // 1 hour\n */\n expiration?: number\n generateEmailHTML?: GenerateForgotPasswordEmailHTML\n generateEmailSubject?: GenerateForgotPasswordEmailSubject\n }\n /**\n * Set the time (in milliseconds) that a user should be locked out if they fail authentication more times than maxLoginAttempts allows for.\n */\n lockTime?: number\n /**\n * Ability to allow users to login with username/password.\n *\n * @link https://payloadcms.com/docs/authentication/overview#login-with-username\n */\n loginWithUsername?: boolean | LoginWithUsernameOptions\n /**\n * Only allow a user to attempt logging in X amount of times. Automatically locks out a user from authenticating if this limit is passed. Set to 0 to disable.\n */\n maxLoginAttempts?: number\n /***\n * Set to true if you want to remove the token from the returned authentication API responses such as login or refresh.\n */\n removeTokenFromResponses?: true\n /**\n * Advanced - an array of custom authentification strategies to extend this collection's authentication with.\n * @link https://payloadcms.com/docs/authentication/custom-strategies\n */\n strategies?: AuthStrategy[]\n /**\n * Controls how many seconds the token will be valid for. Default is 2 hours.\n * @default 7200\n * @link https://payloadcms.com/docs/authentication/overview#config-options\n */\n tokenExpiration?: number\n /**\n * Payload Authentication provides for API keys to be set on each user within an Authentication-enabled Collection.\n * @default false\n * @link https://payloadcms.com/docs/authentication/api-keys\n */\n useAPIKey?: boolean\n /**\n * Set to true or pass an object with verification options to require users to verify by email before they are allowed to log into your app.\n * @link https://payloadcms.com/docs/authentication/email#email-verification\n */\n verify?:\n | {\n generateEmailHTML?: GenerateVerifyEmailHTML\n generateEmailSubject?: GenerateVerifyEmailSubject\n }\n | boolean\n}\n\nexport type VerifyConfig = {\n generateEmailHTML?: GenerateVerifyEmailHTML\n generateEmailSubject?: GenerateVerifyEmailSubject\n}\n\nexport interface Auth\n extends Omit<DeepRequired<IncomingAuthType>, 'forgotPassword' | 'loginWithUsername' | 'verify'> {\n forgotPassword?: {\n expiration?: number\n generateEmailHTML?: GenerateForgotPasswordEmailHTML\n generateEmailSubject?: GenerateForgotPasswordEmailSubject\n }\n loginWithUsername: false | LoginWithUsernameOptions\n verify?: boolean | VerifyConfig\n}\n\nexport function hasWhereAccessResult(result: boolean | Where): result is Where {\n return result && typeof result === 'object'\n}\n"],"names":["hasWhereAccessResult","result"],"mappings":"AAsSA,OAAO,SAASA,qBAAqBC,MAAuB;IAC1D,OAAOA,UAAU,OAAOA,WAAW;AACrC"}
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/collections/config/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAE1D,OAAO,KAAK,EAAE,iBAAiB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,UAAU,EAAE,yBAAyB,CAAA;IACrC,aAAa,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,eAAe,CAAC,CAAA;IACvD,IAAI,EAAE,UAAU,CAAA;IAChB,SAAS,EAAE,SAAS,CAAA;CACrB,KAAG,sBA6IH,CAAA;AAED,eAAO,MAAM,6BAA6B,qDAKvC;IACD,WAAW,EAAE,yBAAyB,EAAE,CAAA;IACxC,aAAa,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,eAAe,CAAC,CAAA;IACvD,IAAI,EAAE,UAAU,CAAA;IAChB,SAAS,EAAE,SAAS,CAAA;CACrB,KAAG,sBAAsB,EAezB,CAAA"}
@@ -147,7 +147,6 @@ export const createClientCollectionConfig = ({ collection, defaultIDType, i18n,
147
147
  }
148
148
  }
149
149
  break;
150
- break;
151
150
  default:
152
151
  clientCollection[key] = collection[key];
153
152
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/collections/config/client.ts"],"sourcesContent":["import type { I18nClient } from '@payloadcms/translations'\n\nimport type { StaticDescription } from '../../admin/types.js'\nimport type { ImportMap } from '../../bin/generateImportMap/index.js'\nimport type {\n LivePreviewConfig,\n ServerOnlyLivePreviewProperties,\n StaticLabel,\n} from '../../config/types.js'\nimport type { ClientField } from '../../fields/config/client.js'\nimport type { Payload } from '../../types/index.js'\nimport type { SanitizedUploadConfig } from '../../uploads/types.js'\nimport type { SanitizedCollectionConfig } from './types.js'\n\nimport { createClientFields } from '../../fields/config/client.js'\n\nexport type ServerOnlyCollectionProperties = keyof Pick<\n SanitizedCollectionConfig,\n 'access' | 'custom' | 'endpoints' | 'flattenedFields' | 'hooks' | 'joins'\n>\n\nexport type ServerOnlyCollectionAdminProperties = keyof Pick<\n SanitizedCollectionConfig['admin'],\n 'baseListFilter' | 'components' | 'hidden'\n>\n\nexport type ServerOnlyUploadProperties = keyof Pick<\n SanitizedCollectionConfig['upload'],\n | 'adminThumbnail'\n | 'externalFileHeaderFilter'\n | 'handlers'\n | 'modifyResponseHeaders'\n | 'withMetadata'\n>\n\nexport type ClientCollectionConfig = {\n admin: {\n description?: StaticDescription\n livePreview?: Omit<LivePreviewConfig, ServerOnlyLivePreviewProperties>\n preview?: boolean\n } & Omit<\n SanitizedCollectionConfig['admin'],\n | 'components'\n | 'description'\n | 'joins'\n | 'livePreview'\n | 'preview'\n | ServerOnlyCollectionAdminProperties\n >\n auth?: { verify?: true } & Omit<\n SanitizedCollectionConfig['auth'],\n 'forgotPassword' | 'strategies' | 'verify'\n >\n fields: ClientField[]\n labels: {\n plural: StaticLabel\n singular: StaticLabel\n }\n} & Omit<\n SanitizedCollectionConfig,\n 'admin' | 'auth' | 'fields' | 'labels' | ServerOnlyCollectionProperties\n>\n\nconst serverOnlyCollectionProperties: Partial<ServerOnlyCollectionProperties>[] = [\n 'hooks',\n 'access',\n 'endpoints',\n 'custom',\n 'joins',\n 'flattenedFields',\n // `upload`\n // `admin`\n // are all handled separately\n]\n\nconst serverOnlyUploadProperties: Partial<ServerOnlyUploadProperties>[] = [\n 'adminThumbnail',\n 'externalFileHeaderFilter',\n 'handlers',\n 'modifyResponseHeaders',\n 'withMetadata',\n]\n\nconst serverOnlyCollectionAdminProperties: Partial<ServerOnlyCollectionAdminProperties>[] = [\n 'hidden',\n 'baseListFilter',\n 'components',\n // 'preview' is handled separately\n // `livePreview` is handled separately\n]\n\nexport const createClientCollectionConfig = ({\n collection,\n defaultIDType,\n i18n,\n importMap,\n}: {\n collection: SanitizedCollectionConfig\n defaultIDType: Payload['config']['db']['defaultIDType']\n i18n: I18nClient\n importMap: ImportMap\n}): ClientCollectionConfig => {\n const clientCollection = {} as Partial<ClientCollectionConfig>\n\n for (const key in collection) {\n if (serverOnlyCollectionProperties.includes(key as any)) {\n continue\n }\n switch (key) {\n case 'admin':\n if (!collection.admin) {\n break\n }\n clientCollection.admin = {} as ClientCollectionConfig['admin']\n for (const adminKey in collection.admin) {\n if (serverOnlyCollectionAdminProperties.includes(adminKey as any)) {\n continue\n }\n\n switch (adminKey) {\n case 'description':\n if (\n typeof collection.admin.description === 'string' ||\n typeof collection.admin.description === 'object'\n ) {\n if (collection.admin.description) {\n clientCollection.admin.description = collection.admin.description\n }\n } else if (typeof collection.admin.description === 'function') {\n const description = collection.admin.description({ t: i18n.t })\n if (description) {\n clientCollection.admin.description = description\n }\n }\n break\n case 'livePreview':\n clientCollection.admin.livePreview =\n {} as ClientCollectionConfig['admin']['livePreview']\n if (collection.admin.livePreview.breakpoints) {\n clientCollection.admin.livePreview.breakpoints =\n collection.admin.livePreview.breakpoints\n }\n break\n case 'preview':\n if (collection.admin.preview) {\n clientCollection.admin.preview = true\n }\n break\n default:\n clientCollection.admin[adminKey] = collection.admin[adminKey]\n }\n }\n break\n case 'auth':\n if (!collection.auth) {\n break\n }\n clientCollection.auth = {} as { verify?: true } & SanitizedCollectionConfig['auth']\n if (collection.auth.cookies) {\n clientCollection.auth.cookies = collection.auth.cookies\n }\n if (collection.auth.depth !== undefined) {\n // Check for undefined as it can be a number (0)\n clientCollection.auth.depth = collection.auth.depth\n }\n if (collection.auth.disableLocalStrategy) {\n clientCollection.auth.disableLocalStrategy = collection.auth.disableLocalStrategy\n }\n if (collection.auth.lockTime !== undefined) {\n // Check for undefined as it can be a number (0)\n clientCollection.auth.lockTime = collection.auth.lockTime\n }\n if (collection.auth.loginWithUsername) {\n clientCollection.auth.loginWithUsername = collection.auth.loginWithUsername\n }\n if (collection.auth.maxLoginAttempts !== undefined) {\n // Check for undefined as it can be a number (0)\n clientCollection.auth.maxLoginAttempts = collection.auth.maxLoginAttempts\n }\n if (collection.auth.removeTokenFromResponses) {\n clientCollection.auth.removeTokenFromResponses = collection.auth.removeTokenFromResponses\n }\n\n if (collection.auth.useAPIKey) {\n clientCollection.auth.useAPIKey = collection.auth.useAPIKey\n }\n if (collection.auth.tokenExpiration) {\n clientCollection.auth.tokenExpiration = collection.auth.tokenExpiration\n }\n if (collection.auth.verify) {\n clientCollection.auth.verify = true\n }\n break\n case 'fields':\n clientCollection.fields = createClientFields({\n defaultIDType,\n fields: collection.fields,\n i18n,\n importMap,\n })\n break\n case 'labels':\n clientCollection.labels = {\n plural:\n typeof collection.labels.plural === 'function'\n ? collection.labels.plural({ t: i18n.t })\n : collection.labels.plural,\n singular:\n typeof collection.labels.singular === 'function'\n ? collection.labels.singular({ t: i18n.t })\n : collection.labels.singular,\n }\n break\n case 'upload':\n if (!collection.upload) {\n break\n }\n clientCollection.upload = {} as SanitizedUploadConfig\n for (const uploadKey in collection.upload) {\n if (serverOnlyUploadProperties.includes(uploadKey as any)) {\n continue\n }\n if (uploadKey === 'imageSizes') {\n clientCollection.upload.imageSizes = collection.upload.imageSizes.map((size) => {\n const sanitizedSize = { ...size }\n if ('generateImageName' in sanitizedSize) {\n delete sanitizedSize.generateImageName\n }\n return sanitizedSize\n })\n } else {\n clientCollection.upload[uploadKey] = collection.upload[uploadKey]\n }\n }\n break\n\n break\n default:\n clientCollection[key] = collection[key]\n }\n }\n\n return clientCollection as ClientCollectionConfig\n}\n\nexport const createClientCollectionConfigs = ({\n collections,\n defaultIDType,\n i18n,\n importMap,\n}: {\n collections: SanitizedCollectionConfig[]\n defaultIDType: Payload['config']['db']['defaultIDType']\n i18n: I18nClient\n importMap: ImportMap\n}): ClientCollectionConfig[] => {\n const clientCollections = new Array(collections.length)\n\n for (let i = 0; i < collections.length; i++) {\n const collection = collections[i]\n\n clientCollections[i] = createClientCollectionConfig({\n collection,\n defaultIDType,\n i18n,\n importMap,\n })\n }\n\n return clientCollections\n}\n"],"names":["createClientFields","serverOnlyCollectionProperties","serverOnlyUploadProperties","serverOnlyCollectionAdminProperties","createClientCollectionConfig","collection","defaultIDType","i18n","importMap","clientCollection","key","includes","admin","adminKey","description","t","livePreview","breakpoints","preview","auth","cookies","depth","undefined","disableLocalStrategy","lockTime","loginWithUsername","maxLoginAttempts","removeTokenFromResponses","useAPIKey","tokenExpiration","verify","fields","labels","plural","singular","upload","uploadKey","imageSizes","map","size","sanitizedSize","generateImageName","createClientCollectionConfigs","collections","clientCollections","Array","length","i"],"mappings":"AAcA,SAASA,kBAAkB,QAAQ,gCAA+B;AAiDlE,MAAMC,iCAA4E;IAChF;IACA;IACA;IACA;IACA;IACA;CAID;AAED,MAAMC,6BAAoE;IACxE;IACA;IACA;IACA;IACA;CACD;AAED,MAAMC,sCAAsF;IAC1F;IACA;IACA;CAGD;AAED,OAAO,MAAMC,+BAA+B,CAAC,EAC3CC,UAAU,EACVC,aAAa,EACbC,IAAI,EACJC,SAAS,EAMV;IACC,MAAMC,mBAAmB,CAAC;IAE1B,IAAK,MAAMC,OAAOL,WAAY;QAC5B,IAAIJ,+BAA+BU,QAAQ,CAACD,MAAa;YACvD;QACF;QACA,OAAQA;YACN,KAAK;gBACH,IAAI,CAACL,WAAWO,KAAK,EAAE;oBACrB;gBACF;gBACAH,iBAAiBG,KAAK,GAAG,CAAC;gBAC1B,IAAK,MAAMC,YAAYR,WAAWO,KAAK,CAAE;oBACvC,IAAIT,oCAAoCQ,QAAQ,CAACE,WAAkB;wBACjE;oBACF;oBAEA,OAAQA;wBACN,KAAK;4BACH,IACE,OAAOR,WAAWO,KAAK,CAACE,WAAW,KAAK,YACxC,OAAOT,WAAWO,KAAK,CAACE,WAAW,KAAK,UACxC;gCACA,IAAIT,WAAWO,KAAK,CAACE,WAAW,EAAE;oCAChCL,iBAAiBG,KAAK,CAACE,WAAW,GAAGT,WAAWO,KAAK,CAACE,WAAW;gCACnE;4BACF,OAAO,IAAI,OAAOT,WAAWO,KAAK,CAACE,WAAW,KAAK,YAAY;gCAC7D,MAAMA,cAAcT,WAAWO,KAAK,CAACE,WAAW,CAAC;oCAAEC,GAAGR,KAAKQ,CAAC;gCAAC;gCAC7D,IAAID,aAAa;oCACfL,iBAAiBG,KAAK,CAACE,WAAW,GAAGA;gCACvC;4BACF;4BACA;wBACF,KAAK;4BACHL,iBAAiBG,KAAK,CAACI,WAAW,GAChC,CAAC;4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zC,IAAIjC,2BAA2BS,QAAQ,CAACyB,YAAmB;wBACzD;oBACF;oBACA,IAAIA,cAAc,cAAc;wBAC9B3B,iBAAiB0B,MAAM,CAACE,UAAU,GAAGhC,WAAW8B,MAAM,CAACE,UAAU,CAACC,GAAG,CAAC,CAACC;4BACrE,MAAMC,gBAAgB;gCAAE,GAAGD,IAAI;4BAAC;4BAChC,IAAI,uBAAuBC,eAAe;gCACxC,OAAOA,cAAcC,iBAAiB;4BACxC;4BACA,OAAOD;wBACT;oBACF,OAAO;wBACL/B,iBAAiB0B,MAAM,CAACC,UAAU,GAAG/B,WAAW8B,MAAM,CAACC,UAAU;oBACnE;gBACF;gBACA;gBAEA;YACF;gBACE3B,gBAAgB,CAACC,IAAI,GAAGL,UAAU,CAACK,IAAI;QAC3C;IACF;IAEA,OAAOD;AACT,EAAC;AAED,OAAO,MAAMiC,gCAAgC,CAAC,EAC5CC,WAAW,EACXrC,aAAa,EACbC,IAAI,EACJC,SAAS,EAMV;IACC,MAAMoC,oBAAoB,IAAIC,MAAMF,YAAYG,MAAM;IAEtD,IAAK,IAAIC,IAAI,GAAGA,IAAIJ,YAAYG,MAAM,EAAEC,IAAK;QAC3C,MAAM1C,aAAasC,WAAW,CAACI,EAAE;QAEjCH,iBAAiB,CAACG,EAAE,GAAG3C,6BAA6B;YAClDC;YACAC;YACAC;YACAC;QACF;IACF;IAEA,OAAOoC;AACT,EAAC"}
1
+ {"version":3,"sources":["../../../src/collections/config/client.ts"],"sourcesContent":["import type { I18nClient } from '@payloadcms/translations'\n\nimport type { StaticDescription } from '../../admin/types.js'\nimport type { ImportMap } from '../../bin/generateImportMap/index.js'\nimport type {\n LivePreviewConfig,\n ServerOnlyLivePreviewProperties,\n StaticLabel,\n} from '../../config/types.js'\nimport type { ClientField } from '../../fields/config/client.js'\nimport type { Payload } from '../../types/index.js'\nimport type { SanitizedUploadConfig } from '../../uploads/types.js'\nimport type { SanitizedCollectionConfig } from './types.js'\n\nimport { createClientFields } from '../../fields/config/client.js'\n\nexport type ServerOnlyCollectionProperties = keyof Pick<\n SanitizedCollectionConfig,\n 'access' | 'custom' | 'endpoints' | 'flattenedFields' | 'hooks' | 'joins'\n>\n\nexport type ServerOnlyCollectionAdminProperties = keyof Pick<\n SanitizedCollectionConfig['admin'],\n 'baseListFilter' | 'components' | 'hidden'\n>\n\nexport type ServerOnlyUploadProperties = keyof Pick<\n SanitizedCollectionConfig['upload'],\n | 'adminThumbnail'\n | 'externalFileHeaderFilter'\n | 'handlers'\n | 'modifyResponseHeaders'\n | 'withMetadata'\n>\n\nexport type ClientCollectionConfig = {\n admin: {\n description?: StaticDescription\n livePreview?: Omit<LivePreviewConfig, ServerOnlyLivePreviewProperties>\n preview?: boolean\n } & Omit<\n SanitizedCollectionConfig['admin'],\n | 'components'\n | 'description'\n | 'joins'\n | 'livePreview'\n | 'preview'\n | ServerOnlyCollectionAdminProperties\n >\n auth?: { verify?: true } & Omit<\n SanitizedCollectionConfig['auth'],\n 'forgotPassword' | 'strategies' | 'verify'\n >\n fields: ClientField[]\n labels: {\n plural: StaticLabel\n singular: StaticLabel\n }\n} & Omit<\n SanitizedCollectionConfig,\n 'admin' | 'auth' | 'fields' | 'labels' | ServerOnlyCollectionProperties\n>\n\nconst serverOnlyCollectionProperties: Partial<ServerOnlyCollectionProperties>[] = [\n 'hooks',\n 'access',\n 'endpoints',\n 'custom',\n 'joins',\n 'flattenedFields',\n // `upload`\n // `admin`\n // are all handled separately\n]\n\nconst serverOnlyUploadProperties: Partial<ServerOnlyUploadProperties>[] = [\n 'adminThumbnail',\n 'externalFileHeaderFilter',\n 'handlers',\n 'modifyResponseHeaders',\n 'withMetadata',\n]\n\nconst serverOnlyCollectionAdminProperties: Partial<ServerOnlyCollectionAdminProperties>[] = [\n 'hidden',\n 'baseListFilter',\n 'components',\n // 'preview' is handled separately\n // `livePreview` is handled separately\n]\n\nexport const createClientCollectionConfig = ({\n collection,\n defaultIDType,\n i18n,\n importMap,\n}: {\n collection: SanitizedCollectionConfig\n defaultIDType: Payload['config']['db']['defaultIDType']\n i18n: I18nClient\n importMap: ImportMap\n}): ClientCollectionConfig => {\n const clientCollection = {} as Partial<ClientCollectionConfig>\n\n for (const key in collection) {\n if (serverOnlyCollectionProperties.includes(key as any)) {\n continue\n }\n switch (key) {\n case 'admin':\n if (!collection.admin) {\n break\n }\n clientCollection.admin = {} as ClientCollectionConfig['admin']\n for (const adminKey in collection.admin) {\n if (serverOnlyCollectionAdminProperties.includes(adminKey as any)) {\n continue\n }\n\n switch (adminKey) {\n case 'description':\n if (\n typeof collection.admin.description === 'string' ||\n typeof collection.admin.description === 'object'\n ) {\n if (collection.admin.description) {\n clientCollection.admin.description = collection.admin.description\n }\n } else if (typeof collection.admin.description === 'function') {\n const description = collection.admin.description({ t: i18n.t })\n if (description) {\n clientCollection.admin.description = description\n }\n }\n break\n case 'livePreview':\n clientCollection.admin.livePreview =\n {} as ClientCollectionConfig['admin']['livePreview']\n if (collection.admin.livePreview.breakpoints) {\n clientCollection.admin.livePreview.breakpoints =\n collection.admin.livePreview.breakpoints\n }\n break\n case 'preview':\n if (collection.admin.preview) {\n clientCollection.admin.preview = true\n }\n break\n default:\n clientCollection.admin[adminKey] = collection.admin[adminKey]\n }\n }\n break\n case 'auth':\n if (!collection.auth) {\n break\n }\n clientCollection.auth = {} as { verify?: true } & SanitizedCollectionConfig['auth']\n if (collection.auth.cookies) {\n clientCollection.auth.cookies = collection.auth.cookies\n }\n if (collection.auth.depth !== undefined) {\n // Check for undefined as it can be a number (0)\n clientCollection.auth.depth = collection.auth.depth\n }\n if (collection.auth.disableLocalStrategy) {\n clientCollection.auth.disableLocalStrategy = collection.auth.disableLocalStrategy\n }\n if (collection.auth.lockTime !== undefined) {\n // Check for undefined as it can be a number (0)\n clientCollection.auth.lockTime = collection.auth.lockTime\n }\n if (collection.auth.loginWithUsername) {\n clientCollection.auth.loginWithUsername = collection.auth.loginWithUsername\n }\n if (collection.auth.maxLoginAttempts !== undefined) {\n // Check for undefined as it can be a number (0)\n clientCollection.auth.maxLoginAttempts = collection.auth.maxLoginAttempts\n }\n if (collection.auth.removeTokenFromResponses) {\n clientCollection.auth.removeTokenFromResponses = collection.auth.removeTokenFromResponses\n }\n\n if (collection.auth.useAPIKey) {\n clientCollection.auth.useAPIKey = collection.auth.useAPIKey\n }\n if (collection.auth.tokenExpiration) {\n clientCollection.auth.tokenExpiration = collection.auth.tokenExpiration\n }\n if (collection.auth.verify) {\n clientCollection.auth.verify = true\n }\n break\n case 'fields':\n clientCollection.fields = createClientFields({\n defaultIDType,\n fields: collection.fields,\n i18n,\n importMap,\n })\n break\n case 'labels':\n clientCollection.labels = {\n plural:\n typeof collection.labels.plural === 'function'\n ? collection.labels.plural({ t: i18n.t })\n : collection.labels.plural,\n singular:\n typeof collection.labels.singular === 'function'\n ? collection.labels.singular({ t: i18n.t })\n : collection.labels.singular,\n }\n break\n case 'upload':\n if (!collection.upload) {\n break\n }\n clientCollection.upload = {} as SanitizedUploadConfig\n for (const uploadKey in collection.upload) {\n if (serverOnlyUploadProperties.includes(uploadKey as any)) {\n continue\n }\n if (uploadKey === 'imageSizes') {\n clientCollection.upload.imageSizes = collection.upload.imageSizes.map((size) => {\n const sanitizedSize = { ...size }\n if ('generateImageName' in sanitizedSize) {\n delete sanitizedSize.generateImageName\n }\n return sanitizedSize\n })\n } else {\n clientCollection.upload[uploadKey] = collection.upload[uploadKey]\n }\n }\n break\n\n default:\n clientCollection[key] = collection[key]\n }\n }\n\n return clientCollection as ClientCollectionConfig\n}\n\nexport const createClientCollectionConfigs = ({\n collections,\n defaultIDType,\n i18n,\n importMap,\n}: {\n collections: SanitizedCollectionConfig[]\n defaultIDType: Payload['config']['db']['defaultIDType']\n i18n: I18nClient\n importMap: ImportMap\n}): ClientCollectionConfig[] => {\n const clientCollections = new Array(collections.length)\n\n for (let i = 0; i < collections.length; i++) {\n const collection = collections[i]\n\n clientCollections[i] = createClientCollectionConfig({\n collection,\n defaultIDType,\n i18n,\n importMap,\n })\n }\n\n return clientCollections\n}\n"],"names":["createClientFields","serverOnlyCollectionProperties","serverOnlyUploadProperties","serverOnlyCollectionAdminProperties","createClientCollectionConfig","collection","defaultIDType","i18n","importMap","clientCollection","key","includes","admin","adminKey","description","t","livePreview","breakpoints","preview","auth","cookies","depth","undefined","disableLocalStrategy","lockTime","loginWithUsername","maxLoginAttempts","removeTokenFromResponses","useAPIKey","tokenExpiration","verify","fields","labels","plural","singular","upload","uploadKey","imageSizes","map","size","sanitizedSize","generateImageName","createClientCollectionConfigs","collections","clientCollections","Array","length","i"],"mappings":"AAcA,SAASA,kBAAkB,QAAQ,gCAA+B;AAiDlE,MAAMC,iCAA4E;IAChF;IACA;IACA;IACA;IACA;IACA;CAID;AAED,MAAMC,6BAAoE;IACxE;IACA;IACA;IACA;IACA;CACD;AAED,MAAMC,sCAAsF;IAC1F;IACA;IACA;CAGD;AAED,OAAO,MAAMC,+BAA+B,CAAC,EAC3CC,UAAU,EACVC,aAAa,EACbC,IAAI,EACJC,SAAS,EAMV;IACC,MAAMC,mBAAmB,CAAC;IAE1B,IAAK,MAAMC,OAAOL,WAAY;QAC5B,IAAIJ,+BAA+BU,QAAQ,CAACD,MAAa;YACvD;QACF;QACA,OAAQA;YACN,KAAK;gBACH,IAAI,CAACL,WAAWO,KAAK,EAAE;oBACrB;gBACF;gBACAH,iBAAiBG,KAAK,GAAG,CAAC;gBAC1B,IAAK,MAAMC,YAAYR,WAAWO,KAAK,CAAE;oBACvC,IAAIT,oCAAoCQ,QAAQ,CAACE,WAAkB;wBACjE;oBACF;oBAEA,OAAQA;wBACN,KAAK;4BACH,IACE,OAAOR,WAAWO,KAAK,CAACE,WAAW,KAAK,YACxC,OAAOT,WAAWO,KAAK,CAACE,WAAW,KAAK,UACxC;gCACA,IAAIT,WAAWO,KAAK,CAACE,WAAW,EAAE;oCAChCL,iBAAiBG,KAAK,CAACE,WAAW,GAAGT,WAAWO,KAAK,CAACE,WAAW;gCACnE;4BACF,OAAO,IAA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7B,WAAW2B,MAAM,CAACE,QAAQ,CAAC;wBAAEnB,GAAGR,KAAKQ,CAAC;oBAAC,KACvCV,WAAW2B,MAAM,CAACE,QAAQ;gBAClC;gBACA;YACF,KAAK;gBACH,IAAI,CAAC7B,WAAW8B,MAAM,EAAE;oBACtB;gBACF;gBACA1B,iBAAiB0B,MAAM,GAAG,CAAC;gBAC3B,IAAK,MAAMC,aAAa/B,WAAW8B,MAAM,CAAE;oBACzC,IAAIjC,2BAA2BS,QAAQ,CAACyB,YAAmB;wBACzD;oBACF;oBACA,IAAIA,cAAc,cAAc;wBAC9B3B,iBAAiB0B,MAAM,CAACE,UAAU,GAAGhC,WAAW8B,MAAM,CAACE,UAAU,CAACC,GAAG,CAAC,CAACC;4BACrE,MAAMC,gBAAgB;gCAAE,GAAGD,IAAI;4BAAC;4BAChC,IAAI,uBAAuBC,eAAe;gCACxC,OAAOA,cAAcC,iBAAiB;4BACxC;4BACA,OAAOD;wBACT;oBACF,OAAO;wBACL/B,iBAAiB0B,MAAM,CAACC,UAAU,GAAG/B,WAAW8B,MAAM,CAACC,UAAU;oBACnE;gBACF;gBACA;YAEF;gBACE3B,gBAAgB,CAACC,IAAI,GAAGL,UAAU,CAACK,IAAI;QAC3C;IACF;IAEA,OAAOD;AACT,EAAC;AAED,OAAO,MAAMiC,gCAAgC,CAAC,EAC5CC,WAAW,EACXrC,aAAa,EACbC,IAAI,EACJC,SAAS,EAMV;IACC,MAAMoC,oBAAoB,IAAIC,MAAMF,YAAYG,MAAM;IAEtD,IAAK,IAAIC,IAAI,GAAGA,IAAIJ,YAAYG,MAAM,EAAEC,IAAK;QAC3C,MAAM1C,aAAasC,WAAW,CAACI,EAAE;QAEjCH,iBAAiB,CAACG,EAAE,GAAG3C,6BAA6B;YAClDC;YACAC;YACAC;YACAC;QACF;IACF;IAEA,OAAOoC;AACT,EAAC"}
@@ -4,7 +4,7 @@ export { getFromImportMap } from '../bin/generateImportMap/getFromImportMap.js';
4
4
  export { parsePayloadComponent } from '../bin/generateImportMap/parsePayloadComponent.js';
5
5
  export { defaults as collectionDefaults } from '../collections/config/defaults.js';
6
6
  export { serverProps } from '../config/types.js';
7
- export { fieldAffectsData, fieldHasMaxDepth, fieldHasSubFields, fieldIsArrayType, fieldIsBlockType, fieldIsGroupType, fieldIsLocalized, fieldIsPresentationalOnly, fieldIsSidebar, fieldIsVirtual, fieldSupportsMany, optionIsObject, optionIsValue, optionsAreObjects, tabHasName, valueIsValueWithRelation, } from '../fields/config/types.js';
7
+ export { fieldAffectsData, fieldHasMaxDepth, fieldHasSubFields, fieldIsArrayType, fieldIsBlockType, fieldIsGroupType, fieldIsHiddenOrDisabled, fieldIsID, fieldIsLocalized, fieldIsPresentationalOnly, fieldIsSidebar, fieldIsVirtual, fieldSupportsMany, optionIsObject, optionIsValue, optionsAreObjects, tabHasName, valueIsValueWithRelation, } from '../fields/config/types.js';
8
8
  export { getFieldPaths } from '../fields/getFieldPaths.js';
9
9
  export * from '../fields/validations.js';
10
10
  export { validOperators } from '../types/constants.js';
@@ -1 +1 @@
1
- {"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/exports/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,4BAA4B,EAC5B,qBAAqB,EACrB,mBAAmB,EACnB,YAAY,GACb,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,8CAA8C,CAAA;AAC/E,OAAO,EAAE,qBAAqB,EAAE,MAAM,mDAAmD,CAAA;AACzF,OAAO,EAAE,QAAQ,IAAI,kBAAkB,EAAE,MAAM,mCAAmC,CAAA;AAElF,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAEhD,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,yBAAy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ACL,cAAc,EACd,qBAAqB,EACrB,oBAAoB,EACpB,0CAA0C,GAC3C,MAAM,gCAAgC,CAAA;AACvC,OAAO,EACL,SAAS,EACT,2BAA2B,EAC3B,4BAA4B,EAC5B,yBAAyB,GAC1B,MAAM,2BAA2B,CAAA;AAElC,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAA;AAErE,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAA;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAA;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AAE/D,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAA;AAEjE,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAA;AAEnD,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAA;AAE7D,OAAO,EACL,sBAAsB,EACtB,0BAA0B,EAC1B,gCAAgC,GACjC,MAAM,kCAAkC,CAAA;AAEzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAA;AAE3E,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAA;AAE3D,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,6BAA6B,CAAA;AAEpE,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AAErD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAA;AACnE,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAC3C,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,qCAAqC,CAAA;AACpF,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAA"}
@@ -4,7 +4,7 @@ export { getFromImportMap } from '../bin/generateImportMap/getFromImportMap.js';
4
4
  export { parsePayloadComponent } from '../bin/generateImportMap/parsePayloadComponent.js';
5
5
  export { defaults as collectionDefaults } from '../collections/config/defaults.js';
6
6
  export { serverProps } from '../config/types.js';
7
- export { fieldAffectsData, fieldHasMaxDepth, fieldHasSubFields, fieldIsArrayType, fieldIsBlockType, fieldIsGroupType, fieldIsLocalized, fieldIsPresentationalOnly, fieldIsSidebar, fieldIsVirtual, fieldSupportsMany, optionIsObject, optionIsValue, optionsAreObjects, tabHasName, valueIsValueWithRelation } from '../fields/config/types.js';
7
+ export { fieldAffectsData, fieldHasMaxDepth, fieldHasSubFields, fieldIsArrayType, fieldIsBlockType, fieldIsGroupType, fieldIsHiddenOrDisabled, fieldIsID, fieldIsLocalized, fieldIsPresentationalOnly, fieldIsSidebar, fieldIsVirtual, fieldSupportsMany, optionIsObject, optionIsValue, optionsAreObjects, tabHasName, valueIsValueWithRelation } from '../fields/config/types.js';
8
8
  export { getFieldPaths } from '../fields/getFieldPaths.js';
9
9
  export * from '../fields/validations.js';
10
10
  export { validOperators } from '../types/constants.js';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/exports/shared.ts"],"sourcesContent":["export {\n generateCookie,\n generateExpiredPayloadCookie,\n generatePayloadCookie,\n getCookieExpiration,\n parseCookies,\n} from '../auth/cookies.js'\nexport { getLoginOptions } from '../auth/getLoginOptions.js'\nexport { getFromImportMap } from '../bin/generateImportMap/getFromImportMap.js'\nexport { parsePayloadComponent } from '../bin/generateImportMap/parsePayloadComponent.js'\nexport { defaults as collectionDefaults } from '../collections/config/defaults.js'\n\nexport { serverProps } from '../config/types.js'\n\nexport {\n fieldAffectsData,\n fieldHasMaxDepth,\n fieldHasSubFields,\n fieldIsArrayType,\n fieldIsBlockType,\n fieldIsGroupType,\n fieldIsLocalized,\n fieldIsPresentationalOnly,\n fieldIsSidebar,\n fieldIsVirtual,\n fieldSupportsMany,\n optionIsObject,\n optionIsValue,\n optionsAreObjects,\n tabHasName,\n valueIsValueWithRelation,\n} from '../fields/config/types.js'\n\nexport { getFieldPaths } from '../fields/getFieldPaths.js'\n\nexport * from '../fields/validations.js'\n\nexport { validOperators } from '../types/constants.js'\n\nexport { formatFilesize } from '../uploads/formatFilesize.js'\n\nexport { isImage } from '../uploads/isImage.js'\n\nexport {\n deepCopyObject,\n deepCopyObjectComplex,\n deepCopyObjectSimple,\n deepCopyObjectSimpleWithoutReactComponents,\n} from '../utilities/deepCopyObject.js'\nexport {\n deepMerge,\n deepMergeWithCombinedArrays,\n deepMergeWithReactComponents,\n deepMergeWithSourceArrays,\n} from '../utilities/deepMerge.js'\n\nexport { fieldSchemaToJSON } from '../utilities/fieldSchemaToJSON.js'\n\nexport { getDataByPath } from '../utilities/getDataByPath.js'\nexport { getSelectMode } from '../utilities/getSelectMode.js'\nexport { getSiblingData } from '../utilities/getSiblingData.js'\n\nexport { getUniqueListBy } from '../utilities/getUniqueListBy.js'\n\nexport { isNumber } from '../utilities/isNumber.js'\n\nexport { isPlainObject } from '../utilities/isPlainObject.js'\n\nexport {\n isReactClientComponent,\n isReactComponentOrFunction,\n isReactServerComponentOrFunction,\n} from '../utilities/isReactComponent.js'\n\nexport { reduceFieldsToValues } from '../utilities/reduceFieldsToValues.js'\n\nexport { setsAreEqual } from '../utilities/setsAreEqual.js'\n\nexport { default as toKebabCase } from '../utilities/toKebabCase.js'\n\nexport { unflatten } from '../utilities/unflatten.js'\n\nexport { validateMimeType } from '../utilities/validateMimeType.js'\nexport { wait } from '../utilities/wait.js'\nexport { default as wordBoundariesRegex } from '../utilities/wordBoundariesRegex.js'\nexport { versionDefaults } from '../versions/defaults.js'\nexport { deepMergeSimple } from '@payloadcms/translations/utilities'\n"],"names":["generateCookie","generateExpiredPayloadCookie","generatePayloadCookie","getCookieExpiration","parseCookies","getLoginOptions","getFromImportMap","parsePayloadComponent","defaults","collectionDefaults","serverProps","fieldAffectsData","fieldHasMaxDepth","fieldHasSubFields","fieldIsArrayType","fieldIsBlockType","fieldIsGroupType","fieldIsLocalized","fieldIsPresentationalOnly","fieldIsSidebar","fieldIsVirtual","fieldSupportsMany","optionIsObject","optionIsValue","optionsAreObjects","tabHasName","valueIsValueWithRelation","getFieldPaths","validOperators","formatFilesize","isImage","deepCopyObject","deepCopyObjectComplex","deepCopyObjectSimple","deepCopyObjectSimpleWithoutReactComponents","deepMerge","deepMergeWithCombinedArrays","deepMergeWithReactComponents","deepMergeWithSourceArrays","fieldSchemaToJSON","getDataByPath","getSelectMode","getSiblingData","getUniqueListBy","isNumber","isPlainObject","isReactClientComponent","isReactComponentOrFunction","isReactServerComponentOrFunction","reduceFieldsToValues","setsAreEqual","default","toKebabCase","unflatten","validateMimeType","wait","wordBoundariesRegex","versionDefaults","deepMergeSimple"],"mappings":"AAAA,SACEA,cAAc,EACdC,4BAA4B,EAC5BC,qBAAqB,EACrBC,mBAAmB,EACnBC,YAAY,QACP,qBAAoB;AAC3B,SAASC,eAAe,QAAQ,6BAA4B;AAC5D,SAASC,gBAAgB,QAAQ,+CAA8C;AAC/E,SAASC,qBAAqB,QAAQ,oDAAmD;AACzF,SAASC,YAAYC,kBAAkB,QAAQ,oCAAmC;AAElF,SAASC,WAAW,QAAQ,qBAAoB;AAEhD,SACEC,gBAAgB,EAChBC,gBAAgB,EAChBC,iBAAiB,EACjBC,gBAAgB,EAChBC,gBAAgB,EAChBC,gBAAgB,EAChBC,gBAAgB,EAChBC,yBAAyB,EACzBC,cAAc,EACdC,cAAc,EACdC,iBAAiB,EACjBC,cAAc,EACdC,aAAa,EACbC,iBAAiB,EACjBC,UAAU,EACVC,wBAAwB,QACnB,4BAA2B;AAElC,SAASC,aAAa,QAAQ,6BAA4B;AAE1D,cAAc,2BAA0B;AAExC,SAASC,cAAc,QAAQ,wBAAuB;AAEtD,SAASC,cAAc,QAAQ,+BAA8B;AAE7D,SAASC,OAAO,QAAQ,wBAAuB;AAE/C,SACEC,cAAc,EACdC,qBAAqB,EACrBC,oBAAoB,EACpBC,0CAA0C,QACrC,iCAAgC;AACvC,SACEC,SAAS,EACTC,2BAA2B,EAC3BC,4BAA4B,EAC5BC,yBAAyB,QACpB,4BAA2B;AAElC,SAASC,iBAAiB,QAAQ,oCAAmC;AAErE,SAASC,aAAa,QAAQ,gCAA+B;AAC7D,SAASC,aAAa,QAAQ,gCAA+B;AAC7D,SAASC,cAAc,QAAQ,iCAAgC;AAE/D,SAASC,eAAe,QAAQ,kCAAiC;AAEjE,SAASC,QAAQ,QAAQ,2BAA0B;AAEnD,SAASC,aAAa,QAAQ,gCAA+B;AAE7D,SACEC,sBAAsB,EACtBC,0BAA0B,EAC1BC,gCAAgC,QAC3B,mCAAkC;AAEzC,SAASC,oBAAoB,QAAQ,uCAAsC;AAE3E,SAASC,YAAY,QAAQ,+BAA8B;AAE3D,SAASC,WAAWC,WAAW,QAAQ,8BAA6B;AAEpE,SAASC,SAAS,QAAQ,4BAA2B;AAErD,SAASC,gBAAgB,QAAQ,mCAAkC;AACnE,SAASC,IAAI,QAAQ,uBAAsB;AAC3C,SAASJ,WAAWK,mBAAmB,QAAQ,sCAAqC;AACpF,SAASC,eAAe,QAAQ,0BAAyB;AACzD,SAASC,eAAe,QAAQ,qCAAoC"}
1
+ {"version":3,"sources":["../../src/exports/shared.ts"],"sourcesContent":["export {\n generateCookie,\n generateExpiredPayloadCookie,\n generatePayloadCookie,\n getCookieExpiration,\n parseCookies,\n} from '../auth/cookies.js'\nexport { getLoginOptions } from '../auth/getLoginOptions.js'\nexport { getFromImportMap } from '../bin/generateImportMap/getFromImportMap.js'\nexport { parsePayloadComponent } from '../bin/generateImportMap/parsePayloadComponent.js'\nexport { defaults as collectionDefaults } from '../collections/config/defaults.js'\n\nexport { serverProps } from '../config/types.js'\n\nexport {\n fieldAffectsData,\n fieldHasMaxDepth,\n fieldHasSubFields,\n fieldIsArrayType,\n fieldIsBlockType,\n fieldIsGroupType,\n fieldIsHiddenOrDisabled,\n fieldIsID,\n fieldIsLocalized,\n fieldIsPresentationalOnly,\n fieldIsSidebar,\n fieldIsVirtual,\n fieldSupportsMany,\n optionIsObject,\n optionIsValue,\n optionsAreObjects,\n tabHasName,\n valueIsValueWithRelation,\n} from '../fields/config/types.js'\n\nexport { getFieldPaths } from '../fields/getFieldPaths.js'\n\nexport * from '../fields/validations.js'\n\nexport { validOperators } from '../types/constants.js'\n\nexport { formatFilesize } from '../uploads/formatFilesize.js'\n\nexport { isImage } from '../uploads/isImage.js'\n\nexport {\n deepCopyObject,\n deepCopyObjectComplex,\n deepCopyObjectSimple,\n deepCopyObjectSimpleWithoutReactComponents,\n} from '../utilities/deepCopyObject.js'\nexport {\n deepMerge,\n deepMergeWithCombinedArrays,\n deepMergeWithReactComponents,\n deepMergeWithSourceArrays,\n} from '../utilities/deepMerge.js'\n\nexport { fieldSchemaToJSON } from '../utilities/fieldSchemaToJSON.js'\n\nexport { getDataByPath } from '../utilities/getDataByPath.js'\nexport { getSelectMode } from '../utilities/getSelectMode.js'\nexport { getSiblingData } from '../utilities/getSiblingData.js'\n\nexport { getUniqueListBy } from '../utilities/getUniqueListBy.js'\n\nexport { isNumber } from '../utilities/isNumber.js'\n\nexport { isPlainObject } from '../utilities/isPlainObject.js'\n\nexport {\n isReactClientComponent,\n isReactComponentOrFunction,\n isReactServerComponentOrFunction,\n} from '../utilities/isReactComponent.js'\n\nexport { reduceFieldsToValues } from '../utilities/reduceFieldsToValues.js'\n\nexport { setsAreEqual } from '../utilities/setsAreEqual.js'\n\nexport { default as toKebabCase } from '../utilities/toKebabCase.js'\n\nexport { unflatten } from '../utilities/unflatten.js'\n\nexport { validateMimeType } from '../utilities/validateMimeType.js'\nexport { wait } from '../utilities/wait.js'\nexport { default as wordBoundariesRegex } from '../utilities/wordBoundariesRegex.js'\nexport { versionDefaults } from '../versions/defaults.js'\nexport { deepMergeSimple } from '@payloadcms/translations/utilities'\n"],"names":["generateCookie","generateExpiredPayloadCookie","generatePayloadCookie","getCookieExpiration","parseCookies","getLoginOptions","getFromImportMap","parsePayloadComponent","defaults","collectionDefaults","serverProps","fieldAffectsData","fieldHasMaxDepth","fieldHasSubFields","fieldIsArrayType","fieldIsBlockType","fieldIsGroupType","fieldIsHiddenOrDisabled","fieldIsID","fieldIsLocalized","fieldIsPresentationalOnly","fieldIsSidebar","fieldIsVirtual","fieldSupportsMany","optionIsObject","optionIsValue","optionsAreObjects","tabHasName","valueIsValueWithRelation","getFieldPaths","validOperators","formatFilesize","isImage","deepCopyObject","deepCopyObjectComplex","deepCopyObjectSimple","deepCopyObjectSimpleWithoutReactComponents","deepMerge","deepMergeWithCombinedArrays","deepMergeWithReactComponents","deepMergeWithSourceArrays","fieldSchemaToJSON","getDataByPath","getSelectMode","getSiblingData","getUniqueListBy","isNumber","isPlainObject","isReactClientComponent","isReactComponentOrFunction","isReactServerComponentOrFunction","reduceFieldsToValues","setsAreEqual","default","toKebabCase","unflatten","validateMimeType","wait","wordBoundariesRegex","versionDefaults","deepMergeSimple"],"mappings":"AAAA,SACEA,cAAc,EACdC,4BAA4B,EAC5BC,qBAAqB,EACrBC,mBAAmB,EACnBC,YAAY,QACP,qBAAoB;AAC3B,SAASC,eAAe,QAAQ,6BAA4B;AAC5D,SAASC,gBAAgB,QAAQ,+CAA8C;AAC/E,SAASC,qBAAqB,QAAQ,oDAAmD;AACzF,SAASC,YAAYC,kBAAkB,QAAQ,oCAAmC;AAElF,SAASC,WAAW,QAAQ,qBAAoB;AAEhD,SACEC,gBAAgB,EAChBC,gBAAgB,EAChBC,iBAAiB,EACjBC,gBAAgB,EAChBC,gBAAgB,EAChBC,gBAAgB,EAChBC,uBAAuB,EACvBC,SAAS,EACTC,gBAAgB,EAChBC,yBAAyB,EACzBC,cAAc,EACdC,cAAc,EACdC,iBAAiB,EACjBC,cAAc,EACdC,aAAa,EACbC,iBAAiB,EACjBC,UAAU,EACVC,wBAAwB,QACnB,4BAA2B;AAElC,SAASC,aAAa,QAAQ,6BAA4B;AAE1D,cAAc,2BAA0B;AAExC,SAASC,cAAc,QAAQ,wBAAuB;AAEtD,SAASC,cAAc,QAAQ,+BAA8B;AAE7D,SAASC,OAAO,QAAQ,wBAAuB;AAE/C,SACE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AAU,GACV,MAAM,IAAI,CAAC,SAAS,EAAE,QAAQ,GAAG,QAAQ,GAAG,cAAc,GAAG,OAAO,CAAC,CAAA;AAEzE,MAAM,MAAM,8BAA8B,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,WAAW,CAAC,CAAA;AAyBxF,eAAO,MAAM,iBAAiB,8DAK3B;IACD,aAAa,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,eAAe,CAAC,CAAA;IACvD,KAAK,EAAE,KAAK,CAAA;IACZ,IAAI,EAAE,UAAU,CAAA;IAChB,SAAS,EAAE,SAAS,CAAA;CACrB,KAAG,WAiOH,CAAA;AAED,eAAO,MAAM,kBAAkB,iEAM5B;IACD,aAAa,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,eAAe,CAAC,CAAA;IACvD,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,MAAM,EAAE,KAAK,EAAE,CAAA;IACf,IAAI,EAAE,UAAU,CAAA;IAChB,SAAS,EAAE,SAAS,CAAA;CACrB,KAAG,WAAW,EAkCd,CAAA"}
@@ -20,11 +20,6 @@ const serverOnlyFieldAdminProperties = [
20
20
  ];
21
21
  export const createClientField = ({ defaultIDType, field: incomingField, i18n, importMap })=>{
22
22
  const clientField = {};
23
- const isHidden = 'hidden' in incomingField && incomingField?.hidden;
24
- const disabledFromAdmin = incomingField?.admin && 'disabled' in incomingField.admin && incomingField.admin.disabled;
25
- if (fieldAffectsData(incomingField) && (isHidden || disabledFromAdmin)) {
26
- return null;
27
- }
28
23
  for(const key in incomingField){
29
24
  if (serverOnlyFieldProperties.includes(key)) {
30
25
  continue;
@@ -229,9 +224,7 @@ export const createClientFields = ({ defaultIDType, disableAddingID, fields, i18
229
224
  i18n,
230
225
  importMap
231
226
  });
232
- if (clientField) {
233
- clientFields.push(clientField);
234
- }
227
+ clientFields.push(clientField);
235
228
  }
236
229
  const hasID = flattenTopLevelFields(fields).some((f)=>fieldAffectsData(f) && f.name === 'id');
237
230
  if (!disableAddingID && !hasID) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/fields/config/client.ts"],"sourcesContent":["import type { I18nClient } from '@payloadcms/translations'\n\nimport type {\n AdminClient,\n BlockJSX,\n BlocksFieldClient,\n ClientBlock,\n ClientField,\n Field,\n FieldBase,\n LabelsClient,\n RadioFieldClient,\n RowFieldClient,\n SelectFieldClient,\n TabsFieldClient,\n} from '../../fields/config/types.js'\nimport type { Payload } from '../../types/index.js'\n\nimport { getFromImportMap } from '../../bin/generateImportMap/getFromImportMap.js'\nimport { MissingEditorProp } from '../../errors/MissingEditorProp.js'\nimport { fieldAffectsData } from '../../fields/config/types.js'\nimport { flattenTopLevelFields, type ImportMap } from '../../index.js'\nimport { removeUndefined } from '../../utilities/removeUndefined.js'\n\n// Should not be used - ClientField should be used instead. This is why we don't export ClientField, we don't want people\n// to accidentally use it instead of ClientField and get confused\n\nexport { ClientField }\n\nexport type ServerOnlyFieldProperties =\n | 'dbName' // can be a function\n | 'editor' // This is a `richText` only property\n | 'enumName' // can be a function\n | 'filterOptions' // This is a `relationship` and `upload` only property\n | 'label'\n | 'typescriptSchema'\n | 'validate'\n | keyof Pick<FieldBase, 'access' | 'custom' | 'defaultValue' | 'hooks'>\n\nexport type ServerOnlyFieldAdminProperties = keyof Pick<FieldBase['admin'], 'condition'>\n\nconst serverOnlyFieldProperties: Partial<ServerOnlyFieldProperties>[] = [\n 'hooks',\n 'access',\n 'validate',\n 'defaultValue',\n 'filterOptions', // This is a `relationship` and `upload` only property\n 'editor', // This is a `richText` only property\n 'custom',\n 'typescriptSchema',\n 'dbName', // can be a function\n 'enumName', // can be a function\n // the following props are handled separately (see below):\n // `label`\n // `fields`\n // `blocks`\n // `tabs`\n // `admin`\n]\nconst serverOnlyFieldAdminProperties: Partial<ServerOnlyFieldAdminProperties>[] = ['condition']\ntype FieldWithDescription = {\n admin: AdminClient\n} & ClientField\n\nexport const createClientField = ({\n defaultIDType,\n field: incomingField,\n i18n,\n importMap,\n}: {\n defaultIDType: Payload['config']['db']['defaultIDType']\n field: Field\n i18n: I18nClient\n importMap: ImportMap\n}): ClientField => {\n const clientField: ClientField = {} as ClientField\n\n const isHidden = 'hidden' in incomingField && incomingField?.hidden\n const disabledFromAdmin =\n incomingField?.admin && 'disabled' in incomingField.admin && incomingField.admin.disabled\n\n if (fieldAffectsData(incomingField) && (isHidden || disabledFromAdmin)) {\n return null\n }\n\n for (const key in incomingField) {\n if (serverOnlyFieldProperties.includes(key as any)) {\n continue\n }\n switch (key) {\n case 'admin':\n if (!incomingField.admin) {\n break\n }\n clientField.admin = {} as AdminClient\n for (const adminKey in incomingField.admin) {\n if (serverOnlyFieldAdminProperties.includes(adminKey as any)) {\n continue\n }\n switch (adminKey) {\n case 'description':\n if ('description' in incomingField.admin) {\n if (typeof incomingField.admin?.description !== 'function') {\n ;(clientField as FieldWithDescription).admin.description =\n incomingField.admin.description\n }\n }\n\n break\n default:\n clientField.admin[adminKey] = incomingField.admin[adminKey]\n }\n }\n break\n case 'blocks':\n case 'fields':\n case 'tabs':\n // Skip - we handle sub-fields in the switch below\n break\n case 'label':\n //@ts-expect-error - would need to type narrow\n if (typeof incomingField.label === 'function') {\n //@ts-expect-error - would need to type narrow\n clientField.label = incomingField.label({ t: i18n.t })\n } else {\n //@ts-expect-error - would need to type narrow\n clientField.label = incomingField.label\n }\n break\n default:\n clientField[key] = incomingField[key]\n }\n }\n\n switch (incomingField.type) {\n case 'array':\n case 'collapsible':\n case 'group':\n case 'row': {\n const field = clientField as unknown as RowFieldClient\n\n if (!field.fields) {\n field.fields = []\n }\n\n field.fields = createClientFields({\n defaultIDType,\n disableAddingID: incomingField.type !== 'array',\n fields: incomingField.fields,\n i18n,\n importMap,\n })\n\n break\n }\n\n case 'blocks': {\n const field = clientField as unknown as BlocksFieldClient\n\n if (incomingField.blocks?.length) {\n for (let i = 0; i < incomingField.blocks.length; i++) {\n const block = incomingField.blocks[i]\n\n // prevent $undefined from being passed through the rsc requests\n const clientBlock = removeUndefined<ClientBlock>({\n slug: block.slug,\n fields: field.blocks?.[i]?.fields || [],\n imageAltText: block.imageAltText,\n imageURL: block.imageURL,\n }) satisfies ClientBlock\n\n if (block.admin?.custom) {\n clientBlock.admin = {\n custom: block.admin.custom,\n }\n }\n\n if (block?.admin?.jsx) {\n const jsxResolved = getFromImportMap<BlockJSX>({\n importMap,\n PayloadComponent: block.admin.jsx,\n schemaPath: '',\n })\n clientBlock.jsx = jsxResolved\n }\n\n if (block.labels) {\n clientBlock.labels = {} as unknown as LabelsClient\n\n if (block.labels.singular) {\n if (typeof block.labels.singular === 'function') {\n clientBlock.labels.singular = block.labels.singular({ t: i18n.t })\n } else {\n clientBlock.labels.singular = block.labels.singular\n }\n if (typeof block.labels.plural === 'function') {\n clientBlock.labels.plural = block.labels.plural({ t: i18n.t })\n } else {\n clientBlock.labels.plural = block.labels.plural\n }\n }\n }\n\n clientBlock.fields = createClientFields({\n defaultIDType,\n fields: block.fields,\n i18n,\n importMap,\n })\n\n if (!field.blocks) {\n field.blocks = []\n }\n\n field.blocks[i] = clientBlock\n }\n }\n\n break\n }\n\n case 'radio':\n // falls through\n case 'select': {\n const field = clientField as RadioFieldClient | SelectFieldClient\n\n if (incomingField.options?.length) {\n for (let i = 0; i < incomingField.options.length; i++) {\n const option = incomingField.options[i]\n\n if (typeof option === 'object' && typeof option.label === 'function') {\n if (!field.options) {\n field.options = []\n }\n\n field.options[i] = {\n label: option.label({ t: i18n.t }),\n value: option.value,\n }\n }\n }\n }\n\n break\n }\n case 'richText': {\n if (!incomingField?.editor) {\n throw new MissingEditorProp(incomingField) // while we allow disabling editor functionality, you should not have any richText fields defined if you do not have an editor\n }\n\n if (typeof incomingField?.editor === 'function') {\n throw new Error('Attempted to access unsanitized rich text editor.')\n }\n\n break\n }\n\n case 'tabs': {\n const field = clientField as unknown as TabsFieldClient\n\n if (incomingField.tabs?.length) {\n field.tabs = []\n\n for (let i = 0; i < incomingField.tabs.length; i++) {\n const tab = incomingField.tabs[i]\n const clientTab = {} as unknown as TabsFieldClient['tabs'][0]\n\n for (const key in tab) {\n if (serverOnlyFieldProperties.includes(key as any)) {\n continue\n }\n if (key === 'fields') {\n clientTab.fields = createClientFields({\n defaultIDType,\n disableAddingID: true,\n fields: tab.fields,\n i18n,\n importMap,\n })\n } else {\n clientTab[key] = tab[key]\n }\n }\n field.tabs[i] = clientTab\n }\n }\n\n break\n }\n\n default:\n break\n }\n\n return clientField\n}\n\nexport const createClientFields = ({\n defaultIDType,\n disableAddingID,\n fields,\n i18n,\n importMap,\n}: {\n defaultIDType: Payload['config']['db']['defaultIDType']\n disableAddingID?: boolean\n fields: Field[]\n i18n: I18nClient\n importMap: ImportMap\n}): ClientField[] => {\n const clientFields: ClientField[] = []\n\n for (let i = 0; i < fields.length; i++) {\n const field = fields[i]\n\n const clientField = createClientField({\n defaultIDType,\n field,\n i18n,\n importMap,\n })\n\n if (clientField) {\n clientFields.push(clientField)\n }\n }\n\n const hasID = flattenTopLevelFields(fields).some((f) => fieldAffectsData(f) && f.name === 'id')\n\n if (!disableAddingID && !hasID) {\n clientFields.push({\n name: 'id',\n type: defaultIDType,\n admin: {\n description: 'The unique identifier for this document',\n disableBulkEdit: true,\n disabled: true,\n hidden: true,\n },\n hidden: true,\n label: 'ID',\n })\n }\n\n return clientFields\n}\n"],"names":["getFromImportMap","MissingEditorProp","fieldAffectsData","flattenTopLevelFields","removeUndefined","serverOnlyFieldProperties","serverOnlyFieldAdminProperties","createClientField","defaultIDType","field","incomingField","i18n","importMap","clientField","isHidden","hidden","disabledFromAdmin","admin","disabled","key","includes","adminKey","description","label","t","type","fields","createClientFields","disableAddingID","blocks","length","i","block","clientBlock","slug","imageAltText","imageURL","custom","jsx","jsxResolved","PayloadComponent","schemaPath","labels","singular","plural","options","option","value","editor","Error","tabs","tab","clientTab","clientFields","push","hasID","some","f","name","disableBulkEdit"],"mappings":"AAkBA,SAASA,gBA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,IAAI,CAACnB,EAAE,GAAGqB;oBAClB;gBACF;gBAEA;YACF;QAEA;YACE;IACJ;IAEA,OAAOvC;AACT,EAAC;AAED,OAAO,MAAMc,qBAAqB,CAAC,EACjCnB,aAAa,EACboB,eAAe,EACfF,MAAM,EACNf,IAAI,EACJC,SAAS,EAOV;IACC,MAAMyC,eAA8B,EAAE;IAEtC,IAAK,IAAItB,IAAI,GAAGA,IAAIL,OAAOI,MAAM,EAAEC,IAAK;QACtC,MAAMtB,QAAQiB,MAAM,CAACK,EAAE;QAEvB,MAAMlB,cAAcN,kBAAkB;YACpCC;YACAC;YACAE;YACAC;QACF;QAEA,IAAIC,aAAa;YACfwC,aAAaC,IAAI,CAACzC;QACpB;IACF;IAEA,MAAM0C,QAAQpD,sBAAsBuB,QAAQ8B,IAAI,CAAC,CAACC,IAAMvD,iBAAiBuD,MAAMA,EAAEC,IAAI,KAAK;IAE1F,IAAI,CAAC9B,mBAAmB,CAAC2B,OAAO;QAC9BF,aAAaC,IAAI,CAAC;YAChBI,MAAM;YACNjC,MAAMjB;YACNS,OAAO;gBACLK,aAAa;gBACbqC,iBAAiB;gBACjBzC,UAAU;gBACVH,QAAQ;YACV;YACAA,QAAQ;YACRQ,OAAO;QACT;IACF;IAEA,OAAO8B;AACT,EAAC"}
1
+ {"version":3,"sources":["../../../src/fields/config/client.ts"],"sourcesContent":["import type { I18nClient } from '@payloadcms/translations'\n\nimport type {\n AdminClient,\n BlockJSX,\n BlocksFieldClient,\n ClientBlock,\n ClientField,\n Field,\n FieldBase,\n LabelsClient,\n RadioFieldClient,\n RowFieldClient,\n SelectFieldClient,\n TabsFieldClient,\n} from '../../fields/config/types.js'\nimport type { Payload } from '../../types/index.js'\n\nimport { getFromImportMap } from '../../bin/generateImportMap/getFromImportMap.js'\nimport { MissingEditorProp } from '../../errors/MissingEditorProp.js'\nimport { fieldAffectsData } from '../../fields/config/types.js'\nimport { flattenTopLevelFields, type ImportMap } from '../../index.js'\nimport { removeUndefined } from '../../utilities/removeUndefined.js'\n\n// Should not be used - ClientField should be used instead. This is why we don't export ClientField, we don't want people\n// to accidentally use it instead of ClientField and get confused\n\nexport { ClientField }\n\nexport type ServerOnlyFieldProperties =\n | 'dbName' // can be a function\n | 'editor' // This is a `richText` only property\n | 'enumName' // can be a function\n | 'filterOptions' // This is a `relationship` and `upload` only property\n | 'label'\n | 'typescriptSchema'\n | 'validate'\n | keyof Pick<FieldBase, 'access' | 'custom' | 'defaultValue' | 'hooks'>\n\nexport type ServerOnlyFieldAdminProperties = keyof Pick<FieldBase['admin'], 'condition'>\n\nconst serverOnlyFieldProperties: Partial<ServerOnlyFieldProperties>[] = [\n 'hooks',\n 'access',\n 'validate',\n 'defaultValue',\n 'filterOptions', // This is a `relationship` and `upload` only property\n 'editor', // This is a `richText` only property\n 'custom',\n 'typescriptSchema',\n 'dbName', // can be a function\n 'enumName', // can be a function\n // the following props are handled separately (see below):\n // `label`\n // `fields`\n // `blocks`\n // `tabs`\n // `admin`\n]\nconst serverOnlyFieldAdminProperties: Partial<ServerOnlyFieldAdminProperties>[] = ['condition']\ntype FieldWithDescription = {\n admin: AdminClient\n} & ClientField\n\nexport const createClientField = ({\n defaultIDType,\n field: incomingField,\n i18n,\n importMap,\n}: {\n defaultIDType: Payload['config']['db']['defaultIDType']\n field: Field\n i18n: I18nClient\n importMap: ImportMap\n}): ClientField => {\n const clientField: ClientField = {} as ClientField\n\n for (const key in incomingField) {\n if (serverOnlyFieldProperties.includes(key as any)) {\n continue\n }\n\n switch (key) {\n case 'admin':\n if (!incomingField.admin) {\n break\n }\n\n clientField.admin = {} as AdminClient\n\n for (const adminKey in incomingField.admin) {\n if (serverOnlyFieldAdminProperties.includes(adminKey as any)) {\n continue\n }\n\n switch (adminKey) {\n case 'description':\n if ('description' in incomingField.admin) {\n if (typeof incomingField.admin?.description !== 'function') {\n ;(clientField as FieldWithDescription).admin.description =\n incomingField.admin.description\n }\n }\n\n break\n\n default:\n clientField.admin[adminKey] = incomingField.admin[adminKey]\n }\n }\n\n break\n\n case 'blocks':\n case 'fields':\n case 'tabs':\n // Skip - we handle sub-fields in the switch below\n break\n\n case 'label':\n //@ts-expect-error - would need to type narrow\n if (typeof incomingField.label === 'function') {\n //@ts-expect-error - would need to type narrow\n clientField.label = incomingField.label({ t: i18n.t })\n } else {\n //@ts-expect-error - would need to type narrow\n clientField.label = incomingField.label\n }\n\n break\n\n default:\n clientField[key] = incomingField[key]\n }\n }\n\n switch (incomingField.type) {\n case 'array':\n case 'collapsible':\n case 'group':\n case 'row': {\n const field = clientField as unknown as RowFieldClient\n\n if (!field.fields) {\n field.fields = []\n }\n\n field.fields = createClientFields({\n defaultIDType,\n disableAddingID: incomingField.type !== 'array',\n fields: incomingField.fields,\n i18n,\n importMap,\n })\n\n break\n }\n\n case 'blocks': {\n const field = clientField as unknown as BlocksFieldClient\n\n if (incomingField.blocks?.length) {\n for (let i = 0; i < incomingField.blocks.length; i++) {\n const block = incomingField.blocks[i]\n\n // prevent $undefined from being passed through the rsc requests\n const clientBlock = removeUndefined<ClientBlock>({\n slug: block.slug,\n fields: field.blocks?.[i]?.fields || [],\n imageAltText: block.imageAltText,\n imageURL: block.imageURL,\n }) satisfies ClientBlock\n\n if (block.admin?.custom) {\n clientBlock.admin = {\n custom: block.admin.custom,\n }\n }\n\n if (block?.admin?.jsx) {\n const jsxResolved = getFromImportMap<BlockJSX>({\n importMap,\n PayloadComponent: block.admin.jsx,\n schemaPath: '',\n })\n clientBlock.jsx = jsxResolved\n }\n\n if (block.labels) {\n clientBlock.labels = {} as unknown as LabelsClient\n\n if (block.labels.singular) {\n if (typeof block.labels.singular === 'function') {\n clientBlock.labels.singular = block.labels.singular({ t: i18n.t })\n } else {\n clientBlock.labels.singular = block.labels.singular\n }\n if (typeof block.labels.plural === 'function') {\n clientBlock.labels.plural = block.labels.plural({ t: i18n.t })\n } else {\n clientBlock.labels.plural = block.labels.plural\n }\n }\n }\n\n clientBlock.fields = createClientFields({\n defaultIDType,\n fields: block.fields,\n i18n,\n importMap,\n })\n\n if (!field.blocks) {\n field.blocks = []\n }\n\n field.blocks[i] = clientBlock\n }\n }\n\n break\n }\n\n case 'radio':\n // falls through\n case 'select': {\n const field = clientField as RadioFieldClient | SelectFieldClient\n\n if (incomingField.options?.length) {\n for (let i = 0; i < incomingField.options.length; i++) {\n const option = incomingField.options[i]\n\n if (typeof option === 'object' && typeof option.label === 'function') {\n if (!field.options) {\n field.options = []\n }\n\n field.options[i] = {\n label: option.label({ t: i18n.t }),\n value: option.value,\n }\n }\n }\n }\n\n break\n }\n\n case 'richText': {\n if (!incomingField?.editor) {\n throw new MissingEditorProp(incomingField) // while we allow disabling editor functionality, you should not have any richText fields defined if you do not have an editor\n }\n\n if (typeof incomingField?.editor === 'function') {\n throw new Error('Attempted to access unsanitized rich text editor.')\n }\n\n break\n }\n\n case 'tabs': {\n const field = clientField as unknown as TabsFieldClient\n\n if (incomingField.tabs?.length) {\n field.tabs = []\n\n for (let i = 0; i < incomingField.tabs.length; i++) {\n const tab = incomingField.tabs[i]\n const clientTab = {} as unknown as TabsFieldClient['tabs'][0]\n\n for (const key in tab) {\n if (serverOnlyFieldProperties.includes(key as any)) {\n continue\n }\n\n if (key === 'fields') {\n clientTab.fields = createClientFields({\n defaultIDType,\n disableAddingID: true,\n fields: tab.fields,\n i18n,\n importMap,\n })\n } else {\n clientTab[key] = tab[key]\n }\n }\n field.tabs[i] = clientTab\n }\n }\n\n break\n }\n\n default:\n break\n }\n\n return clientField\n}\n\nexport const createClientFields = ({\n defaultIDType,\n disableAddingID,\n fields,\n i18n,\n importMap,\n}: {\n defaultIDType: Payload['config']['db']['defaultIDType']\n disableAddingID?: boolean\n fields: Field[]\n i18n: I18nClient\n importMap: ImportMap\n}): ClientField[] => {\n const clientFields: ClientField[] = []\n\n for (let i = 0; i < fields.length; i++) {\n const field = fields[i]\n\n const clientField = createClientField({\n defaultIDType,\n field,\n i18n,\n importMap,\n })\n\n clientFields.push(clientField)\n }\n\n const hasID = flattenTopLevelFields(fields).some((f) => fieldAffectsData(f) && f.name === 'id')\n\n if (!disableAddingID && !hasID) {\n clientFields.push({\n name: 'id',\n type: defaultIDType,\n admin: {\n description: 'The unique identifier for this document',\n disableBulkEdit: true,\n disabled: true,\n hidden: true,\n },\n hidden: true,\n label: 'ID',\n })\n }\n\n return clientFields\n}\n"],"names":["getFromImportMap","MissingEditorProp","fieldAffectsData","flattenTopLevelFields","removeUndefined","serverOnlyFieldProperties","serverOnlyFieldAdminProperties","createClientField","defaultIDType","field","incomingField","i18n","importMap","clientField","key","includes","admin","adminKey","description","label","t","type","fields","createClientFields","disableAddingID","blocks","length","i","block","clientBlock","slug","imageAltText","imageURL","custom","jsx","jsxResolved","PayloadComponent","schemaPath","labels","singular","plural","options","option","value","editor","Error","tabs","tab","clientTab","clientFields","push","hasID","some","f","name","disableBulkEdit","disabled","hidden"],"mappings":"AAkBA,SAASA,gBAAgB,QAAQ,kDAAiD;AAClF,SAASC,iBAAiB,QAAQ,oCAAmC;AACrE,SAASC,gBAAgB,QAAQ,+BAA8B;AAC/D,SAASC,qBAAqB,QAAwB,iBAAgB;AACtE,SAASC,eAAe,QAAQ,qCAAoC;AAmBpE,MAAMC,4BAAkE;IACtE;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CAOD;AACD,MAAMC,iCAA4E;IAAC;CAAY;AAK/F,OAAO,MAAMC,oBAAoB,CAAC,EAChCC,aAAa,EACbC,OAAOC,aAAa,EACpBC,IAAI,EACJC,SAAS,EAMV;IACC,MAAMC,cAA2B,CAAC;IAElC,IAAK,MAAMC,OAAOJ,cAAe;QAC/B,IAAIL,0BAA0BU,QAAQ,CAACD,MAAa;YAClD;QACF;QAEA,OAAQA;YACN,KAAK;gBACH,IAAI,CAACJ,cAAcM,KAAK,EAAE;oBACxB;gBACF;gBAEAH,YAAYG,KAAK,GAAG,CAAC;gBAErB,IAAK,MAAMC,YAAYP,cAAcM,KAAK,CAAE;oBAC1C,IAAIV,+BAA+BS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B,YAAY,CAAC;wBAEnB,IAAK,MAAMlC,OAAOiC,IAAK;4BACrB,IAAI1C,0BAA0BU,QAAQ,CAACD,MAAa;gCAClD;4BACF;4BAEA,IAAIA,QAAQ,UAAU;gCACpBkC,UAAU1B,MAAM,GAAGC,mBAAmB;oCACpCf;oCACAgB,iBAAiB;oCACjBF,QAAQyB,IAAIzB,MAAM;oCAClBX;oCACAC;gCACF;4BACF,OAAO;gCACLoC,SAAS,CAAClC,IAAI,GAAGiC,GAAG,CAACjC,IAAI;4BAC3B;wBACF;wBACAL,MAAMqC,IAAI,CAACnB,EAAE,GAAGqB;oBAClB;gBACF;gBAEA;YACF;QAEA;YACE;IACJ;IAEA,OAAOnC;AACT,EAAC;AAED,OAAO,MAAMU,qBAAqB,CAAC,EACjCf,aAAa,EACbgB,eAAe,EACfF,MAAM,EACNX,IAAI,EACJC,SAAS,EAOV;IACC,MAAMqC,eAA8B,EAAE;IAEtC,IAAK,IAAItB,IAAI,GAAGA,IAAIL,OAAOI,MAAM,EAAEC,IAAK;QACtC,MAAMlB,QAAQa,MAAM,CAACK,EAAE;QAEvB,MAAMd,cAAcN,kBAAkB;YACpCC;YACAC;YACAE;YACAC;QACF;QAEAqC,aAAaC,IAAI,CAACrC;IACpB;IAEA,MAAMsC,QAAQhD,sBAAsBmB,QAAQ8B,IAAI,CAAC,CAACC,IAAMnD,iBAAiBmD,MAAMA,EAAEC,IAAI,KAAK;IAE1F,IAAI,CAAC9B,mBAAmB,CAAC2B,OAAO;QAC9BF,aAAaC,IAAI,CAAC;YAChBI,MAAM;YACNjC,MAAMb;YACNQ,OAAO;gBACLE,aAAa;gBACbqC,iBAAiB;gBACjBC,UAAU;gBACVC,QAAQ;YACV;YACAA,QAAQ;YACRtC,OAAO;QACT;IACF;IAEA,OAAO8B;AACT,EAAC"}
@@ -1045,6 +1045,8 @@ export type JoinField = {
1045
1045
  admin?: {
1046
1046
  allowCreate?: boolean;
1047
1047
  components?: {
1048
+ afterInput?: CustomComponent[];
1049
+ beforeInput?: CustomComponent[];
1048
1050
  Error?: CustomComponent<JoinFieldErrorClientComponent | JoinFieldErrorServerComponent>;
1049
1051
  Label?: CustomComponent<JoinFieldLabelClientComponent | JoinFieldLabelServerComponent>;
1050
1052
  } & Admin['components'];
@@ -1136,6 +1138,14 @@ export declare function fieldIsSidebar<TField extends ClientField | Field | TabA
1136
1138
  position: 'sidebar';
1137
1139
  };
1138
1140
  } & TField;
1141
+ export declare function fieldIsID<TField extends ClientField | Field>(field: TField): field is {
1142
+ name: 'id';
1143
+ } & TField;
1144
+ export declare function fieldIsHiddenOrDisabled<TField extends ClientField | Field | TabAsField | TabAsFieldClient>(field: TField): field is {
1145
+ admin: {
1146
+ hidden: true;
1147
+ };
1148
+ } & TField;
1139
1149
  export declare function fieldAffectsData<TField extends ClientField | Field | TabAsField | TabAsFieldClient>(field: TField): field is TField & (TField extends ClientField | TabAsFieldClient ? FieldAffectingDataClient : FieldAffectingData);
1140
1150
  export declare function tabHasName<TField extends ClientTab | Tab>(tab: TField): tab is NamedTab & TField;
1141
1151
  export declare function fieldIsLocalized(field: Field | Tab): boolean;