New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

siyuan_api_cache_lib

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

siyuan_api_cache_lib - npm Package Compare versions

Comparing version

to
1.0.7

12

dist/cache/api-cache.js

@@ -71,3 +71,11 @@ import { config } from "../config";

const code = self.frameElement.parentElement.getAttribute(key) || "";
return JSON.parse(code || "");
try {
return JSON.parse(code || "");
}
catch (error) {
// 补丁,弥补之前直接使用函数名作为参数的糊涂行为
const key = getCacheKey({ getBlockAttr: "ss" }[funcName] || funcName, arg);
const code = self.frameElement.parentElement.getAttribute(key) || "";
return JSON.parse(code || "");
}
}

@@ -79,3 +87,3 @@ else {

function getCacheKey(funcName, arg) {
// 存在 缺陷,当函数名称变化时,缓存的 key 也会变化
// 存在 缺陷,当函数名称变化时,缓存的 key 也会变化,所以还是需要主动传递一个 key -> funcName
/** 这里本来是 custom-call 改成 z 是为了在思源内的属性面板中排最后 对于用户来说应该不会很关心这里的数据 */

@@ -82,0 +90,0 @@ return `custom-z-${funcName.toLowerCase()}-${cyrb53(`${funcName}__${JSON.stringify(arg)}`)}`;

2

package.json
{
"name": "siyuan_api_cache_lib",
"version": "1.0.5",
"version": "1.0.7",
"description": "为思源挂件块提供 api 访问的工具库,同时具有缓存 api 调用结果到块属性上以及在非思源笔记环境下使用缓存结果的功能",

@@ -5,0 +5,0 @@ "main": "dist/index.js",