kubo-rpc-client-esm-cjs
Version:
A client library for the Kubo RPC API
34 lines • 1.67 kB
JavaScript
;
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.createApply = void 0;
const configure_js_1 = require("../../lib/configure.js");
const to_url_search_params_js_1 = require("../../lib/to-url-search-params.js");
exports.createApply = (0, configure_js_1.configure)(api => {
/**
* @type {import('../../types').ConfigProfilesAPI["apply"]}
*/
function apply(profile, options = {}) {
return __awaiter(this, void 0, void 0, function* () {
const res = yield api.post('config/profile/apply', {
signal: options.signal,
searchParams: (0, to_url_search_params_js_1.toUrlSearchParams)(Object.assign({ arg: profile }, options)),
headers: options.headers
});
const data = yield res.json();
return {
original: data.OldCfg, updated: data.NewCfg
};
});
}
return apply;
});
//# sourceMappingURL=apply.js.map