@rebasepro/cli 0.30.0 → 0.31.0-canary.g59cd6fd
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/README.md +8 -7
- package/dist/{agent-setup-0uyfC7VX.js → agent-setup-DqAcoDcn.js} +10 -5
- package/dist/{agent-setup-0uyfC7VX.js.map → agent-setup-DqAcoDcn.js.map} +1 -1
- package/dist/{api-keys-Dfw5-9s1.js → api-keys-eIUjMqWn.js} +8 -7
- package/dist/api-keys-eIUjMqWn.js.map +1 -0
- package/dist/{apps-MKQbgDtN.js → apps-DExO4PEl.js} +8 -7
- package/dist/apps-DExO4PEl.js.map +1 -0
- package/dist/{project-CasK56vN.js → args-CaCcrYE1.js} +2 -351
- package/dist/args-CaCcrYE1.js.map +1 -0
- package/dist/{atlas-dev-database-BODqdCWt.js → atlas-dev-database-DOCKk6ht.js} +2 -2
- package/dist/{atlas-dev-database-BODqdCWt.js.map → atlas-dev-database-DOCKk6ht.js.map} +1 -1
- package/dist/{auth-Bv0rTbQX.js → auth-D96QYgFR.js} +7 -6
- package/dist/{auth-Bv0rTbQX.js.map → auth-D96QYgFR.js.map} +1 -1
- package/dist/backend-guard-C0mVkXBw.js +162 -0
- package/dist/backend-guard-C0mVkXBw.js.map +1 -0
- package/dist/{branch-pointer-BQUF6lYa.js → branch-pointer-DMPyvZoK.js} +1 -1
- package/dist/{build-BuKTnec8.js → build-CA5R07tw.js} +29 -9
- package/dist/build-CA5R07tw.js.map +1 -0
- package/dist/{bundle-BAH4FCju.js → bundle-DgILeA5b.js} +112 -138
- package/dist/bundle-DgILeA5b.js.map +1 -0
- package/dist/bundle.d.ts +35 -12
- package/dist/cli.d.ts +2 -2
- package/dist/{cloud-Cj5ey3l_.js → cloud-CYMk92iG.js} +217 -104
- package/dist/cloud-CYMk92iG.js.map +1 -0
- package/dist/cms-directories-BK3vcswg.js +33 -0
- package/dist/cms-directories-BK3vcswg.js.map +1 -0
- package/dist/codemod/collections-to-tables/ast.d.ts +135 -0
- package/dist/codemod/collections-to-tables/backend.d.ts +38 -0
- package/dist/codemod/collections-to-tables/command.d.ts +35 -0
- package/dist/codemod/collections-to-tables/comments.d.ts +45 -0
- package/dist/codemod/collections-to-tables/customization.d.ts +47 -0
- package/dist/codemod/collections-to-tables/dynamic-props.d.ts +34 -0
- package/dist/codemod/collections-to-tables/export-changes.d.ts +83 -0
- package/dist/codemod/collections-to-tables/firestore.d.ts +11 -0
- package/dist/codemod/collections-to-tables/helper-hooks.d.ts +41 -0
- package/dist/codemod/collections-to-tables/hooks.d.ts +44 -0
- package/dist/codemod/collections-to-tables/journal.d.ts +10 -0
- package/dist/codemod/collections-to-tables/legacy-shims.d.ts +52 -0
- package/dist/codemod/collections-to-tables/load-legacy.d.ts +81 -0
- package/dist/codemod/collections-to-tables/migrate.d.ts +20 -0
- package/dist/codemod/collections-to-tables/modules.d.ts +127 -0
- package/dist/codemod/collections-to-tables/moved-imports.d.ts +70 -0
- package/dist/codemod/collections-to-tables/moved-symbols.generated.d.ts +12 -0
- package/dist/codemod/collections-to-tables/own.d.ts +10 -0
- package/dist/codemod/collections-to-tables/path-aliases.d.ts +26 -0
- package/dist/codemod/collections-to-tables/plan-context.d.ts +49 -0
- package/dist/codemod/collections-to-tables/print-js.d.ts +44 -0
- package/dist/codemod/collections-to-tables/project-files.d.ts +144 -0
- package/dist/codemod/collections-to-tables/repoint.d.ts +50 -0
- package/dist/codemod/collections-to-tables/row-hands.d.ts +7 -0
- package/dist/codemod/collections-to-tables/sdk-calls.d.ts +88 -0
- package/dist/codemod/collections-to-tables/skills-step.d.ts +13 -0
- package/dist/codemod/collections-to-tables/split-constants.d.ts +42 -0
- package/dist/codemod/collections-to-tables/storage-paths.d.ts +28 -0
- package/dist/codemod/collections-to-tables/types.d.ts +164 -0
- package/dist/codemod/collections-to-tables/verify.d.ts +27 -0
- package/dist/codemod/collections-to-tables/vocabulary.d.ts +40 -0
- package/dist/command-D5lhW_-B.js +9984 -0
- package/dist/command-D5lhW_-B.js.map +1 -0
- package/dist/commands/agent-setup.d.ts +6 -2
- package/dist/commands/cloud/auth.d.ts +2 -0
- package/dist/commands/cloud/context.d.ts +1 -1
- package/dist/commands/cloud/init.d.ts +2 -2
- package/dist/commands/cloud/login-flow.d.ts +30 -1
- package/dist/commands/console.d.ts +1 -2
- package/dist/commands/db.d.ts +5 -6
- package/dist/commands/dev.d.ts +18 -17
- package/dist/commands/doctor.d.ts +4 -5
- package/dist/commands/eject.d.ts +17 -13
- package/dist/commands/generate-view.d.ts +20 -9
- package/dist/commands/generate_sdk.d.ts +27 -27
- package/dist/commands/init.d.ts +21 -8
- package/dist/commands/migrate.d.ts +24 -0
- package/dist/commands/schema-reconcile.d.ts +1 -1
- package/dist/commands/skills.d.ts +8 -0
- package/dist/commands/verify-cms.d.ts +28 -0
- package/dist/commands/verify.d.ts +14 -9
- package/dist/{consent-BD7F29T3.js → consent-BXLIrMl8.js} +2 -2
- package/dist/{consent-BD7F29T3.js.map → consent-BXLIrMl8.js.map} +1 -1
- package/dist/{console-CdwIYOMV.js → console-C1d3LwB7.js} +14 -14
- package/dist/console-C1d3LwB7.js.map +1 -0
- package/dist/{context-AXdAh-q8.js → context--JwaHaZp.js} +6 -5
- package/dist/context--JwaHaZp.js.map +1 -0
- package/dist/{daemon-Cp7oNXth.js → daemon-w30PsdwV.js} +2 -2
- package/dist/{daemon-Cp7oNXth.js.map → daemon-w30PsdwV.js.map} +1 -1
- package/dist/{db-DBbKpjYX.js → db-DQZK9n9c.js} +52 -51
- package/dist/db-DQZK9n9c.js.map +1 -0
- package/dist/{derive-ae9UOoOB.js → derive-C3ezmY-p.js} +105 -133
- package/dist/derive-C3ezmY-p.js.map +1 -0
- package/dist/{dev-C93d4QIv.js → dev-PY5h4O6u.js} +142 -84
- package/dist/dev-PY5h4O6u.js.map +1 -0
- package/dist/dev-db/attver.d.ts +32 -0
- package/dist/dev-db/pull.d.ts +15 -1
- package/dist/{dev-preflight-Cxv3TiD1.js → dev-preflight-DjvcV6SK.js} +5 -5
- package/dist/dev-preflight-DjvcV6SK.js.map +1 -0
- package/dist/{dev-server-OJsUGZEB.js → dev-server-BLxCbQEP.js} +2 -2
- package/dist/{dev-server-OJsUGZEB.js.map → dev-server-BLxCbQEP.js.map} +1 -1
- package/dist/{doctor-BBPQUO2g.js → doctor-CnUu8kpM.js} +39 -62
- package/dist/doctor-CnUu8kpM.js.map +1 -0
- package/dist/doctor-environment.d.ts +6 -6
- package/dist/{eject-DABcDnPN.js → eject-Bhzd6hgb.js} +25 -16
- package/dist/eject-Bhzd6hgb.js.map +1 -0
- package/dist/{fold-static-BWzxNn06.js → fold-static-CKewnAPX.js} +5 -3
- package/dist/fold-static-CKewnAPX.js.map +1 -0
- package/dist/{generate-view-IFwCADvb.js → generate-view-CTOluXvH.js} +160 -89
- package/dist/generate-view-CTOluXvH.js.map +1 -0
- package/dist/{generate_sdk-DNmNuFuW.js → generate_sdk-De-aLC1L.js} +120 -137
- package/dist/generate_sdk-De-aLC1L.js.map +1 -0
- package/dist/import-schema-module-Df67TIWj.js +51 -0
- package/dist/import-schema-module-Df67TIWj.js.map +1 -0
- package/dist/index.es.js +64 -51
- package/dist/index.es.js.map +1 -1
- package/dist/{init-vL1DWOeC.js → init-Dtl-IcXf.js} +83 -80
- package/dist/init-Dtl-IcXf.js.map +1 -0
- package/dist/last-dev-database-Dc8cP01o.js +2 -0
- package/dist/{manifest-BtzDy7KQ.js → manifest-C3uLDrrJ.js} +115 -40
- package/dist/manifest-C3uLDrrJ.js.map +1 -0
- package/dist/manifest.d.ts +79 -24
- package/dist/migrate-VrKoi3nB.js +138 -0
- package/dist/migrate-VrKoi3nB.js.map +1 -0
- package/dist/{normalize-imports-Bd5Y4yLp.js → normalize-imports-DwxqEMYq.js} +3 -3
- package/dist/{normalize-imports-Bd5Y4yLp.js.map → normalize-imports-DwxqEMYq.js.map} +1 -1
- package/dist/path-flags-7O5uPBcQ.js +139 -0
- package/dist/path-flags-7O5uPBcQ.js.map +1 -0
- package/dist/{prepare-CTw9NEkh.js → prepare-Ccxspoj-.js} +4 -4
- package/dist/{prepare-CTw9NEkh.js.map → prepare-Ccxspoj-.js.map} +1 -1
- package/dist/project-CLcF5i8c.js +360 -0
- package/dist/project-CLcF5i8c.js.map +1 -0
- package/dist/project-schema-CsSOG2gE.js +30 -0
- package/dist/project-schema-CsSOG2gE.js.map +1 -0
- package/dist/{pull-DDMpsZ5r.js → pull-DRWqBZp5.js} +327 -4
- package/dist/pull-DRWqBZp5.js.map +1 -0
- package/dist/resolve-BY7bSFRT.js +2 -0
- package/dist/resources/derive.d.ts +19 -13
- package/dist/{resources-CPSC5Kcu.js → resources-Dpfs2y8P.js} +5 -4
- package/dist/{resources-CPSC5Kcu.js.map → resources-Dpfs2y8P.js.map} +1 -1
- package/dist/{schema-DtLPsXbT.js → schema-CdDjv5zI.js} +41 -39
- package/dist/schema-CdDjv5zI.js.map +1 -0
- package/dist/schema-dir-Cd1kvYbf.js +98 -0
- package/dist/schema-dir-Cd1kvYbf.js.map +1 -0
- package/dist/schema-reconcile-BAupXfkd.js +2 -0
- package/dist/schema-text-CpNrsuMe.js +73 -0
- package/dist/schema-text-CpNrsuMe.js.map +1 -0
- package/dist/{skills-CbwV6vw_.js → skills-CXjA9TWw.js} +54 -10
- package/dist/skills-CXjA9TWw.js.map +1 -0
- package/dist/{start-YOr3X5Zm.js → start-Bwbtt2W5.js} +7 -10
- package/dist/{start-YOr3X5Zm.js.map → start-Bwbtt2W5.js.map} +1 -1
- package/dist/{status-BREvtzJm.js → status-D7XCGHu2.js} +12 -12
- package/dist/status-D7XCGHu2.js.map +1 -0
- package/dist/{storage-CO9ouK76.js → storage-iTqj5-Av.js} +12 -11
- package/dist/storage-iTqj5-Av.js.map +1 -0
- package/dist/{telemetry-DwK5RQJl.js → telemetry-BP_1Cl9r.js} +4 -4
- package/dist/{telemetry-DwK5RQJl.js.map → telemetry-BP_1Cl9r.js.map} +1 -1
- package/dist/{telemetry-CgwJPVMO.js → telemetry-M3HjlyhZ.js} +2 -2
- package/dist/{telemetry-CgwJPVMO.js.map → telemetry-M3HjlyhZ.js.map} +1 -1
- package/dist/{upgrade-B7sVwL8S.js → upgrade-oZzJ13jM.js} +5 -4
- package/dist/{upgrade-B7sVwL8S.js.map → upgrade-oZzJ13jM.js.map} +1 -1
- package/dist/utils/backend-guard.d.ts +47 -0
- package/dist/utils/cms-directories.d.ts +6 -0
- package/dist/utils/dev-preflight.d.ts +2 -2
- package/dist/utils/import-schema-module.d.ts +16 -0
- package/dist/utils/path-flags.d.ts +35 -16
- package/dist/utils/project-schema.d.ts +40 -0
- package/dist/utils/project.d.ts +8 -2
- package/dist/utils/schema-dir.d.ts +32 -0
- package/dist/utils/schema-drift.d.ts +6 -0
- package/dist/utils/schema-text.d.ts +24 -0
- package/dist/verify-5p_vaUG2.js +1160 -0
- package/dist/verify-5p_vaUG2.js.map +1 -0
- package/package.json +11 -8
- package/runtime/dev-server.mjs +5 -1
- package/templates/eject/Dockerfile +1 -4
- package/templates/eject/backend/src/env.ts +1 -1
- package/templates/eject/backend/src/index.ts +53 -40
- package/templates/eject/docker-compose.custom.yml +1 -1
- package/templates/overlays/baas/README.md +39 -12
- package/templates/overlays/baas/ai-instructions.md +8 -8
- package/templates/overlays/baas/{config → backend}/storage.ts +3 -4
- package/templates/overlays/baas/backend/tsconfig.json +10 -12
- package/templates/overlays/baas/package.json +1 -2
- package/templates/overlays/baas/pnpm-workspace.yaml +0 -1
- package/templates/presets/blank/backend/schema/index.ts +19 -0
- package/templates/presets/blank/frontend/src/App.tsx +56 -0
- package/templates/presets/ecommerce/backend/schema/categories.ts +12 -0
- package/templates/presets/ecommerce/backend/schema/index.ts +23 -0
- package/templates/presets/ecommerce/backend/schema/orders.ts +13 -0
- package/templates/presets/ecommerce/backend/schema/products.ts +18 -0
- package/templates/presets/ecommerce/frontend/src/App.tsx +59 -0
- package/templates/presets/ecommerce/frontend/src/cms/categories.tsx +12 -0
- package/templates/presets/ecommerce/frontend/src/cms/orders.tsx +38 -0
- package/templates/presets/ecommerce/frontend/src/cms/products.tsx +27 -0
- package/templates/resource-graphs/blank.json +2 -2
- package/templates/resource-graphs/blog.json +5 -5
- package/templates/resource-graphs/ecommerce.json +5 -5
- package/templates/resource-graphs/headless.json +1 -1
- package/templates/template/.claude/hooks/post-edit-collection.sh +27 -23
- package/templates/template/.cursorrules +2 -2
- package/templates/template/.env.example +6 -17
- package/templates/template/.github/copilot-instructions.md +2 -2
- package/templates/template/.windsurfrules +2 -2
- package/templates/template/AGENTS.md +2 -2
- package/templates/template/CLAUDE.md +2 -2
- package/templates/template/README.md +47 -13
- package/templates/template/ai-instructions.md +15 -14
- package/templates/template/backend/functions/hello.ts +1 -1
- package/templates/template/backend/package.json +0 -2
- package/templates/template/{config → backend}/resources.ts +3 -3
- package/templates/template/backend/schema/authors.ts +11 -0
- package/templates/template/backend/schema/index.ts +29 -0
- package/templates/template/backend/schema/posts.ts +29 -0
- package/templates/template/backend/schema/tags.ts +9 -0
- package/templates/template/backend/schema/users.ts +32 -0
- package/templates/template/{config → backend}/storage.ts +4 -4
- package/templates/template/backend/tsconfig.json +15 -20
- package/templates/template/docker-compose.yml +3 -3
- package/templates/template/frontend/package.json +0 -2
- package/templates/template/frontend/src/App.tsx +10 -4
- package/templates/template/frontend/src/cms/authors.tsx +7 -0
- package/templates/template/frontend/src/cms/posts.tsx +27 -0
- package/templates/template/frontend/src/cms/tags.tsx +11 -0
- package/templates/template/frontend/src/cms/ui-config.json +3 -0
- package/templates/template/frontend/src/cms/users.tsx +54 -0
- package/templates/template/frontend/src/{virtual.d.ts → vite-env.d.ts} +0 -4
- package/templates/template/frontend/vite.config.ts +6 -2
- package/templates/template/gitignore +1 -1
- package/templates/template/package.json +1 -2
- package/templates/template/pnpm-workspace.yaml +0 -1
- package/templates/template/scripts/example.ts +3 -3
- package/templates/template/tsconfig.json +1 -1
- package/templates/views/AppView.tsx.tmpl +4 -4
- package/templates/views/EntityView.tsx.tmpl +3 -4
- package/dist/api-keys-Dfw5-9s1.js.map +0 -1
- package/dist/apps-MKQbgDtN.js.map +0 -1
- package/dist/build-BuKTnec8.js.map +0 -1
- package/dist/bundle-BAH4FCju.js.map +0 -1
- package/dist/cloud-Cj5ey3l_.js.map +0 -1
- package/dist/collection-drift-BKj_BoMq.js +0 -106
- package/dist/collection-drift-BKj_BoMq.js.map +0 -1
- package/dist/collections-dir-DlvDhime.js +0 -69
- package/dist/collections-dir-DlvDhime.js.map +0 -1
- package/dist/console-CdwIYOMV.js.map +0 -1
- package/dist/context-AXdAh-q8.js.map +0 -1
- package/dist/db-DBbKpjYX.js.map +0 -1
- package/dist/derive-ae9UOoOB.js.map +0 -1
- package/dist/dev-C93d4QIv.js.map +0 -1
- package/dist/dev-preflight-Cxv3TiD1.js.map +0 -1
- package/dist/doctor-BBPQUO2g.js.map +0 -1
- package/dist/eject-DABcDnPN.js.map +0 -1
- package/dist/fold-static-BWzxNn06.js.map +0 -1
- package/dist/generate-view-IFwCADvb.js.map +0 -1
- package/dist/generate_sdk-DNmNuFuW.js.map +0 -1
- package/dist/init-vL1DWOeC.js.map +0 -1
- package/dist/last-dev-database-DpW5dfoX.js +0 -2
- package/dist/manifest-BtzDy7KQ.js.map +0 -1
- package/dist/path-flags-DNvtEi2-.js +0 -92
- package/dist/path-flags-DNvtEi2-.js.map +0 -1
- package/dist/project-CasK56vN.js.map +0 -1
- package/dist/pull-DDMpsZ5r.js.map +0 -1
- package/dist/resolve-D647F1LA.js +0 -2
- package/dist/schema-DtLPsXbT.js.map +0 -1
- package/dist/schema-reconcile-DkArN9jF.js +0 -2
- package/dist/skills-CbwV6vw_.js.map +0 -1
- package/dist/status-BREvtzJm.js.map +0 -1
- package/dist/storage-CO9ouK76.js.map +0 -1
- package/dist/utils/collection-drift.d.ts +0 -27
- package/dist/utils/collections-dir.d.ts +0 -14
- package/dist/verify-Y3rWSgfA.js +0 -730
- package/dist/verify-Y3rWSgfA.js.map +0 -1
- package/templates/overlays/baas/config/index.ts +0 -24
- package/templates/overlays/baas/config/package.json +0 -30
- package/templates/template/config/cms.d.ts +0 -15
- package/templates/template/config/collections/authors.ts +0 -47
- package/templates/template/config/collections/index.ts +0 -44
- package/templates/template/config/collections/posts.ts +0 -94
- package/templates/template/config/collections/presets/blank/index.ts +0 -5
- package/templates/template/config/collections/presets/ecommerce/categories.ts +0 -42
- package/templates/template/config/collections/presets/ecommerce/index.ts +0 -31
- package/templates/template/config/collections/presets/ecommerce/orders.ts +0 -78
- package/templates/template/config/collections/presets/ecommerce/products.ts +0 -73
- package/templates/template/config/collections/tags.ts +0 -27
- package/templates/template/config/collections/users.ts +0 -149
- package/templates/template/config/frontend-assets.d.ts +0 -17
- package/templates/template/config/index.ts +0 -12
- package/templates/template/config/package.json +0 -30
- package/templates/template/config/tsconfig.json +0 -35
- /package/templates/eject/{config → backend}/resources.ts +0 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { type AddedDependency } from "./moved-imports.js";
|
|
2
|
+
import type { ManualStep, Note } from "./types.js";
|
|
3
|
+
/** The rules, by the name the report counts them under. */
|
|
4
|
+
export type SdkRule = "collection-call" | "client-options" | "generated-types" | "batch-op" | "type-names" | "error-codes" | "offline-options" | "typed-accessor" | "table-hooks" | "storage-authorize" | "boot-options" | "rule-vocabulary" | "moved-imports";
|
|
5
|
+
/** One `.collection(` left alone, and why. */
|
|
6
|
+
export interface LeftUnchanged {
|
|
7
|
+
file: string;
|
|
8
|
+
line: number;
|
|
9
|
+
code: string;
|
|
10
|
+
reason: string;
|
|
11
|
+
}
|
|
12
|
+
/** What one rewrite run did. */
|
|
13
|
+
export interface SdkRewriteReport {
|
|
14
|
+
/** Files rewritten, relative to the root, with how many edits each. */
|
|
15
|
+
files: {
|
|
16
|
+
path: string;
|
|
17
|
+
edits: number;
|
|
18
|
+
}[];
|
|
19
|
+
/** Edits by rule. */
|
|
20
|
+
counts: Partial<Record<SdkRule, number>>;
|
|
21
|
+
left: LeftUnchanged[];
|
|
22
|
+
manualSteps: ManualStep[];
|
|
23
|
+
notes: Note[];
|
|
24
|
+
/** Generated SDK files found (not rewritten). */
|
|
25
|
+
generated: string[];
|
|
26
|
+
/** Whether receivers were checked by type in at least one file. */
|
|
27
|
+
typeAware: boolean;
|
|
28
|
+
/** Packages added to a workspace package's dependencies because imports moved there. */
|
|
29
|
+
dependencies: AddedDependency[];
|
|
30
|
+
/**
|
|
31
|
+
* `.collection(` calls rewritten by name alone — an untyped (`any`)
|
|
32
|
+
* receiver that is `dataAsAdmin`, or `.data` with a literal table name —
|
|
33
|
+
* printed under "Rewritten by name — review".
|
|
34
|
+
*/
|
|
35
|
+
byName: {
|
|
36
|
+
file: string;
|
|
37
|
+
line: number;
|
|
38
|
+
code: string;
|
|
39
|
+
}[];
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Whether a JavaScript file is bundled or minified output — a vendored build of
|
|
43
|
+
* the client, say. Its identifiers are the bundle's own internals (a build of
|
|
44
|
+
* `@rebasepro/client` reads `maxCachedQueriesPerCollection` from its own
|
|
45
|
+
* options), so rewriting it would break it: it is replaced, not edited.
|
|
46
|
+
*/
|
|
47
|
+
export declare function isBundledFile(file: string, text: string): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Whether a file is generated SDK output, which `rebase generate-sdk` rewrites:
|
|
50
|
+
* the header Rebase's generators write, or a generated SDK file name. A file
|
|
51
|
+
* some other generator marks "do not edit" (a project's own build step) is
|
|
52
|
+
* the project's code, and is read like any other.
|
|
53
|
+
*/
|
|
54
|
+
export declare function isGeneratedSdkFile(file: string, text: string): boolean;
|
|
55
|
+
/** Every source file of a project the rewrite reads. */
|
|
56
|
+
export declare function sdkSourceFiles(root: string, skipDirs?: readonly string[]): string[];
|
|
57
|
+
/** Options of {@link rewriteSdkCalls}. */
|
|
58
|
+
export interface RewriteSdkOptions {
|
|
59
|
+
/** Files to read instead of the ones on disk (what the migration is about to write). */
|
|
60
|
+
overrides?: ReadonlyMap<string, string>;
|
|
61
|
+
/** Directories not to read (the legacy `config/collections`, which is deleted after the migration). */
|
|
62
|
+
skipDirs?: readonly string[];
|
|
63
|
+
/** Files not to read (what the migration moves out of `config/` and removes). */
|
|
64
|
+
skipFiles?: readonly string[];
|
|
65
|
+
/** Module specifiers → files, for the type checker (the workspace's sources in-repo). */
|
|
66
|
+
aliases?: Record<string, string>;
|
|
67
|
+
/** The `backend/schema` directory a `collectionsDir` boot option becomes. */
|
|
68
|
+
schemaDir?: string;
|
|
69
|
+
/** The legacy collections directory, to recognise a `collectionsDir` that points at it. */
|
|
70
|
+
collectionsDir?: string;
|
|
71
|
+
/** The auth table's module and the collection file it came from (absolute): an `auth.collection` naming either is dropped. */
|
|
72
|
+
authFiles?: readonly string[];
|
|
73
|
+
/**
|
|
74
|
+
* The legacy config package's `package.json`. A file the run writes (an override)
|
|
75
|
+
* that imports a package only that manifest declared — a customization carrying a
|
|
76
|
+
* `@rebasepro/cms-types` type, an action's icon library — gets it added to its own
|
|
77
|
+
* package, at the version config/ declared.
|
|
78
|
+
*/
|
|
79
|
+
configManifest?: string;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Rewrite every source file of the project at `root`. Returns the new content
|
|
83
|
+
* of each file that changed, and the report.
|
|
84
|
+
*/
|
|
85
|
+
export declare function rewriteSdkCalls(root: string, options?: RewriteSdkOptions): Promise<{
|
|
86
|
+
files: Map<string, string>;
|
|
87
|
+
report: SdkRewriteReport;
|
|
88
|
+
}>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type AgentKey } from "../../commands/skills.js";
|
|
2
|
+
import type { ManualStep } from "./types.js";
|
|
3
|
+
/** The agents whose directory in the project holds Rebase skills: a skills manifest, or a `rebase…` entry from an older install. */
|
|
4
|
+
export declare function agentsWithInstalledSkills(projectRoot: string): {
|
|
5
|
+
agent: AgentKey;
|
|
6
|
+
dir: string;
|
|
7
|
+
}[];
|
|
8
|
+
/**
|
|
9
|
+
* The step, or `undefined` when the project holds no installed Rebase skills.
|
|
10
|
+
*
|
|
11
|
+
* @param projectRoot the project being migrated
|
|
12
|
+
*/
|
|
13
|
+
export declare function refreshSkillsStep(projectRoot: string): ManualStep | undefined;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { ModuleImporter } from "./load-legacy.js";
|
|
2
|
+
import type { CollectionEntry, PlanContext } from "./plan-context.js";
|
|
3
|
+
/** One constant split in two. */
|
|
4
|
+
export interface SplitConstant {
|
|
5
|
+
/** The legacy module, absolute. */
|
|
6
|
+
module: string;
|
|
7
|
+
/** The legacy export name (`LOCALE_ENUM`). */
|
|
8
|
+
legacyName: string;
|
|
9
|
+
/** The values, in order. */
|
|
10
|
+
ids: (string | number)[];
|
|
11
|
+
/** The label of each value. */
|
|
12
|
+
labels: Record<string, string>;
|
|
13
|
+
/** `LOCALES`, written in `backend/lib/<name>.ts`. */
|
|
14
|
+
valuesName: string;
|
|
15
|
+
/** `Locale`. */
|
|
16
|
+
typeName: string;
|
|
17
|
+
/** `LOCALE_LABELS`, written in `frontend/src/cms/lib/<name>.ts`. */
|
|
18
|
+
labelsName: string;
|
|
19
|
+
/** The backend module, absolute. */
|
|
20
|
+
backendFile: string;
|
|
21
|
+
/** The frontend module, absolute (absent for a project without a frontend). */
|
|
22
|
+
frontendFile?: string;
|
|
23
|
+
/** The collection files that import the legacy module. */
|
|
24
|
+
importedBy: Set<string>;
|
|
25
|
+
}
|
|
26
|
+
/** A module of `config/` that could not be split, and why. */
|
|
27
|
+
export interface UnsplitModule {
|
|
28
|
+
module: string;
|
|
29
|
+
reason: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Find the `config/` modules the collections import that are enum constants
|
|
33
|
+
* and nothing else.
|
|
34
|
+
*/
|
|
35
|
+
export declare function findSplitConstants(plan: PlanContext, entries: readonly CollectionEntry[], importModule: ModuleImporter, cmsDir: string | undefined): Promise<{
|
|
36
|
+
constants: SplitConstant[];
|
|
37
|
+
unsplit: UnsplitModule[];
|
|
38
|
+
}>;
|
|
39
|
+
/** Write the split modules and point the planned tables at the values. */
|
|
40
|
+
export declare function planSplitConstants(plan: PlanContext, constants: readonly SplitConstant[], tableFiles: ReadonlyMap<string, string>): void;
|
|
41
|
+
/** The constant whose labels a field's legacy `enum` restates, when one does. */
|
|
42
|
+
export declare function constantForEnum(constants: readonly SplitConstant[], collectionFile: string, values: unknown): SplitConstant | undefined;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A storage property whose `storagePath` is a function.
|
|
3
|
+
*
|
|
4
|
+
* On 0.30 the panel called the function to choose where an upload goes, and
|
|
5
|
+
* the server enforced the property's `maxSize` / `acceptedFiles` only for an
|
|
6
|
+
* upload that named the property (a function path claimed no keys). On 0.31
|
|
7
|
+
* the split is explicit: the panel's function is the customization's
|
|
8
|
+
* `storage.path`, and the column's `path` template is where the server
|
|
9
|
+
* enforces the limits for any upload landing there — in addition to an upload
|
|
10
|
+
* that names the column.
|
|
11
|
+
*
|
|
12
|
+
* So the column needs a template that claims exactly the keys the function
|
|
13
|
+
* produces. When the function returns one template literal (or string), the
|
|
14
|
+
* template is its static text with each interpolation as `{path}` (any number
|
|
15
|
+
* of segments — an interpolated value may hold a `/`): `` `${owner}/cv` ``
|
|
16
|
+
* → `{path}/cv`, which matches every key the function can write and keys of
|
|
17
|
+
* that same shape only. With no static text at all (or a function the codemod
|
|
18
|
+
* cannot read), no template would be faithful: the lift refuses it, with what
|
|
19
|
+
* to write.
|
|
20
|
+
*/
|
|
21
|
+
import type { LiftNote } from "@rebasepro/common/migrate";
|
|
22
|
+
import type { CollectionEntry, PlanContext } from "./plan-context.js";
|
|
23
|
+
/**
|
|
24
|
+
* Replace each derivable function `storagePath` of the evaluated collections
|
|
25
|
+
* with its template, and return the functions as lift notes (`browser`), so
|
|
26
|
+
* the customization carries them as `storage.path`.
|
|
27
|
+
*/
|
|
28
|
+
export declare function deriveStoragePaths(plan: PlanContext, entries: readonly CollectionEntry[]): LiftNote[];
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The vocabulary of the collections-to-tables codemod: what it was asked to
|
|
3
|
+
* do, and what it reports back. The report is the machine-readable answer
|
|
4
|
+
* (`--json`) and the source of the human one.
|
|
5
|
+
*/
|
|
6
|
+
import type { SdkRewriteReport } from "./sdk-calls.js";
|
|
7
|
+
/** Where a construct the codemod looked at lives in the legacy source. */
|
|
8
|
+
export interface SourceLocation {
|
|
9
|
+
/** The file, relative to the project root. */
|
|
10
|
+
file: string;
|
|
11
|
+
/** 1-based line, when the construct has one. */
|
|
12
|
+
line?: number;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Something the codemod could not convert without guessing. Any refusal
|
|
16
|
+
* blocks the write: nothing is written, and each one names what to change.
|
|
17
|
+
*/
|
|
18
|
+
export interface Refusal extends SourceLocation {
|
|
19
|
+
/** The collection's slug, when the refusal is about one collection. */
|
|
20
|
+
collection?: string;
|
|
21
|
+
/** The property or field it is about. */
|
|
22
|
+
key?: string;
|
|
23
|
+
/** Why, and what to write instead. */
|
|
24
|
+
reason: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* A step the codemod leaves to the user, with the exact text to apply. A
|
|
28
|
+
* manual step does not block the write: the migrated project fails loudly
|
|
29
|
+
* (a type error, a refusal at boot) until the step is done.
|
|
30
|
+
*/
|
|
31
|
+
export interface ManualStep {
|
|
32
|
+
/** A short title: "Mount the table customizations". */
|
|
33
|
+
title: string;
|
|
34
|
+
/** What to do, in full. */
|
|
35
|
+
detail: string;
|
|
36
|
+
/** Code to paste, when there is some. */
|
|
37
|
+
snippet?: string;
|
|
38
|
+
/** The file it is about, relative to the project root. */
|
|
39
|
+
file?: string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* A fact worth reading that needs no action: a carried construct, a
|
|
43
|
+
* post-declaration assignment that evaluation resolved, a dropped default.
|
|
44
|
+
*/
|
|
45
|
+
export interface Note extends SourceLocation {
|
|
46
|
+
collection?: string;
|
|
47
|
+
message: string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* A security rule carried as written that compiles to a policy granting
|
|
51
|
+
* something different than it did on the previous version (a lift note of
|
|
52
|
+
* kind `meaning`). The codemod's SQL check compares the migrated schema with
|
|
53
|
+
* the legacy collections lifted by the same compiler, so it cannot see these:
|
|
54
|
+
* they are listed under "Review before deploying", and `--check` exits 1
|
|
55
|
+
* while one is present unless `--accept-rule-changes` acknowledges them.
|
|
56
|
+
*/
|
|
57
|
+
export interface RuleChange extends SourceLocation {
|
|
58
|
+
/** The collection's slug, or `defaultSecurityRules`. */
|
|
59
|
+
collection: string;
|
|
60
|
+
/** Which rule: `securityRules[2]`, `defaultSecurityRules[0]`. */
|
|
61
|
+
rule: string;
|
|
62
|
+
/** What it did, what it does now, and what to write instead. */
|
|
63
|
+
message: string;
|
|
64
|
+
}
|
|
65
|
+
/** One file the codemod writes, as planned. */
|
|
66
|
+
export interface PlannedFile {
|
|
67
|
+
/** Relative to the project root, `/`-separated. */
|
|
68
|
+
path: string;
|
|
69
|
+
/** The full content. */
|
|
70
|
+
content: string;
|
|
71
|
+
/** `create` for a new file, `update` when it replaces one, `unchanged` when the file already holds exactly this. */
|
|
72
|
+
action: "create" | "update" | "unchanged";
|
|
73
|
+
/** Why it is written: "table posts", "customization posts", "rebase.json"… */
|
|
74
|
+
role: string;
|
|
75
|
+
}
|
|
76
|
+
/** What one legacy collection became. */
|
|
77
|
+
export interface CollectionOutcome {
|
|
78
|
+
slug: string;
|
|
79
|
+
/** The collection file, relative to the project root. */
|
|
80
|
+
file: string;
|
|
81
|
+
/** `table`, `auth-table`, `view`, `firestore`, or `refused`. */
|
|
82
|
+
kind: "table" | "auth-table" | "view" | "firestore" | "refused";
|
|
83
|
+
/** The backend module written for it. */
|
|
84
|
+
backendFile?: string;
|
|
85
|
+
/** The `customizeTable` / `defineFirestoreCollection` module written for it, when its presentation was not the default. */
|
|
86
|
+
frontendFile?: string;
|
|
87
|
+
}
|
|
88
|
+
/** The outcome of the SQL-identity check. */
|
|
89
|
+
export interface VerificationResult {
|
|
90
|
+
/** Whether every rendered output was byte-identical. */
|
|
91
|
+
identical: boolean;
|
|
92
|
+
/** How many outputs were compared. */
|
|
93
|
+
compared: number;
|
|
94
|
+
/** The outputs that differ, each with a unified diff. */
|
|
95
|
+
differences: {
|
|
96
|
+
output: string;
|
|
97
|
+
diff: string;
|
|
98
|
+
}[];
|
|
99
|
+
/** Set when the check could not run at all. */
|
|
100
|
+
error?: string;
|
|
101
|
+
}
|
|
102
|
+
/** The whole report. */
|
|
103
|
+
export interface MigrationReport {
|
|
104
|
+
/** The project root, absolute. */
|
|
105
|
+
projectRoot: string;
|
|
106
|
+
/** `migrated` (written and verified), `planned` (dry run), `checked` (`--check`), `already-migrated`, `blocked` (refusals), `failed` (verification), `rule-changes` (`--check` matched, but rules change meaning and `--accept-rule-changes` was not given). */
|
|
107
|
+
status: "migrated" | "planned" | "checked" | "already-migrated" | "blocked" | "failed" | "rule-changes";
|
|
108
|
+
collections: CollectionOutcome[];
|
|
109
|
+
files: PlannedFile[];
|
|
110
|
+
refusals: Refusal[];
|
|
111
|
+
notes: Note[];
|
|
112
|
+
manualSteps: ManualStep[];
|
|
113
|
+
/** Rules whose meaning changes with the migration: review them before deploying. */
|
|
114
|
+
ruleChanges: RuleChange[];
|
|
115
|
+
verification?: VerificationResult;
|
|
116
|
+
/** What the SDK-call rewrite did (absent with `skipSdkCalls`). */
|
|
117
|
+
sdk?: SdkRewriteReport;
|
|
118
|
+
/** The `git rm -r` line to run once verification passed: deleting the legacy files is the user's step. */
|
|
119
|
+
removeCommand?: string;
|
|
120
|
+
}
|
|
121
|
+
/** The modes of one run. */
|
|
122
|
+
export interface MigrateOptions {
|
|
123
|
+
/** The project root: the directory holding `rebase.json` and `config/`. */
|
|
124
|
+
projectRoot: string;
|
|
125
|
+
/** Plan and print; write nothing. */
|
|
126
|
+
dryRun?: boolean;
|
|
127
|
+
/** Verify an already migrated tree against the legacy collections; write nothing. */
|
|
128
|
+
check?: boolean;
|
|
129
|
+
/** Run on a dirty (or absent) git tree, and replace files that differ from what the codemod writes. */
|
|
130
|
+
force?: boolean;
|
|
131
|
+
/**
|
|
132
|
+
* Module specifiers mapped to files for evaluating the project's modules
|
|
133
|
+
* (`@rebasepro/types` → its source). Tests and the in-repo corpora use it;
|
|
134
|
+
* a user's project resolves through its own `node_modules`.
|
|
135
|
+
*/
|
|
136
|
+
moduleAliases?: Record<string, string>;
|
|
137
|
+
/** Leave the project's SDK calls as they are (`--skip-sdk-calls`); by default they are rewritten too. */
|
|
138
|
+
skipSdkCalls?: boolean;
|
|
139
|
+
/**
|
|
140
|
+
* `--accept-rule-changes`: the {@link RuleChange}s were reviewed. Without
|
|
141
|
+
* it, a `--check` run that finds one ends `rule-changes` (exit 1).
|
|
142
|
+
*/
|
|
143
|
+
acceptRuleChanges?: boolean;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* One exported name that left where a 0.30 project imported it from
|
|
147
|
+
* (`moved-symbols.generated.ts`, `export-changes.ts`). `rebase migrate
|
|
148
|
+
* sdk-calls` moves the import when `to` is a package, and prints a manual step
|
|
149
|
+
* with `instead` when `to` is null.
|
|
150
|
+
*/
|
|
151
|
+
export interface MovedSymbol {
|
|
152
|
+
/** The exported name, as a 0.30 project imported it. */
|
|
153
|
+
symbol: string;
|
|
154
|
+
/** The module specifier it was imported from (`@rebasepro/common`). */
|
|
155
|
+
from: string;
|
|
156
|
+
/** The module specifier to import it from now, or null when the codemod does not rewrite it. */
|
|
157
|
+
to: string | null;
|
|
158
|
+
/** The name it is exported under now, when it was renamed. */
|
|
159
|
+
as?: string;
|
|
160
|
+
/** With `to: null`: what a project writes instead. */
|
|
161
|
+
instead?: string;
|
|
162
|
+
/** The upgrade-guide section that explains it (`#133-…`), when there is one. */
|
|
163
|
+
guide?: string;
|
|
164
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The proof that a migration is lossless: the legacy collections and the
|
|
3
|
+
* migrated tables render the same SQL.
|
|
4
|
+
*
|
|
5
|
+
* "Before" is the collections exactly as the legacy loader serves them.
|
|
6
|
+
* "After" is `backend/schema` read back through the new pipeline —
|
|
7
|
+
* `loadBackendSchema` (index authority, sibling check, compile) with the CLI's
|
|
8
|
+
* jiti importer, compiled by `compileLoadedSchema`, the one compile boot, the
|
|
9
|
+
* runtime and the CLI share. The planner reads only compiled tables, so
|
|
10
|
+
* "before" is the legacy collections lifted (`collectionsToTableDefs`, the
|
|
11
|
+
* codemod's own core) and compiled. Both go through
|
|
12
|
+
* `renderSchemaOutputs`, the renderer the plan-golden corpus is recorded
|
|
13
|
+
* with: DDL under every option, policies, search, vector, triggers, views,
|
|
14
|
+
* the Drizzle schema and the boot plans. A single byte of difference fails.
|
|
15
|
+
*/
|
|
16
|
+
import type { LegacyCollectionConfig } from "@rebasepro/common/migrate";
|
|
17
|
+
import type { ModuleImporter } from "./load-legacy.js";
|
|
18
|
+
import type { VerificationResult } from "./types.js";
|
|
19
|
+
/** The lines around the first and last difference of two texts, as a unified-style excerpt. */
|
|
20
|
+
export declare function describeDifference(before: string, after: string, context?: number, limit?: number): string;
|
|
21
|
+
/**
|
|
22
|
+
* Compare what the legacy collections and the migrated schema render.
|
|
23
|
+
*
|
|
24
|
+
* @param legacy the Postgres collections as the legacy loader serves them
|
|
25
|
+
* @param schemaDir the migrated `backend/schema`, absolute
|
|
26
|
+
*/
|
|
27
|
+
export declare function verifyMigration(legacy: readonly LegacyCollectionConfig[], schemaDir: string, importModule: ModuleImporter): Promise<VerificationResult>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where each legacy presentation key goes in `customizeTable`.
|
|
3
|
+
*
|
|
4
|
+
* A migration tool legitimately freezes legacy knowledge, so the table lives
|
|
5
|
+
* here — written out in full, one entry per legacy key, as plain data. It is
|
|
6
|
+
* guarded against the real surface by `tooling/scripts/test/codemod-vocabulary.test.mjs`
|
|
7
|
+
* (`pnpm test:gates`): every destination must be a key `customizeTable`
|
|
8
|
+
* accepts (`TABLE_CUSTOMIZATION_KEYS` / `FIELD_CUSTOMIZATION_KEYS` in
|
|
9
|
+
* `@rebasepro/cms-types`), every renamed key must agree with the hint
|
|
10
|
+
* `customizeTable` refuses the old name with, and every legacy `admin` key
|
|
11
|
+
* (`ADMIN_COLLECTION_KEYS` / `ADMIN_PROPERTY_KEYS` in `@rebasepro/cms-types`) must
|
|
12
|
+
* have an entry here — a destination, or an explicit `dropped` with why.
|
|
13
|
+
*
|
|
14
|
+
* A destination is a key of the customization (`"fieldOrder"`) or a path into
|
|
15
|
+
* one (`"kanban.orderField"`). Keep the literals plain: the gate test reads
|
|
16
|
+
* this file as source.
|
|
17
|
+
*/
|
|
18
|
+
/** Where a legacy key goes: a customization key or path, or why it has none. */
|
|
19
|
+
export type Destination = string | {
|
|
20
|
+
dropped: string;
|
|
21
|
+
};
|
|
22
|
+
/** A collection's `admin` keys → `customizeTable` options. */
|
|
23
|
+
export declare const COLLECTION_ADMIN_DESTINATIONS: Readonly<Record<string, Destination>>;
|
|
24
|
+
/** Keys inside a collection's `admin.kanban` → keys of `customizeTable`'s `kanban`. */
|
|
25
|
+
export declare const KANBAN_DESTINATIONS: Readonly<Record<string, string>>;
|
|
26
|
+
/** A property's `admin` keys → field-customization options. `disabled: { hidden: true }` also becomes `hiddenInForm`. */
|
|
27
|
+
export declare const PROPERTY_ADMIN_DESTINATIONS: Readonly<Record<string, Destination>>;
|
|
28
|
+
/** Presentation fields of a collection outside its `admin` block (what the lift reports as not carried). */
|
|
29
|
+
export declare const COLLECTION_FIELD_DESTINATIONS: Readonly<Record<string, Destination>>;
|
|
30
|
+
/** Presentation fields of a property outside its `admin` block. Labels equal to the derived one are dropped on the way. */
|
|
31
|
+
export declare const PROPERTY_FIELD_DESTINATIONS: Readonly<Record<string, Destination>>;
|
|
32
|
+
/**
|
|
33
|
+
* Keys of a rule source renamed with the move to tables, by where they are
|
|
34
|
+
* written: the argument of `policy.existsIn(…)` / a literal
|
|
35
|
+
* `{ kind: "existsIn", … }` (`ExistsInPolicyExpression` in `@rebasepro/types`),
|
|
36
|
+
* and a tenant's `membership: { … }` source (`TenantMembershipSource`). The
|
|
37
|
+
* SDK-call pass (`sdk-calls.ts`, rule 11) applies them to the project's own
|
|
38
|
+
* code; the gate test holds each new key to the type's members.
|
|
39
|
+
*/
|
|
40
|
+
export declare const RULE_KEY_RENAMES: Readonly<Record<"existsIn" | "membership", Readonly<Record<string, string>>>>;
|