diff --git a/dist/plugin.js b/dist/plugin.js index 4e7bf7b..a2b856e 100644 --- a/dist/plugin.js +++ b/dist/plugin.js @@ -67,8 +67,8 @@ import { buildSeoPlugin, injectAutoFillMeta, injectSeoTabs } from './modules/seo // optional peer dependency at build time (it isn't in the plugin's own // node_modules). Avoids TS2307 without @ts-expect-error; the module // exists at runtime in projects that installed it. - const pkg = '@clocklimited/payload-2fa'; - const mod = await import(pkg); + // @ts-ignore + const mod = await import('@clocklimited/payload-2fa'); // The package exports `payloadTotp`; older/other builds may use // `totpPlugin`. Accept either so a rename doesn't break us. const totp = mod.payloadTotp ?? mod.totpPlugin; diff --git a/dist/plugin.js.map b/dist/plugin.js.map index 07462f5..6fefea4 100644 --- a/dist/plugin.js.map +++ b/dist/plugin.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/plugin.ts"],"sourcesContent":["import type { Config, Plugin } from 'payload'\n\nimport type { IpalOptions } from './types.js'\n\nimport { buildCookieSettings } from './globals/CookieSettings/index.js'\nimport { buildNotifications } from './globals/Notifications/index.js'\nimport { buildSiteIntegrations } from './globals/SiteIntegrations/index.js'\nimport { buildSiteSettings } from './globals/SiteSettings/index.js'\nimport { injectRoles } from './modules/access/index.js'\nimport { buildArchiveFields } from './modules/content/index.js'\nimport { testEmailEndpoint } from './modules/email/test/testEmailEndpoint.js'\nimport { buildFormsPlugin } from './modules/forms/formsPluginConfig.js'\nimport { buildLocalizationConfig, validateI18nConfig } from './modules/i18n/index.js'\nimport { buildSystemPagesFields } from './modules/pages/index.js'\nimport { buildSeoPlugin, injectAutoFillMeta, injectSeoTabs } from './modules/seo/index.js'\n\n/**\n * IPAL (Intecion Payload Advanced Library) plugin for Payload CMS 3.\n *\n * @example\n * ```ts\n * import { ipalKit } from 'ipal-kit'\n *\n * export default buildConfig({\n * plugins: [\n * ipalKit({\n * i18n: {\n * locales: [\n * { code: 'pl', label: 'Polski' },\n * { code: 'en', label: 'English' },\n * ],\n * defaultLocale: 'pl',\n * },\n * access: { authCollection: 'users' },\n * }),\n * ],\n * })\n * ```\n */\nexport const ipalKit = (options: IpalOptions): Plugin => {\n // Validate eagerly — fail fast before Payload boots\n validateI18nConfig(options.i18n)\n\n return async (incomingConfig: Config): Promise => {\n // Early return when disabled — schema stays, behavior off\n if (options.enabled === false) {\n return incomingConfig\n }\n\n let config = { ...incomingConfig }\n\n // --- custom admin route (e.g. '/its' instead of '/admin') ---\n // Sets config.routes.admin; the project must move its app/(payload)//\n // folder to match (plugin can't create files in the project's app/).\n if (options.adminRoute) {\n config.routes = { ...(config.routes ?? {}), admin: options.adminRoute }\n }\n\n // --- enforced 2FA (TOTP) via @clocklimited/payload-2fa ---\n // Enforced by default (forceSetup) unless twoFactor is explicitly false. The\n // plugin is a PEER dependency imported dynamically — ipal-kit doesn't bundle\n // it, so projects that opt out (twoFactor: false) needn't install it, and the\n // import never runs under generate:importmap when 2FA is off. Wrapping access\n // control (not just admin UI) means TOTP gates data access — no API bypass.\n if (options.twoFactor !== false) {\n const tf = options.twoFactor\n if (!tf?.issuer) {\n throw new Error(\n '[ipal] twoFactor.issuer is required (name shown in the authenticator ' +\n 'app). Pass twoFactor: { issuer: \"Your Site\" }, or twoFactor: false to ' +\n 'opt out (discouraged).',\n )\n }\n try {\n // Dynamic specifier via a variable so TS doesn't try to resolve this\n // optional peer dependency at build time (it isn't in the plugin's own\n // node_modules). Avoids TS2307 without @ts-expect-error; the module\n // exists at runtime in projects that installed it.\n const pkg = '@clocklimited/payload-2fa'\n const mod = (await import(pkg)) as {\n payloadTotp?: (opts: Record) => Plugin\n totpPlugin?: (opts: Record) => Plugin\n }\n // The package exports `payloadTotp`; older/other builds may use\n // `totpPlugin`. Accept either so a rename doesn't break us.\n const totp = mod.payloadTotp ?? mod.totpPlugin\n if (typeof totp !== 'function') {\n throw new Error(\n 'expected export payloadTotp (or totpPlugin) to be a function — ' +\n 'check the installed @clocklimited/payload-2fa version',\n )\n }\n config = await totp({\n collection: tf.collectionSlug ?? 'users',\n forceSetup: true, // ENFORCED — every user must set up TOTP; no opt-out\n totp: { issuer: tf.issuer },\n })(config)\n } catch (err) {\n throw new Error(\n '[ipal] 2FA is enforced but @clocklimited/payload-2fa is not installed. ' +\n 'Run: pnpm add @clocklimited/payload-2fa — or set twoFactor: false to ' +\n `opt out (discouraged). Original error: ${String(err)}`,\n )\n }\n }\n\n // --- i18n ---\n config.localization = buildLocalizationConfig(options.i18n)\n\n // --- access: inject roles into the client's auth collection ---\n if (options.access) {\n config = injectRoles(config, options.access)\n }\n\n // --- seo: apply @payloadcms/plugin-seo directly ---\n // NOTE: apply the plugin function to the config immediately rather than\n // pushing it onto config.plugins. Payload has already iterated the plugins\n // array by the time IPAL runs, so nested plugins added to that list are\n // never executed. Calling the plugin as (config) => config applies its\n // transform now.\n if (options.seo) {\n config = await buildSeoPlugin({ seo: options.seo })(config)\n // Auto-fill empty meta from document content on save\n config = injectAutoFillMeta(config, options.seo)\n // Wrap fields into Content + SEO tabs (replaces plugin-seo's tabbedUI,\n // which breaks when other fields already exist in the collection)\n config = injectSeoTabs(config, options.seo)\n }\n\n // --- forms: apply @payloadcms/plugin-form-builder directly ---\n if (options.forms) {\n config = await buildFormsPlugin(options.forms)(config)\n }\n\n // --- globals ---\n // The System Pages tab collects every \"which page plays this role\"\n // assignment. Composing it here keeps SiteSettings unaware of which modules\n // are enabled — it just renders the fields it's given.\n const systemPageFields = [\n ...(options.pages ? buildSystemPagesFields(options.pages) : []),\n ...(options.content && options.pages\n ? buildArchiveFields(options.content, options.pages.slug)\n : []),\n ]\n\n config.globals = [\n ...(config.globals ?? []),\n buildSiteSettings({\n additionalFields: options.siteSettingsFields,\n systemPageFields,\n }),\n buildSiteIntegrations({ additionalFields: options.integrationsFields }),\n buildCookieSettings(),\n buildNotifications(),\n ]\n\n config.endpoints = [...(config.endpoints ?? []), testEmailEndpoint]\n\n // --- hooks: onInit ---\n const incomingOnInit = config.onInit\n config.onInit = async (payload) => {\n if (incomingOnInit) {await incomingOnInit(payload)}\n payload.logger.info('[ipal] Plugin initialized.')\n }\n\n return config\n }\n}\n"],"names":["buildCookieSettings","buildNotifications","buildSiteIntegrations","buildSiteSettings","injectRoles","buildArchiveFields","testEmailEndpoint","buildFormsPlugin","buildLocalizationConfig","validateI18nConfig","buildSystemPagesFields","buildSeoPlugin","injectAutoFillMeta","injectSeoTabs","ipalKit","options","i18n","incomingConfig","enabled","config","adminRoute","routes","admin","twoFactor","tf","issuer","Error","pkg","mod","totp","payloadTotp","totpPlugin","collection","collectionSlug","forceSetup","err","String","localization","access","seo","forms","systemPageFields","pages","content","slug","globals","additionalFields","siteSettingsFields","integrationsFields","endpoints","incomingOnInit","onInit","payload","logger","info"],"mappings":"AAIA,SAASA,mBAAmB,QAAQ,oCAAmC;AACvE,SAASC,kBAAkB,QAAQ,mCAAkC;AACrE,SAASC,qBAAqB,QAAQ,sCAAqC;AAC3E,SAASC,iBAAiB,QAAQ,kCAAiC;AACnE,SAASC,WAAW,QAAQ,4BAA2B;AACvD,SAASC,kBAAkB,QAAQ,6BAA4B;AAC/D,SAASC,iBAAiB,QAAQ,4CAA2C;AAC7E,SAASC,gBAAgB,QAAQ,uCAAsC;AACvE,SAASC,uBAAuB,EAAEC,kBAAkB,QAAQ,0BAAyB;AACrF,SAASC,sBAAsB,QAAQ,2BAA0B;AACjE,SAASC,cAAc,EAAEC,kBAAkB,EAAEC,aAAa,QAAQ,yBAAwB;AAE1F;;;;;;;;;;;;;;;;;;;;;;CAsBC,GACD,OAAO,MAAMC,UAAU,CAACC;IACtB,oDAAoD;IACpDN,mBAAmBM,QAAQC,IAAI;IAE/B,OAAO,OAAOC;QACZ,0DAA0D;QAC1D,IAAIF,QAAQG,OAAO,KAAK,OAAO;YAC7B,OAAOD;QACT;QAEA,IAAIE,SAAS;YAAE,GAAGF,cAAc;QAAC;QAEjC,+DAA+D;QAC/D,6EAA6E;QAC7E,qEAAqE;QACrE,IAAIF,QAAQK,UAAU,EAAE;YACtBD,OAAOE,MAAM,GAAG;gBAA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YACpD,qDAAqD;YACrDA,SAASP,mBAAmBO,QAAQJ,QAAQwB,GAAG;YAC/C,uEAAuE;YACvE,kEAAkE;YAClEpB,SAASN,cAAcM,QAAQJ,QAAQwB,GAAG;QAC5C;QAEA,gEAAgE;QAChE,IAAIxB,QAAQyB,KAAK,EAAE;YACjBrB,SAAS,MAAMZ,iBAAiBQ,QAAQyB,KAAK,EAAErB;QACjD;QAEA,kBAAkB;QAClB,mEAAmE;QACnE,4EAA4E;QAC5E,uDAAuD;QACvD,MAAMsB,mBAAmB;eACnB1B,QAAQ2B,KAAK,GAAGhC,uBAAuBK,QAAQ2B,KAAK,IAAI,EAAE;eAC1D3B,QAAQ4B,OAAO,IAAI5B,QAAQ2B,KAAK,GAChCrC,mBAAmBU,QAAQ4B,OAAO,EAAE5B,QAAQ2B,KAAK,CAACE,IAAI,IACtD,EAAE;SACP;QAEDzB,OAAO0B,OAAO,GAAG;eACX1B,OAAO0B,OAAO,IAAI,EAAE;YACxB1C,kBAAkB;gBAChB2C,kBAAkB/B,QAAQgC,kBAAkB;gBAC5CN;YACF;YACAvC,sBAAsB;gBAAE4C,kBAAkB/B,QAAQiC,kBAAkB;YAAC;YACrEhD;YACAC;SACD;QAEDkB,OAAO8B,SAAS,GAAG;eAAK9B,OAAO8B,SAAS,IAAI,EAAE;YAAG3C;SAAkB;QAEnE,wBAAwB;QACxB,MAAM4C,iBAAiB/B,OAAOgC,MAAM;QACpChC,OAAOgC,MAAM,GAAG,OAAOC;YACrB,IAAIF,gBAAgB;gBAAC,MAAMA,eAAeE;YAAQ;YAClDA,QAAQC,MAAM,CAACC,IAAI,CAAC;QACtB;QAEA,OAAOnC;IACT;AACF,EAAC"} \ No newline at end of file +{"version":3,"sources":["../src/plugin.ts"],"sourcesContent":["import type { Config, Plugin } from 'payload'\n\nimport type { IpalOptions } from './types.js'\n\nimport { buildCookieSettings } from './globals/CookieSettings/index.js'\nimport { buildNotifications } from './globals/Notifications/index.js'\nimport { buildSiteIntegrations } from './globals/SiteIntegrations/index.js'\nimport { buildSiteSettings } from './globals/SiteSettings/index.js'\nimport { injectRoles } from './modules/access/index.js'\nimport { buildArchiveFields } from './modules/content/index.js'\nimport { testEmailEndpoint } from './modules/email/test/testEmailEndpoint.js'\nimport { buildFormsPlugin } from './modules/forms/formsPluginConfig.js'\nimport { buildLocalizationConfig, validateI18nConfig } from './modules/i18n/index.js'\nimport { buildSystemPagesFields } from './modules/pages/index.js'\nimport { buildSeoPlugin, injectAutoFillMeta, injectSeoTabs } from './modules/seo/index.js'\n\n/**\n * IPAL (Intecion Payload Advanced Library) plugin for Payload CMS 3.\n *\n * @example\n * ```ts\n * import { ipalKit } from 'ipal-kit'\n *\n * export default buildConfig({\n * plugins: [\n * ipalKit({\n * i18n: {\n * locales: [\n * { code: 'pl', label: 'Polski' },\n * { code: 'en', label: 'English' },\n * ],\n * defaultLocale: 'pl',\n * },\n * access: { authCollection: 'users' },\n * }),\n * ],\n * })\n * ```\n */\nexport const ipalKit = (options: IpalOptions): Plugin => {\n // Validate eagerly — fail fast before Payload boots\n validateI18nConfig(options.i18n)\n\n return async (incomingConfig: Config): Promise => {\n // Early return when disabled — schema stays, behavior off\n if (options.enabled === false) {\n return incomingConfig\n }\n\n let config = { ...incomingConfig }\n\n // --- custom admin route (e.g. '/its' instead of '/admin') ---\n // Sets config.routes.admin; the project must move its app/(payload)//\n // folder to match (plugin can't create files in the project's app/).\n if (options.adminRoute) {\n config.routes = { ...(config.routes ?? {}), admin: options.adminRoute }\n }\n\n // --- enforced 2FA (TOTP) via @clocklimited/payload-2fa ---\n // Enforced by default (forceSetup) unless twoFactor is explicitly false. The\n // plugin is a PEER dependency imported dynamically — ipal-kit doesn't bundle\n // it, so projects that opt out (twoFactor: false) needn't install it, and the\n // import never runs under generate:importmap when 2FA is off. Wrapping access\n // control (not just admin UI) means TOTP gates data access — no API bypass.\n if (options.twoFactor !== false) {\n const tf = options.twoFactor\n if (!tf?.issuer) {\n throw new Error(\n '[ipal] twoFactor.issuer is required (name shown in the authenticator ' +\n 'app). Pass twoFactor: { issuer: \"Your Site\" }, or twoFactor: false to ' +\n 'opt out (discouraged).',\n )\n }\n try {\n // Dynamic specifier via a variable so TS doesn't try to resolve this\n // optional peer dependency at build time (it isn't in the plugin's own\n // node_modules). Avoids TS2307 without @ts-expect-error; the module\n // exists at runtime in projects that installed it.\n // @ts-ignore\n const mod = (await import('@clocklimited/payload-2fa')) as {\n payloadTotp?: (opts: Record) => Plugin\n totpPlugin?: (opts: Record) => Plugin\n }\n // The package exports `payloadTotp`; older/other builds may use\n // `totpPlugin`. Accept either so a rename doesn't break us.\n const totp = mod.payloadTotp ?? mod.totpPlugin\n if (typeof totp !== 'function') {\n throw new Error(\n 'expected export payloadTotp (or totpPlugin) to be a function — ' +\n 'check the installed @clocklimited/payload-2fa version',\n )\n }\n config = await totp({\n collection: tf.collectionSlug ?? 'users',\n forceSetup: true, // ENFORCED — every user must set up TOTP; no opt-out\n totp: { issuer: tf.issuer },\n })(config)\n } catch (err) {\n throw new Error(\n '[ipal] 2FA is enforced but @clocklimited/payload-2fa is not installed. ' +\n 'Run: pnpm add @clocklimited/payload-2fa — or set twoFactor: false to ' +\n `opt out (discouraged). Original error: ${String(err)}`,\n )\n }\n }\n\n // --- i18n ---\n config.localization = buildLocalizationConfig(options.i18n)\n\n // --- access: inject roles into the client's auth collection ---\n if (options.access) {\n config = injectRoles(config, options.access)\n }\n\n // --- seo: apply @payloadcms/plugin-seo directly ---\n // NOTE: apply the plugin function to the config immediately rather than\n // pushing it onto config.plugins. Payload has already iterated the plugins\n // array by the time IPAL runs, so nested plugins added to that list are\n // never executed. Calling the plugin as (config) => config applies its\n // transform now.\n if (options.seo) {\n config = await buildSeoPlugin({ seo: options.seo })(config)\n // Auto-fill empty meta from document content on save\n config = injectAutoFillMeta(config, options.seo)\n // Wrap fields into Content + SEO tabs (replaces plugin-seo's tabbedUI,\n // which breaks when other fields already exist in the collection)\n config = injectSeoTabs(config, options.seo)\n }\n\n // --- forms: apply @payloadcms/plugin-form-builder directly ---\n if (options.forms) {\n config = await buildFormsPlugin(options.forms)(config)\n }\n\n // --- globals ---\n // The System Pages tab collects every \"which page plays this role\"\n // assignment. Composing it here keeps SiteSettings unaware of which modules\n // are enabled — it just renders the fields it's given.\n const systemPageFields = [\n ...(options.pages ? buildSystemPagesFields(options.pages) : []),\n ...(options.content && options.pages\n ? buildArchiveFields(options.content, options.pages.slug)\n : []),\n ]\n\n config.globals = [\n ...(config.globals ?? []),\n buildSiteSettings({\n additionalFields: options.siteSettingsFields,\n systemPageFields,\n }),\n buildSiteIntegrations({ additionalFields: options.integrationsFields }),\n buildCookieSettings(),\n buildNotifications(),\n ]\n\n config.endpoints = [...(config.endpoints ?? []), testEmailEndpoint]\n\n // --- hooks: onInit ---\n const incomingOnInit = config.onInit\n config.onInit = async (payload) => {\n if (incomingOnInit) {await incomingOnInit(payload)}\n payload.logger.info('[ipal] Plugin initialized.')\n }\n\n return config\n }\n}\n"],"names":["buildCookieSettings","buildNotifications","buildSiteIntegrations","buildSiteSettings","injectRoles","buildArchiveFields","testEmailEndpoint","buildFormsPlugin","buildLocalizationConfig","validateI18nConfig","buildSystemPagesFields","buildSeoPlugin","injectAutoFillMeta","injectSeoTabs","ipalKit","options","i18n","incomingConfig","enabled","config","adminRoute","routes","admin","twoFactor","tf","issuer","Error","mod","totp","payloadTotp","totpPlugin","collection","collectionSlug","forceSetup","err","String","localization","access","seo","forms","systemPageFields","pages","content","slug","globals","additionalFields","siteSettingsFields","integrationsFields","endpoints","incomingOnInit","onInit","payload","logger","info"],"mappings":"AAIA,SAASA,mBAAmB,QAAQ,oCAAmC;AACvE,SAASC,kBAAkB,QAAQ,mCAAkC;AACrE,SAASC,qBAAqB,QAAQ,sCAAqC;AAC3E,SAASC,iBAAiB,QAAQ,kCAAiC;AACnE,SAASC,WAAW,QAAQ,4BAA2B;AACvD,SAASC,kBAAkB,QAAQ,6BAA4B;AAC/D,SAASC,iBAAiB,QAAQ,4CAA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BAAE2C,kBAAkB9B,QAAQgC,kBAAkB;YAAC;YACrE/C;YACAC;SACD;QAEDkB,OAAO6B,SAAS,GAAG;eAAK7B,OAAO6B,SAAS,IAAI,EAAE;YAAG1C;SAAkB;QAEnE,wBAAwB;QACxB,MAAM2C,iBAAiB9B,OAAO+B,MAAM;QACpC/B,OAAO+B,MAAM,GAAG,OAAOC;YACrB,IAAIF,gBAAgB;gBAAC,MAAMA,eAAeE;YAAQ;YAClDA,QAAQC,MAAM,CAACC,IAAI,CAAC;QACtB;QAEA,OAAOlC;IACT;AACF,EAAC"} \ No newline at end of file diff --git a/src/plugin.ts b/src/plugin.ts index b66c34a..0f15c00 100644 --- a/src/plugin.ts +++ b/src/plugin.ts @@ -76,8 +76,8 @@ export const ipalKit = (options: IpalOptions): Plugin => { // optional peer dependency at build time (it isn't in the plugin's own // node_modules). Avoids TS2307 without @ts-expect-error; the module // exists at runtime in projects that installed it. - const pkg = '@clocklimited/payload-2fa' - const mod = (await import(pkg)) as { + // @ts-ignore + const mod = (await import('@clocklimited/payload-2fa')) as { payloadTotp?: (opts: Record) => Plugin totpPlugin?: (opts: Record) => Plugin }