1- import { ResourceWithOptions } from 'adminjs' ;
1+ import { ComponentLoader , ResourceWithOptions } from 'adminjs' ;
22
3- import { bundleComponents } from './components /bundle.js' ;
3+ import { bundleComponent } from './utils /bundle-component .js' ;
44import { ADMINJS_LOGGER_DEFAULT_RESOURCE_ID } from './constants.js' ;
55import { LoggerFeatureOptions } from './types.js' ;
66import { getLogPropertyName } from './utils/get-log-property-name.js' ;
77
8- const { RECORD_DIFFERENCE , RECORD_LINK } = bundleComponents ( ) ;
9-
108export const createLoggerResource = < T = unknown > ( {
9+ componentLoader,
1110 resource,
1211 featureOptions,
1312} : {
13+ componentLoader : ComponentLoader ;
1414 resource : T ;
1515 featureOptions ?: LoggerFeatureOptions ;
1616} ) : ResourceWithOptions => {
1717 const { resourceOptions = { } , propertiesMapping = { } } = featureOptions ?? { } ;
1818 const { resourceId, navigation, actions = { } } = resourceOptions ;
19-
19+ const recordDifferenceComponent = bundleComponent (
20+ componentLoader ,
21+ 'RecordDifference'
22+ ) ;
23+ const recordLinkComponent = bundleComponent ( componentLoader , 'RecordLink' ) ;
2024 return {
2125 resource,
2226 options : {
@@ -55,7 +59,7 @@ export const createLoggerResource = <T = unknown>({
5559 } ,
5660 [ getLogPropertyName ( 'difference' , propertiesMapping ) ] : {
5761 components : {
58- show : RECORD_DIFFERENCE ,
62+ show : recordDifferenceComponent ,
5963 } ,
6064 custom : {
6165 propertiesMapping,
@@ -64,8 +68,8 @@ export const createLoggerResource = <T = unknown>({
6468 } ,
6569 [ getLogPropertyName ( 'recordId' , propertiesMapping ) ] : {
6670 components : {
67- list : RECORD_LINK ,
68- show : RECORD_LINK ,
71+ list : recordLinkComponent ,
72+ show : recordLinkComponent ,
6973 } ,
7074 custom : {
7175 propertiesMapping,
0 commit comments