passkit-generator
Advanced tools
Comparing version 3.1.6 to 3.1.7
@@ -12,3 +12,3 @@ import type PKPass from "./PKPass"; | ||
private [sharedKeysPoolSymbol]; | ||
constructor(passInstance: InstanceType<typeof PKPass>, keysPool: Set<string>, ...args: Schemas.Field[]); | ||
constructor(passInstance: InstanceType<typeof PKPass>, keysPool: Set<string>, fieldSchema: typeof Schemas.Field | typeof Schemas.FieldWithRow, ...args: Schemas.Field[]); | ||
push(...items: Schemas.Field[]): number; | ||
@@ -15,0 +15,0 @@ pop(): Schemas.Field; |
@@ -13,5 +13,7 @@ "use strict"; | ||
const sharedKeysPoolSymbol = Symbol("keysPool"); | ||
const fieldSchemaSymbol = Symbol("fieldSchema"); | ||
class FieldsArray extends Array { | ||
constructor(passInstance, keysPool, ...args) { | ||
constructor(passInstance, keysPool, fieldSchema, ...args) { | ||
super(...args); | ||
this[fieldSchemaSymbol] = fieldSchema; | ||
this[passInstanceSymbol] = passInstance; | ||
@@ -53,3 +55,3 @@ this[sharedKeysPoolSymbol] = keysPool; | ||
try { | ||
Schemas.assertValidity(Schemas.Field, field, Messages.FIELDS.INVALID); | ||
Schemas.assertValidity(instance[fieldSchemaSymbol], field, Messages.FIELDS.INVALID); | ||
if (instance[sharedKeysPoolSymbol].has(field.key)) { | ||
@@ -56,0 +58,0 @@ throw new TypeError(Messages.format(Messages.FIELDS.REPEATED_KEY, field.key)); |
@@ -105,4 +105,9 @@ /// <reference types="node" /> | ||
* set yet. | ||
* | ||
* For Typescript users: this signature allows | ||
* in any case to add the 'row' field, but on | ||
* runtime they are only allowed on "eventTicket" | ||
* passes. | ||
*/ | ||
get auxiliaryFields(): Schemas.Field[]; | ||
get auxiliaryFields(): Schemas.FieldWithRow[]; | ||
/** | ||
@@ -109,0 +114,0 @@ * Allows accessing to headerFields object |
@@ -209,2 +209,7 @@ "use strict"; | ||
* set yet. | ||
* | ||
* For Typescript users: this signature allows | ||
* in any case to add the 'row' field, but on | ||
* runtime they are only allowed on "eventTicket" | ||
* passes. | ||
*/ | ||
@@ -259,8 +264,8 @@ get auxiliaryFields() { | ||
this[exports.passTypeSymbol] = type; | ||
this[exports.propsSymbol][this[exports.passTypeSymbol]] = { | ||
headerFields /******/: new FieldsArray_1.default(this, sharedKeysPool), | ||
primaryFields /*****/: new FieldsArray_1.default(this, sharedKeysPool), | ||
secondaryFields /***/: new FieldsArray_1.default(this, sharedKeysPool), | ||
auxiliaryFields /***/: new FieldsArray_1.default(this, sharedKeysPool), | ||
backFields /********/: new FieldsArray_1.default(this, sharedKeysPool), | ||
this[exports.propsSymbol][type] = { | ||
headerFields /******/: new FieldsArray_1.default(this, sharedKeysPool, Schemas.Field), | ||
primaryFields /*****/: new FieldsArray_1.default(this, sharedKeysPool, Schemas.Field), | ||
secondaryFields /***/: new FieldsArray_1.default(this, sharedKeysPool, Schemas.Field), | ||
auxiliaryFields /***/: new FieldsArray_1.default(this, sharedKeysPool, type === "eventTicket" ? Schemas.FieldWithRow : Schemas.Field), | ||
backFields /********/: new FieldsArray_1.default(this, sharedKeysPool, Schemas.Field), | ||
transitType: undefined, | ||
@@ -267,0 +272,0 @@ }; |
@@ -22,2 +22,6 @@ import Joi from "joi"; | ||
} | ||
export interface FieldWithRow extends Field { | ||
row?: 0 | 1; | ||
} | ||
export declare const Field: Joi.ObjectSchema<Field>; | ||
export declare const FieldWithRow: Joi.ObjectSchema<Field>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Field = void 0; | ||
exports.FieldWithRow = exports.Field = void 0; | ||
const tslib_1 = require("tslib"); | ||
@@ -33,2 +33,5 @@ const joi_1 = tslib_1.__importDefault(require("joi")); | ||
}); | ||
exports.FieldWithRow = exports.Field.concat(joi_1.default.object().keys({ | ||
row: joi_1.default.number().min(0).max(1), | ||
})); | ||
//# sourceMappingURL=Field.js.map |
import Joi from "joi"; | ||
import { Field } from "./Field"; | ||
import { Field, FieldWithRow } from "./Field"; | ||
export declare type TransitType = "PKTransitTypeAir" | "PKTransitTypeBoat" | "PKTransitTypeBus" | "PKTransitTypeGeneric" | "PKTransitTypeTrain"; | ||
export declare const TransitType: Joi.StringSchema; | ||
export interface PassFields { | ||
auxiliaryFields: (Field & { | ||
row?: number; | ||
})[]; | ||
auxiliaryFields: FieldWithRow[]; | ||
backFields: Field[]; | ||
@@ -10,0 +8,0 @@ headerFields: Field[]; |
@@ -9,7 +9,3 @@ "use strict"; | ||
exports.PassFields = joi_1.default.object().keys({ | ||
auxiliaryFields: joi_1.default.array().items(joi_1.default.object() | ||
.keys({ | ||
row: joi_1.default.number().max(1).min(0), | ||
}) | ||
.concat(Field_1.Field)), | ||
auxiliaryFields: joi_1.default.array().items(Field_1.FieldWithRow), | ||
backFields: joi_1.default.array().items(Field_1.Field), | ||
@@ -16,0 +12,0 @@ headerFields: joi_1.default.array().items(Field_1.Field), |
{ | ||
"name": "passkit-generator", | ||
"version": "3.1.6", | ||
"version": "3.1.7", | ||
"description": "The easiest way to generate custom Apple Wallet passes in Node.js", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -67,5 +67,6 @@ <div align="center"> | ||
Following to this best practice, the package is set to require each folder-model to have a **_.pass_** extension. | ||
If omitted in the configuration (as in [Usage Example](#usage_example), at "model" key), it will be forcefully added. | ||
Following to this best practice, the package is set to **require** each folder-model to have a **_.pass_** extension. | ||
If omitted in the configuration (as in [Usage Example](#usage_example) below), it will be forcefully added, possibly resulting in a folder reading error, if your model folder doesn't have it. | ||
--- | ||
@@ -78,5 +79,5 @@ | ||
You can follow the [Apple Developer documentation](https://apple.co/2wuJLC1) (_Package Structure_) to build a correct pass model. The **icon is required** in order to make the pass work. Omitting an icon resolution, might make a pass work on a device (e.g. Mac) but not on another (e.g. iPhone). _Manifest.json_ and _signature_ will be automatically ignored from the model and generated in runtime. | ||
You can follow [_Create the Directory and add Files for the Pass_](https://apple.co/3zumjFI) at Apple Developer to build a correct pass model. The **icon is required** in order to make the pass work. Omitting an icon resolution, might make a pass work on a device (e.g. Mac) but not on another (e.g. iPhone). _Manifest.json_ and _signature_ will be automatically ignored from the model and generated in runtime. | ||
You can also create `.lproj` folders (e.g. _en.lproj_ or _it.lproj_) containing localized media. To include a folder or translate texts inside the pass, please refer to [Localizing Passes](./API.md#localizing-passes) in the API documentation. | ||
You can also create `.lproj` folders (e.g. _en.lproj_ or _it.lproj_) containing localized media. To include a folder or translate texts inside the pass, please refer to [Localizing Passes](https://github.com/alexandercerutti/passkit-generator/wiki/API-Documentation-Reference#localizing-passes) in the wiki API documentation. | ||
@@ -87,3 +88,3 @@ To include a file that belongs to an `.lproj` folder in buffers, you'll just have to name a key like `en.lproj/thumbnail.png`. | ||
Create a `pass.json` by taking example from examples folder models or the one provided by Apple for the [first tutorial](https://apple.co/2NA2nus) and fill it with the basic informations, that are `teamIdentifier`, `passTypeIdentifier` and all the other basic keys like pass type. Please refer to [Top-Level Keys/Standard Keys](https://apple.co/2PRfSnu) and [Top-Level Keys/Style Keys](https://apple.co/2wzyL5J). | ||
Create a `pass.json` by taking example from examples folder models or the one provided by Apple for the [first tutorial](https://apple.co/2NA2nus) and fill it with the basic informations, that are `teamIdentifier`, `passTypeIdentifier` and all the other basic keys like pass type. Please refer to [Pass interface documentation on Apple Developers](https://apple.co/3DeKKYA). | ||
@@ -90,0 +91,0 @@ ```json |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
111198
2603
258