/** * Information about an OpenT2T package, as loaded from a source directory with * a translator manifest or from a built package.json. * * This class is not intended to represent every piece of metadata that might be in * package.json -- just the parts that are relevant to OpenT2T package discovery and * module resolution. * * By specifying module paths of schemas and translators in the package, this class * abstracts away the directory structure from the rest of the library and consumers * of it. */ export declare class PackageInfo { /** * Parses information about OpenT2T modules from a package.json. Returns null if not * an OpenT2T package. Throws an Error if parsing failed or the data is invalid. * * @param {any} packageJson JSON string or pre-parsed JSON object for the package.json * @returns {PackageInfo | null} The parsed package information, or null if not an * OpenT2T package */ static parse(packageJson: any): PackageInfo | null; /** * Converts references to modules within the same package (using a ./ prefix) into * package-qualified module references. */ private static resolveModuleName(packageName, moduleName); /** * Name of the package. This is an NPM package name, which may optionally include a scope * name prefix, e.g. "@opent2t/somepackage". */ readonly name: string; /** * Semantic version of the package. */ readonly version: string; /** * Optional description of the package. */ readonly description?: string; /** * Array of information about OpenT2T schema modules in the package. */ readonly schemas: PackageSchemaInfo[]; /** * Array of information about OpenT2T translator modules in the package. */ readonly translators: PackageTranslatorInfo[]; /** * Information about Onboarding package. (not applicable to translators or hub packages). */ readonly onboardingInfo: PackageOnboardingInfo | null; } /** * Information about an OpenT2T schema module in a package, as loaded from * the opent2t/schemas node of package.json. */ export declare class PackageSchemaInfo { /** * Relative path and name of the schema module within the package. This is not a fully- * qualified name; a package name prefix is normally required to resolve the module. */ readonly moduleName: string; /** * Optional description of the schema module. */ readonly description?: string; } /** * Information about an OpenT2T translator module in a package, as loaded from * the opent2t/translators node of package.json. */ export declare class PackageTranslatorInfo { /** * Relative path and name of the translator module within the package. This is not a * fully-qualified name; a package name prefix is normally required to resolve the * module. */ readonly moduleName: string; /** * Optional description of the translator module. */ readonly description?: string; /** * List of references to schemas implemented by the translator. * These are package-qualified schema module names. */ readonly schemas: string[]; /** * Reference to the onboarding module required by the translator. * This is a package-qualified onboarding module name. */ readonly onboarding: string; /** * Dictionary of properties passed to the onboarding module. For example, a property * may specify a filter for the kind of thing that is to be onboarded. * This is optional and applicable only for devices that are connected through a hub. */ readonly onboardingProperties: { [propertyName: string]: string; }; /** * Onboarding information pertaining to the hub device, which will have the onboarding flow information. * For example, an 'input' flow type for acquiring username/client_id/client_secret * This is optional and present only on hub devices. */ readonly onboardingFlow: OnboardingFlow[]; } export declare class PackageOnboardingInfo { /** * Relative path and name of the onboarding module within the package. This is not a * fully-qualified name; a package name prefix is normally required to resolve the * module. */ readonly moduleName: string; /** * List of references to schemas implemented by the onboarding. * These are package-qualified schema module names. */ readonly schemas: string[]; } export declare class OnboardingFlow { /** * Name of the onboarding flow method. Example: 'getUserInput'' to indicate input from the end-user. */ readonly name: string; /** * Represents individual steps in a given flow (ex: get username, get password). */ readonly flow: OnboardingFlowElement[]; } export declare class OnboardingFlowElement { /** * Specifies type of the flow step (ex: input, password). Each type has specified meaning. * For example, 'password' type indicates the UI to hide the text, when the user types. */ readonly type: string; /** * Friendly name of the flow step. */ readonly name: string; /** * Dictionary of localized descriptions of each flow step, with a language (say en, fr) being the key. */ readonly descriptions: { [locale: string]: string; }; }