Improved declaration file

This commit is contained in:
Alexander Cerutti
2019-08-14 15:51:26 +02:00
parent 522b2fca62
commit 681d9d144d

34
index.d.ts vendored
View File

@@ -1,6 +1,14 @@
import { Stream } from "stream"; import { Stream } from "stream";
export function createPass(options: Schema.FactoryOptions): Promise<Pass>; /**
* Creates a new Pass instance.
*
* @param options Options to be used to create the instance or an Abstract Model reference
* @param additionalBuffers More buffers (with file name) to be added on runtime (if you are downloading some files from the web)
* @param abstractMissingData Additional data for abstract models, that might vary from pass to pass.
*/
export declare function createPass(options: Schema.FactoryOptions | AbstractModel, additionalBuffers?: Schema.BundleUnit, abstractMissingData?: Omit<Schema.AbstractFactoryOptions, "model">): Promise<Pass>;
export declare class Pass { export declare class Pass {
constructor(options: Schema.PassInstance); constructor(options: Schema.PassInstance);
@@ -115,6 +123,20 @@ export declare class Pass {
readonly props: Readonly<Schema.ValidPass>; readonly props: Readonly<Schema.ValidPass>;
} }
/**
* Creates an abstract model to keep data
* in memory for future passes creation
* @param options
*/
export declare function createAbstractModel(options: Schema.AbstractFactoryOptions): Promise<AbstractModel>;
export declare class AbstractModel {
constructor(options: Schema.AbstractModelOptions);
readonly certificates: Schema.FinalCertificates;
readonly bundle: Schema.PartitionedBundle;
readonly overrides: Schema.OverridesSupportedOptions;
}
declare namespace Schema { declare namespace Schema {
type DataDetectorType = "PKDataDetectorTypePhoneNumber" | "PKDataDetectorTypeLink" | "PKDataDetectorTypeAddress" | "PKDataDetectorTypeCalendarEvent"; type DataDetectorType = "PKDataDetectorTypePhoneNumber" | "PKDataDetectorTypeLink" | "PKDataDetectorTypeAddress" | "PKDataDetectorTypeCalendarEvent";
type TextAlignment = "PKTextAlignmentLeft" | "PKTextAlignmentCenter" | "PKTextAlignmentRight" | "PKTextAlignmentNatural"; type TextAlignment = "PKTextAlignmentLeft" | "PKTextAlignmentCenter" | "PKTextAlignmentRight" | "PKTextAlignmentNatural";
@@ -156,6 +178,16 @@ declare namespace Schema {
signerKey: string; signerKey: string;
} }
interface AbstractFactoryOptions extends Omit<FactoryOptions, "certificates"> {
certificates?: Certificates;
}
interface AbstractModelOptions {
bundle: PartitionedBundle;
certificates: FinalCertificates;
overrides?: OverridesSupportedOptions;
}
interface PassInstance { interface PassInstance {
model: PartitionedBundle; model: PartitionedBundle;
certificates: FinalCertificates; certificates: FinalCertificates;