Compare commits
35 Commits
feat/expor
...
fix/postgr
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d20ff9b941 | ||
|
|
b11c33b59f | ||
|
|
664f1efe9f | ||
|
|
ae730feada | ||
|
|
72ca92d2d0 | ||
|
|
e6cd8062ea | ||
|
|
e837a0d418 | ||
|
|
31d256f770 | ||
|
|
66575fc676 | ||
|
|
6eb99418a7 | ||
|
|
6d4859f65d | ||
|
|
ca300eaaf8 | ||
|
|
7be66b9304 | ||
|
|
4c0a4921bf | ||
|
|
0c13a94cb4 | ||
|
|
9f79cfb2be | ||
|
|
6b0fce2fc5 | ||
|
|
8abc4d2af7 | ||
|
|
07d6272747 | ||
|
|
ef44748817 | ||
|
|
8df359195f | ||
|
|
207cfaee8a | ||
|
|
55333a38f8 | ||
|
|
b010519937 | ||
|
|
a08508f23a | ||
|
|
b68393e1a3 | ||
|
|
4663f4b379 | ||
|
|
bdc972f2f0 | ||
|
|
da7687f0e6 | ||
|
|
4261d0a3aa | ||
|
|
7dc911cef5 | ||
|
|
c57966988d | ||
|
|
faf0fa3b86 | ||
|
|
c13fe0832f | ||
|
|
8b97a0925d |
@@ -1,5 +1,5 @@
|
||||
import type { CountryField } from 'payload-plugin-form-builder/dist/types'
|
||||
import type { Control, FieldErrorsImpl, FieldValues } from 'react-hook-form';
|
||||
import type { Control, FieldErrorsImpl, FieldValues } from 'react-hook-form'
|
||||
|
||||
import React from 'react'
|
||||
import { Controller } from 'react-hook-form'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { SelectField } from 'payload-plugin-form-builder/dist/types'
|
||||
import type { Control, FieldErrorsImpl, FieldValues } from 'react-hook-form';
|
||||
import type { Control, FieldErrorsImpl, FieldValues } from 'react-hook-form'
|
||||
|
||||
import React from 'react'
|
||||
import { Controller } from 'react-hook-form'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { StateField } from 'payload-plugin-form-builder/dist/types'
|
||||
import type { Control, FieldErrorsImpl, FieldValues } from 'react-hook-form';
|
||||
import type { Control, FieldErrorsImpl, FieldValues } from 'react-hook-form'
|
||||
|
||||
import React from 'react'
|
||||
import { Controller } from 'react-hook-form'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
'use client'
|
||||
import type React from 'react';
|
||||
import type React from 'react'
|
||||
|
||||
import { useModal } from '@faceless-ui/modal'
|
||||
import { usePathname } from 'next/navigation'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { Ref } from 'react';
|
||||
import type { Ref } from 'react'
|
||||
|
||||
import React, { forwardRef } from 'react'
|
||||
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev -p 3001",
|
||||
"build": "next build",
|
||||
"start": "next start -p 3001",
|
||||
"lint": "next lint"
|
||||
"dev": "next dev -p 3001",
|
||||
"lint": "next lint",
|
||||
"start": "next start -p 3001"
|
||||
},
|
||||
"dependencies": {
|
||||
"@payloadcms/live-preview-react": "3.0.0-beta.28",
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev -p 3001",
|
||||
"build": "next build",
|
||||
"start": "next start -p 3001",
|
||||
"lint": "next lint"
|
||||
"dev": "next dev -p 3001",
|
||||
"lint": "next lint",
|
||||
"start": "next start -p 3001"
|
||||
},
|
||||
"dependencies": {
|
||||
"@payloadcms/live-preview-react": "3.0.0-beta.28",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { ElementType } from 'react';
|
||||
import type { ElementType } from 'react'
|
||||
|
||||
import Link from 'next/link'
|
||||
import React from 'react'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { Ref } from 'react';
|
||||
import type { Ref } from 'react'
|
||||
|
||||
import React, { forwardRef } from 'react'
|
||||
|
||||
|
||||
@@ -125,7 +125,7 @@ const link: LinkType = ({ appearances, disableLabel = false, overrides = {} } =
|
||||
]
|
||||
|
||||
if (appearances) {
|
||||
appearanceOptionsToUse = appearances.map(appearance => appearanceOptions[appearance])
|
||||
appearanceOptionsToUse = appearances.map((appearance) => appearanceOptions[appearance])
|
||||
}
|
||||
|
||||
linkResult.fields.push({
|
||||
|
||||
@@ -21,6 +21,11 @@
|
||||
"import": "./src/types.ts",
|
||||
"require": "./src/types.ts",
|
||||
"types": "./src/types.ts"
|
||||
},
|
||||
"./migration-utils": {
|
||||
"import": "./src/exports/migration-utils.ts",
|
||||
"require": "./src/exports/migration-utils.ts",
|
||||
"types": "./src/exports/migration-utils.ts"
|
||||
}
|
||||
},
|
||||
"main": "./src/index.ts",
|
||||
@@ -66,6 +71,11 @@
|
||||
"import": "./dist/types.js",
|
||||
"require": "./dist/types.js",
|
||||
"types": "./dist/types.d.ts"
|
||||
},
|
||||
"./migration-utils": {
|
||||
"import": "./dist/exports/migration-utils.js",
|
||||
"require": "./dist/exports/migration-utils.js",
|
||||
"types": "./dist/exports/migration-utils.d.ts"
|
||||
}
|
||||
},
|
||||
"main": "./dist/index.js",
|
||||
|
||||
314
packages/db-postgres/predefinedMigrations/relationships-v2-v3.ts
Normal file
314
packages/db-postgres/predefinedMigrations/relationships-v2-v3.ts
Normal file
@@ -0,0 +1,314 @@
|
||||
import { eq, SQL, sql } from 'drizzle-orm'
|
||||
import { Payload } from 'payload/dist'
|
||||
import { Collection } from 'payload/dist/collections/config/types'
|
||||
import { Field, TabAsField, } from 'payload/dist/fields/config/types'
|
||||
import { buildVersionCollectionFields } from 'payload/dist/versions/buildCollectionFields'
|
||||
import toSnakeCase from 'to-snake-case'
|
||||
|
||||
|
||||
const collectionRelationshipMap: Record<string, {
|
||||
// ex: category_id
|
||||
columnName: string
|
||||
// group_
|
||||
columnPrefix: string
|
||||
// the type of the id column
|
||||
idType: 'number' | 'serial' | 'text' | 'uuid'
|
||||
// for blocks and arrays we need to join the tables with orderBy "order", then get the id from the index returned
|
||||
joins: string[]
|
||||
// whether the relationship is localized
|
||||
localized: boolean
|
||||
// ex: posts_rels, _posts_v_rels
|
||||
tableName: string
|
||||
// ex: posts, _posts_v, posts_blocks_relationships, posts_array_relationships
|
||||
targetTableName: string
|
||||
}[]> = {}
|
||||
const findRelationships = (
|
||||
{
|
||||
collection,
|
||||
columnPrefix,
|
||||
fields,
|
||||
joins,
|
||||
localized,
|
||||
payload,
|
||||
tableName,
|
||||
version,
|
||||
}: {
|
||||
collection: Collection,
|
||||
columnPrefix: string,
|
||||
fields: Field[] | TabAsField,
|
||||
joins: string[]
|
||||
localized?: boolean,
|
||||
payload: Payload,
|
||||
tableName: string,
|
||||
version?: boolean,
|
||||
}
|
||||
) => {
|
||||
const { db } = payload
|
||||
const rootTableName = db.tableNameMap.get(version ? `_${toSnakeCase(collection.slug)}${db.versionsSuffix}` : toSnakeCase(collection.slug))
|
||||
|
||||
let newTableName = tableName
|
||||
collectionRelationshipMap[newTableName] = collectionRelationshipMap[newTableName] || []
|
||||
|
||||
return fields.forEach((field) => {
|
||||
if (!(typeof 'type' in field) || !field.type) {
|
||||
return
|
||||
}
|
||||
|
||||
if ((field.type === 'relationship' || field.type === 'upload') && !field.hasMany && typeof field.relationTo === 'string') {
|
||||
if (field.localized) {
|
||||
localized = true
|
||||
}
|
||||
collectionRelationshipMap[newTableName].push({
|
||||
columnName: `${toSnakeCase(field.relationTo)}_id`,
|
||||
columnPrefix,
|
||||
idType: collection.customIDType || db.idType,
|
||||
joins,
|
||||
localized: field.localized,
|
||||
tableName: `${db.tableNameMap.get(rootTableName)}${db.relationshipsSuffix}`,
|
||||
targetTableName: `${db.tableNameMap.get(newTableName)}${localized ? db.localesSuffix : ''}`,
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
if (field.type === 'blocks') {
|
||||
field.blocks.forEach((blockType) => {
|
||||
const block = field.blocks.find((block) => block.slug === blockType)
|
||||
fields = block.fields
|
||||
newTableName = db.tableNameMap.get(
|
||||
`${tableName}_blocks_${toSnakeCase(block.slug)}`,
|
||||
)
|
||||
findRelationships({
|
||||
collection,
|
||||
columnPrefix,
|
||||
fields,
|
||||
joins,
|
||||
payload,
|
||||
tableName: newTableName,
|
||||
version,
|
||||
})
|
||||
})
|
||||
return
|
||||
}
|
||||
if (field.type === 'tabs') {
|
||||
field.tabs.forEach((tab) => {
|
||||
fields = tab.fields
|
||||
if (tab.name) {
|
||||
columnPrefix += `${toSnakeCase(tab.name)}_`
|
||||
}
|
||||
findRelationships({
|
||||
collection,
|
||||
columnPrefix,
|
||||
fields,
|
||||
joins,
|
||||
localized: tab.localized,
|
||||
payload,
|
||||
tableName: newTableName,
|
||||
version,
|
||||
})
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
let fields = field.fields
|
||||
let isLocalized
|
||||
|
||||
switch (field.type) {
|
||||
case 'group':
|
||||
if (field.localized) {
|
||||
isLocalized = true
|
||||
}
|
||||
if (field.name) {
|
||||
columnPrefix += `${toSnakeCase(field.name)}_`
|
||||
}
|
||||
break
|
||||
case 'array':
|
||||
newTableName = db.tableNameMap.get(`${tableName}_${toSnakeCase(field.name)}`)
|
||||
// add the
|
||||
joins[tableName] = eq(
|
||||
payload.db.tables[tableName].id,
|
||||
payload.db.tables[newTableName]._parentID,
|
||||
)
|
||||
break
|
||||
}
|
||||
if (fields) {
|
||||
findRelationships({
|
||||
collection,
|
||||
columnPrefix,
|
||||
fields,
|
||||
joins,
|
||||
localized: isLocalized,
|
||||
payload,
|
||||
tableName: newTableName,
|
||||
version,
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const up = async function up(payload) {
|
||||
// TODO: Early return to skip migration if the version of drizzle is above 5 if we include the drizzle update in ours
|
||||
|
||||
// For each collection and global get the fields and find the relationships that need migration
|
||||
// find all the relationships that need to be updated
|
||||
// creating a path object to key the relationships by the path
|
||||
payload.collections.forEach((collection) => {
|
||||
const tableName = toSnakeCase(collection.slug)
|
||||
findRelationships({
|
||||
collection,
|
||||
columnPrefix: '',
|
||||
fields: collection.fields,
|
||||
joins: {},
|
||||
payload,
|
||||
tableName
|
||||
})
|
||||
if (collection.versions) {
|
||||
const versionFields = buildVersionCollectionFields(collection)
|
||||
findRelationships({
|
||||
collection,
|
||||
columnPrefix: '',
|
||||
fields: versionFields,
|
||||
joins: [],
|
||||
payload,
|
||||
tableName,
|
||||
version: true,
|
||||
})
|
||||
}
|
||||
})
|
||||
payload.globals.forEach((global) => {
|
||||
findRelationships({
|
||||
collection: global,
|
||||
columnPrefix: '',
|
||||
fields: global.fields,
|
||||
joins: {},
|
||||
payload,
|
||||
tableName: toSnakeCase(global.slug)
|
||||
})
|
||||
if (global.versions) {
|
||||
const versionFields = buildVersionCollectionFields(global)
|
||||
findRelationships({
|
||||
collection: global,
|
||||
columnPrefix: '',
|
||||
fields: versionFields,
|
||||
joins: {},
|
||||
payload,
|
||||
tableName: toSnakeCase(global),
|
||||
version: true
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
let createColumnsSQL = ''
|
||||
|
||||
// update schema to hold new relationship columns in the format of the destination
|
||||
// - do not enforce referential integrity while populating the new columns
|
||||
Object.entries(collectionRelationshipMap).forEach(([slug, relationships]) => {
|
||||
relationships.forEach(({ columnName, idType, targetTableName }) => {
|
||||
let idColumnType = 'integer'
|
||||
switch (idType) {
|
||||
case 'number':
|
||||
idColumnType = 'numeric'
|
||||
break
|
||||
case 'text':
|
||||
idColumnType = 'varchar'
|
||||
break
|
||||
case 'uuid':
|
||||
idColumnType = 'uuid'
|
||||
break
|
||||
case 'serial':
|
||||
idColumnType = 'integer'
|
||||
break
|
||||
default:
|
||||
break
|
||||
}
|
||||
createColumnsSQL += `ALTER TABLE "${targetTableName}"
|
||||
ADD COLUMN "${columnName}" ${idColumnType};`
|
||||
})
|
||||
})
|
||||
|
||||
await payload.db.drizzle.execute(sql`${createColumnsSQL}`)
|
||||
|
||||
/**
|
||||
* This needs to return a query that gets the ids of the tables to update with the new relationship columns
|
||||
* @param locale
|
||||
* @param parent_id
|
||||
* @param path
|
||||
* @param targetTableName
|
||||
*/
|
||||
const queryPath = ({ locale, parent_id, path, targetTableName }): SQL => {
|
||||
// the relationship is directly on the collection table
|
||||
if (!path.includes('.')) {
|
||||
if (locale) {
|
||||
// the relationship is on the locales table
|
||||
return sql`select "id"
|
||||
from "${targetTableName}"
|
||||
where "id" = ${parent_id}
|
||||
and "_locale" = ${locale}`
|
||||
} else {
|
||||
// the relationship is on the main table
|
||||
return sql`select "id"
|
||||
from "${targetTableName}"
|
||||
where "id" = ${parent_id}`
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: map path to arrays and blocks that will be joined in and return the id for the row that needs to be written to
|
||||
const pathParts = path.split('.')
|
||||
const parts: { field: string, order: number }[] = []
|
||||
while (pathParts.length > 1) {
|
||||
const [field, order] = pathParts.splice(0, 2)
|
||||
parts.push({ field, order })
|
||||
// example query for blocks:
|
||||
}
|
||||
|
||||
// if parts.length === 1 the parent_id is the id of the collection
|
||||
let sql = `select "id" from ${targetTableName} where "id" = ${parts.length === 1 ? parent_id : '('}}}`
|
||||
// if parts.length > 1 we need the subquery parent_id
|
||||
parts.forEach(({ field, order }, index) => {
|
||||
sql += `select "id" from ${joinTable} where "_order" = ${order} and "_parent_id" = )`
|
||||
|
||||
|
||||
|
||||
// for each relationship that was found, copy the relationship to the new columns
|
||||
Object.entries(collectionRelationshipMap).forEach(([slug, relationships]) => {
|
||||
|
||||
relationships.forEach(async ({ columnName, columnPrefix, localized, tableName, targetTableName }) => {
|
||||
// for blocks and arrays we need to join all the tables with orderBy "order", then get the id from the index returned
|
||||
const selectStatement = sql`select "parent_id", "path", ${localized ? `"locale",` : ''} ${columnName} as value
|
||||
from ${tableName}`
|
||||
const result = await payload.db.drizzle.query(selectStatement)
|
||||
|
||||
for (const { locale, parent_id, path, value } of result) {
|
||||
// if a path has a dot parse it
|
||||
const selectTargetSQL = queryPath({ locale, parent_id, path, targetTableName })
|
||||
|
||||
const targetResult = await payload.db.drizzle.query(selectTargetSQL)
|
||||
// update the new columns with the existing data
|
||||
const updateSQL = sql`update ${targetTableName}
|
||||
set ${`${columnPrefix}${columnName}`} = ${value}
|
||||
where "id" = ${targetResult.id}`
|
||||
await payload.db.drizzle.execute(updateSQL)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
// drop the old columns and possibly entire tables (_rels)
|
||||
Object.entries(collectionRelationshipMap).forEach(([slug, relationships]) => {
|
||||
relationships.forEach(({ columnName, tableName }) => {
|
||||
const dropColumnSQL = sql`ALTER TABLE "${tableName}"
|
||||
DROP COLUMN "${columnName}";`
|
||||
payload.db.drizzle.execute(dropColumnSQL)
|
||||
})
|
||||
})
|
||||
|
||||
// add foreign key constraints to the new columns
|
||||
Object.entries(collectionRelationshipMap).forEach(([slug, relationships]) => {
|
||||
relationships.forEach(({ columnName, targetTableName }) => {
|
||||
const foreignKeySQL = sql`ALTER TABLE "${targetTableName}"
|
||||
ADD CONSTRAINT "${targetTableName}_${columnName}_fk" FOREIGN KEY ("${columnName}") REFERENCES "${slug}" ("id") ON DELETE cascade ON UPDATE no action;`
|
||||
// if this errors, they have bad data in the table
|
||||
payload.db.drizzle.execute(foreignKeySQL)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// module.exports.up = ``
|
||||
@@ -45,17 +45,12 @@ export async function createVersion<T extends TypeWithID>(
|
||||
|
||||
const table = this.tables[tableName]
|
||||
|
||||
const relationshipsTable = this.tables[`${tableName}${this.relationshipsSuffix}`]
|
||||
|
||||
if (collection.versions.drafts) {
|
||||
await db.execute(sql`
|
||||
UPDATE ${table}
|
||||
SET latest = false
|
||||
FROM ${relationshipsTable}
|
||||
WHERE ${table.id} = ${relationshipsTable.parent}
|
||||
AND ${relationshipsTable.path} = ${'parent'}
|
||||
AND ${relationshipsTable[`${collectionSlug}ID`]} = ${parent}
|
||||
AND ${table.id} != ${result.id};
|
||||
WHERE ${table.id} != ${result.id}
|
||||
AND ${table.parent} = ${parent}
|
||||
`)
|
||||
}
|
||||
|
||||
|
||||
1
packages/db-postgres/src/exports/migration-utils.ts
Normal file
1
packages/db-postgres/src/exports/migration-utils.ts
Normal file
@@ -0,0 +1 @@
|
||||
export { migratePostgresV2toV3 } from '../predefinedMigrations/v2-v3/index.js'
|
||||
@@ -12,7 +12,11 @@ type BuildFindQueryArgs = {
|
||||
tableName: string
|
||||
}
|
||||
|
||||
export type Result = DBQueryConfig<'many', true, any, any>
|
||||
export type Result = DBQueryConfig<'many', true, any, any> & {
|
||||
with?: DBQueryConfig<'many', true, any, any> & {
|
||||
_locales?: DBQueryConfig<'many', true, any, any>
|
||||
}
|
||||
}
|
||||
|
||||
// Generate the Drizzle query for findMany based on
|
||||
// a collection field structure
|
||||
@@ -31,6 +35,7 @@ export const buildFindManyArgs = ({
|
||||
id: false,
|
||||
_parentID: false,
|
||||
},
|
||||
with: {},
|
||||
}
|
||||
|
||||
if (adapter.tables[`${tableName}_texts`]) {
|
||||
|
||||
@@ -123,13 +123,6 @@ export const findMany = async function find({
|
||||
if (pagination !== false && (orderedIDs ? orderedIDs?.length <= limit : true)) {
|
||||
const selectCountMethods: ChainedMethods = []
|
||||
|
||||
joinAliases.forEach(({ condition, table }) => {
|
||||
selectCountMethods.push({
|
||||
args: [table, condition],
|
||||
method: 'leftJoin',
|
||||
})
|
||||
})
|
||||
|
||||
Object.entries(joins).forEach(([joinTable, condition]) => {
|
||||
if (joinTable) {
|
||||
selectCountMethods.push({
|
||||
@@ -139,6 +132,13 @@ export const findMany = async function find({
|
||||
}
|
||||
})
|
||||
|
||||
joinAliases.forEach(({ condition, table }) => {
|
||||
selectCountMethods.push({
|
||||
args: [table, condition],
|
||||
method: 'leftJoin',
|
||||
})
|
||||
})
|
||||
|
||||
const countResult = await chainMethods({
|
||||
methods: selectCountMethods,
|
||||
query: db
|
||||
|
||||
@@ -8,9 +8,9 @@ import type { PostgresAdapter } from '../types.js'
|
||||
import type { Result } from './buildFindManyArgs.js'
|
||||
|
||||
type TraverseFieldArgs = {
|
||||
_locales: Record<string, unknown>
|
||||
_locales: Result
|
||||
adapter: PostgresAdapter
|
||||
currentArgs: Record<string, unknown>
|
||||
currentArgs: Result
|
||||
currentTableName: string
|
||||
depth?: number
|
||||
fields: Field[]
|
||||
@@ -31,6 +31,18 @@ export const traverseFields = ({
|
||||
topLevelTableName,
|
||||
}: TraverseFieldArgs) => {
|
||||
fields.forEach((field) => {
|
||||
// handle simple relationship
|
||||
if (
|
||||
field.type === 'upload' ||
|
||||
(field.type === 'relationship' && !field.hasMany && typeof field.relationTo === 'string')
|
||||
) {
|
||||
if (field.localized) {
|
||||
_locales.with[`${path}${field.name}`] = true
|
||||
} else {
|
||||
currentArgs.with[`${path}${field.name}`] = true
|
||||
}
|
||||
}
|
||||
|
||||
if (field.type === 'collapsible' || field.type === 'row') {
|
||||
traverseFields({
|
||||
_locales,
|
||||
@@ -84,11 +96,19 @@ export const traverseFields = ({
|
||||
|
||||
const arrayTableNameWithLocales = `${arrayTableName}${adapter.localesSuffix}`
|
||||
|
||||
if (adapter.tables[arrayTableNameWithLocales]) withArray.with._locales = _locales
|
||||
if (adapter.tables[arrayTableNameWithLocales]) {
|
||||
withArray.with._locales = {
|
||||
columns: {
|
||||
id: false,
|
||||
_parentID: false,
|
||||
},
|
||||
with: {},
|
||||
}
|
||||
}
|
||||
currentArgs.with[`${path}${field.name}`] = withArray
|
||||
|
||||
traverseFields({
|
||||
_locales,
|
||||
_locales: withArray.with._locales,
|
||||
adapter,
|
||||
currentArgs: withArray,
|
||||
currentTableName: arrayTableName,
|
||||
@@ -137,12 +157,14 @@ export const traverseFields = ({
|
||||
)
|
||||
|
||||
if (adapter.tables[`${tableName}${adapter.localesSuffix}`]) {
|
||||
withBlock.with._locales = _locales
|
||||
withBlock.with._locales = {
|
||||
with: {},
|
||||
}
|
||||
}
|
||||
topLevelArgs.with[blockKey] = withBlock
|
||||
|
||||
traverseFields({
|
||||
_locales,
|
||||
_locales: withBlock.with._locales,
|
||||
adapter,
|
||||
currentArgs: withBlock,
|
||||
currentTableName: tableName,
|
||||
|
||||
@@ -4,6 +4,7 @@ import type { SanitizedCollectionConfig } from 'payload/types'
|
||||
|
||||
import { pgEnum, pgSchema, pgTable } from 'drizzle-orm/pg-core'
|
||||
import { buildVersionCollectionFields, buildVersionGlobalFields } from 'payload/versions'
|
||||
import toSnakeCase from 'to-snake-case'
|
||||
|
||||
import type { PostgresAdapter } from './types.js'
|
||||
|
||||
@@ -25,16 +26,25 @@ export const init: Init = function init(this: PostgresAdapter) {
|
||||
}
|
||||
|
||||
this.payload.config.collections.forEach((collection: SanitizedCollectionConfig) => {
|
||||
const tableName = createTableName({
|
||||
createTableName({
|
||||
adapter: this,
|
||||
config: collection,
|
||||
})
|
||||
|
||||
if (collection.versions) {
|
||||
createTableName({
|
||||
adapter: this,
|
||||
config: collection,
|
||||
versions: true,
|
||||
versionsCustomName: true,
|
||||
})
|
||||
}
|
||||
})
|
||||
this.payload.config.collections.forEach((collection: SanitizedCollectionConfig) => {
|
||||
const tableName = this.tableNameMap.get(toSnakeCase(collection.slug))
|
||||
|
||||
buildTable({
|
||||
adapter: this,
|
||||
buildNumbers: true,
|
||||
buildRelationships: true,
|
||||
buildTexts: true,
|
||||
disableNotNull: !!collection?.versions?.drafts,
|
||||
disableUnique: false,
|
||||
fields: collection.fields,
|
||||
@@ -44,19 +54,13 @@ export const init: Init = function init(this: PostgresAdapter) {
|
||||
})
|
||||
|
||||
if (collection.versions) {
|
||||
const versionsTableName = createTableName({
|
||||
adapter: this,
|
||||
config: collection,
|
||||
versions: true,
|
||||
versionsCustomName: true,
|
||||
})
|
||||
const versionsTableName = this.tableNameMap.get(
|
||||
`_${toSnakeCase(collection.slug)}${this.versionsSuffix}`,
|
||||
)
|
||||
const versionFields = buildVersionCollectionFields(collection)
|
||||
|
||||
buildTable({
|
||||
adapter: this,
|
||||
buildNumbers: true,
|
||||
buildRelationships: true,
|
||||
buildTexts: true,
|
||||
disableNotNull: !!collection.versions?.drafts,
|
||||
disableUnique: true,
|
||||
fields: versionFields,
|
||||
@@ -72,9 +76,6 @@ export const init: Init = function init(this: PostgresAdapter) {
|
||||
|
||||
buildTable({
|
||||
adapter: this,
|
||||
buildNumbers: true,
|
||||
buildRelationships: true,
|
||||
buildTexts: true,
|
||||
disableNotNull: !!global?.versions?.drafts,
|
||||
disableUnique: false,
|
||||
fields: global.fields,
|
||||
@@ -94,9 +95,6 @@ export const init: Init = function init(this: PostgresAdapter) {
|
||||
|
||||
buildTable({
|
||||
adapter: this,
|
||||
buildNumbers: true,
|
||||
buildRelationships: true,
|
||||
buildTexts: true,
|
||||
disableNotNull: !!global.versions?.drafts,
|
||||
disableUnique: true,
|
||||
fields: versionFields,
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
import type { Payload } from 'payload/types'
|
||||
|
||||
import { sql } from 'drizzle-orm'
|
||||
|
||||
import type { DrizzleTransaction } from '../../types.js'
|
||||
import type { ColumnToCreate } from './types.js'
|
||||
|
||||
type Args = {
|
||||
columnsToCreate: ColumnToCreate[]
|
||||
db: DrizzleTransaction
|
||||
debug: boolean
|
||||
dryRun: boolean
|
||||
payload: Payload
|
||||
}
|
||||
|
||||
export const createColumns = async ({ columnsToCreate, db, debug, dryRun, payload }: Args) => {
|
||||
let createColumnsStatement = columnsToCreate.reduce(
|
||||
(statement, { columnName, columnType, tableName }) => {
|
||||
return (statement += `
|
||||
IF NOT EXISTS (SELECT 1 FROM information_schema.columns WHERE table_name='${tableName}' AND column_name='${columnName}') THEN
|
||||
ALTER TABLE "${tableName}" ADD COLUMN "${columnName}" ${columnType};
|
||||
END IF;
|
||||
`)
|
||||
},
|
||||
'',
|
||||
)
|
||||
|
||||
createColumnsStatement = `DO $$
|
||||
BEGIN
|
||||
${createColumnsStatement}
|
||||
END $$;
|
||||
`
|
||||
|
||||
if (debug) {
|
||||
payload.logger.info('CREATING NEW RELATIONSHIP COLUMNS')
|
||||
payload.logger.info(createColumnsStatement)
|
||||
payload.logger.info('SUCCESSFULLY CREATED NEW RELATIONSHIP COLUMNS')
|
||||
}
|
||||
|
||||
if (!dryRun) {
|
||||
await db.execute(sql.raw(`${createColumnsStatement}`))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,250 @@
|
||||
import type { Payload } from 'payload'
|
||||
import type { Field, PayloadRequestWithData } from 'payload/types'
|
||||
|
||||
import type { DrizzleTransaction, PostgresAdapter } from '../../../types.js'
|
||||
import type { DocsToResave } from '../types.js'
|
||||
|
||||
import { upsertRow } from '../../../upsertRow/index.js'
|
||||
import { traverseFields } from './traverseFields.js'
|
||||
|
||||
type Args = {
|
||||
adapter: PostgresAdapter
|
||||
collectionSlug?: string
|
||||
db: DrizzleTransaction
|
||||
debug: boolean
|
||||
docsToResave: DocsToResave
|
||||
dryRun: boolean
|
||||
fields: Field[]
|
||||
globalSlug?: string
|
||||
isVersions: boolean
|
||||
payload: Payload
|
||||
req: PayloadRequestWithData
|
||||
tableName: string
|
||||
}
|
||||
|
||||
export const fetchAndResave = async ({
|
||||
adapter,
|
||||
collectionSlug,
|
||||
db,
|
||||
debug,
|
||||
docsToResave,
|
||||
dryRun,
|
||||
fields,
|
||||
globalSlug,
|
||||
isVersions,
|
||||
payload,
|
||||
req,
|
||||
tableName,
|
||||
}: Args) => {
|
||||
for (const [id, rows] of Object.entries(docsToResave)) {
|
||||
if (collectionSlug) {
|
||||
const collectionConfig = payload.collections[collectionSlug].config
|
||||
|
||||
if (collectionConfig) {
|
||||
if (isVersions) {
|
||||
const { docs } = await payload.findVersions({
|
||||
collection: collectionSlug,
|
||||
depth: 0,
|
||||
fallbackLocale: null,
|
||||
limit: 0,
|
||||
locale: 'all',
|
||||
showHiddenFields: true,
|
||||
where: {
|
||||
parent: {
|
||||
equals: id,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
if (debug) {
|
||||
payload.logger.info(
|
||||
`${docs.length} collection "${collectionConfig.slug}" versions will be migrated`,
|
||||
)
|
||||
}
|
||||
|
||||
for (const doc of docs) {
|
||||
traverseFields({
|
||||
doc,
|
||||
fields,
|
||||
path: '',
|
||||
rows,
|
||||
})
|
||||
|
||||
if (!dryRun) {
|
||||
try {
|
||||
await upsertRow({
|
||||
id: doc.id,
|
||||
adapter,
|
||||
data: doc,
|
||||
db,
|
||||
fields,
|
||||
ignoreResult: true,
|
||||
operation: 'update',
|
||||
req,
|
||||
tableName,
|
||||
})
|
||||
} catch (err) {
|
||||
payload.logger.error(
|
||||
`"${collectionConfig.slug}" version with ID ${doc.id} FAILED TO MIGRATE`,
|
||||
)
|
||||
|
||||
throw err
|
||||
}
|
||||
}
|
||||
|
||||
if (debug) {
|
||||
payload.logger.info(
|
||||
`"${collectionConfig.slug}" version with ID ${doc.id} migrated successfully!`,
|
||||
)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
const doc = await payload.findByID({
|
||||
id,
|
||||
collection: collectionSlug,
|
||||
depth: 0,
|
||||
fallbackLocale: null,
|
||||
locale: 'all',
|
||||
showHiddenFields: true,
|
||||
})
|
||||
|
||||
if (debug) {
|
||||
payload.logger.info(
|
||||
`The collection "${collectionConfig.slug}" with ID ${doc.id} will be migrated`,
|
||||
)
|
||||
}
|
||||
|
||||
traverseFields({
|
||||
doc,
|
||||
fields,
|
||||
path: '',
|
||||
rows,
|
||||
})
|
||||
|
||||
if (!dryRun) {
|
||||
try {
|
||||
await upsertRow({
|
||||
id: doc.id,
|
||||
adapter,
|
||||
data: doc,
|
||||
db,
|
||||
fields,
|
||||
ignoreResult: true,
|
||||
operation: 'update',
|
||||
req,
|
||||
tableName,
|
||||
})
|
||||
} catch (err) {
|
||||
payload.logger.error(
|
||||
`The collection "${collectionConfig.slug}" with ID ${doc.id} has FAILED TO MIGRATE`,
|
||||
)
|
||||
|
||||
throw err
|
||||
}
|
||||
}
|
||||
|
||||
if (debug) {
|
||||
payload.logger.info(
|
||||
`The collection "${collectionConfig.slug}" with ID ${doc.id} has migrated successfully!`,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (globalSlug) {
|
||||
const globalConfig = payload.config.globals?.find((global) => global.slug === globalSlug)
|
||||
|
||||
if (globalConfig) {
|
||||
if (isVersions) {
|
||||
const { docs } = await payload.findGlobalVersions({
|
||||
slug: globalSlug,
|
||||
depth: 0,
|
||||
fallbackLocale: null,
|
||||
limit: 0,
|
||||
locale: 'all',
|
||||
showHiddenFields: true,
|
||||
})
|
||||
|
||||
if (debug) {
|
||||
payload.logger.info(`${docs.length} global "${globalSlug}" versions will be migrated`)
|
||||
}
|
||||
|
||||
for (const doc of docs) {
|
||||
traverseFields({
|
||||
doc,
|
||||
fields,
|
||||
path: '',
|
||||
rows,
|
||||
})
|
||||
|
||||
if (!dryRun) {
|
||||
try {
|
||||
await upsertRow({
|
||||
id: doc.id,
|
||||
adapter,
|
||||
data: doc,
|
||||
db,
|
||||
fields,
|
||||
ignoreResult: true,
|
||||
operation: 'update',
|
||||
req,
|
||||
tableName,
|
||||
})
|
||||
} catch (err) {
|
||||
payload.logger.error(`"${globalSlug}" version with ID ${doc.id} FAILED TO MIGRATE`)
|
||||
|
||||
throw err
|
||||
}
|
||||
}
|
||||
|
||||
if (debug) {
|
||||
payload.logger.info(
|
||||
`"${globalSlug}" version with ID ${doc.id} migrated successfully!`,
|
||||
)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
const doc = await payload.findGlobal({
|
||||
slug: globalSlug,
|
||||
depth: 0,
|
||||
fallbackLocale: null,
|
||||
locale: 'all',
|
||||
showHiddenFields: true,
|
||||
})
|
||||
|
||||
traverseFields({
|
||||
doc,
|
||||
fields,
|
||||
path: '',
|
||||
rows,
|
||||
})
|
||||
|
||||
if (!dryRun) {
|
||||
try {
|
||||
await upsertRow({
|
||||
id: doc.id,
|
||||
adapter,
|
||||
data: doc,
|
||||
db,
|
||||
fields,
|
||||
ignoreResult: true,
|
||||
operation: 'update',
|
||||
req,
|
||||
tableName,
|
||||
})
|
||||
} catch (err) {
|
||||
payload.logger.error(`The global "${globalSlug}" has FAILED TO MIGRATE`)
|
||||
|
||||
throw err
|
||||
}
|
||||
}
|
||||
|
||||
if (debug) {
|
||||
payload.logger.info(`The global "${globalSlug}" has migrated successfully!`)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,215 @@
|
||||
import type { Field } from 'payload/types'
|
||||
|
||||
import { tabHasName } from 'payload/types'
|
||||
|
||||
type Args = {
|
||||
doc: Record<string, unknown>
|
||||
fields: Field[]
|
||||
locale?: string
|
||||
path: string
|
||||
rows: Record<string, unknown>[]
|
||||
}
|
||||
|
||||
export const traverseFields = ({ doc, fields, locale, path, rows }: Args) => {
|
||||
fields.forEach((field) => {
|
||||
switch (field.type) {
|
||||
case 'group': {
|
||||
const newPath = `${path ? `${path}.` : ''}${field.name}`
|
||||
const newDoc = doc?.[field.name]
|
||||
|
||||
if (typeof newDoc === 'object' && newDoc !== null) {
|
||||
if (field.localized) {
|
||||
Object.entries(newDoc).forEach(([locale, localeDoc]) => {
|
||||
return traverseFields({
|
||||
doc: localeDoc,
|
||||
fields: field.fields,
|
||||
locale,
|
||||
path: newPath,
|
||||
rows,
|
||||
})
|
||||
})
|
||||
} else {
|
||||
return traverseFields({
|
||||
doc: newDoc as Record<string, unknown>,
|
||||
fields: field.fields,
|
||||
path: newPath,
|
||||
rows,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
break
|
||||
}
|
||||
|
||||
case 'row':
|
||||
case 'collapsible': {
|
||||
return traverseFields({
|
||||
doc,
|
||||
fields: field.fields,
|
||||
path,
|
||||
rows,
|
||||
})
|
||||
}
|
||||
|
||||
case 'array': {
|
||||
const rowData = doc?.[field.name]
|
||||
|
||||
if (field.localized && typeof rowData === 'object' && rowData !== null) {
|
||||
Object.entries(rowData).forEach(([locale, localeRows]) => {
|
||||
if (Array.isArray(localeRows)) {
|
||||
localeRows.forEach((row, i) => {
|
||||
return traverseFields({
|
||||
doc: row as Record<string, unknown>,
|
||||
fields: field.fields,
|
||||
locale,
|
||||
path: `${path ? `${path}.` : ''}${field.name}.${i}`,
|
||||
rows,
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
if (Array.isArray(rowData)) {
|
||||
rowData.forEach((row, i) => {
|
||||
return traverseFields({
|
||||
doc: row as Record<string, unknown>,
|
||||
fields: field.fields,
|
||||
path: `${path ? `${path}.` : ''}${field.name}.${i}`,
|
||||
rows,
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
break
|
||||
}
|
||||
|
||||
case 'blocks': {
|
||||
const rowData = doc?.[field.name]
|
||||
|
||||
if (field.localized && typeof rowData === 'object' && rowData !== null) {
|
||||
Object.entries(rowData).forEach(([locale, localeRows]) => {
|
||||
if (Array.isArray(localeRows)) {
|
||||
localeRows.forEach((row, i) => {
|
||||
const matchedBlock = field.blocks.find((block) => block.slug === row.blockType)
|
||||
|
||||
if (matchedBlock) {
|
||||
return traverseFields({
|
||||
doc: row as Record<string, unknown>,
|
||||
fields: matchedBlock.fields,
|
||||
locale,
|
||||
path: `${path ? `${path}.` : ''}${field.name}.${i}`,
|
||||
rows,
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
if (Array.isArray(rowData)) {
|
||||
rowData.forEach((row, i) => {
|
||||
const matchedBlock = field.blocks.find((block) => block.slug === row.blockType)
|
||||
|
||||
if (matchedBlock) {
|
||||
return traverseFields({
|
||||
doc: row as Record<string, unknown>,
|
||||
fields: matchedBlock.fields,
|
||||
path: `${path ? `${path}.` : ''}${field.name}.${i}`,
|
||||
rows,
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
break
|
||||
}
|
||||
|
||||
case 'tabs': {
|
||||
return field.tabs.forEach((tab) => {
|
||||
if (tabHasName(tab)) {
|
||||
const newDoc = doc?.[tab.name]
|
||||
const newPath = `${path ? `${path}.` : ''}${tab.name}`
|
||||
|
||||
if (typeof newDoc === 'object' && newDoc !== null) {
|
||||
if (tab.localized) {
|
||||
Object.entries(newDoc).forEach(([locale, localeDoc]) => {
|
||||
return traverseFields({
|
||||
doc: localeDoc,
|
||||
fields: tab.fields,
|
||||
locale,
|
||||
path: newPath,
|
||||
rows,
|
||||
})
|
||||
})
|
||||
} else {
|
||||
return traverseFields({
|
||||
doc: newDoc as Record<string, unknown>,
|
||||
fields: tab.fields,
|
||||
path: newPath,
|
||||
rows,
|
||||
})
|
||||
}
|
||||
}
|
||||
} else {
|
||||
traverseFields({
|
||||
doc,
|
||||
fields: tab.fields,
|
||||
path,
|
||||
rows,
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
case 'relationship':
|
||||
case 'upload': {
|
||||
if (typeof field.relationTo === 'string') {
|
||||
if (field.type === 'upload' || !field.hasMany) {
|
||||
const relationshipPath = `${path ? `${path}.` : ''}${field.name}`
|
||||
|
||||
if (field.localized) {
|
||||
const matchedRelationshipsWithLocales = rows.filter(
|
||||
(row) => row.path === relationshipPath,
|
||||
)
|
||||
|
||||
if (matchedRelationshipsWithLocales.length && !doc[field.name]) {
|
||||
doc[field.name] = {}
|
||||
}
|
||||
|
||||
const newDoc = doc[field.name] as Record<string, unknown>
|
||||
|
||||
matchedRelationshipsWithLocales.forEach((localeRow) => {
|
||||
if (typeof localeRow.locale === 'string') {
|
||||
const [, id] = Object.entries(localeRow).find(
|
||||
([key, val]) =>
|
||||
val !== null && !['id', 'locale', 'order', 'parent_id', 'path'].includes(key),
|
||||
)
|
||||
|
||||
newDoc[localeRow.locale] = id
|
||||
}
|
||||
})
|
||||
} else {
|
||||
const matchedRelationship = rows.find((row) => {
|
||||
const matchesPath = row.path === relationshipPath
|
||||
|
||||
if (locale) return matchesPath && locale === row.locale
|
||||
|
||||
return row.path === relationshipPath
|
||||
})
|
||||
|
||||
if (matchedRelationship) {
|
||||
const [, id] = Object.entries(matchedRelationship).find(
|
||||
([key, val]) =>
|
||||
val !== null && !['id', 'locale', 'order', 'parent_id', 'path'].includes(key),
|
||||
)
|
||||
|
||||
doc[field.name] = id
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
223
packages/db-postgres/src/predefinedMigrations/v2-v3/index.ts
Normal file
223
packages/db-postgres/src/predefinedMigrations/v2-v3/index.ts
Normal file
@@ -0,0 +1,223 @@
|
||||
import type { Payload } from 'payload'
|
||||
import type { PayloadRequestWithData } from 'payload/types'
|
||||
|
||||
import { buildVersionCollectionFields, buildVersionGlobalFields } from 'payload/versions'
|
||||
import toSnakeCase from 'to-snake-case'
|
||||
|
||||
import type { PostgresAdapter } from '../../types.js'
|
||||
import type { ColumnToCreate, PathsToQuery } from './types.js'
|
||||
|
||||
import { createColumns } from './createColumns.js'
|
||||
import { migrateRelationships } from './migrateRelationships.js'
|
||||
import { traverseFields } from './traverseFields.js'
|
||||
|
||||
type Args = {
|
||||
debug?: boolean
|
||||
dryRun?: boolean
|
||||
payload: Payload
|
||||
req: PayloadRequestWithData
|
||||
}
|
||||
|
||||
export const migratePostgresV2toV3 = async ({ debug, dryRun, payload, req }: Args) => {
|
||||
const adapter = payload.db as PostgresAdapter
|
||||
const db = adapter.sessions[req.transactionID]?.db
|
||||
|
||||
for (const collection of payload.config.collections) {
|
||||
const tableName = adapter.tableNameMap.get(toSnakeCase(collection.slug))
|
||||
|
||||
const columnsToCreate: ColumnToCreate[] = []
|
||||
const pathsToQuery: PathsToQuery = new Set()
|
||||
|
||||
traverseFields({
|
||||
adapter,
|
||||
collectionSlug: collection.slug,
|
||||
columnPrefix: '',
|
||||
columnsToCreate,
|
||||
db,
|
||||
disableNotNull: false,
|
||||
fields: collection.fields,
|
||||
isVersions: false,
|
||||
newTableName: tableName,
|
||||
parentTableName: tableName,
|
||||
path: '',
|
||||
pathsToQuery,
|
||||
payload,
|
||||
rootTableName: tableName,
|
||||
})
|
||||
|
||||
if (columnsToCreate) {
|
||||
await createColumns({
|
||||
columnsToCreate,
|
||||
db,
|
||||
debug,
|
||||
dryRun,
|
||||
payload,
|
||||
})
|
||||
|
||||
await migrateRelationships({
|
||||
adapter,
|
||||
collectionSlug: collection.slug,
|
||||
db,
|
||||
debug,
|
||||
dryRun,
|
||||
fields: collection.fields,
|
||||
isVersions: false,
|
||||
pathsToQuery,
|
||||
payload,
|
||||
req,
|
||||
tableName,
|
||||
})
|
||||
}
|
||||
|
||||
if (collection.versions) {
|
||||
const versionsTableName = adapter.tableNameMap.get(
|
||||
`_${toSnakeCase(collection.slug)}${adapter.versionsSuffix}`,
|
||||
)
|
||||
const versionFields = buildVersionCollectionFields(collection)
|
||||
|
||||
const versionColumnsToCreate: ColumnToCreate[] = []
|
||||
const versionPathsToQuery: PathsToQuery = new Set()
|
||||
|
||||
traverseFields({
|
||||
adapter,
|
||||
collectionSlug: collection.slug,
|
||||
columnPrefix: '',
|
||||
columnsToCreate: versionColumnsToCreate,
|
||||
db,
|
||||
disableNotNull: true,
|
||||
fields: versionFields,
|
||||
isVersions: true,
|
||||
newTableName: versionsTableName,
|
||||
parentTableName: versionsTableName,
|
||||
path: '',
|
||||
pathsToQuery: versionPathsToQuery,
|
||||
payload,
|
||||
rootTableName: versionsTableName,
|
||||
})
|
||||
|
||||
if (versionColumnsToCreate.length) {
|
||||
await createColumns({
|
||||
columnsToCreate: versionColumnsToCreate,
|
||||
db,
|
||||
debug,
|
||||
dryRun,
|
||||
payload,
|
||||
})
|
||||
|
||||
await migrateRelationships({
|
||||
adapter,
|
||||
collectionSlug: collection.slug,
|
||||
db,
|
||||
debug,
|
||||
dryRun,
|
||||
fields: versionFields,
|
||||
isVersions: true,
|
||||
pathsToQuery: versionPathsToQuery,
|
||||
payload,
|
||||
req,
|
||||
tableName: versionsTableName,
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (const global of payload.config.globals) {
|
||||
const tableName = adapter.tableNameMap.get(toSnakeCase(global.slug))
|
||||
|
||||
const columnsToCreate: ColumnToCreate[] = []
|
||||
const pathsToQuery: PathsToQuery = new Set()
|
||||
|
||||
traverseFields({
|
||||
adapter,
|
||||
columnPrefix: '',
|
||||
columnsToCreate,
|
||||
db,
|
||||
disableNotNull: false,
|
||||
fields: global.fields,
|
||||
globalSlug: global.slug,
|
||||
isVersions: false,
|
||||
newTableName: tableName,
|
||||
parentTableName: tableName,
|
||||
path: '',
|
||||
pathsToQuery,
|
||||
payload,
|
||||
rootTableName: tableName,
|
||||
})
|
||||
|
||||
if (columnsToCreate.length) {
|
||||
await createColumns({
|
||||
columnsToCreate,
|
||||
db,
|
||||
debug,
|
||||
dryRun,
|
||||
payload,
|
||||
})
|
||||
|
||||
await migrateRelationships({
|
||||
adapter,
|
||||
db,
|
||||
debug,
|
||||
dryRun,
|
||||
fields: global.fields,
|
||||
globalSlug: global.slug,
|
||||
isVersions: false,
|
||||
pathsToQuery,
|
||||
payload,
|
||||
req,
|
||||
tableName,
|
||||
})
|
||||
}
|
||||
|
||||
if (global.versions) {
|
||||
const versionsTableName = adapter.tableNameMap.get(
|
||||
`_${toSnakeCase(global.slug)}${adapter.versionsSuffix}`,
|
||||
)
|
||||
|
||||
const versionFields = buildVersionGlobalFields(global)
|
||||
|
||||
const versionColumnsToCreate: ColumnToCreate[] = []
|
||||
const versionPathsToQuery: PathsToQuery = new Set()
|
||||
|
||||
traverseFields({
|
||||
adapter,
|
||||
columnPrefix: '',
|
||||
columnsToCreate: versionColumnsToCreate,
|
||||
db,
|
||||
disableNotNull: true,
|
||||
fields: versionFields,
|
||||
globalSlug: global.slug,
|
||||
isVersions: true,
|
||||
newTableName: versionsTableName,
|
||||
parentTableName: versionsTableName,
|
||||
path: '',
|
||||
pathsToQuery: versionPathsToQuery,
|
||||
payload,
|
||||
rootTableName: versionsTableName,
|
||||
})
|
||||
|
||||
if (versionColumnsToCreate.length) {
|
||||
await createColumns({
|
||||
columnsToCreate: versionColumnsToCreate,
|
||||
db,
|
||||
debug,
|
||||
dryRun,
|
||||
payload,
|
||||
})
|
||||
|
||||
await migrateRelationships({
|
||||
adapter,
|
||||
db,
|
||||
debug,
|
||||
dryRun,
|
||||
fields: versionFields,
|
||||
globalSlug: global.slug,
|
||||
isVersions: true,
|
||||
pathsToQuery: versionPathsToQuery,
|
||||
payload,
|
||||
req,
|
||||
tableName: versionsTableName,
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
import type { Field, Payload, PayloadRequestWithData } from 'payload/types'
|
||||
|
||||
import { sql } from 'drizzle-orm'
|
||||
|
||||
import type { DrizzleTransaction, PostgresAdapter } from '../../types.js'
|
||||
import type { DocsToResave, PathsToQuery } from './types.js'
|
||||
|
||||
import { fetchAndResave } from './fetchAndResave/index.js'
|
||||
|
||||
type Args = {
|
||||
adapter: PostgresAdapter
|
||||
collectionSlug?: string
|
||||
db: DrizzleTransaction
|
||||
debug: boolean
|
||||
dryRun: boolean
|
||||
fields: Field[]
|
||||
globalSlug?: string
|
||||
isVersions: boolean
|
||||
pathsToQuery: PathsToQuery
|
||||
payload: Payload
|
||||
req: PayloadRequestWithData
|
||||
tableName: string
|
||||
}
|
||||
|
||||
export const migrateRelationships = async ({
|
||||
adapter,
|
||||
collectionSlug,
|
||||
db,
|
||||
debug,
|
||||
dryRun,
|
||||
fields,
|
||||
globalSlug,
|
||||
isVersions,
|
||||
pathsToQuery,
|
||||
payload,
|
||||
req,
|
||||
tableName,
|
||||
}: Args) => {
|
||||
if (pathsToQuery.size === 0) return
|
||||
|
||||
const docsToResave: DocsToResave = {}
|
||||
|
||||
const where = Array.from(pathsToQuery).reduce((statement, path, i) => {
|
||||
return (statement += `
|
||||
"${tableName}${adapter.relationshipsSuffix}"."path" LIKE '${path}'${pathsToQuery.size !== i + 1 ? ' OR' : ''}
|
||||
`)
|
||||
}, '')
|
||||
|
||||
const statement = `SELECT * FROM ${tableName}${adapter.relationshipsSuffix} WHERE
|
||||
${where}
|
||||
`
|
||||
if (debug) {
|
||||
payload.logger.info('FINDING ROWS TO MIGRATE')
|
||||
payload.logger.info(statement)
|
||||
}
|
||||
|
||||
const result = await adapter.drizzle.execute(sql.raw(`${statement}`))
|
||||
|
||||
result.rows.forEach((row) => {
|
||||
const parentID = row.parent_id
|
||||
|
||||
if (typeof parentID === 'string' || typeof parentID === 'number') {
|
||||
if (!docsToResave[parentID]) docsToResave[parentID] = []
|
||||
docsToResave[parentID].push(row)
|
||||
}
|
||||
})
|
||||
|
||||
await fetchAndResave({
|
||||
adapter,
|
||||
collectionSlug,
|
||||
db,
|
||||
debug,
|
||||
docsToResave,
|
||||
dryRun,
|
||||
fields,
|
||||
globalSlug,
|
||||
isVersions,
|
||||
payload,
|
||||
req,
|
||||
tableName,
|
||||
})
|
||||
|
||||
const deleteStatement = `DELETE FROM ${tableName}${adapter.relationshipsSuffix} WHERE ${where}`
|
||||
if (debug) {
|
||||
payload.logger.info('DELETING ROWS')
|
||||
payload.logger.info(deleteStatement)
|
||||
}
|
||||
if (!dryRun) await db.execute(sql.raw(`${deleteStatement}`))
|
||||
}
|
||||
@@ -0,0 +1,143 @@
|
||||
import type { Payload } from 'payload'
|
||||
|
||||
import { type Field, tabHasName } from 'payload/types'
|
||||
import toSnakeCase from 'to-snake-case'
|
||||
|
||||
import type { DrizzleTransaction, PostgresAdapter } from '../../types.js'
|
||||
import type { ColumnToCreate, PathsToQuery } from './types.js'
|
||||
|
||||
type Args = {
|
||||
adapter: PostgresAdapter
|
||||
collectionSlug?: string
|
||||
columnPrefix: string
|
||||
columnsToCreate: ColumnToCreate[]
|
||||
db: DrizzleTransaction
|
||||
disableNotNull: boolean
|
||||
fields: Field[]
|
||||
globalSlug?: string
|
||||
isVersions: boolean
|
||||
newTableName: string
|
||||
parentTableName: string
|
||||
path: string
|
||||
pathsToQuery: PathsToQuery
|
||||
payload: Payload
|
||||
rootTableName: string
|
||||
}
|
||||
|
||||
const idTypeMap = {
|
||||
number: 'numeric',
|
||||
serial: 'integer',
|
||||
text: 'varchar',
|
||||
uuid: 'uuid',
|
||||
} as const
|
||||
|
||||
export const traverseFields = (args: Args) => {
|
||||
args.fields.forEach((field) => {
|
||||
switch (field.type) {
|
||||
case 'group': {
|
||||
let newTableName = `${args.newTableName}_${toSnakeCase(field.name)}`
|
||||
|
||||
if (field.localized && args.payload.config.localization) {
|
||||
newTableName += args.adapter.localesSuffix
|
||||
}
|
||||
|
||||
return traverseFields({
|
||||
...args,
|
||||
columnPrefix: `${args.columnPrefix}${toSnakeCase(field.name)}_`,
|
||||
fields: field.fields,
|
||||
newTableName,
|
||||
path: `${args.path ? `${args.path}.` : ''}${field.name}`,
|
||||
})
|
||||
}
|
||||
|
||||
case 'row':
|
||||
case 'collapsible': {
|
||||
return traverseFields({
|
||||
...args,
|
||||
fields: field.fields,
|
||||
})
|
||||
}
|
||||
|
||||
case 'array': {
|
||||
const newTableName = args.adapter.tableNameMap.get(
|
||||
`${args.newTableName}_${toSnakeCase(field.name)}`,
|
||||
)
|
||||
|
||||
return traverseFields({
|
||||
...args,
|
||||
columnPrefix: '',
|
||||
fields: field.fields,
|
||||
newTableName,
|
||||
parentTableName: newTableName,
|
||||
path: `${args.path ? `${args.path}.` : ''}${field.name}.%`,
|
||||
})
|
||||
}
|
||||
|
||||
case 'blocks': {
|
||||
return field.blocks.forEach((block) => {
|
||||
const newTableName = args.adapter.tableNameMap.get(
|
||||
`${args.rootTableName}_blocks_${toSnakeCase(block.slug)}`,
|
||||
)
|
||||
|
||||
traverseFields({
|
||||
...args,
|
||||
columnPrefix: '',
|
||||
fields: block.fields,
|
||||
newTableName,
|
||||
parentTableName: newTableName,
|
||||
path: `${args.path ? `${args.path}.` : ''}${field.name}.%`,
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
case 'tabs': {
|
||||
return field.tabs.forEach((tab) => {
|
||||
if (tabHasName(tab)) {
|
||||
args.columnPrefix = `${args.columnPrefix}_${toSnakeCase(tab.name)}_`
|
||||
args.path = `${args.path ? `${args.path}.` : ''}${tab.name}`
|
||||
args.newTableName = `${args.newTableName}_${toSnakeCase(tab.name)}`
|
||||
|
||||
if (tab.localized && args.payload.config.localization) {
|
||||
args.newTableName += args.adapter.localesSuffix
|
||||
}
|
||||
}
|
||||
|
||||
traverseFields({
|
||||
...args,
|
||||
fields: tab.fields,
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
case 'relationship':
|
||||
case 'upload': {
|
||||
if (typeof field.relationTo === 'string') {
|
||||
if (field.type === 'upload' || !field.hasMany) {
|
||||
const condition = field.admin && field.admin.condition
|
||||
const notNull = !args.disableNotNull && field.required && !condition
|
||||
|
||||
let tableName = args.parentTableName
|
||||
|
||||
if (field.localized && args.payload.config.localization) {
|
||||
tableName += args.adapter.localesSuffix
|
||||
}
|
||||
|
||||
args.columnsToCreate.push({
|
||||
columnName: `${args.columnPrefix}${toSnakeCase(field.name)}_id`,
|
||||
columnType:
|
||||
idTypeMap[
|
||||
args.payload.collections[field.relationTo].customIDType || args.adapter.idType
|
||||
],
|
||||
notNull,
|
||||
tableName,
|
||||
})
|
||||
|
||||
args.pathsToQuery.add(`${args.path ? `${args.path}.` : ''}${field.name}`)
|
||||
}
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
16
packages/db-postgres/src/predefinedMigrations/v2-v3/types.ts
Normal file
16
packages/db-postgres/src/predefinedMigrations/v2-v3/types.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
export type ColumnToCreate = {
|
||||
columnName: string
|
||||
columnType?: 'integer' | 'numeric' | 'uuid' | 'varchar'
|
||||
notNull: boolean
|
||||
tableName: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Set of all paths which should be moved
|
||||
* This will be built up into one WHERE query
|
||||
*/
|
||||
export type PathsToQuery = Set<string>
|
||||
|
||||
export type DocsToResave = {
|
||||
[id: number | string]: Record<string, unknown>[]
|
||||
}
|
||||
@@ -434,116 +434,182 @@ export const getTableColumnFromPath = ({
|
||||
|
||||
case 'relationship':
|
||||
case 'upload': {
|
||||
let relationshipFields
|
||||
const relationTableName = `${rootTableName}${adapter.relationshipsSuffix}`
|
||||
const newCollectionPath = pathSegments.slice(1).join('.')
|
||||
const aliasRelationshipTableName = uuid()
|
||||
const aliasRelationshipTable = alias(
|
||||
adapter.tables[relationTableName],
|
||||
aliasRelationshipTableName,
|
||||
)
|
||||
if (Array.isArray(field.relationTo) || (field.type === 'relationship' && field.hasMany)) {
|
||||
let relationshipFields
|
||||
const relationTableName = `${rootTableName}${adapter.relationshipsSuffix}`
|
||||
const aliasRelationshipTableName = uuid()
|
||||
const aliasRelationshipTable = alias(
|
||||
adapter.tables[relationTableName],
|
||||
aliasRelationshipTableName,
|
||||
)
|
||||
|
||||
// Join in the relationships table
|
||||
if (locale && field.localized && adapter.payload.config.localization) {
|
||||
joinAliases.push({
|
||||
condition: and(
|
||||
eq((aliasTable || adapter.tables[rootTableName]).id, aliasRelationshipTable.parent),
|
||||
eq(aliasRelationshipTable.locale, locale),
|
||||
like(aliasRelationshipTable.path, `${constraintPath}${field.name}`),
|
||||
),
|
||||
table: aliasRelationshipTable,
|
||||
})
|
||||
if (locale !== 'all') {
|
||||
constraints.push({
|
||||
columnName: 'locale',
|
||||
// Join in the relationships table
|
||||
if (locale && field.localized && adapter.payload.config.localization) {
|
||||
joinAliases.push({
|
||||
condition: and(
|
||||
eq((aliasTable || adapter.tables[rootTableName]).id, aliasRelationshipTable.parent),
|
||||
eq(aliasRelationshipTable.locale, locale),
|
||||
like(aliasRelationshipTable.path, `${constraintPath}${field.name}`),
|
||||
),
|
||||
table: aliasRelationshipTable,
|
||||
})
|
||||
if (locale !== 'all') {
|
||||
constraints.push({
|
||||
columnName: 'locale',
|
||||
table: aliasRelationshipTable,
|
||||
value: locale,
|
||||
})
|
||||
}
|
||||
} else {
|
||||
// Join in the relationships table
|
||||
joinAliases.push({
|
||||
condition: and(
|
||||
eq((aliasTable || adapter.tables[rootTableName]).id, aliasRelationshipTable.parent),
|
||||
like(aliasRelationshipTable.path, `${constraintPath}${field.name}`),
|
||||
),
|
||||
table: aliasRelationshipTable,
|
||||
value: locale,
|
||||
})
|
||||
}
|
||||
} else {
|
||||
// Join in the relationships table
|
||||
joinAliases.push({
|
||||
condition: and(
|
||||
eq((aliasTable || adapter.tables[rootTableName]).id, aliasRelationshipTable.parent),
|
||||
like(aliasRelationshipTable.path, `${constraintPath}${field.name}`),
|
||||
),
|
||||
table: aliasRelationshipTable,
|
||||
})
|
||||
}
|
||||
|
||||
selectFields[`${relationTableName}.path`] = aliasRelationshipTable.path
|
||||
selectFields[`${relationTableName}.path`] = aliasRelationshipTable.path
|
||||
|
||||
let newAliasTable
|
||||
let newAliasTable
|
||||
|
||||
if (typeof field.relationTo === 'string') {
|
||||
const relationshipConfig = adapter.payload.collections[field.relationTo].config
|
||||
if (typeof field.relationTo === 'string') {
|
||||
const relationshipConfig = adapter.payload.collections[field.relationTo].config
|
||||
|
||||
newTableName = adapter.tableNameMap.get(toSnakeCase(relationshipConfig.slug))
|
||||
newTableName = adapter.tableNameMap.get(toSnakeCase(relationshipConfig.slug))
|
||||
|
||||
// parent to relationship join table
|
||||
relationshipFields = relationshipConfig.fields
|
||||
// parent to relationship join table
|
||||
relationshipFields = relationshipConfig.fields
|
||||
|
||||
newAliasTable = alias(adapter.tables[newTableName], toSnakeCase(uuid()))
|
||||
newAliasTable = alias(adapter.tables[newTableName], toSnakeCase(uuid()))
|
||||
|
||||
joinAliases.push({
|
||||
condition: eq(newAliasTable.id, aliasRelationshipTable[`${field.relationTo}ID`]),
|
||||
table: newAliasTable,
|
||||
})
|
||||
joinAliases.push({
|
||||
condition: eq(newAliasTable.id, aliasRelationshipTable[`${field.relationTo}ID`]),
|
||||
table: newAliasTable,
|
||||
})
|
||||
|
||||
if (newCollectionPath === '' || newCollectionPath === 'id') {
|
||||
if (newCollectionPath === '' || newCollectionPath === 'id') {
|
||||
return {
|
||||
columnName: `${field.relationTo}ID`,
|
||||
constraints,
|
||||
field,
|
||||
table: aliasRelationshipTable,
|
||||
}
|
||||
}
|
||||
} else if (newCollectionPath === 'value') {
|
||||
const tableColumnsNames = field.relationTo.map((relationTo) => {
|
||||
const relationTableName = adapter.tableNameMap.get(
|
||||
toSnakeCase(adapter.payload.collections[relationTo].config.slug),
|
||||
)
|
||||
|
||||
return `"${aliasRelationshipTableName}"."${relationTableName}_id"`
|
||||
})
|
||||
return {
|
||||
columnName: `${field.relationTo}ID`,
|
||||
constraints,
|
||||
field,
|
||||
rawColumn: sql.raw(`COALESCE(${tableColumnsNames.join(', ')})`),
|
||||
table: aliasRelationshipTable,
|
||||
}
|
||||
}
|
||||
} else if (newCollectionPath === 'value') {
|
||||
const tableColumnsNames = field.relationTo.map((relationTo) => {
|
||||
const relationTableName = adapter.tableNameMap.get(
|
||||
toSnakeCase(adapter.payload.collections[relationTo].config.slug),
|
||||
)
|
||||
} else if (newCollectionPath === 'relationTo') {
|
||||
const relationTo = Array.isArray(field.relationTo)
|
||||
? field.relationTo
|
||||
: [field.relationTo]
|
||||
|
||||
return `"${aliasRelationshipTableName}"."${relationTableName}_id"`
|
||||
return {
|
||||
constraints,
|
||||
field,
|
||||
getNotNullColumnByValue: (val) => {
|
||||
const matchedRelation = relationTo.find((relation) => relation === val)
|
||||
if (matchedRelation) return `${matchedRelation}ID`
|
||||
return undefined
|
||||
},
|
||||
table: aliasRelationshipTable,
|
||||
}
|
||||
} else {
|
||||
throw new APIError('Not supported')
|
||||
}
|
||||
|
||||
return getTableColumnFromPath({
|
||||
adapter,
|
||||
aliasTable: newAliasTable,
|
||||
collectionPath: newCollectionPath,
|
||||
constraints,
|
||||
fields: relationshipFields,
|
||||
joinAliases,
|
||||
joins,
|
||||
locale,
|
||||
pathSegments: pathSegments.slice(1),
|
||||
rootTableName: newTableName,
|
||||
selectFields,
|
||||
tableName: newTableName,
|
||||
value,
|
||||
})
|
||||
return {
|
||||
constraints,
|
||||
field,
|
||||
rawColumn: sql.raw(`COALESCE(${tableColumnsNames.join(', ')})`),
|
||||
table: aliasRelationshipTable,
|
||||
}
|
||||
} else if (newCollectionPath === 'relationTo') {
|
||||
const relationTo = Array.isArray(field.relationTo) ? field.relationTo : [field.relationTo]
|
||||
} else if (pathSegments.length > 1) {
|
||||
// simple relationships
|
||||
const columnName = `${columnPrefix}${field.name}`
|
||||
const newTableName = adapter.tableNameMap.get(
|
||||
toSnakeCase(adapter.payload.collections[field.relationTo].config.slug),
|
||||
)
|
||||
const aliasTableName = uuid()
|
||||
const newAliasTable = alias(adapter.tables[newTableName], aliasTableName)
|
||||
|
||||
return {
|
||||
constraints,
|
||||
field,
|
||||
getNotNullColumnByValue: (val) => {
|
||||
const matchedRelation = relationTo.find((relation) => relation === val)
|
||||
if (matchedRelation) return `${matchedRelation}ID`
|
||||
return undefined
|
||||
},
|
||||
table: aliasRelationshipTable,
|
||||
if (field.localized && adapter.payload.config.localization) {
|
||||
const aliasLocaleTableName = uuid()
|
||||
const aliasLocaleTable = alias(
|
||||
adapter.tables[`${rootTableName}${adapter.localesSuffix}`],
|
||||
aliasLocaleTableName,
|
||||
)
|
||||
joinAliases.push({
|
||||
condition: and(
|
||||
eq(aliasLocaleTable._parentID, adapter.tables[rootTableName].id),
|
||||
eq(aliasLocaleTable._locale, locale),
|
||||
),
|
||||
table: aliasLocaleTable,
|
||||
})
|
||||
joinAliases.push({
|
||||
condition: eq(aliasLocaleTable[columnName], newAliasTable.id),
|
||||
table: newAliasTable,
|
||||
})
|
||||
} else {
|
||||
joinAliases.push({
|
||||
condition: and(eq(newAliasTable.id, adapter.tables[tableName][columnName])),
|
||||
table: newAliasTable,
|
||||
})
|
||||
}
|
||||
|
||||
return getTableColumnFromPath({
|
||||
adapter,
|
||||
aliasTable: newAliasTable,
|
||||
collectionPath: newCollectionPath,
|
||||
constraintPath: '',
|
||||
constraints,
|
||||
fields: adapter.payload.collections[field.relationTo].config.fields,
|
||||
joinAliases,
|
||||
joins,
|
||||
locale,
|
||||
pathSegments: pathSegments.slice(1),
|
||||
selectFields,
|
||||
tableName: newTableName,
|
||||
value,
|
||||
})
|
||||
} else {
|
||||
throw new APIError('Not supported')
|
||||
// simple relationship on id
|
||||
return {
|
||||
columnName: `${columnPrefix}${field.name}`,
|
||||
constraints,
|
||||
field,
|
||||
table: adapter.tables[tableName],
|
||||
}
|
||||
}
|
||||
break
|
||||
}
|
||||
|
||||
return getTableColumnFromPath({
|
||||
adapter,
|
||||
aliasTable: newAliasTable,
|
||||
collectionPath: newCollectionPath,
|
||||
constraints,
|
||||
fields: relationshipFields,
|
||||
joinAliases,
|
||||
joins,
|
||||
locale,
|
||||
pathSegments: pathSegments.slice(1),
|
||||
rootTableName: newTableName,
|
||||
selectFields,
|
||||
tableName: newTableName,
|
||||
value,
|
||||
})
|
||||
default: {
|
||||
// fall through
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,13 +36,6 @@ export const selectDistinct = ({
|
||||
chainedMethods.push({ args: [where], method: 'where' })
|
||||
}
|
||||
|
||||
joinAliases.forEach(({ condition, table }) => {
|
||||
chainedMethods.push({
|
||||
args: [table, condition],
|
||||
method: 'leftJoin',
|
||||
})
|
||||
})
|
||||
|
||||
Object.entries(joins).forEach(([joinTable, condition]) => {
|
||||
if (joinTable) {
|
||||
chainedMethods.push({
|
||||
@@ -52,6 +45,13 @@ export const selectDistinct = ({
|
||||
}
|
||||
})
|
||||
|
||||
joinAliases.forEach(({ condition, table }) => {
|
||||
chainedMethods.push({
|
||||
args: [table, condition],
|
||||
method: 'leftJoin',
|
||||
})
|
||||
})
|
||||
|
||||
return chainMethods({
|
||||
methods: chainedMethods,
|
||||
query: db.selectDistinct(selectFields).from(adapter.tables[tableName]),
|
||||
|
||||
@@ -34,17 +34,18 @@ export type BaseExtraConfig = Record<
|
||||
(cols: GenericColumns) => ForeignKeyBuilder | IndexBuilder | UniqueConstraintBuilder
|
||||
>
|
||||
|
||||
export type RelationMap = Map<string, { localized: boolean; target: string; type: 'many' | 'one' }>
|
||||
|
||||
type Args = {
|
||||
adapter: PostgresAdapter
|
||||
baseColumns?: Record<string, PgColumnBuilder>
|
||||
baseExtraConfig?: BaseExtraConfig
|
||||
buildNumbers?: boolean
|
||||
buildRelationships?: boolean
|
||||
buildTexts?: boolean
|
||||
disableNotNull: boolean
|
||||
disableUnique: boolean
|
||||
fields: Field[]
|
||||
rootRelationsToBuild?: Map<string, string>
|
||||
rootRelationsToBuild?: RelationMap
|
||||
rootRelationships?: Set<string>
|
||||
rootTableIDColType?: string
|
||||
rootTableName?: string
|
||||
@@ -56,16 +57,13 @@ type Args = {
|
||||
type Result = {
|
||||
hasManyNumberField: 'index' | boolean
|
||||
hasManyTextField: 'index' | boolean
|
||||
relationsToBuild: Map<string, string>
|
||||
relationsToBuild: RelationMap
|
||||
}
|
||||
|
||||
export const buildTable = ({
|
||||
adapter,
|
||||
baseColumns = {},
|
||||
baseExtraConfig = {},
|
||||
buildNumbers,
|
||||
buildRelationships,
|
||||
buildTexts,
|
||||
disableNotNull,
|
||||
disableUnique = false,
|
||||
fields,
|
||||
@@ -77,6 +75,7 @@ export const buildTable = ({
|
||||
timestamps,
|
||||
versions,
|
||||
}: Args): Result => {
|
||||
const isRoot = !incomingRootTableName
|
||||
const rootTableName = incomingRootTableName || tableName
|
||||
const columns: Record<string, PgColumnBuilder> = baseColumns
|
||||
const indexes: Record<string, (cols: GenericColumns) => IndexBuilder> = {}
|
||||
@@ -93,7 +92,7 @@ export const buildTable = ({
|
||||
let relationshipsTable: GenericTable | PgTableWithColumns<any>
|
||||
|
||||
// Drizzle relations
|
||||
const relationsToBuild: Map<string, string> = new Map()
|
||||
const relationsToBuild: RelationMap = new Map()
|
||||
|
||||
const idColType: IDType = setColumnID({ adapter, columns, fields })
|
||||
|
||||
@@ -106,9 +105,6 @@ export const buildTable = ({
|
||||
hasManyTextField,
|
||||
} = traverseFields({
|
||||
adapter,
|
||||
buildNumbers,
|
||||
buildRelationships,
|
||||
buildTexts,
|
||||
columns,
|
||||
disableNotNull,
|
||||
disableUnique,
|
||||
@@ -126,6 +122,15 @@ export const buildTable = ({
|
||||
versions,
|
||||
})
|
||||
|
||||
// split the relationsToBuild by localized and non-localized
|
||||
const localizedRelations = new Map()
|
||||
const nonLocalizedRelations = new Map()
|
||||
|
||||
relationsToBuild.forEach(({ type, localized, target }, key) => {
|
||||
const map = localized ? localizedRelations : nonLocalizedRelations
|
||||
map.set(key, { type, target })
|
||||
})
|
||||
|
||||
if (timestamps) {
|
||||
columns.createdAt = timestamp('created_at', {
|
||||
mode: 'string',
|
||||
@@ -159,7 +164,7 @@ export const buildTable = ({
|
||||
|
||||
adapter.tables[tableName] = table
|
||||
|
||||
if (hasLocalizedField) {
|
||||
if (hasLocalizedField || localizedRelations.size) {
|
||||
const localeTableName = `${tableName}${adapter.localesSuffix}`
|
||||
localesColumns.id = serial('id').primaryKey()
|
||||
localesColumns._locale = adapter.enums.enum__locales('_locale').notNull()
|
||||
@@ -187,114 +192,128 @@ export const buildTable = ({
|
||||
|
||||
adapter.tables[localeTableName] = localesTable
|
||||
|
||||
const localesTableRelations = relations(localesTable, ({ one }) => ({
|
||||
_parentID: one(table, {
|
||||
adapter.relations[`relations_${localeTableName}`] = relations(localesTable, ({ many, one }) => {
|
||||
const result: Record<string, Relation<string>> = {}
|
||||
|
||||
result._parentID = one(table, {
|
||||
fields: [localesTable._parentID],
|
||||
references: [table.id],
|
||||
}),
|
||||
}))
|
||||
})
|
||||
|
||||
adapter.relations[`relations_${localeTableName}`] = localesTableRelations
|
||||
localizedRelations.forEach(({ type, target }, key) => {
|
||||
if (type === 'one') {
|
||||
result[key] = one(adapter.tables[target], {
|
||||
fields: [localesTable[key]],
|
||||
references: [adapter.tables[target].id],
|
||||
relationName: key,
|
||||
})
|
||||
}
|
||||
if (type === 'many') {
|
||||
result[key] = many(adapter.tables[target])
|
||||
}
|
||||
})
|
||||
|
||||
return result
|
||||
})
|
||||
}
|
||||
|
||||
if (hasManyTextField && buildTexts) {
|
||||
const textsTableName = `${rootTableName}_texts`
|
||||
const columns: Record<string, PgColumnBuilder> = {
|
||||
id: serial('id').primaryKey(),
|
||||
order: integer('order').notNull(),
|
||||
parent: parentIDColumnMap[idColType]('parent_id').notNull(),
|
||||
path: varchar('path').notNull(),
|
||||
text: varchar('text'),
|
||||
}
|
||||
|
||||
if (hasLocalizedManyTextField) {
|
||||
columns.locale = adapter.enums.enum__locales('locale')
|
||||
}
|
||||
|
||||
textsTable = adapter.pgSchema.table(textsTableName, columns, (cols) => {
|
||||
const config: Record<string, ForeignKeyBuilder | IndexBuilder> = {
|
||||
orderParentIdx: index(`${textsTableName}_order_parent_idx`).on(cols.order, cols.parent),
|
||||
parentFk: foreignKey({
|
||||
name: `${textsTableName}_parent_fk`,
|
||||
columns: [cols.parent],
|
||||
foreignColumns: [table.id],
|
||||
}).onDelete('cascade'),
|
||||
}
|
||||
|
||||
if (hasManyTextField === 'index') {
|
||||
config.text_idx = index(`${textsTableName}_text_idx`).on(cols.text)
|
||||
if (isRoot) {
|
||||
if (hasManyTextField) {
|
||||
const textsTableName = `${rootTableName}_texts`
|
||||
const columns: Record<string, PgColumnBuilder> = {
|
||||
id: serial('id').primaryKey(),
|
||||
order: integer('order').notNull(),
|
||||
parent: parentIDColumnMap[idColType]('parent_id').notNull(),
|
||||
path: varchar('path').notNull(),
|
||||
text: varchar('text'),
|
||||
}
|
||||
|
||||
if (hasLocalizedManyTextField) {
|
||||
config.localeParent = index(`${textsTableName}_locale_parent`).on(cols.locale, cols.parent)
|
||||
columns.locale = adapter.enums.enum__locales('locale')
|
||||
}
|
||||
|
||||
return config
|
||||
})
|
||||
textsTable = adapter.pgSchema.table(textsTableName, columns, (cols) => {
|
||||
const config: Record<string, ForeignKeyBuilder | IndexBuilder> = {
|
||||
orderParentIdx: index(`${textsTableName}_order_parent_idx`).on(cols.order, cols.parent),
|
||||
parentFk: foreignKey({
|
||||
name: `${textsTableName}_parent_fk`,
|
||||
columns: [cols.parent],
|
||||
foreignColumns: [table.id],
|
||||
}).onDelete('cascade'),
|
||||
}
|
||||
|
||||
adapter.tables[textsTableName] = textsTable
|
||||
if (hasManyTextField === 'index') {
|
||||
config.text_idx = index(`${textsTableName}_text_idx`).on(cols.text)
|
||||
}
|
||||
|
||||
const textsTableRelations = relations(textsTable, ({ one }) => ({
|
||||
parent: one(table, {
|
||||
fields: [textsTable.parent],
|
||||
references: [table.id],
|
||||
}),
|
||||
}))
|
||||
if (hasLocalizedManyTextField) {
|
||||
config.localeParent = index(`${textsTableName}_locale_parent`).on(
|
||||
cols.locale,
|
||||
cols.parent,
|
||||
)
|
||||
}
|
||||
|
||||
adapter.relations[`relations_${textsTableName}`] = textsTableRelations
|
||||
}
|
||||
return config
|
||||
})
|
||||
|
||||
if (hasManyNumberField && buildNumbers) {
|
||||
const numbersTableName = `${rootTableName}_numbers`
|
||||
const columns: Record<string, PgColumnBuilder> = {
|
||||
id: serial('id').primaryKey(),
|
||||
number: numeric('number'),
|
||||
order: integer('order').notNull(),
|
||||
parent: parentIDColumnMap[idColType]('parent_id').notNull(),
|
||||
path: varchar('path').notNull(),
|
||||
adapter.tables[textsTableName] = textsTable
|
||||
|
||||
adapter.relations[`relations_${textsTableName}`] = relations(textsTable, ({ one }) => ({
|
||||
parent: one(table, {
|
||||
fields: [textsTable.parent],
|
||||
references: [table.id],
|
||||
}),
|
||||
}))
|
||||
}
|
||||
|
||||
if (hasLocalizedManyNumberField) {
|
||||
columns.locale = adapter.enums.enum__locales('locale')
|
||||
}
|
||||
|
||||
numbersTable = adapter.pgSchema.table(numbersTableName, columns, (cols) => {
|
||||
const config: Record<string, ForeignKeyBuilder | IndexBuilder> = {
|
||||
orderParentIdx: index(`${numbersTableName}_order_parent_idx`).on(cols.order, cols.parent),
|
||||
parentFk: foreignKey({
|
||||
name: `${numbersTableName}_parent_fk`,
|
||||
columns: [cols.parent],
|
||||
foreignColumns: [table.id],
|
||||
}).onDelete('cascade'),
|
||||
}
|
||||
|
||||
if (hasManyNumberField === 'index') {
|
||||
config.numberIdx = index(`${numbersTableName}_number_idx`).on(cols.number)
|
||||
if (hasManyNumberField) {
|
||||
const numbersTableName = `${rootTableName}_numbers`
|
||||
const columns: Record<string, PgColumnBuilder> = {
|
||||
id: serial('id').primaryKey(),
|
||||
number: numeric('number'),
|
||||
order: integer('order').notNull(),
|
||||
parent: parentIDColumnMap[idColType]('parent_id').notNull(),
|
||||
path: varchar('path').notNull(),
|
||||
}
|
||||
|
||||
if (hasLocalizedManyNumberField) {
|
||||
config.localeParent = index(`${numbersTableName}_locale_parent`).on(
|
||||
cols.locale,
|
||||
cols.parent,
|
||||
)
|
||||
columns.locale = adapter.enums.enum__locales('locale')
|
||||
}
|
||||
|
||||
return config
|
||||
})
|
||||
numbersTable = adapter.pgSchema.table(numbersTableName, columns, (cols) => {
|
||||
const config: Record<string, ForeignKeyBuilder | IndexBuilder> = {
|
||||
orderParentIdx: index(`${numbersTableName}_order_parent_idx`).on(cols.order, cols.parent),
|
||||
parentFk: foreignKey({
|
||||
name: `${numbersTableName}_parent_fk`,
|
||||
columns: [cols.parent],
|
||||
foreignColumns: [table.id],
|
||||
}).onDelete('cascade'),
|
||||
}
|
||||
|
||||
adapter.tables[numbersTableName] = numbersTable
|
||||
if (hasManyNumberField === 'index') {
|
||||
config.numberIdx = index(`${numbersTableName}_number_idx`).on(cols.number)
|
||||
}
|
||||
|
||||
const numbersTableRelations = relations(numbersTable, ({ one }) => ({
|
||||
parent: one(table, {
|
||||
fields: [numbersTable.parent],
|
||||
references: [table.id],
|
||||
}),
|
||||
}))
|
||||
if (hasLocalizedManyNumberField) {
|
||||
config.localeParent = index(`${numbersTableName}_locale_parent`).on(
|
||||
cols.locale,
|
||||
cols.parent,
|
||||
)
|
||||
}
|
||||
|
||||
adapter.relations[`relations_${numbersTableName}`] = numbersTableRelations
|
||||
}
|
||||
return config
|
||||
})
|
||||
|
||||
adapter.tables[numbersTableName] = numbersTable
|
||||
|
||||
adapter.relations[`relations_${numbersTableName}`] = relations(numbersTable, ({ one }) => ({
|
||||
parent: one(table, {
|
||||
fields: [numbersTable.parent],
|
||||
references: [table.id],
|
||||
}),
|
||||
}))
|
||||
}
|
||||
|
||||
if (buildRelationships) {
|
||||
if (relationships.size) {
|
||||
const relationshipColumns: Record<string, PgColumnBuilder> = {
|
||||
id: serial('id').primaryKey(),
|
||||
@@ -308,7 +327,6 @@ export const buildTable = ({
|
||||
}
|
||||
|
||||
const relationExtraConfig: BaseExtraConfig = {}
|
||||
|
||||
const relationshipsTableName = `${tableName}${adapter.relationshipsSuffix}`
|
||||
|
||||
relationships.forEach((relationTo) => {
|
||||
@@ -319,7 +337,6 @@ export const buildTable = ({
|
||||
throwValidationError: true,
|
||||
})
|
||||
let colType = adapter.idType === 'uuid' ? 'uuid' : 'integer'
|
||||
|
||||
const relatedCollectionCustomIDType =
|
||||
adapter.payload.collections[relationshipConfig.slug]?.customIDType
|
||||
|
||||
@@ -371,40 +388,50 @@ export const buildTable = ({
|
||||
|
||||
adapter.tables[relationshipsTableName] = relationshipsTable
|
||||
|
||||
const relationshipsTableRelations = relations(relationshipsTable, ({ one }) => {
|
||||
const result: Record<string, Relation<string>> = {
|
||||
parent: one(table, {
|
||||
fields: [relationshipsTable.parent],
|
||||
references: [table.id],
|
||||
relationName: '_rels',
|
||||
}),
|
||||
}
|
||||
adapter.relations[`relations_${relationshipsTableName}`] = relations(
|
||||
relationshipsTable,
|
||||
({ one }) => {
|
||||
const result: Record<string, Relation<string>> = {
|
||||
parent: one(table, {
|
||||
fields: [relationshipsTable.parent],
|
||||
references: [table.id],
|
||||
relationName: '_rels',
|
||||
}),
|
||||
}
|
||||
|
||||
relationships.forEach((relationTo) => {
|
||||
const relatedTableName = createTableName({
|
||||
adapter,
|
||||
config: adapter.payload.collections[relationTo].config,
|
||||
throwValidationError: true,
|
||||
relationships.forEach((relationTo) => {
|
||||
const relatedTableName = createTableName({
|
||||
adapter,
|
||||
config: adapter.payload.collections[relationTo].config,
|
||||
throwValidationError: true,
|
||||
})
|
||||
const idColumnName = `${relationTo}ID`
|
||||
result[idColumnName] = one(adapter.tables[relatedTableName], {
|
||||
fields: [relationshipsTable[idColumnName]],
|
||||
references: [adapter.tables[relatedTableName].id],
|
||||
})
|
||||
})
|
||||
const idColumnName = `${relationTo}ID`
|
||||
result[idColumnName] = one(adapter.tables[relatedTableName], {
|
||||
fields: [relationshipsTable[idColumnName]],
|
||||
references: [adapter.tables[relatedTableName].id],
|
||||
})
|
||||
})
|
||||
|
||||
return result
|
||||
})
|
||||
|
||||
adapter.relations[`relations_${relationshipsTableName}`] = relationshipsTableRelations
|
||||
return result
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
const tableRelations = relations(table, ({ many }) => {
|
||||
adapter.relations[`relations_${tableName}`] = relations(table, ({ many, one }) => {
|
||||
const result: Record<string, Relation<string>> = {}
|
||||
|
||||
relationsToBuild.forEach((val, key) => {
|
||||
result[key] = many(adapter.tables[val])
|
||||
nonLocalizedRelations.forEach(({ type, target }, key) => {
|
||||
if (type === 'one') {
|
||||
result[key] = one(adapter.tables[target], {
|
||||
fields: [table[key]],
|
||||
references: [adapter.tables[target].id],
|
||||
relationName: key,
|
||||
})
|
||||
}
|
||||
if (type === 'many') {
|
||||
result[key] = many(adapter.tables[target])
|
||||
}
|
||||
})
|
||||
|
||||
if (hasLocalizedField) {
|
||||
@@ -414,6 +441,7 @@ export const buildTable = ({
|
||||
if (hasManyTextField) {
|
||||
result._texts = many(textsTable)
|
||||
}
|
||||
|
||||
if (hasManyNumberField) {
|
||||
result._numbers = many(numbersTable)
|
||||
}
|
||||
@@ -427,7 +455,5 @@ export const buildTable = ({
|
||||
return result
|
||||
})
|
||||
|
||||
adapter.relations[`relations_${tableName}`] = tableRelations
|
||||
|
||||
return { hasManyNumberField, hasManyTextField, relationsToBuild }
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ import { fieldAffectsData, optionIsObject } from 'payload/types'
|
||||
import toSnakeCase from 'to-snake-case'
|
||||
|
||||
import type { GenericColumns, IDType, PostgresAdapter } from '../types.js'
|
||||
import type { BaseExtraConfig } from './build.js'
|
||||
import type { BaseExtraConfig, RelationMap } from './build.js'
|
||||
|
||||
import { hasLocalesTable } from '../utilities/hasLocalesTable.js'
|
||||
import { buildTable } from './build.js'
|
||||
@@ -36,9 +36,6 @@ import { validateExistingBlockIsIdentical } from './validateExistingBlockIsIdent
|
||||
|
||||
type Args = {
|
||||
adapter: PostgresAdapter
|
||||
buildNumbers: boolean
|
||||
buildRelationships: boolean
|
||||
buildTexts: boolean
|
||||
columnPrefix?: string
|
||||
columns: Record<string, PgColumnBuilder>
|
||||
disableNotNull: boolean
|
||||
@@ -51,9 +48,9 @@ type Args = {
|
||||
localesIndexes: Record<string, (cols: GenericColumns) => IndexBuilder>
|
||||
newTableName: string
|
||||
parentTableName: string
|
||||
relationsToBuild: Map<string, string>
|
||||
relationsToBuild: RelationMap
|
||||
relationships: Set<string>
|
||||
rootRelationsToBuild?: Map<string, string>
|
||||
rootRelationsToBuild?: RelationMap
|
||||
rootTableIDColType: string
|
||||
rootTableName: string
|
||||
versions: boolean
|
||||
@@ -70,9 +67,6 @@ type Result = {
|
||||
|
||||
export const traverseFields = ({
|
||||
adapter,
|
||||
buildNumbers,
|
||||
buildRelationships,
|
||||
buildTexts,
|
||||
columnPrefix,
|
||||
columns,
|
||||
disableNotNull,
|
||||
@@ -121,7 +115,13 @@ export const traverseFields = ({
|
||||
|
||||
// If field is localized,
|
||||
// add the column to the locale table instead of main table
|
||||
if (adapter.payload.config.localization && (field.localized || forceLocalized)) {
|
||||
if (
|
||||
adapter.payload.config.localization &&
|
||||
(field.localized || forceLocalized) &&
|
||||
field.type !== 'array' &&
|
||||
field.type !== 'blocks' &&
|
||||
(('hasMany' in field && field.hasMany !== true) || !('hasMany' in field))
|
||||
) {
|
||||
hasLocalizedField = true
|
||||
targetTable = localesColumns
|
||||
targetIndexes = localesIndexes
|
||||
@@ -129,23 +129,28 @@ export const traverseFields = ({
|
||||
|
||||
if (
|
||||
(field.unique || field.index) &&
|
||||
!['array', 'blocks', 'group', 'point', 'relationship', 'upload'].includes(field.type) &&
|
||||
!('hasMany' in field && field.hasMany === true)
|
||||
!['array', 'blocks', 'group', 'point'].includes(field.type)
|
||||
) {
|
||||
const unique = disableUnique !== true && field.unique
|
||||
if (unique) {
|
||||
const constraintValue = `${fieldPrefix || ''}${field.name}`
|
||||
if (!adapter.fieldConstraints?.[rootTableName]) {
|
||||
adapter.fieldConstraints[rootTableName] = {}
|
||||
if (
|
||||
field.type !== 'relationship' ||
|
||||
(field.type === 'relationship' && typeof field.relationTo === 'string' && !field.hasMany)
|
||||
) {
|
||||
const unique = disableUnique !== true && field.unique
|
||||
if (unique) {
|
||||
const constraintValue = `${fieldPrefix || ''}${field.name}`
|
||||
if (!adapter.fieldConstraints?.[rootTableName]) {
|
||||
adapter.fieldConstraints[rootTableName] = {}
|
||||
}
|
||||
adapter.fieldConstraints[rootTableName][`${newTableName}_${columnName}_idx`] =
|
||||
constraintValue
|
||||
}
|
||||
adapter.fieldConstraints[rootTableName][`${columnName}_idx`] = constraintValue
|
||||
targetIndexes[`${newTableName}_${field.name}Idx`] = createIndex({
|
||||
name: fieldName,
|
||||
columnName,
|
||||
tableName: newTableName,
|
||||
unique,
|
||||
})
|
||||
}
|
||||
targetIndexes[`${newTableName}_${field.name}Idx`] = createIndex({
|
||||
name: fieldName,
|
||||
columnName,
|
||||
tableName: newTableName,
|
||||
unique,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -250,6 +255,7 @@ export const traverseFields = ({
|
||||
parentTableName: newTableName,
|
||||
prefix: `${newTableName}_`,
|
||||
throwValidationError,
|
||||
versionsCustomName: versions,
|
||||
})
|
||||
const baseColumns: Record<string, PgColumnBuilder> = {
|
||||
order: integer('order').notNull(),
|
||||
@@ -264,7 +270,7 @@ export const traverseFields = ({
|
||||
name: `${selectTableName}_parent_fk`,
|
||||
columns: [cols.parent],
|
||||
foreignColumns: [adapter.tables[parentTableName].id],
|
||||
}),
|
||||
}).onDelete('cascade'),
|
||||
parentIdx: (cols) => index(`${selectTableName}_parent_idx`).on(cols.parent),
|
||||
}
|
||||
|
||||
@@ -285,24 +291,27 @@ export const traverseFields = ({
|
||||
disableNotNull,
|
||||
disableUnique,
|
||||
fields: [],
|
||||
rootTableName,
|
||||
tableName: selectTableName,
|
||||
versions,
|
||||
})
|
||||
|
||||
relationsToBuild.set(fieldName, selectTableName)
|
||||
relationsToBuild.set(fieldName, {
|
||||
type: 'many',
|
||||
// selects have their own localized table, independent of the base table.
|
||||
localized: false,
|
||||
target: selectTableName,
|
||||
})
|
||||
|
||||
const selectTableRelations = relations(adapter.tables[selectTableName], ({ one }) => {
|
||||
const result: Record<string, Relation<string>> = {
|
||||
adapter.relations[`relations_${selectTableName}`] = relations(
|
||||
adapter.tables[selectTableName],
|
||||
({ one }) => ({
|
||||
parent: one(adapter.tables[parentTableName], {
|
||||
fields: [adapter.tables[selectTableName].parent],
|
||||
references: [adapter.tables[parentTableName].id],
|
||||
}),
|
||||
}
|
||||
|
||||
return result
|
||||
})
|
||||
|
||||
adapter.relations[`relation_${selectTableName}`] = selectTableRelations
|
||||
}),
|
||||
)
|
||||
} else {
|
||||
targetTable[fieldName] = adapter.enums[enumName](fieldName)
|
||||
}
|
||||
@@ -376,28 +385,46 @@ export const traverseFields = ({
|
||||
hasManyNumberField = subHasManyNumberField
|
||||
}
|
||||
|
||||
relationsToBuild.set(fieldName, arrayTableName)
|
||||
|
||||
const arrayTableRelations = relations(adapter.tables[arrayTableName], ({ many, one }) => {
|
||||
const result: Record<string, Relation<string>> = {
|
||||
_parentID: one(adapter.tables[parentTableName], {
|
||||
fields: [adapter.tables[arrayTableName]._parentID],
|
||||
references: [adapter.tables[parentTableName].id],
|
||||
}),
|
||||
}
|
||||
|
||||
if (hasLocalesTable(field.fields)) {
|
||||
result._locales = many(adapter.tables[`${arrayTableName}${adapter.localesSuffix}`])
|
||||
}
|
||||
|
||||
subRelationsToBuild.forEach((val, key) => {
|
||||
result[key] = many(adapter.tables[val])
|
||||
})
|
||||
|
||||
return result
|
||||
relationsToBuild.set(fieldName, {
|
||||
type: 'many',
|
||||
// arrays have their own localized table, independent of the base table.
|
||||
localized: false,
|
||||
target: arrayTableName,
|
||||
})
|
||||
|
||||
adapter.relations[`relations_${arrayTableName}`] = arrayTableRelations
|
||||
adapter.relations[`relations_${arrayTableName}`] = relations(
|
||||
adapter.tables[arrayTableName],
|
||||
({ many, one }) => {
|
||||
const result: Record<string, Relation<string>> = {
|
||||
_parentID: one(adapter.tables[parentTableName], {
|
||||
fields: [adapter.tables[arrayTableName]._parentID],
|
||||
references: [adapter.tables[parentTableName].id],
|
||||
}),
|
||||
}
|
||||
|
||||
if (hasLocalesTable(field.fields)) {
|
||||
result._locales = many(adapter.tables[`${arrayTableName}${adapter.localesSuffix}`])
|
||||
}
|
||||
|
||||
subRelationsToBuild.forEach(({ type, localized, target }, key) => {
|
||||
if (type === 'one') {
|
||||
const arrayWithLocalized = localized
|
||||
? `${arrayTableName}${adapter.localesSuffix}`
|
||||
: arrayTableName
|
||||
result[key] = one(adapter.tables[target], {
|
||||
fields: [adapter.tables[arrayWithLocalized][key]],
|
||||
references: [adapter.tables[target].id],
|
||||
relationName: key,
|
||||
})
|
||||
}
|
||||
if (type === 'many') {
|
||||
result[key] = many(adapter.tables[target])
|
||||
}
|
||||
})
|
||||
|
||||
return result
|
||||
},
|
||||
)
|
||||
|
||||
break
|
||||
}
|
||||
@@ -468,15 +495,15 @@ export const traverseFields = ({
|
||||
hasManyNumberField = subHasManyNumberField
|
||||
}
|
||||
|
||||
const blockTableRelations = relations(
|
||||
adapter.relations[`relations_${blockTableName}`] = relations(
|
||||
adapter.tables[blockTableName],
|
||||
({ many, one }) => {
|
||||
const result: Record<string, Relation<string>> = {
|
||||
_parentID: one(adapter.tables[rootTableName], {
|
||||
fields: [adapter.tables[blockTableName]._parentID],
|
||||
references: [adapter.tables[rootTableName].id],
|
||||
}),
|
||||
}
|
||||
const result: Record<string, Relation<string>> = {}
|
||||
|
||||
result._parentID = one(adapter.tables[rootTableName], {
|
||||
fields: [adapter.tables[blockTableName]._parentID],
|
||||
references: [adapter.tables[rootTableName].id],
|
||||
})
|
||||
|
||||
if (hasLocalesTable(block.fields)) {
|
||||
result._locales = many(
|
||||
@@ -484,15 +511,25 @@ export const traverseFields = ({
|
||||
)
|
||||
}
|
||||
|
||||
subRelationsToBuild.forEach((val, key) => {
|
||||
result[key] = many(adapter.tables[val])
|
||||
subRelationsToBuild.forEach(({ type, localized, target }, key) => {
|
||||
if (type === 'one') {
|
||||
const arrayWithLocalized = localized
|
||||
? `${blockTableName}${adapter.localesSuffix}`
|
||||
: blockTableName
|
||||
result[key] = one(adapter.tables[target], {
|
||||
fields: [adapter.tables[arrayWithLocalized][key]],
|
||||
references: [adapter.tables[target].id],
|
||||
relationName: key,
|
||||
})
|
||||
}
|
||||
if (type === 'many') {
|
||||
result[key] = many(adapter.tables[target])
|
||||
}
|
||||
})
|
||||
|
||||
return result
|
||||
},
|
||||
)
|
||||
|
||||
adapter.relations[`relations_${blockTableName}`] = blockTableRelations
|
||||
} else if (process.env.NODE_ENV !== 'production' && !versions) {
|
||||
validateExistingBlockIsIdentical({
|
||||
block,
|
||||
@@ -502,7 +539,12 @@ export const traverseFields = ({
|
||||
tableLocales: adapter.tables[`${blockTableName}${adapter.localesSuffix}`],
|
||||
})
|
||||
}
|
||||
rootRelationsToBuild.set(`_blocks_${block.slug}`, blockTableName)
|
||||
rootRelationsToBuild.set(`_blocks_${block.slug}`, {
|
||||
type: 'many',
|
||||
// blocks are not localized on the parent table
|
||||
localized: false,
|
||||
target: blockTableName,
|
||||
})
|
||||
})
|
||||
|
||||
break
|
||||
@@ -520,9 +562,6 @@ export const traverseFields = ({
|
||||
hasManyTextField: groupHasManyTextField,
|
||||
} = traverseFields({
|
||||
adapter,
|
||||
buildNumbers,
|
||||
buildRelationships,
|
||||
buildTexts,
|
||||
columnPrefix,
|
||||
columns,
|
||||
disableNotNull,
|
||||
@@ -563,9 +602,6 @@ export const traverseFields = ({
|
||||
hasManyTextField: groupHasManyTextField,
|
||||
} = traverseFields({
|
||||
adapter,
|
||||
buildNumbers,
|
||||
buildRelationships,
|
||||
buildTexts,
|
||||
columnPrefix: `${columnName}_`,
|
||||
columns,
|
||||
disableNotNull: disableNotNullFromHere,
|
||||
@@ -607,9 +643,6 @@ export const traverseFields = ({
|
||||
hasManyTextField: tabHasManyTextField,
|
||||
} = traverseFields({
|
||||
adapter,
|
||||
buildNumbers,
|
||||
buildRelationships,
|
||||
buildTexts,
|
||||
columnPrefix,
|
||||
columns,
|
||||
disableNotNull: disableNotNullFromHere,
|
||||
@@ -651,9 +684,6 @@ export const traverseFields = ({
|
||||
hasManyTextField: rowHasManyTextField,
|
||||
} = traverseFields({
|
||||
adapter,
|
||||
buildNumbers,
|
||||
buildRelationships,
|
||||
buildTexts,
|
||||
columnPrefix,
|
||||
columns,
|
||||
disableNotNull: disableNotNullFromHere,
|
||||
@@ -687,13 +717,45 @@ export const traverseFields = ({
|
||||
case 'upload':
|
||||
if (Array.isArray(field.relationTo)) {
|
||||
field.relationTo.forEach((relation) => relationships.add(relation))
|
||||
} else {
|
||||
} else if (field.type === 'relationship' && field.hasMany) {
|
||||
relationships.add(field.relationTo)
|
||||
} else {
|
||||
// simple relationships get a column on the targetTable with a foreign key to the relationTo table
|
||||
const relationshipConfig = adapter.payload.collections[field.relationTo].config
|
||||
|
||||
const tableName = adapter.tableNameMap.get(toSnakeCase(field.relationTo))
|
||||
|
||||
// get the id type of the related collection
|
||||
let colType = adapter.idType === 'uuid' ? 'uuid' : 'integer'
|
||||
const relatedCollectionCustomID = relationshipConfig.fields.find(
|
||||
(field) => fieldAffectsData(field) && field.name === 'id',
|
||||
)
|
||||
if (relatedCollectionCustomID?.type === 'number') colType = 'numeric'
|
||||
if (relatedCollectionCustomID?.type === 'text') colType = 'varchar'
|
||||
|
||||
// make the foreign key column for relationship using the correct id column type
|
||||
targetTable[fieldName] = parentIDColumnMap[colType](`${columnName}_id`).references(
|
||||
() => adapter.tables[tableName].id,
|
||||
{ onDelete: 'cascade' },
|
||||
)
|
||||
|
||||
// add relationship to table
|
||||
relationsToBuild.set(fieldName, {
|
||||
type: 'one',
|
||||
localized: adapter.payload.config.localization && field.localized,
|
||||
target: tableName,
|
||||
})
|
||||
|
||||
// add notNull when not required
|
||||
if (!disableNotNull && field.required && !field.admin?.condition) {
|
||||
targetTable[fieldName].notNull()
|
||||
}
|
||||
}
|
||||
|
||||
if (field.localized && adapter.payload.config.localization) {
|
||||
hasLocalizedRelationshipField = true
|
||||
}
|
||||
// if (field.localized && adapter.payload.config.localization) {
|
||||
// hasLocalizedRelationshipField = true
|
||||
// }
|
||||
|
||||
break
|
||||
|
||||
default:
|
||||
|
||||
@@ -30,10 +30,6 @@ export const transformRelationship = ({ field, locale, ref, relations }: Args) =
|
||||
value: matchedRelation[1],
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Handle hasOne
|
||||
const relatedData = relation[`${field.relationTo}ID`]
|
||||
result = relatedData
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -114,6 +114,11 @@ export const traverseFields = <T extends Record<string, unknown>>({
|
||||
if (fieldAffectsData(field)) {
|
||||
const fieldName = `${fieldPrefix || ''}${field.name}`
|
||||
const fieldData = table[fieldName]
|
||||
const localizedFieldData = {}
|
||||
const valuesToTransform: {
|
||||
ref: Record<string, unknown>
|
||||
table: Record<string, unknown>
|
||||
}[] = []
|
||||
|
||||
if (fieldPrefix) {
|
||||
deletions.push(() => delete table[fieldName])
|
||||
@@ -266,49 +271,63 @@ export const traverseFields = <T extends Record<string, unknown>>({
|
||||
}
|
||||
|
||||
if (field.type === 'relationship' || field.type === 'upload') {
|
||||
const relationPathMatch = relationships[`${sanitizedPath}${field.name}`]
|
||||
if (!relationPathMatch) {
|
||||
if ('hasMany' in field && field.hasMany) {
|
||||
if (field.localized && config.localization && config.localization.locales) {
|
||||
result[field.name] = {
|
||||
[config.localization.defaultLocale]: [],
|
||||
if (!('hasMany' in field) || (!field.hasMany && field.relationTo === 'string')) {
|
||||
if (
|
||||
field.localized &&
|
||||
config.localization &&
|
||||
config.localization.locales &&
|
||||
Array.isArray(table?._locales)
|
||||
) {
|
||||
table._locales.forEach((localeRow) => {
|
||||
result[field.name] = { [localeRow._locale]: localeRow[fieldName] }
|
||||
})
|
||||
} else {
|
||||
valuesToTransform.push({ ref: result, table })
|
||||
}
|
||||
} else {
|
||||
const relationPathMatch = relationships[`${sanitizedPath}${field.name}`]
|
||||
if (!relationPathMatch) {
|
||||
if ('hasMany' in field && field.hasMany) {
|
||||
if (field.localized && config.localization && config.localization.locales) {
|
||||
result[field.name] = {
|
||||
[config.localization.defaultLocale]: [],
|
||||
}
|
||||
} else {
|
||||
result[field.name] = []
|
||||
}
|
||||
} else {
|
||||
result[field.name] = []
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
if (field.localized) {
|
||||
result[field.name] = {}
|
||||
const relationsByLocale: Record<string, Record<string, unknown>[]> = {}
|
||||
|
||||
if (field.localized) {
|
||||
result[field.name] = {}
|
||||
const relationsByLocale: Record<string, Record<string, unknown>[]> = {}
|
||||
relationPathMatch.forEach((row) => {
|
||||
if (typeof row.locale === 'string') {
|
||||
if (!relationsByLocale[row.locale]) relationsByLocale[row.locale] = []
|
||||
relationsByLocale[row.locale].push(row)
|
||||
}
|
||||
})
|
||||
|
||||
relationPathMatch.forEach((row) => {
|
||||
if (typeof row.locale === 'string') {
|
||||
if (!relationsByLocale[row.locale]) relationsByLocale[row.locale] = []
|
||||
relationsByLocale[row.locale].push(row)
|
||||
}
|
||||
})
|
||||
|
||||
Object.entries(relationsByLocale).forEach(([locale, relations]) => {
|
||||
Object.entries(relationsByLocale).forEach(([locale, relations]) => {
|
||||
transformRelationship({
|
||||
field,
|
||||
locale,
|
||||
ref: result,
|
||||
relations,
|
||||
})
|
||||
})
|
||||
} else {
|
||||
transformRelationship({
|
||||
field,
|
||||
locale,
|
||||
ref: result,
|
||||
relations,
|
||||
relations: relationPathMatch,
|
||||
})
|
||||
})
|
||||
} else {
|
||||
transformRelationship({
|
||||
field,
|
||||
ref: result,
|
||||
relations: relationPathMatch,
|
||||
})
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
if (field.type === 'text' && field?.hasMany) {
|
||||
@@ -397,12 +416,6 @@ export const traverseFields = <T extends Record<string, unknown>>({
|
||||
return result
|
||||
}
|
||||
|
||||
const localizedFieldData = {}
|
||||
const valuesToTransform: {
|
||||
ref: Record<string, unknown>
|
||||
table: Record<string, unknown>
|
||||
}[] = []
|
||||
|
||||
if (field.localized && Array.isArray(table._locales)) {
|
||||
table._locales.forEach((localeRow) => {
|
||||
valuesToTransform.push({ ref: localizedFieldData, table: localeRow })
|
||||
|
||||
@@ -354,7 +354,10 @@ export const traverseFields = ({
|
||||
if (field.type === 'relationship' || field.type === 'upload') {
|
||||
const relationshipPath = `${path || ''}${field.name}`
|
||||
|
||||
if (field.localized) {
|
||||
if (
|
||||
field.localized &&
|
||||
(Array.isArray(field.relationTo) || ('hasMany' in field && field.hasMany))
|
||||
) {
|
||||
if (typeof fieldData === 'object') {
|
||||
Object.entries(fieldData).forEach(([localeKey, localeData]) => {
|
||||
if (localeData === null) {
|
||||
@@ -376,7 +379,8 @@ export const traverseFields = ({
|
||||
})
|
||||
})
|
||||
}
|
||||
} else {
|
||||
return
|
||||
} else if (Array.isArray(field.relationTo) || ('hasMany' in field && field.hasMany)) {
|
||||
if (fieldData === null || (Array.isArray(fieldData) && fieldData.length === 0)) {
|
||||
relationshipsToDelete.push({ path: relationshipPath })
|
||||
return
|
||||
@@ -390,9 +394,30 @@ export const traverseFields = ({
|
||||
field,
|
||||
relationships,
|
||||
})
|
||||
return
|
||||
} else {
|
||||
if (
|
||||
!field.localized &&
|
||||
fieldData &&
|
||||
typeof fieldData === 'object' &&
|
||||
'id' in fieldData &&
|
||||
fieldData?.id
|
||||
) {
|
||||
fieldData = fieldData.id
|
||||
} else if (field.localized) {
|
||||
if (typeof fieldData === 'object') {
|
||||
Object.entries(fieldData).forEach(([localeKey, localeData]) => {
|
||||
if (typeof localeData === 'object') {
|
||||
if ('id' in localeData && localeData?.id) {
|
||||
fieldData[localeKey] = localeData.id
|
||||
}
|
||||
} else {
|
||||
fieldData[localeKey] = localeData
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
if (field.type === 'text' && field.hasMany) {
|
||||
|
||||
@@ -20,6 +20,7 @@ export const upsertRow = async <T extends TypeWithID>({
|
||||
data,
|
||||
db,
|
||||
fields,
|
||||
ignoreResult,
|
||||
operation,
|
||||
path = '',
|
||||
req,
|
||||
@@ -323,6 +324,8 @@ export const upsertRow = async <T extends TypeWithID>({
|
||||
: error
|
||||
}
|
||||
|
||||
if (ignoreResult) return data as T
|
||||
|
||||
// //////////////////////////////////
|
||||
// RETRIEVE NEWLY UPDATED ROW
|
||||
// //////////////////////////////////
|
||||
|
||||
@@ -8,6 +8,11 @@ type BaseArgs = {
|
||||
data: Record<string, unknown>
|
||||
db: DrizzleDB
|
||||
fields: Field[]
|
||||
/**
|
||||
* When true, skips reading the data back from the database and returns the input data
|
||||
* @default false
|
||||
*/
|
||||
ignoreResult?: boolean
|
||||
path?: string
|
||||
req: PayloadRequestWithData
|
||||
tableName: string
|
||||
|
||||
6
packages/payload/auth.d.ts
vendored
Normal file
6
packages/payload/auth.d.ts
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
export * from './dist/auth/index.js';
|
||||
export { default as executeAccess } from './dist/auth/executeAccess.js';
|
||||
export { getAccessResults } from './dist/auth/getAccessResults.js';
|
||||
export { getAuthenticatedUser } from './dist/auth/getAuthenticatedUser.js';
|
||||
export type { AuthStrategyFunction, AuthStrategyFunctionArgs, CollectionPermission, FieldPermissions, GlobalPermission, IncomingAuthType, Permission, Permissions, User, VerifyConfig, } from './dist/auth/types.js';
|
||||
//# sourceMappingURL=auth.d.ts.map
|
||||
6
packages/payload/auth.js
Normal file
6
packages/payload/auth.js
Normal file
@@ -0,0 +1,6 @@
|
||||
export * from './dist/auth/index.js';
|
||||
export { default as executeAccess } from './dist/auth/executeAccess.js';
|
||||
export { getAccessResults } from './dist/auth/getAccessResults.js';
|
||||
export { getAuthenticatedUser } from './dist/auth/getAuthenticatedUser.js';
|
||||
|
||||
//# sourceMappingURL=auth.js.map
|
||||
14
packages/payload/components.d.ts
vendored
Normal file
14
packages/payload/components.d.ts
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
export { default as Banner } from './dist/admin/components/elements/Banner';
|
||||
export { default as Button } from './dist/admin/components/elements/Button';
|
||||
export { ErrorPill } from './dist/admin/components/elements/ErrorPill';
|
||||
export { default as Pill } from './dist/admin/components/elements/Pill';
|
||||
export { default as Popup } from './dist/admin/components/elements/Popup';
|
||||
export { ShimmerEffect } from './dist/admin/components/elements/ShimmerEffect';
|
||||
export { default as Tooltip } from './dist/admin/components/elements/Tooltip';
|
||||
export { default as Check } from './dist/admin/components/icons/Check';
|
||||
export { default as Chevron } from './dist/admin/components/icons/Chevron';
|
||||
export { default as Menu } from './dist/admin/components/icons/Menu';
|
||||
export { default as Search } from './dist/admin/components/icons/Search';
|
||||
export { default as X } from './dist/admin/components/icons/X';
|
||||
export { default as MinimalTemplate } from './dist/admin/components/templates/Minimal';
|
||||
//# sourceMappingURL=components.d.ts.map
|
||||
71
packages/payload/components.js
Normal file
71
packages/payload/components.js
Normal file
@@ -0,0 +1,71 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
Banner: function() {
|
||||
return _Banner.default;
|
||||
},
|
||||
Button: function() {
|
||||
return _Button.default;
|
||||
},
|
||||
Check: function() {
|
||||
return _Check.default;
|
||||
},
|
||||
Chevron: function() {
|
||||
return _Chevron.default;
|
||||
},
|
||||
ErrorPill: function() {
|
||||
return _ErrorPill.ErrorPill;
|
||||
},
|
||||
Menu: function() {
|
||||
return _Menu.default;
|
||||
},
|
||||
MinimalTemplate: function() {
|
||||
return _Minimal.default;
|
||||
},
|
||||
Pill: function() {
|
||||
return _Pill.default;
|
||||
},
|
||||
Popup: function() {
|
||||
return _Popup.default;
|
||||
},
|
||||
Search: function() {
|
||||
return _Search.default;
|
||||
},
|
||||
ShimmerEffect: function() {
|
||||
return _ShimmerEffect.ShimmerEffect;
|
||||
},
|
||||
Tooltip: function() {
|
||||
return _Tooltip.default;
|
||||
},
|
||||
X: function() {
|
||||
return _X.default;
|
||||
}
|
||||
});
|
||||
const _Banner = /*#__PURE__*/ _interop_require_default(require("./dist/admin/components/elements/Banner"));
|
||||
const _Button = /*#__PURE__*/ _interop_require_default(require("./dist/admin/components/elements/Button"));
|
||||
const _ErrorPill = require("./dist/admin/components/elements/ErrorPill");
|
||||
const _Pill = /*#__PURE__*/ _interop_require_default(require("./dist/admin/components/elements/Pill"));
|
||||
const _Popup = /*#__PURE__*/ _interop_require_default(require("./dist/admin/components/elements/Popup"));
|
||||
const _ShimmerEffect = require("./dist/admin/components/elements/ShimmerEffect");
|
||||
const _Tooltip = /*#__PURE__*/ _interop_require_default(require("./dist/admin/components/elements/Tooltip"));
|
||||
const _Check = /*#__PURE__*/ _interop_require_default(require("./dist/admin/components/icons/Check"));
|
||||
const _Chevron = /*#__PURE__*/ _interop_require_default(require("./dist/admin/components/icons/Chevron"));
|
||||
const _Menu = /*#__PURE__*/ _interop_require_default(require("./dist/admin/components/icons/Menu"));
|
||||
const _Search = /*#__PURE__*/ _interop_require_default(require("./dist/admin/components/icons/Search"));
|
||||
const _X = /*#__PURE__*/ _interop_require_default(require("./dist/admin/components/icons/X"));
|
||||
const _Minimal = /*#__PURE__*/ _interop_require_default(require("./dist/admin/components/templates/Minimal"));
|
||||
function _interop_require_default(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9leHBvcnRzL2NvbXBvbmVudHMudHMiXSwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IHsgZGVmYXVsdCBhcyBCYW5uZXIgfSBmcm9tICcuLi9hZG1pbi9jb21wb25lbnRzL2VsZW1lbnRzL0Jhbm5lcidcbmV4cG9ydCB7IGRlZmF1bHQgYXMgQnV0dG9uIH0gZnJvbSAnLi4vYWRtaW4vY29tcG9uZW50cy9lbGVtZW50cy9CdXR0b24nXG5cbmV4cG9ydCB7IEVycm9yUGlsbCB9IGZyb20gJy4uL2FkbWluL2NvbXBvbmVudHMvZWxlbWVudHMvRXJyb3JQaWxsJ1xuZXhwb3J0IHsgZGVmYXVsdCBhcyBQaWxsIH0gZnJvbSAnLi4vYWRtaW4vY29tcG9uZW50cy9lbGVtZW50cy9QaWxsJ1xuXG5leHBvcnQgeyBkZWZhdWx0IGFzIFBvcHVwIH0gZnJvbSAnLi4vYWRtaW4vY29tcG9uZW50cy9lbGVtZW50cy9Qb3B1cCdcblxuZXhwb3J0IHsgU2hpbW1lckVmZmVjdCB9IGZyb20gJy4uL2FkbWluL2NvbXBvbmVudHMvZWxlbWVudHMvU2hpbW1lckVmZmVjdCdcbmV4cG9ydCB7IGRlZmF1bHQgYXMgVG9vbHRpcCB9IGZyb20gJy4uL2FkbWluL2NvbXBvbmVudHMvZWxlbWVudHMvVG9vbHRpcCdcbmV4cG9ydCB7IGRlZmF1bHQgYXMgQ2hlY2sgfSBmcm9tICcuLi9hZG1pbi9jb21wb25lbnRzL2ljb25zL0NoZWNrJ1xuZXhwb3J0IHsgZGVmYXVsdCBhcyBDaGV2cm9uIH0gZnJvbSAnLi4vYWRtaW4vY29tcG9uZW50cy9pY29ucy9DaGV2cm9uJ1xuZXhwb3J0IHsgZGVmYXVsdCBhcyBNZW51IH0gZnJvbSAnLi4vYWRtaW4vY29tcG9uZW50cy9pY29ucy9NZW51J1xuZXhwb3J0IHsgZGVmYXVsdCBhcyBTZWFyY2ggfSBmcm9tICcuLi9hZG1pbi9jb21wb25lbnRzL2ljb25zL1NlYXJjaCdcbmV4cG9ydCB7IGRlZmF1bHQgYXMgWCB9IGZyb20gJy4uL2FkbWluL2NvbXBvbmVudHMvaWNvbnMvWCdcbmV4cG9ydCB7IGRlZmF1bHQgYXMgTWluaW1hbFRlbXBsYXRlIH0gZnJvbSAnLi4vYWRtaW4vY29tcG9uZW50cy90ZW1wbGF0ZXMvTWluaW1hbCdcbiJdLCJuYW1lcyI6WyJCYW5uZXIiLCJCdXR0b24iLCJDaGVjayIsIkNoZXZyb24iLCJFcnJvclBpbGwiLCJNZW51IiwiTWluaW1hbFRlbXBsYXRlIiwiUGlsbCIsIlBvcHVwIiwiU2VhcmNoIiwiU2hpbW1lckVmZmVjdCIsIlRvb2x0aXAiLCJYIl0sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7OztJQUFvQkEsTUFBTTtlQUFOQSxlQUFNOztJQUNOQyxNQUFNO2VBQU5BLGVBQU07O0lBU05DLEtBQUs7ZUFBTEEsY0FBSzs7SUFDTEMsT0FBTztlQUFQQSxnQkFBTzs7SUFSbEJDLFNBQVM7ZUFBVEEsb0JBQVM7O0lBU0VDLElBQUk7ZUFBSkEsYUFBSTs7SUFHSkMsZUFBZTtlQUFmQSxnQkFBZTs7SUFYZkMsSUFBSTtlQUFKQSxhQUFJOztJQUVKQyxLQUFLO2VBQUxBLGNBQUs7O0lBT0xDLE1BQU07ZUFBTkEsZUFBTTs7SUFMakJDLGFBQWE7ZUFBYkEsNEJBQWE7O0lBQ0ZDLE9BQU87ZUFBUEEsZ0JBQU87O0lBS1BDLENBQUM7ZUFBREEsVUFBQzs7OytEQWRhOytEQUNBOzJCQUVSOzZEQUNNOzhEQUVDOytCQUVIO2dFQUNLOzhEQUNGO2dFQUNFOzZEQUNIOytEQUNFOzBEQUNMO2dFQUNjIn0=
|
||||
14
packages/payload/components/elements.d.ts
vendored
Normal file
14
packages/payload/components/elements.d.ts
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
export { default as Button } from '../dist/admin/components/elements/Button';
|
||||
export { default as Card } from '../dist/admin/components/elements/Card';
|
||||
export { Collapsible } from '../dist/admin/components/elements/Collapsible';
|
||||
export { DocumentDrawer, DocumentDrawerToggler, baseClass as DocumentDrawerBaseClass, useDocumentDrawer, } from '../dist/admin/components/elements/DocumentDrawer';
|
||||
export { Drawer, DrawerToggler, formatDrawerSlug } from '../dist/admin/components/elements/Drawer';
|
||||
export { useDrawerSlug } from '../dist/admin/components/elements/Drawer/useDrawerSlug';
|
||||
export { default as Eyebrow } from '../dist/admin/components/elements/Eyebrow';
|
||||
export { Gutter } from '../dist/admin/components/elements/Gutter';
|
||||
export { AppHeader } from '../dist/admin/components/elements/Header';
|
||||
export { ListDrawer, ListDrawerToggler, baseClass as ListDrawerBaseClass, formatListDrawerSlug, useListDrawer, } from '../dist/admin/components/elements/ListDrawer';
|
||||
export { Description, DescriptionComponent, DescriptionFunction, } from '../dist/admin/components/forms/FieldDescription/types';
|
||||
export { useNav } from '../dist/admin/components/elements/Nav/context';
|
||||
export { default as NavGroup } from '../dist/admin/components/elements/NavGroup';
|
||||
//# sourceMappingURL=elements.d.ts.map
|
||||
104
packages/payload/components/elements.js
Normal file
104
packages/payload/components/elements.js
Normal file
@@ -0,0 +1,104 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
AppHeader: function() {
|
||||
return _Header.AppHeader;
|
||||
},
|
||||
Button: function() {
|
||||
return _Button.default;
|
||||
},
|
||||
Card: function() {
|
||||
return _Card.default;
|
||||
},
|
||||
Collapsible: function() {
|
||||
return _Collapsible.Collapsible;
|
||||
},
|
||||
Description: function() {
|
||||
return _types.Description;
|
||||
},
|
||||
DescriptionComponent: function() {
|
||||
return _types.DescriptionComponent;
|
||||
},
|
||||
DescriptionFunction: function() {
|
||||
return _types.DescriptionFunction;
|
||||
},
|
||||
DocumentDrawer: function() {
|
||||
return _DocumentDrawer.DocumentDrawer;
|
||||
},
|
||||
DocumentDrawerBaseClass: function() {
|
||||
return _DocumentDrawer.baseClass;
|
||||
},
|
||||
DocumentDrawerToggler: function() {
|
||||
return _DocumentDrawer.DocumentDrawerToggler;
|
||||
},
|
||||
Drawer: function() {
|
||||
return _Drawer.Drawer;
|
||||
},
|
||||
DrawerToggler: function() {
|
||||
return _Drawer.DrawerToggler;
|
||||
},
|
||||
Eyebrow: function() {
|
||||
return _Eyebrow.default;
|
||||
},
|
||||
Gutter: function() {
|
||||
return _Gutter.Gutter;
|
||||
},
|
||||
ListDrawer: function() {
|
||||
return _ListDrawer.ListDrawer;
|
||||
},
|
||||
ListDrawerBaseClass: function() {
|
||||
return _ListDrawer.baseClass;
|
||||
},
|
||||
ListDrawerToggler: function() {
|
||||
return _ListDrawer.ListDrawerToggler;
|
||||
},
|
||||
NavGroup: function() {
|
||||
return _NavGroup.default;
|
||||
},
|
||||
formatDrawerSlug: function() {
|
||||
return _Drawer.formatDrawerSlug;
|
||||
},
|
||||
formatListDrawerSlug: function() {
|
||||
return _ListDrawer.formatListDrawerSlug;
|
||||
},
|
||||
useDocumentDrawer: function() {
|
||||
return _DocumentDrawer.useDocumentDrawer;
|
||||
},
|
||||
useDrawerSlug: function() {
|
||||
return _useDrawerSlug.useDrawerSlug;
|
||||
},
|
||||
useListDrawer: function() {
|
||||
return _ListDrawer.useListDrawer;
|
||||
},
|
||||
useNav: function() {
|
||||
return _context.useNav;
|
||||
}
|
||||
});
|
||||
const _Button = /*#__PURE__*/ _interop_require_default(require("../dist/admin/components/elements/Button"));
|
||||
const _Card = /*#__PURE__*/ _interop_require_default(require("../dist/admin/components/elements/Card"));
|
||||
const _Collapsible = require("../dist/admin/components/elements/Collapsible");
|
||||
const _DocumentDrawer = require("../dist/admin/components/elements/DocumentDrawer");
|
||||
const _Drawer = require("../dist/admin/components/elements/Drawer");
|
||||
const _useDrawerSlug = require("../dist/admin/components/elements/Drawer/useDrawerSlug");
|
||||
const _Eyebrow = /*#__PURE__*/ _interop_require_default(require("../dist/admin/components/elements/Eyebrow"));
|
||||
const _Gutter = require("../dist/admin/components/elements/Gutter");
|
||||
const _Header = require("../dist/admin/components/elements/Header");
|
||||
const _ListDrawer = require("../dist/admin/components/elements/ListDrawer");
|
||||
const _types = require("../dist/admin/components/forms/FieldDescription/types");
|
||||
const _context = require("../dist/admin/components/elements/Nav/context");
|
||||
const _NavGroup = /*#__PURE__*/ _interop_require_default(require("../dist/admin/components/elements/NavGroup"));
|
||||
function _interop_require_default(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9leHBvcnRzL2NvbXBvbmVudHMvZWxlbWVudHMudHMiXSwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IHsgZGVmYXVsdCBhcyBCdXR0b24gfSBmcm9tICcuLi8uLi9hZG1pbi9jb21wb25lbnRzL2VsZW1lbnRzL0J1dHRvbidcbmV4cG9ydCB7IGRlZmF1bHQgYXMgQ2FyZCB9IGZyb20gJy4uLy4uL2FkbWluL2NvbXBvbmVudHMvZWxlbWVudHMvQ2FyZCdcbmV4cG9ydCB7IENvbGxhcHNpYmxlIH0gZnJvbSAnLi4vLi4vYWRtaW4vY29tcG9uZW50cy9lbGVtZW50cy9Db2xsYXBzaWJsZSdcbmV4cG9ydCB7XG4gIERvY3VtZW50RHJhd2VyLFxuICBEb2N1bWVudERyYXdlclRvZ2dsZXIsXG4gIGJhc2VDbGFzcyBhcyBEb2N1bWVudERyYXdlckJhc2VDbGFzcyxcbiAgdXNlRG9jdW1lbnREcmF3ZXIsXG59IGZyb20gJy4uLy4uL2FkbWluL2NvbXBvbmVudHMvZWxlbWVudHMvRG9jdW1lbnREcmF3ZXInXG5leHBvcnQgeyBEcmF3ZXIsIERyYXdlclRvZ2dsZXIsIGZvcm1hdERyYXdlclNsdWcgfSBmcm9tICcuLi8uLi9hZG1pbi9jb21wb25lbnRzL2VsZW1lbnRzL0RyYXdlcidcblxuZXhwb3J0IHsgdXNlRHJhd2VyU2x1ZyB9IGZyb20gJy4uLy4uL2FkbWluL2NvbXBvbmVudHMvZWxlbWVudHMvRHJhd2VyL3VzZURyYXdlclNsdWcnXG5cbmV4cG9ydCB7IGRlZmF1bHQgYXMgRXllYnJvdyB9IGZyb20gJy4uLy4uL2FkbWluL2NvbXBvbmVudHMvZWxlbWVudHMvRXllYnJvdydcbmV4cG9ydCB7IEd1dHRlciB9IGZyb20gJy4uLy4uL2FkbWluL2NvbXBvbmVudHMvZWxlbWVudHMvR3V0dGVyJ1xuZXhwb3J0IHsgQXBwSGVhZGVyIH0gZnJvbSAnLi4vLi4vYWRtaW4vY29tcG9uZW50cy9lbGVtZW50cy9IZWFkZXInXG5cbmV4cG9ydCB7XG4gIExpc3REcmF3ZXIsXG4gIExpc3REcmF3ZXJUb2dnbGVyLFxuICBiYXNlQ2xhc3MgYXMgTGlzdERyYXdlckJhc2VDbGFzcyxcbiAgZm9ybWF0TGlzdERyYXdlclNsdWcsXG4gIHVzZUxpc3REcmF3ZXIsXG59IGZyb20gJy4uLy4uL2FkbWluL2NvbXBvbmVudHMvZWxlbWVudHMvTGlzdERyYXdlcidcblxuZXhwb3J0IHtcbiAgRGVzY3JpcHRpb24sXG4gIERlc2NyaXB0aW9uQ29tcG9uZW50LFxuICBEZXNjcmlwdGlvbkZ1bmN0aW9uLFxufSBmcm9tICcuLi8uLi9hZG1pbi9jb21wb25lbnRzL2Zvcm1zL0ZpZWxkRGVzY3JpcHRpb24vdHlwZXMnXG5cbmV4cG9ydCB7IHVzZU5hdiB9IGZyb20gJy4uLy4uL2FkbWluL2NvbXBvbmVudHMvZWxlbWVudHMvTmF2L2NvbnRleHQnXG5leHBvcnQgeyBkZWZhdWx0IGFzIE5hdkdyb3VwIH0gZnJvbSAnLi4vLi4vYWRtaW4vY29tcG9uZW50cy9lbGVtZW50cy9OYXZHcm91cCdcbiJdLCJuYW1lcyI6WyJBcHBIZWFkZXIiLCJCdXR0b24iLCJDYXJkIiwiQ29sbGFwc2libGUiLCJEZXNjcmlwdGlvbiIsIkRlc2NyaXB0aW9uQ29tcG9uZW50IiwiRGVzY3JpcHRpb25GdW5jdGlvbiIsIkRvY3VtZW50RHJhd2VyIiwiRG9jdW1lbnREcmF3ZXJCYXNlQ2xhc3MiLCJiYXNlQ2xhc3MiLCJEb2N1bWVudERyYXdlclRvZ2dsZXIiLCJEcmF3ZXIiLCJEcmF3ZXJUb2dnbGVyIiwiRXllYnJvdyIsIkd1dHRlciIsIkxpc3REcmF3ZXIiLCJMaXN0RHJhd2VyQmFzZUNsYXNzIiwiTGlzdERyYXdlclRvZ2dsZXIiLCJOYXZHcm91cCIsImZvcm1hdERyYXdlclNsdWciLCJmb3JtYXRMaXN0RHJhd2VyU2x1ZyIsInVzZURvY3VtZW50RHJhd2VyIiwidXNlRHJhd2VyU2x1ZyIsInVzZUxpc3REcmF3ZXIiLCJ1c2VOYXYiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7O0lBZVNBLFNBQVM7ZUFBVEEsaUJBQVM7O0lBZkVDLE1BQU07ZUFBTkEsZUFBTTs7SUFDTkMsSUFBSTtlQUFKQSxhQUFJOztJQUNmQyxXQUFXO2VBQVhBLHdCQUFXOztJQXdCbEJDLFdBQVc7ZUFBWEEsa0JBQVc7O0lBQ1hDLG9CQUFvQjtlQUFwQkEsMkJBQW9COztJQUNwQkMsbUJBQW1CO2VBQW5CQSwwQkFBbUI7O0lBeEJuQkMsY0FBYztlQUFkQSw4QkFBYzs7SUFFREMsdUJBQXVCO2VBQXBDQyx5QkFBUzs7SUFEVEMscUJBQXFCO2VBQXJCQSxxQ0FBcUI7O0lBSWRDLE1BQU07ZUFBTkEsY0FBTTs7SUFBRUMsYUFBYTtlQUFiQSxxQkFBYTs7SUFJVkMsT0FBTztlQUFQQSxnQkFBTzs7SUFDbEJDLE1BQU07ZUFBTkEsY0FBTTs7SUFJYkMsVUFBVTtlQUFWQSxzQkFBVTs7SUFFR0MsbUJBQW1CO2VBQWhDUCxxQkFBUzs7SUFEVFEsaUJBQWlCO2VBQWpCQSw2QkFBaUI7O0lBYUNDLFFBQVE7ZUFBUkEsaUJBQVE7O0lBdkJJQyxnQkFBZ0I7ZUFBaEJBLHdCQUFnQjs7SUFZOUNDLG9CQUFvQjtlQUFwQkEsZ0NBQW9COztJQWRwQkMsaUJBQWlCO2VBQWpCQSxpQ0FBaUI7O0lBSVZDLGFBQWE7ZUFBYkEsNEJBQWE7O0lBV3BCQyxhQUFhO2VBQWJBLHlCQUFhOztJQVNOQyxNQUFNO2VBQU5BLGVBQU07OzsrREEvQm1COzZEQUNGOzZCQUNKO2dDQU1yQjt3QkFDaUQ7K0JBRTFCO2dFQUVLO3dCQUNaO3dCQUNHOzRCQVFuQjt1QkFNQTt5QkFFZ0I7aUVBQ2EifQ==
|
||||
2
packages/payload/components/fields/Array.d.ts
vendored
Normal file
2
packages/payload/components/fields/Array.d.ts
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export type { Props } from '../../dist/admin/components/forms/field-types/Array/types';
|
||||
//# sourceMappingURL=Array.d.ts.map
|
||||
6
packages/payload/components/fields/Array.js
Normal file
6
packages/payload/components/fields/Array.js
Normal file
@@ -0,0 +1,6 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiJ9
|
||||
9
packages/payload/components/fields/Blocks.d.ts
vendored
Normal file
9
packages/payload/components/fields/Blocks.d.ts
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
export { BlockRow } from '../../dist/admin/components/forms/field-types/Blocks/BlockRow';
|
||||
export { BlocksDrawer } from '../../dist/admin/components/forms/field-types/Blocks/BlocksDrawer';
|
||||
export { default as BlockSearch } from '../../dist/admin/components/forms/field-types/Blocks/BlocksDrawer/BlockSearch';
|
||||
export type { Props as BlocksDrawerProps } from '../../dist/admin/components/forms/field-types/Blocks/BlocksDrawer/types';
|
||||
export { RowActions } from '../../dist/admin/components/forms/field-types/Blocks/RowActions';
|
||||
export { default as SectionTitle } from '../../dist/admin/components/forms/field-types/Blocks/SectionTitle/index';
|
||||
export type { Props as SectionTitleProps } from '../../dist/admin/components/forms/field-types/Blocks/SectionTitle/types';
|
||||
export type { Props } from '../../dist/admin/components/forms/field-types/Blocks/types';
|
||||
//# sourceMappingURL=Blocks.d.ts.map
|
||||
39
packages/payload/components/fields/Blocks.js
Normal file
39
packages/payload/components/fields/Blocks.js
Normal file
@@ -0,0 +1,39 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
BlockRow: function() {
|
||||
return _BlockRow.BlockRow;
|
||||
},
|
||||
BlockSearch: function() {
|
||||
return _BlockSearch.default;
|
||||
},
|
||||
BlocksDrawer: function() {
|
||||
return _BlocksDrawer.BlocksDrawer;
|
||||
},
|
||||
RowActions: function() {
|
||||
return _RowActions.RowActions;
|
||||
},
|
||||
SectionTitle: function() {
|
||||
return _index.default;
|
||||
}
|
||||
});
|
||||
const _BlockRow = require("../../dist/admin/components/forms/field-types/Blocks/BlockRow");
|
||||
const _BlocksDrawer = require("../../dist/admin/components/forms/field-types/Blocks/BlocksDrawer");
|
||||
const _BlockSearch = /*#__PURE__*/ _interop_require_default(require("../../dist/admin/components/forms/field-types/Blocks/BlocksDrawer/BlockSearch"));
|
||||
const _RowActions = require("../../dist/admin/components/forms/field-types/Blocks/RowActions");
|
||||
const _index = /*#__PURE__*/ _interop_require_default(require("../../dist/admin/components/forms/field-types/Blocks/SectionTitle/index"));
|
||||
function _interop_require_default(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9leHBvcnRzL2NvbXBvbmVudHMvZmllbGRzL0Jsb2Nrcy50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgeyBCbG9ja1JvdyB9IGZyb20gJy4uLy4uLy4uL2FkbWluL2NvbXBvbmVudHMvZm9ybXMvZmllbGQtdHlwZXMvQmxvY2tzL0Jsb2NrUm93J1xuZXhwb3J0IHsgQmxvY2tzRHJhd2VyIH0gZnJvbSAnLi4vLi4vLi4vYWRtaW4vY29tcG9uZW50cy9mb3Jtcy9maWVsZC10eXBlcy9CbG9ja3MvQmxvY2tzRHJhd2VyJ1xuZXhwb3J0IHsgZGVmYXVsdCBhcyBCbG9ja1NlYXJjaCB9IGZyb20gJy4uLy4uLy4uL2FkbWluL2NvbXBvbmVudHMvZm9ybXMvZmllbGQtdHlwZXMvQmxvY2tzL0Jsb2Nrc0RyYXdlci9CbG9ja1NlYXJjaCdcbmV4cG9ydCB0eXBlIHsgUHJvcHMgYXMgQmxvY2tzRHJhd2VyUHJvcHMgfSBmcm9tICcuLi8uLi8uLi9hZG1pbi9jb21wb25lbnRzL2Zvcm1zL2ZpZWxkLXR5cGVzL0Jsb2Nrcy9CbG9ja3NEcmF3ZXIvdHlwZXMnXG5leHBvcnQgeyBSb3dBY3Rpb25zIH0gZnJvbSAnLi4vLi4vLi4vYWRtaW4vY29tcG9uZW50cy9mb3Jtcy9maWVsZC10eXBlcy9CbG9ja3MvUm93QWN0aW9ucydcbmV4cG9ydCB7IGRlZmF1bHQgYXMgU2VjdGlvblRpdGxlIH0gZnJvbSAnLi4vLi4vLi4vYWRtaW4vY29tcG9uZW50cy9mb3Jtcy9maWVsZC10eXBlcy9CbG9ja3MvU2VjdGlvblRpdGxlL2luZGV4J1xuZXhwb3J0IHR5cGUgeyBQcm9wcyBhcyBTZWN0aW9uVGl0bGVQcm9wcyB9IGZyb20gJy4uLy4uLy4uL2FkbWluL2NvbXBvbmVudHMvZm9ybXMvZmllbGQtdHlwZXMvQmxvY2tzL1NlY3Rpb25UaXRsZS90eXBlcydcbmV4cG9ydCB0eXBlIHsgUHJvcHMgfSBmcm9tICcuLi8uLi8uLi9hZG1pbi9jb21wb25lbnRzL2Zvcm1zL2ZpZWxkLXR5cGVzL0Jsb2Nrcy90eXBlcydcbiJdLCJuYW1lcyI6WyJCbG9ja1JvdyIsIkJsb2NrU2VhcmNoIiwiQmxvY2tzRHJhd2VyIiwiUm93QWN0aW9ucyIsIlNlY3Rpb25UaXRsZSJdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7SUFBU0EsUUFBUTtlQUFSQSxrQkFBUTs7SUFFR0MsV0FBVztlQUFYQSxvQkFBVzs7SUFEdEJDLFlBQVk7ZUFBWkEsMEJBQVk7O0lBR1pDLFVBQVU7ZUFBVkEsc0JBQVU7O0lBQ0NDLFlBQVk7ZUFBWkEsY0FBWTs7OzBCQUxQOzhCQUNJO29FQUNVOzRCQUVaOzhEQUNhIn0=
|
||||
2
packages/payload/components/fields/Cell.d.ts
vendored
Normal file
2
packages/payload/components/fields/Cell.d.ts
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export type { Props } from '../../dist/admin/components/views/collections/List/Cell/types';
|
||||
//# sourceMappingURL=Cell.d.ts.map
|
||||
6
packages/payload/components/fields/Cell.js
Normal file
6
packages/payload/components/fields/Cell.js
Normal file
@@ -0,0 +1,6 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiJ9
|
||||
2
packages/payload/components/fields/Checkbox.d.ts
vendored
Normal file
2
packages/payload/components/fields/Checkbox.d.ts
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export type { Props } from '../../dist/admin/components/forms/field-types/Checkbox/types';
|
||||
//# sourceMappingURL=Checkbox.d.ts.map
|
||||
6
packages/payload/components/fields/Checkbox.js
Normal file
6
packages/payload/components/fields/Checkbox.js
Normal file
@@ -0,0 +1,6 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiJ9
|
||||
2
packages/payload/components/fields/Code.d.ts
vendored
Normal file
2
packages/payload/components/fields/Code.d.ts
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export type { Props } from '../../dist/admin/components/forms/field-types/Code/types';
|
||||
//# sourceMappingURL=Code.d.ts.map
|
||||
6
packages/payload/components/fields/Code.js
Normal file
6
packages/payload/components/fields/Code.js
Normal file
@@ -0,0 +1,6 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiJ9
|
||||
2
packages/payload/components/fields/DateTime.d.ts
vendored
Normal file
2
packages/payload/components/fields/DateTime.d.ts
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export type { Props } from '../../dist/admin/components/forms/field-types/DateTime/types';
|
||||
//# sourceMappingURL=DateTime.d.ts.map
|
||||
6
packages/payload/components/fields/DateTime.js
Normal file
6
packages/payload/components/fields/DateTime.js
Normal file
@@ -0,0 +1,6 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiJ9
|
||||
2
packages/payload/components/fields/Email.d.ts
vendored
Normal file
2
packages/payload/components/fields/Email.d.ts
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export type { Props } from '../../dist/admin/components/forms/field-types/Email/types';
|
||||
//# sourceMappingURL=Email.d.ts.map
|
||||
6
packages/payload/components/fields/Email.js
Normal file
6
packages/payload/components/fields/Email.js
Normal file
@@ -0,0 +1,6 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiJ9
|
||||
2
packages/payload/components/fields/Group.d.ts
vendored
Normal file
2
packages/payload/components/fields/Group.d.ts
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export type { Props } from '../../dist/admin/components/forms/field-types/Group/types';
|
||||
//# sourceMappingURL=Group.d.ts.map
|
||||
6
packages/payload/components/fields/Group.js
Normal file
6
packages/payload/components/fields/Group.js
Normal file
@@ -0,0 +1,6 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiJ9
|
||||
2
packages/payload/components/fields/Json.d.ts
vendored
Normal file
2
packages/payload/components/fields/Json.d.ts
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export type { Props } from '../../dist/admin/components/forms/field-types/JSON/types';
|
||||
//# sourceMappingURL=Json.d.ts.map
|
||||
6
packages/payload/components/fields/Json.js
Normal file
6
packages/payload/components/fields/Json.js
Normal file
@@ -0,0 +1,6 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiJ9
|
||||
2
packages/payload/components/fields/Number.d.ts
vendored
Normal file
2
packages/payload/components/fields/Number.d.ts
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export type { Props } from '../../dist/admin/components/forms/field-types/Number/types';
|
||||
//# sourceMappingURL=Number.d.ts.map
|
||||
6
packages/payload/components/fields/Number.js
Normal file
6
packages/payload/components/fields/Number.js
Normal file
@@ -0,0 +1,6 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiJ9
|
||||
2
packages/payload/components/fields/Password.d.ts
vendored
Normal file
2
packages/payload/components/fields/Password.d.ts
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export type { Props } from '../../dist/admin/components/forms/field-types/Password/types';
|
||||
//# sourceMappingURL=Password.d.ts.map
|
||||
6
packages/payload/components/fields/Password.js
Normal file
6
packages/payload/components/fields/Password.js
Normal file
@@ -0,0 +1,6 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiJ9
|
||||
2
packages/payload/components/fields/RadioGroup/RadioInput.d.ts
vendored
Normal file
2
packages/payload/components/fields/RadioGroup/RadioInput.d.ts
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export type { Props } from '../../../dist/admin/components/forms/field-types/RadioGroup/RadioInput/types';
|
||||
//# sourceMappingURL=RadioInput.d.ts.map
|
||||
@@ -0,0 +1,6 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiJ9
|
||||
2
packages/payload/components/fields/RadioGroup/index.d.ts
vendored
Normal file
2
packages/payload/components/fields/RadioGroup/index.d.ts
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export type { Props } from '../../../dist/admin/components/forms/field-types/RadioGroup/types';
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
6
packages/payload/components/fields/RadioGroup/index.js
Normal file
6
packages/payload/components/fields/RadioGroup/index.js
Normal file
@@ -0,0 +1,6 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiJ9
|
||||
3
packages/payload/components/fields/Relationship.d.ts
vendored
Normal file
3
packages/payload/components/fields/Relationship.d.ts
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export { default as RelationshipComponent } from '../../dist/admin/components/forms/field-types/Relationship';
|
||||
export type { Option, Props, ValueWithRelation, } from '../../dist/admin/components/forms/field-types/Relationship/types';
|
||||
//# sourceMappingURL=Relationship.d.ts.map
|
||||
18
packages/payload/components/fields/Relationship.js
Normal file
18
packages/payload/components/fields/Relationship.js
Normal file
@@ -0,0 +1,18 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "RelationshipComponent", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return _Relationship.default;
|
||||
}
|
||||
});
|
||||
const _Relationship = /*#__PURE__*/ _interop_require_default(require("../../dist/admin/components/forms/field-types/Relationship"));
|
||||
function _interop_require_default(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9leHBvcnRzL2NvbXBvbmVudHMvZmllbGRzL1JlbGF0aW9uc2hpcC50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgeyBkZWZhdWx0IGFzIFJlbGF0aW9uc2hpcENvbXBvbmVudCB9IGZyb20gJy4uLy4uLy4uL2FkbWluL2NvbXBvbmVudHMvZm9ybXMvZmllbGQtdHlwZXMvUmVsYXRpb25zaGlwJ1xuZXhwb3J0IHR5cGUge1xuICBPcHRpb24sXG4gIFByb3BzLFxuICBWYWx1ZVdpdGhSZWxhdGlvbixcbn0gZnJvbSAnLi4vLi4vLi4vYWRtaW4vY29tcG9uZW50cy9mb3Jtcy9maWVsZC10eXBlcy9SZWxhdGlvbnNoaXAvdHlwZXMnXG4iXSwibmFtZXMiOlsiUmVsYXRpb25zaGlwQ29tcG9uZW50Il0sIm1hcHBpbmdzIjoiOzs7OytCQUFvQkE7OztlQUFBQSxxQkFBcUI7OztxRUFBUSJ9
|
||||
2
packages/payload/components/fields/RichText.d.ts
vendored
Normal file
2
packages/payload/components/fields/RichText.d.ts
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export type { RichTextFieldProps } from '../../dist/admin/components/forms/field-types/RichText/types';
|
||||
//# sourceMappingURL=RichText.d.ts.map
|
||||
6
packages/payload/components/fields/RichText.js
Normal file
6
packages/payload/components/fields/RichText.js
Normal file
@@ -0,0 +1,6 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiJ9
|
||||
2
packages/payload/components/fields/Row.d.ts
vendored
Normal file
2
packages/payload/components/fields/Row.d.ts
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export type { Props } from '../../dist/admin/components/forms/field-types/Row/types';
|
||||
//# sourceMappingURL=Row.d.ts.map
|
||||
6
packages/payload/components/fields/Row.js
Normal file
6
packages/payload/components/fields/Row.js
Normal file
@@ -0,0 +1,6 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiJ9
|
||||
3
packages/payload/components/fields/Select.d.ts
vendored
Normal file
3
packages/payload/components/fields/Select.d.ts
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export { default as SelectComponent } from '../../dist/admin/components/forms/field-types/Select';
|
||||
export type { Props } from '../../dist/admin/components/forms/field-types/Select/types';
|
||||
//# sourceMappingURL=Select.d.ts.map
|
||||
18
packages/payload/components/fields/Select.js
Normal file
18
packages/payload/components/fields/Select.js
Normal file
@@ -0,0 +1,18 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "SelectComponent", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return _Select.default;
|
||||
}
|
||||
});
|
||||
const _Select = /*#__PURE__*/ _interop_require_default(require("../../dist/admin/components/forms/field-types/Select"));
|
||||
function _interop_require_default(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9leHBvcnRzL2NvbXBvbmVudHMvZmllbGRzL1NlbGVjdC50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgeyBkZWZhdWx0IGFzIFNlbGVjdENvbXBvbmVudCB9IGZyb20gJy4uLy4uLy4uL2FkbWluL2NvbXBvbmVudHMvZm9ybXMvZmllbGQtdHlwZXMvU2VsZWN0J1xuZXhwb3J0IHR5cGUgeyBQcm9wcyB9IGZyb20gJy4uLy4uLy4uL2FkbWluL2NvbXBvbmVudHMvZm9ybXMvZmllbGQtdHlwZXMvU2VsZWN0L3R5cGVzJ1xuIl0sIm5hbWVzIjpbIlNlbGVjdENvbXBvbmVudCJdLCJtYXBwaW5ncyI6Ijs7OzsrQkFBb0JBOzs7ZUFBQUEsZUFBZTs7OytEQUFRIn0=
|
||||
2
packages/payload/components/fields/Text.d.ts
vendored
Normal file
2
packages/payload/components/fields/Text.d.ts
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export type { Props } from '../../dist/admin/components/forms/field-types/Text/types';
|
||||
//# sourceMappingURL=Text.d.ts.map
|
||||
6
packages/payload/components/fields/Text.js
Normal file
6
packages/payload/components/fields/Text.js
Normal file
@@ -0,0 +1,6 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiJ9
|
||||
2
packages/payload/components/fields/Textarea.d.ts
vendored
Normal file
2
packages/payload/components/fields/Textarea.d.ts
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export type { Props } from '../../dist/admin/components/forms/field-types/Textarea/types';
|
||||
//# sourceMappingURL=Textarea.d.ts.map
|
||||
6
packages/payload/components/fields/Textarea.js
Normal file
6
packages/payload/components/fields/Textarea.js
Normal file
@@ -0,0 +1,6 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiJ9
|
||||
2
packages/payload/components/fields/Upload.d.ts
vendored
Normal file
2
packages/payload/components/fields/Upload.d.ts
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export type { Props } from '../../dist/admin/components/forms/field-types/Upload/types';
|
||||
//# sourceMappingURL=Upload.d.ts.map
|
||||
6
packages/payload/components/fields/Upload.js
Normal file
6
packages/payload/components/fields/Upload.js
Normal file
@@ -0,0 +1,6 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiJ9
|
||||
38
packages/payload/components/forms.d.ts
vendored
Normal file
38
packages/payload/components/forms.d.ts
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
export { default as Error } from '../dist/admin/components/forms/Error';
|
||||
export { default as FieldDescription } from '../dist/admin/components/forms/FieldDescription';
|
||||
export { default as Form } from '../dist/admin/components/forms/Form';
|
||||
export { default as buildInitialState } from '../dist/admin/components/forms/Form/buildInitialState';
|
||||
export { useAllFormFields, useForm, useFormFields, useFormModified, useFormProcessing, useFormSubmitted,
|
||||
/**
|
||||
* @deprecated useWatchForm is no longer preferred. If you need all form fields, prefer `useAllFormFields`.
|
||||
*/
|
||||
useWatchForm, } from '../dist/admin/components/forms/Form/context';
|
||||
export { createNestedFieldPath } from '../dist/admin/components/forms/Form/createNestedFieldPath';
|
||||
export { default as getSiblingData } from '../dist/admin/components/forms/Form/getSiblingData';
|
||||
export { default as reduceFieldsToValues } from '../dist/admin/components/forms/Form/reduceFieldsToValues';
|
||||
export { default as Label } from '../dist/admin/components/forms/Label';
|
||||
export { default as RenderFields } from '../dist/admin/components/forms/RenderFields';
|
||||
export { default as Submit } from '../dist/admin/components/forms/Submit';
|
||||
export { default as FormSubmit } from '../dist/admin/components/forms/Submit';
|
||||
export { fieldTypes } from '../dist/admin/components/forms/field-types';
|
||||
export { default as Checkbox } from '../dist/admin/components/forms/field-types/Checkbox';
|
||||
export { default as Collapsible } from '../dist/admin/components/forms/field-types/Collapsible';
|
||||
export { default as Date } from '../dist/admin/components/forms/field-types/DateTime';
|
||||
export { DateTimeInput } from '../dist/admin/components/forms/field-types/DateTime/Input';
|
||||
export { default as Group } from '../dist/admin/components/forms/field-types/Group';
|
||||
export { default as HiddenInput } from '../dist/admin/components/forms/field-types/HiddenInput';
|
||||
export { default as Select } from '../dist/admin/components/forms/field-types/Select';
|
||||
export { default as SelectInput } from '../dist/admin/components/forms/field-types/Select/Input';
|
||||
export { default as Text } from '../dist/admin/components/forms/field-types/Text';
|
||||
export { default as TextInput } from '../dist/admin/components/forms/field-types/Text/Input';
|
||||
export { default as Textarea } from '../dist/admin/components/forms/field-types/Textarea';
|
||||
export { default as TextareaInput } from '../dist/admin/components/forms/field-types/Textarea/Input';
|
||||
export { default as Upload } from '../dist/admin/components/forms/field-types/Upload';
|
||||
export { default as UploadInput } from '../dist/admin/components/forms/field-types/Upload/Input';
|
||||
/**
|
||||
* @deprecated This method is now called useField. The useFieldType alias will be removed in an upcoming version.
|
||||
*/
|
||||
export { default as useFieldType } from '../dist/admin/components/forms/useField';
|
||||
export { default as useField } from '../dist/admin/components/forms/useField';
|
||||
export { default as withCondition } from '../dist/admin/components/forms/withCondition';
|
||||
//# sourceMappingURL=forms.d.ts.map
|
||||
157
packages/payload/components/forms.js
Normal file
157
packages/payload/components/forms.js
Normal file
File diff suppressed because one or more lines are too long
7
packages/payload/components/graphics.d.ts
vendored
Normal file
7
packages/payload/components/graphics.d.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
export { default as AccountGraphic } from '../dist/admin/components/graphics/Account';
|
||||
export { default as DefaultBlockImageGraphic } from '../dist/admin/components/graphics/DefaultBlockImage';
|
||||
export { default as FileGraphic } from '../dist/admin/components/graphics/File';
|
||||
export { default as IconGraphic } from '../dist/admin/components/graphics/Icon';
|
||||
export { default as LogoGraphic } from '../dist/admin/components/graphics/Logo';
|
||||
export { default as SearchGraphic } from '../dist/admin/components/graphics/Search';
|
||||
//# sourceMappingURL=graphics.d.ts.map
|
||||
43
packages/payload/components/graphics.js
Normal file
43
packages/payload/components/graphics.js
Normal file
@@ -0,0 +1,43 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
AccountGraphic: function() {
|
||||
return _Account.default;
|
||||
},
|
||||
DefaultBlockImageGraphic: function() {
|
||||
return _DefaultBlockImage.default;
|
||||
},
|
||||
FileGraphic: function() {
|
||||
return _File.default;
|
||||
},
|
||||
IconGraphic: function() {
|
||||
return _Icon.default;
|
||||
},
|
||||
LogoGraphic: function() {
|
||||
return _Logo.default;
|
||||
},
|
||||
SearchGraphic: function() {
|
||||
return _Search.default;
|
||||
}
|
||||
});
|
||||
const _Account = /*#__PURE__*/ _interop_require_default(require("../dist/admin/components/graphics/Account"));
|
||||
const _DefaultBlockImage = /*#__PURE__*/ _interop_require_default(require("../dist/admin/components/graphics/DefaultBlockImage"));
|
||||
const _File = /*#__PURE__*/ _interop_require_default(require("../dist/admin/components/graphics/File"));
|
||||
const _Icon = /*#__PURE__*/ _interop_require_default(require("../dist/admin/components/graphics/Icon"));
|
||||
const _Logo = /*#__PURE__*/ _interop_require_default(require("../dist/admin/components/graphics/Logo"));
|
||||
const _Search = /*#__PURE__*/ _interop_require_default(require("../dist/admin/components/graphics/Search"));
|
||||
function _interop_require_default(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9leHBvcnRzL2NvbXBvbmVudHMvZ3JhcGhpY3MudHMiXSwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IHsgZGVmYXVsdCBhcyBBY2NvdW50R3JhcGhpYyB9IGZyb20gJy4uLy4uL2FkbWluL2NvbXBvbmVudHMvZ3JhcGhpY3MvQWNjb3VudCdcbmV4cG9ydCB7IGRlZmF1bHQgYXMgRGVmYXVsdEJsb2NrSW1hZ2VHcmFwaGljIH0gZnJvbSAnLi4vLi4vYWRtaW4vY29tcG9uZW50cy9ncmFwaGljcy9EZWZhdWx0QmxvY2tJbWFnZSdcbmV4cG9ydCB7IGRlZmF1bHQgYXMgRmlsZUdyYXBoaWMgfSBmcm9tICcuLi8uLi9hZG1pbi9jb21wb25lbnRzL2dyYXBoaWNzL0ZpbGUnXG5leHBvcnQgeyBkZWZhdWx0IGFzIEljb25HcmFwaGljIH0gZnJvbSAnLi4vLi4vYWRtaW4vY29tcG9uZW50cy9ncmFwaGljcy9JY29uJ1xuZXhwb3J0IHsgZGVmYXVsdCBhcyBMb2dvR3JhcGhpYyB9IGZyb20gJy4uLy4uL2FkbWluL2NvbXBvbmVudHMvZ3JhcGhpY3MvTG9nbydcbmV4cG9ydCB7IGRlZmF1bHQgYXMgU2VhcmNoR3JhcGhpYyB9IGZyb20gJy4uLy4uL2FkbWluL2NvbXBvbmVudHMvZ3JhcGhpY3MvU2VhcmNoJ1xuIl0sIm5hbWVzIjpbIkFjY291bnRHcmFwaGljIiwiRGVmYXVsdEJsb2NrSW1hZ2VHcmFwaGljIiwiRmlsZUdyYXBoaWMiLCJJY29uR3JhcGhpYyIsIkxvZ29HcmFwaGljIiwiU2VhcmNoR3JhcGhpYyJdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7SUFBb0JBLGNBQWM7ZUFBZEEsZ0JBQWM7O0lBQ2RDLHdCQUF3QjtlQUF4QkEsMEJBQXdCOztJQUN4QkMsV0FBVztlQUFYQSxhQUFXOztJQUNYQyxXQUFXO2VBQVhBLGFBQVc7O0lBQ1hDLFdBQVc7ZUFBWEEsYUFBVzs7SUFDWEMsYUFBYTtlQUFiQSxlQUFhOzs7Z0VBTFM7MEVBQ1U7NkRBQ2I7NkRBQ0E7NkRBQ0E7K0RBQ0UifQ==
|
||||
15
packages/payload/components/hooks.d.ts
vendored
Normal file
15
packages/payload/components/hooks.d.ts
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
export { useStepNav } from '../dist/admin/components/elements/StepNav';
|
||||
export { useTableColumns } from '../dist/admin/components/elements/TableColumns';
|
||||
export { useDocumentEvents } from '../dist/admin/components/utilities/DocumentEvents';
|
||||
export { default as useDebounce } from '../dist/admin/hooks/useDebounce';
|
||||
export { useDebouncedCallback } from '../dist/admin/hooks/useDebouncedCallback';
|
||||
export { useDelay } from '../dist/admin/hooks/useDelay';
|
||||
export { useDelayedRender } from '../dist/admin/hooks/useDelayedRender';
|
||||
export { default as useHotkey } from '../dist/admin/hooks/useHotkey';
|
||||
export { default as useIntersect } from '../dist/admin/hooks/useIntersect';
|
||||
export { default as useMountEffect } from '../dist/admin/hooks/useMountEffect';
|
||||
export { default as usePayloadAPI } from '../dist/admin/hooks/usePayloadAPI';
|
||||
export { default as useThrottledEffect } from '../dist/admin/hooks/useThrottledEffect';
|
||||
export { default as useThumbnail } from '../dist/admin/hooks/useThumbnail';
|
||||
export { default as useTitle, formatUseAsTitle } from '../dist/admin/hooks/useTitle';
|
||||
//# sourceMappingURL=hooks.d.ts.map
|
||||
119
packages/payload/components/hooks.js
Normal file
119
packages/payload/components/hooks.js
Normal file
@@ -0,0 +1,119 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
formatUseAsTitle: function() {
|
||||
return _useTitle.formatUseAsTitle;
|
||||
},
|
||||
useDebounce: function() {
|
||||
return _useDebounce.default;
|
||||
},
|
||||
useDebouncedCallback: function() {
|
||||
return _useDebouncedCallback.useDebouncedCallback;
|
||||
},
|
||||
useDelay: function() {
|
||||
return _useDelay.useDelay;
|
||||
},
|
||||
useDelayedRender: function() {
|
||||
return _useDelayedRender.useDelayedRender;
|
||||
},
|
||||
useDocumentEvents: function() {
|
||||
return _DocumentEvents.useDocumentEvents;
|
||||
},
|
||||
useHotkey: function() {
|
||||
return _useHotkey.default;
|
||||
},
|
||||
useIntersect: function() {
|
||||
return _useIntersect.default;
|
||||
},
|
||||
useMountEffect: function() {
|
||||
return _useMountEffect.default;
|
||||
},
|
||||
usePayloadAPI: function() {
|
||||
return _usePayloadAPI.default;
|
||||
},
|
||||
useStepNav: function() {
|
||||
return _StepNav.useStepNav;
|
||||
},
|
||||
useTableColumns: function() {
|
||||
return _TableColumns.useTableColumns;
|
||||
},
|
||||
useThrottledEffect: function() {
|
||||
return _useThrottledEffect.default;
|
||||
},
|
||||
useThumbnail: function() {
|
||||
return _useThumbnail.default;
|
||||
},
|
||||
useTitle: function() {
|
||||
return _useTitle.default;
|
||||
}
|
||||
});
|
||||
const _StepNav = require("../dist/admin/components/elements/StepNav");
|
||||
const _TableColumns = require("../dist/admin/components/elements/TableColumns");
|
||||
const _DocumentEvents = require("../dist/admin/components/utilities/DocumentEvents");
|
||||
const _useDebounce = /*#__PURE__*/ _interop_require_default(require("../dist/admin/hooks/useDebounce"));
|
||||
const _useDebouncedCallback = require("../dist/admin/hooks/useDebouncedCallback");
|
||||
const _useDelay = require("../dist/admin/hooks/useDelay");
|
||||
const _useDelayedRender = require("../dist/admin/hooks/useDelayedRender");
|
||||
const _useHotkey = /*#__PURE__*/ _interop_require_default(require("../dist/admin/hooks/useHotkey"));
|
||||
const _useIntersect = /*#__PURE__*/ _interop_require_default(require("../dist/admin/hooks/useIntersect"));
|
||||
const _useMountEffect = /*#__PURE__*/ _interop_require_default(require("../dist/admin/hooks/useMountEffect"));
|
||||
const _usePayloadAPI = /*#__PURE__*/ _interop_require_default(require("../dist/admin/hooks/usePayloadAPI"));
|
||||
const _useThrottledEffect = /*#__PURE__*/ _interop_require_default(require("../dist/admin/hooks/useThrottledEffect"));
|
||||
const _useThumbnail = /*#__PURE__*/ _interop_require_default(require("../dist/admin/hooks/useThumbnail"));
|
||||
const _useTitle = /*#__PURE__*/ _interop_require_wildcard(require("../dist/admin/hooks/useTitle"));
|
||||
function _interop_require_default(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
function _getRequireWildcardCache(nodeInterop) {
|
||||
if (typeof WeakMap !== "function") return null;
|
||||
var cacheBabelInterop = new WeakMap();
|
||||
var cacheNodeInterop = new WeakMap();
|
||||
return (_getRequireWildcardCache = function(nodeInterop) {
|
||||
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
||||
})(nodeInterop);
|
||||
}
|
||||
function _interop_require_wildcard(obj, nodeInterop) {
|
||||
if (!nodeInterop && obj && obj.__esModule) {
|
||||
return obj;
|
||||
}
|
||||
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
||||
return {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
var cache = _getRequireWildcardCache(nodeInterop);
|
||||
if (cache && cache.has(obj)) {
|
||||
return cache.get(obj);
|
||||
}
|
||||
var newObj = {
|
||||
__proto__: null
|
||||
};
|
||||
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
||||
for(var key in obj){
|
||||
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
||||
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
||||
if (desc && (desc.get || desc.set)) {
|
||||
Object.defineProperty(newObj, key, desc);
|
||||
} else {
|
||||
newObj[key] = obj[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
newObj.default = obj;
|
||||
if (cache) {
|
||||
cache.set(obj, newObj);
|
||||
}
|
||||
return newObj;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9leHBvcnRzL2NvbXBvbmVudHMvaG9va3MudHMiXSwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IHsgdXNlU3RlcE5hdiB9IGZyb20gJy4uLy4uL2FkbWluL2NvbXBvbmVudHMvZWxlbWVudHMvU3RlcE5hdidcbmV4cG9ydCB7IHVzZVRhYmxlQ29sdW1ucyB9IGZyb20gJy4uLy4uL2FkbWluL2NvbXBvbmVudHMvZWxlbWVudHMvVGFibGVDb2x1bW5zJ1xuZXhwb3J0IHsgdXNlRG9jdW1lbnRFdmVudHMgfSBmcm9tICcuLi8uLi9hZG1pbi9jb21wb25lbnRzL3V0aWxpdGllcy9Eb2N1bWVudEV2ZW50cydcbmV4cG9ydCB7IGRlZmF1bHQgYXMgdXNlRGVib3VuY2UgfSBmcm9tICcuLi8uLi9hZG1pbi9ob29rcy91c2VEZWJvdW5jZSdcbmV4cG9ydCB7IHVzZURlYm91bmNlZENhbGxiYWNrIH0gZnJvbSAnLi4vLi4vYWRtaW4vaG9va3MvdXNlRGVib3VuY2VkQ2FsbGJhY2snXG5leHBvcnQgeyB1c2VEZWxheSB9IGZyb20gJy4uLy4uL2FkbWluL2hvb2tzL3VzZURlbGF5J1xuZXhwb3J0IHsgdXNlRGVsYXllZFJlbmRlciB9IGZyb20gJy4uLy4uL2FkbWluL2hvb2tzL3VzZURlbGF5ZWRSZW5kZXInXG5leHBvcnQgeyBkZWZhdWx0IGFzIHVzZUhvdGtleSB9IGZyb20gJy4uLy4uL2FkbWluL2hvb2tzL3VzZUhvdGtleSdcbmV4cG9ydCB7IGRlZmF1bHQgYXMgdXNlSW50ZXJzZWN0IH0gZnJvbSAnLi4vLi4vYWRtaW4vaG9va3MvdXNlSW50ZXJzZWN0J1xuZXhwb3J0IHsgZGVmYXVsdCBhcyB1c2VNb3VudEVmZmVjdCB9IGZyb20gJy4uLy4uL2FkbWluL2hvb2tzL3VzZU1vdW50RWZmZWN0J1xuZXhwb3J0IHsgZGVmYXVsdCBhcyB1c2VQYXlsb2FkQVBJIH0gZnJvbSAnLi4vLi4vYWRtaW4vaG9va3MvdXNlUGF5bG9hZEFQSSdcbmV4cG9ydCB7IGRlZmF1bHQgYXMgdXNlVGhyb3R0bGVkRWZmZWN0IH0gZnJvbSAnLi4vLi4vYWRtaW4vaG9va3MvdXNlVGhyb3R0bGVkRWZmZWN0J1xuZXhwb3J0IHsgZGVmYXVsdCBhcyB1c2VUaHVtYm5haWwgfSBmcm9tICcuLi8uLi9hZG1pbi9ob29rcy91c2VUaHVtYm5haWwnXG5leHBvcnQgeyBkZWZhdWx0IGFzIHVzZVRpdGxlLCBmb3JtYXRVc2VBc1RpdGxlIH0gZnJvbSAnLi4vLi4vYWRtaW4vaG9va3MvdXNlVGl0bGUnXG4iXSwibmFtZXMiOlsiZm9ybWF0VXNlQXNUaXRsZSIsInVzZURlYm91bmNlIiwidXNlRGVib3VuY2VkQ2FsbGJhY2siLCJ1c2VEZWxheSIsInVzZURlbGF5ZWRSZW5kZXIiLCJ1c2VEb2N1bWVudEV2ZW50cyIsInVzZUhvdGtleSIsInVzZUludGVyc2VjdCIsInVzZU1vdW50RWZmZWN0IiwidXNlUGF5bG9hZEFQSSIsInVzZVN0ZXBOYXYiLCJ1c2VUYWJsZUNvbHVtbnMiLCJ1c2VUaHJvdHRsZWRFZmZlY3QiLCJ1c2VUaHVtYm5haWwiLCJ1c2VUaXRsZSJdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7SUFhOEJBLGdCQUFnQjtlQUFoQkEsMEJBQWdCOztJQVYxQkMsV0FBVztlQUFYQSxvQkFBVzs7SUFDdEJDLG9CQUFvQjtlQUFwQkEsMENBQW9COztJQUNwQkMsUUFBUTtlQUFSQSxrQkFBUTs7SUFDUkMsZ0JBQWdCO2VBQWhCQSxrQ0FBZ0I7O0lBSmhCQyxpQkFBaUI7ZUFBakJBLGlDQUFpQjs7SUFLTkMsU0FBUztlQUFUQSxrQkFBUzs7SUFDVEMsWUFBWTtlQUFaQSxxQkFBWTs7SUFDWkMsY0FBYztlQUFkQSx1QkFBYzs7SUFDZEMsYUFBYTtlQUFiQSxzQkFBYTs7SUFWeEJDLFVBQVU7ZUFBVkEsbUJBQVU7O0lBQ1ZDLGVBQWU7ZUFBZkEsNkJBQWU7O0lBVUpDLGtCQUFrQjtlQUFsQkEsMkJBQWtCOztJQUNsQkMsWUFBWTtlQUFaQSxxQkFBWTs7SUFDWkMsUUFBUTtlQUFSQSxpQkFBUTs7O3lCQWJEOzhCQUNLO2dDQUNFO29FQUNLO3NDQUNGOzBCQUNaO2tDQUNRO2tFQUNJO3FFQUNHO3VFQUNFO3NFQUNEOzJFQUNLO3FFQUNOO2tFQUNjIn0=
|
||||
3
packages/payload/components/icons.d.ts
vendored
Normal file
3
packages/payload/components/icons.d.ts
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export { default as Chevron } from '../dist/admin/components/icons/Chevron';
|
||||
export { default as X } from '../dist/admin/components/icons/X';
|
||||
//# sourceMappingURL=icons.d.ts.map
|
||||
27
packages/payload/components/icons.js
Normal file
27
packages/payload/components/icons.js
Normal file
@@ -0,0 +1,27 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
Chevron: function() {
|
||||
return _Chevron.default;
|
||||
},
|
||||
X: function() {
|
||||
return _X.default;
|
||||
}
|
||||
});
|
||||
const _Chevron = /*#__PURE__*/ _interop_require_default(require("../dist/admin/components/icons/Chevron"));
|
||||
const _X = /*#__PURE__*/ _interop_require_default(require("../dist/admin/components/icons/X"));
|
||||
function _interop_require_default(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9leHBvcnRzL2NvbXBvbmVudHMvaWNvbnMudHMiXSwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IHsgZGVmYXVsdCBhcyBDaGV2cm9uIH0gZnJvbSAnLi4vLi4vYWRtaW4vY29tcG9uZW50cy9pY29ucy9DaGV2cm9uJ1xuZXhwb3J0IHsgZGVmYXVsdCBhcyBYIH0gZnJvbSAnLi4vLi4vYWRtaW4vY29tcG9uZW50cy9pY29ucy9YJ1xuIl0sIm5hbWVzIjpbIkNoZXZyb24iLCJYIl0sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7OztJQUFvQkEsT0FBTztlQUFQQSxnQkFBTzs7SUFDUEMsQ0FBQztlQUFEQSxVQUFDOzs7Z0VBRGM7MERBQ04ifQ==
|
||||
27
packages/payload/components/index.js
Normal file
27
packages/payload/components/index.js
Normal file
File diff suppressed because one or more lines are too long
2
packages/payload/components/preferences.d.ts
vendored
Normal file
2
packages/payload/components/preferences.d.ts
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export { usePreferences } from '../dist/admin/components/utilities/Preferences';
|
||||
//# sourceMappingURL=preferences.d.ts.map
|
||||
13
packages/payload/components/preferences.js
Normal file
13
packages/payload/components/preferences.js
Normal file
@@ -0,0 +1,13 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "usePreferences", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return _Preferences.usePreferences;
|
||||
}
|
||||
});
|
||||
const _Preferences = require("../dist/admin/components/utilities/Preferences");
|
||||
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9leHBvcnRzL2NvbXBvbmVudHMvcHJlZmVyZW5jZXMudHMiXSwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IHsgdXNlUHJlZmVyZW5jZXMgfSBmcm9tICcuLi8uLi9hZG1pbi9jb21wb25lbnRzL3V0aWxpdGllcy9QcmVmZXJlbmNlcydcbiJdLCJuYW1lcyI6WyJ1c2VQcmVmZXJlbmNlcyJdLCJtYXBwaW5ncyI6Ijs7OzsrQkFBU0E7OztlQUFBQSwyQkFBYzs7OzZCQUFRIn0=
|
||||
4
packages/payload/components/rich-text.d.ts
vendored
Normal file
4
packages/payload/components/rich-text.d.ts
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
export { default as ElementButton } from '../dist/admin/components/forms/field-types/RichText/elements/Button';
|
||||
export { default as toggleElement } from '../dist/admin/components/forms/field-types/RichText/elements/toggle';
|
||||
export { default as LeafButton } from '../dist/admin/components/forms/field-types/RichText/leaves/Button';
|
||||
//# sourceMappingURL=rich-text.d.ts.map
|
||||
31
packages/payload/components/rich-text.js
Normal file
31
packages/payload/components/rich-text.js
Normal file
@@ -0,0 +1,31 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
ElementButton: function() {
|
||||
return _Button.default;
|
||||
},
|
||||
toggleElement: function() {
|
||||
return _toggle.default;
|
||||
},
|
||||
LeafButton: function() {
|
||||
return _Button1.default;
|
||||
}
|
||||
});
|
||||
const _Button = /*#__PURE__*/ _interop_require_default(require("../dist/admin/components/forms/field-types/RichText/elements/Button"));
|
||||
const _toggle = /*#__PURE__*/ _interop_require_default(require("../dist/admin/components/forms/field-types/RichText/elements/toggle"));
|
||||
const _Button1 = /*#__PURE__*/ _interop_require_default(require("../dist/admin/components/forms/field-types/RichText/leaves/Button"));
|
||||
function _interop_require_default(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9leHBvcnRzL2NvbXBvbmVudHMvcmljaC10ZXh0LnRzIl0sInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCB7IGRlZmF1bHQgYXMgRWxlbWVudEJ1dHRvbiB9IGZyb20gJy4uLy4uL2FkbWluL2NvbXBvbmVudHMvZm9ybXMvZmllbGQtdHlwZXMvUmljaFRleHQvZWxlbWVudHMvQnV0dG9uJ1xuZXhwb3J0IHsgZGVmYXVsdCBhcyB0b2dnbGVFbGVtZW50IH0gZnJvbSAnLi4vLi4vYWRtaW4vY29tcG9uZW50cy9mb3Jtcy9maWVsZC10eXBlcy9SaWNoVGV4dC9lbGVtZW50cy90b2dnbGUnXG5leHBvcnQgeyBkZWZhdWx0IGFzIExlYWZCdXR0b24gfSBmcm9tICcuLi8uLi9hZG1pbi9jb21wb25lbnRzL2Zvcm1zL2ZpZWxkLXR5cGVzL1JpY2hUZXh0L2xlYXZlcy9CdXR0b24nXG4iXSwibmFtZXMiOlsiRWxlbWVudEJ1dHRvbiIsInRvZ2dsZUVsZW1lbnQiLCJMZWFmQnV0dG9uIl0sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7OztJQUFvQkEsYUFBYTtlQUFiQSxlQUFhOztJQUNiQyxhQUFhO2VBQWJBLGVBQWE7O0lBQ2JDLFVBQVU7ZUFBVkEsZ0JBQVU7OzsrREFGVzsrREFDQTtnRUFDSCJ9
|
||||
2
packages/payload/components/root.d.ts
vendored
Normal file
2
packages/payload/components/root.d.ts
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export { default as Root } from '../dist/admin/Root';
|
||||
//# sourceMappingURL=root.d.ts.map
|
||||
18
packages/payload/components/root.js
Normal file
18
packages/payload/components/root.js
Normal file
@@ -0,0 +1,18 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "Root", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return _Root.default;
|
||||
}
|
||||
});
|
||||
const _Root = /*#__PURE__*/ _interop_require_default(require("../dist/admin/Root"));
|
||||
function _interop_require_default(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9leHBvcnRzL2NvbXBvbmVudHMvcm9vdC50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgeyBkZWZhdWx0IGFzIFJvb3QgfSBmcm9tICcuLi8uLi9hZG1pbi9Sb290J1xuIl0sIm5hbWVzIjpbIlJvb3QiXSwibWFwcGluZ3MiOiI7Ozs7K0JBQW9CQTs7O2VBQUFBLGFBQUk7Ozs2REFBUSJ9
|
||||
1
packages/payload/components/styles.css
Normal file
1
packages/payload/components/styles.css
Normal file
File diff suppressed because one or more lines are too long
3
packages/payload/components/templates.d.ts
vendored
Normal file
3
packages/payload/components/templates.d.ts
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export { default as DefaultTemplate } from '../dist/admin/components/templates/Default';
|
||||
export { default as MinimalTemplate } from '../dist/admin/components/templates/Minimal';
|
||||
//# sourceMappingURL=templates.d.ts.map
|
||||
27
packages/payload/components/templates.js
Normal file
27
packages/payload/components/templates.js
Normal file
@@ -0,0 +1,27 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
DefaultTemplate: function() {
|
||||
return _Default.default;
|
||||
},
|
||||
MinimalTemplate: function() {
|
||||
return _Minimal.default;
|
||||
}
|
||||
});
|
||||
const _Default = /*#__PURE__*/ _interop_require_default(require("../dist/admin/components/templates/Default"));
|
||||
const _Minimal = /*#__PURE__*/ _interop_require_default(require("../dist/admin/components/templates/Minimal"));
|
||||
function _interop_require_default(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9leHBvcnRzL2NvbXBvbmVudHMvdGVtcGxhdGVzLnRzIl0sInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCB7IGRlZmF1bHQgYXMgRGVmYXVsdFRlbXBsYXRlIH0gZnJvbSAnLi4vLi4vYWRtaW4vY29tcG9uZW50cy90ZW1wbGF0ZXMvRGVmYXVsdCdcbmV4cG9ydCB7IGRlZmF1bHQgYXMgTWluaW1hbFRlbXBsYXRlIH0gZnJvbSAnLi4vLi4vYWRtaW4vY29tcG9uZW50cy90ZW1wbGF0ZXMvTWluaW1hbCdcbiJdLCJuYW1lcyI6WyJEZWZhdWx0VGVtcGxhdGUiLCJNaW5pbWFsVGVtcGxhdGUiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7O0lBQW9CQSxlQUFlO2VBQWZBLGdCQUFlOztJQUNmQyxlQUFlO2VBQWZBLGdCQUFlOzs7Z0VBRFE7Z0VBQ0EifQ==
|
||||
2
packages/payload/components/utilities.d.ts
vendored
Normal file
2
packages/payload/components/utilities.d.ts
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export {};
|
||||
//# sourceMappingURL=utilities.d.ts.map
|
||||
2
packages/payload/components/utilities.js
Normal file
2
packages/payload/components/utilities.js
Normal file
@@ -0,0 +1,2 @@
|
||||
|
||||
//# sourceMappingURL=utilities.js.map
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user