@agoric/internal
Advanced tools
Comparing version 0.3.3-dev-0a07188.0 to 0.3.3-dev-0a9d7f0.0
{ | ||
"name": "@agoric/internal", | ||
"version": "0.3.3-dev-0a07188.0+0a07188", | ||
"version": "0.3.3-dev-0a9d7f0.0+0a9d7f0", | ||
"description": "Externally unsupported utilities internal to agoric-sdk", | ||
@@ -23,12 +23,12 @@ "type": "module", | ||
"dependencies": { | ||
"@agoric/base-zone": "0.1.1-dev-0a07188.0+0a07188", | ||
"@endo/common": "^1.2.8", | ||
"@endo/errors": "^1.2.8", | ||
"@endo/far": "^1.1.9", | ||
"@endo/init": "^1.1.7", | ||
"@endo/marshal": "^1.6.2", | ||
"@endo/pass-style": "^1.4.7", | ||
"@endo/patterns": "^1.4.7", | ||
"@endo/promise-kit": "^1.1.8", | ||
"@endo/stream": "^1.2.8", | ||
"@agoric/base-zone": "0.1.1-dev-0a9d7f0.0+0a9d7f0", | ||
"@endo/common": "^1.2.9", | ||
"@endo/errors": "^1.2.9", | ||
"@endo/far": "^1.1.10", | ||
"@endo/init": "^1.1.8", | ||
"@endo/marshal": "^1.6.3", | ||
"@endo/pass-style": "^1.4.8", | ||
"@endo/patterns": "^1.4.8", | ||
"@endo/promise-kit": "^1.1.9", | ||
"@endo/stream": "^1.2.9", | ||
"anylogger": "^0.21.0", | ||
@@ -38,5 +38,6 @@ "jessie.js": "^0.3.4" | ||
"devDependencies": { | ||
"@agoric/cosmic-proto": "0.4.1-dev-0a07188.0+0a07188", | ||
"@endo/exo": "^1.5.7", | ||
"@endo/init": "^1.1.7", | ||
"@agoric/cosmic-proto": "0.4.1-dev-0a9d7f0.0+0a9d7f0", | ||
"@endo/exo": "^1.5.8", | ||
"@endo/init": "^1.1.8", | ||
"@fast-check/ava": "^2.0.1", | ||
"ava": "^5.3.0", | ||
@@ -63,5 +64,5 @@ "tsd": "^0.31.1" | ||
"typeCoverage": { | ||
"atLeast": 93.06 | ||
"atLeast": 93.04 | ||
}, | ||
"gitHead": "0a07188a9db63f72e2b960924628e00c4d44e7eb" | ||
"gitHead": "0a9d7f048636bb55b88b0a0dab9efd53b10d5387" | ||
} |
@@ -49,2 +49,4 @@ /** | ||
let WALLET_SPEND_ACTION: "WALLET_SPEND_ACTION"; | ||
let VTRANSFER_IBC_EVENT: "VTRANSFER_IBC_EVENT"; | ||
let KERNEL_UPGRADE_EVENTS: "KERNEL_UPGRADE_EVENTS"; | ||
} | ||
@@ -59,5 +61,4 @@ export const CORE_EVAL: "CORE_EVAL"; | ||
export const WALLET_SPEND_ACTION: "WALLET_SPEND_ACTION"; | ||
export const CALCULATE_FEES_IN_BEANS: "CALCULATE_FEES_IN_BEANS"; | ||
export const VTRANSFER_IBC_EVENT: "VTRANSFER_IBC_EVENT"; | ||
export const KERNEL_UPGRADE_EVENTS: "KERNEL_UPGRADE_EVENTS"; | ||
//# sourceMappingURL=action-types.d.ts.map |
@@ -59,2 +59,4 @@ // @jessie-check | ||
WALLET_SPEND_ACTION: 'WALLET_SPEND_ACTION', | ||
VTRANSFER_IBC_EVENT: 'VTRANSFER_IBC_EVENT', | ||
KERNEL_UPGRADE_EVENTS: 'KERNEL_UPGRADE_EVENTS', | ||
}); | ||
@@ -73,6 +75,4 @@ harden(QueuedActionType); | ||
WALLET_SPEND_ACTION, | ||
VTRANSFER_IBC_EVENT, | ||
KERNEL_UPGRADE_EVENTS, | ||
} = QueuedActionType; | ||
export const CALCULATE_FEES_IN_BEANS = 'CALCULATE_FEES_IN_BEANS'; | ||
export const VTRANSFER_IBC_EVENT = 'VTRANSFER_IBC_EVENT'; | ||
export const KERNEL_UPGRADE_EVENTS = 'KERNEL_UPGRADE_EVENTS'; |
@@ -11,5 +11,2 @@ export * from "./config.js"; | ||
export { pureDataMarshaller } from "./marshal.js"; | ||
export { objectMap } from "@endo/common/object-map.js"; | ||
export { objectMetaMap } from "@endo/common/object-meta-map.js"; | ||
export { fromUniqueEntries } from "@endo/common/from-unique-entries.js"; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -17,5 +17,1 @@ // @jessie-check | ||
export * from './types-index.js'; | ||
export { objectMap } from '@endo/common/object-map.js'; | ||
export { objectMetaMap } from '@endo/common/object-meta-map.js'; | ||
export { fromUniqueEntries } from '@endo/common/from-unique-entries.js'; |
@@ -0,3 +1,29 @@ | ||
/** For overriding TypeScript inferring the type of `true` as boolean. */ | ||
export const TRUE: true; | ||
/** | ||
* @typedef {<O extends Record<string, unknown>>( | ||
* obj: O, | ||
* ) => { [K in keyof O]: K extends string ? [K, O[K]] : never }[keyof O][]} TypedEntries | ||
*/ | ||
export const typedEntries: TypedEntries; | ||
/** | ||
* @typedef {< | ||
* const Entries extends ReadonlyArray<readonly [PropertyKey, unknown]>, | ||
* >( | ||
* entries: Entries, | ||
* ) => { [Entry in Entries[number] as Entry[0]]: Entry[1] }} FromTypedEntries | ||
*/ | ||
export const fromTypedEntries: FromTypedEntries; | ||
/** | ||
* @typedef {<A extends unknown[], V>( | ||
* arr: A, | ||
* mapper: <K extends number>(el: A[K], idx: K, arr: A) => V, | ||
* ) => V[]} TypedMap | ||
*/ | ||
export const typedMap: TypedMap; | ||
export const logLevels: readonly ["debug", "log", "info", "warn", "error"]; | ||
export function deepCopyJsonable<T>(value: T): T; | ||
export function deepMapObject(obj: object, mapper: (value: any, name: string, record: object) => any): object; | ||
export function deepMapObject<O extends Record<string, unknown>, M>(obj: O, mapper: <T extends Record<string, unknown>, K extends string & keyof T>(value: T[K], name: K, record: T) => T[K] | M): O | { [K_1 in keyof O]: K_1 extends string ? O[K_1] | M : never; }; | ||
export function defineName<F extends Function>(name: string, fn: F): F; | ||
export function objectMapMutable<O extends Record<string, unknown>, M>(obj: O, mapper: <K extends keyof O>(value: O[K], key: K) => M): { [K in keyof O]: K extends string ? M : never; }; | ||
export function makeMeasureSeconds(currentTimeMillisec: () => number): <T>(fn: () => Promise<T>) => Promise<{ | ||
@@ -7,2 +33,7 @@ result: T; | ||
}>; | ||
export type TypedEntries = <O extends Record<string, unknown>>(obj: O) => { [K in keyof O]: K extends string ? [K, O[K]] : never; }[keyof O][]; | ||
export type FromTypedEntries = <const Entries extends ReadonlyArray<readonly [PropertyKey, unknown]>>(entries: Entries) => { [Entry in Entries[number] as Entry[0]]: Entry[1]; }; | ||
export type TypedMap = <A extends unknown[], V>(arr: A, mapper: <K extends number>(el: A[K], idx: K, arr: A) => V) => V[]; | ||
export type LogLevel = (typeof logLevels)[keyof readonly ["debug", "log", "info", "warn", "error"] & number]; | ||
export type LimitedConsole = Pick<Console, LogLevel>; | ||
//# sourceMappingURL=js-utils.d.ts.map |
@@ -8,3 +8,49 @@ // @ts-check | ||
const { defineProperty } = Object; | ||
/** For overriding TypeScript inferring the type of `true` as boolean. */ | ||
export const TRUE = /** @type {const} */ (true); | ||
/** | ||
* @typedef {<O extends Record<string, unknown>>( | ||
* obj: O, | ||
* ) => { [K in keyof O]: K extends string ? [K, O[K]] : never }[keyof O][]} TypedEntries | ||
*/ | ||
export const typedEntries = /** @type {TypedEntries} */ (Object.entries); | ||
/** | ||
* @typedef {< | ||
* const Entries extends ReadonlyArray<readonly [PropertyKey, unknown]>, | ||
* >( | ||
* entries: Entries, | ||
* ) => { [Entry in Entries[number] as Entry[0]]: Entry[1] }} FromTypedEntries | ||
*/ | ||
export const fromTypedEntries = /** @type {FromTypedEntries} */ ( | ||
Object.fromEntries | ||
); | ||
/** | ||
* @typedef {<A extends unknown[], V>( | ||
* arr: A, | ||
* mapper: <K extends number>(el: A[K], idx: K, arr: A) => V, | ||
* ) => V[]} TypedMap | ||
*/ | ||
export const typedMap = /** @type {TypedMap} */ ( | ||
Function.prototype.call.bind(Array.prototype.map) | ||
); | ||
export const logLevels = /** @type {const} */ ([ | ||
'debug', | ||
'log', | ||
'info', | ||
'warn', | ||
'error', | ||
]); | ||
Object.freeze(logLevels); | ||
/** @typedef {(typeof logLevels)[keyof logLevels & number]} LogLevel */ | ||
/** @typedef {Pick<Console, LogLevel>} LimitedConsole */ | ||
/** | ||
* Deep-copy a value by round-tripping it through JSON (which drops | ||
@@ -21,7 +67,10 @@ * function/symbol/undefined values and properties that are non-enumerable | ||
/** | ||
* @param {any} value | ||
* @param {string | undefined} name | ||
* @param {object | undefined} container | ||
* @param {(value: any, name: string, record: object) => any} mapper | ||
* @returns {any} | ||
* @template {Record<PropertyKey, unknown>} O | ||
* @template {string & keyof O} K | ||
* @template M | ||
* @param {O[K]} value | ||
* @param {K | undefined} name | ||
* @param {O | undefined} container | ||
* @param {(value: O[K], name: K, record: O) => O[K] | M} mapper | ||
* @returns {O[K] | M | { [K2 in keyof O[K]]: O[K][K2] | M }} | ||
*/ | ||
@@ -41,14 +90,26 @@ const deepMapObjectInternal = (value, name, container, mapper) => { | ||
let wasMapped = false; | ||
const mappedEntries = Object.entries(value).map(([innerName, innerValue]) => { | ||
const valueObj = /** @type {Record<string, unknown>} */ (value); | ||
/** | ||
* @type {<T extends typeof value, K2 extends string & keyof T>( | ||
* entry: [K2, T[K2]], | ||
* ) => [K2, T[K2] | M]} | ||
*/ | ||
const mapEntry = ([innerName, innerValue]) => { | ||
const mappedInnerValue = deepMapObjectInternal( | ||
innerValue, | ||
innerName, | ||
value, | ||
valueObj, | ||
mapper, | ||
); | ||
wasMapped ||= mappedInnerValue !== innerValue; | ||
return [innerName, mappedInnerValue]; | ||
}); | ||
return [innerName, /** @type {any} */ (mappedInnerValue)]; | ||
}; | ||
const mappedEntries = typedEntries(valueObj).map(mapEntry); | ||
return wasMapped ? Object.fromEntries(mappedEntries) : value; | ||
if (!wasMapped) { | ||
return value; | ||
} | ||
const mappedObj = fromTypedEntries(mappedEntries); | ||
return /** @type {any} */ (mappedObj); | ||
}; | ||
@@ -65,10 +126,55 @@ | ||
* | ||
* @param {object} obj | ||
* @param {(value: any, name: string, record: object) => any} mapper | ||
* @returns {object} | ||
* @template {Record<string, unknown>} O | ||
* @template M | ||
* @param {O} obj | ||
* @param {<T extends Record<string, unknown>, K extends string & keyof T>( | ||
* value: T[K], | ||
* name: K, | ||
* record: T, | ||
* ) => T[K] | M} mapper | ||
* @returns {O | { [K in keyof O]: K extends string ? O[K] | M : never }} | ||
*/ | ||
export const deepMapObject = (obj, mapper) => | ||
deepMapObjectInternal(obj, undefined, undefined, mapper); | ||
/** @type {any} */ (deepMapObjectInternal(obj, undefined, undefined, mapper)); | ||
/** | ||
* Explicitly set a function's name, supporting use of arrow functions for which | ||
* source text doesn't include a name and no initial name is set by | ||
* NamedEvaluation | ||
* https://tc39.es/ecma262/multipage/syntax-directed-operations.html#sec-runtime-semantics-namedevaluation | ||
* | ||
* `name` is the first parameter for better readability at call sites (e.g., | ||
* `return defineName('foo', () => { ... })`). | ||
* | ||
* @template {Function} F | ||
* @param {string} name | ||
* @param {F} fn | ||
* @returns {F} | ||
*/ | ||
export const defineName = (name, fn) => | ||
defineProperty(fn, 'name', { value: name }); | ||
/** | ||
* By analogy with how `Array.prototype.map` will map the elements of an array | ||
* to transformed elements of an array of the same shape, `objectMapMutable` | ||
* will do likewise for the enumerable string-keyed properties of an object. | ||
* | ||
* Unlike endo's `objectMap`, this function returns a non-hardened object. | ||
* | ||
* @template {Record<string, unknown>} O | ||
* @template M | ||
* @param {O} obj | ||
* @param {<K extends keyof O>(value: O[K], key: K) => M} mapper | ||
* @returns {{ [K in keyof O]: K extends string ? M : never }} | ||
*/ | ||
export const objectMapMutable = (obj, mapper) => { | ||
const oldEntries = typedEntries(obj); | ||
/** @type {<K extends keyof O>(entry: [K, O[K]]) => [K, M]} */ | ||
const mapEntry = ([k, v]) => [k, mapper(v, k)]; | ||
const newEntries = typedMap(oldEntries, mapEntry); | ||
const newObj = fromTypedEntries(newEntries); | ||
return /** @type {any} */ (newObj); | ||
}; | ||
/** | ||
* Returns a function that uses a millisecond-based current-time capability | ||
@@ -75,0 +181,0 @@ * (such as `performance.now`) to measure execution duration of an async |
@@ -31,2 +31,3 @@ /** @type {(namespace: string) => string} */ | ||
export type PrioritySendersManager = ReturnType<typeof makePrioritySendersManager>; | ||
import type { ERef } from '@endo/far'; | ||
//# sourceMappingURL=priority-senders.d.ts.map |
import { Fail, q } from '@endo/errors'; | ||
import { E, Far } from '@endo/far'; | ||
/** @import {ERef} from '@endo/far'; */ | ||
/** @import {StorageNode} from './lib-chainStorage.js'; */ | ||
const PRIORITY_SENDERS_NAMESPACE_RE = /^[a-zA-Z0-9_-]{1,50}$/; | ||
@@ -5,0 +8,0 @@ |
@@ -1,2 +0,2 @@ | ||
export function makeWithQueue(): <T extends (...args: any[]) => any>(inner: T) => (...args: Parameters<T>) => Promise<Awaited<ReturnType<T>>>; | ||
export function makeWithQueue(): (inner: T) => (...args: Parameters<T>) => Promise<Awaited<ReturnType<T>>>; | ||
//# sourceMappingURL=queue.d.ts.map |
@@ -1,2 +0,2 @@ | ||
/** @import {ERef} from '@endo/far' */ | ||
export function makeLimitedConsole(makeLogger: (level: string) => (...args: unknown[]) => void): LimitedConsole; | ||
/** | ||
@@ -37,2 +37,3 @@ * @template T | ||
export function assertAllDefined<T extends Record<string, unknown>>(obj: T): asserts obj is AllDefined<T>; | ||
export function attenuate<T, P extends Permit<T>>(specimen: T, permit: P, transform?: <U, SubP extends Permit<U>>(attenuation: U, permit: SubP) => U): Attenuated<T, P>; | ||
export const forever: AsyncIterable<undefined>; | ||
@@ -60,3 +61,10 @@ export function whileTrue<T>(produce: () => T): AsyncIterable<Awaited<T>>; | ||
export type AllDefined<T extends Record<string, unknown>> = { [P in keyof T]: Exclude<T[P], undefined>; }; | ||
import { objectMap } from '@endo/common/object-map.js'; | ||
import { objectMetaMap } from '@endo/common/object-meta-map.js'; | ||
import { fromUniqueEntries } from '@endo/common/from-unique-entries.js'; | ||
import type { LimitedConsole } from './js-utils.js'; | ||
import type { Permit } from './types.js'; | ||
import type { Attenuated } from './types.js'; | ||
import type { ERef } from '@endo/far'; | ||
export { objectMap, objectMetaMap, fromUniqueEntries }; | ||
//# sourceMappingURL=ses-utils.d.ts.map |
@@ -8,2 +8,5 @@ // @ts-check | ||
import { objectMap } from '@endo/common/object-map.js'; | ||
import { objectMetaMap } from '@endo/common/object-meta-map.js'; | ||
import { fromUniqueEntries } from '@endo/common/from-unique-entries.js'; | ||
import { q, Fail, makeError, annotateError, X } from '@endo/errors'; | ||
@@ -13,7 +16,25 @@ import { deeplyFulfilled, isObject } from '@endo/marshal'; | ||
import { makeQueue } from '@endo/stream'; | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore TS7016 The 'jessie.js' library may need to update its package.json or typings | ||
import { asyncGenerate } from 'jessie.js'; | ||
import { logLevels } from './js-utils.js'; | ||
/** @import {LimitedConsole} from './js-utils.js'; */ | ||
/** @import {ERef} from '@endo/far'; */ | ||
/** @import {Primitive} from '@endo/pass-style'; */ | ||
/** @import {Permit, Attenuated} from './types.js'; */ | ||
export { objectMap, objectMetaMap, fromUniqueEntries }; | ||
const { fromEntries, keys, values } = Object; | ||
/** @import {ERef} from '@endo/far' */ | ||
/** @param {(level: string) => (...args: unknown[]) => void} makeLogger */ | ||
export const makeLimitedConsole = makeLogger => { | ||
const limitedConsole = /** @type {any} */ ( | ||
fromEntries(logLevels.map(level => [level, makeLogger(level)])) | ||
); | ||
return /** @type {LimitedConsole} */ (harden(limitedConsole)); | ||
}; | ||
harden(makeLimitedConsole); | ||
@@ -168,2 +189,57 @@ /** | ||
/** | ||
* Attenuate `specimen` to only properties allowed by `permit`. | ||
* | ||
* @template T | ||
* @template {Permit<T>} P | ||
* @param {T} specimen | ||
* @param {P} permit | ||
* @param {<U, SubP extends Permit<U>>(attenuation: U, permit: SubP) => U} [transform] | ||
* used to replace the results of recursive picks (but not blanket permits) | ||
* @returns {Attenuated<T, P>} | ||
*/ | ||
export const attenuate = (specimen, permit, transform = x => x) => { | ||
// Fast-path for no attenuation. | ||
if (permit === true || typeof permit === 'string') { | ||
return /** @type {Attenuated<T, P>} */ (specimen); | ||
} | ||
/** @type {string[]} */ | ||
const path = []; | ||
/** | ||
* @template SubT | ||
* @template {Exclude<Permit<SubT>, Primitive>} SubP | ||
* @type {(specimen: SubT, permit: SubP) => Attenuated<SubT, SubP>} | ||
*/ | ||
const extract = (subSpecimen, subPermit) => { | ||
if (subPermit === null || typeof subPermit !== 'object') { | ||
throw path.length === 0 | ||
? Fail`invalid permit: ${q(permit)}` | ||
: Fail`invalid permit at path ${q(path)}: ${q(subPermit)}`; | ||
} else if (subSpecimen === null || typeof subSpecimen !== 'object') { | ||
throw path.length === 0 | ||
? Fail`specimen must be an object for permit ${q(permit)}` | ||
: Fail`specimen at path ${q(path)} must be an object for permit ${q(subPermit)}`; | ||
} | ||
const picks = Object.entries(subPermit).map(([subKey, deepPermit]) => { | ||
if (!Object.hasOwn(subSpecimen, subKey)) { | ||
throw Fail`specimen is missing path ${q(path.concat(subKey))}`; | ||
} | ||
const deepSpecimen = Reflect.get(subSpecimen, subKey); | ||
if (deepPermit === true || typeof deepPermit === 'string') { | ||
return [subKey, deepSpecimen]; | ||
} | ||
path.push(subKey); | ||
const extracted = extract(/** @type {any} */ (deepSpecimen), deepPermit); | ||
const entry = [subKey, extracted]; | ||
path.pop(); | ||
return entry; | ||
}); | ||
return transform(Object.fromEntries(picks), subPermit); | ||
}; | ||
// @ts-expect-error cast | ||
return extract(specimen, permit); | ||
}; | ||
/** @type {IteratorResult<undefined, never>} */ | ||
@@ -170,0 +246,0 @@ const notDone = harden({ done: false, value: undefined }); |
@@ -27,11 +27,12 @@ export function slotToRemotable(_slotId: string, iface?: string): import("@endo/pass-style").RemotableObject<string> & import("@endo/eventual-send").RemotableBrand<{}, {}>; | ||
data: Map<string, string>; | ||
updateNewCellBlockHeight: (blockHeight?: number) => void; | ||
getValues: (path: string) => string[]; | ||
messages: StorageMessage[]; | ||
toStorage: ((message: StorageMessage) => string | number | any[] | { | ||
toStorage: ((message: StorageMessage) => string | number | true | any[] | { | ||
storeName: string; | ||
storeSubkey: string; | ||
} | null | undefined) & import("@endo/pass-style").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, (message: StorageMessage) => string | number | any[] | { | ||
} | null) & import("@endo/pass-style").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, (message: StorageMessage) => string | number | true | any[] | { | ||
storeName: string; | ||
storeSubkey: string; | ||
} | null | undefined>; | ||
} | null>; | ||
}; | ||
@@ -38,0 +39,0 @@ export function makeMockChainStorageRoot(): MockChainStorageRoot; |
@@ -14,3 +14,3 @@ // @ts-check | ||
* @import {TotalMap} from './types.js'; | ||
* @import {Marshaller, StorageEntry, StorageMessage, StorageNode} from './lib-chainStorage.js'; | ||
* @import {Marshaller, StorageEntry, StorageMessage, StorageNode, StreamCell} from './lib-chainStorage.js'; | ||
*/ | ||
@@ -104,2 +104,10 @@ | ||
const data = new Map(); | ||
let currentBlockHeight = 0; | ||
const updateNewCellBlockHeight = (blockHeight = currentBlockHeight + 1) => { | ||
blockHeight > currentBlockHeight || | ||
Fail`blockHeight ${blockHeight} must be greater than ${currentBlockHeight}`; | ||
currentBlockHeight = blockHeight; | ||
}; | ||
/** @param {string} prefix */ | ||
@@ -163,3 +171,3 @@ const getChildEntries = prefix => { | ||
} | ||
break; | ||
return true; | ||
} | ||
@@ -172,4 +180,6 @@ case 'append': { | ||
value != null || Fail`attempt to append with no value`; | ||
// In the absence of block boundaries, everything goes in a single StreamCell. | ||
const oldVal = data.get(key); | ||
/** @type {string | undefined} */ | ||
let oldVal = data.get(key); | ||
/** @type {StreamCell | undefined} */ | ||
let streamCell; | ||
@@ -183,6 +193,15 @@ if (oldVal != null) { | ||
} | ||
// StreamCells reset at block boundaries. | ||
if ( | ||
streamCell && | ||
Number(streamCell.blockHeight) !== currentBlockHeight | ||
) { | ||
streamCell = undefined; | ||
oldVal = undefined; | ||
} | ||
} | ||
if (streamCell === undefined) { | ||
streamCell = { | ||
blockHeight: '0', | ||
blockHeight: String(currentBlockHeight), | ||
values: oldVal != null ? [oldVal] : [], | ||
@@ -194,3 +213,3 @@ }; | ||
} | ||
break; | ||
return true; | ||
} | ||
@@ -228,2 +247,3 @@ case 'size': | ||
data: /** @type {Map<string, string>} */ (data), | ||
updateNewCellBlockHeight, | ||
getValues, | ||
@@ -230,0 +250,0 @@ messages, |
@@ -1,3 +0,6 @@ | ||
/** @file adapted from https://raw.githubusercontent.com/sindresorhus/type-fest/main/source/opaque.d.ts */ | ||
/** @file adapted from https://raw.githubusercontent.com/sindresorhus/type-fest/main/source/tagged.d.ts */ | ||
// different name to avoid confusion with pass-style "tagged" | ||
export { Tagged as TypeTag }; | ||
declare const tag: unique symbol; | ||
@@ -4,0 +7,0 @@ |
@@ -31,3 +31,3 @@ // @ts-check | ||
* @param {MapStore} store | ||
* @returns {object} tree of the contents of the store | ||
* @returns {object} tree of the contents of the store | ||
*/ | ||
@@ -34,0 +34,0 @@ export const inspectMapStore = store => { |
export const StorageNodeShape: import("@endo/patterns").Matcher; | ||
/** To be used only for 'helper' facets where the calls are from trusted code. */ | ||
export const UnguardedHelperI: import("@endo/patterns").InterfaceGuard<any>; | ||
/** | ||
* @typedef {number | `${bigint}`} BridgeBigInt Ensure that callees passed a | ||
* bridge message that was serialised from a Golang int64 or uint64 accept | ||
* either a JS number or a stringified JS bigint. | ||
*/ | ||
/** | ||
* @type {import('./types.js').TypedPattern<BridgeBigInt>} | ||
*/ | ||
export const BridgeBigIntShape: import("./types.js").TypedPattern<BridgeBigInt>; | ||
/** | ||
* Ensure that callees passed a | ||
* bridge message that was serialised from a Golang int64 or uint64 accept | ||
* either a JS number or a stringified JS bigint. | ||
*/ | ||
export type BridgeBigInt = number | `${bigint}`; | ||
//# sourceMappingURL=typeGuards.d.ts.map |
// @jessie-check | ||
// @ts-check | ||
@@ -14,1 +15,12 @@ import { M } from '@endo/patterns'; | ||
); | ||
/** | ||
* @typedef {number | `${bigint}`} BridgeBigInt Ensure that callees passed a | ||
* bridge message that was serialised from a Golang int64 or uint64 accept | ||
* either a JS number or a stringified JS bigint. | ||
*/ | ||
/** | ||
* @type {import('./types.js').TypedPattern<BridgeBigInt>} | ||
*/ | ||
export const BridgeBigIntShape = M.or(M.number(), M.string()); |
@@ -14,2 +14,14 @@ import type { ERef, RemotableBrand } from '@endo/eventual-send'; | ||
export type TotalMapFrom<M extends Map<any, any>> = M extends Map<infer K, infer V> ? TotalMap<K, V> : never; | ||
/** | ||
* A permit is either `true` or a string (both meaning no attenuation, with a | ||
* string serving as a grouping label for convenience and/or diagram | ||
* generation), or an object whose keys identify child properties and whose | ||
* corresponding values are theirselves (recursive) Permits. | ||
*/ | ||
export type Permit<T> = true | string | Partial<{ | ||
[K in keyof T]: K extends string ? Permit<T[K]> : never; | ||
}>; | ||
export type Attenuated<T, P extends Permit<T>> = P extends object ? { | ||
[K in keyof P]: K extends keyof T ? P[K] extends Permit<T[K]> ? Attenuated<T[K], P[K]> : never : never; | ||
} : T; | ||
export declare class Callback<I extends (...args: any[]) => any> { | ||
@@ -16,0 +28,0 @@ private iface; |
@@ -18,2 +18,23 @@ /* eslint-disable max-classes-per-file */ | ||
/** | ||
* A permit is either `true` or a string (both meaning no attenuation, with a | ||
* string serving as a grouping label for convenience and/or diagram | ||
* generation), or an object whose keys identify child properties and whose | ||
* corresponding values are theirselves (recursive) Permits. | ||
*/ | ||
export type Permit<T> = | ||
| true | ||
| string | ||
| Partial<{ [K in keyof T]: K extends string ? Permit<T[K]> : never }>; | ||
export type Attenuated<T, P extends Permit<T>> = P extends object | ||
? { | ||
[K in keyof P]: K extends keyof T | ||
? P[K] extends Permit<T[K]> | ||
? Attenuated<T[K], P[K]> | ||
: never | ||
: never; | ||
} | ||
: T; | ||
export declare class Callback<I extends (...args: any[]) => any> { | ||
@@ -20,0 +41,0 @@ private iface: I; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
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
192210
121
4359
6
7
4
Updated@endo/common@^1.2.9
Updated@endo/errors@^1.2.9
Updated@endo/far@^1.1.10
Updated@endo/init@^1.1.8
Updated@endo/marshal@^1.6.3
Updated@endo/pass-style@^1.4.8
Updated@endo/patterns@^1.4.8
Updated@endo/promise-kit@^1.1.9
Updated@endo/stream@^1.2.9