Moved Template type to Schemas

This commit is contained in:
Alexander Cerutti
2021-09-27 00:32:58 +02:00
parent cabb0daab4
commit ac1c994b75
2 changed files with 8 additions and 16 deletions

View File

@@ -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<PKPass> {
let certificates: Schemas.Certificates = undefined;
static async from(source: PKPass | Schemas.Template): Promise<PKPass> {
let certificates: Schemas.CertificatesSchema = undefined;
let buffers: NamedBuffers = undefined;
if (!source) {

View File

@@ -78,15 +78,15 @@ export const CertificatesSchema = Joi.object<CertificatesSchema>()
})
.required();
export interface PassInstance {
model: PartitionedBundle;
export interface Template {
model: string;
certificates: CertificatesSchema;
overrides?: OverridesSupportedOptions;
}
export const PassInstance = Joi.object<PassInstance>().keys({
model: Joi.alternatives(Joi.object(), Joi.string()).required(),
certificates: Joi.object(),
export const Template = Joi.object<Template>({
model: Joi.string().required(),
certificates: Joi.object().required(),
overrides: Joi.object(),
});
@@ -181,7 +181,7 @@ type AvailableSchemas =
| typeof PassFields
| typeof Personalization
| typeof TransitType
| typeof PassInstance
| typeof Template
| typeof CertificatesSchema
| typeof OverridesSupportedOptions;