ironflock 1.3.2 → 1.3.3
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/README.md +36 -0
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +37 -0
- package/dist/index.mjs +378 -354
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -70,6 +70,16 @@ export declare type Details = {
|
|
|
70
70
|
caller_authrole: string;
|
|
71
71
|
};
|
|
72
72
|
|
|
73
|
+
/**
|
|
74
|
+
* Name of the per-databackend system error table. Apps report errors into it via
|
|
75
|
+
* {@link IronFlock.reportError}; it behaves like any normal table, so it can be
|
|
76
|
+
* queried (getHistory) and streamed (subscribeToTable) and used in board-templates.
|
|
77
|
+
*/
|
|
78
|
+
export declare const ERROR_LOGS_TABLE = "error-logs";
|
|
79
|
+
|
|
80
|
+
/** Severity level recorded alongside a reported error. */
|
|
81
|
+
export declare type ErrorLevel = "error" | "warn" | "info" | "debug";
|
|
82
|
+
|
|
73
83
|
export declare class IronFlock {
|
|
74
84
|
private _connection;
|
|
75
85
|
private _serialNumber;
|
|
@@ -90,6 +100,21 @@ export declare class IronFlock {
|
|
|
90
100
|
stop(): Promise<void>;
|
|
91
101
|
publish(topic: string, args?: unknown[], kwargs?: Record<string, unknown>): Promise<unknown>;
|
|
92
102
|
publishToTable(tablename: string, args?: unknown[], kwargs?: Record<string, unknown>): Promise<unknown>;
|
|
103
|
+
/**
|
|
104
|
+
* Reports an application error into the databackend's `error-logs` table.
|
|
105
|
+
*
|
|
106
|
+
* This is a thin convenience wrapper over {@link publishToTable} /
|
|
107
|
+
* {@link appendToTable}: it stamps the row with `source: "app"`, a severity
|
|
108
|
+
* `level`, and a timestamp, then writes it like any normal table row. The error
|
|
109
|
+
* therefore lands in the same `error-logs` table that fleetdb system errors use
|
|
110
|
+
* (tagged `source: "system"`), and is delivered in realtime on
|
|
111
|
+
* `transformed.error-logs` — the channel board-templates consume — without
|
|
112
|
+
* touching the platform error-toast channel (`databackend.errors.*`).
|
|
113
|
+
*
|
|
114
|
+
* @param error An error message, or an Error whose stack/message is recorded.
|
|
115
|
+
* @param opts Optional level (default "error"), append flag, and tsp override.
|
|
116
|
+
*/
|
|
117
|
+
reportError(error: string | Error, opts?: ReportErrorOptions): Promise<unknown>;
|
|
93
118
|
appendToTable(tablename: string, args?: unknown[], kwargs?: Record<string, unknown>): Promise<unknown>;
|
|
94
119
|
/**
|
|
95
120
|
* Publishes many rows in a single message (bulk insert) to the dedicated topic
|
|
@@ -167,6 +192,18 @@ export declare interface PublishParams {
|
|
|
167
192
|
kwargs?: Record<string, unknown>;
|
|
168
193
|
}
|
|
169
194
|
|
|
195
|
+
export declare interface ReportErrorOptions {
|
|
196
|
+
/** Severity level. Defaults to "error". */
|
|
197
|
+
level?: ErrorLevel;
|
|
198
|
+
/**
|
|
199
|
+
* When true, use the RPC append path (resolves with the insert outcome).
|
|
200
|
+
* Defaults to false: fire-and-forget publish, matching typical logging.
|
|
201
|
+
*/
|
|
202
|
+
append?: boolean;
|
|
203
|
+
/** ISO-8601 timestamp override. Defaults to the current time. */
|
|
204
|
+
tsp?: string;
|
|
205
|
+
}
|
|
206
|
+
|
|
170
207
|
export declare interface SQLFilterAnd {
|
|
171
208
|
column: string & tags.MinLength<1>;
|
|
172
209
|
operator: string & tags.MinLength<1>;
|