@saltcorn/server 1.1.2-beta.9 → 1.1.3-beta.0

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 (418) hide show
  1. package/CHANGELOG.md +29 -1
  2. package/auth/admin.js +8 -1
  3. package/auth/routes.js +45 -4
  4. package/docs/.nojekyll +1 -0
  5. package/docs/assets/custom.css +6 -0
  6. package/docs/assets/highlight.css +85 -0
  7. package/docs/assets/main.js +58 -0
  8. package/docs/assets/search.js +1 -0
  9. package/docs/assets/style.css +1367 -0
  10. package/docs/classes/_saltcorn_common_code.Relation.html +162 -0
  11. package/docs/classes/_saltcorn_common_code.RelationsFinder.html +182 -0
  12. package/docs/classes/_saltcorn_data.models.Crash-1.html +316 -0
  13. package/docs/classes/_saltcorn_data.models.EventLog-1.html +350 -0
  14. package/docs/classes/_saltcorn_data.models.Field.html +949 -0
  15. package/docs/classes/_saltcorn_data.models.FieldRepeat-1.html +293 -0
  16. package/docs/classes/_saltcorn_data.models.File-1.html +881 -0
  17. package/docs/classes/_saltcorn_data.models.Form-1.html +494 -0
  18. package/docs/classes/_saltcorn_data.models.Library.html +295 -0
  19. package/docs/classes/_saltcorn_data.models.Page.html +417 -0
  20. package/docs/classes/_saltcorn_data.models.PageGroup-1.html +500 -0
  21. package/docs/classes/_saltcorn_data.models.Plugin.html +414 -0
  22. package/docs/classes/_saltcorn_data.models.Role.html +254 -0
  23. package/docs/classes/_saltcorn_data.models.Table-1.html +1830 -0
  24. package/docs/classes/_saltcorn_data.models.TableConstraint-1.html +296 -0
  25. package/docs/classes/_saltcorn_data.models.Trigger.html +672 -0
  26. package/docs/classes/_saltcorn_data.models.User-1.html +813 -0
  27. package/docs/classes/_saltcorn_data.models.View-1.html +878 -0
  28. package/docs/classes/_saltcorn_data.models.Workflow-1.html +374 -0
  29. package/docs/classes/_saltcorn_data.models.WorkflowRun.html +529 -0
  30. package/docs/classes/_saltcorn_data.models.WorkflowStep.html +421 -0
  31. package/docs/classes/_saltcorn_data.models.WorkflowTrace.html +318 -0
  32. package/docs/classes/_saltcorn_mobile_builder.MobileBuilder.html +356 -0
  33. package/docs/enums/_saltcorn_common_code.RelationType.html +115 -0
  34. package/docs/enums/_saltcorn_common_code.ViewDisplayType.html +94 -0
  35. package/docs/functions/_saltcorn_admin_models.backup.create_backup.html +76 -0
  36. package/docs/functions/_saltcorn_admin_models.backup.create_csv_from_rows.html +77 -0
  37. package/docs/functions/_saltcorn_admin_models.backup.restore.html +93 -0
  38. package/docs/functions/_saltcorn_admin_models.pack.add_to_menu.html +100 -0
  39. package/docs/functions/_saltcorn_admin_models.pack.can_install_pack.html +89 -0
  40. package/docs/functions/_saltcorn_admin_models.pack.fetch_available_packs.html +83 -0
  41. package/docs/functions/_saltcorn_admin_models.pack.fetch_pack_by_name.html +90 -0
  42. package/docs/functions/_saltcorn_admin_models.pack.install_pack.html +107 -0
  43. package/docs/functions/_saltcorn_admin_models.pack.library_pack.html +90 -0
  44. package/docs/functions/_saltcorn_admin_models.pack.model_instance_pack.html +95 -0
  45. package/docs/functions/_saltcorn_admin_models.pack.model_pack.html +96 -0
  46. package/docs/functions/_saltcorn_admin_models.pack.page_group_pack.html +91 -0
  47. package/docs/functions/_saltcorn_admin_models.pack.page_pack.html +91 -0
  48. package/docs/functions/_saltcorn_admin_models.pack.plugin_pack.html +89 -0
  49. package/docs/functions/_saltcorn_admin_models.pack.role_pack.html +90 -0
  50. package/docs/functions/_saltcorn_admin_models.pack.table_pack.html +90 -0
  51. package/docs/functions/_saltcorn_admin_models.pack.trigger_pack.html +89 -0
  52. package/docs/functions/_saltcorn_admin_models.pack.uninstall_pack.html +92 -0
  53. package/docs/functions/_saltcorn_admin_models.pack.view_pack.html +89 -0
  54. package/docs/functions/_saltcorn_admin_models.tenant.copy_tenant_template.html +105 -0
  55. package/docs/functions/_saltcorn_admin_models.tenant.create_tenant.html +107 -0
  56. package/docs/functions/_saltcorn_admin_models.tenant.deleteTenant.html +88 -0
  57. package/docs/functions/_saltcorn_admin_models.tenant.domain_sanitize.html +87 -0
  58. package/docs/functions/_saltcorn_admin_models.tenant.eachTenant.html +91 -0
  59. package/docs/functions/_saltcorn_admin_models.tenant.getAllTenantRows.html +77 -0
  60. package/docs/functions/_saltcorn_admin_models.tenant.getAllTenants.html +77 -0
  61. package/docs/functions/_saltcorn_admin_models.tenant.insertTenant.html +103 -0
  62. package/docs/functions/_saltcorn_admin_models.tenant.switchToTenant.html +92 -0
  63. package/docs/functions/_saltcorn_common_code.buildTableCaches.html +81 -0
  64. package/docs/functions/_saltcorn_common_code.parseLegacyRelation.html +77 -0
  65. package/docs/functions/_saltcorn_common_code.parseRelationPath.html +76 -0
  66. package/docs/functions/_saltcorn_data.models.config.check_email_mask.html +131 -0
  67. package/docs/functions/_saltcorn_data.models.config.deleteConfig.html +131 -0
  68. package/docs/functions/_saltcorn_data.models.config.getAllConfig.html +125 -0
  69. package/docs/functions/_saltcorn_data.models.config.getConfig.html +134 -0
  70. package/docs/functions/_saltcorn_data.models.config.get_base_url.html +130 -0
  71. package/docs/functions/_saltcorn_data.models.config.get_latest_npm_version.html +132 -0
  72. package/docs/functions/_saltcorn_data.models.config.remove_from_menu.html +131 -0
  73. package/docs/functions/_saltcorn_data.models.config.save_menu_items.html +126 -0
  74. package/docs/functions/_saltcorn_data.models.config.setConfig.html +134 -0
  75. package/docs/functions/_saltcorn_data.models.discovery.discover_tables.html +131 -0
  76. package/docs/functions/_saltcorn_data.models.discovery.discoverable_tables.html +129 -0
  77. package/docs/functions/_saltcorn_data.models.discovery.findType.html +127 -0
  78. package/docs/functions/_saltcorn_data.models.discovery.get_existing_views.html +127 -0
  79. package/docs/functions/_saltcorn_data.models.discovery.implement_discovery.html +129 -0
  80. package/docs/functions/_saltcorn_data.models.email.getMailTransport.html +114 -0
  81. package/docs/functions/_saltcorn_data.models.email.send_verification_email.html +130 -0
  82. package/docs/functions/_saltcorn_data.models.email.viewToEmailHtml.html +130 -0
  83. package/docs/functions/_saltcorn_data.models.expression.apply_calculated_fields.html +131 -0
  84. package/docs/functions/_saltcorn_data.models.expression.apply_calculated_fields_stored.html +131 -0
  85. package/docs/functions/_saltcorn_data.models.expression.eval_expression.html +132 -0
  86. package/docs/functions/_saltcorn_data.models.expression.expressionValidator.html +126 -0
  87. package/docs/functions/_saltcorn_data.models.expression.get_async_expression_function.html +132 -0
  88. package/docs/functions/_saltcorn_data.models.expression.get_expression_function.html +129 -0
  89. package/docs/functions/_saltcorn_data.models.expression.jsexprToWhere.html +131 -0
  90. package/docs/functions/_saltcorn_data.models.expression.recalculate_for_stored.html +132 -0
  91. package/docs/functions/_saltcorn_data.models.expression.transform_for_async.html +134 -0
  92. package/docs/functions/_saltcorn_data.models.layout.eachView.html +128 -0
  93. package/docs/functions/_saltcorn_data.models.layout.getStringsForI18n.html +123 -0
  94. package/docs/functions/_saltcorn_data.models.layout.getViews.html +123 -0
  95. package/docs/functions/_saltcorn_data.models.layout.translateLayout.html +126 -0
  96. package/docs/functions/_saltcorn_data.models.layout.traverse.html +126 -0
  97. package/docs/functions/_saltcorn_data.models.layout.traverseSync.html +126 -0
  98. package/docs/functions/_saltcorn_data.models.random.all_views.html +123 -0
  99. package/docs/functions/_saltcorn_data.models.random.fill_table_row.html +123 -0
  100. package/docs/functions/_saltcorn_data.models.random.initial_view.html +126 -0
  101. package/docs/functions/_saltcorn_data.models.random.random_table.html +120 -0
  102. package/docs/functions/_saltcorn_db_common.buildInsertBulkSql.html +127 -0
  103. package/docs/functions/_saltcorn_db_common.buildInsertSql.html +128 -0
  104. package/docs/functions/_saltcorn_db_common.doCount.html +110 -0
  105. package/docs/functions/_saltcorn_db_common.doDeleteWhere.html +110 -0
  106. package/docs/functions/_saltcorn_db_common.doListScTables.html +104 -0
  107. package/docs/functions/_saltcorn_db_common.doListTables.html +104 -0
  108. package/docs/functions/_saltcorn_db_common.doListUserDefinedTables.html +104 -0
  109. package/docs/functions/_saltcorn_db_common.do_add_index.html +120 -0
  110. package/docs/functions/_saltcorn_db_common.do_drop_index.html +120 -0
  111. package/docs/functions/_saltcorn_db_common.ftsFieldsSqlExpr.html +106 -0
  112. package/docs/functions/_saltcorn_db_common.mkSelectOptions.html +108 -0
  113. package/docs/functions/_saltcorn_db_common.mkVal.html +105 -0
  114. package/docs/functions/_saltcorn_db_common.mkWhere.html +110 -0
  115. package/docs/functions/_saltcorn_db_common.multi_tenant.enable_multi_tenant.html +108 -0
  116. package/docs/functions/_saltcorn_db_common.multi_tenant.getTenantSchema.html +110 -0
  117. package/docs/functions/_saltcorn_db_common.multi_tenant.init.html +116 -0
  118. package/docs/functions/_saltcorn_db_common.multi_tenant.is_it_multi_tenant.html +110 -0
  119. package/docs/functions/_saltcorn_db_common.multi_tenant.runWithTenant.html +130 -0
  120. package/docs/functions/_saltcorn_db_common.orderByIsObject.html +102 -0
  121. package/docs/functions/_saltcorn_db_common.orderByIsOperator.html +102 -0
  122. package/docs/functions/_saltcorn_db_common.prefixFieldsInWhere.html +104 -0
  123. package/docs/functions/_saltcorn_db_common.reprAsJson.html +107 -0
  124. package/docs/functions/_saltcorn_db_common.single_tenant.enable_multi_tenant.html +107 -0
  125. package/docs/functions/_saltcorn_db_common.single_tenant.getTenantSchema.html +109 -0
  126. package/docs/functions/_saltcorn_db_common.single_tenant.init.html +115 -0
  127. package/docs/functions/_saltcorn_db_common.single_tenant.is_it_multi_tenant.html +109 -0
  128. package/docs/functions/_saltcorn_db_common.single_tenant.runWithTenant.html +129 -0
  129. package/docs/functions/_saltcorn_db_common.sqlBinOp.html +111 -0
  130. package/docs/functions/_saltcorn_db_common.sqlFun.html +111 -0
  131. package/docs/functions/_saltcorn_db_common.sqlsanitize.html +108 -0
  132. package/docs/functions/_saltcorn_db_common.sqlsanitizeAllowDots.html +110 -0
  133. package/docs/functions/_saltcorn_db_common.subSelectWhere.html +133 -0
  134. package/docs/functions/_saltcorn_mobile_builder.common_build_utils.buildTablesFile.html +110 -0
  135. package/docs/functions/_saltcorn_mobile_builder.common_build_utils.copyPrepopulatedDb.html +100 -0
  136. package/docs/functions/_saltcorn_mobile_builder.common_build_utils.copyServerFiles.html +104 -0
  137. package/docs/functions/_saltcorn_mobile_builder.common_build_utils.copyShareExtFiles.html +98 -0
  138. package/docs/functions/_saltcorn_mobile_builder.common_build_utils.copySiteLogo.html +102 -0
  139. package/docs/functions/_saltcorn_mobile_builder.common_build_utils.copyTranslationFiles.html +104 -0
  140. package/docs/functions/_saltcorn_mobile_builder.common_build_utils.createSqliteDb.html +105 -0
  141. package/docs/functions/_saltcorn_mobile_builder.common_build_utils.decodeProvisioningProfile.html +100 -0
  142. package/docs/functions/_saltcorn_mobile_builder.common_build_utils.extractDomain.html +98 -0
  143. package/docs/functions/_saltcorn_mobile_builder.common_build_utils.generateAndroidVersionCode.html +98 -0
  144. package/docs/functions/_saltcorn_mobile_builder.common_build_utils.modifyAndroidManifest.html +102 -0
  145. package/docs/functions/_saltcorn_mobile_builder.common_build_utils.modifyConfigXml.html +100 -0
  146. package/docs/functions/_saltcorn_mobile_builder.common_build_utils.modifyGradleConfig.html +100 -0
  147. package/docs/functions/_saltcorn_mobile_builder.common_build_utils.modifyInfoPlist.html +100 -0
  148. package/docs/functions/_saltcorn_mobile_builder.common_build_utils.modifyXcodeProjectFile.html +107 -0
  149. package/docs/functions/_saltcorn_mobile_builder.common_build_utils.prepAppIcon.html +100 -0
  150. package/docs/functions/_saltcorn_mobile_builder.common_build_utils.prepareAppIcon.html +109 -0
  151. package/docs/functions/_saltcorn_mobile_builder.common_build_utils.prepareBuildDir.html +110 -0
  152. package/docs/functions/_saltcorn_mobile_builder.common_build_utils.prepareExportOptionsPlist.html +98 -0
  153. package/docs/functions/_saltcorn_mobile_builder.common_build_utils.prepareSplashIcon.html +110 -0
  154. package/docs/functions/_saltcorn_mobile_builder.common_build_utils.prepareSplashPage.html +119 -0
  155. package/docs/functions/_saltcorn_mobile_builder.common_build_utils.writeCapacitorConfig.html +100 -0
  156. package/docs/functions/_saltcorn_mobile_builder.common_build_utils.writeCfgFile.html +102 -0
  157. package/docs/functions/_saltcorn_mobile_builder.common_build_utils.writeDataExtractionRules.html +98 -0
  158. package/docs/functions/_saltcorn_mobile_builder.common_build_utils.writeNetworkSecurityConfig.html +100 -0
  159. package/docs/functions/_saltcorn_mobile_builder.common_build_utils.writePodfile.html +98 -0
  160. package/docs/functions/_saltcorn_mobile_builder.common_build_utils.writePrivacyInfo.html +98 -0
  161. package/docs/functions/_saltcorn_mobile_builder.package_bundle_utils.bundleMobileAppCode.html +73 -0
  162. package/docs/functions/_saltcorn_mobile_builder.package_bundle_utils.bundlePackagesAndPlugins.html +82 -0
  163. package/docs/functions/_saltcorn_mobile_builder.package_bundle_utils.copyPublicDirs.html +80 -0
  164. package/docs/functions/_saltcorn_sqlite.add_index.html +105 -0
  165. package/docs/functions/_saltcorn_sqlite.add_unique_constraint.html +105 -0
  166. package/docs/functions/_saltcorn_sqlite.begin.html +92 -0
  167. package/docs/functions/_saltcorn_sqlite.changeConnection.html +100 -0
  168. package/docs/functions/_saltcorn_sqlite.close.html +92 -0
  169. package/docs/functions/_saltcorn_sqlite.commit.html +92 -0
  170. package/docs/functions/_saltcorn_sqlite.count.html +106 -0
  171. package/docs/functions/_saltcorn_sqlite.deleteWhere.html +106 -0
  172. package/docs/functions/_saltcorn_sqlite.dropTable.html +95 -0
  173. package/docs/functions/_saltcorn_sqlite.dropTables.html +95 -0
  174. package/docs/functions/_saltcorn_sqlite.drop_index.html +105 -0
  175. package/docs/functions/_saltcorn_sqlite.drop_reset_schema.html +94 -0
  176. package/docs/functions/_saltcorn_sqlite.drop_unique_constraint.html +105 -0
  177. package/docs/functions/_saltcorn_sqlite.getVersion.html +93 -0
  178. package/docs/functions/_saltcorn_sqlite.get_db_filepath.html +92 -0
  179. package/docs/functions/_saltcorn_sqlite.get_sql_logging.html +92 -0
  180. package/docs/functions/_saltcorn_sqlite.init.html +105 -0
  181. package/docs/functions/_saltcorn_sqlite.insert.html +113 -0
  182. package/docs/functions/_saltcorn_sqlite.listScTables.html +89 -0
  183. package/docs/functions/_saltcorn_sqlite.listTables.html +89 -0
  184. package/docs/functions/_saltcorn_sqlite.listUserDefinedTables.html +89 -0
  185. package/docs/functions/_saltcorn_sqlite.query.html +98 -0
  186. package/docs/functions/_saltcorn_sqlite.rollback.html +92 -0
  187. package/docs/functions/_saltcorn_sqlite.select.html +108 -0
  188. package/docs/functions/_saltcorn_sqlite.selectMaybeOne.html +110 -0
  189. package/docs/functions/_saltcorn_sqlite.selectOne.html +109 -0
  190. package/docs/functions/_saltcorn_sqlite.set_sql_logging.html +96 -0
  191. package/docs/functions/_saltcorn_sqlite.slugify.html +93 -0
  192. package/docs/functions/_saltcorn_sqlite.sql_log.html +104 -0
  193. package/docs/functions/_saltcorn_sqlite.update.html +111 -0
  194. package/docs/functions/_saltcorn_sqlite.updateWhere.html +97 -0
  195. package/docs/functions/_saltcorn_sqlite_mobile.add_index.html +95 -0
  196. package/docs/functions/_saltcorn_sqlite_mobile.add_unique_constraint.html +95 -0
  197. package/docs/functions/_saltcorn_sqlite_mobile.count.html +88 -0
  198. package/docs/functions/_saltcorn_sqlite_mobile.deleteWhere.html +85 -0
  199. package/docs/functions/_saltcorn_sqlite_mobile.drop_index.html +95 -0
  200. package/docs/functions/_saltcorn_sqlite_mobile.drop_reset_schema.html +78 -0
  201. package/docs/functions/_saltcorn_sqlite_mobile.drop_unique_constraint.html +95 -0
  202. package/docs/functions/_saltcorn_sqlite_mobile.init.html +78 -0
  203. package/docs/functions/_saltcorn_sqlite_mobile.insert.html +96 -0
  204. package/docs/functions/_saltcorn_sqlite_mobile.insertRows.html +94 -0
  205. package/docs/functions/_saltcorn_sqlite_mobile.listScTables.html +79 -0
  206. package/docs/functions/_saltcorn_sqlite_mobile.listTables.html +79 -0
  207. package/docs/functions/_saltcorn_sqlite_mobile.listUserDefinedTables.html +79 -0
  208. package/docs/functions/_saltcorn_sqlite_mobile.query.html +85 -0
  209. package/docs/functions/_saltcorn_sqlite_mobile.select.html +87 -0
  210. package/docs/functions/_saltcorn_sqlite_mobile.selectMaybeOne.html +88 -0
  211. package/docs/functions/_saltcorn_sqlite_mobile.selectOne.html +88 -0
  212. package/docs/functions/_saltcorn_sqlite_mobile.setConnectionObject.html +85 -0
  213. package/docs/functions/_saltcorn_sqlite_mobile.tableExists.html +87 -0
  214. package/docs/functions/_saltcorn_sqlite_mobile.time.html +78 -0
  215. package/docs/functions/_saltcorn_sqlite_mobile.update.html +97 -0
  216. package/docs/functions/_saltcorn_types.ModelAbstracts.abstract_field.instanceOfField.html +88 -0
  217. package/docs/functions/_saltcorn_types.ModelAbstracts.abstract_page.instanceOfPage.html +87 -0
  218. package/docs/functions/_saltcorn_types.ModelAbstracts.abstract_view.instanceOfView.html +87 -0
  219. package/docs/functions/_saltcorn_types.Types.base_types.instanceOWithHtmlFile.html +107 -0
  220. package/docs/functions/_saltcorn_types.Types.common_types.instanceOfErrorMsg.html +84 -0
  221. package/docs/functions/_saltcorn_types.Types.common_types.instanceOfSuccessMsg.html +84 -0
  222. package/docs/functions/_saltcorn_types.Types.common_types.instanceOfType.html +84 -0
  223. package/docs/functions/_saltcorn_types.generators.generateBool.html +68 -0
  224. package/docs/functions/_saltcorn_types.generators.generateString.html +75 -0
  225. package/docs/functions/_saltcorn_types.generators.num_between.html +75 -0
  226. package/docs/functions/_saltcorn_types.generators.oneOf.html +73 -0
  227. package/docs/index.html +56 -0
  228. package/docs/interfaces/_saltcorn_mobile_builder.common_build_utils.ScCapacitorConfig.html +169 -0
  229. package/docs/interfaces/_saltcorn_types.ModelAbstracts.abstract_field.AbstractField.html +187 -0
  230. package/docs/interfaces/_saltcorn_types.ModelAbstracts.abstract_field.AbstractFieldRepeat.html +110 -0
  231. package/docs/interfaces/_saltcorn_types.ModelAbstracts.abstract_form.AbstractForm.html +268 -0
  232. package/docs/interfaces/_saltcorn_types.ModelAbstracts.abstract_page.AbstractPage.html +153 -0
  233. package/docs/interfaces/_saltcorn_types.ModelAbstracts.abstract_role.AbstractRole.html +108 -0
  234. package/docs/interfaces/_saltcorn_types.ModelAbstracts.abstract_table.AbstractTable.html +147 -0
  235. package/docs/interfaces/_saltcorn_types.ModelAbstracts.abstract_trigger.AbstractTrigger.html +224 -0
  236. package/docs/interfaces/_saltcorn_types.ModelAbstracts.abstract_view.AbstractView.html +174 -0
  237. package/docs/interfaces/_saltcorn_types.ModelAbstracts.abstract_workflow.AbstractWorkflow.html +264 -0
  238. package/docs/modules/_saltcorn_admin_models.backup.html +74 -0
  239. package/docs/modules/_saltcorn_admin_models.html +68 -0
  240. package/docs/modules/_saltcorn_admin_models.pack.html +100 -0
  241. package/docs/modules/_saltcorn_admin_models.tenant.html +86 -0
  242. package/docs/modules/_saltcorn_common_code.html +77 -0
  243. package/docs/modules/_saltcorn_data.html +476 -0
  244. package/docs/modules/_saltcorn_data.models.Crash.html +113 -0
  245. package/docs/modules/_saltcorn_data.models.EventLog.html +113 -0
  246. package/docs/modules/_saltcorn_data.models.FieldRepeat.html +113 -0
  247. package/docs/modules/_saltcorn_data.models.File.html +113 -0
  248. package/docs/modules/_saltcorn_data.models.Form.html +115 -0
  249. package/docs/modules/_saltcorn_data.models.PageGroup.html +113 -0
  250. package/docs/modules/_saltcorn_data.models.Table.html +117 -0
  251. package/docs/modules/_saltcorn_data.models.TableConstraint.html +113 -0
  252. package/docs/modules/_saltcorn_data.models.User.html +113 -0
  253. package/docs/modules/_saltcorn_data.models.View.html +113 -0
  254. package/docs/modules/_saltcorn_data.models.Workflow.html +113 -0
  255. package/docs/modules/_saltcorn_data.models.config.html +135 -0
  256. package/docs/modules/_saltcorn_data.models.discovery.html +120 -0
  257. package/docs/modules/_saltcorn_data.models.email.html +116 -0
  258. package/docs/modules/_saltcorn_data.models.expression.html +128 -0
  259. package/docs/modules/_saltcorn_data.models.html +150 -0
  260. package/docs/modules/_saltcorn_data.models.layout.html +122 -0
  261. package/docs/modules/_saltcorn_data.models.random.html +118 -0
  262. package/docs/modules/_saltcorn_data.models.scheduler.html +112 -0
  263. package/docs/modules/_saltcorn_data.plugin_helper.html +70 -0
  264. package/docs/modules/_saltcorn_data.utils.html +72 -0
  265. package/docs/modules/_saltcorn_db_common.html +181 -0
  266. package/docs/modules/_saltcorn_db_common.multi_tenant.html +120 -0
  267. package/docs/modules/_saltcorn_db_common.single_tenant.html +115 -0
  268. package/docs/modules/_saltcorn_markup.html +399 -0
  269. package/docs/modules/_saltcorn_mobile_builder.common_build_utils.html +124 -0
  270. package/docs/modules/_saltcorn_mobile_builder.html +75 -0
  271. package/docs/modules/_saltcorn_mobile_builder.package_bundle_utils.html +71 -0
  272. package/docs/modules/_saltcorn_sqlite.html +123 -0
  273. package/docs/modules/_saltcorn_sqlite_mobile.html +103 -0
  274. package/docs/modules/_saltcorn_types.ModelAbstracts.abstract_field.html +94 -0
  275. package/docs/modules/_saltcorn_types.ModelAbstracts.abstract_form.html +85 -0
  276. package/docs/modules/_saltcorn_types.ModelAbstracts.abstract_library.html +82 -0
  277. package/docs/modules/_saltcorn_types.ModelAbstracts.abstract_page.html +92 -0
  278. package/docs/modules/_saltcorn_types.ModelAbstracts.abstract_plugin.html +82 -0
  279. package/docs/modules/_saltcorn_types.ModelAbstracts.abstract_role.html +87 -0
  280. package/docs/modules/_saltcorn_types.ModelAbstracts.abstract_table.html +87 -0
  281. package/docs/modules/_saltcorn_types.ModelAbstracts.abstract_trigger.html +87 -0
  282. package/docs/modules/_saltcorn_types.ModelAbstracts.abstract_view.html +92 -0
  283. package/docs/modules/_saltcorn_types.ModelAbstracts.abstract_workflow.html +87 -0
  284. package/docs/modules/_saltcorn_types.ModelAbstracts.html +88 -0
  285. package/docs/modules/_saltcorn_types.Types.base_types.html +141 -0
  286. package/docs/modules/_saltcorn_types.Types.common_types.html +91 -0
  287. package/docs/modules/_saltcorn_types.Types.html +68 -0
  288. package/docs/modules/_saltcorn_types.generators.html +76 -0
  289. package/docs/modules/_saltcorn_types.html +67 -0
  290. package/docs/types/_saltcorn_data.models.Crash.CrashCfg.html +128 -0
  291. package/docs/types/_saltcorn_data.models.EventLog.EventLogCfg.html +122 -0
  292. package/docs/types/_saltcorn_data.models.FieldRepeat.FieldRepeatCfg.html +126 -0
  293. package/docs/types/_saltcorn_data.models.File.FileCfg.html +132 -0
  294. package/docs/types/_saltcorn_data.models.Form.AdditionalButton.html +108 -0
  295. package/docs/types/_saltcorn_data.models.Form.FormCfg.html +180 -0
  296. package/docs/types/_saltcorn_data.models.PageGroup.ScreenInfoParams.html +118 -0
  297. package/docs/types/_saltcorn_data.models.Table.ChildRelations.html +116 -0
  298. package/docs/types/_saltcorn_data.models.Table.ParentRelations.html +116 -0
  299. package/docs/types/_saltcorn_data.models.Table.RelationData.html +116 -0
  300. package/docs/types/_saltcorn_data.models.TableConstraint.TableConstraintCfg.html +120 -0
  301. package/docs/types/_saltcorn_data.models.User.UserCfg.html +138 -0
  302. package/docs/types/_saltcorn_data.models.View.FindViewsPred.html +127 -0
  303. package/docs/types/_saltcorn_data.models.Workflow.WorkflowCfg.html +161 -0
  304. package/docs/types/_saltcorn_db_common.AggregationOptions.html +114 -0
  305. package/docs/types/_saltcorn_db_common.CoordOpts.html +104 -0
  306. package/docs/types/_saltcorn_db_common.JoinField.html +106 -0
  307. package/docs/types/_saltcorn_db_common.JoinFields.html +98 -0
  308. package/docs/types/_saltcorn_db_common.JoinOptions.html +107 -0
  309. package/docs/types/_saltcorn_db_common.JsonPath.html +93 -0
  310. package/docs/types/_saltcorn_db_common.JsonPathElem.html +93 -0
  311. package/docs/types/_saltcorn_db_common.Operator.html +102 -0
  312. package/docs/types/_saltcorn_db_common.PrimaryKeyValue.html +93 -0
  313. package/docs/types/_saltcorn_db_common.Row.html +98 -0
  314. package/docs/types/_saltcorn_db_common.SelectOptions.html +132 -0
  315. package/docs/types/_saltcorn_db_common.SqlAndValues.html +104 -0
  316. package/docs/types/_saltcorn_db_common.SubselectOptions.html +104 -0
  317. package/docs/types/_saltcorn_db_common.Value.html +93 -0
  318. package/docs/types/_saltcorn_db_common.Where.html +115 -0
  319. package/docs/types/_saltcorn_mobile_builder.IosCfg.html +76 -0
  320. package/docs/types/_saltcorn_types.ModelAbstracts.abstract_field.FieldCfg.html +168 -0
  321. package/docs/types/_saltcorn_types.ModelAbstracts.abstract_field.InputType.html +79 -0
  322. package/docs/types/_saltcorn_types.ModelAbstracts.abstract_form.AdditionalButton.html +87 -0
  323. package/docs/types/_saltcorn_types.ModelAbstracts.abstract_library.LibraryCfg.html +87 -0
  324. package/docs/types/_saltcorn_types.ModelAbstracts.abstract_library.LibraryPack.html +79 -0
  325. package/docs/types/_saltcorn_types.ModelAbstracts.abstract_page.PageCfg.html +97 -0
  326. package/docs/types/_saltcorn_types.ModelAbstracts.abstract_page.PagePack.html +85 -0
  327. package/docs/types/_saltcorn_types.ModelAbstracts.abstract_plugin.PluginCfg.html +103 -0
  328. package/docs/types/_saltcorn_types.ModelAbstracts.abstract_plugin.PluginPack.html +79 -0
  329. package/docs/types/_saltcorn_types.ModelAbstracts.abstract_role.RoleCfg.html +84 -0
  330. package/docs/types/_saltcorn_types.ModelAbstracts.abstract_role.RolePack.html +80 -0
  331. package/docs/types/_saltcorn_types.ModelAbstracts.abstract_table.TableCfg.html +111 -0
  332. package/docs/types/_saltcorn_types.ModelAbstracts.abstract_table.TablePack.html +86 -0
  333. package/docs/types/_saltcorn_types.ModelAbstracts.abstract_trigger.TriggerCfg.html +104 -0
  334. package/docs/types/_saltcorn_types.ModelAbstracts.abstract_trigger.TriggerPack.html +80 -0
  335. package/docs/types/_saltcorn_types.ModelAbstracts.abstract_view.ViewCfg.html +109 -0
  336. package/docs/types/_saltcorn_types.ModelAbstracts.abstract_view.ViewPack.html +89 -0
  337. package/docs/types/_saltcorn_types.ModelAbstracts.abstract_workflow.ConfigWorkflowStep.html +97 -0
  338. package/docs/types/_saltcorn_types.ModelAbstracts.abstract_workflow.RunResult.html +100 -0
  339. package/docs/types/_saltcorn_types.Types.base_types.Action.html +189 -0
  340. package/docs/types/_saltcorn_types.Types.base_types.AuthenticationMethod.html +109 -0
  341. package/docs/types/_saltcorn_types.Types.base_types.CodePagePack.html +107 -0
  342. package/docs/types/_saltcorn_types.Types.base_types.Column.html +103 -0
  343. package/docs/types/_saltcorn_types.Types.base_types.ConnectedObjects.html +109 -0
  344. package/docs/types/_saltcorn_types.Types.base_types.CopilotSkill.html +149 -0
  345. package/docs/types/_saltcorn_types.Types.base_types.FieldLike.html +98 -0
  346. package/docs/types/_saltcorn_types.Types.base_types.FieldView.html +166 -0
  347. package/docs/types/_saltcorn_types.Types.base_types.Header.html +107 -0
  348. package/docs/types/_saltcorn_types.Types.base_types.JoinFieldOption.html +109 -0
  349. package/docs/types/_saltcorn_types.Types.base_types.Layout.html +98 -0
  350. package/docs/types/_saltcorn_types.Types.base_types.MobileConfig.html +133 -0
  351. package/docs/types/_saltcorn_types.Types.base_types.ModelPattern.html +261 -0
  352. package/docs/types/_saltcorn_types.Types.base_types.Pack.html +129 -0
  353. package/docs/types/_saltcorn_types.Types.base_types.Plugin.html +122 -0
  354. package/docs/types/_saltcorn_types.Types.base_types.PluginFunction.html +120 -0
  355. package/docs/types/_saltcorn_types.Types.base_types.PluginLayout.html +116 -0
  356. package/docs/types/_saltcorn_types.Types.base_types.PluginRoute.html +125 -0
  357. package/docs/types/_saltcorn_types.Types.base_types.PluginSourceType.html +98 -0
  358. package/docs/types/_saltcorn_types.Types.base_types.PluginType.html +183 -0
  359. package/docs/types/_saltcorn_types.Types.base_types.PluginWrap.html +111 -0
  360. package/docs/types/_saltcorn_types.Types.base_types.PluginWrapArg.html +122 -0
  361. package/docs/types/_saltcorn_types.Types.base_types.RelationOption.html +105 -0
  362. package/docs/types/_saltcorn_types.Types.base_types.Req.html +178 -0
  363. package/docs/types/_saltcorn_types.Types.base_types.Res.html +168 -0
  364. package/docs/types/_saltcorn_types.Types.base_types.RouteAction.html +121 -0
  365. package/docs/types/_saltcorn_types.Types.base_types.RunExtra.html +103 -0
  366. package/docs/types/_saltcorn_types.Types.base_types.TableProvider.html +140 -0
  367. package/docs/types/_saltcorn_types.Types.base_types.TableQuery.html +129 -0
  368. package/docs/types/_saltcorn_types.Types.base_types.Tablely.html +103 -0
  369. package/docs/types/_saltcorn_types.Types.base_types.ViewTemplate.html +471 -0
  370. package/docs/types/_saltcorn_types.Types.common_types.ErrorMessage.html +84 -0
  371. package/docs/types/_saltcorn_types.Types.common_types.GenObj.html +80 -0
  372. package/docs/types/_saltcorn_types.Types.common_types.ReqRes.html +82 -0
  373. package/docs/types/_saltcorn_types.Types.common_types.ResultMessage.html +75 -0
  374. package/docs/types/_saltcorn_types.Types.common_types.SuccessMessage.html +86 -0
  375. package/docs/types/_saltcorn_types.Types.common_types.Type.html +144 -0
  376. package/docs/variables/_saltcorn_data.db.html +60 -0
  377. package/docs/variables/_saltcorn_data.migrations.html +60 -0
  378. package/docs/variables/_saltcorn_data.models.config.available_languages.html +154 -0
  379. package/docs/variables/_saltcorn_data.models.config.configTypes.html +117 -0
  380. package/docs/variables/_saltcorn_data.models.scheduler.runScheduler.html +152 -0
  381. package/docs/variables/_saltcorn_data.plugin_helper.run_action_column.html +65 -0
  382. package/docs/variables/_saltcorn_data.utils.NotAuthorized.html +66 -0
  383. package/docs/variables/_saltcorn_data.utils.sleep.html +66 -0
  384. package/docs/variables/_saltcorn_db_common.multi_tenant.tenantNamespace.html +103 -0
  385. package/help/Extra state formula.tmd +1 -1
  386. package/help/JavaScript action code.tmd +1 -1
  387. package/locales/ar.json +1289 -4
  388. package/locales/da.json +355 -203
  389. package/locales/de.json +665 -149
  390. package/locales/en.json +16 -1
  391. package/locales/es.json +1567 -1271
  392. package/locales/fr.json +1562 -294
  393. package/locales/hi.json +1563 -0
  394. package/locales/pt.json +1300 -11
  395. package/locales/ru.json +1577 -1222
  396. package/locales/si.json +402 -4
  397. package/locales/uk.json +399 -3
  398. package/locales/zh.json +689 -7
  399. package/markup/admin.js +32 -14
  400. package/package.json +9 -9
  401. package/public/gridedit.js +4 -2
  402. package/public/saltcorn-common.js +45 -13
  403. package/public/saltcorn.js +17 -28
  404. package/routes/actions.js +4 -42
  405. package/routes/admin.js +78 -43
  406. package/routes/api.js +9 -9
  407. package/routes/delete.js +4 -2
  408. package/routes/eventlog.js +64 -27
  409. package/routes/fields.js +25 -14
  410. package/routes/files.js +9 -9
  411. package/routes/infoarch.js +57 -2
  412. package/routes/list.js +6 -4
  413. package/routes/pageedit.js +1 -1
  414. package/routes/plugins.js +36 -1
  415. package/routes/search.js +7 -3
  416. package/routes/tables.js +207 -28
  417. package/tests/admin.test.js +15 -0
  418. package/wrapper.js +14 -4
