@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 @@
|
|
|
1
|
+
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../src/infra/register.ts"],"names":[],"mappings":"AAmCA,wBAAgB,4BAA4B,IAAI,IAAI,CA8CnD"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
// builtin infra-adapter registration.
|
|
2
|
+
//
|
|
3
|
+
// Registration ORDER is the conflict-resolution priority for the merge step
|
|
4
|
+
// (registry.ts): the first-registered adapter wins a `declared`-vs-`declared`
|
|
5
|
+
// tie. The locked order is CF → Supabase → Terraform: a provider-specific
|
|
6
|
+
// config (wrangler.toml, supabase/config.toml) is more authoritative about its
|
|
7
|
+
// own resources than a generic Terraform `cloudflare_*` / `supabase_*` block,
|
|
8
|
+
// and Terraform is the universal fallback. / slot their adapters
|
|
9
|
+
// into this list in priority order.
|
|
10
|
+
//
|
|
11
|
+
// `registerInfraAdapter` is idempotent on name (replaces), so calling this more
|
|
12
|
+
// than once across a process is safe.
|
|
13
|
+
import { registerInfraAdapter } from './registry.js';
|
|
14
|
+
import { cloudflareAdapter } from './cloudflare/cloudflare.js';
|
|
15
|
+
import { supabaseAdapter } from './supabase/supabase.js';
|
|
16
|
+
import { dockerComposeAdapter } from './compose/compose.js';
|
|
17
|
+
import { netlifyAdapter } from './netlify/netlify.js';
|
|
18
|
+
import { firebaseAdapter } from './firebase/firebase.js';
|
|
19
|
+
import { convexAdapter } from './convex/convex.js';
|
|
20
|
+
import { vercelAdapter } from './vercel/vercel.js';
|
|
21
|
+
import { flyAdapter } from './fly/fly.js';
|
|
22
|
+
import { renderAdapter } from './render/render.js';
|
|
23
|
+
import { railwayAdapter } from './railway/railway.js';
|
|
24
|
+
import { herokuAdapter } from './heroku/heroku.js';
|
|
25
|
+
import { digitaloceanAdapter } from './digitalocean/digitalocean.js';
|
|
26
|
+
import { kamalAdapter } from './kamal/kamal.js';
|
|
27
|
+
import { sstAdapter } from './sst/sst.js';
|
|
28
|
+
import { pulumiAdapter } from './pulumi/pulumi.js';
|
|
29
|
+
import { opentofuAdapter } from './opentofu/opentofu.js';
|
|
30
|
+
import { awsAdapter } from './aws/aws.js';
|
|
31
|
+
import { gcpAdapter } from './gcp/gcp.js';
|
|
32
|
+
import { azureAdapter } from './azure/azure.js';
|
|
33
|
+
import { terraformAdapter } from './terraform/terraform.js';
|
|
34
|
+
export function registerBuiltinInfraAdapters() {
|
|
35
|
+
registerInfraAdapter(cloudflareAdapter);
|
|
36
|
+
registerInfraAdapter(supabaseAdapter);
|
|
37
|
+
// docker-compose — a self-hosted container declaration; its id space
|
|
38
|
+
// (`compose:service:*`) is disjoint from the cloud adapters, so order is
|
|
39
|
+
// cosmetic, but it sits with the specific provider configs ahead of the
|
|
40
|
+
// generic IaC fallbacks.
|
|
41
|
+
registerInfraAdapter(dockerComposeAdapter);
|
|
42
|
+
// Netlify before Vercel: netlify.toml is the explicit, stronger frontend-host
|
|
43
|
+
// signal, so it's listed ahead of Vercel's bare `next.config.*` detection. (Their
|
|
44
|
+
// id spaces are disjoint, so this is intent-documenting; the attribution win comes
|
|
45
|
+
// from Netlify emitting sourceRoots where the Vercel next.config path doesn't.)
|
|
46
|
+
registerInfraAdapter(netlifyAdapter);
|
|
47
|
+
// Firebase — a BaaS like Supabase; disjoint id space (`firebase:*`), grouped
|
|
48
|
+
// with the other provider-specific configs ahead of the generic IaC fallbacks.
|
|
49
|
+
registerInfraAdapter(firebaseAdapter);
|
|
50
|
+
// Convex — a reactive-TS BaaS like Supabase/Firebase; disjoint id
|
|
51
|
+
// space (`convex:*`), grouped with the provider-specific configs ahead of the
|
|
52
|
+
// generic IaC fallbacks. Source-based (functions ARE code), no image resolver.
|
|
53
|
+
registerInfraAdapter(convexAdapter);
|
|
54
|
+
registerInfraAdapter(vercelAdapter);
|
|
55
|
+
registerInfraAdapter(flyAdapter);
|
|
56
|
+
registerInfraAdapter(renderAdapter);
|
|
57
|
+
registerInfraAdapter(railwayAdapter);
|
|
58
|
+
registerInfraAdapter(herokuAdapter);
|
|
59
|
+
// DigitalOcean App Platform — keyed off the `.do/` app spec (NOT bare app.yaml,
|
|
60
|
+
// which GCP App Engine owns). Disjoint id space (`digitalocean:*`).
|
|
61
|
+
registerInfraAdapter(digitaloceanAdapter);
|
|
62
|
+
// Kamal — Docker-to-VPS deploy; self-hosted-container-shaped like
|
|
63
|
+
// docker-compose. Keyed off config/deploy.yml (path-scoped); disjoint id space
|
|
64
|
+
// (`kamal:*`), so order is cosmetic — no detect() overlap with other adapters.
|
|
65
|
+
registerInfraAdapter(kamalAdapter);
|
|
66
|
+
// SST v3 "Ion" — config-as-code IaC like Pulumi (ts-morph over
|
|
67
|
+
// sst.config.ts); disjoint id space (`sst:*`). Triggers only on sst.config.*,
|
|
68
|
+
// so no detect() double-fire with Pulumi (Pulumi.yaml) or Terraform (*.tf);
|
|
69
|
+
// grouped with the code-IaC adapters ahead of the generic fallbacks.
|
|
70
|
+
registerInfraAdapter(sstAdapter);
|
|
71
|
+
registerInfraAdapter(pulumiAdapter);
|
|
72
|
+
registerInfraAdapter(opentofuAdapter);
|
|
73
|
+
registerInfraAdapter(awsAdapter);
|
|
74
|
+
registerInfraAdapter(gcpAdapter);
|
|
75
|
+
registerInfraAdapter(azureAdapter);
|
|
76
|
+
// Terraform last — the universal fallback. A provider-specific config
|
|
77
|
+
// (wrangler.toml, supabase/config.toml) is more authoritative about its own
|
|
78
|
+
// resources than a generic `cloudflare_*` / `supabase_*` Terraform block.
|
|
79
|
+
registerInfraAdapter(terraformAdapter);
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=register.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register.js","sourceRoot":"","sources":["../../src/infra/register.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,0EAA0E;AAC1E,+EAA+E;AAC/E,8EAA8E;AAC9E,iEAAiE;AACjE,oCAAoC;AACpC,EAAE;AACF,gFAAgF;AAChF,sCAAsC;AAEtC,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACn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;IACtC,oBAAoB,CAAC,UAAU,CAAC,CAAC;IACjC,oBAAoB,CAAC,UAAU,CAAC,CAAC;IACjC,oBAAoB,CAAC,YAAY,CAAC,CAAC;IACnC,sEAAsE;IACtE,4EAA4E;IAC5E,0EAA0E;IAC1E,oBAAoB,CAAC,gBAAgB,CAAC,CAAC;AACzC,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { InfraAdapter, InfraGraph, MergedInfraGraph } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Register an adapter. Idempotent on `name` — re-registering replaces the
|
|
4
|
+
* existing entry (useful for tests that swap a mock implementation).
|
|
5
|
+
* Insertion order is the conflict-priority order for the merge step.
|
|
6
|
+
*/
|
|
7
|
+
export declare function registerInfraAdapter(adapter: InfraAdapter): void;
|
|
8
|
+
/** Read-only view of registered adapters in registration order. */
|
|
9
|
+
export declare function listInfraAdapters(): readonly InfraAdapter[];
|
|
10
|
+
/**
|
|
11
|
+
* the `scansSourcePath` predicates of every registered adapter that
|
|
12
|
+
* (a) declares one AND (b) `detect()`-positive on `repoDir` — i.e. the
|
|
13
|
+
* source-grep adapters ACTIVE for this repo. The diff-driven hosted walk
|
|
14
|
+
* (container.ts) ORs these into its carry/re-extract decision so a source-only
|
|
15
|
+
* change a source-scanner would read forces an infra re-extract instead of
|
|
16
|
+
* reusing the stale carried graph.
|
|
17
|
+
*
|
|
18
|
+
* Detection runs in parallel (cheap file-exists checks), exactly like
|
|
19
|
+
* runInfraAdapters. Computed ONCE per re-extract (not per checkpoint): a diff
|
|
20
|
+
* that would flip an adapter's detect() necessarily touches its config/IaC
|
|
21
|
+
* trigger (supabase/**, package.json, next.config.*, vercel.json), all of which
|
|
22
|
+
* already force a re-extract (diffTouchesInfra / config-invalidator) — after
|
|
23
|
+
* which the walk recomputes this set. So a config-only adapter never starts
|
|
24
|
+
* scanning source mid-walk without us noticing.
|
|
25
|
+
*/
|
|
26
|
+
export declare function activeSourceScanners(repoDir: string): Promise<Array<(path: string) => boolean>>;
|
|
27
|
+
/** Test helper — wipe the registry between specs. Never call from production. */
|
|
28
|
+
export declare function clearInfraAdapters(): void;
|
|
29
|
+
/**
|
|
30
|
+
* Run every `detect()`-positive adapter against `repoDir` and merge the
|
|
31
|
+
* outputs. Detection runs in parallel (cheap file-exists checks),
|
|
32
|
+
* extraction runs serially (cheap IO + parsing, but several adapters
|
|
33
|
+
* touching the same files saturates the kernel cache faster serially
|
|
34
|
+
* than in parallel — and serial keeps log output legible).
|
|
35
|
+
*
|
|
36
|
+
* If no adapter detects the repo, returns an empty MergedInfraGraph anchored
|
|
37
|
+
* at `repoDir` — the caller (assemble.ts) should still produce a snapshot;
|
|
38
|
+
* the infra layer just contributes nothing.
|
|
39
|
+
*/
|
|
40
|
+
export declare function runInfraAdapters(repoDir: string): Promise<MergedInfraGraph>;
|
|
41
|
+
/**
|
|
42
|
+
* Merge per-adapter InfraGraphs into one. Conflict policy:
|
|
43
|
+
*
|
|
44
|
+
* * Node id collisions resolve in favor of the higher-provenance node
|
|
45
|
+
* (declared > inferred > llm-classified). Ties on provenance resolve in
|
|
46
|
+
* favor of the earlier-listed graph (= earlier-registered adapter).
|
|
47
|
+
*
|
|
48
|
+
* * Edges dedupe on (source, target, kind) — two adapters describing the
|
|
49
|
+
* same Worker → Queue write produce one edge. Adapter-specific metadata
|
|
50
|
+
* from the LOSING duplicate is dropped.
|
|
51
|
+
*
|
|
52
|
+
* * ClassificationRef refs deduped on (provider, resourceType, forNodeId).
|
|
53
|
+
*
|
|
54
|
+
* Node ids are NAMESPACED by adapter (`<adapter>:<node.id>`) before merging,
|
|
55
|
+
* which means raw id collisions only happen if the same adapter emits the
|
|
56
|
+
* same id twice — that's an adapter bug, not a merge concern, and we throw.
|
|
57
|
+
*/
|
|
58
|
+
export declare function mergeInfraGraphs(graphs: InfraGraph[], root: string): MergedInfraGraph;
|
|
59
|
+
/**
|
|
60
|
+
* Edges whose `source` or `target` resolves to neither a merged infra node nor
|
|
61
|
+
* a member of `knownIds`. Empty result = every endpoint is accounted for.
|
|
62
|
+
*/
|
|
63
|
+
export declare function validateMergedGraph(merged: MergedInfraGraph, knownIds?: ReadonlySet<string>): MergedInfraGraph['edges'];
|
|
64
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/infra/registry.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAEV,YAAY,EACZ,UAAU,EAEV,gBAAgB,EACjB,MAAM,YAAY,CAAC;AAQpB;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,YAAY,GAAG,IAAI,CAIhE;AAED,mEAAmE;AACnE,wBAAgB,iBAAiB,IAAI,SAAS,YAAY,EAAE,CAE3D;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC,CAQ3C;AAED,iFAAiF;AACjF,wBAAgB,kBAAkB,IAAI,IAAI,CAEzC;AAKD;;;;;;;;;;GAUG;AACH,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAWjF;AAYD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,UAAU,EAAE,EACpB,IAAI,EAAE,MAAM,GACX,gBAAgB,CA4ElB;AAcD;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,gBAAgB,EACxB,QAAQ,GAAE,WAAW,CAAC,MAAM,CAAa,GACxC,gBAAgB,CAAC,OAAO,CAAC,CAI3B"}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
// Adapter registry + merge.
|
|
2
|
+
//
|
|
3
|
+
// One ingest = run every detect()-positive InfraAdapter against the repo
|
|
4
|
+
// dir, collect their InfraGraphs, dedupe + reconcile via mergeInfraGraphs,
|
|
5
|
+
// then run any open ClassificationRef through before handing the
|
|
6
|
+
// MergedInfraGraph to the assemble step.
|
|
7
|
+
//
|
|
8
|
+
// Adapters run in REGISTRATION ORDER, and registration order is the
|
|
9
|
+
// conflict-resolution priority for `declared` vs `declared` ties: the
|
|
10
|
+
// first-registered adapter wins. Today that's CF → Supabase → Terraform.
|
|
11
|
+
// Rationale (per the ticket): wrangler.toml is more specific
|
|
12
|
+
// about Cloudflare resources than a Terraform `cloudflare_*` resource is;
|
|
13
|
+
// Terraform is the universal fallback. Same logic applies to Supabase
|
|
14
|
+
// (config.toml beats Terraform).
|
|
15
|
+
//
|
|
16
|
+
// `declared > inferred > llm-classified` is the inverse priority on
|
|
17
|
+
// provenance — a higher-priority provenance always wins regardless of
|
|
18
|
+
// adapter order. Two adapters both `declared` a node → adapter-order tie
|
|
19
|
+
// break (above). One `declared`, one `llm-classified` → declared wins.
|
|
20
|
+
// ---------------------------------------------------------------------------
|
|
21
|
+
// Adapter registration.
|
|
22
|
+
const REGISTERED = [];
|
|
23
|
+
/**
|
|
24
|
+
* Register an adapter. Idempotent on `name` — re-registering replaces the
|
|
25
|
+
* existing entry (useful for tests that swap a mock implementation).
|
|
26
|
+
* Insertion order is the conflict-priority order for the merge step.
|
|
27
|
+
*/
|
|
28
|
+
export function registerInfraAdapter(adapter) {
|
|
29
|
+
const existing = REGISTERED.findIndex((a) => a.name === adapter.name);
|
|
30
|
+
if (existing >= 0)
|
|
31
|
+
REGISTERED[existing] = adapter;
|
|
32
|
+
else
|
|
33
|
+
REGISTERED.push(adapter);
|
|
34
|
+
}
|
|
35
|
+
/** Read-only view of registered adapters in registration order. */
|
|
36
|
+
export function listInfraAdapters() {
|
|
37
|
+
return REGISTERED;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* the `scansSourcePath` predicates of every registered adapter that
|
|
41
|
+
* (a) declares one AND (b) `detect()`-positive on `repoDir` — i.e. the
|
|
42
|
+
* source-grep adapters ACTIVE for this repo. The diff-driven hosted walk
|
|
43
|
+
* (container.ts) ORs these into its carry/re-extract decision so a source-only
|
|
44
|
+
* change a source-scanner would read forces an infra re-extract instead of
|
|
45
|
+
* reusing the stale carried graph.
|
|
46
|
+
*
|
|
47
|
+
* Detection runs in parallel (cheap file-exists checks), exactly like
|
|
48
|
+
* runInfraAdapters. Computed ONCE per re-extract (not per checkpoint): a diff
|
|
49
|
+
* that would flip an adapter's detect() necessarily touches its config/IaC
|
|
50
|
+
* trigger (supabase/**, package.json, next.config.*, vercel.json), all of which
|
|
51
|
+
* already force a re-extract (diffTouchesInfra / config-invalidator) — after
|
|
52
|
+
* which the walk recomputes this set. So a config-only adapter never starts
|
|
53
|
+
* scanning source mid-walk without us noticing.
|
|
54
|
+
*/
|
|
55
|
+
export async function activeSourceScanners(repoDir) {
|
|
56
|
+
const scanners = REGISTERED.filter((a) => typeof a.scansSourcePath === 'function');
|
|
57
|
+
const detections = await Promise.all(scanners.map(async (a) => ({ adapter: a, detected: await a.detect(repoDir) })));
|
|
58
|
+
return detections
|
|
59
|
+
.filter((d) => d.detected)
|
|
60
|
+
.map((d) => (path) => d.adapter.scansSourcePath(path));
|
|
61
|
+
}
|
|
62
|
+
/** Test helper — wipe the registry between specs. Never call from production. */
|
|
63
|
+
export function clearInfraAdapters() {
|
|
64
|
+
REGISTERED.length = 0;
|
|
65
|
+
}
|
|
66
|
+
// ---------------------------------------------------------------------------
|
|
67
|
+
// Run + merge.
|
|
68
|
+
/**
|
|
69
|
+
* Run every `detect()`-positive adapter against `repoDir` and merge the
|
|
70
|
+
* outputs. Detection runs in parallel (cheap file-exists checks),
|
|
71
|
+
* extraction runs serially (cheap IO + parsing, but several adapters
|
|
72
|
+
* touching the same files saturates the kernel cache faster serially
|
|
73
|
+
* than in parallel — and serial keeps log output legible).
|
|
74
|
+
*
|
|
75
|
+
* If no adapter detects the repo, returns an empty MergedInfraGraph anchored
|
|
76
|
+
* at `repoDir` — the caller (assemble.ts) should still produce a snapshot;
|
|
77
|
+
* the infra layer just contributes nothing.
|
|
78
|
+
*/
|
|
79
|
+
export async function runInfraAdapters(repoDir) {
|
|
80
|
+
const detections = await Promise.all(REGISTERED.map(async (a) => ({ adapter: a, detected: await a.detect(repoDir) })));
|
|
81
|
+
const matched = detections.filter((d) => d.detected).map((d) => d.adapter);
|
|
82
|
+
const graphs = [];
|
|
83
|
+
for (const adapter of matched) {
|
|
84
|
+
graphs.push(await adapter.extract(repoDir));
|
|
85
|
+
}
|
|
86
|
+
return mergeInfraGraphs(graphs, repoDir);
|
|
87
|
+
}
|
|
88
|
+
// ---------------------------------------------------------------------------
|
|
89
|
+
// Pure merge — exported separately for tests + for callers that already
|
|
90
|
+
// have the per-adapter outputs in hand.
|
|
91
|
+
const PROVENANCE_PRIORITY = {
|
|
92
|
+
declared: 3,
|
|
93
|
+
inferred: 2,
|
|
94
|
+
'llm-classified': 1,
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* Merge per-adapter InfraGraphs into one. Conflict policy:
|
|
98
|
+
*
|
|
99
|
+
* * Node id collisions resolve in favor of the higher-provenance node
|
|
100
|
+
* (declared > inferred > llm-classified). Ties on provenance resolve in
|
|
101
|
+
* favor of the earlier-listed graph (= earlier-registered adapter).
|
|
102
|
+
*
|
|
103
|
+
* * Edges dedupe on (source, target, kind) — two adapters describing the
|
|
104
|
+
* same Worker → Queue write produce one edge. Adapter-specific metadata
|
|
105
|
+
* from the LOSING duplicate is dropped.
|
|
106
|
+
*
|
|
107
|
+
* * ClassificationRef refs deduped on (provider, resourceType, forNodeId).
|
|
108
|
+
*
|
|
109
|
+
* Node ids are NAMESPACED by adapter (`<adapter>:<node.id>`) before merging,
|
|
110
|
+
* which means raw id collisions only happen if the same adapter emits the
|
|
111
|
+
* same id twice — that's an adapter bug, not a merge concern, and we throw.
|
|
112
|
+
*/
|
|
113
|
+
export function mergeInfraGraphs(graphs, root) {
|
|
114
|
+
const byId = new Map();
|
|
115
|
+
for (let g = 0; g < graphs.length; g++) {
|
|
116
|
+
const graph = graphs[g];
|
|
117
|
+
const seenLocal = new Set();
|
|
118
|
+
for (const raw of graph.nodes) {
|
|
119
|
+
if (seenLocal.has(raw.id)) {
|
|
120
|
+
throw new Error(`infra adapter '${graph.adapter}' emitted duplicate node id '${raw.id}'`);
|
|
121
|
+
}
|
|
122
|
+
seenLocal.add(raw.id);
|
|
123
|
+
const namespaced = { ...raw, id: `${graph.adapter}:${raw.id}` };
|
|
124
|
+
const existing = byId.get(namespaced.id);
|
|
125
|
+
if (!existing) {
|
|
126
|
+
byId.set(namespaced.id, { node: namespaced, graphOrder: g });
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
const incoming = PROVENANCE_PRIORITY[namespaced.provenance];
|
|
130
|
+
const incumbent = PROVENANCE_PRIORITY[existing.node.provenance];
|
|
131
|
+
if (incoming > incumbent) {
|
|
132
|
+
byId.set(namespaced.id, { node: namespaced, graphOrder: g });
|
|
133
|
+
}
|
|
134
|
+
else if (incoming === incumbent && g < existing.graphOrder) {
|
|
135
|
+
// Higher-priority adapter (earlier-registered) wins on ties.
|
|
136
|
+
byId.set(namespaced.id, { node: namespaced, graphOrder: g });
|
|
137
|
+
}
|
|
138
|
+
// Otherwise existing wins; nothing to do.
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
// 2. Edges — namespace endpoints, dedupe on (source, target, kind).
|
|
142
|
+
//
|
|
143
|
+
// Endpoints can be either an adapter-local infra node id, or a code-side
|
|
144
|
+
// module id (set during later cross-graph join). We prefix infra-local
|
|
145
|
+
// refs; anything that doesn't match a known infra node id is left
|
|
146
|
+
// untouched so the cross-graph join can bind it.
|
|
147
|
+
//
|
|
148
|
+
// PR #7 review #7: pre-compute the local-id set once per graph instead
|
|
149
|
+
// of `.some()`-scanning the nodes array per edge. The naive form is
|
|
150
|
+
// O(edges × nodes); at 's 10-adapter fan-out with one Terraform
|
|
151
|
+
// graph carrying thousands of resources, that compounded every ingest.
|
|
152
|
+
const edgeKey = (s, t, k) => `${s}→${t}:${k}`;
|
|
153
|
+
const edges = new Map();
|
|
154
|
+
for (const graph of graphs) {
|
|
155
|
+
const localIds = new Set(graph.nodes.map((n) => n.id));
|
|
156
|
+
for (const e of graph.edges) {
|
|
157
|
+
const src = localIds.has(e.source) ? `${graph.adapter}:${e.source}` : e.source;
|
|
158
|
+
const tgt = localIds.has(e.target) ? `${graph.adapter}:${e.target}` : e.target;
|
|
159
|
+
const key = edgeKey(src, tgt, e.kind);
|
|
160
|
+
if (!edges.has(key))
|
|
161
|
+
edges.set(key, { ...e, source: src, target: tgt });
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
// 3. ClassificationRefs — same namespacing for `forNodeId`, dedupe on
|
|
165
|
+
// the (provider, resourceType, forNodeId) triple.
|
|
166
|
+
const classKey = (p, rt, f) => `${p}/${rt}/${f}`;
|
|
167
|
+
const classRefs = new Map();
|
|
168
|
+
for (const graph of graphs) {
|
|
169
|
+
for (const c of graph.classificationsNeeded) {
|
|
170
|
+
const forNs = `${graph.adapter}:${c.forNodeId}`;
|
|
171
|
+
const key = classKey(c.provider, c.resourceType, forNs);
|
|
172
|
+
if (!classRefs.has(key)) {
|
|
173
|
+
classRefs.set(key, { ...c, forNodeId: forNs });
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
return {
|
|
178
|
+
root,
|
|
179
|
+
nodes: [...byId.values()].map((t) => t.node),
|
|
180
|
+
edges: [...edges.values()],
|
|
181
|
+
classificationsNeeded: [...classRefs.values()],
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
// ---------------------------------------------------------------------------
|
|
185
|
+
// Post-merge validation gate.
|
|
186
|
+
//
|
|
187
|
+
// `mergeInfraGraphs` deliberately leaves unresolved edge endpoints untouched
|
|
188
|
+
// (a Terraform `depends_on` may point at a code module the cross-graph join
|
|
189
|
+
// binds later). It is NOT the validation gate — this is (PR #7 review #8).
|
|
190
|
+
// Once the full id space is known (post-join, /12), the caller passes the
|
|
191
|
+
// code-module ids in `knownIds`; any edge endpoint that still doesn't resolve
|
|
192
|
+
// is an adapter bug (a typo'd `depends_on`, a dangling ref) rather than a
|
|
193
|
+
// pending join. Returns those offending edges so tests can assert on an empty
|
|
194
|
+
// result and the join step can fail loud instead of rendering a phantom node.
|
|
195
|
+
/**
|
|
196
|
+
* Edges whose `source` or `target` resolves to neither a merged infra node nor
|
|
197
|
+
* a member of `knownIds`. Empty result = every endpoint is accounted for.
|
|
198
|
+
*/
|
|
199
|
+
export function validateMergedGraph(merged, knownIds = new Set()) {
|
|
200
|
+
const ids = new Set(merged.nodes.map((n) => n.id));
|
|
201
|
+
for (const id of knownIds)
|
|
202
|
+
ids.add(id);
|
|
203
|
+
return merged.edges.filter((e) => !ids.has(e.source) || !ids.has(e.target));
|
|
204
|
+
}
|
|
205
|
+
//# sourceMappingURL=registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/infra/registry.ts"],"names":[],"mappings":"AAAA,4BAA4B;AAC5B,EAAE;AACF,yEAAyE;AACzE,2EAA2E;AAC3E,kEAAkE;AAClE,yCAAyC;AACzC,EAAE;AACF,oEAAoE;AACpE,sEAAsE;AACtE,yEAAyE;AACzE,8DAA8D;AAC9D,0EAA0E;AAC1E,sEAAsE;AACtE,iCAAiC;AACjC,EAAE;AACF,oEAAoE;AACpE,sEAAsE;AACtE,yEAAyE;AACzE,uEAAuE;AAWvE,8EAA8E;AAC9E,wBAAwB;AAExB,MAAM,UAAU,GAAmB,EAAE,CAAC;AAEtC;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAAqB;IACxD,MAAM,QAAQ,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACtE,IAAI,QAAQ,IAAI,C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CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACnD,KAAK,MAAM,EAAE,IAAI,QAAQ;QAAE,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACvC,OAAO,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AAC9E,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** Is this repo-relative path one an infra adapter would read? */
|
|
2
|
+
export declare function isInfraRelevantPath(path: string): boolean;
|
|
3
|
+
/** Do any of a diff's paths touch infra-relevant CONFIG/IaC files? */
|
|
4
|
+
export declare function diffTouchesInfra(paths: readonly string[]): boolean;
|
|
5
|
+
/**
|
|
6
|
+
* the source-aware carry/re-extract decision for the hosted walk.
|
|
7
|
+
*
|
|
8
|
+
* True iff the diff touches a CONFIG/IaC infra path (diffTouchesInfra) OR a
|
|
9
|
+
* SOURCE path that one of the ACTIVE source-grep adapters reads. `sourceScanners`
|
|
10
|
+
* is the list of `scansSourcePath` predicates for the adapters whose detect()
|
|
11
|
+
* is positive on this repo (registry.activeSourceScanners) — pass an empty list
|
|
12
|
+
* (or omit) for a repo with no source-grep adapter, and this collapses to
|
|
13
|
+
* `diffTouchesInfra`, preserving the carry optimization for config-only stacks.
|
|
14
|
+
*/
|
|
15
|
+
export declare function diffTouchesInfraWithSources(paths: readonly string[], sourceScanners?: ReadonlyArray<(path: string) => boolean>): boolean;
|
|
16
|
+
//# sourceMappingURL=relevance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relevance.d.ts","sourceRoot":"","sources":["../../src/infra/relevance.ts"],"names":[],"mappings":"AAwGA,kEAAkE;AAClE,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAOzD;AAED,sEAAsE;AACtE,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAElE;AAED;;;;;;;;;GASG;AACH,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,cAAc,GAAE,aAAa,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAM,GAC5D,OAAO,CAIT"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
// Stage A — infra-relevance gate for diff-driven ingestion.
|
|
2
|
+
//
|
|
3
|
+
// Decides whether a checkpoint's diff could change the INFRA topology: only
|
|
4
|
+
// then is an infra re-extraction warranted; otherwise the previous
|
|
5
|
+
// checkpoint's infra graph is reused.
|
|
6
|
+
//
|
|
7
|
+
// TWO classes of trigger ( fix):
|
|
8
|
+
// 1. CONFIG/IaC paths — `diffTouchesInfra` below. Every adapter reads these;
|
|
9
|
+
// a config-DECLARED adapter (Cloudflare, Terraform, Fly, …) reads ONLY
|
|
10
|
+
// these, so a checkpoint that touches none can safely carry that adapter's
|
|
11
|
+
// graph.
|
|
12
|
+
// 2. SOURCE paths a source-grep adapter reads — `diffTouchesInfraWithSources`.
|
|
13
|
+
// This is the carry-invariant fix: it is FALSE that "infra adapters read
|
|
14
|
+
// only config/IaC." The Supabase adapter greps app `.ts/.tsx/.js/…` for
|
|
15
|
+
// `.from(`/`.auth`/`.storage`/`.realtime` (→ app→Postgres edges + the
|
|
16
|
+
// Auth/Storage/Realtime nodes), and the Vercel adapter reads
|
|
17
|
+
// `app/**/route.ts`, `pages/api/**`, `middleware.ts`. A `supabase.from(...)`
|
|
18
|
+
// added in plain `src/**` changes the infra graph, so it MUST force a
|
|
19
|
+
// re-extract — otherwise the carried graph silently drops the new
|
|
20
|
+
// node/edge until the next full re-seed. This is acute on example-app,
|
|
21
|
+
// which has NO supabase/config.toml: its WHOLE Supabase topology is
|
|
22
|
+
// source-grep-derived, exactly the signal `diffTouchesInfra` alone misses.
|
|
23
|
+
// The source globs are NOT hard-coded here — they come from the active
|
|
24
|
+
// adapters' own `scansSourcePath` predicates (registry.activeSourceScanners)
|
|
25
|
+
// so the gate can't drift from what the adapters actually read.
|
|
26
|
+
//
|
|
27
|
+
// The CONFIG pattern list is DERIVED from the registered adapters' detect()/file
|
|
28
|
+
// matchers (scripts/ingest/infra/*):
|
|
29
|
+
// cloudflare → wrangler.toml/jsonc/json supabase → supabase/**
|
|
30
|
+
// terraform → *.tf, *.tfvars opentofu → *.tofu(.json), tofu.tfvars
|
|
31
|
+
// vercel → vercel.json, next.config.* fly → fly.toml
|
|
32
|
+
// netlify → netlify.toml firebase → firebase.json, .firebaserc
|
|
33
|
+
// convex → convex.json (; convex/** source via scansSourcePath)
|
|
34
|
+
// render → render.yaml/yml railway → railway.json/toml, nixpacks.toml, Procfile
|
|
35
|
+
// heroku → Procfile, app.json, heroku.yml pulumi → Pulumi.yaml
|
|
36
|
+
// sst → sst.config.ts/.mjs/.js
|
|
37
|
+
// aws → *.template.json, serverless.yml/yaml, samconfig.toml, template.yaml/yml, cdk.json
|
|
38
|
+
// gcp → app.yaml, cloudbuild.yaml azure → *.bicep, function.json, host.json
|
|
39
|
+
// digitalocean → .do/*.y(a)ml app spec (path-scoped, NOT bare app.yaml)
|
|
40
|
+
// kamal → config/deploy(.<env>)?.y(a)ml (path-scoped, NOT bare deploy.yml)
|
|
41
|
+
// + generic container signals: Dockerfile*, docker-compose*/compose* (.ya?ml), .dockerignore
|
|
42
|
+
// (the docker-compose adapter — reads these compose files)
|
|
43
|
+
// + root Vite SPA signal: vite.config.* — Cloudflare now reads it (+
|
|
44
|
+
// index.html) to emit the Pages frontend unit + its `src/**` source root. Only
|
|
45
|
+
// vite.config is gated (index.html is a noisy basename; a SPA appearing always
|
|
46
|
+
// lands a vite.config, so this still catches it).
|
|
47
|
+
//
|
|
48
|
+
// DELIBERATELY NARROWER than the broadest adapters (gcp/azure scan every
|
|
49
|
+
// *.yaml): a "rerun infra" false-negative only delays an infra-topology update
|
|
50
|
+
// to the next full extract, while matching every yaml would fire the gate on
|
|
51
|
+
// CI workflows and i18n files constantly, making it useless. Conservative
|
|
52
|
+
// where it's cheap (well-known names), not where it's noisy.
|
|
53
|
+
//
|
|
54
|
+
// NOTE: the HOSTED container pipeline now DOES run infra extraction
|
|
55
|
+
// (container.ts → extractCheckpointInfra). This gate is the per-checkpoint
|
|
56
|
+
// carry/re-extract decision + observability counter for that walk.
|
|
57
|
+
const INFRA_BASENAME_RE = new RegExp('^(' +
|
|
58
|
+
[
|
|
59
|
+
'wrangler\\.(toml|jsonc|json)',
|
|
60
|
+
'netlify\\.toml', //
|
|
61
|
+
'firebase\\.json', //
|
|
62
|
+
'\\.firebaserc', //
|
|
63
|
+
'convex\\.json', // Convex config (functions-dir override); the
|
|
64
|
+
// convex/** source signal is covered by scansSourcePath
|
|
65
|
+
'vercel\\.json',
|
|
66
|
+
'next\\.config\\.[^/]+',
|
|
67
|
+
'fly\\.toml',
|
|
68
|
+
'render\\.ya?ml',
|
|
69
|
+
'railway\\.(json|toml)',
|
|
70
|
+
'nixpacks\\.toml',
|
|
71
|
+
'Procfile',
|
|
72
|
+
'app\\.json',
|
|
73
|
+
'heroku\\.yml',
|
|
74
|
+
'Pulumi\\.ya?ml',
|
|
75
|
+
'sst\\.config\\.[^/]+', // SST v3 Ion config (sst.config.ts/.mjs/.js)
|
|
76
|
+
'serverless\\.ya?ml',
|
|
77
|
+
'samconfig\\.toml',
|
|
78
|
+
'template\\.ya?ml',
|
|
79
|
+
'cdk\\.json',
|
|
80
|
+
'app\\.yaml',
|
|
81
|
+
'cloudbuild\\.ya?ml',
|
|
82
|
+
'function\\.json',
|
|
83
|
+
'host\\.json',
|
|
84
|
+
'tofu\\.tfvars',
|
|
85
|
+
'Dockerfile[^/]*',
|
|
86
|
+
'docker-compose[^/]*\\.ya?ml',
|
|
87
|
+
'compose(\\.[^/]+)?\\.ya?ml', // Compose Spec default filename (compose.yaml / compose.prod.yml)
|
|
88
|
+
'\\.dockerignore',
|
|
89
|
+
'vite\\.config\\.[^/]+',
|
|
90
|
+
].join('|') +
|
|
91
|
+
')$');
|
|
92
|
+
const INFRA_EXTENSION_RE = /\.(tf|tf\.json|tfvars|tofu|tofu\.json|bicep)$/;
|
|
93
|
+
/** A DO App Platform spec under `.do/` — path-scoped, NOT bare app.yaml. */
|
|
94
|
+
const DO_SPEC_RE = /(^|\/)\.do\/[^/]+\.ya?ml$/;
|
|
95
|
+
/** A Kamal config — path-scoped `config/deploy(.<env>)?.y(a)ml`, NOT a
|
|
96
|
+
* bare `deploy.yml` basename (CI workflows use that). */
|
|
97
|
+
const KAMAL_SPEC_RE = /(^|\/)config\/deploy(\.[A-Za-z0-9_-]+)?\.ya?ml$/;
|
|
98
|
+
/** Is this repo-relative path one an infra adapter would read? */
|
|
99
|
+
export function isInfraRelevantPath(path) {
|
|
100
|
+
if (path === 'supabase' || path.startsWith('supabase/'))
|
|
101
|
+
return true;
|
|
102
|
+
if (DO_SPEC_RE.test(path))
|
|
103
|
+
return true;
|
|
104
|
+
if (KAMAL_SPEC_RE.test(path))
|
|
105
|
+
return true;
|
|
106
|
+
if (INFRA_EXTENSION_RE.test(path))
|
|
107
|
+
return true;
|
|
108
|
+
const base = path.split('/').pop() ?? path;
|
|
109
|
+
return INFRA_BASENAME_RE.test(base);
|
|
110
|
+
}
|
|
111
|
+
/** Do any of a diff's paths touch infra-relevant CONFIG/IaC files? */
|
|
112
|
+
export function diffTouchesInfra(paths) {
|
|
113
|
+
return paths.some(isInfraRelevantPath);
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* the source-aware carry/re-extract decision for the hosted walk.
|
|
117
|
+
*
|
|
118
|
+
* True iff the diff touches a CONFIG/IaC infra path (diffTouchesInfra) OR a
|
|
119
|
+
* SOURCE path that one of the ACTIVE source-grep adapters reads. `sourceScanners`
|
|
120
|
+
* is the list of `scansSourcePath` predicates for the adapters whose detect()
|
|
121
|
+
* is positive on this repo (registry.activeSourceScanners) — pass an empty list
|
|
122
|
+
* (or omit) for a repo with no source-grep adapter, and this collapses to
|
|
123
|
+
* `diffTouchesInfra`, preserving the carry optimization for config-only stacks.
|
|
124
|
+
*/
|
|
125
|
+
export function diffTouchesInfraWithSources(paths, sourceScanners = []) {
|
|
126
|
+
if (diffTouchesInfra(paths))
|
|
127
|
+
return true;
|
|
128
|
+
if (sourceScanners.length === 0)
|
|
129
|
+
return false;
|
|
130
|
+
return paths.some((p) => sourceScanners.some((scans) => scans(p)));
|
|
131
|
+
}
|
|
132
|
+
//# sourceMappingURL=relevance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relevance.js","sourceRoot":"","sources":["../../src/infra/relevance.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,EAAE;AACF,4EAA4E;AAC5E,mEAAmE;AACnE,sCAAsC;AACtC,EAAE;AACF,iCAAiC;AACjC,+EAA+E;AAC/E,4EAA4E;AAC5E,gFAAgF;AAChF,cAAc;AACd,iFAAiF;AACjF,8EAA8E;AAC9E,6EAA6E;AAC7E,2EAA2E;AAC3E,kEAAkE;AAClE,kFAAkF;AAClF,2EAA2E;AAC3E,uEAAuE;AACvE,4EAA4E;AAC5E,yEAAyE;AACzE,gFAAgF;AAChF,4EAA4E;AAC5E,kFAAkF;AAClF,qEAAqE;AACrE,EAAE;AACF,iFAAiF;AACjF,qCAAqC;AACrC,4EAA4E;AAC5E,2FAA2F;AAC3F,yEAAyE;AACzE,4EAA4E;AAC5E,sEAAsE;AACtE,2GAA2G;AAC3G,4EAA4E;AAC5E,wCAAwC;AACxC,mGAAmG;AACnG,kGAAkG;AAClG,0EAA0E;AAC1E,kFAAkF;AAClF,+FAA+F;AAC/F,+DAA+D;AAC/D,uEAAuE;AACvE,mFAAmF;AACnF,mFAAmF;AACnF,sDAAsD;AACtD,EAAE;AACF,yEAAyE;AACzE,+EAA+E;AAC/E,6EAA6E;AAC7E,0EAA0E;AAC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AAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,IAAI,IAAI,CAAC;IAC3C,OAAO,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACtC,CAAC;AAED,sEAAsE;AACtE,MAAM,UAAU,gBAAgB,CAAC,KAAwB;IACvD,OAAO,KAAK,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;AACzC,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,2BAA2B,CACzC,KAAwB,EACxB,iBAA2D,EAAE;IAE7D,IAAI,gBAAgB,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACzC,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAC9C,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACrE,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
export type RenderServiceType = 'web' | 'worker' | 'cron' | 'pserv' | 'static';
|
|
2
|
+
export interface RenderEnvVar {
|
|
3
|
+
key?: string;
|
|
4
|
+
/** Literal string value. */
|
|
5
|
+
value?: string;
|
|
6
|
+
/** Auto-generated secret — treat as metadata only. */
|
|
7
|
+
generateValue?: boolean;
|
|
8
|
+
/** fromDatabase: { name: string; property: string } — the service reads from a db. */
|
|
9
|
+
fromDatabase?: {
|
|
10
|
+
name?: string;
|
|
11
|
+
property?: string;
|
|
12
|
+
};
|
|
13
|
+
/** fromService: { name: string; type: string; property: string } — reads a peer's prop. */
|
|
14
|
+
fromService?: {
|
|
15
|
+
name?: string;
|
|
16
|
+
type?: string;
|
|
17
|
+
property?: string;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export interface RenderService {
|
|
21
|
+
name: string;
|
|
22
|
+
type: RenderServiceType;
|
|
23
|
+
/**
|
|
24
|
+
* The original type string from the YAML, preserved verbatim.
|
|
25
|
+
* Equals `type` for known service types; differs when an unrecognised type
|
|
26
|
+
* caused the parser to fall back to 'web' so the metadata can record the
|
|
27
|
+
* actual declared value rather than the fallback.
|
|
28
|
+
*/
|
|
29
|
+
rawType: string;
|
|
30
|
+
/** Runtime: node | python | ruby | go | rust | elixir | docker */
|
|
31
|
+
runtime?: string;
|
|
32
|
+
buildCommand?: string;
|
|
33
|
+
startCommand?: string;
|
|
34
|
+
/** Build plan tier. */
|
|
35
|
+
plan?: string;
|
|
36
|
+
/** The git branch to track. */
|
|
37
|
+
branch?: string;
|
|
38
|
+
autoDeploy?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* the monorepo base dir Render runs build/start from (the service's
|
|
41
|
+
* source root). Repo-relative.
|
|
42
|
+
*/
|
|
43
|
+
rootDir?: string;
|
|
44
|
+
/** Docker runtime — path to the Dockerfile (its dir is the build context). */
|
|
45
|
+
dockerfilePath?: string;
|
|
46
|
+
/** Docker runtime — explicit build-context dir (overrides the Dockerfile's dir). */
|
|
47
|
+
dockerContext?: string;
|
|
48
|
+
envVars: RenderEnvVar[];
|
|
49
|
+
/** Routes for static sites. */
|
|
50
|
+
routes?: Array<{
|
|
51
|
+
type?: string;
|
|
52
|
+
source?: string;
|
|
53
|
+
destination?: string;
|
|
54
|
+
}>;
|
|
55
|
+
}
|
|
56
|
+
export interface RenderDatabase {
|
|
57
|
+
/** Logical name used as the target for fromDatabase references. */
|
|
58
|
+
name: string;
|
|
59
|
+
plan?: string;
|
|
60
|
+
region?: string;
|
|
61
|
+
postgresMajorVersion?: number | string;
|
|
62
|
+
databaseName?: string;
|
|
63
|
+
user?: string;
|
|
64
|
+
}
|
|
65
|
+
export interface RenderRedis {
|
|
66
|
+
name: string;
|
|
67
|
+
plan?: string;
|
|
68
|
+
region?: string;
|
|
69
|
+
}
|
|
70
|
+
export interface RenderConfig {
|
|
71
|
+
services: RenderService[];
|
|
72
|
+
databases: RenderDatabase[];
|
|
73
|
+
redis: RenderRedis[];
|
|
74
|
+
}
|
|
75
|
+
export declare function parseRenderConfig(yamlText: string): RenderConfig;
|
|
76
|
+
//# sourceMappingURL=render-parse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-parse.d.ts","sourceRoot":"","sources":["../../../src/infra/render/render-parse.ts"],"names":[],"mappings":"AAwBA,MAAM,MAAM,iBAAiB,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;AAE/E,MAAM,WAAW,YAAY;IAC3B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,4BAA4B;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sDAAsD;IACtD,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,sFAAsF;IACtF,YAAY,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACpD,2FAA2F;IAC3F,WAAW,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACnE;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,iBAAiB,CAAC;IACxB;;;;;OAKG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB,kEAAkE;IAClE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,uBAAuB;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,+BAA+B;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,OAAO,CAAC,EAAE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