@infinitetoken/lumber-kit 0.4.18 → 0.4.20

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 ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2026 Infinite Token LLC (https://www.infinitetoken.com/)
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
package/README.md CHANGED
@@ -11,37 +11,87 @@ npm install @infinitetoken/lumber-kit
11
11
  ## Usage
12
12
 
13
13
  ```typescript
14
- import { LogLevel, LogRecord, EncryptedPayload, LogQuery } from '@infinitetoken/lumber-kit'
14
+ import { LogLevel, LogRecord, LogEncrypted, LogPayload, LogsQuery } from '@infinitetoken/lumber-kit'
15
15
  ```
16
16
 
17
17
  ## Exports
18
18
 
19
+ ### Log types
20
+
19
21
  | Export | Kind | Purpose |
20
22
  |--------|------|---------|
21
23
  | `LogLevel` | `const enum` | Log severity: Debug=0 Info=1 Warn=2 Error=3 Fatal=4 |
22
- | `SubscriptionLevel` | `const enum` | User tier: Hobby=0 Dev=1 Pro=2 |
23
- | `LogPayload` | interface | Plaintext fields before encryption |
24
- | `EncryptedPayload` | interface | Wire format: `{ payload: string, v: number }` |
25
24
  | `LogRecord` | interface | API response shape for a stored log |
26
- | `AppRecord` | interface | API response shape for an app (no encryption_key) |
27
- | `AppCreatedRecord` | interface | POST /apps 201 response only (includes encryption_key once) |
28
- | `UserRecord` | interface | API response shape for a user (no password_digest) |
29
- | `LogQuery` | interface | GET /logs filter params |
30
- | `AppQuery` | interface | GET /apps filter params |
25
+ | `LogEncrypted` | interface | Encrypted envelope: `{ nonce, payload, keyVersion }` |
26
+ | `LogPayload` | interface | Plaintext shape encrypted into `LogEncrypted` (client-side only) |
27
+ | `LogContext` | interface | Structured context fields (code location, custom fields) |
28
+ | `LogsQuery` | interface | Sync-protocol params for GET /logs |
29
+
30
+ ### Subscription types
31
+
32
+ | Export | Kind | Purpose |
33
+ |--------|------|---------|
34
+ | `SubscriptionLevel` | `const enum` | Team tier: Hobby=0 Dev=1 Pro=2 Enterprise=3 |
35
+ | `subscriptionLevelToName` | object | Maps `SubscriptionLevel` to `'hobby' \| 'dev' \| 'pro' \| 'enterprise'` |
36
+ | `subscriptionLimits` | object | Per-tier limits (apps, seats, apiKeys, logRetentionDays, etc.) |
37
+ | `isValidSubscriptionLevel` | function | Type guard for `SubscriptionLevel` values |
38
+
39
+ ### Flag types
40
+
41
+ | Export | Kind | Purpose |
42
+ |--------|------|---------|
43
+ | `FlagRecord` | interface | A user flag on a log: `{ id, createdAt, updatedAt, logId, userId }` |
44
+ | `FlagsQuery` | interface | Sync-protocol params for GET /flags |
45
+
46
+ ### App / User / Team types
31
47
 
32
- ## Wire Format
48
+ | Export | Kind | Purpose |
49
+ |--------|------|---------|
50
+ | `AppRecord` | interface | API response shape for an app |
51
+ | `AppCreatedRecord` | interface | POST /apps 201 response (includes `encryptedKey` once) |
52
+ | `UserRecord` | interface | API response shape for a user |
53
+ | `TeamRecord` | interface | API response shape for a team |
54
+ | `TeamMemberRecord` | interface | Team membership record |
55
+
56
+ ## Wire format
57
+
58
+ All log content is E2E encrypted before leaving the client. `LogRecord` contains only:
59
+
60
+ ```typescript
61
+ {
62
+ id: string // server-assigned
63
+ createdAt: string // ISO 8601
64
+ updatedAt: string // ISO 8601
65
+ appId: string
66
+ encrypted: LogEncrypted // opaque blob — server cannot read this
67
+ }
68
+ ```
69
+
70
+ `LogEncrypted` uses AES-256-GCM:
71
+ - `nonce` — base64(random IV, 12 bytes)
72
+ - `payload` — base64(authTag[16 bytes] + ciphertext)
73
+ - `keyVersion` — always `1` for the current format; changes are semver major
33
74
 
34
- `EncryptedPayload.payload` is `base64(IV[12 bytes] + AuthTag[16 bytes] + ciphertext)`.
75
+ The plaintext shape inside `payload` is `LogPayload`:
35
76
 
36
- The `v` field is always `1` for the current wire format. Changes to this format are semver major.
77
+ ```typescript
78
+ {
79
+ level: LogLevel
80
+ message: string
81
+ requestId?: string
82
+ traceId?: string
83
+ context?: LogContext
84
+ metadata?: Record<string, unknown>
85
+ }
86
+ ```
37
87
 
38
- ## const enum and Babel Consumers
88
+ ## const enum and Babel consumers
39
89
 
40
90
  `LogLevel` is a TypeScript `const enum`. TypeScript consumers have values inlined at compile time (zero runtime overhead).
41
91
 
42
- If your project uses Babel, esbuild, or `isolatedModules: true`, the runtime enum object is available because Lumber-Kit is compiled with `preserveConstEnums: true`. No special configuration is needed in your project.
92
+ If your project uses Babel, esbuild, or `isolatedModules: true`, the runtime enum object is available because Lumber-Kit is compiled with `preserveConstEnums: true`. No special configuration is needed.
43
93
 
44
- ## Local Development (yalc)
94
+ ## Local development (yalc)
45
95
 
46
96
  Do NOT use `npm link` — it creates symlinks that break Metro in the Expo client.
47
97
 
@@ -0,0 +1,14 @@
1
+ export interface FlagRecord {
2
+ id: string;
3
+ createdAt: string;
4
+ updatedAt: string;
5
+ logId: string;
6
+ userId: string;
7
+ }
8
+ export interface FlagsQuery {
9
+ from?: string;
10
+ to?: string;
11
+ limit?: number;
12
+ cursor?: string;
13
+ }
14
+ //# sourceMappingURL=flag.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flag.d.ts","sourceRoot":"","sources":["../../../src/types/flag.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAA;IACV,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,5 +1,6 @@
1
1
  export * from './app';
2
2
  export * from './deviceLink';
3
+ export * from './flag';
3
4
  export * from './log';
4
5
  export * from './note';
5
6
  export * from './response';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAA;AACrB,cAAc,cAAc,CAAA;AAC5B,cAAc,OAAO,CAAA;AACrB,cAAc,QAAQ,CAAA;AACtB,cAAc,YAAY,CAAA;AAC1B,cAAc,QAAQ,CAAA;AACtB,cAAc,cAAc,CAAA;AAC5B,cAAc,QAAQ,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAA;AACrB,cAAc,cAAc,CAAA;AAC5B,cAAc,QAAQ,CAAA;AACtB,cAAc,OAAO,CAAA;AACrB,cAAc,QAAQ,CAAA;AACtB,cAAc,YAAY,CAAA;AAC1B,cAAc,QAAQ,CAAA;AACtB,cAAc,cAAc,CAAA;AAC5B,cAAc,QAAQ,CAAA"}
@@ -16,6 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./app"), exports);
18
18
  __exportStar(require("./deviceLink"), exports);
19
+ __exportStar(require("./flag"), exports);
19
20
  __exportStar(require("./log"), exports);
20
21
  __exportStar(require("./note"), exports);
21
22
  __exportStar(require("./response"), exports);
@@ -3,8 +3,6 @@ import { LogLevel } from '../constants';
3
3
  * Structured log context content.
4
4
  */
5
5
  export interface LogContext {
6
- requestId?: string;
7
- traceId?: string;
8
6
  code?: string;
9
7
  method?: string;
10
8
  line?: number;
@@ -13,43 +11,45 @@ export interface LogContext {
13
11
  [key: string]: unknown;
14
12
  }
15
13
  /**
16
- * Encrypted private container.
14
+ * Encrypted envelope stored on the server.
17
15
  * payload = base64(authTag + ciphertext)
18
16
  * nonce = base64(random IV)
19
17
  * keyVersion enables future rotation support.
20
18
  */
21
- export interface LogPrivate {
22
- payload: string;
19
+ export interface LogEncrypted {
23
20
  nonce: string;
21
+ payload: string;
24
22
  keyVersion: number;
25
23
  }
24
+ /**
25
+ * Plaintext shape of log content — encrypted before sending, never stored plaintext on server.
26
+ */
27
+ export interface LogPayload {
28
+ level: LogLevel;
29
+ message: string;
30
+ requestId?: string;
31
+ traceId?: string;
32
+ context?: LogContext;
33
+ metadata?: Record<string, unknown>;
34
+ }
26
35
  /**
27
36
  * API response shape for a stored log.
37
+ * level is plaintext for server-side notification routing; all content is inside encrypted.
28
38
  */
29
39
  export interface LogRecord {
30
40
  id: string;
31
41
  createdAt: string;
32
42
  updatedAt: string;
33
43
  appId: string;
34
- requestId?: string;
35
- traceId?: string;
36
44
  level: LogLevel;
37
- message: string;
38
- flagged: boolean;
39
- context?: LogContext;
40
- metadata?: Record<string, unknown>;
41
- private?: LogPrivate;
45
+ encrypted: LogEncrypted;
42
46
  }
43
47
  /**
44
- * Filter params for GET /logs.
48
+ * Sync-protocol params for GET /logs.
45
49
  */
46
50
  export interface LogsQuery {
47
51
  appIds?: string[];
48
- requestId?: string;
49
- traceId?: string;
50
- levels?: LogLevel[];
51
- text?: string;
52
- flagged?: boolean;
52
+ levels?: number[];
53
53
  from?: string;
54
54
  to?: string;
55
55
  sort?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../../src/types/log.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAEvC;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,CAAA;IAEhB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,CAAA;IAEf,IAAI,CAAC,EAAE,MAAM,CAAA;IAEb,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB;AAED;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,MAAM,CAAA;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAA;IACV,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IAEjB,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,CAAA;IAEhB,KAAK,EAAE,QAAQ,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IAEf,OAAO,EAAE,OAAO,CAAA;IAEhB,OAAO,CAAC,EAAE,UAAU,CAAA;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAA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AAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACnC;AAED;;;GAGG;AACH,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAA;IACV,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,QAAQ,CAAA;IACf,SAAS,EAAE,YAAY,CAAA;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;IACjB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;IACjB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB"}
@@ -4,7 +4,7 @@
4
4
  * nonce = base64(random IV)
5
5
  * keyVersion enables future key rotation.
6
6
  */
7
- export interface NotePrivate {
7
+ export interface NoteEncrypted {
8
8
  payload: string;
9
9
  nonce: string;
10
10
  keyVersion: number;
@@ -21,7 +21,7 @@ export interface NoteRecord {
21
21
  appId: string;
22
22
  userId: string;
23
23
  logId?: string;
24
- private: NotePrivate;
24
+ encrypted: NoteEncrypted;
25
25
  }
26
26
  /**
27
27
  * Filter params for GET /notes.
@@ -1 +1 @@
1
- {"version":3,"file":"note.d.ts","sourceRoot":"","sources":["../../../src/types/note.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,MAAM,CAAA;CACnB;AAED;;;;GAIG;AACH,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAA;IACV,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA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AA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB"}
@@ -0,0 +1,14 @@
1
+ export interface FlagRecord {
2
+ id: string;
3
+ createdAt: string;
4
+ updatedAt: string;
5
+ logId: string;
6
+ userId: string;
7
+ }
8
+ export interface FlagsQuery {
9
+ from?: string;
10
+ to?: string;
11
+ limit?: number;
12
+ cursor?: string;
13
+ }
14
+ //# sourceMappingURL=flag.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flag.d.ts","sourceRoot":"","sources":["../../../src/types/flag.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAA;IACV,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB"}
@@ -0,0 +1 @@
1
+ export {};
@@ -1,5 +1,6 @@
1
1
  export * from './app';
2
2
  export * from './deviceLink';
3
+ export * from './flag';
3
4
  export * from './log';
4
5
  export * from './note';
5
6
  export * from './response';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAA;AACrB,cAAc,cAAc,CAAA;AAC5B,cAAc,OAAO,CAAA;AACrB,cAAc,QAAQ,CAAA;AACtB,cAAc,YAAY,CAAA;AAC1B,cAAc,QAAQ,CAAA;AACtB,cAAc,cAAc,CAAA;AAC5B,cAAc,QAAQ,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAA;AACrB,cAAc,cAAc,CAAA;AAC5B,cAAc,QAAQ,CAAA;AACtB,cAAc,OAAO,CAAA;AACrB,cAAc,QAAQ,CAAA;AACtB,cAAc,YAAY,CAAA;AAC1B,cAAc,QAAQ,CAAA;AACtB,cAAc,cAAc,CAAA;AAC5B,cAAc,QAAQ,CAAA"}
@@ -1,5 +1,6 @@
1
1
  export * from './app.js';
2
2
  export * from './deviceLink.js';
3
+ export * from './flag.js';
3
4
  export * from './log.js';
4
5
  export * from './note.js';
5
6
  export * from './response.js';
@@ -3,8 +3,6 @@ import { LogLevel } from '../constants';
3
3
  * Structured log context content.
4
4
  */
5
5
  export interface LogContext {
6
- requestId?: string;
7
- traceId?: string;
8
6
  code?: string;
9
7
  method?: string;
10
8
  line?: number;
@@ -13,43 +11,45 @@ export interface LogContext {
13
11
  [key: string]: unknown;
14
12
  }
15
13
  /**
16
- * Encrypted private container.
14
+ * Encrypted envelope stored on the server.
17
15
  * payload = base64(authTag + ciphertext)
18
16
  * nonce = base64(random IV)
19
17
  * keyVersion enables future rotation support.
20
18
  */
21
- export interface LogPrivate {
22
- payload: string;
19
+ export interface LogEncrypted {
23
20
  nonce: string;
21
+ payload: string;
24
22
  keyVersion: number;
25
23
  }
24
+ /**
25
+ * Plaintext shape of log content — encrypted before sending, never stored plaintext on server.
26
+ */
27
+ export interface LogPayload {
28
+ level: LogLevel;
29
+ message: string;
30
+ requestId?: string;
31
+ traceId?: string;
32
+ context?: LogContext;
33
+ metadata?: Record<string, unknown>;
34
+ }
26
35
  /**
27
36
  * API response shape for a stored log.
37
+ * level is plaintext for server-side notification routing; all content is inside encrypted.
28
38
  */
29
39
  export interface LogRecord {
30
40
  id: string;
31
41
  createdAt: string;
32
42
  updatedAt: string;
33
43
  appId: string;
34
- requestId?: string;
35
- traceId?: string;
36
44
  level: LogLevel;
37
- message: string;
38
- flagged: boolean;
39
- context?: LogContext;
40
- metadata?: Record<string, unknown>;
41
- private?: LogPrivate;
45
+ encrypted: LogEncrypted;
42
46
  }
43
47
  /**
44
- * Filter params for GET /logs.
48
+ * Sync-protocol params for GET /logs.
45
49
  */
46
50
  export interface LogsQuery {
47
51
  appIds?: string[];
48
- requestId?: string;
49
- traceId?: string;
50
- levels?: LogLevel[];
51
- text?: string;
52
- flagged?: boolean;
52
+ levels?: number[];
53
53
  from?: string;
54
54
  to?: string;
55
55
  sort?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../../src/types/log.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAEvC;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,CAAA;IAEhB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,CAAA;IAEf,IAAI,CAAC,EAAE,MAAM,CAAA;IAEb,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB;AAED;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,MAAM,CAAA;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAA;IACV,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IAEjB,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,CAAA;IAEhB,KAAK,EAAE,QAAQ,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IAEf,OAAO,EAAE,OAAO,CAAA;IAEhB,OAAO,CAAC,EAAE,UAAU,CAAA;IACpB,QAAQ,C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IAChB,OAAO,CAAC,EAAE,UAAU,CAAA;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACnC;AAED;;;GAGG;AACH,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAA;IACV,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,QAAQ,CAAA;IACf,SAAS,EAAE,YAAY,CAAA;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;IACjB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;IACjB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB"}
@@ -4,7 +4,7 @@
4
4
  * nonce = base64(random IV)
5
5
  * keyVersion enables future key rotation.
6
6
  */
7
- export interface NotePrivate {
7
+ export interface NoteEncrypted {
8
8
  payload: string;
9
9
  nonce: string;
10
10
  keyVersion: number;
@@ -21,7 +21,7 @@ export interface NoteRecord {
21
21
  appId: string;
22
22
  userId: string;
23
23
  logId?: string;
24
- private: NotePrivate;
24
+ encrypted: NoteEncrypted;
25
25
  }
26
26
  /**
27
27
  * Filter params for GET /notes.
@@ -1 +1 @@
1
- {"version":3,"file":"note.d.ts","sourceRoot":"","sources":["../../../src/types/note.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,MAAM,CAAA;CACnB;AAED;;;;GAIG;AACH,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAA;IACV,SA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,EAAE,MAAM,CAAA;IACX,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB"}
package/package.json CHANGED
@@ -1,10 +1,26 @@
1
1
  {
2
2
  "name": "@infinitetoken/lumber-kit",
3
- "version": "0.4.18",
3
+ "version": "0.4.20",
4
4
  "description": "Shared TypeScript types and wire format contracts for the Lumber cloud logging suite",
5
- "main": "./dist/cjs/index.js",
6
- "module": "./dist/esm/index.js",
7
- "types": "./dist/cjs/index.d.ts",
5
+ "keywords": [
6
+ "lumber",
7
+ "logging",
8
+ "cloud-logging",
9
+ "typescript",
10
+ "types",
11
+ "wire-format",
12
+ "contracts",
13
+ "schema",
14
+ "log-schema"
15
+ ],
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/infinitetoken/lumber-kit.git"
19
+ },
20
+ "license": "SEE LICENSE IN LICENSE",
21
+ "author": "Jay Deaton",
22
+ "sideEffects": false,
23
+ "type": "commonjs",
8
24
  "exports": {
9
25
  ".": {
10
26
  "import": {
@@ -17,40 +33,44 @@
17
33
  }
18
34
  }
19
35
  },
36
+ "main": "./dist/cjs/index.js",
37
+ "module": "./dist/esm/index.js",
38
+ "types": "./dist/cjs/index.d.ts",
20
39
  "files": [
21
- "dist",
22
- "README.md"
40
+ "dist"
23
41
  ],
24
- "publishConfig": {
25
- "access": "public"
26
- },
27
42
  "scripts": {
28
43
  "build": "npm run build:cjs && npm run build:esm",
29
44
  "build:cjs": "tsc -p tsconfig.cjs.json",
30
45
  "build:esm": "tsc -p tsconfig.esm.json && echo '{\"type\": \"module\"}' > dist/esm/package.json && node scripts/fix-esm-imports.mjs",
31
46
  "clean": "rm -rf dist coverage",
32
- "test": "jest",
33
- "lint": "eslint .",
34
47
  "fix": "eslint . --fix",
35
- "preversion": "npm run lint && npm test",
48
+ "lint": "eslint .",
36
49
  "prepublishOnly": "npm run build",
37
50
  "release": "git push --follow-tags",
38
- "release:patch": "npm version patch && git push --follow-tags",
51
+ "release:major": "npm version major && git push --follow-tags",
39
52
  "release:minor": "npm version minor && git push --follow-tags",
40
- "release:major": "npm version major && git push --follow-tags"
53
+ "release:patch": "npm version patch && git push --follow-tags",
54
+ "test": "jest",
55
+ "typecheck": "tsc --noEmit",
56
+ "preversion": "npm run lint && npm test"
41
57
  },
42
58
  "devDependencies": {
43
59
  "@types/jest": "^30.0.0",
44
60
  "@types/node": "^25.0.0",
45
- "@typescript-eslint/eslint-plugin": "^8.59.1",
46
61
  "@typescript-eslint/parser": "^8.59.1",
47
62
  "eslint": "^10.2.1",
48
63
  "eslint-config-prettier": "^10.1.8",
64
+ "eslint-plugin-package-json": "^1.0.0",
49
65
  "eslint-plugin-prettier": "^5.5.4",
50
66
  "eslint-plugin-simple-import-sort": "^13.0.0",
51
67
  "jest": "^30.3.0",
52
68
  "prettier": "^3.8.3",
53
69
  "ts-jest": "^29.4.9",
54
- "typescript": "^6.0.3"
70
+ "typescript": "^6.0.3",
71
+ "typescript-eslint": "^8.59.3"
72
+ },
73
+ "publishConfig": {
74
+ "access": "public"
55
75
  }
56
76
  }