@kwirthmagnify/kwirth-common-back 0.5.40 → 0.5.41
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/IExtensionConfig.d.ts +28 -0
- package/dist/IExtensionConfig.js +38 -0
- package/dist/IIdpConnector.d.ts +4 -8
- package/dist/ILogin.d.ts +5 -8
- package/dist/IProvider.d.ts +22 -0
- package/dist/ISender.d.ts +7 -14
- package/dist/IWebhook.d.ts +7 -14
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/oauth2.js +4 -3
- package/dist/oidc.js +5 -4
- package/package.json +1 -1
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export declare enum EConfigFieldType {
|
|
2
|
+
TEXT = "text",
|
|
3
|
+
NUMBER = "number",
|
|
4
|
+
BOOLEAN = "boolean",
|
|
5
|
+
PASSWORD = "password",
|
|
6
|
+
SELECT = "select",
|
|
7
|
+
JSON = "json"
|
|
8
|
+
}
|
|
9
|
+
export interface IConfigFieldDef {
|
|
10
|
+
/** Clave con la que el valor se guarda en la configuracion. */
|
|
11
|
+
name: string;
|
|
12
|
+
/** Etiqueta que ve el usuario en el formulario. */
|
|
13
|
+
label: string;
|
|
14
|
+
/** Ausente = EConfigFieldType.TEXT. */
|
|
15
|
+
type?: EConfigFieldType;
|
|
16
|
+
required?: boolean;
|
|
17
|
+
/** Valores admitidos cuando 'type' es SELECT. Ignorado en el resto. */
|
|
18
|
+
options?: string[];
|
|
19
|
+
/** Valor con el que se precarga el campo mientras no haya nada guardado. */
|
|
20
|
+
default?: string | number | boolean;
|
|
21
|
+
/** El campo es comun a TODAS las configuraciones de la extension, no propio de cada una. */
|
|
22
|
+
common?: boolean;
|
|
23
|
+
}
|
|
24
|
+
export interface IExtensionNodeMeta {
|
|
25
|
+
label: string;
|
|
26
|
+
icon?: string;
|
|
27
|
+
description?: string;
|
|
28
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
Contrato COMUN de configuracion de extensiones.
|
|
4
|
+
|
|
5
|
+
Toda extension que publique un formulario de configuracion (senders, webhooks, conectores IdP,
|
|
6
|
+
logins y providers) describe sus campos con ESTE tipo. Antes cada familia tenia el suyo, casi
|
|
7
|
+
identico pero divergente: provider decia 'string' donde el resto decia 'text', solo el tenia
|
|
8
|
+
'default', solo sender y webhook tenian 'common', y su definicion ni siquiera vivia aqui (estaba
|
|
9
|
+
dentro del core, en back/src/tools/ProviderManager.ts).
|
|
10
|
+
|
|
11
|
+
OJO: no confundir EConfigFieldType (el tipo de UN CAMPO del formulario) con EExtensionType (el
|
|
12
|
+
tipo de la extension: provider, sender, plugin...), que vive en kwirth-common y es lo que declara
|
|
13
|
+
el package.json del artefacto.
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.EConfigFieldType = void 0;
|
|
17
|
+
/*
|
|
18
|
+
Tipo de un campo del formulario de configuracion.
|
|
19
|
+
|
|
20
|
+
Lo que hoy pinta el front para cada valor:
|
|
21
|
+
TEXT campo de texto. Es el comportamiento por defecto cuando 'type' se omite.
|
|
22
|
+
NUMBER campo numerico.
|
|
23
|
+
BOOLEAN switch. Los gestores de sender, webhook, idp y provider lo pintan; el de login no.
|
|
24
|
+
PASSWORD campo enmascarado con ojo de visibilidad.
|
|
25
|
+
SELECT desplegable alimentado por 'options'. Los gestores de sender, webhook y login lo
|
|
26
|
+
pintan; los de idp y provider no.
|
|
27
|
+
JSON area de texto libre para JSON. NINGUN gestor lo pinta todavia: hoy cae a campo de
|
|
28
|
+
texto. Declararlo es valido, pero no esperes editor estructurado.
|
|
29
|
+
*/
|
|
30
|
+
var EConfigFieldType;
|
|
31
|
+
(function (EConfigFieldType) {
|
|
32
|
+
EConfigFieldType["TEXT"] = "text";
|
|
33
|
+
EConfigFieldType["NUMBER"] = "number";
|
|
34
|
+
EConfigFieldType["BOOLEAN"] = "boolean";
|
|
35
|
+
EConfigFieldType["PASSWORD"] = "password";
|
|
36
|
+
EConfigFieldType["SELECT"] = "select";
|
|
37
|
+
EConfigFieldType["JSON"] = "json";
|
|
38
|
+
})(EConfigFieldType || (exports.EConfigFieldType = EConfigFieldType = {}));
|
package/dist/IIdpConnector.d.ts
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
|
+
import { EConfigFieldType, IConfigFieldDef } from './IExtensionConfig';
|
|
1
2
|
export declare enum EIdpConnectorKind {
|
|
2
3
|
OIDC = "oidc",
|
|
3
4
|
OAUTH2 = "oauth2"
|
|
4
5
|
}
|
|
5
|
-
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
label: string;
|
|
9
|
-
type?: IdpFieldType;
|
|
10
|
-
required?: boolean;
|
|
11
|
-
options?: string[];
|
|
12
|
-
}
|
|
6
|
+
/** @deprecated usa EConfigFieldType, comun a todas las extensiones. */
|
|
7
|
+
export type IdpFieldType = EConfigFieldType;
|
|
8
|
+
export type IIdpConfigFieldDef = IConfigFieldDef;
|
|
13
9
|
export interface IIdpIdentity {
|
|
14
10
|
email: string;
|
|
15
11
|
emailVerified: boolean;
|
package/dist/ILogin.d.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
required?: boolean;
|
|
7
|
-
options?: string[];
|
|
8
|
-
}
|
|
1
|
+
import { EConfigFieldType, IConfigFieldDef } from './IExtensionConfig';
|
|
2
|
+
/** @deprecated usa EConfigFieldType, comun a todas las extensiones. */
|
|
3
|
+
export type LoginFieldType = EConfigFieldType;
|
|
4
|
+
/** Campo de configuracion de un login. Es el contrato comun IConfigFieldDef, sin nada propio. */
|
|
5
|
+
export type ILoginFieldDef = IConfigFieldDef;
|
package/dist/IProvider.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { KwirthData } from '@kwirthmagnify/kwirth-common';
|
|
2
|
+
import { IConfigFieldDef } from './IExtensionConfig';
|
|
2
3
|
/**
|
|
3
4
|
* Minimal interface representing the channel side that providers interact with.
|
|
4
5
|
* Providers only need to call processProviderEvent on their subscribers.
|
|
@@ -44,6 +45,11 @@ export interface IProviderSubscriptionHelp {
|
|
|
44
45
|
/** Descripcion campo a campo. Opcional: solo para payloads planos. */
|
|
45
46
|
fields?: IProviderSubscriptionField[];
|
|
46
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* Un campo de la configuracion del PROPIO provider (no de la suscripcion). Es el contrato comun
|
|
50
|
+
* IConfigFieldDef, el mismo que usan senders, webhooks, idps y logins.
|
|
51
|
+
*/
|
|
52
|
+
export type IProviderFieldDef = IConfigFieldDef;
|
|
47
53
|
/**
|
|
48
54
|
* Interface that all provider plugins must implement.
|
|
49
55
|
* Use 'any' for clusterInfo to avoid pulling in kubernetes/docker dependencies.
|
|
@@ -67,6 +73,22 @@ export interface IProvider {
|
|
|
67
73
|
* payload escribir.
|
|
68
74
|
*/
|
|
69
75
|
getSubscriptionHelp?(): IProviderSubscriptionHelp;
|
|
76
|
+
/**
|
|
77
|
+
* Nombres de las configuraciones que el provider tiene definidas (equivalente a
|
|
78
|
+
* ISender.getConfigNames). OPCIONAL: solo tiene sentido en un provider que sea dueño de su
|
|
79
|
+
* configuracion. El gestor de extensiones lo usa para mostrar cuantas hay en la tarjeta, igual
|
|
80
|
+
* que hace con los senders. No expone valores, solo nombres.
|
|
81
|
+
*/
|
|
82
|
+
getConfigNames?(): string[];
|
|
83
|
+
/**
|
|
84
|
+
* Schema de configuracion del propio provider, con el que kwirth pinta un formulario generico.
|
|
85
|
+
* Es la forma ESTANDAR de declararlo, la misma que ISender.getConfigSchema e IWebhook.
|
|
86
|
+
*
|
|
87
|
+
* Un provider al que nadie se suscribe y que no expone router NO se instancia nunca, asi que en
|
|
88
|
+
* ese caso no hay a quien preguntarselo: para esos, exporta ademas una constante 'schema' con el
|
|
89
|
+
* mismo array desde el back.js, que el core lee al instalar sin instanciar nada.
|
|
90
|
+
*/
|
|
91
|
+
getConfigSchema?(): IProviderFieldDef[];
|
|
70
92
|
startProvider(): Promise<void>;
|
|
71
93
|
stopProvider(): Promise<void>;
|
|
72
94
|
router: any;
|
package/dist/ISender.d.ts
CHANGED
|
@@ -1,19 +1,12 @@
|
|
|
1
1
|
import { ISenderMessage, ISenderConfig, ISenderAccess, ISenderStoredConfig, ISenderResult } from '@kwirthmagnify/kwirth-common';
|
|
2
|
+
import { EConfigFieldType, IConfigFieldDef, IExtensionNodeMeta } from './IExtensionConfig';
|
|
2
3
|
export { ISenderMessage, ISenderConfig, ISenderAccess, ISenderStoredConfig, ISenderResult };
|
|
3
|
-
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
options?: string[];
|
|
10
|
-
common?: boolean;
|
|
11
|
-
}
|
|
12
|
-
export interface ISenderNodeMeta {
|
|
13
|
-
label: string;
|
|
14
|
-
icon?: string;
|
|
15
|
-
description?: string;
|
|
16
|
-
}
|
|
4
|
+
/** @deprecated usa EConfigFieldType, comun a todas las extensiones. */
|
|
5
|
+
export type SenderFieldType = EConfigFieldType;
|
|
6
|
+
/** Campo de configuracion de un sender. Es el contrato comun IConfigFieldDef, sin nada propio. */
|
|
7
|
+
export type ISenderFieldDef = IConfigFieldDef;
|
|
8
|
+
/** @deprecated usa IExtensionNodeMeta, comun a todas las extensiones. */
|
|
9
|
+
export type ISenderNodeMeta = IExtensionNodeMeta;
|
|
17
10
|
export interface ISender {
|
|
18
11
|
readonly id: string;
|
|
19
12
|
readonly senderType?: 'filter' | 'output';
|
package/dist/IWebhook.d.ts
CHANGED
|
@@ -1,19 +1,12 @@
|
|
|
1
1
|
import { IWebhookEvent, IWebhookConfig, IWebhookAccess, IWebhookConsumer, IWebhookStoredConfig } from '@kwirthmagnify/kwirth-common';
|
|
2
|
+
import { EConfigFieldType, IConfigFieldDef, IExtensionNodeMeta } from './IExtensionConfig';
|
|
2
3
|
export { IWebhookEvent, IWebhookConfig, IWebhookAccess, IWebhookConsumer, IWebhookStoredConfig };
|
|
3
|
-
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
options?: string[];
|
|
10
|
-
common?: boolean;
|
|
11
|
-
}
|
|
12
|
-
export interface IWebhookNodeMeta {
|
|
13
|
-
label: string;
|
|
14
|
-
icon?: string;
|
|
15
|
-
description?: string;
|
|
16
|
-
}
|
|
4
|
+
/** @deprecated usa EConfigFieldType, comun a todas las extensiones. */
|
|
5
|
+
export type WebhookFieldType = EConfigFieldType;
|
|
6
|
+
/** Campo de configuracion de un webhook. Es el contrato comun IConfigFieldDef, sin nada propio. */
|
|
7
|
+
export type IWebhookFieldDef = IConfigFieldDef;
|
|
8
|
+
/** @deprecated usa IExtensionNodeMeta, comun a todas las extensiones. */
|
|
9
|
+
export type IWebhookNodeMeta = IExtensionNodeMeta;
|
|
17
10
|
export interface IWebhook {
|
|
18
11
|
readonly id: string;
|
|
19
12
|
verify(rawBody: Buffer, headers: Record<string, string | string[] | undefined>, config: IWebhookConfig): boolean;
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./IExtensionConfig"), exports);
|
|
17
18
|
__exportStar(require("./IBackChannelObject"), exports);
|
|
18
19
|
__exportStar(require("./ILogin"), exports);
|
|
19
20
|
__exportStar(require("./IChannel"), exports);
|
package/dist/oauth2.js
CHANGED
|
@@ -3,12 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.oauth2ConfigSchema = oauth2ConfigSchema;
|
|
4
4
|
exports.oauth2BuildAuthorizationUrl = oauth2BuildAuthorizationUrl;
|
|
5
5
|
exports.oauth2HandleCallback = oauth2HandleCallback;
|
|
6
|
+
const IExtensionConfig_1 = require("./IExtensionConfig");
|
|
6
7
|
// esquema base de un IdP OAuth2 (el conector añade sus URLs si aplica; clientSecret 'password' → se enmascara)
|
|
7
8
|
function oauth2ConfigSchema() {
|
|
8
9
|
return [
|
|
9
|
-
{ name: 'clientId', label: 'Client ID', type:
|
|
10
|
-
{ name: 'clientSecret', label: 'Client Secret', type:
|
|
11
|
-
{ name: 'scopes', label: 'Scopes', type:
|
|
10
|
+
{ name: 'clientId', label: 'Client ID', type: IExtensionConfig_1.EConfigFieldType.TEXT, required: true },
|
|
11
|
+
{ name: 'clientSecret', label: 'Client Secret', type: IExtensionConfig_1.EConfigFieldType.PASSWORD, required: true },
|
|
12
|
+
{ name: 'scopes', label: 'Scopes', type: IExtensionConfig_1.EConfigFieldType.TEXT }
|
|
12
13
|
];
|
|
13
14
|
}
|
|
14
15
|
function oauth2BuildAuthorizationUrl(config, ctx, ep) {
|
package/dist/oidc.js
CHANGED
|
@@ -4,6 +4,7 @@ exports.oidcConfigSchema = oidcConfigSchema;
|
|
|
4
4
|
exports.oidcBuildAuthorizationUrl = oidcBuildAuthorizationUrl;
|
|
5
5
|
exports.oidcHandleCallback = oidcHandleCallback;
|
|
6
6
|
const openid_client_1 = require("openid-client");
|
|
7
|
+
const IExtensionConfig_1 = require("./IExtensionConfig");
|
|
7
8
|
/*
|
|
8
9
|
Lógica OIDC compartida por todos los conectores OIDC (Google, Keycloak, GitLab, Microsoft, ...).
|
|
9
10
|
Vive en common-back y el back la expone como global (__kwirth_back__.kwirthCommonBack), de modo
|
|
@@ -15,10 +16,10 @@ const openid_client_1 = require("openid-client");
|
|
|
15
16
|
// esquema de config estándar de un IdP OIDC (clientSecret es 'password' → se enmascara en la UI)
|
|
16
17
|
function oidcConfigSchema() {
|
|
17
18
|
return [
|
|
18
|
-
{ name: 'clientId', label: 'Client ID', type:
|
|
19
|
-
{ name: 'clientSecret', label: 'Client Secret', type:
|
|
20
|
-
{ name: 'scopes', label: 'Scopes', type:
|
|
21
|
-
{ name: 'issuer', label: 'Issuer URL', type:
|
|
19
|
+
{ name: 'clientId', label: 'Client ID', type: IExtensionConfig_1.EConfigFieldType.TEXT, required: true },
|
|
20
|
+
{ name: 'clientSecret', label: 'Client Secret', type: IExtensionConfig_1.EConfigFieldType.PASSWORD, required: true },
|
|
21
|
+
{ name: 'scopes', label: 'Scopes', type: IExtensionConfig_1.EConfigFieldType.TEXT },
|
|
22
|
+
{ name: 'issuer', label: 'Issuer URL', type: IExtensionConfig_1.EConfigFieldType.TEXT }
|
|
22
23
|
];
|
|
23
24
|
}
|
|
24
25
|
async function makeClient(config, redirectUri, defaultIssuer) {
|