plan

package
v1.786.92 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 4, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package plansvc mounts the @hanzo/plans catalog into the unified cloud binary under /v1/plans/*, per HIP-0106.

STRATEGY: wrap, don't rewrite. @hanzo/plans is a Node data package (JSON catalog + entitlements.mjs transforms). We do NOT reimplement the entitlement vocabulary in Go and we do NOT copy the catalog into cloud. Instead:

  • github.com/hanzoai/plans (the service repo's Go embed module) ships goja/bundle.js — the ESM-free port of entitlements.mjs + the /v1/plans route table — plus the embedded *.json catalog (plans.Data()).
  • This wrapper loads that bundle into a goja runtime (clients/gojahost), injects the catalog as globalThis.__PLANS_DATA__, and registers thin zip handlers that call globalThis.handle({route, params, tenant}). The entitlement transforms (fromLegacy/toLicenseFeatures/resolvePlan) run in goja — real JS, not a Go reimplementation.

The plans data is read-only public-catalog content; there are no secrets here. The licensing SIGNER/fingerprint that consumes toLicenseFeatures stays in hanzoai/licensing. This wrapper is pure glue.

IAM gating + X-Org-Id tenant scope: every /v1/plans route reads the gateway-minted identity off the zip.Ctx (c.Org()) and threads it into the bundle as the tenant, so a reseller org (tenant_id != "hanzo") sees its own catalog overrides. The plan catalog is readable by any authenticated caller; no admin scope is required for reads.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Mount

func Mount(app *zip.App, deps cloud.Deps) error

Mount registers the /v1/plans/* surface on app per HIP-0106.

func Shutdown

func Shutdown(context.Context) error

Shutdown drops the goja host. Idempotent.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL