Aparté scripts
Reference of the Aparté ticket mapper script, extensions.aparte.ticket.mapper: registration, the MapFromAparte and GetPassType handlers and an example.
The Aparté connector turns each Aparté ticket into a pass. The ticket mapper script adjusts that work in two optional ways: it adds computed values to the data the pass template reads, and it chooses a pass type for a ticket. This page is the reference for extensions.aparte.ticket.mapper. The connector itself is described on the Aparté connector pages; the rules shared by every connector script are in Connector scripts.
The Aparté API is read-only for tickets, so the mapping goes one way, from the ticket to the pass.
Registration
Key
Slot file
Methods (required in bold)
extensions.aparte.ticket.mapper
aparte.ticket.mapper.js
MapFromAparte, GetPassType
The file sits in server/scripts/. The slot sits in the Advanced tab of the Aparté connector settings, and is read and written with GET and PUT /api/{tenantId}/admin/extensions/aparte/scripts. When no script is registered, the default mapping applies and the connector's default pass type is used. Installation tracking is built into the connector and needs no script.
export default function (context) {
context.register('extensions.aparte.ticket.mapper', {
MapFromAparte: (ticket, entity) => {},
GetPassType: async (ticket) => null
});
}When it runs
MapFromAparte runs when the connector fills the pass data from a ticket, after the default mapping. GetPassType runs when a ticket pass's metadata is updated and the ticket is read again: a non-empty name replaces the pass type and the change is logged. At creation, the connector's Default pass type is used and GetPassType is not called. When the ticket cannot be read and Invalid ticket pass type is set, the pass switches to that pass type instead.
Handlers
Both methods are optional: a method that is left out behaves as if it returned nothing.
MapFromAparte
ticket, entity
nothing
Optional
Synchronous
GetPassType
ticket
a promise of a pass type name, or of null
Optional
Asynchronous: declare it async
ticketis the Aparté ticket. Its members are the PascalCase names of the Aparté ticket, for exampleCategoryLabel,DoorLabel,RankandSeat. Its raw content is written on the pass data underdebug.aparte.ticket, which shows the exact member names before writing the script.entityis the pass data, a flat dictionary (see Data objects).MapFromAparteadds keys to it and the pass template reads them.GetPassTypereturns the name of a pass type of the tenant, ornull(or an empty string) to keep the current pass type.
Errors and edge cases
No script registered: the default mapping and the default pass type apply.
A method is missing: it is skipped, as both are optional.
GetPassTypereturns a name that is not a pass type of the tenant: the name is not checked and is set on the pass as is. Return only names of existing pass types.MapFromAparteis declaredasync: it is not awaited, so changes made after anawaitare lost.A script throws: the error is not caught. A throw in
MapFromApartefails the read of the ticket, and a throw inGetPassTypefails the pass update.
Example
Tickets whose category label is VIP go to the pass type vip-ticket. The script also adds a display label made of the door and the seat.
Common pitfalls
GetPassTypeis not declaredasync: the connector awaits a promise, so return one.A member name is typed from memory instead of being read in
debug.aparte.ticket.
Last updated

