From b3cfd46e0c6f2cc29f73c99478104abab3463b36 Mon Sep 17 00:00:00 2001 From: Clement Bouvet Date: Tue, 1 Jul 2025 08:31:38 +0200 Subject: [PATCH 1/4] remove consent management --- consent-management/.gitignore | 4 -- consent-management/Component.cs | 46 ------------------- consent-management/Makefile | 13 ------ consent-management/README.md | 30 ------------ consent-management/edgee-component.toml | 20 -------- .../example-cs-component.csproj | 26 ----------- consent-management/nuget.config | 9 ---- 7 files changed, 148 deletions(-) delete mode 100644 consent-management/.gitignore delete mode 100644 consent-management/Component.cs delete mode 100644 consent-management/Makefile delete mode 100644 consent-management/README.md delete mode 100644 consent-management/edgee-component.toml delete mode 100644 consent-management/example-cs-component.csproj delete mode 100644 consent-management/nuget.config diff --git a/consent-management/.gitignore b/consent-management/.gitignore deleted file mode 100644 index 9068194..0000000 --- a/consent-management/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -.edgee/ -bin/ -obj/ -component.wasm diff --git a/consent-management/Component.cs b/consent-management/Component.cs deleted file mode 100644 index f5710ca..0000000 --- a/consent-management/Component.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace ConsentManagementWorld.wit.exports.edgee.components.v1_0_0; - -public struct Settings { - public string Example { get; } - - public Settings(List<(string, string)> settings) { - Example = string.Empty; - foreach (var setting in settings) { - if (setting.Item1 == "example") { - Example = setting.Item2; - } - } - } -} - -public struct Cookies { - public string Example { get; } - - public Cookies(List<(string, string)> cookies) { - Example = string.Empty; - foreach (var cookie in cookies) { - if (cookie.Item1 == "example") { - Example = cookie.Item2; - } - } - } -} - -public class ConsentManagementImpl: IConsentManagement { - public static IConsentManagement.Consent? Map(List<(string, string)> cookies, List<(string, string)> settings) { - Settings s = new Settings(settings); - Cookies c = new Cookies(cookies); - - if (c.Example == string.Empty) { - return null; - } else if (c.Example == "granted") { - return IConsentManagement.Consent.GRANTED; - } else if (c.Example == "denied") { - return IConsentManagement.Consent.DENIED; - } else { - return IConsentManagement.Consent.PENDING; - } - - } -} - diff --git a/consent-management/Makefile b/consent-management/Makefile deleted file mode 100644 index c0e47ac..0000000 --- a/consent-management/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -.PHONY: all -MAKEFLAGS += --silent - -all: help - -help: - @grep -E '^[a-zA-Z1-9\._-]+:.*?## .*$$' $(MAKEFILE_LIST) \ - | sort \ - | sed -e "s/^Makefile://" -e "s///" \ - | awk 'BEGIN { FS = ":.*?## " }; { printf "\033[36m%-30s\033[0m %s\n", $$1, $$2 }' - -build: - edgee components build \ No newline at end of file diff --git a/consent-management/README.md b/consent-management/README.md deleted file mode 100644 index 5a40867..0000000 --- a/consent-management/README.md +++ /dev/null @@ -1,30 +0,0 @@ -
-

- - - - Edgee - - -

-
- -

Example dotnet component for Edgee

