From 681d9d144d9246440529b113e4e15a869a2df32d Mon Sep 17 00:00:00 2001 From: Alexander Cerutti Date: Wed, 14 Aug 2019 15:51:26 +0200 Subject: [PATCH] Improved declaration file --- index.d.ts | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/index.d.ts b/index.d.ts index bfec422..ad15c5f 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,6 +1,14 @@ import { Stream } from "stream"; -export function createPass(options: Schema.FactoryOptions): Promise; +/** + * 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): Promise; + export declare class Pass { constructor(options: Schema.PassInstance); @@ -115,6 +123,20 @@ export declare class Pass { readonly props: Readonly; } +/** + * Creates an abstract model to keep data + * in memory for future passes creation + * @param options + */ +export declare function createAbstractModel(options: Schema.AbstractFactoryOptions): Promise; + +export declare class AbstractModel { + constructor(options: Schema.AbstractModelOptions); + readonly certificates: Schema.FinalCertificates; + readonly bundle: Schema.PartitionedBundle; + readonly overrides: Schema.OverridesSupportedOptions; +} + declare namespace Schema { type DataDetectorType = "PKDataDetectorTypePhoneNumber" | "PKDataDetectorTypeLink" | "PKDataDetectorTypeAddress" | "PKDataDetectorTypeCalendarEvent"; type TextAlignment = "PKTextAlignmentLeft" | "PKTextAlignmentCenter" | "PKTextAlignmentRight" | "PKTextAlignmentNatural"; @@ -156,6 +178,16 @@ declare namespace Schema { signerKey: string; } + interface AbstractFactoryOptions extends Omit { + certificates?: Certificates; + } + + interface AbstractModelOptions { + bundle: PartitionedBundle; + certificates: FinalCertificates; + overrides?: OverridesSupportedOptions; + } + interface PassInstance { model: PartitionedBundle; certificates: FinalCertificates;