@voltro/cli 0.33.0 → 0.35.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/CHANGELOG.md +1968 -0
- package/bin/nodeEnvironment.d.mts +30 -0
- package/bin/nodeEnvironment.mjs +158 -0
- package/bin/voltro.mjs +69 -5
- package/dist/addCommand-BNeoeSxe.js +124 -0
- package/dist/addCommand-aXSQveak.js +2 -0
- package/dist/agentsMd-BTchIZku.js +2 -0
- package/dist/agentsMd-mhQMF1bx.js +254 -0
- package/dist/apiBuild-B8aoJvuw.js +2 -0
- package/dist/{apiBuild-h9VHtnlw.js → apiBuild-DYD_ONLD.js} +46 -46
- package/dist/{appGraph-gQ_6GkQQ.js → appGraph-KGDPTuTy.js} +1 -1
- package/dist/appGraph-zuMGKVYX.js +2 -0
- package/dist/appPort-B_HpJ_ck.js +48 -0
- package/dist/baselineCommand-C2ClWZN3.js +2 -0
- package/dist/baselineCommand-DIttzO8A.js +227 -0
- package/dist/bin.js +71 -28
- package/dist/build-CD8K4XOr.js +711 -0
- package/dist/cacheCommand-DA4OH9xt.js +42 -0
- package/dist/capabilitiesCommand-nq_pz5xd.js +123 -0
- package/dist/checkCommand-Ct9xkTrS.js +232 -0
- package/dist/checkCommand-DKpDLlqu.js +2 -0
- package/dist/{cliArgs-qdZSElM3.js → cliArgs-D4p8n7EE.js} +12 -1
- package/dist/cliError-BmdYnghb.js +10 -0
- package/dist/cliOutput-D1tSBoRM.js +15 -0
- package/dist/{cliRuntime-Oh517vCV.js → cliRuntime-Dh7UDinH.js} +20 -20
- package/dist/cloudClient-DWL-Hw_T.js +67 -0
- package/dist/cloudCmd-Cvv5HGaZ.js +364 -0
- package/dist/clusterCmd-D5wsCmA_.js +54 -0
- package/dist/codegen-CYM3Zqrf.js +605 -0
- package/dist/codegen-ChBi_hVa.js +2 -0
- package/dist/codegenCommand-C4YoQIc2.js +30 -0
- package/dist/codemodRunner-BnFq3Fgu.js +5384 -0
- package/dist/commandRunner-BLAEFLjp.js +47 -0
- package/dist/commands-BE8E7zF3.js +816 -0
- package/dist/connectionConfig-UFlIEiys.js +66 -0
- package/dist/dashboardCommand-D7SgZGaN.js +25 -0
- package/dist/dataCommand-BhYwDgg-.js +537 -0
- package/dist/dataProfile-dW-PsfLB.js +15 -0
- package/dist/dbCommand-DS4b97Is.js +2 -0
- package/dist/{dbCommand-DTLKAfbA.js → dbCommand-O8HA63s2.js} +552 -402
- package/dist/{dev-C_P8FLSx.js → dev-C7sFZq3m.js} +3670 -3169
- package/dist/dev-D2BikO7a.js +3 -0
- package/dist/devActivity-Dx_3nnGv.js +100 -0
- package/dist/devActivity.js +1 -1
- package/dist/dialectDriver-CgXnDfec.js +39 -0
- package/dist/discover-C9XKJDco.js +25 -0
- package/dist/doctorCommand-CM4Ch9C7.js +2 -0
- package/dist/{checkCommand-xGhRFFg2.js → doctorCommand-DnimF5IM.js} +523 -1278
- package/dist/dormancyCommand-QewYug_s.js +69 -0
- package/dist/e2eCmd-BRabZww-.js +147 -0
- package/dist/embeddingsCommand-BfiLS_QI.js +73 -0
- package/dist/envCommand-CCGPRQY1.js +60 -0
- package/dist/evalCommand-6RUfPen4.js +118 -0
- package/dist/evolveCommand-CHsLCtDf.js +281 -0
- package/dist/fileTaxonomy-CJfgOllU.js +457 -0
- package/dist/frameworkTableAssembly-YyVe32Cb.js +2 -0
- package/dist/frameworkTableAssembly-oMPBKqlE.js +511 -0
- package/dist/generateCommand-DbgcUpGw.js +147 -0
- package/dist/index.d.ts +45 -0
- package/dist/index.js +4 -3
- package/dist/infoCommand-DwOgK1t6.js +60 -0
- package/dist/{inspect-BUUjt773.js → inspect-CjTYzAs_.js} +113 -41
- package/dist/inspect-P4pxoMaV.js +2 -0
- package/dist/inspectCmd-EHFZ9yYu.js +224 -0
- package/dist/inspectFetch-EMuhTG_9.js +151 -0
- package/dist/inspectMetrics-CfdKLh6t.js +72 -0
- package/dist/loadEnv-D9nEOClM.js +44 -0
- package/dist/logFileSink-C_D2wRN1.js +105 -0
- package/dist/logsCmd-D36xK7Zu.js +260 -0
- package/dist/manifestBuild-COkJoyAr.js +2 -0
- package/dist/{manifestBuild-BLrVuSlM.js → manifestBuild-hpPLaGxV.js} +1 -1
- package/dist/metaCommands-7MJfZ5cf.js +196 -0
- package/dist/migrate-BV7I-ZHZ.js +83 -0
- package/dist/mssqlClusterPatch-_4cE_nun.js +44 -0
- package/dist/newCommand-COWOJ1_E.js +156 -0
- package/dist/nodeEnvironment-cGFAj1J8.js +28 -0
- package/dist/packageCommand-Cug_3Ogl.js +271 -0
- package/dist/pageConvention-cEiRxdab.js +5 -0
- package/dist/privacyCommand-C-Df56U_.js +146 -0
- package/dist/probeCommand-CZfaaUOZ.js +122 -0
- package/dist/projectScaffold-DmzEKHib.js +2 -0
- package/dist/projectScaffold-LMMtaavR.js +814 -0
- package/dist/renderModeScan-D7J1B7Kw.js +105 -0
- package/dist/renderProfile-1OWWAAtx.js +81 -0
- package/dist/runtimeRegistry-DMeKfTHP.js +81 -0
- package/dist/runtimeTrace-CH3eUiMw.js +91 -0
- package/dist/scheduleCmd-DQRu6BZC.js +149 -0
- package/dist/scheduleManifestCmd-D2x0CTTY.js +249 -0
- package/dist/schemaIr-UJybUUZW.js +103 -0
- package/dist/{sdkgen-C81QIkiL.js → sdkgen-BLkvGRfX.js} +111 -209
- package/dist/seedRunner-ZmLSqNe2.js +333 -0
- package/dist/serveCommand-CbDHU6l-.js +2 -0
- package/dist/serveCommand-iwlUBNS1.js +1766 -0
- package/dist/serveEntry.js +5 -5
- package/dist/serverlessCommand-CfJZy6dS.js +482 -0
- package/dist/start-BgN62boB.js +3 -0
- package/dist/start-T4VesWiM.js +1087 -0
- package/dist/startEntry.js +2 -2
- package/dist/staticCommand-Dr2M6tpU.js +304 -0
- package/dist/storageCommand-Co6NfLqN.js +42 -0
- package/dist/templates-De8IR5-c.js +102 -0
- package/dist/test-CI6iDsYc.js +115 -0
- package/dist/tracesCmd-DStmCJPi.js +232 -0
- package/dist/tsconfigPaths-BWXBWgcl.js +107 -0
- package/dist/tsxLoader-EuXmSJ1K.js +51 -0
- package/dist/typecheckCommand-BlsWiCNq.js +61 -0
- package/dist/updateCommand-BlMZhWgO.js +2 -0
- package/dist/updateCommand-x0pI_x-B.js +585 -0
- package/dist/webDev-BcykISYQ2.js +2 -0
- package/dist/{inspectMetrics-1xzTKAFx.js → webDev-Dybxew86.js} +988 -1560
- package/dist/webhookDiscovery-CrGAfhIG.js +2 -0
- package/dist/webhookDiscovery-D7VaeMlz.js +51 -0
- package/dist/webhooksCommand-DlAgS2Iw.js +267 -0
- package/dist/workflowsCmd-BGF-mRZ5.js +608 -0
- package/package.json +209 -17
- package/templates/AGENTS.core.md +58 -3
- package/templates/AGENTS.md +64 -7
- package/templates/agent-docs/_index.md +6 -4
- package/templates/agent-docs/_manifest.json +23 -6
- package/templates/agent-docs/ai.md +370 -0
- package/templates/agent-docs/authentication.md +313 -31
- package/templates/agent-docs/caching.md +6 -0
- package/templates/agent-docs/cli.md +853 -50
- package/templates/agent-docs/data.md +608 -12
- package/templates/agent-docs/database/migrations.md +223 -25
- package/templates/agent-docs/database/misc.md +156 -40
- package/templates/agent-docs/database/querying.md +19 -1
- package/templates/agent-docs/database/scaling.md +60 -0
- package/templates/agent-docs/database/schema.md +1 -0
- package/templates/agent-docs/database/seedsdialects.md +208 -19
- package/templates/agent-docs/database/transactions.md +68 -0
- package/templates/agent-docs/deployment.md +284 -25
- package/templates/agent-docs/introduction.md +88 -17
- package/templates/agent-docs/local-first-mobile.md +79 -4
- package/templates/agent-docs/multi-tenancy.md +188 -42
- package/templates/agent-docs/observability.md +58 -3
- package/templates/agent-docs/plugins/ai-flows.md +247 -2
- package/templates/agent-docs/plugins/analytics-postgres.md +1 -1
- package/templates/agent-docs/plugins/audit.md +37 -1
- package/templates/agent-docs/plugins/auth-social.md +143 -0
- package/templates/agent-docs/plugins/auth-workos.md +4 -2
- package/templates/agent-docs/plugins/auth.md +131 -6
- package/templates/agent-docs/plugins/billing.md +132 -15
- package/templates/agent-docs/plugins/cdc-out.md +46 -7
- package/templates/agent-docs/plugins/clickhouse.md +32 -1
- package/templates/agent-docs/plugins/duckdb.md +1 -1
- package/templates/agent-docs/plugins/flags.md +132 -0
- package/templates/agent-docs/plugins/governance.md +105 -7
- package/templates/agent-docs/plugins/multitenancy.md +9 -4
- package/templates/agent-docs/plugins/presence.md +13 -2
- package/templates/agent-docs/plugins/ratelimit.md +9 -0
- package/templates/agent-docs/plugins/search.md +162 -8
- package/templates/agent-docs/plugins/sso-saml.md +47 -8
- package/templates/agent-docs/plugins/storage.md +11 -0
- package/templates/agent-docs/plugins/webhooks.md +105 -0
- package/templates/agent-docs/plugins.md +152 -18
- package/templates/agent-docs/reference.md +60 -3
- package/templates/agent-docs/releases.md +1117 -0
- package/templates/agent-docs/routing.md +43 -25
- package/templates/agent-docs/scheduling.md +27 -0
- package/templates/agent-docs/schema-driven-ui.md +92 -12
- package/templates/agent-docs/security.md +426 -0
- package/templates/agent-docs/templates/apibackends.md +87 -18
- package/templates/agent-docs/templates/appshells.md +32 -14
- package/templates/agent-docs/templates/overview.md +13 -8
- package/templates/agent-docs/testing.md +211 -14
- package/templates/agent-docs/whats-new.md +98 -136
- package/templates/agent-docs/workflows.md +231 -14
- package/templates/apps/api-ai/actions/summarize.action.ts +11 -0
- package/templates/apps/api-ai/package.json +8 -7
- package/templates/apps/api-auth/actions/me.action.ts +13 -0
- package/templates/apps/api-auth/package.json +9 -8
- package/templates/apps/api-backend/mutations/notes.create.mutation.ts +9 -0
- package/templates/apps/api-backend/package.json +12 -8
- package/templates/apps/api-backend/queries/notes.query.ts +30 -8
- package/templates/apps/api-backend-deactivation/actions/users.get.action.ts +14 -0
- package/templates/apps/api-backend-deactivation/mutations/users.create.mutation.ts +8 -0
- package/templates/apps/api-backend-deactivation/mutations/users.deactivate.mutation.ts +10 -0
- package/templates/apps/api-backend-deactivation/package.json +8 -7
- package/templates/apps/api-backend-mail/actions/sendWelcome.action.ts +17 -0
- package/templates/apps/api-backend-mail/mutations/notes.create.mutation.ts +9 -0
- package/templates/apps/api-backend-mail/package.json +9 -8
- package/templates/apps/api-backend-mail/queries/notes.query.ts +30 -8
- package/templates/apps/api-backend-mariadb/.env.example +14 -0
- package/templates/apps/api-backend-mariadb/mutations/notes.create.mutation.ts +9 -0
- package/templates/apps/api-backend-mariadb/package.json +10 -9
- package/templates/apps/api-backend-mariadb/queries/notes.query.ts +30 -8
- package/templates/apps/api-backend-sqlite/.env.example +14 -0
- package/templates/apps/api-backend-sqlite/mutations/notes.create.mutation.ts +9 -0
- package/templates/apps/api-backend-sqlite/package.json +9 -8
- package/templates/apps/api-backend-sqlite/queries/notes.query.ts +30 -8
- package/templates/apps/api-backend-storage/actions/uploadAvatar.action.ts +13 -0
- package/templates/apps/api-backend-storage/actions/uploadDocument.action.ts +12 -0
- package/templates/apps/api-backend-storage/mutations/notes.create.mutation.ts +9 -0
- package/templates/apps/api-backend-storage/package.json +9 -8
- package/templates/apps/api-backend-storage/queries/notes.query.ts +30 -8
- package/templates/apps/api-cms/actions/content.get.action.ts +7 -0
- package/templates/apps/api-cms/actions/content.types.action.ts +6 -0
- package/templates/apps/api-cms/actions/me.action.ts +13 -0
- package/templates/apps/api-cms/app.config.ts +19 -0
- package/templates/apps/api-cms/authz.ts +63 -0
- package/templates/apps/api-cms/mutations/content.publish.mutation.ts +10 -0
- package/templates/apps/api-cms/mutations/content.saveDraft.mutation.ts +10 -0
- package/templates/apps/api-cms/mutations/content.unpublish.mutation.ts +5 -0
- package/templates/apps/api-cms/package.json +11 -10
- package/templates/apps/api-cms/queries/content.list.query.ts +23 -7
- package/templates/apps/api-cms/tests/accessDecisions.test.ts +121 -0
- package/templates/apps/api-cms/tests/content.descriptors.test.ts +8 -4
- package/templates/apps/api-collab/mutations/documents.create.mutation.ts +8 -0
- package/templates/apps/api-collab/mutations/documents.setBody.mutation.ts +13 -0
- package/templates/apps/api-collab/package.json +9 -8
- package/templates/apps/api-collab/queries/documents.query.ts +19 -7
- package/templates/apps/api-data-advanced/package.json +9 -8
- package/templates/apps/api-data-advanced/queries/authors.withBooks.query.ts +12 -0
- package/templates/apps/api-data-advanced/queries/books.search.query.ts +9 -0
- package/templates/apps/api-durable/mutations/orders.approve.mutation.ts +17 -0
- package/templates/apps/api-durable/mutations/orders.place.mutation.ts +9 -0
- package/templates/apps/api-durable/package.json +9 -8
- package/templates/apps/api-feature-flags/actions/notes.export.action.ts +16 -0
- package/templates/apps/api-feature-flags/mutations/notes.create.mutation.ts +12 -0
- package/templates/apps/api-feature-flags/package.json +10 -9
- package/templates/apps/api-governance/README.md +30 -8
- package/templates/apps/api-governance/actions/profiles.get.action.server.ts +17 -1
- package/templates/apps/api-governance/actions/profiles.get.action.ts +29 -4
- package/templates/apps/api-governance/database/schema.ts +16 -4
- package/templates/apps/api-governance/mutations/profiles.create.mutation.ts +12 -0
- package/templates/apps/api-governance/package.json +9 -8
- package/templates/apps/api-kv/actions/sync.pull.action.ts +15 -0
- package/templates/apps/api-kv/actions/sync.reset.action.ts +13 -0
- package/templates/apps/api-kv/actions/sync.status.action.ts +7 -0
- package/templates/apps/api-kv/package.json +9 -8
- package/templates/apps/api-kv/queries/events.list.query.ts +19 -8
- package/templates/apps/api-moderation/mutations/comments.create.mutation.ts +11 -0
- package/templates/apps/api-moderation/mutations/posts.create.mutation.ts +13 -0
- package/templates/apps/api-moderation/package.json +9 -8
- package/templates/apps/api-observability/mutations/notes.create.mutation.ts +8 -0
- package/templates/apps/api-observability/package.json +9 -8
- package/templates/apps/api-observability/queries/notes.list.query.ts +13 -0
- package/templates/apps/api-ratelimit/mutations/notes.create.mutation.ts +14 -0
- package/templates/apps/api-ratelimit/package.json +9 -8
- package/templates/apps/api-rbac/package.json +9 -8
- package/templates/apps/api-rest/package.json +8 -7
- package/templates/apps/api-saas/mutations/projects.create.mutation.ts +13 -0
- package/templates/apps/api-saas/package.json +12 -11
- package/templates/apps/api-saas/queries/projects.list.query.ts +11 -0
- package/templates/apps/api-saas-starter/actions/me.action.ts +13 -0
- package/templates/apps/api-saas-starter/app.config.ts +19 -0
- package/templates/apps/api-saas-starter/authz.ts +75 -0
- package/templates/apps/api-saas-starter/mutations/invites.create.mutation.ts +10 -0
- package/templates/apps/api-saas-starter/mutations/projects.create.mutation.ts +9 -0
- package/templates/apps/api-saas-starter/package.json +15 -11
- package/templates/apps/api-saas-starter/queries/invites.list.query.ts +19 -8
- package/templates/apps/api-saas-starter/queries/projects.list.query.ts +18 -7
- package/templates/apps/api-saas-starter/tests/accessDecisions.test.ts +135 -0
- package/templates/apps/api-search/mutations/articles.create.mutation.ts +14 -0
- package/templates/apps/api-search/package.json +9 -8
- package/templates/apps/api-search/queries/articles.list.query.ts +21 -8
- package/templates/apps/api-status/README.md +10 -3
- package/templates/apps/api-status/app.config.ts +8 -3
- package/templates/apps/api-status/authz.ts +5 -3
- package/templates/apps/api-status/package.json +9 -8
- package/templates/apps/api-status/queries/components.list.query.ts +14 -6
- package/templates/apps/api-status/queries/incidents.live.query.ts +23 -10
- package/templates/apps/api-status/queries/updates.list.query.ts +16 -9
- package/templates/apps/api-status/tests/status.test.ts +9 -1
- package/templates/apps/api-versioning/actions/documents.asOf.action.ts +12 -0
- package/templates/apps/api-versioning/actions/documents.history.action.ts +13 -0
- package/templates/apps/api-versioning/mutations/documents.create.mutation.ts +9 -0
- package/templates/apps/api-versioning/mutations/documents.update.mutation.ts +12 -0
- package/templates/apps/api-versioning/package.json +9 -8
- package/templates/apps/api-webhooks/mutations/orders.fulfill.mutation.ts +16 -0
- package/templates/apps/api-webhooks/package.json +10 -9
- package/templates/apps/api-webhooks/queries/orders.list.query.ts +10 -0
- package/templates/apps/changelog/package.json +8 -6
- package/templates/apps/edge-functions/package.json +2 -2
- package/templates/apps/frontend-admin/package.json +10 -8
- package/templates/apps/frontend-admin/src/lib/admin.ts +20 -9
- package/templates/apps/frontend-admin/src/locales/de.ts +11 -1
- package/templates/apps/frontend-admin/src/locales/en.ts +13 -1
- package/templates/apps/frontend-admin/src/pages/admin/[entity]/page.tsx +65 -22
- package/templates/apps/frontend-admin/src/pages/admin/entity.test.tsx +130 -23
- package/templates/apps/frontend-admin/src/pages/admin/layout.tsx +3 -2
- package/templates/apps/frontend-admin/src/pages/admin/page.test.tsx +19 -2
- package/templates/apps/frontend-admin/src/pages/admin/page.tsx +9 -4
- package/templates/apps/frontend-app/app.config.ts +4 -3
- package/templates/apps/frontend-app/package.json +11 -8
- package/templates/apps/frontend-app/src/lib/api.ts +25 -0
- package/templates/apps/frontend-app/src/pages/page.test.tsx +130 -82
- package/templates/apps/frontend-app/src/pages/page.tsx +14 -18
- package/templates/apps/frontend-auth/package.json +10 -8
- package/templates/apps/frontend-blank/package.json +9 -7
- package/templates/apps/frontend-cms/package.json +11 -9
- package/templates/apps/frontend-collab/package.json +12 -9
- package/templates/apps/frontend-collab/src/pages/page.test.tsx +122 -78
- package/templates/apps/frontend-contact/package.json +9 -7
- package/templates/apps/frontend-dashboard/package.json +9 -7
- package/templates/apps/frontend-docs/package.json +9 -7
- package/templates/apps/frontend-i18n/package.json +8 -6
- package/templates/apps/frontend-landing/package.json +9 -7
- package/templates/apps/frontend-portal/package.json +10 -8
- package/templates/apps/frontend-saas/app.config.ts +10 -6
- package/templates/apps/frontend-saas/package.json +10 -8
- package/templates/apps/frontend-saas/src/lib/api.ts +27 -32
- package/templates/apps/frontend-saas/src/pages/dashboard/billing/page.tsx +7 -8
- package/templates/apps/frontend-saas/src/pages/dashboard/page.test.tsx +27 -3
- package/templates/apps/frontend-saas/src/pages/dashboard/page.tsx +4 -4
- package/templates/apps/frontend-saas/src/pages/dashboard/team/page.tsx +3 -4
- package/templates/apps/frontend-spa/package.json +9 -7
- package/templates/apps/frontend-ssr/package.json +9 -7
- package/templates/apps/frontend-ssr-api/package.json +10 -8
- package/templates/apps/frontend-static-blog/package.json +8 -6
- package/templates/apps/frontend-status/package.json +10 -8
- package/templates/apps/mobile-app/README.md +1 -0
- package/templates/apps/mobile-app/package.json +4 -2
- package/templates/apps/mobile-app/src/app/index.tsx +22 -12
- package/templates/apps/mobile-app/src/app/orders/[id].tsx +1 -1
- package/templates/apps/mobile-app/src/lib/api.ts +34 -0
- package/templates/apps/mobile-app/voltro.mobile.ts +4 -2
- package/templates/baselines/bare/.env.example +14 -0
- package/templates/baselines/bare/baseline.json +4 -4
- package/templates/baselines/compose/.env.example +14 -0
- package/templates/baselines/compose/README.md +1 -1
- package/templates/baselines/compose/baseline.json +5 -5
- package/templates/baselines/compose-mariadb/.env.example +14 -0
- package/templates/baselines/compose-mariadb/README.md +1 -1
- package/templates/baselines/compose-mariadb/baseline.json +5 -5
- package/templates/baselines/helm/.env.example +14 -0
- package/templates/baselines/helm/baseline.json +4 -4
- package/dist/apiBuild-C-x9YacA.js +0 -2
- package/dist/appGraph-CvQCte0z.js +0 -2
- package/dist/checkCommand-DRovTKza.js +0 -2
- package/dist/commands-CJfepbm4.js +0 -11541
- package/dist/dbCommand-b1gum4td.js +0 -2
- package/dist/dev-iiMtlkfs.js +0 -3
- package/dist/devActivity-BhIu6ncs.js +0 -159
- package/dist/frameworkTableAssembly-BwIrO5nv.js +0 -638
- package/dist/frameworkTableAssembly-D-EebUQX.js +0 -2
- package/dist/inspect-mmBuRXmy.js +0 -2
- package/dist/manifestBuild-Dj8Jjoto.js +0 -2
- package/dist/seedRunner-Bqxgp7HZ.js +0 -230
- package/dist/serveCommand-DdaM4Hup.js +0 -1608
- package/dist/start-C0koT0UO.js +0 -1084
- /package/templates/apps/api-ai/actions/{summarize.action.server.tsx → summarize.action.server.ts} +0 -0
|
@@ -0,0 +1,605 @@
|
|
|
1
|
+
import { o as e } from "./fileConventions-Cof68_BL.js";
|
|
2
|
+
import { dirname as t, join as n, relative as r, resolve as i } from "node:path";
|
|
3
|
+
import { promises as a, readFileSync as o } from "node:fs";
|
|
4
|
+
import { pathToFileURL as s } from "node:url";
|
|
5
|
+
import { isEventDescriptor as c, isWireReachable as l } from "@voltro/protocol";
|
|
6
|
+
import { undoSurfaceEnabled as u } from "@voltro/runtime";
|
|
7
|
+
import { createHash as d } from "node:crypto";
|
|
8
|
+
import { isAgentDescriptor as f } from "@voltro/ai/agent";
|
|
9
|
+
//#region src/browserSafetyGuard.ts
|
|
10
|
+
var p = /* @__PURE__ */ new Set(/* @__PURE__ */ "crypto.fs.path.os.net.http.https.http2.tls.dns.dgram.stream.zlib.child_process.worker_threads.cluster.readline.vm.module.perf_hooks.async_hooks.inspector.v8.process.tty.repl.constants.sys.string_decoder".split(".")), m = (e) => e.startsWith("node:") || p.has(e) || e === "@voltro/workflow" ? !0 : e === "@voltro/database/wire" ? !1 : e === "@voltro/database" || e.startsWith("@voltro/database/") || e === "@voltro/runtime" || e.startsWith("@voltro/runtime/") ? !0 : e === "@voltro/ai/agent" || e === "@voltro/ai/events" ? !1 : !!(e === "@voltro/ai" || e.startsWith("@voltro/ai/") || [
|
|
11
|
+
"@voltro/protocol/session",
|
|
12
|
+
"@voltro/protocol/jwt",
|
|
13
|
+
"@voltro/protocol/apikey"
|
|
14
|
+
].includes(e) || e === "@voltro/env/server" || e.startsWith("@effect/cluster") || e.startsWith("@effect/sql") || e === "@effect/platform-node" || [
|
|
15
|
+
"pg",
|
|
16
|
+
"postgres",
|
|
17
|
+
"mysql2",
|
|
18
|
+
"tedious",
|
|
19
|
+
"better-sqlite3",
|
|
20
|
+
"ioredis",
|
|
21
|
+
"mongodb",
|
|
22
|
+
"@planetscale/database",
|
|
23
|
+
"@neondatabase/serverless",
|
|
24
|
+
"knex",
|
|
25
|
+
"drizzle-orm",
|
|
26
|
+
"@prisma/client",
|
|
27
|
+
"nodemailer",
|
|
28
|
+
"jose"
|
|
29
|
+
].includes(e)), h = (e) => e.replace(/\/\*[\s\S]*?\*\//g, " ").replace(/(^|[^:])\/\/[^\n]*/g, "$1"), g = (e) => {
|
|
30
|
+
let t = h(e), n = [], r = /(?:^|[\n;}])\s*(?:import|export)\s+([^;'"]*?)\s+from\s+['"]([^'"]+)['"]/g, i;
|
|
31
|
+
for (; (i = r.exec(t)) !== null;) {
|
|
32
|
+
let e = i[1].trim();
|
|
33
|
+
if (e === "type" || e.startsWith("type ")) continue;
|
|
34
|
+
let t = e.match(/^\{([\s\S]*)\}$/);
|
|
35
|
+
if (t) {
|
|
36
|
+
let e = t[1].split(",").map((e) => e.trim()).filter(Boolean);
|
|
37
|
+
if (e.length > 0 && e.every((e) => e.startsWith("type "))) continue;
|
|
38
|
+
}
|
|
39
|
+
n.push(i[2]);
|
|
40
|
+
}
|
|
41
|
+
let a = /(?:^|[\n;}])\s*import\s+['"]([^'"]+)['"]/g;
|
|
42
|
+
for (; (i = a.exec(t)) !== null;) n.push(i[1]);
|
|
43
|
+
let o = /\bimport\(\s*['"]([^'"]+)['"]\s*\)/g;
|
|
44
|
+
for (; (i = o.exec(t)) !== null;) n.push(i[1]);
|
|
45
|
+
return n;
|
|
46
|
+
}, _ = (e) => e.endsWith(".ts") || e.endsWith(".tsx"), v = async (e) => {
|
|
47
|
+
let t = _(e) ? [e] : [
|
|
48
|
+
`${e}.ts`,
|
|
49
|
+
`${e}.tsx`,
|
|
50
|
+
n(e, "index.ts"),
|
|
51
|
+
n(e, "index.tsx")
|
|
52
|
+
];
|
|
53
|
+
for (let e of t) try {
|
|
54
|
+
if ((await a.stat(e)).isFile()) return e;
|
|
55
|
+
} catch {}
|
|
56
|
+
return null;
|
|
57
|
+
}, y = async (e, r) => {
|
|
58
|
+
let i = r;
|
|
59
|
+
for (;;) {
|
|
60
|
+
let r = n(i, "node_modules", e);
|
|
61
|
+
try {
|
|
62
|
+
if ((await a.stat(r)).isDirectory()) return r;
|
|
63
|
+
} catch {}
|
|
64
|
+
let o = t(i);
|
|
65
|
+
if (o === i) return null;
|
|
66
|
+
i = o;
|
|
67
|
+
}
|
|
68
|
+
}, b = (e) => {
|
|
69
|
+
if (typeof e == "string") return e;
|
|
70
|
+
if (typeof e == "object" && e) {
|
|
71
|
+
let t = e;
|
|
72
|
+
for (let e of [
|
|
73
|
+
"import",
|
|
74
|
+
"module",
|
|
75
|
+
"node",
|
|
76
|
+
"default"
|
|
77
|
+
]) if (e in t) {
|
|
78
|
+
let n = b(t[e]);
|
|
79
|
+
if (n !== void 0) return n;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}, x = async (e, r) => {
|
|
83
|
+
if (e.startsWith(".")) return v(i(t(r), e));
|
|
84
|
+
let o = e.split("/"), s = e.startsWith("@"), c = s ? `${o[0]}/${o[1]}` : o[0], l = s ? o.slice(2) : o.slice(1), u = l.length > 0 ? `./${l.join("/")}` : ".", d = await y(c, t(r));
|
|
85
|
+
if (!d) return null;
|
|
86
|
+
try {
|
|
87
|
+
let e = JSON.parse(await a.readFile(n(d, "package.json"), "utf8")), t = b(e.exports?.[u]) ?? (u === "." ? e.module ?? e.main : void 0);
|
|
88
|
+
if (typeof t == "string") return v(i(d, t));
|
|
89
|
+
} catch {}
|
|
90
|
+
return null;
|
|
91
|
+
}, S = (e, t) => e.startsWith(t) ? e.slice(t.length).replace(/^[/\\]/, "") : e, C = async (e, t) => {
|
|
92
|
+
let n = /* @__PURE__ */ new Set(), r = [{
|
|
93
|
+
file: e,
|
|
94
|
+
chain: [S(e, t)]
|
|
95
|
+
}];
|
|
96
|
+
for (; r.length > 0;) {
|
|
97
|
+
let { file: e, chain: i } = r.shift();
|
|
98
|
+
if (n.has(e)) continue;
|
|
99
|
+
n.add(e);
|
|
100
|
+
let o;
|
|
101
|
+
try {
|
|
102
|
+
o = await a.readFile(e, "utf8");
|
|
103
|
+
} catch {
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
for (let a of g(o)) {
|
|
107
|
+
if (m(a)) return {
|
|
108
|
+
specifier: a,
|
|
109
|
+
chain: [...i, a]
|
|
110
|
+
};
|
|
111
|
+
let o = await x(a, e);
|
|
112
|
+
o && !n.has(o) && r.push({
|
|
113
|
+
file: o,
|
|
114
|
+
chain: [...i, `${a} (${S(o, t)})`]
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return null;
|
|
119
|
+
}, w = /\.client\.tsx?$/, T = async (e, t) => {
|
|
120
|
+
let n = [];
|
|
121
|
+
for (let r of t) {
|
|
122
|
+
if (!w.test(r)) continue;
|
|
123
|
+
let t = await C(r, e);
|
|
124
|
+
t !== null && n.push({
|
|
125
|
+
file: S(r, e),
|
|
126
|
+
violation: t
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
return n;
|
|
130
|
+
}, E = (e) => `browser-safety violation — ${e.file} declares itself browser-safe (.client.ts) and is not.\n\n '${e.violation.specifier}' is server-only (node:* / database / ai / cluster / protocol session / db driver).\n\n import chain:\n → ${e.violation.chain.join("\n → ")}\n\n The .client suffix is a claim the framework checks, not a hint. Either move the server-only\n code behind a *.server.ts and keep this file pure, or drop the suffix — an unmarked file\n makes no claim, and only the rpcGroup guard will judge it (later, and with a longer chain).`, D = async (e) => {
|
|
131
|
+
if (process.env.VOLTRO_BROWSER_SAFETY === "off") return;
|
|
132
|
+
let n = await C(e, t(e));
|
|
133
|
+
if (!n) return;
|
|
134
|
+
let r = n.chain.join("\n → ");
|
|
135
|
+
throw Error(`browser-safety violation — the generated rpcGroup pulls a SERVER-ONLY module into the client bundle.\n\n '${n.specifier}' is server-only (node:* / database / ai / cluster / protocol session / db driver),\n and the web client loads rpcGroup VALUE-LEVEL — this crashes the browser with\n "Module …node:crypto… has been externalized for browser compatibility", or bloats the\n bundle with the whole server graph.\n\n import chain:\n → ${r}\n\n Fix: keep the descriptor (*.query/.mutation/.action.ts), the workflow descriptor\n (*.workflow.tsx, import from @voltro/workflow/define), AND any plugin error schema\n browser-safe. Move DB-backed / node: code behind a *.server.ts file or a browser-safe\n subpath (e.g. a plugin's '/errors' export). Escape hatch (not recommended):\n VOLTRO_BROWSER_SAFETY=off.`);
|
|
136
|
+
}, O = /\.(query|mutation|action|stream)\.ts$/, k = /\.(query|mutation|action|stream)\.server\.ts$/, A = /\.workflow\.tsx$/, j = /(?<!\.server)\.agent\.tsx?$/, M = /\.connection\.tsx?$/, N = /* @__PURE__ */ new Set([
|
|
137
|
+
"node_modules",
|
|
138
|
+
"dist",
|
|
139
|
+
"build",
|
|
140
|
+
".turbo",
|
|
141
|
+
".vite",
|
|
142
|
+
".next",
|
|
143
|
+
".git"
|
|
144
|
+
]), P = async (e) => {
|
|
145
|
+
let t = async (e) => {
|
|
146
|
+
let r = await a.readdir(e, { withFileTypes: !0 }).catch(() => []);
|
|
147
|
+
for (let i of r) if (!N.has(i.name)) {
|
|
148
|
+
if (i.isDirectory()) {
|
|
149
|
+
if (await t(n(e, i.name))) return !0;
|
|
150
|
+
} else if (i.isFile() && M.test(i.name)) return !0;
|
|
151
|
+
}
|
|
152
|
+
return !1;
|
|
153
|
+
};
|
|
154
|
+
return t(e);
|
|
155
|
+
}, F = async (t) => {
|
|
156
|
+
let r = [], i = async (t) => {
|
|
157
|
+
let o = await a.readdir(t, { withFileTypes: !0 });
|
|
158
|
+
for (let a of o) {
|
|
159
|
+
if (N.has(a.name)) continue;
|
|
160
|
+
let o = n(t, a.name);
|
|
161
|
+
a.isDirectory() ? await i(o) : a.isFile() && (O.test(a.name) && !k.test(a.name) || A.test(a.name) || j.test(a.name) || e.test(a.name)) && r.push(o);
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
return await i(t), r;
|
|
165
|
+
}, I = (e) => typeof e == "object" && !!e && "kind" in e && "name" in e && (e.kind === "query" || e.kind === "mutation" || e.kind === "action" || e.kind === "stream"), L = Symbol.for("@effect/workflow/Workflow"), R = (e) => typeof e == "object" && !!e && L in e && "name" in e && typeof e.name == "string", z = async (e) => Promise.all(e.map((e) => import(s(e).href))), B = async (e) => {
|
|
166
|
+
let t = [], n = await z(e);
|
|
167
|
+
for (let [r, i] of e.entries()) {
|
|
168
|
+
let e = n[r], a = /* @__PURE__ */ new Set();
|
|
169
|
+
for (let [n, r] of Object.entries(e)) {
|
|
170
|
+
if (typeof r == "object" && r) {
|
|
171
|
+
if (a.has(r)) continue;
|
|
172
|
+
a.add(r);
|
|
173
|
+
}
|
|
174
|
+
if (I(r)) {
|
|
175
|
+
if (!l(r)) continue;
|
|
176
|
+
t.push({
|
|
177
|
+
file: i,
|
|
178
|
+
exportName: n,
|
|
179
|
+
rpcTag: r.name,
|
|
180
|
+
kind: r.kind,
|
|
181
|
+
...r.requiresApproval == null ? {} : { requiresApproval: !0 }
|
|
182
|
+
});
|
|
183
|
+
} else c(r) ? t.push({
|
|
184
|
+
file: i,
|
|
185
|
+
exportName: n,
|
|
186
|
+
rpcTag: r.name,
|
|
187
|
+
kind: "event"
|
|
188
|
+
}) : R(r) && t.push({
|
|
189
|
+
file: i,
|
|
190
|
+
exportName: n,
|
|
191
|
+
rpcTag: r.name,
|
|
192
|
+
kind: "workflow"
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
return t;
|
|
197
|
+
}, V = async (e) => {
|
|
198
|
+
let t = [], n = e.filter((e) => j.test(e)), r = await z(n);
|
|
199
|
+
for (let [e, i] of n.entries()) for (let [n, a] of Object.entries(r[e])) f(a) && t.push({
|
|
200
|
+
file: i,
|
|
201
|
+
exportName: n,
|
|
202
|
+
name: a.name
|
|
203
|
+
});
|
|
204
|
+
return t;
|
|
205
|
+
}, H = (e) => {
|
|
206
|
+
let t = (e, t) => e.split(/[^a-zA-Z0-9]+/).filter(Boolean).map((e, n) => (n === 0 && !t ? e.charAt(0).toLowerCase() : e.charAt(0).toUpperCase()) + e.slice(1)).join(""), n = e.split(".");
|
|
207
|
+
return `${t(n[0] ?? "rpc", !1)}${n.slice(1).map((e) => t(e, !0)).join("")}Rpc`;
|
|
208
|
+
}, U = /^[A-Za-z][A-Za-z0-9]*([._-][A-Za-z0-9]+)*$/, W = (e, t) => {
|
|
209
|
+
let n = (e) => r(t, e.file).replace(/\\/g, "/"), i = e.filter((e) => !U.test(e.rpcTag));
|
|
210
|
+
if (i.length > 0) throw Error(`invalid rpc tag — a procedure/workflow \`name\` must start with a letter and
|
|
211
|
+
use only letters, digits, and \`.\` \`-\` \`_\` separators (the tag becomes a JS
|
|
212
|
+
identifier in the generated rpcGroup):
|
|
213
|
+
|
|
214
|
+
${i.map((e) => ` • "${e.rpcTag}" (${n(e)})`).join("\n")}\n`);
|
|
215
|
+
let a = /* @__PURE__ */ new Map();
|
|
216
|
+
for (let t of e) {
|
|
217
|
+
let e = H(t.rpcTag), n = a.get(e);
|
|
218
|
+
n ? n.push(t) : a.set(e, [t]);
|
|
219
|
+
}
|
|
220
|
+
let o = [...a.values()].filter((e) => new Set(e.map((e) => e.rpcTag)).size > 1);
|
|
221
|
+
if (o.length > 0) throw Error(`rpc tag identifier collision — these distinct tags collapse to the same
|
|
222
|
+
generated identifier (separators are normalized away). Rename one so they
|
|
223
|
+
differ by more than a \`.\`/\`-\`/\`_\`:
|
|
224
|
+
|
|
225
|
+
${o.map((e) => ` ${H(e[0].rpcTag)}:\n` + e.map((e) => ` - "${e.rpcTag}" (${n(e)})`).join("\n")).join("\n\n")}\n`);
|
|
226
|
+
}, G = (e) => {
|
|
227
|
+
switch (e) {
|
|
228
|
+
case "query": return 0;
|
|
229
|
+
case "mutation": return 1;
|
|
230
|
+
case "action": return 2;
|
|
231
|
+
case "stream": return 3;
|
|
232
|
+
case "event": return 4;
|
|
233
|
+
case "workflow": return 5;
|
|
234
|
+
}
|
|
235
|
+
}, K = (e, t) => {
|
|
236
|
+
let n = /* @__PURE__ */ new Map();
|
|
237
|
+
for (let t of e) n.has(t.rpcTag) || n.set(t.rpcTag, t);
|
|
238
|
+
let i = [...n.keys()], a = (e) => r(t, n.get(e).file).replace(/\\/g, "/"), o = [];
|
|
239
|
+
for (let e of i) {
|
|
240
|
+
let t = i.filter((t) => t.startsWith(`${e}.`)).sort();
|
|
241
|
+
if (t.length === 0) continue;
|
|
242
|
+
let n = t.map((e) => ` - ${e} (${a(e)})`).join("\n");
|
|
243
|
+
o.push(` • "${e}" (${a(e)})\n is a procedure AND the namespace prefix of:\n${n}`);
|
|
244
|
+
}
|
|
245
|
+
if (o.length !== 0) throw Error(`rpc tag namespace collision — the web client nests tags by ".", so a tag
|
|
246
|
+
can't be both a leaf and a namespace. Rename one side (e.g. give the
|
|
247
|
+
workflow/procedure a nested name like "<prefix>.run"):
|
|
248
|
+
|
|
249
|
+
${o.join("\n\n")}\n`);
|
|
250
|
+
}, q = "// source-fingerprint: ", J = async (e) => {
|
|
251
|
+
let t = [...await F(e)].sort(), n = d("sha1");
|
|
252
|
+
for (let i of t) {
|
|
253
|
+
let t = "";
|
|
254
|
+
try {
|
|
255
|
+
t = o(i, "utf8");
|
|
256
|
+
} catch {}
|
|
257
|
+
n.update(`${r(e, i).replace(/\\/g, "/")}\u0000${t}\u0000`);
|
|
258
|
+
}
|
|
259
|
+
return n.digest("hex").slice(0, 16);
|
|
260
|
+
}, Y = async (e) => {
|
|
261
|
+
let t = async (e) => {
|
|
262
|
+
let r = await a.readdir(e, { withFileTypes: !0 }).catch(() => []);
|
|
263
|
+
for (let t of r) if (!N.has(t.name) && t.isFile() && t.name === "rpcGroup.generated.ts") return n(e, t.name);
|
|
264
|
+
for (let i of r) {
|
|
265
|
+
if (N.has(i.name) || !i.isDirectory()) continue;
|
|
266
|
+
let r = await t(n(e, i.name));
|
|
267
|
+
if (r !== void 0) return r;
|
|
268
|
+
}
|
|
269
|
+
};
|
|
270
|
+
return t(i(e));
|
|
271
|
+
}, X = async (e) => {
|
|
272
|
+
let n = await Y(e);
|
|
273
|
+
if (n === void 0) return { kind: "absent" };
|
|
274
|
+
let r = "";
|
|
275
|
+
try {
|
|
276
|
+
r = await a.readFile(n, "utf8");
|
|
277
|
+
} catch {
|
|
278
|
+
return { kind: "absent" };
|
|
279
|
+
}
|
|
280
|
+
let i = /^\/\/ source-fingerprint: ([0-9a-f]+)$/m.exec(r)?.[1];
|
|
281
|
+
return i === void 0 ? {
|
|
282
|
+
kind: "stale",
|
|
283
|
+
file: n,
|
|
284
|
+
reason: "the generated group carries no freshness stamp"
|
|
285
|
+
} : await J(t(n)) === i ? {
|
|
286
|
+
kind: "fresh",
|
|
287
|
+
file: n
|
|
288
|
+
} : {
|
|
289
|
+
kind: "stale",
|
|
290
|
+
file: n,
|
|
291
|
+
reason: "a descriptor changed since the group was generated"
|
|
292
|
+
};
|
|
293
|
+
}, Z = (e, n, i, a = [], s = [], c = !1, l = !1, u = [], f = "") => {
|
|
294
|
+
let p = s.length > 0, m = s.flatMap((e) => [{
|
|
295
|
+
file: e.file,
|
|
296
|
+
exportName: e.exportName,
|
|
297
|
+
rpcTag: `${e.name}.send`,
|
|
298
|
+
kind: "action"
|
|
299
|
+
}, {
|
|
300
|
+
file: e.file,
|
|
301
|
+
exportName: e.exportName,
|
|
302
|
+
rpcTag: `${e.name}.messages`,
|
|
303
|
+
kind: "query"
|
|
304
|
+
}]), h = [...new Map(u.map((e) => [e.tag, e])).values()].sort((e, t) => e.tag < t.tag ? -1 : 1), g = h.map((e) => ({
|
|
305
|
+
file: `plugin:${e.module}`,
|
|
306
|
+
exportName: e.name,
|
|
307
|
+
rpcTag: e.tag,
|
|
308
|
+
kind: e.kind
|
|
309
|
+
}));
|
|
310
|
+
K([
|
|
311
|
+
...i,
|
|
312
|
+
...m,
|
|
313
|
+
...g
|
|
314
|
+
], e), W([
|
|
315
|
+
...i,
|
|
316
|
+
...m,
|
|
317
|
+
...g
|
|
318
|
+
], e);
|
|
319
|
+
let _ = (e) => e.replace(/[^a-zA-Z0-9_$]/g, "_"), v = (e) => `__src_agent_${_(e.name)}`, y = (e) => `__agentRoutes_${_(e.name)}`, b = a.length > 0, x = a.map((e, t) => `import { ${e.name} as __pe${t} } from '${e.module}'`), S = b ? ", __voltroPluginErrors" : "", C = h.length > 0, w = h.map((e, t) => `import { ${e.name} as __prpc${t} } from '${e.module}'`), T = (e) => e === "query" ? "queryToRpc" : e === "mutation" ? "mutationToRpc" : "actionToRpc", E = h.map((e, t) => `export const ${H(e.tag)} = ${T(e.kind)}(__prpc${t}${S})`), D = h.map((e) => ` ${H(e.tag)},`), O = [...i].sort((e, t) => e.kind === t.kind ? e.rpcTag < t.rpcTag ? -1 : 1 : G(e.kind) - G(t.kind)), k = t(n), A = (e) => `__src_${H(e.rpcTag)}`, j = (e) => {
|
|
320
|
+
let t = `./${r(k, e.file).replace(/\\/g, "/").replace(/\.tsx?$/, "")}`;
|
|
321
|
+
return `import { ${e.exportName} as ${A(e)} } from '${t}'`;
|
|
322
|
+
}, M = (e) => {
|
|
323
|
+
let t = H(e.rpcTag), n = A(e);
|
|
324
|
+
return e.kind === "query" ? `export const ${t} = queryToRpc(${n}${S})` : e.kind === "mutation" ? `export const ${t} = mutationToRpc(${n}${S})` : e.kind === "action" ? `export const ${t} = actionToRpc(${n}${S})` : e.kind === "stream" ? `export const ${t} = streamToRpc(${n}${S})` : e.kind === "event" ? `export const ${t} = eventToRpc(${n}${S})` : [
|
|
325
|
+
`export const ${t} = Rpc.make('${e.rpcTag}', {`,
|
|
326
|
+
` payload: ${n}.payloadSchema,`,
|
|
327
|
+
" success: WorkflowRunHandleSchema,",
|
|
328
|
+
` error: ${n}.errorSchema,`,
|
|
329
|
+
"})"
|
|
330
|
+
].join("\n");
|
|
331
|
+
}, N = [...O.filter((e) => e.kind === "query" || e.kind === "mutation" || e.kind === "action" || e.kind === "stream").map((e) => ` | __AppErrorOf<typeof ${A(e)}>`), ...b ? [" | Schema.Schema.Type<(typeof __voltroPluginErrors)[number]>"] : []], P = N.length > 0, F = O.some((e) => e.kind === "workflow"), I = F ? [
|
|
332
|
+
"__voltroWorkflowRun",
|
|
333
|
+
"__voltroWorkflowRuns",
|
|
334
|
+
"__voltroWorkflowRunSteps",
|
|
335
|
+
"__voltroWorkflowRunEvents",
|
|
336
|
+
"__voltroWorkflowDomainEvents",
|
|
337
|
+
"__voltroWorkflowEventDeliveries",
|
|
338
|
+
"__voltroWorkflowCancel",
|
|
339
|
+
"__voltroWorkflowResume",
|
|
340
|
+
"__voltroWorkflowSignal",
|
|
341
|
+
"__voltroWorkflowUpdate"
|
|
342
|
+
] : [], L = c ? [
|
|
343
|
+
"__voltroUndoLog",
|
|
344
|
+
"__voltroUndoApply",
|
|
345
|
+
"__voltroUndoRedo"
|
|
346
|
+
] : [], R = O.some((e) => e.requiresApproval === !0), z = R ? ["__voltroApprovalsPending", "__voltroApprovalsDecide"] : [], B = l ? [
|
|
347
|
+
"__voltroConnectionsList",
|
|
348
|
+
"__voltroConnectionStart",
|
|
349
|
+
"__voltroConnectionSubmitToken",
|
|
350
|
+
"__voltroConnectionDisconnect"
|
|
351
|
+
] : [], V = [
|
|
352
|
+
...O.map((e) => ` ${H(e.rpcTag)},`),
|
|
353
|
+
...s.flatMap((e) => [` ${H(`${e.name}.send`)},`, ` ${H(`${e.name}.messages`)},`]),
|
|
354
|
+
...I.map((e) => ` ${e},`),
|
|
355
|
+
...L.map((e) => ` ${e},`),
|
|
356
|
+
...z.map((e) => ` ${e},`),
|
|
357
|
+
...B.map((e) => ` ${e},`),
|
|
358
|
+
...D
|
|
359
|
+
].join("\n"), U = ["queryToRpc"];
|
|
360
|
+
(O.some((e) => e.kind === "mutation") || h.some((e) => e.kind === "mutation")) && U.push("mutationToRpc"), (O.some((e) => e.kind === "action") || F || p || h.some((e) => e.kind === "action")) && U.push("actionToRpc"), O.some((e) => e.kind === "stream") && U.push("streamToRpc"), O.some((e) => e.kind === "event") && U.push("eventToRpc"), F && U.push("WorkflowRunHandleSchema", "workflowCancelDescriptor", "workflowDomainEventsQueryDescriptor", "workflowEventDeliveriesQueryDescriptor", "workflowResumeDescriptor", "workflowRunEventsQueryDescriptor", "workflowRunQueryDescriptor", "workflowRunsQueryDescriptor", "workflowRunStepsQueryDescriptor", "workflowSignalDescriptor", "workflowUpdateDescriptor"), c && U.push("mutationToRpc", "undoLogQueryDescriptor", "undoApplyDescriptor", "undoRedoDescriptor"), R && U.push("mutationToRpc", "approvalsPendingQueryDescriptor", "approvalsDecideDescriptor"), l && U.push("mutationToRpc", "actionToRpc", "connectionsListQueryDescriptor", "connectionStartDescriptor", "connectionSubmitTokenDescriptor", "connectionDisconnectDescriptor"), (O.some((e) => e.kind === "query" || e.kind === "mutation" || e.kind === "action" || e.kind === "stream") || p || F || c || R || l || C) && U.push("normalizeDescriptor");
|
|
361
|
+
let J = [...new Set(U)].sort(), Y = [...O.filter((e) => e.kind === "query" || e.kind === "mutation" || e.kind === "action" || e.kind === "stream").map((e) => [e.rpcTag, A(e)]), ...s.flatMap((e) => [[`${e.name}.send`, `${y(e)}.send`], [`${e.name}.messages`, `${y(e)}.messages`]])], X = [
|
|
362
|
+
...F ? [
|
|
363
|
+
["__voltro.workflow.run", "workflowRunQueryDescriptor"],
|
|
364
|
+
["__voltro.workflow.runs", "workflowRunsQueryDescriptor"],
|
|
365
|
+
["__voltro.workflow.run.steps", "workflowRunStepsQueryDescriptor"],
|
|
366
|
+
["__voltro.workflow.run.events", "workflowRunEventsQueryDescriptor"],
|
|
367
|
+
["__voltro.workflow.domainEvents", "workflowDomainEventsQueryDescriptor"],
|
|
368
|
+
["__voltro.workflow.event.deliveries", "workflowEventDeliveriesQueryDescriptor"],
|
|
369
|
+
["__voltro.workflow.cancel", "workflowCancelDescriptor"],
|
|
370
|
+
["__voltro.workflow.resume", "workflowResumeDescriptor"],
|
|
371
|
+
["__voltro.workflow.signal", "workflowSignalDescriptor"],
|
|
372
|
+
["__voltro.workflow.update", "workflowUpdateDescriptor"]
|
|
373
|
+
] : [],
|
|
374
|
+
...c ? [
|
|
375
|
+
["__voltro.undo.log", "undoLogQueryDescriptor"],
|
|
376
|
+
["__voltro.undo.apply", "undoApplyDescriptor"],
|
|
377
|
+
["__voltro.undo.redo", "undoRedoDescriptor"]
|
|
378
|
+
] : [],
|
|
379
|
+
...R ? [["__voltro.approvals.pending", "approvalsPendingQueryDescriptor"], ["__voltro.approvals.decide", "approvalsDecideDescriptor"]] : [],
|
|
380
|
+
...l ? [
|
|
381
|
+
["__voltro.connections.list", "connectionsListQueryDescriptor"],
|
|
382
|
+
["__voltro.connections.start", "connectionStartDescriptor"],
|
|
383
|
+
["__voltro.connections.submitToken", "connectionSubmitTokenDescriptor"],
|
|
384
|
+
["__voltro.connections.disconnect", "connectionDisconnectDescriptor"]
|
|
385
|
+
] : [],
|
|
386
|
+
...h.map((e, t) => [e.tag, `__prpc${t}`])
|
|
387
|
+
], Z = ([e, t]) => ` ${JSON.stringify(e)}: normalizeDescriptor(${t}),`, Q = ([e, t]) => ` readonly ${JSON.stringify(e)}: typeof ${t}`, $ = Y.map(Z), ee = X.map(Z), te = O.filter((e) => e.kind === "workflow").map((e) => ` ${JSON.stringify(e.rpcTag)}: { kind: 'workflow' },`), ne = O.filter((e) => e.kind === "workflow").map((e) => ` readonly ${JSON.stringify(e.rpcTag)}: { readonly kind: 'workflow' }`), re = [
|
|
388
|
+
...Y.map(Q),
|
|
389
|
+
...ne,
|
|
390
|
+
...X.map(Q)
|
|
391
|
+
], ie = O.filter((e) => e.kind === "workflow").map((e) => {
|
|
392
|
+
let t = A(e);
|
|
393
|
+
return [
|
|
394
|
+
` ${JSON.stringify(e.rpcTag)}: {`,
|
|
395
|
+
" kind: 'workflow',",
|
|
396
|
+
` payload: ${t}.payloadSchema,`,
|
|
397
|
+
` success: ${t}.successSchema,`,
|
|
398
|
+
` error: ${t}.errorSchema,`,
|
|
399
|
+
` signals: __voltroWorkflowMessages(${t}).signals,`,
|
|
400
|
+
` updates: __voltroWorkflowMessages(${t}).updates,`,
|
|
401
|
+
" },"
|
|
402
|
+
].join("\n");
|
|
403
|
+
}), ae = [...O, ...s.map((e) => ({
|
|
404
|
+
rpcTag: `agent:${e.name}`,
|
|
405
|
+
file: e.file
|
|
406
|
+
}))];
|
|
407
|
+
return [
|
|
408
|
+
"// THIS FILE IS GENERATED — DO NOT EDIT BY HAND.",
|
|
409
|
+
"// Re-emitted by `voltro dev` whenever query/mutation/action/stream/workflow files change.",
|
|
410
|
+
`// descriptor-fingerprint: ${d("sha1").update(ae.map((e) => {
|
|
411
|
+
let t = "";
|
|
412
|
+
try {
|
|
413
|
+
t = o(e.file, "utf8");
|
|
414
|
+
} catch {}
|
|
415
|
+
return `${e.rpcTag}\u0000${t}`;
|
|
416
|
+
}).join("")).digest("hex").slice(0, 16)}`,
|
|
417
|
+
`${q}${f}`,
|
|
418
|
+
"// Source files:",
|
|
419
|
+
...O.map((t) => `// - ${r(e, t.file).replace(/\\/g, "/")}`),
|
|
420
|
+
...s.map((t) => `// - ${r(e, t.file).replace(/\\/g, "/")} (agent)`),
|
|
421
|
+
"",
|
|
422
|
+
F ? "import { Rpc, RpcGroup } from '@effect/rpc'" : "import { RpcGroup } from '@effect/rpc'",
|
|
423
|
+
...F || P ? ["import { Schema } from 'effect'"] : [],
|
|
424
|
+
`import { ${J.join(", ")} } from '@voltro/protocol'`,
|
|
425
|
+
...p ? ["import { agentRouteDescriptors as __voltroAgentRoutes } from '@voltro/ai/agent'"] : [],
|
|
426
|
+
"",
|
|
427
|
+
...O.map(j),
|
|
428
|
+
...s.map((e) => `import { ${e.exportName} as ${v(e)} } from './${r(k, e.file).replace(/\\/g, "/").replace(/\.tsx?$/, "")}'`),
|
|
429
|
+
...b ? ["", ...x] : [],
|
|
430
|
+
...C ? ["", ...w] : [],
|
|
431
|
+
"",
|
|
432
|
+
...s.map((e) => `const ${y(e)} = __voltroAgentRoutes(${v(e)})`),
|
|
433
|
+
...p ? [""] : [],
|
|
434
|
+
...b ? [
|
|
435
|
+
"/** Cross-cutting plugin error schemas, unioned into every rpc's",
|
|
436
|
+
" * wire error so interceptor failures decode typed on the client. */",
|
|
437
|
+
`const __voltroPluginErrors = [${a.map((e, t) => `__pe${t}`).join(", ")}] as const`,
|
|
438
|
+
""
|
|
439
|
+
] : [],
|
|
440
|
+
...F ? [
|
|
441
|
+
"const __voltroEmptyWorkflowMessages = { signals: {}, updates: {} } as const",
|
|
442
|
+
"const __voltroWorkflowMessages = <const M extends {",
|
|
443
|
+
" readonly signals: Readonly<Record<string, Schema.Schema.Any>>",
|
|
444
|
+
" readonly updates: Readonly<Record<string, { readonly payload: Schema.Schema.Any; readonly success: Schema.Schema.Any }>>",
|
|
445
|
+
"}>(definition: object & { readonly __voltroWorkflowMessages?: M }) =>",
|
|
446
|
+
" definition.__voltroWorkflowMessages ?? __voltroEmptyWorkflowMessages",
|
|
447
|
+
"",
|
|
448
|
+
"export const workflowDescriptors = {",
|
|
449
|
+
...ie,
|
|
450
|
+
"} as const",
|
|
451
|
+
"",
|
|
452
|
+
"export type WorkflowDescriptors = typeof workflowDescriptors",
|
|
453
|
+
"export type WorkflowName = keyof WorkflowDescriptors",
|
|
454
|
+
"export type WorkflowPayloads = { [K in WorkflowName]: WorkflowDescriptors[K] extends { readonly payload: infer Payload extends Schema.Schema.Any } ? Schema.Schema.Type<Payload> : never }",
|
|
455
|
+
"export type WorkflowResults = { [K in WorkflowName]: WorkflowDescriptors[K] extends { readonly success: infer Success extends Schema.Schema.Any } ? Schema.Schema.Type<Success> : never }",
|
|
456
|
+
"export type WorkflowErrors = { [K in WorkflowName]: WorkflowDescriptors[K] extends { readonly error: infer ErrorSchema extends Schema.Schema.Any } ? Schema.Schema.Type<ErrorSchema> : never }",
|
|
457
|
+
"export type WorkflowSignals = { [K in WorkflowName]: WorkflowDescriptors[K] extends { readonly signals: infer Signals extends Readonly<Record<string, Schema.Schema.Any>> } ? { [S in keyof Signals]: Schema.Schema.Type<Signals[S]> } : {} }",
|
|
458
|
+
"export type WorkflowUpdates = { [K in WorkflowName]: WorkflowDescriptors[K] extends { readonly updates: infer Updates extends Readonly<Record<string, { readonly payload: Schema.Schema.Any; readonly success: Schema.Schema.Any }>> } ? { [U in keyof Updates]: {",
|
|
459
|
+
" readonly payload: Schema.Schema.Type<Updates[U]['payload']>",
|
|
460
|
+
" readonly result: Schema.Schema.Type<Updates[U]['success']>",
|
|
461
|
+
"} } : {} }",
|
|
462
|
+
"export type WorkflowMessages = { [K in WorkflowName]: {",
|
|
463
|
+
" readonly signals: WorkflowSignals[K]",
|
|
464
|
+
" readonly updates: WorkflowUpdates[K]",
|
|
465
|
+
"} }",
|
|
466
|
+
""
|
|
467
|
+
] : [],
|
|
468
|
+
...O.map(M),
|
|
469
|
+
...s.flatMap((e) => [`export const ${H(`${e.name}.send`)} = actionToRpc(${y(e)}.send${S})`, `export const ${H(`${e.name}.messages`)} = queryToRpc(${y(e)}.messages${S})`]),
|
|
470
|
+
...F ? [
|
|
471
|
+
"export const __voltroWorkflowRun = queryToRpc(workflowRunQueryDescriptor)",
|
|
472
|
+
"export const __voltroWorkflowRuns = queryToRpc(workflowRunsQueryDescriptor)",
|
|
473
|
+
"export const __voltroWorkflowRunSteps = queryToRpc(workflowRunStepsQueryDescriptor)",
|
|
474
|
+
"export const __voltroWorkflowRunEvents = queryToRpc(workflowRunEventsQueryDescriptor)",
|
|
475
|
+
"export const __voltroWorkflowDomainEvents = queryToRpc(workflowDomainEventsQueryDescriptor)",
|
|
476
|
+
"export const __voltroWorkflowEventDeliveries = queryToRpc(workflowEventDeliveriesQueryDescriptor)",
|
|
477
|
+
"export const __voltroWorkflowCancel = actionToRpc(workflowCancelDescriptor)",
|
|
478
|
+
"export const __voltroWorkflowResume = actionToRpc(workflowResumeDescriptor)",
|
|
479
|
+
"export const __voltroWorkflowSignal = actionToRpc(workflowSignalDescriptor)",
|
|
480
|
+
"export const __voltroWorkflowUpdate = actionToRpc(workflowUpdateDescriptor)"
|
|
481
|
+
] : [],
|
|
482
|
+
...c ? [
|
|
483
|
+
"export const __voltroUndoLog = queryToRpc(undoLogQueryDescriptor)",
|
|
484
|
+
"export const __voltroUndoApply = mutationToRpc(undoApplyDescriptor)",
|
|
485
|
+
"export const __voltroUndoRedo = mutationToRpc(undoRedoDescriptor)"
|
|
486
|
+
] : [],
|
|
487
|
+
...R ? ["export const __voltroApprovalsPending = queryToRpc(approvalsPendingQueryDescriptor)", "export const __voltroApprovalsDecide = mutationToRpc(approvalsDecideDescriptor)"] : [],
|
|
488
|
+
...l ? [
|
|
489
|
+
"export const __voltroConnectionsList = queryToRpc(connectionsListQueryDescriptor)",
|
|
490
|
+
"export const __voltroConnectionStart = actionToRpc(connectionStartDescriptor)",
|
|
491
|
+
"export const __voltroConnectionSubmitToken = mutationToRpc(connectionSubmitTokenDescriptor)",
|
|
492
|
+
"export const __voltroConnectionDisconnect = mutationToRpc(connectionDisconnectDescriptor)"
|
|
493
|
+
] : [],
|
|
494
|
+
...E,
|
|
495
|
+
"",
|
|
496
|
+
"export const appGroup = RpcGroup.make(",
|
|
497
|
+
V,
|
|
498
|
+
")",
|
|
499
|
+
"",
|
|
500
|
+
"/** Per-rpc-tag metadata for the client. Drives auto-optimistic etc.",
|
|
501
|
+
" * Function fields (target.shape, target.identify) survive because",
|
|
502
|
+
" * the descriptors themselves are imported by reference. */",
|
|
503
|
+
"export const appDescriptors = {",
|
|
504
|
+
...$,
|
|
505
|
+
...te,
|
|
506
|
+
...ee,
|
|
507
|
+
"} as const",
|
|
508
|
+
"",
|
|
509
|
+
"export type AppDescriptors = typeof appDescriptors",
|
|
510
|
+
"",
|
|
511
|
+
"/** Type-level map: rpc tag → the DESCRIPTOR TYPE behind it — the input and",
|
|
512
|
+
" * output `Schema`s this app's procedures actually declare.",
|
|
513
|
+
" *",
|
|
514
|
+
" * Feed it to `createHooks` from @voltro/client to get hooks whose tag is a",
|
|
515
|
+
" * literal union and whose input/output types are INFERRED, so a call site",
|
|
516
|
+
" * never spells either by hand:",
|
|
517
|
+
" *",
|
|
518
|
+
" * // src/lib/api.ts",
|
|
519
|
+
" * import { createHooks } from '@voltro/client'",
|
|
520
|
+
" * import type { AppProcedures } from '<this-api-package>/rpcGroup'",
|
|
521
|
+
" *",
|
|
522
|
+
" * export const { useSubscription, useMutation, useAction } =",
|
|
523
|
+
" * createHooks<AppProcedures>('app') // the key from app.config.ts `apis`",
|
|
524
|
+
" *",
|
|
525
|
+
" * A type ALIAS, not an interface, on purpose: an interface has no implicit",
|
|
526
|
+
" * index signature, so it would not satisfy `createHooks`' constraint.",
|
|
527
|
+
" * Types only — erased at build time, so importing it costs the bundle",
|
|
528
|
+
" * nothing. */",
|
|
529
|
+
"export type AppProcedures = {",
|
|
530
|
+
...re,
|
|
531
|
+
"}",
|
|
532
|
+
"",
|
|
533
|
+
...P ? [
|
|
534
|
+
"type __AppErrorOf<D> = D extends { readonly error: infer E extends Schema.Schema.Any } ? Schema.Schema.Type<E> : never",
|
|
535
|
+
"/** Union of every typed error the app's rpcs can fail with — the declared",
|
|
536
|
+
" * `error:` schemas + cross-cutting plugin errors. Generated by reference,",
|
|
537
|
+
" * so it can never drift out of date. (Workflows: see `WorkflowErrors`.) */",
|
|
538
|
+
"export type AppError =",
|
|
539
|
+
...N,
|
|
540
|
+
"/** The `_tag` literal of every AppError — the exhaustive key set for `matchError`. */",
|
|
541
|
+
"export type AppErrorTag = AppError extends { readonly _tag: infer T extends string } ? T : never",
|
|
542
|
+
"",
|
|
543
|
+
"/** Exhaustively match a caught rpc error by its `_tag`. Handler keys are the",
|
|
544
|
+
" * app's ACTUAL error tags (a dead/renamed tag is a compile error), so the",
|
|
545
|
+
" * hand-maintained tag list that drifts is gone. Returns the matched handler's",
|
|
546
|
+
" * result, or `fallback(err)` / `undefined` when no tag matches. Browser-safe",
|
|
547
|
+
" * (reads `_tag` structurally — no runtime dependency). */",
|
|
548
|
+
"export const matchError = <R>(",
|
|
549
|
+
" err: unknown,",
|
|
550
|
+
" handlers: Partial<{ [T in AppErrorTag]: (e: Extract<AppError, { readonly _tag: T }>) => R }>,",
|
|
551
|
+
" fallback?: (err: unknown) => R,",
|
|
552
|
+
"): R | undefined => {",
|
|
553
|
+
" const tag = (err as { readonly _tag?: unknown } | null | undefined)?._tag",
|
|
554
|
+
" if (typeof tag === 'string') {",
|
|
555
|
+
" const handler = (handlers as Record<string, ((e: never) => R) | undefined>)[tag]",
|
|
556
|
+
" if (handler) return handler(err as never)",
|
|
557
|
+
" }",
|
|
558
|
+
" return fallback ? fallback(err) : undefined",
|
|
559
|
+
"}",
|
|
560
|
+
""
|
|
561
|
+
] : []
|
|
562
|
+
].join("\n");
|
|
563
|
+
}, Q = async (e) => {
|
|
564
|
+
let r = i(e.root), o = await F(r), s = await B(o), c = await V(o), l = await P(r);
|
|
565
|
+
if (s.length === 0 && c.length === 0 && !l && (e.pluginRpcImports?.length ?? 0) === 0) return;
|
|
566
|
+
let d = ((e) => {
|
|
567
|
+
if (e.length === 0) return r;
|
|
568
|
+
let t = e.map((e) => e.split("/")), n = Math.min(...t.map((e) => e.length)), i = [];
|
|
569
|
+
for (let e = 0; e < n; e++) {
|
|
570
|
+
let n = t[0][e];
|
|
571
|
+
if (t.every((t) => t[e] === n)) i.push(n);
|
|
572
|
+
else break;
|
|
573
|
+
}
|
|
574
|
+
return i.join("/") || "/";
|
|
575
|
+
})([...new Set([...s.map((e) => e.file), ...c.map((e) => e.file)].map((e) => e.replace(/\/[^/]+$/, "")))]), f = /* @__PURE__ */ new Set([
|
|
576
|
+
"queries",
|
|
577
|
+
"mutations",
|
|
578
|
+
"actions",
|
|
579
|
+
"streams",
|
|
580
|
+
"workflows"
|
|
581
|
+
]), p = (e) => e.slice(e.lastIndexOf("/") + 1), m = d;
|
|
582
|
+
for (; m !== r && f.has(p(m));) m = m.slice(0, m.lastIndexOf("/")) || "/";
|
|
583
|
+
let h = i(e.outputFile ?? n(m, "rpcGroup.generated.ts")), g = [...new Map((e.pluginErrorImports ?? []).map((e) => [`${e.module}#${e.name}`, e])).values()], _ = [...new Map((e.pluginRpcImports ?? []).map((e) => [e.tag, e])).values()], v = await J(t(h)), y = Z(r, h, s, g, c, u(), l, _, v), b = [];
|
|
584
|
+
for (let t of e.pluginContributions ?? []) {
|
|
585
|
+
let e = null;
|
|
586
|
+
try {
|
|
587
|
+
e = t.emit();
|
|
588
|
+
} catch (n) {
|
|
589
|
+
e = `// <plugin:${t.pluginName}> ERROR: ${n?.message ?? String(n)}\n// </plugin:${t.pluginName}>`;
|
|
590
|
+
}
|
|
591
|
+
e === null || e === "" || b.push([
|
|
592
|
+
`// <plugin:${t.pluginName}>`,
|
|
593
|
+
e,
|
|
594
|
+
`// </plugin:${t.pluginName}>`,
|
|
595
|
+
""
|
|
596
|
+
].join("\n"));
|
|
597
|
+
}
|
|
598
|
+
let x = b.length === 0 ? y : `${y}\n\n// ---- plugin codegen ----\n\n${b.join("\n")}`, S = null;
|
|
599
|
+
try {
|
|
600
|
+
S = await a.readFile(h, "utf8");
|
|
601
|
+
} catch {}
|
|
602
|
+
return S !== x && await a.writeFile(h, x, "utf8"), await D(h), h;
|
|
603
|
+
};
|
|
604
|
+
//#endregion
|
|
605
|
+
export { D as a, T as c, w as i, J as n, E as o, Q as r, C as s, X as t };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { l as e, z as t } from "./dev-C7sFZq3m.js";
|
|
2
|
+
import { r as n } from "./codegen-CYM3Zqrf.js";
|
|
3
|
+
import { basename as r, relative as i, resolve as a } from "node:path";
|
|
4
|
+
//#region src/codegenCommand.ts
|
|
5
|
+
var o = async (i) => {
|
|
6
|
+
let { config: a, present: o, error: s } = await e(i);
|
|
7
|
+
if (o && a === null) return {
|
|
8
|
+
kind: "refused",
|
|
9
|
+
reason: "app.config.ts exists but could not be loaded" + (s === void 0 ? "" : ` — ${s instanceof Error ? s.message : String(s)}`)
|
|
10
|
+
};
|
|
11
|
+
let c = a?.plugins ?? [], { pluginContributions: l, pluginErrorImports: u, pluginRpcImports: d } = await t(c, a?.name ?? r(i), i), f = await n({
|
|
12
|
+
root: i,
|
|
13
|
+
...l.length > 0 ? { pluginContributions: l } : {},
|
|
14
|
+
...u.length > 0 ? { pluginErrorImports: u } : {},
|
|
15
|
+
...d.length > 0 ? { pluginRpcImports: d } : {},
|
|
16
|
+
...a?.name === void 0 ? {} : { apiName: a.name }
|
|
17
|
+
});
|
|
18
|
+
return f ? {
|
|
19
|
+
kind: "wrote",
|
|
20
|
+
file: f,
|
|
21
|
+
plugins: c.length,
|
|
22
|
+
errorSchemas: u.length,
|
|
23
|
+
routes: d.length
|
|
24
|
+
} : { kind: "nothing-to-write" };
|
|
25
|
+
}, s = async (e) => {
|
|
26
|
+
let t = a(e.find((e) => !e.startsWith("-")) ?? process.cwd()), n = await o(t);
|
|
27
|
+
return n.kind === "refused" ? (console.error(`voltro codegen: ${n.reason} — refusing to write.`), console.error(" The generated file would omit every plugin's error union and client routes, and would typecheck, so the omission would only surface as a missing error tag at runtime."), 1) : n.kind === "nothing-to-write" ? (console.log("voltro codegen: no rpc primitives found — nothing to write."), 0) : (console.log(`voltro codegen: wrote ${i(t, n.file)} (plugins ${n.plugins}, error schemas ${n.errorSchemas}, plugin routes ${n.routes})`), n.plugins > 0 && n.errorSchemas === 0 && console.log(" note: no plugin contributed a cross-cutting error schema, so the wire error union carries only each procedure's own `error:`. Expected if none of your plugins declare `errorSchemas` — but `guards:` needs @voltro/plugin-rbac for its ScopeError to decode typed."), 0);
|
|
28
|
+
};
|
|
29
|
+
//#endregion
|
|
30
|
+
export { o as regenerateRpcGroup, s as runCodegenCommand };
|