Socket
Socket
Sign inDemoInstall

payload

Package Overview
Dependencies
177
Maintainers
2
Versions
601
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.0.0-beta.19 to 3.0.0-beta.20

3

dist/admin/elements/Tab.d.ts
import type { I18n } from '@payloadcms/translations';
import type { Permissions } from '../../auth/types.js';
import type { SanitizedCollectionConfig } from '../../collections/config/types.js';

@@ -11,2 +12,3 @@ import type { SanitizedConfig } from '../../config/types.js';

i18n: I18n;
permissions: Permissions;
};

@@ -17,2 +19,3 @@ export type DocumentTabCondition = (args: {

globalConfig: SanitizedGlobalConfig;
permissions: Permissions;
}) => boolean;

@@ -19,0 +22,0 @@ export type DocumentTabConfig = {

5

dist/auth/operations/forgotPassword.js

@@ -60,4 +60,5 @@ import crypto from 'crypto';

if (!disableEmail) {
const protocol = new URL(req.url).protocol;
const serverURL = config.serverURL !== null && config.serverURL !== '' ? config.serverURL : `${protocol}://${req.headers.get('host')}`;
const protocol = new URL(req.url).protocol // includes the final :
;
const serverURL = config.serverURL !== null && config.serverURL !== '' ? config.serverURL : `${protocol}//${req.headers.get('host')}`;
let html = `${req.t('authentication:youAreReceivingResetPassword')}

@@ -64,0 +65,0 @@ <a href="${serverURL}${config.routes.admin}/reset/${token}">

@@ -6,4 +6,5 @@ import { URL } from 'url';

if (!disableEmail) {
const protocol = new URL(req.url).protocol;
const serverURL = config.serverURL !== null && config.serverURL !== '' ? config.serverURL : `${protocol}://${req.headers.get('host')}`;
const protocol = new URL(req.url).protocol // includes the final :
;
const serverURL = config.serverURL !== null && config.serverURL !== '' ? config.serverURL : `${protocol}//${req.headers.get('host')}`;
const verificationURL = `${serverURL}${config.routes.admin}/${collectionConfig.slug}/verify/${token}`;

@@ -10,0 +11,0 @@ let html = `${req.t('authentication:newAccountCreated', {

import type { Config } from '../../config/types.js';
import type { CollectionConfig, SanitizedCollectionConfig } from './types.js';
declare const sanitizeCollection: (config: Config, collection: CollectionConfig) => SanitizedCollectionConfig;
export default sanitizeCollection;
export declare const sanitizeCollection: (config: Config, collection: CollectionConfig) => SanitizedCollectionConfig;
//# sourceMappingURL=sanitize.d.ts.map

@@ -15,3 +15,3 @@ import merge from 'deepmerge';

import { authDefaults, defaults } from './defaults.js';
const sanitizeCollection = (config, collection)=>{
export const sanitizeCollection = (config, collection)=>{
// /////////////////////////////////

@@ -129,4 +129,3 @@ // Make copy of collection config

};
export default sanitizeCollection;
//# sourceMappingURL=sanitize.js.map

@@ -130,2 +130,3 @@ import joi from 'joi';

upload: joi.alternatives().try(joi.object({
adapter: joi.string(),
adminThumbnail: joi.alternatives().try(joi.string(), componentSchema),

@@ -132,0 +133,0 @@ crop: joi.bool(),

import { en } from '@payloadcms/translations/languages/en';
import merge from 'deepmerge';
import { defaultUserCollection } from '../auth/defaultUser.js';
import sanitizeCollection from '../collections/config/sanitize.js';
import { sanitizeCollection } from '../collections/config/sanitize.js';
import { migrationsCollection } from '../database/migrations/migrationsCollection.js';

@@ -26,3 +26,4 @@ import { InvalidConfiguration } from '../errors/index.js';

}
if (!sanitizedConfig.collections.find(({ slug })=>slug === sanitizedConfig.admin.user)) {
const userCollection = sanitizedConfig.collections.find(({ slug })=>slug === sanitizedConfig.admin.user);
if (!userCollection || !userCollection.auth) {
throw new InvalidConfiguration(`${sanitizedConfig.admin.user} is not a valid admin user collection`);

@@ -84,2 +85,7 @@ }

}
// Get deduped list of upload adapters
if (!config.upload) config.upload = {
adapters: []
};
config.upload.adapters = Array.from(new Set(config.collections.map((c)=>c.upload?.adapter).filter(Boolean)));
return config;

@@ -86,0 +92,0 @@ };

@@ -84,3 +84,3 @@ import joi from 'joi';

}).unknown(),
email: joi.object(),
email: joi.alternatives().try(joi.object(), joi.func()),
endpoints: endpointsSchema,

@@ -87,0 +87,0 @@ globals: joi.array(),

@@ -564,3 +564,3 @@ /// <reference types="node" resolution-mode="require"/>

};
export type SanitizedConfig = Omit<DeepRequired<Config>, 'collections' | 'endpoint' | 'globals' | 'i18n' | 'localization'> & {
export type SanitizedConfig = Omit<DeepRequired<Config>, 'collections' | 'endpoint' | 'globals' | 'i18n' | 'localization' | 'upload'> & {
collections: SanitizedCollectionConfig[];

@@ -576,2 +576,8 @@ endpoints: Endpoint[];

};
upload: ExpressFileUploadOptions & {
/**
* Deduped list of adapters used in the project
*/
adapters: string[];
};
};

@@ -578,0 +584,0 @@ export type EditConfig = ({

import { emailDefaults } from './defaults.js';
import { getStringifiedToAddress } from './getStringifiedToAddress.js';
export const consoleEmailAdapter = ({ payload })=>({
name: 'console',
defaultFromAddress: emailDefaults.defaultFromAddress,

@@ -5,0 +6,0 @@ defaultFromName: emailDefaults.defaultFromName,

@@ -24,2 +24,3 @@ import type { SendMailOptions as NodemailerSendMailOptions } from 'nodemailer';

defaultFromName: string;
name: string;
sendEmail: (message: SendEmailOptions) => Promise<TSendEmailResponse>;

@@ -26,0 +27,0 @@ };

@@ -67,2 +67,6 @@ /// <reference types="node" resolution-mode="require"/>

/**
* The adapter to use for uploads.
*/
adapter?: string;
/**
* Represents an admin thumbnail, which can be either a React component or a string.

@@ -69,0 +73,0 @@ * - If a string, it should be one of the image size names.

@@ -46,3 +46,3 @@ import { getDataLoader } from '../collections/dataloader.js';

// @ts-expect-error
if (!req?.url) req.url = getURLObject().url;
if (!req?.url) req.url = getURLObject().href;
};

@@ -64,2 +64,4 @@ export const createLocalReq = async ({ context, fallbackLocale, locale: localeArg, req = {}, user }, payload)=>{

}
// @ts-expect-error
if (!req.headers) req.headers = new Headers();
req.context = getRequestContext(req, context);

@@ -66,0 +68,0 @@ req.payloadAPI = req?.payloadAPI || 'local';

@@ -6,9 +6,14 @@ import type { Payload } from '../../types/index.js';

ciName: null | string;
dbAdapter: string;
emailAdapter: null | string;
envID: string;
isCI: boolean;
locales: string[];
localizationDefaultLocale: null | string;
localizationEnabled: boolean;
nodeEnv: string;
nodeVersion: string;
payloadPackages: Record<string, string>;
payloadVersion: string;
projectID: string;
uploadAdapters: string[];
};

@@ -26,3 +31,4 @@ type PackageJSON = {

export declare const getPayloadVersion: (packageJSON: PackageJSON) => string;
export declare const getLocalizationInfo: (payload: Payload) => Pick<BaseEvent, 'locales' | 'localizationDefaultLocale' | 'localizationEnabled'>;
export {};
//# sourceMappingURL=index.d.ts.map

@@ -14,3 +14,3 @@ import { execSync } from 'child_process';

try {
const packageJSON = await getPackageJSON();
const { packageJSON, packageJSONPath } = await getPackageJSON();
// Only generate the base event once

@@ -24,5 +24,8 @@ if (!baseEvent) {

nodeVersion: process.version,
payloadPackages: getPayloadPackages(packageJSON),
payloadVersion: getPayloadVersion(packageJSON),
projectID: getProjectID(payload, packageJSON)
projectID: getProjectID(payload, packageJSON),
...getLocalizationInfo(payload),
dbAdapter: payload.db.name,
emailAdapter: payload.email?.name || null,
uploadAdapters: payload.config.upload.adapters
};

@@ -34,3 +37,4 @@ }

...baseEvent,
...event
...event,
packageJSONPath
},

@@ -86,18 +90,22 @@ msg: 'Telemetry Event'

};
const getPayloadPackages = (packageJSON)=>{
return Object.keys(packageJSON.dependencies || {}).reduce((acc, key)=>{
return key.startsWith('@payloadcms/') ? {
...acc,
[key]: packageJSON.dependencies[key]
} : acc;
}, {});
};
const getPackageJSON = async ()=>{
const filename = fileURLToPath(import.meta.url);
const dirname = path.dirname(filename);
const packageJsonPath = await findUp('package.json', {
cwd: dirname
});
const jsonContent = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
return jsonContent;
let packageJSONPath = path.resolve(process.cwd(), 'package.json');
if (!fs.existsSync(packageJSONPath)) {
// Old logic
const filename = fileURLToPath(import.meta.url);
const dirname = path.dirname(filename);
packageJSONPath = await findUp('package.json', {
cwd: dirname
});
const jsonContent = JSON.parse(fs.readFileSync(packageJSONPath, 'utf-8'));
return {
packageJSON: jsonContent,
packageJSONPath
};
}
const packageJSON = JSON.parse(fs.readFileSync(packageJSONPath, 'utf-8'));
return {
packageJSON,
packageJSONPath
};
};

@@ -110,3 +118,17 @@ const getPackageJSONID = (payload, packageJSON)=>{

};
export const getLocalizationInfo = (payload)=>{
if (!payload.config.localization) {
return {
locales: [],
localizationDefaultLocale: null,
localizationEnabled: false
};
}
return {
locales: payload.config.localization.localeCodes,
localizationDefaultLocale: payload.config.localization.defaultLocale,
localizationEnabled: true
};
};
//# sourceMappingURL=index.js.map
{
"name": "payload",
"version": "3.0.0-beta.19",
"version": "3.0.0-beta.20",
"description": "Node, React, Headless CMS and Application Framework built on Next.js",

@@ -102,3 +102,3 @@ "keywords": [

"uuid": "^9.0.1",
"@payloadcms/translations": "3.0.0-beta.19"
"@payloadcms/translations": "3.0.0-beta.20"
},

@@ -159,3 +159,3 @@ "devDependencies": {

"engines": {
"node": ">=18.20.2"
"node": "^18.20.2 || >=20.6.0"
},

@@ -162,0 +162,0 @@ "publishConfig": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc