@did-space/core 0.1.61 → 0.1.63

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.
@@ -2,7 +2,7 @@
2
2
  import { Stream } from 'stream';
3
3
  import { SpaceConfig } from '../configuration';
4
4
  import { Data, Object } from '../meta';
5
- import { AppSpaceOptions, DeleteOptions, DriverOptions, DriverProtocol, ListOptions, ListsOptions, PermissionOptions, ReadOptions, SpaceConfigProtocol, SpaceOperatorProtocol, WriteOptions } from '../protocols';
5
+ import { AppSpaceOptions, DeleteOptions, DriverOptions, DriverProtocol, GetHashOptions, ListOptions, ListsOptions, PermissionOptions, ReadOptions, SpaceConfigProtocol, SpaceOperatorProtocol, WriteOptions } from '../protocols';
6
6
  export declare abstract class BaseDriver implements DriverProtocol {
7
7
  readonly options: DriverOptions;
8
8
  constructor(options: DriverOptions);
@@ -28,6 +28,7 @@ export declare abstract class BaseDriver implements DriverProtocol {
28
28
  write(options: WriteOptions): Promise<void>;
29
29
  delete(options: DeleteOptions): Promise<void>;
30
30
  read(options: ReadOptions): Promise<Stream>;
31
+ getHash(options: GetHashOptions): Promise<string>;
31
32
  exists(options: ReadOptions): Promise<boolean>;
32
33
  lists(options: ListsOptions): Promise<Object[]>;
33
34
  list(options: ListOptions): Promise<Object>;
@@ -128,6 +128,11 @@ class BaseDriver {
128
128
  return this.spaceOperator.read(options);
129
129
  });
130
130
  }
131
+ getHash(options) {
132
+ return __awaiter(this, void 0, void 0, function* () {
133
+ return this.spaceOperator.getHash(options);
134
+ });
135
+ }
131
136
  exists(options) {
132
137
  return __awaiter(this, void 0, void 0, function* () {
133
138
  if (!(yield this.spaceConfig.isListable({
@@ -1,4 +1,12 @@
1
1
  export interface Object {
2
+ /**
3
+ *
4
+ * @description
5
+ * @tips 约定好 key 的第一个字符是 /
6
+ * @example /demo/index.html
7
+ * @type {string}
8
+ * @memberof Object
9
+ */
2
10
  key: string;
3
11
  name: string;
4
12
  isDir: boolean;
@@ -9,6 +9,7 @@ export interface AppSpaceOptions {
9
9
  export interface WriteOptions extends AppSpaceOptions {
10
10
  key: string;
11
11
  data: Data;
12
+ hash?: string;
12
13
  }
13
14
  export interface DeleteOptions extends AppSpaceOptions {
14
15
  key: string;
@@ -16,6 +17,9 @@ export interface DeleteOptions extends AppSpaceOptions {
16
17
  export interface ReadOptions extends AppSpaceOptions {
17
18
  key: string;
18
19
  }
20
+ export interface GetHashOptions extends AppSpaceOptions {
21
+ key: string;
22
+ }
19
23
  export interface ListOptions {
20
24
  key: string;
21
25
  }
@@ -48,6 +52,7 @@ export interface SpaceOperatorProtocol extends SpaceOwnerOperatorProtocol {
48
52
  write(options: WriteOptions): Promise<void>;
49
53
  delete(options: DeleteOptions): Promise<void>;
50
54
  read(options: ReadOptions): Promise<Stream>;
55
+ getHash(options: GetHashOptions): Promise<string>;
51
56
  exists(options: ReadOptions): Promise<boolean>;
52
57
  lists(options: ListsOptions): Promise<Object[]>;
53
58
  list(options: ListOptions): Promise<Object>;
@@ -2,7 +2,7 @@
2
2
  import { Stream } from 'stream';
3
3
  import { SpaceConfig } from '../configuration';
4
4
  import { Data, Object } from '../meta';
5
- import { WriteOptions, ReadOptions, SpaceProtocol, DriverProtocol, AppSpaceOptions, PermissionOptions, DeleteOptions, ListOptions, ListsOptions } from '../protocols';
5
+ import { WriteOptions, ReadOptions, SpaceProtocol, DriverProtocol, AppSpaceOptions, PermissionOptions, DeleteOptions, ListOptions, ListsOptions, GetHashOptions } from '../protocols';
6
6
  export declare class Space implements SpaceProtocol {
7
7
  readonly driver: DriverProtocol;
8
8
  static readonly READONLY_OBJECT_KEYS: string[];
@@ -27,6 +27,7 @@ export declare class Space implements SpaceProtocol {
27
27
  write(options: WriteOptions): Promise<void>;
28
28
  delete(options: DeleteOptions): Promise<void>;
29
29
  read(options: ReadOptions): Promise<Stream>;
30
+ getHash(options: GetHashOptions): Promise<string>;
30
31
  exists(options: ReadOptions): Promise<boolean>;
31
32
  lists(options: ListsOptions): Promise<Object[]>;
32
33
  list(options: ListOptions): Promise<Object>;
@@ -114,6 +114,11 @@ class Space {
114
114
  return this.driver.read(options);
115
115
  });
116
116
  }
117
+ getHash(options) {
118
+ return __awaiter(this, void 0, void 0, function* () {
119
+ return this.driver.getHash(options);
120
+ });
121
+ }
117
122
  exists(options) {
118
123
  return __awaiter(this, void 0, void 0, function* () {
119
124
  return this.driver.exists(options);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@did-space/core",
3
- "version": "0.1.61",
3
+ "version": "0.1.63",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -32,14 +32,14 @@
32
32
  ]
33
33
  },
34
34
  "dependencies": {
35
- "@arcblock/did": "^1.18.32",
36
- "@arcblock/jwt": "^1.18.32",
37
- "@arcblock/validator": "^1.18.32",
35
+ "@arcblock/did": "^1.18.35",
36
+ "@arcblock/jwt": "^1.18.35",
37
+ "@arcblock/validator": "^1.18.35",
38
38
  "@aws-sdk/client-s3": "^3.45.0",
39
39
  "@aws-sdk/signature-v4-crt": "^3.45.0",
40
- "@blocklet/meta": "^1.8.49",
41
- "@ocap/mcrypto": "^1.18.32",
42
- "@ocap/wallet": "^1.18.32",
40
+ "@blocklet/meta": "^1.8.55",
41
+ "@ocap/mcrypto": "^1.18.35",
42
+ "@ocap/wallet": "^1.18.35",
43
43
  "fs-extra": "^10.0.0",
44
44
  "joi": "^17.5.0",
45
45
  "js-yaml": "^4.1.0",
@@ -61,5 +61,5 @@
61
61
  "ts-jest": "^28.0.6",
62
62
  "typescript": "4.4.4"
63
63
  },
64
- "gitHead": "817bd492edb1e8c92e307c6005e06e6c3cd51e62"
64
+ "gitHead": "03b28e9ab9337fb06c64a7dcb9318e5870091043"
65
65
  }