@pulse-compute/wasm-host-runtime 1.0.0-beta.3 → 1.0.0-beta.4

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.
package/README.md CHANGED
@@ -7,9 +7,9 @@
7
7
  > **Supported entry points:** `None for application authors.`<br>
8
8
  > **Stability:** Internal compiler/runtime interface synchronized with this release set.<br>
9
9
  > **npm:** [`@pulse-compute/wasm-host-runtime`](https://www.npmjs.com/package/@pulse-compute/wasm-host-runtime)<br>
10
- > **Canonical documentation:** [Package guide](https://pulsecompute.io/v1.0.0-beta.3/packages/implementation-packages/)
10
+ > **Canonical documentation:** [Package guide](https://pulsecompute.io/v1.0.0-beta.4/packages/implementation-packages/)
11
11
  >
12
- > This release-status block is generated from the synchronized `Pulse 1.0.0-beta.3` package policy.
12
+ > This release-status block is generated from the synchronized `Pulse 1.0.0-beta.4` package policy.
13
13
  <!-- pulse-package-status:end -->
14
14
 
15
15
  Package-owned PulseWasm host-runtime build-time builders and local runtime helpers.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pulse-compute/wasm-host-runtime",
3
- "version": "1.0.0-beta.3",
3
+ "version": "1.0.0-beta.4",
4
4
  "license": "Apache-2.0",
5
5
  "engines": {
6
6
  "node": "^22.14.0 || ^24.0.0"
@@ -28,11 +28,11 @@
28
28
  "./runtime/canonical-native-host": "./src/runtime/canonical-native-host.js"
29
29
  },
30
30
  "dependencies": {
31
- "@pulse-compute/crypto": "1.0.0-beta.3",
32
- "@pulse-compute/runtime": "1.0.0-beta.3",
33
- "@pulse-compute/wasm-build-support": "1.0.0-beta.3",
34
- "@pulse-compute/wasm-contracts": "1.0.0-beta.3",
35
- "@pulse-compute/wasm-schema-json": "1.0.0-beta.3"
31
+ "@pulse-compute/crypto": "1.0.0-beta.4",
32
+ "@pulse-compute/runtime": "1.0.0-beta.4",
33
+ "@pulse-compute/wasm-build-support": "1.0.0-beta.4",
34
+ "@pulse-compute/wasm-contracts": "1.0.0-beta.4",
35
+ "@pulse-compute/wasm-schema-json": "1.0.0-beta.4"
36
36
  },
37
37
  "publishConfig": {
38
38
  "access": "public"
@@ -48,7 +48,7 @@
48
48
  "url": "git+https://github.com/pulse-compute/pulse.git",
49
49
  "directory": "wasm/packages/host-runtime"
50
50
  },
51
- "homepage": "https://pulsecompute.io/v1.0.0-beta.3/packages/implementation-packages/",
51
+ "homepage": "https://pulsecompute.io/v1.0.0-beta.4/packages/implementation-packages/",
52
52
  "bugs": {
53
53
  "url": "https://github.com/pulse-compute/pulse/issues"
54
54
  }
@@ -634,6 +634,26 @@ function createCanonicalContext(options, trace) {
634
634
  }
635
635
 
636
636
  const ctx = Object.freeze({
637
+ encodeJson(value, schemaId) {
638
+ const key = requireSchemaId(schemaCodecs, schemaId, 'application-value');
639
+ const event = {
640
+ boundary: 'application-value', schemaId: key, responseCaseId: null,
641
+ operationId: `application-value:${key}`, status: null,
642
+ contentType: 'application/json; charset=utf-8', headers: [],
643
+ bodyOwnership: 'application-owned', target: options.target || null,
644
+ provider: options.provider || null, effectId: null, groupId: null
645
+ };
646
+ try {
647
+ const text = schemaCodecs.encodeJsonText(key, value, 'application-value');
648
+ assertSchemaBodySize(schemaCodecs, text, key, 'application-value');
649
+ const normalized = schemaCodecs.decodeJsonText(key, text, 'application-value-trace');
650
+ jsonTrace(trace, { ...event, kind: 'json.encode.value' }, normalized);
651
+ return text;
652
+ } catch (error) {
653
+ jsonTrace(trace, { ...event, kind: 'json.encode.error', ...jsonTraceErrorDetail(error) });
654
+ throw error;
655
+ }
656
+ },
637
657
  req: requestSurface.surface,
638
658
  log: Object.freeze(log),
639
659
  fetch() {
@@ -655,6 +655,7 @@ function instantiateCanonicalNativeModule(compiled, options = {}) {
655
655
  router_match(pathHandle, patternHandle) { return put(routerMatch(value(pathHandle), value(patternHandle))); },
656
656
  router_param(pathHandle, patternHandle, nameHandle) { return put(routerParam(value(pathHandle), value(patternHandle), value(nameHandle))); },
657
657
  response_json(valueHandle, optionsHandle) { requireHttpSurface('ctx.json'); return put(context.ctx.json(value(valueHandle), value(optionsHandle))); },
658
+ schema_encode(valueHandle, schemaHandle) { return put(context.ctx.encodeJson(value(valueHandle), value(schemaHandle))); },
658
659
  response_text(valueHandle, optionsHandle) { requireHttpSurface('ctx.text'); return put(context.ctx.text(value(valueHandle), value(optionsHandle))); },
659
660
  response_custom(valueHandle) { requireHttpSurface('ctx.response'); return put(context.ctx.response(value(valueHandle))); },
660
661
  grip_is_websocket() {