@beseif-solutions/prow-core 0.0.33 → 0.0.35
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/entities/commons.js +2 -1
- package/dist/entities/events.d.ts +8 -1
- package/dist/entities/events.js +8 -1
- package/dist/entities/provider.d.ts +1 -2
- package/dist/entities/provider.js +2 -2
- package/dist/index.d.ts +1 -2
- package/dist/index.js +2 -3
- package/dist/minified-utils/locales.d.ts +1 -0
- package/dist/minified-utils/locales.js +6 -1
- package/package.json +1 -1
- package/src/entities/commons.ts +2 -1
- package/src/entities/events.ts +16 -2
- package/src/entities/provider.ts +3 -4
- package/src/index.ts +1 -2
- package/src/minified-utils/locales.ts +8 -0
- package/dist/entities/category.d.ts +0 -1
- package/dist/entities/category.js +0 -20
- package/src/entities/category.ts +0 -9
package/dist/entities/commons.js
CHANGED
|
@@ -5,7 +5,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.commonSchema = exports.idSchema = void 0;
|
|
7
7
|
const joi_1 = __importDefault(require("joi"));
|
|
8
|
-
const idSchema = () => joi_1.default.string().required().regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/)
|
|
8
|
+
const idSchema = () => joi_1.default.string().required().regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/)
|
|
9
|
+
.invalid(`ui`);
|
|
9
10
|
exports.idSchema = idSchema;
|
|
10
11
|
const commonSchema = () => joi_1.default.object({
|
|
11
12
|
id: (0, exports.idSchema)(),
|
|
@@ -29,7 +29,14 @@ type EventConfig = Pick<CoreConfig, `credentials` | `outputs`> & {
|
|
|
29
29
|
};
|
|
30
30
|
type CommonEvents<Config extends EventConfig = {}> = Common<Config> & {
|
|
31
31
|
model: `event`;
|
|
32
|
-
|
|
32
|
+
categorization: {
|
|
33
|
+
department: string;
|
|
34
|
+
category: string;
|
|
35
|
+
};
|
|
36
|
+
ui: {
|
|
37
|
+
group: string;
|
|
38
|
+
icon?: string;
|
|
39
|
+
};
|
|
33
40
|
credentials: string[];
|
|
34
41
|
sandbox: boolean;
|
|
35
42
|
fields: Field[];
|
package/dist/entities/events.js
CHANGED
|
@@ -22,7 +22,14 @@ 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
|
+
categorization: joi_1.default.object({
|
|
26
|
+
department: joi_1.default.string().required(),
|
|
27
|
+
category: joi_1.default.string().required(),
|
|
28
|
+
}).required(),
|
|
29
|
+
ui: joi_1.default.object({
|
|
30
|
+
group: joi_1.default.string().required(),
|
|
31
|
+
icon: joi_1.default.string(),
|
|
32
|
+
}).required(),
|
|
26
33
|
credentials: joi_1.default.array().items((0, commons_1.idSchema)().optional()).required().min(0),
|
|
27
34
|
sandbox: joi_1.default.bool().required(),
|
|
28
35
|
fields: (0, fields_1.fieldsSchema)().required(),
|
|
@@ -5,10 +5,9 @@ import { Source } from "./source";
|
|
|
5
5
|
export type Provider = {
|
|
6
6
|
id: string;
|
|
7
7
|
model: `provider`;
|
|
8
|
-
categories: string[];
|
|
9
8
|
credentials: Record<string, Credentials>;
|
|
10
9
|
triggers: Record<string, Trigger>;
|
|
11
10
|
actions: Record<string, Action>;
|
|
12
|
-
sources
|
|
11
|
+
sources: Record<string, Source>;
|
|
13
12
|
};
|
|
14
13
|
export declare const providerSchema: () => Joi.ObjectSchema<any>;
|
|
@@ -12,7 +12,6 @@ const source_1 = require("./source");
|
|
|
12
12
|
const providerSchema = () => joi_1.default.object({
|
|
13
13
|
id: (0, commons_1.idSchema)(),
|
|
14
14
|
model: joi_1.default.valid(`provider`).required(),
|
|
15
|
-
categories: joi_1.default.array().items(joi_1.default.string()).min(1).required(),
|
|
16
15
|
credentials: joi_1.default.object()
|
|
17
16
|
.pattern((0, commons_1.idSchema)(), (0, credentials_1.credentialsSchema)())
|
|
18
17
|
.required(),
|
|
@@ -23,6 +22,7 @@ const providerSchema = () => joi_1.default.object({
|
|
|
23
22
|
.pattern((0, commons_1.idSchema)(), (0, events_1.actionSchema)())
|
|
24
23
|
.required(),
|
|
25
24
|
sources: joi_1.default.object()
|
|
26
|
-
.pattern((0, commons_1.idSchema)(), (0, source_1.sourceSchema)())
|
|
25
|
+
.pattern((0, commons_1.idSchema)(), (0, source_1.sourceSchema)())
|
|
26
|
+
.required(),
|
|
27
27
|
});
|
|
28
28
|
exports.providerSchema = providerSchema;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
export { Core, core } from './core';
|
|
2
|
-
export { getCategories } from './entities/category';
|
|
3
2
|
export { CoreFunction, idSchema } from './entities/commons';
|
|
4
3
|
export { Credentials, credentialsSchema, OAuthCredentials, oauthCredentialsSchema, SessionCredentials, sessionCredentialsSchema, StaticCredentials, staticCredentialsSchema } from './entities/credentials';
|
|
5
4
|
export { Action, actionOutputSchema, actionSchema, Event, eventSchema, ImmediateTrigger, immediateTriggerSchema, Request, ScheduledTrigger, scheduledTriggerSchema, Trigger, triggerOutputSchema, triggerSchema } from './entities/events';
|
|
6
5
|
export { Provider, providerSchema } from './entities/provider';
|
|
7
6
|
export { Source } from './entities/source';
|
|
8
7
|
export { extract, Field, fieldSchema, fieldsSchema, SelectFieldChoice, validate, ValidationResult } from './minified-utils/fields';
|
|
9
|
-
export { i18n, localizeFields, localizeInputs, localizeOutputs, localizeProperties
|
|
8
|
+
export { i18n, LocalizedField, LocalizedProperties, localizeFields, localizeGroup, localizeInputs, localizeOutputs, localizeProperties } from './minified-utils/locales';
|
|
10
9
|
export { Properties } from './minified-utils/properties';
|
|
11
10
|
export { Protocol } from './minified-utils/protocol';
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Protocol = exports.Properties = exports.localizeProperties = exports.localizeOutputs = exports.localizeInputs = exports.localizeFields = exports.i18n = exports.validate = exports.fieldsSchema = exports.fieldSchema = exports.extract = exports.providerSchema = exports.triggerSchema = exports.triggerOutputSchema = exports.scheduledTriggerSchema = exports.immediateTriggerSchema = exports.eventSchema = exports.actionSchema = exports.actionOutputSchema = exports.staticCredentialsSchema = exports.sessionCredentialsSchema = exports.oauthCredentialsSchema = exports.credentialsSchema = exports.idSchema = exports.
|
|
3
|
+
exports.Protocol = exports.Properties = exports.localizeProperties = exports.localizeOutputs = exports.localizeInputs = exports.localizeGroup = exports.localizeFields = exports.i18n = exports.validate = exports.fieldsSchema = exports.fieldSchema = exports.extract = exports.providerSchema = exports.triggerSchema = exports.triggerOutputSchema = exports.scheduledTriggerSchema = exports.immediateTriggerSchema = exports.eventSchema = exports.actionSchema = exports.actionOutputSchema = exports.staticCredentialsSchema = exports.sessionCredentialsSchema = exports.oauthCredentialsSchema = exports.credentialsSchema = exports.idSchema = exports.core = void 0;
|
|
4
4
|
var core_1 = require("./core");
|
|
5
5
|
Object.defineProperty(exports, "core", { enumerable: true, get: function () { return core_1.core; } });
|
|
6
|
-
var category_1 = require("./entities/category");
|
|
7
|
-
Object.defineProperty(exports, "getCategories", { enumerable: true, get: function () { return category_1.getCategories; } });
|
|
8
6
|
var commons_1 = require("./entities/commons");
|
|
9
7
|
Object.defineProperty(exports, "idSchema", { enumerable: true, get: function () { return commons_1.idSchema; } });
|
|
10
8
|
var credentials_1 = require("./entities/credentials");
|
|
@@ -30,6 +28,7 @@ Object.defineProperty(exports, "validate", { enumerable: true, get: function ()
|
|
|
30
28
|
var locales_1 = require("./minified-utils/locales");
|
|
31
29
|
Object.defineProperty(exports, "i18n", { enumerable: true, get: function () { return locales_1.i18n; } });
|
|
32
30
|
Object.defineProperty(exports, "localizeFields", { enumerable: true, get: function () { return locales_1.localizeFields; } });
|
|
31
|
+
Object.defineProperty(exports, "localizeGroup", { enumerable: true, get: function () { return locales_1.localizeGroup; } });
|
|
33
32
|
Object.defineProperty(exports, "localizeInputs", { enumerable: true, get: function () { return locales_1.localizeInputs; } });
|
|
34
33
|
Object.defineProperty(exports, "localizeOutputs", { enumerable: true, get: function () { return locales_1.localizeOutputs; } });
|
|
35
34
|
Object.defineProperty(exports, "localizeProperties", { enumerable: true, get: function () { return locales_1.localizeProperties; } });
|
|
@@ -34,6 +34,7 @@ export declare const i18n: (options: FromCatalog | FromDirectory) => {
|
|
|
34
34
|
};
|
|
35
35
|
export declare const localizeFields: (t: ReturnType<typeof i18n>[`t`], element: Action | Trigger | StaticCredentials | SessionCredentials | Source) => Field<LocalizedField>[];
|
|
36
36
|
export declare const localizeProperties: (t: ReturnType<typeof i18n>[`t`], element: Action | Trigger | Credentials | Provider | Source) => LocalizedProperties;
|
|
37
|
+
export declare const localizeGroup: (t: ReturnType<typeof i18n>[`t`], element: Action | Trigger) => LocalizedProperties;
|
|
37
38
|
export declare const localizeInputs: (t: ReturnType<typeof i18n>[`t`], element: Action) => (ConnectableEvent & LocalizedProperties)[];
|
|
38
39
|
export declare const localizeOutputs: (t: ReturnType<typeof i18n>[`t`], element: Action | Trigger) => (ConnectableEvent & LocalizedProperties)[];
|
|
39
40
|
export {};
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.localizeOutputs = exports.localizeInputs = exports.localizeProperties = exports.localizeFields = exports.i18n = exports.validateDirectory = void 0;
|
|
6
|
+
exports.localizeOutputs = exports.localizeInputs = exports.localizeGroup = exports.localizeProperties = exports.localizeFields = exports.i18n = exports.validateDirectory = void 0;
|
|
7
7
|
const i18n_1 = __importDefault(require("i18n"));
|
|
8
8
|
const lodash_1 = __importDefault(require("lodash"));
|
|
9
9
|
const fs_1 = __importDefault(require("fs"));
|
|
@@ -112,6 +112,11 @@ const localizeProperties = (t, element) => ({
|
|
|
112
112
|
description: t(`${element.id}.description`),
|
|
113
113
|
});
|
|
114
114
|
exports.localizeProperties = localizeProperties;
|
|
115
|
+
const localizeGroup = (t, element) => ({
|
|
116
|
+
name: t(`ui.groups.${element.ui.group}.name`, { fallback: true }),
|
|
117
|
+
description: t(`ui.groups.${element.ui.group}.description`),
|
|
118
|
+
});
|
|
119
|
+
exports.localizeGroup = localizeGroup;
|
|
115
120
|
const localizeConnectable = (t, element, type) => {
|
|
116
121
|
const response = [];
|
|
117
122
|
if (element[type] && element[type].length > 0) {
|
package/package.json
CHANGED
package/src/entities/commons.ts
CHANGED
|
@@ -31,7 +31,8 @@ export type Common<Config extends CommonConfig = {}> = {
|
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
export const idSchema = () =>
|
|
34
|
-
Joi.string().required().regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/)
|
|
34
|
+
Joi.string().required().regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/)
|
|
35
|
+
.invalid(`ui`);
|
|
35
36
|
|
|
36
37
|
export const commonSchema = () =>
|
|
37
38
|
Joi.object({
|
package/src/entities/events.ts
CHANGED
|
@@ -37,7 +37,14 @@ type EventConfig = Pick<CoreConfig, `credentials` | `outputs`> & {
|
|
|
37
37
|
|
|
38
38
|
type CommonEvents<Config extends EventConfig = {}> = Common<Config> & {
|
|
39
39
|
model: `event`,
|
|
40
|
-
|
|
40
|
+
categorization: {
|
|
41
|
+
department: string,
|
|
42
|
+
category: string,
|
|
43
|
+
},
|
|
44
|
+
ui: {
|
|
45
|
+
group: string,
|
|
46
|
+
icon?: string,
|
|
47
|
+
},
|
|
41
48
|
credentials: string[],
|
|
42
49
|
sandbox: boolean,
|
|
43
50
|
fields: Field[],
|
|
@@ -143,7 +150,14 @@ const additionalConnectableEventSchema = () =>
|
|
|
143
150
|
const commonEventsSchema = () =>
|
|
144
151
|
Joi.object({
|
|
145
152
|
model: Joi.valid(`event`).required(),
|
|
146
|
-
|
|
153
|
+
categorization: Joi.object({
|
|
154
|
+
department: Joi.string().required(),
|
|
155
|
+
category: Joi.string().required(),
|
|
156
|
+
}).required(),
|
|
157
|
+
ui: Joi.object({
|
|
158
|
+
group: Joi.string().required(),
|
|
159
|
+
icon: Joi.string(),
|
|
160
|
+
}).required(),
|
|
147
161
|
credentials: Joi.array().items(idSchema().optional()).required().min(0),
|
|
148
162
|
sandbox: Joi.bool().required(),
|
|
149
163
|
fields: fieldsSchema().required(),
|
package/src/entities/provider.ts
CHANGED
|
@@ -7,18 +7,16 @@ import { Source, sourceSchema } from "./source";
|
|
|
7
7
|
export type Provider = {
|
|
8
8
|
id: string,
|
|
9
9
|
model: `provider`,
|
|
10
|
-
categories: string[],
|
|
11
10
|
credentials: Record<string, Credentials>,
|
|
12
11
|
triggers: Record<string, Trigger>,
|
|
13
12
|
actions: Record<string, Action>,
|
|
14
|
-
sources
|
|
13
|
+
sources: Record<string, Source>,
|
|
15
14
|
};
|
|
16
15
|
|
|
17
16
|
export const providerSchema = () =>
|
|
18
17
|
Joi.object({
|
|
19
18
|
id: idSchema(),
|
|
20
19
|
model: Joi.valid(`provider`).required(),
|
|
21
|
-
categories: Joi.array().items(Joi.string()).min(1).required(),
|
|
22
20
|
credentials: Joi.object()
|
|
23
21
|
.pattern(idSchema(), credentialsSchema())
|
|
24
22
|
.required(),
|
|
@@ -29,5 +27,6 @@ export const providerSchema = () =>
|
|
|
29
27
|
.pattern(idSchema(), actionSchema())
|
|
30
28
|
.required(),
|
|
31
29
|
sources: Joi.object()
|
|
32
|
-
.pattern(idSchema(), sourceSchema())
|
|
30
|
+
.pattern(idSchema(), sourceSchema())
|
|
31
|
+
.required(),
|
|
33
32
|
});
|
package/src/index.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
export { Core, core } from './core';
|
|
2
|
-
export { getCategories } from './entities/category';
|
|
3
2
|
export { CoreFunction, idSchema } from './entities/commons';
|
|
4
3
|
export { Credentials, credentialsSchema, OAuthCredentials, oauthCredentialsSchema, SessionCredentials, sessionCredentialsSchema, StaticCredentials, staticCredentialsSchema } from './entities/credentials';
|
|
5
4
|
export { Action, actionOutputSchema, actionSchema, Event, eventSchema, ImmediateTrigger, immediateTriggerSchema, Request, ScheduledTrigger, scheduledTriggerSchema, Trigger, triggerOutputSchema, triggerSchema } from './entities/events';
|
|
6
5
|
export { Provider, providerSchema } from './entities/provider';
|
|
7
6
|
export { Source } from './entities/source';
|
|
8
7
|
export { extract, Field, fieldSchema, fieldsSchema, SelectFieldChoice, validate, ValidationResult } from './minified-utils/fields';
|
|
9
|
-
export { i18n, localizeFields, localizeInputs, localizeOutputs, localizeProperties
|
|
8
|
+
export { i18n, LocalizedField, LocalizedProperties, localizeFields, localizeGroup, localizeInputs, localizeOutputs, localizeProperties } from './minified-utils/locales';
|
|
10
9
|
export { Properties } from './minified-utils/properties';
|
|
11
10
|
export { Protocol } from './minified-utils/protocol';
|
|
@@ -157,6 +157,14 @@ export const localizeProperties = (
|
|
|
157
157
|
description: t(`${element.id}.description`),
|
|
158
158
|
});
|
|
159
159
|
|
|
160
|
+
export const localizeGroup = (
|
|
161
|
+
t: ReturnType<typeof i18n>[`t`],
|
|
162
|
+
element: Action | Trigger,
|
|
163
|
+
): LocalizedProperties => ({
|
|
164
|
+
name: t(`ui.groups.${element.ui.group}.name`, { fallback: true }),
|
|
165
|
+
description: t(`ui.groups.${element.ui.group}.description`),
|
|
166
|
+
});
|
|
167
|
+
|
|
160
168
|
const localizeConnectable = (
|
|
161
169
|
t: ReturnType<typeof i18n>[`t`],
|
|
162
170
|
element: Action | Trigger,
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const getCategories: () => Promise<string[]>;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getCategories = void 0;
|
|
7
|
-
const axios_1 = __importDefault(require("axios"));
|
|
8
|
-
const getCategories = async () => {
|
|
9
|
-
try {
|
|
10
|
-
const { data } = await axios_1.default.get(`https://dev-beseif.s3.eu-west-1.amazonaws.com/prow/categories.txt`);
|
|
11
|
-
if (!data || typeof data !== `string`) {
|
|
12
|
-
throw new Error(`Could not obtain category list`);
|
|
13
|
-
}
|
|
14
|
-
return data.split(`\n`).map((d) => d.trim()).filter((d) => d);
|
|
15
|
-
}
|
|
16
|
-
catch (e) {
|
|
17
|
-
throw e;
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
exports.getCategories = getCategories;
|
package/src/entities/category.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import axios from "axios";
|
|
2
|
-
|
|
3
|
-
export const getCategories = async (): Promise<string[]> => {
|
|
4
|
-
try {
|
|
5
|
-
const { data } = await axios.get(`https://dev-beseif.s3.eu-west-1.amazonaws.com/prow/categories.txt`);
|
|
6
|
-
if (!data || typeof data !== `string`) { throw new Error(`Could not obtain category list`); }
|
|
7
|
-
return data.split(`\n`).map((d) => d.trim()).filter((d) => d);
|
|
8
|
-
} catch (e) { throw e; }
|
|
9
|
-
};
|