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: 2 additions & 0 deletions .github/scripts/test-calculate-package-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ assert_version "3.0.0" '{"versions":["3.0.0"]}' "3.0.1"
assert_version "3.0.0" '{"versions":["3.0.2","3.1.0"]}' "3.0.3"
assert_version "3.0.1" '{"versions":["3.0.0"]}' "3.0.1"
assert_version "3.0.2" '{"versions":["3.0.0"]}' "3.0.2"
assert_version "4.0.0" '{"versions":["3.1.0","4.0.0-preview.1"]}' "4.0.0"
assert_version "4.0.0" '{"versions":["3.1.0","4.0.0"]}' "4.0.1"
assert_version "3.0.1" '{"versions":["3.0.1"]}' "3.0.2"
assert_failure "3.0.0-preview.1" '{"versions":["2.0.7"]}'
assert_failure "2.0" '{"versions":["2.0.2"]}'
Expand Down
6 changes: 3 additions & 3 deletions .github/scripts/test-migration-cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ node tests/migrations/author-protected-transition.mjs "$magicdb" "$scratch_root/
# Real installed-package -> MSBuild-selected project SDK -> isolated exporter ->
# shared runtime schema resolver. No application assembly is loaded by the tool.
"$magicdb" databases list --project tests/MigrationCliConsumer/MigrationCliConsumer.csproj \
--framework net10.0 --configuration Release --json > "$artifact_root/consumer-list.json"
--framework net11.0 --configuration Release --json > "$artifact_root/consumer-list.json"
"$magicdb" schema export --project tests/MigrationCliConsumer/MigrationCliConsumer.csproj \
--framework net10.0 --configuration Release --output "$artifact_root/consumer-model.json" --json > "$artifact_root/consumer-export.json"
--framework net11.0 --configuration Release --output "$artifact_root/consumer-model.json" --json > "$artifact_root/consumer-export.json"
"$magicdb" migrations add Initial --schema "$artifact_root/consumer-model.json" \
--directory "$artifact_root/consumer" --json > "$artifact_root/consumer-add.json"
"$magicdb" migrations validate --project tests/MigrationCliConsumer/MigrationCliConsumer.csproj \
Expand All @@ -95,7 +95,7 @@ fi

dotnet build tests/Magic.IndexedDb.Cli.ContractTests/Magic.IndexedDb.Cli.ContractTests.csproj \
--configuration Release > "$artifact_root/contract-build.log" 2>&1
dotnet tests/Magic.IndexedDb.Cli.ContractTests/bin/Release/net10.0/Magic.IndexedDb.Cli.ContractTests.dll \
dotnet tests/Magic.IndexedDb.Cli.ContractTests/bin/Release/net11.0/Magic.IndexedDb.Cli.ContractTests.dll \
> "$artifact_root/contract-results.json"

node --input-type=module - "$artifact_root" <<'JS'
Expand Down
2 changes: 1 addition & 1 deletion .github/scripts/test-numeric-wasm.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import path from 'node:path';
import { pathToFileURL } from 'node:url';

