{"version":3,"file":"types.mjs","names":[],"sources":["../src/types.ts"],"sourcesContent":["import type { Logger } from './logger'\nimport { Ed25519PublicJwk, PublicJwk } from './modules/kms'\n\nexport interface InitConfig {\n  logger?: Logger\n  autoUpdateStorageOnStartup?: boolean\n\n  /**\n   * Allow insecure http urls in places where this is usually required.\n   * Unsecure http urls may still be allowed in places where this is not checked (e.g. didcomm)\n   *\n   * For some flows this config option is set globally, which means that different agent configurations\n   * will fight for the configuration. It is meant as a local development option.\n   *\n   * Use with caution\n   *\n   * @default false\n   */\n  allowInsecureHttpUrls?: boolean\n\n  /**\n   * The allowed skew in seconds that should be allowed for validity time of a credentials and other signed\n   * objects (e.g. StatusList). Mobile devices especially can run a bit behind actual time, making validity\n   * checks fail based on a milliseconds / seconds.\n   *\n   * NOTE: this does currently only affects JWT based objects and credentials:\n   * - Token Status List\n   * - SD-JWT VC\n   * - W3C VCDM 1.1 and 2.0 with JWT/SD-JWT\n   *\n   * It does not cover\n   * - W3C VCDM 1.1 JSON-LD\n   * - mDOC\n   *\n   * @default 30\n   */\n  validitySkewSeconds?: number\n}\n\nexport type JsonValue = string | number | boolean | null | JsonObject | JsonArray\nexport type JsonArray = Array<JsonValue>\nexport interface JsonObject {\n  [property: string]: JsonValue\n}\n\n/**\n * Flatten an array of arrays\n * @example\n * ```\n * type Flattened = FlatArray<[[1], [2]]>\n *\n * // is the same as\n * type Flattened = 1 | 2\n * ```\n */\nexport type FlatArray<Arr> = Arr extends ReadonlyArray<infer InnerArr> ? FlatArray<InnerArr> : Arr\n\n/**\n * Create an exclusive or, setting the other params to 'never' which helps with\n * type narrowing\n *\n * @example\n * ```\n * type Options = XOR<{ name: string }, { dateOfBirth: Date }>\n *\n * type Options =\n *  | { name: string; dateOfBirth?: never }\n *  | { name?: never; dateOfBirth: Date }\n * ```\n */\nexport type XOR<T, U> =\n  | (T & { [P in keyof Omit<U, keyof T>]?: never })\n  | (U & { [P in keyof Omit<T, keyof U>]?: never })\n\n/**\n * Get the awaited (resolved promise) type of Promise type.\n */\nexport type Awaited<T> = T extends Promise<infer U> ? U : never\n\n/**\n * Type util that returns `true` or `false` based on whether the input type `T` is of type `any`\n */\nexport type IsAny<T> = unknown extends T ? ([keyof T] extends [never] ? false : true) : false\n\nexport interface ResolvedDidCommService {\n  id: string\n  serviceEndpoint: string\n  recipientKeys: PublicJwk<Ed25519PublicJwk>[]\n  routingKeys: PublicJwk<Ed25519PublicJwk>[]\n}\n\nexport const isJsonObject = (value: unknown): value is JsonObject => {\n  return value !== undefined && typeof value === 'object' && value !== null && !Array.isArray(value)\n}\n\nexport type SingleOrArray<T> = T | T[]\nexport type Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>\nexport type CanBePromise<T> = T | Promise<T>\n\nexport type NonEmptyArray<T> = [T, ...T[]]\nexport function mapNonEmptyArray<U, M extends (item: U, index: number) => unknown>(\n  array: NonEmptyArray<U>,\n  mapFunction: M\n): NonEmptyArray<ReturnType<M>> {\n  return array.map(mapFunction) as NonEmptyArray<ReturnType<M>>\n}\nexport function isNonEmptyArray<U>(array: U[]): array is NonEmptyArray<U> {\n  return array.length > 0\n}\n"],"mappings":";;;;;AA2FA,MAAa,gBAAgB,UAAwC;AACnE,QAAO,UAAU,UAAa,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,MAAM;;AAQpG,SAAgB,iBACd,OACA,aAC8B;AAC9B,QAAO,MAAM,IAAI,YAAY;;AAE/B,SAAgB,gBAAmB,OAAuC;AACxE,QAAO,MAAM,SAAS"}