22exports . __esModule = true ;
33exports . injectHooks = void 0 ;
44function injectListHooks ( declaration , injectFunctions ) {
5+ var _a ;
56 if ( ! declaration . list ) {
67 declaration . list = { } ;
78 }
89 // If the list is resolved by a custom function, we don't need to inject hooks
9- if ( declaration . list . resolve ) {
10+ if ( ( _a = declaration === null || declaration === void 0 ? void 0 : declaration . list ) === null || _a === void 0 ? void 0 : _a . resolve ) {
1011 return ;
1112 }
1213 var beforeList = Array . isArray ( declaration . list . before )
@@ -27,16 +28,16 @@ function injectListHooks(declaration, injectFunctions) {
2728 : afterList ;
2829}
2930function injectUpdateHooks ( declaration , injectFunctions ) {
30- var _a ;
31+ var _a , _b ;
3132 if ( ! ( ( _a = declaration . actions ) === null || _a === void 0 ? void 0 : _a . includes ( 'update' ) ) )
3233 return ;
33- if ( ! declaration . update || 'type' in declaration . update ) {
34- declaration . update = { } ;
35- }
3634 // If the update is resolved by a custom function, we don't need to inject hooks
37- if ( declaration . update . resolve ) {
35+ if ( ( _b = declaration === null || declaration === void 0 ? void 0 : declaration . update ) === null || _b === void 0 ? void 0 : _b . resolve ) {
3836 return ;
3937 }
38+ if ( ! declaration . update ) {
39+ declaration . update = { } ;
40+ }
4041 var beforeUpdate = Array . isArray ( declaration . update . before )
4142 ? declaration . update . before
4243 : declaration . update . before
@@ -55,16 +56,16 @@ function injectUpdateHooks(declaration, injectFunctions) {
5556 : afterUpdate ;
5657}
5758function injectCreateHooks ( declaration , injectFunctions ) {
58- var _a ;
59+ var _a , _b ;
5960 if ( ! ( ( _a = declaration . actions ) === null || _a === void 0 ? void 0 : _a . includes ( 'create' ) ) )
6061 return ;
61- if ( ! declaration . create || 'type' in declaration . create ) {
62- declaration . create = { } ;
63- }
6462 // If the create is resolved by a custom function, we don't need to inject hooks
65- if ( declaration . list . create ) {
63+ if ( ( _b = declaration === null || declaration === void 0 ? void 0 : declaration . create ) === null || _b === void 0 ? void 0 : _b . resolve ) {
6664 return ;
6765 }
66+ if ( ! declaration . create ) {
67+ declaration . create = { } ;
68+ }
6869 var beforeCreate = Array . isArray ( declaration . create . before )
6970 ? declaration . create . before
7071 : declaration . create . before
@@ -83,16 +84,16 @@ function injectCreateHooks(declaration, injectFunctions) {
8384 : afterCreate ;
8485}
8586function injectDeleteHooks ( declaration , injectFunctions ) {
86- var _a ;
87+ var _a , _b ;
8788 if ( ! ( ( _a = declaration . actions ) === null || _a === void 0 ? void 0 : _a . includes ( 'delete' ) ) )
8889 return ;
89- if ( ! declaration [ "delete" ] || 'type' in declaration [ "delete" ] ) {
90- declaration [ "delete" ] = { } ;
91- }
9290 // If the delete is resolved by a custom function, we don't need to inject hooks
93- if ( declaration [ "delete" ] . resolve ) {
91+ if ( ( _b = declaration === null || declaration === void 0 ? void 0 : declaration [ "delete" ] ) === null || _b === void 0 ? void 0 : _b . resolve ) {
9492 return ;
9593 }
94+ if ( ! declaration [ "delete" ] ) {
95+ declaration [ "delete" ] = { } ;
96+ }
9697 var beforeDelete = Array . isArray ( declaration [ "delete" ] . before )
9798 ? declaration [ "delete" ] . before
9899 : declaration [ "delete" ] . before
0 commit comments