@kontourai/survey 1.18.0 → 1.18.1

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.
@@ -151,10 +151,17 @@ export function selectedCandidateRole(state) {
151
151
  }
152
152
  return workbenchDecisionDefinitions[state.decision].candidateRole;
153
153
  }
154
+ function canonicalizeJsonResource(value) {
155
+ const serialized = JSON.stringify(value);
156
+ if (serialized === undefined) {
157
+ throw new TypeError("Review session resources must be JSON-serializable.");
158
+ }
159
+ return JSON.parse(serialized);
160
+ }
154
161
  export function buildReviewSessionResource(session, events = [], sessionName = defaultReviewSessionName) {
155
162
  const summary = reviewSessionSummary(session);
156
163
  const completedAt = summary.unresolved === 0 ? session.reviewedAt : undefined;
157
- return {
164
+ return canonicalizeJsonResource({
158
165
  apiVersion: reviewResourceApiVersion,
159
166
  kind: "ReviewSession",
160
167
  metadata: {
@@ -173,7 +180,7 @@ export function buildReviewSessionResource(session, events = [], sessionName = d
173
180
  eventCount: events.length,
174
181
  decisionCount: Object.keys(session.decisionsByItemName).length,
175
182
  },
176
- };
183
+ });
177
184
  }
178
185
  export function buildReviewSessionEvents(session, sessionName = defaultReviewSessionName) {
179
186
  const events = [
@@ -372,7 +379,7 @@ export function isClearedWorkbenchDecisionEvent(event) {
372
379
  && event.spec.data.workbenchDecision === null;
373
380
  }
374
381
  export function buildReviewSessionEvent(session, spec) {
375
- return {
382
+ return canonicalizeJsonResource({
376
383
  apiVersion: reviewResourceApiVersion,
377
384
  kind: "ReviewSessionEvent",
378
385
  metadata: {
@@ -384,7 +391,7 @@ export function buildReviewSessionEvent(session, spec) {
384
391
  id: session.actorId,
385
392
  },
386
393
  },
387
- };
394
+ });
388
395
  }
389
396
  function workbenchDecisionFromEvent(event) {
390
397
  const decision = event.spec.data?.workbenchDecision;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kontourai/survey",
3
- "version": "1.18.0",
3
+ "version": "1.18.1",
4
4
  "description": "Producer-side source, extraction, candidate, and review contracts for projecting verified claims into Surface.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",