@apillon/cli
Version:
▶◀ Apillon CLI tools ▶◀
62 lines • 2.44 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.deleteIpns = exports.publishIpns = exports.getIpns = exports.createIpns = exports.listIpnsNames = void 0;
const sdk_1 = require("@apillon/sdk");
const options_1 = require("../../lib/options");
const utils_1 = require("../../lib/utils");
async function listIpnsNames(optsWithGlobals) {
await (0, utils_1.withErrorHandler)(async () => {
const data = await new sdk_1.Storage(optsWithGlobals)
.bucket(optsWithGlobals.bucketUuid)
.listIpnsNames((0, options_1.paginate)(optsWithGlobals));
data.items = data.items.map((w) => w.serialize());
console.log(data);
});
}
exports.listIpnsNames = listIpnsNames;
async function createIpns(optsWithGlobals) {
await (0, utils_1.withErrorHandler)(async () => {
const ipns = await new sdk_1.Storage(optsWithGlobals)
.bucket(optsWithGlobals.bucketUuid)
.createIpns({
name: optsWithGlobals.name,
description: optsWithGlobals.description,
cid: optsWithGlobals.cid,
});
console.log('IPNS record created successfully');
console.log(ipns.serialize());
});
}
exports.createIpns = createIpns;
async function getIpns(optsWithGlobals) {
await (0, utils_1.withErrorHandler)(async () => {
const ipns = await new sdk_1.Storage(optsWithGlobals)
.bucket(optsWithGlobals.bucketUuid)
.ipns(optsWithGlobals.ipnsUuid)
.get();
console.log(ipns.serialize());
});
}
exports.getIpns = getIpns;
async function publishIpns(optsWithGlobals) {
await (0, utils_1.withErrorHandler)(async () => {
const ipns = await new sdk_1.Storage(optsWithGlobals)
.bucket(optsWithGlobals.bucketUuid)
.ipns(optsWithGlobals.ipnsUuid)
.publish(optsWithGlobals.cid);
console.log('IPNS published successfully');
console.log(ipns.serialize());
});
}
exports.publishIpns = publishIpns;
async function deleteIpns(optsWithGlobals) {
await (0, utils_1.withErrorHandler)(async () => {
await new sdk_1.Storage(optsWithGlobals)
.bucket(optsWithGlobals.bucketUuid)
.ipns(optsWithGlobals.ipnsUuid)
.delete();
console.log('IPNS record deleted successfully');
});
}
exports.deleteIpns = deleteIpns;
//# sourceMappingURL=ipns.service.js.map