@certd/pipeline 1.38.12 → 1.39.1
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/CHANGELOG.md +8 -0
- package/dist/plugin/api.d.ts +2 -0
- package/dist/plugin/api.js +6 -3
- package/package.json +4 -4
- package/test/echo-plugin.js +0 -86
- package/test/index.test.js +0 -18
- package/test/pipeline/access-service-test.js +0 -65
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.39.1](https://github.com/certd/certd/compare/v1.39.0...v1.39.1) (2026-03-09)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @certd/pipeline
|
|
9
|
+
|
|
10
|
+
# [1.39.0](https://github.com/certd/certd/compare/v1.38.12...v1.39.0) (2026-03-07)
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package @certd/pipeline
|
|
13
|
+
|
|
6
14
|
## [1.38.12](https://github.com/certd/certd/compare/v1.38.11...v1.38.12) (2026-02-18)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @certd/pipeline
|
package/dist/plugin/api.d.ts
CHANGED
|
@@ -96,6 +96,7 @@ export type TaskInstanceContext = {
|
|
|
96
96
|
signal: AbortSignal;
|
|
97
97
|
utils: typeof utils;
|
|
98
98
|
user: UserInfo;
|
|
99
|
+
projectId?: number;
|
|
99
100
|
emitter: TaskEmitter;
|
|
100
101
|
serviceGetter?: IServiceGetter;
|
|
101
102
|
};
|
|
@@ -122,6 +123,7 @@ export declare abstract class AbstractTaskPlugin implements ITaskPlugin {
|
|
|
122
123
|
buildCertName(domain: string, prefix?: string): string;
|
|
123
124
|
onRequest(req: PluginRequestHandleReq<any>): Promise<any>;
|
|
124
125
|
isAdmin(): boolean;
|
|
126
|
+
checkAdmin(): void;
|
|
125
127
|
getStepFromPipeline(stepId: string): any;
|
|
126
128
|
getStepIdFromRefInput(ref?: string): string;
|
|
127
129
|
buildDomainGroupOptions(options: any[], domains: string[]): any[];
|
package/dist/plugin/api.js
CHANGED
|
@@ -42,9 +42,7 @@ export class AbstractTaskPlugin {
|
|
|
42
42
|
this.registerSecret(cert.one);
|
|
43
43
|
}
|
|
44
44
|
if (this.ctx?.define?.onlyAdmin) {
|
|
45
|
-
|
|
46
|
-
throw new Error("只有管理员才能运行此任务");
|
|
47
|
-
}
|
|
45
|
+
this.checkAdmin();
|
|
48
46
|
}
|
|
49
47
|
}
|
|
50
48
|
async getAccess(accessId, isCommon = false) {
|
|
@@ -140,6 +138,11 @@ export class AbstractTaskPlugin {
|
|
|
140
138
|
isAdmin() {
|
|
141
139
|
return this.ctx.user.role === "admin";
|
|
142
140
|
}
|
|
141
|
+
checkAdmin() {
|
|
142
|
+
if (!this.isAdmin()) {
|
|
143
|
+
throw new Error("只有“管理员”或“系统级项目”才有权限运行此插件任务");
|
|
144
|
+
}
|
|
145
|
+
}
|
|
143
146
|
getStepFromPipeline(stepId) {
|
|
144
147
|
let found = null;
|
|
145
148
|
RunnableCollection.each(this.ctx.pipeline.stages, step => {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@certd/pipeline",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.39.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"module": "./dist/index.js",
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"compile": "tsc --skipLibCheck --watch"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@certd/basic": "^1.
|
|
22
|
-
"@certd/plus-core": "^1.
|
|
21
|
+
"@certd/basic": "^1.39.1",
|
|
22
|
+
"@certd/plus-core": "^1.39.1",
|
|
23
23
|
"dayjs": "^1.11.7",
|
|
24
24
|
"lodash-es": "^4.17.21",
|
|
25
25
|
"reflect-metadata": "^0.1.13"
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"tslib": "^2.8.1",
|
|
46
46
|
"typescript": "^5.4.2"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "590ff67fcb40ff8ba0f7b2a9592b51d9fb54a2ef"
|
|
49
49
|
}
|
package/test/echo-plugin.js
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
9
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
10
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
11
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
12
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
13
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
14
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
15
|
-
});
|
|
16
|
-
};
|
|
17
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
18
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
19
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
20
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
21
|
-
function step(op) {
|
|
22
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
23
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
24
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
25
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
26
|
-
switch (op[0]) {
|
|
27
|
-
case 0: case 1: t = op; break;
|
|
28
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
29
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
30
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
31
|
-
default:
|
|
32
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
33
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
34
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
35
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
36
|
-
if (t[2]) _.ops.pop();
|
|
37
|
-
_.trys.pop(); continue;
|
|
38
|
-
}
|
|
39
|
-
op = body.call(thisArg, _);
|
|
40
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
41
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
exports.__esModule = true;
|
|
45
|
-
exports.EchoPlugin = void 0;
|
|
46
|
-
var src_1 = require("../src");
|
|
47
|
-
var EchoPlugin = /** @class */ (function () {
|
|
48
|
-
function EchoPlugin() {
|
|
49
|
-
}
|
|
50
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
51
|
-
EchoPlugin.prototype.onInstance = function () {
|
|
52
|
-
return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
53
|
-
return [2 /*return*/];
|
|
54
|
-
}); });
|
|
55
|
-
};
|
|
56
|
-
EchoPlugin.prototype.execute = function () {
|
|
57
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
58
|
-
return __generator(this, function (_a) {
|
|
59
|
-
console.log("input :cert", this.cert);
|
|
60
|
-
return [2 /*return*/];
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
};
|
|
64
|
-
__decorate([
|
|
65
|
-
(0, src_1.TaskInput)({
|
|
66
|
-
title: "cert",
|
|
67
|
-
component: {
|
|
68
|
-
name: "output-selector"
|
|
69
|
-
},
|
|
70
|
-
helper: "输出选择"
|
|
71
|
-
})
|
|
72
|
-
], EchoPlugin.prototype, "cert");
|
|
73
|
-
__decorate([
|
|
74
|
-
(0, src_1.TaskOutput)({
|
|
75
|
-
title: "cert info"
|
|
76
|
-
})
|
|
77
|
-
], EchoPlugin.prototype, "certInfo");
|
|
78
|
-
EchoPlugin = __decorate([
|
|
79
|
-
(0, src_1.IsTaskPlugin)({
|
|
80
|
-
name: "EchoPlugin",
|
|
81
|
-
title: "测试插件【echo】"
|
|
82
|
-
})
|
|
83
|
-
], EchoPlugin);
|
|
84
|
-
return EchoPlugin;
|
|
85
|
-
}());
|
|
86
|
-
exports.EchoPlugin = EchoPlugin;
|
package/test/index.test.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var chai_1 = require("chai");
|
|
4
|
-
require("mocha");
|
|
5
|
-
var echo_plugin_js_1 = require("./echo-plugin.js");
|
|
6
|
-
describe("task_plugin", function () {
|
|
7
|
-
it("#taskplugin", function () {
|
|
8
|
-
console.log("before new plugin");
|
|
9
|
-
var echoPlugin = new echo_plugin_js_1.EchoPlugin();
|
|
10
|
-
console.log("before set property", echoPlugin);
|
|
11
|
-
echoPlugin.cert = { test: 1 };
|
|
12
|
-
console.log("before execute");
|
|
13
|
-
// @ts-ignore
|
|
14
|
-
echoPlugin.execute();
|
|
15
|
-
console.log("after execute");
|
|
16
|
-
(0, chai_1.expect)(echoPlugin.cert.test).eq(1);
|
|
17
|
-
});
|
|
18
|
-
});
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
-
function step(op) {
|
|
27
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
29
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
-
switch (op[0]) {
|
|
32
|
-
case 0: case 1: t = op; break;
|
|
33
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
-
default:
|
|
37
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
-
if (t[2]) _.ops.pop();
|
|
42
|
-
_.trys.pop(); continue;
|
|
43
|
-
}
|
|
44
|
-
op = body.call(thisArg, _);
|
|
45
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
-
exports.AccessServiceTest = void 0;
|
|
51
|
-
// @ts-ignore
|
|
52
|
-
var user_secret_1 = require("../user.secret");
|
|
53
|
-
var AccessServiceTest = /** @class */ (function () {
|
|
54
|
-
function AccessServiceTest() {
|
|
55
|
-
}
|
|
56
|
-
AccessServiceTest.prototype.getById = function (id) {
|
|
57
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
58
|
-
return __generator(this, function (_a) {
|
|
59
|
-
return [2 /*return*/, __assign({}, user_secret_1.aliyunSecret)];
|
|
60
|
-
});
|
|
61
|
-
});
|
|
62
|
-
};
|
|
63
|
-
return AccessServiceTest;
|
|
64
|
-
}());
|
|
65
|
-
exports.AccessServiceTest = AccessServiceTest;
|