adminforth 1.1.65 → 1.1.67

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.
Files changed (62) hide show
  1. package/auth.ts +19 -4
  2. package/dataConnectors/mongo.ts +7 -13
  3. package/dataConnectors/postgres.ts +2 -2
  4. package/dataConnectors/sqlite.ts +2 -2
  5. package/dist/auth.js +14 -4
  6. package/dist/dataConnectors/mongo.js +1 -9
  7. package/dist/index.js +4 -9
  8. package/dist/plugins/AuditLogPlugin/custom/AuditLogView.vue +7 -6
  9. package/dist/plugins/AuditLogPlugin/index.js +17 -13
  10. package/dist/servers/express.js +1 -1
  11. package/dist/spa/index.html +2 -2
  12. package/dist/spa/package-lock.json +17 -4
  13. package/dist/spa/package.json +2 -1
  14. package/dist/spa/spa/src/App.vue +24 -12
  15. package/dist/spa/spa/src/composables/useStores.ts +16 -4
  16. package/dist/spa/spa/src/main.ts +1 -1
  17. package/dist/spa/src/App.vue +125 -45
  18. package/dist/spa/src/assets/logo.svg +19 -1
  19. package/dist/spa/src/components/AcceptModal.vue +2 -9
  20. package/dist/spa/src/components/BreadcrumbsWithButtons.vue +1 -1
  21. package/dist/spa/src/components/CustomDatePicker.vue +16 -3
  22. package/dist/spa/src/components/CustomDateRangePicker.vue +11 -2
  23. package/dist/spa/src/components/Dropdown.vue +6 -1
  24. package/dist/spa/src/components/Filters.vue +40 -19
  25. package/dist/spa/src/components/ResourceForm.vue +26 -24
  26. package/dist/spa/src/components/ResourceListTable.vue +419 -0
  27. package/dist/spa/src/components/Toast.vue +66 -0
  28. package/dist/spa/src/components/ValueRenderer.vue +14 -8
  29. package/dist/spa/src/composables/useFrontendApi.ts +26 -0
  30. package/dist/spa/src/composables/useStores.ts +113 -0
  31. package/dist/spa/src/main.ts +1 -1
  32. package/dist/spa/src/router/index.ts +30 -20
  33. package/dist/spa/src/spa_types/core.ts +51 -0
  34. package/dist/spa/src/stores/core.ts +48 -31
  35. package/dist/spa/src/stores/filters.ts +22 -0
  36. package/dist/spa/src/stores/modal.ts +13 -3
  37. package/dist/spa/src/stores/toast.ts +15 -0
  38. package/dist/spa/src/stores/user.ts +54 -0
  39. package/dist/spa/src/utils.ts +62 -7
  40. package/dist/spa/src/views/CreateView.vue +67 -15
  41. package/dist/spa/src/views/EditView.vue +45 -11
  42. package/dist/spa/src/views/ListView.vue +82 -366
  43. package/dist/spa/src/views/LoginView.vue +16 -4
  44. package/dist/spa/src/views/ShowView.vue +105 -21
  45. package/dist/spa/tailwind.config.js +1 -1
  46. package/dist/spa/vite.config.ts +6 -0
  47. package/index.ts +7 -12
  48. package/package.json +1 -1
  49. package/plugins/AuditLogPlugin/custom/AuditLogView.vue +7 -6
  50. package/plugins/AuditLogPlugin/index.ts +22 -15
  51. package/servers/express.ts +1 -1
  52. package/spa/src/App.vue +24 -12
  53. package/spa/src/composables/useStores.ts +16 -4
  54. package/spa/src/main.ts +1 -1
  55. package/types/AdminForthConfig.ts +18 -4
  56. package/types/FrontendAPI.ts +1 -15
  57. package/dist/plugins/AccessControl/index.js +0 -66
  58. package/dist/plugins/AccessControl/types.js +0 -1
  59. package/dist/spa/public/favicon.ico +0 -0
  60. package/dist/spa/spa/public/favicon.ico +0 -0
  61. package/dist/types.js +0 -30
  62. /package/dist/spa/{spa/public → public/assets}/favicon.png +0 -0
