@blocklet/did-space-js 0.5.58

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 (160) hide show
  1. package/README.md +77 -0
  2. package/dist/client/index.d.ts +40 -0
  3. package/dist/client/index.js +110 -0
  4. package/dist/commands/backup/backup-blocklet.d.ts +14 -0
  5. package/dist/commands/backup/backup-blocklet.js +83 -0
  6. package/dist/commands/backup/index.d.ts +3 -0
  7. package/dist/commands/backup/index.js +19 -0
  8. package/dist/commands/backup/post-app-backup.d.ts +9 -0
  9. package/dist/commands/backup/post-app-backup.js +49 -0
  10. package/dist/commands/backup/put-app-backup.d.ts +9 -0
  11. package/dist/commands/backup/put-app-backup.js +49 -0
  12. package/dist/commands/base.d.ts +21 -0
  13. package/dist/commands/base.js +47 -0
  14. package/dist/commands/incremental-backup/backup-blocklet.d.ts +14 -0
  15. package/dist/commands/incremental-backup/backup-blocklet.js +90 -0
  16. package/dist/commands/incremental-backup/index.d.ts +1 -0
  17. package/dist/commands/incremental-backup/index.js +17 -0
  18. package/dist/commands/incremental-sync/index.d.ts +2 -0
  19. package/dist/commands/incremental-sync/index.js +18 -0
  20. package/dist/commands/incremental-sync/sync-base.d.ts +76 -0
  21. package/dist/commands/incremental-sync/sync-base.js +236 -0
  22. package/dist/commands/incremental-sync/sync-push.d.ts +30 -0
  23. package/dist/commands/incremental-sync/sync-push.js +202 -0
  24. package/dist/commands/index.d.ts +9 -0
  25. package/dist/commands/index.js +25 -0
  26. package/dist/commands/nft/index.d.ts +1 -0
  27. package/dist/commands/nft/index.js +17 -0
  28. package/dist/commands/nft/put-nft-object.d.ts +20 -0
  29. package/dist/commands/nft/put-nft-object.js +143 -0
  30. package/dist/commands/object/delete-object.d.ts +7 -0
  31. package/dist/commands/object/delete-object.js +38 -0
  32. package/dist/commands/object/get-object.d.ts +7 -0
  33. package/dist/commands/object/get-object.js +43 -0
  34. package/dist/commands/object/index.d.ts +5 -0
  35. package/dist/commands/object/index.js +21 -0
  36. package/dist/commands/object/list-object.d.ts +7 -0
  37. package/dist/commands/object/list-object.js +31 -0
  38. package/dist/commands/object/list-objects.d.ts +7 -0
  39. package/dist/commands/object/list-objects.js +44 -0
  40. package/dist/commands/object/put-object.d.ts +7 -0
  41. package/dist/commands/object/put-object.js +61 -0
  42. package/dist/commands/restore/index.d.ts +3 -0
  43. package/dist/commands/restore/index.js +19 -0
  44. package/dist/commands/restore/post-app-restore.d.ts +7 -0
  45. package/dist/commands/restore/post-app-restore.js +45 -0
  46. package/dist/commands/restore/put-app-restore.d.ts +9 -0
  47. package/dist/commands/restore/put-app-restore.js +49 -0
  48. package/dist/commands/restore/restore-blocklet.d.ts +14 -0
  49. package/dist/commands/restore/restore-blocklet.js +80 -0
  50. package/dist/commands/space/head.d.ts +8 -0
  51. package/dist/commands/space/head.js +52 -0
  52. package/dist/commands/space/index.d.ts +1 -0
  53. package/dist/commands/space/index.js +17 -0
  54. package/dist/commands/sync/index.d.ts +3 -0
  55. package/dist/commands/sync/index.js +19 -0
  56. package/dist/commands/sync/sync-folder-base.d.ts +105 -0
  57. package/dist/commands/sync/sync-folder-base.js +319 -0
  58. package/dist/commands/sync/sync-folder-pull.d.ts +13 -0
  59. package/dist/commands/sync/sync-folder-pull.js +151 -0
  60. package/dist/commands/sync/sync-folder-push.d.ts +20 -0
  61. package/dist/commands/sync/sync-folder-push.js +166 -0
  62. package/dist/did-document/did-document.d.ts +29 -0
  63. package/dist/did-document/did-document.js +2 -0
  64. package/dist/did-document/index.d.ts +3 -0
  65. package/dist/did-document/index.js +19 -0
  66. package/dist/did-document/sign-document.d.ts +3 -0
  67. package/dist/did-document/sign-document.js +13 -0
  68. package/dist/did-document/verify-document.d.ts +10 -0
  69. package/dist/did-document/verify-document.js +35 -0
  70. package/dist/index.d.ts +7 -0
  71. package/dist/index.js +23 -0
  72. package/dist/libs/api.d.ts +3 -0
  73. package/dist/libs/api.js +65 -0
  74. package/dist/libs/did.d.ts +9 -0
  75. package/dist/libs/did.js +34 -0
  76. package/dist/libs/encoding.d.ts +7 -0
  77. package/dist/libs/encoding.js +17 -0
  78. package/dist/libs/error.d.ts +4 -0
  79. package/dist/libs/error.js +27 -0
  80. package/dist/libs/hash.d.ts +1 -0
  81. package/dist/libs/hash.js +5 -0
  82. package/dist/libs/index.d.ts +11 -0
  83. package/dist/libs/index.js +27 -0
  84. package/dist/libs/logger.d.ts +2 -0
  85. package/dist/libs/logger.js +12 -0
  86. package/dist/libs/object-integrality.d.ts +1 -0
  87. package/dist/libs/object-integrality.js +13 -0
  88. package/dist/libs/performance.d.ts +7 -0
  89. package/dist/libs/performance.js +13 -0
  90. package/dist/libs/sleep.d.ts +1 -0
  91. package/dist/libs/sleep.js +9 -0
  92. package/dist/libs/space.d.ts +16 -0
  93. package/dist/libs/space.js +56 -0
  94. package/dist/libs/stream.d.ts +3 -0
  95. package/dist/libs/stream.js +10 -0
  96. package/dist/meta/backup/backup-blocklet-command.d.ts +50 -0
  97. package/dist/meta/backup/backup-blocklet-command.js +2 -0
  98. package/dist/meta/backup/index.d.ts +3 -0
  99. package/dist/meta/backup/index.js +19 -0
  100. package/dist/meta/backup/post-app-backup-command.d.ts +8 -0
  101. package/dist/meta/backup/post-app-backup-command.js +16 -0
  102. package/dist/meta/backup/put-app-backup-command.d.ts +7 -0
  103. package/dist/meta/backup/put-app-backup-command.js +18 -0
  104. package/dist/meta/incremental-backup/backup-blocklet-command.d.ts +50 -0
  105. package/dist/meta/incremental-backup/backup-blocklet-command.js +2 -0
  106. package/dist/meta/incremental-backup/index.d.ts +1 -0
  107. package/dist/meta/incremental-backup/index.js +17 -0
  108. package/dist/meta/index.d.ts +7 -0
  109. package/dist/meta/index.js +23 -0
  110. package/dist/meta/nft/index.d.ts +1 -0
  111. package/dist/meta/nft/index.js +17 -0
  112. package/dist/meta/nft/put-nft-object-command.d.ts +51 -0
  113. package/dist/meta/nft/put-nft-object-command.js +2 -0
  114. package/dist/meta/object/delete-object-command.d.ts +6 -0
  115. package/dist/meta/object/delete-object-command.js +2 -0
  116. package/dist/meta/object/get-object-command.d.ts +10 -0
  117. package/dist/meta/object/get-object-command.js +2 -0
  118. package/dist/meta/object/head-object-command.d.ts +13 -0
  119. package/dist/meta/object/head-object-command.js +2 -0
  120. package/dist/meta/object/index.d.ts +5 -0
  121. package/dist/meta/object/index.js +21 -0
  122. package/dist/meta/object/list-object-command.d.ts +6 -0
  123. package/dist/meta/object/list-object-command.js +2 -0
  124. package/dist/meta/object/list-objects-command.d.ts +8 -0
  125. package/dist/meta/object/list-objects-command.js +2 -0
  126. package/dist/meta/object/put-object-command.d.ts +29 -0
  127. package/dist/meta/object/put-object-command.js +2 -0
  128. package/dist/meta/restore/index.d.ts +3 -0
  129. package/dist/meta/restore/index.js +19 -0
  130. package/dist/meta/restore/post-app-restore-command.d.ts +8 -0
  131. package/dist/meta/restore/post-app-restore-command.js +13 -0
  132. package/dist/meta/restore/put-app-restore-command.d.ts +7 -0
  133. package/dist/meta/restore/put-app-restore-command.js +18 -0
  134. package/dist/meta/restore/restore-blocklet-command.d.ts +28 -0
  135. package/dist/meta/restore/restore-blocklet-command.js +2 -0
  136. package/dist/meta/spaces-client-options.d.ts +5 -0
  137. package/dist/meta/spaces-client-options.js +2 -0
  138. package/dist/meta/sync/incremental-sync-base-command.d.ts +7 -0
  139. package/dist/meta/sync/incremental-sync-base-command.js +2 -0
  140. package/dist/meta/sync/incremental-sync-push-command.d.ts +8 -0
  141. package/dist/meta/sync/incremental-sync-push-command.js +2 -0
  142. package/dist/meta/sync/index.d.ts +6 -0
  143. package/dist/meta/sync/index.js +22 -0
  144. package/dist/meta/sync/sync-base-command.d.ts +121 -0
  145. package/dist/meta/sync/sync-base-command.js +2 -0
  146. package/dist/meta/sync/sync-folder-base-command.d.ts +12 -0
  147. package/dist/meta/sync/sync-folder-base-command.js +2 -0
  148. package/dist/meta/sync/sync-folder-pull-command.d.ts +5 -0
  149. package/dist/meta/sync/sync-folder-pull-command.js +2 -0
  150. package/dist/meta/sync/sync-folder-push-command.d.ts +7 -0
  151. package/dist/meta/sync/sync-folder-push-command.js +2 -0
  152. package/dist/protocol/command.protocol.d.ts +68 -0
  153. package/dist/protocol/command.protocol.js +2 -0
  154. package/dist/protocol/index.d.ts +1 -0
  155. package/dist/protocol/index.js +17 -0
  156. package/dist/security/index.d.ts +1 -0
  157. package/dist/security/index.js +17 -0
  158. package/dist/security/request-signature.d.ts +32 -0
  159. package/dist/security/request-signature.js +140 -0
  160. package/package.json +78 -0
