@kwirthmagnify/kwirth-common-back 0.5.52 → 0.5.53
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/IExtension.d.ts +18 -0
- package/dist/IProvider.d.ts +5 -11
- package/dist/ISender.d.ts +13 -1
- package/package.json +1 -1
package/dist/IExtension.d.ts
CHANGED
|
@@ -1,4 +1,22 @@
|
|
|
1
1
|
import { IExtensionExportOptions, IExtensionImportResult } from '@kwirthmagnify/kwirth-common';
|
|
2
|
+
/**
|
|
3
|
+
* What an extension writes its log with. The core builds it knowing who the extension is, so the
|
|
4
|
+
* line comes out identified — '[prov] [ERRO] [longhorn] ...' — and the extension only writes the
|
|
5
|
+
* message.
|
|
6
|
+
*
|
|
7
|
+
* It lives here, and not next to one family's contract, because the need is the same for all of
|
|
8
|
+
* them: before this, anything that was not a channel had only `console.log`, which comes out with no
|
|
9
|
+
* timestamp, no level and no component, and turns a failure into something that reads like a routine
|
|
10
|
+
* trace.
|
|
11
|
+
*
|
|
12
|
+
* Three levels and no more. An `info` nobody can filter out is what buries a log, and a failure that
|
|
13
|
+
* goes out as `info` is a failure nobody sees.
|
|
14
|
+
*/
|
|
15
|
+
export interface IExtensionLogger {
|
|
16
|
+
info(message: unknown): void;
|
|
17
|
+
warning(message: unknown): void;
|
|
18
|
+
error(message: unknown): void;
|
|
19
|
+
}
|
|
2
20
|
export interface IExtension {
|
|
3
21
|
exportConfig?(options: IExtensionExportOptions): Promise<unknown>;
|
|
4
22
|
importConfig?(config: unknown): Promise<IExtensionImportResult>;
|
package/dist/IProvider.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { KwirthData, IConfigFieldDef } from '@kwirthmagnify/kwirth-common';
|
|
2
|
-
import { IExtension } from './IExtension';
|
|
2
|
+
import { IExtension, IExtensionLogger } from './IExtension';
|
|
3
3
|
/**
|
|
4
4
|
* Minimal interface representing the channel side that providers interact with.
|
|
5
5
|
* Providers only need to call processProviderEvent on their subscribers.
|
|
@@ -119,17 +119,11 @@ export interface IProviderStats {
|
|
|
119
119
|
errors?: number;
|
|
120
120
|
}
|
|
121
121
|
/**
|
|
122
|
-
* What a provider writes its log with.
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
* Three levels and no more: an 'info' that nobody can filter out is what buries a log, and a failure
|
|
126
|
-
* that goes out as 'info' is a failure nobody sees.
|
|
122
|
+
* What a provider writes its log with. It is the common extension logger — the need turned out to be
|
|
123
|
+
* the same for senders, so it lives in IExtension. Kept as a name of its own because it is already
|
|
124
|
+
* published and providers compile against it.
|
|
127
125
|
*/
|
|
128
|
-
export
|
|
129
|
-
info(message: unknown): void;
|
|
130
|
-
warning(message: unknown): void;
|
|
131
|
-
error(message: unknown): void;
|
|
132
|
-
}
|
|
126
|
+
export type IProviderLogger = IExtensionLogger;
|
|
133
127
|
/**
|
|
134
128
|
* Interface that all provider plugins must implement.
|
|
135
129
|
* Use 'any' for clusterInfo to avoid pulling in kubernetes/docker dependencies.
|
package/dist/ISender.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ISenderMessage, ISenderConfig, ISenderAccess, ISenderStoredConfig, ISenderResult, TConfigFieldType, IConfigFieldDef, IExtensionNodeMeta } from '@kwirthmagnify/kwirth-common';
|
|
2
|
-
import { IExtension } from './IExtension';
|
|
2
|
+
import { IExtension, IExtensionLogger } from './IExtension';
|
|
3
3
|
export { ISenderMessage, ISenderConfig, ISenderAccess, ISenderStoredConfig, ISenderResult };
|
|
4
4
|
/** @deprecated usa TConfigFieldType, comun a todas las extensiones. */
|
|
5
5
|
export type SenderFieldType = TConfigFieldType;
|
|
@@ -17,6 +17,18 @@ export interface ISender extends IExtension {
|
|
|
17
17
|
getConfigSchema?(): ISenderFieldDef[];
|
|
18
18
|
getNodeMeta?(): ISenderNodeMeta;
|
|
19
19
|
send(configName: string, message: ISenderMessage): Promise<ISenderResult | void>;
|
|
20
|
+
/**
|
|
21
|
+
* The core hands the sender a logger that already knows who it is, as soon as it builds it.
|
|
22
|
+
*
|
|
23
|
+
* OPTIONAL and read defensively, like the rest: a sender that does not implement it keeps writing
|
|
24
|
+
* wherever it was writing, and an older core that never calls it leaves the sender on its own
|
|
25
|
+
* fallback.
|
|
26
|
+
*
|
|
27
|
+
* ⚠️ This is for what the sender says ABOUT ITSELF — a delivery that failed, a configuration it
|
|
28
|
+
* could not read. It is not the place for what it delivers: a sender's job is to put a message
|
|
29
|
+
* somewhere, and that somewhere is decided by its configuration, not by this.
|
|
30
|
+
*/
|
|
31
|
+
setLogger?(logger: IExtensionLogger): void;
|
|
20
32
|
sendBatch?(configName: string, messages: ISenderMessage[]): Promise<ISenderResult | void>;
|
|
21
33
|
fetchStatus?(configName: string, externalId: string): Promise<string | undefined>;
|
|
22
34
|
evalFilter?(configName: string, message: ISenderMessage, forward: () => Promise<void>): Promise<void>;
|