@certd/lib-server 1.40.4 → 1.41.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/basic/base-controller.d.ts +1 -0
- package/dist/basic/base-controller.js +1 -1
- package/dist/basic/base-service.d.ts +15 -1
- package/dist/basic/base-service.js +27 -2
- package/dist/basic/constants.d.ts +2 -0
- package/dist/basic/constants.js +2 -0
- package/dist/basic/crud-controller.d.ts +1 -0
- package/dist/basic/enum-item.d.ts +1 -0
- package/dist/basic/exception/auth-exception.d.ts +1 -0
- package/dist/basic/exception/base-exception.d.ts +1 -0
- package/dist/basic/exception/code-error-exception.d.ts +1 -0
- package/dist/basic/exception/common-exception.d.ts +1 -0
- package/dist/basic/exception/index.d.ts +1 -0
- package/dist/basic/exception/login-error-exception.d.ts +1 -0
- package/dist/basic/exception/not-found-exception.d.ts +1 -0
- package/dist/basic/exception/param-exception.d.ts +1 -0
- package/dist/basic/exception/permission-exception.d.ts +1 -0
- package/dist/basic/exception/preview-exception.d.ts +1 -0
- package/dist/basic/exception/site-off-exception.d.ts +1 -0
- package/dist/basic/exception/validation-exception.d.ts +1 -0
- package/dist/basic/exception/vip-exception.d.ts +1 -0
- package/dist/basic/index.d.ts +1 -0
- package/dist/basic/mode.d.ts +1 -0
- package/dist/basic/result.d.ts +1 -0
- package/dist/configuration.d.ts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/system/basic/index.d.ts +1 -0
- package/dist/system/basic/service/encryptor.d.ts +1 -0
- package/dist/system/basic/service/executor-queue.d.ts +1 -0
- package/dist/system/basic/service/file-service.d.ts +2 -1
- package/dist/system/basic/service/file-service.js +2 -2
- package/dist/system/basic/service/ocr-service.d.ts +1 -0
- package/dist/system/basic/service/plus-service.d.ts +1 -0
- package/dist/system/index.d.ts +1 -0
- package/dist/system/settings/entity/sys-settings.d.ts +1 -0
- package/dist/system/settings/index.d.ts +1 -0
- package/dist/system/settings/service/models.d.ts +1 -0
- package/dist/system/settings/service/sys-settings-service.d.ts +1 -0
- package/dist/user/access/entity/access.d.ts +2 -0
- package/dist/user/access/entity/access.js +5 -0
- package/dist/user/access/index.d.ts +1 -0
- package/dist/user/access/service/access-getter.d.ts +2 -1
- package/dist/user/access/service/access-service.d.ts +6 -3
- package/dist/user/access/service/access-service.js +31 -25
- package/dist/user/access/service/access-sys-getter.d.ts +1 -0
- package/dist/user/access/service/encrypt-service.d.ts +1 -0
- package/dist/user/addon/api/api.d.ts +1 -0
- package/dist/user/addon/api/decorator.d.ts +1 -0
- package/dist/user/addon/api/index.d.ts +1 -0
- package/dist/user/addon/api/registry.d.ts +1 -0
- package/dist/user/addon/entity/addon.d.ts +1 -0
- package/dist/user/addon/index.d.ts +1 -0
- package/dist/user/addon/service/addon-service.d.ts +1 -0
- package/dist/user/addon/service/addon-service.js +12 -16
- package/dist/user/index.d.ts +1 -0
- package/package.json +7 -7
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FindOneOptions, Repository, SelectQueryBuilder } from 'typeorm';
|
|
1
|
+
import { EntityTarget, FindOneOptions, Repository, SelectQueryBuilder } from 'typeorm';
|
|
2
2
|
import { TypeORMDataSourceManager } from '@midwayjs/typeorm';
|
|
3
3
|
import { EntityManager } from 'typeorm/entity-manager/EntityManager.js';
|
|
4
4
|
import { FindManyOptions } from 'typeorm';
|
|
@@ -17,6 +17,9 @@ export type ListReq<T = any> = {
|
|
|
17
17
|
buildQuery?: (bq: SelectQueryBuilder<any>) => void;
|
|
18
18
|
select?: any;
|
|
19
19
|
};
|
|
20
|
+
export type ServiceContext = {
|
|
21
|
+
manager?: EntityManager;
|
|
22
|
+
};
|
|
20
23
|
/**
|
|
21
24
|
* 服务基类
|
|
22
25
|
*/
|
|
@@ -24,6 +27,16 @@ export declare abstract class BaseService<T> {
|
|
|
24
27
|
dataSourceManager: TypeORMDataSourceManager;
|
|
25
28
|
abstract getRepository(): Repository<T>;
|
|
26
29
|
transaction(callback: (entityManager: EntityManager) => Promise<any>): Promise<unknown>;
|
|
30
|
+
/**
|
|
31
|
+
* 如果 ctx 有 manager 则复用已有事务,否则开启新事务
|
|
32
|
+
*/
|
|
33
|
+
protected transactionWithCtx<T>(ctx: ServiceContext, callback: (manager: EntityManager) => Promise<T>): Promise<T>;
|
|
34
|
+
protected getRepo<E>(ctx: ServiceContext, entity: EntityTarget<E>): Repository<E>;
|
|
35
|
+
protected buildUserProjectQuery(userId: number, projectId?: number): {
|
|
36
|
+
[key: string]: any;
|
|
37
|
+
userId: number;
|
|
38
|
+
projectId?: number;
|
|
39
|
+
};
|
|
27
40
|
/**
|
|
28
41
|
* 获得单个ID
|
|
29
42
|
* @param id ID
|
|
@@ -89,3 +102,4 @@ export declare abstract class BaseService<T> {
|
|
|
89
102
|
findOne(options: FindOneOptions<T>): Promise<T>;
|
|
90
103
|
}
|
|
91
104
|
export declare function checkUserProjectParam(userId: number, projectId: number): boolean;
|
|
105
|
+
//# sourceMappingURL=base-service.d.ts.map
|
|
@@ -21,6 +21,31 @@ export class BaseService {
|
|
|
21
21
|
const dataSource = this.dataSourceManager.getDataSource('default');
|
|
22
22
|
return await dataSource.transaction(callback);
|
|
23
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* 如果 ctx 有 manager 则复用已有事务,否则开启新事务
|
|
26
|
+
*/
|
|
27
|
+
async transactionWithCtx(ctx, callback) {
|
|
28
|
+
if (ctx.manager) {
|
|
29
|
+
return await callback(ctx.manager);
|
|
30
|
+
}
|
|
31
|
+
return (await this.transaction(callback));
|
|
32
|
+
}
|
|
33
|
+
getRepo(ctx, entity) {
|
|
34
|
+
if (ctx.manager) {
|
|
35
|
+
return ctx.manager.getRepository(entity);
|
|
36
|
+
}
|
|
37
|
+
const dataSource = this.dataSourceManager.getDataSource('default');
|
|
38
|
+
return dataSource.getRepository(entity);
|
|
39
|
+
}
|
|
40
|
+
buildUserProjectQuery(userId, projectId) {
|
|
41
|
+
const query = {
|
|
42
|
+
userId,
|
|
43
|
+
};
|
|
44
|
+
if (projectId != null) {
|
|
45
|
+
query.projectId = projectId;
|
|
46
|
+
}
|
|
47
|
+
return query;
|
|
48
|
+
}
|
|
24
49
|
/**
|
|
25
50
|
* 获得单个ID
|
|
26
51
|
* @param id ID
|
|
@@ -224,12 +249,12 @@ export class BaseService {
|
|
|
224
249
|
async batchDelete(ids, userId, projectId) {
|
|
225
250
|
ids = this.filterIds(ids);
|
|
226
251
|
if (userId != null) {
|
|
252
|
+
const userProjectQuery = this.buildUserProjectQuery(userId, projectId);
|
|
227
253
|
const list = await this.getRepository().find({
|
|
228
254
|
where: {
|
|
229
255
|
// @ts-ignore
|
|
230
256
|
id: In(ids),
|
|
231
|
-
|
|
232
|
-
projectId,
|
|
257
|
+
...userProjectQuery,
|
|
233
258
|
},
|
|
234
259
|
});
|
|
235
260
|
// @ts-ignore
|
|
@@ -6,6 +6,7 @@ export declare const Constants: {
|
|
|
6
6
|
per: {
|
|
7
7
|
guest: string;
|
|
8
8
|
anonymous: string;
|
|
9
|
+
guestOptionalAuth: string;
|
|
9
10
|
authOnly: string;
|
|
10
11
|
loginOnly: string;
|
|
11
12
|
open: string;
|
|
@@ -115,3 +116,4 @@ export declare const Constants: {
|
|
|
115
116
|
systemUserId: number;
|
|
116
117
|
enterpriseUserId: number;
|
|
117
118
|
};
|
|
119
|
+
//# sourceMappingURL=constants.d.ts.map
|
package/dist/basic/constants.js
CHANGED
package/dist/basic/index.d.ts
CHANGED
package/dist/basic/mode.d.ts
CHANGED
package/dist/basic/result.d.ts
CHANGED
package/dist/configuration.d.ts
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -6,3 +6,4 @@ export * from './system/index.js';
|
|
|
6
6
|
export * from './user/index.js';
|
|
7
7
|
export { LibServerConfiguration as Configuration } from './configuration.js';
|
|
8
8
|
export declare const libServerEntities: (typeof SysSettingsEntity | typeof AccessEntity | typeof AddonEntity)[];
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -7,5 +7,6 @@ export declare const uploadTmpFileCacheKey = "tmpfile_key_";
|
|
|
7
7
|
*/
|
|
8
8
|
export declare class FileService {
|
|
9
9
|
saveFile(userId: number, tmpCacheKey: any, permission: 'public' | 'private'): Promise<any>;
|
|
10
|
-
getFile(key: string, userId?: number): string;
|
|
10
|
+
getFile(key: string, userId?: number, allowAnyPrivateUser?: boolean): string;
|
|
11
11
|
}
|
|
12
|
+
//# sourceMappingURL=file-service.d.ts.map
|
|
@@ -54,7 +54,7 @@ let FileService = class FileService {
|
|
|
54
54
|
}
|
|
55
55
|
return key;
|
|
56
56
|
}
|
|
57
|
-
getFile(key, userId) {
|
|
57
|
+
getFile(key, userId, allowAnyPrivateUser = false) {
|
|
58
58
|
if (!key) {
|
|
59
59
|
throw new ParamException('参数错误');
|
|
60
60
|
}
|
|
@@ -68,7 +68,7 @@ let FileService = class FileService {
|
|
|
68
68
|
const keyArr = key.split('/');
|
|
69
69
|
const permission = keyArr[1];
|
|
70
70
|
const userIdMd5 = keyArr[2];
|
|
71
|
-
if (permission !== 'public') {
|
|
71
|
+
if (permission !== 'public' && !allowAnyPrivateUser) {
|
|
72
72
|
//非公开文件需要验证用户
|
|
73
73
|
const userIdStr = Buffer.from(Buffer.from(userIdMd5, 'hex').toString('base64')).toString();
|
|
74
74
|
const userIdInt = parseInt(userIdStr, 10);
|
package/dist/system/index.d.ts
CHANGED
|
@@ -7,9 +7,11 @@ export declare class AccessEntity {
|
|
|
7
7
|
userId: number;
|
|
8
8
|
name: string;
|
|
9
9
|
type: string;
|
|
10
|
+
subtype: string;
|
|
10
11
|
setting: string;
|
|
11
12
|
encryptSetting: string;
|
|
12
13
|
projectId: number;
|
|
13
14
|
createTime: Date;
|
|
14
15
|
updateTime: Date;
|
|
15
16
|
}
|
|
17
|
+
//# sourceMappingURL=access.d.ts.map
|
|
@@ -17,6 +17,7 @@ let AccessEntity = class AccessEntity {
|
|
|
17
17
|
userId; // 0为系统级别, -1为企业,大于1为用户
|
|
18
18
|
name;
|
|
19
19
|
type;
|
|
20
|
+
subtype;
|
|
20
21
|
setting;
|
|
21
22
|
encryptSetting;
|
|
22
23
|
projectId;
|
|
@@ -43,6 +44,10 @@ __decorate([
|
|
|
43
44
|
Column({ comment: '类型', length: 100 }),
|
|
44
45
|
__metadata("design:type", String)
|
|
45
46
|
], AccessEntity.prototype, "type", void 0);
|
|
47
|
+
__decorate([
|
|
48
|
+
Column({ name: 'subtype', comment: '子类型', length: 100, nullable: true }),
|
|
49
|
+
__metadata("design:type", String)
|
|
50
|
+
], AccessEntity.prototype, "subtype", void 0);
|
|
46
51
|
__decorate([
|
|
47
52
|
Column({ name: 'setting', comment: '设置', length: 10240, nullable: true }),
|
|
48
53
|
__metadata("design:type", String)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IAccessService } from
|
|
1
|
+
import { IAccessService } from "@certd/pipeline";
|
|
2
2
|
export declare class AccessGetter implements IAccessService {
|
|
3
3
|
userId: number;
|
|
4
4
|
projectId?: number;
|
|
@@ -7,3 +7,4 @@ export declare class AccessGetter implements IAccessService {
|
|
|
7
7
|
getById<T = any>(id: any): Promise<T>;
|
|
8
8
|
getCommonById<T = any>(id: any): Promise<T>;
|
|
9
9
|
}
|
|
10
|
+
//# sourceMappingURL=access-getter.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Repository } from "typeorm";
|
|
2
|
-
import { BaseService, PageReq } from
|
|
3
|
-
import { AccessEntity } from
|
|
4
|
-
import { EncryptService } from
|
|
2
|
+
import { BaseService, PageReq } from "../../../index.js";
|
|
3
|
+
import { AccessEntity } from "../entity/access.js";
|
|
4
|
+
import { EncryptService } from "./encrypt-service.js";
|
|
5
5
|
/**
|
|
6
6
|
* 授权
|
|
7
7
|
*/
|
|
@@ -28,6 +28,8 @@ export declare class AccessService extends BaseService<AccessEntity> {
|
|
|
28
28
|
getSimpleInfo(id: number): Promise<{
|
|
29
29
|
id: number;
|
|
30
30
|
name: string;
|
|
31
|
+
type: string;
|
|
32
|
+
subtype: string;
|
|
31
33
|
userId: number;
|
|
32
34
|
projectId: number;
|
|
33
35
|
}>;
|
|
@@ -52,3 +54,4 @@ export declare class AccessService extends BaseService<AccessEntity> {
|
|
|
52
54
|
*/
|
|
53
55
|
copyTo(accessId: number, projectId?: number): Promise<any>;
|
|
54
56
|
}
|
|
57
|
+
//# sourceMappingURL=access-service.d.ts.map
|
|
@@ -7,14 +7,14 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
9
|
};
|
|
10
|
-
import { Inject, Provide, Scope, ScopeEnum } from
|
|
11
|
-
import { InjectEntityModel } from
|
|
10
|
+
import { Inject, Provide, Scope, ScopeEnum } from "@midwayjs/core";
|
|
11
|
+
import { InjectEntityModel } from "@midwayjs/typeorm";
|
|
12
12
|
import { In, Repository } from "typeorm";
|
|
13
|
-
import { AccessGetter, BaseService, PermissionException, ValidateException } from
|
|
14
|
-
import { AccessEntity } from
|
|
15
|
-
import { accessRegistry, newAccess } from
|
|
16
|
-
import { EncryptService } from
|
|
17
|
-
import { logger, utils } from
|
|
13
|
+
import { AccessGetter, BaseService, PermissionException, ValidateException } from "../../../index.js";
|
|
14
|
+
import { AccessEntity } from "../entity/access.js";
|
|
15
|
+
import { accessRegistry, newAccess } from "@certd/pipeline";
|
|
16
|
+
import { EncryptService } from "./encrypt-service.js";
|
|
17
|
+
import { logger, utils } from "@certd/basic";
|
|
18
18
|
/**
|
|
19
19
|
* 授权
|
|
20
20
|
*/
|
|
@@ -39,10 +39,10 @@ let AccessService = class AccessService extends BaseService {
|
|
|
39
39
|
if (param._copyFrom) {
|
|
40
40
|
oldEntity = await this.info(param._copyFrom);
|
|
41
41
|
if (oldEntity == null) {
|
|
42
|
-
throw new ValidateException(
|
|
42
|
+
throw new ValidateException("该授权配置不存在,请确认是否已被删除");
|
|
43
43
|
}
|
|
44
44
|
if (oldEntity.userId !== param.userId) {
|
|
45
|
-
throw new ValidateException(
|
|
45
|
+
throw new ValidateException("您无权查看该授权配置");
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
delete param._copyFrom;
|
|
@@ -61,17 +61,20 @@ let AccessService = class AccessService extends BaseService {
|
|
|
61
61
|
return;
|
|
62
62
|
}
|
|
63
63
|
const json = JSON.parse(setting);
|
|
64
|
+
if (accessDefine.subtype) {
|
|
65
|
+
param.subtype = json[accessDefine.subtype] || null;
|
|
66
|
+
}
|
|
64
67
|
let oldSetting = {};
|
|
65
68
|
let encryptSetting = {};
|
|
66
|
-
const firstEncrypt = !oldSettingEntity || !oldSettingEntity.encryptSetting || oldSettingEntity.encryptSetting ===
|
|
69
|
+
const firstEncrypt = !oldSettingEntity || !oldSettingEntity.encryptSetting || oldSettingEntity.encryptSetting === "{}";
|
|
67
70
|
if (oldSettingEntity) {
|
|
68
|
-
oldSetting = JSON.parse(oldSettingEntity.setting ||
|
|
69
|
-
encryptSetting = JSON.parse(oldSettingEntity.encryptSetting ||
|
|
71
|
+
oldSetting = JSON.parse(oldSettingEntity.setting || "{}");
|
|
72
|
+
encryptSetting = JSON.parse(oldSettingEntity.encryptSetting || "{}");
|
|
70
73
|
}
|
|
71
74
|
for (const key in json) {
|
|
72
75
|
//加密
|
|
73
76
|
let value = json[key];
|
|
74
|
-
if (value && typeof value ===
|
|
77
|
+
if (value && typeof value === "string") {
|
|
75
78
|
//去除前后空格
|
|
76
79
|
value = value.trim();
|
|
77
80
|
json[key] = value;
|
|
@@ -80,7 +83,7 @@ let AccessService = class AccessService extends BaseService {
|
|
|
80
83
|
if (!accessInputDefine) {
|
|
81
84
|
continue;
|
|
82
85
|
}
|
|
83
|
-
if (!accessInputDefine.encrypt || !value || typeof value !==
|
|
86
|
+
if (!accessInputDefine.encrypt || !value || typeof value !== "string") {
|
|
84
87
|
//定义无需加密、value为空、不是字符串 这些不需要加密
|
|
85
88
|
encryptSetting[key] = {
|
|
86
89
|
value: value,
|
|
@@ -94,7 +97,7 @@ let AccessService = class AccessService extends BaseService {
|
|
|
94
97
|
const subIndex = Math.min(2, length);
|
|
95
98
|
let starLength = length - subIndex * 2;
|
|
96
99
|
starLength = Math.max(2, starLength);
|
|
97
|
-
const starString =
|
|
100
|
+
const starString = "*".repeat(starLength);
|
|
98
101
|
json[key] = value.substring(0, subIndex) + starString + value.substring(value.length - subIndex);
|
|
99
102
|
encryptSetting[key] = {
|
|
100
103
|
value: this.encryptService.encrypt(value),
|
|
@@ -113,7 +116,7 @@ let AccessService = class AccessService extends BaseService {
|
|
|
113
116
|
async update(param) {
|
|
114
117
|
const oldEntity = await this.info(param.id);
|
|
115
118
|
if (oldEntity == null) {
|
|
116
|
-
throw new ValidateException(
|
|
119
|
+
throw new ValidateException("该授权配置不存在,请确认是否已被删除");
|
|
117
120
|
}
|
|
118
121
|
this.encryptSetting(param, oldEntity);
|
|
119
122
|
delete param.keyId;
|
|
@@ -122,11 +125,11 @@ let AccessService = class AccessService extends BaseService {
|
|
|
122
125
|
async updateAccess(access) {
|
|
123
126
|
const oldEntity = await this.info(access.id);
|
|
124
127
|
if (oldEntity == null) {
|
|
125
|
-
throw new ValidateException(
|
|
128
|
+
throw new ValidateException("该授权配置不存在,请确认是否已被删除");
|
|
126
129
|
}
|
|
127
130
|
const setting = this.decryptAccessEntity(oldEntity);
|
|
128
131
|
for (const key of Object.keys(access)) {
|
|
129
|
-
if (key ===
|
|
132
|
+
if (key === "id") {
|
|
130
133
|
continue;
|
|
131
134
|
}
|
|
132
135
|
setting[key] = access[key];
|
|
@@ -140,11 +143,13 @@ let AccessService = class AccessService extends BaseService {
|
|
|
140
143
|
async getSimpleInfo(id) {
|
|
141
144
|
const entity = await this.info(id);
|
|
142
145
|
if (entity == null) {
|
|
143
|
-
throw new ValidateException(
|
|
146
|
+
throw new ValidateException("该授权配置不存在,请确认是否已被删除");
|
|
144
147
|
}
|
|
145
148
|
return {
|
|
146
149
|
id: entity.id,
|
|
147
150
|
name: entity.name,
|
|
151
|
+
type: entity.type,
|
|
152
|
+
subtype: entity.subtype,
|
|
148
153
|
userId: entity.userId,
|
|
149
154
|
projectId: entity.projectId,
|
|
150
155
|
};
|
|
@@ -156,14 +161,14 @@ let AccessService = class AccessService extends BaseService {
|
|
|
156
161
|
}
|
|
157
162
|
if (checkUserId) {
|
|
158
163
|
if (userId == null) {
|
|
159
|
-
throw new ValidateException(
|
|
164
|
+
throw new ValidateException("userId不能为空");
|
|
160
165
|
}
|
|
161
166
|
if (userId !== entity.userId) {
|
|
162
|
-
throw new PermissionException(
|
|
167
|
+
throw new PermissionException("您对该Access授权无访问权限");
|
|
163
168
|
}
|
|
164
169
|
}
|
|
165
170
|
if (projectId != null && projectId !== entity.projectId) {
|
|
166
|
-
throw new PermissionException(
|
|
171
|
+
throw new PermissionException("您对该Access授权无访问权限");
|
|
167
172
|
}
|
|
168
173
|
// const access = accessRegistry.get(entity.type);
|
|
169
174
|
const setting = this.decryptAccessEntity(entity);
|
|
@@ -179,7 +184,7 @@ let AccessService = class AccessService extends BaseService {
|
|
|
179
184
|
}
|
|
180
185
|
decryptAccessEntity(entity) {
|
|
181
186
|
let setting = {};
|
|
182
|
-
if (entity.encryptSetting && entity.encryptSetting !==
|
|
187
|
+
if (entity.encryptSetting && entity.encryptSetting !== "{}") {
|
|
183
188
|
setting = JSON.parse(entity.encryptSetting);
|
|
184
189
|
for (const key in setting) {
|
|
185
190
|
//解密
|
|
@@ -209,16 +214,17 @@ let AccessService = class AccessService extends BaseService {
|
|
|
209
214
|
if (userId == null) {
|
|
210
215
|
return [];
|
|
211
216
|
}
|
|
217
|
+
const userProjectQuery = this.buildUserProjectQuery(userId, projectId);
|
|
212
218
|
return await this.repository.find({
|
|
213
219
|
where: {
|
|
214
220
|
id: In(ids),
|
|
215
|
-
|
|
216
|
-
projectId,
|
|
221
|
+
...userProjectQuery,
|
|
217
222
|
},
|
|
218
223
|
select: {
|
|
219
224
|
id: true,
|
|
220
225
|
name: true,
|
|
221
226
|
type: true,
|
|
227
|
+
subtype: true,
|
|
222
228
|
userId: true,
|
|
223
229
|
projectId: true,
|
|
224
230
|
},
|
|
@@ -4,3 +4,4 @@ export declare const ADDON_INPUT_KEY = "pipeline:addon:input";
|
|
|
4
4
|
export declare function IsAddon(define: AddonDefine): ClassDecorator;
|
|
5
5
|
export declare function AddonInput(input?: AddonInputDefine): PropertyDecorator;
|
|
6
6
|
export declare function newAddon(addonType: string, type: string, input: any, ctx: AddonContext): Promise<any>;
|
|
7
|
+
//# sourceMappingURL=decorator.d.ts.map
|
|
@@ -91,11 +91,11 @@ let AddonService = class AddonService extends BaseService {
|
|
|
91
91
|
if (userId == null) {
|
|
92
92
|
return [];
|
|
93
93
|
}
|
|
94
|
+
const userProjectQuery = this.buildUserProjectQuery(userId, projectId);
|
|
94
95
|
return await this.repository.find({
|
|
95
96
|
where: {
|
|
96
97
|
id: In(ids),
|
|
97
|
-
|
|
98
|
-
projectId
|
|
98
|
+
...userProjectQuery,
|
|
99
99
|
},
|
|
100
100
|
select: {
|
|
101
101
|
id: true,
|
|
@@ -109,11 +109,11 @@ let AddonService = class AddonService extends BaseService {
|
|
|
109
109
|
});
|
|
110
110
|
}
|
|
111
111
|
async getDefault(userId, addonType, projectId) {
|
|
112
|
+
const userProjectQuery = this.buildUserProjectQuery(userId, projectId);
|
|
112
113
|
const res = await this.repository.findOne({
|
|
113
114
|
where: {
|
|
114
|
-
userId,
|
|
115
115
|
addonType,
|
|
116
|
-
|
|
116
|
+
...userProjectQuery,
|
|
117
117
|
},
|
|
118
118
|
order: {
|
|
119
119
|
isDefault: "DESC"
|
|
@@ -144,19 +144,15 @@ let AddonService = class AddonService extends BaseService {
|
|
|
144
144
|
if (userId == null) {
|
|
145
145
|
throw new ValidateException("userId不能为空");
|
|
146
146
|
}
|
|
147
|
-
|
|
148
|
-
|
|
147
|
+
const userProjectQuery = this.buildUserProjectQuery(userId, projectId);
|
|
148
|
+
const query = {
|
|
149
149
|
addonType,
|
|
150
|
-
|
|
151
|
-
}
|
|
150
|
+
...userProjectQuery,
|
|
151
|
+
};
|
|
152
|
+
await this.repository.update(query, {
|
|
152
153
|
isDefault: false
|
|
153
154
|
});
|
|
154
|
-
await this.repository.update({
|
|
155
|
-
id,
|
|
156
|
-
userId,
|
|
157
|
-
addonType,
|
|
158
|
-
projectId
|
|
159
|
-
}, {
|
|
155
|
+
await this.repository.update({ ...query, id }, {
|
|
160
156
|
isDefault: true
|
|
161
157
|
});
|
|
162
158
|
}
|
|
@@ -182,12 +178,12 @@ let AddonService = class AddonService extends BaseService {
|
|
|
182
178
|
return this.buildAddonInstanceConfig(res);
|
|
183
179
|
}
|
|
184
180
|
async getOneByType(req) {
|
|
181
|
+
const userProjectQuery = this.buildUserProjectQuery(req.userId, req.projectId);
|
|
185
182
|
return await this.repository.findOne({
|
|
186
183
|
where: {
|
|
187
184
|
addonType: req.addonType,
|
|
188
185
|
type: req.type,
|
|
189
|
-
|
|
190
|
-
projectId: req.projectId
|
|
186
|
+
...userProjectQuery,
|
|
191
187
|
}
|
|
192
188
|
});
|
|
193
189
|
}
|
package/dist/user/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@certd/lib-server",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.41.0",
|
|
4
4
|
"description": "midway with flyway, sql upgrade way ",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -29,11 +29,11 @@
|
|
|
29
29
|
],
|
|
30
30
|
"license": "AGPL",
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@certd/acme-client": "^1.
|
|
33
|
-
"@certd/basic": "^1.
|
|
34
|
-
"@certd/pipeline": "^1.
|
|
35
|
-
"@certd/plugin-lib": "^1.
|
|
36
|
-
"@certd/plus-core": "^1.
|
|
32
|
+
"@certd/acme-client": "^1.41.0",
|
|
33
|
+
"@certd/basic": "^1.41.0",
|
|
34
|
+
"@certd/pipeline": "^1.41.0",
|
|
35
|
+
"@certd/plugin-lib": "^1.41.0",
|
|
36
|
+
"@certd/plus-core": "^1.41.0",
|
|
37
37
|
"@midwayjs/cache": "3.14.0",
|
|
38
38
|
"@midwayjs/core": "3.20.11",
|
|
39
39
|
"@midwayjs/i18n": "3.20.13",
|
|
@@ -69,5 +69,5 @@
|
|
|
69
69
|
"typeorm": "^0.3.11",
|
|
70
70
|
"typescript": "^5.4.2"
|
|
71
71
|
},
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "d368f9666abf71d7f56891b6cbedeb618b82701c"
|
|
73
73
|
}
|