Added fields and pool creation to PKPass

This commit is contained in:
Alexander Cerutti
2021-09-18 21:45:46 +02:00
parent cab8e08c3e
commit a970232623

View File

@@ -1,11 +1,21 @@
import { Certificates } from "../lib/schemas"; import FieldsArray from "../src/fieldsArray";
import { Certificates } from "../src/schemas";
import { default as Bundle, filesSymbol } from "./Bundle"; import { default as Bundle, filesSymbol } from "./Bundle";
const fieldKeysPoolSymbol = Symbol("fieldKeysPoolSymbol");
interface NamedBuffers { interface NamedBuffers {
[key: string]: Buffer; [key: string]: Buffer;
} }
export class PKPass extends Bundle { export class PKPass extends Bundle {
private [fieldKeysPoolSymbol] = new Set<string>();
public primaryFields /*****/ = new FieldsArray(this[fieldKeysPoolSymbol]);
public secondaryFields /***/ = new FieldsArray(this[fieldKeysPoolSymbol]);
public auxiliaryFields /***/ = new FieldsArray(this[fieldKeysPoolSymbol]);
public headerFields /******/ = new FieldsArray(this[fieldKeysPoolSymbol]);
public backFields /********/ = new FieldsArray(this[fieldKeysPoolSymbol]);
constructor(buffers: NamedBuffers, certificates: Certificates) { constructor(buffers: NamedBuffers, certificates: Certificates) {
super("application/vnd.apple.pkpass"); super("application/vnd.apple.pkpass");