chore: updates db-postgres imports for ESM
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
import type { Payload } from 'payload'
|
import type { Payload } from 'payload'
|
||||||
import type { Field, Where } from 'payload/types'
|
import type { Field, Where } from 'payload/types'
|
||||||
|
|
||||||
import { parseParams } from './parseParams'
|
import { parseParams } from './parseParams.js'
|
||||||
|
|
||||||
export async function buildAndOrConditions({
|
export async function buildAndOrConditions({
|
||||||
collectionSlug,
|
collectionSlug,
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { numeric, timestamp, varchar } from 'drizzle-orm/pg-core'
|
|||||||
import { Pool } from 'pg'
|
import { Pool } from 'pg'
|
||||||
import prompts from 'prompts'
|
import prompts from 'prompts'
|
||||||
|
|
||||||
import type { PostgresAdapter } from './types'
|
import type { PostgresAdapter } from './types.d.ts'
|
||||||
|
|
||||||
const connectWithReconnect = async function ({
|
const connectWithReconnect = async function ({
|
||||||
adapter,
|
adapter,
|
||||||
|
|||||||
@@ -2,9 +2,9 @@ import type { Create } from 'payload/database'
|
|||||||
|
|
||||||
import toSnakeCase from 'to-snake-case'
|
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(
|
export const create: Create = async function create(
|
||||||
this: PostgresAdapter,
|
this: PostgresAdapter,
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ import type { PayloadRequest, TypeWithID } from 'payload/types'
|
|||||||
|
|
||||||
import toSnakeCase from 'to-snake-case'
|
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>(
|
export async function createGlobal<T extends TypeWithID>(
|
||||||
this: PostgresAdapter,
|
this: PostgresAdapter,
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ import { sql } from 'drizzle-orm'
|
|||||||
import { buildVersionGlobalFields } from 'payload/versions'
|
import { buildVersionGlobalFields } from 'payload/versions'
|
||||||
import toSnakeCase from 'to-snake-case'
|
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>(
|
export async function createGlobalVersion<T extends TypeWithID>(
|
||||||
this: PostgresAdapter,
|
this: PostgresAdapter,
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import type { CreateMigration } from 'payload/database'
|
|||||||
import fs from 'fs'
|
import fs from 'fs'
|
||||||
import prompts from 'prompts'
|
import prompts from 'prompts'
|
||||||
|
|
||||||
import type { PostgresAdapter } from './types'
|
import type { PostgresAdapter } from './types.d.ts'
|
||||||
|
|
||||||
const migrationTemplate = (
|
const migrationTemplate = (
|
||||||
upSQL?: string,
|
upSQL?: string,
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ import { sql } from 'drizzle-orm'
|
|||||||
import { buildVersionCollectionFields } from 'payload/versions'
|
import { buildVersionCollectionFields } from 'payload/versions'
|
||||||
import toSnakeCase from 'to-snake-case'
|
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>(
|
export async function createVersion<T extends TypeWithID>(
|
||||||
this: PostgresAdapter,
|
this: PostgresAdapter,
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ import type { PayloadRequest } from 'payload/types'
|
|||||||
import { inArray } from 'drizzle-orm'
|
import { inArray } from 'drizzle-orm'
|
||||||
import toSnakeCase from 'to-snake-case'
|
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(
|
export const deleteMany: DeleteMany = async function deleteMany(
|
||||||
this: PostgresAdapter,
|
this: PostgresAdapter,
|
||||||
|
|||||||
@@ -3,11 +3,11 @@ import type { PayloadRequest } from 'payload/types'
|
|||||||
|
|
||||||
import toSnakeCase from 'to-snake-case'
|
import toSnakeCase from 'to-snake-case'
|
||||||
|
|
||||||
import type { PostgresAdapter } from './types'
|
import type { PostgresAdapter } from './types.d.ts'
|
||||||
|
|
||||||
import { buildFindManyArgs } from './find/buildFindManyArgs'
|
import { buildFindManyArgs } from './find/buildFindManyArgs.js'
|
||||||
import buildQuery from './queries/buildQuery'
|
import buildQuery from './queries/buildQuery.js'
|
||||||
import { transform } from './transform/read'
|
import { transform } from './transform/read/index.js'
|
||||||
|
|
||||||
export const deleteOne: DeleteOne = async function deleteOne(
|
export const deleteOne: DeleteOne = async function deleteOne(
|
||||||
this: PostgresAdapter,
|
this: PostgresAdapter,
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ import { inArray } from 'drizzle-orm'
|
|||||||
import { buildVersionCollectionFields } from 'payload/versions'
|
import { buildVersionCollectionFields } from 'payload/versions'
|
||||||
import toSnakeCase from 'to-snake-case'
|
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(
|
export const deleteVersions: DeleteVersions = async function deleteVersion(
|
||||||
this: PostgresAdapter,
|
this: PostgresAdapter,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import type { Destroy } from 'payload/database'
|
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) {
|
export const destroy: Destroy = async function destroy(this: PostgresAdapter) {
|
||||||
// TODO: this hangs test suite for some reason
|
// TODO: this hangs test suite for some reason
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ import type { PayloadRequest, SanitizedCollectionConfig } from 'payload/types'
|
|||||||
|
|
||||||
import toSnakeCase from 'to-snake-case'
|
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(
|
export const find: Find = async function find(
|
||||||
this: PostgresAdapter,
|
this: PostgresAdapter,
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import type { DBQueryConfig } from 'drizzle-orm'
|
import type { DBQueryConfig } from 'drizzle-orm'
|
||||||
import type { Field } from 'payload/types'
|
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 = {
|
type BuildFindQueryArgs = {
|
||||||
adapter: PostgresAdapter
|
adapter: PostgresAdapter
|
||||||
|
|||||||
@@ -3,13 +3,13 @@ import type { Field, PayloadRequest, TypeWithID } from 'payload/types'
|
|||||||
|
|
||||||
import { inArray, sql } from 'drizzle-orm'
|
import { inArray, sql } from 'drizzle-orm'
|
||||||
|
|
||||||
import type { PostgresAdapter } from '../types'
|
import type { PostgresAdapter } from '../types.d.ts'
|
||||||
import type { ChainedMethods } from './chainMethods'
|
import type { ChainedMethods } from './chainMethods.d.ts'
|
||||||
|
|
||||||
import buildQuery from '../queries/buildQuery'
|
import buildQuery from '../queries/buildQuery.js'
|
||||||
import { transform } from '../transform/read'
|
import { transform } from '../transform/read/index.js'
|
||||||
import { buildFindManyArgs } from './buildFindManyArgs'
|
import { buildFindManyArgs } from './buildFindManyArgs.js'
|
||||||
import { chainMethods } from './chainMethods'
|
import { chainMethods } from './chainMethods.js'
|
||||||
|
|
||||||
type Args = Omit<FindArgs, 'collection'> & {
|
type Args = Omit<FindArgs, 'collection'> & {
|
||||||
adapter: PostgresAdapter
|
adapter: PostgresAdapter
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ import type { Field } from 'payload/types'
|
|||||||
import { fieldAffectsData, tabHasName } from 'payload/types'
|
import { fieldAffectsData, tabHasName } from 'payload/types'
|
||||||
import toSnakeCase from 'to-snake-case'
|
import toSnakeCase from 'to-snake-case'
|
||||||
|
|
||||||
import type { PostgresAdapter } from '../types'
|
import type { PostgresAdapter } from '../types.d.ts'
|
||||||
import type { Result } from './buildFindManyArgs'
|
import type { Result } from './buildFindManyArgs.d.ts'
|
||||||
|
|
||||||
type TraverseFieldArgs = {
|
type TraverseFieldArgs = {
|
||||||
_locales: Record<string, unknown>
|
_locales: Record<string, unknown>
|
||||||
|
|||||||
@@ -2,9 +2,9 @@ import type { FindGlobal } from 'payload/database'
|
|||||||
|
|
||||||
import toSnakeCase from 'to-snake-case'
|
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(
|
export const findGlobal: FindGlobal = async function findGlobal(
|
||||||
this: PostgresAdapter,
|
this: PostgresAdapter,
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ import type { PayloadRequest, SanitizedGlobalConfig } from 'payload/types'
|
|||||||
import { buildVersionGlobalFields } from 'payload/versions'
|
import { buildVersionGlobalFields } from 'payload/versions'
|
||||||
import toSnakeCase from 'to-snake-case'
|
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(
|
export const findGlobalVersions: FindGlobalVersions = async function findGlobalVersions(
|
||||||
this: PostgresAdapter,
|
this: PostgresAdapter,
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ import type { PayloadRequest, SanitizedCollectionConfig, TypeWithID } from 'payl
|
|||||||
|
|
||||||
import toSnakeCase from 'to-snake-case'
|
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>(
|
export async function findOne<T extends TypeWithID>(
|
||||||
this: PostgresAdapter,
|
this: PostgresAdapter,
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ import type { PayloadRequest, SanitizedCollectionConfig } from 'payload/types'
|
|||||||
import { buildVersionCollectionFields } from 'payload/versions'
|
import { buildVersionCollectionFields } from 'payload/versions'
|
||||||
import toSnakeCase from 'to-snake-case'
|
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(
|
export const findVersions: FindVersions = async function findVersions(
|
||||||
this: PostgresAdapter,
|
this: PostgresAdapter,
|
||||||
|
|||||||
@@ -5,40 +5,40 @@ import fs from 'fs'
|
|||||||
import path from 'path'
|
import path from 'path'
|
||||||
import { createDatabaseAdapter } from 'payload/database'
|
import { createDatabaseAdapter } from 'payload/database'
|
||||||
|
|
||||||
import type { Args, PostgresAdapter } from './types'
|
import type { Args, PostgresAdapter } from './types.d.ts'
|
||||||
|
|
||||||
import { connect } from './connect'
|
import { connect } from './connect.js'
|
||||||
import { create } from './create'
|
import { create } from './create.js'
|
||||||
import { createGlobal } from './createGlobal'
|
import { createGlobal } from './createGlobal.js'
|
||||||
import { createGlobalVersion } from './createGlobalVersion'
|
import { createGlobalVersion } from './createGlobalVersion.js'
|
||||||
import { createMigration } from './createMigration'
|
import { createMigration } from './createMigration.js'
|
||||||
import { createVersion } from './createVersion'
|
import { createVersion } from './createVersion.js'
|
||||||
import { deleteMany } from './deleteMany'
|
import { deleteMany } from './deleteMany.js'
|
||||||
import { deleteOne } from './deleteOne'
|
import { deleteOne } from './deleteOne.js'
|
||||||
import { deleteVersions } from './deleteVersions'
|
import { deleteVersions } from './deleteVersions.js'
|
||||||
import { destroy } from './destroy'
|
import { destroy } from './destroy.js'
|
||||||
import { find } from './find'
|
import { find } from './find.js'
|
||||||
import { findGlobal } from './findGlobal'
|
import { findGlobal } from './findGlobal.js'
|
||||||
import { findGlobalVersions } from './findGlobalVersions'
|
import { findGlobalVersions } from './findGlobalVersions.js'
|
||||||
import { findOne } from './findOne'
|
import { findOne } from './findOne.js'
|
||||||
import { findVersions } from './findVersions'
|
import { findVersions } from './findVersions.js'
|
||||||
import { init } from './init'
|
import { init } from './init.js'
|
||||||
import { migrate } from './migrate'
|
import { migrate } from './migrate.js'
|
||||||
import { migrateDown } from './migrateDown'
|
import { migrateDown } from './migrateDown.js'
|
||||||
import { migrateFresh } from './migrateFresh'
|
import { migrateFresh } from './migrateFresh.js'
|
||||||
import { migrateRefresh } from './migrateRefresh'
|
import { migrateRefresh } from './migrateRefresh.js'
|
||||||
import { migrateReset } from './migrateReset'
|
import { migrateReset } from './migrateReset.js'
|
||||||
import { migrateStatus } from './migrateStatus'
|
import { migrateStatus } from './migrateStatus.js'
|
||||||
import { queryDrafts } from './queryDrafts'
|
import { queryDrafts } from './queryDrafts.js'
|
||||||
import { beginTransaction } from './transactions/beginTransaction'
|
import { beginTransaction } from './transactions/beginTransaction.js'
|
||||||
import { commitTransaction } from './transactions/commitTransaction'
|
import { commitTransaction } from './transactions/commitTransaction.js'
|
||||||
import { rollbackTransaction } from './transactions/rollbackTransaction'
|
import { rollbackTransaction } from './transactions/rollbackTransaction.js'
|
||||||
import { updateOne } from './update'
|
import { updateOne } from './update.js'
|
||||||
import { updateGlobal } from './updateGlobal'
|
import { updateGlobal } from './updateGlobal.js'
|
||||||
import { updateGlobalVersion } from './updateGlobalVersion'
|
import { updateGlobalVersion } from './updateGlobalVersion.js'
|
||||||
import { updateVersion } from './updateVersion'
|
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> {
|
export function postgresAdapter(args: Args): DatabaseAdapterObj<PostgresAdapter> {
|
||||||
function adapter({ payload }: { payload: Payload }) {
|
function adapter({ payload }: { payload: Payload }) {
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ import { pgEnum, pgSchema, pgTable } from 'drizzle-orm/pg-core'
|
|||||||
import { buildVersionCollectionFields, buildVersionGlobalFields } from 'payload/versions'
|
import { buildVersionCollectionFields, buildVersionGlobalFields } from 'payload/versions'
|
||||||
import toSnakeCase from 'to-snake-case'
|
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) {
|
export const init: Init = async function init(this: PostgresAdapter) {
|
||||||
if (this.schemaName) {
|
if (this.schemaName) {
|
||||||
|
|||||||
@@ -11,11 +11,11 @@ import {
|
|||||||
} from 'payload/database'
|
} from 'payload/database'
|
||||||
import prompts from 'prompts'
|
import prompts from 'prompts'
|
||||||
|
|
||||||
import type { PostgresAdapter } from './types'
|
import type { PostgresAdapter } from './types.d.ts'
|
||||||
|
|
||||||
import { createMigrationTable } from './utilities/createMigrationTable'
|
import { createMigrationTable } from './utilities/createMigrationTable.js'
|
||||||
import { migrationTableExists } from './utilities/migrationTableExists'
|
import { migrationTableExists } from './utilities/migrationTableExists.js'
|
||||||
import { parseError } from './utilities/parseError'
|
import { parseError } from './utilities/parseError.js'
|
||||||
|
|
||||||
export async function migrate(this: PostgresAdapter): Promise<void> {
|
export async function migrate(this: PostgresAdapter): Promise<void> {
|
||||||
const { payload } = this
|
const { payload } = this
|
||||||
|
|||||||
@@ -9,10 +9,10 @@ import {
|
|||||||
readMigrationFiles,
|
readMigrationFiles,
|
||||||
} from 'payload/database'
|
} 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'
|
||||||
import { parseError } from './utilities/parseError'
|
import { parseError } from './utilities/parseError.js'
|
||||||
|
|
||||||
export async function migrateDown(this: PostgresAdapter): Promise<void> {
|
export async function migrateDown(this: PostgresAdapter): Promise<void> {
|
||||||
const { payload } = this
|
const { payload } = this
|
||||||
|
|||||||
@@ -9,9 +9,9 @@ import {
|
|||||||
} from 'payload/database'
|
} from 'payload/database'
|
||||||
import prompts from 'prompts'
|
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
|
* Drop the current database and run all migrate up functions
|
||||||
|
|||||||
@@ -9,10 +9,10 @@ import {
|
|||||||
readMigrationFiles,
|
readMigrationFiles,
|
||||||
} from 'payload/database'
|
} 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'
|
||||||
import { parseError } from './utilities/parseError'
|
import { parseError } from './utilities/parseError.js'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Run all migration down functions before running up
|
* Run all migration down functions before running up
|
||||||
|
|||||||
@@ -9,9 +9,9 @@ import {
|
|||||||
readMigrationFiles,
|
readMigrationFiles,
|
||||||
} from 'payload/database'
|
} 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
|
* Run all migrate down functions
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { Table } from 'console-table-printer'
|
import { Table } from 'console-table-printer'
|
||||||
import { getMigrations, readMigrationFiles } from 'payload/database'
|
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> {
|
export async function migrateStatus(this: PostgresAdapter): Promise<void> {
|
||||||
const { payload } = this
|
const { payload } = this
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import type { SQL } from 'drizzle-orm'
|
import type { SQL } from 'drizzle-orm'
|
||||||
import type { Field, Where } from 'payload/types'
|
import type { Field, Where } from 'payload/types'
|
||||||
|
|
||||||
import type { GenericColumn, PostgresAdapter } from '../types'
|
import type { GenericColumn, PostgresAdapter } from '../types.d.ts'
|
||||||
import type { BuildQueryJoinAliases, BuildQueryJoins } from './buildQuery'
|
import type { BuildQueryJoinAliases, BuildQueryJoins } from './buildQuery.d.ts'
|
||||||
|
|
||||||
import { parseParams } from './parseParams'
|
import { parseParams } from './parseParams.js'
|
||||||
|
|
||||||
export async function buildAndOrConditions({
|
export async function buildAndOrConditions({
|
||||||
adapter,
|
adapter,
|
||||||
|
|||||||
@@ -4,10 +4,10 @@ import type { Field, Where } from 'payload/types'
|
|||||||
|
|
||||||
import { asc, desc } from 'drizzle-orm'
|
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 { getTableColumnFromPath } from './getTableColumnFromPath.js'
|
||||||
import { parseParams } from './parseParams'
|
import { parseParams } from './parseParams.js'
|
||||||
|
|
||||||
export type BuildQueryJoins = Record<string, SQL>
|
export type BuildQueryJoins = Record<string, SQL>
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { formatJSONPathSegment } from './formatJSONPathSegment'
|
import { formatJSONPathSegment } from './formatJSONPathSegment.js'
|
||||||
|
|
||||||
export const convertPathToJSONTraversal = (incomingSegments: string[]) => {
|
export const convertPathToJSONTraversal = (incomingSegments: string[]) => {
|
||||||
const segments = [...incomingSegments]
|
const segments = [...incomingSegments]
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { convertPathToJSONTraversal } from './convertPathToJSONTraversal'
|
import { convertPathToJSONTraversal } from './convertPathToJSONTraversal.js'
|
||||||
import { formatJSONPathSegment } from './formatJSONPathSegment'
|
import { formatJSONPathSegment } from './formatJSONPathSegment.js'
|
||||||
|
|
||||||
const operatorMap = {
|
const operatorMap = {
|
||||||
contains: '~*',
|
contains: '~*',
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ import { flattenTopLevelFields } from 'payload/utilities'
|
|||||||
import toSnakeCase from 'to-snake-case'
|
import toSnakeCase from 'to-snake-case'
|
||||||
import { v4 as uuid } from 'uuid'
|
import { v4 as uuid } from 'uuid'
|
||||||
|
|
||||||
import type { GenericColumn, GenericTable, PostgresAdapter } from '../types'
|
import type { GenericColumn, GenericTable, PostgresAdapter } from '../types.d.ts'
|
||||||
import type { BuildQueryJoinAliases, BuildQueryJoins } from './buildQuery'
|
import type { BuildQueryJoinAliases, BuildQueryJoins } from './buildQuery.d.ts'
|
||||||
|
|
||||||
type Constraint = {
|
type Constraint = {
|
||||||
columnName: string
|
columnName: string
|
||||||
|
|||||||
@@ -6,15 +6,15 @@ import { and, ilike, isNotNull, isNull, ne, notInArray, or, sql } from 'drizzle-
|
|||||||
import { QueryError } from 'payload/errors'
|
import { QueryError } from 'payload/errors'
|
||||||
import { validOperators } from 'payload/types'
|
import { validOperators } from 'payload/types'
|
||||||
|
|
||||||
import type { GenericColumn, PostgresAdapter } from '../types'
|
import type { GenericColumn, PostgresAdapter } from '../types.d.ts'
|
||||||
import type { BuildQueryJoinAliases, BuildQueryJoins } from './buildQuery'
|
import type { BuildQueryJoinAliases, BuildQueryJoins } from './buildQuery.d.ts'
|
||||||
|
|
||||||
import { buildAndOrConditions } from './buildAndOrConditions'
|
import { buildAndOrConditions } from './buildAndOrConditions.js'
|
||||||
import { createJSONQuery } from './createJSONQuery'
|
import { createJSONQuery } from './createJSONQuery/index.js'
|
||||||
import { convertPathToJSONTraversal } from './createJSONQuery/convertPathToJSONTraversal'
|
import { convertPathToJSONTraversal } from './createJSONQuery/convertPathToJSONTraversal.js'
|
||||||
import { getTableColumnFromPath } from './getTableColumnFromPath'
|
import { getTableColumnFromPath } from './getTableColumnFromPath.js'
|
||||||
import { operatorMap } from './operatorMap'
|
import { operatorMap } from './operatorMap.js'
|
||||||
import { sanitizeQueryValue } from './sanitizeQueryValue'
|
import { sanitizeQueryValue } from './sanitizeQueryValue.js'
|
||||||
|
|
||||||
type Args = {
|
type Args = {
|
||||||
adapter: PostgresAdapter
|
adapter: PostgresAdapter
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { APIError } from 'payload/errors'
|
|||||||
import { type Field, type TabAsField, fieldAffectsData } from 'payload/types'
|
import { type Field, type TabAsField, fieldAffectsData } from 'payload/types'
|
||||||
import { createArrayFromCommaDelineated } from 'payload/utilities'
|
import { createArrayFromCommaDelineated } from 'payload/utilities'
|
||||||
|
|
||||||
import type { PostgresAdapter } from '../types'
|
import type { PostgresAdapter } from '../types.d.ts'
|
||||||
|
|
||||||
type SanitizeQueryValueArgs = {
|
type SanitizeQueryValueArgs = {
|
||||||
adapter: PostgresAdapter
|
adapter: PostgresAdapter
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { type QueryDrafts, combineQueries } from 'payload/database'
|
|||||||
import { buildVersionCollectionFields } from 'payload/versions'
|
import { buildVersionCollectionFields } from 'payload/versions'
|
||||||
import toSnakeCase from 'to-snake-case'
|
import toSnakeCase from 'to-snake-case'
|
||||||
|
|
||||||
import { findMany } from './find/findMany'
|
import { findMany } from './find/findMany.js'
|
||||||
|
|
||||||
export const queryDrafts: QueryDrafts = async function queryDrafts({
|
export const queryDrafts: QueryDrafts = async function queryDrafts({
|
||||||
collection,
|
collection,
|
||||||
|
|||||||
@@ -13,11 +13,11 @@ import { index, integer, numeric, serial, timestamp, unique, varchar } from 'dri
|
|||||||
import { fieldAffectsData } from 'payload/types'
|
import { fieldAffectsData } from 'payload/types'
|
||||||
import toSnakeCase from 'to-snake-case'
|
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 { parentIDColumnMap } from './parentIDColumnMap.js'
|
||||||
import { setColumnID } from './setColumnID'
|
import { setColumnID } from './setColumnID.js'
|
||||||
import { traverseFields } from './traverseFields'
|
import { traverseFields } from './traverseFields.js'
|
||||||
|
|
||||||
type Args = {
|
type Args = {
|
||||||
adapter: PostgresAdapter
|
adapter: PostgresAdapter
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/* eslint-disable no-param-reassign */
|
/* eslint-disable no-param-reassign */
|
||||||
import { index, uniqueIndex } from 'drizzle-orm/pg-core'
|
import { index, uniqueIndex } from 'drizzle-orm/pg-core'
|
||||||
|
|
||||||
import type { GenericColumn } from '../types'
|
import type { GenericColumn } from '../types.d.ts'
|
||||||
|
|
||||||
type CreateIndexArgs = {
|
type CreateIndexArgs = {
|
||||||
columnName: string
|
columnName: string
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { integer, numeric, uuid, varchar } from 'drizzle-orm/pg-core'
|
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<
|
export const parentIDColumnMap: Record<
|
||||||
IDType,
|
IDType,
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { numeric, serial, uuid, varchar } from 'drizzle-orm/pg-core'
|
|||||||
import { type Field, fieldAffectsData } from 'payload/types'
|
import { type Field, fieldAffectsData } from 'payload/types'
|
||||||
import { flattenTopLevelFields } from 'payload/utilities'
|
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[] }
|
type Args = { adapter: PostgresAdapter; columns: Record<string, PgColumnBuilder>; fields: Field[] }
|
||||||
export const setColumnID = ({ adapter, columns, fields }: Args): IDType => {
|
export const setColumnID = ({ adapter, columns, fields }: Args): IDType => {
|
||||||
|
|||||||
@@ -22,14 +22,14 @@ import { InvalidConfiguration } from 'payload/errors'
|
|||||||
import { fieldAffectsData, optionIsObject } from 'payload/types'
|
import { fieldAffectsData, optionIsObject } from 'payload/types'
|
||||||
import toSnakeCase from 'to-snake-case'
|
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 { hasLocalesTable } from '../utilities/hasLocalesTable.js'
|
||||||
import { buildTable } from './build'
|
import { buildTable } from './build.js'
|
||||||
import { createIndex } from './createIndex'
|
import { createIndex } from './createIndex.js'
|
||||||
import { idToUUID } from './idToUUID'
|
import { idToUUID } from './idToUUID.js'
|
||||||
import { parentIDColumnMap } from './parentIDColumnMap'
|
import { parentIDColumnMap } from './parentIDColumnMap.js'
|
||||||
import { validateExistingBlockIsIdentical } from './validateExistingBlockIsIdentical'
|
import { validateExistingBlockIsIdentical } from './validateExistingBlockIsIdentical.js'
|
||||||
|
|
||||||
type Args = {
|
type Args = {
|
||||||
adapter: PostgresAdapter
|
adapter: PostgresAdapter
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import type { Block, Field } from 'payload/types'
|
|||||||
import { InvalidConfiguration } from 'payload/errors'
|
import { InvalidConfiguration } from 'payload/errors'
|
||||||
import { fieldAffectsData, fieldHasSubFields, tabHasName } from 'payload/types'
|
import { fieldAffectsData, fieldHasSubFields, tabHasName } from 'payload/types'
|
||||||
|
|
||||||
import type { GenericTable } from '../types'
|
import type { GenericTable } from '../types.d.ts'
|
||||||
|
|
||||||
type Args = {
|
type Args = {
|
||||||
block: Block
|
block: Block
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import type { BeginTransaction } from 'payload/database'
|
|||||||
|
|
||||||
import { v4 as uuid } from 'uuid'
|
import { v4 as uuid } from 'uuid'
|
||||||
|
|
||||||
import type { DrizzleTransaction, PostgresAdapter } from '../types'
|
import type { DrizzleTransaction, PostgresAdapter } from '../types.d.ts'
|
||||||
|
|
||||||
export const beginTransaction: BeginTransaction = async function beginTransaction(
|
export const beginTransaction: BeginTransaction = async function beginTransaction(
|
||||||
this: PostgresAdapter,
|
this: PostgresAdapter,
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
import type { SanitizedConfig } from 'payload/config'
|
import type { SanitizedConfig } from 'payload/config'
|
||||||
import type { Field, TypeWithID } from 'payload/types'
|
import type { Field, TypeWithID } from 'payload/types'
|
||||||
|
|
||||||
import { createBlocksMap } from '../../utilities/createBlocksMap'
|
import { createBlocksMap } from '../../utilities/createBlocksMap.js'
|
||||||
import { createPathMap } from '../../utilities/createRelationshipMap'
|
import { createPathMap } from '../../utilities/createRelationshipMap.js'
|
||||||
import { traverseFields } from './traverseFields'
|
import { traverseFields } from './traverseFields.js'
|
||||||
|
|
||||||
type TransformArgs = {
|
type TransformArgs = {
|
||||||
config: SanitizedConfig
|
config: SanitizedConfig
|
||||||
|
|||||||
@@ -4,11 +4,11 @@ import type { Field, TabAsField } from 'payload/types'
|
|||||||
|
|
||||||
import { fieldAffectsData } from 'payload/types'
|
import { fieldAffectsData } from 'payload/types'
|
||||||
|
|
||||||
import type { BlocksMap } from '../../utilities/createBlocksMap'
|
import type { BlocksMap } from '../../utilities/createBlocksMap.d.ts'
|
||||||
|
|
||||||
import { transformHasManyNumber } from './hasManyNumber'
|
import { transformHasManyNumber } from './hasManyNumber.js'
|
||||||
import { transformHasManyText } from './hasManyText'
|
import { transformHasManyText } from './hasManyText.js'
|
||||||
import { transformRelationship } from './relationship'
|
import { transformRelationship } from './relationship.js'
|
||||||
|
|
||||||
type TraverseFieldsArgs = {
|
type TraverseFieldsArgs = {
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
/* eslint-disable no-param-reassign */
|
/* eslint-disable no-param-reassign */
|
||||||
import type { ArrayField } from 'payload/types'
|
import type { ArrayField } from 'payload/types'
|
||||||
|
|
||||||
import type { PostgresAdapter } from '../../types'
|
import type { PostgresAdapter } from '../../types.d.ts'
|
||||||
import type { ArrayRowToInsert, BlockRowToInsert, RelationshipToDelete } from './types'
|
import type { ArrayRowToInsert, BlockRowToInsert, RelationshipToDelete } from './types.d.ts'
|
||||||
|
|
||||||
import { isArrayOfRows } from '../../utilities/isArrayOfRows'
|
import { isArrayOfRows } from '../../utilities/isArrayOfRows.js'
|
||||||
import { traverseFields } from './traverseFields'
|
import { traverseFields } from './traverseFields.js'
|
||||||
|
|
||||||
type Args = {
|
type Args = {
|
||||||
adapter: PostgresAdapter
|
adapter: PostgresAdapter
|
||||||
|
|||||||
@@ -3,10 +3,10 @@ import type { BlockField } from 'payload/types'
|
|||||||
|
|
||||||
import toSnakeCase from 'to-snake-case'
|
import toSnakeCase from 'to-snake-case'
|
||||||
|
|
||||||
import type { PostgresAdapter } from '../../types'
|
import type { PostgresAdapter } from '../../types.d.ts'
|
||||||
import type { BlockRowToInsert, RelationshipToDelete } from './types'
|
import type { BlockRowToInsert, RelationshipToDelete } from './types.d.ts'
|
||||||
|
|
||||||
import { traverseFields } from './traverseFields'
|
import { traverseFields } from './traverseFields.js'
|
||||||
|
|
||||||
type Args = {
|
type Args = {
|
||||||
adapter: PostgresAdapter
|
adapter: PostgresAdapter
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
/* eslint-disable no-param-reassign */
|
/* eslint-disable no-param-reassign */
|
||||||
import type { Field } from 'payload/types'
|
import type { Field } from 'payload/types'
|
||||||
|
|
||||||
import type { PostgresAdapter } from '../../types'
|
import type { PostgresAdapter } from '../../types.d.ts'
|
||||||
import type { RowToInsert } from './types'
|
import type { RowToInsert } from './types.d.ts'
|
||||||
|
|
||||||
import { traverseFields } from './traverseFields'
|
import { traverseFields } from './traverseFields.js'
|
||||||
|
|
||||||
type Args = {
|
type Args = {
|
||||||
adapter: PostgresAdapter
|
adapter: PostgresAdapter
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* eslint-disable no-param-reassign */
|
/* eslint-disable no-param-reassign */
|
||||||
import { isArrayOfRows } from '../../utilities/isArrayOfRows'
|
import { isArrayOfRows } from '../../utilities/isArrayOfRows.js'
|
||||||
|
|
||||||
type Args = {
|
type Args = {
|
||||||
data: unknown
|
data: unknown
|
||||||
|
|||||||
@@ -4,16 +4,16 @@ import type { Field } from 'payload/types'
|
|||||||
import { fieldAffectsData } from 'payload/types'
|
import { fieldAffectsData } from 'payload/types'
|
||||||
import toSnakeCase from 'to-snake-case'
|
import toSnakeCase from 'to-snake-case'
|
||||||
|
|
||||||
import type { PostgresAdapter } from '../../types'
|
import type { PostgresAdapter } from '../../types.d.ts'
|
||||||
import type { ArrayRowToInsert, BlockRowToInsert, RelationshipToDelete } from './types'
|
import type { ArrayRowToInsert, BlockRowToInsert, RelationshipToDelete } from './types.d.ts'
|
||||||
|
|
||||||
import { isArrayOfRows } from '../../utilities/isArrayOfRows'
|
import { isArrayOfRows } from '../../utilities/isArrayOfRows.js'
|
||||||
import { transformArray } from './array'
|
import { transformArray } from './array.js'
|
||||||
import { transformBlocks } from './blocks'
|
import { transformBlocks } from './blocks.js'
|
||||||
import { transformNumbers } from './numbers'
|
import { transformNumbers } from './numbers.js'
|
||||||
import { transformRelationship } from './relationships'
|
import { transformRelationship } from './relationships.js'
|
||||||
import { transformSelects } from './selects'
|
import { transformSelects } from './selects.js'
|
||||||
import { transformTexts } from './texts'
|
import { transformTexts } from './texts.js'
|
||||||
|
|
||||||
type Args = {
|
type Args = {
|
||||||
adapter: PostgresAdapter
|
adapter: PostgresAdapter
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ import type { UpdateOne } from 'payload/database'
|
|||||||
|
|
||||||
import toSnakeCase from 'to-snake-case'
|
import toSnakeCase from 'to-snake-case'
|
||||||
|
|
||||||
import type { ChainedMethods } from './find/chainMethods'
|
import type { ChainedMethods } from './find/chainMethods.d.ts'
|
||||||
import { chainMethods } from './find/chainMethods'
|
import type { PostgresAdapter } from './types.d.ts'
|
||||||
import type { PostgresAdapter } from './types'
|
import { chainMethods } from './find/chainMethods.js'
|
||||||
import buildQuery from './queries/buildQuery'
|
import buildQuery from './queries/buildQuery.js'
|
||||||
import { upsertRow } from './upsertRow'
|
import { upsertRow } from './upsertRow/index.js'
|
||||||
|
|
||||||
export const updateOne: UpdateOne = async function updateOne(
|
export const updateOne: UpdateOne = async function updateOne(
|
||||||
this: PostgresAdapter,
|
this: PostgresAdapter,
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ import type { PayloadRequest, TypeWithID } from 'payload/types'
|
|||||||
|
|
||||||
import toSnakeCase from 'to-snake-case'
|
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 updateGlobal<T extends TypeWithID>(
|
export async function updateGlobal<T extends TypeWithID>(
|
||||||
this: PostgresAdapter,
|
this: PostgresAdapter,
|
||||||
|
|||||||
@@ -4,10 +4,10 @@ import type { PayloadRequest, SanitizedGlobalConfig, TypeWithID } from 'payload/
|
|||||||
import { buildVersionGlobalFields } from 'payload/versions'
|
import { buildVersionGlobalFields } from 'payload/versions'
|
||||||
import toSnakeCase from 'to-snake-case'
|
import toSnakeCase from 'to-snake-case'
|
||||||
|
|
||||||
import type { PostgresAdapter } from './types'
|
import type { PostgresAdapter } from './types.d.ts'
|
||||||
|
|
||||||
import buildQuery from './queries/buildQuery'
|
import buildQuery from './queries/buildQuery.js'
|
||||||
import { upsertRow } from './upsertRow'
|
import { upsertRow } from './upsertRow/index.js'
|
||||||
|
|
||||||
export async function updateGlobalVersion<T extends TypeWithID>(
|
export async function updateGlobalVersion<T extends TypeWithID>(
|
||||||
this: PostgresAdapter,
|
this: PostgresAdapter,
|
||||||
|
|||||||
@@ -4,10 +4,10 @@ import type { PayloadRequest, SanitizedCollectionConfig, TypeWithID } from 'payl
|
|||||||
import { buildVersionCollectionFields } from 'payload/versions'
|
import { buildVersionCollectionFields } from 'payload/versions'
|
||||||
import toSnakeCase from 'to-snake-case'
|
import toSnakeCase from 'to-snake-case'
|
||||||
|
|
||||||
import type { PostgresAdapter } from './types'
|
import type { PostgresAdapter } from './types.d.ts'
|
||||||
|
|
||||||
import buildQuery from './queries/buildQuery'
|
import buildQuery from './queries/buildQuery.js'
|
||||||
import { upsertRow } from './upsertRow'
|
import { upsertRow } from './upsertRow/index.js'
|
||||||
|
|
||||||
export async function updateVersion<T extends TypeWithID>(
|
export async function updateVersion<T extends TypeWithID>(
|
||||||
this: PostgresAdapter,
|
this: PostgresAdapter,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { and, eq } from 'drizzle-orm'
|
import { and, eq } from 'drizzle-orm'
|
||||||
|
|
||||||
import type { DrizzleDB, PostgresAdapter } from '../types'
|
import type { DrizzleDB, PostgresAdapter } from '../types.d.ts'
|
||||||
|
|
||||||
type Args = {
|
type Args = {
|
||||||
adapter: PostgresAdapter
|
adapter: PostgresAdapter
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { and, eq, inArray } from 'drizzle-orm'
|
import { and, eq, inArray } from 'drizzle-orm'
|
||||||
|
|
||||||
import type { DrizzleDB, PostgresAdapter } from '../types'
|
import type { DrizzleDB, PostgresAdapter } from '../types.d.ts'
|
||||||
|
|
||||||
type Args = {
|
type Args = {
|
||||||
adapter: PostgresAdapter
|
adapter: PostgresAdapter
|
||||||
|
|||||||
@@ -4,15 +4,15 @@ import type { TypeWithID } from 'payload/types'
|
|||||||
import { eq } from 'drizzle-orm'
|
import { eq } from 'drizzle-orm'
|
||||||
import { ValidationError } from 'payload/errors'
|
import { ValidationError } from 'payload/errors'
|
||||||
|
|
||||||
import type { BlockRowToInsert } from '../transform/write/types'
|
import type { BlockRowToInsert } from '../transform/write/types.d.ts'
|
||||||
import type { Args } from './types'
|
import type { Args } from './types.d.ts'
|
||||||
|
|
||||||
import { buildFindManyArgs } from '../find/buildFindManyArgs'
|
import { buildFindManyArgs } from '../find/buildFindManyArgs.js'
|
||||||
import { transform } from '../transform/read'
|
import { transform } from '../transform/read/index.js'
|
||||||
import { transformForWrite } from '../transform/write'
|
import { transformForWrite } from '../transform/write/index.js'
|
||||||
import { deleteExistingArrayRows } from './deleteExistingArrayRows'
|
import { deleteExistingArrayRows } from './deleteExistingArrayRows.js'
|
||||||
import { deleteExistingRowsByPath } from './deleteExistingRowsByPath'
|
import { deleteExistingRowsByPath } from './deleteExistingRowsByPath.js'
|
||||||
import { insertArrays } from './insertArrays'
|
import { insertArrays } from './insertArrays.js'
|
||||||
|
|
||||||
export const upsertRow = async <T extends TypeWithID>({
|
export const upsertRow = async <T extends TypeWithID>({
|
||||||
id,
|
id,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/* eslint-disable no-param-reassign */
|
/* eslint-disable no-param-reassign */
|
||||||
import type { ArrayRowToInsert } from '../transform/write/types'
|
import type { ArrayRowToInsert } from '../transform/write/types.d.ts'
|
||||||
import type { DrizzleDB, PostgresAdapter } from '../types'
|
import type { DrizzleDB, PostgresAdapter } from '../types.d.ts'
|
||||||
|
|
||||||
type Args = {
|
type Args = {
|
||||||
adapter: PostgresAdapter
|
adapter: PostgresAdapter
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import type { SQL } from 'drizzle-orm'
|
import type { SQL } from 'drizzle-orm'
|
||||||
import type { Field, PayloadRequest } from 'payload/types'
|
import type { Field, PayloadRequest } from 'payload/types'
|
||||||
|
|
||||||
import type { DrizzleDB, GenericColumn, PostgresAdapter } from '../types'
|
import type { DrizzleDB, GenericColumn, PostgresAdapter } from '../types.d.ts'
|
||||||
|
|
||||||
type BaseArgs = {
|
type BaseArgs = {
|
||||||
adapter: PostgresAdapter
|
adapter: PostgresAdapter
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { sql } from 'drizzle-orm'
|
import { sql } from 'drizzle-orm'
|
||||||
|
|
||||||
import type { PostgresAdapter } from '../types'
|
import type { PostgresAdapter } from '../types.d.ts'
|
||||||
|
|
||||||
export const createMigrationTable = async (adapter: PostgresAdapter): Promise<void> => {
|
export const createMigrationTable = async (adapter: PostgresAdapter): Promise<void> => {
|
||||||
const prependSchema = adapter.schemaName ? `"${adapter.schemaName}".` : ''
|
const prependSchema = adapter.schemaName ? `"${adapter.schemaName}".` : ''
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { sql } from 'drizzle-orm'
|
import { sql } from 'drizzle-orm'
|
||||||
|
|
||||||
import type { DrizzleDB } from '../types'
|
import type { DrizzleDB } from '../types.d.ts'
|
||||||
|
|
||||||
export const migrationTableExists = async (db: DrizzleDB): Promise<boolean> => {
|
export const migrationTableExists = async (db: DrizzleDB): Promise<boolean> => {
|
||||||
const queryRes = await db.execute(sql`SELECT to_regclass('public.payload_migrations');`)
|
const queryRes = await db.execute(sql`SELECT to_regclass('public.payload_migrations');`)
|
||||||
|
|||||||
Reference in New Issue
Block a user