@reventlessdev/reventless-spec 3.0.0-alpha.94 → 3.0.0-alpha.96

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/CHANGELOG.md CHANGED
@@ -3,6 +3,21 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # 3.0.0-alpha.96 (2026-08-02)
7
+
8
+ ### Bug Fixes
9
+
10
+ * **spec:** add Offload.toJson to serialize a payload as untagged wire JSON ([6a4c60f](https://github.com/ReventlessDev/reventless-core/commit/6a4c60f606dd6657082981acf75a90070099bf29))
11
+
12
+
13
+ # 3.0.0-alpha.95 (2026-08-02)
14
+
15
+ **Note:** Version bump only for package @reventlessdev/reventless-spec
16
+
17
+
18
+
19
+
20
+
6
21
  # 3.0.0-alpha.94 (2026-08-02)
7
22
 
8
23
  ### Features
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reventlessdev/reventless-spec",
3
- "version": "3.0.0-alpha.94",
3
+ "version": "3.0.0-alpha.96",
4
4
  "description": "Specifications for Reventless",
5
5
  "license": "Apache-2.0",
6
6
  "bin": {
@@ -21,7 +21,7 @@
21
21
  "sury": "11.0.0-alpha.4",
22
22
  "sury-ppx": "11.0.0-alpha.2",
23
23
  "yaml": "^2.8.3",
24
- "@reventlessdev/rescript-node": "2.0.0-alpha.0"
24
+ "@reventlessdev/rescript-node": "2.0.0-alpha.1"
25
25
  },
26
26
  "devDependencies": {
27
27
  "rescript": "12.3.0",
@@ -146,6 +146,14 @@ let optionSchema = (
146
146
  ~payload=StoredIn({plugin, store}),
147
147
  )
148
148
 
149
+ /** Serialize a payload to its **untagged** wire JSON: `Inline` becomes the bare
150
+ inner value's JSON, `Offloaded` becomes `{"$offload": {...}}`. Used where a
151
+ payload must be stored as a plain JSON blob rather than the ReScript variant —
152
+ e.g. the plugin read model, whose DynamoDB write path marshals the raw value
153
+ and would otherwise persist the variant's runtime `{TAG, _0}` shape. */
154
+ let toJson = (inner: S.t<'a>, payload: payload<'a>): JSON.t =>
155
+ payload->S.reverseConvertToJsonOrThrow(schema(inner))
156
+
149
157
  /** The inline value, if this payload is `Inline`. `None` for `Offloaded` — a
150
158
  caller that must handle both arms uses `resolve` (async, fetches the ref); a
151
159
  caller that only ever sees inline values (a test, or a path where offloading
@@ -81,6 +81,10 @@ function optionSchema(plugin, store, inner) {
81
81
  });
82
82
  }
83
83
 
84
+ function toJson(inner, payload) {
85
+ return S.reverseConvertToJsonOrThrow(payload, schema(inner));
86
+ }
87
+
84
88
  function getInline(payload) {
85
89
  if (payload.TAG === "Inline") {
86
90
  return Primitive_option.some(payload._0);
@@ -148,6 +152,7 @@ export {
148
152
  schema,
149
153
  forStore,
150
154
  optionSchema,
155
+ toJson,
151
156
  getInline,
152
157
  prepare,
153
158
  resolve,