@ruiapp/rapid-core 0.1.63 → 0.1.66

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 (166) hide show
  1. package/dist/helpers/entityHelpers.d.ts +3 -1
  2. package/dist/{dataAccess → helpers}/metaHelper.d.ts +3 -0
  3. package/dist/index.d.ts +2 -0
  4. package/dist/index.js +879 -154
  5. package/dist/plugins/setting/SettingPlugin.d.ts +21 -0
  6. package/dist/plugins/setting/SettingPluginTypes.d.ts +33 -0
  7. package/dist/plugins/setting/SettingService.d.ts +22 -0
  8. package/dist/plugins/setting/actionHandlers/getSystemSettingValues.d.ts +7 -0
  9. package/dist/plugins/setting/actionHandlers/getUserSettingValues.d.ts +7 -0
  10. package/dist/plugins/setting/actionHandlers/index.d.ts +4 -0
  11. package/dist/plugins/setting/models/SystemSettingGroupSetting.d.ts +3 -0
  12. package/dist/plugins/setting/models/SystemSettingItem.d.ts +3 -0
  13. package/dist/plugins/setting/models/SystemSettingItemSetting.d.ts +3 -0
  14. package/dist/plugins/setting/models/UserSettingGroupSetting.d.ts +3 -0
  15. package/dist/plugins/setting/models/UserSettingItem.d.ts +3 -0
  16. package/dist/plugins/setting/models/UserSettingItemSetting.d.ts +3 -0
  17. package/dist/plugins/setting/models/index.d.ts +2 -0
  18. package/dist/plugins/setting/routes/getSystemSettingValues.d.ts +12 -0
  19. package/dist/plugins/setting/routes/getUserSettingValues.d.ts +12 -0
  20. package/dist/plugins/setting/routes/index.d.ts +12 -0
  21. package/dist/types.d.ts +4 -0
  22. package/package.json +1 -1
  23. package/rollup.config.js +16 -16
  24. package/src/bootstrapApplicationConfig.ts +552 -545
  25. package/src/core/actionHandler.ts +22 -22
  26. package/src/core/eventManager.ts +20 -20
  27. package/src/core/facility.ts +7 -7
  28. package/src/core/http/formDataParser.ts +89 -89
  29. package/src/core/http-types.ts +4 -4
  30. package/src/core/pluginManager.ts +175 -175
  31. package/src/core/providers/runtimeProvider.ts +5 -5
  32. package/src/core/request.ts +86 -86
  33. package/src/core/response.ts +76 -76
  34. package/src/core/routeContext.ts +43 -43
  35. package/src/core/routesBuilder.ts +88 -88
  36. package/src/core/server.ts +16 -1
  37. package/src/dataAccess/dataAccessTypes.ts +109 -109
  38. package/src/dataAccess/dataAccessor.ts +137 -137
  39. package/src/dataAccess/entityManager.ts +1298 -1292
  40. package/src/dataAccess/entityMapper.ts +4 -5
  41. package/src/dataAccess/propertyMapper.ts +27 -27
  42. package/src/deno-std/assert/assert.ts +9 -9
  43. package/src/deno-std/assert/assertion_error.ts +7 -7
  44. package/src/deno-std/datetime/to_imf.ts +32 -32
  45. package/src/deno-std/encoding/base64.ts +141 -141
  46. package/src/deno-std/http/cookie.ts +8 -1
  47. package/src/facilities/log/LogFacility.ts +35 -35
  48. package/src/helpers/entityHelpers.ts +76 -21
  49. package/src/{dataAccess → helpers}/filterHelper.ts +3 -1
  50. package/src/helpers/inputHelper.ts +11 -11
  51. package/src/{dataAccess → helpers}/metaHelper.ts +15 -6
  52. package/src/helpers/runCollectionEntityActionHandler.ts +6 -1
  53. package/src/index.ts +44 -41
  54. package/src/plugins/auth/AuthPlugin.ts +7 -1
  55. package/src/plugins/auth/actionHandlers/changePassword.ts +54 -54
  56. package/src/plugins/auth/actionHandlers/createSession.ts +63 -63
  57. package/src/plugins/auth/actionHandlers/deleteSession.ts +18 -18
  58. package/src/plugins/auth/actionHandlers/getMyProfile.ts +35 -35
  59. package/src/plugins/auth/actionHandlers/index.ts +8 -8
  60. package/src/plugins/auth/actionHandlers/resetPassword.ts +38 -38
  61. package/src/plugins/auth/models/AccessToken.ts +56 -56
  62. package/src/plugins/auth/models/index.ts +3 -3
  63. package/src/plugins/auth/routes/changePassword.ts +15 -15
  64. package/src/plugins/auth/routes/getMyProfile.ts +15 -15
  65. package/src/plugins/auth/routes/index.ts +7 -7
  66. package/src/plugins/auth/routes/resetPassword.ts +15 -15
  67. package/src/plugins/auth/routes/signin.ts +15 -15
  68. package/src/plugins/auth/routes/signout.ts +15 -15
  69. package/src/plugins/cronJob/CronJobPlugin.ts +7 -1
  70. package/src/plugins/cronJob/CronJobPluginTypes.ts +49 -49
  71. package/src/plugins/cronJob/actionHandlers/index.ts +4 -4
  72. package/src/plugins/cronJob/actionHandlers/runCronJob.ts +29 -29
  73. package/src/plugins/cronJob/routes/index.ts +3 -3
  74. package/src/plugins/cronJob/routes/runCronJob.ts +15 -15
  75. package/src/plugins/dataManage/DataManagePlugin.ts +7 -1
  76. package/src/plugins/dataManage/actionHandlers/addEntityRelations.ts +20 -20
  77. package/src/plugins/dataManage/actionHandlers/countCollectionEntities.ts +15 -15
  78. package/src/plugins/dataManage/actionHandlers/createCollectionEntitiesBatch.ts +42 -42
  79. package/src/plugins/dataManage/actionHandlers/createCollectionEntity.ts +24 -24
  80. package/src/plugins/dataManage/actionHandlers/deleteCollectionEntityById.ts +7 -4
  81. package/src/plugins/dataManage/actionHandlers/findCollectionEntities.ts +26 -26
  82. package/src/plugins/dataManage/actionHandlers/findCollectionEntityById.ts +21 -21
  83. package/src/plugins/dataManage/actionHandlers/queryDatabase.ts +22 -22
  84. package/src/plugins/dataManage/actionHandlers/removeEntityRelations.ts +20 -20
  85. package/src/plugins/dataManage/actionHandlers/updateCollectionEntityById.ts +35 -35
  86. package/src/plugins/entityAccessControl/EntityAccessControlPlugin.ts +146 -146
  87. package/src/plugins/fileManage/FileManagePlugin.ts +7 -1
  88. package/src/plugins/fileManage/actionHandlers/downloadDocument.ts +36 -36
  89. package/src/plugins/fileManage/actionHandlers/downloadFile.ts +28 -28
  90. package/src/plugins/fileManage/actionHandlers/uploadFile.ts +33 -33
  91. package/src/plugins/fileManage/routes/downloadDocument.ts +15 -15
  92. package/src/plugins/fileManage/routes/downloadFile.ts +15 -15
  93. package/src/plugins/fileManage/routes/index.ts +5 -5
  94. package/src/plugins/fileManage/routes/uploadFile.ts +15 -15
  95. package/src/plugins/metaManage/MetaManagePlugin.ts +37 -9
  96. package/src/plugins/metaManage/actionHandlers/getMetaModelDetail.ts +10 -10
  97. package/src/plugins/metaManage/actionHandlers/listMetaModels.ts +9 -9
  98. package/src/plugins/metaManage/actionHandlers/listMetaRoutes.ts +9 -9
  99. package/src/plugins/routeManage/RouteManagePlugin.ts +7 -1
  100. package/src/plugins/routeManage/actionHandlers/httpProxy.ts +13 -13
  101. package/src/plugins/sequence/SequencePlugin.ts +8 -2
  102. package/src/plugins/sequence/SequencePluginTypes.ts +9 -1
  103. package/src/plugins/sequence/SequenceService.ts +81 -81
  104. package/src/plugins/sequence/actionHandlers/generateSn.ts +32 -32
  105. package/src/plugins/sequence/actionHandlers/index.ts +4 -4
  106. package/src/plugins/sequence/models/SequenceAutoIncrementRecord.ts +49 -49
  107. package/src/plugins/sequence/models/SequenceRule.ts +42 -42
  108. package/src/plugins/sequence/models/index.ts +4 -4
  109. package/src/plugins/sequence/routes/generateSn.ts +15 -15
  110. package/src/plugins/sequence/routes/index.ts +3 -3
  111. package/src/plugins/sequence/segment-utility.ts +11 -11
  112. package/src/plugins/sequence/segments/autoIncrement.ts +6 -1
  113. package/src/plugins/sequence/segments/dayOfMonth.ts +6 -1
  114. package/src/plugins/sequence/segments/index.ts +9 -9
  115. package/src/plugins/sequence/segments/literal.ts +6 -1
  116. package/src/plugins/sequence/segments/month.ts +6 -1
  117. package/src/plugins/sequence/segments/parameter.ts +6 -1
  118. package/src/plugins/sequence/segments/year.ts +6 -1
  119. package/src/plugins/serverOperation/ServerOperationPlugin.ts +91 -91
  120. package/src/plugins/serverOperation/ServerOperationPluginTypes.ts +15 -15
  121. package/src/plugins/serverOperation/actionHandlers/index.ts +4 -4
  122. package/src/plugins/serverOperation/actionHandlers/runServerOperation.ts +15 -15
  123. package/src/plugins/setting/SettingPlugin.ts +68 -0
  124. package/src/plugins/setting/SettingPluginTypes.ts +37 -0
  125. package/src/plugins/setting/SettingService.ts +206 -0
  126. package/src/plugins/setting/actionHandlers/getSystemSettingValues.ts +30 -0
  127. package/src/plugins/setting/actionHandlers/getUserSettingValues.ts +38 -0
  128. package/src/plugins/setting/actionHandlers/index.ts +5 -0
  129. package/src/plugins/setting/models/SystemSettingGroupSetting.ts +56 -0
  130. package/src/plugins/setting/models/SystemSettingItem.ts +42 -0
  131. package/src/plugins/setting/models/SystemSettingItemSetting.ts +72 -0
  132. package/src/plugins/setting/models/UserSettingGroupSetting.ts +56 -0
  133. package/src/plugins/setting/models/UserSettingItem.ts +49 -0
  134. package/src/plugins/setting/models/UserSettingItemSetting.ts +72 -0
  135. package/src/plugins/setting/models/index.ts +8 -0
  136. package/src/plugins/setting/routes/getSystemSettingValues.ts +15 -0
  137. package/src/plugins/setting/routes/getUserSettingValues.ts +15 -0
  138. package/src/plugins/setting/routes/index.ts +4 -0
  139. package/src/plugins/stateMachine/StateMachinePlugin.ts +8 -2
  140. package/src/plugins/stateMachine/StateMachinePluginTypes.ts +9 -1
  141. package/src/plugins/stateMachine/actionHandlers/index.ts +4 -4
  142. package/src/plugins/stateMachine/actionHandlers/sendStateMachineEvent.ts +51 -51
  143. package/src/plugins/stateMachine/models/StateMachine.ts +42 -42
  144. package/src/plugins/stateMachine/models/index.ts +3 -3
  145. package/src/plugins/stateMachine/routes/index.ts +3 -3
  146. package/src/plugins/stateMachine/routes/sendStateMachineEvent.ts +15 -15
  147. package/src/plugins/stateMachine/stateMachineHelper.ts +36 -36
  148. package/src/plugins/webhooks/WebhooksPlugin.ts +13 -2
  149. package/src/plugins/webhooks/pluginConfig.ts +74 -74
  150. package/src/polyfill.ts +5 -5
  151. package/src/proxy/mod.ts +38 -38
  152. package/src/proxy/types.ts +21 -21
  153. package/src/queryBuilder/index.ts +1 -1
  154. package/src/queryBuilder/queryBuilder.ts +473 -473
  155. package/src/server.ts +23 -3
  156. package/src/types.ts +593 -589
  157. package/src/utilities/accessControlUtility.ts +33 -33
  158. package/src/utilities/errorUtility.ts +4 -6
  159. package/src/utilities/fsUtility.ts +61 -61
  160. package/src/utilities/httpUtility.ts +19 -19
  161. package/src/utilities/jwtUtility.ts +26 -26
  162. package/src/utilities/typeUtility.ts +11 -11
  163. package/tsconfig.json +19 -19
  164. package/dist/utilities/rapidUtility.d.ts +0 -2
  165. package/src/utilities/rapidUtility.ts +0 -5
  166. /package/dist/{dataAccess → helpers}/filterHelper.d.ts +0 -0
