From 61a09063f0bfc91cae36ecdb26ad270a5394db19 Mon Sep 17 00:00:00 2001 From: "Julianne H." Date: Fri, 7 Mar 2025 17:50:33 +0100 Subject: [PATCH 1/3] chore: update to new WIT files handling --- .gitignore | 3 +- package.json | 4 +- wit/deps.lock | 4 - wit/deps.toml | 1 - wit/deps/edgee/consent-mapping.wit | 13 ---- wit/deps/edgee/data-collection.wit | 114 ----------------------------- wit/world.wit | 5 -- 7 files changed, 4 insertions(+), 140 deletions(-) delete mode 100644 wit/deps.lock delete mode 100644 wit/deps.toml delete mode 100644 wit/deps/edgee/consent-mapping.wit delete mode 100644 wit/deps/edgee/data-collection.wit delete mode 100644 wit/world.wit diff --git a/.gitignore b/.gitignore index 9ac2624..92c444a 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ /coverage # Build artifacts -*.wasm \ No newline at end of file +.edgee/ +*.wasm diff --git a/package.json b/package.json index 5ee081c..cac5dc2 100644 --- a/package.json +++ b/package.json @@ -4,8 +4,8 @@ "main": "src/index.js", "types": "./types/wit.d.ts", "scripts": { - "generate": "npx @bytecodealliance/jco types wit/ -o types/", - "build": "npx @bytecodealliance/jco componentize src/index.js --wit wit -o example-js-component.wasm -n data-collection -d all", + "generate": "npx @bytecodealliance/jco types .edgee/wit -o types/", + "build": "npx @bytecodealliance/jco componentize src/index.js --wit .edgee/wit -o example-js-component.wasm -n data-collection -d all", "test": "mocha", "coverage": "c8 --src js --all -r text -r text-summary npm test" }, diff --git a/wit/deps.lock b/wit/deps.lock deleted file mode 100644 index 6455ab3..0000000 --- a/wit/deps.lock +++ /dev/null @@ -1,4 +0,0 @@ -[edgee] -url = "https://github.com/edgee-cloud/edgee-wit/archive/refs/tags/v0.5.0.tar.gz" -sha256 = "f6e11c5cde39ec04b024b1181f45e896f154f7677ff5a904c99f6af5224dc371" -sha512 = "21b045d0fb82a793a6176f6d9e98dab868563ab7906e3762601e14f06a715e36c965e83e6f5c76cf016af03df48d219b86165a7c18d14284e967d0b837bf99e4" diff --git a/wit/deps.toml b/wit/deps.toml deleted file mode 100644 index 77ea76e..0000000 --- a/wit/deps.toml +++ /dev/null @@ -1 +0,0 @@ -edgee = "https://github.com/edgee-cloud/edgee-wit/archive/refs/tags/v0.5.0.tar.gz" diff --git a/wit/deps/edgee/consent-mapping.wit b/wit/deps/edgee/consent-mapping.wit deleted file mode 100644 index b284aa0..0000000 --- a/wit/deps/edgee/consent-mapping.wit +++ /dev/null @@ -1,13 +0,0 @@ -package edgee:components; - -interface consent-mapping { - type dict = list>; - - enum consent { - pending, - granted, - denied, - } - - map: func(cookie: string, settings: dict) -> option; -} \ No newline at end of file diff --git a/wit/deps/edgee/data-collection.wit b/wit/deps/edgee/data-collection.wit deleted file mode 100644 index 994c537..0000000 --- a/wit/deps/edgee/data-collection.wit +++ /dev/null @@ -1,114 +0,0 @@ -package edgee:components; - -interface data-collection { - type dict = list>; - - enum event-type { page, track, user } - enum consent { pending, granted, denied } - - record event { - uuid: string, - timestamp: s64, - timestamp-millis: s64, - timestamp-micros: s64, - event-type: event-type, - data: data, - context: context, - consent: option, - } - - variant data { - page(page-data), - track(track-data), - user(user-data), - } - - record page-data { - name: string, - category: string, - keywords: list, - title: string, - url: string, - path: string, - search: string, - referrer: string, - properties: dict, - } - - record user-data { - user-id: string, - anonymous-id: string, - edgee-id: string, - properties: dict, - } - - record track-data { - name: string, - properties: dict, - products: list, - } - - record context { - page: page-data, - user: user-data, - client: client, - campaign: campaign, - session: session, - } - - record client { - ip: string, - locale: string, - timezone: string, - user-agent: string, - user-agent-architecture: string, - user-agent-bitness: string, - user-agent-version-list: string, - user-agent-full-version-list: string, - user-agent-mobile: string, - user-agent-model: string, - os-name: string, - os-version: string, - screen-width: s32, - screen-height: s32, - screen-density: f32, - continent: string, - country-code: string, - country-name: string, - region: string, - city: string, - } - - record campaign { - name: string, - source: string, - medium: string, - term: string, - content: string, - creative-format: string, - marketing-tactic: string, - } - - record session { - session-id: string, - previous-session-id: string, - session-count: u32, - session-start: bool, - first-seen: s64, - last-seen: s64, - } - - record edgee-request { - method: http-method, - url: string, - headers: dict, - forward-client-headers: bool, - body: string, - } - - enum http-method { GET, PUT, POST, DELETE } - - page: func(e: event, settings: dict) -> result; - track: func(e: event, settings: dict) -> result; - user: func(e: event, settings:dict) -> result; -} \ No newline at end of file diff --git a/wit/world.wit b/wit/world.wit deleted file mode 100644 index d9e1f9f..0000000 --- a/wit/world.wit +++ /dev/null @@ -1,5 +0,0 @@ -package edgee:native; - -world data-collection { - export edgee:components/data-collection; -} From 437c63b6646d5376321d05e70d9975d574007a14 Mon Sep 17 00:00:00 2001 From: "Julianne H." Date: Mon, 10 Mar 2025 10:29:04 +0100 Subject: [PATCH 2/3] chore(edgee-manifest): add `language` field --- edgee-component.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/edgee-component.toml b/edgee-component.toml index a37740a..3410f52 100644 --- a/edgee-component.toml +++ b/edgee-component.toml @@ -8,6 +8,7 @@ subcategory = "analytics" description = "Example Javascript component for data collection" documentation = "https://github.com/edgee-cloud/example-js-component" repository = "https://github.com/edgee-cloud/example-js-component" +language = "JavaScript" wit-world-version = "0.5.0" [component.build] From 72c27f84adb44d655c7f0c871aca6096aeeffba6 Mon Sep 17 00:00:00 2001 From: "Julianne H." Date: Mon, 10 Mar 2025 15:34:22 +0100 Subject: [PATCH 3/3] refactor(manifest): rename wit-world-version field to wit-version --- edgee-component.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/edgee-component.toml b/edgee-component.toml index 3410f52..f6c031a 100644 --- a/edgee-component.toml +++ b/edgee-component.toml @@ -9,7 +9,7 @@ description = "Example Javascript component for data collection" documentation = "https://github.com/edgee-cloud/example-js-component" repository = "https://github.com/edgee-cloud/example-js-component" language = "JavaScript" -wit-world-version = "0.5.0" +wit-version = "0.5.0" [component.build] command = "npm install && npm run generate && npm run build"