@ipab/cli 0.0.0-stage → 0.1.0-rc.0
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.
- package/LICENSE +21 -0
- package/README.md +19 -2
- package/dist/app-authoring.d.ts +23 -0
- package/dist/app-authoring.d.ts.map +1 -0
- package/dist/app-authoring.js +449 -0
- package/dist/app-authoring.js.map +1 -0
- package/dist/app-definition.d.ts +109 -0
- package/dist/app-definition.d.ts.map +1 -0
- package/dist/app-definition.js +207 -0
- package/dist/app-definition.js.map +1 -0
- package/dist/app-prebuild.d.ts +12 -0
- package/dist/app-prebuild.d.ts.map +1 -0
- package/dist/app-prebuild.js +231 -0
- package/dist/app-prebuild.js.map +1 -0
- package/dist/app-templates.d.ts +13 -0
- package/dist/app-templates.d.ts.map +1 -0
- package/dist/app-templates.js +287 -0
- package/dist/app-templates.js.map +1 -0
- package/dist/authoring.d.ts +72 -0
- package/dist/authoring.d.ts.map +1 -0
- package/dist/authoring.js +440 -0
- package/dist/authoring.js.map +1 -0
- package/dist/builtins/template.node.car +0 -0
- package/dist/builtins/template.web-app.car +0 -0
- package/dist/builtins.d.ts +6 -0
- package/dist/builtins.d.ts.map +1 -0
- package/dist/builtins.js +46 -0
- package/dist/builtins.js.map +1 -0
- package/dist/child.d.ts +5 -0
- package/dist/child.d.ts.map +1 -0
- package/dist/child.js +28 -0
- package/dist/child.js.map +1 -0
- package/dist/cli.d.ts +24 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +1072 -0
- package/dist/cli.js.map +1 -0
- package/dist/config.d.ts +26 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +156 -0
- package/dist/config.js.map +1 -0
- package/dist/context.d.ts +42 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +164 -0
- package/dist/context.js.map +1 -0
- package/dist/errors.d.ts +10 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +40 -0
- package/dist/errors.js.map +1 -0
- package/dist/history.d.ts +34 -0
- package/dist/history.d.ts.map +1 -0
- package/dist/history.js +286 -0
- package/dist/history.js.map +1 -0
- package/dist/ipc.d.ts +26 -0
- package/dist/ipc.d.ts.map +1 -0
- package/dist/ipc.js +332 -0
- package/dist/ipc.js.map +1 -0
- package/dist/logs.d.ts +15 -0
- package/dist/logs.d.ts.map +1 -0
- package/dist/logs.js +118 -0
- package/dist/logs.js.map +1 -0
- package/dist/main.d.ts +3 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +4 -0
- package/dist/main.js.map +1 -0
- package/dist/pins.d.ts +33 -0
- package/dist/pins.d.ts.map +1 -0
- package/dist/pins.js +183 -0
- package/dist/pins.js.map +1 -0
- package/dist/runtime.d.ts +20 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +237 -0
- package/dist/runtime.js.map +1 -0
- package/dist/source-bundle.d.ts +16 -0
- package/dist/source-bundle.d.ts.map +1 -0
- package/dist/source-bundle.js +103 -0
- package/dist/source-bundle.js.map +1 -0
- package/dist/space.d.ts +33 -0
- package/dist/space.d.ts.map +1 -0
- package/dist/space.js +269 -0
- package/dist/space.js.map +1 -0
- package/dist/state.d.ts +92 -0
- package/dist/state.d.ts.map +1 -0
- package/dist/state.js +324 -0
- package/dist/state.js.map +1 -0
- package/dist/supported-schemas.d.ts +5 -0
- package/dist/supported-schemas.d.ts.map +1 -0
- package/dist/supported-schemas.js +90 -0
- package/dist/supported-schemas.js.map +1 -0
- package/dist/template-definition.d.ts +115 -0
- package/dist/template-definition.d.ts.map +1 -0
- package/dist/template-definition.js +188 -0
- package/dist/template-definition.js.map +1 -0
- package/dist/template-source.d.ts +12 -0
- package/dist/template-source.d.ts.map +1 -0
- package/dist/template-source.js +97 -0
- package/dist/template-source.js.map +1 -0
- package/package.json +67 -3
- package/src/app-authoring.ts +614 -0
- package/src/app-definition.ts +256 -0
- package/src/app-prebuild.ts +289 -0
- package/src/app-templates.ts +382 -0
- package/src/authoring.ts +610 -0
- package/src/builtins.ts +55 -0
- package/src/child.ts +32 -0
- package/src/cli.ts +1285 -0
- package/src/config.ts +220 -0
- package/src/context.ts +232 -0
- package/src/errors.ts +46 -0
- package/src/history.ts +391 -0
- package/src/ipc.ts +358 -0
- package/src/logs.ts +132 -0
- package/src/main.ts +4 -0
- package/src/pins.ts +214 -0
- package/src/runtime.ts +300 -0
- package/src/source-bundle.ts +136 -0
- package/src/space.ts +379 -0
- package/src/state.ts +416 -0
- package/src/supported-schemas.ts +151 -0
- package/src/template-definition.ts +242 -0
- package/src/template-source.ts +128 -0
package/src/space.ts
ADDED
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
import { importer } from "ipfs-unixfs-importer";
|
|
2
|
+
import { UnixFS } from "ipfs-unixfs";
|
|
3
|
+
import * as dagPb from "@ipld/dag-pb";
|
|
4
|
+
import { CID } from "multiformats/cid";
|
|
5
|
+
import { sha256 } from "multiformats/hashes/sha2";
|
|
6
|
+
import type { IpfsStore } from "@ipab/ipfs-store";
|
|
7
|
+
import { openBundle, type ContentBundle } from "@ipab/bundle";
|
|
8
|
+
import { HostError, message } from "./errors.js";
|
|
9
|
+
import type { Ownership } from "./history.js";
|
|
10
|
+
import { appDescription, appSchemaCid } from "./app-definition.js";
|
|
11
|
+
import { readSupportedSchemas } from "./supported-schemas.js";
|
|
12
|
+
export { appSchema, appSchemaCid } from "./app-definition.js";
|
|
13
|
+
export const CHUNK_BYTES = 64 * 1024;
|
|
14
|
+
export const OUTPUT_BYTES = 64 * 1024 * 1024;
|
|
15
|
+
export const MAX_PATHS = 4096;
|
|
16
|
+
|
|
17
|
+
export function relativePath(path: string): string {
|
|
18
|
+
if (
|
|
19
|
+
path.length > 1024 ||
|
|
20
|
+
!path ||
|
|
21
|
+
path.includes("\\") ||
|
|
22
|
+
path.includes("%") ||
|
|
23
|
+
[...path].some(
|
|
24
|
+
(char) =>
|
|
25
|
+
char.charCodeAt(0) < 32 ||
|
|
26
|
+
char.charCodeAt(0) === 127 ||
|
|
27
|
+
':*?"<>|'.includes(char),
|
|
28
|
+
) ||
|
|
29
|
+
path
|
|
30
|
+
.split("/")
|
|
31
|
+
.some(
|
|
32
|
+
(part) => !part || part === "." || part === ".." || /[. ]$/.test(part),
|
|
33
|
+
)
|
|
34
|
+
)
|
|
35
|
+
throw new HostError(
|
|
36
|
+
"Unsafe Space path; use an unambiguous directory-relative / path.",
|
|
37
|
+
1,
|
|
38
|
+
"PATH_INVALID",
|
|
39
|
+
"execution",
|
|
40
|
+
);
|
|
41
|
+
return path;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export async function bytes(
|
|
45
|
+
stream: ReadableStream<Uint8Array>,
|
|
46
|
+
limit: number,
|
|
47
|
+
): Promise<Uint8Array> {
|
|
48
|
+
const reader = stream.getReader();
|
|
49
|
+
const parts: Uint8Array[] = [];
|
|
50
|
+
let size = 0;
|
|
51
|
+
try {
|
|
52
|
+
for (;;) {
|
|
53
|
+
const item = await reader.read();
|
|
54
|
+
if (item.done) break;
|
|
55
|
+
size += item.value.byteLength;
|
|
56
|
+
if (size > limit)
|
|
57
|
+
throw new HostError(
|
|
58
|
+
"Resource exceeds its byte limit.",
|
|
59
|
+
1,
|
|
60
|
+
"LIMIT_EXCEEDED",
|
|
61
|
+
"validation",
|
|
62
|
+
);
|
|
63
|
+
parts.push(item.value);
|
|
64
|
+
}
|
|
65
|
+
} catch (error) {
|
|
66
|
+
await reader.cancel(error);
|
|
67
|
+
throw error;
|
|
68
|
+
} finally {
|
|
69
|
+
reader.releaseLock();
|
|
70
|
+
}
|
|
71
|
+
const result = new Uint8Array(size);
|
|
72
|
+
let offset = 0;
|
|
73
|
+
for (const part of parts) {
|
|
74
|
+
result.set(part, offset);
|
|
75
|
+
offset += part.length;
|
|
76
|
+
}
|
|
77
|
+
return result;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export async function validatedBundle(
|
|
81
|
+
root: string,
|
|
82
|
+
store: IpfsStore,
|
|
83
|
+
owner: Ownership,
|
|
84
|
+
signal?: AbortSignal,
|
|
85
|
+
): Promise<ContentBundle> {
|
|
86
|
+
await owner.retain([root], signal);
|
|
87
|
+
return openBundle(CID.parse(root), {
|
|
88
|
+
...(signal ? { signal } : {}),
|
|
89
|
+
resolveCid: async (cid, options) => {
|
|
90
|
+
await owner.retain([cid.toV1().toString()], options.signal);
|
|
91
|
+
return store.block.get(cid.toString(), options);
|
|
92
|
+
},
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export async function loadApp(
|
|
97
|
+
root: string,
|
|
98
|
+
store: IpfsStore,
|
|
99
|
+
owner: Ownership,
|
|
100
|
+
signal?: AbortSignal,
|
|
101
|
+
): Promise<{
|
|
102
|
+
path: string;
|
|
103
|
+
source: Uint8Array;
|
|
104
|
+
supportedSchemas: ReadonlySet<string>;
|
|
105
|
+
}> {
|
|
106
|
+
const bundle = await validatedBundle(root, store, owner, signal);
|
|
107
|
+
if (
|
|
108
|
+
bundle.schemaKey !== appSchemaCid.toString() ||
|
|
109
|
+
bundle.manifest.entry.contentType !== "application/json"
|
|
110
|
+
)
|
|
111
|
+
throw new HostError(
|
|
112
|
+
"App must use the documented exact builtin Node App type CID.",
|
|
113
|
+
1,
|
|
114
|
+
"APP_PROFILE_INVALID",
|
|
115
|
+
"validation",
|
|
116
|
+
);
|
|
117
|
+
const description = appDescription(
|
|
118
|
+
JSON.parse(
|
|
119
|
+
new TextDecoder("utf-8", { fatal: true }).decode(
|
|
120
|
+
await bytes(
|
|
121
|
+
await bundle.readFile(bundle.manifest.entry.path),
|
|
122
|
+
64 * 1024,
|
|
123
|
+
),
|
|
124
|
+
),
|
|
125
|
+
) as unknown,
|
|
126
|
+
);
|
|
127
|
+
if (description.icon !== undefined) {
|
|
128
|
+
const icon = relativePath(description.icon);
|
|
129
|
+
if (!icon.startsWith("resources/"))
|
|
130
|
+
throw new HostError(
|
|
131
|
+
"App icon must be a Bundle-root-relative resources/ file.",
|
|
132
|
+
);
|
|
133
|
+
const stream = await bundle.readFile(icon);
|
|
134
|
+
await stream.cancel();
|
|
135
|
+
}
|
|
136
|
+
const path = relativePath(description.entry);
|
|
137
|
+
if (!path.startsWith("resources/") || !path.endsWith(".cjs"))
|
|
138
|
+
throw new HostError(
|
|
139
|
+
"Node App entry must be a resources/*.cjs file.",
|
|
140
|
+
1,
|
|
141
|
+
"APP_PROFILE_INVALID",
|
|
142
|
+
"validation",
|
|
143
|
+
);
|
|
144
|
+
let supportedSchemas: ReadonlySet<string> = new Set();
|
|
145
|
+
if (description.supportedSchemas !== undefined) {
|
|
146
|
+
const schemasPath = relativePath(description.supportedSchemas);
|
|
147
|
+
if (!schemasPath.startsWith("resources/") || schemasPath === path)
|
|
148
|
+
throw new HostError(
|
|
149
|
+
"App supportedSchemas must be a distinct Bundle-root-relative resources/ regular file.",
|
|
150
|
+
);
|
|
151
|
+
supportedSchemas = await readSupportedSchemas(
|
|
152
|
+
await bundle.readFile(schemasPath),
|
|
153
|
+
signal,
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
return {
|
|
157
|
+
path,
|
|
158
|
+
supportedSchemas,
|
|
159
|
+
source: await bytes(await bundle.readFile(path), 8 * 1024 * 1024),
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
interface Entry {
|
|
164
|
+
cid: CID;
|
|
165
|
+
size: bigint;
|
|
166
|
+
}
|
|
167
|
+
interface Directory {
|
|
168
|
+
entries: Map<string, Entry | Directory>;
|
|
169
|
+
}
|
|
170
|
+
function isDirectory(entry: Entry | Directory): entry is Directory {
|
|
171
|
+
return "entries" in entry;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export class OutputSpace {
|
|
175
|
+
readonly session: string;
|
|
176
|
+
private readonly entries = new Map<string, Entry>();
|
|
177
|
+
private readonly claimed = new Set<string>();
|
|
178
|
+
private readonly pending = new Set<string>();
|
|
179
|
+
private totalBytes = 0;
|
|
180
|
+
private fault: Error | undefined;
|
|
181
|
+
constructor(
|
|
182
|
+
readonly store: IpfsStore,
|
|
183
|
+
readonly owner: Ownership,
|
|
184
|
+
session: string,
|
|
185
|
+
readonly signal?: AbortSignal,
|
|
186
|
+
) {
|
|
187
|
+
this.session = session;
|
|
188
|
+
}
|
|
189
|
+
private claim(path: string): void {
|
|
190
|
+
relativePath(path);
|
|
191
|
+
if (this.claimed.size >= MAX_PATHS)
|
|
192
|
+
throw new HostError("Output path limit exceeded.");
|
|
193
|
+
for (const previous of this.claimed) {
|
|
194
|
+
if (
|
|
195
|
+
previous === path ||
|
|
196
|
+
previous.startsWith(`${path}/`) ||
|
|
197
|
+
path.startsWith(`${previous}/`)
|
|
198
|
+
)
|
|
199
|
+
throw new HostError("Output paths must be unique and cannot overlap.");
|
|
200
|
+
}
|
|
201
|
+
this.claimed.add(path);
|
|
202
|
+
this.pending.add(path);
|
|
203
|
+
}
|
|
204
|
+
fail(error: unknown): void {
|
|
205
|
+
this.fault ??= new HostError(message(error));
|
|
206
|
+
}
|
|
207
|
+
async write(
|
|
208
|
+
path: string,
|
|
209
|
+
content: AsyncIterable<Uint8Array>,
|
|
210
|
+
signal?: AbortSignal,
|
|
211
|
+
): Promise<string> {
|
|
212
|
+
signal = this.signal
|
|
213
|
+
? AbortSignal.any([this.signal, ...(signal ? [signal] : [])])
|
|
214
|
+
: signal;
|
|
215
|
+
try {
|
|
216
|
+
this.claim(path);
|
|
217
|
+
const account = (part: Uint8Array) => {
|
|
218
|
+
this.totalBytes += part.length;
|
|
219
|
+
if (this.totalBytes > OUTPUT_BYTES)
|
|
220
|
+
throw new HostError("Output byte limit exceeded.");
|
|
221
|
+
};
|
|
222
|
+
const checked = async function* () {
|
|
223
|
+
for await (const part of content) {
|
|
224
|
+
if (!(part instanceof Uint8Array) || part.length > CHUNK_BYTES)
|
|
225
|
+
throw new HostError(
|
|
226
|
+
"Output chunks must be byte arrays of at most 65536 bytes.",
|
|
227
|
+
);
|
|
228
|
+
account(part);
|
|
229
|
+
yield part;
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
let result: Entry | undefined;
|
|
233
|
+
for await (const item of importer(
|
|
234
|
+
[{ path: "file", content: checked() }],
|
|
235
|
+
{
|
|
236
|
+
put: async (cid, block) => {
|
|
237
|
+
const content =
|
|
238
|
+
block instanceof Uint8Array
|
|
239
|
+
? block
|
|
240
|
+
: await bytes(
|
|
241
|
+
ReadableStream.from(block),
|
|
242
|
+
this.store.limits.blockBytes,
|
|
243
|
+
);
|
|
244
|
+
await this.store.stageBlock(
|
|
245
|
+
this.session,
|
|
246
|
+
cid,
|
|
247
|
+
content,
|
|
248
|
+
signal ? { signal } : {},
|
|
249
|
+
);
|
|
250
|
+
return cid;
|
|
251
|
+
},
|
|
252
|
+
},
|
|
253
|
+
{ cidVersion: 1, rawLeaves: true, wrapWithDirectory: false },
|
|
254
|
+
)) {
|
|
255
|
+
result = { cid: item.cid, size: item.size };
|
|
256
|
+
}
|
|
257
|
+
if (!result) throw new HostError("Output file import produced no root.");
|
|
258
|
+
this.entries.set(path, result);
|
|
259
|
+
this.pending.delete(path);
|
|
260
|
+
return result.cid.toString();
|
|
261
|
+
} catch (error) {
|
|
262
|
+
this.fail(error);
|
|
263
|
+
throw error;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
async link(path: string, root: string, signal?: AbortSignal): Promise<void> {
|
|
267
|
+
signal = this.signal
|
|
268
|
+
? AbortSignal.any([this.signal, ...(signal ? [signal] : [])])
|
|
269
|
+
: signal;
|
|
270
|
+
try {
|
|
271
|
+
signal?.throwIfAborted();
|
|
272
|
+
this.claim(path);
|
|
273
|
+
const cid = CID.parse(root).toV1();
|
|
274
|
+
const options = signal ? { signal } : {};
|
|
275
|
+
await this.store.read(cid, options);
|
|
276
|
+
signal?.throwIfAborted();
|
|
277
|
+
// Validate/protect the entire UnixFS target, not arbitrary DAG-CBOR, before publishing a link.
|
|
278
|
+
await this.owner.retain([cid.toString()], signal);
|
|
279
|
+
signal?.throwIfAborted();
|
|
280
|
+
const seen = new Map<string, bigint>();
|
|
281
|
+
const size = async (cid: CID, depth: number): Promise<bigint> => {
|
|
282
|
+
signal?.throwIfAborted();
|
|
283
|
+
if (
|
|
284
|
+
depth > this.store.limits.depth ||
|
|
285
|
+
seen.size >= this.store.limits.blocks
|
|
286
|
+
)
|
|
287
|
+
throw new HostError("Linked DAG exceeds resource limits.");
|
|
288
|
+
const key = cid.toString();
|
|
289
|
+
const previous = seen.get(key);
|
|
290
|
+
if (previous !== undefined) return previous;
|
|
291
|
+
await this.store.read(cid, options);
|
|
292
|
+
signal?.throwIfAborted();
|
|
293
|
+
const block = await this.store.block.get(key, options);
|
|
294
|
+
signal?.throwIfAborted();
|
|
295
|
+
await this.store.stageBlock(this.session, cid, block, options);
|
|
296
|
+
signal?.throwIfAborted();
|
|
297
|
+
let total = BigInt(block.length);
|
|
298
|
+
if (cid.code === dagPb.code) {
|
|
299
|
+
for (const link of dagPb.decode(block).Links)
|
|
300
|
+
total += await size(link.Hash, depth + 1);
|
|
301
|
+
} else if (cid.code !== 0x55)
|
|
302
|
+
throw new HostError(
|
|
303
|
+
"Linked content must be a UnixFS file or directory.",
|
|
304
|
+
);
|
|
305
|
+
seen.set(key, total);
|
|
306
|
+
return total;
|
|
307
|
+
};
|
|
308
|
+
const total = await size(cid, 0);
|
|
309
|
+
signal?.throwIfAborted();
|
|
310
|
+
this.entries.set(path, { cid, size: total });
|
|
311
|
+
this.pending.delete(path);
|
|
312
|
+
} catch (error) {
|
|
313
|
+
this.fail(error);
|
|
314
|
+
throw error;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
async finalize(): Promise<string> {
|
|
318
|
+
if (this.fault) throw this.fault;
|
|
319
|
+
if (this.pending.size)
|
|
320
|
+
throw new HostError(
|
|
321
|
+
"Output has unfinished stream writes.",
|
|
322
|
+
1,
|
|
323
|
+
"OUTPUT_PENDING",
|
|
324
|
+
"commit",
|
|
325
|
+
);
|
|
326
|
+
const root: Directory = { entries: new Map() };
|
|
327
|
+
for (const [path, entry] of this.entries) {
|
|
328
|
+
const parts = path.split("/");
|
|
329
|
+
let directory = root;
|
|
330
|
+
for (const name of parts.slice(0, -1)) {
|
|
331
|
+
let child = directory.entries.get(name);
|
|
332
|
+
if (!child) {
|
|
333
|
+
child = { entries: new Map() };
|
|
334
|
+
directory.entries.set(name, child);
|
|
335
|
+
}
|
|
336
|
+
if (!isDirectory(child))
|
|
337
|
+
throw new HostError("Output file/directory collision.");
|
|
338
|
+
directory = child;
|
|
339
|
+
}
|
|
340
|
+
directory.entries.set(parts.at(-1)!, entry);
|
|
341
|
+
}
|
|
342
|
+
const build = async (directory: Directory): Promise<Entry> => {
|
|
343
|
+
const links: dagPb.PBLink[] = [];
|
|
344
|
+
let descendants = 0n;
|
|
345
|
+
for (const [name, child] of [...directory.entries].sort(([a], [b]) =>
|
|
346
|
+
a.localeCompare(b),
|
|
347
|
+
)) {
|
|
348
|
+
const entry = isDirectory(child) ? await build(child) : child;
|
|
349
|
+
if (entry.size > BigInt(Number.MAX_SAFE_INTEGER))
|
|
350
|
+
throw new HostError("UnixFS DAG size exceeds safe limits.");
|
|
351
|
+
descendants += entry.size;
|
|
352
|
+
links.push({ Name: name, Hash: entry.cid, Tsize: Number(entry.size) });
|
|
353
|
+
}
|
|
354
|
+
const block = dagPb.encode(
|
|
355
|
+
dagPb.prepare({
|
|
356
|
+
Data: new UnixFS({ type: "directory" }).marshal(),
|
|
357
|
+
Links: links,
|
|
358
|
+
}),
|
|
359
|
+
);
|
|
360
|
+
const cid = CID.createV1(dagPb.code, await sha256.digest(block));
|
|
361
|
+
await this.store.stageBlock(
|
|
362
|
+
this.session,
|
|
363
|
+
cid,
|
|
364
|
+
block,
|
|
365
|
+
this.signal ? { signal: this.signal } : {},
|
|
366
|
+
);
|
|
367
|
+
return { cid, size: descendants + BigInt(block.length) };
|
|
368
|
+
};
|
|
369
|
+
const directory = await build(root);
|
|
370
|
+
await this.store.finishImport(
|
|
371
|
+
this.session,
|
|
372
|
+
directory.cid,
|
|
373
|
+
this.owner.owner,
|
|
374
|
+
this.signal ? { signal: this.signal } : {},
|
|
375
|
+
);
|
|
376
|
+
await this.owner.retain([directory.cid.toString()], this.signal);
|
|
377
|
+
return directory.cid.toString();
|
|
378
|
+
}
|
|
379
|
+
}
|