zeed 0.10.21 → 0.10.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,5 @@
1
1
  import * as fs from 'fs';
2
+ import { Buffer } from 'node:buffer';
2
3
 
3
4
  /** Always throws. */
4
5
  declare function fatal(...messages: any[]): never;
@@ -178,7 +179,7 @@ declare function encodeBase62(bin: BinInput, padding?: number): string;
178
179
  declare function decodeBase62(s: string, padding?: number): Uint8Array;
179
180
  declare function estimateSizeForBase(bytes: number, base: number): number;
180
181
 
181
- declare const toCamelCase: (s: string) => string;
182
+ declare function toCamelCase(s: string): string;
182
183
  declare function toCapitalize(s: string): string;
183
184
  declare function toCapitalizeWords(s: string): string;
184
185
  declare function fromCamelCase(str: string, separator?: string): string;
@@ -312,8 +313,8 @@ interface Options {
312
313
  */
313
314
  declare function diffObjects(obj: Record<string, any> | any[], newObj: Record<string, any> | any[], options?: Partial<Options>, _stack?: Record<string, any>[]): Difference[];
314
315
 
315
- declare const escapeHTML: (s: string) => string;
316
- declare const unescapeHTML: (s: string) => string;
316
+ declare function escapeHTML(s: string): string;
317
+ declare function unescapeHTML(s: string): string;
317
318
 
318
319
  type Primitive = null | undefined | string | number | boolean | symbol | bigint;
319
320
  declare function isObject(obj: unknown): obj is object;
@@ -412,8 +413,8 @@ declare function toValidFilename(string: string, replacement?: string): string |
412
413
  declare function escapeRegExp(value: RegExp | string): string;
413
414
 
414
415
  type RoundingMode = (value: number) => number;
415
- declare const isHalf: (value: number) => boolean;
416
- declare const isEven: (value: number) => boolean;
416
+ declare function isHalf(value: number): boolean;
417
+ declare function isEven(value: number): boolean;
417
418
  declare const roundUp: RoundingMode;
418
419
  declare const roundDown: RoundingMode;
419
420
  declare const roundHalfUp: RoundingMode;
@@ -748,7 +749,7 @@ interface MessageHub {
748
749
  listen<L extends MessageDefinitions>(newHandlers: L): void;
749
750
  send<L extends MessageDefinitions>(): MessagesMethods<L>;
750
751
  }
751
- declare const createPromiseProxy: <P extends object>(fn: (name: string, args: any[], opt: any) => Promise<unknown>, opt: MessagesOptions, predefinedMethods?: any) => P;
752
+ declare function createPromiseProxy<P extends object>(fn: (name: string, args: any[], opt: any) => Promise<unknown>, opt: MessagesOptions, predefinedMethods?: any): P;
752
753
  /**
753
754
  * RPC
754
755
  *
@@ -790,11 +791,9 @@ declare function usePubSub<L extends ListenerSignature<L> = DefaultListener>(opt
790
791
 
791
792
  type ArgumentsType<T> = T extends (...args: infer A) => any ? A : never;
792
793
  type ReturnType$1<T> = T extends (...args: any) => infer R ? R : never;
793
- interface RPCOptions<Remote> {
794
+ interface RPCOptionsBasic {
794
795
  /** No return values expected */
795
796
  onlyEvents?: boolean;
796
- /** Names of remote functions that do not need response. */
797
- eventNames?: (keyof Remote)[];
798
797
  /** Function to post raw message */
799
798
  post: (data: any) => void;
800
799
  /** Listener to receive raw message */
@@ -804,6 +803,10 @@ interface RPCOptions<Remote> {
804
803
  /** Custom function to deserialize data */
805
804
  deserialize?: (data: any) => any;
806
805
  }
806
+ interface RPCOptions<Remote> extends RPCOptionsBasic {
807
+ /** Names of remote functions that do not need response. */
808
+ eventNames?: (keyof Remote)[];
809
+ }
807
810
  interface RPCFn<T> {
808
811
  /** Call the remote function and wait for the result. */
809
812
  (...args: ArgumentsType<T>): Promise<Awaited<ReturnType$1<T>>>;
@@ -814,6 +817,8 @@ type RPCReturn<RemoteFunctions> = {
814
817
  [K in keyof RemoteFunctions]: RPCFn<RemoteFunctions[K]>;
815
818
  };
816
819
  declare function useRPC<RemoteFunctions = {}, LocalFunctions = {}>(functions: LocalFunctions, options: RPCOptions<RemoteFunctions>): RPCReturn<RemoteFunctions>;
820
+ declare function useRPCHub(options: RPCOptionsBasic): <RemoteFunctions = {}, LocalFunctions = {}>(additionalFunctions?: LocalFunctions | undefined, additionalEventNames?: string[]) => RPCReturn<RemoteFunctions>;
821
+ type UseRPCHubType = ReturnType$1<typeof useRPCHub>;
817
822
 
818
823
  interface ProgressOptions {
819
824
  totalUnits?: number;
@@ -1225,16 +1230,16 @@ declare class MemStorage<T = Json> implements ObjectStorage<T> {
1225
1230
  /**
1226
1231
  * @returns Timestamp in miliseconds
1227
1232
  */
1228
- declare const getTimestamp: () => number;
1233
+ declare function getTimestamp(): number;
1229
1234
  declare function formatMilliseconds(ms: number): string;
1230
1235
  declare function parseDate(...dateCandidates: (string | Date)[]): Date | undefined;
1231
1236
  /**
1232
1237
  * @returns Timestamp in miliseconds
1233
1238
  */
1234
- declare const getPerformanceTimestamp: () => number;
1239
+ declare function getPerformanceTimestamp(): number;
1235
1240
  declare function duration(): () => string;
1236
1241
 
1237
- declare const noop: () => void;
1242
+ declare function noop(): void;
1238
1243
 
1239
1244
  declare function uuidBytes(): Uint8Array;
1240
1245
  declare function uuidB62(bytes?: Uint8Array): string;
@@ -1429,4 +1434,4 @@ declare function browserSupportsColors(): boolean;
1429
1434
 
1430
1435
  declare function Logger(name?: string, level?: LogLevelAliasType): LoggerInterface;
1431
1436
 
1432
- export { ArgumentsType, AsyncMutex, AsyncReturnType, BinInput, BinaryEncoder, CRYPTO_DEFAULT_ALG, CRYPTO_DEFAULT_DERIVE_ALG, CRYPTO_DEFAULT_DERIVE_ITERATIONS, CRYPTO_DEFAULT_HASH_ALG, Channel, ChannelMessageEvent, CryptoEncoder, DAY_MS, Day, DayInput, DayInputLegacy, DayValue, DecimalInput, DecimalValue, DefaultListener, DefaultLogger, Difference, DifferenceType, Disposable, Disposer, DisposerFunction, Emitter, EmitterAllHandler, EmitterHandler, Encoder, FileStorage, FileStorageOptions, FilterFunction, Json, JsonEncoder, ListenerSignature, LocalChannel, LocalStorage, LocalStorageOptions, LogHandler, LogHandlerOptions, LogLevel, LogLevelAlias, LogLevelAliasKey, LogLevelAliasType, LogLevelAll, LogLevelDebug, LogLevelError, LogLevelFatal, LogLevelInfo, LogLevelOff, LogLevelWarn, LogMessage, Logger, LoggerBrowserHandler, LoggerBrowserSetupDebugFactory, LoggerConsoleHandler, LoggerContext, LoggerContextInterface, LoggerFileHandler, LoggerInterface, LoggerMemoryHandler, LoggerNodeHandler, MapperFunction, MemStorage, MemStorageOptions, Message, MessageAction, MessageDefinitions, MessageHub, MessageResult, MessagesDefaultMethods, MessagesMethods, MessagesOptions, Mutex, NestedArray, NoopEncoder, ObjectStorage, PoolConfig, PoolTask, PoolTaskEvents, PoolTaskFn, PoolTaskIdConflictResolution, PoolTaskState, Primitive, Progress, PubSub, RPCFn, RPCOptions, RPCReturn, RenderMessagesOptions, ReturnType$1 as ReturnType, RoundingMode, SerialQueue, SortableItem, TaskEvents, TaskFn, Uint8ArrayToDataUri, Uint8ArrayToHexDump, Uint8ArrayToJson, Uint8ArrayToString, UseDefer, UseDispose, XRX, _decodeUtf8Polyfill, _encodeUtf8Polyfill, _useBase, activateConsoleDebug, arrayAvg, arrayBatches, arrayEmptyInPlace, arrayFilterInPlace, arrayFlatten, arrayIntersection, arrayIsEqual, arrayMax, arrayMin, arrayMinus, arrayRandomElement, arrayRemoveElement, arraySetElement, arrayShuffle, arrayShuffleForce, arrayShuffleInPlace, arraySorted, arraySortedNumbers, arraySum, arraySymmetricDifference, arrayToggleInPlace, arrayUnion, arrayUnique, assert, assertCondition, avg, between, bitfield, blobToArrayBuffer, blobToDataUri, blobToUint8Array, browserSelectColorByName, browserSupportsColors, cloneJsonObject, cloneObject, cmp, colorString, colorStringList, composeOrderby, createArray, createBinaryStreamDecoder, createBinaryStreamEncoder, createLocalChannelPair, createPromise, createPromiseProxy, csvParse, csvParseToObjects, csvStringify, dataUriToBlob, dataUriToMimeType, dataUriToUint8Array, dateStringToDays, day, dayDay, dayDiff, dayFromAny, dayFromDate, dayFromDateGMT, dayFromParts, dayFromString, dayFromTimestamp, dayFromToday, dayIterator, dayMonth, dayMonthStart, dayOffset, dayRange, dayToDate, dayToDateGMT, dayToParts, dayToString, dayToTimestamp, dayYear, dayYearStart, debounce, decimal, decimalCentsPart, decimalFromCents, decimalToCents, decodeBase16, decodeBase32, decodeBase58, decodeBase62, decodeJson, decrypt, deepEqual, deepMerge, deepStripUndefinedInPlace, deriveKeyPbkdf2, detect, diffObjects, digest, duration, empty, encodeBase16, encodeBase32, encodeBase58, encodeBase62, encodeJson, encodeQuery, encrypt, endSortWeight, ensureFolder, ensureKey, ensureKeyAsync, equalBinary, escapeHTML, escapeRegExp, estimateSizeForBase, exists, fatal, fetchBasic, fetchJson, fetchOptionsBasicAuth, fetchOptionsFormURLEncoded, fetchOptionsJson, fetchText, files, filesAsync, first, fixBrokenUth8String, forEachDay, forTimes, formatMessages, formatMilliseconds, fromBase64, fromBase64String, fromCamelCase, fromHex, getEnvVariableRelaxed, getFingerprint, getFingerprintAsync, getGlobal, getGlobalContext, getGlobalEmitter, getGlobalLogger, getGlobalLoggerIfExists, getNamespaceFilterString, getNavigator, getPerformanceTimestamp, getSecureRandom, getSecureRandomIfPossible, getSourceLocation, getSourceLocationByPrecedingPattern, getStack, getStackLlocationList, getStat, getStatAsync, getTimestamp, getWebCrypto, getWindow, globToRegExp, gravatarURLByEmail, httpMethod, immediate, isArray, isBoolean, isBrowser, isEmpty, isEven, isHalf, isHiddenPath, isInteger, isLocalHost, isNotEmpty, isNotNull, isNull, isNullOrUndefined, isNumber, isObject, isPrime, isPrimeRX, isPrimitive, isPromise, isRecord, isRecordPlain, isSafeInteger, isString, isTimeout, isTruthy, isUint8Array, isValue, joinToUint8Array, jsonStringify, jsonStringifySafe, jsonStringifySorted, jsonToUint8Array, last, lazyListener, linkifyPlainText, listDistinctUnion, listGroupBy, listOfKey, listQuery, loggerStackTraceDebug, memoize, memoizeAsync, moveSortWeight, noop, objectIsEmpty, objectMap, objectMergeDisposable, parseArgs, parseBasicAuth, parseDate, parseLogLevel, parseOrderby, parseQuery, pbcopy, promisify, qid, randomBoolean, randomFloat, randomInt, randomUint8Array, readText, regExpEscape, regExpString, removeFolder, renderMessages, roundDown, roundHalfAwayFromZero, roundHalfDown, roundHalfEven, roundHalfOdd, roundHalfTowardsZero, roundHalfUp, roundUp, seededRandom, setUuidDefaultEncoding, setupEnv, setupWebCrypto, size, sleep, sortedItems, sortedOrderby, startSortWeight, stringToBoolean, stringToFloat, stringToInteger, stringToPath, stringToUInt8Array, suid, suidBytes, suidBytesDate, suidDate, sum, throttle, timeout, toBase64, toBase64Url, toBool, toCamelCase, toCapitalize, toCapitalizeWords, toFloat, toHex, toHumanReadableFilePath, toHumanReadableUrl, toInt, toPath, toString, toUint8Array, toValidFilename, today, tryTimeout, uname, unescapeHTML, urlBase64ToUint8Array, useAsyncMutex, useBase, useDefer, useDispose, useDisposer, useEventListener, useExitHandler, useInterval, useLevelFilter, useMessageHub, useMutex, useNamespaceFilter, usePool, usePubSub, useRPC, useSorted, useTimeout, uuid, uuid32bit, uuidB32, uuidB62, uuidBytes, uuidDecode, uuidDecodeB32, uuidDecodeB62, uuidDecodeV4, uuidEncode, uuidEncodeB32, uuidEncodeB62, uuidEncodeV4, uuidIsValid, uuidv4, valueToBoolean, valueToFloat, valueToInteger, valueToPath, valueToString, waitOn, walkSync, walkSyncAsync, writeText };
1437
+ export { ArgumentsType, AsyncMutex, AsyncReturnType, BinInput, BinaryEncoder, CRYPTO_DEFAULT_ALG, CRYPTO_DEFAULT_DERIVE_ALG, CRYPTO_DEFAULT_DERIVE_ITERATIONS, CRYPTO_DEFAULT_HASH_ALG, Channel, ChannelMessageEvent, CryptoEncoder, DAY_MS, Day, DayInput, DayInputLegacy, DayValue, DecimalInput, DecimalValue, DefaultListener, DefaultLogger, Difference, DifferenceType, Disposable, Disposer, DisposerFunction, Emitter, EmitterAllHandler, EmitterHandler, Encoder, FileStorage, FileStorageOptions, FilterFunction, Json, JsonEncoder, ListenerSignature, LocalChannel, LocalStorage, LocalStorageOptions, LogHandler, LogHandlerOptions, LogLevel, LogLevelAlias, LogLevelAliasKey, LogLevelAliasType, LogLevelAll, LogLevelDebug, LogLevelError, LogLevelFatal, LogLevelInfo, LogLevelOff, LogLevelWarn, LogMessage, Logger, LoggerBrowserHandler, LoggerBrowserSetupDebugFactory, LoggerConsoleHandler, LoggerContext, LoggerContextInterface, LoggerFileHandler, LoggerInterface, LoggerMemoryHandler, LoggerNodeHandler, MapperFunction, MemStorage, MemStorageOptions, Message, MessageAction, MessageDefinitions, MessageHub, MessageResult, MessagesDefaultMethods, MessagesMethods, MessagesOptions, Mutex, NestedArray, NoopEncoder, ObjectStorage, PoolConfig, PoolTask, PoolTaskEvents, PoolTaskFn, PoolTaskIdConflictResolution, PoolTaskState, Primitive, Progress, PubSub, RPCFn, RPCOptions, RPCOptionsBasic, RPCReturn, RenderMessagesOptions, ReturnType$1 as ReturnType, RoundingMode, SerialQueue, SortableItem, TaskEvents, TaskFn, Uint8ArrayToDataUri, Uint8ArrayToHexDump, Uint8ArrayToJson, Uint8ArrayToString, UseDefer, UseDispose, UseRPCHubType, XRX, _decodeUtf8Polyfill, _encodeUtf8Polyfill, _useBase, activateConsoleDebug, arrayAvg, arrayBatches, arrayEmptyInPlace, arrayFilterInPlace, arrayFlatten, arrayIntersection, arrayIsEqual, arrayMax, arrayMin, arrayMinus, arrayRandomElement, arrayRemoveElement, arraySetElement, arrayShuffle, arrayShuffleForce, arrayShuffleInPlace, arraySorted, arraySortedNumbers, arraySum, arraySymmetricDifference, arrayToggleInPlace, arrayUnion, arrayUnique, assert, assertCondition, avg, between, bitfield, blobToArrayBuffer, blobToDataUri, blobToUint8Array, browserSelectColorByName, browserSupportsColors, cloneJsonObject, cloneObject, cmp, colorString, colorStringList, composeOrderby, createArray, createBinaryStreamDecoder, createBinaryStreamEncoder, createLocalChannelPair, createPromise, createPromiseProxy, csvParse, csvParseToObjects, csvStringify, dataUriToBlob, dataUriToMimeType, dataUriToUint8Array, dateStringToDays, day, dayDay, dayDiff, dayFromAny, dayFromDate, dayFromDateGMT, dayFromParts, dayFromString, dayFromTimestamp, dayFromToday, dayIterator, dayMonth, dayMonthStart, dayOffset, dayRange, dayToDate, dayToDateGMT, dayToParts, dayToString, dayToTimestamp, dayYear, dayYearStart, debounce, decimal, decimalCentsPart, decimalFromCents, decimalToCents, decodeBase16, decodeBase32, decodeBase58, decodeBase62, decodeJson, decrypt, deepEqual, deepMerge, deepStripUndefinedInPlace, deriveKeyPbkdf2, detect, diffObjects, digest, duration, empty, encodeBase16, encodeBase32, encodeBase58, encodeBase62, encodeJson, encodeQuery, encrypt, endSortWeight, ensureFolder, ensureKey, ensureKeyAsync, equalBinary, escapeHTML, escapeRegExp, estimateSizeForBase, exists, fatal, fetchBasic, fetchJson, fetchOptionsBasicAuth, fetchOptionsFormURLEncoded, fetchOptionsJson, fetchText, files, filesAsync, first, fixBrokenUth8String, forEachDay, forTimes, formatMessages, formatMilliseconds, fromBase64, fromBase64String, fromCamelCase, fromHex, getEnvVariableRelaxed, getFingerprint, getFingerprintAsync, getGlobal, getGlobalContext, getGlobalEmitter, getGlobalLogger, getGlobalLoggerIfExists, getNamespaceFilterString, getNavigator, getPerformanceTimestamp, getSecureRandom, getSecureRandomIfPossible, getSourceLocation, getSourceLocationByPrecedingPattern, getStack, getStackLlocationList, getStat, getStatAsync, getTimestamp, getWebCrypto, getWindow, globToRegExp, gravatarURLByEmail, httpMethod, immediate, isArray, isBoolean, isBrowser, isEmpty, isEven, isHalf, isHiddenPath, isInteger, isLocalHost, isNotEmpty, isNotNull, isNull, isNullOrUndefined, isNumber, isObject, isPrime, isPrimeRX, isPrimitive, isPromise, isRecord, isRecordPlain, isSafeInteger, isString, isTimeout, isTruthy, isUint8Array, isValue, joinToUint8Array, jsonStringify, jsonStringifySafe, jsonStringifySorted, jsonToUint8Array, last, lazyListener, linkifyPlainText, listDistinctUnion, listGroupBy, listOfKey, listQuery, loggerStackTraceDebug, memoize, memoizeAsync, moveSortWeight, noop, objectIsEmpty, objectMap, objectMergeDisposable, parseArgs, parseBasicAuth, parseDate, parseLogLevel, parseOrderby, parseQuery, pbcopy, promisify, qid, randomBoolean, randomFloat, randomInt, randomUint8Array, readText, regExpEscape, regExpString, removeFolder, renderMessages, roundDown, roundHalfAwayFromZero, roundHalfDown, roundHalfEven, roundHalfOdd, roundHalfTowardsZero, roundHalfUp, roundUp, seededRandom, setUuidDefaultEncoding, setupEnv, setupWebCrypto, size, sleep, sortedItems, sortedOrderby, startSortWeight, stringToBoolean, stringToFloat, stringToInteger, stringToPath, stringToUInt8Array, suid, suidBytes, suidBytesDate, suidDate, sum, throttle, timeout, toBase64, toBase64Url, toBool, toCamelCase, toCapitalize, toCapitalizeWords, toFloat, toHex, toHumanReadableFilePath, toHumanReadableUrl, toInt, toPath, toString, toUint8Array, toValidFilename, today, tryTimeout, uname, unescapeHTML, urlBase64ToUint8Array, useAsyncMutex, useBase, useDefer, useDispose, useDisposer, useEventListener, useExitHandler, useInterval, useLevelFilter, useMessageHub, useMutex, useNamespaceFilter, usePool, usePubSub, useRPC, useRPCHub, useSorted, useTimeout, uuid, uuid32bit, uuidB32, uuidB62, uuidBytes, uuidDecode, uuidDecodeB32, uuidDecodeB62, uuidDecodeV4, uuidEncode, uuidEncodeB32, uuidEncodeB62, uuidEncodeV4, uuidIsValid, uuidv4, valueToBoolean, valueToFloat, valueToInteger, valueToPath, valueToString, waitOn, walkSync, walkSyncAsync, writeText };