@infinitetoken/lumber-kit 0.4.20 → 0.4.21
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/dist/index.d.mts +359 -0
- package/dist/index.d.ts +359 -0
- package/dist/index.js +124 -0
- package/dist/index.mjs +83 -0
- package/package.json +22 -25
- package/dist/cjs/constants/index.d.ts +0 -3
- package/dist/cjs/constants/index.d.ts.map +0 -1
- package/dist/cjs/constants/index.js +0 -18
- package/dist/cjs/constants/logLevel.d.ts +0 -17
- package/dist/cjs/constants/logLevel.d.ts.map +0 -1
- package/dist/cjs/constants/logLevel.js +0 -31
- package/dist/cjs/constants/subscription.d.ts +0 -27
- package/dist/cjs/constants/subscription.d.ts.map +0 -1
- package/dist/cjs/constants/subscription.js +0 -28
- package/dist/cjs/index.d.ts +0 -4
- package/dist/cjs/index.d.ts.map +0 -1
- package/dist/cjs/index.js +0 -19
- package/dist/cjs/types/app.d.ts +0 -62
- package/dist/cjs/types/app.d.ts.map +0 -1
- package/dist/cjs/types/app.js +0 -2
- package/dist/cjs/types/deviceLink.d.ts +0 -19
- package/dist/cjs/types/deviceLink.d.ts.map +0 -1
- package/dist/cjs/types/deviceLink.js +0 -2
- package/dist/cjs/types/flag.d.ts +0 -14
- package/dist/cjs/types/flag.d.ts.map +0 -1
- package/dist/cjs/types/flag.js +0 -2
- package/dist/cjs/types/index.d.ts +0 -10
- package/dist/cjs/types/index.d.ts.map +0 -1
- package/dist/cjs/types/index.js +0 -25
- package/dist/cjs/types/log.d.ts +0 -59
- package/dist/cjs/types/log.d.ts.map +0 -1
- package/dist/cjs/types/log.js +0 -2
- package/dist/cjs/types/note.d.ts +0 -40
- package/dist/cjs/types/note.d.ts.map +0 -1
- package/dist/cjs/types/note.js +0 -2
- package/dist/cjs/types/response.d.ts +0 -14
- package/dist/cjs/types/response.d.ts.map +0 -1
- package/dist/cjs/types/response.js +0 -2
- package/dist/cjs/types/team.d.ts +0 -34
- package/dist/cjs/types/team.d.ts.map +0 -1
- package/dist/cjs/types/team.js +0 -2
- package/dist/cjs/types/timeseries.d.ts +0 -30
- package/dist/cjs/types/timeseries.d.ts.map +0 -1
- package/dist/cjs/types/timeseries.js +0 -2
- package/dist/cjs/types/user.d.ts +0 -34
- package/dist/cjs/types/user.d.ts.map +0 -1
- package/dist/cjs/types/user.js +0 -2
- package/dist/cjs/utils/index.d.ts +0 -12
- package/dist/cjs/utils/index.d.ts.map +0 -1
- package/dist/cjs/utils/index.js +0 -33
- package/dist/esm/constants/index.d.ts +0 -3
- package/dist/esm/constants/index.d.ts.map +0 -1
- package/dist/esm/constants/index.js +0 -2
- package/dist/esm/constants/logLevel.d.ts +0 -17
- package/dist/esm/constants/logLevel.d.ts.map +0 -1
- package/dist/esm/constants/logLevel.js +0 -28
- package/dist/esm/constants/subscription.d.ts +0 -27
- package/dist/esm/constants/subscription.d.ts.map +0 -1
- package/dist/esm/constants/subscription.js +0 -25
- package/dist/esm/index.d.ts +0 -4
- package/dist/esm/index.d.ts.map +0 -1
- package/dist/esm/index.js +0 -3
- package/dist/esm/package.json +0 -1
- package/dist/esm/types/app.d.ts +0 -62
- package/dist/esm/types/app.d.ts.map +0 -1
- package/dist/esm/types/app.js +0 -1
- package/dist/esm/types/deviceLink.d.ts +0 -19
- package/dist/esm/types/deviceLink.d.ts.map +0 -1
- package/dist/esm/types/deviceLink.js +0 -1
- package/dist/esm/types/flag.d.ts +0 -14
- package/dist/esm/types/flag.d.ts.map +0 -1
- package/dist/esm/types/flag.js +0 -1
- package/dist/esm/types/index.d.ts +0 -10
- package/dist/esm/types/index.d.ts.map +0 -1
- package/dist/esm/types/index.js +0 -9
- package/dist/esm/types/log.d.ts +0 -59
- package/dist/esm/types/log.d.ts.map +0 -1
- package/dist/esm/types/log.js +0 -1
- package/dist/esm/types/note.d.ts +0 -40
- package/dist/esm/types/note.d.ts.map +0 -1
- package/dist/esm/types/note.js +0 -1
- package/dist/esm/types/response.d.ts +0 -14
- package/dist/esm/types/response.d.ts.map +0 -1
- package/dist/esm/types/response.js +0 -1
- package/dist/esm/types/team.d.ts +0 -34
- package/dist/esm/types/team.d.ts.map +0 -1
- package/dist/esm/types/team.js +0 -1
- package/dist/esm/types/timeseries.d.ts +0 -30
- package/dist/esm/types/timeseries.d.ts.map +0 -1
- package/dist/esm/types/timeseries.js +0 -1
- package/dist/esm/types/user.d.ts +0 -34
- package/dist/esm/types/user.d.ts.map +0 -1
- package/dist/esm/types/user.js +0 -1
- package/dist/esm/utils/index.d.ts +0 -12
- package/dist/esm/utils/index.d.ts.map +0 -1
- package/dist/esm/utils/index.js +0 -23
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
/** Log severity level. Numeric values match the existing Lumber-API level field. */
|
|
2
|
+
declare const enum LogLevel {
|
|
3
|
+
Debug = 0,
|
|
4
|
+
Info = 1,
|
|
5
|
+
Warn = 2,
|
|
6
|
+
Error = 3,
|
|
7
|
+
Fatal = 4
|
|
8
|
+
}
|
|
9
|
+
/** String name for each log level. */
|
|
10
|
+
type LogLevelName = 'debug' | 'info' | 'warn' | 'error' | 'fatal';
|
|
11
|
+
/** Maps numeric log level to its lowercase string name. */
|
|
12
|
+
declare const logLevelToName: Record<number, LogLevelName>;
|
|
13
|
+
/** Maps lowercase log level name to its numeric value. */
|
|
14
|
+
declare const logLevelNameToLevel: Record<LogLevelName, LogLevel>;
|
|
15
|
+
/** All valid log levels, ordered from least to most severe. */
|
|
16
|
+
declare const logLevels: readonly LogLevel[];
|
|
17
|
+
|
|
18
|
+
/** User subscription level. Mirrors User.subscriptionLevel in Lumber-API. */
|
|
19
|
+
declare const enum SubscriptionLevel {
|
|
20
|
+
Hobby = 0,
|
|
21
|
+
Dev = 1,
|
|
22
|
+
Pro = 2,
|
|
23
|
+
Enterprise = 3
|
|
24
|
+
}
|
|
25
|
+
/** String name for each subscription level, suitable for display and Redux state. */
|
|
26
|
+
type SubscriptionLevelName = 'hobby' | 'dev' | 'pro' | 'enterprise';
|
|
27
|
+
/** Maps numeric subscription level to its string level name. */
|
|
28
|
+
declare const subscriptionLevelToName: Record<SubscriptionLevel, SubscriptionLevelName>;
|
|
29
|
+
/** All valid subscription levels, ordered from least to most severe. */
|
|
30
|
+
declare const subscriptionLevels: readonly SubscriptionLevel[];
|
|
31
|
+
type SubscriptionLimits = {
|
|
32
|
+
apps: number;
|
|
33
|
+
seats: number;
|
|
34
|
+
apiKeys: number;
|
|
35
|
+
logRetentionDays: number;
|
|
36
|
+
monthlyLogs: number;
|
|
37
|
+
/** Whether real-time WebSocket log streaming is available. */
|
|
38
|
+
realtimeLogs: boolean;
|
|
39
|
+
/** Minimum log level that triggers a push notification. Infinity means push is disabled. */
|
|
40
|
+
minPushLevel: number;
|
|
41
|
+
};
|
|
42
|
+
/** Per-level resource limits. Use Infinity to mean unlimited or disabled. */
|
|
43
|
+
declare const subscriptionLimits: Record<SubscriptionLevel, SubscriptionLimits>;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Wrapped application encryption key for a specific user.
|
|
47
|
+
*/
|
|
48
|
+
interface AppEncryptedKey {
|
|
49
|
+
userId: string;
|
|
50
|
+
encryptedKey: string;
|
|
51
|
+
keyVersion: number;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* API response shape for a listed or fetched app.
|
|
55
|
+
* encryptedKey is the requesting user's wrapped copy of the app key, or null if none exists.
|
|
56
|
+
*/
|
|
57
|
+
interface AppRecord {
|
|
58
|
+
id: string;
|
|
59
|
+
createdAt: string;
|
|
60
|
+
updatedAt: string;
|
|
61
|
+
name: string;
|
|
62
|
+
color?: string;
|
|
63
|
+
imageUrl?: string;
|
|
64
|
+
teamId?: string;
|
|
65
|
+
encryptedKey: string | null;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* App creation response.
|
|
69
|
+
* Initial wrapped encryption key may optionally be returned.
|
|
70
|
+
*/
|
|
71
|
+
interface AppCreatedRecord extends AppRecord {
|
|
72
|
+
apiKey?: string;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Machine authentication credential.
|
|
76
|
+
*/
|
|
77
|
+
interface ApiKeyRecord {
|
|
78
|
+
id: string;
|
|
79
|
+
createdAt: string;
|
|
80
|
+
updatedAt: string;
|
|
81
|
+
appId: string;
|
|
82
|
+
name?: string;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* External guest granted access to a specific app without being a team member.
|
|
86
|
+
*/
|
|
87
|
+
interface GuestRecord {
|
|
88
|
+
id: string;
|
|
89
|
+
createdAt: string;
|
|
90
|
+
updatedAt: string;
|
|
91
|
+
appId: string;
|
|
92
|
+
userId: string;
|
|
93
|
+
role: 'owner' | 'admin' | 'read' | 'write';
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Filter params for GET /apps.
|
|
97
|
+
*/
|
|
98
|
+
interface AppsQuery {
|
|
99
|
+
teamId?: string;
|
|
100
|
+
from?: string;
|
|
101
|
+
to?: string;
|
|
102
|
+
sort?: string;
|
|
103
|
+
limit?: number;
|
|
104
|
+
cursor?: string;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
type DeviceLinkStatus = 'pending' | 'approved' | 'denied';
|
|
108
|
+
/**
|
|
109
|
+
* Response from POST /device-links.
|
|
110
|
+
*/
|
|
111
|
+
interface DeviceLinkCreatedRecord {
|
|
112
|
+
id: string;
|
|
113
|
+
expiresAt: string;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Response from GET /device-links/:id.
|
|
117
|
+
* encryptedKey is present only when status is 'approved'.
|
|
118
|
+
*/
|
|
119
|
+
interface DeviceLinkRecord {
|
|
120
|
+
id: string;
|
|
121
|
+
status: DeviceLinkStatus;
|
|
122
|
+
encryptedKey?: string;
|
|
123
|
+
expiresAt: string;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
interface FlagRecord {
|
|
127
|
+
id: string;
|
|
128
|
+
createdAt: string;
|
|
129
|
+
updatedAt: string;
|
|
130
|
+
logId: string;
|
|
131
|
+
userId: string;
|
|
132
|
+
}
|
|
133
|
+
interface FlagsQuery {
|
|
134
|
+
from?: string;
|
|
135
|
+
to?: string;
|
|
136
|
+
limit?: number;
|
|
137
|
+
cursor?: string;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Structured log context content.
|
|
142
|
+
*/
|
|
143
|
+
interface LogContext {
|
|
144
|
+
code?: string;
|
|
145
|
+
method?: string;
|
|
146
|
+
line?: number;
|
|
147
|
+
column?: number;
|
|
148
|
+
note?: string;
|
|
149
|
+
[key: string]: unknown;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Encrypted envelope stored on the server.
|
|
153
|
+
* payload = base64(authTag + ciphertext)
|
|
154
|
+
* nonce = base64(random IV)
|
|
155
|
+
* keyVersion enables future rotation support.
|
|
156
|
+
*/
|
|
157
|
+
interface LogEncrypted {
|
|
158
|
+
nonce: string;
|
|
159
|
+
payload: string;
|
|
160
|
+
keyVersion: number;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Plaintext shape of log content — encrypted before sending, never stored plaintext on server.
|
|
164
|
+
*/
|
|
165
|
+
interface LogPayload {
|
|
166
|
+
level: LogLevel;
|
|
167
|
+
message: string;
|
|
168
|
+
requestId?: string;
|
|
169
|
+
traceId?: string;
|
|
170
|
+
context?: LogContext;
|
|
171
|
+
metadata?: Record<string, unknown>;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* API response shape for a stored log.
|
|
175
|
+
* level is plaintext for server-side notification routing; all content is inside encrypted.
|
|
176
|
+
*/
|
|
177
|
+
interface LogRecord {
|
|
178
|
+
id: string;
|
|
179
|
+
createdAt: string;
|
|
180
|
+
updatedAt: string;
|
|
181
|
+
appId: string;
|
|
182
|
+
level: LogLevel;
|
|
183
|
+
encrypted: LogEncrypted;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Sync-protocol params for GET /logs.
|
|
187
|
+
*/
|
|
188
|
+
interface LogsQuery {
|
|
189
|
+
appIds?: string[];
|
|
190
|
+
levels?: number[];
|
|
191
|
+
from?: string;
|
|
192
|
+
to?: string;
|
|
193
|
+
sort?: string;
|
|
194
|
+
limit?: number;
|
|
195
|
+
cursor?: string;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Encrypted note content.
|
|
200
|
+
* payload = base64(authTag + ciphertext)
|
|
201
|
+
* nonce = base64(random IV)
|
|
202
|
+
* keyVersion enables future key rotation.
|
|
203
|
+
*/
|
|
204
|
+
interface NoteEncrypted {
|
|
205
|
+
payload: string;
|
|
206
|
+
nonce: string;
|
|
207
|
+
keyVersion: number;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* A short user-authored note, encrypted with the app key.
|
|
211
|
+
* Visible to all members of the associated app.
|
|
212
|
+
* Query by teamId in NotesQuery to build a cross-app team feed.
|
|
213
|
+
*/
|
|
214
|
+
interface NoteRecord {
|
|
215
|
+
id: string;
|
|
216
|
+
createdAt: string;
|
|
217
|
+
updatedAt: string;
|
|
218
|
+
appId: string;
|
|
219
|
+
userId: string;
|
|
220
|
+
logId?: string;
|
|
221
|
+
encrypted: NoteEncrypted;
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Filter params for GET /notes.
|
|
225
|
+
*/
|
|
226
|
+
interface NotesQuery {
|
|
227
|
+
appId?: string;
|
|
228
|
+
teamId?: string;
|
|
229
|
+
userId?: string;
|
|
230
|
+
logId?: string;
|
|
231
|
+
from?: string;
|
|
232
|
+
to?: string;
|
|
233
|
+
sort?: string;
|
|
234
|
+
limit?: number;
|
|
235
|
+
cursor?: string;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
interface ResponseMetadata {
|
|
239
|
+
requestId: string;
|
|
240
|
+
durationMs: number;
|
|
241
|
+
warnings?: string[];
|
|
242
|
+
cursor?: string | null;
|
|
243
|
+
hasMore?: boolean;
|
|
244
|
+
count?: number;
|
|
245
|
+
hiddenCount?: number;
|
|
246
|
+
}
|
|
247
|
+
interface ApiResponse<T> {
|
|
248
|
+
data: T;
|
|
249
|
+
metadata: ResponseMetadata;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* An organization that owns apps and pays for member usage.
|
|
254
|
+
* Team subscriptionLevel takes precedence over individual member levels.
|
|
255
|
+
*/
|
|
256
|
+
interface TeamRecord {
|
|
257
|
+
id: string;
|
|
258
|
+
createdAt: string;
|
|
259
|
+
updatedAt: string;
|
|
260
|
+
name: string;
|
|
261
|
+
color?: string;
|
|
262
|
+
imageUrl?: string;
|
|
263
|
+
subscriptionLevel: SubscriptionLevel;
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Membership of a user in a team.
|
|
267
|
+
*/
|
|
268
|
+
interface TeamMemberRecord {
|
|
269
|
+
id: string;
|
|
270
|
+
createdAt: string;
|
|
271
|
+
updatedAt: string;
|
|
272
|
+
teamId: string;
|
|
273
|
+
userId: string;
|
|
274
|
+
role: 'owner' | 'admin' | 'member';
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Filter params for GET /teams.
|
|
278
|
+
*/
|
|
279
|
+
interface TeamsQuery {
|
|
280
|
+
sort?: string;
|
|
281
|
+
limit?: number;
|
|
282
|
+
cursor?: string;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* A single time bucket in a timeseries response.
|
|
287
|
+
* date is an ISO date string (YYYY-MM-DD for 'day', ISO datetime for 'hour').
|
|
288
|
+
* byLevel optionally breaks down the count per LogLevel for severity-tinted rendering.
|
|
289
|
+
*/
|
|
290
|
+
interface TimeseriesBucket {
|
|
291
|
+
date: string;
|
|
292
|
+
count: number;
|
|
293
|
+
byLevel?: Partial<Record<number, number>>;
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Generic timeseries aggregate response. Reusable across logs, notifications, messages, etc.
|
|
297
|
+
*/
|
|
298
|
+
interface TimeseriesResponse {
|
|
299
|
+
buckets: TimeseriesBucket[];
|
|
300
|
+
from: string;
|
|
301
|
+
to: string;
|
|
302
|
+
interval: 'day' | 'hour';
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Filter params for GET /logs/timeseries.
|
|
306
|
+
*/
|
|
307
|
+
interface LogTimeseriesQuery {
|
|
308
|
+
appIds?: string[];
|
|
309
|
+
levels?: number[];
|
|
310
|
+
from?: string;
|
|
311
|
+
to?: string;
|
|
312
|
+
interval?: 'day' | 'hour';
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
type Appearance = 'system' | 'dark' | 'light';
|
|
316
|
+
interface PushToken {
|
|
317
|
+
token: string;
|
|
318
|
+
deviceId?: string;
|
|
319
|
+
platform?: 'ios' | 'android' | 'web';
|
|
320
|
+
}
|
|
321
|
+
interface NotificationPreference {
|
|
322
|
+
enabled?: boolean;
|
|
323
|
+
minimumLevel?: number;
|
|
324
|
+
lastReadAt?: string;
|
|
325
|
+
}
|
|
326
|
+
interface NotificationPreferences {
|
|
327
|
+
enabled?: boolean;
|
|
328
|
+
minimumLevel?: number;
|
|
329
|
+
perApp?: Record<string, NotificationPreference>;
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* Public user profile returned from API.
|
|
333
|
+
*/
|
|
334
|
+
interface UserRecord {
|
|
335
|
+
id: string;
|
|
336
|
+
createdAt: string;
|
|
337
|
+
updatedAt: string;
|
|
338
|
+
email: string;
|
|
339
|
+
name?: string;
|
|
340
|
+
publicKey?: string;
|
|
341
|
+
appearance?: Appearance;
|
|
342
|
+
color?: string;
|
|
343
|
+
imageUrl?: string;
|
|
344
|
+
agreedToTermsVersion?: string;
|
|
345
|
+
notificationPreferences: NotificationPreferences;
|
|
346
|
+
pushTokens: PushToken[];
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
declare const isValidAppearance: (value: unknown) => value is Appearance;
|
|
350
|
+
/** Accepts 3- and 6-digit hex color strings (#rgb, #rrggbb). */
|
|
351
|
+
declare const isValidColor: (value: string) => boolean;
|
|
352
|
+
declare const isValidLogLevel: (value: unknown) => value is LogLevel;
|
|
353
|
+
declare const isValidSubscriptionLevel: (value: unknown) => value is SubscriptionLevel;
|
|
354
|
+
declare const isValidDeviceLinkStatus: (value: unknown) => value is DeviceLinkStatus;
|
|
355
|
+
declare const isValidTeamMemberRole: (value: unknown) => value is TeamMemberRecord["role"];
|
|
356
|
+
/** Accepts any valid absolute URL (https://..., http://..., etc.). */
|
|
357
|
+
declare const isValidImageUrl: (value: unknown) => value is string;
|
|
358
|
+
|
|
359
|
+
export { type ApiKeyRecord, type ApiResponse, type AppCreatedRecord, type AppEncryptedKey, type AppRecord, type Appearance, type AppsQuery, type DeviceLinkCreatedRecord, type DeviceLinkRecord, type DeviceLinkStatus, type FlagRecord, type FlagsQuery, type GuestRecord, type LogContext, type LogEncrypted, LogLevel, type LogLevelName, type LogPayload, type LogRecord, type LogTimeseriesQuery, type LogsQuery, type NoteEncrypted, type NoteRecord, type NotesQuery, type NotificationPreference, type NotificationPreferences, type PushToken, type ResponseMetadata, SubscriptionLevel, type SubscriptionLevelName, type SubscriptionLimits, type TeamMemberRecord, type TeamRecord, type TeamsQuery, type TimeseriesBucket, type TimeseriesResponse, type UserRecord, isValidAppearance, isValidColor, isValidDeviceLinkStatus, isValidImageUrl, isValidLogLevel, isValidSubscriptionLevel, isValidTeamMemberRole, logLevelNameToLevel, logLevelToName, logLevels, subscriptionLevelToName, subscriptionLevels, subscriptionLimits };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
/** Log severity level. Numeric values match the existing Lumber-API level field. */
|
|
2
|
+
declare const enum LogLevel {
|
|
3
|
+
Debug = 0,
|
|
4
|
+
Info = 1,
|
|
5
|
+
Warn = 2,
|
|
6
|
+
Error = 3,
|
|
7
|
+
Fatal = 4
|
|
8
|
+
}
|
|
9
|
+
/** String name for each log level. */
|
|
10
|
+
type LogLevelName = 'debug' | 'info' | 'warn' | 'error' | 'fatal';
|
|
11
|
+
/** Maps numeric log level to its lowercase string name. */
|
|
12
|
+
declare const logLevelToName: Record<number, LogLevelName>;
|
|
13
|
+
/** Maps lowercase log level name to its numeric value. */
|
|
14
|
+
declare const logLevelNameToLevel: Record<LogLevelName, LogLevel>;
|
|
15
|
+
/** All valid log levels, ordered from least to most severe. */
|
|
16
|
+
declare const logLevels: readonly LogLevel[];
|
|
17
|
+
|
|
18
|
+
/** User subscription level. Mirrors User.subscriptionLevel in Lumber-API. */
|
|
19
|
+
declare const enum SubscriptionLevel {
|
|
20
|
+
Hobby = 0,
|
|
21
|
+
Dev = 1,
|
|
22
|
+
Pro = 2,
|
|
23
|
+
Enterprise = 3
|
|
24
|
+
}
|
|
25
|
+
/** String name for each subscription level, suitable for display and Redux state. */
|
|
26
|
+
type SubscriptionLevelName = 'hobby' | 'dev' | 'pro' | 'enterprise';
|
|
27
|
+
/** Maps numeric subscription level to its string level name. */
|
|
28
|
+
declare const subscriptionLevelToName: Record<SubscriptionLevel, SubscriptionLevelName>;
|
|
29
|
+
/** All valid subscription levels, ordered from least to most severe. */
|
|
30
|
+
declare const subscriptionLevels: readonly SubscriptionLevel[];
|
|
31
|
+
type SubscriptionLimits = {
|
|
32
|
+
apps: number;
|
|
33
|
+
seats: number;
|
|
34
|
+
apiKeys: number;
|
|
35
|
+
logRetentionDays: number;
|
|
36
|
+
monthlyLogs: number;
|
|
37
|
+
/** Whether real-time WebSocket log streaming is available. */
|
|
38
|
+
realtimeLogs: boolean;
|
|
39
|
+
/** Minimum log level that triggers a push notification. Infinity means push is disabled. */
|
|
40
|
+
minPushLevel: number;
|
|
41
|
+
};
|
|
42
|
+
/** Per-level resource limits. Use Infinity to mean unlimited or disabled. */
|
|
43
|
+
declare const subscriptionLimits: Record<SubscriptionLevel, SubscriptionLimits>;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Wrapped application encryption key for a specific user.
|
|
47
|
+
*/
|
|
48
|
+
interface AppEncryptedKey {
|
|
49
|
+
userId: string;
|
|
50
|
+
encryptedKey: string;
|
|
51
|
+
keyVersion: number;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* API response shape for a listed or fetched app.
|
|
55
|
+
* encryptedKey is the requesting user's wrapped copy of the app key, or null if none exists.
|
|
56
|
+
*/
|
|
57
|
+
interface AppRecord {
|
|
58
|
+
id: string;
|
|
59
|
+
createdAt: string;
|
|
60
|
+
updatedAt: string;
|
|
61
|
+
name: string;
|
|
62
|
+
color?: string;
|
|
63
|
+
imageUrl?: string;
|
|
64
|
+
teamId?: string;
|
|
65
|
+
encryptedKey: string | null;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* App creation response.
|
|
69
|
+
* Initial wrapped encryption key may optionally be returned.
|
|
70
|
+
*/
|
|
71
|
+
interface AppCreatedRecord extends AppRecord {
|
|
72
|
+
apiKey?: string;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Machine authentication credential.
|
|
76
|
+
*/
|
|
77
|
+
interface ApiKeyRecord {
|
|
78
|
+
id: string;
|
|
79
|
+
createdAt: string;
|
|
80
|
+
updatedAt: string;
|
|
81
|
+
appId: string;
|
|
82
|
+
name?: string;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* External guest granted access to a specific app without being a team member.
|
|
86
|
+
*/
|
|
87
|
+
interface GuestRecord {
|
|
88
|
+
id: string;
|
|
89
|
+
createdAt: string;
|
|
90
|
+
updatedAt: string;
|
|
91
|
+
appId: string;
|
|
92
|
+
userId: string;
|
|
93
|
+
role: 'owner' | 'admin' | 'read' | 'write';
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Filter params for GET /apps.
|
|
97
|
+
*/
|
|
98
|
+
interface AppsQuery {
|
|
99
|
+
teamId?: string;
|
|
100
|
+
from?: string;
|
|
101
|
+
to?: string;
|
|
102
|
+
sort?: string;
|
|
103
|
+
limit?: number;
|
|
104
|
+
cursor?: string;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
type DeviceLinkStatus = 'pending' | 'approved' | 'denied';
|
|
108
|
+
/**
|
|
109
|
+
* Response from POST /device-links.
|
|
110
|
+
*/
|
|
111
|
+
interface DeviceLinkCreatedRecord {
|
|
112
|
+
id: string;
|
|
113
|
+
expiresAt: string;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Response from GET /device-links/:id.
|
|
117
|
+
* encryptedKey is present only when status is 'approved'.
|
|
118
|
+
*/
|
|
119
|
+
interface DeviceLinkRecord {
|
|
120
|
+
id: string;
|
|
121
|
+
status: DeviceLinkStatus;
|
|
122
|
+
encryptedKey?: string;
|
|
123
|
+
expiresAt: string;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
interface FlagRecord {
|
|
127
|
+
id: string;
|
|
128
|
+
createdAt: string;
|
|
129
|
+
updatedAt: string;
|
|
130
|
+
logId: string;
|
|
131
|
+
userId: string;
|
|
132
|
+
}
|
|
133
|
+
interface FlagsQuery {
|
|
134
|
+
from?: string;
|
|
135
|
+
to?: string;
|
|
136
|
+
limit?: number;
|
|
137
|
+
cursor?: string;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Structured log context content.
|
|
142
|
+
*/
|
|
143
|
+
interface LogContext {
|
|
144
|
+
code?: string;
|
|
145
|
+
method?: string;
|
|
146
|
+
line?: number;
|
|
147
|
+
column?: number;
|
|
148
|
+
note?: string;
|
|
149
|
+
[key: string]: unknown;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Encrypted envelope stored on the server.
|
|
153
|
+
* payload = base64(authTag + ciphertext)
|
|
154
|
+
* nonce = base64(random IV)
|
|
155
|
+
* keyVersion enables future rotation support.
|
|
156
|
+
*/
|
|
157
|
+
interface LogEncrypted {
|
|
158
|
+
nonce: string;
|
|
159
|
+
payload: string;
|
|
160
|
+
keyVersion: number;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Plaintext shape of log content — encrypted before sending, never stored plaintext on server.
|
|
164
|
+
*/
|
|
165
|
+
interface LogPayload {
|
|
166
|
+
level: LogLevel;
|
|
167
|
+
message: string;
|
|
168
|
+
requestId?: string;
|
|
169
|
+
traceId?: string;
|
|
170
|
+
context?: LogContext;
|
|
171
|
+
metadata?: Record<string, unknown>;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* API response shape for a stored log.
|
|
175
|
+
* level is plaintext for server-side notification routing; all content is inside encrypted.
|
|
176
|
+
*/
|
|
177
|
+
interface LogRecord {
|
|
178
|
+
id: string;
|
|
179
|
+
createdAt: string;
|
|
180
|
+
updatedAt: string;
|
|
181
|
+
appId: string;
|
|
182
|
+
level: LogLevel;
|
|
183
|
+
encrypted: LogEncrypted;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Sync-protocol params for GET /logs.
|
|
187
|
+
*/
|
|
188
|
+
interface LogsQuery {
|
|
189
|
+
appIds?: string[];
|
|
190
|
+
levels?: number[];
|
|
191
|
+
from?: string;
|
|
192
|
+
to?: string;
|
|
193
|
+
sort?: string;
|
|
194
|
+
limit?: number;
|
|
195
|
+
cursor?: string;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Encrypted note content.
|
|
200
|
+
* payload = base64(authTag + ciphertext)
|
|
201
|
+
* nonce = base64(random IV)
|
|
202
|
+
* keyVersion enables future key rotation.
|
|
203
|
+
*/
|
|
204
|
+
interface NoteEncrypted {
|
|
205
|
+
payload: string;
|
|
206
|
+
nonce: string;
|
|
207
|
+
keyVersion: number;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* A short user-authored note, encrypted with the app key.
|
|
211
|
+
* Visible to all members of the associated app.
|
|
212
|
+
* Query by teamId in NotesQuery to build a cross-app team feed.
|
|
213
|
+
*/
|
|
214
|
+
interface NoteRecord {
|
|
215
|
+
id: string;
|
|
216
|
+
createdAt: string;
|
|
217
|
+
updatedAt: string;
|
|
218
|
+
appId: string;
|
|
219
|
+
userId: string;
|
|
220
|
+
logId?: string;
|
|
221
|
+
encrypted: NoteEncrypted;
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Filter params for GET /notes.
|
|
225
|
+
*/
|
|
226
|
+
interface NotesQuery {
|
|
227
|
+
appId?: string;
|
|
228
|
+
teamId?: string;
|
|
229
|
+
userId?: string;
|
|
230
|
+
logId?: string;
|
|
231
|
+
from?: string;
|
|
232
|
+
to?: string;
|
|
233
|
+
sort?: string;
|
|
234
|
+
limit?: number;
|
|
235
|
+
cursor?: string;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
interface ResponseMetadata {
|
|
239
|
+
requestId: string;
|
|
240
|
+
durationMs: number;
|
|
241
|
+
warnings?: string[];
|
|
242
|
+
cursor?: string | null;
|
|
243
|
+
hasMore?: boolean;
|
|
244
|
+
count?: number;
|
|
245
|
+
hiddenCount?: number;
|
|
246
|
+
}
|
|
247
|
+
interface ApiResponse<T> {
|
|
248
|
+
data: T;
|
|
249
|
+
metadata: ResponseMetadata;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* An organization that owns apps and pays for member usage.
|
|
254
|
+
* Team subscriptionLevel takes precedence over individual member levels.
|
|
255
|
+
*/
|
|
256
|
+
interface TeamRecord {
|
|
257
|
+
id: string;
|
|
258
|
+
createdAt: string;
|
|
259
|
+
updatedAt: string;
|
|
260
|
+
name: string;
|
|
261
|
+
color?: string;
|
|
262
|
+
imageUrl?: string;
|
|
263
|
+
subscriptionLevel: SubscriptionLevel;
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Membership of a user in a team.
|
|
267
|
+
*/
|
|
268
|
+
interface TeamMemberRecord {
|
|
269
|
+
id: string;
|
|
270
|
+
createdAt: string;
|
|
271
|
+
updatedAt: string;
|
|
272
|
+
teamId: string;
|
|
273
|
+
userId: string;
|
|
274
|
+
role: 'owner' | 'admin' | 'member';
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Filter params for GET /teams.
|
|
278
|
+
*/
|
|
279
|
+
interface TeamsQuery {
|
|
280
|
+
sort?: string;
|
|
281
|
+
limit?: number;
|
|
282
|
+
cursor?: string;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* A single time bucket in a timeseries response.
|
|
287
|
+
* date is an ISO date string (YYYY-MM-DD for 'day', ISO datetime for 'hour').
|
|
288
|
+
* byLevel optionally breaks down the count per LogLevel for severity-tinted rendering.
|
|
289
|
+
*/
|
|
290
|
+
interface TimeseriesBucket {
|
|
291
|
+
date: string;
|
|
292
|
+
count: number;
|
|
293
|
+
byLevel?: Partial<Record<number, number>>;
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Generic timeseries aggregate response. Reusable across logs, notifications, messages, etc.
|
|
297
|
+
*/
|
|
298
|
+
interface TimeseriesResponse {
|
|
299
|
+
buckets: TimeseriesBucket[];
|
|
300
|
+
from: string;
|
|
301
|
+
to: string;
|
|
302
|
+
interval: 'day' | 'hour';
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Filter params for GET /logs/timeseries.
|
|
306
|
+
*/
|
|
307
|
+
interface LogTimeseriesQuery {
|
|
308
|
+
appIds?: string[];
|
|
309
|
+
levels?: number[];
|
|
310
|
+
from?: string;
|
|
311
|
+
to?: string;
|
|
312
|
+
interval?: 'day' | 'hour';
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
type Appearance = 'system' | 'dark' | 'light';
|
|
316
|
+
interface PushToken {
|
|
317
|
+
token: string;
|
|
318
|
+
deviceId?: string;
|
|
319
|
+
platform?: 'ios' | 'android' | 'web';
|
|
320
|
+
}
|
|
321
|
+
interface NotificationPreference {
|
|
322
|
+
enabled?: boolean;
|
|
323
|
+
minimumLevel?: number;
|
|
324
|
+
lastReadAt?: string;
|
|
325
|
+
}
|
|
326
|
+
interface NotificationPreferences {
|
|
327
|
+
enabled?: boolean;
|
|
328
|
+
minimumLevel?: number;
|
|
329
|
+
perApp?: Record<string, NotificationPreference>;
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* Public user profile returned from API.
|
|
333
|
+
*/
|
|
334
|
+
interface UserRecord {
|
|
335
|
+
id: string;
|
|
336
|
+
createdAt: string;
|
|
337
|
+
updatedAt: string;
|
|
338
|
+
email: string;
|
|
339
|
+
name?: string;
|
|
340
|
+
publicKey?: string;
|
|
341
|
+
appearance?: Appearance;
|
|
342
|
+
color?: string;
|
|
343
|
+
imageUrl?: string;
|
|
344
|
+
agreedToTermsVersion?: string;
|
|
345
|
+
notificationPreferences: NotificationPreferences;
|
|
346
|
+
pushTokens: PushToken[];
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
declare const isValidAppearance: (value: unknown) => value is Appearance;
|
|
350
|
+
/** Accepts 3- and 6-digit hex color strings (#rgb, #rrggbb). */
|
|
351
|
+
declare const isValidColor: (value: string) => boolean;
|
|
352
|
+
declare const isValidLogLevel: (value: unknown) => value is LogLevel;
|
|
353
|
+
declare const isValidSubscriptionLevel: (value: unknown) => value is SubscriptionLevel;
|
|
354
|
+
declare const isValidDeviceLinkStatus: (value: unknown) => value is DeviceLinkStatus;
|
|
355
|
+
declare const isValidTeamMemberRole: (value: unknown) => value is TeamMemberRecord["role"];
|
|
356
|
+
/** Accepts any valid absolute URL (https://..., http://..., etc.). */
|
|
357
|
+
declare const isValidImageUrl: (value: unknown) => value is string;
|
|
358
|
+
|
|
359
|
+
export { type ApiKeyRecord, type ApiResponse, type AppCreatedRecord, type AppEncryptedKey, type AppRecord, type Appearance, type AppsQuery, type DeviceLinkCreatedRecord, type DeviceLinkRecord, type DeviceLinkStatus, type FlagRecord, type FlagsQuery, type GuestRecord, type LogContext, type LogEncrypted, LogLevel, type LogLevelName, type LogPayload, type LogRecord, type LogTimeseriesQuery, type LogsQuery, type NoteEncrypted, type NoteRecord, type NotesQuery, type NotificationPreference, type NotificationPreferences, type PushToken, type ResponseMetadata, SubscriptionLevel, type SubscriptionLevelName, type SubscriptionLimits, type TeamMemberRecord, type TeamRecord, type TeamsQuery, type TimeseriesBucket, type TimeseriesResponse, type UserRecord, isValidAppearance, isValidColor, isValidDeviceLinkStatus, isValidImageUrl, isValidLogLevel, isValidSubscriptionLevel, isValidTeamMemberRole, logLevelNameToLevel, logLevelToName, logLevels, subscriptionLevelToName, subscriptionLevels, subscriptionLimits };
|