@lazycatcloud/sdk 0.1.144 → 0.1.145

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 (49) hide show
  1. package/dist/package.json +5 -1
  2. package/package.json +5 -1
  3. package/common/box.ts +0 -545
  4. package/common/browseronly.ts +0 -520
  5. package/common/end_device.ts +0 -635
  6. package/common/file_handler.ts +0 -485
  7. package/common/filetrans.ts +0 -1936
  8. package/common/gateway.ts +0 -663
  9. package/common/media_meta.ts +0 -319
  10. package/common/message.ts +0 -242
  11. package/common/peripheral_device.ts +0 -783
  12. package/common/security_context.ts +0 -729
  13. package/common/users.ts +0 -1044
  14. package/dlna/dlna.ts +0 -895
  15. package/docs/contribute.md +0 -40
  16. package/docs/extentions/AppCommon.md +0 -30
  17. package/extentions/app_common.ts +0 -63
  18. package/extentions/base.ts +0 -459
  19. package/extentions/index.ts +0 -27
  20. package/extentions/safe_app.ts +0 -60
  21. package/extentions/unsafe_app.ts +0 -107
  22. package/google/protobuf/descriptor.ts +0 -3778
  23. package/google/protobuf/empty.ts +0 -64
  24. package/google/protobuf/timestamp.ts +0 -214
  25. package/grpcweb.ts +0 -106
  26. package/index.ts +0 -204
  27. package/lanforward/lanforward.ts +0 -301
  28. package/localdevice/clipboard.ts +0 -499
  29. package/localdevice/config.ts +0 -268
  30. package/localdevice/device.ts +0 -218
  31. package/localdevice/dialog.ts +0 -707
  32. package/localdevice/local-launch.ts +0 -954
  33. package/localdevice/network.ts +0 -273
  34. package/localdevice/permission.ts +0 -733
  35. package/localdevice/photo.ts +0 -1497
  36. package/ssdp/ssdp.ts +0 -332
  37. package/sys/OS_daemon.ts +0 -325
  38. package/sys/OS_snapshot.ts +0 -1714
  39. package/sys/OS_upgrader.ts +0 -782
  40. package/sys/btrfs.ts +0 -530
  41. package/sys/devopt.ts +0 -250
  42. package/sys/event.ts +0 -787
  43. package/sys/hc-core/hc-core.ts +0 -1582
  44. package/sys/ingress.ts +0 -953
  45. package/sys/network_manager.ts +0 -874
  46. package/sys/package_manager.ts +0 -1931
  47. package/sys/portal-server/portal-server.ts +0 -2934
  48. package/sys/snapd.ts +0 -861
  49. package/tsconfig.json +0 -15