@@ -0,0 +1,6 @@
1
+ import { Object } from '@did-space/core';
2
+ import type { CommandOutput } from '../../protocol';
3
+ export interface ListObjectCommandInput {
4
+ key: string;
5
+ }
6
+ export type ListObjectCommandOutput = CommandOutput<Object>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,8 @@
1
+ import { Object } from '@did-space/core';
2
+ import { CommandOutput } from '../../protocol';
3
+ export interface ListObjectsCommandInput {
4
+ key: string;
5
+ recursive?: false | true;
6
+ ignoreDirectories?: false | true;
7
+ }
8
+ export type ListObjectsCommandOutput = CommandOutput<Object[]>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,29 @@
1
+ import { Data } from '@did-space/core';
2
+ import type { CommandOutput } from '../../protocol';
3
+ export interface PutObjectCommandInput {
4
+ /**
5
+ * @description 可以是一个文件名或者文件夹
6
+ * @type {string}
7
+ * @memberof PutObjectCommandInput
8
+ */
9
+ key: string;
10
+ /**
11
+ * @description
12
+ * @type {Data}
13
+ * @memberof PutObjectCommandInput
14
+ */
15
+ data?: Data;
16
+ /**
17
+ * @description 对象的 hash 值,我们期望它是 ipfs v1 的 hash
18
+ * @type {string}
19
+ * @memberof PutObjectCommandInput
20
+ */
21
+ hash?: string;
22
+ /**
23
+ * @description 存储文件夹或者文件的元数据
24
+ * @type {Record<string, any>}
25
+ * @memberof PutObjectCommandInput
26
+ */
27
+ metadata?: Record<string, any>;
28
+ }
29
+ export type PutObjectCommandOutput = CommandOutput<void>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ export * from './post-app-restore-command';
2
+ export * from './put-app-restore-command';
3
+ export * from './restore-blocklet-command';
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./post-app-restore-command"), exports);
18
+ __exportStar(require("./put-app-restore-command"), exports);
19
+ __exportStar(require("./restore-blocklet-command"), exports);
@@ -0,0 +1,8 @@
1
+ import { AppRestore } from '@did-space/core';
2
+ import type { ObjectSchema } from 'joi';
3
+ import { CommandOutput } from '../../protocol/command.protocol';
4
+ export declare const PostAppRestoreCommandInputSchema: ObjectSchema<any>;
5
+ export interface PostAppRestoreCommandInput extends Pick<AppRestore, 'userDid' | 'referrer' | 'serverDid'> {
6
+ }
7
+ export interface PostAppRestoreCommandOutput extends CommandOutput<Required<AppRestore>> {
8
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PostAppRestoreCommandInputSchema = void 0;
4
+ const validator_1 = require("@arcblock/validator");
5
+ exports.PostAppRestoreCommandInputSchema = validator_1.Joi.object({
6
+ userDid: validator_1.Joi.DID(),
7
+ referrer: validator_1.Joi.string()
8
+ .uri({
9
+ scheme: ['http', 'https'],
10
+ })
11
+ .required(),
12
+ serverDid: validator_1.Joi.string().optional().allow('').default(''),
13
+ });
@@ -0,0 +1,7 @@
1
+ import { AppRestore } from '@did-space/core';
2
+ import type { ObjectSchema } from 'joi';
3
+ import type { CommandOutput } from '../../protocol';
4
+ export declare const PutAppRestoreCommandInputSchema: ObjectSchema<any>;
5
+ export type PutAppRestoreCommandInput = Required<Pick<AppRestore, 'id'>> & Partial<AppRestore>;
6
+ export interface PutAppRestoreCommandOutput extends CommandOutput<Required<AppRestore>> {
7
+ }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PutAppRestoreCommandInputSchema = void 0;
4
+ const validator_1 = require("@arcblock/validator");
5
+ const core_1 = require("@did-space/core");
6
+ exports.PutAppRestoreCommandInputSchema = validator_1.Joi.object({
7
+ id: validator_1.Joi.string().required(),
8
+ updateAt: validator_1.Joi.string()
9
+ .optional()
10
+ .default(() => new Date().toISOString()),
11
+ // 默认是 APP_BACKUP_STATUS.DEFAULT 是因为我要兼容以前的旧版本的数据
12
+ status: validator_1.Joi.string()
13
+ .optional()
14
+ .allow('')
15
+ .valid(...Object.values(core_1.APP_BACKUP_STATUS))
16
+ .default(core_1.APP_BACKUP_STATUS.DEFAULT),
17
+ message: validator_1.Joi.string().optional().allow('').default(''),
18
+ });
@@ -0,0 +1,28 @@
1
+ import { SyncFolderBaseCommandInput, SyncFolderBaseCommandOutput } from '../sync/sync-folder-base-command';
2
+ export interface RestoreBlockletCommandInput extends Omit<SyncFolderBaseCommandInput, 'source'> {
3
+ appDid: string;
4
+ /**
5
+ *
6
+ * @description 备份人员的 userDid
7
+ * @type {string}
8
+ * @memberof RestoreBlockletCommandInput
9
+ */
10
+ userDid: string;
11
+ /**
12
+ *
13
+ * @description 用户当时在什么页面备份的呢?
14
+ * @type {string}
15
+ * @memberof RestoreBlockletCommandInput
16
+ */
17
+ referrer: string;
18
+ /**
19
+ *
20
+ * @description 指向 server 的 did 地址
21
+ * @default ""
22
+ * @type {string}
23
+ * @memberof RestoreBlockletCommandInput
24
+ */
25
+ serverDid: string;
26
+ }
27
+ export interface RestoreBlockletCommandOutput extends SyncFolderBaseCommandOutput {
28
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,5 @@
1
+ export interface SpaceEndpointContext {
2
+ baseUrl: string;
3
+ spaceDid: string;
4
+ appDid: string;
5
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,7 @@
1
+ import { Object } from '@did-space/core';
2
+ import { SyncBaseCommandInput, SyncBaseCommandOutput } from './sync-base-command';
3
+ export interface IncrementalSyncBaseCommandInput extends SyncBaseCommandInput {
4
+ source: Object[];
5
+ }
6
+ export interface IncrementalSyncBaseCommandOutput extends SyncBaseCommandOutput {
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,8 @@
1
+ import { Object, type ObjectMetadata } from '@did-space/core';
2
+ import { SyncBaseCommandInput, SyncBaseCommandOutput } from './sync-base-command';
3
+ export interface IncrementalSyncPushCommandInput extends SyncBaseCommandInput {
4
+ source: Object[];
5
+ metadata?: ObjectMetadata;
6
+ }
7
+ export interface IncrementalSyncPushCommandOutput extends SyncBaseCommandOutput {
8
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,6 @@
1
+ export * from './incremental-sync-push-command';
2
+ export * from './incremental-sync-base-command';
3
+ export * from './sync-base-command';
4
+ export * from './sync-folder-base-command';
5
+ export * from './sync-folder-pull-command';
6
+ export * from './sync-folder-push-command';
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./incremental-sync-push-command"), exports);
18
+ __exportStar(require("./incremental-sync-base-command"), exports);
19
+ __exportStar(require("./sync-base-command"), exports);
20
+ __exportStar(require("./sync-folder-base-command"), exports);
21
+ __exportStar(require("./sync-folder-pull-command"), exports);
22
+ __exportStar(require("./sync-folder-push-command"), exports);
@@ -0,0 +1,121 @@
1
+ import { Object } from '@did-space/core';
2
+ import type { CommandOutput } from '../../protocol';
3
+ export interface OnProgressInput {
4
+ /**
5
+ *
6
+ * @description 已完成的任务数
7
+ * @type {number}
8
+ * @memberof OnProgressInput
9
+ */
10
+ completed: number;
11
+ /**
12
+ *
13
+ * @description 总任务数
14
+ * @type {number}
15
+ * @memberof OnProgressInput
16
+ */
17
+ total: number;
18
+ /**
19
+ *
20
+ * @description 文件的key
21
+ * @type {string}
22
+ * @memberof OnProgressInput
23
+ */
24
+ key: string;
25
+ }
26
+ export interface OnAfterUploadInput {
27
+ /**
28
+ *
29
+ * @description 已完成的任务数
30
+ * @type {number}
31
+ * @memberof OnProgressInput
32
+ */
33
+ completed: number;
34
+ /**
35
+ *
36
+ * @description 总任务数
37
+ * @type {number}
38
+ * @memberof OnProgressInput
39
+ */
40
+ total: number;
41
+ /**
42
+ *
43
+ * @description 文件的key
44
+ * @type {string}
45
+ * @memberof OnProgressInput
46
+ */
47
+ key: string;
48
+ }
49
+ export interface SyncBaseCommandInput {
50
+ /**
51
+ *
52
+ * @description 将 source 同步到 target, 文件夹请添加尾杠 /
53
+ * @type {string}
54
+ * @memberof SyncFolderBaseCommandInput
55
+ */
56
+ target: string;
57
+ /**
58
+ *
59
+ * @description 并发数,默认为 256
60
+ * @default 256
61
+ * @type {number}
62
+ * @memberof SyncFolderBaseCommandInput
63
+ */
64
+ concurrency?: number;
65
+ /**
66
+ *
67
+ * @description 同步失败后重试次数,默认重试 3 次
68
+ * @default 3
69
+ * @type {number}
70
+ * @memberof SyncFolderPushCommandInput
71
+ */
72
+ retryCount?: number;
73
+ /**
74
+ *
75
+ * @description 是否输出 debug 信息
76
+ * @default false
77
+ * @type {boolean}
78
+ * @memberof SyncFolderPushCommandInput
79
+ */
80
+ debug?: boolean;
81
+ /**
82
+ *
83
+ * @description 过滤函数,可用于过滤掉某些目录或者文件,需要 sync 请返回 true, 不需要 sync 请返回 false
84
+ * @default 默认同步所有文件,不过滤
85
+ * @memberof SyncFolderBaseCommandInput
86
+ */
87
+ filter?: (object: Object, index: number, objects: Object[]) => boolean;
88
+ onProgress?: (input: OnProgressInput) => Promise<void>;
89
+ onAfterUpload?: (input: OnAfterUploadInput) => Promise<void>;
90
+ /**
91
+ * @description 可以临时存放文件的一个目录,可不填写,但运行时一定有值
92
+ * @type {string}
93
+ * @memberof SyncBaseCommandInput
94
+ */
95
+ tmpDir?: string;
96
+ }
97
+ export interface SyncBaseCommandOutputData {
98
+ /**
99
+ * @description 发生错误的任务数
100
+ * @type {number}
101
+ * @memberof SyncFolderBaseCommandOutput
102
+ */
103
+ errorCount: number;
104
+ /**
105
+ *
106
+ * @description 总任务数
107
+ * @type {number}
108
+ * @memberof SyncFolderBaseCommandOutput
109
+ */
110
+ count: number;
111
+ /**
112
+ *
113
+ * @description 花了多少秒才处理完成呢?
114
+ * @unit 秒(s)
115
+ * @type {number}
116
+ * @memberof SyncFolderBaseCommandOutput
117
+ */
118
+ duration: number;
119
+ }
120
+ export interface SyncBaseCommandOutput extends CommandOutput<SyncBaseCommandOutputData> {
121
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,12 @@
1
+ import { SyncBaseCommandInput, SyncBaseCommandOutput } from './sync-base-command';
2
+ export interface SyncFolderBaseCommandInput extends SyncBaseCommandInput {
3
+ /**
4
+ *
5
+ * @description 需要被同步的 source, 文件夹请添加尾杠 /
6
+ * @type {string}
7
+ * @memberof SyncFolderBaseCommandInput
8
+ */
9
+ source: string;
10
+ }
11
+ export interface SyncFolderBaseCommandOutput extends SyncBaseCommandOutput {
12
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,5 @@
1
+ import { SyncFolderBaseCommandInput, SyncFolderBaseCommandOutput } from './sync-folder-base-command';
2
+ export interface SyncFolderPullCommandInput extends SyncFolderBaseCommandInput {
3
+ }
4
+ export interface SyncFolderPullCommandOutput extends SyncFolderBaseCommandOutput {
5
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,7 @@
1
+ import type { ObjectMetadata } from '@did-space/core';
2
+ import { SyncFolderBaseCommandInput, SyncFolderBaseCommandOutput } from './sync-folder-base-command';
3
+ export interface SyncFolderPushCommandInput extends SyncFolderBaseCommandInput {
4
+ metadata?: ObjectMetadata;
5
+ }
6
+ export interface SyncFolderPushCommandOutput extends SyncFolderBaseCommandOutput {
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,68 @@
1
+ import type { WalletObject } from '@ocap/wallet';
2
+ import type { Response } from 'got';
3
+ export interface CommandInput {
4
+ }
5
+ export interface CommandOutput<D = any> {
6
+ /**
7
+ *
8
+ * @description
9
+ * @type {string}
10
+ * @memberof CommandOutput
11
+ */
12
+ statusCode: number;
13
+ /**
14
+ *
15
+ * @description 一般来说,发生错误的时候才会有值
16
+ * @type {string}
17
+ * @memberof CommandOutput
18
+ */
19
+ statusMessage?: string;
20
+ /**
21
+ * @description
22
+ * @type {string}
23
+ * @memberof CommandOutput
24
+ */
25
+ stack?: string;
26
+ /**
27
+ * @description
28
+ * @type {D}
29
+ * @memberof CommandOutput
30
+ */
31
+ data: D;
32
+ response?: Response;
33
+ }
34
+ export interface SpaceClientOptions {
35
+ /**
36
+ *
37
+ * @default blocklet wallet
38
+ * @type {WalletObject}
39
+ * @memberof SpaceClientOptions
40
+ */
41
+ wallet: WalletObject;
42
+ /**
43
+ *
44
+ * @description spaces endpoint
45
+ * @example https://cedcaa27-znkomkclejcfbjaxw9knzzebmzmqrxjnn9bb.did.abtnet.io/api/space/z3T6EHN7sLhH5cty1PshDeSipeG7JNxEVaRFS/app/zNKabhhwdvVmXjtRTtSHk2YQz4pdDPStV289/
46
+ * @type {string}
47
+ * @memberof SpaceClientOptions
48
+ */
49
+ endpoint: string;
50
+ /**
51
+ * A jwt token that certifies the requester is authorized to access the space
52
+ * @description delegation token
53
+ * @type {string}
54
+ * @memberof SpaceClientOptions
55
+ */
56
+ delegation?: string;
57
+ /**
58
+ * @description
59
+ * @type {string}
60
+ * @memberof SpaceClientOptions
61
+ */
62
+ componentDid?: string;
63
+ }
64
+ export interface CommandProtocol<Input extends CommandInput, Output extends CommandOutput> {
65
+ input: Input;
66
+ context: SpaceClientOptions;
67
+ request(...args: any[]): Promise<Output>;
68
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export * from './command.protocol';
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./command.protocol"), exports);
@@ -0,0 +1 @@
1
+ export * from './request-signature';
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./request-signature"), exports);
@@ -0,0 +1,32 @@
1
+ import { WalletObject } from '@ocap/wallet';
2
+ type Method = import('got/dist/source').Method;
3
+ type Headers = {
4
+ 'x-app-did': string;
5
+ 'x-app-pk': string;
6
+ 'x-app-token': string;
7
+ 'x-app-delegation': string;
8
+ [key: string]: any;
9
+ };
10
+ declare function verifyDelegation(delegation: string, delegatee: WalletObject): string;
11
+ declare function signRequest({ url, method, data, headers, wallet, delegation, }: {
12
+ url: string;
13
+ method: Method;
14
+ data: any;
15
+ headers: {
16
+ [key: string]: string;
17
+ };
18
+ wallet: WalletObject;
19
+ delegation?: string;
20
+ }): {
21
+ url: string;
22
+ method: Method;
23
+ data: any;
24
+ headers: Headers;
25
+ };
26
+ declare function verifyRequest({ url, method, data, headers, }: {
27
+ url: string;
28
+ method: Method;
29
+ data: any;
30
+ headers: Headers;
31
+ }): string;
32
+ export { signRequest, verifyRequest, verifyDelegation };