Compare commits
8 Commits
db-postgre
...
fix/db-mon
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
44231b55cb | ||
|
|
f9dda628b2 | ||
|
|
93eb0e4a31 | ||
|
|
2e362f44f4 | ||
|
|
775502b161 | ||
|
|
84d75ce6ca | ||
|
|
175cf229c0 | ||
|
|
2b731c1088 |
2
.github/ISSUE_TEMPLATE/1.bug_report.yml
vendored
2
.github/ISSUE_TEMPLATE/1.bug_report.yml
vendored
@@ -1,6 +1,6 @@
|
||||
name: Bug Report
|
||||
description: Create a bug report for Payload
|
||||
labels: ['possible-bug']
|
||||
labels: ['[possible-bug]']
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
## [2.8.1](https://github.com/payloadcms/payload/compare/v2.8.0...v2.8.1) (2024-01-12)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* corrects config usage in build bin script ([#4796](https://github.com/payloadcms/payload/issues/4796)) ([775502b](https://github.com/payloadcms/payload/commit/775502b1616c1bd35a3044438e253a0e84219f99))
|
||||
|
||||
## [2.8.0](https://github.com/payloadcms/payload/compare/v2.7.0...v2.8.0) (2024-01-12)
|
||||
|
||||
|
||||
|
||||
@@ -65,7 +65,8 @@ export const sanitizeQueryValue = ({
|
||||
if (field.type === 'date' && typeof val === 'string') {
|
||||
formattedValue = new Date(val)
|
||||
if (Number.isNaN(Date.parse(formattedValue))) {
|
||||
return undefined
|
||||
// ignore invalid query
|
||||
return { rawQuery: {} }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "payload",
|
||||
"version": "2.8.0",
|
||||
"version": "2.8.1",
|
||||
"description": "Node, React and MongoDB Headless CMS and Application Framework",
|
||||
"license": "MIT",
|
||||
"main": "./dist/index.js",
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import payload from '..'
|
||||
import loadConfig from '../config/load'
|
||||
|
||||
export const build = async (): Promise<void> => {
|
||||
const config = await loadConfig() // Will throw its own error if it fails
|
||||
|
||||
await payload.config.admin.bundler.build(config)
|
||||
await config.admin.bundler.build(config)
|
||||
}
|
||||
|
||||
// when build.js is launched directly
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@payloadcms/plugin-form-builder",
|
||||
"description": "Form builder plugin for Payload CMS",
|
||||
"version": "1.1.1",
|
||||
"version": "1.1.2",
|
||||
"homepage:": "https://payloadcms.com",
|
||||
"repository": "git@github.com:payloadcms/plugin-form-builder.git",
|
||||
"main": "dist/index.js",
|
||||
|
||||
@@ -7,6 +7,8 @@ import sendEmail from './hooks/sendEmail'
|
||||
|
||||
// all settings can be overridden by the config
|
||||
export const generateSubmissionCollection = (formConfig: PluginConfig): CollectionConfig => {
|
||||
const formSlug = formConfig?.formOverrides?.slug || 'forms'
|
||||
|
||||
const newConfig: CollectionConfig = {
|
||||
...(formConfig?.formSubmissionOverrides || {}),
|
||||
access: {
|
||||
@@ -25,9 +27,28 @@ export const generateSubmissionCollection = (formConfig: PluginConfig): Collecti
|
||||
admin: {
|
||||
readOnly: true,
|
||||
},
|
||||
relationTo: formConfig?.formOverrides?.slug || 'forms',
|
||||
relationTo: formSlug,
|
||||
required: true,
|
||||
type: 'relationship',
|
||||
validate: async (value, { payload }) => {
|
||||
/* Don't run in the client side */
|
||||
if (!payload) return true
|
||||
|
||||
if (payload) {
|
||||
let existingForm
|
||||
|
||||
try {
|
||||
existingForm = await payload.findByID({
|
||||
id: value,
|
||||
collection: formSlug,
|
||||
})
|
||||
|
||||
return true
|
||||
} catch (error) {
|
||||
return 'Cannot create this submission because this form does not exist.'
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'submissionData',
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@payloadcms/richtext-lexical",
|
||||
"version": "0.5.1",
|
||||
"version": "0.5.2",
|
||||
"description": "The officially supported Lexical richtext adapter for Payload",
|
||||
"repository": "https://github.com/payloadcms/payload",
|
||||
"license": "MIT",
|
||||
|
||||
@@ -100,8 +100,8 @@ describe('Fields', () => {
|
||||
const { id } = await payload.create({
|
||||
collection: 'text-fields',
|
||||
data: {
|
||||
text,
|
||||
localizedHasMany,
|
||||
text,
|
||||
},
|
||||
locale: 'en',
|
||||
})
|
||||
@@ -112,7 +112,7 @@ describe('Fields', () => {
|
||||
})
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
// @ts-expect-error
|
||||
expect(localizedDoc.localizedHasMany.en).toEqual(localizedHasMany)
|
||||
})
|
||||
})
|
||||
@@ -257,6 +257,20 @@ describe('Fields', () => {
|
||||
expect(docs.map(({ id }) => id)).toContain(doc.id)
|
||||
})
|
||||
|
||||
it('should not error using invalid date query', async () => {
|
||||
const { result, status } = await client.find({
|
||||
slug: 'date-fields',
|
||||
query: {
|
||||
updatedAt: {
|
||||
like: 'invalid',
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
expect(status).toStrictEqual(200)
|
||||
expect(result.docs).toBeDefined()
|
||||
})
|
||||
|
||||
it('should query createdAt', async () => {
|
||||
const result = await payload.find({
|
||||
collection: 'date-fields',
|
||||
@@ -268,7 +282,7 @@ describe('Fields', () => {
|
||||
},
|
||||
})
|
||||
|
||||
expect(result.docs[0].id).toEqual(doc.id)
|
||||
expect(result.docs[0].id).toStrictEqual(doc.id)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -413,7 +427,7 @@ describe('Fields', () => {
|
||||
})
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
// @ts-expect-error
|
||||
expect(localizedDoc.localizedHasMany.en).toEqual(localizedHasMany)
|
||||
})
|
||||
})
|
||||
@@ -1183,8 +1197,8 @@ describe('Fields', () => {
|
||||
expect(nodes).toBeDefined()
|
||||
const child = nodes.flatMap((n) => n.children).find((c) => c.doc)
|
||||
expect(child).toMatchObject({
|
||||
linkType: 'internal',
|
||||
type: 'link',
|
||||
linkType: 'internal',
|
||||
})
|
||||
expect(child.doc.relationTo).toEqual('array-fields')
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import { serializeLexical } from '../../packages/plugin-form-builder/src/utiliti
|
||||
import { serializeSlate } from '../../packages/plugin-form-builder/src/utilities/slate/serializeSlate'
|
||||
import { initPayloadTest } from '../helpers/configHelpers'
|
||||
import { formSubmissionsSlug, formsSlug } from './shared'
|
||||
import { ValidationError } from '../../packages/payload/src/errors'
|
||||
|
||||
describe('Form Builder Plugin', () => {
|
||||
let form: Form
|
||||
@@ -42,7 +43,7 @@ describe('Form Builder Plugin', () => {
|
||||
|
||||
it('adds form submissions collection', async () => {
|
||||
const { docs: formSubmissions } = await payload.find({ collection: formSubmissionsSlug })
|
||||
expect(formSubmissions).toHaveLength(0)
|
||||
expect(formSubmissions).toHaveLength(1)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -118,6 +119,25 @@ describe('Form Builder Plugin', () => {
|
||||
expect(formSubmission.submissionData[0]).toHaveProperty('value', 'Test Submission')
|
||||
})
|
||||
|
||||
it('does not create a form submission for a non-existing form', async () => {
|
||||
const req = async () =>
|
||||
payload.create({
|
||||
collection: formSubmissionsSlug,
|
||||
data: {
|
||||
form: '659c7c2f98ffb5d83df9dadb',
|
||||
submissionData: [
|
||||
{
|
||||
field: 'name',
|
||||
value: 'Test Submission',
|
||||
},
|
||||
],
|
||||
},
|
||||
depth: 0,
|
||||
})
|
||||
|
||||
await expect(req).rejects.toThrow(ValidationError)
|
||||
})
|
||||
|
||||
it('replaces curly braces with data when using slate serializer', async () => {
|
||||
const mockName = 'Test Submission'
|
||||
const mockEmail = 'dev@payloadcms.com'
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { Payload } from '../../../packages/payload/src'
|
||||
import type { PayloadRequest } from '../../../packages/payload/src/express/types'
|
||||
|
||||
import { formsSlug, pagesSlug } from '../shared'
|
||||
import { formSubmissionsSlug, formsSlug, pagesSlug } from '../shared'
|
||||
|
||||
export const seed = async (payload: Payload): Promise<boolean> => {
|
||||
payload.logger.info('Seeding data...')
|
||||
@@ -53,6 +53,23 @@ export const seed = async (payload: Payload): Promise<boolean> => {
|
||||
},
|
||||
})
|
||||
|
||||
await payload.create({
|
||||
collection: formSubmissionsSlug,
|
||||
data: {
|
||||
form: formID,
|
||||
submissionData: [
|
||||
{
|
||||
field: 'name',
|
||||
value: 'Test Submission',
|
||||
},
|
||||
{
|
||||
field: 'email',
|
||||
value: 'tester@example.com',
|
||||
},
|
||||
],
|
||||
},
|
||||
})
|
||||
|
||||
await payload.create({
|
||||
collection: pagesSlug,
|
||||
data: {
|
||||
|
||||
Reference in New Issue
Block a user