Files
dataroom/embed.go
zooqueen 7ef03a2bdd the bundle becomes a module cloud can pin, not a file it copies
cloud carried a hand-vendored byte-copy of goja/bundle.js because this repo is
a TS app with no Go module, so nothing checked what it embedded. The copy had
already drifted: cloud's carried the link deny-list and this one did not.

A std-lib-only embed module — the same shape github.com/hanzoai/sign has — makes
the bundle a dependency cloud requires at a version and records in go.sum, so
the three folds (sign, captable, dataroom) are all pinned the same way and there
is no second copy to drift.

The deny-list the copy was ahead by lands here with it: an address on a link's
deny list is refused even when the allow list would admit it, checked first so
deny cannot be bypassed.
2026-08-14 21:12:45 -07:00

29 lines
1.2 KiB
Go

// Package dataroom embeds the Hanzo Dataroom goja bundle so the unified
// hanzoai/cloud binary can serve /v1/dataroom/* in-process via the dop251/goja
// engine, without a Next.js runtime or Prisma/Postgres (HIP-0106, task #101).
//
// The TypeScript/Next.js app remains the primary artifact and reference for the
// domain. This Go file is a read-only embed:
//
// - Bundle() returns goja/bundle.js — the self-contained, ESM-free port of the
// dataroom surface (documents, data rooms, shareable links with access
// controls, viewers, per-page view analytics) exposing globalThis.handle(req).
//
// The bundle carries LOGIC only. Its host capabilities — a per-tenant
// Base/SQLite store (globalThis.__db), the bcrypt primitive link passwords are
// hashed with (globalThis.__bcrypt), and the object storage the document bytes
// live in — are injected by the Go host in github.com/hanzoai/cloud/apps/dataroom.
// See goja/README.md for the contract.
package dataroom
import "embed"
//go:embed goja/bundle.js
var assets embed.FS
// Bundle returns the goja bundle source (goja/bundle.js). The host compiles this
// once and runs it on each pooled goja runtime.
func Bundle() ([]byte, error) {
return assets.ReadFile("goja/bundle.js")
}