@go-labs-sg/event-tech 1.21.0 → 1.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +73 -0
- package/command-reference.md +1 -0
- package/dist/index.js +198 -20
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -155,6 +155,10 @@ et passport redemption create --event-id <id> --participant-id <id> --prize-id <
|
|
|
155
155
|
et passport redemption create --event-id <id> --participant-id <id> --prize-id <id> --award-station-id <id> --request-id "$(uuidgen)"
|
|
156
156
|
et passport station upsert --event-id <id> --station-json '{"name":"Ring toss","collection":{"collectionMode":"STAFF_SCAN","stampValue":3,"category":"GAME"}}'
|
|
157
157
|
et passport station upsert --event-id <id> --station-json '{"name":"Desk basketball","collection":{"collectionMode":"STAFF_SCAN","category":"GAME","info":{"subtitle":"Game 4 · Desk basketball","steps":["Stand behind the line","Sink 3 shots"]}}}'
|
|
158
|
+
et passport station upsert --event-id <id> --station-json '{"name":"Food counter","collection":{"collectionMode":"STAFF_SCAN","category":"FOOD","menuItems":[{"name":"Laksa","stock":40},{"name":"Teh","stock":null}]}}'
|
|
159
|
+
et passport collect --event-id <id> --station-id <id> --profile-code <participant-code> --item Laksa
|
|
160
|
+
et passport menu-stock --event-id <id>
|
|
161
|
+
et passport menu-stock --event-id <id> --station-id <id> --site FAB10N
|
|
158
162
|
et passport station upsert --event-id <id> --station-json '{"name":"Food counter","collection":{"collectionMode":"STAFF_TALLY","tallyItems":["Laksa","Teh"],"tallyEarnsStamp":true}}'
|
|
159
163
|
et passport tally record --event-id <id> --station-id <id> --profile-code <participant-code> --item Laksa --quantity 2
|
|
160
164
|
et passport tally list --event-id <id> --station-id <id>
|
|
@@ -198,6 +202,15 @@ Station collection modes are `SELF_SCAN`, `STAFF_SCAN`, `STAFF_SCORE` and `STAFF
|
|
|
198
202
|
`collection.category` is `GAME`, `FOOD`, `DRINK` or `BINGO` (default `GAME`) and
|
|
199
203
|
groups stations for guests; the CLI rejects any other value before calling the API.
|
|
200
204
|
Omit either field on an existing station to keep the stored value.
|
|
205
|
+
`collection.showMyQr` is an optional boolean in every mode (default `true`).
|
|
206
|
+
Set it to `false` to hide the station sheet’s **Show my QR** button, including
|
|
207
|
+
the alternative at a self-scan station; the scan action stays available. Omit
|
|
208
|
+
it to preserve the stored value, or set `true` to show it again. It is independent
|
|
209
|
+
of `showHowToCollect` and the global passport QR.
|
|
210
|
+
|
|
211
|
+
`collection.showHowToCollect` is an optional boolean in every mode. It defaults to
|
|
212
|
+
`true`; set it to `false` for attendance stations to hide the guest sheet's
|
|
213
|
+
**How to collect** panel. Omission keeps the stored setting.
|
|
201
214
|
`collection.prizeDeskAward` (`true` or `false`, `SELF_SCAN` and `STAFF_SCAN` stations only, not
|
|
202
215
|
the Bingo category) lets prize-desk crew award this station's stamp with a prize redemption (see
|
|
203
216
|
below); omit it to keep the stored value, `false` turns it off, and a station that never set it
|
|
@@ -358,6 +371,66 @@ returns per-item totals; `tally list` returns a station's tallies; `export`
|
|
|
358
371
|
includes `tallies` and `tallySummary`. Plain `collect`, `claim` and rotating QR routes reject tally stations; only a manager stamp correction can add or remove the
|
|
359
372
|
station stamp there. Reversing a tally keeps the station stamp, and a revoked station stamp is not restored by later tallies. The CLI prints the server response unchanged.
|
|
360
373
|
|
|
374
|
+
Food and drink served as stamps use `STAFF_SCAN` on a `FOOD` or `DRINK` station.
|
|
375
|
+
Its optional `collection.menuItems` has 1 to 30 `{name,stock,siteStocks?}` entries;
|
|
376
|
+
names are trimmed, max 60 characters, and unique ignoring case. Stock is 0 to
|
|
377
|
+
2147483647 or `null` for unlimited. Omit `menuItems` to preserve the current menu
|
|
378
|
+
and use `null` to clear it.
|
|
379
|
+
|
|
380
|
+
`collection.collectionLimit` is `ONCE` (default, once per person per station,
|
|
381
|
+
across all buildings) or `UNLIMITED`. Omission preserves the stored limit.
|
|
382
|
+
Every deliberate `collect` records one serving and consumes one unit. Only the
|
|
383
|
+
first collection can award the station's configured stamp credit; repeats add
|
|
384
|
+
no credit or prize progress, including at stations with `stampValue: 0`.
|
|
385
|
+
`UNLIMITED` requires `--request-id <uuid>`: keep the same ID when retrying a lost
|
|
386
|
+
response, and use a fresh UUID for each new serving. Reusing an ID with a different
|
|
387
|
+
participant, item or site fails. A reversed collection keeps its UUID; retrying it
|
|
388
|
+
fails and a new serving requires a fresh UUID. Restoring a collection requires
|
|
389
|
+
its exact original item and site label, including casing. `ONCE` keeps the existing Already stamped response
|
|
390
|
+
for another give without consuming stock. These rules do not change
|
|
391
|
+
`STAFF_TALLY` or its independent `--quantity` workflow.
|
|
392
|
+
|
|
393
|
+
For building pools, give every menu item the same `siteStocks` site names (including casing), up to
|
|
394
|
+
30 sites (each name trimmed, max 60 characters, unique ignoring case). These
|
|
395
|
+
pools replace that item's single `stock` pool. Crew choose a building in the
|
|
396
|
+
station screen or follow a link ending in `?site=FAB10N`; `collect --site FAB10N`
|
|
397
|
+
uses only that building's stock. A site is required when pools are configured.
|
|
398
|
+
Guests see the combined remaining stock, while crew see their selected building.
|
|
399
|
+
`menu-stock` includes both totals and `siteStocks`; add `--site` to select one
|
|
400
|
+
building. Organizers use `--station-id` to read a station's stock without joining
|
|
401
|
+
as a guest; omitting it uses the existing participant-authorized stock read.
|
|
402
|
+
Set stock totals with `station upsert`; they are delivered quantities, not a
|
|
403
|
+
remaining-stock reset. Existing active consumption is always deducted.
|
|
404
|
+
|
|
405
|
+
```bash
|
|
406
|
+
et passport station upsert --event-id <id> --station-json '{"name":"SMASHED","collection":{"collectionMode":"STAFF_SCAN","category":"FOOD","stampValue":0,"collectionLimit":"UNLIMITED","menuItems":[{"name":"Beef Burger","stock":2300,"siteStocks":[{"site":"FAB10N","stock":1725},{"site":"FAB10A","stock":575}]}]}}'
|
|
407
|
+
et passport collect --event-id <id> --station-id <id> --profile-code <code> --item 'Beef Burger' --site FAB10N --request-id <uuid>
|
|
408
|
+
et passport stamp correct --event-id <id> --station-id <id> --participant-id <id> --stamped false --collection-id <collection-id> --reason 'Handed over in error' --allow-state-change --target <same-event-id>
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
`mine` and `participant detail` include active collection history. `stamps recipients`
|
|
412
|
+
adds `collectionId`, `item` and `site`; `tally summary` groups menu collections by
|
|
413
|
+
item and site, `tally list` includes individual collections, and `export` adds
|
|
414
|
+
`collections` with the building and reversal metadata. The web export has a
|
|
415
|
+
Collections CSV. Reverse one ledger serving with `stamp correct --stamped false
|
|
416
|
+
--collection-id <id>`; it returns that serving's stock. Undo an erroneous reversal with `--stamped true
|
|
417
|
+
--collection-id <id>`: the original item and building must have stock, and a
|
|
418
|
+
repeat serving restores no stamp credit. Do not supply item, site or points with
|
|
419
|
+
a collection ID. Legacy menu stamps still
|
|
420
|
+
appear once in stock/history and can be corrected through the existing stamp
|
|
421
|
+
workflow. Manager corrections that create a new menu collection also need `--site`
|
|
422
|
+
for building pools. Corrections cannot change an active collection's item.
|
|
423
|
+
|
|
424
|
+
Release prerequisite: apply the additive Event Tech schema before deploying the
|
|
425
|
+
new runtime (separate authorization). The ledger leaves the unique participant /
|
|
426
|
+
station stamp row intact. Do not enable building pools while unattributed legacy
|
|
427
|
+
consumption exists; the API rejects stock pool changes it cannot safely attribute.
|
|
428
|
+
Configure sites before service begins, or keep the original pool until existing
|
|
429
|
+
collections can be reconciled. Roll back to a runtime that understands the ledger
|
|
430
|
+
after taking collections: older runtimes cannot account for ledger-only repeats.
|
|
431
|
+
|
|
432
|
+
Menu names referenced by stamps or ledger collections are fixed, including case and reversed history. `station upsert` rejects renaming or individually removing those names. Unused items can still be renamed or removed, stock can be adjusted, and `menuItems: null` still clears the whole menu. Re-enabling a menu must include every name with stamp or collection history. For restores, omit `--item` to preserve the saved item, including historical null items. `participant detail` includes `correctionStamps: {stationId,item,revokedAt,station:{name}}[]` for all stamps, including those at archived stations; its existing `stamps` list remains active-only. The CLI prints both fields unchanged from the API. The organiser correction form retains historical station choices after revocation so archived stamps can be restored without reopening the station.
|
|
433
|
+
|
|
361
434
|
Bingo: `bingo enable` (manager) creates the hunt and a hidden Bingo station (stamp value 3 by default). The game's display name is that station's name (default "Human Bingo"); `bingo rename --name <name>` (manager, 1-100 characters, bingo must be enabled) changes it, and `bingo status` returns it as `name`, with the Bingo station's art as `station.imageUrl` (null without art) and its stamp value as `station.stampValue`. `bingo join`, `bingo status` and `bingo claim-stamp` act as the signed-in passport participant; `claim-stamp` is the catch-up for a completed card. Overview, participant detail and `export` report bingo joined, completed and stamp counts.
|
|
362
435
|
|
|
363
436
|
Staff roster: with `loginMethods.staffId` on, guests sign in with a Staff ID and,
|
package/command-reference.md
CHANGED
|
@@ -439,6 +439,7 @@ Run `et <command> --help` for the full input JSON Schema.
|
|
|
439
439
|
- `event.passport.joinPassport`: participant-only
|
|
440
440
|
- `event.passport.getMyPassport`: hand-written
|
|
441
441
|
- `event.passport.getMyPassportPrizeStock`: participant-only
|
|
442
|
+
- `event.passport.getMyPassportMenuStock`: hand-written
|
|
442
443
|
- `event.passport.getMyPassportCode`: participant-only
|
|
443
444
|
- `event.passport.getPassportParticipantDetail`: hand-written
|
|
444
445
|
- `event.passport.getPassportOverview`: hand-written
|
package/dist/index.js
CHANGED
|
@@ -19067,6 +19067,7 @@ Usage:
|
|
|
19067
19067
|
et lucky-draw participants list --event-id <id> [--page <n>] [--per-page <n>]
|
|
19068
19068
|
et passport overview --event-id <id>
|
|
19069
19069
|
et passport mine --event-id <id>
|
|
19070
|
+
et passport menu-stock --event-id <id> [--station-id <id>] [--site <building>] (guest stock; --station-id reads organizer stock; includes building pools)
|
|
19070
19071
|
et passport login-options --event-id <id>
|
|
19071
19072
|
et passport queue-status --event-id <id> (what guests see: enabled, staleMinutes and the crew-set waits in stations, plus defaultStatus and defaultStationIds for visible stations crew set none for, which read "< 10 mins"; overview gives each station's queueStatus and queueStatusDefault)
|
|
19072
19073
|
et passport bingo enable --event-id <id> (host: creates the hidden Bingo station and the HumanBingo)
|
|
@@ -19076,7 +19077,7 @@ Usage:
|
|
|
19076
19077
|
et passport bingo status --event-id <id> (guest: own bingo progress and stamp)
|
|
19077
19078
|
et passport export --event-id <id>
|
|
19078
19079
|
et passport settings update --event-id <id> --settings-json <json> (maxRedemptionsPerParticipant 0 = no cap; optional guestScan and simplifiedChinese true|false; optional staffIdLabel string|null; optional categoryLabels object|null; optional queueStatus true|false and queueStatusStaleMinutes 1-240|null)
|
|
19079
|
-
et passport station upsert --event-id <id> --station-json <json> (collection.stampValue 0-1000, default 1; collection.category GAME|FOOD|DRINK|BINGO, default GAME; collection.prizeDeskAward true|false on SELF_SCAN/STAFF_SCAN, default false)
|
|
19080
|
+
et passport station upsert --event-id <id> --station-json <json> (collection.stampValue 0-1000, default 1; collection.category GAME|FOOD|DRINK|BINGO, default GAME; collection.prizeDeskAward true|false on SELF_SCAN/STAFF_SCAN, default false; collection.showHowToCollect true|false and collection.showMyQr true|false, default true; collection.collectionLimit ONCE|UNLIMITED for food/drink menus, default ONCE)
|
|
19080
19081
|
et passport station-access get --event-id <id>
|
|
19081
19082
|
et passport station-access set-password --event-id <id> --password-stdin --allow-state-change --target <same-event-id> (password read from stdin; 6-128 chars; ends every station session)
|
|
19082
19083
|
et passport station-access clear-password --event-id <id> --allow-state-change --target <same-event-id> (turns station links off; ends every station session)
|
|
@@ -19097,11 +19098,11 @@ Usage:
|
|
|
19097
19098
|
et passport station print-revoke --event-id <id> --station-id <id> --expected-printed-qr-version <n> --allow-state-change --target <same-event-id>
|
|
19098
19099
|
et passport station start-qr --event-id <id> --station-id <id>
|
|
19099
19100
|
et passport station qr-status --event-id <id> --session-id <id>
|
|
19100
|
-
et passport collect --event-id <id> --station-id <id> --profile-code <code> [--points <n>]
|
|
19101
|
+
et passport collect --event-id <id> --station-id <id> --profile-code <code> [--points <n>] [--item <menu-item>] [--site <building>] [--request-id <uuid>]
|
|
19101
19102
|
et passport claim --event-id <id> --code <code>
|
|
19102
19103
|
et passport participant search --event-id <id> [--query <text>]
|
|
19103
19104
|
et passport participant detail --event-id <id> --participant-id <id>
|
|
19104
|
-
et passport stamp correct --event-id <id> --station-id <id> --participant-id <id> --stamped <true|false> --reason <text> [--points <n>] --allow-state-change --target <same-event-id>
|
|
19105
|
+
et passport stamp correct --event-id <id> --station-id <id> --participant-id <id> --stamped <true|false> --reason <text> [--points <n>] [--item <menu-item>] [--site <building>] [--collection-id <id>] --allow-state-change --target <same-event-id>
|
|
19105
19106
|
et passport prize upsert --event-id <id> --prize-json <json> (stampCost: stamps per unit, default 0; imageKey: omit keeps the photo, null clears it)
|
|
19106
19107
|
et passport prize image-set --event-id <id> --prize-id <id> --file <path> --content-type <image-mime>
|
|
19107
19108
|
et passport prize image-clear --event-id <id> --prize-id <id>
|
|
@@ -19125,6 +19126,10 @@ Event Passport:
|
|
|
19125
19126
|
Uses the same typed procedures and event permissions as the web app.
|
|
19126
19127
|
Station collection modes: SELF_SCAN, STAFF_SCAN, STAFF_SCORE, STAFF_TALLY.
|
|
19127
19128
|
STAFF_TALLY needs collection.tallyItems (1-30 unique names) and optional tallyEarnsStamp (default false).
|
|
19129
|
+
collection.showMyQr false hides the station sheet's Show my QR action (including the self-scan alternative); omit preserves the stored value (default true).
|
|
19130
|
+
collection.showHowToCollect false hides the guest instructions panel in any mode; omit preserves the stored value (default true).
|
|
19131
|
+
FOOD/DRINK STAFF_SCAN may set collection.menuItems to 1-30 {name,stock,siteStocks?} entries; names are unique ignoring case and surrounding whitespace, max 60 chars. stock is 0..2147483647 or null for unlimited; omit menuItems to preserve, null to clear. Optional siteStocks is [{site,stock}]; every item needs the same sites. Building pools replace the single pool, and collect requires --site for them.
|
|
19132
|
+
collection.collectionLimit ONCE (default) blocks a second collection per person across buildings; UNLIMITED allows repeats. Omit preserves the stored limit. Each new collection uses one unit; repeats add no stamp credit. collect --request-id <uuid> is required for UNLIMITED and must be reused for a retry; a new deliberate give needs a new UUID. stamp correct --stamped false --collection-id <id> reverses that specific collection and restores its unit; --stamped true with the same collection ID restores the serving from its original stock. Omit item/site/points with collection-id. mine, participant detail, tally list and export include collections with item and site.
|
|
19128
19133
|
Include collection.maxPoints only for STAFF_SCORE; zero is a valid score.
|
|
19129
19134
|
collection.category groups stations for guests: GAME, FOOD, DRINK or BINGO. Omit it to keep the stored one.
|
|
19130
19135
|
Omit collection on an existing station to preserve its current mode.
|
|
@@ -19847,6 +19852,49 @@ var PASSPORT_REDEMPTION_QUANTITY_MAX = 20;
|
|
|
19847
19852
|
var PASSPORT_TALLY_ITEMS_MAX = 30;
|
|
19848
19853
|
var PASSPORT_TALLY_ITEM_NAME_MAX = 60;
|
|
19849
19854
|
var PASSPORT_TALLY_QUANTITY_MAX = 20;
|
|
19855
|
+
var PASSPORT_MENU_STOCK_MAX = 2147483647;
|
|
19856
|
+
var passportMenuItemsSchema = array(object({
|
|
19857
|
+
name: string2().trim().min(1).max(PASSPORT_TALLY_ITEM_NAME_MAX),
|
|
19858
|
+
stock: number2().int().min(0).max(PASSPORT_MENU_STOCK_MAX).nullable(),
|
|
19859
|
+
siteStocks: array(object({
|
|
19860
|
+
site: string2().trim().min(1).max(60),
|
|
19861
|
+
stock: number2().int().min(0).max(PASSPORT_MENU_STOCK_MAX).nullable()
|
|
19862
|
+
}).strict()).max(30).optional()
|
|
19863
|
+
})).min(1).max(PASSPORT_TALLY_ITEMS_MAX).superRefine((items, context) => {
|
|
19864
|
+
const names = new Set;
|
|
19865
|
+
items.forEach((item, index) => {
|
|
19866
|
+
const name = item.name.toLocaleLowerCase();
|
|
19867
|
+
if (names.has(name))
|
|
19868
|
+
context.addIssue({
|
|
19869
|
+
code: "custom",
|
|
19870
|
+
path: [index, "name"],
|
|
19871
|
+
message: "Menu item names must be unique."
|
|
19872
|
+
});
|
|
19873
|
+
names.add(name);
|
|
19874
|
+
const sites = (item.siteStocks ?? []).map((row) => row.site.toLowerCase());
|
|
19875
|
+
const expected = (items[0]?.siteStocks ?? []).map((row) => row.site).sort();
|
|
19876
|
+
if (new Set(sites).size !== sites.length || JSON.stringify((item.siteStocks ?? []).map((row) => row.site).sort()) !== JSON.stringify(expected))
|
|
19877
|
+
context.addIssue({
|
|
19878
|
+
code: "custom",
|
|
19879
|
+
path: [index, "siteStocks"],
|
|
19880
|
+
message: "Every menu item must use the same site names and casing; site names must be unique ignoring case."
|
|
19881
|
+
});
|
|
19882
|
+
});
|
|
19883
|
+
});
|
|
19884
|
+
var validateMenuCollection = (config, context) => {
|
|
19885
|
+
if (config.collectionLimit !== undefined && (!config.menuItems?.length || config.collectionMode !== "STAFF_SCAN" || !["FOOD", "DRINK"].includes(config.category ?? "GAME")))
|
|
19886
|
+
context.addIssue({
|
|
19887
|
+
code: "custom",
|
|
19888
|
+
path: ["collectionLimit"],
|
|
19889
|
+
message: "Collection limits require a FOOD or DRINK staff-scan menu station."
|
|
19890
|
+
});
|
|
19891
|
+
if (config.menuItems && (config.collectionMode !== "STAFF_SCAN" || config.prizeDeskAward))
|
|
19892
|
+
context.addIssue({
|
|
19893
|
+
code: "custom",
|
|
19894
|
+
path: ["menuItems"],
|
|
19895
|
+
message: "Menu items require staff-scan collection without prize-desk awards."
|
|
19896
|
+
});
|
|
19897
|
+
};
|
|
19850
19898
|
var stampValueSchema = number2().int().min(0).max(PASSPORT_STAMP_VALUE_MAX);
|
|
19851
19899
|
var PASSPORT_STATION_CATEGORIES = [
|
|
19852
19900
|
"GAME",
|
|
@@ -19979,9 +20027,14 @@ var passportStationConfigSchema = object({
|
|
|
19979
20027
|
category: passportStationCategorySchema.optional(),
|
|
19980
20028
|
tallyItems: passportTallyItemsSchema.optional(),
|
|
19981
20029
|
tallyEarnsStamp: boolean2().optional(),
|
|
20030
|
+
menuItems: passportMenuItemsSchema.optional(),
|
|
20031
|
+
showHowToCollect: boolean2().optional(),
|
|
20032
|
+
showMyQr: boolean2().optional(),
|
|
20033
|
+
collectionLimit: _enum(["ONCE", "UNLIMITED"]).optional(),
|
|
19982
20034
|
prizeDeskAward: boolean2().optional(),
|
|
19983
20035
|
info: passportStationInfoSchema.optional().catch(undefined)
|
|
19984
20036
|
}).superRefine((config, context) => {
|
|
20037
|
+
validateMenuCollection(config, context);
|
|
19985
20038
|
const tally = config.collectionMode === "STAFF_TALLY";
|
|
19986
20039
|
if (tally && !config.tallyItems) {
|
|
19987
20040
|
context.addIssue({
|
|
@@ -20030,6 +20083,8 @@ var passportStationConfigSchema = object({
|
|
|
20030
20083
|
});
|
|
20031
20084
|
var passportStationCollectionSchema = discriminatedUnion("collectionMode", [
|
|
20032
20085
|
object({
|
|
20086
|
+
showHowToCollect: boolean2().optional(),
|
|
20087
|
+
showMyQr: boolean2().optional(),
|
|
20033
20088
|
collectionMode: literal("SELF_SCAN"),
|
|
20034
20089
|
stampValue: stampValueSchema.optional(),
|
|
20035
20090
|
category: passportStationCategorySchema.optional(),
|
|
@@ -20037,13 +20092,19 @@ var passportStationCollectionSchema = discriminatedUnion("collectionMode", [
|
|
|
20037
20092
|
info: passportStationInfoInputSchema.optional()
|
|
20038
20093
|
}).strict(),
|
|
20039
20094
|
object({
|
|
20095
|
+
showHowToCollect: boolean2().optional(),
|
|
20096
|
+
showMyQr: boolean2().optional(),
|
|
20040
20097
|
collectionMode: literal("STAFF_SCAN"),
|
|
20098
|
+
menuItems: passportMenuItemsSchema.nullable().optional(),
|
|
20099
|
+
collectionLimit: _enum(["ONCE", "UNLIMITED"]).optional(),
|
|
20041
20100
|
stampValue: stampValueSchema.optional(),
|
|
20042
20101
|
category: passportStationCategorySchema.optional(),
|
|
20043
20102
|
prizeDeskAward: boolean2().optional(),
|
|
20044
20103
|
info: passportStationInfoInputSchema.optional()
|
|
20045
20104
|
}).strict(),
|
|
20046
20105
|
object({
|
|
20106
|
+
showHowToCollect: boolean2().optional(),
|
|
20107
|
+
showMyQr: boolean2().optional(),
|
|
20047
20108
|
collectionMode: literal("STAFF_SCORE"),
|
|
20048
20109
|
maxPoints: pointsSchema,
|
|
20049
20110
|
stampValue: stampValueSchema.optional(),
|
|
@@ -20051,6 +20112,8 @@ var passportStationCollectionSchema = discriminatedUnion("collectionMode", [
|
|
|
20051
20112
|
info: passportStationInfoInputSchema.optional()
|
|
20052
20113
|
}).strict(),
|
|
20053
20114
|
object({
|
|
20115
|
+
showHowToCollect: boolean2().optional(),
|
|
20116
|
+
showMyQr: boolean2().optional(),
|
|
20054
20117
|
collectionMode: literal("STAFF_TALLY"),
|
|
20055
20118
|
tallyItems: passportTallyItemsSchema,
|
|
20056
20119
|
tallyEarnsStamp: boolean2().default(false),
|
|
@@ -20071,7 +20134,10 @@ var passportPrintQrMutationSchema = passportStationIdSchema.extend({
|
|
|
20071
20134
|
});
|
|
20072
20135
|
var collectPassportStampByStaffSchema = passportStationIdSchema.extend({
|
|
20073
20136
|
profileCode: string2().min(1).max(2048),
|
|
20074
|
-
|
|
20137
|
+
site: string2().trim().min(1).max(60).optional(),
|
|
20138
|
+
requestId: uuid2().optional(),
|
|
20139
|
+
points: pointsSchema.optional(),
|
|
20140
|
+
item: string2().trim().min(1).max(PASSPORT_TALLY_ITEM_NAME_MAX).optional()
|
|
20075
20141
|
});
|
|
20076
20142
|
var recordPassportTallySchema = passportStationIdSchema.extend({
|
|
20077
20143
|
profileCode: string2().min(1).max(2048),
|
|
@@ -20084,9 +20150,12 @@ var reversePassportTallySchema = passportEventIdSchema.extend({
|
|
|
20084
20150
|
});
|
|
20085
20151
|
var correctPassportStampSchema = passportStationIdSchema.extend({
|
|
20086
20152
|
participantId: string2().min(1),
|
|
20153
|
+
collectionId: string2().min(1).optional(),
|
|
20154
|
+
site: string2().trim().min(1).max(60).optional(),
|
|
20087
20155
|
stamped: boolean2(),
|
|
20088
20156
|
reason: string2().trim().min(1).max(500),
|
|
20089
|
-
points: pointsSchema.optional()
|
|
20157
|
+
points: pointsSchema.optional(),
|
|
20158
|
+
item: string2().trim().min(1).max(PASSPORT_TALLY_ITEM_NAME_MAX).optional()
|
|
20090
20159
|
});
|
|
20091
20160
|
var beginPassportAccountLinkSchema = discriminatedUnion("method", [
|
|
20092
20161
|
passportEventIdSchema.extend({
|
|
@@ -20284,9 +20353,13 @@ var signInToStationStaffSchema = passportEventIdSchema.extend({ password: string
|
|
|
20284
20353
|
var setPassportStationPasswordSchema = passportEventIdSchema.extend({ password: stationStaffPasswordSchema }).strict();
|
|
20285
20354
|
var participantCodeSchema = string2().min(1).max(2048);
|
|
20286
20355
|
var stationStaffParticipantSchema = union([
|
|
20287
|
-
passportStationIdSchema.extend({ profileCode: participantCodeSchema }),
|
|
20288
20356
|
passportStationIdSchema.extend({
|
|
20289
|
-
|
|
20357
|
+
profileCode: participantCodeSchema,
|
|
20358
|
+
site: string2().trim().min(1).max(60).optional()
|
|
20359
|
+
}),
|
|
20360
|
+
passportStationIdSchema.extend({
|
|
20361
|
+
staffId: string2().trim().min(1).max(PASSPORT_ROSTER_STAFF_ID_MAX),
|
|
20362
|
+
site: string2().trim().min(1).max(60).optional()
|
|
20290
20363
|
})
|
|
20291
20364
|
]);
|
|
20292
20365
|
var stationPrizeClaimParticipantSchema = union([
|
|
@@ -20789,6 +20862,8 @@ var date4 = (value, name) => {
|
|
|
20789
20862
|
var parseStaffTallyCollection = (item, extras) => {
|
|
20790
20863
|
keys(item, [
|
|
20791
20864
|
"collectionMode",
|
|
20865
|
+
"showHowToCollect",
|
|
20866
|
+
"showMyQr",
|
|
20792
20867
|
"tallyItems",
|
|
20793
20868
|
"tallyEarnsStamp",
|
|
20794
20869
|
"stampValue",
|
|
@@ -20811,13 +20886,76 @@ var parseStaffTallyCollection = (item, extras) => {
|
|
|
20811
20886
|
...extras
|
|
20812
20887
|
};
|
|
20813
20888
|
};
|
|
20889
|
+
var parseStaffScanCollection = (item, extras) => {
|
|
20890
|
+
keys(item, [
|
|
20891
|
+
"collectionMode",
|
|
20892
|
+
"stampValue",
|
|
20893
|
+
"category",
|
|
20894
|
+
"prizeDeskAward",
|
|
20895
|
+
"showHowToCollect",
|
|
20896
|
+
"showMyQr",
|
|
20897
|
+
"collectionLimit",
|
|
20898
|
+
"menuItems",
|
|
20899
|
+
"info"
|
|
20900
|
+
], "collection");
|
|
20901
|
+
if (item.collectionMode !== "STAFF_SCAN" && (item.menuItems !== undefined || item.collectionLimit !== undefined))
|
|
20902
|
+
throw new CliUsageError("Only STAFF_SCAN stations can configure menuItems or collectionLimit.");
|
|
20903
|
+
if (item.prizeDeskAward !== undefined && typeof item.prizeDeskAward !== "boolean")
|
|
20904
|
+
throw new CliUsageError("prizeDeskAward must be true or false.");
|
|
20905
|
+
if (item.collectionLimit !== undefined && item.collectionLimit !== "ONCE" && item.collectionLimit !== "UNLIMITED")
|
|
20906
|
+
throw new CliUsageError("collectionLimit must be ONCE or UNLIMITED.");
|
|
20907
|
+
return {
|
|
20908
|
+
collectionMode: item.collectionMode,
|
|
20909
|
+
...item.collectionLimit === undefined ? {} : { collectionLimit: item.collectionLimit },
|
|
20910
|
+
...item.menuItems === undefined ? {} : {
|
|
20911
|
+
menuItems: item.menuItems === null ? null : parseStaffScanMenuItems(item.menuItems)
|
|
20912
|
+
},
|
|
20913
|
+
...extras,
|
|
20914
|
+
...item.prizeDeskAward === undefined ? {} : { prizeDeskAward: item.prizeDeskAward }
|
|
20915
|
+
};
|
|
20916
|
+
};
|
|
20917
|
+
var parseStaffScanMenuItems = (value) => {
|
|
20918
|
+
if (!Array.isArray(value))
|
|
20919
|
+
throw new CliUsageError("menuItems must be an array of menu item objects.");
|
|
20920
|
+
if (value.length < 1 || value.length > 30)
|
|
20921
|
+
throw new CliUsageError("menuItems must have 1 to 30 items.");
|
|
20922
|
+
const menuItems = value.map((raw, index) => {
|
|
20923
|
+
const item = object2(raw, `menuItems[${index}]`);
|
|
20924
|
+
keys(item, ["name", "stock", "siteStocks"], `menuItems[${index}]`);
|
|
20925
|
+
return {
|
|
20926
|
+
name: text(item.name, `menuItems[${index}].name`, 60),
|
|
20927
|
+
...item.siteStocks === undefined ? {} : { siteStocks: item.siteStocks },
|
|
20928
|
+
stock: item.stock === null ? null : integer2(item.stock, `menuItems[${index}].stock`)
|
|
20929
|
+
};
|
|
20930
|
+
});
|
|
20931
|
+
if (new Set(menuItems.map(({ name }) => name.trim().toLocaleLowerCase())).size !== menuItems.length)
|
|
20932
|
+
throw new CliUsageError("menuItems names must be unique ignoring case and surrounding whitespace.");
|
|
20933
|
+
const parsed = passportMenuItemsSchema.safeParse(menuItems);
|
|
20934
|
+
if (!parsed.success)
|
|
20935
|
+
throw new CliUsageError(`menuItems is invalid: ${parsed.error.issues.map((issue) => `${issue.path.join(".")} ${issue.message}`).join("; ")}`);
|
|
20936
|
+
return parsed.data;
|
|
20937
|
+
};
|
|
20814
20938
|
var parsePassportCollection = (raw) => {
|
|
20815
20939
|
const item = object2(raw, "collection");
|
|
20816
20940
|
const stampValue = item.stampValue === undefined ? {} : { stampValue: integer2(item.stampValue, "stampValue", 0, 1000) };
|
|
20817
20941
|
const category = item.category === undefined ? {} : { category: stationCategory(item.category) };
|
|
20818
|
-
const info =
|
|
20942
|
+
const info = {
|
|
20943
|
+
...item.showMyQr === undefined ? {} : { showMyQr: boolean4(item.showMyQr, "showMyQr") },
|
|
20944
|
+
...item.info === undefined ? {} : { info: stationInfo(item.info) },
|
|
20945
|
+
...item.showHowToCollect === undefined ? {} : {
|
|
20946
|
+
showHowToCollect: boolean4(item.showHowToCollect, "showHowToCollect")
|
|
20947
|
+
}
|
|
20948
|
+
};
|
|
20819
20949
|
if (item.collectionMode === "STAFF_SCORE") {
|
|
20820
|
-
keys(item, [
|
|
20950
|
+
keys(item, [
|
|
20951
|
+
"collectionMode",
|
|
20952
|
+
"maxPoints",
|
|
20953
|
+
"stampValue",
|
|
20954
|
+
"category",
|
|
20955
|
+
"info",
|
|
20956
|
+
"showHowToCollect",
|
|
20957
|
+
"showMyQr"
|
|
20958
|
+
], "collection");
|
|
20821
20959
|
return {
|
|
20822
20960
|
collectionMode: "STAFF_SCORE",
|
|
20823
20961
|
maxPoints: integer2(item.maxPoints, "maxPoints"),
|
|
@@ -20834,16 +20972,11 @@ var parsePassportCollection = (raw) => {
|
|
|
20834
20972
|
});
|
|
20835
20973
|
}
|
|
20836
20974
|
if (item.collectionMode === "SELF_SCAN" || item.collectionMode === "STAFF_SCAN") {
|
|
20837
|
-
|
|
20838
|
-
if (item.prizeDeskAward !== undefined && typeof item.prizeDeskAward !== "boolean")
|
|
20839
|
-
throw new CliUsageError("prizeDeskAward must be true or false.");
|
|
20840
|
-
return {
|
|
20841
|
-
collectionMode: item.collectionMode,
|
|
20975
|
+
return parseStaffScanCollection(item, {
|
|
20842
20976
|
...stampValue,
|
|
20843
20977
|
...category,
|
|
20844
|
-
...item.prizeDeskAward === undefined ? {} : { prizeDeskAward: item.prizeDeskAward },
|
|
20845
20978
|
...info
|
|
20846
|
-
};
|
|
20979
|
+
});
|
|
20847
20980
|
}
|
|
20848
20981
|
throw new CliUsageError("collectionMode must be SELF_SCAN, STAFF_SCAN, STAFF_SCORE or STAFF_TALLY.");
|
|
20849
20982
|
};
|
|
@@ -21110,6 +21243,38 @@ var runPassportCommand = async (input) => {
|
|
|
21110
21243
|
case "mine":
|
|
21111
21244
|
operation = () => api2.event.passport.getMyPassport.query(event);
|
|
21112
21245
|
break;
|
|
21246
|
+
case "menu-stock": {
|
|
21247
|
+
allowed.push("station-id", "site");
|
|
21248
|
+
const stationId = flag(flags, "station-id", false);
|
|
21249
|
+
const site = flag(flags, "site", false);
|
|
21250
|
+
operation = async () => {
|
|
21251
|
+
const rows = stationId === undefined ? await api2.event.passport.getMyPassportMenuStock.query(event) : (await api2.event.passport.getPassportOverview.query(event)).stations.filter((row) => row.id === stationId).map((row) => ({
|
|
21252
|
+
stationId: row.id,
|
|
21253
|
+
menuStock: row.menuStock
|
|
21254
|
+
}));
|
|
21255
|
+
if (stationId !== undefined && !rows.length)
|
|
21256
|
+
throw new CliUsageError("No station with that ID exists in this passport.");
|
|
21257
|
+
if (site === undefined)
|
|
21258
|
+
return rows;
|
|
21259
|
+
const selected = rows.flatMap((row) => {
|
|
21260
|
+
const menuStock = row.menuStock.flatMap((item) => {
|
|
21261
|
+
const stock = item.siteStocks?.find((value) => value.site.toLocaleLowerCase() === site.trim().toLocaleLowerCase());
|
|
21262
|
+
return stock ? [
|
|
21263
|
+
{
|
|
21264
|
+
...item,
|
|
21265
|
+
stock: stock.stock,
|
|
21266
|
+
remainingStock: stock.remainingStock
|
|
21267
|
+
}
|
|
21268
|
+
] : [];
|
|
21269
|
+
});
|
|
21270
|
+
return menuStock.length ? [{ ...row, site, menuStock }] : [];
|
|
21271
|
+
});
|
|
21272
|
+
if (!selected.length)
|
|
21273
|
+
throw new CliUsageError("No menu stock is configured for that site.");
|
|
21274
|
+
return selected;
|
|
21275
|
+
};
|
|
21276
|
+
break;
|
|
21277
|
+
}
|
|
21113
21278
|
case "bingo enable":
|
|
21114
21279
|
operation = () => api2.event.passport.enablePassportBingo.mutate(event);
|
|
21115
21280
|
break;
|
|
@@ -21207,12 +21372,21 @@ var runPassportCommand = async (input) => {
|
|
|
21207
21372
|
break;
|
|
21208
21373
|
}
|
|
21209
21374
|
case "collect": {
|
|
21210
|
-
allowed.push("station-id", "profile-code", "points");
|
|
21375
|
+
allowed.push("station-id", "profile-code", "points", "item", "site", "request-id");
|
|
21211
21376
|
const points = flag(flags, "points", false);
|
|
21377
|
+
const item = flag(flags, "item", false);
|
|
21212
21378
|
const payload = {
|
|
21213
21379
|
...station(),
|
|
21214
21380
|
profileCode: requiredFlag(flags, "profile-code"),
|
|
21215
|
-
...optionalEntry("
|
|
21381
|
+
...optionalEntry("site", flag(flags, "site", false), (raw) => text(raw, "--site", 60)),
|
|
21382
|
+
...optionalEntry("requestId", flag(flags, "request-id", false), (raw) => {
|
|
21383
|
+
const parsed = passportRedemptionRequestIdSchema.safeParse(raw);
|
|
21384
|
+
if (!parsed.success)
|
|
21385
|
+
throw new CliUsageError("--request-id must be a UUID.");
|
|
21386
|
+
return parsed.data;
|
|
21387
|
+
}),
|
|
21388
|
+
...optionalEntry("points", points, (raw) => integer2(raw, "--points")),
|
|
21389
|
+
...optionalEntry("item", item, (raw) => text(raw, "--item", 60))
|
|
21216
21390
|
};
|
|
21217
21391
|
operation = () => api2.event.passport.collectPassportStampByStaff.mutate(payload);
|
|
21218
21392
|
break;
|
|
@@ -21224,15 +21398,19 @@ var runPassportCommand = async (input) => {
|
|
|
21224
21398
|
break;
|
|
21225
21399
|
}
|
|
21226
21400
|
case "stamp correct": {
|
|
21227
|
-
allowed.push("station-id", "participant-id", "stamped", "reason", "points");
|
|
21401
|
+
allowed.push("station-id", "participant-id", "stamped", "reason", "points", "item", "collection-id", "site");
|
|
21228
21402
|
confirm();
|
|
21229
21403
|
const points = flag(flags, "points", false);
|
|
21404
|
+
const item = flag(flags, "item", false);
|
|
21230
21405
|
const payload = {
|
|
21231
21406
|
...station(),
|
|
21232
21407
|
participantId: requiredFlag(flags, "participant-id"),
|
|
21408
|
+
...optionalEntry("collectionId", flag(flags, "collection-id", false), (raw) => text(raw, "--collection-id", 200)),
|
|
21409
|
+
...optionalEntry("site", flag(flags, "site", false), (raw) => text(raw, "--site", 60)),
|
|
21233
21410
|
stamped: boolean4(requiredFlag(flags, "stamped"), "--stamped"),
|
|
21234
21411
|
reason: requiredFlag(flags, "reason"),
|
|
21235
|
-
...optionalEntry("points", points, (raw) => integer2(raw, "--points"))
|
|
21412
|
+
...optionalEntry("points", points, (raw) => integer2(raw, "--points")),
|
|
21413
|
+
...optionalEntry("item", item, (raw) => text(raw, "--item", 60))
|
|
21236
21414
|
};
|
|
21237
21415
|
operation = () => api2.event.passport.correctPassportStamp.mutate(payload);
|
|
21238
21416
|
break;
|