- -This is an example of a C# Edgee Component. - -## Setup -Requirements: -- [edgee-cli](https://github.com/edgee-cloud/edgee) -- [dotnet SDK 10.0](https://dotnet.microsoft.com/en-us/download/dotnet/10.0) -- Modify the csproj file to match your OS: - - On Linux -```dotnet add package runtime.linux-x64.microsoft.dotnet.ilcompiler.llvm --prerelease``` - - On Windows -```dotnet add package runtime.win-x64.microsoft.dotnet.ilcompiler.llvm --prerelease``` - -## Building - -```shell -$ make build -``` diff --git a/consent-management/edgee-component.toml b/consent-management/edgee-component.toml deleted file mode 100644 index 6ce57b0..0000000 --- a/consent-management/edgee-component.toml +++ /dev/null @@ -1,20 +0,0 @@ -manifest-version = 1 - -[component] -name = "example-cs-consent-management-component" -version = "1.0.0" -category = "consent-management" -subcategory = "consent-mapping" -description = "Example CSharp component for consent management" -documentation = "https://github.com/edgee-cloud/example-cs-component" -repository = "https://github.com/edgee-cloud/example-cs-component" -language = "CSharp" -wit-version = "1.0.0" - -[component.build] -command = "dotnet build && mv ./bin/Debug/net10.0/wasi-wasm/publish/example-cs-component.wasm ./component.wasm" -output_path = "./component.wasm" - -[component.settings.example] -title = "Example Config Field" -type = "string" diff --git a/consent-management/example-cs-component.csproj b/consent-management/example-cs-component.csproj deleted file mode 100644 index 1446b3b..0000000 --- a/consent-management/example-cs-component.csproj +++ /dev/null @@ -1,26 +0,0 @@ - - - - Library - net10.0 - example_cs_component - enable - enable - wasi-wasm - false - true - true - true - - - - - - - - - - - - - diff --git a/consent-management/nuget.config b/consent-management/nuget.config deleted file mode 100644 index caa4ee8..0000000 --- a/consent-management/nuget.config +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - From 3317f26eb2acab8ed5b7cd750958c153f23253d0 Mon Sep 17 00:00:00 2001 From: Clement Bouvet Date: Tue, 1 Jul 2025 09:02:02 +0200 Subject: [PATCH 2/4] edge-function: wip --- edge-function/.gitignore | 4 +++ edge-function/Component.cs | 30 +++++++++++++++++++++++ edge-function/Makefile | 13 ++++++++++ edge-function/README.md | 30 +++++++++++++++++++++++ edge-function/edgee-component.toml | 20 +++++++++++++++ edge-function/example-cs-component.csproj | 26 ++++++++++++++++++++ edge-function/nuget.config | 9 +++++++ 7 files changed, 132 insertions(+) create mode 100644 edge-function/.gitignore create mode 100644 edge-function/Component.cs create mode 100644 edge-function/Makefile create mode 100644 edge-function/README.md create mode 100644 edge-function/edgee-component.toml create mode 100644 edge-function/example-cs-component.csproj create mode 100644 edge-function/nuget.config diff --git a/edge-function/.gitignore b/edge-function/.gitignore new file mode 100644 index 0000000..9068194 --- /dev/null +++ b/edge-function/.gitignore @@ -0,0 +1,4 @@ +.edgee/ +bin/ +obj/ +component.wasm diff --git a/edge-function/Component.cs b/edge-function/Component.cs new file mode 100644 index 0000000..d98f189 --- /dev/null +++ b/edge-function/Component.cs @@ -0,0 +1,30 @@ +namespace EdgeFunctionWorld.wit.exports.wasi.http.v0_2_0; +using System.Text; + +using EdgeFunctionWorld; +using EdgeFunctionWorld.wit.exports.wasi.http.v0_2_0; +using EdgeFunctionWorld.wit.imports.wasi.http.v0_2_0; +using EdgeFunctionWorld.wit.imports.wasi.io.v0_2_0; + +public class IncomingHandlerImpl: IIncomingHandler { + public static void Handle(ITypes.IncomingRequest request, ITypes.ResponseOutparam responseOut) { + byte[] content = "Hello, World!"u8.ToArray(); + List<(string, byte[])> headers = + [ + ("content-type", "text/plain"u8.ToArray()), + ("content-length", Encoding.ASCII.GetBytes(content.Length.ToString())) + ]; + + ITypes.OutgoingResponse response = new(ITypes.Fields.FromList(headers)); + ITypes.OutgoingBody body = response.Body(); + + ITypes.ResponseOutparam.Set(responseOut, Result.Ok(response)); + + using IStreams.OutputStream stream = body.Write(); + stream.BlockingWriteAndFlush(content); + stream.Dispose(); + + ITypes.OutgoingBody.Finish(body, null); + } +} + diff --git a/edge-function/Makefile b/edge-function/Makefile new file mode 100644 index 0000000..c0e47ac --- /dev/null +++ b/edge-function/Makefile @@ -0,0 +1,13 @@ +.PHONY: all +MAKEFLAGS += --silent + +all: help + +help: + @grep -E '^[a-zA-Z1-9\._-]+:.*?## .*$$' $(MAKEFILE_LIST) \ + | sort \ + | sed -e "s/^Makefile://" -e "s///" \ + | awk 'BEGIN { FS = ":.*?## " }; { printf "\033[36m%-30s\033[0m %s\n", $$1, $$2 }' + +build: + edgee components build \ No newline at end of file diff --git a/edge-function/README.md b/edge-function/README.md new file mode 100644 index 0000000..5a40867 --- /dev/null +++ b/edge-function/README.md @@ -0,0 +1,30 @@ +
+

