adminforth 1.4.3-next.2 → 1.4.3-next.21

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 (191) hide show
  1. package/commands/bundle.js +29 -0
  2. package/commands/generateModels.js +63 -0
  3. package/commands/utils.js +93 -0
  4. package/dist/adminforth/auth.d.ts +31 -0
  5. package/dist/adminforth/auth.d.ts.map +1 -0
  6. package/dist/adminforth/auth.js +119 -0
  7. package/dist/adminforth/auth.js.map +1 -0
  8. package/dist/adminforth/basePlugin.d.ts +23 -0
  9. package/dist/adminforth/basePlugin.d.ts.map +1 -0
  10. package/dist/adminforth/basePlugin.js +51 -0
  11. package/dist/adminforth/basePlugin.js.map +1 -0
  12. package/dist/adminforth/dataConnectors/baseConnector.d.ts +95 -0
  13. package/dist/adminforth/dataConnectors/baseConnector.d.ts.map +1 -0
  14. package/dist/adminforth/dataConnectors/baseConnector.js +178 -0
  15. package/dist/adminforth/dataConnectors/baseConnector.js.map +1 -0
  16. package/dist/adminforth/dataConnectors/clickhouse.d.ts +93 -0
  17. package/dist/adminforth/dataConnectors/clickhouse.d.ts.map +1 -0
  18. package/dist/adminforth/dataConnectors/clickhouse.js +297 -0
  19. package/dist/adminforth/dataConnectors/clickhouse.js.map +1 -0
  20. package/dist/adminforth/dataConnectors/mongo.d.ts +94 -0
  21. package/dist/adminforth/dataConnectors/mongo.d.ts.map +1 -0
  22. package/dist/adminforth/dataConnectors/mongo.js +168 -0
  23. package/dist/adminforth/dataConnectors/mongo.js.map +1 -0
  24. package/dist/adminforth/dataConnectors/postgres.d.ts +72 -0
  25. package/dist/adminforth/dataConnectors/postgres.d.ts.map +1 -0
  26. package/dist/adminforth/dataConnectors/postgres.js +298 -0
  27. package/dist/adminforth/dataConnectors/postgres.js.map +1 -0
  28. package/dist/adminforth/dataConnectors/sqlite.d.ts +67 -0
  29. package/dist/adminforth/dataConnectors/sqlite.d.ts.map +1 -0
  30. package/dist/adminforth/dataConnectors/sqlite.js +251 -0
  31. package/dist/adminforth/dataConnectors/sqlite.js.map +1 -0
  32. package/dist/adminforth/index.d.ts +94 -0
  33. package/dist/adminforth/index.d.ts.map +1 -0
  34. package/dist/adminforth/index.js +357 -0
  35. package/dist/adminforth/index.js.map +1 -0
  36. package/dist/adminforth/modules/codeInjector.d.ts +38 -0
  37. package/dist/adminforth/modules/codeInjector.d.ts.map +1 -0
  38. package/dist/adminforth/modules/codeInjector.js +673 -0
  39. package/dist/adminforth/modules/codeInjector.js.map +1 -0
  40. package/dist/adminforth/modules/configValidator.d.ts +13 -0
  41. package/dist/adminforth/modules/configValidator.d.ts.map +1 -0
  42. package/dist/adminforth/modules/configValidator.js +511 -0
  43. package/dist/adminforth/modules/configValidator.js.map +1 -0
  44. package/dist/adminforth/modules/operationalResource.d.ts +17 -0
  45. package/dist/adminforth/modules/operationalResource.d.ts.map +1 -0
  46. package/dist/adminforth/modules/operationalResource.js +75 -0
  47. package/dist/adminforth/modules/operationalResource.js.map +1 -0
  48. package/dist/adminforth/modules/restApi.d.ts +11 -0
  49. package/dist/adminforth/modules/restApi.d.ts.map +1 -0
  50. package/dist/adminforth/modules/restApi.js +657 -0
  51. package/dist/adminforth/modules/restApi.js.map +1 -0
  52. package/dist/adminforth/modules/styleGenerator.d.ts +9 -0
  53. package/dist/adminforth/modules/styleGenerator.d.ts.map +1 -0
  54. package/dist/adminforth/modules/styleGenerator.js +47 -0
  55. package/dist/adminforth/modules/styleGenerator.js.map +1 -0
  56. package/dist/adminforth/modules/styles.d.ts +96 -0
  57. package/dist/adminforth/modules/styles.d.ts.map +1 -0
  58. package/dist/adminforth/modules/styles.js +105 -0
  59. package/dist/adminforth/modules/styles.js.map +1 -0
  60. package/dist/adminforth/modules/utils.d.ts +39 -0
  61. package/dist/adminforth/modules/utils.d.ts.map +1 -0
  62. package/dist/adminforth/modules/utils.js +421 -0
  63. package/dist/adminforth/modules/utils.js.map +1 -0
  64. package/dist/adminforth/plugins/audit-log/index.d.ts +25 -0
  65. package/dist/adminforth/plugins/audit-log/index.d.ts.map +1 -0
  66. package/dist/adminforth/plugins/audit-log/index.js +129 -0
  67. package/dist/adminforth/plugins/audit-log/index.js.map +1 -0
  68. package/dist/adminforth/plugins/audit-log/types.d.ts +35 -0
  69. package/dist/adminforth/plugins/audit-log/types.d.ts.map +1 -0
  70. package/dist/adminforth/plugins/audit-log/types.js +2 -0
  71. package/dist/adminforth/plugins/audit-log/types.js.map +1 -0
  72. package/dist/adminforth/plugins/chat-gpt/index.d.ts +14 -0
  73. package/dist/adminforth/plugins/chat-gpt/index.d.ts.map +1 -0
  74. package/dist/adminforth/plugins/chat-gpt/index.js +147 -0
  75. package/dist/adminforth/plugins/chat-gpt/index.js.map +1 -0
  76. package/dist/adminforth/plugins/chat-gpt/types.d.ts +82 -0
  77. package/dist/adminforth/plugins/chat-gpt/types.d.ts.map +1 -0
  78. package/dist/adminforth/plugins/chat-gpt/types.js +2 -0
  79. package/dist/adminforth/plugins/chat-gpt/types.js.map +1 -0
  80. package/dist/adminforth/plugins/email-password-reset/index.d.ts +15 -0
  81. package/dist/adminforth/plugins/email-password-reset/index.d.ts.map +1 -0
  82. package/dist/adminforth/plugins/email-password-reset/index.js +176 -0
  83. package/dist/adminforth/plugins/email-password-reset/index.js.map +1 -0
  84. package/dist/adminforth/plugins/email-password-reset/types.d.ts +28 -0
  85. package/dist/adminforth/plugins/email-password-reset/types.d.ts.map +1 -0
  86. package/dist/adminforth/plugins/email-password-reset/types.js +2 -0
  87. package/dist/adminforth/plugins/email-password-reset/types.js.map +1 -0
  88. package/dist/adminforth/plugins/foreign-inline-list/index.d.ts +13 -0
  89. package/dist/adminforth/plugins/foreign-inline-list/index.d.ts.map +1 -0
  90. package/dist/adminforth/plugins/foreign-inline-list/index.js +56 -0
  91. package/dist/adminforth/plugins/foreign-inline-list/index.js.map +1 -0
  92. package/dist/adminforth/plugins/foreign-inline-list/types.d.ts +19 -0
  93. package/dist/adminforth/plugins/foreign-inline-list/types.d.ts.map +1 -0
  94. package/dist/adminforth/plugins/foreign-inline-list/types.js +2 -0
  95. package/dist/adminforth/plugins/foreign-inline-list/types.js.map +1 -0
  96. package/dist/adminforth/plugins/import-export/index.d.ts +15 -0
  97. package/dist/adminforth/plugins/import-export/index.d.ts.map +1 -0
  98. package/dist/adminforth/plugins/import-export/index.js +127 -0
  99. package/dist/adminforth/plugins/import-export/index.js.map +1 -0
  100. package/dist/adminforth/plugins/import-export/types.d.ts +3 -0
  101. package/dist/adminforth/plugins/import-export/types.d.ts.map +1 -0
  102. package/dist/adminforth/plugins/import-export/types.js +2 -0
  103. package/dist/adminforth/plugins/import-export/types.js.map +1 -0
  104. package/dist/adminforth/plugins/rich-editor/index.d.ts +17 -0
  105. package/dist/adminforth/plugins/rich-editor/index.d.ts.map +1 -0
  106. package/dist/adminforth/plugins/rich-editor/index.js +262 -0
  107. package/dist/adminforth/plugins/rich-editor/index.js.map +1 -0
  108. package/dist/adminforth/plugins/rich-editor/types.d.ts +153 -0
  109. package/dist/adminforth/plugins/rich-editor/types.d.ts.map +1 -0
  110. package/dist/adminforth/plugins/rich-editor/types.js +16 -0
  111. package/dist/adminforth/plugins/rich-editor/types.js.map +1 -0
  112. package/dist/adminforth/plugins/two-factors-auth/index.d.ts +16 -0
  113. package/dist/adminforth/plugins/two-factors-auth/index.d.ts.map +1 -0
  114. package/dist/adminforth/plugins/two-factors-auth/index.js +134 -0
  115. package/dist/adminforth/plugins/two-factors-auth/index.js.map +1 -0
  116. package/dist/adminforth/plugins/two-factors-auth/types.d.ts +18 -0
  117. package/dist/adminforth/plugins/two-factors-auth/types.d.ts.map +1 -0
  118. package/dist/adminforth/plugins/two-factors-auth/types.js +2 -0
  119. package/dist/adminforth/plugins/two-factors-auth/types.js.map +1 -0
  120. package/dist/adminforth/plugins/upload/index.d.ts +14 -0
  121. package/dist/adminforth/plugins/upload/index.d.ts.map +1 -0
  122. package/dist/adminforth/plugins/upload/index.js +450 -0
  123. package/dist/adminforth/plugins/upload/index.js.map +1 -0
  124. package/dist/adminforth/plugins/upload/types.d.ts +132 -0
  125. package/dist/adminforth/plugins/upload/types.d.ts.map +1 -0
  126. package/dist/adminforth/plugins/upload/types.js +2 -0
  127. package/dist/adminforth/plugins/upload/types.js.map +1 -0
  128. package/dist/adminforth/servers/express.d.ts +18 -0
  129. package/dist/adminforth/servers/express.d.ts.map +1 -0
  130. package/dist/adminforth/servers/express.js +238 -0
  131. package/dist/adminforth/servers/express.js.map +1 -0
  132. package/dist/adminforth/types/Back.d.ts +1103 -0
  133. package/dist/adminforth/types/Back.d.ts.map +1 -0
  134. package/dist/adminforth/types/Back.js +86 -0
  135. package/dist/adminforth/types/Back.js.map +1 -0
  136. package/dist/adminforth/types/Common.d.ts +616 -0
  137. package/dist/adminforth/types/Common.d.ts.map +1 -0
  138. package/dist/adminforth/types/Common.js +65 -0
  139. package/dist/adminforth/types/Common.js.map +1 -0
  140. package/dist/adminforth/types/FrontendAPI.d.ts +134 -0
  141. package/dist/adminforth/types/FrontendAPI.d.ts.map +1 -0
  142. package/dist/adminforth/types/FrontendAPI.js +8 -0
  143. package/dist/adminforth/types/FrontendAPI.js.map +1 -0
  144. package/dist/dataConnectors/baseConnector.d.ts.map +1 -1
  145. package/dist/dataConnectors/baseConnector.js +7 -2
  146. package/dist/dataConnectors/baseConnector.js.map +1 -1
  147. package/dist/dataConnectors/postgres.js +3 -3
  148. package/dist/dataConnectors/postgres.js.map +1 -1
  149. package/dist/dev-demo/index.d.ts +3 -0
  150. package/dist/dev-demo/index.d.ts.map +1 -0
  151. package/dist/dev-demo/index.js +1052 -0
  152. package/dist/dev-demo/index.js.map +1 -0
  153. package/dist/modules/codeInjector.d.ts +4 -2
  154. package/dist/modules/codeInjector.d.ts.map +1 -1
  155. package/dist/modules/codeInjector.js +93 -69
  156. package/dist/modules/codeInjector.js.map +1 -1
  157. package/dist/modules/restApi.d.ts.map +1 -1
  158. package/dist/modules/restApi.js +33 -19
  159. package/dist/modules/restApi.js.map +1 -1
  160. package/dist/modules/utils.d.ts.map +1 -1
  161. package/dist/modules/utils.js +0 -1
  162. package/dist/modules/utils.js.map +1 -1
  163. package/dist/servers/express.d.ts.map +1 -1
  164. package/dist/servers/express.js +4 -1
  165. package/dist/servers/express.js.map +1 -1
  166. package/dist/spa/package-lock.json +64 -4
  167. package/dist/spa/package.json +1 -0
  168. package/dist/spa/src/App.vue +15 -25
  169. package/dist/spa/src/acl/Button.vue +21 -0
  170. package/dist/spa/src/acl/Link.vue +9 -0
  171. package/dist/spa/src/afcl/Button.vue +27 -0
  172. package/dist/spa/src/afcl/Input.vue +41 -0
  173. package/dist/spa/src/afcl/Link.vue +9 -0
  174. package/dist/spa/src/afcl/Select.vue +206 -0
  175. package/dist/spa/src/afcl/index.ts +6 -0
  176. package/dist/spa/src/components/Filters.vue +11 -5
  177. package/dist/spa/src/components/GroupsTable.vue +23 -23
  178. package/dist/spa/src/components/ValueRenderer.vue +3 -1
  179. package/dist/spa/src/renderers/CompactField.vue +1 -1
  180. package/dist/spa/src/renderers/CompactUUID.vue +1 -1
  181. package/dist/spa/src/renderers/CountryFlag.vue +3 -4
  182. package/dist/spa/src/renderers/HumanNumber.vue +3 -2
  183. package/dist/spa/src/renderers/RelativeTime.vue +3 -2
  184. package/dist/spa/src/router/index.ts +1 -1
  185. package/dist/spa/src/types/Back.ts +47 -13
  186. package/dist/spa/src/views/LoginView.vue +4 -15
  187. package/dist/spa/vite.config.ts +16 -34
  188. package/dist/types/Back.d.ts +21 -6
  189. package/dist/types/Back.d.ts.map +1 -1
  190. package/dist/types/Back.js.map +1 -1
  191. package/package.json +3 -2
