@did-space/core 0.2.130 → 0.2.132

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, GetHashOptions, ListOptions, ListsOptions, PermissionOptions, ReadOptions, SpaceConfigProtocol, SpaceOperatorProtocol, WriteOptions } from '../protocols';
5
+ import { AppSpaceOptions, DeleteOptions, DriverOptions, DriverProtocol, GetHashOptions, KeyStatus, 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);
@@ -36,4 +36,5 @@ export declare abstract class BaseDriver implements DriverProtocol {
36
36
  deleteAsOwner(key: string): Promise<void>;
37
37
  readAsOwner(key: string): Promise<Stream>;
38
38
  existsAsOwner(key: string): Promise<boolean>;
39
+ getStatusAsOwner(key: string): Promise<KeyStatus>;
39
40
  }
@@ -146,5 +146,8 @@ class BaseDriver {
146
146
  existsAsOwner(key) {
147
147
  return this.spaceOperator.existsAsOwner(key);
148
148
  }
149
+ getStatusAsOwner(key) {
150
+ return this.spaceOperator.getStatusAsOwner(key);
151
+ }
149
152
  }
150
153
  exports.BaseDriver = BaseDriver;
@@ -1,9 +1,15 @@
1
1
  /// <reference types="node" />
2
2
  import { Stream } from 'stream';
3
3
  import { Data } from '../meta';
4
+ export type KeyStatus = {
5
+ objects: number;
6
+ lastModified: number;
7
+ size: number;
8
+ };
4
9
  export interface SpaceOwnerOperatorProtocol {
5
10
  writeAsOwner(key: string, data: Data): Promise<void>;
6
11
  deleteAsOwner(key: string): Promise<void>;
7
12
  readAsOwner(key: string): Promise<Stream>;
8
13
  existsAsOwner(key: string): Promise<boolean>;
14
+ getStatusAsOwner(key: string): Promise<KeyStatus>;
9
15
  }
@@ -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, GetHashOptions } from '../protocols';
5
+ import { WriteOptions, ReadOptions, SpaceProtocol, DriverProtocol, AppSpaceOptions, PermissionOptions, DeleteOptions, ListOptions, ListsOptions, GetHashOptions, KeyStatus } from '../protocols';
6
6
  export declare class Space implements SpaceProtocol {
7
7
  readonly driver: DriverProtocol;
8
8
  static readonly READONLY_OBJECT_KEYS: string[];
@@ -40,5 +40,6 @@ export declare class Space implements SpaceProtocol {
40
40
  deleteAsOwner(key: string): Promise<void>;
41
41
  readAsOwner(key: string): Promise<Stream>;
42
42
  existsAsOwner(key: string): Promise<boolean>;
43
+ getStatusAsOwner(key: string): Promise<KeyStatus>;
43
44
  static editable(key: string): boolean;
44
45
  }
@@ -179,6 +179,9 @@ class Space {
179
179
  existsAsOwner(key) {
180
180
  return this.driver.existsAsOwner(key);
181
181
  }
182
+ getStatusAsOwner(key) {
183
+ return this.driver.getStatusAsOwner(key);
184
+ }
182
185
  static editable(key) {
183
186
  return !Space.READONLY_OBJECT_KEYS.includes(key);
184
187
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@did-space/core",
3
- "version": "0.2.130",
3
+ "version": "0.2.132",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -32,7 +32,7 @@
32
32
  ]
33
33
  },
34
34
  "dependencies": {
35
- "@arcblock/validator": "^1.18.84",
35
+ "@arcblock/validator": "^1.18.85",
36
36
  "joi": "^17.9.2",
37
37
  "xbytes": "^1.8.0"
38
38
  },
@@ -47,5 +47,5 @@
47
47
  "ts-jest": "^28.0.6",
48
48
  "typescript": "^4.9.5"
49
49
  },
50
- "gitHead": "1e1bebb766feb7b3d17e78cc7dfe66f72c050aa0"
50
+ "gitHead": "72e410dd3ce245e4b5d66d998c3042c1eda1352d"
51
51
  }