Skip to content

Commit

Permalink
feat: pureDataMarshaller
Browse files Browse the repository at this point in the history
  • Loading branch information
turadg committed Dec 17, 2024
1 parent fd05a7e commit 6df7f1f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/internal/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export * from './config.js';
export * from './debug.js';
export * from './errors.js';
export * from './js-utils.js';
export { pureDataMarshaller } from './marshal.js';
export * from './method-tools.js';
export * from './ses-utils.js';
export * from './typeCheck.js';
Expand Down
7 changes: 7 additions & 0 deletions packages/internal/src/marshal.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,3 +135,10 @@ export const makeHistoryReviver = (entries, slotToVal = undefined) => {

return harden({ getItem, children, has });
};

/** @param {import('@endo/marshal').CapData<unknown>} cap */
const rejectOCap = cap => Fail`${cap} is not pure data`;
export const pureDataMarshaller = makeMarshal(rejectOCap, rejectOCap, {
serializeBodyFormat: 'smallcaps',
});
harden(pureDataMarshaller);
1 change: 1 addition & 0 deletions packages/internal/test/snapshots/exports.test.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Generated by [AVA](https://avajs.dev).
'mustMatch',
'objectMap',
'objectMetaMap',
'pureDataMarshaller',
'synchronizedTee',
'untilTrue',
'whileTrue',
Expand Down
Binary file modified packages/internal/test/snapshots/exports.test.js.snap
Binary file not shown.

0 comments on commit 6df7f1f

Please sign in to comment.