@@ -0,0 +1,153 @@
1
+ export interface PluginOptions {
2
+ /**
3
+ * Field where plugin will auto-complete text. Should be string or text field.
4
+ */
5
+ htmlFieldName: string;
6
+ /**
7
+ * Quill toolbar setting, full toolbar:
8
+ *
9
+ * ```
10
+ * [
11
+ * ['bold', 'italic', 'underline', 'strike'], // toggled buttons
12
+ * ['blockquote', 'code-block', 'link'],
13
+ * // [ 'image', 'video', 'formula' ],
14
+ *
15
+ * [{ 'header': 2 }, { 'header': 3 }], // custom button values
16
+ * [{ 'list': 'ordered'}, { 'list': 'bullet' }, { 'list': 'check' }],
17
+ * // [{ 'script': 'sub'}, { 'script': 'super' }], // superscript/subscript
18
+ * // [{ 'indent': '-1'}, { 'indent': '+1' }], // outdent/indent
19
+ * // [{ 'direction': 'rtl' }], // text direction
20
+ * // [{ 'size': ['small', false, 'large', 'huge'] }], // custom dropdown
21
+ * // [{ 'header': [1, 2, 3, 4, 5, 6, false] }],
22
+ * // [{ 'color': [] }, { 'background': [] }], // dropdown with defaults from theme
23
+ * // [{ 'font': [] }],
24
+ * [{ 'align': [] }],
25
+ *
26
+ * ['clean']
27
+ * ]
28
+ *```
29
+ */
30
+ toolbar?: any[];
31
+ /**
32
+ * The completion section is used to define the completion provider and its parameters.
33
+ */
34
+ completion?: {
35
+ /**
36
+ * The provider is the name of the plugin that will be used to provide completions.
37
+ */
38
+ provider: string;
39
+ /**
40
+ * The params are the parameters that will be passed to the completion provider.
41
+ */
42
+ params: {
43
+ /**
44
+ * OpenAI API key. Go to https://platform.openai.com/, go to Dashboard -> API keys -> Create new secret key
45
+ * Paste value in your .env file OPENAI_API_KEY=your_key
46
+ * Set openAiApiKey: process.env.OPENAI_API_KEY to access it
47
+ */
48
+ apiKey: string;
49
+ /**
50
+ * Model name. Go to https://platform.openai.com/docs/models, select model and copy name.
51
+ * Default is `gpt-4o-mini`. Use e.g. more expensive `gpt-4o` for more powerful model.
52
+ */
53
+ model?: string;
54
+ };
55
+ /**
56
+ * Expert settings
57
+ */
58
+ expert?: {
59
+ /**
60
+ * Number of tokens to generate. Default is 50. 1 token ~= ¾ words
61
+ */
62
+ maxTokens?: number;
63
+ /**
64
+ * Temperature (0-1). Lower is more deterministic, higher is more unpredicted creative. Default is 0.7.
65
+ */
66
+ temperature?: number;
67
+ /**
68
+ * Maximum number of last characters which will be used for completion for target field. Default is 500.
69
+ * Higher value will give better context but will cost more.
70
+ */
71
+ promptInputLimit?: number;
72
+ /**
73
+ * Time in ms to wait after user stops typing before sending request to completion provider. Default is 300 ms.
74
+ */
75
+ debounceTime?: number;
76
+ /**
77
+ * Stop completion on these characters. Default is ['.']
78
+ */
79
+ stop?: string[];
80
+ /**
81
+ * When completion is made, this plugin passes non-empty fields of the record to the LLM model for record context understanding.
82
+ */
83
+ recordContext?: {
84
+ /**
85
+ * Using this field you can limit number of fields passed to the model.
86
+ * Default is 5.
87
+ * Completion field is not included in this limit.
88
+ * Set to 0 to disable context passing at all.
89
+ * If count of fields exceeds this number, longest fields will be selected.
90
+ * If some of values will exceed maxFieldLength, it will be smartly truncated by splitting ito splitParts, taking their
91
+ * starting substring and joining back with '...'.
92
+ */
93
+ maxFields?: number;
94
+ /**
95
+ * Limit of input field value. Default is 300. If field is longer, it will be truncated.
96
+ */
97
+ maxFieldLength?: number;
98
+ /**
99
+ * How many parts to split field value if it exceeds maxFieldLength. Default is 5.
100
+ */
101
+ splitParts?: number;
102
+ };
103
+ };
104
+ /**
105
+ * Since AI generation can be expensive, we can limit the number of requests per IP.
106
+ * Completion will simply stop working when limit is reached so user will not be bothered with error messages.
107
+ */
108
+ rateLimit?: {
109
+ /**
110
+ * E.g. 5/1d - 5 requests per day
111
+ * 3/1h - 3 requests per hour
112
+ */
113
+ limit: string;
114
+ /**
115
+ * Not used now
116
+ * Message shown to user when rate limit is reached
117
+ */
118
+ errorMessage: string;
119
+ };
120
+ };
121
+ /**
122
+ * Allows to attach images to the HTML text
123
+ * Requires to have a separate resource with Upload Plugin installed on attachment field.
124
+ * Each attachment used in HTML will create one record in the attachment resource.
125
+ */
126
+ attachments?: {
127
+ /**
128
+ * Resource name where images are stored. Should point to the existing resource.
129
+ */
130
+ attachmentResource: string;
131
+ /**
132
+ * Field name in the attachment resource where image is stored. Should point to the existing field in the attachment resource.
133
+ * Also there should be upload plugin installed on this field.
134
+ */
135
+ attachmentFieldName: string;
136
+ /**
137
+ * When attachment is created, it will be linked to the record, by storing id of the record with editor in attachment resource.
138
+ * Here you define the field name where this id will be stored.
139
+ *
140
+ * Linking is needed to remove all attachments when record is deleted.
141
+ *
142
+ * For example when RichEditor installed on description field of apartment resource,
143
+ * field in attachment resource described hear will store id of apartment record.
144
+ */
145
+ attachmentRecordIdFieldName: string;
146
+ /**
147
+ * When attachment is created, it will be linked to the resource, by storing id of the resource with editor in attachment resource.
148
+ * For example when RichEditor installed on description field of apartment resource, it will store id of apartment resource.
149
+ */
150
+ attachmentResourceIdFieldName: string;
151
+ };
152
+ }
153
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../plugins/rich-editor/types.ts"],"names":[],"mappings":"AAeA,MAAM,WAAW,aAAa;IAE5B;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IAGtB;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC;IAEhB;;OAEG;IACH,UAAU,CAAC,EAAE;QACX;;WAEG;QACH,QAAQ,EAAE,MAAM,CAAC;QAEjB;;WAEG;QACH,MAAM,EAAE;YACN;;;;eAIG;YACH,MAAM,EAAE,MAAM,CAAC;YAEf;;;eAGG;YACH,KAAK,CAAC,EAAE,MAAM,CAAC;SAChB,CAAA;QAED;;WAEG;QACH,MAAM,CAAC,EAAE;YACL;;eAEG;YACH,SAAS,CAAC,EAAE,MAAM,CAAC;YAEnB;;eAEG;YACH,WAAW,CAAC,EAAE,MAAM,CAAC;YAErB;;;eAGG;YACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;YAE1B;;eAEG;YACH,YAAY,CAAC,EAAE,MAAM,CAAC;YAEtB;;eAEG;YACH,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;YAEhB;;eAEG;YACH,aAAa,CAAC,EAAE;gBACd;;;;;;;;mBAQG;gBACH,SAAS,CAAC,EAAE,MAAM,CAAC;gBAEnB;;mBAEG;gBACH,cAAc,CAAC,EAAE,MAAM,CAAC;gBAExB;;mBAEG;gBACH,UAAU,CAAC,EAAE,MAAM,CAAC;aAErB,CAAA;SACJ,CAAA;QAED;;;WAGG;QACH,SAAS,CAAC,EAAE;YAEV;;;eAGG;YACH,KAAK,EAAE,MAAM,CAAC;YAEd;;;eAGG;YACH,YAAY,EAAE,MAAM,CAAC;SACtB,CAAC;KAEH,CAAA;IAED;;;;OAIG;IACH,WAAW,CAAC,EAAE;QACZ;;WAEG;QACH,kBAAkB,EAAE,MAAM,CAAC;QAE3B;;;WAGG;QACH,mBAAmB,EAAE,MAAM,CAAC;QAE5B;;;;;;;;WAQG;QACH,2BAA2B,EAAE,MAAM,CAAC;QAEpC;;;WAGG;QACH,6BAA6B,EAAE,MAAM,CAAC;KACvC,CAAC;CACH"}
@@ -0,0 +1,16 @@
1
+ // example options ussage:
2
+ //{
3
+ // htmlFieldName: 'description',
4
+ // completion: {
5
+ // provider: 'openai-chat-gpt',
6
+ // params: {
7
+ // apiKey: process.env.OPENAI_API_KEY as string,
8
+ // model: 'gpt-4o',
9
+ // },
10
+ // expert: {
11
+ // debounceTime: 250,
12
+ // }
13
+ // }
14
+ //}
15
+ export {};
16
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../plugins/rich-editor/types.ts"],"names":[],"mappings":"AAAA,0BAA0B;AAC1B,GAAG;AACH,iCAAiC;AACjC,iBAAiB;AACjB,kCAAkC;AAClC,eAAe;AACf,qDAAqD;AACrD,wBAAwB;AACxB,QAAQ;AACR,eAAe;AACf,0BAA0B;AAC1B,OAAO;AACP,KAAK;AACL,GAAG"}
@@ -0,0 +1,16 @@
1
+ import { AdminForthPlugin } from "adminforth";
2
+ import type { AdminForthResource, IAdminForth, IHttpServer, IAdminForthAuth } from "adminforth";
3
+ import { PluginOptions } from "./types.js";
4
+ export default class TwoFactorsAuthPlugin extends AdminForthPlugin {
5
+ options: PluginOptions;
6
+ adminforth: IAdminForth;
7
+ authResource: AdminForthResource;
8
+ connectors: any;
9
+ adminForthAuth: IAdminForthAuth;
10
+ constructor(options: PluginOptions);
11
+ instanceUniqueRepresentation(pluginOptions: any): string;
12
+ modifyResourceConfig(adminforth: IAdminForth, resourceConfig: AdminForthResource): void;
13
+ activate(resourceConfig: AdminForthResource, adminforth: IAdminForth): void;
14
+ setupEndpoints(server: IHttpServer): void;
15
+ }
16
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../plugins/two-factors-auth/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAG,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,KAAK,EAAE,kBAAkB,EAAa,WAAW,EAAE,WAAW,EAAE,eAAe,EAA4D,MAAM,YAAY,CAAC;AAErK,OAAQ,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAE3C,MAAM,CAAC,OAAO,OAAO,oBAAqB,SAAQ,gBAAgB;IAChE,OAAO,EAAE,aAAa,CAAC;IACvB,UAAU,EAAE,WAAW,CAAC;IACxB,YAAY,EAAE,kBAAkB,CAAC;IACjC,UAAU,EAAE,GAAG,CAAC;IAChB,cAAc,EAAE,eAAe,CAAC;gBAEpB,OAAO,EAAE,aAAa;IAKlC,4BAA4B,CAAC,aAAa,EAAE,GAAG,GAAI,MAAM;IAIzD,oBAAoB,CAAC,UAAU,EAAE,WAAW,EAAE,cAAc,EAAE,kBAAkB;IAgBhF,QAAQ,CAAG,cAAc,EAAE,kBAAkB,EAAE,UAAU,EAAE,WAAW;IAsDtE,cAAc,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI;CAsD1C"}
@@ -0,0 +1,134 @@
1
+ import { AdminForthPlugin } from "adminforth";
2
+ import twofactor from 'node-2fa';
3
+ export default class TwoFactorsAuthPlugin extends AdminForthPlugin {
4
+ constructor(options) {
5
+ super(options, import.meta.url);
6
+ this.options = options;
7
+ }
8
+ instanceUniqueRepresentation(pluginOptions) {
9
+ return `single`;
10
+ }
11
+ modifyResourceConfig(adminforth, resourceConfig) {
12
+ super.modifyResourceConfig(adminforth, resourceConfig);
13
+ this.adminforth = adminforth;
14
+ this.adminForthAuth = adminforth.auth;
15
+ const customPages = this.adminforth.config.customization.customPages;
16
+ customPages.push({
17
+ path: '/confirm2fa',
18
+ component: { file: this.componentPath('TwoFactorsConfirmation.vue'), meta: { customLayout: true } }
19
+ });
20
+ customPages.push({
21
+ path: '/setup2fa',
22
+ component: { file: this.componentPath('TwoFactorsSetup.vue'), meta: { title: 'Setup 2FA', customLayout: true } }
23
+ });
24
+ this.activate(resourceConfig, adminforth);
25
+ }
26
+ activate(resourceConfig, adminforth) {
27
+ if (!this.options.twoFaSecretFieldName) {
28
+ throw new Error('twoFaSecretFieldName is required');
29
+ }
30
+ if (typeof this.options.twoFaSecretFieldName !== 'string') {
31
+ throw new Error('twoFaSecretFieldName must be a string');
32
+ }
33
+ this.authResource = resourceConfig;
34
+ if (!this.authResource.columns.some((col) => col.name === this.options.twoFaSecretFieldName)) {
35
+ throw new Error(`Column ${this.options.twoFaSecretFieldName} not found in ${this.authResource.label}`);
36
+ }
37
+ this.adminforth.config.auth.beforeLoginConfirmation.push(async ({ adminUser, response }) => {
38
+ const secret = adminUser.dbUser[this.options.twoFaSecretFieldName];
39
+ const userName = adminUser.dbUser[adminforth.config.auth.usernameField];
40
+ const brandName = adminforth.config.customization.brandName;
41
+ const authResource = adminforth.config.resources.find((res) => res.resourceId === adminforth.config.auth.usersResourceId);
42
+ const authPk = authResource.columns.find((col) => col.primaryKey).name;
43
+ const userPk = adminUser.dbUser[authPk];
44
+ let newSecret = null;
45
+ const userNeeds2FA = this.options.usersFilterToApply ? this.options.usersFilterToApply(adminUser) : true;
46
+ if (!userNeeds2FA) {
47
+ return { body: { loginAllowed: true }, ok: true };
48
+ }
49
+ if (!secret) {
50
+ const tempSecret = twofactor.generateSecret({ name: brandName, account: userName });
51
+ newSecret = tempSecret.secret;
52
+ }
53
+ else {
54
+ const value = this.adminforth.auth.issueJWT({ userName, issuer: brandName, pk: userPk }, 'tempTotp', '2h');
55
+ response.setHeader('Set-Cookie', `adminforth_totpTemporaryJWT=${value}; Path=${this.adminforth.config.baseUrl || '/'}; HttpOnly; SameSite=Strict; max-age=3600; `);
56
+ return {
57
+ body: {
58
+ loginAllowed: false,
59
+ redirectTo: '/confirm2fa',
60
+ },
61
+ ok: true
62
+ };
63
+ }
64
+ const totpTemporaryJWT = this.adminforth.auth.issueJWT({ userName, newSecret, issuer: brandName, pk: userPk }, 'tempTotp', '2h');
65
+ response.setHeader('Set-Cookie', `adminforth_totpTemporaryJWT=${totpTemporaryJWT}; Path=${this.adminforth.config.baseUrl || '/'}; HttpOnly; SameSite=Strict; Expires=${new Date(Date.now() + '1h').toUTCString()} `);
66
+ return {
67
+ body: {
68
+ loginAllowed: false,
69
+ redirectTo: secret ? '/confirm2fa' : '/setup2fa',
70
+ },
71
+ ok: true
72
+ };
73
+ });
74
+ }
75
+ setupEndpoints(server) {
76
+ server.endpoint({
77
+ method: 'POST',
78
+ path: `/plugin/twofa/initSetup`,
79
+ noAuth: true,
80
+ handler: async (server) => {
81
+ var _a;
82
+ const toReturn = { totpJWT: null, status: 'ok', };
83
+ const totpTemporaryJWT = (_a = server.cookies.find((cookie) => cookie.key === 'adminforth_totpTemporaryJWT')) === null || _a === void 0 ? void 0 : _a.value;
84
+ if (totpTemporaryJWT) {
85
+ toReturn.totpJWT = totpTemporaryJWT;
86
+ }
87
+ return toReturn;
88
+ }
89
+ });
90
+ server.endpoint({
91
+ method: 'POST',
92
+ path: `/plugin/twofa/confirmSetup`,
93
+ noAuth: true,
94
+ handler: async ({ body, adminUser, response, cookies }) => {
95
+ var _a;
96
+ const totpTemporaryJWT = (_a = cookies.find((cookie) => cookie.key === 'adminforth_totpTemporaryJWT')) === null || _a === void 0 ? void 0 : _a.value;
97
+ const decoded = await this.adminforth.auth.verify(totpTemporaryJWT, 'tempTotp');
98
+ if (!decoded) {
99
+ return { status: 'error', message: 'Invalid token' };
100
+ }
101
+ if (decoded.newSecret) {
102
+ const verified = twofactor.verifyToken(decoded.newSecret, body.code);
103
+ if (verified) {
104
+ this.connectors = this.adminforth.connectors;
105
+ const connector = this.connectors[this.authResource.dataSource];
106
+ await connector.updateRecord({ resource: this.authResource, recordId: decoded.pk, newValues: { [this.options.twoFaSecretFieldName]: decoded.newSecret } });
107
+ this.adminforth.auth.removeCustomCookie({ response, name: 'totpTemporaryJWT' });
108
+ this.adminforth.auth.setAuthCookie({ response, username: decoded.userName, pk: decoded.pk });
109
+ return { status: 'ok', allowedLogin: true };
110
+ }
111
+ else {
112
+ return { error: 'Wrong or expired OTP code' };
113
+ }
114
+ }
115
+ else {
116
+ // user already has secret, get it
117
+ this.connectors = this.adminforth.connectors;
118
+ const connector = this.connectors[this.authResource.dataSource];
119
+ const user = await connector.getRecordByPrimaryKey(this.authResource, decoded.pk);
120
+ const verified = twofactor.verifyToken(user[this.options.twoFaSecretFieldName], body.code);
121
+ if (verified) {
122
+ this.adminforth.auth.removeCustomCookie({ response, name: 'totpTemporaryJWT' });
123
+ this.adminforth.auth.setAuthCookie({ response, username: decoded.userName, pk: decoded.pk });
124
+ return { status: 'ok', allowedLogin: true };
125
+ }
126
+ else {
127
+ return { error: 'Wrong or expired OTP code' };
128
+ }
129
+ }
130
+ }
131
+ });
132
+ }
133
+ }
134
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../plugins/two-factors-auth/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAG,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE/C,OAAO,SAAS,MAAM,UAAU,CAAC;AAGjC,MAAM,CAAC,OAAO,OAAO,oBAAqB,SAAQ,gBAAgB;IAOhE,YAAY,OAAsB;QAChC,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC,IAAI,CA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ACH,CAAC;qBAAM,CAAC;oBACP,kCAAkC;oBACjC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,UAAU,CAAA;oBAC5C,MAAM,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;oBAChE,MAAM,IAAI,GAAG,MAAM,SAAS,CAAC,qBAAqB,CAAC,IAAI,CAAC,YAAY,EAAE,OAAO,CAAC,EAAE,CAAC,CAAA;oBACjF,MAAM,QAAQ,GAAG,SAAS,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;oBAC3F,IAAI,QAAQ,EAAE,CAAC;wBACb,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,kBAAkB,CAAC,EAAC,QAAQ,EAAE,IAAI,EAAC,kBAAkB,EAAC,CAAC,CAAA;wBAC5E,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,aAAa,CAAC,EAAC,QAAQ,EAAE,QAAQ,EAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,EAAC,OAAO,CAAC,EAAE,EAAC,CAAC,CAAA;wBACxF,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,CAAA;oBAC7C,CAAC;yBAAM,CAAC;wBACN,OAAO,EAAC,KAAK,EAAE,2BAA2B,EAAC,CAAA;oBAC7C,CAAC;gBACH,CAAC;YACH,CAAC;SACF,CAAC,CAAA;IACJ,CAAC;CACF"}
@@ -0,0 +1,18 @@
1
+ import { AdminUser } from "adminforth";
2
+ export type PluginOptions = {
3
+ /**
4
+ * Name of the field in the auth resource which will store 2FA secret.
5
+ *
6
+ * Resource mandatory should have one columns which defined {@link AdminForthResourceColumn} which
7
+ * name should be equal to the value .
8
+ */
9
+ twoFaSecretFieldName: string;
10
+ /**
11
+ * Optional function to filter users to apply 2FA.
12
+ * Should return true if 2FA should be applied to the user and false if AdminForth should not challenge the user with 2FA.
13
+ * @param adminUser
14
+ * @returns true if 2FA should be applied to the user and false if AdminForth should not challenge the user with 2FA.
15
+ */
16
+ usersFilterToApply: (adminUser: AdminUser) => boolean;
17
+ };
18
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../plugins/two-factors-auth/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,MAAM,MAAM,aAAa,GAAG;IAExB;;;;;OAKG;IACH,oBAAoB,EAAE,MAAM,CAAC;IAE7B;;;;;OAKG;IACH,kBAAkB,EAAE,CAAC,SAAS,EAAE,SAAS,KAAK,OAAO,CAAC;CACzD,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../plugins/two-factors-auth/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,14 @@
1
+ import { PluginOptions } from './types.js';
2
+ import { S3 } from '@aws-sdk/client-s3';
3
+ import { AdminForthPlugin, IAdminForth, IHttpServer } from "adminforth";
4
+ export default class UploadPlugin extends AdminForthPlugin {
5
+ options: PluginOptions;
6
+ constructor(options: PluginOptions);
7
+ instanceUniqueRepresentation(pluginOptions: any): string;
8
+ setupLifecycleRule(): Promise<void>;
9
+ genPreviewUrl(record: any, s3: S3): Promise<void>;
10
+ modifyResourceConfig(adminforth: IAdminForth, resourceConfig: any): Promise<void>;
11
+ validateConfigAfterDiscover(adminforth: IAdminForth, resourceConfig: any): void;
12
+ setupEndpoints(server: IHttpServer): void;
13
+ }
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../plugins/upload/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,OAAO,EAAyE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AAC/G,OAAO,EAAE,gBAAgB,EAAqD,WAAW,EAAE,WAAW,EAAiB,MAAM,YAAY,CAAC;AAM1I,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,gBAAgB;IACxD,OAAO,EAAE,aAAa,CAAC;gBAEX,OAAO,EAAE,aAAa;IAKlC,4BAA4B,CAAC,aAAa,EAAE,GAAG,GAAI,MAAM;IAInD,kBAAkB;IA2DlB,aAAa,CAAC,MAAM,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE;IAajC,oBAAoB,CAAC,UAAU,EAAE,WAAW,EAAE,cAAc,EAAE,GAAG;IA8QvE,2BAA2B,CAAC,UAAU,EAAE,WAAW,EAAE,cAAc,EAAE,GAAG;IAKxE,cAAc,CAAC,MAAM,EAAE,WAAW;CA2JnC"}