@solazah/solazah-runtime 0.1.153 → 0.1.155

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solazah/solazah-runtime",
3
- "version": "0.1.153",
3
+ "version": "0.1.155",
4
4
  "main": "index.cjs",
5
5
  "module": "index.js",
6
6
  "types": "types/index.d.ts",
@@ -1,4 +1,10 @@
1
1
  import { default as IpcRenderer } from './IpcRenderer';
2
+ /** 集合里的一项:id 必填,order 可选(手工位次,列表按它排前),其余字段由插件自定。 */
3
+ export interface PluginSettingItem {
4
+ id: string;
5
+ order?: number;
6
+ [key: string]: any;
7
+ }
2
8
  export default class PluginSettings {
3
9
  private transport;
4
10
  constructor(transport?: IpcRenderer);
@@ -30,4 +36,32 @@ export default class PluginSettings {
30
36
  * @returns 无返回。无法定位发起方插件或该 key 对应的设置不存在时不执行任何操作。
31
37
  */
32
38
  removeSetting: (key: string) => Promise<any>;
39
+ /**
40
+ * 列出某个集合里的全部项。集合是一项一行存储的列表(键 = `集合名/项 id`),跨设备同步时逐项合并,
41
+ * 不会整份互相覆盖——列表类数据(自定义命令、链接、分组…)一律用集合,不要整份数组存进一个键。
42
+ * 带 order 的项按 order 排前,其余按写入先后。
43
+ *
44
+ * @param collection 集合名,只能用字母、数字、点、下划线、横线。
45
+ * @param options 可选。legacyKey:旧版把整份数组存在这个键里,那一行还在就先迁成行(缺 order 的按数组下标补)再删掉它,迁移幂等。
46
+ * @returns 项数组,每项带 id;无法定位发起方插件时返回 undefined。
47
+ */
48
+ listItems: (collection: string, options?: {
49
+ legacyKey?: string;
50
+ }) => Promise<PluginSettingItem[] | undefined>;
51
+ /**
52
+ * 写入集合里的一项(有则覆盖,无则新建)。
53
+ *
54
+ * @param collection 集合名。
55
+ * @param item 项,必须带非空字符串 id;可带数字 order 表示手工位次。
56
+ * @returns 无返回。无法定位发起方插件时不执行任何操作。
57
+ */
58
+ putItem: (collection: string, item: PluginSettingItem) => Promise<void>;
59
+ /**
60
+ * 删除集合里的一项;本来就没有时不做任何事。
61
+ *
62
+ * @param collection 集合名。
63
+ * @param id 项的 id。
64
+ * @returns 无返回。无法定位发起方插件时不执行任何操作。
65
+ */
66
+ removeItem: (collection: string, id: string) => Promise<void>;
33
67
  }