@endo/marshal
Advanced tools
Comparing version 1.5.0 to 1.5.1
@@ -1,2 +0,1 @@ | ||
export { deeplyFulfilled } from "./src/deeplyFulfilled.js"; | ||
export { QCLASS } from "./src/encodeToCapData.js"; | ||
@@ -7,2 +6,3 @@ export { makeMarshal } from "./src/marshal.js"; | ||
export * from "@endo/pass-style"; | ||
export { deeplyFulfilled } from "@endo/pass-style"; | ||
export { stringify, parse } from "./src/marshal-stringify.js"; | ||
@@ -9,0 +9,0 @@ export { makePassableKit, makeEncodePassable, makeDecodePassable, isEncodedRemotable, zeroPad, recordNames, recordValues } from "./src/encodePassable.js"; |
@@ -1,3 +0,1 @@ | ||
export { deeplyFulfilled } from './src/deeplyFulfilled.js'; | ||
export { QCLASS } from './src/encodeToCapData.js'; | ||
@@ -38,1 +36,7 @@ export { makeMarshal } from './src/marshal.js'; | ||
export * from '@endo/pass-style'; | ||
/** | ||
* @deprecated Import deeplyFulfilled directly from @endo/pass-style. | ||
* The re-export here is just for compat with old importers | ||
*/ | ||
export { deeplyFulfilled } from '@endo/pass-style'; |
User-visible changes in `@endo/marshal`: | ||
# v1.5.1 (2024-07-30) | ||
- `deeplyFulfilled` moved from @endo/marshal to @endo/pass-style. @endo/marshal still reexports it, to avoid breaking old importers. But importers should be upgraded to import `deeplyFulfilled` directly from @endo/pass-style. | ||
# v1.3.0 (2024-02-22) | ||
@@ -4,0 +8,0 @@ |
{ | ||
"name": "@endo/marshal", | ||
"version": "1.5.0", | ||
"version": "1.5.1", | ||
"description": "marshal: encoding and deconding of Passable subgraphs", | ||
@@ -16,4 +16,4 @@ "type": "module", | ||
"build": "exit 0", | ||
"build:types": "tsc --build tsconfig.build.json", | ||
"clean:types": "git clean -f '*.d.ts*'", | ||
"prepack": "tsc --build tsconfig.build.json", | ||
"postpack": "git clean -f '*.d.ts*'", | ||
"test": "ava", | ||
@@ -45,16 +45,17 @@ "test:c8": "c8 $C8_OPTIONS ava --config=ava-nesm.config.js", | ||
"dependencies": { | ||
"@endo/common": "^1.2.2", | ||
"@endo/errors": "^1.2.2", | ||
"@endo/eventual-send": "^1.2.2", | ||
"@endo/nat": "^5.0.7", | ||
"@endo/pass-style": "^1.4.0", | ||
"@endo/promise-kit": "^1.1.2" | ||
"@endo/common": "^1.2.3", | ||
"@endo/errors": "^1.2.3", | ||
"@endo/eventual-send": "^1.2.3", | ||
"@endo/nat": "^5.0.8", | ||
"@endo/pass-style": "^1.4.1", | ||
"@endo/promise-kit": "^1.1.3" | ||
}, | ||
"devDependencies": { | ||
"@endo/init": "^1.1.2", | ||
"@endo/lockdown": "^1.0.7", | ||
"@endo/ses-ava": "^1.2.2", | ||
"@endo/init": "^1.1.3", | ||
"@endo/lockdown": "^1.0.8", | ||
"@endo/ses-ava": "^1.2.3", | ||
"@fast-check/ava": "^1.1.5", | ||
"ava": "^6.1.2", | ||
"c8": "^7.14.0" | ||
"ava": "^6.1.3", | ||
"c8": "^7.14.0", | ||
"typescript": "5.5.2" | ||
}, | ||
@@ -80,3 +81,4 @@ "files": [ | ||
"files": [ | ||
"test/**/test-*.js" | ||
"test/**/test-*.*", | ||
"test/**/*.test.*" | ||
], | ||
@@ -88,3 +90,3 @@ "timeout": "2m" | ||
}, | ||
"gitHead": "08e59bc0d262565165636c2e3875bbe3dcb91cf8" | ||
"gitHead": "681b813ccb1fa177905dabf2ed3f5f248cb33ce7" | ||
} |
@@ -5,4 +5,4 @@ export function recordNames<T extends Passable>(record: CopyRecord<T>): string[]; | ||
export function makePassableKit(options?: (EncodeOptions & DecodeOptions) | undefined): PassableKit; | ||
export function makeEncodePassable(encodeOptions?: EncodeOptions | undefined): PassableKit['encodePassable']; | ||
export function makeDecodePassable(decodeOptions?: DecodeOptions | undefined): PassableKit['decodePassable']; | ||
export function makeEncodePassable(encodeOptions?: EncodeOptions | undefined): PassableKit["encodePassable"]; | ||
export function makeDecodePassable(decodeOptions?: DecodeOptions | undefined): PassableKit["decodePassable"]; | ||
export function isEncodedRemotable(encoded: any): boolean; | ||
@@ -40,5 +40,5 @@ /** | ||
encodePassable: ReturnType<(encodeStringSuffix: (str: string) => string, encodeArray: (arr: unknown[], encodeRecur: (p: Passable) => string) => string, options: Required<EncodeOptions> & { | ||
verifyEncoding?: ((encoded: string, label: string) => void) | undefined; | ||
verifyEncoding?: (encoded: string, label: string) => void; | ||
}) => (p: Passable) => string>; | ||
decodePassable: ReturnType<(decodeStringSuffix: (encoded: string) => string, decodeArray: (encoded: string, decodeRecur: (e: string) => Passable, skip?: number | undefined) => unknown[], options: Required<DecodeOptions>) => (encoded: string, skip?: number | undefined) => Passable>; | ||
decodePassable: ReturnType<(decodeStringSuffix: (encoded: string) => string, decodeArray: (encoded: string, decodeRecur: (e: string) => Passable, skip?: number) => unknown[], options: Required<DecodeOptions>) => (encoded: string, skip?: number) => Passable>; | ||
}; | ||
@@ -45,0 +45,0 @@ import type { Passable } from '@endo/pass-style'; |
@@ -675,2 +675,3 @@ /* eslint-disable no-bitwise */ | ||
const { decodeRemotable, decodePromise, decodeError } = options; | ||
/** @type {(encoded: string, skip?: number) => Passable} */ | ||
const innerDecode = (encoded, skip = 0) => { | ||
@@ -719,2 +720,3 @@ switch (encoded.charAt(skip)) { | ||
case '^': { | ||
// @ts-expect-error Type 'unknown[]' is not Passable | ||
return decodeArray(encoded, innerDecode, skip); | ||
@@ -733,3 +735,2 @@ } | ||
}; | ||
// @ts-expect-error Type 'unknown' is not assignable to type 'Passable<PassableCap, Error>'. | ||
return innerDecode; | ||
@@ -736,0 +737,0 @@ }; |
@@ -9,4 +9,4 @@ export function makeEncodeToCapData(encodeOptions?: EncodeToCapDataOptions | undefined): (passable: Passable) => Encoding; | ||
export type DecodeOptions = { | ||
decodeRemotableFromCapData?: ((encodedRemotable: Encoding, decodeRecur: (e: Encoding) => Passable) => Promise<any> | RemotableObject) | undefined; | ||
decodePromiseFromCapData?: ((encodedPromise: Encoding, decodeRecur: (e: Encoding) => Passable) => Promise<any> | RemotableObject) | undefined; | ||
decodeRemotableFromCapData?: ((encodedRemotable: Encoding, decodeRecur: (e: Encoding) => Passable) => (Promise<any> | RemotableObject)) | undefined; | ||
decodePromiseFromCapData?: ((encodedPromise: Encoding, decodeRecur: (e: Encoding) => Passable) => (Promise<any> | RemotableObject)) | undefined; | ||
decodeErrorFromCapData?: ((encodedError: Encoding, decodeRecur: (e: Encoding) => Passable) => Error) | undefined; | ||
@@ -13,0 +13,0 @@ }; |
@@ -6,3 +6,3 @@ export function makeEncodeToSmallcaps(encodeOptions?: EncodeToSmallcapsOptions | undefined): (passable: Passable) => SmallcapsEncoding; | ||
export type EncodeToSmallcapsOptions = { | ||
encodeRemotableToSmallcaps?: ((remotable: typeof Remotable, encodeRecur: (p: Passable) => SmallcapsEncoding) => SmallcapsEncoding) | undefined; | ||
encodeRemotableToSmallcaps?: ((remotable: <T extends {}, I extends import("@endo/pass-style").InterfaceSpec>(iface?: I | undefined, props?: undefined, remotable?: T | undefined) => T & import("@endo/pass-style").RemotableObject<I> & import("@endo/eventual-send").RemotableBrand<{}, T>, encodeRecur: (p: Passable) => SmallcapsEncoding) => SmallcapsEncoding) | undefined; | ||
encodePromiseToSmallcaps?: ((promise: Promise<any>, encodeRecur: (p: Passable) => SmallcapsEncoding) => SmallcapsEncoding) | undefined; | ||
@@ -12,3 +12,3 @@ encodeErrorToSmallcaps?: ((error: Error, encodeRecur: (p: Passable) => SmallcapsEncoding) => SmallcapsEncoding) | undefined; | ||
export type DecodeFromSmallcapsOptions = { | ||
decodeRemotableFromSmallcaps?: ((encodedRemotable: SmallcapsEncoding, decodeRecur: (e: SmallcapsEncoding) => Passable) => typeof Remotable) | undefined; | ||
decodeRemotableFromSmallcaps?: ((encodedRemotable: SmallcapsEncoding, decodeRecur: (e: SmallcapsEncoding) => Passable) => <T extends {}, I extends import("@endo/pass-style").InterfaceSpec>(iface?: I | undefined, props?: undefined, remotable?: T | undefined) => T & import("@endo/pass-style").RemotableObject<I> & import("@endo/eventual-send").RemotableBrand<{}, T>) | undefined; | ||
decodePromiseFromSmallcaps?: ((encodedPromise: SmallcapsEncoding, decodeRecur: (e: SmallcapsEncoding) => Passable) => Promise<any>) | undefined; | ||
@@ -18,3 +18,2 @@ decodeErrorFromSmallcaps?: ((encodedError: SmallcapsEncoding, decodeRecur: (e: SmallcapsEncoding) => Passable) => Error) | undefined; | ||
import type { Passable } from '@endo/pass-style'; | ||
import type { Remotable } from '@endo/pass-style'; | ||
//# sourceMappingURL=encodeToSmallcaps.d.ts.map |
@@ -237,3 +237,3 @@ /// <reference types="ses"/> | ||
const makeFullRevive = slots => { | ||
/** @type {Map<number>} */ | ||
/** @type {Map<number, RemotableObject | Promise>} */ | ||
const valMap = new Map(); | ||
@@ -243,3 +243,3 @@ | ||
* @param {{iface?: string, index: number}} slotData | ||
* @returns {PassableCap} | ||
* @returns {RemotableObject | Promise} | ||
*/ | ||
@@ -351,3 +351,3 @@ const decodeSlotCommon = slotData => { | ||
* @param {string} stringEncoding | ||
* @param {(e: unknown) => PassableCap} _decodeRecur | ||
* @param {(e: unknown) => Passable} _decodeRecur | ||
* @returns {RemotableObject | Promise} | ||
@@ -354,0 +354,0 @@ */ |
@@ -1,2 +0,2 @@ | ||
export function trivialComparator(left: any, right: any): 1 | -1 | 0; | ||
export function trivialComparator(left: any, right: any): 0 | 1 | -1; | ||
export function getPassStyleCover(passStyle: PassStyle): RankCover; | ||
@@ -22,60 +22,10 @@ export function makeComparatorKit(compareRemotables?: RankCompare | undefined): RankComparatorKit; | ||
export type FullComparatorKit = { | ||
comparator: RankCompare; | ||
antiComparator: RankCompare; | ||
comparator: FullCompare; | ||
antiComparator: FullCompare; | ||
}; | ||
export type IndexCover = [number, number]; | ||
export type PassStyleRanksRecord = { | ||
string: { | ||
index: number; | ||
cover: RankCover; | ||
}; | ||
number: { | ||
index: number; | ||
cover: RankCover; | ||
}; | ||
bigint: { | ||
index: number; | ||
cover: RankCover; | ||
}; | ||
boolean: { | ||
index: number; | ||
cover: RankCover; | ||
}; | ||
symbol: { | ||
index: number; | ||
cover: RankCover; | ||
}; | ||
undefined: { | ||
index: number; | ||
cover: RankCover; | ||
}; | ||
tagged: { | ||
index: number; | ||
cover: RankCover; | ||
}; | ||
remotable: { | ||
index: number; | ||
cover: RankCover; | ||
}; | ||
null: { | ||
index: number; | ||
cover: RankCover; | ||
}; | ||
copyRecord: { | ||
index: number; | ||
cover: RankCover; | ||
}; | ||
copyArray: { | ||
index: number; | ||
cover: RankCover; | ||
}; | ||
error: { | ||
index: number; | ||
cover: RankCover; | ||
}; | ||
promise: { | ||
index: number; | ||
cover: RankCover; | ||
}; | ||
}; | ||
export type PassStyleRanksRecord = Record<PassStyle, { | ||
index: number; | ||
cover: RankCover; | ||
}>; | ||
import type { PassStyle } from '@endo/pass-style'; | ||
@@ -85,2 +35,3 @@ import type { RankCover } from './types.js'; | ||
import type { Passable } from '@endo/pass-style'; | ||
import type { FullCompare } from './types.js'; | ||
//# sourceMappingURL=rankOrder.d.ts.map |
export type ConvertValToSlot<Slot, Value extends PassableCap = any> = (val: Value) => Slot; | ||
export type ConvertSlotToVal<Slot, Value extends PassableCap = any> = (slot: Slot, iface?: string | undefined) => Value; | ||
export type EncodingClass<T> = { | ||
'@qclass': T; | ||
"@qclass": T; | ||
}; | ||
@@ -15,7 +15,7 @@ /** | ||
*/ | ||
export type EncodingUnion = EncodingClass<'NaN'> | EncodingClass<'undefined'> | EncodingClass<'Infinity'> | EncodingClass<'-Infinity'> | (EncodingClass<'bigint'> & { | ||
export type EncodingUnion = EncodingClass<"NaN"> | EncodingClass<"undefined"> | EncodingClass<"Infinity"> | EncodingClass<"-Infinity"> | (EncodingClass<"bigint"> & { | ||
digits: string; | ||
}) | EncodingClass<'@@asyncIterator'> | (EncodingClass<'symbol'> & { | ||
}) | EncodingClass<"@@asyncIterator"> | (EncodingClass<"symbol"> & { | ||
name: string; | ||
}) | (EncodingClass<'error'> & { | ||
}) | (EncodingClass<"error"> & { | ||
name: string; | ||
@@ -26,9 +26,9 @@ message: string; | ||
errors?: Encoding[]; | ||
}) | (EncodingClass<'slot'> & { | ||
}) | (EncodingClass<"slot"> & { | ||
index: number; | ||
iface?: string; | ||
}) | (EncodingClass<'hilbert'> & { | ||
}) | (EncodingClass<"hilbert"> & { | ||
original: Encoding; | ||
rest?: Encoding; | ||
}) | (EncodingClass<'tagged'> & { | ||
}) | (EncodingClass<"tagged"> & { | ||
tag: string; | ||
@@ -35,0 +35,0 @@ payload: Encoding; |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
175733
7
38
3743
Updated@endo/common@^1.2.3
Updated@endo/errors@^1.2.3
Updated@endo/eventual-send@^1.2.3
Updated@endo/nat@^5.0.8
Updated@endo/pass-style@^1.4.1
Updated@endo/promise-kit@^1.1.3