package/routes/api.js CHANGED
@@ -78,8 +78,8 @@ function accessAllowedRead(req, user, table, allow_ownership) {
78
78
  req.user && req.user.id
79
79
  ? req.user.role_id
80
80
  : user && user.role_id
81
- ? user.role_id
82
- : 100;
81
+ ? user.role_id
82
+ : 100;
83
83
 
84
84
  return (
85
85
  role <= table.min_role_read ||
@@ -101,8 +101,8 @@ function accessAllowedWrite(req, user, table) {
101
101
  req.user && req.user.id
102
102
  ? req.user.role_id
103
103
  : user && user.role_id
104
- ? user.role_id
105
- : 100;
104
+ ? user.role_id
105
+ : 100;
106
106
 
107
107
  return (
108
108
  role <= table.min_role_write ||
@@ -122,8 +122,8 @@ function accessAllowed(req, user, trigger) {
122
122
  req.user && req.user.id
123
123
  ? req.user.role_id
124
124
  : user && user.role_id
125
- ? user.role_id
126
- : 100;
125
+ ? user.role_id
126
+ : 100;
127
127
 
128
128
  return role <= trigger.min_role;
129
129
  }
@@ -397,8 +397,8 @@ router.get(
397
397
  const derefs = Array.isArray(dereference)
398
398
  ? dereference
399
399
  : !dereference
400
- ? []
401
- : [dereference];
400
+ ? []
401
+ : [dereference];
402
402
  derefs.forEach((f) => {
403
403
  const field = table.getField(f);
404
404
  if (field?.attributes?.summary_field)
@@ -701,7 +701,7 @@ router.delete(
701
701
  );
702
702
  } else
703
703
  await table.deleteRows(
704
- { id },
704
+ { [table.pk_name]: id },
705
705
  user || req.user || { role_id: 100 }
706
706
  );
707
707
  res.json({ success: true });
package/routes/delete.js CHANGED
@@ -35,9 +35,11 @@ router.post(
35
35
  // todo check that works after where change
36
36
  const table = Table.findOne({ name: tableName });
37
37
  const role = req.user && req.user.id ? req.user.role_id : 100;
38
+ const where = { [table.pk_name]: id };
39
+
38
40
  try {
39
41
  if (role <= table.min_role_write)
40
- await table.deleteRows({ id }, req.user || { role_id: 100 });
42
+ await table.deleteRows(where, req.user || { role_id: 100 });
41
43
  else if (
42
44
  (table.ownership_field_id || table.ownership_formula) &&
43
45
  req.user
@@ -47,7 +49,7 @@ router.post(
47
49
  { forUser: req.user, forPublic: !req.user }
48
50
  );
49
51
  if (row && table.is_owner(req.user, row))
50
- await table.deleteRows({ id }, req.user || { role_id: 100 });
52
+ await table.deleteRows(where, req.user || { role_id: 100 });
51
53
  else req.flash("error", req.__("Not authorized"));
52
54
  } else
53
55
  req.flash(
@@ -459,33 +459,70 @@ router.get(
459
459
  isAdmin,
460
460
  error_catcher(async (req, res) => {
461
461
  const { id } = req.params;
462
- const ev = await EventLog.findOneWithUser(id);
462
+ const { or_less, or_more } = req.query;
463
463
  const locale = getState().getConfig("default_locale", "en");
464
- send_events_page({
465
- res,
466
- req,
467
- active_sub: "Event log",
468
- sub2_page: ev.id,
469
- contents: {
470
- type: "card",
471
- contents:
472
- table(
473
- { class: "table eventlog" },
474
- tbody(
475
- tr(
476
- th(req.__("When")),
477
- td(localeDateTime(ev.occur_at, {}, locale))
478
- ),
479
- tr(th(req.__("Type")), td(ev.event_type)),
480
- tr(th(req.__("Channel")), td(ev.channel)),
481
- tr(th(req.__("User")), td(ev.email))
482
- )
483
- ) +
484
- div(
485
- { class: "eventpayload" },
486
- ev.payload ? pre(text(JSON.stringify(ev.payload, null, 2))) : ""
487
- ),
488
- },
489
- });
464
+ let ev = await EventLog.findOneWithUser(id);
465
+ if (!ev && (or_less || or_more)) {
466
+ const evFound = await EventLog.find(
467
+ {
468
+ id: or_less ? { lt: +id } : { gt: +id },
469
+ },
470
+ { limit: 1, orderBy: "id", orderDesc: !!or_less }
471
+ );
472
+ if (evFound.length) ev = await EventLog.findOneWithUser(evFound[0].id);
473
+ }
474
+ if (!ev) {
475
+ req.flash("warning", "Event not found");
476
+ res.redirect("/eventlog");
477
+ } else
478
+ send_events_page({
479
+ res,
480
+ req,
481
+ active_sub: "Event log",
482
+ sub2_page: ev.id,
483
+ contents: {
484
+ type: "card",
485
+ contents:
486
+ table(
487
+ { class: "table eventlog" },
488
+ tbody(
489
+ tr(
490
+ th(req.__("When")),
491
+ td(
492
+ div(
493
+ { class: "d-flex justify-content-between" },
494
+ div(localeDateTime(ev.occur_at, {}, locale)),
495
+ div(
496
+ +id > 1
497
+ ? a(
498
+ {
499
+ href: `/eventlog/${ev.id - 1}?or_less=1`,
500
+ class: "btn btn-sm btn-secondary me-1",
501
+ },
502
+ i({ class: "fas fa-chevron-left" })
503
+ )
504
+ : "",
505
+ a(
506
+ {
507
+ href: `/eventlog/${ev.id + 1}?or_more=1`,
508
+ class: "btn btn-sm btn-secondary",
509
+ },
510
+ i({ class: "fas fa-chevron-right" })
511
+ )
512
+ )
513
+ )
514
+ )
515
+ ),
516
+ tr(th(req.__("Type")), td(ev.event_type)),
517
+ tr(th(req.__("Channel")), td(ev.channel)),
518
+ tr(th(req.__("User")), td(ev.email))
519
+ )
520
+ ) +
521
+ div(
522
+ { class: "eventpayload" },
523
+ ev.payload ? pre(text(JSON.stringify(ev.payload, null, 2))) : ""
524
+ ),
525
+ },
526
+ });
490
527
  })
491
528
  );
package/routes/fields.js CHANGED
@@ -303,6 +303,7 @@ const fieldFlow = (req) =>
303
303
  fldRow.is_unique = false;
304
304
  fldRow.required = false;
305
305
  }
306
+ const table = Table.findOne({ id: table_id });
306
307
  if (context.id) {
307
308
  const field = await Field.findOne({ id: context.id });
308
309
  try {
@@ -311,10 +312,15 @@ const fieldFlow = (req) =>
311
312
  }
312
313
 
313
314
  await field.update(fldRow);
314
- Trigger.emitEvent("AppChange", `Field ${fldRow.name}`, req.user, {
315
- entity_type: "Field",
316
- entity_name: fldRow.name || fldRow.label,
317
- });
315
+ Trigger.emitEvent(
316
+ "AppChange",
317
+ `Field ${fldRow.name} on table ${table?.name}`,
318
+ req.user,
319
+ {
320
+ entity_type: "Field",
321
+ entity_name: fldRow.name || fldRow.label,
322
+ }
323
+ );
318
324
  } catch (e) {
319
325
  return {
320
326
  redirect: `/table/${context.table_id}`,
@@ -324,10 +330,15 @@ const fieldFlow = (req) =>
324
330
  } else {
325
331
  try {
326
332
  await Field.create(fldRow);
327
- Trigger.emitEvent("AppChange", `Field ${fldRow.name}`, req.user, {
328
- entity_type: "Field",
329
- entity_name: fldRow.name || fldRow.label,
330
- });
333
+ Trigger.emitEvent(
334
+ "AppChange",
335
+ `Field ${fldRow.name} on table ${table?.name}`,
336
+ req.user,
337
+ {
338
+ entity_type: "Field",
339
+ entity_name: fldRow.name || fldRow.label,
340
+ }
341
+ );
331
342
  } catch (e) {
332
343
  return {
333
344
  redirect: `/table/${context.table_id}`,
@@ -669,8 +680,8 @@ const fieldFlow = (req) =>
669
680
  a.type?.name === "String" && b.type?.name !== "String"
670
681
  ? -1
671
682
  : a.type?.name !== "String" && b.type?.name === "String"
672
- ? 1
673
- : 0
683
+ ? 1
684
+ : 0
674
685
  )
675
686
  .map((f) => ({
676
687
  value: f.name,
@@ -1165,8 +1176,8 @@ router.post(
1165
1176
  typeof value === "string"
1166
1177
  ? value
1167
1178
  : value?.toString
1168
- ? value.toString()
1169
- : `${value}`
1179
+ ? value.toString()
1180
+ : `${value}`
1170
1181
  );
1171
1182
  return;
1172
1183
  }
@@ -1289,8 +1300,8 @@ router.post(
1289
1300
  field.type === "Key"
1290
1301
  ? state.keyFieldviews
1291
1302
  : field.type === "File"
1292
- ? state.fileviews
1293
- : field.type.fieldviews;
1303
+ ? state.fileviews
1304
+ : field.type.fieldviews;
1294
1305
  if (!field.type || !fieldviews) {
1295
1306
  res.send("");
1296
1307
  return;
package/routes/files.js CHANGED
@@ -19,6 +19,7 @@ const {
19
19
  error_catcher,
20
20
  setTenant,
21
21
  is_relative_url,
22
+ isAdminOrHasConfigMinRole,
22
23
  } = require("./utils.js");
23
24
  const {
24
25
  h1,
@@ -156,7 +157,7 @@ router.get(
156
157
  */
157
158
  router.get(
158
159
  "/",
159
- isAdmin,
160
+ isAdminOrHasConfigMinRole("min_role_edit_files"),
160
161
  error_catcher(async (req, res) => {
161
162
  // todo limit select from file by 10 or 20
162
163
  const { dir, search } = req.query;
@@ -245,8 +246,7 @@ router.get(
245
246
 
246
247
  router.post(
247
248
  "/download-zip",
248
- isAdmin,
249
-
249
+ isAdminOrHasConfigMinRole("min_role_edit_files"),
250
250
  error_catcher(async (req, res) => {
251
251
  const role = req.user && req.user.id ? req.user.role_id : 100;
252
252
  const user_id = req.user && req.user.id;
@@ -377,7 +377,7 @@ router.get(
377
377
  */
378
378
  router.post(
379
379
  "/setrole/*serve_path",
380
- isAdmin,
380
+ isAdminOrHasConfigMinRole("min_role_edit_files"),
381
381
  error_catcher(async (req, res) => {
382
382
  const serve_path = path.join(...req.params.serve_path);
383
383
  const file = await File.findOne(serve_path);
@@ -397,7 +397,7 @@ router.post(
397
397
 
398
398
  router.post(
399
399
  "/move/*serve_path",
400
- isAdmin,
400
+ isAdminOrHasConfigMinRole("min_role_edit_files"),
401
401
  error_catcher(async (req, res) => {
402
402
  const serve_path = path.join(...req.params.serve_path);
403
403
  const file = await File.findOne(serve_path);
@@ -424,7 +424,7 @@ router.post(
424
424
  */
425
425
  router.post(
426
426
  "/setname/*serve_path",
427
- isAdmin,
427
+ isAdminOrHasConfigMinRole("min_role_edit_files"),
428
428
  error_catcher(async (req, res) => {
429
429
  const serve_path = path.join(...req.params.serve_path);
430
430
  const filename = (req.body || {}).value;
@@ -444,7 +444,7 @@ router.post(
444
444
  */
445
445
  router.post(
446
446
  "/unzip/*serve_path",
447
- isAdmin,
447
+ isAdminOrHasConfigMinRole("min_role_edit_files"),
448
448
  error_catcher(async (req, res) => {
449
449
  const serve_path = path.join(...req.params.serve_path);
450
450
  const filename = (req.body || {}).value;
@@ -458,7 +458,7 @@ router.post(
458
458
 
459
459
  router.post(
460
460
  "/new-folder",
461
- isAdmin,
461
+ isAdminOrHasConfigMinRole("min_role_edit_files"),
462
462
  error_catcher(async (req, res) => {
463
463
  const { name, folder } = req.body || {};
464
464
  await File.new_folder(name, folder);
@@ -535,7 +535,7 @@ router.post(
535
535
  */
536
536
  router.post(
537
537
  "/delete/*serve_path",
538
- isAdmin,
538
+ isAdminOrHasConfigMinRole("min_role_edit_files"),
539
539
  error_catcher(async (req, res) => {
540
540
  const serve_path = path.join(...req.params.serve_path);
541
541
  const { redirect } = req.query;
@@ -5,7 +5,12 @@
5
5
  */
6
6
 
7
7
  const Router = require("express-promise-router");
8
- const { isAdmin, setTenant, error_catcher } = require("./utils.js");
8
+ const {
9
+ isAdmin,
10
+ setTenant,
11
+ error_catcher,
12
+ isAdminOrHasConfigMinRole,
13
+ } = require("./utils.js");
9
14
  const {
10
15
  send_infoarch_page,
11
16
  send_admin_page,
@@ -13,9 +18,10 @@ const {
13
18
  save_config_from_form,
14
19
  } = require("../markup/admin.js");
15
20
  const { getState } = require("@saltcorn/data/db/state");
16
- const { div, a, i, text } = require("@saltcorn/markup/tags");
21
+ const { div, a, i, text, button } = require("@saltcorn/markup/tags");
17
22
  const { mkTable, renderForm, post_delete_btn } = require("@saltcorn/markup");
18
23
  const Form = require("@saltcorn/data/models/form");
24
+ const Snapshot = require("@saltcorn/admin-models/models/snapshot");
19
25
 
20
26
  /**
21
27
  * @type {object}
@@ -41,6 +47,55 @@ router.get(
41
47
  })
42
48
  );
43
49
 
50
+ router.get(
51
+ "/create-snapshot",
52
+ isAdminOrHasConfigMinRole("min_role_create_snapshots"),
53
+ error_catcher(async (req, res) => {
54
+ send_infoarch_page({
55
+ res,
56
+ req,
57
+ active_sub: "Snapshots",
58
+ contents: {
59
+ type: "card",
60
+ contents: div(
61
+ button(
62
+ {
63
+ class: "btn btn-outline-secondary",
64
+ type: "button",
65
+ onclick:
66
+ "ajax_post('/site-structure/create-snapshot/'+prompt('Name of snapshot (optional)'))",
67
+ },
68
+ req.__("Snapshot now")
69
+ )
70
+ ),
71
+ },
72
+ });
73
+ })
74
+ );
75
+
76
+ router.post(
77
+ "/create-snapshot/:snapshotname",
78
+ isAdminOrHasConfigMinRole("min_role_create_snapshots"),
79
+ error_catcher(async (req, res) => {
80
+ const { snapshotname } = req.params;
81
+ if (snapshotname == "null") {
82
+ //user clicked cancel on prompt
83
+ res.json({ success: true });
84
+ return;
85
+ }
86
+
87
+ try {
88
+ const taken = await Snapshot.take_if_changed(snapshotname);
89
+ if (taken) req.flash("success", req.__("Snapshot successful"));
90
+ else
91
+ req.flash("success", req.__("No changes detected, snapshot skipped"));
92
+ } catch (e) {
93
+ req.flash("error", e.message);
94
+ }
95
+ res.json({ reload_page: true });
96
+ })
97
+ );
98
+
44
99
  /**
45
100
  * @param {object} req
46
101
  * @returns {Form}
package/routes/list.js CHANGED
@@ -282,6 +282,7 @@ router.get(
282
282
  cellClick: "__delete_tabulator_row",
283
283
  });
284
284
  const isDark = getState().getLightDarkMode(req.user) === "dark";
285
+ const pkNm = table.pk_name
285
286
  res.sendWrap(
286
287
  {
287
288
  title: req.__(`%s data table`, table.name),
@@ -401,6 +402,7 @@ router.get(
401
402
  col[k] = window[v.substring(2)];
402
403
  })
403
404
  })
405
+ window.tabulator_table_primary_key = "${table.pk_name}";
404
406
  window.tabulator_table = new Tabulator("#jsGrid", {
405
407
  ajaxURL:"/api/${encodeURIComponent(
406
408
  table.name
@@ -420,7 +422,7 @@ router.get(
420
422
  ajaxContentType:"json",
421
423
  sortMode:"remote",
422
424
  initialSort:[
423
- {column:"id", dir:"asc"},
425
+ {column:"${table.pk_name}", dir:"asc"},
424
426
  ],
425
427
  });
426
428
  window.tabulator_table.on("cellEdited", function(cell){
@@ -428,7 +430,7 @@ router.get(
428
430
  ajax_indicator(true);
429
431
  $.ajax({
430
432
  type: "POST",
431
- url: "/api/${table.name}/" + (row.id||""),
433
+ url: "/api/${table.name}/" + (row.${pkNm}||""),
432
434
  data: row,
433
435
  headers: {
434
436
  "CSRF-Token": _sc_globalCsrf,
@@ -438,8 +440,8 @@ router.get(
438
440
  ajax_indicator(false);
439
441
  //if (item._versions) item._versions = +item._versions + 1;
440
442
  //data.resolve(fixKeys(item));
441
- if(resp.success &&(typeof resp.success ==="number" || typeof resp.success ==="string") && !row.id) {
442
- window.tabulator_table.updateRow(cell.getRow(), {id: resp.success});
443
+ if(resp.success &&(typeof resp.success ==="number" || typeof resp.success ==="string") && !row.${pkNm}) {
444
+ window.tabulator_table.updateRow(cell.getRow(), {${pkNm}: resp.success});
443
445
  }
444
446
 
445
447
  }).fail(function (resp) {
@@ -289,7 +289,7 @@ const getRootPageForm = (pages, pageGroups, roles, req) => {
289
289
  input_type: "select",
290
290
  options: [
291
291
  "",
292
- ...pages.map((p) => p.name),
292
+ ...pages.filter((p) => p.min_role >= r.id).map((p) => p.name),
293
293
  ...pageGroups.map((g) => ({
294
294
  label: `${g.name} (group)`,
295
295
  value: g.name,
package/routes/plugins.js CHANGED
@@ -495,6 +495,17 @@ const store_actions_dropdown = (req) => {
495
495
  '<i class="far fa-arrow-alt-circle-up"></i>&nbsp;' +
496
496
  req.__("Upgrade installed modules")
497
497
  ),
498
+ db.getTenantSchema() === db.connectObj.default_schema &&
499
+ a(
500
+ {
501
+ class: "dropdown-item",
502
+ href: `/plugins/reinstall-all`,
503
+ onClick: `notifyAlert('${req.__("Upgrading modules...")}', true)`,
504
+ },
505
+ '<i class="fas fa-pump-medical"></i>&nbsp;' +
506
+ req.__("Clean modules and restart")
507
+ ),
508
+
498
509
  (db.getTenantSchema() === db.connectObj.default_schema ||
499
510
  tenants_install_git) &&
500
511
  a(
@@ -558,7 +569,7 @@ const plugin_store_html = (items, req) => {
558
569
  },
559
570
  {
560
571
  besides: items.map(store_item_html(req)),
561
- gy:3,
572
+ gy: 3,
562
573
  widths: items.map(() => 4),
563
574
  },
564
575
  ],
@@ -1397,6 +1408,30 @@ router.get(
1397
1408
  })
1398
1409
  );
1399
1410
 
1411
+ /**
1412
+ * @name get/upgrade
1413
+ * @function
1414
+ * @memberof module:routes/plugins~pluginsRouter
1415
+ * @function
1416
+ */
1417
+ router.get(
1418
+ "/reinstall-all",
1419
+ isAdmin,
1420
+ error_catcher(async (req, res) => {
1421
+ //TODO make this post
1422
+ const schema = db.getTenantSchema();
1423
+ if (schema === db.connectObj.default_schema) {
1424
+ await PluginInstaller.cleanPluginsDirectory();
1425
+ req.flash("success", req.__(`Modules cleaned, server restarting...`));
1426
+ setTimeout(() => {
1427
+ if (process.send) getState().processSend("RestartServer");
1428
+ else process.exit(0);
1429
+ }, 1000);
1430
+ }
1431
+ res.redirect(`/plugins`);
1432
+ })
1433
+ );
1434
+
1400
1435
  /**
1401
1436
  * @name get/upgrade-plugin/:name
1402
1437
  * @function
package/routes/search.js CHANGED
@@ -10,7 +10,11 @@ const { span, h5, h4, nbsp, p, a, div } = require("@saltcorn/markup/tags");
10
10
  const { getState } = require("@saltcorn/data/db/state");
11
11
  const db = require("@saltcorn/data/db");
12
12
 
13
- const { isAdmin, error_catcher } = require("./utils.js");
13
+ const {
14
+ isAdmin,
15
+ error_catcher,
16
+ isAdminOrHasConfigMinRole,
17
+ } = require("./utils.js");
14
18
  const Form = require("@saltcorn/data/models/form");
15
19
  const Table = require("@saltcorn/data/models/table");
16
20
  const View = require("@saltcorn/data/models/view");
@@ -94,7 +98,7 @@ const searchConfigForm = (tables, views, req) => {
94
98
  */
95
99
  router.get(
96
100
  "/config",
97
- isAdmin,
101
+ isAdminOrHasConfigMinRole("min_role_edit_search"),
98
102
  error_catcher(async (req, res) => {
99
103
  const views = await View.find({}, { orderBy: "name" });
100
104
  const tables = await Table.find();
@@ -131,7 +135,7 @@ router.get(
131
135
  */
132
136
  router.post(
133
137
  "/config",
134
- isAdmin,
138
+ isAdminOrHasConfigMinRole("min_role_edit_search"),
135
139
  error_catcher(async (req, res) => {
136
140
  const views = await View.find({}, { orderBy: "name" });
137
141
  const tables = await Table.find();