@agoric/vat-data
Advanced tools
Comparing version 0.5.3-dev-046eb05.0 to 0.5.3-dev-048a67c.0
{ | ||
"name": "@agoric/vat-data", | ||
"version": "0.5.3-dev-046eb05.0+046eb05", | ||
"version": "0.5.3-dev-048a67c.0+048a67c", | ||
"description": "Safe access to VatData global", | ||
@@ -11,3 +11,2 @@ "type": "module", | ||
"test": "ava", | ||
"test:c8": "exit 0", | ||
"test:xs": "exit 0", | ||
@@ -23,11 +22,24 @@ "lint-fix": "yarn lint:eslint --fix", | ||
"dependencies": { | ||
"@agoric/assert": "0.6.1-dev-046eb05.0+046eb05", | ||
"@agoric/internal": "0.3.3-dev-046eb05.0+046eb05", | ||
"@agoric/store": "0.9.3-dev-046eb05.0+046eb05" | ||
"@agoric/base-zone": "0.1.1-dev-048a67c.0+048a67c", | ||
"@agoric/store": "0.9.3-dev-048a67c.0+048a67c", | ||
"@agoric/swingset-liveslots": "0.10.3-dev-048a67c.0+048a67c", | ||
"@endo/errors": "^1.2.9", | ||
"@endo/exo": "^1.5.8", | ||
"@endo/patterns": "^1.4.8" | ||
}, | ||
"devDependencies": { | ||
"@agoric/swingset-vat": "0.32.3-dev-046eb05.0+046eb05", | ||
"@endo/far": "^1.1.10", | ||
"@endo/init": "^1.1.8", | ||
"@endo/ses-ava": "^1.2.9", | ||
"ava": "^5.3.0", | ||
"tsd": "^0.28.1" | ||
"tsd": "^0.31.1" | ||
}, | ||
"ava": { | ||
"require": [ | ||
"@endo/init/debug.js" | ||
], | ||
"files": [ | ||
"test/**/*.test.*" | ||
] | ||
}, | ||
"publishConfig": { | ||
@@ -37,5 +49,8 @@ "access": "public" | ||
"engines": { | ||
"node": ">=14.15.0" | ||
"node": "^18.12 || ^20.9" | ||
}, | ||
"gitHead": "046eb05f824bddad6e1980c2bfab7b3f57f1e60f" | ||
"typeCoverage": { | ||
"atLeast": 99.33 | ||
}, | ||
"gitHead": "048a67cc119529a818e59946d071fb0da74a4dbf" | ||
} |
@@ -7,15 +7,24 @@ // @jessie-check | ||
/** @template L,R @typedef {import('@endo/eventual-send').RemotableBrand<L, R>} RemotableBrand */ | ||
/** @template T @typedef {import('@endo/far').ERef<T>} ERef */ | ||
/** @typedef {import('./types.js').Baggage} Baggage */ | ||
/** @template T @typedef {import('./types.js').DefineKindOptions<T>} DefineKindOptions */ | ||
/** @template T @typedef {import('./types.js').KindFacet<T>} KindFacet */ | ||
/** @template T @typedef {import('./types.js').KindFacets<T>} KindFacets */ | ||
/** @typedef {import('./types.js').DurableKindHandle} DurableKindHandle */ | ||
/** | ||
* @import {InterfaceGuard} from '@endo/patterns'; | ||
* @import {RemotableObject} from '@endo/pass-style'; | ||
* @import {Baggage, DefineKindOptions, DurableKindHandle, InterfaceGuardKit} from '@agoric/swingset-liveslots'; | ||
*/ | ||
// Some feedback if the init function is async | ||
/** | ||
* Make a version of the argument function that takes a kind context but | ||
* ignores it. | ||
* @typedef {(...args: any[]) => any} InitState | ||
*/ | ||
/** | ||
* @template {InitState} I | ||
* @typedef {ReturnType<I> extends Promise<any> ? never : ReturnType<I>} StateResult | ||
*/ | ||
/** | ||
* Make a version of the argument function that takes a kind context but ignores | ||
* it. | ||
* | ||
* @type {<T extends Function>(fn: T) => import('./types.js').PlusContext<never, T>} | ||
* @type {<T extends (...args: any) => any>( | ||
* fn: T, | ||
* ) => import('@agoric/swingset-liveslots').PlusContext<never, T>} | ||
*/ | ||
@@ -29,2 +38,3 @@ export const ignoreContext = | ||
// TODO: Find a good home for this function used by @agoric/vat-data and testing code | ||
/** @param {import('@agoric/swingset-liveslots').VatData} VatData */ | ||
export const makeExoUtils = VatData => { | ||
@@ -40,2 +50,3 @@ const { | ||
/** | ||
* @deprecated Use Exos/ExoClasses instead of Kinds | ||
* @param {Baggage} baggage | ||
@@ -51,3 +62,3 @@ * @param {string} kindName | ||
* @deprecated Use prepareExoClass instead | ||
* @type {import('./types.js').PrepareKind} | ||
* @type {import('@agoric/swingset-liveslots').PrepareKind} | ||
*/ | ||
@@ -71,3 +82,3 @@ const prepareKind = ( | ||
* @deprecated Use prepareExoClassKit instead | ||
* @type {import('./types.js').PrepareKindMulti} | ||
* @type {import('@agoric/swingset-liveslots').PrepareKindMulti} | ||
*/ | ||
@@ -89,14 +100,21 @@ const prepareKindMulti = ( | ||
// TODO interfaceGuard type https://github.com/Agoric/agoric-sdk/issues/6206 | ||
/** | ||
* @template {(...args: any) => any} I init state function | ||
* @template {InitState} I init state function | ||
* @template T behavior | ||
* @param {string} tag | ||
* @param {any} interfaceGuard | ||
* @param {InterfaceGuard | undefined} interfaceGuard | ||
* @param {I} init | ||
* @param {T & ThisType<{ self: T, state: ReturnType<I> }>} methods | ||
* @param {DefineKindOptions<{ self: T, state: ReturnType<I> }>} [options] | ||
* @returns {(...args: Parameters<I>) => (T & RemotableBrand<{}, T>)} | ||
* @param {T & | ||
* ThisType<{ | ||
* self: T; | ||
* state: StateResult<I>; | ||
* }>} methods | ||
* @param {DefineKindOptions<{ | ||
* self: T; | ||
* state: StateResult<I>; | ||
* }>} [options] | ||
* @returns {(...args: Parameters<I>) => import('@endo/exo').Guarded<T>} | ||
*/ | ||
const defineVirtualExoClass = (tag, interfaceGuard, init, methods, options) => | ||
// @ts-expect-error cast | ||
defineKind(tag, init, methods, { | ||
@@ -109,12 +127,18 @@ ...options, | ||
// TODO interfaceGuard type https://github.com/Agoric/agoric-sdk/issues/6206 | ||
/** | ||
* @template {(...args: any) => any} I init state function | ||
* @template {Record<string, Record<string | symbol, CallableFunction>>} T facets | ||
* @template {InitState} I init state function | ||
* @template {Record<string, Record<PropertyKey, CallableFunction>>} T facets | ||
* @param {string} tag | ||
* @param {any} interfaceGuardKit | ||
* @param {InterfaceGuardKit | undefined} interfaceGuardKit | ||
* @param {I} init | ||
* @param {T & ThisType<{ facets: T, state: ReturnType<I> }> } facets | ||
* @param {DefineKindOptions<{ facets: T, state: ReturnType<I> }>} [options] | ||
* @returns {(...args: Parameters<I>) => (T & RemotableBrand<{}, T>)} | ||
* @param {T & | ||
* ThisType<{ | ||
* facets: import('@endo/exo').GuardedKit<T>; | ||
* state: StateResult<I>; | ||
* }>} facets | ||
* @param {DefineKindOptions<{ | ||
* facets: T; | ||
* state: StateResult<I>; | ||
* }>} [options] | ||
* @returns {(...args: Parameters<I>) => import('@endo/exo').GuardedKit<T>} | ||
*/ | ||
@@ -128,19 +152,26 @@ const defineVirtualExoClassKit = ( | ||
) => | ||
// @ts-expect-error cast | ||
defineKindMulti(tag, init, facets, { | ||
...options, | ||
thisfulMethods: true, | ||
interfaceGuard: interfaceGuardKit, | ||
interfaceGuardKit, | ||
}); | ||
harden(defineVirtualExoClassKit); | ||
// TODO interfaceGuard type https://github.com/Agoric/agoric-sdk/issues/6206 | ||
/** | ||
* @template {(...args: any) => any} I init state function | ||
* @template {Record<string | symbol, CallableFunction>} T methods | ||
* @template {InitState} I init state function | ||
* @template {Record<PropertyKey, CallableFunction>} T methods | ||
* @param {DurableKindHandle} kindHandle | ||
* @param {any} interfaceGuard | ||
* @param {InterfaceGuard | undefined} interfaceGuard | ||
* @param {I} init | ||
* @param {T & ThisType<{ self: T, state: ReturnType<I> }>} methods | ||
* @param {DefineKindOptions<{ self: T, state: ReturnType<I> }>} [options] | ||
* @returns {(...args: Parameters<I>) => (T & RemotableBrand<{}, T>)} | ||
* @param {T & | ||
* ThisType<{ | ||
* self: T; | ||
* state: StateResult<I>; | ||
* }>} methods | ||
* @param {DefineKindOptions<{ | ||
* self: T; | ||
* state: StateResult<I>; | ||
* }>} [options] | ||
* @returns {(...args: Parameters<I>) => import('@endo/exo').Guarded<T>} | ||
*/ | ||
@@ -154,2 +185,3 @@ const defineDurableExoClass = ( | ||
) => | ||
// @ts-expect-error cast | ||
defineDurableKind(kindHandle, init, methods, { | ||
@@ -162,12 +194,18 @@ ...options, | ||
// TODO interfaceGuard type https://github.com/Agoric/agoric-sdk/issues/6206 | ||
/** | ||
* @template {(...args: any) => any} I init state function | ||
* @template {Record<string, Record<string | symbol, CallableFunction>>} T facets | ||
* @template {InitState} I init state function | ||
* @template {Record<string, Record<PropertyKey, CallableFunction>>} T facets | ||
* @param {DurableKindHandle} kindHandle | ||
* @param {any} interfaceGuardKit | ||
* @param {InterfaceGuardKit | undefined} interfaceGuardKit | ||
* @param {I} init | ||
* @param {T & ThisType<{ facets: T, state: ReturnType<I>}> } facets | ||
* @param {DefineKindOptions<{ facets: T, state: ReturnType<I>}>} [options] | ||
* @returns {(...args: Parameters<I>) => (T & RemotableBrand<{}, T>)} | ||
* @param {T & | ||
* ThisType<{ | ||
* facets: import('@endo/exo').GuardedKit<T>; | ||
* state: StateResult<I>; | ||
* }>} facets | ||
* @param {DefineKindOptions<{ | ||
* facets: T; | ||
* state: StateResult<I>; | ||
* }>} [options] | ||
* @returns {(...args: Parameters<I>) => import('@endo/exo').GuardedKit<T>} | ||
*/ | ||
@@ -181,20 +219,27 @@ const defineDurableExoClassKit = ( | ||
) => | ||
// @ts-expect-error cast | ||
defineDurableKindMulti(kindHandle, init, facets, { | ||
...options, | ||
thisfulMethods: true, | ||
interfaceGuard: interfaceGuardKit, | ||
interfaceGuardKit, | ||
}); | ||
harden(defineDurableExoClassKit); | ||
// TODO interfaceGuard type https://github.com/Agoric/agoric-sdk/issues/6206 | ||
/** | ||
* @template {(...args: any) => any} I init state function | ||
* @template {Record<string | symbol, CallableFunction>} T methods | ||
* @template {InitState} I init state function | ||
* @template {Record<PropertyKey, CallableFunction>} T methods | ||
* @param {Baggage} baggage | ||
* @param {string} kindName | ||
* @param {any} interfaceGuard | ||
* @param {InterfaceGuard | undefined} interfaceGuard | ||
* @param {I} init | ||
* @param {T & ThisType<{ self: T, state: ReturnType<I> }>} methods | ||
* @param {DefineKindOptions<{ self: T, state: ReturnType<I> }>} [options] | ||
* @returns {(...args: Parameters<I>) => (T & RemotableBrand<{}, T>)} | ||
* @param {T & | ||
* ThisType<{ | ||
* self: RemotableObject & T; | ||
* state: StateResult<I>; | ||
* }>} methods | ||
* @param {DefineKindOptions<{ | ||
* self: T; | ||
* state: StateResult<I>; | ||
* }>} [options] | ||
* @returns {(...args: Parameters<I>) => import('@endo/exo').Guarded<T>} | ||
*/ | ||
@@ -218,13 +263,19 @@ const prepareExoClass = ( | ||
// TODO interfaceGuard type https://github.com/Agoric/agoric-sdk/issues/6206 | ||
/** | ||
* @template {(...args: any) => any} I init state function | ||
* @template {Record<string, Record<string | symbol, CallableFunction>>} T facets | ||
* @template {InitState} I init state function | ||
* @template {Record<string, Record<PropertyKey, CallableFunction>>} T facets | ||
* @param {Baggage} baggage | ||
* @param {string} kindName | ||
* @param {any} interfaceGuardKit | ||
* @param {InterfaceGuardKit | undefined} interfaceGuardKit | ||
* @param {I} init | ||
* @param {T & ThisType<{ facets: T, state: ReturnType<I> }> } facets | ||
* @param {DefineKindOptions<{ facets: T, state: ReturnType<I> }>} [options] | ||
* @returns {(...args: Parameters<I>) => (T & RemotableBrand<{}, T>)} | ||
* @param {T & | ||
* ThisType<{ | ||
* facets: import('@endo/exo').GuardedKit<T>; | ||
* state: StateResult<I>; | ||
* }>} facets | ||
* @param {DefineKindOptions<{ | ||
* facets: T; | ||
* state: StateResult<I>; | ||
* }>} [options] | ||
* @returns {(...args: Parameters<I>) => import('@endo/exo').GuardedKit<T>} | ||
*/ | ||
@@ -248,11 +299,13 @@ const prepareExoClassKit = ( | ||
// TODO interfaceGuard type https://github.com/Agoric/agoric-sdk/issues/6206 | ||
/** | ||
* @template {Record<string | symbol, CallableFunction>} M methods | ||
* @template {Record<PropertyKey, CallableFunction>} M methods | ||
* @param {Baggage} baggage | ||
* @param {string} kindName | ||
* @param {any} interfaceGuard | ||
* @param {M} methods | ||
* @param {InterfaceGuard | undefined} interfaceGuard | ||
* @param {M & | ||
* ThisType<{ | ||
* self: RemotableObject & M; | ||
* }>} methods | ||
* @param {DefineKindOptions<{ self: M }>} [options] | ||
* @returns {M & RemotableBrand<{}, M>} | ||
* @returns {import('@endo/exo').Guarded<M>} | ||
*/ | ||
@@ -280,4 +333,4 @@ const prepareExo = ( | ||
/** | ||
* @template {Record<string | symbol, CallableFunction>} M methods | ||
* @deprecated Use prepareExo instead. | ||
* @template {Record<PropertyKey, CallableFunction>} M methods | ||
* @param {Baggage} baggage | ||
@@ -287,3 +340,3 @@ * @param {string} kindName | ||
* @param {DefineKindOptions<{ self: M }>} [options] | ||
* @returns {M & RemotableBrand<{}, M>} | ||
* @returns {import('@endo/exo').Guarded<M>} | ||
*/ | ||
@@ -302,4 +355,4 @@ const prepareSingleton = (baggage, kindName, methods, options = undefined) => | ||
prepareExo, | ||
prepareSingleton, | ||
provideKindHandle, | ||
@@ -306,0 +359,0 @@ prepareKind, |
// @jessie-check | ||
/// <reference types="ses"/> | ||
/// <reference types="ses" /> | ||
export { | ||
@@ -45,5 +45,11 @@ M, | ||
/** @typedef {import('./types.js').Baggage} Baggage */ | ||
/** @typedef {import('./types.js').DurableKindHandle} DurableKindHandle */ | ||
/** @template T @typedef {import('./types.js').DefineKindOptions<T>} DefineKindOptions */ | ||
// TODO re-export these | ||
/** | ||
* @template T @typedef | ||
* {import('@agoric/swingset-liveslots').DefineKindOptions<T>} | ||
* DefineKindOptions | ||
*/ | ||
// Copy this type because aliasing it by `import('@agoric/swingset-liveslots').Baggage` | ||
// causes this error in typedoc: Expected a symbol for node with kind Identifier | ||
/** @typedef {import('@agoric/swingset-liveslots').MapStore<string, any>} Baggage */ | ||
@@ -50,0 +56,0 @@ // //////////////////////////// deprecated ///////////////////////////////////// |
@@ -1,3 +0,9 @@ | ||
/* eslint-disable no-use-before-define, import/no-extraneous-dependencies */ | ||
import { expectType } from 'tsd'; | ||
import type { | ||
KindFacets, | ||
DurableKindHandle, | ||
KindFacet, | ||
FunctionsPlusContext, | ||
} from '@agoric/swingset-liveslots'; | ||
import type { VirtualObjectManager } from '@agoric/swingset-liveslots/src/virtualObjectManager.js'; | ||
import { | ||
@@ -9,10 +15,8 @@ defineKind, | ||
partialAssign, | ||
} from '.'; | ||
import { | ||
KindFacets, | ||
DurableKindHandle, | ||
KindFacet, | ||
FunctionsPlusContext, | ||
} from './types.js'; | ||
watchPromise, | ||
} from './index.js'; | ||
// for use in assignments below | ||
const anyVal = null as any; | ||
/* | ||
@@ -158,5 +162,30 @@ export const makePaymentMaker = (allegedName: string, brand: unknown) => { | ||
}; | ||
const someFacet: KindFacet<typeof someBehavior> = null as any; | ||
const someFacet: KindFacet<typeof someBehavior> = anyVal; | ||
// @ts-expect-error | ||
someFacet.gt(); | ||
expectType<boolean>(someFacet.gt(1)); | ||
const vom: VirtualObjectManager = anyVal; | ||
// @ts-expect-error | ||
vom.missingMethod; | ||
// @ts-expect-error Expected 0-4 arguments but got 5 | ||
vom.defineDurableKind(anyVal, anyVal, anyVal, anyVal, 'extra'); | ||
const p: Promise<bigint> = anyVal; | ||
watchPromise( | ||
p, | ||
{ | ||
onFulfilled(value, extra1, extra2) { | ||
expectType<bigint>(value); | ||
expectType<string>(extra1); | ||
// @ts-expect-error str | ||
expectType<number>(extra2); | ||
}, | ||
onRejected(reason, extra1) { | ||
expectType<unknown>(reason); | ||
expectType<string>(extra1); | ||
}, | ||
}, | ||
'extraString', | ||
'alsoString', | ||
); |
/* global globalThis */ | ||
import { Fail } from '@agoric/assert'; | ||
import { Fail } from '@endo/errors'; | ||
import { provideLazy } from '@agoric/store'; | ||
/** @type {import('./types').VatData} */ | ||
/** @import {Baggage, PickFacet, VatData} from '@agoric/swingset-liveslots' */ | ||
/** @type {VatData} */ | ||
let VatDataGlobal; | ||
if ('VatData' in globalThis) { | ||
globalThis.VatData || Fail`VatData defined in global as null or undefined`; | ||
VatDataGlobal = globalThis.VatData; | ||
// XXX types incompatibility | ||
VatDataGlobal = /** @type {any} */ (globalThis.VatData); | ||
} else { | ||
@@ -15,16 +18,16 @@ // XXX this module has been known to get imported (transitively) in cases that | ||
// fail at runtime. | ||
const unvailable = () => Fail`VatData unavailable`; | ||
const unavailable = () => Fail`VatData unavailable`; | ||
VatDataGlobal = { | ||
defineKind: unvailable, | ||
defineKindMulti: unvailable, | ||
defineDurableKind: unvailable, | ||
defineDurableKindMulti: unvailable, | ||
makeKindHandle: unvailable, | ||
providePromiseWatcher: unvailable, | ||
watchPromise: unvailable, | ||
makeScalarBigMapStore: unvailable, | ||
makeScalarBigWeakMapStore: unvailable, | ||
makeScalarBigSetStore: unvailable, | ||
makeScalarBigWeakSetStore: unvailable, | ||
canBeDurable: unvailable, | ||
defineKind: unavailable, | ||
defineKindMulti: unavailable, | ||
defineDurableKind: unavailable, | ||
defineDurableKindMulti: unavailable, | ||
makeKindHandle: unavailable, | ||
providePromiseWatcher: unavailable, | ||
watchPromise: unavailable, | ||
makeScalarBigMapStore: unavailable, | ||
makeScalarBigWeakMapStore: unavailable, | ||
makeScalarBigSetStore: unavailable, | ||
makeScalarBigWeakSetStore: unavailable, | ||
canBeDurable: unavailable, | ||
}; | ||
@@ -58,3 +61,4 @@ } | ||
/** | ||
* When making a multi-facet kind, it's common to pick one facet to expose. E.g., | ||
* When making a multi-facet kind, it's common to pick one facet to expose. | ||
* E.g., | ||
* | ||
@@ -67,3 +71,3 @@ * const makeFoo = (a, b, c, d) => makeFooBase(a, b, c, d).self; | ||
* | ||
* @type {import('./types').PickFacet} | ||
* @type {PickFacet} | ||
*/ | ||
@@ -89,53 +93,27 @@ export const pickFacet = | ||
// XXX copied from @agoric/store types | ||
// UNTIL https://github.com/Agoric/agoric-sdk/issues/4560 | ||
/** @import {StoreOptions} from '@agoric/store' */ | ||
/** | ||
* @typedef {object} StoreOptions | ||
* Of the dimensions on which KeyedStores can differ, we only represent a few | ||
* of them as standard options. A given store maker should document which | ||
* options it supports, as well as its positions on dimensions for which it | ||
* does not support options. | ||
* @property {boolean} [longLived=true] Which way to optimize a weak store. True means | ||
* that we expect this weak store to outlive most of its keys, in which | ||
* case we internally may use a JavaScript `WeakMap`. Otherwise we internally | ||
* may use a JavaScript `Map`. | ||
* Defaults to true, so please mark short lived stores explicitly. | ||
* @property {boolean} [durable=false] The contents of this store survive termination | ||
* of its containing process, allowing for restart or upgrade but at the cost | ||
* of forbidding storage of references to ephemeral data. Defaults to false. | ||
* @property {boolean} [fakeDurable=false] This store pretends to be a durable store | ||
* but does not enforce that the things stored in it actually be themselves | ||
* durable (whereas an actual durable store would forbid storage of such | ||
* items). This is in service of allowing incremental transition to use of | ||
* durable stores, to enable normal operation and testing when some stuff | ||
* intended to eventually be durable has not yet been made durable. A store | ||
* marked as fakeDurable will appear to operate normally but any attempt to | ||
* upgrade its containing vat will fail with an error. | ||
* @property {import('./types').Pattern} [keyShape] | ||
* @property {import('./types').Pattern} [valueShape] | ||
*/ | ||
/** | ||
* Unlike `provideLazy`, `provide` should be called at most once | ||
* within any vat incarnation with a given `baggage`,`key` pair. | ||
* Unlike `provideLazy`, `provide` should be called at most once within any vat | ||
* incarnation with a given `baggage`,`key` pair. | ||
* | ||
* `provide` should only to be used to populate baggage, | ||
* where the total number of calls to `provide` must be | ||
* low cardinality, since we keep the bookkeeping to detect collisions | ||
* in normal language-heap memory. All the other baggage-oriented | ||
* `provide*` and `prepare*` functions call `provide`, | ||
* and so impose the same constraints. This is consistent with | ||
* our expected durability patterns: What we store in baggage are | ||
* * kindHandles, which are per kind, which must be low cardinality | ||
* * data "variables" for reestablishing the lexical scope, especially | ||
* of singletons | ||
* * named non-baggage collections at the leaves of the baggage tree. | ||
* `provide` should only be used to populate baggage, where the total number of | ||
* calls to `provide` must be low cardinality, since we keep the bookkeeping to | ||
* detect collisions in normal language-heap memory. All the other | ||
* baggage-oriented `provide*` and `prepare*` functions call `provide`, and so | ||
* impose the same constraints. This is consistent with our expected durability | ||
* patterns: What we store in baggage are | ||
* | ||
* What is expected to be high cardinality are the instances of the kinds, | ||
* and the members of the non-bagggage collections. | ||
* - kindHandles, which are per kind, which must be low cardinality | ||
* - data "variables" for reestablishing the lexical scope, especially of | ||
* singletons | ||
* - named non-baggage collections at the leaves of the baggage tree. | ||
* | ||
* TODO https://github.com/Agoric/agoric-sdk/pull/5875 : | ||
* Implement development-time instrumentation to detect when | ||
* `provide` violates the above prescription, and is called more | ||
* than once in the same vat incarnation with the same | ||
* baggage,key pair. | ||
* What is expected to be high cardinality are the instances of the kinds, and | ||
* the members of the non-bagggage collections. | ||
* | ||
* TODO https://github.com/Agoric/agoric-sdk/pull/5875 : Implement | ||
* development-time instrumentation to detect when `provide` violates the above | ||
* prescription, and is called more than once in the same vat incarnation with | ||
* the same baggage,key pair. | ||
*/ | ||
@@ -145,8 +123,12 @@ | ||
// XXX cast because provideLazy is `any` due to broken type import | ||
/** @type {<K, V>(baggage: import('./types.js').Baggage, key: K, makeValue: (key: K) => V) => V} */ ( | ||
provideLazy | ||
); | ||
/** | ||
* @type {<K, V>( | ||
* baggage: Baggage, | ||
* key: K, | ||
* makeValue: (key: K) => V, | ||
* ) => V} | ||
*/ (provideLazy); | ||
// TODO: Find a good home for this function used by @agoric/vat-data and testing code | ||
/** @param {import('@agoric/vat-data/src/types').VatData} VatData */ | ||
/** @param {VatData} VatData */ | ||
export const makeStoreUtils = VatData => { | ||
@@ -165,3 +147,3 @@ const { | ||
/** | ||
* @param {import('./types').Baggage} baggage | ||
* @param {Baggage} baggage | ||
* @param {string} name | ||
@@ -177,3 +159,3 @@ * @param {Omit<StoreOptions, 'durable'>} options | ||
/** | ||
* @param {import('./types').Baggage} baggage | ||
* @param {Baggage} baggage | ||
* @param {string} name | ||
@@ -189,3 +171,3 @@ * @param {Omit<StoreOptions, 'durable'>} options | ||
/** | ||
* @param {import('./types').Baggage} baggage | ||
* @param {Baggage} baggage | ||
* @param {string} name | ||
@@ -201,3 +183,3 @@ * @param {Omit<StoreOptions, 'durable'>} options | ||
/** | ||
* @param {import('./types').Baggage} baggage | ||
* @param {Baggage} baggage | ||
* @param {string} name | ||
@@ -204,0 +186,0 @@ * @param {Omit<StoreOptions, 'durable'>} options |
@@ -1,3 +0,5 @@ | ||
import { test } from '@agoric/swingset-vat/tools/prepare-test-env-ava.js'; | ||
import test from 'ava'; | ||
/* global globalThis */ | ||
// @ts-expect-error VatData not optional | ||
delete globalThis.VatData; | ||
@@ -8,3 +10,5 @@ | ||
const { defineKind } = await import('../src/index.js'); | ||
t.throws(defineKind, { message: /VatData unavailable/ }); | ||
t.throws(() => defineKind('someTag', () => {}, {}), { | ||
message: /VatData unavailable/, | ||
}); | ||
}); |
@@ -1,7 +0,12 @@ | ||
import { test } from '@agoric/swingset-vat/tools/prepare-test-env-ava.js'; | ||
import test from 'ava'; | ||
const mockDefineKind = /** @type {any} */ (harden({})); | ||
/* global globalThis */ | ||
// @ts-expect-error missing fields | ||
globalThis.VatData ||= { defineKind: mockDefineKind }; | ||
test('methods available', async t => { | ||
const { defineKind } = await import('../src/index.js'); | ||
defineKind('test', () => {}, {}); | ||
t.pass(); | ||
t.is(defineKind, mockDefineKind); | ||
}); |
{ | ||
"extends": "../../tsconfig.json", | ||
"compilerOptions": { | ||
"strict": true, | ||
"noImplicitAny": false, // for compat with peer packages using ambient types | ||
// XXX to resolve the swingset-liveslots types | ||
// "strict": true, // disabled for compat with >0 module depth | ||
// "noImplicitAny": false, // for compat with peer packages using ambient types | ||
}, | ||
@@ -7,0 +8,0 @@ "include": [ |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
20
1354
61289
6
5
2
+ Added@agoric/swingset-liveslots@0.10.3-dev-048a67c.0+048a67c
+ Added@endo/errors@^1.2.9
+ Added@endo/exo@^1.5.8
+ Added@endo/patterns@^1.4.8
+ Added@endo/common@1.2.9(transitive)
+ Added@endo/env-options@1.1.8(transitive)
+ Added@endo/errors@1.2.9(transitive)
+ Added@endo/eventual-send@1.3.0(transitive)
+ Added@endo/exo@1.5.8(transitive)
+ Added@endo/far@1.1.10(transitive)
+ Added@endo/marshal@1.6.3(transitive)
+ Added@endo/nat@5.0.14(transitive)
+ Added@endo/pass-style@1.4.8(transitive)
+ Added@endo/patterns@1.4.8(transitive)
+ Added@endo/promise-kit@1.1.9(transitive)
+ Addedses@1.11.0(transitive)