UNPKG

balena-sdk

Version:
34 lines (33 loc) 2.26 kB
import * as errors from 'balena-errors'; import type * as Pine from '../../typings/pinejs-client-core'; import type { IfDefined } from '../../typings/utils'; import type { WebResourceFile } from 'balena-request'; export interface BalenaUtils { mergePineOptions: typeof mergePineOptions; BalenaWebResourceFile: typeof BalenaWebResourceFile; } export declare const notImplemented: () => never; export declare const onlyIf: (condition: boolean) => <T extends (...args: any[]) => any>(fn: T) => (() => never) | T; export declare const isId: (v?: unknown) => v is number; export declare const isFullUuid: (v?: unknown) => v is string; export declare const withSupervisorLockedError: <T>(fn: () => Promise<T>) => Promise<T>; export declare const isUnauthorizedResponse: (err: Error) => err is errors.BalenaRequestError; export declare const isNotFoundResponse: (err: Error) => err is errors.BalenaRequestError; export declare function mergePineOptionsTyped<R extends object, P extends Pine.ODataOptionsStrict<R>>(defaults: P, extras: Pine.ODataOptions<R> | undefined): P; export type ExtendedPineTypedResult<T, TBaseResult, ExtraPineOptions extends Pine.ODataOptions<T> | undefined> = TBaseResult & IfDefined<ExtraPineOptions, Pine.TypedResult<T, ExtraPineOptions>>; export declare function mergePineOptions<R extends object, TDefault extends Pine.ODataOptions<R>>(defaults: TDefault, extras: Pine.ODataOptions<R> | undefined): TDefault; export declare function mergePineOptions<R extends object>(defaults: Pine.ODataOptions<R>, extras: Pine.ODataOptions<R> | undefined): Pine.ODataOptions<R>; /** * Useful when you want to avoid having to manually parse the key * or when need order guarantees while iterating the keys. * @private */ export declare const groupByMap: <K, V>(entries: V[], iteratee: (item: V) => K) => Map<K, V[]>; export declare const delay: (ms: number) => Promise<void>; export declare const limitedMap: <T, U>(arr: T[], fn: (currentValue: T, index: number, array: T[]) => Promise<U>, { concurrency, }?: { concurrency?: number; }) => Promise<U[]>; export declare class BalenaWebResourceFile extends Blob implements WebResourceFile { name: string; constructor(blobParts: BlobPart[], name: string, options?: BlobPropertyBag); }