@lark-sh/client 0.1.24 → 0.1.25

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.
@@ -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
- if (op.value !== void 0 && op.value !== null) {
4804
- validateWriteData(op.value, "transaction condition");
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(op.value)) {
4807
- return { o: "c", p: path, v: op.value };
4807
+ if (isPrimitive(conditionValue)) {
4808
+ return { o: "c", p: path, v: conditionValue };
4808
4809
  } else {
4809
- const hash = await hashValue(op.value);
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.LARK_DEBUG) {
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.LARK_DEBUG) {
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-MTT7WQB4.mjs.map
5342
+ //# sourceMappingURL=chunk-LCCMBY4S.mjs.map