@lark-sh/client 0.1.24 → 0.1.26
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 +4 -4
- package/dist/{chunk-MTT7WQB4.mjs → chunk-D2DMNW7C.mjs} +12 -10
- package/dist/chunk-D2DMNW7C.mjs.map +1 -0
- package/dist/fb-v8/index.js +11 -9
- package/dist/fb-v8/index.js.map +1 -1
- package/dist/fb-v8/index.mjs +1 -1
- package/dist/index.d.mts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +11 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-MTT7WQB4.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -285,14 +285,14 @@ ref.once('value', successCallback, cancelCallback, context);
|
|
|
285
285
|
|
|
286
286
|
## Transport Options
|
|
287
287
|
|
|
288
|
-
Lark
|
|
288
|
+
Lark uses WebSocket by default. You can opt in to WebTransport for lower latency in supported browsers (Chrome 97+, Edge 97+, Firefox 114+).
|
|
289
289
|
|
|
290
290
|
```typescript
|
|
291
291
|
await db.connect('project/db', {
|
|
292
292
|
anonymous: true,
|
|
293
|
-
transport: '
|
|
294
|
-
// transport: '
|
|
295
|
-
// transport: 'webtransport' // Force WebTransport
|
|
293
|
+
// transport: 'websocket', // Default: WebSocket only
|
|
294
|
+
// transport: 'auto', // Try WebTransport first, fall back to WebSocket
|
|
295
|
+
// transport: 'webtransport' // Force WebTransport (fails if unavailable)
|
|
296
296
|
});
|
|
297
297
|
|
|
298
298
|
// Check which transport is in use
|
|
@@ -292,7 +292,7 @@ function wsUrlToWtUrl(wsUrl) {
|
|
|
292
292
|
return url.toString();
|
|
293
293
|
}
|
|
294
294
|
async function createTransport(wsUrl, transportOptions, options = {}) {
|
|
295
|
-
const preferredType = options.transport || "
|
|
295
|
+
const preferredType = options.transport || "websocket";
|
|
296
296
|
const shouldTryWebTransport = (preferredType === "auto" || preferredType === "webtransport") && isWebTransportAvailable();
|
|
297
297
|
if (preferredType === "webtransport" && !isWebTransportAvailable()) {
|
|
298
298
|
throw new Error("WebTransport is not available in this environment");
|
|
@@ -4799,16 +4799,18 @@ var _LarkDatabase = class _LarkDatabase {
|
|
|
4799
4799
|
return { o: "u", p: path, v: op.value };
|
|
4800
4800
|
case "delete":
|
|
4801
4801
|
return { o: "d", p: path };
|
|
4802
|
-
case "condition":
|
|
4803
|
-
|
|
4804
|
-
|
|
4802
|
+
case "condition": {
|
|
4803
|
+
const conditionValue = op.value instanceof DataSnapshot ? op.value.exportVal() : op.value;
|
|
4804
|
+
if (conditionValue !== void 0 && conditionValue !== null) {
|
|
4805
|
+
validateWriteData(conditionValue, "transaction condition");
|
|
4805
4806
|
}
|
|
4806
|
-
if (isPrimitive(
|
|
4807
|
-
return { o: "c", p: path, v:
|
|
4807
|
+
if (isPrimitive(conditionValue)) {
|
|
4808
|
+
return { o: "c", p: path, v: conditionValue };
|
|
4808
4809
|
} else {
|
|
4809
|
-
const hash = await hashValue(
|
|
4810
|
+
const hash = await hashValue(conditionValue);
|
|
4810
4811
|
return { o: "c", p: path, h: hash };
|
|
4811
4812
|
}
|
|
4813
|
+
}
|
|
4812
4814
|
default:
|
|
4813
4815
|
throw new Error(`Unknown transaction operation: ${op.op}`);
|
|
4814
4816
|
}
|
|
@@ -4963,7 +4965,7 @@ var _LarkDatabase = class _LarkDatabase {
|
|
|
4963
4965
|
console.error("Failed to parse message:", data);
|
|
4964
4966
|
return;
|
|
4965
4967
|
}
|
|
4966
|
-
if (process.env
|
|
4968
|
+
if (typeof process !== "undefined" && process.env?.LARK_DEBUG) {
|
|
4967
4969
|
console.log("[LARK] <<< SERVER:", JSON.stringify(message, null, 2));
|
|
4968
4970
|
}
|
|
4969
4971
|
if (isAckMessage(message)) {
|
|
@@ -5029,7 +5031,7 @@ var _LarkDatabase = class _LarkDatabase {
|
|
|
5029
5031
|
if (!this.transport || !this.transport.connected) {
|
|
5030
5032
|
throw new LarkError("not_connected", "Not connected to database");
|
|
5031
5033
|
}
|
|
5032
|
-
if (process.env
|
|
5034
|
+
if (typeof process !== "undefined" && process.env?.LARK_DEBUG) {
|
|
5033
5035
|
console.log("[LARK] >>> CLIENT:", JSON.stringify(message, null, 2));
|
|
5034
5036
|
}
|
|
5035
5037
|
this.transport.send(JSON.stringify(message));
|
|
@@ -5337,4 +5339,4 @@ export {
|
|
|
5337
5339
|
ServerValue,
|
|
5338
5340
|
LarkDatabase
|
|
5339
5341
|
};
|
|
5340
|
-
//# sourceMappingURL=chunk-
|
|
5342
|
+
//# sourceMappingURL=chunk-D2DMNW7C.mjs.map
|