UNPKG

@junobuild/admin

Version:

A library for interfacing with admin features of Juno

46 lines (45 loc) 2.42 kB
import type { Principal } from '@dfinity/principal'; import { type JunoPackage } from '@junobuild/config'; import type { ActorParameters } from '../types/actor.types'; /** * Parameters required to retrieve a `juno:package` metadata section. * * @typedef {Object} GetJunoPackageParams * @property {Principal | string} moduleId - The ID of the canister module (as a Principal or string). * @property {ActorParameters} [ActorParameters] - Additional actor parameters for making the canister call. */ export type GetJunoPackageParams = { moduleId: Principal | string; } & ActorParameters; /** * Get the `juno:package` metadata from the public custom section of a given module. * * @param {Object} params - The parameters to fetch the metadata. * @param {Principal | string} params.moduleId - The canister ID (as a `Principal` or string) from which to retrieve the metadata. * @param {ActorParameters} params - Additional actor parameters required for the call. * * @returns {Promise<JunoPackage | undefined>} A promise that resolves to the parsed `JunoPackage` metadata, or `undefined` if not found. * * @throws {ZodError} If the metadata exists but does not conform to the expected `JunoPackage` schema. */ export declare const getJunoPackage: ({ moduleId, ...rest }: GetJunoPackageParams) => Promise<JunoPackage | undefined>; /** * Retrieves only the `version` field from the `juno:package` metadata. * * @param {GetJunoPackageParams} params - The parameters to fetch the package version. * * @returns {Promise<string | undefined>} A promise that resolves to the version string or `undefined` if not found. * * @throws {ZodError} If the metadata exists but does not conform to the expected `JunoPackage` schema. */ export declare const getJunoPackageVersion: (params: GetJunoPackageParams) => Promise<JunoPackage["version"] | undefined>; /** * Retrieves the `dependencies` field from the `juno:package` metadata. * * @param {GetJunoPackageParams} params - The parameters to fetch the package metadata. * * @returns {Promise<JunoPackage['dependencies'] | undefined>} A promise that resolves to the dependencies object or `undefined` if not found. * * @throws {ZodError} If the metadata exists but does not conform to the expected `JunoPackage` schema. */ export declare const getJunoPackageDependencies: (params: GetJunoPackageParams) => Promise<JunoPackage["dependencies"] | undefined>;