widelogger 0.1.2

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,40 @@
1
+ export type FieldValue = string | number | boolean;
2
+ declare const KeyError: unique symbol;
3
+ interface KeyErrorBrand {
4
+ [KeyError]: true;
5
+ }
6
+ type ValidateKey<T extends string> = T extends "" ? "widelog keys cannot be empty" & KeyErrorBrand : T extends `.${string}` ? "widelog keys cannot start with a dot" & KeyErrorBrand : T extends `${string}.` ? "widelog keys cannot end with a dot" & KeyErrorBrand : T extends `${string}..${string}` ? "widelog keys cannot contain empty segments" & KeyErrorBrand : T;
7
+ export type DottedKey<T extends string> = ValidateKey<T>;
8
+ export type Operation = {
9
+ operation: "set";
10
+ key: string;
11
+ value: FieldValue;
12
+ } | {
13
+ operation: "count";
14
+ key: string;
15
+ amount: number;
16
+ } | {
17
+ operation: "append";
18
+ key: string;
19
+ value: FieldValue;
20
+ } | {
21
+ operation: "max";
22
+ key: string;
23
+ value: number;
24
+ } | {
25
+ operation: "min";
26
+ key: string;
27
+ value: number;
28
+ } | {
29
+ operation: "time.start";
30
+ key: string;
31
+ time: number;
32
+ } | {
33
+ operation: "time.stop";
34
+ key: string;
35
+ time: number;
36
+ };
37
+ export interface Context {
38
+ operations: Operation[];
39
+ }
40
+ export {};
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "widelogger",
3
+ "version": "0.1.2",
4
+ "license": "AGPL-3.0",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js"
13
+ }
14
+ },
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "https://github.com/ridafkih/widelogger"
18
+ },
19
+ "files": [
20
+ "dist"
21
+ ],
22
+ "scripts": {
23
+ "build": "bun run build:js && bun run build:types",
24
+ "build:js": "bun build ./src/index.ts --outdir ./dist --target node --format esm",
25
+ "build:types": "tsc",
26
+ "check": "ultracite check",
27
+ "fix": "ultracite fix",
28
+ "test": "bun test",
29
+ "prepare": "lefthook install"
30
+ },
31
+ "devDependencies": {
32
+ "@biomejs/biome": "2.3.14",
33
+ "@types/bun": "^1.3.8",
34
+ "lefthook": "^2.1.0",
35
+ "typescript": "^5.8.2",
36
+ "ultracite": "7.1.5"
37
+ },
38
+ "packageManager": "bun@1.3.8",
39
+ "dependencies": {
40
+ "pino": "^10.3.1",
41
+ "pino-pretty": "^13.1.3"
42
+ }
43
+ }