hydrousdb 1.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 +686 -0
- package/dist/analytics/index.d.mts +178 -0
- package/dist/analytics/index.d.ts +178 -0
- package/dist/analytics/index.js +221 -0
- package/dist/analytics/index.js.map +1 -0
- package/dist/analytics/index.mjs +219 -0
- package/dist/analytics/index.mjs.map +1 -0
- package/dist/auth/index.d.mts +180 -0
- package/dist/auth/index.d.ts +180 -0
- package/dist/auth/index.js +220 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/index.mjs +218 -0
- package/dist/auth/index.mjs.map +1 -0
- package/dist/http-CIXLF5GV.d.mts +466 -0
- package/dist/http-CIXLF5GV.d.ts +466 -0
- package/dist/index.d.mts +73 -0
- package/dist/index.d.ts +73 -0
- package/dist/index.js +810 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +801 -0
- package/dist/index.mjs.map +1 -0
- package/dist/records/index.d.mts +124 -0
- package/dist/records/index.d.ts +124 -0
- package/dist/records/index.js +226 -0
- package/dist/records/index.js.map +1 -0
- package/dist/records/index.mjs +224 -0
- package/dist/records/index.mjs.map +1 -0
- package/package.json +67 -0
|
@@ -0,0 +1,466 @@
|
|
|
1
|
+
type FilterOp = '==' | '!=' | '>' | '<' | '>=' | '<=' | 'contains';
|
|
2
|
+
interface Filter {
|
|
3
|
+
field: string;
|
|
4
|
+
op: FilterOp;
|
|
5
|
+
value: string | number | boolean;
|
|
6
|
+
}
|
|
7
|
+
interface PaginationMeta {
|
|
8
|
+
nextCursor: string | null;
|
|
9
|
+
hasMore: boolean;
|
|
10
|
+
limit?: number;
|
|
11
|
+
}
|
|
12
|
+
interface ApiMeta extends PaginationMeta {
|
|
13
|
+
bucketKey?: string;
|
|
14
|
+
projectId?: string;
|
|
15
|
+
retrievedAt?: number;
|
|
16
|
+
filters?: Filter[];
|
|
17
|
+
timeScope?: string;
|
|
18
|
+
year?: string;
|
|
19
|
+
sortOrder?: 'asc' | 'desc';
|
|
20
|
+
}
|
|
21
|
+
interface RequestOptions {
|
|
22
|
+
/** Abort signal for cancellation */
|
|
23
|
+
signal?: AbortSignal;
|
|
24
|
+
/** Additional headers merged into every request */
|
|
25
|
+
headers?: Record<string, string>;
|
|
26
|
+
}
|
|
27
|
+
interface HydrousConfig {
|
|
28
|
+
/** Your HydrousDB API key */
|
|
29
|
+
apiKey: string;
|
|
30
|
+
/** Your bucket key */
|
|
31
|
+
bucketKey: string;
|
|
32
|
+
/** Override the default base URL (advanced use) */
|
|
33
|
+
baseUrl?: string;
|
|
34
|
+
/** Request timeout in milliseconds (default: 30_000) */
|
|
35
|
+
timeout?: number;
|
|
36
|
+
/** Number of times to retry on network errors (default: 2) */
|
|
37
|
+
retries?: number;
|
|
38
|
+
}
|
|
39
|
+
type RecordData = Record<string, unknown>;
|
|
40
|
+
interface HydrousRecord {
|
|
41
|
+
id: string;
|
|
42
|
+
created_at?: number;
|
|
43
|
+
updated_at?: number;
|
|
44
|
+
[key: string]: unknown;
|
|
45
|
+
}
|
|
46
|
+
interface HistoryEntry {
|
|
47
|
+
generation: string | null;
|
|
48
|
+
savedAt: number | null;
|
|
49
|
+
savedBy: string | null;
|
|
50
|
+
sizeBytes: number | null;
|
|
51
|
+
}
|
|
52
|
+
interface GetRecordOptions {
|
|
53
|
+
showHistory?: boolean;
|
|
54
|
+
}
|
|
55
|
+
interface GetRecordResponse {
|
|
56
|
+
success: true;
|
|
57
|
+
data: HydrousRecord;
|
|
58
|
+
meta: {
|
|
59
|
+
id: string;
|
|
60
|
+
bucketKey: string;
|
|
61
|
+
projectId: string;
|
|
62
|
+
retrievedAt: number;
|
|
63
|
+
historyCount?: number;
|
|
64
|
+
};
|
|
65
|
+
history?: HistoryEntry[];
|
|
66
|
+
}
|
|
67
|
+
interface GetSnapshotResponse {
|
|
68
|
+
success: true;
|
|
69
|
+
data: HydrousRecord;
|
|
70
|
+
meta: {
|
|
71
|
+
id: string;
|
|
72
|
+
generation: string;
|
|
73
|
+
historical: true;
|
|
74
|
+
bucketKey: string;
|
|
75
|
+
projectId: string;
|
|
76
|
+
retrievedAt: number;
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
interface QueryOptions {
|
|
80
|
+
/** ISO date string or relative shorthand e.g. "7d", "30d" */
|
|
81
|
+
timeScope?: string;
|
|
82
|
+
/** Year restriction for monthly GCS walk e.g. "26" or "2026" */
|
|
83
|
+
year?: string;
|
|
84
|
+
filters?: Filter[];
|
|
85
|
+
sortOrder?: 'asc' | 'desc';
|
|
86
|
+
limit?: number;
|
|
87
|
+
/** Opaque cursor from a previous response's meta.nextCursor */
|
|
88
|
+
cursor?: string;
|
|
89
|
+
/** Comma-separated field names to return */
|
|
90
|
+
fields?: string;
|
|
91
|
+
}
|
|
92
|
+
interface QueryResponse<T extends RecordData = RecordData> {
|
|
93
|
+
success: true;
|
|
94
|
+
data: (T & HydrousRecord)[];
|
|
95
|
+
meta: ApiMeta;
|
|
96
|
+
}
|
|
97
|
+
interface InsertRecordPayload {
|
|
98
|
+
values: RecordData;
|
|
99
|
+
/** Fields to index for querying */
|
|
100
|
+
queryableFields?: string[];
|
|
101
|
+
userEmail?: string;
|
|
102
|
+
}
|
|
103
|
+
interface InsertRecordResponse {
|
|
104
|
+
success: true;
|
|
105
|
+
data: HydrousRecord;
|
|
106
|
+
meta: {
|
|
107
|
+
id: string;
|
|
108
|
+
bucketKey: string;
|
|
109
|
+
projectId: string;
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
interface UpdateRecordPayload {
|
|
113
|
+
recordId: string;
|
|
114
|
+
values: RecordData;
|
|
115
|
+
userEmail?: string;
|
|
116
|
+
reason?: string;
|
|
117
|
+
track_record_history?: boolean;
|
|
118
|
+
}
|
|
119
|
+
interface UpdateRecordResponse {
|
|
120
|
+
success: true;
|
|
121
|
+
meta: {
|
|
122
|
+
id: string;
|
|
123
|
+
updatedAt: number;
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
interface DeleteRecordResponse {
|
|
127
|
+
success: true;
|
|
128
|
+
meta: {
|
|
129
|
+
id: string;
|
|
130
|
+
deleted: true;
|
|
131
|
+
deletedAt: number;
|
|
132
|
+
deletedBy: string;
|
|
133
|
+
bucketKey: string;
|
|
134
|
+
projectId: string;
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
interface RecordExistsInfo {
|
|
138
|
+
exists: boolean;
|
|
139
|
+
id: string;
|
|
140
|
+
createdAt: string;
|
|
141
|
+
updatedAt: string;
|
|
142
|
+
sizeBytes: string;
|
|
143
|
+
}
|
|
144
|
+
interface BatchUpdateItem {
|
|
145
|
+
recordId: string;
|
|
146
|
+
values: RecordData;
|
|
147
|
+
}
|
|
148
|
+
interface BatchUpdatePayload {
|
|
149
|
+
updates: BatchUpdateItem[];
|
|
150
|
+
userEmail?: string;
|
|
151
|
+
}
|
|
152
|
+
interface BatchResult {
|
|
153
|
+
successful: number;
|
|
154
|
+
failed: number;
|
|
155
|
+
errors?: Array<{
|
|
156
|
+
recordId: string;
|
|
157
|
+
error: string;
|
|
158
|
+
}>;
|
|
159
|
+
}
|
|
160
|
+
interface BatchUpdateResponse {
|
|
161
|
+
success: true;
|
|
162
|
+
data: BatchResult;
|
|
163
|
+
meta: {
|
|
164
|
+
count: number;
|
|
165
|
+
bucketKey: string;
|
|
166
|
+
projectId: string;
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
interface BatchDeletePayload {
|
|
170
|
+
recordIds: string[];
|
|
171
|
+
userEmail?: string;
|
|
172
|
+
}
|
|
173
|
+
interface BatchDeleteResponse {
|
|
174
|
+
success: true;
|
|
175
|
+
data: BatchResult;
|
|
176
|
+
meta: {
|
|
177
|
+
count: number;
|
|
178
|
+
bucketKey: string;
|
|
179
|
+
projectId: string;
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
interface BatchInsertPayload {
|
|
183
|
+
records: RecordData[];
|
|
184
|
+
queryableFields?: string[];
|
|
185
|
+
userEmail?: string;
|
|
186
|
+
}
|
|
187
|
+
interface BatchInsertResponse {
|
|
188
|
+
success: boolean;
|
|
189
|
+
data: HydrousRecord[];
|
|
190
|
+
errors?: Array<{
|
|
191
|
+
index: number;
|
|
192
|
+
error: string;
|
|
193
|
+
}>;
|
|
194
|
+
meta: {
|
|
195
|
+
totalProcessed: number;
|
|
196
|
+
successful: number;
|
|
197
|
+
failed: number;
|
|
198
|
+
bucketKey: string;
|
|
199
|
+
projectId: string;
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
interface AuthUser {
|
|
203
|
+
id: string;
|
|
204
|
+
email: string;
|
|
205
|
+
fullName?: string | null;
|
|
206
|
+
role?: string;
|
|
207
|
+
emailVerified?: boolean;
|
|
208
|
+
accountStatus?: string;
|
|
209
|
+
createdAt?: number;
|
|
210
|
+
updatedAt?: number;
|
|
211
|
+
lastLoginAt?: number | null;
|
|
212
|
+
[key: string]: unknown;
|
|
213
|
+
}
|
|
214
|
+
interface SessionInfo {
|
|
215
|
+
sessionId: string;
|
|
216
|
+
refreshToken: string;
|
|
217
|
+
expiresAt: number;
|
|
218
|
+
}
|
|
219
|
+
interface SignUpPayload {
|
|
220
|
+
email: string;
|
|
221
|
+
password: string;
|
|
222
|
+
fullName?: string;
|
|
223
|
+
[key: string]: unknown;
|
|
224
|
+
}
|
|
225
|
+
interface SignUpResponse {
|
|
226
|
+
success: true;
|
|
227
|
+
message: string;
|
|
228
|
+
data: AuthUser;
|
|
229
|
+
session: SessionInfo;
|
|
230
|
+
meta: {
|
|
231
|
+
userId: string;
|
|
232
|
+
email: string;
|
|
233
|
+
requiresVerification: boolean;
|
|
234
|
+
requestId: string;
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
interface SignInPayload {
|
|
238
|
+
email: string;
|
|
239
|
+
password: string;
|
|
240
|
+
}
|
|
241
|
+
interface SignInResponse {
|
|
242
|
+
success: true;
|
|
243
|
+
message: string;
|
|
244
|
+
data: AuthUser;
|
|
245
|
+
session: SessionInfo;
|
|
246
|
+
meta: {
|
|
247
|
+
userId: string;
|
|
248
|
+
lastLogin: number | null;
|
|
249
|
+
requestId: string;
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
interface SignOutPayload {
|
|
253
|
+
sessionId?: string;
|
|
254
|
+
allDevices?: boolean;
|
|
255
|
+
userId?: string;
|
|
256
|
+
}
|
|
257
|
+
interface ValidateSessionResponse {
|
|
258
|
+
success: true;
|
|
259
|
+
data: AuthUser;
|
|
260
|
+
session: {
|
|
261
|
+
sessionId: string;
|
|
262
|
+
expiresAt: number;
|
|
263
|
+
};
|
|
264
|
+
requestId: string;
|
|
265
|
+
}
|
|
266
|
+
interface RefreshSessionResponse {
|
|
267
|
+
success: true;
|
|
268
|
+
data: AuthUser;
|
|
269
|
+
session: SessionInfo;
|
|
270
|
+
requestId: string;
|
|
271
|
+
}
|
|
272
|
+
interface GetUserResponse {
|
|
273
|
+
success: true;
|
|
274
|
+
data: AuthUser;
|
|
275
|
+
meta: {
|
|
276
|
+
userId: string;
|
|
277
|
+
requestId: string;
|
|
278
|
+
timestamp: number;
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
interface ListUsersResponse {
|
|
282
|
+
success: true;
|
|
283
|
+
data: AuthUser[];
|
|
284
|
+
meta: PaginationMeta & {
|
|
285
|
+
requestId: string;
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
interface UpdateUserPayload {
|
|
289
|
+
userId: string;
|
|
290
|
+
updates: Partial<AuthUser> & Record<string, unknown>;
|
|
291
|
+
}
|
|
292
|
+
interface UpdateUserResponse {
|
|
293
|
+
success: true;
|
|
294
|
+
message: string;
|
|
295
|
+
data: AuthUser;
|
|
296
|
+
meta: {
|
|
297
|
+
userId: string;
|
|
298
|
+
requestId: string;
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
interface PasswordChangePayload {
|
|
302
|
+
userId: string;
|
|
303
|
+
oldPassword: string;
|
|
304
|
+
newPassword: string;
|
|
305
|
+
}
|
|
306
|
+
interface PasswordResetRequestPayload {
|
|
307
|
+
email: string;
|
|
308
|
+
}
|
|
309
|
+
interface PasswordResetConfirmPayload {
|
|
310
|
+
resetToken: string;
|
|
311
|
+
newPassword: string;
|
|
312
|
+
}
|
|
313
|
+
interface EmailVerifyRequestPayload {
|
|
314
|
+
userId: string;
|
|
315
|
+
}
|
|
316
|
+
interface EmailVerifyConfirmPayload {
|
|
317
|
+
verifyToken: string;
|
|
318
|
+
}
|
|
319
|
+
interface AccountLockPayload {
|
|
320
|
+
userId: string;
|
|
321
|
+
/** Duration in ms — defaults to 15 min */
|
|
322
|
+
duration?: number;
|
|
323
|
+
}
|
|
324
|
+
interface AccountLockResponse {
|
|
325
|
+
success: true;
|
|
326
|
+
message: string;
|
|
327
|
+
data: {
|
|
328
|
+
lockedUntil: number;
|
|
329
|
+
unlockTime: string;
|
|
330
|
+
};
|
|
331
|
+
meta: {
|
|
332
|
+
userId: string;
|
|
333
|
+
requestId: string;
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
type AnalyticsQueryType = 'count' | 'distribution' | 'sum' | 'timeSeries' | 'fieldTimeSeries' | 'topN' | 'stats' | 'records' | 'multiMetric' | 'storageStats' | 'crossBucket';
|
|
337
|
+
interface DateRange {
|
|
338
|
+
/** ISO date string "YYYY-MM-DD", epoch ms, or year string "26"/"2026" */
|
|
339
|
+
startDate?: string;
|
|
340
|
+
endDate?: string;
|
|
341
|
+
year?: string;
|
|
342
|
+
month?: string;
|
|
343
|
+
day?: string;
|
|
344
|
+
}
|
|
345
|
+
interface MultiMetricItem {
|
|
346
|
+
name: string;
|
|
347
|
+
field: string;
|
|
348
|
+
aggregation: 'sum' | 'avg' | 'min' | 'max' | 'count';
|
|
349
|
+
}
|
|
350
|
+
interface AnalyticsQuery {
|
|
351
|
+
queryType: AnalyticsQueryType;
|
|
352
|
+
dateRange?: DateRange;
|
|
353
|
+
field?: string;
|
|
354
|
+
groupBy?: string;
|
|
355
|
+
labelField?: string;
|
|
356
|
+
aggregation?: 'sum' | 'avg' | 'min' | 'max' | 'count';
|
|
357
|
+
granularity?: 'hour' | 'day' | 'week' | 'month';
|
|
358
|
+
filters?: Filter[];
|
|
359
|
+
selectFields?: string[];
|
|
360
|
+
limit?: number;
|
|
361
|
+
offset?: number;
|
|
362
|
+
orderBy?: string;
|
|
363
|
+
order?: 'asc' | 'desc';
|
|
364
|
+
n?: number;
|
|
365
|
+
/** For 'multiMetric' — array of { name, field, aggregation } */
|
|
366
|
+
metrics?: MultiMetricItem[];
|
|
367
|
+
/** For 'crossBucket' — list of bucket keys to compare */
|
|
368
|
+
bucketKeys?: string[];
|
|
369
|
+
}
|
|
370
|
+
interface CountResult {
|
|
371
|
+
count: number;
|
|
372
|
+
}
|
|
373
|
+
interface DistributionItem {
|
|
374
|
+
value: string;
|
|
375
|
+
count: number;
|
|
376
|
+
}
|
|
377
|
+
interface SumResult {
|
|
378
|
+
total: number;
|
|
379
|
+
groups?: Array<{
|
|
380
|
+
group: string;
|
|
381
|
+
total: number;
|
|
382
|
+
}>;
|
|
383
|
+
}
|
|
384
|
+
interface TimeSeriesPoint {
|
|
385
|
+
date: string;
|
|
386
|
+
count: number;
|
|
387
|
+
}
|
|
388
|
+
interface FieldTimeSeriesPoint {
|
|
389
|
+
date: string;
|
|
390
|
+
value: number;
|
|
391
|
+
}
|
|
392
|
+
interface TopNItem {
|
|
393
|
+
label: string;
|
|
394
|
+
value: string;
|
|
395
|
+
count: number;
|
|
396
|
+
}
|
|
397
|
+
interface FieldStatsResult {
|
|
398
|
+
min: number;
|
|
399
|
+
max: number;
|
|
400
|
+
avg: number;
|
|
401
|
+
stddev: number;
|
|
402
|
+
count: number;
|
|
403
|
+
sum: number;
|
|
404
|
+
p50: number;
|
|
405
|
+
p90: number;
|
|
406
|
+
p99: number;
|
|
407
|
+
}
|
|
408
|
+
interface FilteredRecordsResult {
|
|
409
|
+
data: RecordData[];
|
|
410
|
+
hasMore: boolean;
|
|
411
|
+
offset: number;
|
|
412
|
+
limit: number;
|
|
413
|
+
}
|
|
414
|
+
interface StorageStatsResult {
|
|
415
|
+
totalRecords: number;
|
|
416
|
+
totalBytes: number;
|
|
417
|
+
avgBytes: number;
|
|
418
|
+
minBytes: number;
|
|
419
|
+
maxBytes: number;
|
|
420
|
+
}
|
|
421
|
+
interface AnalyticsResponse {
|
|
422
|
+
success: true;
|
|
423
|
+
data: unknown;
|
|
424
|
+
meta?: Record<string, unknown>;
|
|
425
|
+
}
|
|
426
|
+
interface HydrousErrorBody {
|
|
427
|
+
success: false;
|
|
428
|
+
error: string;
|
|
429
|
+
code?: string;
|
|
430
|
+
details?: string[];
|
|
431
|
+
requestId?: string;
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
interface HttpClientConfig {
|
|
435
|
+
apiKey: string;
|
|
436
|
+
bucketKey: string;
|
|
437
|
+
baseUrl?: string;
|
|
438
|
+
timeout?: number;
|
|
439
|
+
retries?: number;
|
|
440
|
+
}
|
|
441
|
+
declare class HttpClient {
|
|
442
|
+
readonly baseUrl: string;
|
|
443
|
+
readonly bucketKey: string;
|
|
444
|
+
private readonly apiKey;
|
|
445
|
+
private readonly timeout;
|
|
446
|
+
private readonly retries;
|
|
447
|
+
constructor(config: HttpClientConfig);
|
|
448
|
+
request<T>(method: string, path: string, options?: {
|
|
449
|
+
body?: unknown;
|
|
450
|
+
params?: Record<string, string | number | boolean | undefined | null>;
|
|
451
|
+
signal?: AbortSignal;
|
|
452
|
+
headers?: Record<string, string>;
|
|
453
|
+
/** Return raw Response instead of parsed JSON (used by HEAD) */
|
|
454
|
+
raw?: boolean;
|
|
455
|
+
}): Promise<T>;
|
|
456
|
+
get<T>(path: string, params?: Record<string, string | number | boolean | undefined | null>, opts?: RequestOptions): Promise<T>;
|
|
457
|
+
post<T>(path: string, body?: unknown, opts?: RequestOptions): Promise<T>;
|
|
458
|
+
patch<T>(path: string, body?: unknown, opts?: RequestOptions): Promise<T>;
|
|
459
|
+
delete<T>(path: string, params?: Record<string, string | number | boolean | undefined | null>, opts?: RequestOptions): Promise<T>;
|
|
460
|
+
head(path: string, params?: Record<string, string | number | boolean | undefined | null>, opts?: RequestOptions): Promise<Response>;
|
|
461
|
+
private buildUrl;
|
|
462
|
+
private buildSignal;
|
|
463
|
+
private executeWithRetry;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
export { type SignUpResponse as $, type AccountLockPayload as A, type BatchDeletePayload as B, type CountResult as C, type DateRange as D, type EmailVerifyConfirmPayload as E, type FieldStatsResult as F, type GetRecordOptions as G, type HydrousErrorBody as H, type InsertRecordPayload as I, type InsertRecordResponse as J, type PasswordChangePayload as K, type ListUsersResponse as L, type MultiMetricItem as M, type PasswordResetConfirmPayload as N, type PasswordResetRequestPayload as O, type PaginationMeta as P, type QueryOptions as Q, type QueryResponse as R, type RecordData as S, type RecordExistsInfo as T, type RefreshSessionResponse as U, type RequestOptions as V, type SessionInfo as W, type SignInPayload as X, type SignInResponse as Y, type SignOutPayload as Z, type SignUpPayload as _, type HydrousConfig as a, type StorageStatsResult as a0, type SumResult as a1, type TimeSeriesPoint as a2, type TopNItem as a3, type UpdateRecordPayload as a4, type UpdateRecordResponse as a5, type UpdateUserPayload as a6, type UpdateUserResponse as a7, type ValidateSessionResponse as a8, HttpClient as a9, type AccountLockResponse as b, type AnalyticsQuery as c, type AnalyticsQueryType as d, type AnalyticsResponse as e, type ApiMeta as f, type AuthUser as g, type BatchDeleteResponse as h, type BatchInsertPayload as i, type BatchInsertResponse as j, type BatchResult as k, type BatchUpdateItem as l, type BatchUpdatePayload as m, type BatchUpdateResponse as n, type DeleteRecordResponse as o, type DistributionItem as p, type EmailVerifyRequestPayload as q, type FieldTimeSeriesPoint as r, type Filter as s, type FilterOp as t, type FilteredRecordsResult as u, type GetRecordResponse as v, type GetSnapshotResponse as w, type GetUserResponse as x, type HistoryEntry as y, type HydrousRecord as z };
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { RecordsClient } from './records/index.mjs';
|
|
2
|
+
import { AuthClient } from './auth/index.mjs';
|
|
3
|
+
import { AnalyticsClient } from './analytics/index.mjs';
|
|
4
|
+
import { H as HydrousErrorBody, a as HydrousConfig } from './http-CIXLF5GV.mjs';
|
|
5
|
+
export { A as AccountLockPayload, b as AccountLockResponse, c as AnalyticsQuery, d as AnalyticsQueryType, e as AnalyticsResponse, f as ApiMeta, g as AuthUser, B as BatchDeletePayload, h as BatchDeleteResponse, i as BatchInsertPayload, j as BatchInsertResponse, k as BatchResult, l as BatchUpdateItem, m as BatchUpdatePayload, n as BatchUpdateResponse, C as CountResult, D as DateRange, o as DeleteRecordResponse, p as DistributionItem, E as EmailVerifyConfirmPayload, q as EmailVerifyRequestPayload, F as FieldStatsResult, r as FieldTimeSeriesPoint, s as Filter, t as FilterOp, u as FilteredRecordsResult, G as GetRecordOptions, v as GetRecordResponse, w as GetSnapshotResponse, x as GetUserResponse, y as HistoryEntry, z as HydrousRecord, I as InsertRecordPayload, J as InsertRecordResponse, L as ListUsersResponse, M as MultiMetricItem, P as PaginationMeta, K as PasswordChangePayload, N as PasswordResetConfirmPayload, O as PasswordResetRequestPayload, Q as QueryOptions, R as QueryResponse, S as RecordData, T as RecordExistsInfo, U as RefreshSessionResponse, V as RequestOptions, W as SessionInfo, X as SignInPayload, Y as SignInResponse, Z as SignOutPayload, _ as SignUpPayload, $ as SignUpResponse, a0 as StorageStatsResult, a1 as SumResult, a2 as TimeSeriesPoint, a3 as TopNItem, a4 as UpdateRecordPayload, a5 as UpdateRecordResponse, a6 as UpdateUserPayload, a7 as UpdateUserResponse, a8 as ValidateSessionResponse } from './http-CIXLF5GV.mjs';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Thrown for any non-2xx response from the HydrousDB API.
|
|
9
|
+
*/
|
|
10
|
+
declare class HydrousError extends Error {
|
|
11
|
+
/** HTTP status code */
|
|
12
|
+
readonly status: number;
|
|
13
|
+
/** Machine-readable error code from the API */
|
|
14
|
+
readonly code: string | undefined;
|
|
15
|
+
/** Detailed validation messages */
|
|
16
|
+
readonly details: string[];
|
|
17
|
+
/** Server-generated request ID for support */
|
|
18
|
+
readonly requestId: string | undefined;
|
|
19
|
+
constructor(body: HydrousErrorBody, status: number);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Thrown when a network request fails (e.g. no connectivity, DNS failure).
|
|
23
|
+
*/
|
|
24
|
+
declare class HydrousNetworkError extends Error {
|
|
25
|
+
readonly cause: unknown;
|
|
26
|
+
constructor(message: string, cause?: unknown);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Thrown when a request exceeds the configured timeout.
|
|
30
|
+
*/
|
|
31
|
+
declare class HydrousTimeoutError extends Error {
|
|
32
|
+
constructor(timeoutMs: number);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* The main entry point for the HydrousDB SDK.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* import { createClient } from 'hydrousdb';
|
|
40
|
+
*
|
|
41
|
+
* const db = createClient({
|
|
42
|
+
* apiKey: 'your-api-key',
|
|
43
|
+
* bucketKey: 'your-bucket',
|
|
44
|
+
* });
|
|
45
|
+
*
|
|
46
|
+
* // Records
|
|
47
|
+
* const { data } = await db.records.get('rec_abc123');
|
|
48
|
+
*
|
|
49
|
+
* // Auth
|
|
50
|
+
* const { data, session } = await db.auth.signIn({ email: 'a@b.com', password: '...' });
|
|
51
|
+
*
|
|
52
|
+
* // Analytics
|
|
53
|
+
* const { data } = await db.analytics.count();
|
|
54
|
+
*/
|
|
55
|
+
declare class HydrousClient {
|
|
56
|
+
/** Record CRUD and batch operations */
|
|
57
|
+
readonly records: RecordsClient;
|
|
58
|
+
/** User authentication and session management */
|
|
59
|
+
readonly auth: AuthClient;
|
|
60
|
+
/** Analytics and aggregations */
|
|
61
|
+
readonly analytics: AnalyticsClient;
|
|
62
|
+
private readonly http;
|
|
63
|
+
constructor(config: HydrousConfig);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Create a HydrousDB client.
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* const db = createClient({ apiKey: '...', bucketKey: '...' });
|
|
70
|
+
*/
|
|
71
|
+
declare function createClient(config: HydrousConfig): HydrousClient;
|
|
72
|
+
|
|
73
|
+
export { AnalyticsClient, AuthClient, HydrousClient, HydrousConfig, HydrousError, HydrousErrorBody, HydrousNetworkError, HydrousTimeoutError, RecordsClient, createClient };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { RecordsClient } from './records/index.js';
|
|
2
|
+
import { AuthClient } from './auth/index.js';
|
|
3
|
+
import { AnalyticsClient } from './analytics/index.js';
|
|
4
|
+
import { H as HydrousErrorBody, a as HydrousConfig } from './http-CIXLF5GV.js';
|
|
5
|
+
export { A as AccountLockPayload, b as AccountLockResponse, c as AnalyticsQuery, d as AnalyticsQueryType, e as AnalyticsResponse, f as ApiMeta, g as AuthUser, B as BatchDeletePayload, h as BatchDeleteResponse, i as BatchInsertPayload, j as BatchInsertResponse, k as BatchResult, l as BatchUpdateItem, m as BatchUpdatePayload, n as BatchUpdateResponse, C as CountResult, D as DateRange, o as DeleteRecordResponse, p as DistributionItem, E as EmailVerifyConfirmPayload, q as EmailVerifyRequestPayload, F as FieldStatsResult, r as FieldTimeSeriesPoint, s as Filter, t as FilterOp, u as FilteredRecordsResult, G as GetRecordOptions, v as GetRecordResponse, w as GetSnapshotResponse, x as GetUserResponse, y as HistoryEntry, z as HydrousRecord, I as InsertRecordPayload, J as InsertRecordResponse, L as ListUsersResponse, M as MultiMetricItem, P as PaginationMeta, K as PasswordChangePayload, N as PasswordResetConfirmPayload, O as PasswordResetRequestPayload, Q as QueryOptions, R as QueryResponse, S as RecordData, T as RecordExistsInfo, U as RefreshSessionResponse, V as RequestOptions, W as SessionInfo, X as SignInPayload, Y as SignInResponse, Z as SignOutPayload, _ as SignUpPayload, $ as SignUpResponse, a0 as StorageStatsResult, a1 as SumResult, a2 as TimeSeriesPoint, a3 as TopNItem, a4 as UpdateRecordPayload, a5 as UpdateRecordResponse, a6 as UpdateUserPayload, a7 as UpdateUserResponse, a8 as ValidateSessionResponse } from './http-CIXLF5GV.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Thrown for any non-2xx response from the HydrousDB API.
|
|
9
|
+
*/
|
|
10
|
+
declare class HydrousError extends Error {
|
|
11
|
+
/** HTTP status code */
|
|
12
|
+
readonly status: number;
|
|
13
|
+
/** Machine-readable error code from the API */
|
|
14
|
+
readonly code: string | undefined;
|
|
15
|
+
/** Detailed validation messages */
|
|
16
|
+
readonly details: string[];
|
|
17
|
+
/** Server-generated request ID for support */
|
|
18
|
+
readonly requestId: string | undefined;
|
|
19
|
+
constructor(body: HydrousErrorBody, status: number);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Thrown when a network request fails (e.g. no connectivity, DNS failure).
|
|
23
|
+
*/
|
|
24
|
+
declare class HydrousNetworkError extends Error {
|
|
25
|
+
readonly cause: unknown;
|
|
26
|
+
constructor(message: string, cause?: unknown);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Thrown when a request exceeds the configured timeout.
|
|
30
|
+
*/
|
|
31
|
+
declare class HydrousTimeoutError extends Error {
|
|
32
|
+
constructor(timeoutMs: number);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* The main entry point for the HydrousDB SDK.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* import { createClient } from 'hydrousdb';
|
|
40
|
+
*
|
|
41
|
+
* const db = createClient({
|
|
42
|
+
* apiKey: 'your-api-key',
|
|
43
|
+
* bucketKey: 'your-bucket',
|
|
44
|
+
* });
|
|
45
|
+
*
|
|
46
|
+
* // Records
|
|
47
|
+
* const { data } = await db.records.get('rec_abc123');
|
|
48
|
+
*
|
|
49
|
+
* // Auth
|
|
50
|
+
* const { data, session } = await db.auth.signIn({ email: 'a@b.com', password: '...' });
|
|
51
|
+
*
|
|
52
|
+
* // Analytics
|
|
53
|
+
* const { data } = await db.analytics.count();
|
|
54
|
+
*/
|
|
55
|
+
declare class HydrousClient {
|
|
56
|
+
/** Record CRUD and batch operations */
|
|
57
|
+
readonly records: RecordsClient;
|
|
58
|
+
/** User authentication and session management */
|
|
59
|
+
readonly auth: AuthClient;
|
|
60
|
+
/** Analytics and aggregations */
|
|
61
|
+
readonly analytics: AnalyticsClient;
|
|
62
|
+
private readonly http;
|
|
63
|
+
constructor(config: HydrousConfig);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Create a HydrousDB client.
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* const db = createClient({ apiKey: '...', bucketKey: '...' });
|
|
70
|
+
*/
|
|
71
|
+
declare function createClient(config: HydrousConfig): HydrousClient;
|
|
72
|
+
|
|
73
|
+
export { AnalyticsClient, AuthClient, HydrousClient, HydrousConfig, HydrousError, HydrousErrorBody, HydrousNetworkError, HydrousTimeoutError, RecordsClient, createClient };
|