Skip to content

Commit

Permalink
feat(vat-data): export overlooked provideDurableWeakSetStore
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelfig committed Mar 17, 2023
1 parent 68094ec commit 9e026eb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/vat-data/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export {
provideDurableMapStore,
provideDurableWeakMapStore,
provideDurableSetStore,
provideDurableWeakSetStore,
// deprecated
defineKind,
defineKindMulti,
Expand Down
15 changes: 15 additions & 0 deletions packages/vat-data/src/vat-data-bindings.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ export const makeStoreUtils = VatData => {
makeScalarBigWeakMapStore,
// eslint-disable-next-line no-shadow -- these literally do shadow the globals
makeScalarBigSetStore,
// eslint-disable-next-line no-shadow -- these literally do shadow the globals
makeScalarBigWeakSetStore,
} = VatData;

/**
Expand Down Expand Up @@ -187,10 +189,22 @@ export const makeStoreUtils = VatData => {
);
harden(provideDurableSetStore);

/**
* @param {import('./types').Baggage} baggage
* @param {string} name
* @param {Omit<StoreOptions, 'durable'>} options
*/
const provideDurableWeakSetStore = (baggage, name, options = {}) =>
provide(baggage, name, () =>
makeScalarBigWeakSetStore(name, { durable: true, ...options }),
);
harden(provideDurableWeakSetStore);

return harden({
provideDurableMapStore,
provideDurableWeakMapStore,
provideDurableSetStore,
provideDurableWeakSetStore,
});
};

Expand All @@ -199,4 +213,5 @@ export const {
provideDurableMapStore,
provideDurableWeakMapStore,
provideDurableSetStore,
provideDurableWeakSetStore,
} = globalStoreUtils;

0 comments on commit 9e026eb

Please sign in to comment.