@did-space/core 1.1.0 → 1.1.2

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.
@@ -20,8 +20,8 @@ export type KeyStatus = {
20
20
  };
21
21
  export type ObjectMetadata = Record<string, any>;
22
22
  export type WriteAsOwnerOptions = {
23
- hash: string | null;
24
- size: number;
23
+ hash?: string | null;
24
+ size?: number;
25
25
  useGlobal?: false | true;
26
26
  metadata?: ObjectMetadata;
27
27
  };
@@ -145,7 +145,6 @@ class ObjectSpace extends events_1.default {
145
145
  throw error;
146
146
  }
147
147
  const key = (0, path_1.join)(yield this.getAppSpacePath(options), options.key);
148
- // @ts-expect-error
149
148
  yield this.writeAsOwner(key, options.data, options);
150
149
  debug('write.after', JSON.stringify({ key }));
151
150
  });
@@ -597,6 +596,10 @@ class ObjectSpace extends events_1.default {
597
596
  spaceDid: this.options.spaceDid,
598
597
  key,
599
598
  };
599
+ // @note: 根目录总是存在的
600
+ if (key === '/') {
601
+ return true;
602
+ }
600
603
  debug('existsAsOwner.before', JSON.stringify({ where }));
601
604
  const exists = Boolean(yield this.options.treeRepository.findOne({
602
605
  where,
@@ -20,8 +20,8 @@ export type KeyStatus = {
20
20
  };
21
21
  export type ObjectMetadata = Record<string, any>;
22
22
  export type WriteAsOwnerOptions = {
23
- hash: string | null;
24
- size: number;
23
+ hash?: string | null;
24
+ size?: number;
25
25
  useGlobal?: false | true;
26
26
  metadata?: ObjectMetadata;
27
27
  };
@@ -121,7 +121,6 @@ export class ObjectSpace extends EventEmitter {
121
121
  throw error;
122
122
  }
123
123
  const key = join(await this.getAppSpacePath(options), options.key);
124
- // @ts-expect-error
125
124
  await this.writeAsOwner(key, options.data, options);
126
125
  debug('write.after', JSON.stringify({ key }));
127
126
  }
@@ -552,6 +551,10 @@ export class ObjectSpace extends EventEmitter {
552
551
  spaceDid: this.options.spaceDid,
553
552
  key,
554
553
  };
554
+ // @note: 根目录总是存在的
555
+ if (key === '/') {
556
+ return true;
557
+ }
555
558
  debug('existsAsOwner.before', JSON.stringify({ where }));
556
559
  const exists = Boolean(await this.options.treeRepository.findOne({
557
560
  where,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@did-space/core",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -111,7 +111,7 @@
111
111
  "@arcblock/did": "^1.20.15",
112
112
  "@arcblock/ipfs-only-hash": "^0.0.2",
113
113
  "@arcblock/validator": "^1.20.15",
114
- "@did-space/constants": "^1.1.0",
114
+ "@did-space/constants": "^1.1.2",
115
115
  "dayjs": "^1.11.13",
116
116
  "debug": "^4.4.1",
117
117
  "destroy": "^1.2.0",
@@ -142,5 +142,5 @@
142
142
  "vite": "^7.0.0",
143
143
  "vitest": "^3.2.4"
144
144
  },
145
- "gitHead": "5b93f14e6011e4d81663549078127e4b927c5f12"
145
+ "gitHead": "922e4725da8965f66033b82f9ba28d1d691f9cc5"
146
146
  }