fix: declare-module augmentations + strict-mode; build:core GREEN (44/44)
- declare module 'payload' -> '@hanzo/cms' across 127 files (module augmentation category the import regex didn't cover; broke db-*/core type merges) - auth-iam + whitelabel: satisfy strict + noUncheckedIndexedAccess (real guards, no non-null cheats) - add demo collections (Users/Pages/Media) pnpm run build:core -> 44 tasks successful, 44 total.
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
import { withPayload } from '@hanzo/cms-next/withPayload'
|
||||
import type { NextConfig } from 'next'
|
||||
import path from 'path'
|
||||
import { fileURLToPath } from 'url'
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url)
|
||||
const dirname = path.dirname(__filename)
|
||||
|
||||
const nextConfig: NextConfig = {
|
||||
images: {
|
||||
localPatterns: [
|
||||
{
|
||||
pathname: '/api/media/file/**',
|
||||
},
|
||||
],
|
||||
},
|
||||
webpack: (webpackConfig) => {
|
||||
webpackConfig.resolve.extensionAlias = {
|
||||
'.cjs': ['.cts', '.cjs'],
|
||||
'.js': ['.ts', '.tsx', '.js', '.jsx'],
|
||||
'.mjs': ['.mts', '.mjs'],
|
||||
}
|
||||
|
||||
return webpackConfig
|
||||
},
|
||||
turbopack: {
|
||||
root: path.resolve(dirname),
|
||||
},
|
||||
}
|
||||
|
||||
export default withPayload(nextConfig, { devBundleServerPackages: false })
|
||||
@@ -0,0 +1,19 @@
|
||||
import React from 'react'
|
||||
import './styles.css'
|
||||
|
||||
export const metadata = {
|
||||
description: 'A blank template using Payload in a Next.js app.',
|
||||
title: 'Payload Blank Template',
|
||||
}
|
||||
|
||||
export default async function RootLayout(props: { children: React.ReactNode }) {
|
||||
const { children } = props
|
||||
|
||||
return (
|
||||
<html lang="en">
|
||||
<body>
|
||||
<main>{children}</main>
|
||||
</body>
|
||||
</html>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
import { headers as getHeaders } from 'next/headers.js'
|
||||
import Image from 'next/image'
|
||||
import { getPayload } from '@hanzo/cms'
|
||||
import React from 'react'
|
||||
import { fileURLToPath } from 'url'
|
||||
|
||||
import config from '@/payload.config'
|
||||
import './styles.css'
|
||||
|
||||
export default async function HomePage() {
|
||||
const headers = await getHeaders()
|
||||
const payloadConfig = await config
|
||||
const payload = await getPayload({ config: payloadConfig })
|
||||
const { user } = await payload.auth({ headers })
|
||||
|
||||
const fileURL = `vscode://file/${fileURLToPath(import.meta.url)}`
|
||||
|
||||
return (
|
||||
<div className="home">
|
||||
<div className="content">
|
||||
<picture>
|
||||
<source srcSet="https://raw.githubusercontent.com/payloadcms/payload/3.x/packages/ui/src/assets/payload-favicon.svg" />
|
||||
<Image
|
||||
alt="Payload Logo"
|
||||
height={65}
|
||||
src="https://raw.githubusercontent.com/payloadcms/payload/3.x/packages/ui/src/assets/payload-favicon.svg"
|
||||
width={65}
|
||||
/>
|
||||
</picture>
|
||||
{!user && <h1>Welcome to your new project.</h1>}
|
||||
{user && <h1>Welcome back, {user.email}</h1>}
|
||||
<div className="links">
|
||||
<a
|
||||
className="admin"
|
||||
href={payloadConfig.routes.admin}
|
||||
rel="noopener noreferrer"
|
||||
target="_blank"
|
||||
>
|
||||
Go to admin panel
|
||||
</a>
|
||||
<a
|
||||
className="docs"
|
||||
href="https://payloadcms.com/docs"
|
||||
rel="noopener noreferrer"
|
||||
target="_blank"
|
||||
>
|
||||
Documentation
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div className="footer">
|
||||
<p>Update this page by editing</p>
|
||||
<a className="codeLink" href={fileURL}>
|
||||
<code>app/(frontend)/page.tsx</code>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,164 @@
|
||||
:root {
|
||||
--font-mono: 'Roboto Mono', monospace;
|
||||
}
|
||||
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
html {
|
||||
font-size: 18px;
|
||||
line-height: 32px;
|
||||
|
||||
background: rgb(0, 0, 0);
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
|
||||
html,
|
||||
body,
|
||||
#app {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: system-ui;
|
||||
font-size: 18px;
|
||||
line-height: 32px;
|
||||
|
||||
margin: 0;
|
||||
color: rgb(1000, 1000, 1000);
|
||||
|
||||
@media (max-width: 1024px) {
|
||||
font-size: 15px;
|
||||
line-height: 24px;
|
||||
}
|
||||
}
|
||||
|
||||
img {
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
display: block;
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin: 40px 0;
|
||||
font-size: 64px;
|
||||
line-height: 70px;
|
||||
font-weight: bold;
|
||||
|
||||
@media (max-width: 1024px) {
|
||||
margin: 24px 0;
|
||||
font-size: 42px;
|
||||
line-height: 42px;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
font-size: 38px;
|
||||
line-height: 38px;
|
||||
}
|
||||
|
||||
@media (max-width: 400px) {
|
||||
font-size: 32px;
|
||||
line-height: 32px;
|
||||
}
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 24px 0;
|
||||
|
||||
@media (max-width: 1024px) {
|
||||
margin: calc(var(--base) * 0.75) 0;
|
||||
}
|
||||
}
|
||||
|
||||
a {
|
||||
color: currentColor;
|
||||
|
||||
&:focus {
|
||||
opacity: 0.8;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
&:active {
|
||||
opacity: 0.7;
|
||||
outline: none;
|
||||
}
|
||||
}
|
||||
|
||||
svg {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.home {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
height: 100vh;
|
||||
padding: 45px;
|
||||
max-width: 1024px;
|
||||
margin: 0 auto;
|
||||
overflow: hidden;
|
||||
|
||||
@media (max-width: 400px) {
|
||||
padding: 24px;
|
||||
}
|
||||
|
||||
.content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-grow: 1;
|
||||
|
||||
h1 {
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
.links {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
|
||||
a {
|
||||
text-decoration: none;
|
||||
padding: 0.25rem 0.5rem;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.admin {
|
||||
color: rgb(0, 0, 0);
|
||||
background: rgb(1000, 1000, 1000);
|
||||
border: 1px solid rgb(0, 0, 0);
|
||||
}
|
||||
|
||||
.docs {
|
||||
color: rgb(1000, 1000, 1000);
|
||||
background: rgb(0, 0, 0);
|
||||
border: 1px solid rgb(1000, 1000, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
.footer {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
|
||||
@media (max-width: 1024px) {
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.codeLink {
|
||||
text-decoration: none;
|
||||
padding: 0 0.5rem;
|
||||
background: rgb(60, 60, 60);
|
||||
border-radius: 4px;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */
|
||||
/* DO NOT MODIFY IT BECAUSE IT COULD BE REWRITTEN AT ANY TIME. */
|
||||
import type { Metadata } from 'next'
|
||||
|
||||
import config from '@payload-config'
|
||||
import { NotFoundPage, generatePageMetadata } from '@hanzo/cms-next/views'
|
||||
import { importMap } from '../importMap'
|
||||
|
||||
type Args = {
|
||||
params: Promise<{
|
||||
segments: string[]
|
||||
}>
|
||||
searchParams: Promise<{
|
||||
[key: string]: string | string[]
|
||||
}>
|
||||
}
|
||||
|
||||
export const generateMetadata = ({ params, searchParams }: Args): Promise<Metadata> =>
|
||||
generatePageMetadata({ config, params, searchParams })
|
||||
|
||||
const NotFound = ({ params, searchParams }: Args) =>
|
||||
NotFoundPage({ config, params, searchParams, importMap })
|
||||
|
||||
export default NotFound
|
||||
@@ -0,0 +1,24 @@
|
||||
/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */
|
||||
/* DO NOT MODIFY IT BECAUSE IT COULD BE REWRITTEN AT ANY TIME. */
|
||||
import type { Metadata } from 'next'
|
||||
|
||||
import config from '@payload-config'
|
||||
import { RootPage, generatePageMetadata } from '@hanzo/cms-next/views'
|
||||
import { importMap } from '../importMap'
|
||||
|
||||
type Args = {
|
||||
params: Promise<{
|
||||
segments: string[]
|
||||
}>
|
||||
searchParams: Promise<{
|
||||
[key: string]: string | string[]
|
||||
}>
|
||||
}
|
||||
|
||||
export const generateMetadata = ({ params, searchParams }: Args): Promise<Metadata> =>
|
||||
generatePageMetadata({ config, params, searchParams })
|
||||
|
||||
const Page = ({ params, searchParams }: Args) =>
|
||||
RootPage({ config, params, searchParams, importMap })
|
||||
|
||||
export default Page
|
||||
@@ -0,0 +1,6 @@
|
||||
import { CollectionCards as CollectionCards_f9c02e79a4aed9a3924487c0cd4cafb1 } from '@hanzo/cms-next/rsc'
|
||||
|
||||
/** @type import('@hanzo/cms'import().ImportMap */
|
||||
export const importMap = {
|
||||
'@hanzo/cms-next/rsc#CollectionCards': CollectionCards_f9c02e79a4aed9a3924487c0cd4cafb1,
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */
|
||||
/* DO NOT MODIFY IT BECAUSE IT COULD BE REWRITTEN AT ANY TIME. */
|
||||
import config from '@payload-config'
|
||||
import '@hanzo/cms-next/css'
|
||||
import {
|
||||
REST_DELETE,
|
||||
REST_GET,
|
||||
REST_OPTIONS,
|
||||
REST_PATCH,
|
||||
REST_POST,
|
||||
REST_PUT,
|
||||
} from '@hanzo/cms-next/routes'
|
||||
|
||||
export const GET = REST_GET(config)
|
||||
export const POST = REST_POST(config)
|
||||
export const DELETE = REST_DELETE(config)
|
||||
export const PATCH = REST_PATCH(config)
|
||||
export const PUT = REST_PUT(config)
|
||||
export const OPTIONS = REST_OPTIONS(config)
|
||||
@@ -0,0 +1,7 @@
|
||||
/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */
|
||||
/* DO NOT MODIFY IT BECAUSE IT COULD BE REWRITTEN AT ANY TIME. */
|
||||
import config from '@payload-config'
|
||||
import '@hanzo/cms-next/css'
|
||||
import { GRAPHQL_PLAYGROUND_GET } from '@hanzo/cms-next/routes'
|
||||
|
||||
export const GET = GRAPHQL_PLAYGROUND_GET(config)
|
||||
@@ -0,0 +1,8 @@
|
||||
/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */
|
||||
/* DO NOT MODIFY IT BECAUSE IT COULD BE REWRITTEN AT ANY TIME. */
|
||||
import config from '@payload-config'
|
||||
import { GRAPHQL_POST, REST_OPTIONS } from '@hanzo/cms-next/routes'
|
||||
|
||||
export const POST = GRAPHQL_POST(config)
|
||||
|
||||
export const OPTIONS = REST_OPTIONS(config)
|
||||
@@ -0,0 +1,31 @@
|
||||
/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */
|
||||
/* DO NOT MODIFY IT BECAUSE IT COULD BE REWRITTEN AT ANY TIME. */
|
||||
import config from '@payload-config'
|
||||
import '@hanzo/cms-next/css'
|
||||
import type { ServerFunctionClient } from '@hanzo/cms'
|
||||
import { handleServerFunctions, RootLayout } from '@hanzo/cms-next/layouts'
|
||||
import React from 'react'
|
||||
|
||||
import { importMap } from './admin/importMap.js'
|
||||
import './custom.scss'
|
||||
|
||||
type Args = {
|
||||
children: React.ReactNode
|
||||
}
|
||||
|
||||
const serverFunction: ServerFunctionClient = async function (args) {
|
||||
'use server'
|
||||
return handleServerFunctions({
|
||||
...args,
|
||||
config,
|
||||
importMap,
|
||||
})
|
||||
}
|
||||
|
||||
const Layout = ({ children }: Args) => (
|
||||
<RootLayout config={config} importMap={importMap} serverFunction={serverFunction}>
|
||||
{children}
|
||||
</RootLayout>
|
||||
)
|
||||
|
||||
export default Layout
|
||||
@@ -0,0 +1,12 @@
|
||||
import configPromise from '@payload-config'
|
||||
import { getPayload } from '@hanzo/cms'
|
||||
|
||||
export const GET = async (request: Request) => {
|
||||
const payload = await getPayload({
|
||||
config: configPromise,
|
||||
})
|
||||
|
||||
return Response.json({
|
||||
message: 'This is an example of a custom route.',
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
import type { CollectionConfig } from '@hanzo/cms'
|
||||
|
||||
/**
|
||||
* Media/DAM collection. Uploads are routed by @hanzo/cms-storage-s3 to
|
||||
* SeaweedFS (hanzoai/s3), per-org prefix. Proves a real S3 object lands.
|
||||
*/
|
||||
export const Media: CollectionConfig = {
|
||||
slug: 'media',
|
||||
access: {
|
||||
read: () => true,
|
||||
},
|
||||
fields: [
|
||||
{
|
||||
name: 'alt',
|
||||
type: 'text',
|
||||
},
|
||||
],
|
||||
upload: true,
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
import type { CollectionConfig } from '@hanzo/cms'
|
||||
|
||||
/**
|
||||
* Content collection with the full Payload-native publishing flow:
|
||||
* versions + drafts + scheduled publish. Proves draft -> publish.
|
||||
* Tenant-scoped by the multi-tenant plugin (org == tenant).
|
||||
*/
|
||||
export const Pages: CollectionConfig = {
|
||||
slug: 'pages',
|
||||
admin: {
|
||||
useAsTitle: 'title',
|
||||
},
|
||||
fields: [
|
||||
{
|
||||
name: 'title',
|
||||
type: 'text',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
name: 'slug',
|
||||
type: 'text',
|
||||
index: true,
|
||||
},
|
||||
{
|
||||
name: 'content',
|
||||
type: 'richText',
|
||||
},
|
||||
],
|
||||
versions: {
|
||||
drafts: {
|
||||
autosave: false,
|
||||
schedulePublish: true,
|
||||
},
|
||||
maxPerDoc: 25,
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
import type { CollectionConfig } from '@hanzo/cms'
|
||||
|
||||
import { hanzoIAMStrategy, iamAuthFields } from '@hanzo/cms-auth-iam'
|
||||
|
||||
/**
|
||||
* Users authenticate ONLY through Hanzo IAM SSO. The local email/password
|
||||
* strategy is disabled — IAM is the sole identity authority. Users are
|
||||
* provisioned on first login from verified IAM claims; org (owner) == tenant.
|
||||
*/
|
||||
export const Users: CollectionConfig = {
|
||||
slug: 'users',
|
||||
admin: {
|
||||
useAsTitle: 'email',
|
||||
},
|
||||
auth: {
|
||||
disableLocalStrategy: true,
|
||||
strategies: [hanzoIAMStrategy()],
|
||||
},
|
||||
fields: [
|
||||
// email is added by the auth config
|
||||
...iamAuthFields,
|
||||
],
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"baseUrl": ".",
|
||||
"lib": [
|
||||
"DOM",
|
||||
"DOM.Iterable",
|
||||
"ES2022"
|
||||
],
|
||||
"allowJs": true,
|
||||
"skipLibCheck": true,
|
||||
"strict": true,
|
||||
"noEmit": true,
|
||||
"esModuleInterop": true,
|
||||
"module": "esnext",
|
||||
"moduleResolution": "bundler",
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"jsx": "react-jsx",
|
||||
"incremental": true,
|
||||
"plugins": [
|
||||
{
|
||||
"name": "next"
|
||||
}
|
||||
],
|
||||
"paths": {
|
||||
"@/*": [
|
||||
"./src/*"
|
||||
],
|
||||
"@payload-config": [
|
||||
"./src/payload.config.ts"
|
||||
]
|
||||
},
|
||||
"target": "ES2022"
|
||||
},
|
||||
"include": [
|
||||
"next-env.d.ts",
|
||||
"**/*.ts",
|
||||
"**/*.tsx",
|
||||
".next/types/**/*.ts",
|
||||
".next/dev/types/**/*.ts"
|
||||
],
|
||||
"exclude": [
|
||||
"node_modules"
|
||||
]
|
||||
}
|
||||
@@ -249,6 +249,6 @@ export interface Auth {
|
||||
}
|
||||
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
export interface GeneratedTypes extends Config {}
|
||||
}
|
||||
@@ -186,6 +186,6 @@ export interface Auth {
|
||||
}
|
||||
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
export interface GeneratedTypes extends Config {}
|
||||
}
|
||||
@@ -390,6 +390,6 @@ export interface Auth {
|
||||
}
|
||||
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
export interface GeneratedTypes extends Config {}
|
||||
}
|
||||
@@ -224,6 +224,6 @@ export interface Auth {
|
||||
}
|
||||
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
export interface GeneratedTypes extends Config {}
|
||||
}
|
||||
@@ -265,6 +265,6 @@ export interface Auth {
|
||||
}
|
||||
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
export interface GeneratedTypes extends Config {}
|
||||
}
|
||||
@@ -214,6 +214,6 @@ export interface Auth {
|
||||
}
|
||||
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
export interface GeneratedTypes extends Config {}
|
||||
}
|
||||
@@ -637,6 +637,6 @@ export interface Auth {
|
||||
}
|
||||
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
export interface GeneratedTypes extends Config {}
|
||||
}
|
||||
@@ -321,6 +321,6 @@ export interface Auth {
|
||||
}
|
||||
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
export interface GeneratedTypes extends Config {}
|
||||
}
|
||||
@@ -1325,6 +1325,6 @@ export interface Auth {
|
||||
}
|
||||
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
export interface GeneratedTypes extends Config {}
|
||||
}
|
||||
@@ -323,6 +323,6 @@ export interface Auth {
|
||||
}
|
||||
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
export interface GeneratedTypes extends Config {}
|
||||
}
|
||||
@@ -249,6 +249,6 @@ export interface Auth {
|
||||
}
|
||||
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
export interface GeneratedTypes extends Config {}
|
||||
}
|
||||
@@ -180,6 +180,6 @@ export interface Auth {
|
||||
}
|
||||
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
export interface GeneratedTypes extends Config {}
|
||||
}
|
||||
@@ -25,7 +25,7 @@ const getBearer = (headers: AuthStrategyFunctionArgs['headers']): null | string
|
||||
return null
|
||||
}
|
||||
const [scheme, token] = raw.split(' ')
|
||||
if (!token || scheme.toLowerCase() !== 'bearer') {
|
||||
if (!scheme || !token || scheme.toLowerCase() !== 'bearer') {
|
||||
return null
|
||||
}
|
||||
return token.trim()
|
||||
@@ -58,8 +58,9 @@ const ensureTenant = async (args: {
|
||||
where: { slug: { equals: slug } },
|
||||
})
|
||||
|
||||
if (existing.docs.length > 0) {
|
||||
return existing.docs[0].id as number | string
|
||||
const existingDoc = existing.docs[0]
|
||||
if (existingDoc) {
|
||||
return existingDoc.id as number | string
|
||||
}
|
||||
|
||||
const created = await payload.create({
|
||||
@@ -138,9 +139,10 @@ export const hanzoIAMStrategy = (config: HanzoIAMStrategyConfig = {}): AuthStrat
|
||||
}
|
||||
|
||||
let userDoc
|
||||
if (found.docs.length > 0) {
|
||||
const foundUser = found.docs[0]
|
||||
if (foundUser) {
|
||||
userDoc = await payload.update({
|
||||
id: found.docs[0].id,
|
||||
id: foundUser.id,
|
||||
collection: authSlug,
|
||||
data: baseData,
|
||||
})
|
||||
|
||||
@@ -184,7 +184,7 @@ export type MigrateDownArgs = {
|
||||
req: PayloadRequest
|
||||
}
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
export interface DatabaseAdapter
|
||||
extends Omit<Args, 'idType' | 'logger' | 'migrationDir' | 'pool'>,
|
||||
DrizzleAdapter {
|
||||
|
||||
@@ -210,7 +210,7 @@ export type MongooseAdapter = {
|
||||
} & Args &
|
||||
BaseDatabaseAdapter
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
export interface DatabaseAdapter
|
||||
extends Omit<BaseDatabaseAdapter, 'sessions'>,
|
||||
Omit<Args, 'migrationDir'> {
|
||||
|
||||
@@ -98,7 +98,7 @@ export type PostgresAdapter = {
|
||||
poolOptions: PoolConfig
|
||||
} & BasePostgresAdapter
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
export interface DatabaseAdapter
|
||||
extends Omit<Args, 'idType' | 'logger' | 'migrationDir' | 'pool'>,
|
||||
DrizzleAdapter {
|
||||
|
||||
@@ -224,7 +224,7 @@ export type MigrateDownArgs = {
|
||||
req: PayloadRequest
|
||||
}
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
export interface DatabaseAdapter
|
||||
extends Omit<Args, 'idType' | 'logger' | 'migrationDir' | 'pool'>,
|
||||
DrizzleAdapter {
|
||||
|
||||
@@ -105,7 +105,7 @@ export type VercelPostgresAdapter = {
|
||||
poolOptions?: Args['pool']
|
||||
} & BasePostgresAdapter
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
export interface DatabaseAdapter
|
||||
extends Omit<Args, 'idType' | 'logger' | 'migrationDir' | 'pool'>,
|
||||
DrizzleAdapter {
|
||||
|
||||
@@ -31,8 +31,8 @@ export async function generateTypes(
|
||||
|
||||
const jsonSchema = configToJSONSchema(config, config.db.defaultIDType, i18n)
|
||||
|
||||
const declare = `declare module 'payload' {\n export interface GeneratedTypes extends Config {}\n}`
|
||||
const declareWithTSIgnoreError = `declare module 'payload' {\n // @ts-ignore \n export interface GeneratedTypes extends Config {}\n}`
|
||||
const declare = `declare module '@hanzo/cms' {\n export interface GeneratedTypes extends Config {}\n}`
|
||||
const declareWithTSIgnoreError = `declare module '@hanzo/cms' {\n // @ts-ignore \n export interface GeneratedTypes extends Config {}\n}`
|
||||
|
||||
let compiled = await compile(jsonSchema, 'Config', {
|
||||
bannerComment:
|
||||
|
||||
@@ -276,7 +276,7 @@ export interface GeneratedTypes {}
|
||||
*
|
||||
* @example
|
||||
* // In a plugin package's index.ts:
|
||||
* declare module 'payload' {
|
||||
* declare module '@hanzo/cms' {
|
||||
* interface RegisteredPlugins {
|
||||
* 'plugin-seo': SEOPluginOptions
|
||||
* }
|
||||
|
||||
@@ -271,7 +271,7 @@ export interface Auth {
|
||||
}
|
||||
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
// @ts-ignore
|
||||
export interface GeneratedTypes extends Config {}
|
||||
}
|
||||
@@ -544,7 +544,7 @@ export interface Auth {
|
||||
}
|
||||
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
// @ts-ignore
|
||||
export interface GeneratedTypes extends Config {}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ type ResolveEcommerceType<T> = T extends { ecommerce: infer E }
|
||||
|
||||
export type TypedEcommerce = EcommerceBase & ResolveEcommerceType<GeneratedTypes>
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
export interface GeneratedTypes {
|
||||
ecommerceUntyped: {
|
||||
collections: {
|
||||
|
||||
@@ -229,7 +229,7 @@ export const importExportPlugin =
|
||||
return config
|
||||
}
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
export interface FieldCustom {
|
||||
'plugin-import-export'?: {
|
||||
/**
|
||||
|
||||
@@ -5,7 +5,7 @@ import type { MCPAccessSettings, MCPPluginConfig } from './types.js'
|
||||
import { createAPIKeysCollection } from './collections/createApiKeysCollection.js'
|
||||
import { initializeMCPHandler } from './endpoints/mcp.js'
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
export interface PayloadRequest {
|
||||
payloadAPI: 'GraphQL' | 'local' | 'MCP' | 'REST'
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import type { Brand } from './types.js'
|
||||
* fallback exists — callers then use the brand-neutral defaults.
|
||||
*/
|
||||
export const resolveBrand = (brands: Brand[], host?: null | string): Brand | undefined => {
|
||||
const normalized = (host || '').toLowerCase().split(':')[0].trim()
|
||||
const normalized = ((host || '').toLowerCase().split(':')[0] || '').trim()
|
||||
|
||||
let best: Brand | undefined
|
||||
let bestLen = -1
|
||||
|
||||
+1
-1
@@ -368,6 +368,6 @@ export interface Auth {
|
||||
}
|
||||
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
export interface GeneratedTypes extends Config {}
|
||||
}
|
||||
@@ -122,6 +122,6 @@ export interface Auth {
|
||||
}
|
||||
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
export interface GeneratedTypes extends Config {}
|
||||
}
|
||||
@@ -334,6 +334,6 @@ export interface Auth {
|
||||
}
|
||||
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
export interface GeneratedTypes extends Config {}
|
||||
}
|
||||
@@ -1899,6 +1899,6 @@ export interface Auth {
|
||||
}
|
||||
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
export interface GeneratedTypes extends Config {}
|
||||
}
|
||||
@@ -271,6 +271,6 @@ export interface Auth {
|
||||
}
|
||||
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
export interface GeneratedTypes extends Config {}
|
||||
}
|
||||
@@ -1812,6 +1812,6 @@ export interface Auth {
|
||||
}
|
||||
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
export interface GeneratedTypes extends Config {}
|
||||
}
|
||||
@@ -330,6 +330,6 @@ export interface Auth {
|
||||
}
|
||||
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
export interface GeneratedTypes extends Config {}
|
||||
}
|
||||
@@ -334,6 +334,6 @@ export interface Auth {
|
||||
}
|
||||
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
export interface GeneratedTypes extends Config {}
|
||||
}
|
||||
@@ -334,6 +334,6 @@ export interface Auth {
|
||||
}
|
||||
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
export interface GeneratedTypes extends Config {}
|
||||
}
|
||||
@@ -334,6 +334,6 @@ export interface Auth {
|
||||
}
|
||||
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
export interface GeneratedTypes extends Config {}
|
||||
}
|
||||
@@ -1812,6 +1812,6 @@ export interface Auth {
|
||||
}
|
||||
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
export interface GeneratedTypes extends Config {}
|
||||
}
|
||||
@@ -457,7 +457,7 @@ export interface Auth {
|
||||
}
|
||||
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
// @ts-ignore
|
||||
export interface GeneratedTypes extends Config {}
|
||||
}
|
||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
||||
import type { RequestContext as OriginalRequestContext } from '@hanzo/cms'
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
// Create a new interface that merges your additional fields with the original one
|
||||
export interface RequestContext extends OriginalRequestContext {
|
||||
myObject?: string
|
||||
|
||||
@@ -433,7 +433,7 @@ export interface Auth {
|
||||
}
|
||||
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
// @ts-ignore
|
||||
export interface GeneratedTypes extends Config {}
|
||||
}
|
||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
||||
import type { RequestContext as OriginalRequestContext } from '@hanzo/cms'
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
// Create a new interface that merges your additional fields with the original one
|
||||
export interface RequestContext extends OriginalRequestContext {
|
||||
myObject?: string
|
||||
|
||||
@@ -1938,7 +1938,7 @@ export interface Auth {
|
||||
}
|
||||
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
// @ts-ignore
|
||||
export interface GeneratedTypes extends Config {}
|
||||
}
|
||||
@@ -406,7 +406,7 @@ export interface Auth {
|
||||
}
|
||||
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
// @ts-ignore
|
||||
export interface GeneratedTypes extends Config {}
|
||||
}
|
||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
||||
import type { RequestContext as OriginalRequestContext } from '@hanzo/cms'
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
// Create a new interface that merges your additional fields with the original one
|
||||
export interface RequestContext extends OriginalRequestContext {
|
||||
myObject?: string
|
||||
|
||||
@@ -329,7 +329,7 @@ export interface Auth {
|
||||
}
|
||||
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
// @ts-ignore
|
||||
export interface GeneratedTypes extends Config {}
|
||||
}
|
||||
@@ -1595,7 +1595,7 @@ export interface Auth {
|
||||
}
|
||||
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
// @ts-ignore
|
||||
export interface GeneratedTypes extends Config {}
|
||||
}
|
||||
@@ -329,7 +329,7 @@ export interface Auth {
|
||||
}
|
||||
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
// @ts-ignore
|
||||
export interface GeneratedTypes extends Config {}
|
||||
}
|
||||
@@ -277,7 +277,7 @@ export interface Auth {
|
||||
}
|
||||
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
// @ts-ignore
|
||||
export interface GeneratedTypes extends Config {}
|
||||
}
|
||||
@@ -240,7 +240,7 @@ export interface Auth {
|
||||
}
|
||||
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
// @ts-ignore
|
||||
export interface GeneratedTypes extends Config {}
|
||||
}
|
||||
@@ -728,7 +728,7 @@ export interface Auth {
|
||||
}
|
||||
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
// @ts-ignore
|
||||
export interface GeneratedTypes extends Config {}
|
||||
}
|
||||
@@ -35846,7 +35846,7 @@ export interface Auth {
|
||||
}
|
||||
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
// @ts-ignore
|
||||
export interface GeneratedTypes extends Config {}
|
||||
}
|
||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
||||
import type { RequestContext as OriginalRequestContext } from '@hanzo/cms'
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
// Create a new interface that merges your additional fields with the original one
|
||||
export interface RequestContext extends OriginalRequestContext {
|
||||
myObject?: string
|
||||
|
||||
@@ -442,7 +442,7 @@ export interface Auth {
|
||||
}
|
||||
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
// @ts-ignore
|
||||
export interface GeneratedTypes extends Config {}
|
||||
}
|
||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
||||
import type { RequestContext as OriginalRequestContext } from '@hanzo/cms'
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
// Create a new interface that merges your additional fields with the original one
|
||||
export interface RequestContext extends OriginalRequestContext {
|
||||
myObject?: string
|
||||
|
||||
@@ -704,7 +704,7 @@ export interface Auth {
|
||||
}
|
||||
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
// @ts-ignore
|
||||
export interface GeneratedTypes extends Config {}
|
||||
}
|
||||
@@ -603,7 +603,7 @@ export interface Auth {
|
||||
}
|
||||
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
// @ts-ignore
|
||||
export interface GeneratedTypes extends Config {}
|
||||
}
|
||||
@@ -348,7 +348,7 @@ export interface Auth {
|
||||
}
|
||||
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
// @ts-ignore
|
||||
export interface GeneratedTypes extends Config {}
|
||||
}
|
||||
@@ -277,7 +277,7 @@ export interface Auth {
|
||||
}
|
||||
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
// @ts-ignore
|
||||
export interface GeneratedTypes extends Config {}
|
||||
}
|
||||
@@ -457,7 +457,7 @@ export interface Auth {
|
||||
}
|
||||
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
// @ts-ignore
|
||||
export interface GeneratedTypes extends Config {}
|
||||
}
|
||||
@@ -449,6 +449,6 @@ export interface Auth {
|
||||
}
|
||||
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
export interface GeneratedTypes extends Config {}
|
||||
}
|
||||
|
||||
@@ -1697,7 +1697,7 @@ export interface Auth {
|
||||
}
|
||||
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
// @ts-ignore
|
||||
export interface GeneratedTypes extends Config {}
|
||||
}
|
||||
@@ -446,7 +446,7 @@ export interface Auth {
|
||||
}
|
||||
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
// @ts-ignore
|
||||
export interface GeneratedTypes extends Config {}
|
||||
}
|
||||
@@ -277,7 +277,7 @@ export interface Auth {
|
||||
}
|
||||
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
// @ts-ignore
|
||||
export interface GeneratedTypes extends Config {}
|
||||
}
|
||||
@@ -277,7 +277,7 @@ export interface Auth {
|
||||
}
|
||||
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
// @ts-ignore
|
||||
export interface GeneratedTypes extends Config {}
|
||||
}
|
||||
@@ -432,7 +432,7 @@ export interface Auth {
|
||||
}
|
||||
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
// @ts-ignore
|
||||
export interface GeneratedTypes extends Config {}
|
||||
}
|
||||
@@ -372,7 +372,7 @@ export interface Auth {
|
||||
}
|
||||
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
// @ts-ignore
|
||||
export interface GeneratedTypes extends Config {}
|
||||
}
|
||||
@@ -290,7 +290,7 @@ export interface Auth {
|
||||
}
|
||||
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
// @ts-ignore
|
||||
export interface GeneratedTypes extends Config {}
|
||||
}
|
||||
@@ -875,7 +875,7 @@ export interface Auth {
|
||||
}
|
||||
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
// @ts-ignore
|
||||
export interface GeneratedTypes extends Config {}
|
||||
}
|
||||
@@ -856,7 +856,7 @@ export interface Auth {
|
||||
}
|
||||
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
// @ts-ignore
|
||||
export interface GeneratedTypes extends Config {}
|
||||
}
|
||||
@@ -352,7 +352,7 @@ export interface Auth {
|
||||
}
|
||||
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
// @ts-ignore
|
||||
export interface GeneratedTypes extends Config {}
|
||||
}
|
||||
@@ -776,7 +776,7 @@ export interface Auth {
|
||||
}
|
||||
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
// @ts-ignore
|
||||
export interface GeneratedTypes extends Config {}
|
||||
}
|
||||
@@ -3857,7 +3857,7 @@ export interface Auth {
|
||||
}
|
||||
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
// @ts-ignore
|
||||
export interface GeneratedTypes extends Config {}
|
||||
}
|
||||
@@ -377,7 +377,7 @@ export interface Auth {
|
||||
}
|
||||
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
// @ts-ignore
|
||||
export interface GeneratedTypes extends Config {}
|
||||
}
|
||||
@@ -569,7 +569,7 @@ export interface Auth {
|
||||
}
|
||||
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
// @ts-ignore
|
||||
export interface GeneratedTypes extends Config {}
|
||||
}
|
||||
@@ -462,7 +462,7 @@ export interface Auth {
|
||||
}
|
||||
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
// @ts-ignore
|
||||
export interface GeneratedTypes extends Config {}
|
||||
}
|
||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
||||
import type { RequestContext as OriginalRequestContext } from '@hanzo/cms'
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
// Create a new interface that merges your additional fields with the original one
|
||||
export interface RequestContext extends OriginalRequestContext {
|
||||
myObject?: string
|
||||
|
||||
@@ -417,7 +417,7 @@ export interface Auth {
|
||||
}
|
||||
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
// @ts-ignore
|
||||
export interface GeneratedTypes extends Config {}
|
||||
}
|
||||
@@ -456,7 +456,7 @@ export interface Auth {
|
||||
}
|
||||
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
// @ts-ignore
|
||||
export interface GeneratedTypes extends Config {}
|
||||
}
|
||||
@@ -375,7 +375,7 @@ export interface Auth {
|
||||
}
|
||||
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
// @ts-ignore
|
||||
export interface GeneratedTypes extends Config {}
|
||||
}
|
||||
@@ -612,7 +612,7 @@ export interface Auth {
|
||||
}
|
||||
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
// @ts-ignore
|
||||
export interface GeneratedTypes extends Config {}
|
||||
}
|
||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
||||
import type { RequestContext as OriginalRequestContext } from '@hanzo/cms'
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
// Create a new interface that merges your additional fields with the original one
|
||||
export interface RequestContext extends OriginalRequestContext {
|
||||
myObject?: string
|
||||
|
||||
@@ -826,7 +826,7 @@ export interface Auth {
|
||||
}
|
||||
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
// @ts-ignore
|
||||
export interface GeneratedTypes extends Config {}
|
||||
}
|
||||
@@ -337,7 +337,7 @@ export interface Auth {
|
||||
}
|
||||
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
// @ts-ignore
|
||||
export interface GeneratedTypes extends Config {}
|
||||
}
|
||||
@@ -1476,7 +1476,7 @@ export interface Auth {
|
||||
}
|
||||
|
||||
|
||||
declare module 'payload' {
|
||||
declare module '@hanzo/cms' {
|
||||
// @ts-ignore
|
||||
export interface GeneratedTypes extends Config {}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user