adminforth 2.58.3 → 2.58.5

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.
@@ -19,7 +19,7 @@ export const admin = new AdminForth({
19
19
  loginBackgroundImage: 'https://images.unsplash.com/photo-1534239697798-120952b76f2b?q=80&w=3389&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D',
20
20
  loginBackgroundPosition: '1/2',
21
21
  loginPromptHTML: async () => {
22
- const adminforthUserExists = await admin.resource("adminuser").count(Filters.EQ('email', 'adminforth')) > 0;
22
+ const adminforthUserExists = (await admin.resource("adminuser").count(Filters.EQ('email', 'adminforth'))) > 0;
23
23
  if (adminforthUserExists) {
24
24
  return "Please use <b>adminforth</b> as username and <b>adminforth</b> as password"
25
25
  }
@@ -55,7 +55,7 @@ export const admin = new AdminForth({
55
55
  },
56
56
  ],
57
57
  resources: [
58
- usersResource
58
+ usersResource,
59
59
  ],
60
60
  menu: [
61
61
  { type: 'heading', label: 'SYSTEM' },
@@ -63,7 +63,7 @@ export const admin = new AdminForth({
63
63
  label: 'Users',
64
64
  icon: 'flowbite:user-solid',
65
65
  resourceId: 'adminuser'
66
- }
66
+ },
67
67
  ],
68
68
  });
69
69
 
@@ -82,7 +82,7 @@ if (fileURLToPath(import.meta.url) === path.resolve(process.argv[1])) {
82
82
  admin.express.serve(app);
83
83
 
84
84
  admin.discoverDatabases().then(async () => {
85
- if (await admin.resource('adminuser').count() === 0) {
85
+ if ((await admin.resource('adminuser').count()) === 0) {
86
86
  await admin.resource('adminuser').create({
87
87
  email: 'adminforth',
88
88
  password_hash: await AdminForth.Utils.generatePasswordHash('adminforth'),
@@ -23,7 +23,7 @@ export async function injectResourceIntoIndex({
23
23
  let code = await fs.readFile(indexFilePath, "utf-8");
24
24
  const ast = recast.parse(code, { parser });
25
25
 
26
- const importLine = `import ${resourceId}Resource from "./resources/${table}";`;
26
+ const resourceImportPath = `./resources/${table}.js`;
27
27
  let alreadyImported = false;
28
28
 
29
29
  recast.visit(ast, {
@@ -31,7 +31,7 @@ export async function injectResourceIntoIndex({
31
31
  const { node } = path;
32
32
  if (
33
33
  n.ImportDeclaration.check(node) &&
34
- node.source.value === `./resources/${table}`
34
+ node.source.value === resourceImportPath
35
35
  ) {
36
36
  alreadyImported = true;
37
37
  return false;
@@ -49,7 +49,7 @@ export async function injectResourceIntoIndex({
49
49
  ast.program.body.unshift(
50
50
  b.importDeclaration(
51
51
  [b.importDefaultSpecifier(b.identifier(`${resourceId}Resource`))],
52
- b.stringLiteral(`./resources/${table}`)
52
+ b.stringLiteral(resourceImportPath)
53
53
  )
54
54
  );
55
55
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adminforth",
3
- "version": "2.58.3",
3
+ "version": "2.58.5",
4
4
  "description": "OpenSource Agent-Native forth-generation admin panel",
5
5
  "keywords": [
6
6
  "adminforth",