@aresdefencelabs/wasm-http-runtime 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,6 +7,15 @@ addToLibrary({
7
7
  Module.__aresAbiLog(messagePtr);
8
8
  },
9
9
 
10
+ get_value_from_key__deps: ['$UTF8ToString'],
11
+ get_value_from_key: function (keyPtr) {
12
+ if (typeof Module.__aresAbiGetValueFromKey !== 'function') {
13
+ throw new Error('Module.__aresAbiGetValueFromKey is not set');
14
+ }
15
+
16
+ return Module.__aresAbiGetValueFromKey(keyPtr) >>> 0;
17
+ },
18
+
10
19
  abi_http_get_user_agent_name: function () {
11
20
  if (typeof Module.__aresAbiHttpGetUserAgentName !== 'function') {
12
21
  throw new Error('Module.__aresAbiHttpGetUserAgentName is not set');
@@ -389,6 +389,26 @@ export function createWasmHttpRuntime(config) {
389
389
  return instance.exports;
390
390
  },
391
391
 
392
+ __aresAbiGetValueFromKey(keyPtr) {
393
+ const key = readCStringFromModule(mod, keyPtr);
394
+
395
+ const ctx = state.requestContext;
396
+ const env = ctx?.env;
397
+
398
+ if (!env || typeof env !== "object") {
399
+ return 0;
400
+ }
401
+
402
+ const value = env[key];
403
+
404
+ if (value === undefined || value === null) {
405
+ return 0;
406
+ }
407
+
408
+ const written = writeCString(mod, String(value));
409
+ return written.ptr >>> 0;
410
+ },
411
+
392
412
  __aresAbiLog(messagePtr) {
393
413
  const message = readCStringFromModule(mod, messagePtr);
394
414
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aresdefencelabs/wasm-http-runtime",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "Runtime adapter that connects C++ WebAssembly workers to the Cloudflare Workers runtime via an ABI bridge.",
5
5
  "type": "module",
6
6
  "private": false,
@@ -32,7 +32,9 @@
32
32
  ],
33
33
 
34
34
  "scripts": {
35
- "build": "tsc -p tsconfig.json"
35
+ "build": "tsc -p tsconfig.json",
36
+ "dryrun": "npm pack --dry-run",
37
+ "deploy": "npm publish --access public"
36
38
  },
37
39
  "main": "./dist/index.js",
38
40
  "types": "./dist/index.d.ts",