adminforth 2.22.0-next.2 → 2.22.0-next.4
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.
|
@@ -9,6 +9,7 @@ export default class {{pluginName}} extends AdminForthPlugin {
|
|
|
9
9
|
constructor(options: PluginOptions) {
|
|
10
10
|
super(options, import.meta.url);
|
|
11
11
|
this.options = options;
|
|
12
|
+
this.shouldHaveSingleInstancePerWholeApp = () => false;
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
async modifyResourceConfig(adminforth: IAdminForth, resourceConfig: AdminForthResource) {
|
|
@@ -27,10 +28,6 @@ export default class {{pluginName}} extends AdminForthPlugin {
|
|
|
27
28
|
return `single`;
|
|
28
29
|
}
|
|
29
30
|
|
|
30
|
-
shouldHaveSingleInstancePerWholeApp(): boolean {
|
|
31
|
-
return false;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
31
|
setupEndpoints(server: IHttpServer) {
|
|
35
32
|
server.endpoint({
|
|
36
33
|
method: 'POST',
|
|
@@ -529,20 +529,22 @@ export function compareOldAndNewRecord(oldRecord: Record<string, any>, newRecord
|
|
|
529
529
|
const coreStore = useCoreStore();
|
|
530
530
|
|
|
531
531
|
for (const key of newKeys) {
|
|
532
|
-
|
|
532
|
+
const oldValue = typeof oldRecord[key] === 'object' && oldRecord[key] !== null ? JSON.stringify(oldRecord[key]) : oldRecord[key];
|
|
533
|
+
const newValue = typeof newRecord[key] === 'object' && newRecord[key] !== null ? JSON.stringify(newRecord[key]) : newRecord[key];
|
|
534
|
+
if (oldValue !== newValue) {
|
|
533
535
|
if (
|
|
534
536
|
(
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
(Array.isArray(
|
|
537
|
+
oldValue === undefined ||
|
|
538
|
+
oldValue === null ||
|
|
539
|
+
oldValue === '' ||
|
|
540
|
+
(Array.isArray(oldValue) && oldValue.length === 0)
|
|
539
541
|
)
|
|
540
542
|
&&
|
|
541
543
|
(
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
(Array.isArray(
|
|
544
|
+
newValue === undefined ||
|
|
545
|
+
newValue === null ||
|
|
546
|
+
newValue === '' ||
|
|
547
|
+
(Array.isArray(newValue) && newValue.length === 0)
|
|
546
548
|
)
|
|
547
549
|
) {
|
|
548
550
|
// console.log(`Value for key ${key} is considered equal (empty)`)
|
|
@@ -556,7 +558,7 @@ export function compareOldAndNewRecord(oldRecord: Record<string, any>, newRecord
|
|
|
556
558
|
continue;
|
|
557
559
|
}
|
|
558
560
|
}
|
|
559
|
-
// console.log(`Value for key ${key} is different`, { oldValue:
|
|
561
|
+
// console.log(`Value for key ${key} is different`, { oldValue: oldValue, newValue: newValue });
|
|
560
562
|
return false;
|
|
561
563
|
}
|
|
562
564
|
}
|