@beseif-solutions/prow-core 0.0.33 → 0.0.34

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.
@@ -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
- category: string;
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[];
@@ -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
- category: joi_1.default.string().required(),
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?: Record<string, Source>;
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,5 +1,4 @@
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';
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.getCategories = exports.core = void 0;
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.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");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@beseif-solutions/prow-core",
3
- "version": "0.0.33",
3
+ "version": "0.0.34",
4
4
  "description": "Prow core functionalities and classes",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -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
- category: string,
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
- category: Joi.string().required(),
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(),
@@ -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?: Record<string, Source>,
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,5 +1,4 @@
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';
@@ -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;
@@ -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
- };