@backthread/extractor 0.1.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/LICENSE +21 -0
- package/README.md +83 -0
- package/dist/cluster/domain-grouping.d.ts +113 -0
- package/dist/cluster/domain-grouping.d.ts.map +1 -0
- package/dist/cluster/domain-grouping.js +277 -0
- package/dist/cluster/domain-grouping.js.map +1 -0
- package/dist/cluster/grouping-gate.d.ts +54 -0
- package/dist/cluster/grouping-gate.d.ts.map +1 -0
- package/dist/cluster/grouping-gate.js +0 -0
- package/dist/cluster/grouping-gate.js.map +1 -0
- package/dist/cluster/louvain.d.ts +88 -0
- package/dist/cluster/louvain.d.ts.map +1 -0
- package/dist/cluster/louvain.js +674 -0
- package/dist/cluster/louvain.js.map +1 -0
- package/dist/cluster/overrides.d.ts +19 -0
- package/dist/cluster/overrides.d.ts.map +1 -0
- package/dist/cluster/overrides.js +32 -0
- package/dist/cluster/overrides.js.map +1 -0
- package/dist/cluster/subsystem.d.ts +45 -0
- package/dist/cluster/subsystem.d.ts.map +1 -0
- package/dist/cluster/subsystem.js +299 -0
- package/dist/cluster/subsystem.js.map +1 -0
- package/dist/cluster/workspaces.d.ts +64 -0
- package/dist/cluster/workspaces.d.ts.map +1 -0
- package/dist/cluster/workspaces.js +739 -0
- package/dist/cluster/workspaces.js.map +1 -0
- package/dist/extract.d.ts +52 -0
- package/dist/extract.d.ts.map +1 -0
- package/dist/extract.js +48 -0
- package/dist/extract.js.map +1 -0
- package/dist/framework/celery/celery.d.ts +17 -0
- package/dist/framework/celery/celery.d.ts.map +1 -0
- package/dist/framework/celery/celery.js +524 -0
- package/dist/framework/celery/celery.js.map +1 -0
- package/dist/framework/contribute-step.d.ts +38 -0
- package/dist/framework/contribute-step.d.ts.map +1 -0
- package/dist/framework/contribute-step.js +403 -0
- package/dist/framework/contribute-step.js.map +1 -0
- package/dist/framework/detect-step.d.ts +8 -0
- package/dist/framework/detect-step.d.ts.map +1 -0
- package/dist/framework/detect-step.js +54 -0
- package/dist/framework/detect-step.js.map +1 -0
- package/dist/framework/detect-util.d.ts +24 -0
- package/dist/framework/detect-util.d.ts.map +1 -0
- package/dist/framework/detect-util.js +59 -0
- package/dist/framework/detect-util.js.map +1 -0
- package/dist/framework/django/django.d.ts +22 -0
- package/dist/framework/django/django.d.ts.map +1 -0
- package/dist/framework/django/django.js +940 -0
- package/dist/framework/django/django.js.map +1 -0
- package/dist/framework/fastapi/fastapi.d.ts +27 -0
- package/dist/framework/fastapi/fastapi.d.ts.map +1 -0
- package/dist/framework/fastapi/fastapi.js +477 -0
- package/dist/framework/fastapi/fastapi.js.map +1 -0
- package/dist/framework/faststream/faststream.d.ts +19 -0
- package/dist/framework/faststream/faststream.d.ts.map +1 -0
- package/dist/framework/faststream/faststream.js +765 -0
- package/dist/framework/faststream/faststream.js.map +1 -0
- package/dist/framework/flask/flask.d.ts +17 -0
- package/dist/framework/flask/flask.d.ts.map +1 -0
- package/dist/framework/flask/flask.js +507 -0
- package/dist/framework/flask/flask.js.map +1 -0
- package/dist/framework/graphql/graphql.d.ts +17 -0
- package/dist/framework/graphql/graphql.d.ts.map +1 -0
- package/dist/framework/graphql/graphql.js +708 -0
- package/dist/framework/graphql/graphql.js.map +1 -0
- package/dist/framework/grpc/grpc.d.ts +22 -0
- package/dist/framework/grpc/grpc.d.ts.map +1 -0
- package/dist/framework/grpc/grpc.js +618 -0
- package/dist/framework/grpc/grpc.js.map +1 -0
- package/dist/framework/litestar/litestar.d.ts +17 -0
- package/dist/framework/litestar/litestar.d.ts.map +1 -0
- package/dist/framework/litestar/litestar.js +536 -0
- package/dist/framework/litestar/litestar.js.map +1 -0
- package/dist/framework/nest/nest.d.ts +19 -0
- package/dist/framework/nest/nest.d.ts.map +1 -0
- package/dist/framework/nest/nest.js +613 -0
- package/dist/framework/nest/nest.js.map +1 -0
- package/dist/framework/next/next.d.ts +22 -0
- package/dist/framework/next/next.d.ts.map +1 -0
- package/dist/framework/next/next.js +449 -0
- package/dist/framework/next/next.js.map +1 -0
- package/dist/framework/node/node.d.ts +24 -0
- package/dist/framework/node/node.d.ts.map +1 -0
- package/dist/framework/node/node.js +1009 -0
- package/dist/framework/node/node.js.map +1 -0
- package/dist/framework/orchestrator/orchestrator.d.ts +34 -0
- package/dist/framework/orchestrator/orchestrator.d.ts.map +1 -0
- package/dist/framework/orchestrator/orchestrator.js +691 -0
- package/dist/framework/orchestrator/orchestrator.js.map +1 -0
- package/dist/framework/orm/orm.d.ts +61 -0
- package/dist/framework/orm/orm.d.ts.map +1 -0
- package/dist/framework/orm/orm.js +620 -0
- package/dist/framework/orm/orm.js.map +1 -0
- package/dist/framework/python/analyze.d.ts +38 -0
- package/dist/framework/python/analyze.d.ts.map +1 -0
- package/dist/framework/python/analyze.js +98 -0
- package/dist/framework/python/analyze.js.map +1 -0
- package/dist/framework/python/py-ast.d.ts +130 -0
- package/dist/framework/python/py-ast.d.ts.map +1 -0
- package/dist/framework/python/py-ast.js +344 -0
- package/dist/framework/python/py-ast.js.map +1 -0
- package/dist/framework/python-orm/python-orm.d.ts +19 -0
- package/dist/framework/python-orm/python-orm.d.ts.map +1 -0
- package/dist/framework/python-orm/python-orm.js +516 -0
- package/dist/framework/python-orm/python-orm.js.map +1 -0
- package/dist/framework/react-native/react-native.d.ts +35 -0
- package/dist/framework/react-native/react-native.d.ts.map +1 -0
- package/dist/framework/react-native/react-native.js +1181 -0
- package/dist/framework/react-native/react-native.js.map +1 -0
- package/dist/framework/register.d.ts +2 -0
- package/dist/framework/register.d.ts.map +1 -0
- package/dist/framework/register.js +59 -0
- package/dist/framework/register.js.map +1 -0
- package/dist/framework/registry.d.ts +31 -0
- package/dist/framework/registry.d.ts.map +1 -0
- package/dist/framework/registry.js +70 -0
- package/dist/framework/registry.js.map +1 -0
- package/dist/framework/routing/expo-router.d.ts +31 -0
- package/dist/framework/routing/expo-router.d.ts.map +1 -0
- package/dist/framework/routing/expo-router.js +356 -0
- package/dist/framework/routing/expo-router.js.map +1 -0
- package/dist/framework/routing/index.d.ts +4 -0
- package/dist/framework/routing/index.d.ts.map +1 -0
- package/dist/framework/routing/index.js +16 -0
- package/dist/framework/routing/index.js.map +1 -0
- package/dist/framework/routing/next-router.d.ts +45 -0
- package/dist/framework/routing/next-router.d.ts.map +1 -0
- package/dist/framework/routing/next-router.js +378 -0
- package/dist/framework/routing/next-router.js.map +1 -0
- package/dist/framework/routing/route-tree.d.ts +73 -0
- package/dist/framework/routing/route-tree.d.ts.map +1 -0
- package/dist/framework/routing/route-tree.js +120 -0
- package/dist/framework/routing/route-tree.js.map +1 -0
- package/dist/framework/types.d.ts +230 -0
- package/dist/framework/types.d.ts.map +1 -0
- package/dist/framework/types.js +25 -0
- package/dist/framework/types.js.map +1 -0
- package/dist/graph/cross-language.d.ts +11 -0
- package/dist/graph/cross-language.d.ts.map +1 -0
- package/dist/graph/cross-language.js +123 -0
- package/dist/graph/cross-language.js.map +1 -0
- package/dist/graph/extract.d.ts +13 -0
- package/dist/graph/extract.d.ts.map +1 -0
- package/dist/graph/extract.js +79 -0
- package/dist/graph/extract.js.map +1 -0
- package/dist/graph/file-graph.d.ts +186 -0
- package/dist/graph/file-graph.d.ts.map +1 -0
- package/dist/graph/file-graph.js +427 -0
- package/dist/graph/file-graph.js.map +1 -0
- package/dist/graph/http-callsites.d.ts +14 -0
- package/dist/graph/http-callsites.d.ts.map +1 -0
- package/dist/graph/http-callsites.js +107 -0
- package/dist/graph/http-callsites.js.map +1 -0
- package/dist/graph/incremental.d.ts +122 -0
- package/dist/graph/incremental.d.ts.map +1 -0
- package/dist/graph/incremental.js +448 -0
- package/dist/graph/incremental.js.map +1 -0
- package/dist/graph/language.d.ts +31 -0
- package/dist/graph/language.d.ts.map +1 -0
- package/dist/graph/language.js +146 -0
- package/dist/graph/language.js.map +1 -0
- package/dist/graph/noise-filter.d.ts +46 -0
- package/dist/graph/noise-filter.d.ts.map +1 -0
- package/dist/graph/noise-filter.js +199 -0
- package/dist/graph/noise-filter.js.map +1 -0
- package/dist/graph/python-adapter.d.ts +36 -0
- package/dist/graph/python-adapter.d.ts.map +1 -0
- package/dist/graph/python-adapter.js +402 -0
- package/dist/graph/python-adapter.js.map +1 -0
- package/dist/graph/python-manifest.d.ts +22 -0
- package/dist/graph/python-manifest.d.ts.map +1 -0
- package/dist/graph/python-manifest.js +137 -0
- package/dist/graph/python-manifest.js.map +1 -0
- package/dist/graph/python-stdlib.d.ts +2 -0
- package/dist/graph/python-stdlib.d.ts.map +1 -0
- package/dist/graph/python-stdlib.js +53 -0
- package/dist/graph/python-stdlib.js.map +1 -0
- package/dist/graph/ts-morph-adapter.d.ts +65 -0
- package/dist/graph/ts-morph-adapter.d.ts.map +1 -0
- package/dist/graph/ts-morph-adapter.js +265 -0
- package/dist/graph/ts-morph-adapter.js.map +1 -0
- package/dist/graph/types.d.ts +37 -0
- package/dist/graph/types.d.ts.map +1 -0
- package/dist/graph/types.js +50 -0
- package/dist/graph/types.js.map +1 -0
- package/dist/index.d.ts +45 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +51 -0
- package/dist/index.js.map +1 -0
- package/dist/infra/aws/aws-parse.d.ts +39 -0
- package/dist/infra/aws/aws-parse.d.ts.map +1 -0
- package/dist/infra/aws/aws-parse.js +149 -0
- package/dist/infra/aws/aws-parse.js.map +1 -0
- package/dist/infra/aws/aws.d.ts +6 -0
- package/dist/infra/aws/aws.d.ts.map +1 -0
- package/dist/infra/aws/aws.js +425 -0
- package/dist/infra/aws/aws.js.map +1 -0
- package/dist/infra/azure/azure-parse.d.ts +73 -0
- package/dist/infra/azure/azure-parse.d.ts.map +1 -0
- package/dist/infra/azure/azure-parse.js +178 -0
- package/dist/infra/azure/azure-parse.js.map +1 -0
- package/dist/infra/azure/azure.d.ts +12 -0
- package/dist/infra/azure/azure.d.ts.map +1 -0
- package/dist/infra/azure/azure.js +673 -0
- package/dist/infra/azure/azure.js.map +1 -0
- package/dist/infra/cloudflare/cloudflare.d.ts +50 -0
- package/dist/infra/cloudflare/cloudflare.d.ts.map +1 -0
- package/dist/infra/cloudflare/cloudflare.js +382 -0
- package/dist/infra/cloudflare/cloudflare.js.map +1 -0
- package/dist/infra/cloudflare/wrangler-parse.d.ts +6 -0
- package/dist/infra/cloudflare/wrangler-parse.d.ts.map +1 -0
- package/dist/infra/cloudflare/wrangler-parse.js +278 -0
- package/dist/infra/cloudflare/wrangler-parse.js.map +1 -0
- package/dist/infra/compose/compose-parse.d.ts +24 -0
- package/dist/infra/compose/compose-parse.d.ts.map +1 -0
- package/dist/infra/compose/compose-parse.js +77 -0
- package/dist/infra/compose/compose-parse.js.map +1 -0
- package/dist/infra/compose/compose.d.ts +12 -0
- package/dist/infra/compose/compose.d.ts.map +1 -0
- package/dist/infra/compose/compose.js +201 -0
- package/dist/infra/compose/compose.js.map +1 -0
- package/dist/infra/convex/convex-parse.d.ts +28 -0
- package/dist/infra/convex/convex-parse.d.ts.map +1 -0
- package/dist/infra/convex/convex-parse.js +74 -0
- package/dist/infra/convex/convex-parse.js.map +1 -0
- package/dist/infra/convex/convex.d.ts +18 -0
- package/dist/infra/convex/convex.d.ts.map +1 -0
- package/dist/infra/convex/convex.js +199 -0
- package/dist/infra/convex/convex.js.map +1 -0
- package/dist/infra/digitalocean/digitalocean.d.ts +33 -0
- package/dist/infra/digitalocean/digitalocean.d.ts.map +1 -0
- package/dist/infra/digitalocean/digitalocean.js +204 -0
- package/dist/infra/digitalocean/digitalocean.js.map +1 -0
- package/dist/infra/firebase/firebase.d.ts +43 -0
- package/dist/infra/firebase/firebase.d.ts.map +1 -0
- package/dist/infra/firebase/firebase.js +271 -0
- package/dist/infra/firebase/firebase.js.map +1 -0
- package/dist/infra/fly/fly-parse.d.ts +52 -0
- package/dist/infra/fly/fly-parse.d.ts.map +1 -0
- package/dist/infra/fly/fly-parse.js +114 -0
- package/dist/infra/fly/fly-parse.js.map +1 -0
- package/dist/infra/fly/fly.d.ts +15 -0
- package/dist/infra/fly/fly.d.ts.map +1 -0
- package/dist/infra/fly/fly.js +265 -0
- package/dist/infra/fly/fly.js.map +1 -0
- package/dist/infra/gcp/gcp-parse.d.ts +24 -0
- package/dist/infra/gcp/gcp-parse.d.ts.map +1 -0
- package/dist/infra/gcp/gcp-parse.js +123 -0
- package/dist/infra/gcp/gcp-parse.js.map +1 -0
- package/dist/infra/gcp/gcp.d.ts +10 -0
- package/dist/infra/gcp/gcp.d.ts.map +1 -0
- package/dist/infra/gcp/gcp.js +502 -0
- package/dist/infra/gcp/gcp.js.map +1 -0
- package/dist/infra/heroku/heroku-parse.d.ts +33 -0
- package/dist/infra/heroku/heroku-parse.d.ts.map +1 -0
- package/dist/infra/heroku/heroku-parse.js +63 -0
- package/dist/infra/heroku/heroku-parse.js.map +1 -0
- package/dist/infra/heroku/heroku.d.ts +24 -0
- package/dist/infra/heroku/heroku.d.ts.map +1 -0
- package/dist/infra/heroku/heroku.js +253 -0
- package/dist/infra/heroku/heroku.js.map +1 -0
- package/dist/infra/image-resolve.d.ts +56 -0
- package/dist/infra/image-resolve.d.ts.map +1 -0
- package/dist/infra/image-resolve.js +229 -0
- package/dist/infra/image-resolve.js.map +1 -0
- package/dist/infra/infra-step.d.ts +39 -0
- package/dist/infra/infra-step.d.ts.map +1 -0
- package/dist/infra/infra-step.js +57 -0
- package/dist/infra/infra-step.js.map +1 -0
- package/dist/infra/k8s/index.d.ts +78 -0
- package/dist/infra/k8s/index.d.ts.map +1 -0
- package/dist/infra/k8s/index.js +251 -0
- package/dist/infra/k8s/index.js.map +1 -0
- package/dist/infra/kamal/kamal-parse.d.ts +23 -0
- package/dist/infra/kamal/kamal-parse.d.ts.map +1 -0
- package/dist/infra/kamal/kamal-parse.js +66 -0
- package/dist/infra/kamal/kamal-parse.js.map +1 -0
- package/dist/infra/kamal/kamal.d.ts +17 -0
- package/dist/infra/kamal/kamal.d.ts.map +1 -0
- package/dist/infra/kamal/kamal.js +162 -0
- package/dist/infra/kamal/kamal.js.map +1 -0
- package/dist/infra/netlify/netlify.d.ts +33 -0
- package/dist/infra/netlify/netlify.d.ts.map +1 -0
- package/dist/infra/netlify/netlify.js +247 -0
- package/dist/infra/netlify/netlify.js.map +1 -0
- package/dist/infra/opentofu/opentofu.d.ts +3 -0
- package/dist/infra/opentofu/opentofu.d.ts.map +1 -0
- package/dist/infra/opentofu/opentofu.js +157 -0
- package/dist/infra/opentofu/opentofu.js.map +1 -0
- package/dist/infra/pulumi/pulumi-parse.d.ts +60 -0
- package/dist/infra/pulumi/pulumi-parse.d.ts.map +1 -0
- package/dist/infra/pulumi/pulumi-parse.js +155 -0
- package/dist/infra/pulumi/pulumi-parse.js.map +1 -0
- package/dist/infra/pulumi/pulumi.d.ts +23 -0
- package/dist/infra/pulumi/pulumi.d.ts.map +1 -0
- package/dist/infra/pulumi/pulumi.js +260 -0
- package/dist/infra/pulumi/pulumi.js.map +1 -0
- package/dist/infra/railway/railway-parse.d.ts +54 -0
- package/dist/infra/railway/railway-parse.d.ts.map +1 -0
- package/dist/infra/railway/railway-parse.js +200 -0
- package/dist/infra/railway/railway-parse.js.map +1 -0
- package/dist/infra/railway/railway.d.ts +19 -0
- package/dist/infra/railway/railway.d.ts.map +1 -0
- package/dist/infra/railway/railway.js +397 -0
- package/dist/infra/railway/railway.js.map +1 -0
- package/dist/infra/register.d.ts +2 -0
- package/dist/infra/register.d.ts.map +1 -0
- package/dist/infra/register.js +81 -0
- package/dist/infra/register.js.map +1 -0
- package/dist/infra/registry.d.ts +64 -0
- package/dist/infra/registry.d.ts.map +1 -0
- package/dist/infra/registry.js +205 -0
- package/dist/infra/registry.js.map +1 -0
- package/dist/infra/relevance.d.ts +16 -0
- package/dist/infra/relevance.d.ts.map +1 -0
- package/dist/infra/relevance.js +132 -0
- package/dist/infra/relevance.js.map +1 -0
- package/dist/infra/render/render-parse.d.ts +76 -0
- package/dist/infra/render/render-parse.d.ts.map +1 -0
- package/dist/infra/render/render-parse.js +155 -0
- package/dist/infra/render/render-parse.js.map +1 -0
- package/dist/infra/render/render.d.ts +11 -0
- package/dist/infra/render/render.d.ts.map +1 -0
- package/dist/infra/render/render.js +303 -0
- package/dist/infra/render/render.js.map +1 -0
- package/dist/infra/sst/sst-parse.d.ts +25 -0
- package/dist/infra/sst/sst-parse.d.ts.map +1 -0
- package/dist/infra/sst/sst-parse.js +45 -0
- package/dist/infra/sst/sst-parse.js.map +1 -0
- package/dist/infra/sst/sst.d.ts +19 -0
- package/dist/infra/sst/sst.d.ts.map +1 -0
- package/dist/infra/sst/sst.js +236 -0
- package/dist/infra/sst/sst.js.map +1 -0
- package/dist/infra/supabase/supabase-parse.d.ts +34 -0
- package/dist/infra/supabase/supabase-parse.d.ts.map +1 -0
- package/dist/infra/supabase/supabase-parse.js +113 -0
- package/dist/infra/supabase/supabase-parse.js.map +1 -0
- package/dist/infra/supabase/supabase.d.ts +15 -0
- package/dist/infra/supabase/supabase.d.ts.map +1 -0
- package/dist/infra/supabase/supabase.js +198 -0
- package/dist/infra/supabase/supabase.js.map +1 -0
- package/dist/infra/terraform/hcl-parse.d.ts +34 -0
- package/dist/infra/terraform/hcl-parse.d.ts.map +1 -0
- package/dist/infra/terraform/hcl-parse.js +203 -0
- package/dist/infra/terraform/hcl-parse.js.map +1 -0
- package/dist/infra/terraform/terraform.d.ts +14 -0
- package/dist/infra/terraform/terraform.d.ts.map +1 -0
- package/dist/infra/terraform/terraform.js +264 -0
- package/dist/infra/terraform/terraform.js.map +1 -0
- package/dist/infra/types.d.ts +151 -0
- package/dist/infra/types.d.ts.map +1 -0
- package/dist/infra/types.js +14 -0
- package/dist/infra/types.js.map +1 -0
- package/dist/infra/vercel/vercel-parse.d.ts +70 -0
- package/dist/infra/vercel/vercel-parse.d.ts.map +1 -0
- package/dist/infra/vercel/vercel-parse.js +194 -0
- package/dist/infra/vercel/vercel-parse.js.map +1 -0
- package/dist/infra/vercel/vercel.d.ts +30 -0
- package/dist/infra/vercel/vercel.d.ts.map +1 -0
- package/dist/infra/vercel/vercel.js +523 -0
- package/dist/infra/vercel/vercel.js.map +1 -0
- package/dist/infra/walk.d.ts +36 -0
- package/dist/infra/walk.d.ts.map +1 -0
- package/dist/infra/walk.js +85 -0
- package/dist/infra/walk.js.map +1 -0
- package/dist/safety.d.ts +13 -0
- package/dist/safety.d.ts.map +1 -0
- package/dist/safety.js +67 -0
- package/dist/safety.js.map +1 -0
- package/dist/types.d.ts +47 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +111 -0
- package/dist/types.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +35 -0
- package/dist/version.js.map +1 -0
- package/package.json +65 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Table names declared by a `convex/schema.ts`. Convex schemas are
|
|
3
|
+
* export default defineSchema({ messages: defineTable({…}), users: defineTable({…}) })
|
|
4
|
+
* so a table is any object KEY whose value is a `defineTable(` call. The key may
|
|
5
|
+
* be a bare identifier or a quoted string. Index/search chaining
|
|
6
|
+
* (`defineTable({…}).index(…)`) doesn't affect the key match. Deterministic,
|
|
7
|
+
* sorted, deduped. Returns [] for a schemaless repo (no schema.ts).
|
|
8
|
+
*/
|
|
9
|
+
export declare function parseConvexSchema(source: string): string[];
|
|
10
|
+
/**
|
|
11
|
+
* The configured functions dir from a `convex.json`, repo-relative + normalized
|
|
12
|
+
* (no leading `./`, no trailing `/`). Convex's `functions` key overrides the
|
|
13
|
+
* default `convex/` dir. Returns undefined ONLY when the key is absent / blank /
|
|
14
|
+
* unparseable — the caller then falls back to the `convex` convention. A key that
|
|
15
|
+
* is PRESENT but normalizes to the repo root (`"."`, `"./"`) returns '' — an
|
|
16
|
+
* explicit repo-root deploy, distinct from "absent": the caller keeps it (so the
|
|
17
|
+
* worker still renders) and the repo-root guard drops its sourceRoots (no catch-all).
|
|
18
|
+
*/
|
|
19
|
+
export declare function parseConvexFunctionsDir(json: string): string | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* Does this source file read/write the Convex database? Convex query/mutation
|
|
22
|
+
* functions receive a `ctx` with a `db` handle (`ctx.db.query(...)`,
|
|
23
|
+
* `ctx.db.insert(...)`); some destructure it (`const { db } = ctx`). We gate the
|
|
24
|
+
* function→datastore edge on this evidence so a functions-only-no-data repo
|
|
25
|
+
* doesn't sprout a phantom `stores-in`. Comment-stripped to avoid false hits.
|
|
26
|
+
*/
|
|
27
|
+
export declare function usesConvexDb(source: string): boolean;
|
|
28
|
+
//# sourceMappingURL=convex-parse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convex-parse.d.ts","sourceRoot":"","sources":["../../../src/infra/convex/convex-parse.ts"],"names":[],"mappings":"AAgBA;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAW1D;AAED;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAWxE;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAKpD"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// Convex config + schema + source-usage parsers.
|
|
2
|
+
//
|
|
3
|
+
// All pure (string in, data out) and dependency-free — the same vitest invariant
|
|
4
|
+
// as supabase-parse.ts / compose-parse.ts: unit-testable without the Convex/fs
|
|
5
|
+
// import chain. Three deterministic signals feed the adapter:
|
|
6
|
+
// 1. convex.json `functions` → the functions dir (default `convex/`)
|
|
7
|
+
// 2. convex/schema.ts → the table inventory (defineTable keys)
|
|
8
|
+
// 3. source `ctx.db` usage → the function→datastore `stores-in` edge
|
|
9
|
+
// (evidence-gated, like Supabase's `.from()` grep)
|
|
10
|
+
/** Strip `//` line comments and `/* … *\/` block comments so a commented
|
|
11
|
+
* `defineTable` / `ctx.db` can't register a phantom table or edge. */
|
|
12
|
+
function stripComments(src) {
|
|
13
|
+
return src.replace(/\/\/[^\n]*/g, ' ').replace(/\/\*[\s\S]*?\*\//g, ' ');
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Table names declared by a `convex/schema.ts`. Convex schemas are
|
|
17
|
+
* export default defineSchema({ messages: defineTable({…}), users: defineTable({…}) })
|
|
18
|
+
* so a table is any object KEY whose value is a `defineTable(` call. The key may
|
|
19
|
+
* be a bare identifier or a quoted string. Index/search chaining
|
|
20
|
+
* (`defineTable({…}).index(…)`) doesn't affect the key match. Deterministic,
|
|
21
|
+
* sorted, deduped. Returns [] for a schemaless repo (no schema.ts).
|
|
22
|
+
*/
|
|
23
|
+
export function parseConvexSchema(source) {
|
|
24
|
+
const tables = new Set();
|
|
25
|
+
const src = stripComments(source);
|
|
26
|
+
// key (bare | "quoted" | 'quoted') : defineTable(
|
|
27
|
+
const re = /(?:^|[,{(])\s*(?:"([^"]+)"|'([^']+)'|([A-Za-z_$][\w$]*))\s*:\s*defineTable\s*\(/g;
|
|
28
|
+
let m;
|
|
29
|
+
while ((m = re.exec(src))) {
|
|
30
|
+
const name = m[1] ?? m[2] ?? m[3];
|
|
31
|
+
if (name)
|
|
32
|
+
tables.add(name);
|
|
33
|
+
}
|
|
34
|
+
return [...tables].sort();
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* The configured functions dir from a `convex.json`, repo-relative + normalized
|
|
38
|
+
* (no leading `./`, no trailing `/`). Convex's `functions` key overrides the
|
|
39
|
+
* default `convex/` dir. Returns undefined ONLY when the key is absent / blank /
|
|
40
|
+
* unparseable — the caller then falls back to the `convex` convention. A key that
|
|
41
|
+
* is PRESENT but normalizes to the repo root (`"."`, `"./"`) returns '' — an
|
|
42
|
+
* explicit repo-root deploy, distinct from "absent": the caller keeps it (so the
|
|
43
|
+
* worker still renders) and the repo-root guard drops its sourceRoots (no catch-all).
|
|
44
|
+
*/
|
|
45
|
+
export function parseConvexFunctionsDir(json) {
|
|
46
|
+
let doc;
|
|
47
|
+
try {
|
|
48
|
+
doc = JSON.parse(json);
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
return undefined;
|
|
52
|
+
}
|
|
53
|
+
if (!doc || typeof doc !== 'object')
|
|
54
|
+
return undefined;
|
|
55
|
+
const fns = doc.functions;
|
|
56
|
+
if (typeof fns !== 'string' || !fns.trim())
|
|
57
|
+
return undefined;
|
|
58
|
+
return fns.replace(/\\/g, '/').replace(/^\.\//, '').replace(/\/+$/, '').replace(/^\.$/, '');
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Does this source file read/write the Convex database? Convex query/mutation
|
|
62
|
+
* functions receive a `ctx` with a `db` handle (`ctx.db.query(...)`,
|
|
63
|
+
* `ctx.db.insert(...)`); some destructure it (`const { db } = ctx`). We gate the
|
|
64
|
+
* function→datastore edge on this evidence so a functions-only-no-data repo
|
|
65
|
+
* doesn't sprout a phantom `stores-in`. Comment-stripped to avoid false hits.
|
|
66
|
+
*/
|
|
67
|
+
export function usesConvexDb(source) {
|
|
68
|
+
const src = stripComments(source);
|
|
69
|
+
if (/\bctx\s*\.\s*db\b/.test(src))
|
|
70
|
+
return true;
|
|
71
|
+
// Destructured handle: `db.query(` / `db.insert(` / `db.get(` / …
|
|
72
|
+
return /\bdb\s*\.\s*(?:query|get|insert|patch|replace|delete|normalizeId|system)\s*\(/.test(src);
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=convex-parse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convex-parse.js","sourceRoot":"","sources":["../../../src/infra/convex/convex-parse.ts"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,EAAE;AACF,iFAAiF;AACjF,+EAA+E;AAC/E,8DAA8D;AAC9D,yEAAyE;AACzE,0EAA0E;AAC1E,2EAA2E;AAC3E,wDAAwD;AAExD;sEACsE;AACtE,SAAS,aAAa,CAAC,GAAW;IAChC,OAAO,GAAG,CAAC,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC,OAA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CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AAC9F,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAAC,MAAc;IACzC,MAAM,GAAG,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;IAClC,IAAI,mBAAmB,CAAC,IAAI,CAAC,GAAG,CAAC;QAAE,OAAO,IAAI,CAAC;IAC/C,kEAAkE;IAClE,OAAO,+EAA+E,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACnG,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { InfraAdapter, InfraGraph } from '../types.js';
|
|
2
|
+
export interface ConvexFacts {
|
|
3
|
+
/** Repo-relative, normalized functions dir ('' = repo root → no source root). */
|
|
4
|
+
functionsDir: string;
|
|
5
|
+
/** Does `<functionsDir>` exist? (false ⇒ no worker, datastore-only) */
|
|
6
|
+
functionsDirExists: boolean;
|
|
7
|
+
/** Table names from `<functionsDir>/schema.ts` (sorted, deduped; [] = schemaless). */
|
|
8
|
+
tables: string[];
|
|
9
|
+
/** Does `<functionsDir>/http.ts` (or .js) exist? (the httpActions router) */
|
|
10
|
+
hasHttpRouter: boolean;
|
|
11
|
+
/** Count of authored function source files (excl. _generated, schema, tests). */
|
|
12
|
+
functionFileCount: number;
|
|
13
|
+
/** Did any function file use `ctx.db`? (gates the stores-in edge) */
|
|
14
|
+
usesDb: boolean;
|
|
15
|
+
}
|
|
16
|
+
export declare function buildConvexGraph(facts: ConvexFacts, root: string): InfraGraph;
|
|
17
|
+
export declare const convexAdapter: InfraAdapter;
|
|
18
|
+
//# sourceMappingURL=convex.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convex.d.ts","sourceRoot":"","sources":["../../../src/infra/convex/convex.ts"],"names":[],"mappings":"AAqCA,OAAO,KAAK,EAAE,YAAY,EAAa,UAAU,EAAa,MAAM,aAAa,CAAC;AAkBlF,MAAM,WAAW,WAAW;IAC1B,iFAAiF;IACjF,YAAY,EAAE,MAAM,CAAC;IACrB,uEAAuE;IACvE,kBAAkB,EAAE,OAAO,CAAC;IAC5B,sFAAsF;IACtF,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,6EAA6E;IAC7E,aAAa,EAAE,OAAO,CAAC;IACvB,iFAAiF;IACjF,iBAAiB,EAAE,MAAM,CAAC;IAC1B,qEAAqE;IACrE,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,GAAG,UAAU,CA+C7E;AAgFD,eAAO,MAAM,aAAa,EAAE,YAoC3B,CAAC"}
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
// the Convex InfraAdapter (net-new infra coverage, child of ).
|
|
2
|
+
//
|
|
3
|
+
// Convex is the reactive TS backend AI builders (v0 / Cursor / Lovable) scaffold
|
|
4
|
+
// onto — squarely the vibecoder / rescue-mode persona, so it's the highest-ICP
|
|
5
|
+
// adapter of the SST/Convex/Kamal epic. It is SOURCE-based (functions ARE your
|
|
6
|
+
// code), so unlike the image-referencing adapters it needs NO image resolver.
|
|
7
|
+
//
|
|
8
|
+
// A Convex app deploys as ONE backend: every file under the functions dir
|
|
9
|
+
// (`convex/` by default, or convex.json's `functions`) is pushed to Convex's
|
|
10
|
+
// serverless runtime as a single unit, and the app's tables live in Convex's
|
|
11
|
+
// managed datastore. So we model two nodes — not one-per-file (which would split
|
|
12
|
+
// `sourceRoots` across N units all claiming the same dir and tie attribution):
|
|
13
|
+
//
|
|
14
|
+
// Kind mapping (locked 8-kind InfraModuleKind enum — map onto it, never weaken):
|
|
15
|
+
// the functions deployment (queries/mutations/actions/httpActions, incl. the
|
|
16
|
+
// convex/http.ts router) → worker (serverless compute = your code)
|
|
17
|
+
// the Convex database (schema tables) → datastore (managed persistent storage)
|
|
18
|
+
//
|
|
19
|
+
// sourceRoots: the functions dir IS the deploy unit's source — so the
|
|
20
|
+
// worker carries `sourceRoots: [functionsDir]` and convex/ code attributes to the
|
|
21
|
+
// Convex zone instead of "Other". The datastore runs no code of yours → no
|
|
22
|
+
// sourceRoots. A functions dir that resolves to the repo root ('') is dropped
|
|
23
|
+
// (never a catch-all that swallows siblings — the shared adapter guard).
|
|
24
|
+
//
|
|
25
|
+
// Graceful degradation: a repo that trips detect() only on a `convex` dep (no
|
|
26
|
+
// functions dir) emits just the datastore anchor — no worker, no sourceRoots, so
|
|
27
|
+
// its code honestly stays in "Other (not deployed)." NEVER guess a source root.
|
|
28
|
+
//
|
|
29
|
+
// Evidence-gated edge (the Supabase `.from()`-grep discipline): worker→datastore
|
|
30
|
+
// `stores-in` is emitted only when a function actually uses `ctx.db` OR a schema
|
|
31
|
+
// declares tables — both are honest proof the backend stores data. No phantom edge.
|
|
32
|
+
//
|
|
33
|
+
// Zone label: "Convex" (PROVIDER_ZONE_LABEL['convex'] in assemble/zones.ts).
|
|
34
|
+
// Entirely declared/inferred provenance; no LLM (classificationsNeeded: []).
|
|
35
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
36
|
+
import { join } from 'node:path';
|
|
37
|
+
import { walkRepo, DEFAULT_SKIP_DIRS } from '../walk.js';
|
|
38
|
+
import { parseConvexSchema, parseConvexFunctionsDir, usesConvexDb } from './convex-parse.js';
|
|
39
|
+
const DEFAULT_FUNCTIONS_DIR = 'convex';
|
|
40
|
+
const CONFIG_NAME = 'convex.json';
|
|
41
|
+
const SOURCE_EXT = /\.(ts|tsx|js|jsx|mjs|cjs)$/;
|
|
42
|
+
// Convex's codegen dir — generated, never authored, so excluded from the
|
|
43
|
+
// function-file count and the ctx.db grep (it's not the app's own functions).
|
|
44
|
+
const GENERATED_DIR = '_generated';
|
|
45
|
+
const DB_ID = 'db';
|
|
46
|
+
const FUNCTIONS_ID = 'functions';
|
|
47
|
+
export function buildConvexGraph(facts, root) {
|
|
48
|
+
const { functionsDir, functionsDirExists, tables, hasHttpRouter, functionFileCount, usesDb } = facts;
|
|
49
|
+
const nodes = [];
|
|
50
|
+
const edges = [];
|
|
51
|
+
// The Convex managed datastore — the always-present anchor (a Convex app always
|
|
52
|
+
// has the managed DB, even when schemaless). Table inventory on its metadata,
|
|
53
|
+
// mirroring Supabase's Postgres node.
|
|
54
|
+
nodes.push({
|
|
55
|
+
id: DB_ID,
|
|
56
|
+
label: 'Convex Database',
|
|
57
|
+
kind: 'datastore',
|
|
58
|
+
provenance: 'declared',
|
|
59
|
+
metadata: { provider: 'convex', tables: tables.slice(0, 50), tableCount: tables.length },
|
|
60
|
+
});
|
|
61
|
+
// The functions deployment → a worker. Only when the functions dir exists (it's
|
|
62
|
+
// the deploy unit); its dir is the sourceRoot (dropped if it's the repo root).
|
|
63
|
+
if (functionsDirExists) {
|
|
64
|
+
const node = {
|
|
65
|
+
id: FUNCTIONS_ID,
|
|
66
|
+
label: 'Convex functions',
|
|
67
|
+
kind: 'worker',
|
|
68
|
+
provenance: 'declared',
|
|
69
|
+
metadata: {
|
|
70
|
+
provider: 'convex',
|
|
71
|
+
functionsDir,
|
|
72
|
+
functionFiles: functionFileCount,
|
|
73
|
+
hasHttpRouter,
|
|
74
|
+
},
|
|
75
|
+
...(functionsDir ? { sourceRoots: [functionsDir] } : {}),
|
|
76
|
+
};
|
|
77
|
+
nodes.push(node);
|
|
78
|
+
// worker → datastore `stores-in`, evidence-gated: a real `ctx.db` use OR a
|
|
79
|
+
// declared schema (tables can't exist without something storing in them).
|
|
80
|
+
if (usesDb || tables.length > 0) {
|
|
81
|
+
edges.push({
|
|
82
|
+
source: FUNCTIONS_ID,
|
|
83
|
+
target: DB_ID,
|
|
84
|
+
kind: 'stores-in',
|
|
85
|
+
metadata: { via: usesDb ? 'ctx.db' : 'schema' },
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return { root, adapter: 'convex', nodes, edges, classificationsNeeded: [] };
|
|
90
|
+
}
|
|
91
|
+
// ---------------------------------------------------------------------------
|
|
92
|
+
// fs helpers for extract().
|
|
93
|
+
/** The configured functions dir (convex.json `functions`) or the `convex` default. */
|
|
94
|
+
function resolveFunctionsDir(repoDir) {
|
|
95
|
+
const cfg = join(repoDir, CONFIG_NAME);
|
|
96
|
+
if (existsSync(cfg)) {
|
|
97
|
+
try {
|
|
98
|
+
const dir = parseConvexFunctionsDir(readFileSync(cfg, 'utf8'));
|
|
99
|
+
if (dir !== undefined)
|
|
100
|
+
return dir;
|
|
101
|
+
}
|
|
102
|
+
catch {
|
|
103
|
+
/* unreadable convex.json — fall through to the default */
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return DEFAULT_FUNCTIONS_DIR;
|
|
107
|
+
}
|
|
108
|
+
/** Read the table inventory from `<functionsDir>/schema.ts` (or schema.js). */
|
|
109
|
+
function collectTables(repoDir, functionsDir) {
|
|
110
|
+
for (const name of ['schema.ts', 'schema.js']) {
|
|
111
|
+
const p = join(repoDir, functionsDir, name);
|
|
112
|
+
if (existsSync(p)) {
|
|
113
|
+
try {
|
|
114
|
+
return parseConvexSchema(readFileSync(p, 'utf8'));
|
|
115
|
+
}
|
|
116
|
+
catch {
|
|
117
|
+
return [];
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return [];
|
|
122
|
+
}
|
|
123
|
+
/** Walk the functions dir: count authored function files + detect ctx.db usage. */
|
|
124
|
+
function scanFunctions(repoDir, functionsDir) {
|
|
125
|
+
// A repo-root functions dir ('', from convex.json `"functions": "."`) would make
|
|
126
|
+
// `dir === repoDir` and scan the ENTIRE repo — inflating the file count and
|
|
127
|
+
// risking a false ctx.db hit. The worker emits no sourceRoots in that case
|
|
128
|
+
// anyway (repo-root guard), so the deep scan buys nothing: skip it.
|
|
129
|
+
if (!functionsDir)
|
|
130
|
+
return { functionFileCount: 0, usesDb: false };
|
|
131
|
+
const dir = join(repoDir, functionsDir);
|
|
132
|
+
if (!existsSync(dir))
|
|
133
|
+
return { functionFileCount: 0, usesDb: false };
|
|
134
|
+
let functionFileCount = 0;
|
|
135
|
+
let usesDb = false;
|
|
136
|
+
walkRepo(dir, {
|
|
137
|
+
skipDirs: [...DEFAULT_SKIP_DIRS, GENERATED_DIR],
|
|
138
|
+
onFile: (abs, e) => {
|
|
139
|
+
if (!SOURCE_EXT.test(e.name))
|
|
140
|
+
return;
|
|
141
|
+
if (e.name.endsWith('.d.ts') || e.name.endsWith('.test.ts'))
|
|
142
|
+
return;
|
|
143
|
+
// schema.ts is config, not a deployed function — don't count it as one.
|
|
144
|
+
const isSchema = e.name === 'schema.ts' || e.name === 'schema.js';
|
|
145
|
+
if (!isSchema)
|
|
146
|
+
functionFileCount += 1;
|
|
147
|
+
if (!usesDb) {
|
|
148
|
+
try {
|
|
149
|
+
if (usesConvexDb(readFileSync(abs, 'utf8')))
|
|
150
|
+
usesDb = true;
|
|
151
|
+
}
|
|
152
|
+
catch {
|
|
153
|
+
/* unreadable file — skip */
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
});
|
|
158
|
+
return { functionFileCount, usesDb };
|
|
159
|
+
}
|
|
160
|
+
function hasConvexDep(repoDir) {
|
|
161
|
+
try {
|
|
162
|
+
const pkg = JSON.parse(readFileSync(join(repoDir, 'package.json'), 'utf8'));
|
|
163
|
+
return Boolean(pkg.dependencies?.convex || pkg.devDependencies?.convex);
|
|
164
|
+
}
|
|
165
|
+
catch {
|
|
166
|
+
return false;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
// ---------------------------------------------------------------------------
|
|
170
|
+
// Adapter.
|
|
171
|
+
export const convexAdapter = {
|
|
172
|
+
name: 'convex',
|
|
173
|
+
async detect(repoDir) {
|
|
174
|
+
// Primary: the convex/ dir or a convex.json. Secondary: a `convex` dep (a
|
|
175
|
+
// project mid-setup before its functions dir exists).
|
|
176
|
+
return (existsSync(join(repoDir, DEFAULT_FUNCTIONS_DIR)) ||
|
|
177
|
+
existsSync(join(repoDir, CONFIG_NAME)) ||
|
|
178
|
+
hasConvexDep(repoDir));
|
|
179
|
+
},
|
|
180
|
+
// Convex derives its topology from ordinary source under the functions
|
|
181
|
+
// dir — schema.ts (tables) + the `ctx.db` grep (the stores-in edge). So a change
|
|
182
|
+
// to a `convex/**` source file can change the infra graph and MUST force a
|
|
183
|
+
// re-extract in the diff-driven hosted walk rather than reuse a stale carry.
|
|
184
|
+
// (Default `convex/` convention; a convex.json-relocated functions dir is a v0
|
|
185
|
+
// limitation — the same coarse detect()/extract() mismatch the Pulumi adapter notes.)
|
|
186
|
+
scansSourcePath(path) {
|
|
187
|
+
const p = path.replace(/\\/g, '/');
|
|
188
|
+
return (p === DEFAULT_FUNCTIONS_DIR || p.startsWith(`${DEFAULT_FUNCTIONS_DIR}/`)) && SOURCE_EXT.test(p);
|
|
189
|
+
},
|
|
190
|
+
async extract(repoDir) {
|
|
191
|
+
const functionsDir = resolveFunctionsDir(repoDir);
|
|
192
|
+
const functionsDirExists = existsSync(join(repoDir, functionsDir));
|
|
193
|
+
const tables = collectTables(repoDir, functionsDir);
|
|
194
|
+
const hasHttpRouter = existsSync(join(repoDir, functionsDir, 'http.ts')) || existsSync(join(repoDir, functionsDir, 'http.js'));
|
|
195
|
+
const { functionFileCount, usesDb } = scanFunctions(repoDir, functionsDir);
|
|
196
|
+
return buildConvexGraph({ functionsDir, functionsDirExists, tables, hasHttpRouter, functionFileCount, usesDb }, repoDir);
|
|
197
|
+
},
|
|
198
|
+
};
|
|
199
|
+
//# sourceMappingURL=convex.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convex.js","sourceRoot":"","sources":["../../../src/infra/convex/convex.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,EAAE;AACF,iFAAiF;AACjF,+EAA+E;AAC/E,+EAA+E;AAC/E,8EAA8E;AAC9E,EAAE;AACF,0EAA0E;AAC1E,6EAA6E;AAC7E,6EAA6E;AAC7E,iFAAiF;AACjF,+EAA+E;AAC/E,EAAE;AACF,iFAAiF;AAC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kB,EAAE,MAAM,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,EAAE,EACtF,OAAO,CACR,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { InfraAdapter, InfraGraph } from '../types.js';
|
|
2
|
+
export interface DoComponent {
|
|
3
|
+
name: string;
|
|
4
|
+
/** Repo-root-relative source dir (the deployed code). */
|
|
5
|
+
sourceDir?: string;
|
|
6
|
+
/** Database component names referenced via `${<name>.…}` bindable vars in envs. */
|
|
7
|
+
dbRefs: string[];
|
|
8
|
+
}
|
|
9
|
+
export interface DoDatabase {
|
|
10
|
+
name: string;
|
|
11
|
+
engine?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface DoAppSpec {
|
|
14
|
+
name?: string;
|
|
15
|
+
services: DoComponent[];
|
|
16
|
+
staticSites: DoComponent[];
|
|
17
|
+
workers: DoComponent[];
|
|
18
|
+
jobs: DoComponent[];
|
|
19
|
+
functions: DoComponent[];
|
|
20
|
+
databases: DoDatabase[];
|
|
21
|
+
}
|
|
22
|
+
/** Pure: a parsed DO app-spec object → the typed DoAppSpec. */
|
|
23
|
+
export declare function parseDoAppSpec(tree: unknown): DoAppSpec;
|
|
24
|
+
/**
|
|
25
|
+
* Is this a DO App Platform spec? A spec has a top-level component array
|
|
26
|
+
* (`services`/`static_sites`/`workers`/`jobs`/`functions`) or a `databases`
|
|
27
|
+
* array. Used to confirm a `.do/*.yaml` really is an app spec (vs an unrelated
|
|
28
|
+
* yaml that happens to live under `.do/`).
|
|
29
|
+
*/
|
|
30
|
+
export declare function looksLikeDoSpec(tree: unknown): boolean;
|
|
31
|
+
export declare function buildDigitalOceanGraph(spec: DoAppSpec, root: string, configFile: string): InfraGraph;
|
|
32
|
+
export declare const digitaloceanAdapter: InfraAdapter;
|
|
33
|
+
//# sourceMappingURL=digitalocean.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"digitalocean.d.ts","sourceRoot":"","sources":["../../../src/infra/digitalocean/digitalocean.ts"],"names":[],"mappings":"AAgCA,OAAO,KAAK,EAAE,YAAY,EAAa,UAAU,EAAa,MAAM,aAAa,CAAC;AAqBlF,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,yDAAyD;IACzD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mFAAmF;IACnF,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,WAAW,EAAE,CAAC;IACxB,WAAW,EAAE,WAAW,EAAE,CAAC;IAC3B,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,IAAI,EAAE,WAAW,EAAE,CAAC;IACpB,SAAS,EAAE,WAAW,EAAE,CAAC;IACzB,SAAS,EAAE,UAAU,EAAE,CAAC;CACzB;AAyBD,+DAA+D;AAC/D,wBAAgB,cAAc,CAAC,IAAI,EAAE,OAAO,GAAG,SAAS,CAYvD;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAGtD;AAeD,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,UAAU,CAiDpG;AAmBD,eAAO,MAAM,mBAAmB,EAAE,YAyCjC,CAAC"}
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
// the DigitalOcean App Platform InfraAdapter.
|
|
2
|
+
//
|
|
3
|
+
// DigitalOcean is #4 at ~10.7% adoption (2025 SO survey). This surfaces a DO App
|
|
4
|
+
// Platform deployment from the **app spec** (`.do/app.yaml` / `.do/deploy.template.yaml`).
|
|
5
|
+
//
|
|
6
|
+
// ⚠️ Detection keys off the `.do/` DIR, NOT a bare `app.yaml` — `app.yaml` is also
|
|
7
|
+
// GCP App Engine's filename (our GCP adapter claims it). A DO spec has no top-level
|
|
8
|
+
// `runtime`/`apiVersion`, so GCP's parser returns nothing on it anyway (verified in
|
|
9
|
+
// the tests), but we still scope DO detection to `.do/` so the two never fight.
|
|
10
|
+
//
|
|
11
|
+
// Kind mapping (locked 8-kind InfraModuleKind enum — map onto it, never weaken;
|
|
12
|
+
// `service`/`job` are app-role ModuleKinds, NOT InfraModuleKinds, so an InfraNode
|
|
13
|
+
// can't carry them — the DO component type is preserved in metadata instead):
|
|
14
|
+
// services → worker (source-build PaaS compute — same convention as Render/Fly)
|
|
15
|
+
// workers → worker
|
|
16
|
+
// jobs → worker (run-to-completion; componentType: 'job' in metadata)
|
|
17
|
+
// functions → worker (DO Functions)
|
|
18
|
+
// static_sites→ static-site
|
|
19
|
+
// databases → datastore (managed; no source)
|
|
20
|
+
//
|
|
21
|
+
// sourceRoots: each component's `source_dir` (repo-root-relative in the
|
|
22
|
+
// DO spec) → clean per-unit attribution. A `source_dir` of `/` (repo root) yields
|
|
23
|
+
// no source root (no catch-all). Databases carry none.
|
|
24
|
+
//
|
|
25
|
+
// Edges: a component whose `envs` reference a database bindable var (`${<db>.…}`)
|
|
26
|
+
// `stores-in` that database — the one declarative dependency the spec carries.
|
|
27
|
+
//
|
|
28
|
+
// Zone label: "DigitalOcean" (PROVIDER_ZONE_LABEL['digitalocean'] in zones.ts).
|
|
29
|
+
import { readFileSync } from 'node:fs';
|
|
30
|
+
import { relative } from 'node:path';
|
|
31
|
+
import { parse as parseYaml } from 'yaml';
|
|
32
|
+
import { findFiles } from '../walk.js';
|
|
33
|
+
// ---------------------------------------------------------------------------
|
|
34
|
+
// Path helper.
|
|
35
|
+
function normalizeRoot(p) {
|
|
36
|
+
return p.replace(/\\/g, '/').replace(/^\.?\//, '').replace(/\/+$/, '');
|
|
37
|
+
}
|
|
38
|
+
function str(v) {
|
|
39
|
+
return typeof v === 'string' && v ? v : undefined;
|
|
40
|
+
}
|
|
41
|
+
function arr(v) {
|
|
42
|
+
return Array.isArray(v) ? v.filter((x) => x && typeof x === 'object') : [];
|
|
43
|
+
}
|
|
44
|
+
const DB_REF_RE = /\$\{([A-Za-z0-9_-]+)\./g;
|
|
45
|
+
function parseComponent(raw) {
|
|
46
|
+
const name = str(raw.name);
|
|
47
|
+
if (!name)
|
|
48
|
+
return null;
|
|
49
|
+
const dbRefs = new Set();
|
|
50
|
+
for (const e of arr(raw.envs)) {
|
|
51
|
+
const value = str(e.value);
|
|
52
|
+
if (!value)
|
|
53
|
+
continue;
|
|
54
|
+
for (const m of value.matchAll(DB_REF_RE))
|
|
55
|
+
dbRefs.add(m[1]);
|
|
56
|
+
}
|
|
57
|
+
const c = { name, dbRefs: [...dbRefs] };
|
|
58
|
+
const sourceDir = str(raw.source_dir);
|
|
59
|
+
if (sourceDir)
|
|
60
|
+
c.sourceDir = sourceDir;
|
|
61
|
+
return c;
|
|
62
|
+
}
|
|
63
|
+
function parseDatabase(raw) {
|
|
64
|
+
const name = str(raw.name);
|
|
65
|
+
if (!name)
|
|
66
|
+
return null;
|
|
67
|
+
return { name, engine: str(raw.engine) };
|
|
68
|
+
}
|
|
69
|
+
/** Pure: a parsed DO app-spec object → the typed DoAppSpec. */
|
|
70
|
+
export function parseDoAppSpec(tree) {
|
|
71
|
+
const root = (tree && typeof tree === 'object' && !Array.isArray(tree) ? tree : {});
|
|
72
|
+
const comp = (key) => arr(root[key]).map(parseComponent).filter((c) => c !== null);
|
|
73
|
+
return {
|
|
74
|
+
name: str(root.name),
|
|
75
|
+
services: comp('services'),
|
|
76
|
+
staticSites: comp('static_sites'),
|
|
77
|
+
workers: comp('workers'),
|
|
78
|
+
jobs: comp('jobs'),
|
|
79
|
+
functions: comp('functions'),
|
|
80
|
+
databases: arr(root.databases).map(parseDatabase).filter((d) => d !== null),
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Is this a DO App Platform spec? A spec has a top-level component array
|
|
85
|
+
* (`services`/`static_sites`/`workers`/`jobs`/`functions`) or a `databases`
|
|
86
|
+
* array. Used to confirm a `.do/*.yaml` really is an app spec (vs an unrelated
|
|
87
|
+
* yaml that happens to live under `.do/`).
|
|
88
|
+
*/
|
|
89
|
+
export function looksLikeDoSpec(tree) {
|
|
90
|
+
const r = tree && typeof tree === 'object' && !Array.isArray(tree) ? tree : {};
|
|
91
|
+
return ['services', 'static_sites', 'workers', 'jobs', 'functions', 'databases'].some((k) => Array.isArray(r[k]));
|
|
92
|
+
}
|
|
93
|
+
// ---------------------------------------------------------------------------
|
|
94
|
+
// Node-id helpers (adapter-local; registry prefixes `digitalocean:`).
|
|
95
|
+
const serviceId = (n) => `service:${n}`;
|
|
96
|
+
const staticId = (n) => `static:${n}`;
|
|
97
|
+
const workerId = (n) => `worker:${n}`;
|
|
98
|
+
const jobId = (n) => `job:${n}`;
|
|
99
|
+
const functionId = (n) => `function:${n}`;
|
|
100
|
+
const databaseId = (n) => `database:${n}`;
|
|
101
|
+
// ---------------------------------------------------------------------------
|
|
102
|
+
// Pure graph builder.
|
|
103
|
+
export function buildDigitalOceanGraph(spec, root, configFile) {
|
|
104
|
+
const nodes = new Map();
|
|
105
|
+
const edges = [];
|
|
106
|
+
const dbNames = new Set(spec.databases.map((d) => d.name));
|
|
107
|
+
const addNode = (n) => {
|
|
108
|
+
if (!nodes.has(n.id))
|
|
109
|
+
nodes.set(n.id, n);
|
|
110
|
+
};
|
|
111
|
+
// A code-deploying component → a node (kind from the DO component type, mapped
|
|
112
|
+
// onto InfraModuleKind) + its source_dir as the source root + db edges.
|
|
113
|
+
const addComponent = (c, id, kind, componentType) => {
|
|
114
|
+
const sr = c.sourceDir ? normalizeRoot(c.sourceDir) : '';
|
|
115
|
+
addNode({
|
|
116
|
+
id,
|
|
117
|
+
label: c.name,
|
|
118
|
+
kind,
|
|
119
|
+
provenance: 'declared',
|
|
120
|
+
metadata: { provider: 'digitalocean', config: configFile, componentType, ...(c.sourceDir ? { sourceDir: c.sourceDir } : {}) },
|
|
121
|
+
...(sr ? { sourceRoots: [sr] } : {}),
|
|
122
|
+
});
|
|
123
|
+
for (const ref of c.dbRefs) {
|
|
124
|
+
if (dbNames.has(ref)) {
|
|
125
|
+
edges.push({ source: id, target: databaseId(ref), kind: 'stores-in', metadata: { via: 'env-binding', config: configFile } });
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
for (const c of spec.services)
|
|
130
|
+
addComponent(c, serviceId(c.name), 'worker', 'service');
|
|
131
|
+
for (const c of spec.workers)
|
|
132
|
+
addComponent(c, workerId(c.name), 'worker', 'worker');
|
|
133
|
+
for (const c of spec.jobs)
|
|
134
|
+
addComponent(c, jobId(c.name), 'worker', 'job');
|
|
135
|
+
for (const c of spec.functions)
|
|
136
|
+
addComponent(c, functionId(c.name), 'worker', 'function');
|
|
137
|
+
for (const c of spec.staticSites)
|
|
138
|
+
addComponent(c, staticId(c.name), 'static-site', 'static_site');
|
|
139
|
+
for (const d of spec.databases) {
|
|
140
|
+
addNode({
|
|
141
|
+
id: databaseId(d.name),
|
|
142
|
+
label: d.name,
|
|
143
|
+
kind: 'datastore',
|
|
144
|
+
provenance: 'declared',
|
|
145
|
+
metadata: { provider: 'digitalocean', config: configFile, ...(d.engine ? { engine: d.engine } : {}) },
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
return { root, adapter: 'digitalocean', nodes: [...nodes.values()], edges, classificationsNeeded: [] };
|
|
149
|
+
}
|
|
150
|
+
// ---------------------------------------------------------------------------
|
|
151
|
+
// fs discovery — `.do/*.y(a)ml` only (NOT bare app.yaml elsewhere).
|
|
152
|
+
function findDoSpecFiles(repoDir) {
|
|
153
|
+
return findFiles(repoDir, (abs) => {
|
|
154
|
+
const rel = relative(repoDir, abs).split('\\').join('/');
|
|
155
|
+
return /(^|\/)\.do\/[^/]+\.ya?ml$/.test(rel);
|
|
156
|
+
}, { maxDepth: 5 });
|
|
157
|
+
}
|
|
158
|
+
// ---------------------------------------------------------------------------
|
|
159
|
+
// Adapter.
|
|
160
|
+
export const digitaloceanAdapter = {
|
|
161
|
+
name: 'digitalocean',
|
|
162
|
+
async detect(repoDir) {
|
|
163
|
+
// A `.do/*.yaml` that actually parses as an app spec (component arrays).
|
|
164
|
+
for (const file of findDoSpecFiles(repoDir)) {
|
|
165
|
+
try {
|
|
166
|
+
if (looksLikeDoSpec(parseYaml(readFileSync(file, 'utf8'), { logLevel: 'silent' })))
|
|
167
|
+
return true;
|
|
168
|
+
}
|
|
169
|
+
catch {
|
|
170
|
+
/* unparseable → not a usable spec */
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
return false;
|
|
174
|
+
},
|
|
175
|
+
async extract(repoDir) {
|
|
176
|
+
const files = findDoSpecFiles(repoDir);
|
|
177
|
+
const specs = [];
|
|
178
|
+
let configFile = '.do/app.yaml';
|
|
179
|
+
for (const file of files) {
|
|
180
|
+
try {
|
|
181
|
+
const tree = parseYaml(readFileSync(file, 'utf8'), { logLevel: 'silent' });
|
|
182
|
+
if (!looksLikeDoSpec(tree))
|
|
183
|
+
continue;
|
|
184
|
+
specs.push(parseDoAppSpec(tree));
|
|
185
|
+
configFile = (relative(repoDir, file) || file).split('\\').join('/');
|
|
186
|
+
}
|
|
187
|
+
catch (err) {
|
|
188
|
+
console.warn(` [digitalocean] skipping unparseable ${file}: ${err.message}`);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
// Merge multiple specs (rare) into one graph by concatenating their components.
|
|
192
|
+
const merged = { services: [], staticSites: [], workers: [], jobs: [], functions: [], databases: [] };
|
|
193
|
+
for (const s of specs) {
|
|
194
|
+
merged.services.push(...s.services);
|
|
195
|
+
merged.staticSites.push(...s.staticSites);
|
|
196
|
+
merged.workers.push(...s.workers);
|
|
197
|
+
merged.jobs.push(...s.jobs);
|
|
198
|
+
merged.functions.push(...s.functions);
|
|
199
|
+
merged.databases.push(...s.databases);
|
|
200
|
+
}
|
|
201
|
+
return buildDigitalOceanGraph(merged, repoDir, configFile);
|
|
202
|
+
},
|
|
203
|
+
};
|
|
204
|
+
//# sourceMappingURL=digitalocean.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"digitalocean.js","sourceRoot":"","sources":["../../../src/infra/digitalocean/digitalocean.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C,EAAE;AACF,iFAAiF;AACjF,2FAA2F;AAC3F,EAAE;AACF,mFAAmF;AACnF,oFAAoF;AACpF,oFAAoF;AACpF,gFAAgF;AAChF,EAAE;AACF,gFAAgF;AAChF,kFAAkF;AAClF,8EAA8E;AAC9E,0FAA0F;AAC1F,yBAAyB;AACzB,oFAAoF;AACpF,6CAA6C;AAC7C,8BAA8B;AAC9B,mDAAmD;AACnD,EAAE;AACF,wEAAwE;AACxE,kFAAkF;AAClF,uDAAuD;AACvD,EAAE;AACF,kFAAkF;AAClF,+EAA+E;AAC/E,EAAE;AACF,gFAAgF;AAEhF,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,MAAM,CAAC;AAE1C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,8EAA8E;AAC9E,eAAe;AAEf,SAAS,aAAa,CAAC,CAAS;IAC9B,OAAO,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AACzE,CAAC;AAED,SAAS,GAAG,CAAC,CAAU;IACrB,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACpD,CAAC;AAED,SAAS,GAAG,CAAC,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
+
export interface FirebaseHosting {
|
|
3
|
+
/** The deploy/output dir (metadata; NOT a source root). */
|
|
4
|
+
public?: string;
|
|
5
|
+
/** Site / target name (disambiguates multi-site hosting). */
|
|
6
|
+
name?: string;
|
|
7
|
+
/** True iff any rewrite routes to a Cloud Function. */
|
|
8
|
+
rewritesToFunction: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface FirebaseFunctions {
|
|
11
|
+
/** The functions source dir (default `functions`). */
|
|
12
|
+
source: string;
|
|
13
|
+
/** Optional codebase name (multi-codebase setups). */
|
|
14
|
+
codebase?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface FirebaseConfig {
|
|
17
|
+
hosting: FirebaseHosting[];
|
|
18
|
+
functions: FirebaseFunctions[];
|
|
19
|
+
hasFirestore: boolean;
|
|
20
|
+
hasDatabase: boolean;
|
|
21
|
+
hasStorage: boolean;
|
|
22
|
+
}
|
|
23
|
+
export interface FirebaseUsage {
|
|
24
|
+
usesAuth: boolean;
|
|
25
|
+
usesFirestore: boolean;
|
|
26
|
+
usesDatabase: boolean;
|
|
27
|
+
usesStorage: boolean;
|
|
28
|
+
}
|
|
29
|
+
/** Pure: a parsed firebase.json object → the typed FirebaseConfig. */
|
|
30
|
+
export declare function parseFirebaseConfig(json: unknown): FirebaseConfig;
|
|
31
|
+
/** Parse one source file's Firebase SDK usage. */
|
|
32
|
+
export declare function parseFirebaseUsage(content: string): FirebaseUsage;
|
|
33
|
+
export declare function buildFirebaseGraph(args: {
|
|
34
|
+
config: FirebaseConfig;
|
|
35
|
+
usage: FirebaseUsage;
|
|
36
|
+
configDir: string;
|
|
37
|
+
/** Does `<configDir>/src` exist? (hosting source-root fallback) */
|
|
38
|
+
srcExists: boolean;
|
|
39
|
+
configFile: string;
|
|
40
|
+
root: string;
|
|
41
|
+
}): InfraGraph;
|
|
42
|
+
export declare const firebaseAdapter: InfraAdapter;
|
|
43
|
+
//# sourceMappingURL=firebase.d.ts.map
|