mirror of
https://github.com/xtr-dev/payload-mailing.git
synced 2025-12-10 00:03:23 +00:00
Merge pull request #31 from xtr-dev/dev
Fix variables field type to support all JSON-compatible values
This commit is contained in:
@@ -53,6 +53,9 @@ Your Payload configuration determines which types are used. The plugin automatic
|
|||||||
The base interfaces provided by the plugin:
|
The base interfaces provided by the plugin:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
|
// JSON value type that matches Payload's JSON field type
|
||||||
|
type JSONValue = string | number | boolean | { [k: string]: unknown } | unknown[] | null | undefined
|
||||||
|
|
||||||
interface BaseEmailDocument {
|
interface BaseEmailDocument {
|
||||||
id: string | number
|
id: string | number
|
||||||
template?: any
|
template?: any
|
||||||
@@ -64,7 +67,7 @@ interface BaseEmailDocument {
|
|||||||
subject: string
|
subject: string
|
||||||
html: string
|
html: string
|
||||||
text?: string | null
|
text?: string | null
|
||||||
variables?: Record<string, any> | null
|
variables?: JSONValue // Supports any JSON-compatible value
|
||||||
scheduledAt?: string | null
|
scheduledAt?: string | null
|
||||||
sentAt?: string | null
|
sentAt?: string | null
|
||||||
status?: 'pending' | 'processing' | 'sent' | 'failed' | null
|
status?: 'pending' | 'processing' | 'sent' | 'failed' | null
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@xtr-dev/payload-mailing",
|
"name": "@xtr-dev/payload-mailing",
|
||||||
"version": "0.1.14",
|
"version": "0.1.15",
|
||||||
"description": "Template-based email system with scheduling and job processing for PayloadCMS",
|
"description": "Template-based email system with scheduling and job processing for PayloadCMS",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
|
|||||||
@@ -2,6 +2,9 @@ import { Payload } from 'payload'
|
|||||||
import type { CollectionConfig, RichTextField } from 'payload'
|
import type { CollectionConfig, RichTextField } from 'payload'
|
||||||
import { Transporter } from 'nodemailer'
|
import { Transporter } from 'nodemailer'
|
||||||
|
|
||||||
|
// JSON value type that matches Payload's JSON field type
|
||||||
|
export type JSONValue = string | number | boolean | { [k: string]: unknown } | unknown[] | null | undefined
|
||||||
|
|
||||||
// Generic base interfaces that work with any ID type and null values
|
// Generic base interfaces that work with any ID type and null values
|
||||||
export interface BaseEmailDocument {
|
export interface BaseEmailDocument {
|
||||||
id: string | number
|
id: string | number
|
||||||
@@ -14,7 +17,7 @@ export interface BaseEmailDocument {
|
|||||||
subject: string
|
subject: string
|
||||||
html: string
|
html: string
|
||||||
text?: string | null
|
text?: string | null
|
||||||
variables?: Record<string, any> | null
|
variables?: JSONValue
|
||||||
scheduledAt?: string | null
|
scheduledAt?: string | null
|
||||||
sentAt?: string | null
|
sentAt?: string | null
|
||||||
status?: 'pending' | 'processing' | 'sent' | 'failed' | null
|
status?: 'pending' | 'processing' | 'sent' | 'failed' | null
|
||||||
@@ -84,7 +87,7 @@ export interface QueuedEmail {
|
|||||||
subject: string
|
subject: string
|
||||||
html: string
|
html: string
|
||||||
text?: string | null
|
text?: string | null
|
||||||
variables?: Record<string, any> | null
|
variables?: JSONValue
|
||||||
scheduledAt?: string | null
|
scheduledAt?: string | null
|
||||||
sentAt?: string | null
|
sentAt?: string | null
|
||||||
status: 'pending' | 'processing' | 'sent' | 'failed'
|
status: 'pending' | 'processing' | 'sent' | 'failed'
|
||||||
|
|||||||
Reference in New Issue
Block a user