(core) updates from grist-core

This commit is contained in:
Paul Fitzpatrick
2024-10-01 11:54:40 -04:00
19 changed files with 116 additions and 250 deletions

View File

@@ -192,12 +192,6 @@ export class MergedServer {
this.flexServer.checkOptionCombinations();
this.flexServer.summary();
this.flexServer.ready();
// Some tests have their timing perturbed by having this earlier
// TODO: update those tests.
if (this.hasComponent("docs")) {
await this.flexServer.checkSandbox();
}
} catch(e) {
await this.flexServer.close();
throw e;

View File

@@ -265,7 +265,7 @@ const _sandboxingProbe: Probe = {
id: 'sandboxing',
name: 'Is document sandboxing effective',
apply: async (server, req) => {
const details = server.getSandboxInfo();
const details = await server.getSandboxInfo();
return {
status: (details?.configured && details?.functional) ? 'success' : 'fault',
details,

View File

@@ -1397,8 +1397,9 @@ export class FlexServer implements GristServer {
}
}
public async checkSandbox() {
if (this._check('sandbox', 'doc')) { return; }
public async getSandboxInfo(): Promise<SandboxInfo> {
if (this._sandboxInfo) { return this._sandboxInfo; }
const flavor = process.env.GRIST_SANDBOX_FLAVOR || 'unknown';
const info = this._sandboxInfo = {
flavor,
@@ -1408,6 +1409,8 @@ export class FlexServer implements GristServer {
sandboxed: false,
lastSuccessfulStep: 'none',
} as SandboxInfo;
// Only meaningful on instances that handle documents.
if (!this._docManager) { return info; }
try {
const sandbox = createSandbox({
server: this,
@@ -1432,10 +1435,7 @@ export class FlexServer implements GristServer {
} catch (e) {
info.error = String(e);
}
}
public getSandboxInfo(): SandboxInfo|undefined {
return this._sandboxInfo;
return info;
}
public getInfo(key: string): any {

View File

@@ -70,7 +70,7 @@ export interface GristServer {
servesPlugins(): boolean;
getBundledWidgets(): ICustomWidget[];
getBootKey(): string|undefined;
getSandboxInfo(): SandboxInfo|undefined;
getSandboxInfo(): Promise<SandboxInfo>;
getInfo(key: string): any;
getJobs(): GristJobs;
}
@@ -165,7 +165,7 @@ export function createDummyGristServer(): GristServer {
getPlugins() { return []; },
getBundledWidgets() { return []; },
getBootKey() { return undefined; },
getSandboxInfo() { return undefined; },
getSandboxInfo() { throw new Error('no sandbox'); },
getInfo(key: string) { return undefined; },
getJobs(): GristJobs { throw new Error('no job system'); },
};