rivet-gg / opengb Goto Github PK
View Code? Open in Web Editor NEWOpen Game Backend: Open-source modular backend for all games and tools.
Home Page: https://opengb.dev
License: Apache License 2.0
Open Game Backend: Open-source modular backend for all games and tools.
Home Page: https://opengb.dev
License: Apache License 2.0
When running a Prisma command from Deno, it fails to exit cleanly with this warning:
Warning: Not implemented: ChildProcess.prototype.disconnect
The user has to manually press enter for this to continue.
One workaround is to go back to using npx
instead of deno
, but this requires developers to install Node in addition to Deno.
Make sure the database backend is pluggable between:
Need to figure out how (and if) this works with OpenAPI
Need to figure out the easiest x-platform solution
Can we support multiple protocols?
Prior art:
This will read the types from the parameters on the run config on the fly
Make sure to validate UUIDs
removes ajv
ctx.modules.<module_name>.<script_name>({})
should be type safe, awaitable, and not be overloaded by typescript resolve times
Needs deno.json & .gitignore
Our fork of the esbuild-plugin-polyfill-node
package is not available on NPM, so we have to run it as an NPM package.
Deno does not support Git NPM specifiers yet: denoland/deno#15960
Workaround #1: use esbuild-plugin-polyfill-node
to package itself for use in Deno.
Workaround #2: Use https://esm.sh/ to build & serve the module. Could not figure this out the first go, though.
We currently export prisma
(which holds the types) and Prisma
(which holds the utility functions).
To reference a type, you need to use primsa.Prisma.XXXXGetPayload
while to use a utility function, you need to use Prisma.xxxx
.
Ideally it's just Prisma
for both types and utils
Automatically update the deno.json to specify the OGS runtime path
Run a test with deno test --trace-ops
and disable sanitizeOps
in Runtime.test
to see the issue:
at op_sleep (ext:core/00_infra.js:265:13)
at runAfterTimeout (ext:deno_web/02_timers.js:234:20)
at initializeTimer (ext:deno_web/02_timers.js:192:3)
at setTimeout (ext:deno_web/02_timers.js:336:10)
at pm (file:///Users/nathan/rivet/ogs/dist/prisma/friends/esm.js:7264:14)
at <anonymous> (wasm://wasm/00952342:1:2131297)
at <anonymous> (wasm://wasm/00952342:1:2153871)
at am (file:///Users/nathan/rivet/ogs/dist/prisma/friends/esm.js:7183:9)
at n (file:///Users/nathan/rivet/ogs/dist/prisma/friends/esm.js:7252:20)
at new Promise (<anonymous>)
Sanitize ops is disabled until this can be fixed.
Required for hosting API endpoints.
The default module calling API is meant to be an easy way to call modules that covers use cases where you control the code that calls the server, not as a complete HTTP req/res interface.
The module.yaml
would look something like this:
scripts:
apiEndpoint:
api:
methods: [GET]
pathRegexp: /api/my-module/webhook
The code would look something like this:
import { HttpRequest, HttpResponse } from "@ogs/runtime"
export interface Request extends HttpRequest {}
export interface Response extends HttpResponse {}
export function handler(ctx, req) {
let body = JSON.parse(req.body);
return { body: `hello ${body.foo}`, headers: { "content-type": "application/json" } };
}
Encourage using $queryRaw if needed
Maybe we can use a shared runtime/library.js to save space?
Make only dependencies
available if they're listed in the module's yaml
As of #63 CORS defaults to *
If a module calls other modules, list which dependencies it calls in the module.yaml
.
Developers will only be able to call the explicit dependencies from ModuleContext
(and its subclasses).
This is intended to just be a name, not a reference to a specific registry + module like NPM.
Eventually: dependencies will be able to be remapped (i.e. if I have a fork of the "users" module).
This PR includes dependencies on @ogs/helpers/registry.d.ts
in the engine itself. This file is generated and cannot be referenced from within the engine. The Registry
generic must be passed to the types that use it directly instead of importing it from within the engine.
We serve multiple Prisma instances, but they share the same library and WASM. Explore making them all import the same runtime to safe both (a) binary size and (b) memory usage.
This will require some finessing of the imports.
This may become essential if we get close to going over the 10 MB limit for Cloudflare Workers.
Example: ctx.users.get({ โฆ })
This should only make the listed dependencies
available in the given context. If using a context that's not ModuleContext
, then all modules are available. Should be easy to do using a Partial
.
Any module names that conflict with the core types (e.g. db
) will be renamed with an underscore. e.g. calling the db
module looks like ctx._db.doSomething({})
This needs to have a type-safe req/res format. This will require generating types in the runtime_config.ts
file.
This will include:
Don't tackle Drizzle just yet, keep Deno Postgres ORM
Leave types as JSON schema + Ajv validation
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.