@infinitetoken/lumber-kit 0.7.0 → 1.0.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/README.md +22 -8
- package/contract/schema.json +1310 -1247
- package/dist/index.d.mts +102 -49
- package/dist/index.d.ts +102 -49
- package/dist/index.js +31 -2
- package/dist/index.mjs +26 -2
- package/package.json +8 -4
package/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# @infinitetoken/lumber-kit
|
|
2
2
|
|
|
3
|
-
Shared TypeScript types, wire format contract, and query interfaces for the [Lumber](https://
|
|
3
|
+
Shared TypeScript types, wire format contract, and query interfaces for the [Lumber](https://lumber.infinitetoken.com) cloud logging suite. Lumber is end-to-end encrypted: a client encrypts every log with AES-256-GCM before it leaves the process, and the server stores only ciphertext plus each log's level.
|
|
4
|
+
|
|
5
|
+
To send logs from your own code, you want a client rather than this package: [`@infinitetoken/lumber`](https://github.com/infinitetoken/Lumber-Node) for Node.js, [`lumber-cloud`](https://github.com/infinitetoken/Lumber-Python) for Python or [`lumber-go`](https://github.com/infinitetoken/lumber-go) for Go. The kit is what those clients and Lumber's own apps and services share, and its [contract](contract/README.md) is what a client in any language is tested against.
|
|
4
6
|
|
|
5
7
|
## Install
|
|
6
8
|
|
|
@@ -34,6 +36,7 @@ import { LogLevel, LogRecord, LogEncrypted, LogPayload, LogsQuery } from '@infin
|
|
|
34
36
|
| `SubscriptionLevel` | `const enum` | Team tier: Hobby=0 Dev=1 Pro=2 Enterprise=3 |
|
|
35
37
|
| `subscriptionLevelToName` | object | Maps `SubscriptionLevel` to `'hobby' \| 'dev' \| 'pro' \| 'enterprise'` |
|
|
36
38
|
| `subscriptionLimits` | object | Per-tier limits (apps, seats, apiKeys, logRetentionDays, etc.) |
|
|
39
|
+
| `monthlyLogsCap` | object | Past `monthlyLogs`: the lowest level still taken (ERROR) and the hard stop's multiple (2), where every log is refused |
|
|
37
40
|
| `isValidSubscriptionLevel` | function | Type guard for `SubscriptionLevel` values |
|
|
38
41
|
|
|
39
42
|
### Plans
|
|
@@ -84,6 +87,10 @@ import { LogLevel, LogRecord, LogEncrypted, LogPayload, LogsQuery } from '@infin
|
|
|
84
87
|
| `AppRecord` | interface | API response shape for an app |
|
|
85
88
|
| `AppCreatedRecord` | interface | POST /apps 201 response (includes `encryptedKey` once) |
|
|
86
89
|
| `UserRecord` | interface | API response shape for a user |
|
|
90
|
+
| `TimeFormat` | interface | How a user reads times on every device: `{ clock: '24h' \| '12h', zone: 'local' \| 'utc' }` |
|
|
91
|
+
| `DEFAULT_TIME_FORMAT` | constant | 24-hour, local: what a user gets until they pick one |
|
|
92
|
+
| `isValidTimeFormat` | function | A known clock and zone, and nothing else |
|
|
93
|
+
| `normalizeTimeFormat` | function | A stored or sent time format, each part the default when missing or unknown |
|
|
87
94
|
| `TeamRecord` | interface | API response shape for a team |
|
|
88
95
|
| `TeamMemberRecord` | interface | Team membership record (listed members carry name, handle, color and picture) |
|
|
89
96
|
| `AppTeamAccess` | type | Who on an app's team reads it: `'everyone'` or `'owner'` |
|
|
@@ -134,6 +141,7 @@ A plugin sends only the token to the API (`Authorization: Bearer <token>`) and e
|
|
|
134
141
|
| `buildLogPayload` | function | The `LogPayload` a log call encrypts, from its level, message, data and the plugin's automatic context |
|
|
135
142
|
| `DEFAULT_API_ENDPOINT` | constant | `https://api.lumber.infinitetoken.com` |
|
|
136
143
|
| `LOG_KEY_VERSION` | constant | `LogEncrypted`'s `keyVersion` (1) |
|
|
144
|
+
| `MAX_LOG_PAYLOAD_LENGTH` | constant | The longest `encrypted.payload` `POST /logs` takes (16 KB of base64); longer is refused with a 413 |
|
|
137
145
|
| `logDelivery` | object | Attempts, retry delays and the pause after a 429 |
|
|
138
146
|
| `logDeliveryOutcome` | function | `sent`, `retry`, `drop` or `pause` for a `POST /logs` status (null for a network error) |
|
|
139
147
|
| `logRetryDelayMs` | function | The wait after a log's nth failed attempt: 1s, 2s, 4s, up to 30s |
|
|
@@ -172,7 +180,7 @@ The plaintext shape inside `payload` is `LogPayload`:
|
|
|
172
180
|
|
|
173
181
|
## Other languages
|
|
174
182
|
|
|
175
|
-
TypeScript can't be imported from Python or Go, so the kit ships its contract in `contract/`: a JSON Schema of every exported type (`schema.json`, generated from the TypeScript by `npm run contract`) and known answers (`vectors.json`) for API keys, AES-256-GCM, payloads and delivery, which the kit's own tests check against its code. Lumber-Python and Lumber-Go test against a pinned copy. See `contract/README.md
|
|
183
|
+
TypeScript can't be imported from Python or Go, so the kit ships its contract in `contract/`: a JSON Schema of every exported type (`schema.json`, generated from the TypeScript by `npm run contract`) and known answers (`vectors.json`) for API keys, AES-256-GCM, payloads and delivery, which the kit's own tests check against its code. Lumber-Python and Lumber-Go test against a pinned copy. See [`contract/README.md`](contract/README.md).
|
|
176
184
|
|
|
177
185
|
## const enum and Babel consumers
|
|
178
186
|
|
|
@@ -180,20 +188,26 @@ TypeScript can't be imported from Python or Go, so the kit ships its contract in
|
|
|
180
188
|
|
|
181
189
|
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.
|
|
182
190
|
|
|
183
|
-
##
|
|
191
|
+
## Developing
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
npm install
|
|
195
|
+
npm run verify # lint, test, typecheck, build
|
|
196
|
+
npm run contract # regenerate contract/schema.json after changing a type
|
|
197
|
+
```
|
|
184
198
|
|
|
185
|
-
|
|
199
|
+
To try a change in a project that uses the kit before it's published, use [yalc](https://github.com/wclr/yalc) rather than `npm link`, whose symlinks break Metro (React Native's bundler):
|
|
186
200
|
|
|
187
201
|
```bash
|
|
188
|
-
# In Lumber-Kit
|
|
202
|
+
# In Lumber-Kit
|
|
189
203
|
npm run build
|
|
190
204
|
yalc publish
|
|
191
205
|
|
|
192
|
-
# In
|
|
206
|
+
# In the project using it
|
|
193
207
|
yalc add @infinitetoken/lumber-kit
|
|
194
208
|
npm install
|
|
195
209
|
|
|
196
|
-
# After
|
|
210
|
+
# After each change to Lumber-Kit
|
|
197
211
|
npm run build
|
|
198
|
-
yalc push #
|
|
212
|
+
yalc push # updates every project that added it
|
|
199
213
|
```
|