@certd/lib-server 1.39.9 → 1.39.11

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.
@@ -84,6 +84,7 @@ export declare abstract class BaseService<T> {
84
84
  */
85
85
  list(listReq: ListReq<T>): Promise<T[]>;
86
86
  checkUserId(ids: number | number[], userId: number, userKey?: string): Promise<void>;
87
+ filterIds(ids: any[]): any[];
87
88
  batchDelete(ids: number[], userId: number, projectId?: number): Promise<void>;
88
89
  findOne(options: FindOneOptions<T>): Promise<T>;
89
90
  }
@@ -60,7 +60,8 @@ export class BaseService {
60
60
  * @param where
61
61
  */
62
62
  async delete(ids, where) {
63
- const idArr = this.resolveIdArr(ids);
63
+ let idArr = this.resolveIdArr(ids);
64
+ idArr = this.filterIds(idArr);
64
65
  if (idArr.length === 0) {
65
66
  return;
66
67
  }
@@ -78,6 +79,9 @@ export class BaseService {
78
79
  if (typeof ids === 'string') {
79
80
  return ids.split(',');
80
81
  }
82
+ else if (!Array.isArray(ids)) {
83
+ return [ids];
84
+ }
81
85
  else {
82
86
  return ids;
83
87
  }
@@ -192,6 +196,7 @@ export class BaseService {
192
196
  if (!Array.isArray(ids)) {
193
197
  ids = [ids];
194
198
  }
199
+ ids = this.filterIds(ids);
195
200
  const res = await this.getRepository().find({
196
201
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
197
202
  // @ts-ignore
@@ -208,7 +213,16 @@ export class BaseService {
208
213
  }
209
214
  throw new PermissionException('权限不足');
210
215
  }
216
+ filterIds(ids) {
217
+ if (!ids) {
218
+ throw new ValidateException('ids不能为空');
219
+ }
220
+ return ids.filter((item) => {
221
+ return item != null && item != "";
222
+ });
223
+ }
211
224
  async batchDelete(ids, userId, projectId) {
225
+ ids = this.filterIds(ids);
212
226
  if (userId != null) {
213
227
  const list = await this.getRepository().find({
214
228
  where: {
@@ -14,10 +14,10 @@ import { SysSettingsEntity } from '../entity/sys-settings.js';
14
14
  import { SysInstallInfo, SysPrivateSettings, SysPublicSettings, SysSecret, SysSecretBackup } from './models.js';
15
15
  import { getAllSslProviderDomains, setSslProviderReverseProxies } from '@certd/acme-client';
16
16
  import { cache, logger, mergeUtils, setGlobalProxy } from '@certd/basic';
17
+ import { isPlus } from '@certd/plus-core';
17
18
  import * as dns from 'node:dns';
18
19
  import { BaseService, setAdminMode } from '../../../basic/index.js';
19
20
  import { executorQueue } from '../../basic/service/executor-queue.js';
20
- import { isComm, isPlus } from '@certd/plus-core';
21
21
  const { merge } = mergeUtils;
22
22
  let lastSaveEnvVars = {};
23
23
  /**
@@ -113,11 +113,11 @@ let SysSettingsService = class SysSettingsService extends BaseService {
113
113
  return await this.getSetting(SysPublicSettings);
114
114
  }
115
115
  async savePublicSettings(bean) {
116
- if (isComm()) {
117
- if (bean.adminMode === 'enterprise') {
118
- throw new Error("商业版不支持使用企业管理模式");
119
- }
120
- }
116
+ // if (isComm()) {
117
+ // if (bean.adminMode === 'enterprise') {
118
+ // throw new Error("商业版不支持使用企业管理模式")
119
+ // }
120
+ // }
121
121
  await this.saveSetting(bean);
122
122
  //让设置生效
123
123
  await this.reloadPublicSettings();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@certd/lib-server",
3
- "version": "1.39.9",
3
+ "version": "1.39.11",
4
4
  "description": "midway with flyway, sql upgrade way ",
5
5
  "private": false,
6
6
  "type": "module",
@@ -28,11 +28,11 @@
28
28
  ],
29
29
  "license": "AGPL",
30
30
  "dependencies": {
31
- "@certd/acme-client": "^1.39.9",
32
- "@certd/basic": "^1.39.9",
33
- "@certd/pipeline": "^1.39.9",
34
- "@certd/plugin-lib": "^1.39.9",
35
- "@certd/plus-core": "^1.39.9",
31
+ "@certd/acme-client": "^1.39.11",
32
+ "@certd/basic": "^1.39.11",
33
+ "@certd/pipeline": "^1.39.11",
34
+ "@certd/plugin-lib": "^1.39.11",
35
+ "@certd/plus-core": "^1.39.11",
36
36
  "@midwayjs/cache": "3.14.0",
37
37
  "@midwayjs/core": "3.20.11",
38
38
  "@midwayjs/i18n": "3.20.13",
@@ -64,5 +64,5 @@
64
64
  "typeorm": "^0.3.11",
65
65
  "typescript": "^5.4.2"
66
66
  },
67
- "gitHead": "1c634a702af9298d25542acc270d68f71d9b1049"
67
+ "gitHead": "ec466dc818eace59825d8ae2ebbc9fc75a94a6b0"
68
68
  }