@kwirthmagnify/kwirth-common-back 0.5.26 → 0.5.28

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.
@@ -1,4 +1,4 @@
1
- import { ISenderAccess, IUserInfo } from '@kwirthmagnify/kwirth-common';
1
+ import { ISenderAccess, IWebhookAccess, IUserInfo } from '@kwirthmagnify/kwirth-common';
2
2
  export interface IBackChannelObject {
3
3
  writeStorage?(id: string, secret: boolean, data: any): Promise<void>;
4
4
  readStorage?(id: string, secret: boolean): Promise<any>;
@@ -11,4 +11,5 @@ export interface IBackChannelObject {
11
11
  getUsers?(): Promise<IUserInfo[]>;
12
12
  getPluginConfig?(pluginId: string): Promise<Record<string, unknown>>;
13
13
  senders?: ISenderAccess;
14
+ webhooks?: IWebhookAccess;
14
15
  }
@@ -0,0 +1,30 @@
1
+ import { IWebhookEvent, IWebhookConfig, IWebhookAccess, IWebhookConsumer, IWebhookStoredConfig } from '@kwirthmagnify/kwirth-common';
2
+ export { IWebhookEvent, IWebhookConfig, IWebhookAccess, IWebhookConsumer, IWebhookStoredConfig };
3
+ export type WebhookFieldType = 'text' | 'number' | 'boolean' | 'password' | 'select' | 'json';
4
+ export interface IWebhookFieldDef {
5
+ name: string;
6
+ label: string;
7
+ type?: WebhookFieldType;
8
+ required?: boolean;
9
+ options?: string[];
10
+ common?: boolean;
11
+ }
12
+ export interface IWebhookNodeMeta {
13
+ label: string;
14
+ icon?: string;
15
+ description?: string;
16
+ }
17
+ export interface IWebhook {
18
+ readonly id: string;
19
+ verify(rawBody: Buffer, headers: Record<string, string | string[] | undefined>, config: IWebhookConfig): boolean;
20
+ parse(rawBody: Buffer, headers: Record<string, string | string[] | undefined>): IWebhookEvent | null;
21
+ addConfig(config: IWebhookConfig): void;
22
+ removeConfig(name: string): void;
23
+ hasConfig(name: string): boolean;
24
+ getConfigNames(): string[];
25
+ getConfigSchema?(): IWebhookFieldDef[];
26
+ getNodeMeta?(): IWebhookNodeMeta;
27
+ startWebhook?(access: IWebhookAccess): Promise<void>;
28
+ stopWebhook?(): Promise<void>;
29
+ }
30
+ export type TWebhookConstructor = new () => IWebhook;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/dist/index.d.ts CHANGED
@@ -2,6 +2,7 @@ export * from './IBackChannelObject';
2
2
  export * from './IChannel';
3
3
  export * from './IProvider';
4
4
  export * from './ISender';
5
+ export * from './IWebhook';
5
6
  export * from './IIdpConnector';
6
7
  export * from './oidc';
7
8
  export * from './oauth2';
package/dist/index.js CHANGED
@@ -18,6 +18,7 @@ __exportStar(require("./IBackChannelObject"), exports);
18
18
  __exportStar(require("./IChannel"), exports);
19
19
  __exportStar(require("./IProvider"), exports);
20
20
  __exportStar(require("./ISender"), exports);
21
+ __exportStar(require("./IWebhook"), exports);
21
22
  __exportStar(require("./IIdpConnector"), exports);
22
23
  __exportStar(require("./oidc"), exports);
23
24
  __exportStar(require("./oauth2"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kwirthmagnify/kwirth-common-back",
3
- "version": "0.5.26",
3
+ "version": "0.5.28",
4
4
  "description": "Backend interfaces for building Kwirth provider and channel plugins",
5
5
  "scripts": {
6
6
  "build": "tsc",
@@ -26,7 +26,7 @@
26
26
  "license": "ISC",
27
27
  "dependencies": {
28
28
  "@kubernetes/client-node": "^1.4.0",
29
- "@kwirthmagnify/kwirth-common": "^0.5.33",
29
+ "@kwirthmagnify/kwirth-common": "^0.5.34",
30
30
  "express": "^4.18.0",
31
31
  "js-yaml": "^4.1.0",
32
32
  "openid-client": "^5.7.0"