diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 949c432..11c5d7d 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -24,6 +24,11 @@ updates: Extensions: patterns: - "Microsoft.Extensions*" + exclude-patterns: + - "Microsoft.Extensions.AI*" + ExtensionsAI: + patterns: + - "Microsoft.Extensions.AI*" Web: patterns: - "Microsoft.AspNetCore*" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d0f6d29..d6bd793 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -66,16 +66,11 @@ jobs: fetch-depth: 0 - name: ⚙ dotnet - uses: ./.github/actions/dotnet + uses: devlooped/actions-dotnet-env@v1 - name: 🙏 build run: dotnet build -m:1 -bl:build.binlog - - name: ⚙ azurite - run: | - npm install azurite - npx azurite & - - name: 🧪 test run: | dotnet tool update -g dotnet-retest @@ -91,7 +86,7 @@ jobs: - name: 🚀 sleet env: SLEET_CONNECTION: ${{ secrets.SLEET_CONNECTION }} - if: env.SLEET_CONNECTION != '' && env.SLEET_FEED_URL != '' + if: env.SLEET_CONNECTION != '' run: | dotnet tool update sleet -g --allow-downgrade --version $(curl -s --compressed ${{ vars.SLEET_FEED_URL }} | jq '.["sleet:version"]' -r) sleet push bin --config none -f --verbose -p "SLEET_FEED_CONTAINER=nuget" -p "SLEET_FEED_CONNECTIONSTRING=${{ secrets.SLEET_CONNECTION }}" -p "SLEET_FEED_TYPE=azure" || echo "No packages found" @@ -106,12 +101,7 @@ jobs: fetch-depth: 0 - name: ⚙ dotnet - uses: actions/setup-dotnet@v4 - with: - dotnet-version: | - 6.x - 8.x - 9.x + uses: devlooped/actions-dotnet-env@v1 - name: ✓ ensure format run: | diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 2af84fb..03e57d9 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -28,16 +28,11 @@ jobs: fetch-depth: 0 - name: ⚙ dotnet - uses: ./.github/actions/dotnet + uses: devlooped/actions-dotnet-env@v1 - name: 🙏 build run: dotnet build -m:1 -bl:build.binlog - - name: ⚙ azurite - run: | - npm install azurite - npx azurite & - - name: 🧪 test run: | dotnet tool update -g dotnet-retest diff --git a/.gitignore b/.gitignore index 2ac54a7..0fe79fb 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ BenchmarkDotNet.Artifacts .genaiscript .idea local.settings.json +.env *.suo *.sdf diff --git a/.netconfig b/.netconfig index 2d219b2..b6c8ce5 100644 --- a/.netconfig +++ b/.netconfig @@ -26,9 +26,9 @@ weak [file ".github/dependabot.yml"] url = https://github.com/devlooped/oss/blob/main/.github/dependabot.yml - sha = 917ff5486e25bec90038e7ab6d146fd82c61f846 + sha = e733294084fb3e75d517a2e961e87df8faae7dc6 - etag = 50bf50df5a6eeb1705baea50f4c6e06d167a89cb5a590887ff939bd4120bd442 + etag = 3bf8d9214a15c049ca5cfe80d212a8cbe4753b8a638a9804ef73d34c7def9618 weak [file ".github/release.yml"] url = https://github.com/devlooped/oss/blob/main/.github/release.yml @@ -38,9 +38,9 @@ weak [file ".github/workflows/build.yml"] url = https://github.com/devlooped/oss/blob/main/.github/workflows/build.yml - sha = 08c70776943839f73dbea2e65355108747468508 + sha = 56c2b8532c2f86235a0f5bd00ba6eba126f199cf - etag = fb2e91cdc9fb7a4d3e8f698e525816c5d8febb35b005c278eecca8056e78f809 + etag = bf99c19427f4372ecfe38ec56aa8c411058684fb717da5661f17ac00388b3602 weak [file ".github/workflows/changelog.config"] url = https://github.com/devlooped/oss/blob/main/.github/workflows/changelog.config @@ -71,9 +71,9 @@ weak [file ".github/workflows/publish.yml"] url = https://github.com/devlooped/oss/blob/main/.github/workflows/publish.yml - sha = 08c70776943839f73dbea2e65355108747468508 + sha = 56c2b8532c2f86235a0f5bd00ba6eba126f199cf - etag = 722a2c7cb3a42bc24ca7fb48d2e9a336641ed0599418239e24efbafccf64bd50 + etag = 2ef43521627aa3a91dd55bdc2856ec0c6a93b42485d4fe9d6b181f9ee42c8e18 weak [file ".github/workflows/triage.yml"] url = https://github.com/devlooped/oss/blob/main/.github/workflows/triage.yml @@ -83,9 +83,9 @@ weak [file ".gitignore"] url = https://github.com/devlooped/oss/blob/main/.gitignore - sha = e0be248fff1d39133345283b8227372b36574b75 + sha = 3776526342afb3f57da7e80f2095e5fdca3c31c9 - etag = c449ec6f76803e1891357ca2b8b4fcb5b2e5deeff8311622fd92ca9fbf1e6575 + etag = 11767f73556aa4c6c8bcc153b77ee8e8114f99fa3b885b0a7d66d082f91e77b3 weak [file "Directory.Build.rsp"] url = https://github.com/devlooped/oss/blob/main/Directory.Build.rsp @@ -95,9 +95,9 @@ weak [file "_config.yml"] url = https://github.com/devlooped/oss/blob/main/_config.yml - sha = fa83a5161ba52bc5d510ce0ba75ee0b1f8d4bc63 + sha = 68b409c486842062e0de0e5b11e6fdb7cd12d6e2 - etag = 9139148f845adf503fd3c3c140eb64421fc476a1f9c027fc50825c0efb05f557 + etag = d608aa0ddaedc2d8a87260f50756e8d8314964ad4671b76bd085bcb458757010 weak [file "assets/css/style.scss"] url = https://github.com/devlooped/oss/blob/main/assets/css/style.scss @@ -110,15 +110,15 @@ skip [file "src/Directory.Build.props"] url = https://github.com/devlooped/oss/blob/main/src/Directory.Build.props - sha = 2fff747a9673b499c99f2da183cdd5263fdc9333 + sha = c509be4378ff6789df4f66338cb88119453c0975 - etag = 0fccddf04f282fe98122ab2610dc2972c205a521254559bf013655c6271b0017 + etag = cbbdc1a4d3030f353f3e5306a6c380238dd4ed0945aad2d56ba87b49fcfcd66d weak [file "src/Directory.Build.targets"] url = https://github.com/devlooped/oss/blob/main/src/Directory.Build.targets - sha = a8b208093599263b7f2d1fe3854634c588ea5199 + sha = 4339749ef4b8f66def75931df09ef99c149f8421 - etag = 19087699f05396205e6b050d999a43b175bd242f6e8fac86f6df936310178b03 + etag = 8b4492765755c030c4c351e058a92f53ab493cab440c1c0ef431f6635c4dae0e weak [file "src/Tests/Attributes.cs"] url = https://github.com/devlooped/catbag/blob/main/Xunit/Attributes.cs diff --git a/_config.yml b/_config.yml index a61f7e0..04e6093 100644 --- a/_config.yml +++ b/_config.yml @@ -1,3 +1,3 @@ theme: jekyll-theme-slate -exclude: [ 'src/', '*.sln', 'Gemfile*', '*.rsp' ] \ No newline at end of file +exclude: [ 'src/', '*.sln', '*.slnx', 'Gemfile*', '*.rsp' ] diff --git a/src/Directory.Build.props b/src/Directory.Build.props index b0b9d94..352da32 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -20,6 +20,7 @@ Daniel Cazzulino + Devlooped Copyright (C) Daniel Cazzulino and Contributors. All rights reserved. false MIT @@ -126,6 +127,8 @@ <_VersionLabel>$(_VersionLabel.Replace('/merge', '')) <_VersionLabel>$(_VersionLabel.Replace('/', '-')) + + <_VersionLabel>$(_VersionLabel.Replace('_', '-')) $(_VersionLabel) diff --git a/src/Directory.Build.targets b/src/Directory.Build.targets index 6232750..083afa6 100644 --- a/src/Directory.Build.targets +++ b/src/Directory.Build.targets @@ -165,6 +165,9 @@ @(_GitSourceRoot) + + $([System.IO.Path]::GetFileNameWithoutExtension($(PrivateRepositoryUrl))) + $(ProductFromUrl) @@ -175,9 +178,9 @@ Condition="'$(SourceControlInformationFeatureSupported)' == 'true' And '$(IsPackable)' == 'true'"> - $(RepositoryUrl) + $(RepositoryUrl.Replace('.git', '')) $(Description) - $(RepositoryUrl)/blob/main/changelog.md + $(RepositoryUrl.Replace('.git', ''))/blob/main/changelog.md diff --git a/src/OpenLaw/IConfigurationExtensions.cs b/src/OpenLaw/IConfigurationExtensions.cs index 67c456b..44401b3 100644 --- a/src/OpenLaw/IConfigurationExtensions.cs +++ b/src/OpenLaw/IConfigurationExtensions.cs @@ -14,11 +14,11 @@ public string Get(string key, bool required = true) => public string Get(string key, string @default) => configuration[key] is var value && string.IsNullOrEmpty(value) ? @default : value; - public string this[string key, bool required] => - configuration[key] is string value && !string.IsNullOrEmpty(value) ? value : required ? throw new InvalidOperationException($"Missing required configuration value '{key}'.") : null!; + //public string this[string key, bool required] => + // configuration[key] is string value && !string.IsNullOrEmpty(value) ? value : required ? throw new InvalidOperationException($"Missing required configuration value '{key}'.") : null!; - public string this[string key, string @default] => - configuration[key] is var value && string.IsNullOrEmpty(value) ? @default : value; + //public string this[string key, string @default] => + // configuration[key] is var value && string.IsNullOrEmpty(value) ? @default : value; } } diff --git a/src/OpenLaw/OpenLaw.csproj b/src/OpenLaw/OpenLaw.csproj index b88097c..a2b0be2 100644 --- a/src/OpenLaw/OpenLaw.csproj +++ b/src/OpenLaw/OpenLaw.csproj @@ -9,6 +9,7 @@ + diff --git a/src/OpenLaw/SystemIdMapper.cs b/src/OpenLaw/SystemIdMapper.cs index 4ce861a..d603dab 100644 --- a/src/OpenLaw/SystemIdMapper.cs +++ b/src/OpenLaw/SystemIdMapper.cs @@ -23,9 +23,19 @@ public interface ISystemIdMapper /// Maps IDs across different systems. /// [Service] -public class SystemIdMapper(CloudStorageAccount storage) : ISystemIdMapper +public class SystemIdMapper : ISystemIdMapper { - readonly ITableRepository repo = TableRepository.Create(storage, "SystemId"); + readonly ITableRepository repo; + + public SystemIdMapper(CloudStorageAccount storage) + : this(TableRepository.Create(storage, "SystemId")) + { + } + + internal SystemIdMapper(ITableRepository repo) + { + this.repo = repo ?? throw new ArgumentNullException(nameof(repo)); + } /// /// Creates a bidirectional mapping between the two identifiers. @@ -55,8 +65,17 @@ public async Task MapAsync(SystemId first, SystemId second, CancellationToken ca try { - await foreach (var item in query.Take(1)) - return item.RowKey[(system.Length + 1)..]; + query = query.Take(1); + if (query is IAsyncEnumerable) + { + await foreach (var item in query) + return item.RowKey[(system.Length + 1)..]; + } + else + { + foreach (var item in query) + return item.RowKey[(system.Length + 1)..]; + } } catch (HttpRequestException re) when (re.StatusCode == System.Net.HttpStatusCode.NotFound) { diff --git a/src/Tests/SystemIdMapperTests.cs b/src/Tests/SystemIdMapperTests.cs index 20836b8..3f2c3bd 100644 --- a/src/Tests/SystemIdMapperTests.cs +++ b/src/Tests/SystemIdMapperTests.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Devlooped; +using Devlooped; namespace Clarius.OpenLaw; @@ -12,7 +7,7 @@ public class SystemIdMapperTests [Fact] public async Task Map() { - var mapper = new SystemIdMapper(CloudStorageAccount.DevelopmentStorageAccount); + var mapper = new SystemIdMapper(MemoryRepository.Create()); var from = ("github", "123"); var to = ("discord", "456"); diff --git a/src/Tests/Tests.csproj b/src/Tests/Tests.csproj index f3f87b4..0ae1146 100644 --- a/src/Tests/Tests.csproj +++ b/src/Tests/Tests.csproj @@ -4,11 +4,13 @@ net9.0 OPENAI001;$(NoWarn) true + OpenLaw.Tests +