Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support other SQLite wrappers, and various hooks needed by grist-static #516

Merged
merged 4 commits into from
May 23, 2023

Conversation

paulfitz
Copy link
Member

@paulfitz paulfitz commented May 12, 2023

grist-static currently uses a hacky patched version of grist-core. In this PR, I'm working on cleaning up the changes, and consolidating them in general-purpose hooks.

  • Introduces new front-end hooks to:
    • add attributes to iframes (credentialless is useful in some situations)
    • allow intercepting API calls (handy when there is no back end)
    • allow overriding the base URI for grist-related assets (handy when not in full control of the page HTML)
  • Introduces new back-end hooks to:
    • add alternate sandbox variants (grist-static uses pyodide in the browser, in a particular way)
    • allows sandbox variants where the communication pipe is in-process via callbacks rather than a discrete process (grist-static uses this to communicate with a web worker)
    • add alternate SQLite wrappers (grist-static uses sqlite.js)
  • Supports overriding the webpack configuration (grist-static goes very much its own way there, but still benefits from the rest of the build system)
  • Adds a small script for bundling the Grist data engine python code as a wheel (simplifies using it from pyodide in the browser)
  • Makes Grist a little more forgiving in a few ways:
    • allows "View As" feature to operate without a home database
    • tolerates lack of implementation of a realpath function or setImmediate function
  • Adds some type annotations to make TypeORM happy in a slightly different build

@paulfitz paulfitz marked this pull request as ready for review May 15, 2023 18:28
@georgegevoian georgegevoian self-requested a review May 15, 2023 21:58
buildtools/build.sh Outdated Show resolved Hide resolved
// dbstat compiled in. But it would be sad to disable
// Grist entirely just because we can't track byte-count.
// So return NaN in this case.
return {totalSize: NaN};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At some point in the future, should we return something like null instead? I realize doing it now will introduce a bunch of type errors (and the doc usage UI would need to be updated too) - just wondering.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that would be nice. But it could also be easy to make a SQLite build with dbstat enabled.

if (sandboxProcess.dataFromSandboxDescriptor) {
this._streamFromSandbox =
(this.childProc.stdio as Stream[])[sandboxProcess.dataFromSandboxDescriptor];
if (this.childProc) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any easy changes we can make here to simplify things? (e.g. splitting up into methods, lowering conditional depth)

Ok if not - just flagging because it was a bit of a struggle to read.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I broke the constructor up somewhat.

app/server/lib/SQLiteDB.ts Show resolved Hide resolved
app/server/lib/SqliteCommon.ts Show resolved Hide resolved
Copy link
Contributor

@georgegevoian georgegevoian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @paulfitz!

@paulfitz paulfitz merged commit 7be0ee2 into gristlabs:main May 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants