@ruiapp/rapid-core 0.1.65 → 0.1.67
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +2 -0
- package/dist/index.js +770 -123
- package/dist/plugins/setting/SettingPluginTypes.d.ts +3 -1
- package/dist/plugins/setting/SettingService.d.ts +14 -2
- package/dist/plugins/setting/actionHandlers/getUserSettingValues.d.ts +7 -0
- package/dist/plugins/setting/actionHandlers/index.d.ts +2 -1
- package/dist/plugins/setting/routes/getSystemSettingValues.d.ts +1 -1
- package/dist/plugins/setting/routes/getUserSettingValues.d.ts +12 -0
- package/package.json +1 -1
- package/src/index.ts +3 -0
- package/src/plugins/setting/SettingPlugin.ts +1 -4
- package/src/plugins/setting/SettingPluginTypes.ts +3 -1
- package/src/plugins/setting/SettingService.ts +192 -3
- package/src/plugins/setting/actionHandlers/getSystemSettingValues.ts +1 -1
- package/src/plugins/setting/actionHandlers/getUserSettingValues.ts +38 -0
- package/src/plugins/setting/actionHandlers/index.ts +2 -1
- package/src/plugins/setting/models/SystemSettingGroupSetting.ts +1 -1
- package/src/plugins/setting/models/SystemSettingItemSetting.ts +1 -1
- package/src/plugins/setting/models/UserSettingGroupSetting.ts +1 -1
- package/src/plugins/setting/models/UserSettingItem.ts +3 -3
- package/src/plugins/setting/models/UserSettingItemSetting.ts +1 -1
- package/src/plugins/setting/routes/getSystemSettingValues.ts +2 -2
- package/src/plugins/setting/routes/getUserSettingValues.ts +15 -0
- package/src/plugins/setting/routes/index.ts +2 -1
package/dist/index.js
CHANGED
|
@@ -3669,32 +3669,32 @@ async function generateJwtSecretKey() {
|
|
|
3669
3669
|
return encode(exportedKey);
|
|
3670
3670
|
}
|
|
3671
3671
|
|
|
3672
|
-
const code$
|
|
3673
|
-
async function handler$
|
|
3672
|
+
const code$r = "listMetaModels";
|
|
3673
|
+
async function handler$r(plugin, ctx, options) {
|
|
3674
3674
|
const { applicationConfig } = ctx;
|
|
3675
3675
|
ctx.output = { list: applicationConfig.models };
|
|
3676
3676
|
}
|
|
3677
3677
|
|
|
3678
3678
|
var listMetaModels = /*#__PURE__*/Object.freeze({
|
|
3679
3679
|
__proto__: null,
|
|
3680
|
-
code: code$
|
|
3681
|
-
handler: handler$
|
|
3680
|
+
code: code$r,
|
|
3681
|
+
handler: handler$r
|
|
3682
3682
|
});
|
|
3683
3683
|
|
|
3684
|
-
const code$
|
|
3685
|
-
async function handler$
|
|
3684
|
+
const code$q = "listMetaRoutes";
|
|
3685
|
+
async function handler$q(plugin, ctx, options) {
|
|
3686
3686
|
const { applicationConfig } = ctx;
|
|
3687
3687
|
ctx.output = { list: applicationConfig.routes };
|
|
3688
3688
|
}
|
|
3689
3689
|
|
|
3690
3690
|
var listMetaRoutes = /*#__PURE__*/Object.freeze({
|
|
3691
3691
|
__proto__: null,
|
|
3692
|
-
code: code$
|
|
3693
|
-
handler: handler$
|
|
3692
|
+
code: code$q,
|
|
3693
|
+
handler: handler$q
|
|
3694
3694
|
});
|
|
3695
3695
|
|
|
3696
|
-
const code$
|
|
3697
|
-
async function handler$
|
|
3696
|
+
const code$p = "getMetaModelDetail";
|
|
3697
|
+
async function handler$p(plugin, ctx, options) {
|
|
3698
3698
|
const { server, input } = ctx;
|
|
3699
3699
|
const model = server.getModel(input);
|
|
3700
3700
|
ctx.output = model;
|
|
@@ -3702,8 +3702,8 @@ async function handler$n(plugin, ctx, options) {
|
|
|
3702
3702
|
|
|
3703
3703
|
var getMetaModelDetail = /*#__PURE__*/Object.freeze({
|
|
3704
3704
|
__proto__: null,
|
|
3705
|
-
code: code$
|
|
3706
|
-
handler: handler$
|
|
3705
|
+
code: code$p,
|
|
3706
|
+
handler: handler$p
|
|
3707
3707
|
});
|
|
3708
3708
|
|
|
3709
3709
|
/**
|
|
@@ -4082,9 +4082,9 @@ function transformFilterWithSubFilters(filter) {
|
|
|
4082
4082
|
return filter;
|
|
4083
4083
|
}
|
|
4084
4084
|
|
|
4085
|
-
const code$
|
|
4086
|
-
async function handler$
|
|
4087
|
-
await runCollectionEntityActionHandler(ctx, options, code$
|
|
4085
|
+
const code$o = "findCollectionEntities";
|
|
4086
|
+
async function handler$o(plugin, ctx, options) {
|
|
4087
|
+
await runCollectionEntityActionHandler(ctx, options, code$o, async (entityManager, input) => {
|
|
4088
4088
|
input.filters = removeFiltersWithNullValue(input.filters);
|
|
4089
4089
|
input.routeContext = ctx.routerContext;
|
|
4090
4090
|
const entities = await entityManager.findEntities(input);
|
|
@@ -4100,14 +4100,14 @@ async function handler$m(plugin, ctx, options) {
|
|
|
4100
4100
|
|
|
4101
4101
|
var findCollectionEntities = /*#__PURE__*/Object.freeze({
|
|
4102
4102
|
__proto__: null,
|
|
4103
|
-
code: code$
|
|
4104
|
-
handler: handler$
|
|
4103
|
+
code: code$o,
|
|
4104
|
+
handler: handler$o
|
|
4105
4105
|
});
|
|
4106
4106
|
|
|
4107
|
-
const code$
|
|
4108
|
-
async function handler$
|
|
4107
|
+
const code$n = "findCollectionEntityById";
|
|
4108
|
+
async function handler$n(plugin, ctx, options) {
|
|
4109
4109
|
const { logger, server, input } = ctx;
|
|
4110
|
-
logger.debug(`Running ${code$
|
|
4110
|
+
logger.debug(`Running ${code$n} handler...`, { input });
|
|
4111
4111
|
const { id } = input;
|
|
4112
4112
|
const entityManager = server.getEntityManager(options.singularCode);
|
|
4113
4113
|
const entity = await entityManager.findById({
|
|
@@ -4122,13 +4122,13 @@ async function handler$l(plugin, ctx, options) {
|
|
|
4122
4122
|
|
|
4123
4123
|
var findCollectionEntityById = /*#__PURE__*/Object.freeze({
|
|
4124
4124
|
__proto__: null,
|
|
4125
|
-
code: code$
|
|
4126
|
-
handler: handler$
|
|
4125
|
+
code: code$n,
|
|
4126
|
+
handler: handler$n
|
|
4127
4127
|
});
|
|
4128
4128
|
|
|
4129
|
-
const code$
|
|
4130
|
-
async function handler$
|
|
4131
|
-
await runCollectionEntityActionHandler(ctx, options, code$
|
|
4129
|
+
const code$m = "countCollectionEntities";
|
|
4130
|
+
async function handler$m(plugin, ctx, options) {
|
|
4131
|
+
await runCollectionEntityActionHandler(ctx, options, code$m, (entityManager, input) => {
|
|
4132
4132
|
input.filters = removeFiltersWithNullValue(input.filters);
|
|
4133
4133
|
input.routeContext = ctx.routerContext;
|
|
4134
4134
|
return entityManager.count(input);
|
|
@@ -4137,16 +4137,16 @@ async function handler$k(plugin, ctx, options) {
|
|
|
4137
4137
|
|
|
4138
4138
|
var countCollectionEntities = /*#__PURE__*/Object.freeze({
|
|
4139
4139
|
__proto__: null,
|
|
4140
|
-
code: code$
|
|
4141
|
-
handler: handler$
|
|
4140
|
+
code: code$m,
|
|
4141
|
+
handler: handler$m
|
|
4142
4142
|
});
|
|
4143
4143
|
|
|
4144
|
-
const code$
|
|
4145
|
-
async function handler$
|
|
4144
|
+
const code$l = "createCollectionEntity";
|
|
4145
|
+
async function handler$l(plugin, ctx, options) {
|
|
4146
4146
|
const { logger, server, input } = ctx;
|
|
4147
4147
|
const { defaultInput, fixedInput } = options;
|
|
4148
4148
|
const mergedInput = mergeInput(defaultInput, input, fixedInput);
|
|
4149
|
-
logger.debug(`Running ${code$
|
|
4149
|
+
logger.debug(`Running ${code$l} handler...`, { defaultInput, fixedInput, mergedInput });
|
|
4150
4150
|
const entityManager = server.getEntityManager(options.singularCode);
|
|
4151
4151
|
const output = await entityManager.createEntity({
|
|
4152
4152
|
entity: input,
|
|
@@ -4157,15 +4157,15 @@ async function handler$j(plugin, ctx, options) {
|
|
|
4157
4157
|
|
|
4158
4158
|
var createCollectionEntity = /*#__PURE__*/Object.freeze({
|
|
4159
4159
|
__proto__: null,
|
|
4160
|
-
code: code$
|
|
4161
|
-
handler: handler$
|
|
4160
|
+
code: code$l,
|
|
4161
|
+
handler: handler$l
|
|
4162
4162
|
});
|
|
4163
4163
|
|
|
4164
|
-
const code$
|
|
4165
|
-
async function handler$
|
|
4164
|
+
const code$k = "createCollectionEntitiesBatch";
|
|
4165
|
+
async function handler$k(plugin, ctx, options) {
|
|
4166
4166
|
const { logger, server, input } = ctx;
|
|
4167
4167
|
const { defaultInput, fixedInput } = options;
|
|
4168
|
-
logger.debug(`Running ${code$
|
|
4168
|
+
logger.debug(`Running ${code$k} handler...`, { defaultInput, fixedInput, input });
|
|
4169
4169
|
const { entities } = input;
|
|
4170
4170
|
if (!lodash.isArray(entities)) {
|
|
4171
4171
|
throw new Error("input.entities should be an array.");
|
|
@@ -4189,16 +4189,16 @@ async function handler$i(plugin, ctx, options) {
|
|
|
4189
4189
|
|
|
4190
4190
|
var createCollectionEntitiesBatch = /*#__PURE__*/Object.freeze({
|
|
4191
4191
|
__proto__: null,
|
|
4192
|
-
code: code$
|
|
4193
|
-
handler: handler$
|
|
4192
|
+
code: code$k,
|
|
4193
|
+
handler: handler$k
|
|
4194
4194
|
});
|
|
4195
4195
|
|
|
4196
|
-
const code$
|
|
4197
|
-
async function handler$
|
|
4196
|
+
const code$j = "updateCollectionEntityById";
|
|
4197
|
+
async function handler$j(plugin, ctx, options) {
|
|
4198
4198
|
const { logger, server, input } = ctx;
|
|
4199
4199
|
const { defaultInput, fixedInput } = options;
|
|
4200
4200
|
const mergedInput = mergeInput(defaultInput, input, fixedInput);
|
|
4201
|
-
logger.debug(`Running ${code$
|
|
4201
|
+
logger.debug(`Running ${code$j} handler...`, { defaultInput, fixedInput, mergedInput });
|
|
4202
4202
|
const operation = mergedInput.$operation;
|
|
4203
4203
|
if (operation) {
|
|
4204
4204
|
delete mergedInput.$operation;
|
|
@@ -4221,14 +4221,14 @@ async function handler$h(plugin, ctx, options) {
|
|
|
4221
4221
|
|
|
4222
4222
|
var updateCollectionEntityById = /*#__PURE__*/Object.freeze({
|
|
4223
4223
|
__proto__: null,
|
|
4224
|
-
code: code$
|
|
4225
|
-
handler: handler$
|
|
4224
|
+
code: code$j,
|
|
4225
|
+
handler: handler$j
|
|
4226
4226
|
});
|
|
4227
4227
|
|
|
4228
|
-
const code$
|
|
4229
|
-
async function handler$
|
|
4228
|
+
const code$i = "deleteCollectionEntityById";
|
|
4229
|
+
async function handler$i(plugin, ctx, options) {
|
|
4230
4230
|
const { logger, server, input } = ctx;
|
|
4231
|
-
logger.debug(`Running ${code$
|
|
4231
|
+
logger.debug(`Running ${code$i} handler...`);
|
|
4232
4232
|
const entityManager = server.getEntityManager(options.singularCode);
|
|
4233
4233
|
await entityManager.deleteById({
|
|
4234
4234
|
id: input.id,
|
|
@@ -4240,16 +4240,16 @@ async function handler$g(plugin, ctx, options) {
|
|
|
4240
4240
|
|
|
4241
4241
|
var deleteCollectionEntityById = /*#__PURE__*/Object.freeze({
|
|
4242
4242
|
__proto__: null,
|
|
4243
|
-
code: code$
|
|
4244
|
-
handler: handler$
|
|
4243
|
+
code: code$i,
|
|
4244
|
+
handler: handler$i
|
|
4245
4245
|
});
|
|
4246
4246
|
|
|
4247
|
-
const code$
|
|
4248
|
-
async function handler$
|
|
4247
|
+
const code$h = "addEntityRelations";
|
|
4248
|
+
async function handler$h(plugin, ctx, options) {
|
|
4249
4249
|
const { logger, server, input } = ctx;
|
|
4250
4250
|
const { defaultInput, fixedInput } = options;
|
|
4251
4251
|
const mergedInput = mergeInput(defaultInput, input, fixedInput);
|
|
4252
|
-
logger.debug(`Running ${code$
|
|
4252
|
+
logger.debug(`Running ${code$h} handler...`, { defaultInput, fixedInput, mergedInput });
|
|
4253
4253
|
const entityManager = server.getEntityManager(options.singularCode);
|
|
4254
4254
|
mergedInput.routeContext = ctx.routerContext;
|
|
4255
4255
|
await entityManager.addRelations(mergedInput, plugin);
|
|
@@ -4258,16 +4258,16 @@ async function handler$f(plugin, ctx, options) {
|
|
|
4258
4258
|
|
|
4259
4259
|
var addEntityRelations = /*#__PURE__*/Object.freeze({
|
|
4260
4260
|
__proto__: null,
|
|
4261
|
-
code: code$
|
|
4262
|
-
handler: handler$
|
|
4261
|
+
code: code$h,
|
|
4262
|
+
handler: handler$h
|
|
4263
4263
|
});
|
|
4264
4264
|
|
|
4265
|
-
const code$
|
|
4266
|
-
async function handler$
|
|
4265
|
+
const code$g = "removeEntityRelations";
|
|
4266
|
+
async function handler$g(plugin, ctx, options) {
|
|
4267
4267
|
const { logger, server, input } = ctx;
|
|
4268
4268
|
const { defaultInput, fixedInput } = options;
|
|
4269
4269
|
const mergedInput = mergeInput(defaultInput, input, fixedInput);
|
|
4270
|
-
logger.debug(`Running ${code$
|
|
4270
|
+
logger.debug(`Running ${code$g} handler...`, { defaultInput, fixedInput, mergedInput });
|
|
4271
4271
|
mergedInput.routeContext = ctx.routerContext;
|
|
4272
4272
|
const entityManager = server.getEntityManager(options.singularCode);
|
|
4273
4273
|
await entityManager.removeRelations(mergedInput, plugin);
|
|
@@ -4276,16 +4276,16 @@ async function handler$e(plugin, ctx, options) {
|
|
|
4276
4276
|
|
|
4277
4277
|
var removeEntityRelations = /*#__PURE__*/Object.freeze({
|
|
4278
4278
|
__proto__: null,
|
|
4279
|
-
code: code$
|
|
4280
|
-
handler: handler$
|
|
4279
|
+
code: code$g,
|
|
4280
|
+
handler: handler$g
|
|
4281
4281
|
});
|
|
4282
4282
|
|
|
4283
|
-
const code$
|
|
4284
|
-
async function handler$
|
|
4283
|
+
const code$f = "queryDatabase";
|
|
4284
|
+
async function handler$f(plugin, ctx, options) {
|
|
4285
4285
|
const { logger, server, input } = ctx;
|
|
4286
4286
|
const { sql, querySingle, defaultInput, fixedInput } = options;
|
|
4287
4287
|
const mergedInput = mergeInput(defaultInput, input, fixedInput);
|
|
4288
|
-
logger.debug(`Running ${code$
|
|
4288
|
+
logger.debug(`Running ${code$f} handler...`, { defaultInput, fixedInput, mergedInput });
|
|
4289
4289
|
const result = await server.queryDatabaseObject(sql, mergedInput);
|
|
4290
4290
|
if (querySingle) {
|
|
4291
4291
|
ctx.output = lodash.first(result);
|
|
@@ -4297,8 +4297,8 @@ async function handler$d(plugin, ctx, options) {
|
|
|
4297
4297
|
|
|
4298
4298
|
var queryDatabase = /*#__PURE__*/Object.freeze({
|
|
4299
4299
|
__proto__: null,
|
|
4300
|
-
code: code$
|
|
4301
|
-
handler: handler$
|
|
4300
|
+
code: code$f,
|
|
4301
|
+
handler: handler$f
|
|
4302
4302
|
});
|
|
4303
4303
|
|
|
4304
4304
|
/**
|
|
@@ -4469,17 +4469,17 @@ async function sendSourceResponse(proxyCtx, targetRes) {
|
|
|
4469
4469
|
srcRes.body = targetRes.body;
|
|
4470
4470
|
}
|
|
4471
4471
|
|
|
4472
|
-
const code$
|
|
4473
|
-
async function handler$
|
|
4472
|
+
const code$e = "httpProxy";
|
|
4473
|
+
async function handler$e(plugin, ctx, options) {
|
|
4474
4474
|
const { logger } = ctx;
|
|
4475
|
-
logger.debug(`Running ${code$
|
|
4475
|
+
logger.debug(`Running ${code$e} handler...`);
|
|
4476
4476
|
await doProxy(ctx.routerContext, options);
|
|
4477
4477
|
}
|
|
4478
4478
|
|
|
4479
4479
|
var httpProxy = /*#__PURE__*/Object.freeze({
|
|
4480
4480
|
__proto__: null,
|
|
4481
|
-
code: code$
|
|
4482
|
-
handler: handler$
|
|
4481
|
+
code: code$e,
|
|
4482
|
+
handler: handler$e
|
|
4483
4483
|
});
|
|
4484
4484
|
|
|
4485
4485
|
/**
|
|
@@ -4526,8 +4526,8 @@ class RouteManager {
|
|
|
4526
4526
|
}
|
|
4527
4527
|
}
|
|
4528
4528
|
|
|
4529
|
-
const code$
|
|
4530
|
-
async function handler$
|
|
4529
|
+
const code$d = "generateSn";
|
|
4530
|
+
async function handler$d(plugin, ctx, options) {
|
|
4531
4531
|
const { server, routerContext } = ctx;
|
|
4532
4532
|
const input = ctx.input;
|
|
4533
4533
|
if (options?.ruleCode) {
|
|
@@ -4545,11 +4545,11 @@ async function handler$b(plugin, ctx, options) {
|
|
|
4545
4545
|
|
|
4546
4546
|
var generateSn$1 = /*#__PURE__*/Object.freeze({
|
|
4547
4547
|
__proto__: null,
|
|
4548
|
-
code: code$
|
|
4549
|
-
handler: handler$
|
|
4548
|
+
code: code$d,
|
|
4549
|
+
handler: handler$d
|
|
4550
4550
|
});
|
|
4551
4551
|
|
|
4552
|
-
var pluginActionHandlers$
|
|
4552
|
+
var pluginActionHandlers$5 = [generateSn$1];
|
|
4553
4553
|
|
|
4554
4554
|
var SequenceRule = {
|
|
4555
4555
|
maintainedBy: "sequencePlugin",
|
|
@@ -4640,7 +4640,7 @@ var SequenceAutoIncrementRecord = {
|
|
|
4640
4640
|
],
|
|
4641
4641
|
};
|
|
4642
4642
|
|
|
4643
|
-
var pluginModels$
|
|
4643
|
+
var pluginModels$3 = [SequenceRule, SequenceAutoIncrementRecord];
|
|
4644
4644
|
|
|
4645
4645
|
var generateSn = {
|
|
4646
4646
|
namespace: "svc",
|
|
@@ -4656,7 +4656,7 @@ var generateSn = {
|
|
|
4656
4656
|
],
|
|
4657
4657
|
};
|
|
4658
4658
|
|
|
4659
|
-
var pluginRoutes$
|
|
4659
|
+
var pluginRoutes$5 = [generateSn];
|
|
4660
4660
|
|
|
4661
4661
|
const segmentType$5 = "literal";
|
|
4662
4662
|
async function resolveSegmentValue$5(server, ruleCode, config, input) {
|
|
@@ -4873,19 +4873,19 @@ class SequencePlugin {
|
|
|
4873
4873
|
return [];
|
|
4874
4874
|
}
|
|
4875
4875
|
async registerActionHandlers(server) {
|
|
4876
|
-
for (const actionHandler of pluginActionHandlers$
|
|
4876
|
+
for (const actionHandler of pluginActionHandlers$5) {
|
|
4877
4877
|
server.registerActionHandler(this, actionHandler);
|
|
4878
4878
|
}
|
|
4879
4879
|
}
|
|
4880
4880
|
async configureModels(server, applicationConfig) {
|
|
4881
|
-
server.appendApplicationConfig({ models: pluginModels$
|
|
4881
|
+
server.appendApplicationConfig({ models: pluginModels$3 });
|
|
4882
4882
|
}
|
|
4883
4883
|
async configureServices(server, applicationConfig) {
|
|
4884
4884
|
this.#sequenceService = new SequenceService(server);
|
|
4885
4885
|
server.registerService("sequenceService", this.#sequenceService);
|
|
4886
4886
|
}
|
|
4887
4887
|
async configureRoutes(server, applicationConfig) {
|
|
4888
|
-
server.appendApplicationConfig({ routes: pluginRoutes$
|
|
4888
|
+
server.appendApplicationConfig({ routes: pluginRoutes$5 });
|
|
4889
4889
|
}
|
|
4890
4890
|
async onApplicationLoaded(server, applicationConfig) {
|
|
4891
4891
|
const models = server.getApplicationConfig().models;
|
|
@@ -5124,8 +5124,8 @@ class WebhooksPlugin {
|
|
|
5124
5124
|
}
|
|
5125
5125
|
}
|
|
5126
5126
|
|
|
5127
|
-
const code$
|
|
5128
|
-
async function handler$
|
|
5127
|
+
const code$c = "changePassword";
|
|
5128
|
+
async function handler$c(plugin, ctx, options) {
|
|
5129
5129
|
const { server, input, routerContext } = ctx;
|
|
5130
5130
|
const { id, oldPassword, newPassword } = input;
|
|
5131
5131
|
const userId = routerContext.state.userId;
|
|
@@ -5167,12 +5167,12 @@ async function handler$a(plugin, ctx, options) {
|
|
|
5167
5167
|
|
|
5168
5168
|
var changePassword$1 = /*#__PURE__*/Object.freeze({
|
|
5169
5169
|
__proto__: null,
|
|
5170
|
-
code: code$
|
|
5171
|
-
handler: handler$
|
|
5170
|
+
code: code$c,
|
|
5171
|
+
handler: handler$c
|
|
5172
5172
|
});
|
|
5173
5173
|
|
|
5174
|
-
const code$
|
|
5175
|
-
async function handler$
|
|
5174
|
+
const code$b = "createSession";
|
|
5175
|
+
async function handler$b(plugin, ctx, options) {
|
|
5176
5176
|
const { server, input, routerContext } = ctx;
|
|
5177
5177
|
const { response } = routerContext;
|
|
5178
5178
|
const { account, password } = input;
|
|
@@ -5215,12 +5215,12 @@ async function handler$9(plugin, ctx, options) {
|
|
|
5215
5215
|
|
|
5216
5216
|
var createSession = /*#__PURE__*/Object.freeze({
|
|
5217
5217
|
__proto__: null,
|
|
5218
|
-
code: code$
|
|
5219
|
-
handler: handler$
|
|
5218
|
+
code: code$b,
|
|
5219
|
+
handler: handler$b
|
|
5220
5220
|
});
|
|
5221
5221
|
|
|
5222
|
-
const code$
|
|
5223
|
-
async function handler$
|
|
5222
|
+
const code$a = "deleteSession";
|
|
5223
|
+
async function handler$a(plugin, ctx, options) {
|
|
5224
5224
|
const { server, input, routerContext } = ctx;
|
|
5225
5225
|
const { response } = routerContext;
|
|
5226
5226
|
setCookie(response.headers, {
|
|
@@ -5233,12 +5233,12 @@ async function handler$8(plugin, ctx, options) {
|
|
|
5233
5233
|
|
|
5234
5234
|
var deleteSession = /*#__PURE__*/Object.freeze({
|
|
5235
5235
|
__proto__: null,
|
|
5236
|
-
code: code$
|
|
5237
|
-
handler: handler$
|
|
5236
|
+
code: code$a,
|
|
5237
|
+
handler: handler$a
|
|
5238
5238
|
});
|
|
5239
5239
|
|
|
5240
|
-
const code$
|
|
5241
|
-
async function handler$
|
|
5240
|
+
const code$9 = "getMyProfile";
|
|
5241
|
+
async function handler$9(plugin, ctx, options) {
|
|
5242
5242
|
const { server, input, routerContext } = ctx;
|
|
5243
5243
|
const userId = routerContext.state.userId;
|
|
5244
5244
|
if (!userId) {
|
|
@@ -5268,12 +5268,12 @@ async function handler$7(plugin, ctx, options) {
|
|
|
5268
5268
|
|
|
5269
5269
|
var getMyProfile$2 = /*#__PURE__*/Object.freeze({
|
|
5270
5270
|
__proto__: null,
|
|
5271
|
-
code: code$
|
|
5272
|
-
handler: handler$
|
|
5271
|
+
code: code$9,
|
|
5272
|
+
handler: handler$9
|
|
5273
5273
|
});
|
|
5274
5274
|
|
|
5275
|
-
const code$
|
|
5276
|
-
async function handler$
|
|
5275
|
+
const code$8 = "resetPassword";
|
|
5276
|
+
async function handler$8(plugin, ctx, options) {
|
|
5277
5277
|
const { server, input, routerContext } = ctx;
|
|
5278
5278
|
const { userId, password } = input;
|
|
5279
5279
|
const userDataAccessor = server.getDataAccessor({
|
|
@@ -5301,11 +5301,11 @@ async function handler$6(plugin, ctx, options) {
|
|
|
5301
5301
|
|
|
5302
5302
|
var resetPassword$1 = /*#__PURE__*/Object.freeze({
|
|
5303
5303
|
__proto__: null,
|
|
5304
|
-
code: code$
|
|
5305
|
-
handler: handler$
|
|
5304
|
+
code: code$8,
|
|
5305
|
+
handler: handler$8
|
|
5306
5306
|
});
|
|
5307
5307
|
|
|
5308
|
-
var pluginActionHandlers$
|
|
5308
|
+
var pluginActionHandlers$4 = [changePassword$1, createSession, deleteSession, getMyProfile$2, resetPassword$1];
|
|
5309
5309
|
|
|
5310
5310
|
var AccessToken = {
|
|
5311
5311
|
maintainedBy: "authManager",
|
|
@@ -5362,7 +5362,7 @@ var AccessToken = {
|
|
|
5362
5362
|
],
|
|
5363
5363
|
};
|
|
5364
5364
|
|
|
5365
|
-
var pluginModels$
|
|
5365
|
+
var pluginModels$2 = [AccessToken];
|
|
5366
5366
|
|
|
5367
5367
|
var changePassword = {
|
|
5368
5368
|
namespace: "auth",
|
|
@@ -5434,7 +5434,7 @@ var signout$1 = {
|
|
|
5434
5434
|
],
|
|
5435
5435
|
};
|
|
5436
5436
|
|
|
5437
|
-
var pluginRoutes$
|
|
5437
|
+
var pluginRoutes$4 = [changePassword, getMyProfile$1, resetPassword, signin$1, signout$1];
|
|
5438
5438
|
|
|
5439
5439
|
/**
|
|
5440
5440
|
* Auth manager plugin
|
|
@@ -5456,15 +5456,15 @@ class AuthPlugin {
|
|
|
5456
5456
|
return [];
|
|
5457
5457
|
}
|
|
5458
5458
|
async registerActionHandlers(server) {
|
|
5459
|
-
for (const actionHandler of pluginActionHandlers$
|
|
5459
|
+
for (const actionHandler of pluginActionHandlers$4) {
|
|
5460
5460
|
server.registerActionHandler(this, actionHandler);
|
|
5461
5461
|
}
|
|
5462
5462
|
}
|
|
5463
5463
|
async configureModels(server, applicationConfig) {
|
|
5464
|
-
server.appendApplicationConfig({ models: pluginModels$
|
|
5464
|
+
server.appendApplicationConfig({ models: pluginModels$2 });
|
|
5465
5465
|
}
|
|
5466
5466
|
async configureRoutes(server, applicationConfig) {
|
|
5467
|
-
server.appendApplicationConfig({ routes: pluginRoutes$
|
|
5467
|
+
server.appendApplicationConfig({ routes: pluginRoutes$4 });
|
|
5468
5468
|
}
|
|
5469
5469
|
async onPrepareRouteContext(server, routeContext) {
|
|
5470
5470
|
const request = routeContext.request;
|
|
@@ -5520,8 +5520,8 @@ async function appendFile(path, data) {
|
|
|
5520
5520
|
});
|
|
5521
5521
|
}
|
|
5522
5522
|
|
|
5523
|
-
const code$
|
|
5524
|
-
async function handler$
|
|
5523
|
+
const code$7 = "downloadDocument";
|
|
5524
|
+
async function handler$7(plugin, ctx, options) {
|
|
5525
5525
|
const { server, applicationConfig, routerContext, input } = ctx;
|
|
5526
5526
|
const { request, response } = routerContext;
|
|
5527
5527
|
const documentDataAccessor = ctx.server.getDataAccessor({
|
|
@@ -5549,12 +5549,12 @@ async function handler$5(plugin, ctx, options) {
|
|
|
5549
5549
|
|
|
5550
5550
|
var downloadDocumentActionHandler = /*#__PURE__*/Object.freeze({
|
|
5551
5551
|
__proto__: null,
|
|
5552
|
-
code: code$
|
|
5553
|
-
handler: handler$
|
|
5552
|
+
code: code$7,
|
|
5553
|
+
handler: handler$7
|
|
5554
5554
|
});
|
|
5555
5555
|
|
|
5556
|
-
const code$
|
|
5557
|
-
async function handler$
|
|
5556
|
+
const code$6 = "downloadFile";
|
|
5557
|
+
async function handler$6(plugin, ctx, options) {
|
|
5558
5558
|
const { server, applicationConfig, routerContext, input } = ctx;
|
|
5559
5559
|
const { request, response } = routerContext;
|
|
5560
5560
|
const dataAccessor = ctx.server.getDataAccessor({
|
|
@@ -5574,12 +5574,12 @@ async function handler$4(plugin, ctx, options) {
|
|
|
5574
5574
|
|
|
5575
5575
|
var downloadFileActionHandler = /*#__PURE__*/Object.freeze({
|
|
5576
5576
|
__proto__: null,
|
|
5577
|
-
code: code$
|
|
5578
|
-
handler: handler$
|
|
5577
|
+
code: code$6,
|
|
5578
|
+
handler: handler$6
|
|
5579
5579
|
});
|
|
5580
5580
|
|
|
5581
|
-
const code$
|
|
5582
|
-
async function handler$
|
|
5581
|
+
const code$5 = "uploadFile";
|
|
5582
|
+
async function handler$5(plugin, ctx, options) {
|
|
5583
5583
|
const { server, applicationConfig, routerContext, input } = ctx;
|
|
5584
5584
|
let file = input.file || input.files;
|
|
5585
5585
|
if (lodash.isArray(file)) {
|
|
@@ -5600,8 +5600,8 @@ async function handler$3(plugin, ctx, options) {
|
|
|
5600
5600
|
|
|
5601
5601
|
var uploadFileActionHandler = /*#__PURE__*/Object.freeze({
|
|
5602
5602
|
__proto__: null,
|
|
5603
|
-
code: code$
|
|
5604
|
-
handler: handler$
|
|
5603
|
+
code: code$5,
|
|
5604
|
+
handler: handler$5
|
|
5605
5605
|
});
|
|
5606
5606
|
|
|
5607
5607
|
var getMyProfile = {
|
|
@@ -5646,7 +5646,7 @@ var signout = {
|
|
|
5646
5646
|
],
|
|
5647
5647
|
};
|
|
5648
5648
|
|
|
5649
|
-
var pluginRoutes$
|
|
5649
|
+
var pluginRoutes$3 = [getMyProfile, signin, signout];
|
|
5650
5650
|
|
|
5651
5651
|
/**
|
|
5652
5652
|
* File manager plugin
|
|
@@ -5673,23 +5673,23 @@ class FileManager {
|
|
|
5673
5673
|
server.registerActionHandler(this, uploadFileActionHandler);
|
|
5674
5674
|
}
|
|
5675
5675
|
async configureRoutes(server, applicationConfig) {
|
|
5676
|
-
server.appendApplicationConfig({ routes: pluginRoutes$
|
|
5676
|
+
server.appendApplicationConfig({ routes: pluginRoutes$3 });
|
|
5677
5677
|
}
|
|
5678
5678
|
}
|
|
5679
5679
|
|
|
5680
|
-
const code$
|
|
5681
|
-
async function handler$
|
|
5680
|
+
const code$4 = "runServerOperation";
|
|
5681
|
+
async function handler$4(plugin, ctx, options) {
|
|
5682
5682
|
const { operation } = options;
|
|
5683
5683
|
await operation(ctx);
|
|
5684
5684
|
}
|
|
5685
5685
|
|
|
5686
5686
|
var runServerOperation = /*#__PURE__*/Object.freeze({
|
|
5687
5687
|
__proto__: null,
|
|
5688
|
-
code: code$
|
|
5689
|
-
handler: handler$
|
|
5688
|
+
code: code$4,
|
|
5689
|
+
handler: handler$4
|
|
5690
5690
|
});
|
|
5691
5691
|
|
|
5692
|
-
var pluginActionHandlers$
|
|
5692
|
+
var pluginActionHandlers$3 = [runServerOperation];
|
|
5693
5693
|
|
|
5694
5694
|
class ServerOperationPlugin {
|
|
5695
5695
|
#operations;
|
|
@@ -5714,7 +5714,7 @@ class ServerOperationPlugin {
|
|
|
5714
5714
|
async initPlugin(server) { }
|
|
5715
5715
|
async registerMiddlewares(server) { }
|
|
5716
5716
|
async registerActionHandlers(server) {
|
|
5717
|
-
for (const actionHandler of pluginActionHandlers$
|
|
5717
|
+
for (const actionHandler of pluginActionHandlers$3) {
|
|
5718
5718
|
server.registerActionHandler(this, actionHandler);
|
|
5719
5719
|
}
|
|
5720
5720
|
}
|
|
@@ -5751,6 +5751,652 @@ class ServerOperationPlugin {
|
|
|
5751
5751
|
async onApplicationReady(server, applicationConfig) { }
|
|
5752
5752
|
}
|
|
5753
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: "name",
|
|
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: "name",
|
|
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: "name",
|
|
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: "name",
|
|
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
|
+
|
|
5754
6400
|
const code$1 = "runCronJob";
|
|
5755
6401
|
async function handler$1(plugin, ctx, options) {
|
|
5756
6402
|
const { server, routerContext } = ctx;
|
|
@@ -6293,6 +6939,7 @@ exports.RouteContext = RouteContext;
|
|
|
6293
6939
|
exports.RouteManagePlugin = RouteManager;
|
|
6294
6940
|
exports.SequencePlugin = SequencePlugin;
|
|
6295
6941
|
exports.ServerOperationPlugin = ServerOperationPlugin;
|
|
6942
|
+
exports.SettingPlugin = SettingPlugin;
|
|
6296
6943
|
exports.StateMachinePlugin = StateMachinePlugin;
|
|
6297
6944
|
exports.WebhooksPlugin = WebhooksPlugin;
|
|
6298
6945
|
exports.bootstrapApplicationConfig = bootstrapApplicationConfig$1;
|