@cocalc/project
Version:
CoCalc: project daemon
32 lines (29 loc) • 1.28 kB
JavaScript
;
/*
EXAMPLE:
~$ curl -u `cat .smc/secret_token`: -d path=a.md http://localhost:`cat .smc/api-server.port`/api/v1/get-syncdoc-history -d patches | python -m json.tool
If you get an error about no hubs connected, then edit a file in the project
in a browser to cause a connection to happen. Also, a.md need to be a file that
you have edited.
*/
Object.defineProperty(exports, "__esModule", { value: true });
const misc_1 = require("@cocalc/util/misc");
const db_schema_1 = require("@cocalc/util/db-schema");
const server_1 = require("./server");
async function getSyncdocHistory({ path, patches, }) {
const dbg = server_1.client.dbg("get-syncdoc-history");
dbg(`path="${path}"`);
if (typeof path != "string") {
throw Error("provide the path as a string");
}
// transform jupyter path -- TODO: this should
// be more centralized... since this is brittle.
if (path.endsWith(".ipynb")) {
path = (0, misc_1.meta_file)(path, "jupyter2");
}
// compute the string_id
const string_id = db_schema_1.client_db.sha1(server_1.client.project_id, path);
return await server_1.client.get_syncdoc_history(string_id, !!patches);
}
exports.default = getSyncdocHistory;
//# sourceMappingURL=get-syncdoc-history.js.map