+ + + + Edgee + + +

+
+ +

Example dotnet component for Edgee

+ +This is an example of a C# Edgee Component. + +## Setup +Requirements: +- [edgee-cli](https://github.com/edgee-cloud/edgee) +- [dotnet SDK 10.0](https://dotnet.microsoft.com/en-us/download/dotnet/10.0) +- Modify the csproj file to match your OS: + - On Linux +```dotnet add package runtime.linux-x64.microsoft.dotnet.ilcompiler.llvm --prerelease``` + - On Windows +```dotnet add package runtime.win-x64.microsoft.dotnet.ilcompiler.llvm --prerelease``` + +## Building + +```shell +$ make build +``` diff --git a/edge-function/edgee-component.toml b/edge-function/edgee-component.toml new file mode 100644 index 0000000..b1ae366 --- /dev/null +++ b/edge-function/edgee-component.toml @@ -0,0 +1,20 @@ +manifest-version = 1 + +[component] +name = "example-cs-edge-function-component" +version = "1.0.0" +category = "edge-function" +subcategory = "analytics" +description = "Example CSharp component for edge-function" +documentation = "https://github.com/edgee-cloud/example-cs-component" +repository = "https://github.com/edgee-cloud/example-cs-component" +language = "CSharp" +wit-version = "1.0.0" + +[component.build] +command = "dotnet build && mv ./bin/Debug/net10.0/wasi-wasm/publish/example-cs-component.wasm ./component.wasm" +output_path = "./component.wasm" + +[component.settings.example] +title = "Example Config Field" +type = "string" diff --git a/edge-function/example-cs-component.csproj b/edge-function/example-cs-component.csproj new file mode 100644 index 0000000..6115c23 --- /dev/null +++ b/edge-function/example-cs-component.csproj @@ -0,0 +1,26 @@ + + + + Library + net10.0 + example_cs_component + enable + enable + wasi-wasm + false + true + true + true + + + + + + + + + + + + + diff --git a/edge-function/nuget.config b/edge-function/nuget.config new file mode 100644 index 0000000..caa4ee8 --- /dev/null +++ b/edge-function/nuget.config @@ -0,0 +1,9 @@ + + + + + + + + + From 5d1789f90abfe9d4d61c322cfa90c27deac6d40e Mon Sep 17 00:00:00 2001 From: Clement Bouvet Date: Tue, 1 Jul 2025 15:08:20 +0200 Subject: [PATCH 3/4] CI: build edge-function --- .github/workflows/check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 85237fc..461a6d2 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - dir: [consent-management, data-collection] + dir: [edge-function, data-collection] defaults: run: working-directory: ${{ matrix.dir }} From 456834c22423e0a5aa1413def8964f156c4d9692 Mon Sep 17 00:00:00 2001 From: Clement Bouvet Date: Wed, 2 Jul 2025 08:15:57 +0200 Subject: [PATCH 4/4] fixup! edge-function: wip --- edge-function/edgee-component.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/edge-function/edgee-component.toml b/edge-function/edgee-component.toml index b1ae366..6d461ad 100644 --- a/edge-function/edgee-component.toml +++ b/edge-function/edgee-component.toml @@ -4,7 +4,7 @@ manifest-version = 1 name = "example-cs-edge-function-component" version = "1.0.0" category = "edge-function" -subcategory = "analytics" +subcategory = "wasm-function" description = "Example CSharp component for edge-function" documentation = "https://github.com/edgee-cloud/example-cs-component" repository = "https://github.com/edgee-cloud/example-cs-component"