Fix StartOS 0.4 TypeScript packaging to match SDK API
This commit is contained in:
+38
@@ -0,0 +1,38 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.setupBackups = setupBackups;
|
||||
const Backups_1 = require("./Backups");
|
||||
/**
|
||||
* Set up backup and restore exports for the service.
|
||||
*
|
||||
* Returns `{ createBackup, restoreInit }` which should be exported and wired into
|
||||
* the service's init and backup entry points.
|
||||
*
|
||||
* @param options - Either an array of volume IDs or an async factory returning a Backups instance
|
||||
* @returns An object with `createBackup` (the backup export) and `restoreInit` (an InitScript for restore)
|
||||
*/
|
||||
function setupBackups(options) {
|
||||
let backupsFactory;
|
||||
if (options instanceof Function) {
|
||||
backupsFactory = options;
|
||||
}
|
||||
else {
|
||||
backupsFactory = async () => Backups_1.Backups.ofVolumes(...options);
|
||||
}
|
||||
const answer = {
|
||||
get createBackup() {
|
||||
return (async (options) => {
|
||||
return (await backupsFactory(options)).createBackup(options.effects);
|
||||
});
|
||||
},
|
||||
get restoreInit() {
|
||||
return {
|
||||
init: async (effects, kind) => {
|
||||
return (await backupsFactory({ effects })).init(effects, kind);
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
return answer;
|
||||
}
|
||||
//# sourceMappingURL=setupBackups.js.map
|
||||
Reference in New Issue
Block a user