@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/dist/fb-v8/index.mjs
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -569,8 +569,8 @@ interface ConnectOptions {
|
|
|
569
569
|
domain?: string;
|
|
570
570
|
/**
|
|
571
571
|
* Transport type preference.
|
|
572
|
-
* - '
|
|
573
|
-
* - '
|
|
572
|
+
* - 'websocket': WebSocket only (default)
|
|
573
|
+
* - 'auto': Try WebTransport first, fall back to WebSocket
|
|
574
574
|
* - 'webtransport': Force WebTransport only (fails if unavailable)
|
|
575
575
|
*/
|
|
576
576
|
transport?: TransportType;
|
|
@@ -608,7 +608,8 @@ interface TransactionDeleteOp {
|
|
|
608
608
|
interface TransactionConditionOp {
|
|
609
609
|
op: 'condition';
|
|
610
610
|
path: string;
|
|
611
|
-
value
|
|
611
|
+
/** The expected value. Pass a DataSnapshot to automatically use raw data (preserves priority metadata for correct hashing). */
|
|
612
|
+
value: unknown | DataSnapshot;
|
|
612
613
|
}
|
|
613
614
|
/** A single operation in a transaction (array syntax) */
|
|
614
615
|
type TransactionOp = TransactionSetOp | TransactionUpdateOp | TransactionDeleteOp | TransactionConditionOp;
|
package/dist/index.d.ts
CHANGED
|
@@ -569,8 +569,8 @@ interface ConnectOptions {
|
|
|
569
569
|
domain?: string;
|
|
570
570
|
/**
|
|
571
571
|
* Transport type preference.
|
|
572
|
-
* - '
|
|
573
|
-
* - '
|
|
572
|
+
* - 'websocket': WebSocket only (default)
|
|
573
|
+
* - 'auto': Try WebTransport first, fall back to WebSocket
|
|
574
574
|
* - 'webtransport': Force WebTransport only (fails if unavailable)
|
|
575
575
|
*/
|
|
576
576
|
transport?: TransportType;
|
|
@@ -608,7 +608,8 @@ interface TransactionDeleteOp {
|
|
|
608
608
|
interface TransactionConditionOp {
|
|
609
609
|
op: 'condition';
|
|
610
610
|
path: string;
|
|
611
|
-
value
|
|
611
|
+
/** The expected value. Pass a DataSnapshot to automatically use raw data (preserves priority metadata for correct hashing). */
|
|
612
|
+
value: unknown | DataSnapshot;
|
|
612
613
|
}
|
|
613
614
|
/** A single operation in a transaction (array syntax) */
|
|
614
615
|
type TransactionOp = TransactionSetOp | TransactionUpdateOp | TransactionDeleteOp | TransactionConditionOp;
|
package/dist/index.js
CHANGED
|
@@ -337,7 +337,7 @@ function wsUrlToWtUrl(wsUrl) {
|
|
|
337
337
|
return url.toString();
|
|
338
338
|
}
|
|
339
339
|
async function createTransport(wsUrl, transportOptions, options = {}) {
|
|
340
|
-
const preferredType = options.transport || "
|
|
340
|
+
const preferredType = options.transport || "websocket";
|
|
341
341
|
const shouldTryWebTransport = (preferredType === "auto" || preferredType === "webtransport") && isWebTransportAvailable();
|
|
342
342
|
if (preferredType === "webtransport" && !isWebTransportAvailable()) {
|
|
343
343
|
throw new Error("WebTransport is not available in this environment");
|
|
@@ -4844,16 +4844,18 @@ var _LarkDatabase = class _LarkDatabase {
|
|
|
4844
4844
|
return { o: "u", p: path, v: op.value };
|
|
4845
4845
|
case "delete":
|
|
4846
4846
|
return { o: "d", p: path };
|
|
4847
|
-
case "condition":
|
|
4848
|
-
|
|
4849
|
-
|
|
4847
|
+
case "condition": {
|
|
4848
|
+
const conditionValue = op.value instanceof DataSnapshot ? op.value.exportVal() : op.value;
|
|
4849
|
+
if (conditionValue !== void 0 && conditionValue !== null) {
|
|
4850
|
+
validateWriteData(conditionValue, "transaction condition");
|
|
4850
4851
|
}
|
|
4851
|
-
if (isPrimitive(
|
|
4852
|
-
return { o: "c", p: path, v:
|
|
4852
|
+
if (isPrimitive(conditionValue)) {
|
|
4853
|
+
return { o: "c", p: path, v: conditionValue };
|
|
4853
4854
|
} else {
|
|
4854
|
-
const hash = await hashValue(
|
|
4855
|
+
const hash = await hashValue(conditionValue);
|
|
4855
4856
|
return { o: "c", p: path, h: hash };
|
|
4856
4857
|
}
|
|
4858
|
+
}
|
|
4857
4859
|
default:
|
|
4858
4860
|
throw new Error(`Unknown transaction operation: ${op.op}`);
|
|
4859
4861
|
}
|
|
@@ -5008,7 +5010,7 @@ var _LarkDatabase = class _LarkDatabase {
|
|
|
5008
5010
|
console.error("Failed to parse message:", data);
|
|
5009
5011
|
return;
|
|
5010
5012
|
}
|
|
5011
|
-
if (process.env
|
|
5013
|
+
if (typeof process !== "undefined" && process.env?.LARK_DEBUG) {
|
|
5012
5014
|
console.log("[LARK] <<< SERVER:", JSON.stringify(message, null, 2));
|
|
5013
5015
|
}
|
|
5014
5016
|
if (isAckMessage(message)) {
|
|
@@ -5074,7 +5076,7 @@ var _LarkDatabase = class _LarkDatabase {
|
|
|
5074
5076
|
if (!this.transport || !this.transport.connected) {
|
|
5075
5077
|
throw new LarkError("not_connected", "Not connected to database");
|
|
5076
5078
|
}
|
|
5077
|
-
if (process.env
|
|
5079
|
+
if (typeof process !== "undefined" && process.env?.LARK_DEBUG) {
|
|
5078
5080
|
console.log("[LARK] >>> CLIENT:", JSON.stringify(message, null, 2));
|
|
5079
5081
|
}
|
|
5080
5082
|
this.transport.send(JSON.stringify(message));
|