@kwirthmagnify/kwirth-common-back 0.5.23 → 0.5.25

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.
@@ -0,0 +1,14 @@
1
+ import { ISenderAccess, IUserInfo } from '@kwirthmagnify/kwirth-common';
2
+ export interface IBackChannelObject {
3
+ writeStorage?(id: string, secret: boolean, data: any): Promise<void>;
4
+ readStorage?(id: string, secret: boolean): Promise<any>;
5
+ writeStorageCommon?(id: string, secret: boolean, data: any): Promise<void>;
6
+ readStorageCommon?(id: string, secret: boolean): Promise<any>;
7
+ logInfo?(message: unknown): void;
8
+ logTrace?(message: unknown): void;
9
+ logWarning?(message: unknown): void;
10
+ logError?(message: unknown): void;
11
+ getUsers?(): Promise<IUserInfo[]>;
12
+ getPluginConfig?(pluginId: string): Promise<Record<string, unknown>>;
13
+ senders?: ISenderAccess;
14
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -7,4 +7,10 @@ export interface ICrdInformerHandlers {
7
7
  onError?: (err: any) => void;
8
8
  }
9
9
  export declare function createCrdInformer(clusterInfo: any, apiGroup: string, apiVersion: string, plural: string, handlers: ICrdInformerHandlers): any;
10
+ /** Informer genérico para CUALQUIER recurso (core o grupo): el llamante aporta el `watchPath` (p.ej.
11
+ * '/api/v1/services', '/apis/networking.k8s.io/v1/ingresses') y la `listFn` que devuelve {items}.
12
+ * Reutilizado por createCrdInformer y por consumidores de recursos core (p.ej. exposure). */
13
+ export declare function createInformer(clusterInfo: any, watchPath: string, listFn: () => Promise<{
14
+ items: any[];
15
+ }>, handlers: ICrdInformerHandlers): any;
10
16
  export declare function restartController(kind: string, namespace: string, name: string, clusterInfo: any): Promise<void>;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.applyAllResources = applyAllResources;
4
4
  exports.deleteAllResources = deleteAllResources;
5
5
  exports.createCrdInformer = createCrdInformer;
6
+ exports.createInformer = createInformer;
6
7
  exports.restartController = restartController;
7
8
  const jsYaml = require('js-yaml');
8
9
  const k8s = require('@kubernetes/client-node');
@@ -124,7 +125,13 @@ function createCrdInformer(clusterInfo, apiGroup, apiVersion, plural, handlers)
124
125
  const path = `/apis/${apiGroup}/${apiVersion}/${plural}`;
125
126
  const listFunction = () => clusterInfo.crdApi.listCustomObjectForAllNamespaces({ group: apiGroup, version: apiVersion, plural })
126
127
  .then((res) => res);
127
- const informer = k8s.makeInformer(clusterInfo.kubeConfig, path, listFunction);
128
+ return createInformer(clusterInfo, path, listFunction, handlers);
129
+ }
130
+ /** Informer genérico para CUALQUIER recurso (core o grupo): el llamante aporta el `watchPath` (p.ej.
131
+ * '/api/v1/services', '/apis/networking.k8s.io/v1/ingresses') y la `listFn` que devuelve {items}.
132
+ * Reutilizado por createCrdInformer y por consumidores de recursos core (p.ej. exposure). */
133
+ function createInformer(clusterInfo, watchPath, listFn, handlers) {
134
+ const informer = k8s.makeInformer(clusterInfo.kubeConfig, watchPath, listFn);
128
135
  if (handlers.onAdd)
129
136
  informer.on('add', handlers.onAdd);
130
137
  if (handlers.onUpdate)
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export * from './IBackChannelObject';
1
2
  export * from './IChannel';
2
3
  export * from './IProvider';
3
4
  export * from './ISender';
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("./IBackChannelObject"), exports);
17
18
  __exportStar(require("./IChannel"), exports);
18
19
  __exportStar(require("./IProvider"), exports);
19
20
  __exportStar(require("./ISender"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kwirthmagnify/kwirth-common-back",
3
- "version": "0.5.23",
3
+ "version": "0.5.25",
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.24",
29
+ "@kwirthmagnify/kwirth-common": "^0.5.25",
30
30
  "express": "^4.18.0",
31
31
  "js-yaml": "^4.1.0",
32
32
  "openid-client": "^5.7.0"