@brandlift/payload-loggs 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +85 -0
- package/dist/collections/SiteActivityCollection.js +154 -0
- package/dist/collections/SiteActivityCollection.js.map +1 -0
- package/dist/collections/siteActivity.js +6 -0
- package/dist/collections/siteActivity.js.map +1 -0
- package/dist/core/automation/tasks/cleanup/cleanup.js +41 -0
- package/dist/core/automation/tasks/cleanup/cleanup.js.map +1 -0
- package/dist/core/buffer/bufferManager.js +41 -0
- package/dist/core/buffer/bufferManager.js.map +1 -0
- package/dist/core/buffer/types.js +3 -0
- package/dist/core/buffer/types.js.map +1 -0
- package/dist/core/events/emitter.js +16 -0
- package/dist/core/events/emitter.js.map +1 -0
- package/dist/core/log-builders/helpers/extractOperation/extractOperation.js +11 -0
- package/dist/core/log-builders/helpers/extractOperation/extractOperation.js.map +1 -0
- package/dist/core/log-builders/helpers/handleDebugMode.js +15 -0
- package/dist/core/log-builders/helpers/handleDebugMode.js.map +1 -0
- package/dist/core/log-builders/helpers/isOperationEnabled/isOperationEnabled.js +8 -0
- package/dist/core/log-builders/helpers/isOperationEnabled/isOperationEnabled.js.map +1 -0
- package/dist/core/log-builders/logBuilderManager/logBuilderManager.js +49 -0
- package/dist/core/log-builders/logBuilderManager/logBuilderManager.js.map +1 -0
- package/dist/hooks/collectionHooks.js +197 -0
- package/dist/hooks/collectionHooks.js.map +1 -0
- package/dist/hooks/globalHooks.js +56 -0
- package/dist/hooks/globalHooks.js.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/plugin.js +46 -0
- package/dist/plugin.js.map +1 -0
- package/dist/pluginUtils/attachCollectionConfig/attachCollectionConfig.js +77 -0
- package/dist/pluginUtils/attachCollectionConfig/attachCollectionConfig.js.map +1 -0
- package/dist/pluginUtils/attachGlobalConfig/attachGlobalConfig.js +54 -0
- package/dist/pluginUtils/attachGlobalConfig/attachGlobalConfig.js.map +1 -0
- package/dist/pluginUtils/configHelpers.js +40 -0
- package/dist/pluginUtils/configHelpers.js.map +1 -0
- package/dist/pluginUtils/formatUserDisplay.js +19 -0
- package/dist/pluginUtils/formatUserDisplay.js.map +1 -0
- package/dist/pluginUtils/getCollectionLabel.js +41 -0
- package/dist/pluginUtils/getCollectionLabel.js.map +1 -0
- package/dist/pluginUtils/getResourceTitle.js +31 -0
- package/dist/pluginUtils/getResourceTitle.js.map +1 -0
- package/dist/types/collection.js +3 -0
- package/dist/types/collection.js.map +1 -0
- package/dist/types/config.js +3 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/global.js +3 -0
- package/dist/types/global.js.map +1 -0
- package/dist/types/types.d.js +3 -0
- package/dist/types/types.d.js.map +1 -0
- package/dist/utils/prettyDebugLog.js +15 -0
- package/dist/utils/prettyDebugLog.js.map +1 -0
- package/package.json +160 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolves a human-readable singular label for a collection or global.
|
|
3
|
+
* Defaults to capitalizing the slug if labels are omitted.
|
|
4
|
+
*/ export const getCollectionLabel = (entity)=>{
|
|
5
|
+
if (!entity) {
|
|
6
|
+
return 'Resource';
|
|
7
|
+
}
|
|
8
|
+
// Check collection singular label
|
|
9
|
+
if ('labels' in entity && entity.labels) {
|
|
10
|
+
const singular = typeof entity.labels === 'object' ? entity.labels.singular : entity.labels;
|
|
11
|
+
if (typeof singular === 'string' && singular) {
|
|
12
|
+
return singular;
|
|
13
|
+
}
|
|
14
|
+
if (typeof singular === 'object' && singular !== null) {
|
|
15
|
+
const firstVal = Object.values(singular).find((v)=>typeof v === 'string' && v.trim() !== '');
|
|
16
|
+
if (firstVal && typeof firstVal === 'string') {
|
|
17
|
+
return firstVal;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
// Check global label
|
|
22
|
+
if ('label' in entity && entity.label) {
|
|
23
|
+
if (typeof entity.label === 'string' && entity.label) {
|
|
24
|
+
return entity.label;
|
|
25
|
+
}
|
|
26
|
+
if (typeof entity.label === 'object' && entity.label !== null) {
|
|
27
|
+
const firstVal = Object.values(entity.label).find((v)=>typeof v === 'string' && v.trim() !== '');
|
|
28
|
+
if (firstVal && typeof firstVal === 'string') {
|
|
29
|
+
return firstVal;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
// Fallback: capitalize slug
|
|
34
|
+
const slug = entity.slug || '';
|
|
35
|
+
if (!slug) {
|
|
36
|
+
return 'Resource';
|
|
37
|
+
}
|
|
38
|
+
return slug.split('-').map((word)=>word.charAt(0).toUpperCase() + word.slice(1)).join(' ');
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
//# sourceMappingURL=getCollectionLabel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/pluginUtils/getCollectionLabel.ts"],"sourcesContent":["import type { CollectionConfig, GlobalConfig } from 'payload';\n\n/**\n * Resolves a human-readable singular label for a collection or global.\n * Defaults to capitalizing the slug if labels are omitted.\n */\nexport const getCollectionLabel = (\n entity: CollectionConfig | GlobalConfig | { slug: string; labels?: any; label?: any },\n): string => {\n if (!entity) {\n return 'Resource';\n }\n\n // Check collection singular label\n if ('labels' in entity && entity.labels) {\n const singular = typeof entity.labels === 'object' ? entity.labels.singular : entity.labels;\n if (typeof singular === 'string' && singular) {\n return singular;\n }\n if (typeof singular === 'object' && singular !== null) {\n const firstVal = Object.values(singular).find(v => typeof v === 'string' && v.trim() !== '');\n if (firstVal && typeof firstVal === 'string') {\n return firstVal;\n }\n }\n }\n\n // Check global label\n if ('label' in entity && entity.label) {\n if (typeof entity.label === 'string' && entity.label) {\n return entity.label;\n }\n if (typeof entity.label === 'object' && entity.label !== null) {\n const firstVal = Object.values(entity.label).find(v => typeof v === 'string' && v.trim() !== '');\n if (firstVal && typeof firstVal === 'string') {\n return firstVal;\n }\n }\n }\n\n // Fallback: capitalize slug\n const slug = entity.slug || '';\n if (!slug) {\n return 'Resource';\n }\n return slug\n .split('-')\n .map(word => word.charAt(0).toUpperCase() + word.slice(1))\n .join(' ');\n};\n"],"names":["getCollectionLabel","entity","labels","singular","firstVal","Object","values","find","v","trim","label","slug","split","map","word","charAt","toUpperCase","slice","join"],"mappings":"AAEA;;;CAGC,GACD,OAAO,MAAMA,qBAAqB,CAChCC;IAEA,IAAI,CAACA,QAAQ;QACX,OAAO;IACT;IAEA,kCAAkC;IAClC,IAAI,YAAYA,UAAUA,OAAOC,MAAM,EAAE;QACvC,MAAMC,WAAW,OAAOF,OAAOC,MAAM,KAAK,WAAWD,OAAOC,MAAM,CAACC,QAAQ,GAAGF,OAAOC,MAAM;QAC3F,IAAI,OAAOC,aAAa,YAAYA,UAAU;YAC5C,OAAOA;QACT;QACA,IAAI,OAAOA,aAAa,YAAYA,aAAa,MAAM;YACrD,MAAMC,WAAWC,OAAOC,MAAM,CAACH,UAAUI,IAAI,CAACC,CAAAA,IAAK,OAAOA,MAAM,YAAYA,EAAEC,IAAI,OAAO;YACzF,IAAIL,YAAY,OAAOA,aAAa,UAAU;gBAC5C,OAAOA;YACT;QACF;IACF;IAEA,qBAAqB;IACrB,IAAI,WAAWH,UAAUA,OAAOS,KAAK,EAAE;QACrC,IAAI,OAAOT,OAAOS,KAAK,KAAK,YAAYT,OAAOS,KAAK,EAAE;YACpD,OAAOT,OAAOS,KAAK;QACrB;QACA,IAAI,OAAOT,OAAOS,KAAK,KAAK,YAAYT,OAAOS,KAAK,KAAK,MAAM;YAC7D,MAAMN,WAAWC,OAAOC,MAAM,CAACL,OAAOS,KAAK,EAAEH,IAAI,CAACC,CAAAA,IAAK,OAAOA,MAAM,YAAYA,EAAEC,IAAI,OAAO;YAC7F,IAAIL,YAAY,OAAOA,aAAa,UAAU;gBAC5C,OAAOA;YACT;QACF;IACF;IAEA,4BAA4B;IAC5B,MAAMO,OAAOV,OAAOU,IAAI,IAAI;IAC5B,IAAI,CAACA,MAAM;QACT,OAAO;IACT;IACA,OAAOA,KACJC,KAAK,CAAC,KACNC,GAAG,CAACC,CAAAA,OAAQA,KAAKC,MAAM,CAAC,GAAGC,WAAW,KAAKF,KAAKG,KAAK,CAAC,IACtDC,IAAI,CAAC;AACV,EAAE"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extracts a human-readable resource title from a document or global data object,
|
|
3
|
+
* falling back to document ID if title attributes are missing.
|
|
4
|
+
*/ export const getResourceTitle = (doc, fallbackId)=>{
|
|
5
|
+
if (!doc && fallbackId !== undefined && fallbackId !== null) {
|
|
6
|
+
return String(fallbackId);
|
|
7
|
+
}
|
|
8
|
+
if (!doc) {
|
|
9
|
+
return undefined;
|
|
10
|
+
}
|
|
11
|
+
const titleCandidate = doc.title || doc.name || doc.label || doc.slug;
|
|
12
|
+
if (titleCandidate && typeof titleCandidate === 'string') {
|
|
13
|
+
return titleCandidate;
|
|
14
|
+
}
|
|
15
|
+
if (titleCandidate && typeof titleCandidate === 'object' && titleCandidate !== null) {
|
|
16
|
+
// Handling localized fields if title/name is an object
|
|
17
|
+
const firstVal = Object.values(titleCandidate).find((v)=>typeof v === 'string' && v.trim() !== '');
|
|
18
|
+
if (firstVal && typeof firstVal === 'string') {
|
|
19
|
+
return firstVal;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
if (doc.id !== undefined && doc.id !== null) {
|
|
23
|
+
return String(doc.id);
|
|
24
|
+
}
|
|
25
|
+
if (fallbackId !== undefined && fallbackId !== null) {
|
|
26
|
+
return String(fallbackId);
|
|
27
|
+
}
|
|
28
|
+
return undefined;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=getResourceTitle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/pluginUtils/getResourceTitle.ts"],"sourcesContent":["/**\n * Extracts a human-readable resource title from a document or global data object,\n * falling back to document ID if title attributes are missing.\n */\nexport const getResourceTitle = (\n doc?: Record<string, any> | null,\n fallbackId?: string | number | null,\n): string | undefined => {\n if (!doc && fallbackId !== undefined && fallbackId !== null) {\n return String(fallbackId);\n }\n if (!doc) {\n return undefined;\n }\n\n const titleCandidate = doc.title || doc.name || doc.label || doc.slug;\n if (titleCandidate && typeof titleCandidate === 'string') {\n return titleCandidate;\n }\n if (titleCandidate && typeof titleCandidate === 'object' && titleCandidate !== null) {\n // Handling localized fields if title/name is an object\n const firstVal = Object.values(titleCandidate).find(v => typeof v === 'string' && v.trim() !== '');\n if (firstVal && typeof firstVal === 'string') {\n return firstVal;\n }\n }\n\n if (doc.id !== undefined && doc.id !== null) {\n return String(doc.id);\n }\n\n if (fallbackId !== undefined && fallbackId !== null) {\n return String(fallbackId);\n }\n\n return undefined;\n};\n"],"names":["getResourceTitle","doc","fallbackId","undefined","String","titleCandidate","title","name","label","slug","firstVal","Object","values","find","v","trim","id"],"mappings":"AAAA;;;CAGC,GACD,OAAO,MAAMA,mBAAmB,CAC9BC,KACAC;IAEA,IAAI,CAACD,OAAOC,eAAeC,aAAaD,eAAe,MAAM;QAC3D,OAAOE,OAAOF;IAChB;IACA,IAAI,CAACD,KAAK;QACR,OAAOE;IACT;IAEA,MAAME,iBAAiBJ,IAAIK,KAAK,IAAIL,IAAIM,IAAI,IAAIN,IAAIO,KAAK,IAAIP,IAAIQ,IAAI;IACrE,IAAIJ,kBAAkB,OAAOA,mBAAmB,UAAU;QACxD,OAAOA;IACT;IACA,IAAIA,kBAAkB,OAAOA,mBAAmB,YAAYA,mBAAmB,MAAM;QACnF,uDAAuD;QACvD,MAAMK,WAAWC,OAAOC,MAAM,CAACP,gBAAgBQ,IAAI,CAACC,CAAAA,IAAK,OAAOA,MAAM,YAAYA,EAAEC,IAAI,OAAO;QAC/F,IAAIL,YAAY,OAAOA,aAAa,UAAU;YAC5C,OAAOA;QACT;IACF;IAEA,IAAIT,IAAIe,EAAE,KAAKb,aAAaF,IAAIe,EAAE,KAAK,MAAM;QAC3C,OAAOZ,OAAOH,IAAIe,EAAE;IACtB;IAEA,IAAId,eAAeC,aAAaD,eAAe,MAAM;QACnD,OAAOE,OAAOF;IAChB;IAEA,OAAOC;AACT,EAAE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/types/collection.ts"],"sourcesContent":["import type { AllOperations, CollectionConfig, PayloadTypes } from 'payload';\n\nimport type { SiteActivityLog } from '../collections/siteActivity.js';\n\nexport type OperationDebugConfig = {\n skipDatabaseSave?: boolean;\n} | true;\n\nexport type CollectionHookDebugConfig = {\n skipDatabaseSave?: true;\n} | true;\n\nexport type CollectionHooksKeys = keyof NonNullable<CollectionConfig['hooks']>;\nexport type CollectionHooksOperation = AllOperations | 'read' | 'delete' | 'error' | 'login' | 'logout' | 'me' | 'refresh' | 'forgotPassword' | '';\nexport type CollectionHooksArgsParameterUnion = Parameters<\n NonNullable<\n NonNullable<\n CollectionConfig['hooks']\n >[CollectionHooksKeys]\n >[number]\n>[0];\n\nexport type PayloadCollectionHooksMap = {\n [K in CollectionHooksKeys]: NonNullable<NonNullable<CollectionConfig['hooks']>[K]>[number]\n};\nexport type CollectionsHookConfigForTracking = {\n [K in keyof NonNullable<CollectionConfig['hooks']>]:\n Partial<\n {\n // @ts-expect-error\n [O in Parameters<\n NonNullable<\n NonNullable<\n CollectionConfig['hooks']\n >[K]\n >[number]\n >[0]['operation']]: CollectionOperationLogConfig | boolean\n } & CollectionHookLevelLogConfig<K>\n > | boolean\n};\n\nexport interface CollectionOperationLogConfig<\n HookName extends CollectionHooksKeys = CollectionHooksKeys,\n> {\n customLogger?: (\n args: Parameters<PayloadCollectionHooksMap[HookName]>[0],\n fields: Omit<SiteActivityLog, 'hook' | 'operation'>,\n ) => any | Promise<any>;\n enabled?: boolean;\n debug?: OperationDebugConfig;\n}\n\nexport interface CollectionHookLevelLogConfig<\n HookName extends CollectionHooksKeys = CollectionHooksKeys,\n> {\n customLogger?: (\n args: Parameters<PayloadCollectionHooksMap[HookName]>[0],\n fields: Omit<SiteActivityLog, 'hook'>,\n ) => Omit<SiteActivityLog, 'hook'> | Promise<Omit<SiteActivityLog, 'hook'>>;\n enabled?: boolean;\n debug?: CollectionHookDebugConfig;\n}\n\nexport interface TrackedCollection {\n hooks?: Partial<CollectionsHookConfigForTracking>;\n slug: keyof PayloadTypes['collections'];\n}\nexport interface CollectionsTrackConfig {\n track: TrackedCollection[];\n}\n"],"names":[],"mappings":"AAmEA,WAEC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/types/config.ts"],"sourcesContent":["import type {\n CollectionConfig,\n} from 'payload';\n\nimport type { GlobalsTrackConfig } from './global.js';\nimport type { BufferConfig } from '../core/buffer/types.js';\nimport type { CollectionsTrackConfig } from './collection.js';\nimport type { siteActivity } from '../collections/siteActivity.js';\n\nexport interface AutomationConfig {\n logCleanup?: {\n /**\n * @default 2592000000 // 30 days\n */\n olderThan?: number;\n /**\n * @default \"payload-loggs-queue\"\n */\n queueName?: string;\n /**\n * The cron for scheduling the job.\n *\n * @default '1 0 * * *' // At 00:01 AM daily\n *\n * @example\n * ┌───────────── (optional) second (0 - 59)\n * │ ┌───────────── minute (0 - 59)\n * │ │ ┌───────────── hour (0 - 23)\n * │ │ │ ┌───────────── day of the month (1 - 31)\n * │ │ │ │ ┌───────────── month (1 - 12)\n * │ │ │ │ │ ┌───────────── day of the week (0 - 6) (Sunday to Saturday)\n * │ │ │ │ │ │\n * │ │ │ │ │ │\n * - '* 0 * * * *' every hour at minute 0\n * - '* 0 0 * * *' daily at midnight\n * - '* 0 0 * * 0' weekly at midnight on Sundays\n * - '* 0 0 1 * *' monthly at midnight on the 1st day of the month\n * - '* 0/5 * * * *' every 5 minutes\n * - '* * * * * *' every second\n */\n cronTime?: string;\n };\n}\n\nexport interface PluginConfig {\n /**\n * @see {@link https://github.com/rushidshinde/payload-loggs#automation}\n */\n automation?: AutomationConfig;\n /**\n * @see {@link https://github.com/rushidshinde/payload-loggs#collectionsglobals}\n */\n collections?: CollectionsTrackConfig;\n\n /**\n * @see {@link https://github.com/rushidshinde/payload-loggs#buffer}\n */\n buffer?: BufferConfig;\n\n /**\n * @see {@link https://github.com/rushidshinde/payload-loggs#configurerootcollection}\n */\n configureRootCollection?: (defaults: typeof siteActivity) => CollectionConfig;\n\n /**\n * @see {@link https://github.com/rushidshinde/payload-loggs#collectionsglobals}\n */\n globals?: GlobalsTrackConfig;\n disabled?: boolean;\n}\n"],"names":[],"mappings":"AA4CA,WAyBC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/types/global.ts"],"sourcesContent":["import type { GlobalConfig, PayloadTypes } from 'payload';\n\nimport type { CollectionHookDebugConfig } from './collection.js';\nimport type { SiteActivityLog } from '../collections/siteActivity.js';\n\nexport type GlobalHooksKeys = keyof NonNullable<GlobalConfig['hooks']>;\n\nexport type GlobalOperationDebugConfig = {\n skipDatabaseSave?: boolean;\n} | true;\n\nexport type GlobalHookConfigForTracking = {\n [K in keyof NonNullable<GlobalConfig['hooks']>]:\n Partial<\n {\n // @ts-expect-error\n [O in Parameters<\n NonNullable<\n NonNullable<\n GlobalConfig['hooks']\n >[K]\n >[number]\n >[0]['operation']]: GlobalOperationLogConfig | boolean\n } & GlobalHookLevelLogConfig<K>\n > | boolean\n};\n\nexport interface GlobalOperationLogConfig<\n HookName extends GlobalHooksKeys = GlobalHooksKeys,\n> {\n customLogger?: (\n args: Parameters<NonNullable<NonNullable<GlobalConfig['hooks']>[HookName]>[number]>[0],\n fields: Omit<SiteActivityLog, 'hook' | 'operation'>,\n ) => Omit<SiteActivityLog, 'hook' | 'operation'> | Promise<Omit<SiteActivityLog, 'hook' | 'operation'>>;\n enabled?: boolean;\n debug?: GlobalOperationDebugConfig;\n}\n\nexport interface GlobalHookLevelLogConfig<\n HookName extends GlobalHooksKeys = GlobalHooksKeys,\n> {\n customLogger?: (\n args: Parameters<NonNullable<NonNullable<GlobalConfig['hooks']>[HookName]>[number]>[0],\n fields: Omit<SiteActivityLog, 'hook'>,\n ) => any\n | Promise<any>;\n enabled?: boolean;\n debug?: GlobalHookDebugConfig;\n}\n\nexport type GlobalHookDebugConfig = CollectionHookDebugConfig;\nexport interface TrackedGlobal {\n hooks?: Partial<GlobalHookConfigForTracking>;\n slug: keyof PayloadTypes['globals'];\n}\n\nexport interface GlobalsTrackConfig {\n track: TrackedGlobal[];\n}\n\nexport type GlobalHooksArgsParameterUnion = Parameters<\n NonNullable<\n NonNullable<\n GlobalConfig['hooks']\n >[GlobalHooksKeys]\n >[number]\n>[0];\n"],"names":[],"mappings":"AA4DA,WAMK"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/types/types.d.ts"],"sourcesContent":["import type { RequestContext as OriginalRequestContext } from 'payload';\n\nimport type { PluginConfig, TrackedCollection } from './../types/pluginOptions.ts';\n\ndeclare module 'payload' {\n // Create a new interface that merges your additional fields with the original one\n export interface RequestContext extends OriginalRequestContext {\n pluginOptions: PluginConfig;\n userHookConfig?: TrackedCollection;\n }\n}\n"],"names":[],"mappings":"AAEA,WAAmF"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/* eslint-disable no-console */ export const prettyDebugLog = (params)=>{
|
|
2
|
+
if (!params.data || Object.keys(params.data).length === 0) {
|
|
3
|
+
console.log('%cNo data to display', 'color: #888; font-style: italic;');
|
|
4
|
+
} else {
|
|
5
|
+
console.log('-----------------------------------------');
|
|
6
|
+
console.log(`| %c🔍 Debug Log - ${params.title} ${params.subtitle && `[${params.subtitle}]`} |`);
|
|
7
|
+
console.log('-----------------------------------------');
|
|
8
|
+
for (const [key, value] of Object.entries(params.data)){
|
|
9
|
+
console.log(`|- %c${key}:`, 'color: #666; font-weight: 600;', value);
|
|
10
|
+
}
|
|
11
|
+
console.log('-------------------------------------------');
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=prettyDebugLog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/prettyDebugLog.ts"],"sourcesContent":["/* eslint-disable no-console */\n\nimport type { LiteralUnion } from 'type-fest';\n\nimport type { GlobalHooksKeys } from '../types/global.js';\nimport type { CollectionHooksKeys, CollectionHooksOperation } from '../types/collection.js';\n\ntype Params = {\n title: LiteralUnion<CollectionHooksKeys | GlobalHooksKeys, string>;\n subtitle: LiteralUnion<CollectionHooksOperation | CollectionHooksOperation, string>;\n data: Record<string, any>;\n};\n\nexport const prettyDebugLog = (params: Params) => {\n if (!params.data || Object.keys(params.data).length === 0) {\n console.log('%cNo data to display', 'color: #888; font-style: italic;');\n }\n else {\n console.log('-----------------------------------------');\n console.log(`| %c🔍 Debug Log - ${params.title} ${params.subtitle && `[${params.subtitle}]`} |`);\n console.log('-----------------------------------------');\n for (const [key, value] of Object.entries(params.data)) {\n console.log(`|- %c${key}:`, 'color: #666; font-weight: 600;', value);\n }\n console.log('-------------------------------------------');\n }\n};\n"],"names":["prettyDebugLog","params","data","Object","keys","length","console","log","title","subtitle","key","value","entries"],"mappings":"AAAA,6BAA6B,GAa7B,OAAO,MAAMA,iBAAiB,CAACC;IAC7B,IAAI,CAACA,OAAOC,IAAI,IAAIC,OAAOC,IAAI,CAACH,OAAOC,IAAI,EAAEG,MAAM,KAAK,GAAG;QACzDC,QAAQC,GAAG,CAAC,wBAAwB;IACtC,OACK;QACHD,QAAQC,GAAG,CAAC;QACZD,QAAQC,GAAG,CAAC,CAAC,mBAAmB,EAAEN,OAAOO,KAAK,CAAC,CAAC,EAAEP,OAAOQ,QAAQ,IAAI,CAAC,CAAC,EAAER,OAAOQ,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC/FH,QAAQC,GAAG,CAAC;QACZ,KAAK,MAAM,CAACG,KAAKC,MAAM,IAAIR,OAAOS,OAAO,CAACX,OAAOC,IAAI,EAAG;YACtDI,QAAQC,GAAG,CAAC,CAAC,KAAK,EAAEG,IAAI,CAAC,CAAC,EAAE,kCAAkCC;QAChE;QACAL,QAAQC,GAAG,CAAC;IACd;AACF,EAAE"}
|
package/package.json
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@brandlift/payload-loggs",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"packageManager": "pnpm@10.2.0",
|
|
6
|
+
"description": "Zero-config activity feed, audit logging, and security tracking plugin for Payload CMS",
|
|
7
|
+
"author": {
|
|
8
|
+
"name": "Rushikesh Shinde",
|
|
9
|
+
"email": "rushidshinde@gmail.com"
|
|
10
|
+
},
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"homepage": "https://github.com/rushidshinde/payload-loggs#readme",
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "https://github.com/rushidshinde/payload-loggs"
|
|
16
|
+
},
|
|
17
|
+
"bugs": {
|
|
18
|
+
"url": "https://github.com/rushidshinde/payload-loggs/issues"
|
|
19
|
+
},
|
|
20
|
+
"keywords": [
|
|
21
|
+
"payload",
|
|
22
|
+
"plugin",
|
|
23
|
+
"auditor",
|
|
24
|
+
"logger",
|
|
25
|
+
"activity",
|
|
26
|
+
"site-activity",
|
|
27
|
+
"payload-plugin",
|
|
28
|
+
"payload-cms",
|
|
29
|
+
"security",
|
|
30
|
+
"payloadcms"
|
|
31
|
+
],
|
|
32
|
+
"exports": {
|
|
33
|
+
".": {
|
|
34
|
+
"types": "./dist/index.d.ts",
|
|
35
|
+
"import": "./dist/index.js",
|
|
36
|
+
"default": "./dist/index.js"
|
|
37
|
+
},
|
|
38
|
+
"./client": {
|
|
39
|
+
"types": "./dist/exports/client.d.ts",
|
|
40
|
+
"import": "./dist/exports/client.js",
|
|
41
|
+
"default": "./dist/exports/client.js"
|
|
42
|
+
},
|
|
43
|
+
"./rsc": {
|
|
44
|
+
"types": "./dist/exports/rsc.d.ts",
|
|
45
|
+
"import": "./dist/exports/rsc.js",
|
|
46
|
+
"default": "./dist/exports/rsc.js"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"main": "./dist/index.js",
|
|
50
|
+
"types": "./dist/index.d.ts",
|
|
51
|
+
"files": [
|
|
52
|
+
"LICENSE",
|
|
53
|
+
"README.md",
|
|
54
|
+
"dist"
|
|
55
|
+
],
|
|
56
|
+
"engines": {
|
|
57
|
+
"node": ">=24"
|
|
58
|
+
},
|
|
59
|
+
"scripts": {
|
|
60
|
+
"build:safe": "npm run test:unit && npm run check-types && npm run lint && npm run copyfiles && npm run build:types && npm run build:swc",
|
|
61
|
+
"build:swc": "swc ./src -d ./dist --config-file .swcrc --strip-leading-paths",
|
|
62
|
+
"build": "npm run copyfiles && npm run build:types && npm run build:swc",
|
|
63
|
+
"build:types": "tsc --outDir dist --rootDir ./src",
|
|
64
|
+
"build:only": "npm run copyfiles && npm run build:types && npm run build:swc",
|
|
65
|
+
"clean": "rimraf {dist,*.tsbuildinfo} --glob",
|
|
66
|
+
"copyfiles": "copyfiles -u 1 \"src/**/*.{html,css,scss,ttf,woff,woff2,eot,svg,jpg,png,json}\" dist/",
|
|
67
|
+
"eslint": "eslint .",
|
|
68
|
+
"lint": "npm run eslint:base",
|
|
69
|
+
"lint:commit": "npm run lint-staged",
|
|
70
|
+
"lint:fix": "npm run eslint:base -- --fix",
|
|
71
|
+
"eslint:base": "eslint . --cache --cache-location .cache/eslint/ --no-warn-ignored",
|
|
72
|
+
"eslint:clear": "rimraf .cache/eslint",
|
|
73
|
+
"manual-publish": "npm publish --access public",
|
|
74
|
+
"check-types": "npx tsc --noEmit --pretty",
|
|
75
|
+
"prepublishOnly": "npm run clean && npm run build",
|
|
76
|
+
"test:plugin": "npm run clean && npm run build && npm run link && npm run --dir ./dev link @brandlift/payload-loggs && npm run dev",
|
|
77
|
+
"test:watch": "vitest",
|
|
78
|
+
"test:unit": "vitest run",
|
|
79
|
+
"commit": "cz",
|
|
80
|
+
"sync-main": "git fetch origin main && git rebase origin/main",
|
|
81
|
+
"sync-main:fork": "git fetch upstream main && git rebase upstream/main",
|
|
82
|
+
"release": "semantic-release",
|
|
83
|
+
"pre-release": "semantic-release --branches beta"
|
|
84
|
+
},
|
|
85
|
+
"peerDependencies": {
|
|
86
|
+
"payload": "^3.76.1"
|
|
87
|
+
},
|
|
88
|
+
"devDependencies": {
|
|
89
|
+
"@antfu/eslint-config": "^9.1.0",
|
|
90
|
+
"@commitlint/cli": "^21.2.1",
|
|
91
|
+
"@commitlint/config-conventional": "^21.2.0",
|
|
92
|
+
"@eslint-react/eslint-plugin": "^5.17.1",
|
|
93
|
+
"@next/eslint-plugin-next": "^16.2.10",
|
|
94
|
+
"@payloadcms/db-postgres": "^3.86.0",
|
|
95
|
+
"@payloadcms/next": "^3.86.0",
|
|
96
|
+
"@payloadcms/richtext-lexical": "^3.86.0",
|
|
97
|
+
"@payloadcms/translations": "^3.86.0",
|
|
98
|
+
"@payloadcms/ui": "^3.86.0",
|
|
99
|
+
"@semantic-release/changelog": "^7.0.0",
|
|
100
|
+
"@semantic-release/commit-analyzer": "^13.0.1",
|
|
101
|
+
"@semantic-release/git": "^11.0.1",
|
|
102
|
+
"@semantic-release/github": "^12.0.9",
|
|
103
|
+
"@semantic-release/npm": "^13.1.5",
|
|
104
|
+
"@semantic-release/release-notes-generator": "^14.1.1",
|
|
105
|
+
"@swc-node/register": "^1.12.1",
|
|
106
|
+
"@swc/cli": "^0.8.1",
|
|
107
|
+
"@swc/core": "^1.15.43",
|
|
108
|
+
"@types/node": "^26.1.1",
|
|
109
|
+
"@types/react": "^19.2.17",
|
|
110
|
+
"@types/react-dom": "^19.2.3",
|
|
111
|
+
"@typescript/native-preview": "^7.0.0-dev.20260707.2",
|
|
112
|
+
"conventional-changelog-conventionalcommits": "^10.2.1",
|
|
113
|
+
"copyfiles": "2.4.1",
|
|
114
|
+
"cross-env": "^10.1.0",
|
|
115
|
+
"cz-git": "^1.13.1",
|
|
116
|
+
"eslint": "^10.7.0",
|
|
117
|
+
"eslint-plugin-perfectionist": "^5.10.0",
|
|
118
|
+
"eslint-plugin-react-hooks": "^7.1.1",
|
|
119
|
+
"eslint-plugin-react-refresh": "^0.5.3",
|
|
120
|
+
"graphql": "^17.0.2",
|
|
121
|
+
"next": "^16.2.10",
|
|
122
|
+
"payload": "^3.86.0",
|
|
123
|
+
"react": "^19.2.7",
|
|
124
|
+
"react-dom": "^19.2.7",
|
|
125
|
+
"rimraf": "^6.1.3",
|
|
126
|
+
"semantic-release": "^25.0.9",
|
|
127
|
+
"sharp": "^0.35.3",
|
|
128
|
+
"type-fest": "^5.8.0",
|
|
129
|
+
"typescript": "6",
|
|
130
|
+
"vitest": "^4.1.10"
|
|
131
|
+
},
|
|
132
|
+
"publishConfig": {
|
|
133
|
+
"access": "public",
|
|
134
|
+
"exports": {
|
|
135
|
+
".": {
|
|
136
|
+
"import": "./dist/index.js",
|
|
137
|
+
"types": "./dist/index.d.ts",
|
|
138
|
+
"default": "./dist/index.js"
|
|
139
|
+
},
|
|
140
|
+
"./client": {
|
|
141
|
+
"import": "./dist/exports/client.js",
|
|
142
|
+
"types": "./dist/exports/client.d.ts",
|
|
143
|
+
"default": "./dist/exports/client.js"
|
|
144
|
+
},
|
|
145
|
+
"./rsc": {
|
|
146
|
+
"import": "./dist/exports/rsc.js",
|
|
147
|
+
"types": "./dist/exports/rsc.d.ts",
|
|
148
|
+
"default": "./dist/exports/rsc.js"
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
"main": "./dist/index.js",
|
|
152
|
+
"types": "./dist/index.d.ts"
|
|
153
|
+
},
|
|
154
|
+
"config": {
|
|
155
|
+
"commitizen": {
|
|
156
|
+
"path": "node_modules/cz-git"
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
"registry": "https://registry.npmjs.org/"
|
|
160
|
+
}
|