Merge branch 'feat/next-esm' of https://github.com/payloadcms/payload into feat/next-esm

This commit is contained in:
PatrikKozak
2024-03-06 15:05:28 -05:00
666 changed files with 2926 additions and 2821 deletions

View File

@@ -0,0 +1,17 @@
/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */
import config from '@payload-config'
/* DO NOT MODIFY IT BECAUSE IT COULD BE REWRITTEN AT ANY TIME. */
import { NotFoundView } from '@payloadcms/next/views/NotFound/index'
type Args = {
params: {
segments: string[]
}
searchParams: {
[key: string]: string | string[]
}
}
const NotFound = ({ params, searchParams }: Args) => NotFoundView({ config, params, searchParams })
export default NotFound

View File

@@ -1,6 +1,6 @@
{
"name": "payload-monorepo",
"version": "3.0.0-alpha.20",
"version": "3.0.0-alpha.22",
"private": true,
"type": "module",
"workspaces:": [

View File

@@ -1,6 +1,6 @@
{
"name": "@payloadcms/db-mongodb",
"version": "3.0.0-alpha.20",
"version": "3.0.0-alpha.22",
"description": "The officially supported MongoDB database adapter for Payload - Update 2",
"repository": "https://github.com/payloadcms/payload",
"license": "MIT",

View File

@@ -4,7 +4,7 @@ import type { Connect } from 'payload/database'
import mongoose from 'mongoose'
import type { MongooseAdapter } from '.'
import type { MongooseAdapter } from './index.d.ts'
export const connect: Connect = async function connect(
this: MongooseAdapter,

View File

@@ -1,10 +1,10 @@
import type { Create } from 'payload/database'
import type { Document, PayloadRequest } from 'payload/types'
import type { MongooseAdapter } from '.'
import type { MongooseAdapter } from './index.d.ts'
import handleError from './utilities/handleError'
import { withSession } from './withSession'
import handleError from './utilities/handleError.js'
import { withSession } from './withSession.js'
export const create: Create = async function create(
this: MongooseAdapter,

View File

@@ -1,10 +1,10 @@
import type { CreateGlobal } from 'payload/database'
import type { PayloadRequest } from 'payload/types'
import type { MongooseAdapter } from '.'
import type { MongooseAdapter } from './index.d.ts'
import sanitizeInternalFields from './utilities/sanitizeInternalFields'
import { withSession } from './withSession'
import sanitizeInternalFields from './utilities/sanitizeInternalFields.js'
import { withSession } from './withSession.js'
export const createGlobal: CreateGlobal = async function createGlobal(
this: MongooseAdapter,

View File

@@ -2,9 +2,9 @@ import type { CreateGlobalVersion } from 'payload/database'
import type { PayloadRequest } from 'payload/types'
import type { Document } from 'payload/types'
import type { MongooseAdapter } from '.'
import type { MongooseAdapter } from './index.d.ts'
import { withSession } from './withSession'
import { withSession } from './withSession.js'
export const createGlobalVersion: CreateGlobalVersion = async function createGlobalVersion(
this: MongooseAdapter,

View File

@@ -2,9 +2,9 @@ import type { CreateVersion } from 'payload/database'
import type { PayloadRequest } from 'payload/types'
import type { Document } from 'payload/types'
import type { MongooseAdapter } from '.'
import type { MongooseAdapter } from './index.d.ts'
import { withSession } from './withSession'
import { withSession } from './withSession.js'
export const createVersion: CreateVersion = async function createVersion(
this: MongooseAdapter,

View File

@@ -1,9 +1,9 @@
import type { DeleteMany } from 'payload/database'
import type { PayloadRequest } from 'payload/types'
import type { MongooseAdapter } from '.'
import type { MongooseAdapter } from './index.d.ts'
import { withSession } from './withSession'
import { withSession } from './withSession.js'
export const deleteMany: DeleteMany = async function deleteMany(
this: MongooseAdapter,

View File

@@ -2,10 +2,10 @@ import type { DeleteOne } from 'payload/database'
import type { PayloadRequest } from 'payload/types'
import type { Document } from 'payload/types'
import type { MongooseAdapter } from '.'
import type { MongooseAdapter } from './index.d.ts'
import sanitizeInternalFields from './utilities/sanitizeInternalFields'
import { withSession } from './withSession'
import sanitizeInternalFields from './utilities/sanitizeInternalFields.js'
import { withSession } from './withSession.js'
export const deleteOne: DeleteOne = async function deleteOne(
this: MongooseAdapter,

View File

@@ -1,9 +1,9 @@
import type { DeleteVersions } from 'payload/database'
import type { PayloadRequest } from 'payload/types'
import type { MongooseAdapter } from '.'
import type { MongooseAdapter } from './index.d.ts'
import { withSession } from './withSession'
import { withSession } from './withSession.js'
export const deleteVersions: DeleteVersions = async function deleteVersions(
this: MongooseAdapter,

View File

@@ -2,7 +2,7 @@ import type { Destroy } from 'payload/database'
import mongoose from 'mongoose'
import type { MongooseAdapter } from './index'
import type { MongooseAdapter } from './index.d.ts'
export const destroy: Destroy = async function destroy(this: MongooseAdapter) {
if (this.mongoMemoryServer) {

View File

@@ -4,11 +4,11 @@ import type { PayloadRequest } from 'payload/types'
import { flattenWhereToOperators } from 'payload/database'
import type { MongooseAdapter } from '.'
import type { MongooseAdapter } from './index.d.ts'
import { buildSortParam } from './queries/buildSortParam'
import sanitizeInternalFields from './utilities/sanitizeInternalFields'
import { withSession } from './withSession'
import { buildSortParam } from './queries/buildSortParam.js'
import sanitizeInternalFields from './utilities/sanitizeInternalFields.js'
import { withSession } from './withSession.js'
export const find: Find = async function find(
this: MongooseAdapter,

View File

@@ -3,10 +3,10 @@ import type { PayloadRequest } from 'payload/types'
import { combineQueries } from 'payload/database'
import type { MongooseAdapter } from '.'
import type { MongooseAdapter } from './index.d.ts'
import sanitizeInternalFields from './utilities/sanitizeInternalFields'
import { withSession } from './withSession'
import sanitizeInternalFields from './utilities/sanitizeInternalFields.js'
import { withSession } from './withSession.js'
export const findGlobal: FindGlobal = async function findGlobal(
this: MongooseAdapter,

View File

@@ -5,11 +5,11 @@ import type { PayloadRequest } from 'payload/types'
import { flattenWhereToOperators } from 'payload/database'
import { buildVersionGlobalFields } from 'payload/versions'
import type { MongooseAdapter } from '.'
import type { MongooseAdapter } from './index.d.ts'
import { buildSortParam } from './queries/buildSortParam'
import sanitizeInternalFields from './utilities/sanitizeInternalFields'
import { withSession } from './withSession'
import { buildSortParam } from './queries/buildSortParam.js'
import sanitizeInternalFields from './utilities/sanitizeInternalFields.js'
import { withSession } from './withSession.js'
export const findGlobalVersions: FindGlobalVersions = async function findGlobalVersions(
this: MongooseAdapter,

View File

@@ -3,10 +3,10 @@ import type { FindOne } from 'payload/database'
import type { PayloadRequest } from 'payload/types'
import type { Document } from 'payload/types'
import type { MongooseAdapter } from '.'
import type { MongooseAdapter } from './index.d.ts'
import sanitizeInternalFields from './utilities/sanitizeInternalFields'
import { withSession } from './withSession'
import sanitizeInternalFields from './utilities/sanitizeInternalFields.js'
import { withSession } from './withSession.js'
export const findOne: FindOne = async function findOne(
this: MongooseAdapter,

View File

@@ -4,11 +4,11 @@ import type { PayloadRequest } from 'payload/types'
import { flattenWhereToOperators } from 'payload/database'
import type { MongooseAdapter } from '.'
import type { MongooseAdapter } from './index.d.ts'
import { buildSortParam } from './queries/buildSortParam'
import sanitizeInternalFields from './utilities/sanitizeInternalFields'
import { withSession } from './withSession'
import { buildSortParam } from './queries/buildSortParam.js'
import sanitizeInternalFields from './utilities/sanitizeInternalFields.js'
import { withSession } from './withSession.js'
export const findVersions: FindVersions = async function findVersions(
this: MongooseAdapter,

View File

@@ -8,35 +8,35 @@ import mongoose from 'mongoose'
import path from 'path'
import { createDatabaseAdapter } from 'payload/database'
import type { CollectionModel, GlobalModel } from './types'
import type { CollectionModel, GlobalModel } from './types.d.ts'
import { connect } from './connect'
import { create } from './create'
import { createGlobal } from './createGlobal'
import { createGlobalVersion } from './createGlobalVersion'
import { createMigration } from './createMigration'
import { createVersion } from './createVersion'
import { deleteMany } from './deleteMany'
import { deleteOne } from './deleteOne'
import { deleteVersions } from './deleteVersions'
import { destroy } from './destroy'
import { find } from './find'
import { findGlobal } from './findGlobal'
import { findGlobalVersions } from './findGlobalVersions'
import { findOne } from './findOne'
import { findVersions } from './findVersions'
import { init } from './init'
import { migrateFresh } from './migrateFresh'
import { queryDrafts } from './queryDrafts'
import { beginTransaction } from './transactions/beginTransaction'
import { commitTransaction } from './transactions/commitTransaction'
import { rollbackTransaction } from './transactions/rollbackTransaction'
import { updateGlobal } from './updateGlobal'
import { updateGlobalVersion } from './updateGlobalVersion'
import { updateOne } from './updateOne'
import { updateVersion } from './updateVersion'
import { connect } from './connect.js'
import { create } from './create.js'
import { createGlobal } from './createGlobal.js'
import { createGlobalVersion } from './createGlobalVersion.js'
import { createMigration } from './createMigration.js'
import { createVersion } from './createVersion.js'
import { deleteMany } from './deleteMany.js'
import { deleteOne } from './deleteOne.js'
import { deleteVersions } from './deleteVersions.js'
import { destroy } from './destroy.js'
import { find } from './find.js'
import { findGlobal } from './findGlobal.js'
import { findGlobalVersions } from './findGlobalVersions.js'
import { findOne } from './findOne.js'
import { findVersions } from './findVersions.js'
import { init } from './init.js'
import { migrateFresh } from './migrateFresh.js'
import { queryDrafts } from './queryDrafts.js'
import { beginTransaction } from './transactions/beginTransaction.js'
import { commitTransaction } from './transactions/commitTransaction.js'
import { rollbackTransaction } from './transactions/rollbackTransaction.js'
import { updateGlobal } from './updateGlobal.js'
import { updateGlobalVersion } from './updateGlobalVersion.js'
import { updateOne } from './updateOne.js'
import { updateVersion } from './updateVersion.js'
export type { MigrateDownArgs, MigrateUpArgs } from './types'
export type { MigrateDownArgs, MigrateUpArgs } from './types.d.ts'
import type { DatabaseAdapterObj } from 'payload/database'
export interface Args {

View File

@@ -11,13 +11,13 @@ import {
getVersionsModelName,
} from 'payload/versions'
import type { MongooseAdapter } from '.'
import type { CollectionModel } from './types'
import type { MongooseAdapter } from './index.d.ts'
import type { CollectionModel } from './types.d.ts'
import buildCollectionSchema from './models/buildCollectionSchema'
import { buildGlobalModel } from './models/buildGlobalModel'
import buildSchema from './models/buildSchema'
import getBuildQueryPlugin from './queries/buildQuery'
import buildCollectionSchema from './models/buildCollectionSchema.js'
import { buildGlobalModel } from './models/buildGlobalModel.js'
import buildSchema from './models/buildSchema.js'
import getBuildQueryPlugin from './queries/buildQuery.js'
export const init: Init = function init(this: MongooseAdapter) {
this.payload.config.collections.forEach((collection: SanitizedCollectionConfig) => {

View File

@@ -8,7 +8,7 @@ import {
} from 'payload/database'
import prompts from 'prompts'
import type { MongooseAdapter } from '.'
import type { MongooseAdapter } from './index.d.ts'
/**
* Drop the current database and run all migrate up functions

View File

@@ -4,8 +4,8 @@ import type { SanitizedCollectionConfig } from 'payload/types'
import paginate from 'mongoose-paginate-v2'
import getBuildQueryPlugin from '../queries/buildQuery'
import buildSchema from './buildSchema'
import getBuildQueryPlugin from '../queries/buildQuery.js'
import buildSchema from './buildSchema.js'
const buildCollectionSchema = (
collection: SanitizedCollectionConfig,

View File

@@ -2,10 +2,10 @@ import type { SanitizedConfig } from 'payload/config'
import mongoose from 'mongoose'
import type { GlobalModel } from '../types'
import type { GlobalModel } from '../types.d.ts'
import getBuildQueryPlugin from '../queries/buildQuery'
import buildSchema from './buildSchema'
import getBuildQueryPlugin from '../queries/buildQuery.js'
import buildSchema from './buildSchema.js'
export const buildGlobalModel = (config: SanitizedConfig): GlobalModel | null => {
if (config.globals && config.globals.length > 0) {

View File

@@ -1,7 +1,7 @@
import type { Payload } from 'payload'
import type { Field, Where } from 'payload/types'
import { parseParams } from './parseParams'
import { parseParams } from './parseParams.js'
export async function buildAndOrConditions({
collectionSlug,

View File

@@ -3,7 +3,7 @@ import type { Field, Where } from 'payload/types'
import { QueryError } from 'payload/errors'
import { parseParams } from './parseParams'
import { parseParams } from './parseParams.js'
type GetBuildQueryPluginArgs = {
collectionSlug?: string

View File

@@ -9,10 +9,10 @@ import { getLocalizedPaths } from 'payload/database'
import { fieldAffectsData } from 'payload/types'
import { validOperators } from 'payload/types'
import type { MongooseAdapter } from '..'
import type { MongooseAdapter } from '../index.d.ts'
import { operatorMap } from './operatorMap'
import { sanitizeQueryValue } from './sanitizeQueryValue'
import { operatorMap } from './operatorMap.js'
import { sanitizeQueryValue } from './sanitizeQueryValue.js'
type SearchParam = {
path?: string
@@ -204,7 +204,9 @@ export async function buildSearchParam({
if (typeof formattedValue === 'string') {
if (mongoose.Types.ObjectId.isValid(formattedValue)) {
result.value.$or.push({ [path]: { [operatorKey]: new ObjectId(formattedValue) } })
result.value.$or.push({
[path]: { [operatorKey]: new ObjectId.default(formattedValue) },
})
} else {
;(Array.isArray(field.relationTo) ? field.relationTo : [field.relationTo]).forEach(
(relationTo) => {

View File

@@ -2,7 +2,7 @@ import type { PaginateOptions } from 'mongoose'
import type { SanitizedConfig } from 'payload/config'
import type { Field } from 'payload/types'
import { getLocalizedSortProperty } from './getLocalizedSortProperty'
import { getLocalizedSortProperty } from './getLocalizedSortProperty.js'
type Args = {
config: SanitizedConfig

View File

@@ -1,6 +1,6 @@
import { sanitizeConfig } from 'payload/config'
import { Config } from 'payload/config'
import { getLocalizedSortProperty } from './getLocalizedSortProperty'
import { getLocalizedSortProperty } from './getLocalizedSortProperty.js'
const config = {
localization: {

View File

@@ -9,8 +9,8 @@ import deepmerge from 'deepmerge'
import { validOperators } from 'payload/types'
import { combineMerge } from 'payload/utilities'
import { buildAndOrConditions } from './buildAndOrConditions'
import { buildSearchParam } from './buildSearchParams'
import { buildAndOrConditions } from './buildAndOrConditions.js'
import { buildSearchParam } from './buildSearchParams.js'
export async function parseParams({
collectionSlug,

View File

@@ -4,11 +4,11 @@ import type { PayloadRequest } from 'payload/types'
import { combineQueries, flattenWhereToOperators } from 'payload/database'
import type { MongooseAdapter } from '.'
import type { MongooseAdapter } from './index.d.ts'
import { buildSortParam } from './queries/buildSortParam'
import sanitizeInternalFields from './utilities/sanitizeInternalFields'
import { withSession } from './withSession'
import { buildSortParam } from './queries/buildSortParam.js'
import sanitizeInternalFields from './utilities/sanitizeInternalFields.js'
import { withSession } from './withSession.js'
export const queryDrafts: QueryDrafts = async function queryDrafts(
this: MongooseAdapter,

View File

@@ -4,7 +4,7 @@ import type { BeginTransaction } from 'payload/database'
import { APIError } from 'payload/errors'
import { v4 as uuid } from 'uuid'
import type { MongooseAdapter } from '../index'
import type { MongooseAdapter } from '../index.d.ts'
export const beginTransaction: BeginTransaction = async function beginTransaction(
this: MongooseAdapter,

View File

@@ -25,7 +25,7 @@ import type {
UploadField,
} from 'payload/types'
import type { BuildQueryArgs } from './queries/buildQuery'
import type { BuildQueryArgs } from './queries/buildQuery.d.ts'
export interface CollectionModel extends Model<any>, PaginateModel<any> {
/** buildQuery is used to transform payload's where operator into what can be used by mongoose (e.g. id => _id) */

View File

@@ -1,10 +1,10 @@
import type { UpdateGlobal } from 'payload/database'
import type { PayloadRequest } from 'payload/types'
import type { MongooseAdapter } from '.'
import type { MongooseAdapter } from './index.d.ts'
import sanitizeInternalFields from './utilities/sanitizeInternalFields'
import { withSession } from './withSession'
import sanitizeInternalFields from './utilities/sanitizeInternalFields.js'
import { withSession } from './withSession.js'
export const updateGlobal: UpdateGlobal = async function updateGlobal(
this: MongooseAdapter,

View File

@@ -1,9 +1,9 @@
import type { UpdateGlobalVersionArgs } from 'payload/database'
import type { PayloadRequest, TypeWithID } from 'payload/types'
import type { MongooseAdapter } from '.'
import type { MongooseAdapter } from './index.d.ts'
import { withSession } from './withSession'
import { withSession } from './withSession.js'
export async function updateGlobalVersion<T extends TypeWithID>(
this: MongooseAdapter,

View File

@@ -1,11 +1,11 @@
import type { UpdateOne } from 'payload/database'
import type { PayloadRequest } from 'payload/types'
import type { MongooseAdapter } from '.'
import type { MongooseAdapter } from './index.d.ts'
import handleError from './utilities/handleError'
import sanitizeInternalFields from './utilities/sanitizeInternalFields'
import { withSession } from './withSession'
import handleError from './utilities/handleError.js'
import sanitizeInternalFields from './utilities/sanitizeInternalFields.js'
import { withSession } from './withSession.js'
export const updateOne: UpdateOne = async function updateOne(
this: MongooseAdapter,

View File

@@ -1,9 +1,9 @@
import type { UpdateVersion } from 'payload/database'
import type { PayloadRequest } from 'payload/types'
import type { MongooseAdapter } from '.'
import type { MongooseAdapter } from './index.d.ts'
import { withSession } from './withSession'
import { withSession } from './withSession.js'
export const updateVersion: UpdateVersion = async function updateVersion(
this: MongooseAdapter,

View File

@@ -1,6 +1,6 @@
import type { ClientSession } from 'mongoose'
import type { MongooseAdapter } from './index'
import type { MongooseAdapter } from './index.d.ts'
/**
* returns the session belonging to the transaction of the req.session if exists

View File

@@ -1,6 +1,6 @@
{
"name": "@payloadcms/db-postgres",
"version": "3.0.0-alpha.20",
"version": "3.0.0-alpha.22",
"description": "The officially supported Postgres database adapter for Payload",
"repository": "https://github.com/payloadcms/payload",
"license": "MIT",

View File

@@ -7,7 +7,7 @@ import { numeric, timestamp, varchar } from 'drizzle-orm/pg-core'
import { Pool } from 'pg'
import prompts from 'prompts'
import type { PostgresAdapter } from './types'
import type { PostgresAdapter } from './types.d.ts'
const connectWithReconnect = async function ({
adapter,

View File

@@ -2,9 +2,9 @@ import type { Create } from 'payload/database'
import toSnakeCase from 'to-snake-case'
import type { PostgresAdapter } from './types'
import type { PostgresAdapter } from './types.d.ts'
import { upsertRow } from './upsertRow'
import { upsertRow } from './upsertRow/index.js'
export const create: Create = async function create(
this: PostgresAdapter,

View File

@@ -3,9 +3,9 @@ import type { PayloadRequest, TypeWithID } from 'payload/types'
import toSnakeCase from 'to-snake-case'
import type { PostgresAdapter } from './types'
import type { PostgresAdapter } from './types.d.ts'
import { upsertRow } from './upsertRow'
import { upsertRow } from './upsertRow/index.js'
export async function createGlobal<T extends TypeWithID>(
this: PostgresAdapter,

View File

@@ -6,9 +6,9 @@ import { sql } from 'drizzle-orm'
import { buildVersionGlobalFields } from 'payload/versions'
import toSnakeCase from 'to-snake-case'
import type { PostgresAdapter } from './types'
import type { PostgresAdapter } from './types.d.ts'
import { upsertRow } from './upsertRow'
import { upsertRow } from './upsertRow/index.js'
export async function createGlobalVersion<T extends TypeWithID>(
this: PostgresAdapter,

View File

@@ -5,7 +5,7 @@ import type { CreateMigration } from 'payload/database'
import fs from 'fs'
import prompts from 'prompts'
import type { PostgresAdapter } from './types'
import type { PostgresAdapter } from './types.d.ts'
const migrationTemplate = (
upSQL?: string,

View File

@@ -5,9 +5,9 @@ import { sql } from 'drizzle-orm'
import { buildVersionCollectionFields } from 'payload/versions'
import toSnakeCase from 'to-snake-case'
import type { PostgresAdapter } from './types'
import type { PostgresAdapter } from './types.d.ts'
import { upsertRow } from './upsertRow'
import { upsertRow } from './upsertRow/index.js'
export async function createVersion<T extends TypeWithID>(
this: PostgresAdapter,

View File

@@ -4,9 +4,9 @@ import type { PayloadRequest } from 'payload/types'
import { inArray } from 'drizzle-orm'
import toSnakeCase from 'to-snake-case'
import type { PostgresAdapter } from './types'
import type { PostgresAdapter } from './types.d.ts'
import { findMany } from './find/findMany'
import { findMany } from './find/findMany.js'
export const deleteMany: DeleteMany = async function deleteMany(
this: PostgresAdapter,

View File

@@ -3,11 +3,11 @@ import type { PayloadRequest } from 'payload/types'
import toSnakeCase from 'to-snake-case'
import type { PostgresAdapter } from './types'
import type { PostgresAdapter } from './types.d.ts'
import { buildFindManyArgs } from './find/buildFindManyArgs'
import buildQuery from './queries/buildQuery'
import { transform } from './transform/read'
import { buildFindManyArgs } from './find/buildFindManyArgs.js'
import buildQuery from './queries/buildQuery.js'
import { transform } from './transform/read/index.js'
export const deleteOne: DeleteOne = async function deleteOne(
this: PostgresAdapter,

View File

@@ -5,9 +5,9 @@ import { inArray } from 'drizzle-orm'
import { buildVersionCollectionFields } from 'payload/versions'
import toSnakeCase from 'to-snake-case'
import type { PostgresAdapter } from './types'
import type { PostgresAdapter } from './types.d.ts'
import { findMany } from './find/findMany'
import { findMany } from './find/findMany.js'
export const deleteVersions: DeleteVersions = async function deleteVersion(
this: PostgresAdapter,

View File

@@ -1,6 +1,6 @@
import type { Destroy } from 'payload/database'
import type { PostgresAdapter } from './types'
import type { PostgresAdapter } from './types.d.ts'
export const destroy: Destroy = async function destroy(this: PostgresAdapter) {
// TODO: this hangs test suite for some reason

View File

@@ -3,9 +3,9 @@ import type { PayloadRequest, SanitizedCollectionConfig } from 'payload/types'
import toSnakeCase from 'to-snake-case'
import type { PostgresAdapter } from './types'
import type { PostgresAdapter } from './types.d.ts'
import { findMany } from './find/findMany'
import { findMany } from './find/findMany.js'
export const find: Find = async function find(
this: PostgresAdapter,

View File

@@ -1,9 +1,9 @@
import type { DBQueryConfig } from 'drizzle-orm'
import type { Field } from 'payload/types'
import type { PostgresAdapter } from '../types'
import type { PostgresAdapter } from '../types.d.ts'
import { traverseFields } from './traverseFields'
import { traverseFields } from './traverseFields.js'
type BuildFindQueryArgs = {
adapter: PostgresAdapter

View File

@@ -3,13 +3,13 @@ import type { Field, PayloadRequest, TypeWithID } from 'payload/types'
import { inArray, sql } from 'drizzle-orm'
import type { PostgresAdapter } from '../types'
import type { ChainedMethods } from './chainMethods'
import type { PostgresAdapter } from '../types.d.ts'
import type { ChainedMethods } from './chainMethods.d.ts'
import buildQuery from '../queries/buildQuery'
import { transform } from '../transform/read'
import { buildFindManyArgs } from './buildFindManyArgs'
import { chainMethods } from './chainMethods'
import buildQuery from '../queries/buildQuery.js'
import { transform } from '../transform/read/index.js'
import { buildFindManyArgs } from './buildFindManyArgs.js'
import { chainMethods } from './chainMethods.js'
type Args = Omit<FindArgs, 'collection'> & {
adapter: PostgresAdapter

View File

@@ -4,8 +4,8 @@ import type { Field } from 'payload/types'
import { fieldAffectsData, tabHasName } from 'payload/types'
import toSnakeCase from 'to-snake-case'
import type { PostgresAdapter } from '../types'
import type { Result } from './buildFindManyArgs'
import type { PostgresAdapter } from '../types.d.ts'
import type { Result } from './buildFindManyArgs.d.ts'
type TraverseFieldArgs = {
_locales: Record<string, unknown>

View File

@@ -2,9 +2,9 @@ import type { FindGlobal } from 'payload/database'
import toSnakeCase from 'to-snake-case'
import type { PostgresAdapter } from './types'
import type { PostgresAdapter } from './types.d.ts'
import { findMany } from './find/findMany'
import { findMany } from './find/findMany.js'
export const findGlobal: FindGlobal = async function findGlobal(
this: PostgresAdapter,

View File

@@ -4,9 +4,9 @@ import type { PayloadRequest, SanitizedGlobalConfig } from 'payload/types'
import { buildVersionGlobalFields } from 'payload/versions'
import toSnakeCase from 'to-snake-case'
import type { PostgresAdapter } from './types'
import type { PostgresAdapter } from './types.d.ts'
import { findMany } from './find/findMany'
import { findMany } from './find/findMany.js'
export const findGlobalVersions: FindGlobalVersions = async function findGlobalVersions(
this: PostgresAdapter,

View File

@@ -3,9 +3,9 @@ import type { PayloadRequest, SanitizedCollectionConfig, TypeWithID } from 'payl
import toSnakeCase from 'to-snake-case'
import type { PostgresAdapter } from './types'
import type { PostgresAdapter } from './types.d.ts'
import { findMany } from './find/findMany'
import { findMany } from './find/findMany.js'
export async function findOne<T extends TypeWithID>(
this: PostgresAdapter,

View File

@@ -4,9 +4,9 @@ import type { PayloadRequest, SanitizedCollectionConfig } from 'payload/types'
import { buildVersionCollectionFields } from 'payload/versions'
import toSnakeCase from 'to-snake-case'
import type { PostgresAdapter } from './types'
import type { PostgresAdapter } from './types.d.ts'
import { findMany } from './find/findMany'
import { findMany } from './find/findMany.js'
export const findVersions: FindVersions = async function findVersions(
this: PostgresAdapter,

View File

@@ -5,40 +5,40 @@ import fs from 'fs'
import path from 'path'
import { createDatabaseAdapter } from 'payload/database'
import type { Args, PostgresAdapter } from './types'
import type { Args, PostgresAdapter } from './types.d.ts'
import { connect } from './connect'
import { create } from './create'
import { createGlobal } from './createGlobal'
import { createGlobalVersion } from './createGlobalVersion'
import { createMigration } from './createMigration'
import { createVersion } from './createVersion'
import { deleteMany } from './deleteMany'
import { deleteOne } from './deleteOne'
import { deleteVersions } from './deleteVersions'
import { destroy } from './destroy'
import { find } from './find'
import { findGlobal } from './findGlobal'
import { findGlobalVersions } from './findGlobalVersions'
import { findOne } from './findOne'
import { findVersions } from './findVersions'
import { init } from './init'
import { migrate } from './migrate'
import { migrateDown } from './migrateDown'
import { migrateFresh } from './migrateFresh'
import { migrateRefresh } from './migrateRefresh'
import { migrateReset } from './migrateReset'
import { migrateStatus } from './migrateStatus'
import { queryDrafts } from './queryDrafts'
import { beginTransaction } from './transactions/beginTransaction'
import { commitTransaction } from './transactions/commitTransaction'
import { rollbackTransaction } from './transactions/rollbackTransaction'
import { updateOne } from './update'
import { updateGlobal } from './updateGlobal'
import { updateGlobalVersion } from './updateGlobalVersion'
import { updateVersion } from './updateVersion'
import { connect } from './connect.js'
import { create } from './create.js'
import { createGlobal } from './createGlobal.js'
import { createGlobalVersion } from './createGlobalVersion.js'
import { createMigration } from './createMigration.js'
import { createVersion } from './createVersion.js'
import { deleteMany } from './deleteMany.js'
import { deleteOne } from './deleteOne.js'
import { deleteVersions } from './deleteVersions.js'
import { destroy } from './destroy.js'
import { find } from './find.js'
import { findGlobal } from './findGlobal.js'
import { findGlobalVersions } from './findGlobalVersions.js'
import { findOne } from './findOne.js'
import { findVersions } from './findVersions.js'
import { init } from './init.js'
import { migrate } from './migrate.js'
import { migrateDown } from './migrateDown.js'
import { migrateFresh } from './migrateFresh.js'
import { migrateRefresh } from './migrateRefresh.js'
import { migrateReset } from './migrateReset.js'
import { migrateStatus } from './migrateStatus.js'
import { queryDrafts } from './queryDrafts.js'
import { beginTransaction } from './transactions/beginTransaction.js'
import { commitTransaction } from './transactions/commitTransaction.js'
import { rollbackTransaction } from './transactions/rollbackTransaction.js'
import { updateOne } from './update.js'
import { updateGlobal } from './updateGlobal.js'
import { updateGlobalVersion } from './updateGlobalVersion.js'
import { updateVersion } from './updateVersion.js'
export type { MigrateDownArgs, MigrateUpArgs } from './types'
export type { MigrateDownArgs, MigrateUpArgs } from './types.d.ts'
export function postgresAdapter(args: Args): DatabaseAdapterObj<PostgresAdapter> {
function adapter({ payload }: { payload: Payload }) {

View File

@@ -6,9 +6,9 @@ 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'
import type { PostgresAdapter } from './types.d.ts'
import { buildTable } from './schema/build'
import { buildTable } from './schema/build.js'
export const init: Init = async function init(this: PostgresAdapter) {
if (this.schemaName) {

View File

@@ -11,11 +11,11 @@ import {
} from 'payload/database'
import prompts from 'prompts'
import type { PostgresAdapter } from './types'
import type { PostgresAdapter } from './types.d.ts'
import { createMigrationTable } from './utilities/createMigrationTable'
import { migrationTableExists } from './utilities/migrationTableExists'
import { parseError } from './utilities/parseError'
import { createMigrationTable } from './utilities/createMigrationTable.js'
import { migrationTableExists } from './utilities/migrationTableExists.js'
import { parseError } from './utilities/parseError.js'
export async function migrate(this: PostgresAdapter): Promise<void> {
const { payload } = this

View File

@@ -9,10 +9,10 @@ import {
readMigrationFiles,
} from 'payload/database'
import type { PostgresAdapter } from './types'
import type { PostgresAdapter } from './types.d.ts'
import { migrationTableExists } from './utilities/migrationTableExists'
import { parseError } from './utilities/parseError'
import { migrationTableExists } from './utilities/migrationTableExists.js'
import { parseError } from './utilities/parseError.js'
export async function migrateDown(this: PostgresAdapter): Promise<void> {
const { payload } = this

View File

@@ -9,9 +9,9 @@ import {
} from 'payload/database'
import prompts from 'prompts'
import type { PostgresAdapter } from './types'
import type { PostgresAdapter } from './types.d.ts'
import { parseError } from './utilities/parseError'
import { parseError } from './utilities/parseError.js'
/**
* Drop the current database and run all migrate up functions

View File

@@ -9,10 +9,10 @@ import {
readMigrationFiles,
} from 'payload/database'
import type { PostgresAdapter } from './types'
import type { PostgresAdapter } from './types.d.ts'
import { migrationTableExists } from './utilities/migrationTableExists'
import { parseError } from './utilities/parseError'
import { migrationTableExists } from './utilities/migrationTableExists.js'
import { parseError } from './utilities/parseError.js'
/**
* Run all migration down functions before running up

View File

@@ -9,9 +9,9 @@ import {
readMigrationFiles,
} from 'payload/database'
import type { PostgresAdapter } from './types'
import type { PostgresAdapter } from './types.d.ts'
import { migrationTableExists } from './utilities/migrationTableExists'
import { migrationTableExists } from './utilities/migrationTableExists.js'
/**
* Run all migrate down functions

View File

@@ -1,9 +1,9 @@
import { Table } from 'console-table-printer'
import { getMigrations, readMigrationFiles } from 'payload/database'
import type { PostgresAdapter } from './types'
import type { PostgresAdapter } from './types.d.ts'
import { migrationTableExists } from './utilities/migrationTableExists'
import { migrationTableExists } from './utilities/migrationTableExists.js'
export async function migrateStatus(this: PostgresAdapter): Promise<void> {
const { payload } = this

View File

@@ -1,10 +1,10 @@
import type { SQL } from 'drizzle-orm'
import type { Field, Where } from 'payload/types'
import type { GenericColumn, PostgresAdapter } from '../types'
import type { BuildQueryJoinAliases, BuildQueryJoins } from './buildQuery'
import type { GenericColumn, PostgresAdapter } from '../types.d.ts'
import type { BuildQueryJoinAliases, BuildQueryJoins } from './buildQuery.d.ts'
import { parseParams } from './parseParams'
import { parseParams } from './parseParams.js'
export async function buildAndOrConditions({
adapter,

View File

@@ -4,10 +4,10 @@ import type { Field, Where } from 'payload/types'
import { asc, desc } from 'drizzle-orm'
import type { GenericColumn, GenericTable, PostgresAdapter } from '../types'
import type { GenericColumn, GenericTable, PostgresAdapter } from '../types.d.ts'
import { getTableColumnFromPath } from './getTableColumnFromPath'
import { parseParams } from './parseParams'
import { getTableColumnFromPath } from './getTableColumnFromPath.js'
import { parseParams } from './parseParams.js'
export type BuildQueryJoins = Record<string, SQL>

View File

@@ -1,4 +1,4 @@
import { formatJSONPathSegment } from './formatJSONPathSegment'
import { formatJSONPathSegment } from './formatJSONPathSegment.js'
export const convertPathToJSONTraversal = (incomingSegments: string[]) => {
const segments = [...incomingSegments]

View File

@@ -1,5 +1,5 @@
import { convertPathToJSONTraversal } from './convertPathToJSONTraversal'
import { formatJSONPathSegment } from './formatJSONPathSegment'
import { convertPathToJSONTraversal } from './convertPathToJSONTraversal.js'
import { formatJSONPathSegment } from './formatJSONPathSegment.js'
const operatorMap = {
contains: '~*',

View File

@@ -11,8 +11,8 @@ import { flattenTopLevelFields } from 'payload/utilities'
import toSnakeCase from 'to-snake-case'
import { v4 as uuid } from 'uuid'
import type { GenericColumn, GenericTable, PostgresAdapter } from '../types'
import type { BuildQueryJoinAliases, BuildQueryJoins } from './buildQuery'
import type { GenericColumn, GenericTable, PostgresAdapter } from '../types.d.ts'
import type { BuildQueryJoinAliases, BuildQueryJoins } from './buildQuery.d.ts'
type Constraint = {
columnName: string

View File

@@ -6,15 +6,15 @@ import { and, ilike, isNotNull, isNull, ne, notInArray, or, sql } from 'drizzle-
import { QueryError } from 'payload/errors'
import { validOperators } from 'payload/types'
import type { GenericColumn, PostgresAdapter } from '../types'
import type { BuildQueryJoinAliases, BuildQueryJoins } from './buildQuery'
import type { GenericColumn, PostgresAdapter } from '../types.d.ts'
import type { BuildQueryJoinAliases, BuildQueryJoins } from './buildQuery.d.ts'
import { buildAndOrConditions } from './buildAndOrConditions'
import { createJSONQuery } from './createJSONQuery'
import { convertPathToJSONTraversal } from './createJSONQuery/convertPathToJSONTraversal'
import { getTableColumnFromPath } from './getTableColumnFromPath'
import { operatorMap } from './operatorMap'
import { sanitizeQueryValue } from './sanitizeQueryValue'
import { buildAndOrConditions } from './buildAndOrConditions.js'
import { createJSONQuery } from './createJSONQuery/index.js'
import { convertPathToJSONTraversal } from './createJSONQuery/convertPathToJSONTraversal.js'
import { getTableColumnFromPath } from './getTableColumnFromPath.js'
import { operatorMap } from './operatorMap.js'
import { sanitizeQueryValue } from './sanitizeQueryValue.js'
type Args = {
adapter: PostgresAdapter

View File

@@ -2,7 +2,7 @@ import { APIError } from 'payload/errors'
import { type Field, type TabAsField, fieldAffectsData } from 'payload/types'
import { createArrayFromCommaDelineated } from 'payload/utilities'
import type { PostgresAdapter } from '../types'
import type { PostgresAdapter } from '../types.d.ts'
type SanitizeQueryValueArgs = {
adapter: PostgresAdapter

View File

@@ -4,7 +4,7 @@ import { type QueryDrafts, combineQueries } from 'payload/database'
import { buildVersionCollectionFields } from 'payload/versions'
import toSnakeCase from 'to-snake-case'
import { findMany } from './find/findMany'
import { findMany } from './find/findMany.js'
export const queryDrafts: QueryDrafts = async function queryDrafts({
collection,

View File

@@ -13,11 +13,11 @@ import { index, integer, numeric, serial, timestamp, unique, varchar } from 'dri
import { fieldAffectsData } from 'payload/types'
import toSnakeCase from 'to-snake-case'
import type { GenericColumns, GenericTable, IDType, PostgresAdapter } from '../types'
import type { GenericColumns, GenericTable, IDType, PostgresAdapter } from '../types.d.ts'
import { parentIDColumnMap } from './parentIDColumnMap'
import { setColumnID } from './setColumnID'
import { traverseFields } from './traverseFields'
import { parentIDColumnMap } from './parentIDColumnMap.js'
import { setColumnID } from './setColumnID.js'
import { traverseFields } from './traverseFields.js'
type Args = {
adapter: PostgresAdapter

View File

@@ -1,7 +1,7 @@
/* eslint-disable no-param-reassign */
import { index, uniqueIndex } from 'drizzle-orm/pg-core'
import type { GenericColumn } from '../types'
import type { GenericColumn } from '../types.d.ts'
type CreateIndexArgs = {
columnName: string

View File

@@ -1,6 +1,6 @@
import { integer, numeric, uuid, varchar } from 'drizzle-orm/pg-core'
import type { IDType } from '../types'
import type { IDType } from '../types.d.ts'
export const parentIDColumnMap: Record<
IDType,

View File

@@ -4,7 +4,7 @@ import { numeric, serial, uuid, varchar } from 'drizzle-orm/pg-core'
import { type Field, fieldAffectsData } from 'payload/types'
import { flattenTopLevelFields } from 'payload/utilities'
import type { IDType, PostgresAdapter } from '../types'
import type { IDType, PostgresAdapter } from '../types.d.ts'
type Args = { adapter: PostgresAdapter; columns: Record<string, PgColumnBuilder>; fields: Field[] }
export const setColumnID = ({ adapter, columns, fields }: Args): IDType => {

View File

@@ -22,14 +22,14 @@ import { InvalidConfiguration } from 'payload/errors'
import { fieldAffectsData, optionIsObject } from 'payload/types'
import toSnakeCase from 'to-snake-case'
import type { GenericColumns, IDType, PostgresAdapter } from '../types'
import type { GenericColumns, IDType, PostgresAdapter } from '../types.d.ts'
import { hasLocalesTable } from '../utilities/hasLocalesTable'
import { buildTable } from './build'
import { createIndex } from './createIndex'
import { idToUUID } from './idToUUID'
import { parentIDColumnMap } from './parentIDColumnMap'
import { validateExistingBlockIsIdentical } from './validateExistingBlockIsIdentical'
import { hasLocalesTable } from '../utilities/hasLocalesTable.js'
import { buildTable } from './build.js'
import { createIndex } from './createIndex.js'
import { idToUUID } from './idToUUID.js'
import { parentIDColumnMap } from './parentIDColumnMap.js'
import { validateExistingBlockIsIdentical } from './validateExistingBlockIsIdentical.js'
type Args = {
adapter: PostgresAdapter

View File

@@ -3,7 +3,7 @@ import type { Block, Field } from 'payload/types'
import { InvalidConfiguration } from 'payload/errors'
import { fieldAffectsData, fieldHasSubFields, tabHasName } from 'payload/types'
import type { GenericTable } from '../types'
import type { GenericTable } from '../types.d.ts'
type Args = {
block: Block

Some files were not shown because too many files have changed in this diff Show More