@go-labs-sg/event-tech 1.22.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 +69 -1
- package/dist/index.js +123 -18
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -158,6 +158,7 @@ et passport station upsert --event-id <id> --station-json '{"name":"Desk basketb
|
|
|
158
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
159
|
et passport collect --event-id <id> --station-id <id> --profile-code <participant-code> --item Laksa
|
|
160
160
|
et passport menu-stock --event-id <id>
|
|
161
|
+
et passport menu-stock --event-id <id> --station-id <id> --site FAB10N
|
|
161
162
|
et passport station upsert --event-id <id> --station-json '{"name":"Food counter","collection":{"collectionMode":"STAFF_TALLY","tallyItems":["Laksa","Teh"],"tallyEarnsStamp":true}}'
|
|
162
163
|
et passport tally record --event-id <id> --station-id <id> --profile-code <participant-code> --item Laksa --quantity 2
|
|
163
164
|
et passport tally list --event-id <id> --station-id <id>
|
|
@@ -201,6 +202,15 @@ Station collection modes are `SELF_SCAN`, `STAFF_SCAN`, `STAFF_SCORE` and `STAFF
|
|
|
201
202
|
`collection.category` is `GAME`, `FOOD`, `DRINK` or `BINGO` (default `GAME`) and
|
|
202
203
|
groups stations for guests; the CLI rejects any other value before calling the API.
|
|
203
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.
|
|
204
214
|
`collection.prizeDeskAward` (`true` or `false`, `SELF_SCAN` and `STAFF_SCAN` stations only, not
|
|
205
215
|
the Bingo category) lets prize-desk crew award this station's stamp with a prize redemption (see
|
|
206
216
|
below); omit it to keep the stored value, `false` turns it off, and a station that never set it
|
|
@@ -361,7 +371,65 @@ returns per-item totals; `tally list` returns a station's tallies; `export`
|
|
|
361
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
|
|
362
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.
|
|
363
373
|
|
|
364
|
-
Food and drink served as stamps use `STAFF_SCAN` on a `FOOD` or `DRINK` station.
|
|
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.
|
|
365
433
|
|
|
366
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.
|
|
367
435
|
|
package/dist/index.js
CHANGED
|
@@ -19067,7 +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> (
|
|
19070
|
+
et passport menu-stock --event-id <id> [--station-id <id>] [--site <building>] (guest stock; --station-id reads organizer stock; includes building pools)
|
|
19071
19071
|
et passport login-options --event-id <id>
|
|
19072
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)
|
|
19073
19073
|
et passport bingo enable --event-id <id> (host: creates the hidden Bingo station and the HumanBingo)
|
|
@@ -19077,7 +19077,7 @@ Usage:
|
|
|
19077
19077
|
et passport bingo status --event-id <id> (guest: own bingo progress and stamp)
|
|
19078
19078
|
et passport export --event-id <id>
|
|
19079
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)
|
|
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)
|
|
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)
|
|
19081
19081
|
et passport station-access get --event-id <id>
|
|
19082
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)
|
|
19083
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)
|
|
@@ -19098,11 +19098,11 @@ Usage:
|
|
|
19098
19098
|
et passport station print-revoke --event-id <id> --station-id <id> --expected-printed-qr-version <n> --allow-state-change --target <same-event-id>
|
|
19099
19099
|
et passport station start-qr --event-id <id> --station-id <id>
|
|
19100
19100
|
et passport station qr-status --event-id <id> --session-id <id>
|
|
19101
|
-
et passport collect --event-id <id> --station-id <id> --profile-code <code> [--points <n>] [--item <menu-item>]
|
|
19101
|
+
et passport collect --event-id <id> --station-id <id> --profile-code <code> [--points <n>] [--item <menu-item>] [--site <building>] [--request-id <uuid>]
|
|
19102
19102
|
et passport claim --event-id <id> --code <code>
|
|
19103
19103
|
et passport participant search --event-id <id> [--query <text>]
|
|
19104
19104
|
et passport participant detail --event-id <id> --participant-id <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>] --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>
|
|
19106
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)
|
|
19107
19107
|
et passport prize image-set --event-id <id> --prize-id <id> --file <path> --content-type <image-mime>
|
|
19108
19108
|
et passport prize image-clear --event-id <id> --prize-id <id>
|
|
@@ -19126,7 +19126,10 @@ Event Passport:
|
|
|
19126
19126
|
Uses the same typed procedures and event permissions as the web app.
|
|
19127
19127
|
Station collection modes: SELF_SCAN, STAFF_SCAN, STAFF_SCORE, STAFF_TALLY.
|
|
19128
19128
|
STAFF_TALLY needs collection.tallyItems (1-30 unique names) and optional tallyEarnsStamp (default false).
|
|
19129
|
-
|
|
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.
|
|
19130
19133
|
Include collection.maxPoints only for STAFF_SCORE; zero is a valid score.
|
|
19131
19134
|
collection.category groups stations for guests: GAME, FOOD, DRINK or BINGO. Omit it to keep the stored one.
|
|
19132
19135
|
Omit collection on an existing station to preserve its current mode.
|
|
@@ -19852,7 +19855,11 @@ var PASSPORT_TALLY_QUANTITY_MAX = 20;
|
|
|
19852
19855
|
var PASSPORT_MENU_STOCK_MAX = 2147483647;
|
|
19853
19856
|
var passportMenuItemsSchema = array(object({
|
|
19854
19857
|
name: string2().trim().min(1).max(PASSPORT_TALLY_ITEM_NAME_MAX),
|
|
19855
|
-
stock: number2().int().min(0).max(PASSPORT_MENU_STOCK_MAX).nullable()
|
|
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()
|
|
19856
19863
|
})).min(1).max(PASSPORT_TALLY_ITEMS_MAX).superRefine((items, context) => {
|
|
19857
19864
|
const names = new Set;
|
|
19858
19865
|
items.forEach((item, index) => {
|
|
@@ -19864,9 +19871,23 @@ var passportMenuItemsSchema = array(object({
|
|
|
19864
19871
|
message: "Menu item names must be unique."
|
|
19865
19872
|
});
|
|
19866
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
|
+
});
|
|
19867
19882
|
});
|
|
19868
19883
|
});
|
|
19869
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
|
+
});
|
|
19870
19891
|
if (config.menuItems && (config.collectionMode !== "STAFF_SCAN" || config.prizeDeskAward))
|
|
19871
19892
|
context.addIssue({
|
|
19872
19893
|
code: "custom",
|
|
@@ -20007,6 +20028,9 @@ var passportStationConfigSchema = object({
|
|
|
20007
20028
|
tallyItems: passportTallyItemsSchema.optional(),
|
|
20008
20029
|
tallyEarnsStamp: boolean2().optional(),
|
|
20009
20030
|
menuItems: passportMenuItemsSchema.optional(),
|
|
20031
|
+
showHowToCollect: boolean2().optional(),
|
|
20032
|
+
showMyQr: boolean2().optional(),
|
|
20033
|
+
collectionLimit: _enum(["ONCE", "UNLIMITED"]).optional(),
|
|
20010
20034
|
prizeDeskAward: boolean2().optional(),
|
|
20011
20035
|
info: passportStationInfoSchema.optional().catch(undefined)
|
|
20012
20036
|
}).superRefine((config, context) => {
|
|
@@ -20059,6 +20083,8 @@ var passportStationConfigSchema = object({
|
|
|
20059
20083
|
});
|
|
20060
20084
|
var passportStationCollectionSchema = discriminatedUnion("collectionMode", [
|
|
20061
20085
|
object({
|
|
20086
|
+
showHowToCollect: boolean2().optional(),
|
|
20087
|
+
showMyQr: boolean2().optional(),
|
|
20062
20088
|
collectionMode: literal("SELF_SCAN"),
|
|
20063
20089
|
stampValue: stampValueSchema.optional(),
|
|
20064
20090
|
category: passportStationCategorySchema.optional(),
|
|
@@ -20066,14 +20092,19 @@ var passportStationCollectionSchema = discriminatedUnion("collectionMode", [
|
|
|
20066
20092
|
info: passportStationInfoInputSchema.optional()
|
|
20067
20093
|
}).strict(),
|
|
20068
20094
|
object({
|
|
20095
|
+
showHowToCollect: boolean2().optional(),
|
|
20096
|
+
showMyQr: boolean2().optional(),
|
|
20069
20097
|
collectionMode: literal("STAFF_SCAN"),
|
|
20070
20098
|
menuItems: passportMenuItemsSchema.nullable().optional(),
|
|
20099
|
+
collectionLimit: _enum(["ONCE", "UNLIMITED"]).optional(),
|
|
20071
20100
|
stampValue: stampValueSchema.optional(),
|
|
20072
20101
|
category: passportStationCategorySchema.optional(),
|
|
20073
20102
|
prizeDeskAward: boolean2().optional(),
|
|
20074
20103
|
info: passportStationInfoInputSchema.optional()
|
|
20075
20104
|
}).strict(),
|
|
20076
20105
|
object({
|
|
20106
|
+
showHowToCollect: boolean2().optional(),
|
|
20107
|
+
showMyQr: boolean2().optional(),
|
|
20077
20108
|
collectionMode: literal("STAFF_SCORE"),
|
|
20078
20109
|
maxPoints: pointsSchema,
|
|
20079
20110
|
stampValue: stampValueSchema.optional(),
|
|
@@ -20081,6 +20112,8 @@ var passportStationCollectionSchema = discriminatedUnion("collectionMode", [
|
|
|
20081
20112
|
info: passportStationInfoInputSchema.optional()
|
|
20082
20113
|
}).strict(),
|
|
20083
20114
|
object({
|
|
20115
|
+
showHowToCollect: boolean2().optional(),
|
|
20116
|
+
showMyQr: boolean2().optional(),
|
|
20084
20117
|
collectionMode: literal("STAFF_TALLY"),
|
|
20085
20118
|
tallyItems: passportTallyItemsSchema,
|
|
20086
20119
|
tallyEarnsStamp: boolean2().default(false),
|
|
@@ -20101,6 +20134,8 @@ var passportPrintQrMutationSchema = passportStationIdSchema.extend({
|
|
|
20101
20134
|
});
|
|
20102
20135
|
var collectPassportStampByStaffSchema = passportStationIdSchema.extend({
|
|
20103
20136
|
profileCode: string2().min(1).max(2048),
|
|
20137
|
+
site: string2().trim().min(1).max(60).optional(),
|
|
20138
|
+
requestId: uuid2().optional(),
|
|
20104
20139
|
points: pointsSchema.optional(),
|
|
20105
20140
|
item: string2().trim().min(1).max(PASSPORT_TALLY_ITEM_NAME_MAX).optional()
|
|
20106
20141
|
});
|
|
@@ -20115,6 +20150,8 @@ var reversePassportTallySchema = passportEventIdSchema.extend({
|
|
|
20115
20150
|
});
|
|
20116
20151
|
var correctPassportStampSchema = passportStationIdSchema.extend({
|
|
20117
20152
|
participantId: string2().min(1),
|
|
20153
|
+
collectionId: string2().min(1).optional(),
|
|
20154
|
+
site: string2().trim().min(1).max(60).optional(),
|
|
20118
20155
|
stamped: boolean2(),
|
|
20119
20156
|
reason: string2().trim().min(1).max(500),
|
|
20120
20157
|
points: pointsSchema.optional(),
|
|
@@ -20316,9 +20353,13 @@ var signInToStationStaffSchema = passportEventIdSchema.extend({ password: string
|
|
|
20316
20353
|
var setPassportStationPasswordSchema = passportEventIdSchema.extend({ password: stationStaffPasswordSchema }).strict();
|
|
20317
20354
|
var participantCodeSchema = string2().min(1).max(2048);
|
|
20318
20355
|
var stationStaffParticipantSchema = union([
|
|
20319
|
-
passportStationIdSchema.extend({ profileCode: participantCodeSchema }),
|
|
20320
20356
|
passportStationIdSchema.extend({
|
|
20321
|
-
|
|
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()
|
|
20322
20363
|
})
|
|
20323
20364
|
]);
|
|
20324
20365
|
var stationPrizeClaimParticipantSchema = union([
|
|
@@ -20821,6 +20862,8 @@ var date4 = (value, name) => {
|
|
|
20821
20862
|
var parseStaffTallyCollection = (item, extras) => {
|
|
20822
20863
|
keys(item, [
|
|
20823
20864
|
"collectionMode",
|
|
20865
|
+
"showHowToCollect",
|
|
20866
|
+
"showMyQr",
|
|
20824
20867
|
"tallyItems",
|
|
20825
20868
|
"tallyEarnsStamp",
|
|
20826
20869
|
"stampValue",
|
|
@@ -20849,15 +20892,21 @@ var parseStaffScanCollection = (item, extras) => {
|
|
|
20849
20892
|
"stampValue",
|
|
20850
20893
|
"category",
|
|
20851
20894
|
"prizeDeskAward",
|
|
20895
|
+
"showHowToCollect",
|
|
20896
|
+
"showMyQr",
|
|
20897
|
+
"collectionLimit",
|
|
20852
20898
|
"menuItems",
|
|
20853
20899
|
"info"
|
|
20854
20900
|
], "collection");
|
|
20855
|
-
if (item.collectionMode !== "STAFF_SCAN" && item.menuItems !== undefined)
|
|
20856
|
-
throw new CliUsageError("Only STAFF_SCAN stations can configure menuItems.");
|
|
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.");
|
|
20857
20903
|
if (item.prizeDeskAward !== undefined && typeof item.prizeDeskAward !== "boolean")
|
|
20858
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.");
|
|
20859
20907
|
return {
|
|
20860
20908
|
collectionMode: item.collectionMode,
|
|
20909
|
+
...item.collectionLimit === undefined ? {} : { collectionLimit: item.collectionLimit },
|
|
20861
20910
|
...item.menuItems === undefined ? {} : {
|
|
20862
20911
|
menuItems: item.menuItems === null ? null : parseStaffScanMenuItems(item.menuItems)
|
|
20863
20912
|
},
|
|
@@ -20872,23 +20921,41 @@ var parseStaffScanMenuItems = (value) => {
|
|
|
20872
20921
|
throw new CliUsageError("menuItems must have 1 to 30 items.");
|
|
20873
20922
|
const menuItems = value.map((raw, index) => {
|
|
20874
20923
|
const item = object2(raw, `menuItems[${index}]`);
|
|
20875
|
-
keys(item, ["name", "stock"], `menuItems[${index}]`);
|
|
20924
|
+
keys(item, ["name", "stock", "siteStocks"], `menuItems[${index}]`);
|
|
20876
20925
|
return {
|
|
20877
20926
|
name: text(item.name, `menuItems[${index}].name`, 60),
|
|
20927
|
+
...item.siteStocks === undefined ? {} : { siteStocks: item.siteStocks },
|
|
20878
20928
|
stock: item.stock === null ? null : integer2(item.stock, `menuItems[${index}].stock`)
|
|
20879
20929
|
};
|
|
20880
20930
|
});
|
|
20881
20931
|
if (new Set(menuItems.map(({ name }) => name.trim().toLocaleLowerCase())).size !== menuItems.length)
|
|
20882
20932
|
throw new CliUsageError("menuItems names must be unique ignoring case and surrounding whitespace.");
|
|
20883
|
-
|
|
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;
|
|
20884
20937
|
};
|
|
20885
20938
|
var parsePassportCollection = (raw) => {
|
|
20886
20939
|
const item = object2(raw, "collection");
|
|
20887
20940
|
const stampValue = item.stampValue === undefined ? {} : { stampValue: integer2(item.stampValue, "stampValue", 0, 1000) };
|
|
20888
20941
|
const category = item.category === undefined ? {} : { category: stationCategory(item.category) };
|
|
20889
|
-
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
|
+
};
|
|
20890
20949
|
if (item.collectionMode === "STAFF_SCORE") {
|
|
20891
|
-
keys(item, [
|
|
20950
|
+
keys(item, [
|
|
20951
|
+
"collectionMode",
|
|
20952
|
+
"maxPoints",
|
|
20953
|
+
"stampValue",
|
|
20954
|
+
"category",
|
|
20955
|
+
"info",
|
|
20956
|
+
"showHowToCollect",
|
|
20957
|
+
"showMyQr"
|
|
20958
|
+
], "collection");
|
|
20892
20959
|
return {
|
|
20893
20960
|
collectionMode: "STAFF_SCORE",
|
|
20894
20961
|
maxPoints: integer2(item.maxPoints, "maxPoints"),
|
|
@@ -21176,9 +21243,38 @@ var runPassportCommand = async (input) => {
|
|
|
21176
21243
|
case "mine":
|
|
21177
21244
|
operation = () => api2.event.passport.getMyPassport.query(event);
|
|
21178
21245
|
break;
|
|
21179
|
-
case "menu-stock":
|
|
21180
|
-
|
|
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
|
+
};
|
|
21181
21276
|
break;
|
|
21277
|
+
}
|
|
21182
21278
|
case "bingo enable":
|
|
21183
21279
|
operation = () => api2.event.passport.enablePassportBingo.mutate(event);
|
|
21184
21280
|
break;
|
|
@@ -21276,12 +21372,19 @@ var runPassportCommand = async (input) => {
|
|
|
21276
21372
|
break;
|
|
21277
21373
|
}
|
|
21278
21374
|
case "collect": {
|
|
21279
|
-
allowed.push("station-id", "profile-code", "points", "item");
|
|
21375
|
+
allowed.push("station-id", "profile-code", "points", "item", "site", "request-id");
|
|
21280
21376
|
const points = flag(flags, "points", false);
|
|
21281
21377
|
const item = flag(flags, "item", false);
|
|
21282
21378
|
const payload = {
|
|
21283
21379
|
...station(),
|
|
21284
21380
|
profileCode: requiredFlag(flags, "profile-code"),
|
|
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
|
+
}),
|
|
21285
21388
|
...optionalEntry("points", points, (raw) => integer2(raw, "--points")),
|
|
21286
21389
|
...optionalEntry("item", item, (raw) => text(raw, "--item", 60))
|
|
21287
21390
|
};
|
|
@@ -21295,13 +21398,15 @@ var runPassportCommand = async (input) => {
|
|
|
21295
21398
|
break;
|
|
21296
21399
|
}
|
|
21297
21400
|
case "stamp correct": {
|
|
21298
|
-
allowed.push("station-id", "participant-id", "stamped", "reason", "points", "item");
|
|
21401
|
+
allowed.push("station-id", "participant-id", "stamped", "reason", "points", "item", "collection-id", "site");
|
|
21299
21402
|
confirm();
|
|
21300
21403
|
const points = flag(flags, "points", false);
|
|
21301
21404
|
const item = flag(flags, "item", false);
|
|
21302
21405
|
const payload = {
|
|
21303
21406
|
...station(),
|
|
21304
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)),
|
|
21305
21410
|
stamped: boolean4(requiredFlag(flags, "stamped"), "--stamped"),
|
|
21306
21411
|
reason: requiredFlag(flags, "reason"),
|
|
21307
21412
|
...optionalEntry("points", points, (raw) => integer2(raw, "--points")),
|