Skip to content

Add polyglot exports for Aspire.Hosting.Nats#14902

Merged
sebastienros merged 4 commits intorelease/13.2from
sebros/polyglot-nats
Mar 4, 2026
Merged

Add polyglot exports for Aspire.Hosting.Nats#14902
sebastienros merged 4 commits intorelease/13.2from
sebros/polyglot-nats

Conversation

@sebastienros
Copy link
Contributor

Related to #14069

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings March 3, 2026 19:04
@github-actions
Copy link
Contributor

github-actions bot commented Mar 3, 2026

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 14902

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 14902"

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds polyglot (TypeScript) export support for Aspire.Hosting.Nats, enabling TypeScript app hosts to use NATS server resources via the ATS (Aspire Type System) capability API.

Changes:

  • Annotates existing C# AddNats, WithJetStream, WithDataVolume, and WithDataBindMount overloads with [AspireExport]/[AspireExportIgnore] attributes, and adds a dedicated AddNatsForPolyglot method.
  • Adds a TypeScript ValidationAppHost playground project with a generated SDK (aspire.ts, base.ts, transport.ts) for validating the NATS polyglot exports.
  • Adds project scaffolding files (package.json, tsconfig.json, apphost.ts, apphost.run.json, settings.json, .codegen-hash).

Reviewed changes

Copilot reviewed 9 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/Aspire.Hosting.Nats/NatsBuilderExtensions.cs Adds [AspireExportIgnore] to existing AddNats overloads, adds AddNatsForPolyglot, and annotates WithJetStream/WithDataVolume/WithDataBindMount with [AspireExport]
.modules/aspire.ts Generated TypeScript SDK exposing NATS and core Aspire capabilities via JSON-RPC
.modules/base.ts Base types (ReferenceExpression, ResourceBuilderBase, AspireList, AspireDict)
.modules/transport.ts ATS transport layer: RPC, handle system, callbacks, cancellation
apphost.ts Minimal TypeScript app host entry point
package.json Node.js package manifest for the validation app host
tsconfig.json TypeScript compiler configuration
apphost.run.json Launch profiles for the validation app host
.aspire/settings.json Aspire polyglot settings linking the TS host to the NATS package
.modules/.codegen-hash Hash tracking generated code state
Files not reviewed (1)
  • playground/polyglot/TypeScript/Aspire.Hosting.Nats/ValidationAppHost/package-lock.json: Language not supported

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
sebastienros and others added 2 commits March 3, 2026 12:57
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
- Exercise addNats, withJetStream, withDataVolume, withDataBindMount
- Test withReference and withServiceReference on consumer container
- Add .modules/**/*.d.ts to tsconfig include

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@sebastienros sebastienros enabled auto-merge (squash) March 4, 2026 00:25
@github-actions
Copy link
Contributor

github-actions bot commented Mar 4, 2026

🎬 CLI E2E Test Recordings

The following terminal recordings are available for commit 76ad029:

Test Recording
AddPackageInteractiveWhileAppHostRunningDetached ▶️ View Recording
AddPackageWhileAppHostRunningDetached ▶️ View Recording
AgentCommands_AllHelpOutputs_AreCorrect ▶️ View Recording
AgentInitCommand_MigratesDeprecatedConfig ▶️ View Recording
AgentInitCommand_WithMalformedMcpJson_ShowsErrorAndExitsNonZero ▶️ View Recording
AspireUpdateRemovesAppHostPackageVersionFromDirectoryPackagesProps ▶️ View Recording
Banner_DisplayedOnFirstRun ▶️ View Recording
Banner_DisplayedWithExplicitFlag ▶️ View Recording
CreateAndDeployToDockerCompose ▶️ View Recording
CreateAndDeployToDockerComposeInteractive ▶️ View Recording
CreateAndPublishToKubernetes ▶️ View Recording
CreateAndRunAspireStarterProject ▶️ View Recording
CreateAndRunAspireStarterProjectWithBundle ▶️ View Recording
CreateAndRunJsReactProject ▶️ View Recording
CreateAndRunPythonReactProject ▶️ View Recording
CreateAndRunTypeScriptStarterProject ▶️ View Recording
CreateEmptyAppHostProject ▶️ View Recording
CreateStartAndStopAspireProject ▶️ View Recording
CreateStartWaitAndStopAspireProject ▶️ View Recording
CreateTypeScriptAppHostWithViteApp ▶️ View Recording
DescribeCommandResolvesReplicaNames ▶️ View Recording
DescribeCommandShowsRunningResources ▶️ View Recording
DetachFormatJsonProducesValidJson ▶️ View Recording
DoctorCommand_DetectsDeprecatedAgentConfig ▶️ View Recording
DoctorCommand_WithSslCertDir_ShowsTrusted ▶️ View Recording
DoctorCommand_WithoutSslCertDir_ShowsPartiallyTrusted ▶️ View Recording
LogsCommandShowsResourceLogs ▶️ View Recording
PsCommandListsRunningAppHost ▶️ View Recording
PsFormatJsonOutputsOnlyJsonToStdout ▶️ View Recording
SecretCrudOnDotNetAppHost ▶️ View Recording
SecretCrudOnTypeScriptAppHost ▶️ View Recording
StagingChannel_ConfigureAndVerifySettings_ThenSwitchChannels ▶️ View Recording
StopAllAppHostsFromAppHostDirectory ▶️ View Recording
StopAllAppHostsFromUnrelatedDirectory ▶️ View Recording
StopNonInteractiveMultipleAppHostsShowsError ▶️ View Recording
StopNonInteractiveSingleAppHost ▶️ View Recording
StopWithNoRunningAppHostExitsSuccessfully ▶️ View Recording

📹 Recordings uploaded automatically from CI run #22648903591

@sebastienros sebastienros merged commit 9835847 into release/13.2 Mar 4, 2026
758 of 761 checks passed
@sebastienros sebastienros deleted the sebros/polyglot-nats branch March 4, 2026 00:51
@dotnet-policy-service dotnet-policy-service bot added this to the 13.2 milestone Mar 4, 2026
Copilot AI pushed a commit that referenced this pull request Mar 10, 2026
* Add polyglot exports for Aspire.Hosting.Nats

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Refine AspireExport descriptions for polyglot-nats

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Update src/Aspire.Hosting.Nats/NatsBuilderExtensions.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update Nats TypeScript validation apphost to exercise all exports

- Exercise addNats, withJetStream, withDataVolume, withDataBindMount
- Test withReference and withServiceReference on consumer container
- Add .modules/**/*.d.ts to tsconfig include

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants