@mihari/logger-types 0.1.0
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/LICENSE +21 -0
- package/README.md +24 -0
- package/dist/index.d.ts +43 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -0
- package/package.json +25 -0
- package/src/index.ts +49 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Mihari Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# @mihari/logger-types
|
|
2
|
+
|
|
3
|
+
Shared TypeScript type definitions for the mihari log collection library.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @mihari/logger-types
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Exports
|
|
12
|
+
|
|
13
|
+
- `LogLevel` - Enum: debug, info, warn, error, fatal
|
|
14
|
+
- `LogEntry` - Log entry with dt, level, message, and extra metadata
|
|
15
|
+
- `MihariConfig` - Configuration for mihari clients
|
|
16
|
+
- `TransportOptions` - HTTP transport configuration
|
|
17
|
+
- `BatchOptions` - Batching configuration
|
|
18
|
+
- `TransportResponse` - Successful API response shape
|
|
19
|
+
- `TransportError` - Error API response shape
|
|
20
|
+
- `CompressFn` - Compression function signature
|
|
21
|
+
|
|
22
|
+
## License
|
|
23
|
+
|
|
24
|
+
MIT
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export declare enum LogLevel {
|
|
2
|
+
Debug = "debug",
|
|
3
|
+
Info = "info",
|
|
4
|
+
Warn = "warn",
|
|
5
|
+
Error = "error",
|
|
6
|
+
Fatal = "fatal"
|
|
7
|
+
}
|
|
8
|
+
export interface LogEntry {
|
|
9
|
+
readonly dt: string;
|
|
10
|
+
readonly level: LogLevel;
|
|
11
|
+
readonly message: string;
|
|
12
|
+
readonly [key: string]: unknown;
|
|
13
|
+
}
|
|
14
|
+
export interface MihariConfig {
|
|
15
|
+
readonly token: string;
|
|
16
|
+
readonly endpoint: string;
|
|
17
|
+
readonly batchSize?: number;
|
|
18
|
+
readonly flushInterval?: number;
|
|
19
|
+
readonly maxQueueSize?: number;
|
|
20
|
+
readonly compression?: boolean;
|
|
21
|
+
readonly retries?: number;
|
|
22
|
+
readonly metadata?: Record<string, unknown>;
|
|
23
|
+
}
|
|
24
|
+
export interface TransportOptions {
|
|
25
|
+
readonly token: string;
|
|
26
|
+
readonly endpoint: string;
|
|
27
|
+
readonly compression?: boolean;
|
|
28
|
+
readonly retries?: number;
|
|
29
|
+
}
|
|
30
|
+
export interface BatchOptions {
|
|
31
|
+
readonly batchSize?: number;
|
|
32
|
+
readonly flushInterval?: number;
|
|
33
|
+
readonly maxQueueSize?: number;
|
|
34
|
+
}
|
|
35
|
+
export interface TransportResponse {
|
|
36
|
+
readonly status: "accepted";
|
|
37
|
+
readonly count: number;
|
|
38
|
+
}
|
|
39
|
+
export interface TransportError {
|
|
40
|
+
readonly error: string;
|
|
41
|
+
}
|
|
42
|
+
export type CompressFn = (data: Uint8Array) => Promise<Uint8Array>;
|
|
43
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,oBAAY,QAAQ;IAClB,KAAK,UAAU;IACf,IAAI,SAAS;IACb,IAAI,SAAS;IACb,KAAK,UAAU;IACf,KAAK,UAAU;CAChB;AAED,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACjC;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;IAC/B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC7C;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;IAC/B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;CAChC;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,MAAM,UAAU,GAAG,CAAC,IAAI,EAAE,UAAU,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LogLevel = void 0;
|
|
4
|
+
var LogLevel;
|
|
5
|
+
(function (LogLevel) {
|
|
6
|
+
LogLevel["Debug"] = "debug";
|
|
7
|
+
LogLevel["Info"] = "info";
|
|
8
|
+
LogLevel["Warn"] = "warn";
|
|
9
|
+
LogLevel["Error"] = "error";
|
|
10
|
+
LogLevel["Fatal"] = "fatal";
|
|
11
|
+
})(LogLevel || (exports.LogLevel = LogLevel = {}));
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,IAAY,QAMX;AAND,WAAY,QAAQ;IAClB,2BAAe,CAAA;IACf,yBAAa,CAAA;IACb,yBAAa,CAAA;IACb,2BAAe,CAAA;IACf,2BAAe,CAAA;AACjB,CAAC,EANW,QAAQ,wBAAR,QAAQ,QAMnB"}
|
package/package.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mihari/logger-types",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Shared TypeScript type definitions for mihari",
|
|
5
|
+
"main": "src/index.ts",
|
|
6
|
+
"types": "src/index.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "tsc",
|
|
12
|
+
"clean": "rm -rf dist",
|
|
13
|
+
"test": "cd ../.. && npx vitest run --config vitest.config.ts packages/types"
|
|
14
|
+
},
|
|
15
|
+
"publishConfig": {
|
|
16
|
+
"access": "public"
|
|
17
|
+
},
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "https://github.com/mihari/mihari-js",
|
|
22
|
+
"directory": "packages/types"
|
|
23
|
+
},
|
|
24
|
+
"gitHead": "dc10a3217caa819965eb3a1e2ff3901a16e510aa"
|
|
25
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export enum LogLevel {
|
|
2
|
+
Debug = "debug",
|
|
3
|
+
Info = "info",
|
|
4
|
+
Warn = "warn",
|
|
5
|
+
Error = "error",
|
|
6
|
+
Fatal = "fatal",
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface LogEntry {
|
|
10
|
+
readonly dt: string;
|
|
11
|
+
readonly level: LogLevel;
|
|
12
|
+
readonly message: string;
|
|
13
|
+
readonly [key: string]: unknown;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface MihariConfig {
|
|
17
|
+
readonly token: string;
|
|
18
|
+
readonly endpoint: string;
|
|
19
|
+
readonly batchSize?: number;
|
|
20
|
+
readonly flushInterval?: number;
|
|
21
|
+
readonly maxQueueSize?: number;
|
|
22
|
+
readonly compression?: boolean;
|
|
23
|
+
readonly retries?: number;
|
|
24
|
+
readonly metadata?: Record<string, unknown>;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface TransportOptions {
|
|
28
|
+
readonly token: string;
|
|
29
|
+
readonly endpoint: string;
|
|
30
|
+
readonly compression?: boolean;
|
|
31
|
+
readonly retries?: number;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface BatchOptions {
|
|
35
|
+
readonly batchSize?: number;
|
|
36
|
+
readonly flushInterval?: number;
|
|
37
|
+
readonly maxQueueSize?: number;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface TransportResponse {
|
|
41
|
+
readonly status: "accepted";
|
|
42
|
+
readonly count: number;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface TransportError {
|
|
46
|
+
readonly error: string;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export type CompressFn = (data: Uint8Array) => Promise<Uint8Array>;
|