feat(railway): add Railway SDK from GraphQL introspection#340
Draft
sam-goodwin wants to merge 3 commits into
Draft
feat(railway): add Railway SDK from GraphQL introspection#340sam-goodwin wants to merge 3 commits into
sam-goodwin wants to merge 3 commits into
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
…TypeScript-side only Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
|
Install the packages built from this commit: @distilled.cloud/core bun add @distilled.cloud/core@https://pkg.distilled.cloud/core/da9ea91@distilled.cloud/aws bun add @distilled.cloud/aws@https://pkg.distilled.cloud/aws/da9ea91@distilled.cloud/axiom bun add @distilled.cloud/axiom@https://pkg.distilled.cloud/axiom/da9ea91@distilled.cloud/azure bun add @distilled.cloud/azure@https://pkg.distilled.cloud/azure/da9ea91@distilled.cloud/cloudflare bun add @distilled.cloud/cloudflare@https://pkg.distilled.cloud/cloudflare/da9ea91@distilled.cloud/coinbase bun add @distilled.cloud/coinbase@https://pkg.distilled.cloud/coinbase/da9ea91@distilled.cloud/expo-eas bun add @distilled.cloud/expo-eas@https://pkg.distilled.cloud/expo-eas/da9ea91@distilled.cloud/fly-io bun add @distilled.cloud/fly-io@https://pkg.distilled.cloud/fly-io/da9ea91@distilled.cloud/gcp bun add @distilled.cloud/gcp@https://pkg.distilled.cloud/gcp/da9ea91@distilled.cloud/kubernetes bun add @distilled.cloud/kubernetes@https://pkg.distilled.cloud/kubernetes/da9ea91@distilled.cloud/mongodb-atlas bun add @distilled.cloud/mongodb-atlas@https://pkg.distilled.cloud/mongodb-atlas/da9ea91@distilled.cloud/neon bun add @distilled.cloud/neon@https://pkg.distilled.cloud/neon/da9ea91@distilled.cloud/planetscale bun add @distilled.cloud/planetscale@https://pkg.distilled.cloud/planetscale/da9ea91@distilled.cloud/posthog bun add @distilled.cloud/posthog@https://pkg.distilled.cloud/posthog/da9ea91@distilled.cloud/prisma-postgres bun add @distilled.cloud/prisma-postgres@https://pkg.distilled.cloud/prisma-postgres/da9ea91@distilled.cloud/railway bun add @distilled.cloud/railway@https://pkg.distilled.cloud/railway/da9ea91@distilled.cloud/stripe bun add @distilled.cloud/stripe@https://pkg.distilled.cloud/stripe/da9ea91@distilled.cloud/supabase bun add @distilled.cloud/supabase@https://pkg.distilled.cloud/supabase/da9ea91@distilled.cloud/turso bun add @distilled.cloud/turso@https://pkg.distilled.cloud/turso/da9ea91@distilled.cloud/typesense bun add @distilled.cloud/typesense@https://pkg.distilled.cloud/typesense/da9ea91@distilled.cloud/workos bun add @distilled.cloud/workos@https://pkg.distilled.cloud/workos/da9ea91 |
…ated, custom service-instances query - patches/*.json: typed errors discovered by live testing (name conflicts, invalid names, TCP proxy limits, rate limits, ...) wired into operation error channels via the generator - core generator: add skipField (exclude fields the API errors on) and includeDeprecated (generate deprecated-but-only APIs like tcpProxyCreate) - hand-written custom/getEnvironmentServiceInstances.ts: the only public API for enumerating a project's services (used for adopt-by-name); lives outside src/operations so regeneration leaves it intact
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
@distilled.cloud/railway— an Effect-native SDK for Railway's GraphQL API (https://backboard.railway.com/graphql/v2), generated from the introspection schema mirrored in distilled-spec-railway (new submodule, updated daily upstream).T.GraphQLOpsupport in core's shared clientgetprefix (workspacePolicy→getWorkspacePolicy), mutations lead with their verb (trustedDomainCreate→createTrustedDomain), via a newrenameOperationhook in core's GraphQL generator. The GraphQL documents keep the schema-derived names; renaming is TypeScript-side only.patches/{operationName}.jsonand baked into each operation's typed error channel on regeneration (via a newoperationErrorshook in core's GraphQL generator)RAILWAY_API_TOKEN(account/workspace,Authorization: Bearer) orRAILWAY_PROJECT_TOKEN(Project-Access-Token)Error patching workflow
Unmatched GraphQL errors surface as
UnknownRailwayError(carrying the raw envelope). To type one:bun run generatethen emits the tagged class intosrc/operations/errors.ts(annotated with its matchers) and adds it to the operation'serrors: [...]. Matchers testextensions.code,message(exact or substring), and HTTP status; the most specific match wins. Seepatches/README.md.Typed errors discovered by live testing
41 patch files recorded while building and integration-testing the Railway provider in alchemy-run/alchemy-effect#604 — name conflicts (
EnvironmentNameConflict,ServiceNameConflict), invalid names (ServiceNameInvalid,VolumeNameInvalid), TCP proxy constraints (TcpProxyLimitExceeded,TcpProxyOperationInProgress), the project-create rate limiter (ProjectCreateRateLimited, categorizedquotaso the SDK's burst retry never re-arms the penalty window),NotAuthorized,ProblemProcessingRequest, and more.Generator additions (core)
skipField(parentTypeName, fieldName)— exclude fields the live API errors on when resolving (e.g. Railway'sDeployment.socketsfails with "Problem processing request")includeDeprecated: string[]— generate specific deprecated root fields when they're still the only public API for a capability (e.g.tcpProxyCreate)Hand-written operation
src/custom/getEnvironmentServiceInstances.ts— Railway has no top-level list-services query; the only way to enumerate a project's services is theEnvironment.serviceInstancesconnection, one level deeper than the generator'smaxDepth: 3expansion. Lives outsidesrc/operations/sobun run generate(which wipes that directory) leaves it intact. Used by the alchemy provider to adopt orphaned services by name onServiceNameConflict.Pairs with alchemy-run/alchemy-effect#604, whose
distilledsubmodule pointer references this branch.