@rebasepro/cli 0.31.0 → 0.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{agent-setup-DqAcoDcn.js → agent-setup-Cg_zBWoW.js} +3 -3
- package/dist/{agent-setup-DqAcoDcn.js.map → agent-setup-Cg_zBWoW.js.map} +1 -1
- package/dist/api-TbmW33D7.js +275 -0
- package/dist/api-TbmW33D7.js.map +1 -0
- package/dist/{api-keys-eIUjMqWn.js → api-keys-fPQ55DCm.js} +151 -158
- package/dist/api-keys-fPQ55DCm.js.map +1 -0
- package/dist/{apps-DExO4PEl.js → apps-DBTRoOeP.js} +18 -13
- package/dist/apps-DBTRoOeP.js.map +1 -0
- package/dist/{args-CaCcrYE1.js → args-DHyrshtI.js} +3 -132
- package/dist/args-DHyrshtI.js.map +1 -0
- package/dist/{atlas-dev-database-DOCKk6ht.js → atlas-dev-database-D6h65f2x.js} +3 -3
- package/dist/{atlas-dev-database-DOCKk6ht.js.map → atlas-dev-database-D6h65f2x.js.map} +1 -1
- package/dist/{auth-ofQETpM5.js → auth-BpyYLEFY.js} +93 -12
- package/dist/auth-BpyYLEFY.js.map +1 -0
- package/dist/auth-session-B6aT0Dyj.js +371 -0
- package/dist/auth-session-B6aT0Dyj.js.map +1 -0
- package/dist/{backend-guard-C0mVkXBw.js → backend-guard-Cf8eMK_f.js} +2 -2
- package/dist/{backend-guard-C0mVkXBw.js.map → backend-guard-Cf8eMK_f.js.map} +1 -1
- package/dist/{branch-pointer-DMPyvZoK.js → branch-pointer-BJOF2Ubv.js} +1 -1
- package/dist/{build-CA5R07tw.js → build-BfdT-AUR.js} +12 -10
- package/dist/{build-CA5R07tw.js.map → build-BfdT-AUR.js.map} +1 -1
- package/dist/{bundle-DgILeA5b.js → bundle-CIiKGrte.js} +78 -12
- package/dist/bundle-CIiKGrte.js.map +1 -0
- package/dist/bundle.d.ts +31 -1
- package/dist/{cloud-CYMk92iG.js → cloud-MqnyPnmX.js} +1540 -1531
- package/dist/cloud-MqnyPnmX.js.map +1 -0
- package/dist/{cms-directories-BK3vcswg.js → cms-directories-BaV-Is9a.js} +2 -2
- package/dist/{cms-directories-BK3vcswg.js.map → cms-directories-BaV-Is9a.js.map} +1 -1
- package/dist/codemod/collections-to-tables/backend.d.ts +0 -2
- package/dist/codemod/collections-to-tables/customization.d.ts +2 -1
- package/dist/codemod/collections-to-tables/modules.d.ts +32 -0
- package/dist/codemod/collections-to-tables/plan-context.d.ts +7 -1
- package/dist/{command-D5lhW_-B.js → command-D9g46gg9.js} +68 -42
- package/dist/command-D9g46gg9.js.map +1 -0
- package/dist/commands/api-keys.d.ts +89 -52
- package/dist/commands/api.d.ts +114 -0
- package/dist/commands/auth-session.d.ts +94 -0
- package/dist/commands/auth.d.ts +1 -1
- package/dist/commands/cloud/alerts.d.ts +29 -0
- package/dist/commands/cloud/context.d.ts +8 -0
- package/dist/commands/cloud/debug.d.ts +16 -1
- package/dist/commands/cloud/deploy-hooks.d.ts +19 -0
- package/dist/commands/cloud/deploy.d.ts +25 -0
- package/dist/commands/cloud/env.d.ts +1 -0
- package/dist/commands/cloud/index.d.ts +5 -0
- package/dist/commands/cloud/maintenance.d.ts +26 -1
- package/dist/commands/cloud/not-served.d.ts +27 -0
- package/dist/commands/cloud/orgs.d.ts +5 -0
- package/dist/commands/cloud/resources.d.ts +82 -2
- package/dist/commands/cloud/runtime-logs.d.ts +57 -0
- package/dist/commands/cloud/settings.d.ts +3 -0
- package/dist/commands/cron.d.ts +68 -0
- package/dist/commands/data.d.ts +197 -0
- package/dist/commands/functions.d.ts +38 -0
- package/dist/commands/logs.d.ts +22 -0
- package/dist/commands/rls.d.ts +31 -0
- package/dist/commands/schema-reconcile.d.ts +2 -1
- package/dist/commands/schema-show.d.ts +38 -0
- package/dist/commands/storage-objects.d.ts +88 -0
- package/dist/commands/storage.d.ts +18 -2
- package/dist/commands/users.d.ts +147 -0
- package/dist/{consent-BXLIrMl8.js → consent-UV6ObCME.js} +2 -2
- package/dist/{consent-BXLIrMl8.js.map → consent-UV6ObCME.js.map} +1 -1
- package/dist/{console-DjThnr3f.js → console-BVoYOLAO.js} +6 -6
- package/dist/{console-DjThnr3f.js.map → console-BVoYOLAO.js.map} +1 -1
- package/dist/{context--JwaHaZp.js → context-BOMEoKxn.js} +80 -9
- package/dist/{context--JwaHaZp.js.map → context-BOMEoKxn.js.map} +1 -1
- package/dist/cron-CpUsQ739.js +298 -0
- package/dist/cron-CpUsQ739.js.map +1 -0
- package/dist/cron-ZRXsla0v.js +259 -0
- package/dist/cron-ZRXsla0v.js.map +1 -0
- package/dist/{daemon-w30PsdwV.js → daemon-D5gdG7gx.js} +3 -3
- package/dist/{daemon-w30PsdwV.js.map → daemon-D5gdG7gx.js.map} +1 -1
- package/dist/{daemon-entry-zOC1revO.js → daemon-entry--ummUJnk.js} +2 -2
- package/dist/{daemon-entry-zOC1revO.js.map → daemon-entry--ummUJnk.js.map} +1 -1
- package/dist/data-BJ9AZFUC.js +947 -0
- package/dist/data-BJ9AZFUC.js.map +1 -0
- package/dist/{db-Bz2RFGJj.js → db-D_iF4E-v.js} +38 -34
- package/dist/{db-Bz2RFGJj.js.map → db-D_iF4E-v.js.map} +1 -1
- package/dist/debug-nNbbxAeo.js +1114 -0
- package/dist/debug-nNbbxAeo.js.map +1 -0
- package/dist/{derive-C3ezmY-p.js → derive-Mky_u59_.js} +3 -3
- package/dist/{derive-C3ezmY-p.js.map → derive-Mky_u59_.js.map} +1 -1
- package/dist/{dev-D8TxrE_I.js → dev-bj6dEeSQ.js} +13 -13
- package/dist/{dev-D8TxrE_I.js.map → dev-bj6dEeSQ.js.map} +1 -1
- package/dist/dev-db/pull.d.ts +13 -3
- package/dist/{dev-preflight-DjvcV6SK.js → dev-preflight-BMOf2N6r.js} +2 -2
- package/dist/{dev-preflight-DjvcV6SK.js.map → dev-preflight-BMOf2N6r.js.map} +1 -1
- package/dist/{dev-server-BLxCbQEP.js → dev-server-2XHSHM_q.js} +2 -2
- package/dist/{dev-server-BLxCbQEP.js.map → dev-server-2XHSHM_q.js.map} +1 -1
- package/dist/{doctor-Du-mSxoE.js → doctor-2Jlau0Rm.js} +9 -8
- package/dist/{doctor-Du-mSxoE.js.map → doctor-2Jlau0Rm.js.map} +1 -1
- package/dist/{eject-Bhzd6hgb.js → eject-DK_M9kor.js} +4 -4
- package/dist/{eject-Bhzd6hgb.js.map → eject-DK_M9kor.js.map} +1 -1
- package/dist/{fold-static-CKewnAPX.js → fold-static-2t3UUX4z.js} +10 -6
- package/dist/fold-static-2t3UUX4z.js.map +1 -0
- package/dist/fold-static.d.ts +7 -0
- package/dist/functions-B4JR6EZL.js +120 -0
- package/dist/functions-B4JR6EZL.js.map +1 -0
- package/dist/{generate-view-CTOluXvH.js → generate-view-BMaLQm8H.js} +5 -5
- package/dist/{generate-view-CTOluXvH.js.map → generate-view-BMaLQm8H.js.map} +1 -1
- package/dist/{generate_sdk-De-aLC1L.js → generate_sdk-ByD-gTsK.js} +7 -7
- package/dist/{generate_sdk-De-aLC1L.js.map → generate_sdk-ByD-gTsK.js.map} +1 -1
- package/dist/index.es.js +123 -47
- package/dist/index.es.js.map +1 -1
- package/dist/{init-Dtl-IcXf.js → init-DHCe5mJ5.js} +59 -11
- package/dist/init-DHCe5mJ5.js.map +1 -0
- package/dist/{invoked-command-CG_rIa_o.js → invoked-command-FBeIBS8o.js} +2 -2
- package/dist/{invoked-command-CG_rIa_o.js.map → invoked-command-FBeIBS8o.js.map} +1 -1
- package/dist/last-dev-database-CBVkEUEl.js +2 -0
- package/dist/logs-CIgfLBsu.js +192 -0
- package/dist/logs-CIgfLBsu.js.map +1 -0
- package/dist/{manifest-C3uLDrrJ.js → manifest-RjqxfCpb.js} +114 -5
- package/dist/manifest-RjqxfCpb.js.map +1 -0
- package/dist/{migrate-VrKoi3nB.js → migrate-Cx8-Y4TG.js} +5 -4
- package/dist/{migrate-VrKoi3nB.js.map → migrate-Cx8-Y4TG.js.map} +1 -1
- package/dist/{normalize-imports-DwxqEMYq.js → normalize-imports-P86NVfpo.js} +3 -3
- package/dist/{normalize-imports-DwxqEMYq.js.map → normalize-imports-P86NVfpo.js.map} +1 -1
- package/dist/{path-flags-7O5uPBcQ.js → path-flags-ekLdkbra.js} +3 -3
- package/dist/{path-flags-7O5uPBcQ.js.map → path-flags-ekLdkbra.js.map} +1 -1
- package/dist/{prepare-Ccxspoj-.js → prepare-BaJe0Zik.js} +4 -4
- package/dist/{prepare-Ccxspoj-.js.map → prepare-BaJe0Zik.js.map} +1 -1
- package/dist/{project-CLcF5i8c.js → project-DALmhb5R.js} +2 -2
- package/dist/{project-CLcF5i8c.js.map → project-DALmhb5R.js.map} +1 -1
- package/dist/project-command-Cl9EZzjr.js +662 -0
- package/dist/project-command-Cl9EZzjr.js.map +1 -0
- package/dist/{project-schema-CsSOG2gE.js → project-schema-Dm6Jk0Y_.js} +4 -2
- package/dist/{project-schema-CsSOG2gE.js.map → project-schema-Dm6Jk0Y_.js.map} +1 -1
- package/dist/{pull-BMuiUyjb.js → pull-CTIsST6T.js} +66 -5
- package/dist/pull-CTIsST6T.js.map +1 -0
- package/dist/resolve-C36px9tR.js +2 -0
- package/dist/{resources-Dpfs2y8P.js → resources-Db3USuPO.js} +5 -5
- package/dist/{resources-Dpfs2y8P.js.map → resources-Db3USuPO.js.map} +1 -1
- package/dist/rls-BxrQ0P50.js +133 -0
- package/dist/rls-BxrQ0P50.js.map +1 -0
- package/dist/{schema-Dv6nHkb0.js → schema-_FzZEoB8.js} +54 -40
- package/dist/schema-_FzZEoB8.js.map +1 -0
- package/dist/{schema-dir-Cd1kvYbf.js → schema-dir-ChcYfWjP.js} +2 -2
- package/dist/{schema-dir-Cd1kvYbf.js.map → schema-dir-ChcYfWjP.js.map} +1 -1
- package/dist/schema-reconcile-DV14XY4o.js +2 -0
- package/dist/schema-show-h72UJ9zH.js +127 -0
- package/dist/schema-show-h72UJ9zH.js.map +1 -0
- package/dist/{skills-CXjA9TWw.js → skills-DQ2bZGkj.js} +6 -5
- package/dist/{skills-CXjA9TWw.js.map → skills-DQ2bZGkj.js.map} +1 -1
- package/dist/star-nudge.d.ts +28 -0
- package/dist/{start-Bwbtt2W5.js → start-Cjx4W0bJ.js} +7 -7
- package/dist/{start-Bwbtt2W5.js.map → start-Cjx4W0bJ.js.map} +1 -1
- package/dist/{status-BTgTWzlQ.js → status-CDBk25VO.js} +9 -9
- package/dist/{status-BTgTWzlQ.js.map → status-CDBk25VO.js.map} +1 -1
- package/dist/{storage-iTqj5-Av.js → storage-Clc8dLG8.js} +79 -36
- package/dist/storage-Clc8dLG8.js.map +1 -0
- package/dist/storage-objects-CfRKlTDe.js +279 -0
- package/dist/storage-objects-CfRKlTDe.js.map +1 -0
- package/dist/{telemetry-BP_1Cl9r.js → telemetry-DZU2-NCm.js} +5 -4
- package/dist/{telemetry-BP_1Cl9r.js.map → telemetry-DZU2-NCm.js.map} +1 -1
- package/dist/{telemetry-M3HjlyhZ.js → telemetry-EVtASbKb.js} +2 -2
- package/dist/{telemetry-M3HjlyhZ.js.map → telemetry-EVtASbKb.js.map} +1 -1
- package/dist/unknown-command-DnZ2uhGs.js +139 -0
- package/dist/unknown-command-DnZ2uhGs.js.map +1 -0
- package/dist/{upgrade-oZzJ13jM.js → upgrade-DhpUFb6p.js} +5 -5
- package/dist/{upgrade-oZzJ13jM.js.map → upgrade-DhpUFb6p.js.map} +1 -1
- package/dist/users-5PkqBY6R.js +561 -0
- package/dist/users-5PkqBY6R.js.map +1 -0
- package/dist/utils/project-command.d.ts +38 -0
- package/dist/utils/project-target.d.ts +193 -0
- package/dist/{verify-BkUVGLqo.js → verify-BdeqNb-V.js} +138 -12
- package/dist/verify-BdeqNb-V.js.map +1 -0
- package/dist/{version-Buyyo1ut.js → version-ONIeo7jl.js} +7 -2
- package/dist/{version-Buyyo1ut.js.map → version-ONIeo7jl.js.map} +1 -1
- package/package.json +10 -10
- package/dist/api-keys-eIUjMqWn.js.map +0 -1
- package/dist/apps-DExO4PEl.js.map +0 -1
- package/dist/args-CaCcrYE1.js.map +0 -1
- package/dist/auth-ofQETpM5.js.map +0 -1
- package/dist/bundle-DgILeA5b.js.map +0 -1
- package/dist/cloud-CYMk92iG.js.map +0 -1
- package/dist/command-D5lhW_-B.js.map +0 -1
- package/dist/fold-static-CKewnAPX.js.map +0 -1
- package/dist/init-Dtl-IcXf.js.map +0 -1
- package/dist/last-dev-database-Dc8cP01o.js +0 -2
- package/dist/manifest-C3uLDrrJ.js.map +0 -1
- package/dist/pull-BMuiUyjb.js.map +0 -1
- package/dist/resolve-BY7bSFRT.js +0 -2
- package/dist/schema-Dv6nHkb0.js.map +0 -1
- package/dist/schema-reconcile-CjxLaRHB.js +0 -2
- package/dist/storage-iTqj5-Av.js.map +0 -1
- package/dist/verify-BkUVGLqo.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate_sdk-De-aLC1L.js","names":[],"sources":["../src/commands/generate_sdk.ts"],"sourcesContent":["/**\n * CLI command: generate-sdk\n *\n * Reads the project's tables — `backend/schema`, through the loader the\n * backend boots from, so the SDK describes exactly the tables served — or,\n * with `--from`, a running project's contract, and writes a typed TypeScript\n * SDK to the output directory (default: ./generated/sdk).\n */\n\nimport fs from \"fs\";\nimport path from \"path\";\nimport chalk from \"chalk\";\nimport { computeSchemaVersion, type TableDescriptor } from \"@rebasepro/types\";\nimport { CodegenError, generateSDK, GeneratedFile, toTableAccessor } from \"@rebasepro/codegen\";\nimport { isSchemaDefinitionError } from \"@rebasepro/common\";\nimport { findProjectRoot, readEnvFile } from \"../utils/project\";\nimport { DEV_BACKEND_URL_ENV } from \"../utils/dev-server\";\nimport { Refusal } from \"../utils/refusal\";\nimport { findBackendApp, GENERATED_DIR, loadManifest, manifestExists, writeManifest } from \"../manifest\";\nimport { readLink } from \"./cloud/context\";\nimport { SCHEMA_DIR_FLAG_HELP, PATH_RESOLUTION_RULE } from \"../utils/path-flags\";\nimport { loadProjectSchema, type ModuleAliases } from \"../utils/project-schema\";\n\ninterface GenerateSDKArgs {\n /** The schema directory: the one whose index exports the tables. */\n schemaDir: string;\n output: string;\n cwd: string;\n /**\n * Where to read the schema from instead of local source.\n *\n * `link` uses this checkout's linked project; anything else is treated as\n * the base URL of a Rebase backend. This is what lets a repository that\n * contains no tables — a separate frontend, a second web app — generate\n * a typed client from the project it talks to.\n */\n from?: string;\n /** Bearer token for the contract endpoint. Falls back to REBASE_SERVICE_KEY. */\n token?: string;\n /**\n * Also register the generated `Database` for server-side code: write the\n * types and the `Register` augmentation into `backend/generated/`. See\n * {@link writeRegistration}.\n */\n register?: boolean;\n /**\n * The directory holding `rebase.json`, where `--register` is remembered\n * and under which `backend/generated/` is. Found from `cwd` when not given.\n */\n projectRoot?: string;\n /** Module specifiers mapped to files when importing the schema (in-repo runs and tests). */\n moduleAliases?: ModuleAliases;\n help?: boolean;\n}\n\n/** What `--register` writes, and what marks a project as having opted in. */\nexport const REGISTER_FILE = \"register.ts\";\n\n/** The first line of {@link REGISTER_FILE}: a file without it is the developer's own. */\nconst REGISTER_MARKER = \"// Auto-generated by `rebase generate-sdk --register`. Do not edit.\";\n\nconst REGISTER_SOURCE = `${REGISTER_MARKER}\n//\n// Registers this project's generated \\`Database\\` on \\`@rebasepro/types\\`, so\n// \\`context.data\\` in table hooks, \\`rebase.dataAsAdmin\\`, and the\n// \\`rebase\\` a function or a cron receives are typed from it. Every later\n// \\`rebase generate-sdk\\` (and \\`rebase dev\\`) refreshes this directory; delete\n// it to go back to untyped server-side data.\nimport type { Database } from \"./database.types\";\n\ndeclare module \"@rebasepro/types\" {\n interface Register {\n database: Database;\n }\n}\n`;\n\n/**\n * Where `--register` writes: `backend/generated/` under the project root.\n *\n * Inside `backend/` because that is the program the hooks, functions and\n * crons it types are compiled in. The types are copied in beside the\n * registration rather than imported from `generated/sdk`, which is outside\n * the backend's `rootDir`.\n */\nexport function registrationDir(projectRoot: string): string {\n return path.join(projectRoot, GENERATED_DIR);\n}\n\n/** Whether this project opted in: the registration is there, and it is ours. */\nfunction hasRegistration(dir: string): boolean {\n try {\n return fs.readFileSync(path.join(dir, REGISTER_FILE), \"utf-8\").startsWith(REGISTER_MARKER);\n } catch {\n return false;\n }\n}\n\n/** Write a file only when its content changed, so a watcher on the directory does not restart for nothing. */\nfunction writeIfChanged(filePath: string, content: string): void {\n try {\n if (fs.readFileSync(filePath, \"utf-8\") === content) return;\n } catch {\n // Not there yet.\n }\n fs.writeFileSync(filePath, content, \"utf-8\");\n}\n\n/**\n * Write the generated `Database` and its `Register` augmentation into\n * {@link registrationDir}. Refuses to overwrite a `register.ts` it did not\n * write.\n */\nfunction writeRegistration(dir: string, databaseTypes: string): void {\n const registerPath = path.join(dir, REGISTER_FILE);\n if (fs.existsSync(registerPath) && !hasRegistration(dir)) {\n throw new Error(\n `${registerPath} exists and was not written by \"rebase generate-sdk --register\". ` +\n \"Move it, or register the Database there yourself.\"\n );\n }\n fs.mkdirSync(dir, { recursive: true });\n writeIfChanged(path.join(dir, \"database.types.ts\"), databaseTypes);\n writeIfChanged(registerPath, REGISTER_SOURCE);\n}\n\n/**\n * Write the server-side registration from the build's tables, exactly as\n * `rebase generate-sdk` writes it.\n *\n * Only for a project that asked for it: `registerDatabase` in `rebase.json`,\n * or a registration an earlier `--register` left, which is kept current. The\n * registration lives in gitignored `backend/generated/`, so a fresh clone (a\n * CI job) has none until something writes it, and a bundle compiled without\n * it types `context.data` as untyped rows: hooks that read a typed column fail\n * to compile there while they compile locally.\n *\n * Returns the directory written, or null when there was nothing to do.\n * Throws when a `register.ts` there is not ours, as `generate-sdk` refuses.\n */\nexport async function writeRegistrationForBuild(\n projectRoot: string,\n tables: readonly TableDescriptor[],\n registerDatabase: boolean\n): Promise<string | null> {\n const dir = registrationDir(projectRoot);\n if (!registerDatabase && !hasRegistration(dir)) return null;\n if (tables.length === 0) return null;\n const databaseTypes = generateSDK(sortedBySlug(tables), { includeReadme: false })\n .find((file) => file.path === \"database.types.ts\")?.content;\n if (databaseTypes === undefined) return null;\n writeRegistration(dir, databaseTypes);\n return dir;\n}\n\n/** Tables sorted by slug: the same schema generates the same bytes, whatever order the index lists it in. */\nfunction sortedBySlug(tables: readonly TableDescriptor[]): TableDescriptor[] {\n return [...tables].sort((a, b) => a.slug.localeCompare(b.slug));\n}\n\n/**\n * Whether `rebase.json` asks for the registration (`registerDatabase: true` on\n * the backend app). That is what survives a clone: `generated/` is gitignored,\n * so a `register.ts` from an earlier run is not there to say it.\n *\n * An unreadable manifest answers no; `rebase build` is where it is reported.\n */\nfunction manifestRegisters(projectRoot: string | undefined): boolean {\n if (!projectRoot || !manifestExists(projectRoot)) return false;\n try {\n return findBackendApp(loadManifest(projectRoot).manifest)?.app.registerDatabase === true;\n } catch {\n return false;\n }\n}\n\n/**\n * Remember `--register` in `rebase.json`, so later runs, `rebase dev` and a\n * fresh clone keep registering. Returns where it was written, or why not.\n *\n * Never creates the file: a project without one is synthesized from its\n * layout, and writing one is `rebase apps init`'s decision, not this flag's.\n */\nfunction rememberRegistration(projectRoot: string | undefined): { written: string } | { skipped: string } {\n if (!projectRoot || !manifestExists(projectRoot)) {\n return { skipped: \"No rebase.json here, so the choice lasts as long as the generated files.\" };\n }\n let loaded: ReturnType<typeof loadManifest>;\n try {\n loaded = loadManifest(projectRoot);\n } catch (error) {\n return { skipped: `rebase.json could not be read (${error instanceof Error ? error.message : String(error)}).` };\n }\n const backend = findBackendApp(loaded.manifest);\n if (!backend) return { skipped: \"rebase.json declares no backend app to remember it on.\" };\n if (backend.app.registerDatabase === true) return { written: loaded.filePath ?? projectRoot };\n const manifest = {\n ...loaded.manifest,\n apps: { ...loaded.manifest.apps, [backend.name]: { ...backend.app, registerDatabase: true } }\n };\n return { written: writeManifest(projectRoot, manifest) };\n}\n\n/**\n * The tables the backend serves, read the way it reads them: the schema\n * directory's index, through `loadBackendSchema`, compiled to descriptors.\n *\n * A definition the backend would refuse is fatal here too, as it is at boot:\n * `rebase dev` runs this on every save, and skipping a table would overwrite\n * good types with a `Database` that is silently short one. A missing\n * directory is a `Refusal`: the message says all there is. A module that\n * throws on import is not: that is the project's own code failing, and the\n * stack `--debug` prints points at the line.\n */\nasync function loadTables(projectRoot: string, schemaDir: string, aliases?: ModuleAliases): Promise<TableDescriptor[]> {\n const absDir = path.resolve(schemaDir);\n if (!fs.existsSync(absDir)) {\n throw new Refusal(`Schema directory not found: ${absDir} (${PATH_RESOLUTION_RULE})`);\n }\n const { compiled } = await loadProjectSchema(projectRoot, absDir, aliases);\n return compiled.descriptors;\n}\n\n/**\n * Write generated files to the output directory.\n */\nfunction writeFiles(outputDir: string, files: GeneratedFile[]): void {\n const absOutput = path.resolve(outputDir);\n\n // Create output directory\n fs.mkdirSync(absOutput, { recursive: true });\n\n for (const file of files) {\n const filePath = path.join(absOutput, file.path);\n const dir = path.dirname(filePath);\n if (!fs.existsSync(dir)) {\n fs.mkdirSync(dir, { recursive: true });\n }\n fs.writeFileSync(filePath, file.content, \"utf-8\");\n }\n}\n\nfunction printSdkHelp(): void {\n console.log(`\n${chalk.bold(\"rebase generate-sdk\")} — generate a typed client from a project's schema\n\n${chalk.bold(\"Usage\")}\n rebase generate-sdk [options]\n\n${chalk.bold(\"Options\")}\n --schema-dir <dir> ${SCHEMA_DIR_FLAG_HELP}\n -o, --output <dir> Where to write the SDK (default: ./generated/sdk)\n (--out is accepted too, as on 'rebase build')\n --from <link|url> Fetch the schema from a running project instead of\n local source. \"link\" uses this checkout's linked project.\n --token <token> Bearer token for the contract endpoint\n (default: $REBASE_SERVICE_KEY)\n --register Also type server-side data: write the types and the\n Register declaration to backend/generated/, and\n remember it in rebase.json so later runs keep it.\n -h, --help Show this help\n\n${chalk.bold(\"Examples\")}\n rebase generate-sdk From backend/schema\n rebase generate-sdk --from link From the linked project\n rebase generate-sdk --from https://api.acme.com From any Rebase backend\n rebase generate-sdk --register Type context.data and rebase.dataAsAdmin too\n`.trim());\n}\n\n/** What `--from` sent to the contract endpoint, and which keys it left behind. */\ninterface ContractCredential {\n /** The bearer token sent: `--token`, the shell's key, or none. */\n sent: \"token\" | \"ambient\" | null;\n /** `REBASE_SERVICE_KEY` is in the shell environment. */\n shellKey: boolean;\n /** `REBASE_SERVICE_KEY` is in the project's `.env`. */\n envFileKey: boolean;\n}\n\n/**\n * What to say when the contract endpoint refuses, by what was and was not sent.\n *\n * \"Set REBASE_SERVICE_KEY\" is only right when no key exists. The shell's key is\n * withheld from every host but the linked project, and `.env`'s is never read\n * here — it is the local backend's key, and the linked project is usually a\n * deployed one — so telling a reader whose key is in `.env` to set it sends them\n * to fix something that is not broken.\n */\nfunction contractRefusalHint(credential: ContractCredential): string[] {\n if (credential.sent === \"token\") {\n return [\"The token passed with --token was refused: pass a service key, or an admin's token.\"];\n }\n if (credential.sent === \"ambient\") {\n return [\"REBASE_SERVICE_KEY was sent and refused: it is not this project's service key. Pass the right one with --token.\"];\n }\n if (credential.shellKey) {\n return [\n \"REBASE_SERVICE_KEY is set, but it is only sent to this checkout's linked project, and this host is not it.\",\n \"Pass the key with --token to send it here.\"\n ];\n }\n if (credential.envFileKey) {\n return [\n \"REBASE_SERVICE_KEY in .env is not sent: --from sends the shell's REBASE_SERVICE_KEY, and only to this checkout's linked project.\",\n \"Pass the key with --token.\"\n ];\n }\n return [\"Pass --token <key>, a service key or an admin's token. The shell's REBASE_SERVICE_KEY is sent only to this checkout's linked project.\"];\n}\n\n/**\n * Whether one entry of a contract's `tables` is a table descriptor, as far as\n * the generator reads one: a slug, a SQL name, columns and relations.\n */\nfunction isTableDescriptor(value: unknown): value is TableDescriptor {\n return typeof value === \"object\" && value !== null\n && \"slug\" in value && typeof value.slug === \"string\"\n && \"table\" in value && typeof value.table === \"string\"\n && \"columns\" in value && Array.isArray(value.columns)\n && \"relations\" in value && Array.isArray(value.relations);\n}\n\n/**\n * The tables a running project serves, from its contract endpoint\n * (`{ schemaVersion, runtime, tables: TableDescriptor[] }`). The descriptors\n * are plain data — no thunks to rehydrate — so they go to the generator as\n * they arrive.\n */\nasync function fetchRemoteTables(\n baseUrl: string,\n token: string | undefined,\n credential: ContractCredential\n): Promise<{ tables: TableDescriptor[]; schemaVersion: string }> {\n const url = `${baseUrl.replace(/\\/+$/, \"\")}/api/meta/contract`;\n\n const headers: Record<string, string> = { accept: \"application/json\" };\n if (token) headers.authorization = `Bearer ${token}`;\n\n let response: Response;\n try {\n response = await fetch(url, { headers });\n } catch (err) {\n console.log(chalk.red(` ✗ Could not reach ${url}`));\n console.log(chalk.gray(` ${err instanceof Error ? err.message : String(err)}`));\n process.exit(1);\n }\n\n if (response.status === 401 || response.status === 403) {\n console.log(chalk.red(` ✗ Not authorized to read the project contract (${response.status}).`));\n console.log(chalk.gray(\" The contract describes every table and relation, so it is admin-only.\"));\n for (const line of contractRefusalHint(credential)) console.log(chalk.gray(` ${line}`));\n process.exit(1);\n }\n\n if (response.status === 404) {\n console.log(chalk.red(\" ✗ This server has no contract endpoint.\"));\n console.log(chalk.gray(\" It needs to be running Rebase 0.11 or newer.\"));\n process.exit(1);\n }\n\n if (!response.ok) {\n console.log(chalk.red(` ✗ Contract request failed with ${response.status}.`));\n process.exit(1);\n }\n\n const contract: unknown = await response.json();\n const field = (key: string): unknown =>\n typeof contract === \"object\" && contract !== null && key in contract\n ? Object.entries(contract).find(([name]) => name === key)?.[1]\n : undefined;\n const tables = field(\"tables\");\n const schemaVersion = field(\"schemaVersion\");\n\n if (!Array.isArray(tables)) {\n if (Array.isArray(field(\"collections\"))) {\n // A server from before tables: its contract lists collections, a\n // shape this CLI no longer generates from.\n console.log(chalk.red(\" ✗ This server answers the contract with collections: it runs a Rebase release from before tables.\"));\n console.log(chalk.gray(\" Upgrade the server to a release that serves `tables`, or generate from this project's\"));\n console.log(chalk.gray(\" own backend/schema by running `rebase generate-sdk` without --from.\"));\n process.exit(1);\n }\n console.log(chalk.red(\" ✗ The contract response did not contain tables.\"));\n process.exit(1);\n }\n const invalid = tables.findIndex(entry => !isTableDescriptor(entry));\n if (invalid !== -1) {\n console.log(chalk.red(` ✗ The contract's tables[${invalid}] is not a table descriptor (no slug, table, columns or relations).`));\n process.exit(1);\n }\n\n return {\n tables: tables.filter(isTableDescriptor),\n schemaVersion: typeof schemaVersion === \"string\" ? schemaVersion : \"unknown\"\n };\n}\n\n/**\n * Decide whether the ambient service key may be sent to this host.\n *\n * `REBASE_SERVICE_KEY` grants full admin bypass. Attaching it to whatever URL\n * happened to be passed — or, worse, to whatever a committed `.rebase/cloud.json`\n * points at — would hand the project's most powerful credential to a host nobody\n * vetted. An explicit `--token` is a decision the caller made; the ambient\n * variable is not, so it only travels to the project this checkout is linked to.\n */\nfunction mayUseAmbientKey(target: string, cwd: string): boolean {\n const link = readLink(findProjectRoot(cwd) ?? cwd);\n if (!link?.apiUrl) return false;\n try {\n // Origin, not host: with a link recorded as https, an `http://` target\n // for the same host would otherwise pass and send the key in cleartext.\n return new URL(link.apiUrl).origin === new URL(target).origin;\n } catch {\n return false;\n }\n}\n\n/**\n * The base URL to show in the printed usage example.\n *\n * `rebase dev` binds a port derived from the project path, not 3001, and writes\n * the one it actually got to `.rebase/state.json`. Printing a hardcoded\n * `localhost:3001` sent people to a port nothing was listening on — or, with\n * several projects on one machine, to a different project's backend. Prefer the\n * port `rebase dev` says it is starting the backend on (`DEV_BACKEND_URL_ENV`:\n * it regenerates the SDK before the backend binds), then the port this project\n * last ran on; fall back to the literal only when the project has never been\n * started.\n */\nexport function resolveExampleBaseUrl(cwd: string): string {\n const fromDev = process.env[DEV_BACKEND_URL_ENV]?.trim();\n if (fromDev) return fromDev;\n const projectRoot = findProjectRoot(cwd) ?? cwd;\n try {\n const state = JSON.parse(fs.readFileSync(path.join(projectRoot, \".rebase\", \"state.json\"), \"utf-8\"));\n if (typeof state.baseUrl === \"string\" && state.baseUrl) return state.baseUrl;\n if (typeof state.port === \"number\") return `http://localhost:${state.port}`;\n } catch {\n // Never started, or the file is unreadable — fall through.\n }\n return \"http://localhost:3001\";\n}\n\n/** Whether a slug can be written as `rebase.data.<slug>` rather than a lookup. */\nexport function isIdentifierLike(slug: string): boolean {\n return /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(slug);\n}\n\n/** Resolve `--from` into a base URL, following the link file when asked. */\nfunction resolveSchemaSource(from: string, cwd: string): string {\n if (from !== \"link\") {\n // A bare hostname or a typo would otherwise be handed to `fetch` and fail\n // with something unhelpful; a non-http scheme has no business here at all.\n let parsed: URL;\n try {\n parsed = new URL(from);\n } catch {\n console.log(chalk.red(` ✗ \"${from}\" is not a valid URL.`));\n console.log(chalk.gray(\" Pass a full URL, e.g. https://api.example.com, or \\\"link\\\".\"));\n process.exit(1);\n }\n if (parsed.protocol !== \"http:\" && parsed.protocol !== \"https:\") {\n console.log(chalk.red(\" ✗ The project URL must be http or https.\"));\n process.exit(1);\n }\n return from;\n }\n\n const projectRoot = findProjectRoot(cwd) ?? cwd;\n const link = readLink(projectRoot);\n\n if (!link) {\n console.log(chalk.red(\" ✗ This checkout is not linked to a project.\"));\n console.log(chalk.gray(\" Run `rebase cloud link <url>`, or pass --from <url>.\"));\n process.exit(1);\n }\n\n const apiUrl = link.apiUrl;\n if (!apiUrl) {\n console.log(chalk.red(\" ✗ The project link has no API URL.\"));\n console.log(chalk.gray(\" Re-link with `rebase cloud link <url>` to record one.\"));\n process.exit(1);\n }\n\n return apiUrl;\n}\n\n/**\n * Main entry point for the generate-sdk command.\n */\nexport async function generateSdkCommand(args: GenerateSDKArgs): Promise<void> {\n const { schemaDir, output, cwd } = args;\n\n if (args.help) {\n printSdkHelp();\n return;\n }\n\n const resolvedSchemaDir = path.isAbsolute(schemaDir)\n ? schemaDir\n : path.join(cwd, schemaDir);\n const projectRoot = args.projectRoot ?? findProjectRoot(cwd) ?? undefined;\n\n const resolvedOutput = path.isAbsolute(output)\n ? output\n : path.join(cwd, output);\n\n console.log(\"\");\n console.log(chalk.bold(\" 🔧 Rebase SDK Generator\"));\n console.log(\"\");\n\n let tables: TableDescriptor[];\n let remoteSchemaVersion: string | undefined;\n\n if (args.from) {\n const baseUrl = resolveSchemaSource(args.from, cwd);\n console.log(` ${chalk.gray(\"Project:\")} ${baseUrl}`);\n console.log(` ${chalk.gray(\"Output:\")} ${resolvedOutput}`);\n console.log(\"\");\n console.log(chalk.cyan(\" → Fetching the project contract...\"));\n\n const ambient = mayUseAmbientKey(baseUrl, cwd)\n ? process.env.REBASE_SERVICE_KEY\n : undefined;\n\n if (!args.token && !ambient && process.env.REBASE_SERVICE_KEY) {\n console.log(chalk.dim(\n \" (not sending REBASE_SERVICE_KEY — this host is not the linked project; pass --token to override)\"\n ));\n }\n\n const remote = await fetchRemoteTables(baseUrl, args.token || ambient, {\n sent: args.token ? \"token\" : ambient ? \"ambient\" : null,\n shellKey: Boolean(process.env.REBASE_SERVICE_KEY),\n envFileKey: Boolean(readEnvFile(findProjectRoot(cwd) ?? cwd).REBASE_SERVICE_KEY)\n });\n tables = remote.tables;\n remoteSchemaVersion = remote.schemaVersion;\n } else {\n // A headless project has no schema directory by design: its API is\n // introspected from the live database at boot, and there is nothing here\n // to generate a client from. The scaffold ships `pnpm generate:sdk`\n // anyway, so the documented headless path had a script that could only\n // ever fail — and it failed with a path, which reads as a broken install\n // rather than a question with an answer.\n if (!fs.existsSync(resolvedSchemaDir)) {\n console.log(chalk.gray(\n \" ○ This project derives its API from the database — \"\n + \"there is no backend/schema to generate a client from.\"\n ));\n console.log(chalk.gray(\n ` Nothing to generate from: ${resolvedSchemaDir} does not exist.`\n ));\n console.log(\"\");\n return;\n }\n console.log(` ${chalk.gray(\"Schema:\")} ${resolvedSchemaDir}`);\n console.log(` ${chalk.gray(\"Output:\")} ${resolvedOutput}`);\n console.log(\"\");\n console.log(chalk.cyan(\" → Loading the tables...\"));\n try {\n tables = await loadTables(projectRoot ?? cwd, resolvedSchemaDir, args.moduleAliases);\n } catch (err) {\n // A definition the backend would refuse to boot on: every problem,\n // one per line, each naming its table.\n if (isSchemaDefinitionError(err)) {\n console.log(\"\");\n console.log(chalk.red(` ✗ ${err.message}`));\n process.exit(1);\n }\n throw err;\n }\n }\n\n // Sorted by slug, so the same schema generates the same SDK.\n tables = sortedBySlug(tables);\n\n if (tables.length === 0) {\n console.log(chalk.red(\" ✗ No tables found. Nothing to generate.\"));\n process.exit(1);\n }\n\n console.log(chalk.green(` ✓ Found ${tables.length} table(s): ${tables.map(table => table.slug).join(\", \")}`));\n console.log(\"\");\n\n // 2. Generate SDK files\n console.log(chalk.cyan(\" → Generating SDK files...\"));\n let files: GeneratedFile[];\n try {\n files = generateSDK(tables, { baseUrl: resolveExampleBaseUrl(cwd) });\n } catch (err) {\n // A schema that cannot be expressed as valid TypeScript — two slugs\n // that collide on one accessor, a slug with no usable name. The\n // generator refuses rather than emitting a file that does not compile,\n // or one that silently routes a table's reads to another's.\n if (err instanceof CodegenError) {\n console.log(\"\");\n console.log(chalk.red(` ✗ ${err.message}`));\n process.exit(1);\n }\n throw err;\n }\n\n // Stamp the schema this SDK was built from.\n //\n // Without it, an app in a separate repository has no way to know its client\n // is stale: the backend moves on, the frontend keeps compiling against types\n // captured weeks ago, and the mismatch only surfaces as a runtime error. With\n // it, CI can compare against `/api/meta/schema-version` and say so.\n //\n // No generation timestamp. Tables are sorted above precisely so that\n // the same schema produces the same bytes; a timestamp put that back,\n // turning every regeneration into a diff and making the obvious staleness\n // gate — `rebase generate-sdk && git diff --exit-code` — impossible to pass.\n // `SCHEMA_VERSION` already identifies what this was built from, and does it\n // in a way that can be compared against a running project.\n const schemaVersion = remoteSchemaVersion ?? computeSchemaVersion(tables);\n files.push({\n path: \"schema.meta.ts\",\n content: `// Auto-generated by \\`rebase generate-sdk\\`. Do not edit.\n//\n// The schema version this SDK was generated from. Compare it against the\n// project's current version to detect drift:\n//\n// curl -s <api-url>/api/meta/schema-version\n//\n// Pass it to the client as \\`schemaVersion\\` and every request carries it in\n// the \\`x-rebase-schema\\` header, so the server can name the drift instead of\n// answering a renamed field with a bare 400.\nexport const SCHEMA_VERSION = ${JSON.stringify(schemaVersion)};\n`\n });\n\n console.log(chalk.green(` ✓ Generated ${files.length} file(s)`));\n console.log(chalk.gray(` schema ${schemaVersion}`));\n\n // 3. Write to disk\n console.log(chalk.cyan(` → Writing to ${resolvedOutput}...`));\n writeFiles(resolvedOutput, files);\n\n // 4. The server-side registration: on request, and kept current once a\n // project has it, so `rebase dev` regenerating the SDK never leaves the\n // server typed against an older schema than the client.\n const registerDir = projectRoot ? registrationDir(projectRoot) : undefined;\n if (args.register || (registerDir && hasRegistration(registerDir)) || manifestRegisters(projectRoot)) {\n if (!registerDir || !fs.existsSync(path.dirname(registerDir))) {\n console.log(chalk.red(` ✗ No backend/ directory to register the Database in${registerDir ? ` (${path.dirname(registerDir)})` : \"\"}.`));\n console.log(chalk.gray(\" --register writes backend/generated/register.ts; run it inside a project with a backend.\"));\n process.exit(1);\n return;\n }\n const databaseTypes = files.find((file) => file.path === \"database.types.ts\")?.content;\n if (databaseTypes !== undefined) {\n try {\n writeRegistration(registerDir, databaseTypes);\n } catch (error) {\n console.log(chalk.red(` ✗ ${error instanceof Error ? error.message : String(error)}`));\n process.exit(1);\n return;\n }\n console.log(chalk.green(` ✓ Registered the Database for server-side code in ${registerDir}`));\n if (args.register) {\n const remembered = rememberRegistration(projectRoot);\n if (\"written\" in remembered) {\n console.log(chalk.gray(` Remembered in ${path.relative(cwd, remembered.written) || \"rebase.json\"} (registerDatabase).`));\n } else {\n console.log(chalk.yellow(` ${remembered.skipped}`));\n }\n }\n }\n }\n\n console.log(\"\");\n console.log(chalk.green.bold(\" ✓ SDK generated successfully!\"));\n console.log(\"\");\n const typesImport = `./${path.relative(cwd, path.join(resolvedOutput, \"database.types\"))}`;\n const metaImport = `./${path.relative(cwd, path.join(resolvedOutput, \"schema.meta\"))}`;\n const exampleSlug = tables[0]?.slug || \"my_table\";\n\n console.log(chalk.gray(\" Usage:\"));\n console.log(chalk.gray(\" import { createRebaseClient } from '@rebasepro/client';\"));\n console.log(chalk.gray(` import { tablesDictionary, type Database } from '${typesImport}';`));\n console.log(chalk.gray(` import { SCHEMA_VERSION } from '${metaImport}';`));\n console.log(\"\");\n console.log(chalk.gray(\" const rebase = createRebaseClient<Database>({\"));\n console.log(chalk.gray(` baseUrl: '${resolveExampleBaseUrl(cwd)}',`));\n // Sent as `x-rebase-schema` on every request. Costs one line here and is\n // the difference between a server that can say \"this client is three\n // deploys behind\" and one that can only reject a field it does not know.\n console.log(chalk.gray(\" schemaVersion: SCHEMA_VERSION,\"));\n // Without the dictionary a hyphenated slug is not resolvable from the\n // property name alone, and the request 404s at runtime.\n console.log(chalk.gray(\" tables: tablesDictionary,\"));\n console.log(chalk.gray(\" // token: 'your-jwt-token',\"));\n console.log(chalk.gray(\" });\"));\n console.log(\"\");\n // `rebase.data.<accessor>` is the typed surface, so it is what gets printed.\n // `rebase.data.table(slug)` exists too, but it is generic over\n // `Record<string, unknown>` and has no link to `Database` — it was the\n // headline example here for a while, which advertised the one call shape\n // that throws away the types this command just generated.\n const exampleAccessor = toTableAccessor(exampleSlug);\n const exampleAccess = isIdentifierLike(exampleAccessor)\n ? `rebase.data.${exampleAccessor}`\n : `rebase.data[${JSON.stringify(exampleAccessor)}]`;\n console.log(chalk.gray(` const { data } = await ${exampleAccess}.find();`));\n console.log(\"\");\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAwDA,IAAa,gBAAgB;;AAG7B,IAAM,kBAAkB;AAExB,IAAM,kBAAkB,GAAG,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;AAwB3C,SAAgB,gBAAgB,aAA6B;CACzD,OAAO,KAAK,KAAK,aAAa,aAAa;AAC/C;;AAGA,SAAS,gBAAgB,KAAsB;CAC3C,IAAI;EACA,OAAO,GAAG,aAAa,KAAK,KAAK,KAAK,aAAa,GAAG,OAAO,CAAC,CAAC,WAAW,eAAe;CAC7F,QAAQ;EACJ,OAAO;CACX;AACJ;;AAGA,SAAS,eAAe,UAAkB,SAAuB;CAC7D,IAAI;EACA,IAAI,GAAG,aAAa,UAAU,OAAO,MAAM,SAAS;CACxD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,MAAM,gBAAgB,iBAAiB,eAAe,IAChD,eAAe,oBACf,eAAe,KAAK,UAAU,eAAe,EAAE;CACrD,QAAQ,IAAI,MAAM,KAAK,8BAA8B,cAAc,SAAS,CAAC;CAC7E,QAAQ,IAAI,EAAE;AAClB"}
|
|
1
|
+
{"version":3,"file":"generate_sdk-ByD-gTsK.js","names":[],"sources":["../src/commands/generate_sdk.ts"],"sourcesContent":["/**\n * CLI command: generate-sdk\n *\n * Reads the project's tables — `backend/schema`, through the loader the\n * backend boots from, so the SDK describes exactly the tables served — or,\n * with `--from`, a running project's contract, and writes a typed TypeScript\n * SDK to the output directory (default: ./generated/sdk).\n */\n\nimport fs from \"fs\";\nimport path from \"path\";\nimport chalk from \"chalk\";\nimport { computeSchemaVersion, type TableDescriptor } from \"@rebasepro/types\";\nimport { CodegenError, generateSDK, GeneratedFile, toTableAccessor } from \"@rebasepro/codegen\";\nimport { isSchemaDefinitionError } from \"@rebasepro/common\";\nimport { findProjectRoot, readEnvFile } from \"../utils/project\";\nimport { DEV_BACKEND_URL_ENV } from \"../utils/dev-server\";\nimport { Refusal } from \"../utils/refusal\";\nimport { findBackendApp, GENERATED_DIR, loadManifest, manifestExists, writeManifest } from \"../manifest\";\nimport { readLink } from \"./cloud/context\";\nimport { SCHEMA_DIR_FLAG_HELP, PATH_RESOLUTION_RULE } from \"../utils/path-flags\";\nimport { loadProjectSchema, type ModuleAliases } from \"../utils/project-schema\";\n\ninterface GenerateSDKArgs {\n /** The schema directory: the one whose index exports the tables. */\n schemaDir: string;\n output: string;\n cwd: string;\n /**\n * Where to read the schema from instead of local source.\n *\n * `link` uses this checkout's linked project; anything else is treated as\n * the base URL of a Rebase backend. This is what lets a repository that\n * contains no tables — a separate frontend, a second web app — generate\n * a typed client from the project it talks to.\n */\n from?: string;\n /** Bearer token for the contract endpoint. Falls back to REBASE_SERVICE_KEY. */\n token?: string;\n /**\n * Also register the generated `Database` for server-side code: write the\n * types and the `Register` augmentation into `backend/generated/`. See\n * {@link writeRegistration}.\n */\n register?: boolean;\n /**\n * The directory holding `rebase.json`, where `--register` is remembered\n * and under which `backend/generated/` is. Found from `cwd` when not given.\n */\n projectRoot?: string;\n /** Module specifiers mapped to files when importing the schema (in-repo runs and tests). */\n moduleAliases?: ModuleAliases;\n help?: boolean;\n}\n\n/** What `--register` writes, and what marks a project as having opted in. */\nexport const REGISTER_FILE = \"register.ts\";\n\n/** The first line of {@link REGISTER_FILE}: a file without it is the developer's own. */\nconst REGISTER_MARKER = \"// Auto-generated by `rebase generate-sdk --register`. Do not edit.\";\n\nconst REGISTER_SOURCE = `${REGISTER_MARKER}\n//\n// Registers this project's generated \\`Database\\` on \\`@rebasepro/types\\`, so\n// \\`context.data\\` in table hooks, \\`rebase.dataAsAdmin\\`, and the\n// \\`rebase\\` a function or a cron receives are typed from it. Every later\n// \\`rebase generate-sdk\\` (and \\`rebase dev\\`) refreshes this directory; delete\n// it to go back to untyped server-side data.\nimport type { Database } from \"./database.types\";\n\ndeclare module \"@rebasepro/types\" {\n interface Register {\n database: Database;\n }\n}\n`;\n\n/**\n * Where `--register` writes: `backend/generated/` under the project root.\n *\n * Inside `backend/` because that is the program the hooks, functions and\n * crons it types are compiled in. The types are copied in beside the\n * registration rather than imported from `generated/sdk`, which is outside\n * the backend's `rootDir`.\n */\nexport function registrationDir(projectRoot: string): string {\n return path.join(projectRoot, GENERATED_DIR);\n}\n\n/** Whether this project opted in: the registration is there, and it is ours. */\nfunction hasRegistration(dir: string): boolean {\n try {\n return fs.readFileSync(path.join(dir, REGISTER_FILE), \"utf-8\").startsWith(REGISTER_MARKER);\n } catch {\n return false;\n }\n}\n\n/** Write a file only when its content changed, so a watcher on the directory does not restart for nothing. */\nfunction writeIfChanged(filePath: string, content: string): void {\n try {\n if (fs.readFileSync(filePath, \"utf-8\") === content) return;\n } catch {\n // Not there yet.\n }\n fs.writeFileSync(filePath, content, \"utf-8\");\n}\n\n/**\n * Write the generated `Database` and its `Register` augmentation into\n * {@link registrationDir}. Refuses to overwrite a `register.ts` it did not\n * write.\n */\nfunction writeRegistration(dir: string, databaseTypes: string): void {\n const registerPath = path.join(dir, REGISTER_FILE);\n if (fs.existsSync(registerPath) && !hasRegistration(dir)) {\n throw new Error(\n `${registerPath} exists and was not written by \"rebase generate-sdk --register\". ` +\n \"Move it, or register the Database there yourself.\"\n );\n }\n fs.mkdirSync(dir, { recursive: true });\n writeIfChanged(path.join(dir, \"database.types.ts\"), databaseTypes);\n writeIfChanged(registerPath, REGISTER_SOURCE);\n}\n\n/**\n * Write the server-side registration from the build's tables, exactly as\n * `rebase generate-sdk` writes it.\n *\n * Only for a project that asked for it: `registerDatabase` in `rebase.json`,\n * or a registration an earlier `--register` left, which is kept current. The\n * registration lives in gitignored `backend/generated/`, so a fresh clone (a\n * CI job) has none until something writes it, and a bundle compiled without\n * it types `context.data` as untyped rows: hooks that read a typed column fail\n * to compile there while they compile locally.\n *\n * Returns the directory written, or null when there was nothing to do.\n * Throws when a `register.ts` there is not ours, as `generate-sdk` refuses.\n */\nexport async function writeRegistrationForBuild(\n projectRoot: string,\n tables: readonly TableDescriptor[],\n registerDatabase: boolean\n): Promise<string | null> {\n const dir = registrationDir(projectRoot);\n if (!registerDatabase && !hasRegistration(dir)) return null;\n if (tables.length === 0) return null;\n const databaseTypes = generateSDK(sortedBySlug(tables), { includeReadme: false })\n .find((file) => file.path === \"database.types.ts\")?.content;\n if (databaseTypes === undefined) return null;\n writeRegistration(dir, databaseTypes);\n return dir;\n}\n\n/** Tables sorted by slug: the same schema generates the same bytes, whatever order the index lists it in. */\nfunction sortedBySlug(tables: readonly TableDescriptor[]): TableDescriptor[] {\n return [...tables].sort((a, b) => a.slug.localeCompare(b.slug));\n}\n\n/**\n * Whether `rebase.json` asks for the registration (`registerDatabase: true` on\n * the backend app). That is what survives a clone: `generated/` is gitignored,\n * so a `register.ts` from an earlier run is not there to say it.\n *\n * An unreadable manifest answers no; `rebase build` is where it is reported.\n */\nfunction manifestRegisters(projectRoot: string | undefined): boolean {\n if (!projectRoot || !manifestExists(projectRoot)) return false;\n try {\n return findBackendApp(loadManifest(projectRoot).manifest)?.app.registerDatabase === true;\n } catch {\n return false;\n }\n}\n\n/**\n * Remember `--register` in `rebase.json`, so later runs, `rebase dev` and a\n * fresh clone keep registering. Returns where it was written, or why not.\n *\n * Never creates the file: a project without one is synthesized from its\n * layout, and writing one is `rebase apps init`'s decision, not this flag's.\n */\nfunction rememberRegistration(projectRoot: string | undefined): { written: string } | { skipped: string } {\n if (!projectRoot || !manifestExists(projectRoot)) {\n return { skipped: \"No rebase.json here, so the choice lasts as long as the generated files.\" };\n }\n let loaded: ReturnType<typeof loadManifest>;\n try {\n loaded = loadManifest(projectRoot);\n } catch (error) {\n return { skipped: `rebase.json could not be read (${error instanceof Error ? error.message : String(error)}).` };\n }\n const backend = findBackendApp(loaded.manifest);\n if (!backend) return { skipped: \"rebase.json declares no backend app to remember it on.\" };\n if (backend.app.registerDatabase === true) return { written: loaded.filePath ?? projectRoot };\n const manifest = {\n ...loaded.manifest,\n apps: { ...loaded.manifest.apps, [backend.name]: { ...backend.app, registerDatabase: true } }\n };\n return { written: writeManifest(projectRoot, manifest) };\n}\n\n/**\n * The tables the backend serves, read the way it reads them: the schema\n * directory's index, through `loadBackendSchema`, compiled to descriptors.\n *\n * A definition the backend would refuse is fatal here too, as it is at boot:\n * `rebase dev` runs this on every save, and skipping a table would overwrite\n * good types with a `Database` that is silently short one. A missing\n * directory is a `Refusal`: the message says all there is. A module that\n * throws on import is not: that is the project's own code failing, and the\n * stack `--debug` prints points at the line.\n */\nasync function loadTables(projectRoot: string, schemaDir: string, aliases?: ModuleAliases): Promise<TableDescriptor[]> {\n const absDir = path.resolve(schemaDir);\n if (!fs.existsSync(absDir)) {\n throw new Refusal(`Schema directory not found: ${absDir} (${PATH_RESOLUTION_RULE})`);\n }\n const { compiled } = await loadProjectSchema(projectRoot, absDir, aliases);\n return compiled.descriptors;\n}\n\n/**\n * Write generated files to the output directory.\n */\nfunction writeFiles(outputDir: string, files: GeneratedFile[]): void {\n const absOutput = path.resolve(outputDir);\n\n // Create output directory\n fs.mkdirSync(absOutput, { recursive: true });\n\n for (const file of files) {\n const filePath = path.join(absOutput, file.path);\n const dir = path.dirname(filePath);\n if (!fs.existsSync(dir)) {\n fs.mkdirSync(dir, { recursive: true });\n }\n fs.writeFileSync(filePath, file.content, \"utf-8\");\n }\n}\n\nfunction printSdkHelp(): void {\n console.log(`\n${chalk.bold(\"rebase generate-sdk\")} — generate a typed client from a project's schema\n\n${chalk.bold(\"Usage\")}\n rebase generate-sdk [options]\n\n${chalk.bold(\"Options\")}\n --schema-dir <dir> ${SCHEMA_DIR_FLAG_HELP}\n -o, --output <dir> Where to write the SDK (default: ./generated/sdk)\n (--out is accepted too, as on 'rebase build')\n --from <link|url> Fetch the schema from a running project instead of\n local source. \"link\" uses this checkout's linked project.\n --token <token> Bearer token for the contract endpoint\n (default: $REBASE_SERVICE_KEY)\n --register Also type server-side data: write the types and the\n Register declaration to backend/generated/, and\n remember it in rebase.json so later runs keep it.\n -h, --help Show this help\n\n${chalk.bold(\"Examples\")}\n rebase generate-sdk From backend/schema\n rebase generate-sdk --from link From the linked project\n rebase generate-sdk --from https://api.acme.com From any Rebase backend\n rebase generate-sdk --register Type context.data and rebase.dataAsAdmin too\n`.trim());\n}\n\n/** What `--from` sent to the contract endpoint, and which keys it left behind. */\ninterface ContractCredential {\n /** The bearer token sent: `--token`, the shell's key, or none. */\n sent: \"token\" | \"ambient\" | null;\n /** `REBASE_SERVICE_KEY` is in the shell environment. */\n shellKey: boolean;\n /** `REBASE_SERVICE_KEY` is in the project's `.env`. */\n envFileKey: boolean;\n}\n\n/**\n * What to say when the contract endpoint refuses, by what was and was not sent.\n *\n * \"Set REBASE_SERVICE_KEY\" is only right when no key exists. The shell's key is\n * withheld from every host but the linked project, and `.env`'s is never read\n * here — it is the local backend's key, and the linked project is usually a\n * deployed one — so telling a reader whose key is in `.env` to set it sends them\n * to fix something that is not broken.\n */\nfunction contractRefusalHint(credential: ContractCredential): string[] {\n if (credential.sent === \"token\") {\n return [\"The token passed with --token was refused: pass a service key, or an admin's token.\"];\n }\n if (credential.sent === \"ambient\") {\n return [\"REBASE_SERVICE_KEY was sent and refused: it is not this project's service key. Pass the right one with --token.\"];\n }\n if (credential.shellKey) {\n return [\n \"REBASE_SERVICE_KEY is set, but it is only sent to this checkout's linked project, and this host is not it.\",\n \"Pass the key with --token to send it here.\"\n ];\n }\n if (credential.envFileKey) {\n return [\n \"REBASE_SERVICE_KEY in .env is not sent: --from sends the shell's REBASE_SERVICE_KEY, and only to this checkout's linked project.\",\n \"Pass the key with --token.\"\n ];\n }\n return [\"Pass --token <key>, a service key or an admin's token. The shell's REBASE_SERVICE_KEY is sent only to this checkout's linked project.\"];\n}\n\n/**\n * Whether one entry of a contract's `tables` is a table descriptor, as far as\n * the generator reads one: a slug, a SQL name, columns and relations.\n */\nfunction isTableDescriptor(value: unknown): value is TableDescriptor {\n return typeof value === \"object\" && value !== null\n && \"slug\" in value && typeof value.slug === \"string\"\n && \"table\" in value && typeof value.table === \"string\"\n && \"columns\" in value && Array.isArray(value.columns)\n && \"relations\" in value && Array.isArray(value.relations);\n}\n\n/**\n * The tables a running project serves, from its contract endpoint\n * (`{ schemaVersion, runtime, tables: TableDescriptor[] }`). The descriptors\n * are plain data — no thunks to rehydrate — so they go to the generator as\n * they arrive.\n */\nasync function fetchRemoteTables(\n baseUrl: string,\n token: string | undefined,\n credential: ContractCredential\n): Promise<{ tables: TableDescriptor[]; schemaVersion: string }> {\n const url = `${baseUrl.replace(/\\/+$/, \"\")}/api/meta/contract`;\n\n const headers: Record<string, string> = { accept: \"application/json\" };\n if (token) headers.authorization = `Bearer ${token}`;\n\n let response: Response;\n try {\n response = await fetch(url, { headers });\n } catch (err) {\n console.log(chalk.red(` ✗ Could not reach ${url}`));\n console.log(chalk.gray(` ${err instanceof Error ? err.message : String(err)}`));\n process.exit(1);\n }\n\n if (response.status === 401 || response.status === 403) {\n console.log(chalk.red(` ✗ Not authorized to read the project contract (${response.status}).`));\n console.log(chalk.gray(\" The contract describes every table and relation, so it is admin-only.\"));\n for (const line of contractRefusalHint(credential)) console.log(chalk.gray(` ${line}`));\n process.exit(1);\n }\n\n if (response.status === 404) {\n console.log(chalk.red(\" ✗ This server has no contract endpoint.\"));\n console.log(chalk.gray(\" It needs to be running Rebase 0.11 or newer.\"));\n process.exit(1);\n }\n\n if (!response.ok) {\n console.log(chalk.red(` ✗ Contract request failed with ${response.status}.`));\n process.exit(1);\n }\n\n const contract: unknown = await response.json();\n const field = (key: string): unknown =>\n typeof contract === \"object\" && contract !== null && key in contract\n ? Object.entries(contract).find(([name]) => name === key)?.[1]\n : undefined;\n const tables = field(\"tables\");\n const schemaVersion = field(\"schemaVersion\");\n\n if (!Array.isArray(tables)) {\n if (Array.isArray(field(\"collections\"))) {\n // A server from before tables: its contract lists collections, a\n // shape this CLI no longer generates from.\n console.log(chalk.red(\" ✗ This server answers the contract with collections: it runs a Rebase release from before tables.\"));\n console.log(chalk.gray(\" Upgrade the server to a release that serves `tables`, or generate from this project's\"));\n console.log(chalk.gray(\" own backend/schema by running `rebase generate-sdk` without --from.\"));\n process.exit(1);\n }\n console.log(chalk.red(\" ✗ The contract response did not contain tables.\"));\n process.exit(1);\n }\n const invalid = tables.findIndex(entry => !isTableDescriptor(entry));\n if (invalid !== -1) {\n console.log(chalk.red(` ✗ The contract's tables[${invalid}] is not a table descriptor (no slug, table, columns or relations).`));\n process.exit(1);\n }\n\n return {\n tables: tables.filter(isTableDescriptor),\n schemaVersion: typeof schemaVersion === \"string\" ? schemaVersion : \"unknown\"\n };\n}\n\n/**\n * Decide whether the ambient service key may be sent to this host.\n *\n * `REBASE_SERVICE_KEY` grants full admin bypass. Attaching it to whatever URL\n * happened to be passed — or, worse, to whatever a committed `.rebase/cloud.json`\n * points at — would hand the project's most powerful credential to a host nobody\n * vetted. An explicit `--token` is a decision the caller made; the ambient\n * variable is not, so it only travels to the project this checkout is linked to.\n */\nfunction mayUseAmbientKey(target: string, cwd: string): boolean {\n const link = readLink(findProjectRoot(cwd) ?? cwd);\n if (!link?.apiUrl) return false;\n try {\n // Origin, not host: with a link recorded as https, an `http://` target\n // for the same host would otherwise pass and send the key in cleartext.\n return new URL(link.apiUrl).origin === new URL(target).origin;\n } catch {\n return false;\n }\n}\n\n/**\n * The base URL to show in the printed usage example.\n *\n * `rebase dev` binds a port derived from the project path, not 3001, and writes\n * the one it actually got to `.rebase/state.json`. Printing a hardcoded\n * `localhost:3001` sent people to a port nothing was listening on — or, with\n * several projects on one machine, to a different project's backend. Prefer the\n * port `rebase dev` says it is starting the backend on (`DEV_BACKEND_URL_ENV`:\n * it regenerates the SDK before the backend binds), then the port this project\n * last ran on; fall back to the literal only when the project has never been\n * started.\n */\nexport function resolveExampleBaseUrl(cwd: string): string {\n const fromDev = process.env[DEV_BACKEND_URL_ENV]?.trim();\n if (fromDev) return fromDev;\n const projectRoot = findProjectRoot(cwd) ?? cwd;\n try {\n const state = JSON.parse(fs.readFileSync(path.join(projectRoot, \".rebase\", \"state.json\"), \"utf-8\"));\n if (typeof state.baseUrl === \"string\" && state.baseUrl) return state.baseUrl;\n if (typeof state.port === \"number\") return `http://localhost:${state.port}`;\n } catch {\n // Never started, or the file is unreadable — fall through.\n }\n return \"http://localhost:3001\";\n}\n\n/** Whether a slug can be written as `rebase.data.<slug>` rather than a lookup. */\nexport function isIdentifierLike(slug: string): boolean {\n return /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(slug);\n}\n\n/** Resolve `--from` into a base URL, following the link file when asked. */\nfunction resolveSchemaSource(from: string, cwd: string): string {\n if (from !== \"link\") {\n // A bare hostname or a typo would otherwise be handed to `fetch` and fail\n // with something unhelpful; a non-http scheme has no business here at all.\n let parsed: URL;\n try {\n parsed = new URL(from);\n } catch {\n console.log(chalk.red(` ✗ \"${from}\" is not a valid URL.`));\n console.log(chalk.gray(\" Pass a full URL, e.g. https://api.example.com, or \\\"link\\\".\"));\n process.exit(1);\n }\n if (parsed.protocol !== \"http:\" && parsed.protocol !== \"https:\") {\n console.log(chalk.red(\" ✗ The project URL must be http or https.\"));\n process.exit(1);\n }\n return from;\n }\n\n const projectRoot = findProjectRoot(cwd) ?? cwd;\n const link = readLink(projectRoot);\n\n if (!link) {\n console.log(chalk.red(\" ✗ This checkout is not linked to a project.\"));\n console.log(chalk.gray(\" Run `rebase cloud link <url>`, or pass --from <url>.\"));\n process.exit(1);\n }\n\n const apiUrl = link.apiUrl;\n if (!apiUrl) {\n console.log(chalk.red(\" ✗ The project link has no API URL.\"));\n console.log(chalk.gray(\" Re-link with `rebase cloud link <url>` to record one.\"));\n process.exit(1);\n }\n\n return apiUrl;\n}\n\n/**\n * Main entry point for the generate-sdk command.\n */\nexport async function generateSdkCommand(args: GenerateSDKArgs): Promise<void> {\n const { schemaDir, output, cwd } = args;\n\n if (args.help) {\n printSdkHelp();\n return;\n }\n\n const resolvedSchemaDir = path.isAbsolute(schemaDir)\n ? schemaDir\n : path.join(cwd, schemaDir);\n const projectRoot = args.projectRoot ?? findProjectRoot(cwd) ?? undefined;\n\n const resolvedOutput = path.isAbsolute(output)\n ? output\n : path.join(cwd, output);\n\n console.log(\"\");\n console.log(chalk.bold(\" 🔧 Rebase SDK Generator\"));\n console.log(\"\");\n\n let tables: TableDescriptor[];\n let remoteSchemaVersion: string | undefined;\n\n if (args.from) {\n const baseUrl = resolveSchemaSource(args.from, cwd);\n console.log(` ${chalk.gray(\"Project:\")} ${baseUrl}`);\n console.log(` ${chalk.gray(\"Output:\")} ${resolvedOutput}`);\n console.log(\"\");\n console.log(chalk.cyan(\" → Fetching the project contract...\"));\n\n const ambient = mayUseAmbientKey(baseUrl, cwd)\n ? process.env.REBASE_SERVICE_KEY\n : undefined;\n\n if (!args.token && !ambient && process.env.REBASE_SERVICE_KEY) {\n console.log(chalk.dim(\n \" (not sending REBASE_SERVICE_KEY — this host is not the linked project; pass --token to override)\"\n ));\n }\n\n const remote = await fetchRemoteTables(baseUrl, args.token || ambient, {\n sent: args.token ? \"token\" : ambient ? \"ambient\" : null,\n shellKey: Boolean(process.env.REBASE_SERVICE_KEY),\n envFileKey: Boolean(readEnvFile(findProjectRoot(cwd) ?? cwd).REBASE_SERVICE_KEY)\n });\n tables = remote.tables;\n remoteSchemaVersion = remote.schemaVersion;\n } else {\n // A headless project has no schema directory by design: its API is\n // introspected from the live database at boot, and there is nothing here\n // to generate a client from. The scaffold ships `pnpm generate:sdk`\n // anyway, so the documented headless path had a script that could only\n // ever fail — and it failed with a path, which reads as a broken install\n // rather than a question with an answer.\n if (!fs.existsSync(resolvedSchemaDir)) {\n console.log(chalk.gray(\n \" ○ This project derives its API from the database — \"\n + \"there is no backend/schema to generate a client from.\"\n ));\n console.log(chalk.gray(\n ` Nothing to generate from: ${resolvedSchemaDir} does not exist.`\n ));\n console.log(\"\");\n return;\n }\n console.log(` ${chalk.gray(\"Schema:\")} ${resolvedSchemaDir}`);\n console.log(` ${chalk.gray(\"Output:\")} ${resolvedOutput}`);\n console.log(\"\");\n console.log(chalk.cyan(\" → Loading the tables...\"));\n try {\n tables = await loadTables(projectRoot ?? cwd, resolvedSchemaDir, args.moduleAliases);\n } catch (err) {\n // A definition the backend would refuse to boot on: every problem,\n // one per line, each naming its table.\n if (isSchemaDefinitionError(err)) {\n console.log(\"\");\n console.log(chalk.red(` ✗ ${err.message}`));\n process.exit(1);\n }\n throw err;\n }\n }\n\n // Sorted by slug, so the same schema generates the same SDK.\n tables = sortedBySlug(tables);\n\n if (tables.length === 0) {\n console.log(chalk.red(\" ✗ No tables found. Nothing to generate.\"));\n process.exit(1);\n }\n\n console.log(chalk.green(` ✓ Found ${tables.length} table(s): ${tables.map(table => table.slug).join(\", \")}`));\n console.log(\"\");\n\n // 2. Generate SDK files\n console.log(chalk.cyan(\" → Generating SDK files...\"));\n let files: GeneratedFile[];\n try {\n files = generateSDK(tables, { baseUrl: resolveExampleBaseUrl(cwd) });\n } catch (err) {\n // A schema that cannot be expressed as valid TypeScript — two slugs\n // that collide on one accessor, a slug with no usable name. The\n // generator refuses rather than emitting a file that does not compile,\n // or one that silently routes a table's reads to another's.\n if (err instanceof CodegenError) {\n console.log(\"\");\n console.log(chalk.red(` ✗ ${err.message}`));\n process.exit(1);\n }\n throw err;\n }\n\n // Stamp the schema this SDK was built from.\n //\n // Without it, an app in a separate repository has no way to know its client\n // is stale: the backend moves on, the frontend keeps compiling against types\n // captured weeks ago, and the mismatch only surfaces as a runtime error. With\n // it, CI can compare against `/api/meta/schema-version` and say so.\n //\n // No generation timestamp. Tables are sorted above precisely so that\n // the same schema produces the same bytes; a timestamp put that back,\n // turning every regeneration into a diff and making the obvious staleness\n // gate — `rebase generate-sdk && git diff --exit-code` — impossible to pass.\n // `SCHEMA_VERSION` already identifies what this was built from, and does it\n // in a way that can be compared against a running project.\n const schemaVersion = remoteSchemaVersion ?? computeSchemaVersion(tables);\n files.push({\n path: \"schema.meta.ts\",\n content: `// Auto-generated by \\`rebase generate-sdk\\`. Do not edit.\n//\n// The schema version this SDK was generated from. Compare it against the\n// project's current version to detect drift:\n//\n// curl -s <api-url>/api/meta/schema-version\n//\n// Pass it to the client as \\`schemaVersion\\` and every request carries it in\n// the \\`x-rebase-schema\\` header, so the server can name the drift instead of\n// answering a renamed field with a bare 400.\nexport const SCHEMA_VERSION = ${JSON.stringify(schemaVersion)};\n`\n });\n\n console.log(chalk.green(` ✓ Generated ${files.length} file(s)`));\n console.log(chalk.gray(` schema ${schemaVersion}`));\n\n // 3. Write to disk\n console.log(chalk.cyan(` → Writing to ${resolvedOutput}...`));\n writeFiles(resolvedOutput, files);\n\n // 4. The server-side registration: on request, and kept current once a\n // project has it, so `rebase dev` regenerating the SDK never leaves the\n // server typed against an older schema than the client.\n const registerDir = projectRoot ? registrationDir(projectRoot) : undefined;\n if (args.register || (registerDir && hasRegistration(registerDir)) || manifestRegisters(projectRoot)) {\n if (!registerDir || !fs.existsSync(path.dirname(registerDir))) {\n console.log(chalk.red(` ✗ No backend/ directory to register the Database in${registerDir ? ` (${path.dirname(registerDir)})` : \"\"}.`));\n console.log(chalk.gray(\" --register writes backend/generated/register.ts; run it inside a project with a backend.\"));\n process.exit(1);\n return;\n }\n const databaseTypes = files.find((file) => file.path === \"database.types.ts\")?.content;\n if (databaseTypes !== undefined) {\n try {\n writeRegistration(registerDir, databaseTypes);\n } catch (error) {\n console.log(chalk.red(` ✗ ${error instanceof Error ? error.message : String(error)}`));\n process.exit(1);\n return;\n }\n console.log(chalk.green(` ✓ Registered the Database for server-side code in ${registerDir}`));\n if (args.register) {\n const remembered = rememberRegistration(projectRoot);\n if (\"written\" in remembered) {\n console.log(chalk.gray(` Remembered in ${path.relative(cwd, remembered.written) || \"rebase.json\"} (registerDatabase).`));\n } else {\n console.log(chalk.yellow(` ${remembered.skipped}`));\n }\n }\n }\n }\n\n console.log(\"\");\n console.log(chalk.green.bold(\" ✓ SDK generated successfully!\"));\n console.log(\"\");\n const typesImport = `./${path.relative(cwd, path.join(resolvedOutput, \"database.types\"))}`;\n const metaImport = `./${path.relative(cwd, path.join(resolvedOutput, \"schema.meta\"))}`;\n const exampleSlug = tables[0]?.slug || \"my_table\";\n\n console.log(chalk.gray(\" Usage:\"));\n console.log(chalk.gray(\" import { createRebaseClient } from '@rebasepro/client';\"));\n console.log(chalk.gray(` import { tablesDictionary, type Database } from '${typesImport}';`));\n console.log(chalk.gray(` import { SCHEMA_VERSION } from '${metaImport}';`));\n console.log(\"\");\n console.log(chalk.gray(\" const rebase = createRebaseClient<Database>({\"));\n console.log(chalk.gray(` baseUrl: '${resolveExampleBaseUrl(cwd)}',`));\n // Sent as `x-rebase-schema` on every request. Costs one line here and is\n // the difference between a server that can say \"this client is three\n // deploys behind\" and one that can only reject a field it does not know.\n console.log(chalk.gray(\" schemaVersion: SCHEMA_VERSION,\"));\n // Without the dictionary a hyphenated slug is not resolvable from the\n // property name alone, and the request 404s at runtime.\n console.log(chalk.gray(\" tables: tablesDictionary,\"));\n console.log(chalk.gray(\" // token: 'your-jwt-token',\"));\n console.log(chalk.gray(\" });\"));\n console.log(\"\");\n // `rebase.data.<accessor>` is the typed surface, so it is what gets printed.\n // `rebase.data.table(slug)` exists too, but it is generic over\n // `Record<string, unknown>` and has no link to `Database` — it was the\n // headline example here for a while, which advertised the one call shape\n // that throws away the types this command just generated.\n const exampleAccessor = toTableAccessor(exampleSlug);\n const exampleAccess = isIdentifierLike(exampleAccessor)\n ? `rebase.data.${exampleAccessor}`\n : `rebase.data[${JSON.stringify(exampleAccessor)}]`;\n console.log(chalk.gray(` const { data } = await ${exampleAccess}.find();`));\n console.log(\"\");\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAwDA,IAAa,gBAAgB;;AAG7B,IAAM,kBAAkB;AAExB,IAAM,kBAAkB,GAAG,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;AAwB3C,SAAgB,gBAAgB,aAA6B;CACzD,OAAO,KAAK,KAAK,aAAa,aAAa;AAC/C;;AAGA,SAAS,gBAAgB,KAAsB;CAC3C,IAAI;EACA,OAAO,GAAG,aAAa,KAAK,KAAK,KAAK,aAAa,GAAG,OAAO,CAAC,CAAC,WAAW,eAAe;CAC7F,QAAQ;EACJ,OAAO;CACX;AACJ;;AAGA,SAAS,eAAe,UAAkB,SAAuB;CAC7D,IAAI;EACA,IAAI,GAAG,aAAa,UAAU,OAAO,MAAM,SAAS;CACxD,QAAQ,CAER;CACA,GAAG,cAAc,UAAU,SAAS,OAAO;AAC/C;;;;;;AAOA,SAAS,kBAAkB,KAAa,eAA6B;CACjE,MAAM,eAAe,KAAK,KAAK,KAAK,aAAa;CACjD,IAAI,GAAG,WAAW,YAAY,KAAK,CAAC,gBAAgB,GAAG,GACnD,MAAM,IAAI,MACN,GAAG,aAAa,mHAEpB;CAEJ,GAAG,UAAU,KAAK,EAAE,WAAW,KAAK,CAAC;CACrC,eAAe,KAAK,KAAK,KAAK,mBAAmB,GAAG,aAAa;CACjE,eAAe,cAAc,eAAe;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|
-
import {
|
|
1
|
+
import { i as recordEvent, n as isEnabled, u as errorClass } from "./telemetry-EVtASbKb.js";
|
|
2
|
+
import { n as unknownCommand } from "./unknown-command-DnZ2uhGs.js";
|
|
3
|
+
import { n as parseCommandArgs, t as UsageError } from "./args-DHyrshtI.js";
|
|
4
|
+
import { i as failAsJson, p as requireProjectRoot, y as wantsJsonOutput } from "./project-DALmhb5R.js";
|
|
5
|
+
import { C as resolveBackendPaths, D as validateManifest, E as synthesizeManifest, O as writeManifest, S as manifestPath, T as staticAppAddress, _ as findBackendApp, a as DEFAULT_TABLES_DIR, b as loadManifest, c as LEGACY_CONFIG_DIR, d as STORAGE_FILE, f as TABLES_INDEX_FILES, g as compareMountOrder, h as cmsMountOf, i as DEFAULT_SCHEMA_FILE, l as ManifestError, m as buildableApps, n as DEFAULT_CRONS_DIR, o as GENERATED_DIR, p as assessManagedCompatibility, r as DEFAULT_FUNCTIONS_DIR, s as HOOKS_FILE, t as CURRENT_RUNTIME_RANGE, u as RESOURCES_FILE, v as findTablesIndex, w as selectDeployApp, x as manifestExists, y as formatAppAddress } from "./manifest-RjqxfCpb.js";
|
|
6
|
+
import { a as refuseRemovedCollectionsFlag } from "./path-flags-ekLdkbra.js";
|
|
7
|
+
import { n as cliVersion } from "./version-ONIeo7jl.js";
|
|
8
|
+
import { C as normalizeEsmSpecifiers, S as foldStaticIntoBundle, T as vendorDependencies, _ as detectFrameworkDepDrift, a as VENDOR_SIZE_WARN_BYTES, b as findIgnoredConfigStorageAuthorize, c as buildBundle, d as bundledNpmrc, f as collectDeclaredDependencies, g as detectDeclaredDepConflicts, h as describeDepConflicts, i as VENDOR_SIZE_MAX_BYTES, l as buildStaticBundle, m as composeBundleManifest, n as DEFAULT_BUNDLE_DIR, o as VENDOR_TARGET_CPU, p as commentSpans, r as UNVENDORED_COST, s as VENDOR_TARGET_OS, t as BUNDLED_UI_CONFIG, u as bundleUiConfig, v as detectNativeDependencies, w as unvendoredReason, x as findUnusedServerEntry, y as detectStorageAuthorize } from "./bundle-CIiKGrte.js";
|
|
8
9
|
import chalk from "chalk";
|
|
9
10
|
import arg from "arg";
|
|
10
11
|
import path from "path";
|
|
@@ -75,7 +76,14 @@ var namespacedCommands = [
|
|
|
75
76
|
"status",
|
|
76
77
|
"upgrade",
|
|
77
78
|
"migrate",
|
|
78
|
-
"normalize-imports"
|
|
79
|
+
"normalize-imports",
|
|
80
|
+
"api",
|
|
81
|
+
"data",
|
|
82
|
+
"users",
|
|
83
|
+
"cron",
|
|
84
|
+
"logs",
|
|
85
|
+
"functions",
|
|
86
|
+
"rls"
|
|
79
87
|
];
|
|
80
88
|
var NO_VOCABULARY = {
|
|
81
89
|
subcommands: [],
|
|
@@ -93,47 +101,67 @@ var NO_VOCABULARY = {
|
|
|
93
101
|
async function commandVocabulary(command) {
|
|
94
102
|
switch (command) {
|
|
95
103
|
case "schema": return {
|
|
96
|
-
subcommands: (await import("./schema-
|
|
104
|
+
subcommands: (await import("./schema-_FzZEoB8.js")).SCHEMA_SUBCOMMANDS,
|
|
97
105
|
aliases: {}
|
|
98
106
|
};
|
|
99
107
|
case "db": return {
|
|
100
|
-
subcommands: (await import("./db-
|
|
108
|
+
subcommands: (await import("./db-D_iF4E-v.js")).DB_SUBCOMMANDS,
|
|
101
109
|
aliases: {}
|
|
102
110
|
};
|
|
103
111
|
case "auth": return {
|
|
104
|
-
subcommands: (await import("./auth-
|
|
112
|
+
subcommands: (await import("./auth-BpyYLEFY.js")).AUTH_SUBCOMMANDS,
|
|
105
113
|
aliases: {}
|
|
106
114
|
};
|
|
107
115
|
case "skills": return {
|
|
108
|
-
subcommands: (await import("./skills-
|
|
116
|
+
subcommands: (await import("./skills-DQ2bZGkj.js").then((n) => n.u)).SKILLS_SUBCOMMANDS,
|
|
109
117
|
aliases: {}
|
|
110
118
|
};
|
|
111
119
|
case "api-keys": return {
|
|
112
|
-
subcommands: (await import("./api-keys-
|
|
120
|
+
subcommands: (await import("./api-keys-fPQ55DCm.js").then((n) => n.t)).API_KEYS_SUBCOMMANDS,
|
|
113
121
|
aliases: {}
|
|
114
122
|
};
|
|
115
123
|
case "storage": return {
|
|
116
|
-
subcommands: (await import("./storage-
|
|
124
|
+
subcommands: (await import("./storage-Clc8dLG8.js")).STORAGE_SUBCOMMANDS,
|
|
125
|
+
aliases: {}
|
|
126
|
+
};
|
|
127
|
+
case "data": return {
|
|
128
|
+
subcommands: (await import("./data-BJ9AZFUC.js")).DATA_SUBCOMMANDS,
|
|
129
|
+
aliases: {}
|
|
130
|
+
};
|
|
131
|
+
case "users": return {
|
|
132
|
+
subcommands: (await import("./users-5PkqBY6R.js")).USERS_SUBCOMMANDS,
|
|
133
|
+
aliases: {}
|
|
134
|
+
};
|
|
135
|
+
case "cron": return {
|
|
136
|
+
subcommands: (await import("./cron-CpUsQ739.js")).CRON_SUBCOMMANDS,
|
|
137
|
+
aliases: {}
|
|
138
|
+
};
|
|
139
|
+
case "functions": return {
|
|
140
|
+
subcommands: (await import("./functions-B4JR6EZL.js")).FUNCTIONS_SUBCOMMANDS,
|
|
141
|
+
aliases: {}
|
|
142
|
+
};
|
|
143
|
+
case "rls": return {
|
|
144
|
+
subcommands: (await import("./rls-BxrQ0P50.js")).RLS_SUBCOMMANDS,
|
|
117
145
|
aliases: {}
|
|
118
146
|
};
|
|
119
147
|
case "apps": return {
|
|
120
|
-
subcommands: (await import("./apps-
|
|
148
|
+
subcommands: (await import("./apps-DBTRoOeP.js")).APPS_SUBCOMMANDS,
|
|
121
149
|
aliases: {}
|
|
122
150
|
};
|
|
123
151
|
case "telemetry": return {
|
|
124
|
-
subcommands: (await import("./telemetry-
|
|
152
|
+
subcommands: (await import("./telemetry-DZU2-NCm.js")).TELEMETRY_SUBCOMMANDS,
|
|
125
153
|
aliases: {}
|
|
126
154
|
};
|
|
127
155
|
case "generate": return {
|
|
128
|
-
subcommands: (await import("./generate-view-
|
|
156
|
+
subcommands: (await import("./generate-view-BMaLQm8H.js")).GENERATE_SUBCOMMANDS,
|
|
129
157
|
aliases: {}
|
|
130
158
|
};
|
|
131
159
|
case "migrate": return {
|
|
132
|
-
subcommands: (await import("./migrate-
|
|
160
|
+
subcommands: (await import("./migrate-Cx8-Y4TG.js")).MIGRATE_SUBCOMMANDS,
|
|
133
161
|
aliases: {}
|
|
134
162
|
};
|
|
135
163
|
case "cloud": {
|
|
136
|
-
const cloud = await import("./cloud-
|
|
164
|
+
const cloud = await import("./cloud-MqnyPnmX.js");
|
|
137
165
|
return {
|
|
138
166
|
subcommands: cloud.CLOUD_GROUP_NAMES,
|
|
139
167
|
aliases: cloud.GROUP_ALIASES
|
|
@@ -256,12 +284,12 @@ async function entry(args) {
|
|
|
256
284
|
async function dispatch(command, effectiveSubcommand, args, parsedArgs, namespacedCommands) {
|
|
257
285
|
switch (command) {
|
|
258
286
|
case "__dev-db-daemon": {
|
|
259
|
-
const { parseDaemonArgs, runDaemon } = await import("./daemon-entry
|
|
287
|
+
const { parseDaemonArgs, runDaemon } = await import("./daemon-entry--ummUJnk.js");
|
|
260
288
|
await runDaemon(parseDaemonArgs(args));
|
|
261
289
|
return;
|
|
262
290
|
}
|
|
263
291
|
case "init": {
|
|
264
|
-
const { createRebaseApp } = await import("./init-
|
|
292
|
+
const { createRebaseApp } = await import("./init-DHCe5mJ5.js");
|
|
265
293
|
await createRebaseApp(args);
|
|
266
294
|
break;
|
|
267
295
|
}
|
|
@@ -283,9 +311,9 @@ async function dispatch(command, effectiveSubcommand, args, parsedArgs, namespac
|
|
|
283
311
|
maxPositionals: 0
|
|
284
312
|
});
|
|
285
313
|
const sdkRoot = sdkHelp ? process.cwd() : requireProjectRoot();
|
|
286
|
-
const { generateSdkCommand } = await import("./generate_sdk-
|
|
314
|
+
const { generateSdkCommand } = await import("./generate_sdk-ByD-gTsK.js");
|
|
287
315
|
await generateSdkCommand({
|
|
288
|
-
schemaDir: sdkArgs["--schema-dir"] || (sdkHelp ? sdkRoot : (await import("./schema-dir-
|
|
316
|
+
schemaDir: sdkArgs["--schema-dir"] || (sdkHelp ? sdkRoot : (await import("./schema-dir-ChcYfWjP.js").then((n) => n.i)).resolveSchemaDir(sdkRoot)),
|
|
289
317
|
output: sdkArgs["--output"] || path.join(sdkRoot, "generated/sdk"),
|
|
290
318
|
from: sdkArgs["--from"],
|
|
291
319
|
token: sdkArgs["--token"],
|
|
@@ -297,116 +325,151 @@ async function dispatch(command, effectiveSubcommand, args, parsedArgs, namespac
|
|
|
297
325
|
break;
|
|
298
326
|
}
|
|
299
327
|
case "schema": {
|
|
300
|
-
const { schemaCommand } = await import("./schema-
|
|
328
|
+
const { schemaCommand } = await import("./schema-_FzZEoB8.js");
|
|
301
329
|
await schemaCommand(effectiveSubcommand, args);
|
|
302
330
|
break;
|
|
303
331
|
}
|
|
304
332
|
case "db": {
|
|
305
|
-
const { dbCommand } = await import("./db-
|
|
333
|
+
const { dbCommand } = await import("./db-D_iF4E-v.js");
|
|
306
334
|
await dbCommand(effectiveSubcommand, args);
|
|
307
335
|
break;
|
|
308
336
|
}
|
|
309
337
|
case "console": {
|
|
310
|
-
const { consoleCommand } = await import("./console-
|
|
338
|
+
const { consoleCommand } = await import("./console-BVoYOLAO.js");
|
|
311
339
|
await consoleCommand(args);
|
|
312
340
|
break;
|
|
313
341
|
}
|
|
314
342
|
case "dev": {
|
|
315
|
-
const { devCommand } = await import("./dev-
|
|
343
|
+
const { devCommand } = await import("./dev-bj6dEeSQ.js");
|
|
316
344
|
await devCommand(args);
|
|
317
345
|
break;
|
|
318
346
|
}
|
|
319
347
|
case "normalize-imports": {
|
|
320
|
-
const { normalizeImportsCommand } = await import("./normalize-imports-
|
|
348
|
+
const { normalizeImportsCommand } = await import("./normalize-imports-P86NVfpo.js");
|
|
321
349
|
await normalizeImportsCommand(args);
|
|
322
350
|
break;
|
|
323
351
|
}
|
|
324
352
|
case "build": {
|
|
325
|
-
const { buildCommand } = await import("./build-
|
|
353
|
+
const { buildCommand } = await import("./build-BfdT-AUR.js").then((n) => n.n);
|
|
326
354
|
await buildCommand(args);
|
|
327
355
|
break;
|
|
328
356
|
}
|
|
329
357
|
case "start": {
|
|
330
|
-
const { startCommand } = await import("./start-
|
|
358
|
+
const { startCommand } = await import("./start-Cjx4W0bJ.js");
|
|
331
359
|
await startCommand(args);
|
|
332
360
|
break;
|
|
333
361
|
}
|
|
334
362
|
case "upgrade": {
|
|
335
|
-
const { upgradeCommand } = await import("./upgrade-
|
|
363
|
+
const { upgradeCommand } = await import("./upgrade-DhpUFb6p.js");
|
|
336
364
|
await upgradeCommand(args);
|
|
337
365
|
break;
|
|
338
366
|
}
|
|
339
367
|
case "migrate": {
|
|
340
|
-
const { migrateCommand } = await import("./migrate-
|
|
368
|
+
const { migrateCommand } = await import("./migrate-Cx8-Y4TG.js");
|
|
341
369
|
await migrateCommand(effectiveSubcommand, args);
|
|
342
370
|
break;
|
|
343
371
|
}
|
|
344
372
|
case "apps": {
|
|
345
|
-
const { appsCommand } = await import("./apps-
|
|
373
|
+
const { appsCommand } = await import("./apps-DBTRoOeP.js");
|
|
346
374
|
await appsCommand(effectiveSubcommand, args);
|
|
347
375
|
break;
|
|
348
376
|
}
|
|
349
377
|
case "generate": {
|
|
350
|
-
const { generateCommand } = await import("./generate-view-
|
|
378
|
+
const { generateCommand } = await import("./generate-view-BMaLQm8H.js");
|
|
351
379
|
await generateCommand(effectiveSubcommand, args);
|
|
352
380
|
break;
|
|
353
381
|
}
|
|
354
382
|
case "eject": {
|
|
355
|
-
const { ejectCommand } = await import("./eject-
|
|
383
|
+
const { ejectCommand } = await import("./eject-DK_M9kor.js");
|
|
356
384
|
await ejectCommand(args);
|
|
357
385
|
break;
|
|
358
386
|
}
|
|
359
387
|
case "auth": {
|
|
360
|
-
const { authCommand } = await import("./auth-
|
|
388
|
+
const { authCommand } = await import("./auth-BpyYLEFY.js");
|
|
361
389
|
await authCommand(effectiveSubcommand, args);
|
|
362
390
|
break;
|
|
363
391
|
}
|
|
364
392
|
case "status": {
|
|
365
|
-
const { statusCommand } = await import("./status-
|
|
393
|
+
const { statusCommand } = await import("./status-CDBk25VO.js");
|
|
366
394
|
await statusCommand(args);
|
|
367
395
|
break;
|
|
368
396
|
}
|
|
369
397
|
case "resources": {
|
|
370
|
-
const { resourcesCommand } = await import("./resources-
|
|
398
|
+
const { resourcesCommand } = await import("./resources-Db3USuPO.js");
|
|
371
399
|
await resourcesCommand(args);
|
|
372
400
|
break;
|
|
373
401
|
}
|
|
374
402
|
case "doctor": {
|
|
375
|
-
const { doctorCommand } = await import("./doctor-
|
|
403
|
+
const { doctorCommand } = await import("./doctor-2Jlau0Rm.js");
|
|
376
404
|
await doctorCommand(args);
|
|
377
405
|
break;
|
|
378
406
|
}
|
|
379
407
|
case "verify": {
|
|
380
|
-
const { verifyCommand } = await import("./verify-
|
|
408
|
+
const { verifyCommand } = await import("./verify-BdeqNb-V.js");
|
|
381
409
|
await verifyCommand(args);
|
|
382
410
|
break;
|
|
383
411
|
}
|
|
384
412
|
case "skills": {
|
|
385
|
-
const { skillsCommand } = await import("./skills-
|
|
413
|
+
const { skillsCommand } = await import("./skills-DQ2bZGkj.js").then((n) => n.u);
|
|
386
414
|
await skillsCommand(effectiveSubcommand, args);
|
|
387
415
|
break;
|
|
388
416
|
}
|
|
389
417
|
case "api-keys": {
|
|
390
|
-
const { apiKeysCommand } = await import("./api-keys-
|
|
418
|
+
const { apiKeysCommand } = await import("./api-keys-fPQ55DCm.js").then((n) => n.t);
|
|
391
419
|
await apiKeysCommand(effectiveSubcommand, args);
|
|
392
420
|
break;
|
|
393
421
|
}
|
|
394
422
|
case "storage": {
|
|
395
|
-
const { storageCommand } = await import("./storage-
|
|
423
|
+
const { storageCommand } = await import("./storage-Clc8dLG8.js");
|
|
396
424
|
await storageCommand(effectiveSubcommand, args);
|
|
397
425
|
break;
|
|
398
426
|
}
|
|
399
427
|
case "cloud": {
|
|
400
|
-
const { cloudCommand } = await import("./cloud-
|
|
428
|
+
const { cloudCommand } = await import("./cloud-MqnyPnmX.js");
|
|
401
429
|
await cloudCommand(effectiveSubcommand, args);
|
|
402
430
|
break;
|
|
403
431
|
}
|
|
404
432
|
case "telemetry": {
|
|
405
|
-
const { telemetryCommand } = await import("./telemetry-
|
|
433
|
+
const { telemetryCommand } = await import("./telemetry-DZU2-NCm.js");
|
|
406
434
|
await telemetryCommand(args);
|
|
407
435
|
break;
|
|
408
436
|
}
|
|
409
|
-
|
|
437
|
+
case "api": {
|
|
438
|
+
const { apiCommand } = await import("./api-TbmW33D7.js");
|
|
439
|
+
await apiCommand(args);
|
|
440
|
+
break;
|
|
441
|
+
}
|
|
442
|
+
case "data": {
|
|
443
|
+
const { dataCommand } = await import("./data-BJ9AZFUC.js");
|
|
444
|
+
await dataCommand(effectiveSubcommand, args);
|
|
445
|
+
break;
|
|
446
|
+
}
|
|
447
|
+
case "users": {
|
|
448
|
+
const { usersCommand } = await import("./users-5PkqBY6R.js");
|
|
449
|
+
await usersCommand(effectiveSubcommand, args);
|
|
450
|
+
break;
|
|
451
|
+
}
|
|
452
|
+
case "cron": {
|
|
453
|
+
const { cronCommand } = await import("./cron-CpUsQ739.js");
|
|
454
|
+
await cronCommand(effectiveSubcommand, args);
|
|
455
|
+
break;
|
|
456
|
+
}
|
|
457
|
+
case "logs": {
|
|
458
|
+
const { logsCommand } = await import("./logs-CIgfLBsu.js");
|
|
459
|
+
await logsCommand(args);
|
|
460
|
+
break;
|
|
461
|
+
}
|
|
462
|
+
case "functions": {
|
|
463
|
+
const { functionsCommand } = await import("./functions-B4JR6EZL.js");
|
|
464
|
+
await functionsCommand(effectiveSubcommand, args);
|
|
465
|
+
break;
|
|
466
|
+
}
|
|
467
|
+
case "rls": {
|
|
468
|
+
const { rlsCommand } = await import("./rls-BxrQ0P50.js");
|
|
469
|
+
await rlsCommand(effectiveSubcommand, args);
|
|
470
|
+
break;
|
|
471
|
+
}
|
|
472
|
+
default: unknownCommand(command, namespacedCommands, "", { cloud: (await import("./cloud-MqnyPnmX.js")).CLOUD_GROUP_NAMES });
|
|
410
473
|
}
|
|
411
474
|
}
|
|
412
475
|
/** The global help. Exported so its Options block can be held against {@link ROOT_FLAGS}. */
|
|
@@ -432,6 +495,7 @@ ${chalk.green.bold("Schema")}
|
|
|
432
495
|
${chalk.blue.bold("schema generate")} Generate the Drizzle schema from backend/schema
|
|
433
496
|
${chalk.blue.bold("schema introspect")} Introspect database → defineTable modules in backend/schema
|
|
434
497
|
${chalk.blue.bold("schema stale")} Report generated schema files the tables have moved past
|
|
498
|
+
${chalk.blue.bold("schema show")} ${chalk.gray("[table]")} The tables and their columns ${chalk.gray("(--remote: as a running server serves them)")}
|
|
435
499
|
${chalk.blue.bold("schema")} ${chalk.gray("--help")} Show schema command help
|
|
436
500
|
|
|
437
501
|
${chalk.green.bold("Database")}
|
|
@@ -451,8 +515,19 @@ ${chalk.green.bold("Generate")}
|
|
|
451
515
|
${chalk.blue.bold("generate view")} ${chalk.gray("<slug>")} Scaffold a custom admin screen ${chalk.gray("(--collection: a record tab)")}
|
|
452
516
|
${chalk.blue.bold("generate-sdk")} Generate a typed TypeScript SDK from the tables
|
|
453
517
|
|
|
518
|
+
${chalk.green.bold("A running app")} ${chalk.gray("(rebase dev, --url <server>, or --project <slug> on Rebase Cloud)")}
|
|
519
|
+
${chalk.blue.bold("api")} ${chalk.gray("[METHOD] <path>")} Send any request to the app's API with the project's credential
|
|
520
|
+
${chalk.blue.bold("data")} ${chalk.gray("<action>")} Rows: query, get, count, insert, update, delete, import, watch
|
|
521
|
+
${chalk.blue.bold("users")} ${chalk.gray("<action>")} Accounts: list, create, roles, reset-password, guests
|
|
522
|
+
${chalk.blue.bold("cron")} ${chalk.gray("<action>")} Scheduled jobs: list, logs, run now, enable, disable
|
|
523
|
+
${chalk.blue.bold("logs")} The server's log, once or followed ${chalk.gray("(-f)")}
|
|
524
|
+
${chalk.blue.bold("functions")} ${chalk.gray("<action>")} Your backend/functions routes: list, invoke
|
|
525
|
+
${chalk.blue.bold("rls simulate")} What another role, user or key would see
|
|
526
|
+
|
|
454
527
|
${chalk.green.bold("Auth")}
|
|
455
528
|
${chalk.blue.bold("auth reset-password")} Reset a user's password
|
|
529
|
+
${chalk.blue.bold("auth login")} Sign in to a running app as a person ${chalk.gray("(for rls simulate, --session)")}
|
|
530
|
+
${chalk.blue.bold("auth emails")} The development mailbox: captured sign-in and reset links
|
|
456
531
|
${chalk.blue.bold("auth")} ${chalk.gray("--help")} Show auth command help
|
|
457
532
|
|
|
458
533
|
${chalk.green.bold("Diagnostics")}
|
|
@@ -471,6 +546,7 @@ ${chalk.green.bold("API Keys")}
|
|
|
471
546
|
${chalk.blue.bold("api-keys list")} List the service API keys: kind, scopes, roles
|
|
472
547
|
${chalk.blue.bold("api-keys get")} ${chalk.gray("<id>")} Show one key
|
|
473
548
|
${chalk.blue.bold("api-keys create")} Create a service key holding the scopes you name
|
|
549
|
+
${chalk.blue.bold("api-keys update")} ${chalk.gray("<id>")} Change a key's scopes, roles, limit or expiry
|
|
474
550
|
${chalk.blue.bold("api-keys revoke")} Revoke an API key
|
|
475
551
|
${chalk.blue.bold("api-keys scopes")} List the scopes a key can hold
|
|
476
552
|
${chalk.blue.bold("api-keys")} ${chalk.gray("--help")} Show API key command help
|
|
@@ -514,6 +590,6 @@ function telemetryNotice() {
|
|
|
514
590
|
return chalk.gray(`Usage sharing: ${sharing ? "on" : "off"} — ${chalk.cyan("rebase telemetry")} to inspect or change\n`);
|
|
515
591
|
}
|
|
516
592
|
//#endregion
|
|
517
|
-
export { BUNDLED_UI_CONFIG, CURRENT_RUNTIME_RANGE, DEFAULT_BUNDLE_DIR, DEFAULT_CRONS_DIR, DEFAULT_FUNCTIONS_DIR, DEFAULT_SCHEMA_FILE, DEFAULT_TABLES_DIR, GENERATED_DIR, HOOKS_FILE, LEGACY_CONFIG_DIR, ManifestError, RESOURCES_FILE, STORAGE_FILE, TABLES_INDEX_FILES, UNVENDORED_COST, VENDOR_SIZE_MAX_BYTES, VENDOR_SIZE_WARN_BYTES, VENDOR_TARGET_CPU, VENDOR_TARGET_OS, assessManagedCompatibility, buildBundle, buildStaticBundle, buildableApps, bundleUiConfig, bundledNpmrc, cmsMountOf, collectDeclaredDependencies, commentSpans, compareMountOrder, composeBundleManifest, describeDepConflicts, detectDeclaredDepConflicts, detectFrameworkDepDrift, detectNativeDependencies, detectStorageAuthorize, entry, findBackendApp, findTablesIndex, findUnusedServerEntry, foldStaticIntoBundle, formatAppAddress, loadManifest, manifestExists, manifestPath, normalizeEsmSpecifiers, resolveBackendPaths, selectDeployApp, staticAppAddress, synthesizeManifest, unvendoredReason, validateManifest, vendorDependencies, writeManifest };
|
|
593
|
+
export { BUNDLED_UI_CONFIG, CURRENT_RUNTIME_RANGE, DEFAULT_BUNDLE_DIR, DEFAULT_CRONS_DIR, DEFAULT_FUNCTIONS_DIR, DEFAULT_SCHEMA_FILE, DEFAULT_TABLES_DIR, GENERATED_DIR, HOOKS_FILE, LEGACY_CONFIG_DIR, ManifestError, RESOURCES_FILE, STORAGE_FILE, TABLES_INDEX_FILES, UNVENDORED_COST, VENDOR_SIZE_MAX_BYTES, VENDOR_SIZE_WARN_BYTES, VENDOR_TARGET_CPU, VENDOR_TARGET_OS, assessManagedCompatibility, buildBundle, buildStaticBundle, buildableApps, bundleUiConfig, bundledNpmrc, cmsMountOf, collectDeclaredDependencies, commentSpans, compareMountOrder, composeBundleManifest, describeDepConflicts, detectDeclaredDepConflicts, detectFrameworkDepDrift, detectNativeDependencies, detectStorageAuthorize, entry, findBackendApp, findIgnoredConfigStorageAuthorize, findTablesIndex, findUnusedServerEntry, foldStaticIntoBundle, formatAppAddress, loadManifest, manifestExists, manifestPath, normalizeEsmSpecifiers, resolveBackendPaths, selectDeployApp, staticAppAddress, synthesizeManifest, unvendoredReason, validateManifest, vendorDependencies, writeManifest };
|
|
518
594
|
|
|
519
595
|
//# sourceMappingURL=index.es.js.map
|