@foldspace-fe/casdoor-next-auth-kit 0.1.14 → 0.1.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/billing/index.d.ts +18 -3
- package/dist/billing/index.js +22 -2
- package/dist/{callback-BTzHQK_r.d.ts → callback-rEWxVGyL.d.ts} +1 -1
- package/dist/casdoor/index.d.ts +2 -2
- package/dist/chunk-46V73LSW.js +494 -0
- package/dist/chunk-46V73LSW.js.map +1 -0
- package/dist/{chunk-CULH4UKG.js → chunk-FW4WDHNS.js} +15 -1
- package/dist/chunk-FW4WDHNS.js.map +1 -0
- package/dist/{chunk-QYGC4WNG.js → chunk-GLK4IW22.js} +37 -33
- package/dist/chunk-GLK4IW22.js.map +1 -0
- package/dist/{chunk-5ISF7ZAG.js → chunk-ZCHLJYLN.js} +14 -43
- package/dist/chunk-ZCHLJYLN.js.map +1 -0
- package/dist/cli.js +110 -14
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +6 -6
- package/dist/index.js +24 -4
- package/dist/next/index.d.ts +3 -3
- package/dist/next/index.js +1 -1
- package/dist/{options-JUwZSXu2.d.ts → options-D2YQdRWu.d.ts} +1 -1
- package/dist/react/index.d.ts +26 -6
- package/dist/react/index.js +285 -12
- package/dist/react/index.js.map +1 -1
- package/dist/skills/casdoor-next-auth-kit/SKILL.md +22 -6
- package/dist/{types-DqVXdUge.d.ts → types-BJv6j3NZ.d.ts} +1 -0
- package/dist/types-xgHVGy75.d.ts +895 -0
- package/package.json +4 -3
- package/dist/chunk-5ISF7ZAG.js.map +0 -1
- package/dist/chunk-CULH4UKG.js.map +0 -1
- package/dist/chunk-O3FKI5NT.js +0 -187
- package/dist/chunk-O3FKI5NT.js.map +0 -1
- package/dist/chunk-QYGC4WNG.js.map +0 -1
- package/dist/types-DwThfdu-.d.ts +0 -362
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../package.json","../src/cli/operations.ts","../src/cli/fs.ts","../src/cli/templates.ts","../src/cli/index.ts","../src/cli.ts"],"sourcesContent":["{\n \"name\": \"@foldspace-fe/casdoor-next-auth-kit\",\n \"version\": \"0.1.0\",\n \"private\": false,\n \"type\": \"module\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/foldspace-stack/casdoor-next-auth-kit\"\n },\n \"homepage\": \"https://github.com/foldspace-stack/casdoor-next-auth-kit#readme\",\n \"bugs\": {\n \"url\": \"https://github.com/foldspace-stack/casdoor-next-auth-kit/issues\"\n },\n \"main\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"exports\": {\n \".\": {\n \"types\": \"./dist/index.d.ts\",\n \"default\": \"./dist/index.js\"\n },\n \"./casdoor\": {\n \"types\": \"./dist/casdoor/index.d.ts\",\n \"default\": \"./dist/casdoor/index.js\"\n },\n \"./next\": {\n \"types\": \"./dist/next/index.d.ts\",\n \"default\": \"./dist/next/index.js\"\n },\n \"./billing\": {\n \"types\": \"./dist/billing/index.d.ts\",\n \"default\": \"./dist/billing/index.js\"\n },\n \"./react\": {\n \"types\": \"./dist/react/index.d.ts\",\n \"default\": \"./dist/react/index.js\"\n }\n },\n \"bin\": {\n \"casdoor-next-auth-kit\": \"./dist/cli.js\"\n },\n \"publishConfig\": {\n \"access\": \"public\",\n \"provenance\": true\n },\n \"files\": [\"dist\", \"README.md\"],\n \"scripts\": {\n \"build\": \"tsup && node ./scripts/copy-skill.mjs\",\n \"test\": \"pnpm build && node --test --experimental-strip-types ./scripts/verify-casdoor-proxy.mjs\",\n \"typecheck\": \"tsc -p tsconfig.json --noEmit\",\n \"dev\": \"tsup --watch\"\n },\n \"peerDependencies\": {\n \"next\": \">=16\",\n \"next-auth\": \"^4.24.0\",\n \"react\": \">=19\",\n \"react-dom\": \">=19\"\n },\n \"dependencies\": {\n \"jose\": \"^6.1.0\"\n },\n \"devDependencies\": {\n \"@types/node\": \"^22.15.0\",\n \"@types/react\": \"^19.2.0\",\n \"@types/react-dom\": \"^19.2.0\",\n \"tsup\": \"^8.5.0\",\n \"typescript\": \"^5.6.3\"\n }\n}\n","import fs from 'node:fs';\nimport path from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nimport { AUTH_KIT_ENV_FILES, getMissingManagedEnvKeys } from '../core/env';\nimport { exists, preserveCustomBlock, read, removePath, writeGeneratedFile, writeTextFile } from './fs';\nimport {\n apiProxyRouteTemplate,\n authConfigTemplate,\n authIndexHtmlTemplate,\n authLoginRouteTemplate,\n authSignupRouteTemplate,\n callbackErrorClearCookiesButtonTemplate,\n callbackErrorPageTemplate,\n authorizeRouteTemplate,\n callbackRouteTemplate,\n billingPaymentFinishedHandlerTemplate,\n billingPaymentSuccessHandlerTemplate,\n commerceProxyRouteTemplate,\n envTemplate,\n logoutRouteTemplate,\n nextAuthRouteTemplate,\n paymentFinishedRouteTemplate,\n paymentSuccessRouteTemplate,\n prismaSchemaTemplate,\n signupAuthorizeRouteTemplate,\n} from './templates';\n\nconst projectRoot = process.cwd();\nconst distRoot = path.dirname(fileURLToPath(import.meta.url));\nconst canonicalSkillPaths = [\n path.join(distRoot, 'skills/casdoor-next-auth-kit'),\n path.resolve(distRoot, '..', '..', '..', 'skills/casdoor-next-auth-kit'),\n];\nconst skillTarget = '.agents/skills/casdoor-next-auth-kit';\n\nconst targets = [\n ['app/(auth-kit)/auth-config.ts', authConfigTemplate],\n ['app/(auth-kit)/auth/login/route.ts', authLoginRouteTemplate],\n ['app/(auth-kit)/auth/signup/route.ts', authSignupRouteTemplate],\n ['app/(auth-kit)/login/oauth/authorize/route.ts', authorizeRouteTemplate],\n ['app/(auth-kit)/signup/oauth/authorize/route.ts', signupAuthorizeRouteTemplate],\n ['app/(auth-kit)/auth/api/[...path]/route.ts', apiProxyRouteTemplate],\n ['app/(auth-kit)/api/auth/[...nextauth]/route.ts', nextAuthRouteTemplate],\n ['app/(auth-kit)/auth/payment/success/route.ts', paymentSuccessRouteTemplate],\n ['app/(auth-kit)/auth/payment/finished/route.ts', paymentFinishedRouteTemplate],\n ['app/(auth-kit)/callback/route.ts', callbackRouteTemplate],\n ['app/(auth-kit)/callback/error/page.tsx', callbackErrorPageTemplate],\n ['app/(auth-kit)/callback/error/clear-domain-cookies-button.tsx', callbackErrorClearCookiesButtonTemplate],\n ['app/(auth-kit)/logout/route.ts', logoutRouteTemplate],\n ['app/(auth-kit)/auth/api/commerce/[...path]/route.ts', commerceProxyRouteTemplate],\n ['lib/billing/payment-success.ts', billingPaymentSuccessHandlerTemplate],\n ['lib/billing/payment-finished.ts', billingPaymentFinishedHandlerTemplate],\n ['app/(auth-kit)/index-html.ts', authIndexHtmlTemplate],\n ['prisma/auth-kit.prisma', prismaSchemaTemplate],\n] as const;\n\nconst deprecatedTargets = [\n 'app/(auth-kit)/api/casdoor/[...path]/route.ts',\n 'app/(auth-kit)/api/casdoor/commerce/[...path]/route.ts',\n 'app/(auth-kit)/auth/api/casdoor/[...path]/route.ts',\n 'app/(auth-kit)/auth/api/casdoor/commerce/[...path]/route.ts',\n 'app/(auth-kit)/login/route.ts',\n 'app/(auth-kit)/signup/route.ts',\n 'app/(auth-kit)/signup/oauth/authorize/route.ts',\n 'app/(auth-kit)/auth/payment-success/route.ts',\n 'app/(auth-kit)/auth/payment/finished/page.tsx',\n 'app/(auth-kit)/callback/error/page.tsx',\n 'app/auth/index-html.ts',\n 'app/auth/libs/index.ts',\n 'app/auth/libs/auth-config.ts',\n 'app/auth/libs/casdoor-config.ts',\n 'app/auth/libs/session-token.ts',\n 'app/auth/libs/oauth-state.ts',\n 'app/auth/libs/page-proxy.ts',\n 'app/auth/libs/api-proxy.ts',\n 'app/auth/libs/casdoor-oauth.ts',\n 'app/auth/libs/nextauth-route.ts',\n 'app/auth/libs',\n 'lib/auth-kit/index.ts',\n 'lib/auth-kit/index-html.ts',\n 'lib/auth-kit',\n 'lib/casdoor-entry.ts',\n 'lib/auth.ts',\n 'lib/public-origin.ts',\n 'lib/request-security.ts',\n 'lib/auth-redirect.ts',\n] as const;\n\nfunction logCreated(filePath: string) {\n console.log(`+ ${path.relative(projectRoot, filePath)}`);\n}\n\nfunction logUpdated(filePath: string) {\n console.log(`~ ${path.relative(projectRoot, filePath)}`);\n}\n\nfunction logRemoved(filePath: string) {\n console.log(`- ${path.relative(projectRoot, filePath)}`);\n}\n\nfunction syncManagedEnvFiles() {\n for (const file of AUTH_KIT_ENV_FILES) {\n const filePath = path.join(projectRoot, file);\n const existed = exists(filePath);\n const current = existed ? read(filePath) : '';\n const next = envTemplate(file, current);\n if (!existed || current !== next) {\n writeTextFile(filePath, next);\n if (!existed) {\n logCreated(filePath);\n } else {\n logUpdated(filePath);\n }\n }\n }\n}\n\nfunction syncManagedSkillFile() {\n const filePath = path.join(projectRoot, skillTarget);\n try {\n const sourcePath = canonicalSkillPaths.find((candidate) => fs.existsSync(candidate));\n if (!sourcePath) {\n throw new Error(`Unable to locate canonical skill directory. Checked: ${canonicalSkillPaths.join(', ')}`);\n }\n removePath(filePath);\n fs.mkdirSync(filePath, { recursive: true });\n logCreated(filePath);\n for (const entry of fs.readdirSync(sourcePath, { withFileTypes: true })) {\n const sourceEntry = path.join(sourcePath, entry.name);\n const targetEntry = path.join(filePath, entry.name);\n if (entry.isDirectory()) {\n fs.cpSync(sourceEntry, targetEntry, { recursive: true });\n console.log(`+ ${path.relative(projectRoot, targetEntry)}/`);\n continue;\n }\n fs.copyFileSync(sourceEntry, targetEntry);\n console.log(`+ ${path.relative(projectRoot, targetEntry)}`);\n }\n } catch (error) {\n console.warn(`Skipped skill sync for ${skillTarget}: ${error instanceof Error ? error.message : String(error)}`);\n }\n}\n\nexport async function initProject() {\n for (const [rel, factory] of targets) {\n const filePath = path.join(projectRoot, rel);\n if (!exists(filePath)) {\n writeGeneratedFile(filePath, factory());\n logCreated(filePath);\n }\n }\n\n syncManagedEnvFiles();\n syncManagedSkillFile();\n console.log('Initialized casdoor-next-auth-kit managed files.');\n}\n\nexport async function updateProject() {\n for (const rel of deprecatedTargets) {\n const filePath = path.join(projectRoot, rel);\n if (exists(filePath)) {\n removePath(filePath);\n logRemoved(filePath);\n }\n }\n\n for (const [rel, factory] of targets) {\n const filePath = path.join(projectRoot, rel);\n const next = '// generated by @foldspace-fe/casdoor-next-auth-kit\\n' + factory();\n if (!exists(filePath)) {\n writeGeneratedFile(filePath, factory());\n logCreated(filePath);\n continue;\n }\n\n if (rel === 'app/(auth-kit)/auth-config.ts') {\n const current = read(filePath);\n if (current !== next) {\n writeTextFile(filePath, next);\n logUpdated(filePath);\n }\n continue;\n }\n\n const current = read(filePath);\n const updated = preserveCustomBlock(current, next);\n if (current !== updated) {\n writeTextFile(filePath, updated);\n logUpdated(filePath);\n }\n }\n\n syncManagedEnvFiles();\n syncManagedSkillFile();\n console.log('Updated managed route shells, env files, and skill file.');\n}\n\nexport async function checkProject() {\n const missingRoutes = targets.filter(([rel]) => !exists(path.join(projectRoot, rel))).map(([rel]) => rel);\n const missingEnv = AUTH_KIT_ENV_FILES.filter((file) => {\n const filePath = path.join(projectRoot, file);\n if (!exists(filePath)) {\n return true;\n }\n return getMissingManagedEnvKeys(read(filePath)).length > 0;\n });\n const skillDir = path.join(projectRoot, skillTarget);\n const missingSkill = exists(path.join(skillDir, 'SKILL.md')) ? [] : [path.join(skillTarget, 'SKILL.md')];\n const missing = [...missingRoutes, ...missingEnv, ...missingSkill];\n\n if (missing.length > 0) {\n console.error('Missing generated files:');\n for (const rel of missing) {\n console.error('- ' + rel);\n }\n process.exitCode = 1;\n return;\n }\n\n console.log('All managed files are present.');\n}\n"," import fs from 'node:fs';\n import path from 'node:path';\n\n export const generatedHeader = '// generated by @foldspace-fe/casdoor-next-auth-kit\\n';\n export const customBegin = '// @foldspace-fe/casdoor-next-auth-kit:begin custom';\n export const customEnd = '// @foldspace-fe/casdoor-next-auth-kit:end custom';\n\nexport function ensureDir(filePath: string) {\n fs.mkdirSync(path.dirname(filePath), { recursive: true });\n}\n\nexport function writeGeneratedFile(filePath: string, content: string) {\n ensureDir(filePath);\n fs.writeFileSync(filePath, generatedHeader + content, 'utf8');\n}\n\nexport function writeTextFile(filePath: string, content: string) {\n ensureDir(filePath);\n fs.writeFileSync(filePath, content, 'utf8');\n}\n\nexport function exists(filePath: string) {\n return fs.existsSync(filePath);\n}\n\n export function read(filePath: string) {\n return fs.readFileSync(filePath, 'utf8');\n }\n\nexport function preserveCustomBlock(existing: string, next: string) {\n const begin = existing.indexOf(customBegin);\n const end = existing.indexOf(customEnd);\n if (begin === -1 || end === -1 || end <= begin) return next;\n const custom = existing.slice(begin, end + customEnd.length);\n const targetBegin = next.indexOf(customBegin);\n const targetEnd = next.indexOf(customEnd);\n if (targetBegin === -1 || targetEnd === -1 || targetEnd <= targetBegin) return next;\n return next.slice(0, targetBegin) + custom + next.slice(targetEnd + customEnd.length);\n}\n\nexport function removePath(filePath: string) {\n fs.rmSync(filePath, { force: true, recursive: true });\n}\n","import { customBegin, customEnd } from './fs';\nimport { buildAuthPrismaSchemaTemplate } from '../prisma/schema-template';\nimport { AUTH_KIT_ENV_FILES, buildManagedEnvTemplate } from '../core/env';\n\nexport function authLoginRouteTemplate() {\n return `import { loginHandler } from '../../auth-config';\n\nexport const dynamic = 'force-dynamic';\n\nexport const GET = loginHandler;\n`;\n}\n\nexport function authSignupRouteTemplate() {\n return `import { signupHandler } from '../../auth-config';\n\nexport const dynamic = 'force-dynamic';\n\nexport const GET = signupHandler;\n`;\n}\n\nexport function authorizeRouteTemplate() {\n return `import { authorizeHandler } from '../../../auth-config';\n\nexport const dynamic = 'force-dynamic';\n\nexport const GET = authorizeHandler;\n`;\n}\n\nexport function signupAuthorizeRouteTemplate() {\n return `import { authorizeHandler } from '../../../auth-config';\n\nexport const dynamic = 'force-dynamic';\n\nexport const GET = authorizeHandler;\n`;\n}\n\nexport function callbackRouteTemplate() {\n return `import { callbackHandler } from '../auth-config';\n\nexport const dynamic = 'force-dynamic';\n\nexport const GET = callbackHandler;\n`;\n}\n\nexport function logoutRouteTemplate() {\n return `import { logoutHandler } from '../auth-config';\n\nexport const dynamic = 'force-dynamic';\n\nexport const GET = logoutHandler;\n`;\n}\n\nexport function callbackErrorPageTemplate() {\n return `import { ClearDomainCookiesButton } from './clear-domain-cookies-button';\n\nexport const dynamic = 'force-dynamic';\n\nexport default async function CallbackErrorPage({\n searchParams,\n}: {\n searchParams: Promise<{ title?: string; message?: string; details?: string }>;\n}) {\n const params = await searchParams;\n\n return (\n <main style={{ background: '#fff', borderRadius: 24, padding: 28, boxShadow: '0 18px 40px rgba(15, 23, 42, 0.08)' }}>\n <h2 style={{ marginTop: 0 }}>{params.title ?? 'Callback Error'}</h2>\n <p>{params.message ?? 'Unknown callback failure.'}</p>\n {params.details ? <pre style={{ whiteSpace: 'pre-wrap' }}>{params.details}</pre> : null}\n${customBegin}\n <div style={{ display: 'flex', flexWrap: 'wrap', gap: 12, marginTop: 24 }}>\n <ClearDomainCookiesButton />\n <a href=\"/\" style={{ display: 'inline-flex', alignItems: 'center', justifyContent: 'center', minHeight: 44, padding: '0 16px', borderRadius: 9999, border: '1px solid rgba(148, 163, 184, 0.35)', color: '#0f172a', textDecoration: 'none', background: 'rgba(248, 250, 252, 0.9)' }}>返回首页</a>\n <a href=\"/auth/login\" style={{ display: 'inline-flex', alignItems: 'center', justifyContent: 'center', minHeight: 44, padding: '0 16px', borderRadius: 9999, border: '1px solid rgba(148, 163, 184, 0.35)', color: '#0f172a', textDecoration: 'none', background: 'rgba(248, 250, 252, 0.9)' }}>重新登录</a>\n <a href=\"/auth/signup\" style={{ display: 'inline-flex', alignItems: 'center', justifyContent: 'center', minHeight: 44, padding: '0 16px', borderRadius: 9999, border: '1px solid rgba(148, 163, 184, 0.35)', color: '#0f172a', textDecoration: 'none', background: 'rgba(248, 250, 252, 0.9)' }}>去注册</a>\n </div>\n${customEnd}\n </main>\n );\n}\n`;\n}\n\nexport function callbackErrorClearCookiesButtonTemplate() {\n return `'use client';\n\nimport { useState } from 'react';\n\nconst AUTH_COOKIE_NAMES = [\n 'auth_origin',\n 'auth_redirect',\n 'oauth_state',\n 'pkce_code_verifier',\n 'next-auth.session-token',\n '__Secure-next-auth.session-token',\n 'next-auth.csrf-token',\n '__Secure-next-auth.csrf-token',\n '__Host-next-auth.csrf-token',\n];\n\nfunction getPathCandidates(pathname: string): string[] {\n const normalized = pathname.startsWith('/') ? pathname : '/' + pathname;\n const segments = normalized.split('/').filter(Boolean);\n const paths = new Set<string>(['/']);\n\n let current = '';\n for (const segment of segments) {\n current += '/' + segment;\n paths.add(current);\n }\n\n return [...paths];\n}\n\nfunction getDomainCandidates(hostname: string): string[] {\n const normalized = hostname.toLowerCase();\n if (\n normalized === 'localhost' ||\n normalized.endsWith('.localhost') ||\n /^\\\\d+\\\\.\\\\d+\\\\.\\\\d+\\\\.\\\\d+$/.test(normalized) ||\n /^\\\\[[^\\\\]]+\\\\]$/.test(normalized)\n ) {\n return [];\n }\n\n const parts = normalized.split('.');\n if (parts.length < 2) {\n return [];\n }\n\n const domains = new Set<string>();\n for (let index = 0; index < parts.length - 1; index++) {\n const suffix = parts.slice(index).join('.');\n domains.add(suffix);\n domains.add('.' + suffix);\n }\n\n return [...domains];\n}\n\nfunction expireCookie(name: string, path: string, domain?: string) {\n const pieces = [\n name + '=',\n 'Max-Age=0',\n 'Expires=Thu, 01 Jan 1970 00:00:00 GMT',\n 'Path=' + path,\n 'SameSite=Lax',\n ];\n\n if (domain) {\n pieces.push('Domain=' + domain);\n }\n\n if (window.location.protocol === 'https:') {\n pieces.push('Secure');\n }\n\n document.cookie = pieces.join('; ');\n}\n\n${customBegin}\nexport function ClearDomainCookiesButton() {\n const [cleared, setCleared] = useState(false);\n\n const handleClick = () => {\n if (typeof document === 'undefined' || typeof window === 'undefined') {\n return;\n }\n\n const names = new Set<string>(AUTH_COOKIE_NAMES);\n for (const entry of document.cookie.split(';')) {\n const [rawName] = entry.trim().split('=');\n if (rawName) {\n names.add(rawName);\n }\n }\n\n const pathCandidates = getPathCandidates(window.location.pathname);\n const domainCandidates = getDomainCandidates(window.location.hostname);\n\n for (const name of names) {\n for (const path of pathCandidates) {\n expireCookie(name, path);\n for (const domain of domainCandidates) {\n expireCookie(name, path, domain);\n }\n }\n }\n\n setCleared(true);\n };\n\n return (\n <button\n type=\"button\"\n onClick={handleClick}\n disabled={cleared}\n style={{\n display: 'inline-flex',\n alignItems: 'center',\n justifyContent: 'center',\n minHeight: 44,\n padding: '0 16px',\n borderRadius: 9999,\n border: '1px solid rgba(148, 163, 184, 0.35)',\n color: '#0f172a',\n background: cleared ? 'rgba(220, 252, 231, 0.92)' : 'rgba(248, 250, 252, 0.9)',\n cursor: cleared ? 'default' : 'pointer',\n }}\n >\n {cleared ? '已清空' : '清空当前域 Cookie'}\n </button>\n );\n}\n${customEnd}\n`;\n}\n\nexport function authConfigTemplate() {\n return `import {\n createCallbackHandler,\n createCasdoorApiProxyHandler,\n createCasdoorCommerceProxyHandler,\n createAuthorizeRouteHandler,\n createLoginRouteHandler,\n createLogoutHandler,\n createNextAuthOptions,\n createSignupRouteHandler,\n type AuthBusinessAdapter,\n type AuthKitConfig,\n type AuthPersistenceAdapter,\n} from '@foldspace-fe/casdoor-next-auth-kit';\nimport { isGlobalAdminEmail } from '@foldspace-fe/casdoor-next-auth-kit';\nimport { paymentSuccessHandler as billingPaymentSuccessHandler } from '@/lib/billing/payment-success';\nimport { paymentFinishedHandler as billingPaymentFinishedHandler } from '@/lib/billing/payment-finished';\n\nexport function createAuthKitConfig(): AuthKitConfig {\n return {\n appUrl: process.env.APP_URL || '',\n nextauthSecret: process.env.NEXTAUTH_SECRET || 'dev-nextauth-secret',\n casdoor: {\n serverUrl: process.env.NEXT_PUBLIC_CASDOOR_SERVER_URL || process.env.CASDOOR_SERVER_URL || '',\n clientId: process.env.NEXT_PUBLIC_CASDOOR_CLIENT_ID || process.env.CASDOOR_CLIENT_ID || '',\n clientSecret: process.env.CASDOOR_CLIENT_SECRET || '',\n appName: process.env.NEXT_PUBLIC_CASDOOR_APP_NAME || '',\n organizationName: process.env.NEXT_PUBLIC_CASDOOR_ORGANIZATION_NAME || '',\n redirectPath: process.env.NEXT_PUBLIC_CASDOOR_REDIRECT_PATH || '/callback',\n signinPath: process.env.NEXT_PUBLIC_CASDOOR_SIGNIN_PATH || '/login/oauth/authorize',\n },\n };\n}\n\nexport const authKitConfig = createAuthKitConfig();\n\nexport const adapter: AuthBusinessAdapter = {\n isAdminEmail: isGlobalAdminEmail,\n};\n\nexport const persistence: AuthPersistenceAdapter = {\n async syncAuthUser() {\n return;\n },\n async findAuthUser() {\n return null;\n },\n};\n\nexport const paymentSuccessHandler = billingPaymentSuccessHandler;\nexport const paymentFinishedHandler = billingPaymentFinishedHandler;\n\nexport const loginHandler = createLoginRouteHandler(authKitConfig);\nexport const signupHandler = createSignupRouteHandler(authKitConfig);\nexport const authorizeHandler = createAuthorizeRouteHandler(authKitConfig);\nexport const callbackHandler = createCallbackHandler({\n config: authKitConfig,\n adapter,\n persistence,\n});\nexport const logoutHandler = createLogoutHandler(authKitConfig);\nexport const authOptions = createNextAuthOptions({\n config: authKitConfig,\n adapter,\n persistence,\n});\nexport const apiProxyHandler = createCasdoorApiProxyHandler(authKitConfig, '/auth/api', '/api');\nexport const commerceProxyHandler = createCasdoorCommerceProxyHandler(authKitConfig, '/auth/api/commerce', '/api/commerce');\n`;\n}\n\nexport function nextAuthRouteTemplate() {\n return `import NextAuth from 'next-auth';\nimport { createNextAuthOptions } from '@foldspace-fe/casdoor-next-auth-kit';\nimport { adapter, authKitConfig, persistence } from '../../../auth-config';\n\nexport const dynamic = 'force-dynamic';\nexport const runtime = 'nodejs';\n\nconst handler = NextAuth(\n createNextAuthOptions({\n config: authKitConfig,\n adapter,\n persistence,\n }),\n);\n\nexport const GET = handler;\nexport const POST = handler;\n`;\n}\n\nexport function paymentSuccessRouteTemplate() {\n return `import { createBillingPaymentSuccessRouteHandler } from '@foldspace-fe/casdoor-next-auth-kit';\nimport { authKitConfig, paymentSuccessHandler } from '../../../auth-config';\n\nexport const dynamic = 'force-dynamic';\nexport const runtime = 'nodejs';\n\nexport const GET = createBillingPaymentSuccessRouteHandler({\n appUrl: authKitConfig.appUrl,\n fallbackRedirect: '/auth/payment/finished',\n handler: paymentSuccessHandler,\n});\n`;\n}\n\nexport function paymentFinishedRouteTemplate() {\n return `import { createBillingPaymentFinishedRouteHandler } from '@foldspace-fe/casdoor-next-auth-kit';\nimport { authKitConfig, paymentFinishedHandler } from '../../../auth-config';\n\nexport const dynamic = 'force-dynamic';\nexport const runtime = 'nodejs';\n\nexport const GET = createBillingPaymentFinishedRouteHandler({\n appUrl: authKitConfig.appUrl,\n fallbackRedirect: '/',\n handler: paymentFinishedHandler,\n});\n`;\n}\n\nexport function billingPaymentSuccessHandlerTemplate() {\n return `import type { BillingPaymentSuccessHandler } from '@foldspace-fe/casdoor-next-auth-kit/billing';\n\n${customBegin}\nconst paymentSuccessHandlerImpl: BillingPaymentSuccessHandler = async () => {\n return;\n};\n${customEnd}\n\nexport const paymentSuccessHandler: BillingPaymentSuccessHandler = paymentSuccessHandlerImpl;\n`;\n}\n\nexport function billingPaymentFinishedHandlerTemplate() {\n return `import type { BillingPaymentFinishedHandler } from '@foldspace-fe/casdoor-next-auth-kit/billing';\n\n${customBegin}\nconst paymentFinishedHandlerImpl: BillingPaymentFinishedHandler = async () => {\n return;\n};\n${customEnd}\n\nexport const paymentFinishedHandler: BillingPaymentFinishedHandler = paymentFinishedHandlerImpl;\n`;\n}\n\n export function authIndexHtmlTemplate() {\n return `export { AUTH_INDEX_HTML, createAuthIndexHtml } from '@foldspace-fe/casdoor-next-auth-kit';\n`;\n }\n\n export function prismaSchemaTemplate() {\n return buildAuthPrismaSchemaTemplate();\n }\n\nexport function apiProxyRouteTemplate() {\n return `import { apiProxyHandler } from '../../../auth-config';\n\nexport const dynamic = 'force-dynamic';\n\nexport const GET = apiProxyHandler;\nexport const HEAD = apiProxyHandler;\nexport const POST = apiProxyHandler;\nexport const PUT = apiProxyHandler;\nexport const PATCH = apiProxyHandler;\nexport const DELETE = apiProxyHandler;\nexport const OPTIONS = apiProxyHandler;\n`;\n}\n\nexport function commerceProxyRouteTemplate() {\n return `import { commerceProxyHandler } from '../../../../auth-config';\n\nexport const dynamic = 'force-dynamic';\n\nexport const GET = commerceProxyHandler;\nexport const HEAD = commerceProxyHandler;\nexport const POST = commerceProxyHandler;\nexport const PUT = commerceProxyHandler;\nexport const PATCH = commerceProxyHandler;\nexport const DELETE = commerceProxyHandler;\nexport const OPTIONS = commerceProxyHandler;\n`;\n}\n\n export function envTemplate(file: typeof AUTH_KIT_ENV_FILES[number], existingContent = '') {\n return buildManagedEnvTemplate(file, existingContent);\n }\n","import packageJson from '../../package.json';\n\nimport { initProject, checkProject, updateProject } from './operations';\n\nfunction printUsage() {\n console.log('Usage: npx @foldspace-fe/casdoor-next-auth-kit@latest <init|update|check>');\n console.log(' npx @foldspace-fe/casdoor-next-auth-kit@latest --help');\n console.log(' npx @foldspace-fe/casdoor-next-auth-kit@latest --version');\n}\n\nexport async function runCli(argv: string[]) {\n const command = argv[0] ?? 'help';\n if (command === '--help' || command === '-h' || command === 'help') {\n printUsage();\n return;\n }\n if (command === '--version' || command === '-v') {\n console.log(packageJson.version);\n return;\n }\n if (command === 'init') return initProject();\n if (command === 'update') return updateProject();\n if (command === 'check') return checkProject();\n printUsage();\n}\n","#!/usr/bin/env node\nimport { runCli } from './cli/index';\n\nrunCli(process.argv.slice(2)).catch((error) => {\n console.error(error instanceof Error ? error.message : error);\n process.exit(1);\n});\n"],"mappings":";;;;;;;;;AAAA;AAAA,EACE,MAAQ;AAAA,EACR,SAAW;AAAA,EACX,SAAW;AAAA,EACX,MAAQ;AAAA,EACR,YAAc;AAAA,IACZ,MAAQ;AAAA,IACR,KAAO;AAAA,EACT;AAAA,EACA,UAAY;AAAA,EACZ,MAAQ;AAAA,IACN,KAAO;AAAA,EACT;AAAA,EACA,MAAQ;AAAA,EACR,OAAS;AAAA,EACT,SAAW;AAAA,IACT,KAAK;AAAA,MAC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M;AAC/C,YAAQ,IAAI,gBAAY,OAAO;AAC/B;AAAA,EACF;AACA,MAAI,YAAY,OAAQ,QAAO,YAAY;AAC3C,MAAI,YAAY,SAAU,QAAO,cAAc;AAC/C,MAAI,YAAY,QAAS,QAAO,aAAa;AAC7C,aAAW;AACb;;;ACrBA,OAAO,QAAQ,KAAK,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,UAAU;AAC7C,UAAQ,MAAM,iBAAiB,QAAQ,MAAM,UAAU,KAAK;AAC5D,UAAQ,KAAK,CAAC;AAChB,CAAC;","names":["fs","path","path","fs","current"]}
|
|
1
|
+
{"version":3,"sources":["../package.json","../src/cli/operations.ts","../src/cli/fs.ts","../src/cli/templates.ts","../src/cli/index.ts","../src/cli.ts"],"sourcesContent":["{\n \"name\": \"@foldspace-fe/casdoor-next-auth-kit\",\n \"version\": \"0.1.0\",\n \"private\": false,\n \"type\": \"module\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/foldspace-stack/casdoor-next-auth-kit.git\"\n },\n \"homepage\": \"https://github.com/foldspace-stack/casdoor-next-auth-kit#readme\",\n \"bugs\": {\n \"url\": \"https://github.com/foldspace-stack/casdoor-next-auth-kit/issues\"\n },\n \"main\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"exports\": {\n \".\": {\n \"types\": \"./dist/index.d.ts\",\n \"default\": \"./dist/index.js\"\n },\n \"./casdoor\": {\n \"types\": \"./dist/casdoor/index.d.ts\",\n \"default\": \"./dist/casdoor/index.js\"\n },\n \"./next\": {\n \"types\": \"./dist/next/index.d.ts\",\n \"default\": \"./dist/next/index.js\"\n },\n \"./billing\": {\n \"types\": \"./dist/billing/index.d.ts\",\n \"default\": \"./dist/billing/index.js\"\n },\n \"./react\": {\n \"types\": \"./dist/react/index.d.ts\",\n \"default\": \"./dist/react/index.js\"\n }\n },\n \"bin\": {\n \"casdoor-next-auth-kit\": \"./dist/cli.js\"\n },\n \"publishConfig\": {\n \"access\": \"public\",\n \"provenance\": true\n },\n \"files\": [\"dist\", \"README.md\"],\n \"scripts\": {\n \"build\": \"tsup && node ./scripts/copy-skill.mjs\",\n \"test\": \"pnpm build && node --test --experimental-strip-types ./scripts/verify-casdoor-proxy.mjs ./test/*.test.ts\",\n \"lint\": \"tsc -p tsconfig.json --noEmit\",\n \"typecheck\": \"tsc -p tsconfig.json --noEmit\",\n \"dev\": \"tsup --watch\"\n },\n \"peerDependencies\": {\n \"next\": \">=16\",\n \"next-auth\": \"^4.24.0\",\n \"react\": \">=19\",\n \"react-dom\": \">=19\"\n },\n \"dependencies\": {\n \"jose\": \"^6.1.0\"\n },\n \"devDependencies\": {\n \"@types/node\": \"^22.15.0\",\n \"@types/react\": \"^19.2.0\",\n \"@types/react-dom\": \"^19.2.0\",\n \"tsup\": \"^8.5.0\",\n \"typescript\": \"^5.6.3\"\n }\n}\n","import fs from 'node:fs';\nimport path from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nimport { AUTH_KIT_ENV_FILES, getMissingManagedEnvKeys } from '../core/env';\nimport { exists, preserveCustomBlock, read, removePath, writeGeneratedFile, writeTextFile } from './fs';\nimport {\n apiProxyRouteTemplate,\n authConfigTemplate,\n authIndexHtmlTemplate,\n authLoginRouteTemplate,\n authSignupRouteTemplate,\n callbackErrorClearCookiesButtonTemplate,\n callbackErrorPageTemplate,\n authorizeRouteTemplate,\n callbackRouteTemplate,\n billingPaymentFinishedHandlerTemplate,\n billingPaymentSuccessHandlerTemplate,\n commerceProxyRouteTemplate,\n envTemplate,\n logoutRouteTemplate,\n nextAuthRouteTemplate,\n paymentFinishedRouteTemplate,\n paymentSuccessRouteTemplate,\n prismaSchemaTemplate,\n signupAuthorizeRouteTemplate,\n} from './templates';\n\nconst projectRoot = process.cwd();\nconst distRoot = path.dirname(fileURLToPath(import.meta.url));\nconst canonicalSkillPaths = [\n path.join(distRoot, 'skills/casdoor-next-auth-kit'),\n path.resolve(distRoot, '..', '..', '..', 'skills/casdoor-next-auth-kit'),\n];\nconst skillTarget = '.agents/skills/casdoor-next-auth-kit';\n\nconst targets = [\n ['app/(auth-kit)/auth-config.ts', authConfigTemplate],\n ['app/(auth-kit)/auth/login/route.ts', authLoginRouteTemplate],\n ['app/(auth-kit)/auth/signup/route.ts', authSignupRouteTemplate],\n ['app/(auth-kit)/login/oauth/authorize/route.ts', authorizeRouteTemplate],\n ['app/(auth-kit)/signup/oauth/authorize/route.ts', signupAuthorizeRouteTemplate],\n ['app/(auth-kit)/auth/api/[...path]/route.ts', apiProxyRouteTemplate],\n ['app/(auth-kit)/api/auth/[...nextauth]/route.ts', nextAuthRouteTemplate],\n ['app/(auth-kit)/auth/payment/success/route.ts', paymentSuccessRouteTemplate],\n ['app/(auth-kit)/auth/payment/finished/route.ts', paymentFinishedRouteTemplate],\n ['app/(auth-kit)/callback/route.ts', callbackRouteTemplate],\n ['app/(auth-kit)/callback/error/page.tsx', callbackErrorPageTemplate],\n ['app/(auth-kit)/callback/error/clear-domain-cookies-button.tsx', callbackErrorClearCookiesButtonTemplate],\n ['app/(auth-kit)/logout/route.ts', logoutRouteTemplate],\n ['app/(auth-kit)/auth/api/commerce/[...path]/route.ts', commerceProxyRouteTemplate],\n ['lib/billing/payment-success.ts', billingPaymentSuccessHandlerTemplate],\n ['lib/billing/payment-finished.ts', billingPaymentFinishedHandlerTemplate],\n ['app/(auth-kit)/index-html.ts', authIndexHtmlTemplate],\n ['prisma/auth-kit.prisma', prismaSchemaTemplate],\n] as const;\n\nconst deprecatedTargets = [\n 'app/(auth-kit)/api/casdoor/[...path]/route.ts',\n 'app/(auth-kit)/api/casdoor/commerce/[...path]/route.ts',\n 'app/(auth-kit)/auth/api/casdoor/[...path]/route.ts',\n 'app/(auth-kit)/auth/api/casdoor/commerce/[...path]/route.ts',\n 'app/(auth-kit)/login/route.ts',\n 'app/(auth-kit)/signup/route.ts',\n 'app/(auth-kit)/signup/oauth/authorize/route.ts',\n 'app/(auth-kit)/auth/payment-success/route.ts',\n 'app/(auth-kit)/auth/payment/finished/page.tsx',\n 'app/(auth-kit)/callback/error/page.tsx',\n 'app/auth/index-html.ts',\n 'app/auth/libs/index.ts',\n 'app/auth/libs/auth-config.ts',\n 'app/auth/libs/casdoor-config.ts',\n 'app/auth/libs/session-token.ts',\n 'app/auth/libs/oauth-state.ts',\n 'app/auth/libs/page-proxy.ts',\n 'app/auth/libs/api-proxy.ts',\n 'app/auth/libs/casdoor-oauth.ts',\n 'app/auth/libs/nextauth-route.ts',\n 'app/auth/libs',\n 'lib/auth-kit/index.ts',\n 'lib/auth-kit/index-html.ts',\n 'lib/auth-kit',\n 'lib/casdoor-entry.ts',\n 'lib/auth.ts',\n 'lib/public-origin.ts',\n 'lib/request-security.ts',\n 'lib/auth-redirect.ts',\n] as const;\n\nfunction logCreated(filePath: string) {\n console.log(`+ ${path.relative(projectRoot, filePath)}`);\n}\n\nfunction logUpdated(filePath: string) {\n console.log(`~ ${path.relative(projectRoot, filePath)}`);\n}\n\nfunction logRemoved(filePath: string) {\n console.log(`- ${path.relative(projectRoot, filePath)}`);\n}\n\nfunction syncManagedEnvFiles() {\n for (const file of AUTH_KIT_ENV_FILES) {\n const filePath = path.join(projectRoot, file);\n const existed = exists(filePath);\n const current = existed ? read(filePath) : '';\n const next = envTemplate(file, current);\n if (!existed || current !== next) {\n writeTextFile(filePath, next);\n if (!existed) {\n logCreated(filePath);\n } else {\n logUpdated(filePath);\n }\n }\n }\n}\n\nfunction syncManagedSkillFile() {\n const filePath = path.join(projectRoot, skillTarget);\n try {\n const sourcePath = canonicalSkillPaths.find((candidate) => fs.existsSync(candidate));\n if (!sourcePath) {\n throw new Error(`Unable to locate canonical skill directory. Checked: ${canonicalSkillPaths.join(', ')}`);\n }\n removePath(filePath);\n fs.mkdirSync(filePath, { recursive: true });\n logCreated(filePath);\n for (const entry of fs.readdirSync(sourcePath, { withFileTypes: true })) {\n const sourceEntry = path.join(sourcePath, entry.name);\n const targetEntry = path.join(filePath, entry.name);\n if (entry.isDirectory()) {\n fs.cpSync(sourceEntry, targetEntry, { recursive: true });\n console.log(`+ ${path.relative(projectRoot, targetEntry)}/`);\n continue;\n }\n fs.copyFileSync(sourceEntry, targetEntry);\n console.log(`+ ${path.relative(projectRoot, targetEntry)}`);\n }\n } catch (error) {\n console.warn(`Skipped skill sync for ${skillTarget}: ${error instanceof Error ? error.message : String(error)}`);\n }\n}\n\nexport async function initProject() {\n for (const [rel, factory] of targets) {\n const filePath = path.join(projectRoot, rel);\n if (!exists(filePath)) {\n writeGeneratedFile(filePath, factory());\n logCreated(filePath);\n }\n }\n\n syncManagedEnvFiles();\n syncManagedSkillFile();\n console.log('Initialized casdoor-next-auth-kit managed files.');\n}\n\nexport async function updateProject() {\n for (const rel of deprecatedTargets) {\n const filePath = path.join(projectRoot, rel);\n if (exists(filePath)) {\n removePath(filePath);\n logRemoved(filePath);\n }\n }\n\n for (const [rel, factory] of targets) {\n const filePath = path.join(projectRoot, rel);\n const next = '// generated by @foldspace-fe/casdoor-next-auth-kit\\n' + factory();\n if (!exists(filePath)) {\n writeGeneratedFile(filePath, factory());\n logCreated(filePath);\n continue;\n }\n\n if (rel === 'app/(auth-kit)/auth-config.ts') {\n const current = read(filePath);\n if (current !== next) {\n writeTextFile(filePath, next);\n logUpdated(filePath);\n }\n continue;\n }\n\n const current = read(filePath);\n const updated = preserveCustomBlock(current, next);\n if (current !== updated) {\n writeTextFile(filePath, updated);\n logUpdated(filePath);\n }\n }\n\n syncManagedEnvFiles();\n syncManagedSkillFile();\n console.log('Updated managed route shells, env files, and skill file.');\n}\n\nexport async function checkProject() {\n const missingRoutes = targets.filter(([rel]) => !exists(path.join(projectRoot, rel))).map(([rel]) => rel);\n const missingEnv = AUTH_KIT_ENV_FILES.filter((file) => {\n const filePath = path.join(projectRoot, file);\n if (!exists(filePath)) {\n return true;\n }\n return getMissingManagedEnvKeys(read(filePath)).length > 0;\n });\n const skillDir = path.join(projectRoot, skillTarget);\n const missingSkill = exists(path.join(skillDir, 'SKILL.md')) ? [] : [path.join(skillTarget, 'SKILL.md')];\n const missing = [...missingRoutes, ...missingEnv, ...missingSkill];\n\n if (missing.length > 0) {\n console.error('Missing generated files:');\n for (const rel of missing) {\n console.error('- ' + rel);\n }\n process.exitCode = 1;\n return;\n }\n\n console.log('All managed files are present.');\n}\n"," import fs from 'node:fs';\n import path from 'node:path';\n\n export const generatedHeader = '// generated by @foldspace-fe/casdoor-next-auth-kit\\n';\n export const customBegin = '// @foldspace-fe/casdoor-next-auth-kit:begin custom';\n export const customEnd = '// @foldspace-fe/casdoor-next-auth-kit:end custom';\n\nexport function ensureDir(filePath: string) {\n fs.mkdirSync(path.dirname(filePath), { recursive: true });\n}\n\nexport function writeGeneratedFile(filePath: string, content: string) {\n ensureDir(filePath);\n fs.writeFileSync(filePath, generatedHeader + content, 'utf8');\n}\n\nexport function writeTextFile(filePath: string, content: string) {\n ensureDir(filePath);\n fs.writeFileSync(filePath, content, 'utf8');\n}\n\nexport function exists(filePath: string) {\n return fs.existsSync(filePath);\n}\n\n export function read(filePath: string) {\n return fs.readFileSync(filePath, 'utf8');\n }\n\nexport function preserveCustomBlock(existing: string, next: string) {\n const begin = existing.indexOf(customBegin);\n const end = existing.indexOf(customEnd);\n if (begin === -1 || end === -1 || end <= begin) return next;\n const custom = existing.slice(begin, end + customEnd.length);\n const targetBegin = next.indexOf(customBegin);\n const targetEnd = next.indexOf(customEnd);\n if (targetBegin === -1 || targetEnd === -1 || targetEnd <= targetBegin) return next;\n return next.slice(0, targetBegin) + custom + next.slice(targetEnd + customEnd.length);\n}\n\nexport function removePath(filePath: string) {\n fs.rmSync(filePath, { force: true, recursive: true });\n}\n","import { customBegin, customEnd } from './fs';\nimport { buildAuthPrismaSchemaTemplate } from '../prisma/schema-template';\nimport { AUTH_KIT_ENV_FILES, buildManagedEnvTemplate } from '../core/env';\n\nexport function authLoginRouteTemplate() {\n return `import { loginHandler } from '../../auth-config';\n\nexport const dynamic = 'force-dynamic';\n\nexport const GET = loginHandler;\n`;\n}\n\nexport function authSignupRouteTemplate() {\n return `import { signupHandler } from '../../auth-config';\n\nexport const dynamic = 'force-dynamic';\n\nexport const GET = signupHandler;\n`;\n}\n\nexport function authorizeRouteTemplate() {\n return `import { authorizeHandler } from '../../../auth-config';\n\nexport const dynamic = 'force-dynamic';\n\nexport const GET = authorizeHandler;\n`;\n}\n\nexport function signupAuthorizeRouteTemplate() {\n return `import { authorizeHandler } from '../../../auth-config';\n\nexport const dynamic = 'force-dynamic';\n\nexport const GET = authorizeHandler;\n`;\n}\n\nexport function callbackRouteTemplate() {\n return `import { callbackHandler } from '../auth-config';\n\nexport const dynamic = 'force-dynamic';\n\nexport const GET = callbackHandler;\n`;\n}\n\nexport function logoutRouteTemplate() {\n return `import { logoutHandler } from '../auth-config';\n\nexport const dynamic = 'force-dynamic';\n\nexport const GET = logoutHandler;\n`;\n}\n\nexport function callbackErrorPageTemplate() {\n return `import { ClearDomainCookiesButton } from './clear-domain-cookies-button';\n\nexport const dynamic = 'force-dynamic';\n\nexport default async function CallbackErrorPage({\n searchParams,\n}: {\n searchParams: Promise<{ title?: string; message?: string; details?: string }>;\n}) {\n const params = await searchParams;\n\n return (\n <main\n style={{\n minHeight: '100dvh',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n padding: '20px 16px',\n background:\n 'radial-gradient(circle at top, rgba(99, 102, 241, 0.12) 0, rgba(99, 102, 241, 0) 38%), linear-gradient(180deg, #f8fafc 0%, #eef2ff 100%)',\n }}\n >\n <section\n style={{\n width: 'min(100%, 400px)',\n borderRadius: 28,\n padding: '24px 20px',\n boxSizing: 'border-box',\n background: 'rgba(255, 255, 255, 0.96)',\n border: '1px solid rgba(148, 163, 184, 0.2)',\n boxShadow: '0 22px 52px rgba(15, 23, 42, 0.12)',\n textAlign: 'center',\n backdropFilter: 'blur(10px)',\n }}\n >\n <div\n style={{\n width: 52,\n height: 52,\n margin: '0 auto 14px',\n display: 'grid',\n placeItems: 'center',\n borderRadius: 18,\n background: 'linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(249, 115, 22, 0.1))',\n color: '#b91c1c',\n fontSize: 28,\n lineHeight: 1,\n }}\n aria-hidden=\"true\"\n >\n !\n </div>\n <div\n style={{\n display: 'inline-flex',\n alignItems: 'center',\n justifyContent: 'center',\n marginBottom: 12,\n padding: '6px 12px',\n borderRadius: 9999,\n background: 'rgba(254, 226, 226, 0.9)',\n color: '#b91c1c',\n fontSize: 13,\n fontWeight: 600,\n letterSpacing: '0.04em',\n }}\n >\n 认证失败\n </div>\n <h2 style={{ margin: 0, fontSize: 24, lineHeight: 1.2, color: '#0f172a' }}>{params.title ?? 'Callback Error'}</h2>\n <p style={{ margin: '12px 0 0', color: '#334155', lineHeight: 1.6 }}>{params.message ?? 'Unknown callback failure.'}</p>\n {params.details ? (\n <pre\n style={{\n margin: '14px 0 0',\n maxHeight: 140,\n overflow: 'auto',\n padding: 14,\n borderRadius: 18,\n textAlign: 'left',\n whiteSpace: 'pre-wrap',\n wordBreak: 'break-word',\n background: '#f8fafc',\n color: '#0f172a',\n border: '1px solid rgba(148, 163, 184, 0.18)',\n fontSize: 13,\n lineHeight: 1.6,\n }}\n >\n {params.details}\n </pre>\n ) : null}\n${customBegin}\n <div style={{ display: 'flex', flexDirection: 'column', gap: 10, marginTop: 20 }}>\n <ClearDomainCookiesButton />\n <a href=\"/\" style={{ display: 'inline-flex', width: '100%', alignItems: 'center', justifyContent: 'center', minHeight: 44, padding: '0 16px', boxSizing: 'border-box', borderRadius: 9999, border: '1px solid rgba(148, 163, 184, 0.35)', color: '#0f172a', textDecoration: 'none', background: 'rgba(248, 250, 252, 0.9)' }}>返回首页</a>\n <a href=\"/auth/login\" style={{ display: 'inline-flex', width: '100%', alignItems: 'center', justifyContent: 'center', minHeight: 44, padding: '0 16px', boxSizing: 'border-box', borderRadius: 9999, border: '1px solid rgba(148, 163, 184, 0.35)', color: '#0f172a', textDecoration: 'none', background: 'rgba(248, 250, 252, 0.9)' }}>重新登录</a>\n <a href=\"/auth/signup\" style={{ display: 'inline-flex', width: '100%', alignItems: 'center', justifyContent: 'center', minHeight: 44, padding: '0 16px', boxSizing: 'border-box', borderRadius: 9999, border: '1px solid rgba(148, 163, 184, 0.35)', color: '#0f172a', textDecoration: 'none', background: 'rgba(248, 250, 252, 0.9)' }}>去注册</a>\n </div>\n${customEnd}\n </section>\n </main>\n );\n}\n`;\n}\n\nexport function callbackErrorClearCookiesButtonTemplate() {\n return `'use client';\n\nimport { useState } from 'react';\n\nconst AUTH_COOKIE_NAMES = [\n 'auth_origin',\n 'auth_redirect',\n 'oauth_state',\n 'pkce_code_verifier',\n 'next-auth.session-token',\n '__Secure-next-auth.session-token',\n 'next-auth.csrf-token',\n '__Secure-next-auth.csrf-token',\n '__Host-next-auth.csrf-token',\n];\n\nfunction getPathCandidates(pathname: string): string[] {\n const normalized = pathname.startsWith('/') ? pathname : '/' + pathname;\n const segments = normalized.split('/').filter(Boolean);\n const paths = new Set<string>(['/']);\n\n let current = '';\n for (const segment of segments) {\n current += '/' + segment;\n paths.add(current);\n }\n\n return [...paths];\n}\n\nfunction getDomainCandidates(hostname: string): string[] {\n const normalized = hostname.toLowerCase();\n if (\n normalized === 'localhost' ||\n normalized.endsWith('.localhost') ||\n /^\\\\d+\\\\.\\\\d+\\\\.\\\\d+\\\\.\\\\d+$/.test(normalized) ||\n /^\\\\[[^\\\\]]+\\\\]$/.test(normalized)\n ) {\n return [];\n }\n\n const parts = normalized.split('.');\n if (parts.length < 2) {\n return [];\n }\n\n const domains = new Set<string>();\n for (let index = 0; index < parts.length - 1; index++) {\n const suffix = parts.slice(index).join('.');\n domains.add(suffix);\n domains.add('.' + suffix);\n }\n\n return [...domains];\n}\n\nfunction expireCookie(name: string, path: string, domain?: string) {\n const pieces = [\n name + '=',\n 'Max-Age=0',\n 'Expires=Thu, 01 Jan 1970 00:00:00 GMT',\n 'Path=' + path,\n 'SameSite=Lax',\n ];\n\n if (domain) {\n pieces.push('Domain=' + domain);\n }\n\n if (window.location.protocol === 'https:') {\n pieces.push('Secure');\n }\n\n document.cookie = pieces.join('; ');\n}\n\n${customBegin}\nexport function ClearDomainCookiesButton() {\n const [cleared, setCleared] = useState(false);\n\n const handleClick = () => {\n if (typeof document === 'undefined' || typeof window === 'undefined') {\n return;\n }\n\n const names = new Set<string>(AUTH_COOKIE_NAMES);\n for (const entry of document.cookie.split(';')) {\n const [rawName] = entry.trim().split('=');\n if (rawName) {\n names.add(rawName);\n }\n }\n\n const pathCandidates = getPathCandidates(window.location.pathname);\n const domainCandidates = getDomainCandidates(window.location.hostname);\n\n for (const name of names) {\n for (const path of pathCandidates) {\n expireCookie(name, path);\n for (const domain of domainCandidates) {\n expireCookie(name, path, domain);\n }\n }\n }\n\n setCleared(true);\n };\n\n return (\n <button\n type=\"button\"\n onClick={handleClick}\n disabled={cleared}\n style={{\n display: 'inline-flex',\n width: '100%',\n alignItems: 'center',\n justifyContent: 'center',\n minHeight: 44,\n padding: '0 16px',\n boxSizing: 'border-box',\n borderRadius: 9999,\n border: '1px solid rgba(148, 163, 184, 0.35)',\n color: '#0f172a',\n background: cleared ? 'rgba(220, 252, 231, 0.92)' : 'rgba(248, 250, 252, 0.9)',\n cursor: cleared ? 'default' : 'pointer',\n }}\n >\n {cleared ? '已清空' : '清空当前域 Cookie'}\n </button>\n );\n}\n${customEnd}\n`;\n}\n\nexport function authConfigTemplate() {\n return `import {\n createCallbackHandler,\n createCasdoorApiProxyHandler,\n createCasdoorCommerceProxyHandler,\n createAuthorizeRouteHandler,\n createLoginRouteHandler,\n createLogoutHandler,\n createNextAuthOptions,\n createSignupRouteHandler,\n type AuthBusinessAdapter,\n type AuthKitConfig,\n type AuthPersistenceAdapter,\n} from '@foldspace-fe/casdoor-next-auth-kit';\nimport { isGlobalAdminEmail } from '@foldspace-fe/casdoor-next-auth-kit';\nimport { paymentSuccessHandler as billingPaymentSuccessHandler } from '@/lib/billing/payment-success';\nimport { paymentFinishedHandler as billingPaymentFinishedHandler } from '@/lib/billing/payment-finished';\n\nexport function createAuthKitConfig(): AuthKitConfig {\n return {\n appUrl: process.env.APP_URL || '',\n nextauthSecret: process.env.NEXTAUTH_SECRET || 'dev-nextauth-secret',\n logoutRedirectPath: process.env.NEXT_PUBLIC_AUTH_LOGOUT_REDIRECT_PATH || '/',\n casdoor: {\n serverUrl: process.env.NEXT_PUBLIC_CASDOOR_SERVER_URL || process.env.CASDOOR_SERVER_URL || '',\n clientId: process.env.NEXT_PUBLIC_CASDOOR_CLIENT_ID || process.env.CASDOOR_CLIENT_ID || '',\n clientSecret: process.env.CASDOOR_CLIENT_SECRET || '',\n appName: process.env.NEXT_PUBLIC_CASDOOR_APP_NAME || '',\n organizationName: process.env.NEXT_PUBLIC_CASDOOR_ORGANIZATION_NAME || '',\n redirectPath: process.env.NEXT_PUBLIC_CASDOOR_REDIRECT_PATH || '/callback',\n signinPath: process.env.NEXT_PUBLIC_CASDOOR_SIGNIN_PATH || '/login/oauth/authorize',\n },\n };\n}\n\nexport const authKitConfig = createAuthKitConfig();\n\nexport const adapter: AuthBusinessAdapter = {\n isAdminEmail: isGlobalAdminEmail,\n};\n\nexport const persistence: AuthPersistenceAdapter = {\n async syncAuthUser() {\n return;\n },\n async findAuthUser() {\n return null;\n },\n};\n\nexport const paymentSuccessHandler = billingPaymentSuccessHandler;\nexport const paymentFinishedHandler = billingPaymentFinishedHandler;\n\nexport const loginHandler = createLoginRouteHandler(authKitConfig);\nexport const signupHandler = createSignupRouteHandler(authKitConfig);\nexport const authorizeHandler = createAuthorizeRouteHandler(authKitConfig);\nexport const callbackHandler = createCallbackHandler({\n config: authKitConfig,\n adapter,\n persistence,\n});\nexport const logoutHandler = createLogoutHandler(authKitConfig);\nexport const authOptions = createNextAuthOptions({\n config: authKitConfig,\n adapter,\n persistence,\n});\nexport const apiProxyHandler = createCasdoorApiProxyHandler(authKitConfig, '/auth/api', '/api');\nexport const commerceProxyHandler = createCasdoorCommerceProxyHandler(authKitConfig, '/auth/api/commerce', '/api/commerce');\n`;\n}\n\nexport function nextAuthRouteTemplate() {\n return `import NextAuth from 'next-auth';\nimport { createNextAuthOptions } from '@foldspace-fe/casdoor-next-auth-kit';\nimport { adapter, authKitConfig, persistence } from '../../../auth-config';\n\nexport const dynamic = 'force-dynamic';\nexport const runtime = 'nodejs';\n\nconst handler = NextAuth(\n createNextAuthOptions({\n config: authKitConfig,\n adapter,\n persistence,\n }),\n);\n\nexport const GET = handler;\nexport const POST = handler;\n`;\n}\n\nexport function paymentSuccessRouteTemplate() {\n return `import { createBillingPaymentSuccessRouteHandler } from '@foldspace-fe/casdoor-next-auth-kit';\nimport { authKitConfig, paymentSuccessHandler } from '../../../auth-config';\n\nexport const dynamic = 'force-dynamic';\nexport const runtime = 'nodejs';\n\nexport const GET = createBillingPaymentSuccessRouteHandler({\n appUrl: authKitConfig.appUrl,\n fallbackRedirect: '/auth/payment/finished',\n handler: paymentSuccessHandler,\n phase: 'success',\n});\n`;\n}\n\nexport function paymentFinishedRouteTemplate() {\n return `import { createBillingPaymentFinishedRouteHandler } from '@foldspace-fe/casdoor-next-auth-kit';\nimport { authKitConfig, paymentFinishedHandler } from '../../../auth-config';\n\nexport const dynamic = 'force-dynamic';\nexport const runtime = 'nodejs';\n\nexport const GET = createBillingPaymentFinishedRouteHandler({\n appUrl: authKitConfig.appUrl,\n fallbackRedirect: '/',\n handler: paymentFinishedHandler,\n phase: 'finished',\n});\n`;\n}\n\nexport function billingPaymentSuccessHandlerTemplate() {\n return `import type { BillingPaymentSuccessHandler } from '@foldspace-fe/casdoor-next-auth-kit/billing';\n\n${customBegin}\nconst paymentSuccessHandlerImpl: BillingPaymentSuccessHandler = async (context) => {\n console.info('[casdoor-next-auth-kit] payment success callback received', {\n paymentId: context.paymentId,\n orderId: context.orderId,\n status: context.status,\n redirectTo: context.redirectTo,\n });\n return;\n};\n${customEnd}\n\nexport const paymentSuccessHandler: BillingPaymentSuccessHandler = paymentSuccessHandlerImpl;\n`;\n}\n\nexport function billingPaymentFinishedHandlerTemplate() {\n return `import type { BillingPaymentFinishedHandler } from '@foldspace-fe/casdoor-next-auth-kit/billing';\n\n${customBegin}\nconst paymentFinishedHandlerImpl: BillingPaymentFinishedHandler = async (context) => {\n console.info('[casdoor-next-auth-kit] payment finished callback received', {\n paymentId: context.paymentId,\n orderId: context.orderId,\n status: context.status,\n redirectTo: context.redirectTo,\n });\n return;\n};\n${customEnd}\n\nexport const paymentFinishedHandler: BillingPaymentFinishedHandler = paymentFinishedHandlerImpl;\n`;\n}\n\n export function authIndexHtmlTemplate() {\n return `export { AUTH_INDEX_HTML, createAuthIndexHtml } from '@foldspace-fe/casdoor-next-auth-kit';\n`;\n }\n\n export function prismaSchemaTemplate() {\n return buildAuthPrismaSchemaTemplate();\n }\n\nexport function apiProxyRouteTemplate() {\n return `import { apiProxyHandler } from '../../../auth-config';\n\nexport const dynamic = 'force-dynamic';\n\nexport const GET = apiProxyHandler;\nexport const HEAD = apiProxyHandler;\nexport const POST = apiProxyHandler;\nexport const PUT = apiProxyHandler;\nexport const PATCH = apiProxyHandler;\nexport const DELETE = apiProxyHandler;\nexport const OPTIONS = apiProxyHandler;\n`;\n}\n\nexport function commerceProxyRouteTemplate() {\n return `import { commerceProxyHandler } from '../../../../auth-config';\n\nexport const dynamic = 'force-dynamic';\n\nexport const GET = commerceProxyHandler;\nexport const HEAD = commerceProxyHandler;\nexport const POST = commerceProxyHandler;\nexport const PUT = commerceProxyHandler;\nexport const PATCH = commerceProxyHandler;\nexport const DELETE = commerceProxyHandler;\nexport const OPTIONS = commerceProxyHandler;\n`;\n}\n\n export function envTemplate(file: typeof AUTH_KIT_ENV_FILES[number], existingContent = '') {\n return buildManagedEnvTemplate(file, existingContent);\n }\n","import packageJson from '../../package.json';\n\nimport { initProject, checkProject, updateProject } from './operations';\n\nfunction printUsage() {\n console.log('Usage: npx @foldspace-fe/casdoor-next-auth-kit@latest <init|update|check>');\n console.log(' npx @foldspace-fe/casdoor-next-auth-kit@latest --help');\n console.log(' npx @foldspace-fe/casdoor-next-auth-kit@latest --version');\n}\n\nexport async function runCli(argv: string[]) {\n const command = argv[0] ?? 'help';\n if (command === '--help' || command === '-h' || command === 'help') {\n printUsage();\n return;\n }\n if (command === '--version' || command === '-v') {\n console.log(packageJson.version);\n return;\n }\n if (command === 'init') return initProject();\n if (command === 'update') return updateProject();\n if (command === 'check') return checkProject();\n printUsage();\n}\n","#!/usr/bin/env node\nimport { runCli } from './cli/index';\n\nrunCli(process.argv.slice(2)).catch((error) => {\n console.error(error instanceof Error ? error.message : error);\n process.exit(1);\n});\n"],"mappings":";;;;;;;;;AAAA;AAAA,EACE,MAAQ;AAAA,EACR,SAAW;AAAA,EACX,SAAW;AAAA,EACX,MAAQ;AAAA,EACR,YAAc;AAAA,IACZ,MAAQ;AAAA,IACR,KAAO;AAAA,EACT;AAAA,EACA,UAAY;AAAA,EACZ,MAAQ;AAAA,IACN,KAAO;AAAA,EACT;AAAA,EACA,MAAQ;AAAA,EACR,OAAS;AAAA,EACT,SAAW;AAAA,IACT,KAAK;AAAA,MACH,OAAS;AAAA,MACT,SAAW;AAAA,IACb;AAAA,IACA,aAAa;AAAA,MACX,OAAS;AAAA,MACT,SAAW;AAAA,IACb;AAAA,IACA,UAAU;AAAA,MACR,OAAS;AAAA,MACT,SAAW;AAAA,IACb;AAAA,IACA,aAAa;AAAA,MACX,OAAS;AAAA,MACT,SAAW;AAAA,IACb;AAAA,IACA,WAAW;AAAA,MACT,OAAS;AAAA,MACT,SAAW;AAAA,IACb;AAAA,EACF;AAAA,EACA,KAAO;AAAA,IACL,yBAAyB;AAAA,EAC3B;AAAA,EACA,eAAiB;AAAA,IACf,QAAU;AAAA,IACV,YAAc;AAAA,EAChB;AAAA,EACA,OAAS,CAAC,QAAQ,WAAW;AAAA,EAC7B,SAAW;AAAA,IACT,OAAS;AAAA,IACT,MAAQ;AAAA,IACR,MAAQ;AAAA,IACR,WAAa;AAAA,IACb,KAAO;AAAA,EACT;AAAA,EACA,kBAAoB;AAAA,IA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AAM;AAC/C,YAAQ,IAAI,gBAAY,OAAO;AAC/B;AAAA,EACF;AACA,MAAI,YAAY,OAAQ,QAAO,YAAY;AAC3C,MAAI,YAAY,SAAU,QAAO,cAAc;AAC/C,MAAI,YAAY,QAAS,QAAO,aAAa;AAC7C,aAAW;AACb;;;ACrBA,OAAO,QAAQ,KAAK,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,UAAU;AAC7C,UAAQ,MAAM,iBAAiB,QAAQ,MAAM,UAAU,KAAK;AAC5D,UAAQ,KAAK,CAAC;AAChB,CAAC;","names":["fs","path","path","fs","current"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { A as AuthKitConfig, c as AuthUser, M as ManagedEnvFile, d as ManagedEnvVariableDefinition, e as AuthIndexHtmlOptions, P as PrismaSchemaModelDefinition } from './types-
|
|
2
|
-
export { a as AuthBusinessAdapter, f as AuthDatabaseContract, g as AuthDatabaseFieldRequirement, h as AuthDatabaseTableRequirement, b as AuthPersistenceAdapter, i as AuthRuntimeContext, C as CasdoorUserInfo, O as OAuthTokens, j as PrismaSchemaFieldDefinition } from './types-
|
|
1
|
+
import { A as AuthKitConfig, c as AuthUser, M as ManagedEnvFile, d as ManagedEnvVariableDefinition, e as AuthIndexHtmlOptions, P as PrismaSchemaModelDefinition } from './types-BJv6j3NZ.js';
|
|
2
|
+
export { a as AuthBusinessAdapter, f as AuthDatabaseContract, g as AuthDatabaseFieldRequirement, h as AuthDatabaseTableRequirement, b as AuthPersistenceAdapter, i as AuthRuntimeContext, C as CasdoorUserInfo, O as OAuthTokens, j as PrismaSchemaFieldDefinition } from './types-BJv6j3NZ.js';
|
|
3
3
|
import { JWTDecodeParams, JWT, JWTEncodeParams } from 'next-auth/jwt';
|
|
4
4
|
export { createAuthorizeEntryResponse, createCasdoorApiProxyHandler, createCasdoorCommerceProxyHandler, createCasdoorPageProxyHandler, createLoginEntryResponse, createSignupEntryResponse, decodeCasdoorAccessToken, exchangeCasdoorOAuthToken, exchangeCodeForToken, fetchCasdoorUserInfo, getCasdoorAuthorizeUrl, getCasdoorConfig, getCasdoorTokenUrl, getCasdoorUserInfoUrl } from './casdoor/index.js';
|
|
5
|
-
export { C as CallbackHandlerOptions, c as createCallbackHandler, a as createCallbackResponse } from './callback-
|
|
5
|
+
export { C as CallbackHandlerOptions, c as createCallbackHandler, a as createCallbackResponse } from './callback-rEWxVGyL.js';
|
|
6
6
|
export { createAuthorizeRouteHandler, createLoginRouteHandler, createLogoutHandler, createSignupRouteHandler } from './next/index.js';
|
|
7
|
-
export { A as AuthSession, a as AuthSessionUser, b as AuthTokenPayload, N as NextAuthRouteOptions, c as createNextAuthOptions, d as createNextAuthRouteHandler } from './options-
|
|
8
|
-
export { f as BillingActionExecutor,
|
|
9
|
-
export { buildBillingActionPayload, createBillingPaymentFinishedResponse, createBillingPaymentFinishedRouteHandler, createBillingPaymentSuccessResponse, createBillingPaymentSuccessRouteHandler, deriveBillingCreditsState, deriveBillingEntitlements, normalizeBillingCatalogConfig, normalizeBillingPurchaseStatus, normalizeBillingRuntimeConfig, resolveBillingInterval, resolveBillingItem, resolveBillingProductSnapshot, resolveBillingSubscriptionProduct } from './billing/index.js';
|
|
7
|
+
export { A as AuthSession, a as AuthSessionUser, b as AuthTokenPayload, N as NextAuthRouteOptions, c as createNextAuthOptions, d as createNextAuthRouteHandler } from './options-D2YQdRWu.js';
|
|
8
|
+
export { u as BillingActionExecutionResult, f as BillingActionExecutor, v as BillingActionKind, B as BillingActionPayload, d as BillingApiClient, w as BillingCasdoorAccountDetail, x as BillingCasdoorAccountMultiFactorAuthDetail, y as BillingCasdoorAccountResponse, z as BillingCasdoorApiResponse, A as BillingCasdoorApplicationDetail, C as BillingCasdoorApplicationProviderDetail, D as BillingCasdoorApplicationResponse, E as BillingCasdoorApplicationSigninItemDetail, F as BillingCasdoorApplicationSigninMethodDetail, G as BillingCasdoorApplicationSignupItemDetail, H as BillingCasdoorBuyProductRequest, I as BillingCasdoorBuyProductResponse, J as BillingCasdoorErrorDetail, K as BillingCasdoorErrorPayload, L as BillingCasdoorOrganizationDetail, M as BillingCasdoorOrganizationNamesResponse, N as BillingCasdoorOrganizationOption, O as BillingCasdoorPaymentDetail, P as BillingCasdoorPaymentResponse, s as BillingCasdoorProductDetail, Q as BillingCasdoorProductResponse, R as BillingCasdoorProviderDetail, S as BillingCasdoorProviderOption, c as BillingCatalogConfig, T as BillingConversionRule, t as BillingCoreContextValue, U as BillingCreditsContextValue, m as BillingCreditsState, g as BillingDefaults, n as BillingEntitlementState, V as BillingInterval, a as BillingItem, W as BillingItemKind, e as BillingLoaders, X as BillingOrderCreatedContext, k as BillingOrderHistoryItem, Y as BillingPaymentCallbackContext, Z as BillingPaymentFinishedContext, _ as BillingPaymentFinishedHandler, $ as BillingPaymentFinishedRouteOptions, l as BillingPaymentHistoryItem, a0 as BillingPaymentRouteBaseOptions, a1 as BillingPaymentSuccessContext, a2 as BillingPaymentSuccessHandler, a3 as BillingPaymentSuccessHandlerResult, a4 as BillingPaymentSuccessRouteOptions, a5 as BillingProductContextValue, a6 as BillingProductDetailState, a7 as BillingProductPurchasableEntry, a8 as BillingProductPurchaseConfig, r as BillingProductSnapshot, j as BillingProductState, a9 as BillingPurchasableEntry, aa as BillingPurchasableEntryBase, ab as BillingPurchasableKind, ac as BillingPurchasableWhitelist, ad as BillingPurchaseCompleteContext, ae as BillingPurchaseErrorContext, q as BillingPurchaseHooks, af as BillingPurchaseRequest, p as BillingPurchaseStatus, b as BillingRuntimeConfig, o as BillingStatusState, ag as BillingSubscriptionContextValue, i as BillingSubscriptionHistoryItem, ah as BillingSubscriptionPurchasableEntry, ai as BillingSubscriptionPurchaseConfig, h as BillingSubscriptionState } from './types-xgHVGy75.js';
|
|
9
|
+
export { NormalizedCasdoorProductId, buildBillingActionPayload, buildBillingPaymentCallbackContext, buildBillingPurchaseRequest, buildCasdoorBuyProductParams, buildCasdoorBuyProductRequest, chooseCasdoorProviderName, createBillingPaymentFinishedResponse, createBillingPaymentFinishedRouteHandler, createBillingPaymentSuccessResponse, createBillingPaymentSuccessRouteHandler, deriveBillingCreditsState, deriveBillingEntitlements, filterBillingPurchasableItems, normalizeBillingCatalogConfig, normalizeBillingPurchaseStatus, normalizeBillingRuntimeConfig, normalizeCasdoorBuyProductResponse, normalizeCasdoorProductId, readBuyProductRedirectTo, resolveBillingInterval, resolveBillingItem, resolveBillingProductSnapshot, resolveBillingPurchasable, resolveBillingSubscriptionProduct } from './billing/index.js';
|
|
10
10
|
import 'next/server';
|
|
11
11
|
import 'next-auth';
|
|
12
12
|
|
package/dist/index.js
CHANGED
|
@@ -8,13 +8,13 @@ import {
|
|
|
8
8
|
getMissingManagedEnvKeys,
|
|
9
9
|
readManagedEnvValue,
|
|
10
10
|
sanitizeExistingEnvContent
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-FW4WDHNS.js";
|
|
12
12
|
import {
|
|
13
13
|
createBillingPaymentFinishedResponse,
|
|
14
14
|
createBillingPaymentFinishedRouteHandler,
|
|
15
15
|
createBillingPaymentSuccessResponse,
|
|
16
16
|
createBillingPaymentSuccessRouteHandler
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-ZCHLJYLN.js";
|
|
18
18
|
import {
|
|
19
19
|
createCasdoorApiProxyHandler,
|
|
20
20
|
createCasdoorCommerceProxyHandler,
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
createNextAuthOptions,
|
|
28
28
|
createNextAuthRouteHandler,
|
|
29
29
|
createSignupRouteHandler
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-GLK4IW22.js";
|
|
31
31
|
import {
|
|
32
32
|
AUTH_INDEX_HTML,
|
|
33
33
|
AUTH_REDIRECT_COOKIE_NAME,
|
|
@@ -68,16 +68,26 @@ import {
|
|
|
68
68
|
} from "./chunk-MWXY4JSL.js";
|
|
69
69
|
import {
|
|
70
70
|
buildBillingActionPayload,
|
|
71
|
+
buildBillingPaymentCallbackContext,
|
|
72
|
+
buildBillingPurchaseRequest,
|
|
73
|
+
buildCasdoorBuyProductParams,
|
|
74
|
+
buildCasdoorBuyProductRequest,
|
|
75
|
+
chooseCasdoorProviderName,
|
|
71
76
|
deriveBillingCreditsState,
|
|
72
77
|
deriveBillingEntitlements,
|
|
78
|
+
filterBillingPurchasableItems,
|
|
73
79
|
normalizeBillingCatalogConfig,
|
|
74
80
|
normalizeBillingPurchaseStatus,
|
|
75
81
|
normalizeBillingRuntimeConfig,
|
|
82
|
+
normalizeCasdoorBuyProductResponse,
|
|
83
|
+
normalizeCasdoorProductId,
|
|
84
|
+
readBuyProductRedirectTo,
|
|
76
85
|
resolveBillingInterval,
|
|
77
86
|
resolveBillingItem,
|
|
78
87
|
resolveBillingProductSnapshot,
|
|
88
|
+
resolveBillingPurchasable,
|
|
79
89
|
resolveBillingSubscriptionProduct
|
|
80
|
-
} from "./chunk-
|
|
90
|
+
} from "./chunk-46V73LSW.js";
|
|
81
91
|
import {
|
|
82
92
|
buildAuthJumpHref,
|
|
83
93
|
resolvePostLoginRedirect
|
|
@@ -92,7 +102,12 @@ export {
|
|
|
92
102
|
buildAuthJumpHref,
|
|
93
103
|
buildAuthPrismaSchemaTemplate,
|
|
94
104
|
buildBillingActionPayload,
|
|
105
|
+
buildBillingPaymentCallbackContext,
|
|
106
|
+
buildBillingPurchaseRequest,
|
|
107
|
+
buildCasdoorBuyProductParams,
|
|
108
|
+
buildCasdoorBuyProductRequest,
|
|
95
109
|
buildManagedEnvTemplate,
|
|
110
|
+
chooseCasdoorProviderName,
|
|
96
111
|
clearAuthRedirectCookie,
|
|
97
112
|
clearPublicOriginCookie,
|
|
98
113
|
createAuthIndexHtml,
|
|
@@ -122,6 +137,7 @@ export {
|
|
|
122
137
|
exchangeCasdoorOAuthToken,
|
|
123
138
|
exchangeCodeForToken,
|
|
124
139
|
fetchCasdoorUserInfo,
|
|
140
|
+
filterBillingPurchasableItems,
|
|
125
141
|
generateStateToken,
|
|
126
142
|
getAuthRedirectTarget,
|
|
127
143
|
getCasdoorAuthorizeUrl,
|
|
@@ -140,12 +156,16 @@ export {
|
|
|
140
156
|
normalizeBillingCatalogConfig,
|
|
141
157
|
normalizeBillingPurchaseStatus,
|
|
142
158
|
normalizeBillingRuntimeConfig,
|
|
159
|
+
normalizeCasdoorBuyProductResponse,
|
|
160
|
+
normalizeCasdoorProductId,
|
|
143
161
|
parseStateToken,
|
|
144
162
|
pkceCookiePrefix,
|
|
163
|
+
readBuyProductRedirectTo,
|
|
145
164
|
readManagedEnvValue,
|
|
146
165
|
resolveBillingInterval,
|
|
147
166
|
resolveBillingItem,
|
|
148
167
|
resolveBillingProductSnapshot,
|
|
168
|
+
resolveBillingPurchasable,
|
|
149
169
|
resolveBillingSubscriptionProduct,
|
|
150
170
|
resolvePostLoginRedirect,
|
|
151
171
|
sanitizeExistingEnvContent,
|
package/dist/next/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as next_server from 'next/server';
|
|
2
2
|
import { NextRequest, NextResponse } from 'next/server';
|
|
3
|
-
import { A as AuthKitConfig } from '../types-
|
|
4
|
-
export { C as CallbackHandlerOptions, c as createCallbackHandler, a as createCallbackResponse } from '../callback-
|
|
5
|
-
export { A as AuthSession, a as AuthSessionUser, b as AuthTokenPayload, N as NextAuthRouteOptions, c as createNextAuthOptions, d as createNextAuthRouteHandler } from '../options-
|
|
3
|
+
import { A as AuthKitConfig } from '../types-BJv6j3NZ.js';
|
|
4
|
+
export { C as CallbackHandlerOptions, c as createCallbackHandler, a as createCallbackResponse } from '../callback-rEWxVGyL.js';
|
|
5
|
+
export { A as AuthSession, a as AuthSessionUser, b as AuthTokenPayload, N as NextAuthRouteOptions, c as createNextAuthOptions, d as createNextAuthRouteHandler } from '../options-D2YQdRWu.js';
|
|
6
6
|
import 'next-auth';
|
|
7
7
|
import 'next-auth/jwt';
|
|
8
8
|
|
package/dist/next/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Session, NextAuthOptions } from 'next-auth';
|
|
2
2
|
import { JWT } from 'next-auth/jwt';
|
|
3
|
-
import { A as AuthKitConfig, a as AuthBusinessAdapter, b as AuthPersistenceAdapter } from './types-
|
|
3
|
+
import { A as AuthKitConfig, a as AuthBusinessAdapter, b as AuthPersistenceAdapter } from './types-BJv6j3NZ.js';
|
|
4
4
|
|
|
5
5
|
interface NextAuthRouteOptions {
|
|
6
6
|
config: AuthKitConfig;
|
package/dist/react/index.d.ts
CHANGED
|
@@ -3,11 +3,11 @@ import { ReactNode } from 'react';
|
|
|
3
3
|
import { Session } from 'next-auth';
|
|
4
4
|
export { Session } from 'next-auth';
|
|
5
5
|
import { useSession } from 'next-auth/react';
|
|
6
|
-
import { A as AuthSession } from '../options-
|
|
7
|
-
export { a as AuthSessionUser, b as AuthTokenPayload } from '../options-
|
|
8
|
-
import { B as BillingActionPayload, a as BillingItem, b as BillingRuntimeConfig, c as BillingCatalogConfig, d as BillingApiClient, e as BillingLoaders, f as BillingActionExecutor, g as BillingDefaults, h as BillingSubscriptionState, i as BillingSubscriptionHistoryItem, j as BillingProductState, k as BillingOrderHistoryItem, l as BillingPaymentHistoryItem, m as BillingCreditsState, n as BillingEntitlementState, o as BillingStatusState, p as BillingPurchaseStatus, q as
|
|
6
|
+
import { A as AuthSession } from '../options-D2YQdRWu.js';
|
|
7
|
+
export { a as AuthSessionUser, b as AuthTokenPayload } from '../options-D2YQdRWu.js';
|
|
8
|
+
import { B as BillingActionPayload, a as BillingItem, b as BillingRuntimeConfig, c as BillingCatalogConfig, d as BillingApiClient, e as BillingLoaders, f as BillingActionExecutor, g as BillingDefaults, h as BillingSubscriptionState, i as BillingSubscriptionHistoryItem, j as BillingProductState, k as BillingOrderHistoryItem, l as BillingPaymentHistoryItem, m as BillingCreditsState, n as BillingEntitlementState, o as BillingStatusState, p as BillingPurchaseStatus, q as BillingPurchaseHooks, r as BillingProductSnapshot, s as BillingCasdoorProductDetail, t as BillingCoreContextValue } from '../types-xgHVGy75.js';
|
|
9
9
|
import 'next-auth/jwt';
|
|
10
|
-
import '../types-
|
|
10
|
+
import '../types-BJv6j3NZ.js';
|
|
11
11
|
|
|
12
12
|
declare function AuthProvider({ children, session, }: {
|
|
13
13
|
children: ReactNode;
|
|
@@ -60,6 +60,7 @@ interface BillingProviderProps {
|
|
|
60
60
|
entitlements?: BillingEntitlementState;
|
|
61
61
|
status?: BillingStatusState;
|
|
62
62
|
purchaseStatus?: BillingPurchaseStatus;
|
|
63
|
+
purchaseHooks?: BillingPurchaseHooks;
|
|
63
64
|
autoRefresh?: boolean;
|
|
64
65
|
}
|
|
65
66
|
type BillingCoreProviderProps = BillingProviderProps;
|
|
@@ -92,7 +93,7 @@ interface BillingPipelineOptions {
|
|
|
92
93
|
}) => Promise<void>;
|
|
93
94
|
onError?: (error: unknown) => Promise<void>;
|
|
94
95
|
}
|
|
95
|
-
declare function BillingProvider({ children, apiClient, loaders, runtimeConfigLoader, actionExecutor, defaults, runtimeConfig: runtimeConfigProp, subscription: subscriptionProp, subscriptionHistory: subscriptionHistoryProp, products: productsProp, orderHistory: orderHistoryProp, paymentHistory: paymentHistoryProp, credits: creditsProp, entitlements: entitlementsProp, status: statusProp, purchaseStatus: purchaseStatusProp, autoRefresh, }: BillingProviderProps): react_jsx_runtime.JSX.Element;
|
|
96
|
+
declare function BillingProvider({ children, apiClient, loaders, runtimeConfigLoader, actionExecutor, defaults, runtimeConfig: runtimeConfigProp, subscription: subscriptionProp, subscriptionHistory: subscriptionHistoryProp, products: productsProp, orderHistory: orderHistoryProp, paymentHistory: paymentHistoryProp, credits: creditsProp, entitlements: entitlementsProp, status: statusProp, purchaseStatus: purchaseStatusProp, purchaseHooks, autoRefresh, }: BillingProviderProps): react_jsx_runtime.JSX.Element;
|
|
96
97
|
declare function BillingCoreProvider(props: BillingCoreProviderProps): react_jsx_runtime.JSX.Element;
|
|
97
98
|
declare function SubscriptionProvider({ children, availablePlans, subscription, subscriptionHistory, entitlements, status, }: BillingSubscriptionProviderProps): react_jsx_runtime.JSX.Element;
|
|
98
99
|
declare function ProductProvider({ children, availableProducts, products, orderHistory, paymentHistory, status, }: BillingProductProviderProps): react_jsx_runtime.JSX.Element;
|
|
@@ -112,6 +113,25 @@ interface BillingItemState {
|
|
|
112
113
|
refresh: () => Promise<void>;
|
|
113
114
|
}
|
|
114
115
|
declare function useBillingItem(itemKey: string): BillingItemState;
|
|
116
|
+
interface BillingProductDetailState {
|
|
117
|
+
product?: BillingCasdoorProductDetail;
|
|
118
|
+
loading: boolean;
|
|
119
|
+
error: string | null;
|
|
120
|
+
refresh: () => Promise<void>;
|
|
121
|
+
}
|
|
122
|
+
declare function useBillingProductDetail(productId: string): BillingProductDetailState;
|
|
123
|
+
interface BillingProductPurchaseOptionsState {
|
|
124
|
+
product?: BillingCasdoorProductDetail;
|
|
125
|
+
providers: BillingCasdoorProductDetail['providers'];
|
|
126
|
+
providerObjs: BillingCasdoorProductDetail['providerObjs'];
|
|
127
|
+
providerName?: string;
|
|
128
|
+
selectedProvider?: NonNullable<BillingCasdoorProductDetail['providerObjs']>[number];
|
|
129
|
+
setProviderName: (providerName?: string) => void;
|
|
130
|
+
loading: boolean;
|
|
131
|
+
error: string | null;
|
|
132
|
+
refresh: () => Promise<void>;
|
|
133
|
+
}
|
|
134
|
+
declare function useBillingProductPurchaseOptions(productId: string, preferredProviderName?: string): BillingProductPurchaseOptionsState;
|
|
115
135
|
interface BillingProductsState {
|
|
116
136
|
products: BillingProductState[];
|
|
117
137
|
loading: boolean;
|
|
@@ -234,4 +254,4 @@ interface BillingProductStateView {
|
|
|
234
254
|
declare function useBillingProduct(productKey: string): BillingProductStateView;
|
|
235
255
|
declare function useBillingCatalogConfig(): BillingCatalogState;
|
|
236
256
|
|
|
237
|
-
export { type AuthActions, type AuthActionsOptions, AuthProvider, type AuthRole, AuthSession, type AuthUserSummary, type BillingActionHookResult, type BillingAvailablePlansState, type BillingAvailableProductsState, type BillingCatalogState, BillingCoreProvider, type BillingCoreProviderProps, type BillingCreditsProviderProps, type BillingCreditsStateView, type BillingEntitlementsStateView, type BillingItemState, type BillingOrderHistoryState, type BillingPaymentHistoryState, type BillingPipelineOptions, type BillingPipelineResult, type BillingProductProviderProps, type BillingProductStateView, type BillingProductsState, BillingProvider, type BillingProviderProps, type BillingPurchaseStatusView, type BillingRefreshView, type BillingStatusView, type BillingSubscriptionHistoryState, type BillingSubscriptionProductState, type BillingSubscriptionProviderProps, type BillingSubscriptionStateView, CreditsProvider, ProductProvider, SubscriptionProvider, useAuthActions, useAuthRole, useAuthSession, useAuthUser, useBillingAvailablePlans, useBillingAvailableProducts, useBillingCatalog, useBillingCatalogConfig, useBillingContext, useBillingCredits, useBillingEntitlements, useBillingItem, useBillingOrderHistory, useBillingPaymentHistory, useBillingPipeline, useBillingProduct, useBillingProducts, useBillingPurchaseStatus, useBillingRefresh, useBillingStatus, useBillingSubscription, useBillingSubscriptionHistory, useBillingSubscriptionProduct, useCancelSubscription, useManageSubscription, usePurchaseProduct, useSubscribePlan, useUpgradePlan };
|
|
257
|
+
export { type AuthActions, type AuthActionsOptions, AuthProvider, type AuthRole, AuthSession, type AuthUserSummary, type BillingActionHookResult, type BillingAvailablePlansState, type BillingAvailableProductsState, type BillingCatalogState, BillingCoreProvider, type BillingCoreProviderProps, type BillingCreditsProviderProps, type BillingCreditsStateView, type BillingEntitlementsStateView, type BillingItemState, type BillingOrderHistoryState, type BillingPaymentHistoryState, type BillingPipelineOptions, type BillingPipelineResult, type BillingProductDetailState, type BillingProductProviderProps, type BillingProductPurchaseOptionsState, type BillingProductStateView, type BillingProductsState, BillingProvider, type BillingProviderProps, type BillingPurchaseStatusView, type BillingRefreshView, type BillingStatusView, type BillingSubscriptionHistoryState, type BillingSubscriptionProductState, type BillingSubscriptionProviderProps, type BillingSubscriptionStateView, CreditsProvider, ProductProvider, SubscriptionProvider, useAuthActions, useAuthRole, useAuthSession, useAuthUser, useBillingAvailablePlans, useBillingAvailableProducts, useBillingCatalog, useBillingCatalogConfig, useBillingContext, useBillingCredits, useBillingEntitlements, useBillingItem, useBillingOrderHistory, useBillingPaymentHistory, useBillingPipeline, useBillingProduct, useBillingProductDetail, useBillingProductPurchaseOptions, useBillingProducts, useBillingPurchaseStatus, useBillingRefresh, useBillingStatus, useBillingSubscription, useBillingSubscriptionHistory, useBillingSubscriptionProduct, useCancelSubscription, useManageSubscription, usePurchaseProduct, useSubscribePlan, useUpgradePlan };
|