package/sys/snapd.ts DELETED
@@ -1,861 +0,0 @@
1
- /* eslint-disable */
2
- import { grpc } from "@improbable-eng/grpc-web";
3
- import { BrowserHeaders } from "browser-headers";
4
- import _m0 from "protobufjs/minimal";
5
- import { Empty } from "../google/protobuf/empty";
6
- import { SnapshotDesc } from "./OS_snapshot";
7
-
8
- export enum SnapdAutoStrategy {
9
- /** Default - 修改该配置项时,此值表示不改变当前配置值 */
10
- Default = 0,
11
- /** Disabled - 不自动快照(但超过生命周期的历史快照仍会被清理) */
12
- Disabled = 1,
13
- /** SnapOnly - 自动快照,但不自动备份 */
14
- SnapOnly = 2,
15
- /** SnapAndBackup - 自动快照并备份 */
16
- SnapAndBackup = 3,
17
- UNRECOGNIZED = -1,
18
- }
19
-
20
- export function snapdAutoStrategyFromJSON(object: any): SnapdAutoStrategy {
21
- switch (object) {
22
- case 0:
23
- case "Default":
24
- return SnapdAutoStrategy.Default;
25
- case 1:
26
- case "Disabled":
27
- return SnapdAutoStrategy.Disabled;
28
- case 2:
29
- case "SnapOnly":
30
- return SnapdAutoStrategy.SnapOnly;
31
- case 3:
32
- case "SnapAndBackup":
33
- return SnapdAutoStrategy.SnapAndBackup;
34
- case -1:
35
- case "UNRECOGNIZED":
36
- default:
37
- return SnapdAutoStrategy.UNRECOGNIZED;
38
- }
39
- }
40
-
41
- export function snapdAutoStrategyToJSON(object: SnapdAutoStrategy): string {
42
- switch (object) {
43
- case SnapdAutoStrategy.Default:
44
- return "Default";
45
- case SnapdAutoStrategy.Disabled:
46
- return "Disabled";
47
- case SnapdAutoStrategy.SnapOnly:
48
- return "SnapOnly";
49
- case SnapdAutoStrategy.SnapAndBackup:
50
- return "SnapAndBackup";
51
- case SnapdAutoStrategy.UNRECOGNIZED:
52
- default:
53
- return "UNRECOGNIZED";
54
- }
55
- }
56
-
57
- export interface SnapdEnableRequest {
58
- TargetId: string;
59
- /** 需要启用备份的路径列表 */
60
- PathList: string[];
61
- }
62
-
63
- export interface SnapdTargetRequest {
64
- TargetId: string;
65
- }
66
-
67
- export interface SnapdConf {
68
- /** 自动快照策略 */
69
- AutoStrategy: SnapdAutoStrategy;
70
- /** 自动快照的时间间隔,单位为分钟 */
71
- AutoSnapInterval: number;
72
- /** 自动快照保留的时长,单位为分钟。超出的快照会被自动删除 */
73
- AutoSnapLifetime: number;
74
- /** 自动备份快照保留的时长,单位为分钟。当单个备份池中的备份超过该数量时,旧备份将自动被删除 */
75
- AutoBackupLifetime: number;
76
- }
77
-
78
- export interface SnapdConfSetRequest {
79
- TargetId: string;
80
- Config: SnapdConf | undefined;
81
- }
82
-
83
- export interface SnapdListSnapRequest {
84
- TargetId: string;
85
- /** 为空则查看盒子数据盘上快照,否则查看指定备份池中快照 */
86
- BackupPool: string;
87
- }
88
-
89
- export interface SnapdListSnapResponse {
90
- SnapshotList: SnapshotDesc[];
91
- }
92
-
93
- export interface SnapdSnapRequest {
94
- TargetId: string;
95
- /**
96
- * SnapdTakeSnap: 不为空,则同时将快照备份到指定备份池
97
- * SnapdDelSnap: 为空则删除盒子内快照,否则删除备份池中快照
98
- * SnapdRestoreSnap:为空则回滚盒子内快照,否则从备份池中读取快照并还原
99
- */
100
- BackupPool: string;
101
- SnapName: string;
102
- }
103
-
104
- function createBaseSnapdEnableRequest(): SnapdEnableRequest {
105
- return { TargetId: "", PathList: [] };
106
- }
107
-
108
- export const SnapdEnableRequest = {
109
- encode(message: SnapdEnableRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
110
- if (message.TargetId !== "") {
111
- writer.uint32(10).string(message.TargetId);
112
- }
113
- for (const v of message.PathList) {
114
- writer.uint32(18).string(v!);
115
- }
116
- return writer;
117
- },
118
-
119
- decode(input: _m0.Reader | Uint8Array, length?: number): SnapdEnableRequest {
120
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
121
- let end = length === undefined ? reader.len : reader.pos + length;
122
- const message = createBaseSnapdEnableRequest();
123
- while (reader.pos < end) {
124
- const tag = reader.uint32();
125
- switch (tag >>> 3) {
126
- case 1:
127
- message.TargetId = reader.string();
128
- break;
129
- case 2:
130
- message.PathList.push(reader.string());
131
- break;
132
- default:
133
- reader.skipType(tag & 7);
134
- break;
135
- }
136
- }
137
- return message;
138
- },
139
-
140
- fromJSON(object: any): SnapdEnableRequest {
141
- return {
142
- TargetId: isSet(object.TargetId) ? String(object.TargetId) : "",
143
- PathList: Array.isArray(object?.PathList) ? object.PathList.map((e: any) => String(e)) : [],
144
- };
145
- },
146
-
147
- toJSON(message: SnapdEnableRequest): unknown {
148
- const obj: any = {};
149
- message.TargetId !== undefined && (obj.TargetId = message.TargetId);
150
- if (message.PathList) {
151
- obj.PathList = message.PathList.map((e) => e);
152
- } else {
153
- obj.PathList = [];
154
- }
155
- return obj;
156
- },
157
-
158
- fromPartial<I extends Exact<DeepPartial<SnapdEnableRequest>, I>>(object: I): SnapdEnableRequest {
159
- const message = createBaseSnapdEnableRequest();
160
- message.TargetId = object.TargetId ?? "";
161
- message.PathList = object.PathList?.map((e) => e) || [];
162
- return message;
163
- },
164
- };
165
-
166
- function createBaseSnapdTargetRequest(): SnapdTargetRequest {
167
- return { TargetId: "" };
168
- }
169
-
170
- export const SnapdTargetRequest = {
171
- encode(message: SnapdTargetRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
172
- if (message.TargetId !== "") {
173
- writer.uint32(10).string(message.TargetId);
174
- }
175
- return writer;
176
- },
177
-
178
- decode(input: _m0.Reader | Uint8Array, length?: number): SnapdTargetRequest {
179
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
180
- let end = length === undefined ? reader.len : reader.pos + length;
181
- const message = createBaseSnapdTargetRequest();
182
- while (reader.pos < end) {
183
- const tag = reader.uint32();
184
- switch (tag >>> 3) {
185
- case 1:
186
- message.TargetId = reader.string();
187
- break;
188
- default:
189
- reader.skipType(tag & 7);
190
- break;
191
- }
192
- }
193
- return message;
194
- },
195
-
196
- fromJSON(object: any): SnapdTargetRequest {
197
- return { TargetId: isSet(object.TargetId) ? String(object.TargetId) : "" };
198
- },
199
-
200
- toJSON(message: SnapdTargetRequest): unknown {
201
- const obj: any = {};
202
- message.TargetId !== undefined && (obj.TargetId = message.TargetId);
203
- return obj;
204
- },
205
-
206
- fromPartial<I extends Exact<DeepPartial<SnapdTargetRequest>, I>>(object: I): SnapdTargetRequest {
207
- const message = createBaseSnapdTargetRequest();
208
- message.TargetId = object.TargetId ?? "";
209
- return message;
210
- },
211
- };
212
-
213
- function createBaseSnapdConf(): SnapdConf {
214
- return { AutoStrategy: 0, AutoSnapInterval: 0, AutoSnapLifetime: 0, AutoBackupLifetime: 0 };
215
- }
216
-
217
- export const SnapdConf = {
218
- encode(message: SnapdConf, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
219
- if (message.AutoStrategy !== 0) {
220
- writer.uint32(8).int32(message.AutoStrategy);
221
- }
222
- if (message.AutoSnapInterval !== 0) {
223
- writer.uint32(16).uint32(message.AutoSnapInterval);
224
- }
225
- if (message.AutoSnapLifetime !== 0) {
226
- writer.uint32(24).uint32(message.AutoSnapLifetime);
227
- }
228
- if (message.AutoBackupLifetime !== 0) {
229
- writer.uint32(32).uint32(message.AutoBackupLifetime);
230
- }
231
- return writer;
232
- },
233
-
234
- decode(input: _m0.Reader | Uint8Array, length?: number): SnapdConf {
235
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
236
- let end = length === undefined ? reader.len : reader.pos + length;
237
- const message = createBaseSnapdConf();
238
- while (reader.pos < end) {
239
- const tag = reader.uint32();
240
- switch (tag >>> 3) {
241
- case 1:
242
- message.AutoStrategy = reader.int32() as any;
243
- break;
244
- case 2:
245
- message.AutoSnapInterval = reader.uint32();
246
- break;
247
- case 3:
248
- message.AutoSnapLifetime = reader.uint32();
249
- break;
250
- case 4:
251
- message.AutoBackupLifetime = reader.uint32();
252
- break;
253
- default:
254
- reader.skipType(tag & 7);
255
- break;
256
- }
257
- }
258
- return message;
259
- },
260
-
261
- fromJSON(object: any): SnapdConf {
262
- return {
263
- AutoStrategy: isSet(object.AutoStrategy) ? snapdAutoStrategyFromJSON(object.AutoStrategy) : 0,
264
- AutoSnapInterval: isSet(object.AutoSnapInterval) ? Number(object.AutoSnapInterval) : 0,
265
- AutoSnapLifetime: isSet(object.AutoSnapLifetime) ? Number(object.AutoSnapLifetime) : 0,
266
- AutoBackupLifetime: isSet(object.AutoBackupLifetime) ? Number(object.AutoBackupLifetime) : 0,
267
- };
268
- },
269
-
270
- toJSON(message: SnapdConf): unknown {
271
- const obj: any = {};
272
- message.AutoStrategy !== undefined && (obj.AutoStrategy = snapdAutoStrategyToJSON(message.AutoStrategy));
273
- message.AutoSnapInterval !== undefined && (obj.AutoSnapInterval = Math.round(message.AutoSnapInterval));
274
- message.AutoSnapLifetime !== undefined && (obj.AutoSnapLifetime = Math.round(message.AutoSnapLifetime));
275
- message.AutoBackupLifetime !== undefined && (obj.AutoBackupLifetime = Math.round(message.AutoBackupLifetime));
276
- return obj;
277
- },
278
-
279
- fromPartial<I extends Exact<DeepPartial<SnapdConf>, I>>(object: I): SnapdConf {
280
- const message = createBaseSnapdConf();
281
- message.AutoStrategy = object.AutoStrategy ?? 0;
282
- message.AutoSnapInterval = object.AutoSnapInterval ?? 0;
283
- message.AutoSnapLifetime = object.AutoSnapLifetime ?? 0;
284
- message.AutoBackupLifetime = object.AutoBackupLifetime ?? 0;
285
- return message;
286
- },
287
- };
288
-
289
- function createBaseSnapdConfSetRequest(): SnapdConfSetRequest {
290
- return { TargetId: "", Config: undefined };
291
- }
292
-
293
- export const SnapdConfSetRequest = {
294
- encode(message: SnapdConfSetRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
295
- if (message.TargetId !== "") {
296
- writer.uint32(10).string(message.TargetId);
297
- }
298
- if (message.Config !== undefined) {
299
- SnapdConf.encode(message.Config, writer.uint32(18).fork()).ldelim();
300
- }
301
- return writer;
302
- },
303
-
304
- decode(input: _m0.Reader | Uint8Array, length?: number): SnapdConfSetRequest {
305
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
306
- let end = length === undefined ? reader.len : reader.pos + length;
307
- const message = createBaseSnapdConfSetRequest();
308
- while (reader.pos < end) {
309
- const tag = reader.uint32();
310
- switch (tag >>> 3) {
311
- case 1:
312
- message.TargetId = reader.string();
313
- break;
314
- case 2:
315
- message.Config = SnapdConf.decode(reader, reader.uint32());
316
- break;
317
- default:
318
- reader.skipType(tag & 7);
319
- break;
320
- }
321
- }
322
- return message;
323
- },
324
-
325
- fromJSON(object: any): SnapdConfSetRequest {
326
- return {
327
- TargetId: isSet(object.TargetId) ? String(object.TargetId) : "",
328
- Config: isSet(object.Config) ? SnapdConf.fromJSON(object.Config) : undefined,
329
- };
330
- },
331
-
332
- toJSON(message: SnapdConfSetRequest): unknown {
333
- const obj: any = {};
334
- message.TargetId !== undefined && (obj.TargetId = message.TargetId);
335
- message.Config !== undefined && (obj.Config = message.Config ? SnapdConf.toJSON(message.Config) : undefined);
336
- return obj;
337
- },
338
-
339
- fromPartial<I extends Exact<DeepPartial<SnapdConfSetRequest>, I>>(object: I): SnapdConfSetRequest {
340
- const message = createBaseSnapdConfSetRequest();
341
- message.TargetId = object.TargetId ?? "";
342
- message.Config = (object.Config !== undefined && object.Config !== null)
343
- ? SnapdConf.fromPartial(object.Config)
344
- : undefined;
345
- return message;
346
- },
347
- };
348
-
349
- function createBaseSnapdListSnapRequest(): SnapdListSnapRequest {
350
- return { TargetId: "", BackupPool: "" };
351
- }
352
-
353
- export const SnapdListSnapRequest = {
354
- encode(message: SnapdListSnapRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
355
- if (message.TargetId !== "") {
356
- writer.uint32(10).string(message.TargetId);
357
- }
358
- if (message.BackupPool !== "") {
359
- writer.uint32(18).string(message.BackupPool);
360
- }
361
- return writer;
362
- },
363
-
364
- decode(input: _m0.Reader | Uint8Array, length?: number): SnapdListSnapRequest {
365
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
366
- let end = length === undefined ? reader.len : reader.pos + length;
367
- const message = createBaseSnapdListSnapRequest();
368
- while (reader.pos < end) {
369
- const tag = reader.uint32();
370
- switch (tag >>> 3) {
371
- case 1:
372
- message.TargetId = reader.string();
373
- break;
374
- case 2:
375
- message.BackupPool = reader.string();
376
- break;
377
- default:
378
- reader.skipType(tag & 7);
379
- break;
380
- }
381
- }
382
- return message;
383
- },
384
-
385
- fromJSON(object: any): SnapdListSnapRequest {
386
- return {
387
- TargetId: isSet(object.TargetId) ? String(object.TargetId) : "",
388
- BackupPool: isSet(object.BackupPool) ? String(object.BackupPool) : "",
389
- };
390
- },
391
-
392
- toJSON(message: SnapdListSnapRequest): unknown {
393
- const obj: any = {};
394
- message.TargetId !== undefined && (obj.TargetId = message.TargetId);
395
- message.BackupPool !== undefined && (obj.BackupPool = message.BackupPool);
396
- return obj;
397
- },
398
-
399
- fromPartial<I extends Exact<DeepPartial<SnapdListSnapRequest>, I>>(object: I): SnapdListSnapRequest {
400
- const message = createBaseSnapdListSnapRequest();
401
- message.TargetId = object.TargetId ?? "";
402
- message.BackupPool = object.BackupPool ?? "";
403
- return message;
404
- },
405
- };
406
-
407
- function createBaseSnapdListSnapResponse(): SnapdListSnapResponse {
408
- return { SnapshotList: [] };
409
- }
410
-
411
- export const SnapdListSnapResponse = {
412
- encode(message: SnapdListSnapResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
413
- for (const v of message.SnapshotList) {
414
- SnapshotDesc.encode(v!, writer.uint32(10).fork()).ldelim();
415
- }
416
- return writer;
417
- },
418
-
419
- decode(input: _m0.Reader | Uint8Array, length?: number): SnapdListSnapResponse {
420
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
421
- let end = length === undefined ? reader.len : reader.pos + length;
422
- const message = createBaseSnapdListSnapResponse();
423
- while (reader.pos < end) {
424
- const tag = reader.uint32();
425
- switch (tag >>> 3) {
426
- case 1:
427
- message.SnapshotList.push(SnapshotDesc.decode(reader, reader.uint32()));
428
- break;
429
- default:
430
- reader.skipType(tag & 7);
431
- break;
432
- }
433
- }
434
- return message;
435
- },
436
-
437
- fromJSON(object: any): SnapdListSnapResponse {
438
- return {
439
- SnapshotList: Array.isArray(object?.SnapshotList)
440
- ? object.SnapshotList.map((e: any) => SnapshotDesc.fromJSON(e))
441
- : [],
442
- };
443
- },
444
-
445
- toJSON(message: SnapdListSnapResponse): unknown {
446
- const obj: any = {};
447
- if (message.SnapshotList) {
448
- obj.SnapshotList = message.SnapshotList.map((e) => e ? SnapshotDesc.toJSON(e) : undefined);
449
- } else {
450
- obj.SnapshotList = [];
451
- }
452
- return obj;
453
- },
454
-
455
- fromPartial<I extends Exact<DeepPartial<SnapdListSnapResponse>, I>>(object: I): SnapdListSnapResponse {
456
- const message = createBaseSnapdListSnapResponse();
457
- message.SnapshotList = object.SnapshotList?.map((e) => SnapshotDesc.fromPartial(e)) || [];
458
- return message;
459
- },
460
- };
461
-
462
- function createBaseSnapdSnapRequest(): SnapdSnapRequest {
463
- return { TargetId: "", BackupPool: "", SnapName: "" };
464
- }
465
-
466
- export const SnapdSnapRequest = {
467
- encode(message: SnapdSnapRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
468
- if (message.TargetId !== "") {
469
- writer.uint32(10).string(message.TargetId);
470
- }
471
- if (message.BackupPool !== "") {
472
- writer.uint32(18).string(message.BackupPool);
473
- }
474
- if (message.SnapName !== "") {
475
- writer.uint32(26).string(message.SnapName);
476
- }
477
- return writer;
478
- },
479
-
480
- decode(input: _m0.Reader | Uint8Array, length?: number): SnapdSnapRequest {
481
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
482
- let end = length === undefined ? reader.len : reader.pos + length;
483
- const message = createBaseSnapdSnapRequest();
484
- while (reader.pos < end) {
485
- const tag = reader.uint32();
486
- switch (tag >>> 3) {
487
- case 1:
488
- message.TargetId = reader.string();
489
- break;
490
- case 2:
491
- message.BackupPool = reader.string();
492
- break;
493
- case 3:
494
- message.SnapName = reader.string();
495
- break;
496
- default:
497
- reader.skipType(tag & 7);
498
- break;
499
- }
500
- }
501
- return message;
502
- },
503
-
504
- fromJSON(object: any): SnapdSnapRequest {
505
- return {
506
- TargetId: isSet(object.TargetId) ? String(object.TargetId) : "",
507
- BackupPool: isSet(object.BackupPool) ? String(object.BackupPool) : "",
508
- SnapName: isSet(object.SnapName) ? String(object.SnapName) : "",
509
- };
510
- },
511
-
512
- toJSON(message: SnapdSnapRequest): unknown {
513
- const obj: any = {};
514
- message.TargetId !== undefined && (obj.TargetId = message.TargetId);
515
- message.BackupPool !== undefined && (obj.BackupPool = message.BackupPool);
516
- message.SnapName !== undefined && (obj.SnapName = message.SnapName);
517
- return obj;
518
- },
519
-
520
- fromPartial<I extends Exact<DeepPartial<SnapdSnapRequest>, I>>(object: I): SnapdSnapRequest {
521
- const message = createBaseSnapdSnapRequest();
522
- message.TargetId = object.TargetId ?? "";
523
- message.BackupPool = object.BackupPool ?? "";
524
- message.SnapName = object.SnapName ?? "";
525
- return message;
526
- },
527
- };
528
-
529
- export interface SnapdService {
530
- /** 启用备份 */
531
- SnapdEnable(request: DeepPartial<SnapdEnableRequest>, metadata?: grpc.Metadata): Promise<Empty>;
532
- /** 禁用备份 */
533
- SnapdDisable(request: DeepPartial<SnapdTargetRequest>, metadata?: grpc.Metadata): Promise<Empty>;
534
- /** 获取快照备份配置 */
535
- SnapdConfGet(request: DeepPartial<SnapdTargetRequest>, metadata?: grpc.Metadata): Promise<SnapdConf>;
536
- /** 修改快照备份配置 */
537
- SnapdConfSet(request: DeepPartial<SnapdConfSetRequest>, metadata?: grpc.Metadata): Promise<Empty>;
538
- /** 列举快照信息 */
539
- SnapdSnapList(request: DeepPartial<SnapdListSnapRequest>, metadata?: grpc.Metadata): Promise<SnapdListSnapResponse>;
540
- /** 手动创建快照/备份。以该方式创建的快照/备份会被自动策略忽略 */
541
- SnapdSnapAdd(request: DeepPartial<SnapdSnapRequest>, metadata?: grpc.Metadata): Promise<Empty>;
542
- /** 手动删除快照。目标快照可以是通过自动策略创建的,也可以是手动创建的 */
543
- SnapdSnapDel(request: DeepPartial<SnapdSnapRequest>, metadata?: grpc.Metadata): Promise<Empty>;
544
- /** 将数据回滚到指定快照 */
545
- SnapdSnapRestore(request: DeepPartial<SnapdSnapRequest>, metadata?: grpc.Metadata): Promise<Empty>;
546
- }
547
-
548
- export class SnapdServiceClientImpl implements SnapdService {
549
- private readonly rpc: Rpc;
550
-
551
- constructor(rpc: Rpc) {
552
- this.rpc = rpc;
553
- this.SnapdEnable = this.SnapdEnable.bind(this);
554
- this.SnapdDisable = this.SnapdDisable.bind(this);
555
- this.SnapdConfGet = this.SnapdConfGet.bind(this);
556
- this.SnapdConfSet = this.SnapdConfSet.bind(this);
557
- this.SnapdSnapList = this.SnapdSnapList.bind(this);
558
- this.SnapdSnapAdd = this.SnapdSnapAdd.bind(this);
559
- this.SnapdSnapDel = this.SnapdSnapDel.bind(this);
560
- this.SnapdSnapRestore = this.SnapdSnapRestore.bind(this);
561
- }
562
-
563
- SnapdEnable(request: DeepPartial<SnapdEnableRequest>, metadata?: grpc.Metadata): Promise<Empty> {
564
- return this.rpc.unary(SnapdServiceSnapdEnableDesc, SnapdEnableRequest.fromPartial(request), metadata);
565
- }
566
-
567
- SnapdDisable(request: DeepPartial<SnapdTargetRequest>, metadata?: grpc.Metadata): Promise<Empty> {
568
- return this.rpc.unary(SnapdServiceSnapdDisableDesc, SnapdTargetRequest.fromPartial(request), metadata);
569
- }
570
-
571
- SnapdConfGet(request: DeepPartial<SnapdTargetRequest>, metadata?: grpc.Metadata): Promise<SnapdConf> {
572
- return this.rpc.unary(SnapdServiceSnapdConfGetDesc, SnapdTargetRequest.fromPartial(request), metadata);
573
- }
574
-
575
- SnapdConfSet(request: DeepPartial<SnapdConfSetRequest>, metadata?: grpc.Metadata): Promise<Empty> {
576
- return this.rpc.unary(SnapdServiceSnapdConfSetDesc, SnapdConfSetRequest.fromPartial(request), metadata);
577
- }
578
-
579
- SnapdSnapList(request: DeepPartial<SnapdListSnapRequest>, metadata?: grpc.Metadata): Promise<SnapdListSnapResponse> {
580
- return this.rpc.unary(SnapdServiceSnapdSnapListDesc, SnapdListSnapRequest.fromPartial(request), metadata);
581
- }
582
-
583
- SnapdSnapAdd(request: DeepPartial<SnapdSnapRequest>, metadata?: grpc.Metadata): Promise<Empty> {
584
- return this.rpc.unary(SnapdServiceSnapdSnapAddDesc, SnapdSnapRequest.fromPartial(request), metadata);
585
- }
586
-
587
- SnapdSnapDel(request: DeepPartial<SnapdSnapRequest>, metadata?: grpc.Metadata): Promise<Empty> {
588
- return this.rpc.unary(SnapdServiceSnapdSnapDelDesc, SnapdSnapRequest.fromPartial(request), metadata);
589
- }
590
-
591
- SnapdSnapRestore(request: DeepPartial<SnapdSnapRequest>, metadata?: grpc.Metadata): Promise<Empty> {
592
- return this.rpc.unary(SnapdServiceSnapdSnapRestoreDesc, SnapdSnapRequest.fromPartial(request), metadata);
593
- }
594
- }
595
-
596
- export const SnapdServiceDesc = { serviceName: "cloud.lazycat.apis.sys.SnapdService" };
597
-
598
- export const SnapdServiceSnapdEnableDesc: UnaryMethodDefinitionish = {
599
- methodName: "SnapdEnable",
600
- service: SnapdServiceDesc,
601
- requestStream: false,
602
- responseStream: false,
603
- requestType: {
604
- serializeBinary() {
605
- return SnapdEnableRequest.encode(this).finish();
606
- },
607
- } as any,
608
- responseType: {
609
- deserializeBinary(data: Uint8Array) {
610
- return {
611
- ...Empty.decode(data),
612
- toObject() {
613
- return this;
614
- },
615
- };
616
- },
617
- } as any,
618
- };
619
-
620
- export const SnapdServiceSnapdDisableDesc: UnaryMethodDefinitionish = {
621
- methodName: "SnapdDisable",
622
- service: SnapdServiceDesc,
623
- requestStream: false,
624
- responseStream: false,
625
- requestType: {
626
- serializeBinary() {
627
- return SnapdTargetRequest.encode(this).finish();
628
- },
629
- } as any,
630
- responseType: {
631
- deserializeBinary(data: Uint8Array) {
632
- return {
633
- ...Empty.decode(data),
634
- toObject() {
635
- return this;
636
- },
637
- };
638
- },
639
- } as any,
640
- };
641
-
642
- export const SnapdServiceSnapdConfGetDesc: UnaryMethodDefinitionish = {
643
- methodName: "SnapdConfGet",
644
- service: SnapdServiceDesc,
645
- requestStream: false,
646
- responseStream: false,
647
- requestType: {
648
- serializeBinary() {
649
- return SnapdTargetRequest.encode(this).finish();
650
- },
651
- } as any,
652
- responseType: {
653
- deserializeBinary(data: Uint8Array) {
654
- return {
655
- ...SnapdConf.decode(data),
656
- toObject() {
657
- return this;
658
- },
659
- };
660
- },
661
- } as any,
662
- };
663
-
664
- export const SnapdServiceSnapdConfSetDesc: UnaryMethodDefinitionish = {
665
- methodName: "SnapdConfSet",
666
- service: SnapdServiceDesc,
667
- requestStream: false,
668
- responseStream: false,
669
- requestType: {
670
- serializeBinary() {
671
- return SnapdConfSetRequest.encode(this).finish();
672
- },
673
- } as any,
674
- responseType: {
675
- deserializeBinary(data: Uint8Array) {
676
- return {
677
- ...Empty.decode(data),
678
- toObject() {
679
- return this;
680
- },
681
- };
682
- },
683
- } as any,
684
- };
685
-
686
- export const SnapdServiceSnapdSnapListDesc: UnaryMethodDefinitionish = {
687
- methodName: "SnapdSnapList",
688
- service: SnapdServiceDesc,
689
- requestStream: false,
690
- responseStream: false,
691
- requestType: {
692
- serializeBinary() {
693
- return SnapdListSnapRequest.encode(this).finish();
694
- },
695
- } as any,
696
- responseType: {
697
- deserializeBinary(data: Uint8Array) {
698
- return {
699
- ...SnapdListSnapResponse.decode(data),
700
- toObject() {
701
- return this;
702
- },
703
- };
704
- },
705
- } as any,
706
- };
707
-
708
- export const SnapdServiceSnapdSnapAddDesc: UnaryMethodDefinitionish = {
709
- methodName: "SnapdSnapAdd",
710
- service: SnapdServiceDesc,
711
- requestStream: false,
712
- responseStream: false,
713
- requestType: {
714
- serializeBinary() {
715
- return SnapdSnapRequest.encode(this).finish();
716
- },
717
- } as any,
718
- responseType: {
719
- deserializeBinary(data: Uint8Array) {
720
- return {
721
- ...Empty.decode(data),
722
- toObject() {
723
- return this;
724
- },
725
- };
726
- },
727
- } as any,
728
- };
729
-
730
- export const SnapdServiceSnapdSnapDelDesc: UnaryMethodDefinitionish = {
731
- methodName: "SnapdSnapDel",
732
- service: SnapdServiceDesc,
733
- requestStream: false,
734
- responseStream: false,
735
- requestType: {
736
- serializeBinary() {
737
- return SnapdSnapRequest.encode(this).finish();
738
- },
739
- } as any,
740
- responseType: {
741
- deserializeBinary(data: Uint8Array) {
742
- return {
743
- ...Empty.decode(data),
744
- toObject() {
745
- return this;
746
- },
747
- };
748
- },
749
- } as any,
750
- };
751
-
752
- export const SnapdServiceSnapdSnapRestoreDesc: UnaryMethodDefinitionish = {
753
- methodName: "SnapdSnapRestore",
754
- service: SnapdServiceDesc,
755
- requestStream: false,
756
- responseStream: false,
757
- requestType: {
758
- serializeBinary() {
759
- return SnapdSnapRequest.encode(this).finish();
760
- },
761
- } as any,
762
- responseType: {
763
- deserializeBinary(data: Uint8Array) {
764
- return {
765
- ...Empty.decode(data),
766
- toObject() {
767
- return this;
768
- },
769
- };
770
- },
771
- } as any,
772
- };
773
-
774
- interface UnaryMethodDefinitionishR extends grpc.UnaryMethodDefinition<any, any> {
775
- requestStream: any;
776
- responseStream: any;
777
- }
778
-
779
- type UnaryMethodDefinitionish = UnaryMethodDefinitionishR;
780
-
781
- interface Rpc {
782
- unary<T extends UnaryMethodDefinitionish>(
783
- methodDesc: T,
784
- request: any,
785
- metadata: grpc.Metadata | undefined,
786
- ): Promise<any>;
787
- }
788
-
789
- export class GrpcWebImpl {
790
- private host: string;
791
- private options: {
792
- transport?: grpc.TransportFactory;
793
-
794
- debug?: boolean;
795
- metadata?: grpc.Metadata;
796
- upStreamRetryCodes?: number[];
797
- };
798
-
799
- constructor(
800
- host: string,
801
- options: {
802
- transport?: grpc.TransportFactory;
803
-
804
- debug?: boolean;
805
- metadata?: grpc.Metadata;
806
- upStreamRetryCodes?: number[];
807
- },
808
- ) {
809
- this.host = host;
810
- this.options = options;
811
- }
812
-
813
- unary<T extends UnaryMethodDefinitionish>(
814
- methodDesc: T,
815
- _request: any,
816
- metadata: grpc.Metadata | undefined,
817
- ): Promise<any> {
818
- const request = { ..._request, ...methodDesc.requestType };
819
- const maybeCombinedMetadata = metadata && this.options.metadata
820
- ? new BrowserHeaders({ ...this.options?.metadata.headersMap, ...metadata?.headersMap })
821
- : metadata || this.options.metadata;
822
- return new Promise((resolve, reject) => {
823
- grpc.unary(methodDesc, {
824
- request,
825
- host: this.host,
826
- metadata: maybeCombinedMetadata,
827
- transport: this.options.transport,
828
- debug: this.options.debug,
829
- onEnd: function (response) {
830
- if (response.status === grpc.Code.OK) {
831
- resolve(response.message);
832
- } else {
833
- const err = new GrpcWebError(response.statusMessage, response.status, response.trailers);
834
- reject(err);
835
- }
836
- },
837
- });
838
- });
839
- }
840
- }
841
-
842
- type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
843
-
844
- type DeepPartial<T> = T extends Builtin ? T
845
- : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
846
- : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
847
- : Partial<T>;
848
-
849
- type KeysOfUnion<T> = T extends T ? keyof T : never;
850
- type Exact<P, I extends P> = P extends Builtin ? P
851
- : P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };
852
-
853
- function isSet(value: any): boolean {
854
- return value !== null && value !== undefined;
855
- }
856
-
857
- export class GrpcWebError extends Error {
858
- constructor(message: string, public code: grpc.Code, public metadata: grpc.Metadata) {
859
- super(message);
860
- }
861
- }