Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/actions/setup-runtimes-caching/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ runs:
- name: Install Aspire CLI
uses: timheuer/setup-aspire@v0.1.0
with:
quality: release # temp workaround until url is fixed
quality: release

- name: Set up Python
uses: actions/setup-python@v5
Expand Down
63 changes: 37 additions & 26 deletions eng/testing/validate-typescript-apphost.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ param(
[Parameter(Mandatory = $true)]
[string]$PackageName,

[Parameter(Mandatory = $true)]
[string[]]$WaitForResources,
[string[]]$WaitForResources = @(),

[string[]]$RequiredCommands = @(),

Expand Down Expand Up @@ -87,7 +86,7 @@ if ([string]::IsNullOrWhiteSpace($PackageVersion)) {
$PackageVersion = "$versionPrefix-polyglot.local"
}

if ($WaitForResources.Count -eq 1) {
if ($WaitForResources.Count -eq 1 -and -not [string]::IsNullOrWhiteSpace($WaitForResources[0])) {
$splitOptions = [System.StringSplitOptions]::RemoveEmptyEntries -bor [System.StringSplitOptions]::TrimEntries
$WaitForResources = $WaitForResources[0].Split(",", $splitOptions)
}
Expand Down Expand Up @@ -146,30 +145,36 @@ try {
Pop-Location
}

Invoke-ExternalCommand "aspire" @(
"start",
"--apphost", $resolvedAppHostPath,
"--isolated",
"--format", "Json",
"--non-interactive"
)
$appStarted = $true
Push-Location $appHostDirectory
try {
Invoke-ExternalCommand "aspire" @(
"start",
"--apphost", $resolvedAppHostPath,
"--isolated",
"--format", "Json",
"--non-interactive"
)
$appStarted = $true

foreach ($resource in $WaitForResources) {
Invoke-ExternalCommand "aspire" @(
"wait",
$resource,
"--status", $WaitStatus,
"--apphost", $resolvedAppHostPath,
"--timeout", $WaitTimeoutSeconds
)
}

foreach ($resource in $WaitForResources) {
Invoke-ExternalCommand "aspire" @(
"wait",
$resource,
"--status", $WaitStatus,
"describe",
"--apphost", $resolvedAppHostPath,
"--timeout", $WaitTimeoutSeconds
"--format", "Json"
)
}

Invoke-ExternalCommand "aspire" @(
"describe",
"--apphost", $resolvedAppHostPath,
"--format", "Json"
)
finally {
Pop-Location
}
}
catch {
$primaryError = $_
Expand All @@ -195,10 +200,16 @@ finally {

Invoke-CleanupStep -Description "stop Aspire app" -Action {
if ($appStarted) {
Invoke-ExternalCommand "aspire" @(
"stop",
"--apphost", $resolvedAppHostPath
)
Push-Location $appHostDirectory
try {
Invoke-ExternalCommand "aspire" @(
"stop",
"--apphost", $resolvedAppHostPath
)
}
finally {
Pop-Location
}
}
} -Failures $cleanupFailures
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { createBuilder } from './.modules/aspire.js';

const builder = await createBuilder();
const appHostDirectory = path.dirname(fileURLToPath(import.meta.url));
const primaryConfigPath = path.join(appHostDirectory, 'dab-config.json');
const secondaryConfigPath = path.join(appHostDirectory, 'dab-config-2.json');

const dab = await builder._addDataAPIBuilderInternal('dab', [primaryConfigPath]);
const dabWithOptions = await builder._addDataAPIBuilderInternal('dab-with-options', [primaryConfigPath, secondaryConfigPath], 5001);

const _primaryEndpoint = await dab.primaryEndpoint.get();
const _host = await dab.host.get();
const _port = await dab.port.get();
const _uri = await dab.uriExpression.get();

const _secondaryPrimaryEndpoint = await dabWithOptions.primaryEndpoint.get();
const _secondaryHost = await dabWithOptions.host.get();
const _secondaryPort = await dabWithOptions.port.get();
const _secondaryUri = await dabWithOptions.uriExpression.get();

await builder.build().run();
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"appHost": {
"path": "apphost.ts",
"language": "typescript/nodejs"
},
"profiles": {
"https": {
"applicationUrl": "https://localhost:29750;http://localhost:28931",
"environmentVariables": {
"ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:10975",
"ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:13319"
}
}
},
"packages": {
"CommunityToolkit.Aspire.Hosting.Azure.DataApiBuilder": ""
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,238 @@
{
"$schema": "https://github.com/Azure/data-api-builder/releases/download/v1.3.19/dab.draft.schema.json",
"data-source": {
"database-type": "mssql",
"connection-string": "@env('ConnectionStrings__trek')",
"options": {}
},
"runtime": {
"rest": {
"enabled": true,
"path": "/api",
"request-body-strict": true
},
"graphql": {
"enabled": true,
"path": "/graphql",
"allow-introspection": true
},
"host": {
"cors": {
"origins": [
"*"
],
"allow-credentials": false
},
"authentication": {
"provider": "Simulator"
},
"mode": "development"
}
},
"entities": {
"Actor": {
"source": {
"object": "[dbo].[Actor]",
"type": "table",
"key-fields": [
"Id"
]
},
"graphql": {
"enabled": true,
"type": {
"singular": "Actor",
"plural": "Actors"
}
},
"rest": {
"enabled": true,
"path": "/actor"
},
"permissions": [
{
"role": "anonymous",
"actions": [
{
"action": "*",
"fields": {
"exclude": [
""
],
"include": [
"*"
]
}
}
]
}
],
"relationships": {
"character": {
"cardinality": "many",
"target.entity": "Character",
"source.fields": [
"Id"
],
"target.fields": [
"ActorId"
],
"linking.source.fields": [],
"linking.target.fields": []
}
}
},
"Character": {
"source": {
"object": "[dbo].[Character]",
"type": "table",
"key-fields": [
"Id"
]
},
"graphql": {
"enabled": true,
"type": {
"singular": "Character",
"plural": "Characters"
}
},
"rest": {
"enabled": true,
"path": "/character"
},
"permissions": [
{
"role": "anonymous",
"actions": [
{
"action": "*",
"fields": {
"exclude": [
""
],
"include": [
"*"
]
}
}
]
}
]
},
"Series": {
"source": {
"object": "[dbo].[Series]",
"type": "table",
"key-fields": [
"Id"
]
},
"graphql": {
"enabled": true,
"type": {
"singular": "Series",
"plural": "Series"
}
},
"rest": {
"enabled": true,
"path": "/series"
},
"permissions": [
{
"role": "anonymous",
"actions": [
{
"action": "*",
"fields": {
"exclude": [
""
],
"include": [
"*"
]
}
}
]
}
]
},
"Species": {
"source": {
"object": "[dbo].[Species]",
"type": "table",
"key-fields": [
"Id"
]
},
"graphql": {
"enabled": true,
"type": {
"singular": "Species",
"plural": "Species"
}
},
"rest": {
"enabled": true,
"path": "/species"
},
"permissions": [
{
"role": "anonymous",
"actions": [
{
"action": "*",
"fields": {
"exclude": [
""
],
"include": [
"*"
]
}
}
]
}
]
},
"Series_Character": {
"source": {
"object": "[dbo].[Series_Character]",
"type": "table",
"key-fields": [
"CharacterId",
"SeriesId"
]
},
"graphql": {
"enabled": false,
"type": {
"singular": "Series_Character",
"plural": "Series_Characters"
}
},
"rest": {
"enabled": true
},
"permissions": [
{
"role": "anonymous",
"actions": [
{
"action": "*",
"fields": {
"exclude": [
""
],
"include": [
"*"
]
}
}
]
}
]
}
}
}
Loading
Loading