const wwwroot = path.resolve(process.argv[2] ?? 'artifacts/numeric-wasm/wwwroot');
const playwrightEntry = path.resolve(process.argv[3] ?? 'E2eTest/bin/Release/net10.0/.playwright/package/index.mjs');
const playwrightEntry = path.resolve(process.argv[3] ?? 'E2eTest/bin/Release/net11.0/.playwright/package/index.mjs');
const outputDirectory = path.resolve(process.argv[4] ?? 'artifacts/numeric-wasm-results');
const expectedScenarios = [
'RoundTripAndStream',
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-nuget.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ jobs:
with:
persist-credentials: false

- name: Set up .NET 10
- name: Set up .NET 11
uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6
with:
dotnet-version: 10.0.x
dotnet-version: 11.0.x

- name: Calculate package version
id: version
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/validate-browsers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ jobs:
with:
persist-credentials: false

- name: Set up .NET 10
- name: Set up .NET 11
uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6
with:
dotnet-version: 10.0.x
dotnet-version: 11.0.x

- name: Restore browser tests
run: dotnet restore E2eTest/E2eTest.csproj
Expand All @@ -61,12 +61,12 @@ jobs:
- name: Install browser and Linux dependencies
if: ${{ runner.os == 'Linux' }}
shell: pwsh
run: E2eTest/bin/Release/net10.0/playwright.ps1 install --with-deps ${{ matrix.browser }}
run: E2eTest/bin/Release/net11.0/playwright.ps1 install --with-deps ${{ matrix.browser }}

- name: Install browser on macOS
if: ${{ runner.os == 'macOS' }}
shell: pwsh
run: E2eTest/bin/Release/net10.0/playwright.ps1 install ${{ matrix.browser }}
run: E2eTest/bin/Release/net11.0/playwright.ps1 install ${{ matrix.browser }}

- name: Run browser integration tests
if: ${{ runner.os == 'Linux' }}
Expand Down Expand Up @@ -161,10 +161,10 @@ jobs:
with:
persist-credentials: false

- name: Set up .NET 10
- name: Set up .NET 11
uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6
with:
dotnet-version: 10.0.x
dotnet-version: 11.0.x

- name: Install WebAssembly compilation tools
run: dotnet workload install wasm-tools
Expand All @@ -180,7 +180,7 @@ jobs:
run: dotnet build E2eTest/E2eTest.csproj --configuration Release

- name: Install Chromium and dependencies
run: node E2eTest/bin/Release/net10.0/.playwright/package/cli.js install --with-deps chromium
run: node E2eTest/bin/Release/net11.0/.playwright/package/cli.js install --with-deps chromium

- name: Run numeric scenarios and record benchmark
run: node .github/scripts/test-numeric-wasm.mjs
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/validate-dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ jobs:
with:
persist-credentials: false

- name: Set up .NET 10
- name: Set up .NET 11
uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6
with:
dotnet-version: 10.0.x
dotnet-version: 11.0.x

- name: Restore unit tests
run: dotnet restore Magic.IndexedDb.UnitTests/Magic.IndexedDb.UnitTests.csproj
Expand Down
22 changes: 11 additions & 11 deletions .github/workflows/validate-migrations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ jobs:
with:
persist-credentials: false

- name: Set up .NET 10
- name: Set up .NET 11
uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6
with:
dotnet-version: 10.0.x
dotnet-version: 11.0.x

- name: Set up Node.js 24
uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6
Expand Down Expand Up @@ -105,10 +105,10 @@ jobs:
with:
persist-credentials: false

- name: Set up .NET 10
- name: Set up .NET 11
uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6
with:
dotnet-version: 10.0.x
dotnet-version: 11.0.x

- name: Set up Node.js 24
uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6
Expand All @@ -126,11 +126,11 @@ jobs:

- name: Install browser and Linux dependencies
if: ${{ runner.os == 'Linux' }}
run: node tests/migrations/BrowserDriver/bin/Release/net10.0/.playwright/package/cli.js install --with-deps ${{ matrix.browser }}
run: node tests/migrations/BrowserDriver/bin/Release/net11.0/.playwright/package/cli.js install --with-deps ${{ matrix.browser }}

- name: Install browser on macOS
if: ${{ runner.os == 'macOS' }}
run: node tests/migrations/BrowserDriver/bin/Release/net10.0/.playwright/package/cli.js install ${{ matrix.browser }}
run: node tests/migrations/BrowserDriver/bin/Release/net11.0/.playwright/package/cli.js install ${{ matrix.browser }}

- name: Verify the original MIT v1 compatibility engine
working-directory: tests/migrations/fixtures/recovery-v1
Expand All @@ -143,7 +143,7 @@ jobs:
run: >-
node tests/migrations/run.mjs
${{ matrix.browser }}
tests/migrations/BrowserDriver/bin/Release/net10.0/.playwright/package/index.mjs
tests/migrations/BrowserDriver/bin/Release/net11.0/.playwright/package/index.mjs
artifacts/migration-browser/${{ matrix.browser }}-${{ runner.os }}

- name: Upload complete migration evidence
Expand All @@ -166,7 +166,7 @@ jobs:
persist-credentials: false
- uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6
with:
dotnet-version: 10.0.x
dotnet-version: 11.0.x
- uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6
with:
node-version: 24
Expand Down Expand Up @@ -219,7 +219,7 @@ jobs:
persist-credentials: false
- uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6
with:
dotnet-version: 10.0.x
dotnet-version: 11.0.x
- uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6
with:
node-version: 24
Expand All @@ -235,7 +235,7 @@ jobs:
mkdir -p artifacts/released-upgrade
tar -C artifacts/released-upgrade -xzf artifacts/released-upgrade.tar.gz
dotnet build tests/migrations/BrowserDriver/BrowserDriver.csproj -c Release
driver=tests/migrations/BrowserDriver/bin/Release/net10.0/.playwright/package
driver=tests/migrations/BrowserDriver/bin/Release/net11.0/.playwright/package
if [[ "$RUNNER_PLATFORM" == Linux ]]; then
node "$driver/cli.js" install --with-deps "$BROWSER"
else
Expand All @@ -247,7 +247,7 @@ jobs:
BROWSER: ${{ matrix.browser }}
run: |
set -o pipefail
driver=tests/migrations/BrowserDriver/bin/Release/net10.0/.playwright/package/index.mjs
driver=tests/migrations/BrowserDriver/bin/Release/net11.0/.playwright/package/index.mjs
fixture=artifacts/released-upgrade
status=0
for mode in trimmed aot; do
Expand Down
4 changes: 2 additions & 2 deletions E2eTest/E2eTest.csproj
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<TargetFramework>net11.0</TargetFramework>
<LangVersion>latest</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsTestProject>true</IsTestProject>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="10.0.11" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="11.0.0" />
<PackageReference Include="Microsoft.Playwright.MSTest" Version="1.62.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
<PackageReference Include="MSTest" Version="3.10.4" />
Expand Down
2 changes: 1 addition & 1 deletion E2eTest/benchmarks/encryption-envelope.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// node E2eTest/benchmarks/encryption-envelope.mjs
import { createServer } from "node:http";
import { readFile } from "node:fs/promises";
import { chromium } from "../bin/Release/net10.0/.playwright/package/index.mjs";
import { chromium } from "../bin/Release/net11.0/.playwright/package/index.mjs";

const moduleSource = await readFile(new URL(
"../../Magic.IndexedDb/wwwroot/utilities/encryptionEnvelope.js", import.meta.url));
Expand Down
2 changes: 1 addition & 1 deletion E2eTest/benchmarks/encryption-wasm.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { createServer } from "node:http";
import { createReadStream } from "node:fs";
import { stat } from "node:fs/promises";
import path from "node:path";
import { chromium, firefox, webkit } from "../bin/Release/net10.0/.playwright/package/index.mjs";
import { chromium, firefox, webkit } from "../bin/Release/net11.0/.playwright/package/index.mjs";

const root = path.resolve(process.argv[2]);
const engine = process.argv[3] ?? "chromium";
Expand Down
2 changes: 1 addition & 1 deletion E2eTestWebApp/E2eTestWebApp.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<TargetFramework>net11.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
Expand Down
8 changes: 4 additions & 4 deletions IndexDb.Example/IndexDb.Example.csproj
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">

<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<TargetFramework>net11.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<ServiceWorkerAssetsManifest>service-worker-assets.js</ServiceWorkerAssetsManifest>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="10.0.11" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="10.0.11" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="10.0.11" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="11.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="11.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="11.0.0" PrivateAssets="all" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
</ItemGroup>

Expand Down
4 changes: 2 additions & 2 deletions Magic.IndexedDb.Cli/Magic.IndexedDb.Cli.csproj
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<TargetFramework>net11.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PackAsTool>true</PackAsTool>
<ToolCommandName>magicdb</ToolCommandName>
<PackageId>Magic.IndexedDb.Cli</PackageId>
<Version>3.1.0</Version>
<Version>4.0.0</Version>
<Authors>Magic Man</Authors>
<Description>Code-first, language-independent migration planning, validation, and static publishing for Magic IndexedDB.</Description>
<PackageProjectUrl>https://github.com/magiccodingman/Magic.IndexedDb</PackageProjectUrl>
Expand Down
4 changes: 2 additions & 2 deletions Magic.IndexedDb.Cli/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Magic.IndexedDb.Cli

`magicdb` is the separately packaged .NET 10 tool for Magic IndexedDB 3.0.
`magicdb` is the separately packaged .NET 11 tool for Magic IndexedDB 4.
It exports models, scaffolds reviewed migration history, validates it, and publishes
static browser assets. It never connects to or rewrites customers' browser data.

```sh
dotnet new tool-manifest
dotnet tool install --local Magic.IndexedDb.Cli --version 3.0.0
dotnet tool install --local Magic.IndexedDb.Cli --version 4.0.0
dotnet tool run magicdb -- --help
```

Expand Down
2 changes: 1 addition & 1 deletion Magic.IndexedDb.Cli/SchemaSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ private static async Task<JsonObject> ExportProjectAsync(string input, Arguments
if (framework is null)
{
framework = properties["TargetFramework"]?.GetValue<string>();
if (string.IsNullOrWhiteSpace(framework)) throw new CliException("MAGDB4403", "The exporter multi-targets. Select one target with --framework (for example net10.0).", 4);
if (string.IsNullOrWhiteSpace(framework)) throw new CliException("MAGDB4403", "The exporter multi-targets. Select one target with --framework (for example net11.0).", 4);
}
var build = await RunProcessAsync(DotnetHost(), ["build", project, "--configuration", configuration, "--framework", framework,
"--nologo", "--verbosity", "quiet", "-p:GeneratePackageOnBuild=false"], workingDirectory, cancellationToken);
Expand Down
10 changes: 10 additions & 0 deletions Magic.IndexedDb.UnitTests/ConstructorContractTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,16 @@ public void NestedParameterizedType_DoesNotRequireAParameterlessConstructor()
Assert.AreEqual("nested", result.Value.Code);
}

[TestMethod]
public void NestedNullableQueryCondition_UsesUnderlyingMetadata()
{
var properties = typeof(Magic.IndexedDb.LinqTranslation.Models.FilterNode).GetProperties();
var nested = PropertyMappingCache.GetAllNestedComplexTypes(properties).ToArray();

CollectionAssert.AreEquivalent(
new[] { typeof(Magic.IndexedDb.Models.UniversalOperations.FilterCondition) }, nested);
}

[TestMethod]
public void MultipleMagicConstructors_FailWithAnActionableError()
{
Expand Down
2 changes: 1 addition & 1 deletion Magic.IndexedDb.UnitTests/Magic.IndexedDb.UnitTests.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<TargetFramework>net11.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
Expand Down
29 changes: 14 additions & 15 deletions Magic.IndexedDb/Helpers/PropertyMappingCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ public SearchPropEntry(Type type, Dictionary<string, MagicPropertyEntry> _proper
var parameters = Constructor!.GetParameters();
for (int i = 0; i < parameters.Length; i++)
{
ConstructorParameterMappings[parameters[i].Name!] = i;
// Serialization only needs the properties. Trimmed constructors
// can still be visible to reflection without parameter names.
if (parameters[i].Name is { } name)
ConstructorParameterMappings[name] = i;
}
}

Expand Down Expand Up @@ -256,30 +259,26 @@ public static IEnumerable<Type> GetAllNestedComplexTypes(IEnumerable<PropertyInf
HashSet<Type> complexTypes = new();
Stack<Type> typeStack = new();

// Initial population of the stack
foreach (var property in properties)
void VisitProperty(PropertyInfo property)
{
if (IsComplexType(property.PropertyType))
{
typeStack.Push(property.PropertyType);
complexTypes.Add(property.PropertyType);
}
// A non-null nullable value boxes as its underlying type. Discovering
// the wrapper would require constructor metadata that trimming may omit.
var type = Nullable.GetUnderlyingType(property.PropertyType) ?? property.PropertyType;
if (IsComplexType(type) && complexTypes.Add(type))
typeStack.Push(type);
}

foreach (var property in properties)
VisitProperty(property);

// Process all nested complex types
while (typeStack.Count > 0)
{
var currentType = typeStack.Pop();
var nestedProperties = currentType.GetProperties(BindingFlags.Public | BindingFlags.Instance);

foreach (var nestedProperty in nestedProperties)
{
if (IsComplexType(nestedProperty.PropertyType) && !complexTypes.Contains(nestedProperty.PropertyType))
{
complexTypes.Add(nestedProperty.PropertyType);
typeStack.Push(nestedProperty.PropertyType);
}
}
VisitProperty(nestedProperty);
}

return complexTypes;
Expand Down
Loading
Loading