@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/tables.js CHANGED
@@ -14,6 +14,7 @@ const User = require("@saltcorn/data/models/user");
14
14
  const Model = require("@saltcorn/data/models/model");
15
15
  const Trigger = require("@saltcorn/data/models/trigger");
16
16
  const TagEntry = require("@saltcorn/data/models/tag_entry");
17
+ const Notification = require("@saltcorn/data/models/notification");
17
18
  const {
18
19
  mkTable,
19
20
  renderForm,
@@ -50,6 +51,10 @@ const {
50
51
  code,
51
52
  pre,
52
53
  button,
54
+ text_attr,
55
+ br,
56
+ select,
57
+ option,
53
58
  } = require("@saltcorn/markup/tags");
54
59
  const { stringify } = require("csv-stringify");
55
60
  const TableConstraint = require("@saltcorn/data/models/table_constraints");
@@ -66,6 +71,7 @@ const {
66
71
  InvalidConfiguration,
67
72
  removeAllWhiteSpace,
68
73
  comparingCaseInsensitive,
74
+ validSqlId,
69
75
  } = require("@saltcorn/data/utils");
70
76
  const { EOL } = require("os");
71
77
 
@@ -461,6 +467,15 @@ router.post(
461
467
  req.flash("error", parse_res.error);
462
468
  res.redirect(`/table/create-from-csv`);
463
469
  } else {
470
+ Trigger.emitEvent(
471
+ "AppChange",
472
+ `Table ${parse_res.table.name}`,
473
+ req.user,
474
+ {
475
+ entity_type: "Table",
476
+ entity_name: parse_res.table.name,
477
+ }
478
+ );
464
479
  req.flash(
465
480
  "success",
466
481
  req.__(`Created table %s.`, parse_res.table.name) + parse_res.success
@@ -483,7 +498,10 @@ const buildTableMarkup = (table) => {
483
498
  const members = fields
484
499
  // .filter((f) => !f.reftable_name)
485
500
  .map((f) =>
486
- indentString(`${removeAllWhiteSpace(f.type_name)} ${f.name}`, 6)
501
+ indentString(
502
+ `${removeAllWhiteSpace(f.type_name)} ${validSqlId(f.name)}`,
503
+ 6
504
+ )
487
505
  )
488
506
  .join(EOL);
489
507
  const keys = table
@@ -696,7 +714,14 @@ const typeBadges = (f, req) => {
696
714
  if (f.primary_key) s += badge("warning", req.__("Primary key"));
697
715
  if (f.required) s += badge("primary", req.__("Required"));
698
716
  if (f.is_unique) s += badge("success", req.__("Unique"));
699
- if (f.calculated) s += badge("info", req.__("Calculated"));
717
+ if (f.calculated)
718
+ s += badge(
719
+ "info",
720
+ req.__("Calculated"),
721
+ f.expression && f.expression !== "__aggregation"
722
+ ? text_attr(f.expression)
723
+ : undefined
724
+ );
700
725
  if (f.stored) s += badge("warning", req.__("Stored"));
701
726
  return s;
702
727
  };
@@ -709,8 +734,12 @@ const attribBadges = (f) => {
709
734
  let s = "";
710
735
  if (f.attributes) {
711
736
  Object.entries(f.attributes).forEach(([k, v]) => {
737
+ if (k === "summary_field") s += badge("secondary", "Summary", v);
738
+ if (k === "include_fts" && v)
739
+ s += badge("secondary", "FTS", "Include in full-text search");
712
740
  if (
713
741
  [
742
+ "include_fts",
714
743
  "summary_field",
715
744
  "importance",
716
745
  "on_delete_cascade",
@@ -782,7 +811,11 @@ router.get(
782
811
  const triggers = table.id ? Trigger.find({ table_id: table.id }) : [];
783
812
  triggers.sort(comparingCaseInsensitive("name"));
784
813
  let fieldCard;
785
- const nPrimaryKeys = fields.filter((f) => f.primary_key).length;
814
+ const primaryKeys = fields.filter((f) => f.primary_key);
815
+ const nPrimaryKeys = primaryKeys.length;
816
+ const nonSerialPKS = primaryKeys.some(
817
+ (f) => f.attributes?.NonSerial && f.type?.name === "Integer"
818
+ );
786
819
 
787
820
  if (fields.length === 0) {
788
821
  fieldCard = [
@@ -846,11 +879,13 @@ router.get(
846
879
  { hover: true }
847
880
  );
848
881
  fieldCard = [
849
- nPrimaryKeys > 1 &&
882
+ (nPrimaryKeys !== 1 || nonSerialPKS) &&
883
+ !table.external &&
884
+ !table.provider_name &&
850
885
  div(
851
886
  { class: "alert alert-danger", role: "alert" },
852
887
  i({ class: "fas fa-exclamation-triangle" }),
853
- "This table has composite primary keys which is not supported in Saltcorn. A procedure to introduce a single autoincrementing primary key is available.",
888
+ "This table has composite, non-defaulted integer, or no primary keys, which are not supported in Saltcorn. A procedure to introduce a single autoincrementing primary key is available.",
854
889
  post_btn(
855
890
  `/table/repair-composite-primary/${table.id}`,
856
891
  "Add autoincrementing primary key",
@@ -978,8 +1013,8 @@ router.get(
978
1013
  table.name === "users"
979
1014
  ? `/useradmin/`
980
1015
  : fields.length === 1
981
- ? `javascript:;` // Fix problem with edition of table with only one column ID / Primary Key
982
- : `/list/${encodeURIComponent(table.name)}`,
1016
+ ? `javascript:;` // Fix problem with edition of table with only one column ID / Primary Key
1017
+ : `/list/${encodeURIComponent(table.name)}`,
983
1018
  },
984
1019
  i({ class: "fas fa-2x fa-edit" }),
985
1020
  "<br/>",
@@ -1097,6 +1132,15 @@ router.get(
1097
1132
  req,
1098
1133
  true
1099
1134
  ),
1135
+ req.user.role_id === 1 &&
1136
+ table.name !== "users" &&
1137
+ post_dropdown_item(
1138
+ `/table/delete-with-trig-views/${table.id}`,
1139
+ '<i class="fas fa-trash"></i>&nbsp;' +
1140
+ req.__("Delete table+views+triggers"),
1141
+ req,
1142
+ true
1143
+ ),
1100
1144
  ])
1101
1145
  )
1102
1146
  );
@@ -1191,6 +1235,10 @@ router.post(
1191
1235
  } else {
1192
1236
  delete rest.provider_name;
1193
1237
  const table = await Table.create(name, rest);
1238
+ Trigger.emitEvent("AppChange", `Table ${name}`, req.user, {
1239
+ entity_type: "Table",
1240
+ entity_name: name,
1241
+ });
1194
1242
  req.flash("success", req.__(`Table %s created`, name));
1195
1243
  res.redirect(`/table/${table.id}`);
1196
1244
  }
@@ -1258,6 +1306,50 @@ router.post(
1258
1306
  })
1259
1307
  );
1260
1308
 
1309
+ //delete-with-trig-views
1310
+ /**
1311
+ * Delete Table Route Handler definition
1312
+ * /delete:/id, where id is table id in _sc_tables
1313
+ * @name post/delete/:id
1314
+ * @function
1315
+ * @memberof module:routes/tables~tablesRouter
1316
+ * @function
1317
+ */
1318
+ router.post(
1319
+ "/delete-with-trig-views/:id",
1320
+ isAdmin,
1321
+ error_catcher(async (req, res) => {
1322
+ const { id } = req.params;
1323
+ const t = Table.findOne({ id });
1324
+ if (!t) {
1325
+ req.flash("error", `Table not found`);
1326
+ res.redirect(`/table`);
1327
+ return;
1328
+ }
1329
+ if (t.name === "users") {
1330
+ req.flash("error", req.__(`Cannot delete users table`));
1331
+ res.redirect(`/table`);
1332
+ return;
1333
+ }
1334
+ const views = await View.find(
1335
+ t.id ? { table_id: t.id } : { exttable_name: t.name }
1336
+ );
1337
+ for (const view of views) await view.delete();
1338
+ if (t.id) {
1339
+ const triggers = await Trigger.find({ table_id: t.id });
1340
+ for (const trig of triggers) await trig.delete();
1341
+ }
1342
+ try {
1343
+ await t.delete();
1344
+ req.flash("success", req.__(`Table %s deleted`, t.name));
1345
+ res.redirect(`/table`);
1346
+ } catch (err) {
1347
+ req.flash("error", err.message);
1348
+ res.redirect(`/table`);
1349
+ }
1350
+ })
1351
+ );
1352
+
1261
1353
  /**
1262
1354
  * Delete Table Route Handler definition
1263
1355
  * /delete:/id, where id is table id in _sc_tables
@@ -1311,6 +1403,10 @@ router.post(
1311
1403
  try {
1312
1404
  await t.delete();
1313
1405
  req.flash("success", req.__(`Table %s deleted`, t.name));
1406
+ Trigger.emitEvent("AppChange", `Table ${t.name} deleted`, req.user, {
1407
+ entity_type: "Table",
1408
+ entity_name: t.name,
1409
+ });
1314
1410
  res.redirect(`/table`);
1315
1411
  } catch (err) {
1316
1412
  req.flash("error", err.message);
@@ -1459,7 +1555,10 @@ router.get(
1459
1555
  res.redirect(`/table/${table.id}`);
1460
1556
  return;
1461
1557
  }
1462
- const rows = await table.getRows({}, { orderBy: "id", forUser: req.user });
1558
+ const rows = await table.getRows(
1559
+ {},
1560
+ { orderBy: table.pk_name, forUser: req.user }
1561
+ );
1463
1562
  res.setHeader("Content-Type", "text/csv");
1464
1563
  res.setHeader("Content-Disposition", `attachment; filename="${name}.csv"`);
1465
1564
  res.setHeader("Cache-Control", "no-cache");
@@ -1535,12 +1634,12 @@ router.get(
1535
1634
  r.type === "Unique"
1536
1635
  ? r.configuration.fields.join(", ")
1537
1636
  : r.type === "Index" && r.configuration?.field === "_fts"
1538
- ? "Full text search"
1539
- : r.type === "Index"
1540
- ? r.configuration.field
1541
- : r.type === "Formula"
1542
- ? r.configuration.formula
1543
- : "",
1637
+ ? "Full text search"
1638
+ : r.type === "Index"
1639
+ ? r.configuration.field
1640
+ : r.type === "Formula"
1641
+ ? r.configuration.formula
1642
+ : "",
1544
1643
  },
1545
1644
  {
1546
1645
  label: req.__("Delete"),
@@ -1743,6 +1842,15 @@ router.post(
1743
1842
  type,
1744
1843
  configuration,
1745
1844
  });
1845
+ Trigger.emitEvent(
1846
+ "AppChange",
1847
+ `Constraint ${type} on table ${table?.name}`,
1848
+ req.user,
1849
+ {
1850
+ entity_type: "TableConstraint",
1851
+ entity_name: table.name,
1852
+ }
1853
+ );
1746
1854
  }
1747
1855
  res.redirect(`/table/constraints/${table.id}`);
1748
1856
  })
@@ -1889,18 +1997,52 @@ const previewCSV = async ({ newPath, table, req, res, full }) => {
1889
1997
  "Cancel",
1890
1998
  req.csrfToken(),
1891
1999
  {
1892
- btnClass: "btn-danger",
2000
+ btnClass: "btn-danger mb-2",
1893
2001
  formClass: "d-inline me-2",
1894
2002
  icon: "fa fa-times",
1895
2003
  }
1896
2004
  ),
1897
- post_btn(
1898
- `/table/finish_upload_to_table/${table.name}/${path.basename(
1899
- newPath
1900
- )}`,
1901
- "Proceed",
1902
- req.csrfToken(),
1903
- { icon: "fa fa-check", formClass: "d-inline" }
2005
+ form(
2006
+ {
2007
+ action: `/table/finish_upload_to_table/${table.name}/${path.basename(
2008
+ newPath
2009
+ )}`,
2010
+ method: "post",
2011
+ class: "d-inline",
2012
+ },
2013
+ input({ type: "hidden", name: "_csrf", value: req.csrfToken() }),
2014
+ button(
2015
+ { type: "submit", class: "btn btn-primary mb-2" },
2016
+ i({ class: "fa fa-check" }),
2017
+ "Proceed"
2018
+ ),
2019
+ br(),
2020
+ i({ class: "muted" }, "Method"),
2021
+ select(
2022
+ {
2023
+ name: "import_method",
2024
+ class: "form-select from-control mb-2",
2025
+ },
2026
+ option("Auto"),
2027
+ option({ value: "copy" }, "COPY (fast but strict)"),
2028
+ option(
2029
+ { value: "row-by-row" },
2030
+ "Row-by-row (Slower but more accepting)"
2031
+ )
2032
+ ),
2033
+ div(
2034
+ { class: "form-check" },
2035
+ input({
2036
+ class: "form-check-input",
2037
+ type: "checkbox",
2038
+ id: "import_async",
2039
+ name: "import_async",
2040
+ }),
2041
+ label(
2042
+ { class: "form-check-label", for: "import_async" },
2043
+ "Asynchronous"
2044
+ )
2045
+ )
1904
2046
  )
1905
2047
  ),
1906
2048
  },
@@ -2005,15 +2147,43 @@ router.post(
2005
2147
  const f = await File.findOne(filename);
2006
2148
 
2007
2149
  try {
2008
- const parse_res = await table.import_csv_file(f.location, {
2009
- recalc_stored: true,
2010
- });
2011
- if (parse_res.error) req.flash("error", parse_res.error);
2012
- else req.flash("success", parse_res.success);
2150
+ const { import_method, import_async } = req.body || {};
2151
+
2152
+ const promise = table
2153
+ .import_csv_file(f.location, {
2154
+ recalc_stored: true,
2155
+ method: import_method || "Auto",
2156
+ })
2157
+ .finally(() => {
2158
+ fs.unlink(f.location);
2159
+ });
2160
+ if (import_async) {
2161
+ promise
2162
+ .then((parse_res) => {
2163
+ Notification.create({
2164
+ title: "CSV import complete",
2165
+ body: parse_res.error || parse_res.success,
2166
+ user_id: req.user.id,
2167
+ });
2168
+ })
2169
+ .catch((e) => {
2170
+ console.error("CSV upload error", e);
2171
+ Notification.create({
2172
+ title: "Error importing CSV file",
2173
+ body: e.message,
2174
+ user_id: req.user.id,
2175
+ });
2176
+ });
2177
+ req.flash("success", req.__("Processing CSV file"));
2178
+ } else {
2179
+ const parse_res = await promise;
2180
+ if (parse_res.error) req.flash("error", parse_res.error);
2181
+ else req.flash("success", parse_res.success);
2182
+ }
2013
2183
  } catch (e) {
2184
+ console.error("CSV upload error", e);
2014
2185
  req.flash("error", e.message);
2015
2186
  }
2016
- await fs.unlink(f.location);
2017
2187
  res.redirect(`/table/${table.id}`);
2018
2188
  })
2019
2189
  );
@@ -2186,6 +2356,15 @@ router.post(
2186
2356
  res.redirect(`/table`);
2187
2357
  return;
2188
2358
  }
2359
+ Trigger.emitEvent(
2360
+ "AppChange",
2361
+ `Table ${table.name} configuration`,
2362
+ req.user,
2363
+ {
2364
+ entity_type: "Table",
2365
+ entity_name: table.name,
2366
+ }
2367
+ );
2189
2368
  const workflow = get_provider_workflow(table, req);
2190
2369
  const wfres = await workflow.run(req.body || {}, req);
2191
2370
  respondWorkflow(table, workflow, wfres, req, res);
@@ -472,6 +472,18 @@ describe("actions", () => {
472
472
  .set("Cookie", loginCookie)
473
473
  .expect(toRedirect("/actions/"));
474
474
  });
475
+ it("post Never trigger with table", async () => {
476
+ const app = await getApp({ disableCsrf: true });
477
+ const loginCookie = await getAdminLoginCookie();
478
+ await request(app)
479
+ .post("/actions/new")
480
+ .set("Cookie", loginCookie)
481
+ .send("action=run_js_code")
482
+ .send("table_id=2")
483
+ .send("name=NeverTableTrigger")
484
+ .send("when_trigger=Never")
485
+ .expect(302);
486
+ });
475
487
  });
476
488
  describe("localizer", () => {
477
489
  itShouldRedirectUnauthToLogin("/site-structure/localizer");
@@ -647,6 +659,9 @@ describe("clear all page", () => {
647
659
  .send("users=on")
648
660
  .send("config=on")
649
661
  .send("plugins=on")
662
+ .send("triggers=on")
663
+ .send("library=on")
664
+ .send("eventlog=on")
650
665
  .expect(toRedirect("/auth/create_first_user"));
651
666
  });
652
667
  it("restores backup after clear all", async () => {
package/wrapper.js CHANGED
@@ -97,6 +97,8 @@ const get_menu = (req) => {
97
97
  const canEditPages = state.getConfig("min_role_edit_pages", 1) >= role;
98
98
  const canEditTriggers = state.getConfig("min_role_edit_triggers", 1) >= role;
99
99
  const canEditMenu = state.getConfig("min_role_edit_menu", 1) >= role;
100
+ const canEditFiles = state.getConfig("min_role_edit_files", 1) >= role;
101
+ const canEditSearch = state.getConfig("min_role_edit_search", 1) >= role;
100
102
  const isAdmin = role === 1;
101
103
  const hasAdmin =
102
104
  isAdmin ||
@@ -105,7 +107,9 @@ const get_menu = (req) => {
105
107
  canEditPages ||
106
108
  canEditViews ||
107
109
  canEditMenu ||
108
- canEditTriggers;
110
+ canEditTriggers ||
111
+ canEditFiles ||
112
+ canEditSearch;
109
113
  /*
110
114
  * Admin Menu items
111
115
  *
@@ -137,10 +141,10 @@ const get_menu = (req) => {
137
141
  icon: "fas fa-calendar-check",
138
142
  label: req.__("Triggers"),
139
143
  });
140
- if (canEditMenu && !isAdmin) {
144
+ if ((canEditMenu || canEditSearch) && !isAdmin) {
141
145
  const subitems = [
142
146
  {
143
- link: "/menu",
147
+ link: canEditMenu ? "/menu" : "/search/config",
144
148
  altlinks: [
145
149
  "/site-structure",
146
150
  "/search/config",
@@ -148,7 +152,7 @@ const get_menu = (req) => {
148
152
  "/tenant/list",
149
153
  ],
150
154
  icon: "fas fa-compass",
151
- label: req.__("Menu"),
155
+ label: req.__("Site structure"),
152
156
  },
153
157
  ];
154
158
  if (canEditTriggers)
@@ -158,6 +162,12 @@ const get_menu = (req) => {
158
162
  icon: "fas fa-calendar-check",
159
163
  label: req.__("Triggers"),
160
164
  });
165
+ if (canEditFiles)
166
+ subitems.push({
167
+ link: "/files",
168
+ icon: "far fa-images",
169
+ label: req.__("Files"),
170
+ });
161
171
  adminItems.push({
162
172
  label: req.__("Settings"),
163
173
  icon: "fas fa-wrench",