@kwirthmagnify/kwirth-common-back 0.5.35 → 0.5.37

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.
@@ -6,6 +6,17 @@ import { KwirthData } from '@kwirthmagnify/kwirth-common';
6
6
  export interface IProviderSubscriber {
7
7
  processProviderEvent(providerId: string, obj: any): void;
8
8
  }
9
+ /**
10
+ * Persistencia que el core inyecta al provider (mismo mecanismo que reciben los canales).
11
+ * El booleano 'secret' decide el destino: true -> Secret de Kubernetes, false -> ConfigMap.
12
+ * Las variantes 'Common' escriben en el almacen compartido entre extensiones.
13
+ */
14
+ export interface IProviderStorage {
15
+ writeStorage(id: string, secret: boolean, data: any): Promise<void>;
16
+ readStorage(id: string, secret: boolean): Promise<any>;
17
+ writeStorageCommon(id: string, secret: boolean, data: any): Promise<void>;
18
+ readStorageCommon(id: string, secret: boolean): Promise<any>;
19
+ }
9
20
  /**
10
21
  * Interface that all provider plugins must implement.
11
22
  * Use 'any' for clusterInfo to avoid pulling in kubernetes/docker dependencies.
@@ -17,11 +28,23 @@ export interface IProvider {
17
28
  addSubscriber(c: IProviderSubscriber, data: any): Promise<void>;
18
29
  removeSubscriber(c: IProviderSubscriber): Promise<void>;
19
30
  updateSubscription?(c: IProviderSubscriber, data: any): Promise<void>;
31
+ /**
32
+ * @deprecated El core deja de alimentar este metodo: un provider es dueño de su propia
33
+ * configuracion y la sirve por 'configRouter'. Se mantiene por compatibilidad con providers
34
+ * de terceros que aun usen la config gestionada por el core.
35
+ */
20
36
  configure?(config: Record<string, unknown>): void;
21
37
  startProvider(): Promise<void>;
22
38
  stopProvider(): Promise<void>;
23
39
  router: any;
24
40
  routerAlias: string | undefined;
41
+ /**
42
+ * Router de gestion del provider (su propia configuracion). El core lo monta SIEMPRE detras de
43
+ * validacion de accessKey, igual que hace con los endpoints de un canal, en la ruta
44
+ * '/core/providerconfig/<providerId>'. Es una via distinta de 'router', que es publica y puede
45
+ * recibir trafico externo (OTLP, POSTs de terceros) y por tanto no puede exigir accessKey.
46
+ */
47
+ configRouter?: any;
25
48
  apiKeyApi: any | undefined;
26
49
  }
27
- export type TProviderConstructor = new (clusterInfo: any, kwirthData: KwirthData) => IProvider;
50
+ export type TProviderConstructor = new (clusterInfo: any, kwirthData: KwirthData, storage?: IProviderStorage) => IProvider;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kwirthmagnify/kwirth-common-back",
3
- "version": "0.5.35",
3
+ "version": "0.5.37",
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.42",
29
+ "@kwirthmagnify/kwirth-common": "^0.5.43",
30
30
  "express": "^4.18.0",
31
31
  "js-yaml": "^4.1.0",
32
32
  "openid-client": "^5.7.0"
package/dist/IDaemon.d.ts DELETED
@@ -1,21 +0,0 @@
1
- import { IDaemonInstanceConfig, BackDaemonData, IBackDaemonRequirements } from '@kwirthmagnify/kwirth-common';
2
- export interface IDaemon {
3
- readonly daemonId: string;
4
- readonly requirements: IBackDaemonRequirements;
5
- readonly providesRouter?: boolean;
6
- router?: any;
7
- routerAlias?: string;
8
- getDaemonData(): BackDaemonData;
9
- startDaemon(): Promise<void>;
10
- initInstance?(instanceConfig: IDaemonInstanceConfig): Promise<void>;
11
- addObject(instanceConfig: IDaemonInstanceConfig, podNamespace: string, podName: string, containerName: string): Promise<boolean>;
12
- deleteObject(instanceConfig: IDaemonInstanceConfig, podNamespace: string, podName: string, containerName: string): Promise<boolean>;
13
- containsInstance(instanceId: string): boolean;
14
- containsAsset(instanceId: string, podNamespace: string, podName: string, containerName: string): boolean;
15
- stopInstance(instanceId: string): void;
16
- processProviderEvent(providerId: string, event: unknown): void;
17
- getProviderSubscriptionData?(providerId: string): unknown;
18
- processCommand(instanceId: string, command: string, data: unknown): Promise<unknown>;
19
- processDaemonCommand?(command: string, data: unknown): Promise<unknown>;
20
- subscribe(instanceId: string, callback: (event: unknown) => void): () => void;
21
- }
package/dist/IDaemon.js DELETED
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });