@beseif-solutions/prow-core 0.0.20 → 0.0.21
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.
|
@@ -5,13 +5,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.getCategories = void 0;
|
|
7
7
|
const axios_1 = __importDefault(require("axios"));
|
|
8
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
8
9
|
const getCategories = async () => {
|
|
9
10
|
try {
|
|
10
|
-
const { data } = await axios_1.default.get(`
|
|
11
|
-
if (!data ||
|
|
11
|
+
const { data } = await axios_1.default.get(`http://localhost:5000/feu/v1/repository/categories`);
|
|
12
|
+
if (!data || !lodash_1.default.isArray(data) || data.length === 0) {
|
|
12
13
|
throw new Error(`Could not obtain category list`);
|
|
13
14
|
}
|
|
14
|
-
return data
|
|
15
|
+
return data;
|
|
15
16
|
}
|
|
16
17
|
catch (e) {
|
|
17
18
|
throw e;
|
|
@@ -21,7 +21,7 @@ type EventConfig = Pick<CoreConfig, `credentials` | `outputs`> & {
|
|
|
21
21
|
};
|
|
22
22
|
type CommonEvents<Config extends EventConfig = {}> = Common<Config> & {
|
|
23
23
|
model: `event`;
|
|
24
|
-
|
|
24
|
+
category: string;
|
|
25
25
|
credentials: string[];
|
|
26
26
|
sandbox: boolean;
|
|
27
27
|
fields: Field[];
|
package/dist/entities/events.js
CHANGED
|
@@ -22,7 +22,7 @@ const additionalConnectableEventSchema = () => joi_1.default.object({})
|
|
|
22
22
|
.concat(commonConnectableEventSchema());
|
|
23
23
|
const commonEventsSchema = () => joi_1.default.object({
|
|
24
24
|
model: joi_1.default.valid(`event`).required(),
|
|
25
|
-
|
|
25
|
+
category: joi_1.default.string().required(),
|
|
26
26
|
credentials: joi_1.default.array().items((0, commons_1.idSchema)().optional()).required().min(0),
|
|
27
27
|
sandbox: joi_1.default.bool().required(),
|
|
28
28
|
fields: (0, fields_1.fieldsSchema)().required(),
|
|
@@ -11,7 +11,7 @@ const commons_1 = require("./commons");
|
|
|
11
11
|
const providerSchema = () => joi_1.default.object({
|
|
12
12
|
id: (0, commons_1.idSchema)(),
|
|
13
13
|
model: joi_1.default.valid(`provider`).required(),
|
|
14
|
-
categories: joi_1.default.array().items(joi_1.default.string()).required(),
|
|
14
|
+
categories: joi_1.default.array().items(joi_1.default.string()).min(1).required(),
|
|
15
15
|
credentials: joi_1.default.object()
|
|
16
16
|
.pattern((0, commons_1.idSchema)(), (0, credentials_1.credentialsSchema)())
|
|
17
17
|
.required(),
|
package/package.json
CHANGED
package/src/entities/category.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import axios from "axios";
|
|
2
|
+
import _ from "lodash";
|
|
2
3
|
|
|
3
4
|
export const getCategories = async (): Promise<string[]> => {
|
|
4
5
|
try {
|
|
5
|
-
const { data } = await axios.get(`
|
|
6
|
-
if (!data ||
|
|
7
|
-
return data
|
|
6
|
+
const { data } = await axios.get(`http://localhost:5000/feu/v1/repository/categories`);
|
|
7
|
+
if (!data || !_.isArray(data) || data.length === 0) { throw new Error(`Could not obtain category list`); }
|
|
8
|
+
return data;
|
|
8
9
|
} catch (e) { throw e; }
|
|
9
10
|
};
|
package/src/entities/events.ts
CHANGED
|
@@ -28,7 +28,7 @@ type EventConfig = Pick<CoreConfig, `credentials` | `outputs`> & {
|
|
|
28
28
|
|
|
29
29
|
type CommonEvents<Config extends EventConfig = {}> = Common<Config> & {
|
|
30
30
|
model: `event`,
|
|
31
|
-
|
|
31
|
+
category: string,
|
|
32
32
|
credentials: string[],
|
|
33
33
|
sandbox: boolean,
|
|
34
34
|
fields: Field[],
|
|
@@ -126,7 +126,7 @@ const additionalConnectableEventSchema = () =>
|
|
|
126
126
|
const commonEventsSchema = () =>
|
|
127
127
|
Joi.object({
|
|
128
128
|
model: Joi.valid(`event`).required(),
|
|
129
|
-
|
|
129
|
+
category: Joi.string().required(),
|
|
130
130
|
credentials: Joi.array().items(idSchema().optional()).required().min(0),
|
|
131
131
|
sandbox: Joi.bool().required(),
|
|
132
132
|
fields: fieldsSchema().required(),
|
package/src/entities/provider.ts
CHANGED
|
@@ -16,7 +16,7 @@ export const providerSchema = () =>
|
|
|
16
16
|
Joi.object({
|
|
17
17
|
id: idSchema(),
|
|
18
18
|
model: Joi.valid(`provider`).required(),
|
|
19
|
-
categories: Joi.array().items(Joi.string()).required(),
|
|
19
|
+
categories: Joi.array().items(Joi.string()).min(1).required(),
|
|
20
20
|
credentials: Joi.object()
|
|
21
21
|
.pattern(idSchema(), credentialsSchema())
|
|
22
22
|
.required(),
|