@miot-rn/common-component 1.0.1

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.
Files changed (40) hide show
  1. package/README.md +9 -0
  2. package/dist/index.d.ts +0 -0
  3. package/dist/index.js +0 -0
  4. package/dist/resources/i18n.d.ts +55 -0
  5. package/dist/resources/i18n.js +212 -0
  6. package/dist/service/specs/error-code.d.ts +19 -0
  7. package/dist/service/specs/error-code.js +41 -0
  8. package/dist/service/specs/index.d.ts +95 -0
  9. package/dist/service/specs/index.js +412 -0
  10. package/dist/service/specs/spec.d.ts +10 -0
  11. package/dist/service/specs/spec.js +109 -0
  12. package/dist/service/specs/specCache.d.ts +85 -0
  13. package/dist/service/specs/specCache.js +421 -0
  14. package/dist/service/specs/std-spec.d.ts +5 -0
  15. package/dist/service/specs/std-spec.js +228 -0
  16. package/dist/service/specs/subject.d.ts +20 -0
  17. package/dist/service/specs/subject.js +145 -0
  18. package/dist/service/specs/utils.d.ts +28 -0
  19. package/dist/service/specs/utils.js +46 -0
  20. package/dist/specs/i18n-parser.d.ts +10 -0
  21. package/dist/specs/i18n-parser.js +300 -0
  22. package/dist/specs/instance-parser.d.ts +26 -0
  23. package/dist/specs/instance-parser.js +706 -0
  24. package/dist/store/useGlobalSpecManager.d.ts +320 -0
  25. package/dist/store/useGlobalSpecManager.js +867 -0
  26. package/dist/types/index.d.ts +23 -0
  27. package/dist/types/index.js +1 -0
  28. package/dist/utils/fns.d.ts +12 -0
  29. package/dist/utils/fns.js +308 -0
  30. package/dist/utils/get-value-or-default.d.ts +1 -0
  31. package/dist/utils/get-value-or-default.js +4 -0
  32. package/dist/utils/i18n.d.ts +1 -0
  33. package/dist/utils/i18n.js +141 -0
  34. package/dist/utils/objects.d.ts +2 -0
  35. package/dist/utils/objects.js +222 -0
  36. package/dist/utils/spec.d.ts +8 -0
  37. package/dist/utils/spec.js +171 -0
  38. package/dist/utils/types.d.ts +3 -0
  39. package/dist/utils/types.js +25 -0
  40. package/package.json +27 -0
