gristlabs_grist-core/stubs/app/server/lib/create.ts
Paul Fitzpatrick 71519d9e5c (core) revamp snapshot inventory
Summary:
Deliberate changes:
 * save snapshots to s3 prior to migrations.
 * label migration snapshots in s3 metadata.
 * avoid pruning migration snapshots for a month.

Opportunistic changes:
 * Associate document timezone with snapshots, so pruning can respect timezones.
 * Associate actionHash/Num with snapshots.
 * Record time of last change in snapshots (rather than just s3 upload time, which could be a while later).

This ended up being a biggish change, because there was nowhere ideal to put tags (list of possibilities in diff).

Test Plan: added tests

Reviewers: dsagal

Reviewed By: dsagal

Differential Revision: https://phab.getgrist.com/D2646
2020-10-30 13:52:46 -04:00

49 lines
1.6 KiB
TypeScript

import { HomeDBManager } from 'app/gen-server/lib/HomeDBManager';
import { ActiveDoc } from 'app/server/lib/ActiveDoc';
import { DocManager } from 'app/server/lib/DocManager';
import { ICreate } from 'app/server/lib/ICreate';
import { LoginSession } from 'app/server/lib/LoginSession';
import { NSandboxCreator } from 'app/server/lib/NSandbox';
// Use raw python - update when pynbox or other solution is set up for core.
const sandboxCreator = new NSandboxCreator('unsandboxed');
export const create: ICreate = {
LoginSession() {
return new LoginSession();
},
Billing(dbManager: HomeDBManager) {
return {
addEndpoints(app: any) { /* do nothing */ },
addEventHandlers() { /* do nothing */ },
addWebhooks(app: any) { /* do nothing */ }
};
},
Notifier() {
return {
get testPending() { return false; }
};
},
Shell() {
return {
moveItemToTrash() { throw new Error('moveToTrash unavailable'); },
showItemInFolder() { throw new Error('showItemInFolder unavailable'); }
};
},
ExternalStorage() { return undefined; },
ActiveDoc(docManager, docName) { return new ActiveDoc(docManager, docName); },
DocManager(storageManager, pluginManager, homeDBManager, gristServer) {
return new DocManager(storageManager, pluginManager, homeDBManager, gristServer);
},
NSandbox(options) {
return sandboxCreator.create(options);
},
sessionSecret() {
return process.env.GRIST_SESSION_SECRET ||
'Phoo2ag1jaiz6Moo2Iese2xoaphahbai3oNg7diemohlah0ohtae9iengafieS2Hae7quungoCi9iaPh';
},
configurationOptions() {
return {};
}
};