iVendNextDevelopers Request a sandbox

7. Manifests — your own data, no code

What a manifest installs, as staff see it in Desk: the workspace, the bins and what is in each

What a manifest installs, as staff see it in Desk: a workspace, the bins on their aisles, and what is in each bin (sample S2).

A manifest is a file of data, not code. It adds your own record types, fields, screens, approvals or print formats to a customer's iVendNext. This chapter is for a developer whose app needs its own data inside the shop.

Reference implementation: Shipping your own data in a manifest · Approvals by workflow · the checker and installer ../tools/manifest/ · ../samples/s11_approvals/manifest.json (the permission example: copy its rows) · ../samples/s2_bins/manifest.json (five record types, a field on Item, a print format, a workspace, webhooks) · ../samples/s4_receipt_pack/ (a print format alone).

When to use it

Rung 4 of the ladder (chapter 3): configuration cannot hold your data and your app needs it inside the shop, so staff see it in Desk, a till key reads it or a webhook reports on it. A manifest is data. It runs nothing; your logic stays on your server (chapter 5) or in a till key (chapter 6). Every record type it declares gets the native Desk screens (chapter 13a).

Steps

  1. Choose your prefix: one to three upper-case words (PP BLN) and the matching app name (pp_bln). Every name you create starts with it. A field you add to one of the shop's own record types starts with the lower-case form (pp_bln_default_bin). Names on a site are shared and carry no owner, so the prefix is how an uninstall finds what is yours. (The samples' PP … prefixes are placeholders; there is no shared registry of prefixes yet, see the end of this chapter.)

  2. Write manifest.json. Set "manifest_version": 2; an earlier manifest still installs once every one of its permission rows writes all nine rights (step 3). The kinds it may carry:

    • record data: record types (never submittable; child tables allowed), fields, display tweaks, print formats, notifications, workspaces, sale details, webhooks;
    • screens: Report Builder reports, number cards, charts, dashboards, list settings, Connections links (your records listed under a shop record);
    • approvals and numbering: workflows and numbering rules, on your own record types only;
    • wiring: your event-feed registration and your remote till key, each installed switched off; the shop's administrator chooses the user and ticks them on;
    • extension points (below): your services' subscriptions, Desk actions, save rules and a fiscal reader, each installed switched off.

    The declarations of extension points that have not shipped (scan sources, receipt blocks, label layouts) are each refused, naming the extension point they wait on (chapter 9). Sandboxed modules are refused too (below).

  3. Write every right out: all nine (read, write, create, delete, report, export, share, print, email) on every permission row. A right you leave out is on: measured, a row written as read only came back with all nine rights on, because iVendFramework switches the rights a row does not mention on by default. So the checker refuses a row that leaves a right out, and a row that writes a right as anything but 0 or 1. samples/s11_approvals/manifest.json shows the form; the other sample manifests write all nine too.

  4. Check it yourself, before anyone installs it:

    python3 tools/manifest/validate.py samples/s2_bins/manifest.json      # VALID, exit 0
    

    Every refusal names the element and the reason, for example "REFUSED webhooks[0] (PP BLN Hook): a webhook may only call an address the manifest lists in allowed_urls".

  5. Install. Today we run the installer for you on the shop's server; it has no screen or command of its own yet. A manifest from an outside partner is also reviewed by a person before it is installed. The installer checks the manifest again, refuses names someone else holds, and records each element as it creates it. If anything fails half-way it removes what it made before it reports. Each webhook gets a fresh secret, handed to you once; a secret never goes in the manifest.

  6. Use your records over the record API, like any other type (chapter 5).

  7. Export before you uninstall. The installer refuses to uninstall without an export of every record of your types (child rows and your added field values included), unless the administrator says explicitly that none is wanted. Uninstall leaves nothing behind: it drops your tables and the columns your fields added (the shop's own delete keeps them), and removes what the shop did to your types after install. A sale detail that booked sales already use is kept, switched off, because a booked sale keeps its detail; a reinstall switches it on again. If any element cannot be removed, the uninstall says so, and running it again finishes the job. One exception: attachments, versions and comments on your records stay after an uninstall; the export holds the records themselves.

  8. A reinstall is clean: exactly the first install's schema, and none of the old data.

The extension points' kinds

Each record goes through the product's own checks when it is installed; a refusal there comes back in the product's words, and nothing is left. Each is installed switched off. The full contract of each extension point is in the extension-point library.

Worked example: an approval

A price-change request moving Requested, Approved, Applied, and the price row it changed

A requester asks for a new price, a manager approves it, and the partner's outside service applies it once; the shop's price row then reads the approved price (sample S11).

A request to change a price moves Requested → Approved → Applied on your own record type, by a native workflow: four states, four transitions, each allowed to one role, no transition condition, self-approval off (the installer writes it off; iVendFramework's own default is on), change tracking on. The workflow never submits, cancels or changes a price itself. The roles must exist in the shop before install: a manifest refuses a role the shop lacks. The rows to copy: the requester, the approver and the applier read and write (the requester also creates); System Manager reads, reports, exports and prints only. A state's "who may edit" is a screen rule: over the record API anyone with write can change a request in any state.

An outside service (chapter 5) applies an Approved request through the record API, once. Its key can write only that request type and price rows; a User Permission on Price List, applicable to Item Price only, fences it to its own lists.

The safeguards that matter are in the recipe. The shop does not stop an edit from anyone with write. So the service reads the request's change history and refuses to apply a request whose price changed at any time after it was raised, one approved by the person recorded as raising it, and one with ten or more recorded changes (the shop shows only the latest ten; measured). The approver can then Reject it from Approved. Two people per change holds only while no one holds both the requester's and the approver's role, and only for prices this service writes: any other role with write on price rows skips the approval.

What is refused, and why

Refused Why
a server script, a client script, a web page, a web template partner code in the shop's saves, in every user's browser, or on its public address
a submittable record type it would join the shop's accounts and stock
a field you add to a shop record type that is mandatory, read-only, hidden, unique, defaulted or length-limited; any change to the shop's own fields the server enforces these on every save, a till sale included
a webhook condition, or a notification, on a shop's own record type evaluated inside the shop's save: one mistake would stop every sale
a webhook to an address you did not list, or a secret in the manifest a webhook calls only addresses you declared
a custom workspace block, script in markup, a script print format, an HTML or button field, a display condition that runs code it runs in the browser of everyone who opens the page, administrators included
a required sale detail it would stop every sale on every till that does not fill it
a workflow transition condition, a state that submits or cancels, numbering the shop's own records (a sale's number included) code on the server, or fiscal ground
a single-record or tree record type, or a field on a shop's single-record type the installer makes and removes ordinary record types only
any name without your prefix; records open to visitors who are not signed in, or to a role the system hands out by itself (All, Desk User, Administrator) — and a notification sent to Guest or to one of those roles names carry no owner; a manifest's records are for the shop's own users, and a row for All would reach every signed-in user (a shop's website customers included), and one for Desk User every staff user, whatever roles the shop's administrator chose; a notification to one reaches whoever holds a stored row for it, refused so every place a role is named follows one rule
a permission row that leaves a right out, or writes one as anything but 0 or 1 a right left out is switched on, so every row says all nine
setting a till profile's receipt format that step is configuration (chapter 4)

Nothing leaves the shop that the shop did not grant. A webhook sends only its fixed thin body (record type, name, event, time) and you read the record with your own key. A print format loads nothing from outside the shop. A notification goes to the shop's own people and shows its own record's fields. The checker refuses the other channels. Its refusal is tested; the installer's change to always send the thin body has not yet been run on a test shop.

When your service is down, and when the till is offline

A manifest runs no code, and the rules above keep it out of the shop's own saves, so it cannot stop a sale. Its webhooks behave as every webhook does: three tries, then your reconciliation (chapter 5). A till key that reads your records works only online; the till dims it offline (per the till's own documentation; not run here).

Technical notes

Sources for the plain layer

What the kit has proven

What it has not

The pictures

See also

3. The ladder and the four rules · 4. Configure first · 5. Outside apps and the event feed · 9. The extension-point catalogue and requests · 13a. Screens and user experience

This page in the kit