package/dist/index.js CHANGED
@@ -1093,7 +1093,12 @@ function validateValue(name, value) {
1093
1093
  return;
1094
1094
  for (let i = 0; i < value.length; i++) {
1095
1095
  const c = value.charAt(i);
1096
- if (c < String.fromCharCode(0x21) || c == String.fromCharCode(0x22) || c == String.fromCharCode(0x2c) || c == String.fromCharCode(0x3b) || c == String.fromCharCode(0x5c) || c == String.fromCharCode(0x7f)) {
1096
+ if (c < String.fromCharCode(0x21) ||
1097
+ c == String.fromCharCode(0x22) ||
1098
+ c == String.fromCharCode(0x2c) ||
1099
+ c == String.fromCharCode(0x3b) ||
1100
+ c == String.fromCharCode(0x5c) ||
1101
+ c == String.fromCharCode(0x7f)) {
1097
1102
  throw new Error("RFC2616 cookie '" + name + "' cannot contain character '" + c + "'");
1098
1103
  }
1099
1104
  if (c > String.fromCharCode(0x80)) {
@@ -1340,6 +1345,13 @@ var bootstrapApplicationConfig = {
1340
1345
  type: "text",
1341
1346
  required: false,
1342
1347
  },
1348
+ {
1349
+ name: "displayPropertyCode",
1350
+ code: "displayPropertyCode",
1351
+ columnName: "display_property_code",
1352
+ type: "text",
1353
+ required: false,
1354
+ },
1343
1355
  {
1344
1356
  name: "properties",
1345
1357
  code: "properties",
@@ -1800,8 +1812,10 @@ var bootstrapApplicationConfig$1 = /*#__PURE__*/Object.freeze({
1800
1812
 
1801
1813
  function isRelationProperty(property) {
1802
1814
  return property.type === "relation" || property.type === "relation[]";
1803
- }
1804
-
1815
+ }
1816
+ function isOneRelationProperty(property) {
1817
+ return isRelationProperty(property) && property.relation === "one";
1818
+ }
1805
1819
  function getEntityPropertiesIncludingBase(server, model) {
1806
1820
  if (!model.base) {
1807
1821
  return model.properties;
@@ -1817,10 +1831,7 @@ function getEntityPropertiesIncludingBase(server, model) {
1817
1831
  return property;
1818
1832
  });
1819
1833
  }
1820
- return [
1821
- ...baseProperties,
1822
- ...model.properties,
1823
- ];
1834
+ return [...baseProperties, ...model.properties];
1824
1835
  }
1825
1836
  function getEntityPropertyByCode(server, model, propertyCode) {
1826
1837
  return getEntityProperty(server, model, (e) => e.code === propertyCode);
@@ -1897,8 +1908,8 @@ function mapEntityToDbRow(server, model, entity) {
1897
1908
  if (!entity) {
1898
1909
  return result;
1899
1910
  }
1900
- const row = result.row = {};
1901
- const baseRow = result.baseRow = {};
1911
+ const row = (result.row = {});
1912
+ const baseRow = (result.baseRow = {});
1902
1913
  if (!model.properties || !model.properties.length) {
1903
1914
  return result;
1904
1915
  }
@@ -1946,25 +1957,80 @@ function mapPropertyNameToColumnName(model, propertyName) {
1946
1957
  return property.columnName || property.code;
1947
1958
  }
1948
1959
 
1949
- function getEntityPartChanges(before, after) {
1960
+ function getEntityPartChanges(server, model, before, after) {
1950
1961
  if (!before) {
1951
1962
  throw new Error("Argument 'before' can not be null.");
1952
1963
  }
1953
1964
  if (!after) {
1954
1965
  throw new Error("Argument 'after' can not be null.");
1955
1966
  }
1956
- let changed = null;
1967
+ let changed = false;
1968
+ let changes = {};
1957
1969
  for (const key in after) {
1958
- if (after[key] != before[key]) {
1959
- if (changed) {
1960
- changed[key] = after[key];
1970
+ const property = getEntityPropertyByCode(server, model, key);
1971
+ if (isOneRelationProperty(property)) {
1972
+ const afterValue = after[key];
1973
+ const beforeValue = before[key] || before[property.targetIdColumnName];
1974
+ if (afterValue) {
1975
+ if (lodash.isNumber(afterValue)) {
1976
+ if (beforeValue) {
1977
+ if (lodash.isNumber(beforeValue)) {
1978
+ if (afterValue != beforeValue) {
1979
+ changed = true;
1980
+ changes[key] = afterValue;
1981
+ }
1982
+ }
1983
+ else {
1984
+ if (afterValue != beforeValue.id) {
1985
+ changed = true;
1986
+ changes[key] = afterValue;
1987
+ }
1988
+ }
1989
+ }
1990
+ else {
1991
+ changed = true;
1992
+ changes[key] = afterValue;
1993
+ }
1994
+ }
1995
+ else {
1996
+ if (beforeValue) {
1997
+ if (lodash.isNumber(beforeValue)) {
1998
+ if (afterValue.id != beforeValue) {
1999
+ changed = true;
2000
+ changes[key] = afterValue;
2001
+ }
2002
+ }
2003
+ else {
2004
+ if (afterValue.id != beforeValue.id) {
2005
+ changed = true;
2006
+ changes[key] = afterValue;
2007
+ }
2008
+ }
2009
+ }
2010
+ else {
2011
+ changed = true;
2012
+ changes[key] = afterValue;
2013
+ }
2014
+ }
1961
2015
  }
1962
2016
  else {
1963
- changed = { [key]: after[key] };
2017
+ if (beforeValue) {
2018
+ changed = true;
2019
+ changes[key] = null;
2020
+ }
1964
2021
  }
1965
2022
  }
2023
+ else {
2024
+ if (after[key] != before[key]) {
2025
+ changed = true;
2026
+ changes[key] = after[key];
2027
+ }
2028
+ }
2029
+ }
2030
+ if (changed) {
2031
+ return changes;
1966
2032
  }
1967
- return changed;
2033
+ return null;
1968
2034
  }
1969
2035
 
1970
2036
  function getNowStringWithTimezone() {
@@ -2572,7 +2638,7 @@ async function createEntity(server, dataAccessor, options, plugin) {
2572
2638
  targetRow[property.targetIdColumnName] = targetEntityId;
2573
2639
  }
2574
2640
  }
2575
- else {
2641
+ else if (lodash.isNumber(fieldValue)) {
2576
2642
  // fieldValue is id;
2577
2643
  const targetEntityId = fieldValue;
2578
2644
  const targetEntity = await findById(server, targetDataAccessor, {
@@ -2585,6 +2651,10 @@ async function createEntity(server, dataAccessor, options, plugin) {
2585
2651
  newEntityOneRelationProps[property.code] = targetEntity;
2586
2652
  targetRow[property.targetIdColumnName] = targetEntityId;
2587
2653
  }
2654
+ else {
2655
+ newEntityOneRelationProps[property.code] = null;
2656
+ targetRow[property.targetIdColumnName] = null;
2657
+ }
2588
2658
  }
2589
2659
  let newBaseRow;
2590
2660
  if (model.base) {
@@ -2693,14 +2763,15 @@ async function updateEntityById(server, dataAccessor, options, plugin) {
2693
2763
  throw new Error("Id is required when updating an entity.");
2694
2764
  }
2695
2765
  const entity = await findById(server, dataAccessor, {
2696
- id,
2697
2766
  routeContext,
2767
+ id,
2768
+ keepNonPropertyFields: true,
2698
2769
  });
2699
2770
  if (!entity) {
2700
2771
  throw new Error(`${model.namespace}.${model.singularCode} with id "${id}" was not found.`);
2701
2772
  }
2702
2773
  let { entityToSave } = options;
2703
- let changes = getEntityPartChanges(entity, entityToSave);
2774
+ let changes = getEntityPartChanges(server, model, entity, entityToSave);
2704
2775
  if (!changes && !options.operation) {
2705
2776
  return entity;
2706
2777
  }
@@ -2730,7 +2801,7 @@ async function updateEntityById(server, dataAccessor, options, plugin) {
2730
2801
  sender: plugin,
2731
2802
  routeContext: options.routeContext,
2732
2803
  });
2733
- changes = getEntityPartChanges(entity, entityToSave);
2804
+ changes = getEntityPartChanges(server, model, entity, entityToSave);
2734
2805
  const oneRelationPropertiesToUpdate = [];
2735
2806
  const manyRelationPropertiesToUpdate = [];
2736
2807
  lodash.keys(changes).forEach((propertyCode) => {
@@ -2778,7 +2849,7 @@ async function updateEntityById(server, dataAccessor, options, plugin) {
2778
2849
  targetRow[property.targetIdColumnName] = targetEntityId;
2779
2850
  }
2780
2851
  }
2781
- else {
2852
+ else if (lodash.isNumber(fieldValue)) {
2782
2853
  // fieldValue is id;
2783
2854
  const targetEntityId = fieldValue;
2784
2855
  const targetEntity = await findById(server, targetDataAccessor, {
@@ -2791,6 +2862,10 @@ async function updateEntityById(server, dataAccessor, options, plugin) {
2791
2862
  updatedEntityOneRelationProps[property.code] = targetEntity;
2792
2863
  targetRow[property.targetIdColumnName] = targetEntityId;
2793
2864
  }
2865
+ else {
2866
+ updatedEntityOneRelationProps[property.code] = null;
2867
+ targetRow[property.targetIdColumnName] = null;
2868
+ }
2794
2869
  }
2795
2870
  let updatedRow = row;
2796
2871
  if (Object.keys(row).length) {
@@ -3024,11 +3099,11 @@ class EntityManager {
3024
3099
  const command = `INSERT INTO ${queryBuilder.quoteTable({
3025
3100
  schema: relationProperty.linkSchema,
3026
3101
  tableName: relationProperty.linkTableName,
3027
- })} (${queryBuilder.quoteObject(relationProperty.selfIdColumnName)}, ${queryBuilder.quoteObject(relationProperty.targetIdColumnName)})
3028
- SELECT $1, $2 WHERE NOT EXISTS (
3029
- SELECT ${queryBuilder.quoteObject(relationProperty.selfIdColumnName)}, ${queryBuilder.quoteObject(relationProperty.targetIdColumnName)}
3030
- FROM ${queryBuilder.quoteTable({ schema: relationProperty.linkSchema, tableName: relationProperty.linkTableName })}
3031
- WHERE ${queryBuilder.quoteObject(relationProperty.selfIdColumnName)}=$1 AND ${queryBuilder.quoteObject(relationProperty.targetIdColumnName)}=$2
3102
+ })} (${queryBuilder.quoteObject(relationProperty.selfIdColumnName)}, ${queryBuilder.quoteObject(relationProperty.targetIdColumnName)})
3103
+ SELECT $1, $2 WHERE NOT EXISTS (
3104
+ SELECT ${queryBuilder.quoteObject(relationProperty.selfIdColumnName)}, ${queryBuilder.quoteObject(relationProperty.targetIdColumnName)}
3105
+ FROM ${queryBuilder.quoteTable({ schema: relationProperty.linkSchema, tableName: relationProperty.linkTableName })}
3106
+ WHERE ${queryBuilder.quoteObject(relationProperty.selfIdColumnName)}=$1 AND ${queryBuilder.quoteObject(relationProperty.targetIdColumnName)}=$2
3032
3107
  )`;
3033
3108
  const params = [id, relation.id];
3034
3109
  await server.queryDatabaseObject(command, params);
@@ -3068,7 +3143,7 @@ class EntityManager {
3068
3143
  const { queryBuilder } = server;
3069
3144
  if (relationProperty.linkTableName) {
3070
3145
  for (const relation of relations) {
3071
- const command = `DELETE FROM ${queryBuilder.quoteTable({ schema: relationProperty.linkSchema, tableName: relationProperty.linkTableName })}
3146
+ const command = `DELETE FROM ${queryBuilder.quoteTable({ schema: relationProperty.linkSchema, tableName: relationProperty.linkTableName })}
3072
3147
  WHERE ${queryBuilder.quoteObject(relationProperty.selfIdColumnName)}=$1 AND ${queryBuilder.quoteObject(relationProperty.targetIdColumnName)}=$2;`;
3073
3148
  const params = [id, relation.id];
3074
3149
  await server.queryDatabaseObject(command, params);
@@ -3594,32 +3669,32 @@ async function generateJwtSecretKey() {
3594
3669
  return encode(exportedKey);
3595
3670
  }
3596
3671
 
3597
- const code$p = "listMetaModels";
3598
- async function handler$p(plugin, ctx, options) {
3672
+ const code$r = "listMetaModels";
3673
+ async function handler$r(plugin, ctx, options) {
3599
3674
  const { applicationConfig } = ctx;
3600
3675
  ctx.output = { list: applicationConfig.models };
3601
3676
  }
3602
3677
 
3603
3678
  var listMetaModels = /*#__PURE__*/Object.freeze({
3604
3679
  __proto__: null,
3605
- code: code$p,
3606
- handler: handler$p
3680
+ code: code$r,
3681
+ handler: handler$r
3607
3682
  });
3608
3683
 
3609
- const code$o = "listMetaRoutes";
3610
- async function handler$o(plugin, ctx, options) {
3684
+ const code$q = "listMetaRoutes";
3685
+ async function handler$q(plugin, ctx, options) {
3611
3686
  const { applicationConfig } = ctx;
3612
3687
  ctx.output = { list: applicationConfig.routes };
3613
3688
  }
3614
3689
 
3615
3690
  var listMetaRoutes = /*#__PURE__*/Object.freeze({
3616
3691
  __proto__: null,
3617
- code: code$o,
3618
- handler: handler$o
3692
+ code: code$q,
3693
+ handler: handler$q
3619
3694
  });
3620
3695
 
3621
- const code$n = "getMetaModelDetail";
3622
- async function handler$n(plugin, ctx, options) {
3696
+ const code$p = "getMetaModelDetail";
3697
+ async function handler$p(plugin, ctx, options) {
3623
3698
  const { server, input } = ctx;
3624
3699
  const model = server.getModel(input);
3625
3700
  ctx.output = model;
@@ -3627,8 +3702,8 @@ async function handler$n(plugin, ctx, options) {
3627
3702
 
3628
3703
  var getMetaModelDetail = /*#__PURE__*/Object.freeze({
3629
3704
  __proto__: null,
3630
- code: code$n,
3631
- handler: handler$n
3705
+ code: code$p,
3706
+ handler: handler$p
3632
3707
  });
3633
3708
 
3634
3709
  /**
@@ -3779,7 +3854,10 @@ async function syncDatabaseSchema(server, applicationConfig) {
3779
3854
  }
3780
3855
  else if (property.relation === "many") {
3781
3856
  if (property.linkTableName) {
3782
- const tableInDb = lodash.find(tablesInDb, { table_schema: property.linkSchema || server.databaseConfig.dbDefaultSchema, table_name: property.linkTableName });
3857
+ const tableInDb = lodash.find(tablesInDb, {
3858
+ table_schema: property.linkSchema || server.databaseConfig.dbDefaultSchema,
3859
+ table_name: property.linkTableName,
3860
+ });
3783
3861
  if (!tableInDb) {
3784
3862
  columnDDL = generateLinkTableDDL(queryBuilder, {
3785
3863
  linkSchema: property.linkSchema,
@@ -4004,9 +4082,9 @@ function transformFilterWithSubFilters(filter) {
4004
4082
  return filter;
4005
4083
  }
4006
4084
 
4007
- const code$m = "findCollectionEntities";
4008
- async function handler$m(plugin, ctx, options) {
4009
- await runCollectionEntityActionHandler(ctx, options, code$m, async (entityManager, input) => {
4085
+ const code$o = "findCollectionEntities";
4086
+ async function handler$o(plugin, ctx, options) {
4087
+ await runCollectionEntityActionHandler(ctx, options, code$o, async (entityManager, input) => {
4010
4088
  input.filters = removeFiltersWithNullValue(input.filters);
4011
4089
  input.routeContext = ctx.routerContext;
4012
4090
  const entities = await entityManager.findEntities(input);
@@ -4022,14 +4100,14 @@ async function handler$m(plugin, ctx, options) {
4022
4100
 
4023
4101
  var findCollectionEntities = /*#__PURE__*/Object.freeze({
4024
4102
  __proto__: null,
4025
- code: code$m,
4026
- handler: handler$m
4103
+ code: code$o,
4104
+ handler: handler$o
4027
4105
  });
4028
4106
 
4029
- const code$l = "findCollectionEntityById";
4030
- async function handler$l(plugin, ctx, options) {
4107
+ const code$n = "findCollectionEntityById";
4108
+ async function handler$n(plugin, ctx, options) {
4031
4109
  const { logger, server, input } = ctx;
4032
- logger.debug(`Running ${code$l} handler...`, { input });
4110
+ logger.debug(`Running ${code$n} handler...`, { input });
4033
4111
  const { id } = input;
4034
4112
  const entityManager = server.getEntityManager(options.singularCode);
4035
4113
  const entity = await entityManager.findById({
@@ -4044,13 +4122,13 @@ async function handler$l(plugin, ctx, options) {
4044
4122
 
4045
4123
  var findCollectionEntityById = /*#__PURE__*/Object.freeze({
4046
4124
  __proto__: null,
4047
- code: code$l,
4048
- handler: handler$l
4125
+ code: code$n,
4126
+ handler: handler$n
4049
4127
  });
4050
4128
 
4051
- const code$k = "countCollectionEntities";
4052
- async function handler$k(plugin, ctx, options) {
4053
- await runCollectionEntityActionHandler(ctx, options, code$k, (entityManager, input) => {
4129
+ const code$m = "countCollectionEntities";
4130
+ async function handler$m(plugin, ctx, options) {
4131
+ await runCollectionEntityActionHandler(ctx, options, code$m, (entityManager, input) => {
4054
4132
  input.filters = removeFiltersWithNullValue(input.filters);
4055
4133
  input.routeContext = ctx.routerContext;
4056
4134
  return entityManager.count(input);
@@ -4059,16 +4137,16 @@ async function handler$k(plugin, ctx, options) {
4059
4137
 
4060
4138
  var countCollectionEntities = /*#__PURE__*/Object.freeze({
4061
4139
  __proto__: null,
4062
- code: code$k,
4063
- handler: handler$k
4140
+ code: code$m,
4141
+ handler: handler$m
4064
4142
  });
4065
4143
 
4066
- const code$j = "createCollectionEntity";
4067
- async function handler$j(plugin, ctx, options) {
4144
+ const code$l = "createCollectionEntity";
4145
+ async function handler$l(plugin, ctx, options) {
4068
4146
  const { logger, server, input } = ctx;
4069
4147
  const { defaultInput, fixedInput } = options;
4070
4148
  const mergedInput = mergeInput(defaultInput, input, fixedInput);
4071
- logger.debug(`Running ${code$j} handler...`, { defaultInput, fixedInput, mergedInput });
4149
+ logger.debug(`Running ${code$l} handler...`, { defaultInput, fixedInput, mergedInput });
4072
4150
  const entityManager = server.getEntityManager(options.singularCode);
4073
4151
  const output = await entityManager.createEntity({
4074
4152
  entity: input,
@@ -4079,15 +4157,15 @@ async function handler$j(plugin, ctx, options) {
4079
4157
 
4080
4158
  var createCollectionEntity = /*#__PURE__*/Object.freeze({
4081
4159
  __proto__: null,
4082
- code: code$j,
4083
- handler: handler$j
4160
+ code: code$l,
4161
+ handler: handler$l
4084
4162
  });
4085
4163
 
4086
- const code$i = "createCollectionEntitiesBatch";
4087
- async function handler$i(plugin, ctx, options) {
4164
+ const code$k = "createCollectionEntitiesBatch";
4165
+ async function handler$k(plugin, ctx, options) {
4088
4166
  const { logger, server, input } = ctx;
4089
4167
  const { defaultInput, fixedInput } = options;
4090
- logger.debug(`Running ${code$i} handler...`, { defaultInput, fixedInput, input });
4168
+ logger.debug(`Running ${code$k} handler...`, { defaultInput, fixedInput, input });
4091
4169
  const { entities } = input;
4092
4170
  if (!lodash.isArray(entities)) {
4093
4171
  throw new Error("input.entities should be an array.");
@@ -4111,16 +4189,16 @@ async function handler$i(plugin, ctx, options) {
4111
4189
 
4112
4190
  var createCollectionEntitiesBatch = /*#__PURE__*/Object.freeze({
4113
4191
  __proto__: null,
4114
- code: code$i,
4115
- handler: handler$i
4192
+ code: code$k,
4193
+ handler: handler$k
4116
4194
  });
4117
4195
 
4118
- const code$h = "updateCollectionEntityById";
4119
- async function handler$h(plugin, ctx, options) {
4196
+ const code$j = "updateCollectionEntityById";
4197
+ async function handler$j(plugin, ctx, options) {
4120
4198
  const { logger, server, input } = ctx;
4121
4199
  const { defaultInput, fixedInput } = options;
4122
4200
  const mergedInput = mergeInput(defaultInput, input, fixedInput);
4123
- logger.debug(`Running ${code$h} handler...`, { defaultInput, fixedInput, mergedInput });
4201
+ logger.debug(`Running ${code$j} handler...`, { defaultInput, fixedInput, mergedInput });
4124
4202
  const operation = mergedInput.$operation;
4125
4203
  if (operation) {
4126
4204
  delete mergedInput.$operation;
@@ -4143,14 +4221,14 @@ async function handler$h(plugin, ctx, options) {
4143
4221
 
4144
4222
  var updateCollectionEntityById = /*#__PURE__*/Object.freeze({
4145
4223
  __proto__: null,
4146
- code: code$h,
4147
- handler: handler$h
4224
+ code: code$j,
4225
+ handler: handler$j
4148
4226
  });
4149
4227
 
4150
- const code$g = "deleteCollectionEntityById";
4151
- async function handler$g(plugin, ctx, options) {
4228
+ const code$i = "deleteCollectionEntityById";
4229
+ async function handler$i(plugin, ctx, options) {
4152
4230
  const { logger, server, input } = ctx;
4153
- logger.debug(`Running ${code$g} handler...`);
4231
+ logger.debug(`Running ${code$i} handler...`);
4154
4232
  const entityManager = server.getEntityManager(options.singularCode);
4155
4233
  await entityManager.deleteById({
4156
4234
  id: input.id,
@@ -4162,16 +4240,16 @@ async function handler$g(plugin, ctx, options) {
4162
4240
 
4163
4241
  var deleteCollectionEntityById = /*#__PURE__*/Object.freeze({
4164
4242
  __proto__: null,
4165
- code: code$g,
4166
- handler: handler$g
4243
+ code: code$i,
4244
+ handler: handler$i
4167
4245
  });
4168
4246
 
4169
- const code$f = "addEntityRelations";
4170
- async function handler$f(plugin, ctx, options) {
4247
+ const code$h = "addEntityRelations";
4248
+ async function handler$h(plugin, ctx, options) {
4171
4249
  const { logger, server, input } = ctx;
4172
4250
  const { defaultInput, fixedInput } = options;
4173
4251
  const mergedInput = mergeInput(defaultInput, input, fixedInput);
4174
- logger.debug(`Running ${code$f} handler...`, { defaultInput, fixedInput, mergedInput });
4252
+ logger.debug(`Running ${code$h} handler...`, { defaultInput, fixedInput, mergedInput });
4175
4253
  const entityManager = server.getEntityManager(options.singularCode);
4176
4254
  mergedInput.routeContext = ctx.routerContext;
4177
4255
  await entityManager.addRelations(mergedInput, plugin);
@@ -4180,16 +4258,16 @@ async function handler$f(plugin, ctx, options) {
4180
4258
 
4181
4259
  var addEntityRelations = /*#__PURE__*/Object.freeze({
4182
4260
  __proto__: null,
4183
- code: code$f,
4184
- handler: handler$f
4261
+ code: code$h,
4262
+ handler: handler$h
4185
4263
  });
4186
4264
 
4187
- const code$e = "removeEntityRelations";
4188
- async function handler$e(plugin, ctx, options) {
4265
+ const code$g = "removeEntityRelations";
4266
+ async function handler$g(plugin, ctx, options) {
4189
4267
  const { logger, server, input } = ctx;
4190
4268
  const { defaultInput, fixedInput } = options;
4191
4269
  const mergedInput = mergeInput(defaultInput, input, fixedInput);
4192
- logger.debug(`Running ${code$e} handler...`, { defaultInput, fixedInput, mergedInput });
4270
+ logger.debug(`Running ${code$g} handler...`, { defaultInput, fixedInput, mergedInput });
4193
4271
  mergedInput.routeContext = ctx.routerContext;
4194
4272
  const entityManager = server.getEntityManager(options.singularCode);
4195
4273
  await entityManager.removeRelations(mergedInput, plugin);
@@ -4198,16 +4276,16 @@ async function handler$e(plugin, ctx, options) {
4198
4276
 
4199
4277
  var removeEntityRelations = /*#__PURE__*/Object.freeze({
4200
4278
  __proto__: null,
4201
- code: code$e,
4202
- handler: handler$e
4279
+ code: code$g,
4280
+ handler: handler$g
4203
4281
  });
4204
4282
 
4205
- const code$d = "queryDatabase";
4206
- async function handler$d(plugin, ctx, options) {
4283
+ const code$f = "queryDatabase";
4284
+ async function handler$f(plugin, ctx, options) {
4207
4285
  const { logger, server, input } = ctx;
4208
4286
  const { sql, querySingle, defaultInput, fixedInput } = options;
4209
4287
  const mergedInput = mergeInput(defaultInput, input, fixedInput);
4210
- logger.debug(`Running ${code$d} handler...`, { defaultInput, fixedInput, mergedInput });
4288
+ logger.debug(`Running ${code$f} handler...`, { defaultInput, fixedInput, mergedInput });
4211
4289
  const result = await server.queryDatabaseObject(sql, mergedInput);
4212
4290
  if (querySingle) {
4213
4291
  ctx.output = lodash.first(result);
@@ -4219,8 +4297,8 @@ async function handler$d(plugin, ctx, options) {
4219
4297
 
4220
4298
  var queryDatabase = /*#__PURE__*/Object.freeze({
4221
4299
  __proto__: null,
4222
- code: code$d,
4223
- handler: handler$d
4300
+ code: code$f,
4301
+ handler: handler$f
4224
4302
  });
4225
4303
 
4226
4304
  /**
@@ -4391,17 +4469,17 @@ async function sendSourceResponse(proxyCtx, targetRes) {
4391
4469
  srcRes.body = targetRes.body;
4392
4470
  }
4393
4471
 
4394
- const code$c = "httpProxy";
4395
- async function handler$c(plugin, ctx, options) {
4472
+ const code$e = "httpProxy";
4473
+ async function handler$e(plugin, ctx, options) {
4396
4474
  const { logger } = ctx;
4397
- logger.debug(`Running ${code$c} handler...`);
4475
+ logger.debug(`Running ${code$e} handler...`);
4398
4476
  await doProxy(ctx.routerContext, options);
4399
4477
  }
4400
4478
 
4401
4479
  var httpProxy = /*#__PURE__*/Object.freeze({
4402
4480
  __proto__: null,
4403
- code: code$c,
4404
- handler: handler$c
4481
+ code: code$e,
4482
+ handler: handler$e
4405
4483
  });
4406
4484
 
4407
4485
  /**
@@ -4448,8 +4526,8 @@ class RouteManager {
4448
4526
  }
4449
4527
  }
4450
4528
 
4451
- const code$b = "generateSn";
4452
- async function handler$b(plugin, ctx, options) {
4529
+ const code$d = "generateSn";
4530
+ async function handler$d(plugin, ctx, options) {
4453
4531
  const { server, routerContext } = ctx;
4454
4532
  const input = ctx.input;
4455
4533
  if (options?.ruleCode) {
@@ -4467,11 +4545,11 @@ async function handler$b(plugin, ctx, options) {
4467
4545
 
4468
4546
  var generateSn$1 = /*#__PURE__*/Object.freeze({
4469
4547
  __proto__: null,
4470
- code: code$b,
4471
- handler: handler$b
4548
+ code: code$d,
4549
+ handler: handler$d
4472
4550
  });
4473
4551
 
4474
- var pluginActionHandlers$4 = [generateSn$1];
4552
+ var pluginActionHandlers$5 = [generateSn$1];
4475
4553
 
4476
4554
  var SequenceRule = {
4477
4555
  maintainedBy: "sequencePlugin",
@@ -4562,7 +4640,7 @@ var SequenceAutoIncrementRecord = {
4562
4640
  ],
4563
4641
  };
4564
4642
 
4565
- var pluginModels$2 = [SequenceRule, SequenceAutoIncrementRecord];
4643
+ var pluginModels$3 = [SequenceRule, SequenceAutoIncrementRecord];
4566
4644
 
4567
4645
  var generateSn = {
4568
4646
  namespace: "svc",
@@ -4578,7 +4656,7 @@ var generateSn = {
4578
4656
  ],
4579
4657
  };
4580
4658
 
4581
- var pluginRoutes$4 = [generateSn];
4659
+ var pluginRoutes$5 = [generateSn];
4582
4660
 
4583
4661
  const segmentType$5 = "literal";
4584
4662
  async function resolveSegmentValue$5(server, ruleCode, config, input) {
@@ -4795,19 +4873,19 @@ class SequencePlugin {
4795
4873
  return [];
4796
4874
  }
4797
4875
  async registerActionHandlers(server) {
4798
- for (const actionHandler of pluginActionHandlers$4) {
4876
+ for (const actionHandler of pluginActionHandlers$5) {
4799
4877
  server.registerActionHandler(this, actionHandler);
4800
4878
  }
4801
4879
  }
4802
4880
  async configureModels(server, applicationConfig) {
4803
- server.appendApplicationConfig({ models: pluginModels$2 });
4881
+ server.appendApplicationConfig({ models: pluginModels$3 });
4804
4882
  }
4805
4883
  async configureServices(server, applicationConfig) {
4806
4884
  this.#sequenceService = new SequenceService(server);
4807
4885
  server.registerService("sequenceService", this.#sequenceService);
4808
4886
  }
4809
4887
  async configureRoutes(server, applicationConfig) {
4810
- server.appendApplicationConfig({ routes: pluginRoutes$4 });
4888
+ server.appendApplicationConfig({ routes: pluginRoutes$5 });
4811
4889
  }
4812
4890
  async onApplicationLoaded(server, applicationConfig) {
4813
4891
  const models = server.getApplicationConfig().models;
@@ -5046,8 +5124,8 @@ class WebhooksPlugin {
5046
5124
  }
5047
5125
  }
5048
5126
 
5049
- const code$a = "changePassword";
5050
- async function handler$a(plugin, ctx, options) {
5127
+ const code$c = "changePassword";
5128
+ async function handler$c(plugin, ctx, options) {
5051
5129
  const { server, input, routerContext } = ctx;
5052
5130
  const { id, oldPassword, newPassword } = input;
5053
5131
  const userId = routerContext.state.userId;
@@ -5089,12 +5167,12 @@ async function handler$a(plugin, ctx, options) {
5089
5167
 
5090
5168
  var changePassword$1 = /*#__PURE__*/Object.freeze({
5091
5169
  __proto__: null,
5092
- code: code$a,
5093
- handler: handler$a
5170
+ code: code$c,
5171
+ handler: handler$c
5094
5172
  });
5095
5173
 
5096
- const code$9 = "createSession";
5097
- async function handler$9(plugin, ctx, options) {
5174
+ const code$b = "createSession";
5175
+ async function handler$b(plugin, ctx, options) {
5098
5176
  const { server, input, routerContext } = ctx;
5099
5177
  const { response } = routerContext;
5100
5178
  const { account, password } = input;
@@ -5137,12 +5215,12 @@ async function handler$9(plugin, ctx, options) {
5137
5215
 
5138
5216
  var createSession = /*#__PURE__*/Object.freeze({
5139
5217
  __proto__: null,
5140
- code: code$9,
5141
- handler: handler$9
5218
+ code: code$b,
5219
+ handler: handler$b
5142
5220
  });
5143
5221
 
5144
- const code$8 = "deleteSession";
5145
- async function handler$8(plugin, ctx, options) {
5222
+ const code$a = "deleteSession";
5223
+ async function handler$a(plugin, ctx, options) {
5146
5224
  const { server, input, routerContext } = ctx;
5147
5225
  const { response } = routerContext;
5148
5226
  setCookie(response.headers, {
@@ -5155,12 +5233,12 @@ async function handler$8(plugin, ctx, options) {
5155
5233
 
5156
5234
  var deleteSession = /*#__PURE__*/Object.freeze({
5157
5235
  __proto__: null,
5158
- code: code$8,
5159
- handler: handler$8
5236
+ code: code$a,
5237
+ handler: handler$a
5160
5238
  });
5161
5239
 
5162
- const code$7 = "getMyProfile";
5163
- async function handler$7(plugin, ctx, options) {
5240
+ const code$9 = "getMyProfile";
5241
+ async function handler$9(plugin, ctx, options) {
5164
5242
  const { server, input, routerContext } = ctx;
5165
5243
  const userId = routerContext.state.userId;
5166
5244
  if (!userId) {
@@ -5190,12 +5268,12 @@ async function handler$7(plugin, ctx, options) {
5190
5268
 
5191
5269
  var getMyProfile$2 = /*#__PURE__*/Object.freeze({
5192
5270
  __proto__: null,
5193
- code: code$7,
5194
- handler: handler$7
5271
+ code: code$9,
5272
+ handler: handler$9
5195
5273
  });
5196
5274
 
5197
- const code$6 = "resetPassword";
5198
- async function handler$6(plugin, ctx, options) {
5275
+ const code$8 = "resetPassword";
5276
+ async function handler$8(plugin, ctx, options) {
5199
5277
  const { server, input, routerContext } = ctx;
5200
5278
  const { userId, password } = input;
5201
5279
  const userDataAccessor = server.getDataAccessor({
@@ -5223,11 +5301,11 @@ async function handler$6(plugin, ctx, options) {
5223
5301
 
5224
5302
  var resetPassword$1 = /*#__PURE__*/Object.freeze({
5225
5303
  __proto__: null,
5226
- code: code$6,
5227
- handler: handler$6
5304
+ code: code$8,
5305
+ handler: handler$8
5228
5306
  });
5229
5307
 
5230
- var pluginActionHandlers$3 = [changePassword$1, createSession, deleteSession, getMyProfile$2, resetPassword$1];
5308
+ var pluginActionHandlers$4 = [changePassword$1, createSession, deleteSession, getMyProfile$2, resetPassword$1];
5231
5309
 
5232
5310
  var AccessToken = {
5233
5311
  maintainedBy: "authManager",
@@ -5284,7 +5362,7 @@ var AccessToken = {
5284
5362
  ],
5285
5363
  };
5286
5364
 
5287
- var pluginModels$1 = [AccessToken];
5365
+ var pluginModels$2 = [AccessToken];
5288
5366
 
5289
5367
  var changePassword = {
5290
5368
  namespace: "auth",
@@ -5356,7 +5434,7 @@ var signout$1 = {
5356
5434
  ],
5357
5435
  };
5358
5436
 
5359
- var pluginRoutes$3 = [changePassword, getMyProfile$1, resetPassword, signin$1, signout$1];
5437
+ var pluginRoutes$4 = [changePassword, getMyProfile$1, resetPassword, signin$1, signout$1];
5360
5438
 
5361
5439
  /**
5362
5440
  * Auth manager plugin
@@ -5378,15 +5456,15 @@ class AuthPlugin {
5378
5456
  return [];
5379
5457
  }
5380
5458
  async registerActionHandlers(server) {
5381
- for (const actionHandler of pluginActionHandlers$3) {
5459
+ for (const actionHandler of pluginActionHandlers$4) {
5382
5460
  server.registerActionHandler(this, actionHandler);
5383
5461
  }
5384
5462
  }
5385
5463
  async configureModels(server, applicationConfig) {
5386
- server.appendApplicationConfig({ models: pluginModels$1 });
5464
+ server.appendApplicationConfig({ models: pluginModels$2 });
5387
5465
  }
5388
5466
  async configureRoutes(server, applicationConfig) {
5389
- server.appendApplicationConfig({ routes: pluginRoutes$3 });
5467
+ server.appendApplicationConfig({ routes: pluginRoutes$4 });
5390
5468
  }
5391
5469
  async onPrepareRouteContext(server, routeContext) {
5392
5470
  const request = routeContext.request;
@@ -5442,8 +5520,8 @@ async function appendFile(path, data) {
5442
5520
  });
5443
5521
  }
5444
5522
 
5445
- const code$5 = "downloadDocument";
5446
- async function handler$5(plugin, ctx, options) {
5523
+ const code$7 = "downloadDocument";
5524
+ async function handler$7(plugin, ctx, options) {
5447
5525
  const { server, applicationConfig, routerContext, input } = ctx;
5448
5526
  const { request, response } = routerContext;
5449
5527
  const documentDataAccessor = ctx.server.getDataAccessor({
@@ -5471,12 +5549,12 @@ async function handler$5(plugin, ctx, options) {
5471
5549
 
5472
5550
  var downloadDocumentActionHandler = /*#__PURE__*/Object.freeze({
5473
5551
  __proto__: null,
5474
- code: code$5,
5475
- handler: handler$5
5552
+ code: code$7,
5553
+ handler: handler$7
5476
5554
  });
5477
5555
 
5478
- const code$4 = "downloadFile";
5479
- async function handler$4(plugin, ctx, options) {
5556
+ const code$6 = "downloadFile";
5557
+ async function handler$6(plugin, ctx, options) {
5480
5558
  const { server, applicationConfig, routerContext, input } = ctx;
5481
5559
  const { request, response } = routerContext;
5482
5560
  const dataAccessor = ctx.server.getDataAccessor({
@@ -5496,12 +5574,12 @@ async function handler$4(plugin, ctx, options) {
5496
5574
 
5497
5575
  var downloadFileActionHandler = /*#__PURE__*/Object.freeze({
5498
5576
  __proto__: null,
5499
- code: code$4,
5500
- handler: handler$4
5577
+ code: code$6,
5578
+ handler: handler$6
5501
5579
  });
5502
5580
 
5503
- const code$3 = "uploadFile";
5504
- async function handler$3(plugin, ctx, options) {
5581
+ const code$5 = "uploadFile";
5582
+ async function handler$5(plugin, ctx, options) {
5505
5583
  const { server, applicationConfig, routerContext, input } = ctx;
5506
5584
  let file = input.file || input.files;
5507
5585
  if (lodash.isArray(file)) {
@@ -5522,8 +5600,8 @@ async function handler$3(plugin, ctx, options) {
5522
5600
 
5523
5601
  var uploadFileActionHandler = /*#__PURE__*/Object.freeze({
5524
5602
  __proto__: null,
5525
- code: code$3,
5526
- handler: handler$3
5603
+ code: code$5,
5604
+ handler: handler$5
5527
5605
  });
5528
5606
 
5529
5607
  var getMyProfile = {
@@ -5568,7 +5646,7 @@ var signout = {
5568
5646
  ],
5569
5647
  };
5570
5648
 
5571
- var pluginRoutes$2 = [getMyProfile, signin, signout];
5649
+ var pluginRoutes$3 = [getMyProfile, signin, signout];
5572
5650
 
5573
5651
  /**
5574
5652
  * File manager plugin
@@ -5595,23 +5673,23 @@ class FileManager {
5595
5673
  server.registerActionHandler(this, uploadFileActionHandler);
5596
5674
  }
5597
5675
  async configureRoutes(server, applicationConfig) {
5598
- server.appendApplicationConfig({ routes: pluginRoutes$2 });
5676
+ server.appendApplicationConfig({ routes: pluginRoutes$3 });
5599
5677
  }
5600
5678
  }
5601
5679
 
5602
- const code$2 = "runServerOperation";
5603
- async function handler$2(plugin, ctx, options) {
5680
+ const code$4 = "runServerOperation";
5681
+ async function handler$4(plugin, ctx, options) {
5604
5682
  const { operation } = options;
5605
5683
  await operation(ctx);
5606
5684
  }
5607
5685
 
5608
5686
  var runServerOperation = /*#__PURE__*/Object.freeze({
5609
5687
  __proto__: null,
5610
- code: code$2,
5611
- handler: handler$2
5688
+ code: code$4,
5689
+ handler: handler$4
5612
5690
  });
5613
5691
 
5614
- var pluginActionHandlers$2 = [runServerOperation];
5692
+ var pluginActionHandlers$3 = [runServerOperation];
5615
5693
 
5616
5694
  class ServerOperationPlugin {
5617
5695
  #operations;
@@ -5636,7 +5714,7 @@ class ServerOperationPlugin {
5636
5714
  async initPlugin(server) { }
5637
5715
  async registerMiddlewares(server) { }
5638
5716
  async registerActionHandlers(server) {
5639
- for (const actionHandler of pluginActionHandlers$2) {
5717
+ for (const actionHandler of pluginActionHandlers$3) {
5640
5718
  server.registerActionHandler(this, actionHandler);
5641
5719
  }
5642
5720
  }
@@ -5673,6 +5751,652 @@ class ServerOperationPlugin {
5673
5751
  async onApplicationReady(server, applicationConfig) { }
5674
5752
  }
5675
5753
 
5754
+ const code$3 = "getUserSettingValues";
5755
+ async function handler$3(plugin, ctx, options) {
5756
+ const { server, routerContext } = ctx;
5757
+ const userId = routerContext.state.userId;
5758
+ if (!userId) {
5759
+ ctx.status = 401;
5760
+ ctx.output = {
5761
+ error: {
5762
+ message: "You are not signed in.",
5763
+ },
5764
+ };
5765
+ return;
5766
+ }
5767
+ const input = ctx.input;
5768
+ if (options?.groupCode) {
5769
+ input.groupCode = options.groupCode;
5770
+ }
5771
+ if (!input.groupCode) {
5772
+ throw new Error(`Group code is required when getting system setting values.`);
5773
+ }
5774
+ const settingService = server.getService("settingService");
5775
+ const settingValues = await settingService.getUserSettingValues(userId, input.groupCode);
5776
+ ctx.output = settingValues;
5777
+ }
5778
+
5779
+ var getUserSettingValues$1 = /*#__PURE__*/Object.freeze({
5780
+ __proto__: null,
5781
+ code: code$3,
5782
+ handler: handler$3
5783
+ });
5784
+
5785
+ const code$2 = "getSystemSettingValues";
5786
+ async function handler$2(plugin, ctx, options) {
5787
+ const { server, routerContext } = ctx;
5788
+ const input = ctx.input;
5789
+ if (options?.groupCode) {
5790
+ input.groupCode = options.groupCode;
5791
+ }
5792
+ if (!input.groupCode) {
5793
+ throw new Error(`Group code is required when getting system setting values.`);
5794
+ }
5795
+ const settingService = server.getService("settingService");
5796
+ const settingValues = await settingService.getSystemSettingValues(input.groupCode);
5797
+ ctx.output = settingValues;
5798
+ }
5799
+
5800
+ var getSystemSettingValues$1 = /*#__PURE__*/Object.freeze({
5801
+ __proto__: null,
5802
+ code: code$2,
5803
+ handler: handler$2
5804
+ });
5805
+
5806
+ var pluginActionHandlers$2 = [getUserSettingValues$1, getSystemSettingValues$1];
5807
+
5808
+ var SystemSettingGroupSetting = {
5809
+ maintainedBy: "settingPlugin",
5810
+ namespace: "svc",
5811
+ name: "system_setting_group_setting",
5812
+ singularCode: "system_setting_group_setting",
5813
+ pluralCode: "system_setting_group_settings",
5814
+ schema: "public",
5815
+ tableName: "system_setting_group_settings",
5816
+ properties: [
5817
+ {
5818
+ name: "id",
5819
+ code: "id",
5820
+ columnName: "id",
5821
+ type: "integer",
5822
+ required: true,
5823
+ autoIncrement: true,
5824
+ },
5825
+ {
5826
+ name: "code",
5827
+ code: "code",
5828
+ columnName: "code",
5829
+ type: "text",
5830
+ required: true,
5831
+ },
5832
+ {
5833
+ name: "name",
5834
+ code: "name",
5835
+ columnName: "scnameope",
5836
+ type: "text",
5837
+ required: false,
5838
+ },
5839
+ {
5840
+ name: "description",
5841
+ code: "description",
5842
+ columnName: "description",
5843
+ type: "text",
5844
+ required: false,
5845
+ },
5846
+ {
5847
+ name: "permissionAssignments",
5848
+ code: "permissionAssignments",
5849
+ columnName: "permission_assignments",
5850
+ type: "json",
5851
+ required: false,
5852
+ },
5853
+ {
5854
+ name: "items",
5855
+ code: "items",
5856
+ type: "relation[]",
5857
+ targetSingularCode: "system_setting_item_setting",
5858
+ selfIdColumnName: "group_id",
5859
+ },
5860
+ ],
5861
+ };
5862
+
5863
+ var SystemSettingItem = {
5864
+ maintainedBy: "settingPlugin",
5865
+ namespace: "svc",
5866
+ name: "system_setting_item",
5867
+ singularCode: "system_setting_item",
5868
+ pluralCode: "system_setting_items",
5869
+ schema: "public",
5870
+ tableName: "system_setting_items",
5871
+ properties: [
5872
+ {
5873
+ name: "id",
5874
+ code: "id",
5875
+ columnName: "id",
5876
+ type: "integer",
5877
+ required: true,
5878
+ autoIncrement: true,
5879
+ },
5880
+ {
5881
+ name: "groupCode",
5882
+ code: "groupCode",
5883
+ columnName: "group_code",
5884
+ type: "text",
5885
+ required: true,
5886
+ },
5887
+ {
5888
+ name: "itemCode",
5889
+ code: "itemCode",
5890
+ columnName: "item_code",
5891
+ type: "text",
5892
+ required: true,
5893
+ },
5894
+ {
5895
+ name: "value",
5896
+ code: "value",
5897
+ columnName: "value",
5898
+ type: "json",
5899
+ required: false,
5900
+ },
5901
+ ],
5902
+ };
5903
+
5904
+ var SystemSettingItemSetting = {
5905
+ maintainedBy: "settingPlugin",
5906
+ namespace: "svc",
5907
+ name: "system_setting_item_setting",
5908
+ singularCode: "system_setting_item_setting",
5909
+ pluralCode: "system_setting_item_settings",
5910
+ schema: "public",
5911
+ tableName: "system_setting_item_settings",
5912
+ properties: [
5913
+ {
5914
+ name: "id",
5915
+ code: "id",
5916
+ columnName: "id",
5917
+ type: "integer",
5918
+ required: true,
5919
+ autoIncrement: true,
5920
+ },
5921
+ {
5922
+ name: "group",
5923
+ code: "group",
5924
+ type: "relation",
5925
+ targetSingularCode: "system_setting_group_setting",
5926
+ targetIdColumnName: "group_id",
5927
+ required: true,
5928
+ },
5929
+ {
5930
+ name: "orderNum",
5931
+ code: "orderNum",
5932
+ columnName: "order_num",
5933
+ type: "integer",
5934
+ required: true,
5935
+ defaultValue: "0",
5936
+ },
5937
+ {
5938
+ name: "type",
5939
+ code: "type",
5940
+ columnName: "type",
5941
+ type: "text",
5942
+ required: true,
5943
+ },
5944
+ {
5945
+ name: "code",
5946
+ code: "code",
5947
+ columnName: "code",
5948
+ type: "text",
5949
+ required: true,
5950
+ },
5951
+ {
5952
+ name: "name",
5953
+ code: "name",
5954
+ columnName: "scnameope",
5955
+ type: "text",
5956
+ required: false,
5957
+ },
5958
+ {
5959
+ name: "description",
5960
+ code: "description",
5961
+ columnName: "description",
5962
+ type: "text",
5963
+ required: false,
5964
+ },
5965
+ {
5966
+ name: "config",
5967
+ code: "config",
5968
+ columnName: "config",
5969
+ type: "json",
5970
+ required: false,
5971
+ },
5972
+ ],
5973
+ };
5974
+
5975
+ var UserSettingGroupSetting = {
5976
+ maintainedBy: "settingPlugin",
5977
+ namespace: "svc",
5978
+ name: "user_setting_group_setting",
5979
+ singularCode: "user_setting_group_setting",
5980
+ pluralCode: "user_setting_group_settings",
5981
+ schema: "public",
5982
+ tableName: "user_setting_group_settings",
5983
+ properties: [
5984
+ {
5985
+ name: "id",
5986
+ code: "id",
5987
+ columnName: "id",
5988
+ type: "integer",
5989
+ required: true,
5990
+ autoIncrement: true,
5991
+ },
5992
+ {
5993
+ name: "code",
5994
+ code: "code",
5995
+ columnName: "code",
5996
+ type: "text",
5997
+ required: true,
5998
+ },
5999
+ {
6000
+ name: "name",
6001
+ code: "name",
6002
+ columnName: "scnameope",
6003
+ type: "text",
6004
+ required: false,
6005
+ },
6006
+ {
6007
+ name: "description",
6008
+ code: "description",
6009
+ columnName: "description",
6010
+ type: "text",
6011
+ required: false,
6012
+ },
6013
+ {
6014
+ name: "permissionAssignments",
6015
+ code: "permissionAssignments",
6016
+ columnName: "permission_assignments",
6017
+ type: "json",
6018
+ required: false,
6019
+ },
6020
+ {
6021
+ name: "items",
6022
+ code: "items",
6023
+ type: "relation[]",
6024
+ targetSingularCode: "user_setting_item_setting",
6025
+ selfIdColumnName: "group_id",
6026
+ },
6027
+ ],
6028
+ };
6029
+
6030
+ var UserSettingItem = {
6031
+ maintainedBy: "settingPlugin",
6032
+ namespace: "svc",
6033
+ name: "user_setting_item",
6034
+ singularCode: "user_setting_item",
6035
+ pluralCode: "user_setting_items",
6036
+ schema: "public",
6037
+ tableName: "user_setting_items",
6038
+ properties: [
6039
+ {
6040
+ name: "id",
6041
+ code: "id",
6042
+ columnName: "id",
6043
+ type: "integer",
6044
+ required: true,
6045
+ autoIncrement: true,
6046
+ },
6047
+ {
6048
+ name: "ownerId",
6049
+ code: "ownerId",
6050
+ columnName: "owner_id",
6051
+ type: "integer",
6052
+ required: true,
6053
+ },
6054
+ {
6055
+ name: "groupCode",
6056
+ code: "groupCode",
6057
+ columnName: "group_code",
6058
+ type: "text",
6059
+ required: true,
6060
+ },
6061
+ {
6062
+ name: "itemCode",
6063
+ code: "itemCode",
6064
+ columnName: "item_code",
6065
+ type: "text",
6066
+ required: true,
6067
+ },
6068
+ {
6069
+ name: "value",
6070
+ code: "value",
6071
+ columnName: "value",
6072
+ type: "json",
6073
+ required: false,
6074
+ },
6075
+ ],
6076
+ };
6077
+
6078
+ var UserSettingItemSetting = {
6079
+ maintainedBy: "settingPlugin",
6080
+ namespace: "svc",
6081
+ name: "user_setting_item_setting",
6082
+ singularCode: "user_setting_item_setting",
6083
+ pluralCode: "user_setting_item_settings",
6084
+ schema: "public",
6085
+ tableName: "user_setting_item_settings",
6086
+ properties: [
6087
+ {
6088
+ name: "id",
6089
+ code: "id",
6090
+ columnName: "id",
6091
+ type: "integer",
6092
+ required: true,
6093
+ autoIncrement: true,
6094
+ },
6095
+ {
6096
+ name: "group",
6097
+ code: "group",
6098
+ type: "relation",
6099
+ targetSingularCode: "user_setting_group_setting",
6100
+ targetIdColumnName: "group_id",
6101
+ required: true,
6102
+ },
6103
+ {
6104
+ name: "orderNum",
6105
+ code: "orderNum",
6106
+ columnName: "order_num",
6107
+ type: "integer",
6108
+ required: true,
6109
+ defaultValue: "0",
6110
+ },
6111
+ {
6112
+ name: "type",
6113
+ code: "type",
6114
+ columnName: "type",
6115
+ type: "text",
6116
+ required: true,
6117
+ },
6118
+ {
6119
+ name: "code",
6120
+ code: "code",
6121
+ columnName: "code",
6122
+ type: "text",
6123
+ required: true,
6124
+ },
6125
+ {
6126
+ name: "name",
6127
+ code: "name",
6128
+ columnName: "scnameope",
6129
+ type: "text",
6130
+ required: false,
6131
+ },
6132
+ {
6133
+ name: "description",
6134
+ code: "description",
6135
+ columnName: "description",
6136
+ type: "text",
6137
+ required: false,
6138
+ },
6139
+ {
6140
+ name: "config",
6141
+ code: "config",
6142
+ columnName: "config",
6143
+ type: "json",
6144
+ required: false,
6145
+ },
6146
+ ],
6147
+ };
6148
+
6149
+ var pluginModels$1 = [SystemSettingGroupSetting, SystemSettingItem, SystemSettingItemSetting, UserSettingGroupSetting, UserSettingItem, UserSettingItemSetting];
6150
+
6151
+ var getUserSettingValues = {
6152
+ namespace: "svc",
6153
+ name: "svc.getUserSettingValues",
6154
+ code: "svc.getUserSettingValues",
6155
+ type: "RESTful",
6156
+ method: "GET",
6157
+ endpoint: "/svc/userSettingValues",
6158
+ actions: [
6159
+ {
6160
+ code: "getUserSettingValues",
6161
+ },
6162
+ ],
6163
+ };
6164
+
6165
+ var getSystemSettingValues = {
6166
+ namespace: "svc",
6167
+ name: "svc.getSystemSettingValues",
6168
+ code: "svc.getSystemSettingValues",
6169
+ type: "RESTful",
6170
+ method: "GET",
6171
+ endpoint: "/svc/systemSettingValues",
6172
+ actions: [
6173
+ {
6174
+ code: "getSystemSettingValues",
6175
+ },
6176
+ ],
6177
+ };
6178
+
6179
+ var pluginRoutes$2 = [getUserSettingValues, getSystemSettingValues];
6180
+
6181
+ class SettingService {
6182
+ #server;
6183
+ #systemSettingItemManager;
6184
+ #userSettingItemManager;
6185
+ constructor(server) {
6186
+ this.#server = server;
6187
+ this.#systemSettingItemManager = server.getEntityManager("system_setting_item");
6188
+ this.#userSettingItemManager = server.getEntityManager("user_setting_item");
6189
+ }
6190
+ //#region System Setting
6191
+ async getSystemSettingItems(groupCode) {
6192
+ return await this.#systemSettingItemManager.findEntities({
6193
+ filters: [
6194
+ {
6195
+ operator: "eq",
6196
+ field: "groupCode",
6197
+ value: groupCode,
6198
+ },
6199
+ ],
6200
+ });
6201
+ }
6202
+ async getSystemSettingValues(groupCode) {
6203
+ const settingItems = await this.getSystemSettingItems(groupCode);
6204
+ return settingItems.reduce((settingValues, settingItem) => {
6205
+ settingValues[settingItem.itemCode] = settingItem.value;
6206
+ return settingValues;
6207
+ }, {});
6208
+ }
6209
+ async getSystemSettingValue(groupCode, itemCode) {
6210
+ const settingItem = await this.#systemSettingItemManager.findEntity({
6211
+ filters: [
6212
+ {
6213
+ operator: "eq",
6214
+ field: "groupCode",
6215
+ value: groupCode,
6216
+ },
6217
+ {
6218
+ operator: "eq",
6219
+ field: "itemCode",
6220
+ value: itemCode,
6221
+ },
6222
+ ],
6223
+ });
6224
+ return settingItem ? settingItem.value : null;
6225
+ }
6226
+ async setSystemSettingValue(groupCode, itemCode, value) {
6227
+ const settingItem = await this.#systemSettingItemManager.findEntity({
6228
+ filters: [
6229
+ {
6230
+ operator: "eq",
6231
+ field: "groupCode",
6232
+ value: groupCode,
6233
+ },
6234
+ {
6235
+ operator: "eq",
6236
+ field: "itemCode",
6237
+ value: itemCode,
6238
+ },
6239
+ ],
6240
+ });
6241
+ if (settingItem) {
6242
+ await this.#systemSettingItemManager.updateEntityById({
6243
+ id: settingItem.id,
6244
+ entityToSave: {
6245
+ value,
6246
+ },
6247
+ });
6248
+ }
6249
+ else {
6250
+ await this.#systemSettingItemManager.createEntity({
6251
+ entity: {
6252
+ groupCode,
6253
+ itemCode,
6254
+ value,
6255
+ },
6256
+ });
6257
+ }
6258
+ }
6259
+ async setSystemSettingValues(groupCode, settingValues) {
6260
+ for (const itemCode in settingValues) {
6261
+ const value = settingValues[itemCode];
6262
+ await this.setSystemSettingValue(groupCode, itemCode, value);
6263
+ }
6264
+ }
6265
+ //#endregion
6266
+ //#region User Setting
6267
+ async getUserSettingItems(ownerId, groupCode) {
6268
+ return await this.#userSettingItemManager.findEntities({
6269
+ filters: [
6270
+ {
6271
+ operator: "eq",
6272
+ field: "ownerId",
6273
+ value: ownerId,
6274
+ },
6275
+ {
6276
+ operator: "eq",
6277
+ field: "groupCode",
6278
+ value: groupCode,
6279
+ },
6280
+ ],
6281
+ });
6282
+ }
6283
+ async getUserSettingValues(ownerId, groupCode) {
6284
+ const settingItems = await this.getUserSettingItems(ownerId, groupCode);
6285
+ return settingItems.reduce((settingValues, settingItem) => {
6286
+ settingValues[settingItem.itemCode] = settingItem.value;
6287
+ return settingValues;
6288
+ }, {});
6289
+ }
6290
+ async getUserSettingValue(ownerId, groupCode, itemCode) {
6291
+ const settingItem = await this.#systemSettingItemManager.findEntity({
6292
+ filters: [
6293
+ {
6294
+ operator: "eq",
6295
+ field: "ownerId",
6296
+ value: ownerId,
6297
+ },
6298
+ {
6299
+ operator: "eq",
6300
+ field: "groupCode",
6301
+ value: groupCode,
6302
+ },
6303
+ {
6304
+ operator: "eq",
6305
+ field: "itemCode",
6306
+ value: itemCode,
6307
+ },
6308
+ ],
6309
+ });
6310
+ return settingItem ? settingItem.value : null;
6311
+ }
6312
+ async setUserSettingValue(ownerId, groupCode, itemCode, value) {
6313
+ const settingItem = await this.#userSettingItemManager.findEntity({
6314
+ filters: [
6315
+ {
6316
+ operator: "eq",
6317
+ field: "ownerId",
6318
+ value: ownerId,
6319
+ },
6320
+ {
6321
+ operator: "eq",
6322
+ field: "groupCode",
6323
+ value: groupCode,
6324
+ },
6325
+ {
6326
+ operator: "eq",
6327
+ field: "itemCode",
6328
+ value: itemCode,
6329
+ },
6330
+ ],
6331
+ });
6332
+ if (settingItem) {
6333
+ await this.#userSettingItemManager.updateEntityById({
6334
+ id: settingItem.id,
6335
+ entityToSave: {
6336
+ value,
6337
+ },
6338
+ });
6339
+ }
6340
+ else {
6341
+ await this.#systemSettingItemManager.createEntity({
6342
+ entity: {
6343
+ ownerId: ownerId,
6344
+ groupCode,
6345
+ itemCode,
6346
+ value,
6347
+ },
6348
+ });
6349
+ }
6350
+ }
6351
+ async setUserSettingValues(ownerId, groupCode, settingValues) {
6352
+ for (const itemCode in settingValues) {
6353
+ const value = settingValues[itemCode];
6354
+ await this.setUserSettingValue(ownerId, groupCode, itemCode, value);
6355
+ }
6356
+ }
6357
+ }
6358
+
6359
+ /**
6360
+ * Setting plugin
6361
+ */
6362
+ class SettingPlugin {
6363
+ #settingService;
6364
+ get settingService() {
6365
+ return this.#settingService;
6366
+ }
6367
+ get code() {
6368
+ return "settingPlugin";
6369
+ }
6370
+ get description() {
6371
+ return null;
6372
+ }
6373
+ get extendingAbilities() {
6374
+ return [];
6375
+ }
6376
+ get configurableTargets() {
6377
+ return [];
6378
+ }
6379
+ get configurations() {
6380
+ return [];
6381
+ }
6382
+ async registerActionHandlers(server) {
6383
+ for (const actionHandler of pluginActionHandlers$2) {
6384
+ server.registerActionHandler(this, actionHandler);
6385
+ }
6386
+ }
6387
+ async configureModels(server, applicationConfig) {
6388
+ server.appendApplicationConfig({ models: pluginModels$1 });
6389
+ }
6390
+ async configureServices(server, applicationConfig) {
6391
+ this.#settingService = new SettingService(server);
6392
+ server.registerService("settingService", this.#settingService);
6393
+ }
6394
+ async configureRoutes(server, applicationConfig) {
6395
+ server.appendApplicationConfig({ routes: pluginRoutes$2 });
6396
+ }
6397
+ async onApplicationLoaded(server, applicationConfig) { }
6398
+ }
6399
+
5676
6400
  const code$1 = "runCronJob";
5677
6401
  async function handler$1(plugin, ctx, options) {
5678
6402
  const { server, routerContext } = ctx;
@@ -6179,9 +6903,9 @@ class EntityAccessControlPlugin {
6179
6903
  if (!userId) {
6180
6904
  return;
6181
6905
  }
6182
- const actions = await server.queryDatabaseObject(`select distinct a.* from sys_actions a
6183
- inner join oc_role_sys_action_links ra on a.id = ra.action_id
6184
- inner join oc_role_user_links ru on ru.role_id = ra.role_id
6906
+ const actions = await server.queryDatabaseObject(`select distinct a.* from sys_actions a
6907
+ inner join oc_role_sys_action_links ra on a.id = ra.action_id
6908
+ inner join oc_role_user_links ru on ru.role_id = ra.role_id
6185
6909
  where ru.user_id = $1;`, [userId]);
6186
6910
  routeContext.state.allowedActions = actions.map((item) => item.code);
6187
6911
  }
@@ -6215,6 +6939,7 @@ exports.RouteContext = RouteContext;
6215
6939
  exports.RouteManagePlugin = RouteManager;
6216
6940
  exports.SequencePlugin = SequencePlugin;
6217
6941
  exports.ServerOperationPlugin = ServerOperationPlugin;
6942
+ exports.SettingPlugin = SettingPlugin;
6218
6943
  exports.StateMachinePlugin = StateMachinePlugin;
6219
6944
  exports.WebhooksPlugin = WebhooksPlugin;
6220
6945
  exports.bootstrapApplicationConfig = bootstrapApplicationConfig$1;