@arbidocs/client 0.5.59 → 0.5.60
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 +10 -0
- package/dist/index.cjs +23 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +20 -1
- package/dist/index.d.ts +20 -1
- package/dist/index.js +22 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -281,6 +281,16 @@ import {
|
|
|
281
281
|
} from '@arbidocs/client'
|
|
282
282
|
```
|
|
283
283
|
|
|
284
|
+
### Logger
|
|
285
|
+
|
|
286
|
+
```typescript
|
|
287
|
+
import { configureLogger, logger } from '@arbidocs/client'
|
|
288
|
+
|
|
289
|
+
configureLogger({ verbose: import.meta.env.DEV }) // once, at startup
|
|
290
|
+
logger.error('always printed')
|
|
291
|
+
logger.warn('printed only when verbose') // likewise info, debug
|
|
292
|
+
```
|
|
293
|
+
|
|
284
294
|
## How It Works
|
|
285
295
|
|
|
286
296
|
### Zero-Knowledge Auth
|
package/dist/index.cjs
CHANGED
|
@@ -2406,6 +2406,27 @@ function isMessageType(msg, type) {
|
|
|
2406
2406
|
return msg.type === type;
|
|
2407
2407
|
}
|
|
2408
2408
|
|
|
2409
|
+
// src/logger.ts
|
|
2410
|
+
var verbose = false;
|
|
2411
|
+
function configureLogger(options) {
|
|
2412
|
+
verbose = options.verbose;
|
|
2413
|
+
}
|
|
2414
|
+
var logger = {
|
|
2415
|
+
/** Always printed, production included. */
|
|
2416
|
+
error: (...args) => {
|
|
2417
|
+
console.error(...args);
|
|
2418
|
+
},
|
|
2419
|
+
warn: (...args) => {
|
|
2420
|
+
if (verbose) console.warn(...args);
|
|
2421
|
+
},
|
|
2422
|
+
info: (...args) => {
|
|
2423
|
+
if (verbose) console.info(...args);
|
|
2424
|
+
},
|
|
2425
|
+
debug: (...args) => {
|
|
2426
|
+
if (verbose) console.debug(...args);
|
|
2427
|
+
}
|
|
2428
|
+
};
|
|
2429
|
+
|
|
2409
2430
|
exports.ACCESS_TOKEN_STORAGE_KEY = ACCESS_TOKEN_STORAGE_KEY;
|
|
2410
2431
|
exports.API_PREFIX = API_PREFIX;
|
|
2411
2432
|
exports.CALL_KEY_BYTES = CALL_KEY_BYTES;
|
|
@@ -2430,6 +2451,7 @@ exports.changePassword = changePassword;
|
|
|
2430
2451
|
exports.clearAllData = clearAllData;
|
|
2431
2452
|
exports.clearSession = clearSession;
|
|
2432
2453
|
exports.computeSharedSecret = computeSharedSecret;
|
|
2454
|
+
exports.configureLogger = configureLogger;
|
|
2433
2455
|
exports.createAllWorkspacesOpener = createAllWorkspacesOpener;
|
|
2434
2456
|
exports.createArbiClient = createArbiClient;
|
|
2435
2457
|
exports.createAuthMessage = createAuthMessage;
|
|
@@ -2486,6 +2508,7 @@ exports.initializeDatabase = initializeDatabase;
|
|
|
2486
2508
|
exports.isAbortError = isAbortError;
|
|
2487
2509
|
exports.isEncryptedRecoveryKey = isEncryptedRecoveryKey;
|
|
2488
2510
|
exports.isMessageType = isMessageType;
|
|
2511
|
+
exports.logger = logger;
|
|
2489
2512
|
exports.openCallKeyOf = openCallKeyOf;
|
|
2490
2513
|
exports.openSealedCallKey = openSealedCallKey;
|
|
2491
2514
|
exports.openSealedChatKey = openSealedChatKey;
|