@@ -0,0 +1,412 @@
1
+ /**
2
+ * Spec服务统一入口
3
+ *
4
+ * 功能说明:
5
+ * 1. 封装std-spec.js,提供统一的set/get/action/subscribe接口
6
+ * 2. 集成specCache,提供缓存支持
7
+ * 3. 支持多种数据源(std-spec、未来可扩展ble-spec等)
8
+ * 4. 处理缓存与实时数据的冲突
9
+ * 5. 提供数据来源标识
10
+ *
11
+ * 设计原则:
12
+ * - 向后兼容:保持与原有std-spec.js接口一致
13
+ * - 性能优先:内存缓存优先,减少重复请求
14
+ * - 可扩展:支持未来新增的spec类型
15
+ * - 冲突解决:时间戳优先,值变化更新
16
+ */
17
+
18
+ import { Device } from 'miot';
19
+ import Subject from "./subject";
20
+ import { getEventGenerator } from "./utils";
21
+ import { encodeProp } from "../../utils/spec";
22
+ import { OK, PLUGIN_NULL_ERROR } from "./error-code";
23
+ import * as spec from "./spec";
24
+ import specCache, { CACHE_SOURCE } from "./specCache";
25
+ import { copy } from "../../utils/objects";
26
+ // 事件主题 management
27
+ const specSubject = new Subject(getEventGenerator('spec_subject', encodeProp));
28
+ export { CACHE_SOURCE };
29
+
30
+ // 模块级缓存开关,默认关闭
31
+ let cacheEnabled = false;
32
+ export function enableCache(enabled) {
33
+ cacheEnabled = !!enabled;
34
+ }
35
+ export function isCacheEnabled() {
36
+ return cacheEnabled;
37
+ }
38
+
39
+ // Type definitions
40
+
41
+ /**
42
+ * 读取属性值
43
+ *
44
+ * 功能说明:
45
+ * 1. 支持缓存初始化
46
+ * 2. 根据useCache选项决定是否使用缓存
47
+ * 3. 如果useCache为true且缓存中有数据,先使用缓存数据通知更新
48
+ * 4. 获取真实数据后先更新缓存,再返回数据
49
+ *
50
+ * @param {Array} props - 属性列表,如 [ { siid: 1, piid: 2 }, ... ]
51
+ * @param {Object} options - 配置选项
52
+ * @param {boolean} [options.useCache=true] - 是否使用缓存
53
+ * @param {boolean} [options.forceRefresh=false] - 是否强制刷新
54
+ * @param {boolean} [options.fromSourceIfNeed=true] - 缓存未命中时是否从源获取
55
+ * @returns {Promise<Array>} 读取结果,如 [ { siid: 1, piid: 2, value: 3, code: 0 }, ... ]
56
+ */
57
+ export function getProps(props, options = {}) {
58
+ const {
59
+ useCache = cacheEnabled,
60
+ // 受全局开关控制
61
+ forceRefresh = false,
62
+ // 是否强制刷新
63
+ fromSourceIfNeed = true // 缓存未命中时是否从源获取
64
+ } = options;
65
+
66
+ // 确保缓存已初始化
67
+ const ensureCache = () => {
68
+ return specCache.init();
69
+ };
70
+
71
+ // 从缓存读取并通知更新
72
+ const readFromCacheAndNotify = () => {
73
+ if (!useCache) {
74
+ return Promise.resolve(null);
75
+ }
76
+ return ensureCache().then(() => {
77
+ // 获取缓存数据
78
+ const cachedData = props.map(prop => {
79
+ const key = specCache.getCacheKey(prop);
80
+ const cached = specCache.get(key);
81
+ if (cached && cached.value !== undefined) {
82
+ return {
83
+ ...prop,
84
+ value: cached.value,
85
+ updateTime: cached.updateTime,
86
+ code: OK,
87
+ specDataSource: cached.specDataSource,
88
+ fromCache: true
89
+ };
90
+ }
91
+ return null;
92
+ });
93
+
94
+ // 如果有缓存数据,先通知更新
95
+ const hasCache = cachedData.some(item => item !== null);
96
+ if (hasCache) {
97
+ cachedData.forEach(item => {
98
+ if (item) {
99
+ specSubject.publish({
100
+ ...item
101
+ }, false);
102
+ }
103
+ });
104
+ }
105
+ return hasCache ? cachedData : null;
106
+ });
107
+ };
108
+
109
+ // 从源获取数据并更新缓存
110
+ const fetchFromSourceAndUpdateCache = cachedData => {
111
+ // 如果强制刷新或缓存未命中,从源获取
112
+ if (forceRefresh || !cachedData || !useCache) {
113
+ return spec.getProps(props).then(results => {
114
+ // 更新缓存
115
+ return ensureCache().then(() => {
116
+ results.forEach(result => {
117
+ if (result.code === OK && result.value !== undefined) {
118
+ const key = specCache.getCacheKey(result);
119
+ specCache.put(key, result.value, result.updateTime || Math.floor(Date.now() / 1000), CACHE_SOURCE.GET);
120
+ }
121
+ });
122
+ return results.map(r => ({
123
+ ...r,
124
+ specDataSource: r.specDataSource || CACHE_SOURCE.GET
125
+ }));
126
+ });
127
+ });
128
+ }
129
+
130
+ // 如果缓存中有数据,且fromSourceIfNeed为true,仍然从源获取并更新
131
+ if (fromSourceIfNeed && cachedData) {
132
+ return spec.getProps(props).then(results => {
133
+ // 更新缓存
134
+ return ensureCache().then(() => {
135
+ results.forEach(result => {
136
+ if (result.code === OK && result.value !== undefined) {
137
+ const key = specCache.getCacheKey(result);
138
+ specCache.put(key, result.value, result.updateTime || Math.floor(Date.now() / 1000), CACHE_SOURCE.GET);
139
+ }
140
+ });
141
+ // 返回设备最新数据,缓存仅作为提前通知使用
142
+ return results.map(r => ({
143
+ ...r,
144
+ specDataSource: r.specDataSource || CACHE_SOURCE.GET
145
+ }));
146
+ });
147
+ });
148
+ }
149
+
150
+ // 直接返回缓存数据
151
+ return Promise.resolve(cachedData);
152
+ };
153
+
154
+ // 执行流程
155
+ return readFromCacheAndNotify().then(cachedData => fetchFromSourceAndUpdateCache(cachedData)).catch(e => {
156
+ console.log('getProps error:', props, e);
157
+ return Promise.reject(e);
158
+ });
159
+ }
160
+ export function getCachedProps(props) {
161
+ return specCache.getCachedProps(props);
162
+ }
163
+
164
+ /**
165
+ * 设置属性值
166
+ *
167
+ * 功能说明:
168
+ * 1. 支持缓存初始化
169
+ * 2. 向设备发送设置请求
170
+ * 3. 设置成功后更新缓存
171
+ * 4. 通过事件通知缓存更新
172
+ *
173
+ * @param {Array} props - 属性列表,如 [ { siid: 1, piid: 2, value: 3 }, ... ]
174
+ * @param {Object} options - 配置选项
175
+ * @param {boolean} [options.updateCache=true] - 是否更新缓存
176
+ * @returns {Promise<Array>} 设置结果,如 [ { siid: 1, piid: 2, value: 3, code: 0 }, ... ]
177
+ */
178
+ export function setProps(props, options = {}) {
179
+ const {
180
+ updateCache = cacheEnabled // 受全局开关控制
181
+ } = options;
182
+ props = copy(props || []).filter(p => !!p);
183
+
184
+ // 确保缓存已初始化
185
+ const ensureCache = () => {
186
+ return specCache.init();
187
+ };
188
+
189
+ // 执行设置操作
190
+ const executeSet = () => {
191
+ return spec.setProps(props);
192
+ };
193
+
194
+ // 更新缓存
195
+ const updateCacheData = results => {
196
+ if (!updateCache || !props.length) {
197
+ return Promise.resolve(results);
198
+ }
199
+ return ensureCache().then(() => {
200
+ // 更新缓存
201
+ props.forEach((prop, index) => {
202
+ const result = results[index];
203
+ if (result && result.code === OK) {
204
+ const key = specCache.getCacheKey(prop);
205
+ const updateTime = result.updateTime || Math.floor(Date.now() / 1000);
206
+
207
+ // 更新缓存
208
+ specCache.put(key, prop.value, updateTime, CACHE_SOURCE.SET);
209
+
210
+ // 通过事件通知缓存更新
211
+ // specSubject.publish({
212
+ // ...prop,
213
+ // value: prop.value,
214
+ // code: OK,
215
+ // updateTime: updateTime,
216
+ // did: Device.deviceID,
217
+ // specDataSource: CACHE_SOURCE.SET
218
+
219
+ // }, false);
220
+ }
221
+ });
222
+ return results;
223
+ });
224
+ };
225
+
226
+ // 执行流程
227
+ return executeSet().then(results => updateCacheData(results)).catch(e => {
228
+ console.log('setProps error: ', props, e);
229
+ return Promise.reject(e);
230
+ });
231
+ }
232
+
233
+ /**
234
+ * 设置缓存中的属性值(不触发设备请求)
235
+ *
236
+ * 功能说明:
237
+ * 1. 仅更新本地缓存
238
+ * 2. 不会向设备发送请求
239
+ * 3. 通过事件通知缓存更新
240
+ *
241
+ * @param {Array} props - 属性列表,如 [ { siid: 1, piid: 2, value: 3 }, ... ]
242
+ * @returns {Promise<Array>} 设置结果
243
+ */
244
+ export function setCachedProps(props) {
245
+ props = copy(props || []).filter(p => !!p);
246
+
247
+ // 确保缓存已初始化
248
+ const ensureCache = () => {
249
+ return specCache.init();
250
+ };
251
+
252
+ // 仅更新缓存
253
+ const updateCacheOnly = () => {
254
+ if (!props.length) {
255
+ return Promise.resolve([]);
256
+ }
257
+ return ensureCache().then(() => {
258
+ // 更新缓存
259
+ props.forEach(prop => {
260
+ const key = specCache.getCacheKey(prop);
261
+ const updateTime = Math.floor(Date.now() / 1000);
262
+
263
+ // 更新缓存
264
+ specCache.put(key, prop.value, updateTime, CACHE_SOURCE.SET);
265
+
266
+ // 通过事件通知缓存更新
267
+ specSubject.publish({
268
+ ...prop,
269
+ value: prop.value,
270
+ code: OK,
271
+ updateTime,
272
+ did: Device.deviceID
273
+ }, false);
274
+ });
275
+ return props.map(p => ({
276
+ ...p,
277
+ code: OK
278
+ }));
279
+ });
280
+ };
281
+
282
+ // 执行流程
283
+ return updateCacheOnly().catch(e => {
284
+ console.log('setCachedProps error: ', props, e);
285
+ return Promise.reject(e);
286
+ });
287
+ }
288
+
289
+ /**
290
+ * 调用方法
291
+ * @param { Object } prop 方法和参数, 如 { siid: 1, aiid: 2, in: [17, 'shanghai', ...] }
292
+ * @returns { Promise<Object> } 执行结果,如 { siid: 1, aiid: 2, code: 0 } 或 { code:-9999, message:xxx }
293
+ */
294
+ export function doAction(prop) {
295
+ prop = copy(prop);
296
+ let result;
297
+ if (!prop) {
298
+ result = Promise.resolve({
299
+ code: PLUGIN_NULL_ERROR,
300
+ message: 'action is null'
301
+ });
302
+ } else {
303
+ result = spec.doAction(prop).then(() => {
304
+ return specCache.doAction(prop);
305
+ }).catch(e => {
306
+ console.log('doAction error:', prop, e);
307
+ return Promise.reject(e);
308
+ });
309
+ }
310
+ return result.finally(() => {});
311
+ }
312
+
313
+ /**
314
+ * 监听事件和属性
315
+ *
316
+ * 功能说明:
317
+ * 1. 支持缓存初始化
318
+ * 2. 订阅设备属性或事件变化
319
+ * 3. 如果publishImmediately为true,先从缓存读取并通知
320
+ * 4. 收到变化时更新缓存
321
+ * 5. 返回可取消的订阅对象
322
+ *
323
+ * @param {Array} props - 事件或属性,如 [ { siid: 1, eiid: 2 }, ...]
324
+ * @param {Function} listener - 监听器, 参数为 prop
325
+ * @param {Object} options - 配置选项
326
+ * @param {boolean} [options.publishImmediately=true] - 是否立即发布当前值
327
+ * @param {boolean} [options.updateCache=true] - 收到变化时是否更新缓存
328
+ * @returns {Promise<Object>} 订阅结果,格式如下
329
+ * {
330
+ * props: [ ] // 数组,输入参数的每个 prop 的订阅结果
331
+ * unsubscribe(): () => { } // 取消监听
332
+ * }
333
+ */
334
+ export function subscribe(props, listener, options = {}) {
335
+ props = copy(props || []).filter(p => !!p);
336
+ const {
337
+ publishImmediately = cacheEnabled,
338
+ // 受全局开关控制
339
+ updateCache = cacheEnabled // 受全局开关控制
340
+ } = options;
341
+
342
+ // 确保缓存已初始化
343
+ const ensureCache = () => {
344
+ return specCache.init();
345
+ };
346
+
347
+ // 如果需要立即发布当前值,从缓存读取并通知
348
+ const publishFromCache = () => {
349
+ if (!publishImmediately) {
350
+ return Promise.resolve();
351
+ }
352
+ return ensureCache().then(() => {
353
+ // 从缓存读取并通知
354
+ props.forEach(prop => {
355
+ const key = specCache.getCacheKey(prop);
356
+ const cached = specCache.get(key);
357
+ if (cached && cached.value !== undefined) {
358
+ // 通过listener通知
359
+ if (listener) {
360
+ listener({
361
+ ...prop,
362
+ value: cached.value,
363
+ updateTime: cached.updateTime,
364
+ code: OK,
365
+ specDataSource: cached.specDataSource
366
+ });
367
+ }
368
+ }
369
+ });
370
+ });
371
+ };
372
+
373
+ // 包装监听器以更新缓存
374
+ const wrappedListener = data => {
375
+ // 更新缓存
376
+ if (updateCache && data.piid !== undefined && data.code === OK) {
377
+ ensureCache().then(() => {
378
+ const key = specCache.getCacheKey(data);
379
+ specCache.put(key, data.value, data.updateTime || Math.floor(Date.now() / 1000), CACHE_SOURCE.SUBSCRIBE);
380
+ });
381
+ }
382
+
383
+ // 调用原始监听器
384
+ if (listener) {
385
+ listener({
386
+ ...data,
387
+ specDataSource: data.specDataSource || CACHE_SOURCE.SUBSCRIBE
388
+ });
389
+ }
390
+ };
391
+
392
+ // 执行订阅
393
+ const executeSubscribe = () => {
394
+ return spec.subscribe(props, wrappedListener);
395
+ };
396
+
397
+ // 执行流程
398
+ return publishFromCache().then(() => executeSubscribe()).then(result => {
399
+ // 返回订阅对象,包含取消订阅方法
400
+ return {
401
+ props: result.props,
402
+ unsubscribe: () => {
403
+ if (result && result.unsubscribe) {
404
+ result.unsubscribe();
405
+ }
406
+ }
407
+ };
408
+ }).catch(e => {
409
+ console.log('subscribe error:', props, e);
410
+ return Promise.reject(e);
411
+ });
412
+ }
@@ -0,0 +1,10 @@
1
+ import { Spec } from '../../types';
2
+ export declare const ServiceSourceType: {
3
+ WIFI: number;
4
+ BLE: number;
5
+ WIFI_BLE: number;
6
+ };
7
+ export declare function getProps(props: Spec[], chunkFn?: (data: any) => void): Promise<any>;
8
+ export declare function setProps(props: Spec[]): Promise<any>;
9
+ export declare function doAction(prop: Spec): Promise<any>;
10
+ export declare function subscribe(props: Spec[], listener: any): Promise<any>;
@@ -0,0 +1,109 @@
1
+ /**
2
+ * Spec服务统一入口
3
+ *
4
+ * 功能说明:
5
+ * 1. 封装std-spec.js,提供统一的set/get/action/subscribe接口
6
+ * 2. 集成specCache,提供缓存支持
7
+ * 3. 支持多种数据源(std-spec、未来可扩展ble-spec等)
8
+ * 4. 处理缓存与实时数据的冲突
9
+ * 5. 提供数据来源标识
10
+ *
11
+ * 设计原则:
12
+ * - 向后兼容:保持与原有std-spec.js接口一致
13
+ * - 性能优先:内存缓存优先,减少重复请求
14
+ * - 可扩展:支持未来新增的spec类型
15
+ * - 冲突解决:时间戳优先,值变化更新
16
+ */
17
+ import { reduceResults } from "./utils";
18
+ import { isSuccess } from "./error-code";
19
+ // 引入std-spec
20
+ import * as stdSpec from "./std-spec";
21
+ export const ServiceSourceType = {
22
+ WIFI: 1,
23
+ BLE: 2,
24
+ WIFI_BLE: 3
25
+ };
26
+ const specs = [stdSpec];
27
+ const subscriptions = new Set();
28
+ function current(props, _type) {
29
+ const stdSpecProps = [];
30
+ props.forEach(prop => {
31
+ if (!prop) {
32
+ return;
33
+ }
34
+ stdSpecProps.push(prop);
35
+ });
36
+ return [stdSpecProps];
37
+ }
38
+ function mergePromise(promises) {
39
+ return Promise.all(promises).then(res => {
40
+ return reduceResults(res);
41
+ }).catch(error => {
42
+ return reduceResults(error);
43
+ });
44
+ }
45
+ export function getProps(props, chunkFn) {
46
+ const groupProps = current(props, 'read');
47
+ const promises = specs.reduce((preSpec, current, index) => {
48
+ return groupProps[index].length ? [...preSpec, current.getProps(groupProps[index], chunkFn)] : [...preSpec];
49
+ }, []);
50
+ return mergePromise(promises);
51
+ }
52
+ export function setProps(props) {
53
+ const groupProps = current(props, 'write');
54
+ const promises = specs.reduce((preSpec, currentSpec, index) => {
55
+ return groupProps[index].length ? [...preSpec, currentSpec.setProps(groupProps[index])] : [...preSpec];
56
+ }, []);
57
+ return mergePromise(promises);
58
+ }
59
+ export function doAction(prop) {
60
+ const groupProps = current([prop]);
61
+ const promises = specs.reduce((preSpec, current, index) => {
62
+ return groupProps[index].length ? [...preSpec, current.doAction(groupProps[index][0]).then(r => {
63
+ return [r];
64
+ }).catch(e => {
65
+ return [e];
66
+ })] : [...preSpec];
67
+ }, []);
68
+ // 处理返回结果 直接mergePromise 不能直接区别出错误
69
+ return mergePromise(promises).then(res => {
70
+ let res1 = Array.isArray(res) ? res[0] || res[1] : res;
71
+ let b = true;
72
+ if (Array.isArray(res)) {
73
+ for (let i = 0; i < res.length; i++) {
74
+ b = isSuccess(res[i]?.code || 0);
75
+ if (b === false) {
76
+ res1 = res[i];
77
+ break;
78
+ }
79
+ }
80
+ } else {
81
+ b = isSuccess(res?.code || 0);
82
+ }
83
+ // 统一处理返回{code: 0, sid}
84
+ if (b) {
85
+ return res1;
86
+ }
87
+ throw res1;
88
+ });
89
+ }
90
+ export function subscribe(props, listener) {
91
+ const specSubscribeProps = current(props);
92
+ const ps = specs.map((spec, index) => spec.subscribe(specSubscribeProps[index], listener));
93
+ return Promise.all(ps).then(arr => {
94
+ const result = {
95
+ props: arr[0].props,
96
+ unsubscribe: () => {
97
+ subscriptions.delete(result);
98
+ arr.forEach(sub => {
99
+ if (sub && sub.unsubscribe) {
100
+ sub.unsubscribe();
101
+ sub.unsubscribe = null;
102
+ }
103
+ });
104
+ }
105
+ };
106
+ subscriptions.add(result);
107
+ return result;
108
+ });
109
+ }
@@ -0,0 +1,85 @@
1
+ /// <reference types="react-native" />
2
+ import { Spec } from '../../types';
3
+ export declare const CACHE_SOURCE: {
4
+ CACHE: string;
5
+ GET: string;
6
+ SET: string;
7
+ SUBSCRIBE: string;
8
+ ACTION: string;
9
+ };
10
+ declare class SpecCache {
11
+ memoryCache: Map<string, any>;
12
+ persistQueue: Set<string>;
13
+ lastPersistTime: number;
14
+ persistTimer: ReturnType<typeof setTimeout> | null;
15
+ loaded: boolean;
16
+ persisting: boolean;
17
+ constructor();
18
+ init(): Promise<unknown>;
19
+ loadFromStorage(): Promise<unknown>;
20
+ get(key: string): any;
21
+ put(key: string, value: unknown, updateTime: number, specDataSource?: string): boolean;
22
+ shouldUpdate(existing: any, newValue: unknown, newUpdateTime: number): boolean;
23
+ addToPersistQueue(key: string): void;
24
+ schedulePersist(): void;
25
+ doPersist(): Promise<void>;
26
+ flush(): Promise<void>;
27
+ cleanupOldest(): void;
28
+ remove(key: string): void;
29
+ clear(clearStorage?: boolean): Promise<void>;
30
+ getStats(): {
31
+ memorySize: number;
32
+ persistQueueSize: number;
33
+ sourceCount: Record<string, number>;
34
+ lastPersistTime: number;
35
+ persisting: boolean;
36
+ };
37
+ getCacheKey(prop: Spec): string;
38
+ getCachedProps(props: Spec[]): ({
39
+ value: any;
40
+ updateTime: any;
41
+ code: number;
42
+ specDataSource: any;
43
+ did?: string | undefined;
44
+ siid: number;
45
+ piid?: number | undefined;
46
+ aiid?: number | undefined;
47
+ miid?: number | undefined;
48
+ in?: any[] | undefined;
49
+ dataSource?: number | undefined;
50
+ } | {
51
+ code: number;
52
+ did?: string | undefined;
53
+ siid: number;
54
+ piid?: number | undefined;
55
+ aiid?: number | undefined;
56
+ miid?: number | undefined;
57
+ value?: any;
58
+ in?: any[] | undefined;
59
+ dataSource?: number | undefined;
60
+ })[];
61
+ setCachedProps(props: Spec[]): Promise<{
62
+ code: number;
63
+ did?: string | undefined;
64
+ siid: number;
65
+ piid?: number | undefined;
66
+ aiid?: number | undefined;
67
+ miid?: number | undefined;
68
+ value?: any;
69
+ in?: any[] | undefined;
70
+ dataSource?: number | undefined;
71
+ }[]>;
72
+ doAction(prop: Spec): Promise<{
73
+ code: number;
74
+ did?: string | undefined;
75
+ siid: number;
76
+ piid?: number | undefined;
77
+ aiid?: number | undefined;
78
+ miid?: number | undefined;
79
+ value?: any;
80
+ in?: any[] | undefined;
81
+ dataSource?: number | undefined;
82
+ }>;
83
+ }
84
+ declare const instance: SpecCache;
85
+ export default instance;