@@ -1,66 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { AllowedActionsEnum } from "../../types/AdminForthConfig.js";
11
- import AdminForthPlugin from "../base.js";
12
- class AccessControlPlugin extends AdminForthPlugin {
13
- constructor(options) {
14
- super(options, import.meta.url);
15
- this.options = options;
16
- }
17
- modifyResourceConfig(adminforth, resourceConfig) {
18
- super.modifyResourceConfig(adminforth, resourceConfig);
19
- this.adminforth = adminforth;
20
- if (!resourceConfig.hooks) {
21
- resourceConfig.hooks = {};
22
- }
23
- const checkAccess = (adminUser, action, meta) => __awaiter(this, void 0, void 0, function* () {
24
- const hasAccessOrError = yield this.options.hasAccess(adminUser, action, meta);
25
- if (hasAccessOrError === true) {
26
- return { ok: true };
27
- }
28
- else {
29
- return { ok: false, error: hasAccessOrError || AccessControlPlugin.defaultError };
30
- }
31
- });
32
- const bindHookCheck = (action, hookName) => {
33
- if (!resourceConfig.hooks[action]) {
34
- resourceConfig.hooks[action] = {};
35
- }
36
- if (!resourceConfig.hooks[action][hookName]) {
37
- resourceConfig.hooks[action][hookName] = [];
38
- }
39
- if (hookName === 'beforeDatasourceRequest') {
40
- resourceConfig.hooks[action][hookName].unshift((_a) => __awaiter(this, [_a], void 0, function* ({ adminUser, query }) {
41
- return checkAccess(adminUser, action, { query });
42
- }));
43
- }
44
- else {
45
- resourceConfig.hooks[action][hookName].unshift((_b) => __awaiter(this, [_b], void 0, function* ({ adminUser, record }) {
46
- return checkAccess(adminUser, action, { record });
47
- }));
48
- }
49
- };
50
- // List check
51
- bindHookCheck(AllowedActionsEnum.list, 'beforeDatasourceRequest');
52
- // Show check
53
- bindHookCheck(AllowedActionsEnum.show, 'beforeDatasourceRequest');
54
- // Edit check
55
- bindHookCheck(AllowedActionsEnum.edit, 'beforeDatasourceRequest');
56
- // create check
57
- bindHookCheck(AllowedActionsEnum.create, 'beforeSave');
58
- // edit check
59
- bindHookCheck(AllowedActionsEnum.edit, 'beforeSave');
60
- // delete check
61
- bindHookCheck(AllowedActionsEnum.delete, 'beforeSave');
62
- console.log('resourceConfig', resourceConfig);
63
- }
64
- }
65
- AccessControlPlugin.defaultError = 'Sorry, you do not have access to this resource.';
66
- export default AccessControlPlugin;
@@ -1 +0,0 @@
1
- export {};
Binary file
Binary file
package/dist/types.js DELETED
@@ -1,30 +0,0 @@
1
- // typical types which AdminForth supports
2
- //
3
- export const AdminForthTypes = {
4
- STRING: 'string',
5
- INTEGER: 'integer',
6
- FLOAT: 'float',
7
- DECIMAL: 'decimal',
8
- BOOLEAN: 'boolean',
9
- DATE: 'date',
10
- DATETIME: 'datetime',
11
- TIME: 'time',
12
- TEXT: 'text',
13
- JSON: 'json',
14
- };
15
- export const AdminForthFilterOperators = {
16
- EQ: 'eq',
17
- NE: 'ne',
18
- GT: 'gt',
19
- LT: 'lt',
20
- GTE: 'gte',
21
- LTE: 'lte',
22
- LIKE: 'like',
23
- ILIKE: 'ilike',
24
- IN: 'in',
25
- NIN: 'nin',
26
- };
27
- export const AdminForthSortDirections = {
28
- ASC: 'asc',
29
- DESC: 'desc',
30
- };