From ac1c994b75cc101274b5998316c4e8bb8ef9a24d Mon Sep 17 00:00:00 2001 From: Alexander Cerutti Date: Mon, 27 Sep 2021 00:32:58 +0200 Subject: [PATCH] Moved Template type to Schemas --- src/PKPass.ts | 12 ++---------- src/schemas/index.ts | 12 ++++++------ 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/src/PKPass.ts b/src/PKPass.ts index ec9e26e..f3bd977 100644 --- a/src/PKPass.ts +++ b/src/PKPass.ts @@ -22,14 +22,6 @@ interface NamedBuffers { [key: string]: Buffer; } -namespace PKPass { - export interface Template { - model: string; - certificates: Schemas.Certificates; - overrides?: Schemas.OverridesSupportedOptions; - } -} - type TransitTypes = `PKTransitType${ | "Air" | "Boat" @@ -58,8 +50,8 @@ export default class PKPass extends Bundle { * @returns */ - static async from(source: PKPass | PKPass.Template): Promise { - let certificates: Schemas.Certificates = undefined; + static async from(source: PKPass | Schemas.Template): Promise { + let certificates: Schemas.CertificatesSchema = undefined; let buffers: NamedBuffers = undefined; if (!source) { diff --git a/src/schemas/index.ts b/src/schemas/index.ts index ec80339..ec480c9 100644 --- a/src/schemas/index.ts +++ b/src/schemas/index.ts @@ -78,15 +78,15 @@ export const CertificatesSchema = Joi.object() }) .required(); -export interface PassInstance { - model: PartitionedBundle; +export interface Template { + model: string; certificates: CertificatesSchema; overrides?: OverridesSupportedOptions; } -export const PassInstance = Joi.object().keys({ - model: Joi.alternatives(Joi.object(), Joi.string()).required(), - certificates: Joi.object(), +export const Template = Joi.object