@go-labs-sg/event-tech 1.22.0 → 1.24.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 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
@@ -322,7 +332,8 @@ that opted in with `collection.prizeDeskAward` (at most one per redemption) is g
322
332
  participant together with the prize, in the same transaction, as if they had collected it (the
323
333
  station's `stampValue` at that moment, an activity-log entry, the lucky draw and bingo/progress
324
334
  rules, source `PRIZE_DESK`). The redemption's own checks (threshold, balance, per-person limit,
325
- stock) use the balance before that stamp. It is refused when the participant already holds that
335
+ stock) include that station's stamps in the earned and spendable balance for this
336
+ redemption. A failed redemption rolls back the stamp too. It is refused when the participant already holds that
326
337
  station's stamp, when the station is not opted in, archived or outside its opening window, when
327
338
  the event takes no stamps (not ongoing), and when a manager revoked their stamp there. A stamp that
328
339
  a redemption reversal revoked is back to how it was: it can be awarded again, and the guest can
@@ -361,7 +372,65 @@ returns per-item totals; `tally list` returns a station's tallies; `export`
361
372
  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
373
  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
374
 
364
- Food and drink served as stamps use `STAFF_SCAN` on a `FOOD` or `DRINK` station. Its optional `collection.menuItems` is 1 to 30 `{name,stock}` entries; names are trimmed, max 60 characters, and unique ignoring case. Stock is 0 to 2147483647 or `null` for unlimited. Omit `menuItems` to preserve the current menu and use `null` to clear it. Crew pass `--item <name>` to `collect`; each newly created stamp consumes one unit, with no quantity option. A duplicate stamp returns the existing stamp without consuming stock. Manager `stamp correct --stamped true --item <name>` can set the item for an initial stamp; corrections cannot change an active stamp's item. Revoking restores its consumed unit and restoring the stamp consumes it again. `menu-stock` reads the signed-in guest's remaining quantities; stamp rows include `item` (null when no menu item was selected). These rules do not change repeatable `STAFF_TALLY` tallies or their independent `--quantity` recording workflow.
375
+ Food and drink served as stamps use `STAFF_SCAN` on a `FOOD` or `DRINK` station.
376
+ Its optional `collection.menuItems` has 1 to 30 `{name,stock,siteStocks?}` entries;
377
+ names are trimmed, max 60 characters, and unique ignoring case. Stock is 0 to
378
+ 2147483647 or `null` for unlimited. Omit `menuItems` to preserve the current menu
379
+ and use `null` to clear it.
380
+
381
+ `collection.collectionLimit` is `ONCE` (default, once per person per station,
382
+ across all buildings) or `UNLIMITED`. Omission preserves the stored limit.
383
+ Every deliberate `collect` records one serving and consumes one unit. Only the
384
+ first collection can award the station's configured stamp credit; repeats add
385
+ no credit or prize progress, including at stations with `stampValue: 0`.
386
+ `UNLIMITED` requires `--request-id <uuid>`: keep the same ID when retrying a lost
387
+ response, and use a fresh UUID for each new serving. Reusing an ID with a different
388
+ participant, item or site fails. A reversed collection keeps its UUID; retrying it
389
+ fails and a new serving requires a fresh UUID. Restoring a collection requires
390
+ its exact original item and site label, including casing. `ONCE` keeps the existing Already stamped response
391
+ for another give without consuming stock. These rules do not change
392
+ `STAFF_TALLY` or its independent `--quantity` workflow.
393
+
394
+ For building pools, give every menu item the same `siteStocks` site names (including casing), up to
395
+ 30 sites (each name trimmed, max 60 characters, unique ignoring case). These
396
+ pools replace that item's single `stock` pool. Crew choose a building in the
397
+ station screen or follow a link ending in `?site=FAB10N`; `collect --site FAB10N`
398
+ uses only that building's stock. A site is required when pools are configured.
399
+ Guests see the combined remaining stock, while crew see their selected building.
400
+ `menu-stock` includes both totals and `siteStocks`; add `--site` to select one
401
+ building. Organizers use `--station-id` to read a station's stock without joining
402
+ as a guest; omitting it uses the existing participant-authorized stock read.
403
+ Set stock totals with `station upsert`; they are delivered quantities, not a
404
+ remaining-stock reset. Existing active consumption is always deducted.
405
+
406
+ ```bash
407
+ 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}]}]}}'
408
+ et passport collect --event-id <id> --station-id <id> --profile-code <code> --item 'Beef Burger' --site FAB10N --request-id <uuid>
409
+ 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>
410
+ ```
411
+
412
+ `mine` and `participant detail` include active collection history. `stamps recipients`
413
+ adds `collectionId`, `item` and `site`; `tally summary` groups menu collections by
414
+ item and site, `tally list` includes individual collections, and `export` adds
415
+ `collections` with the building and reversal metadata. The web export has a
416
+ Collections CSV. Reverse one ledger serving with `stamp correct --stamped false
417
+ --collection-id <id>`; it returns that serving's stock. Undo an erroneous reversal with `--stamped true
418
+ --collection-id <id>`: the original item and building must have stock, and a
419
+ repeat serving restores no stamp credit. Do not supply item, site or points with
420
+ a collection ID. Legacy menu stamps still
421
+ appear once in stock/history and can be corrected through the existing stamp
422
+ workflow. Manager corrections that create a new menu collection also need `--site`
423
+ for building pools. Corrections cannot change an active collection's item.
424
+
425
+ Release prerequisite: apply the additive Event Tech schema before deploying the
426
+ new runtime (separate authorization). The ledger leaves the unique participant /
427
+ station stamp row intact. Do not enable building pools while unattributed legacy
428
+ consumption exists; the API rejects stock pool changes it cannot safely attribute.
429
+ Configure sites before service begins, or keep the original pool until existing
430
+ collections can be reconciled. Roll back to a runtime that understands the ledger
431
+ after taking collections: older runtimes cannot account for ledger-only repeats.
432
+
433
+ 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
434
 
366
435
  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
436
 
@@ -426,6 +426,7 @@ Run `et <command> --help` for the full input JSON Schema.
426
426
  - `event.luckyDraw.preDrawPrizes`: hand-written
427
427
  - `event.luckyDraw.updateLuckyDrawPrizesOrder`: hand-written
428
428
  - `event.luckyDraw.updateLuckyDrawConfigJson`: hand-written
429
+ - `event.passport.getStationStaffStampRecipients`: browser-only
429
430
  - `event.passport.getPassportLoginOptions`: hand-written
430
431
  - `event.passport.getPassportQueueStatuses`: hand-written
431
432
  - `event.passport.getStationPrintQr`: hand-written
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> (your remaining FOOD/DRINK STAFF_SCAN menu stock)
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
- FOOD/DRINK STAFF_SCAN may set collection.menuItems to 1-30 {name,stock} 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. --item selects one menu item on a staff stamp; each new stamp uses one unit.
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.
@@ -19143,7 +19146,8 @@ Event Passport:
19143
19146
  Prize-desk award: collection.prizeDeskAward (true|false, SELF_SCAN and STAFF_SCAN only, not the Bingo category; omit
19144
19147
  to keep, absent means off) lets crew give that station's stamp with a prize. redemption create --award-station-id
19145
19148
  <id> gives one such station's stamp (its stampValue, source PRIZE_DESK) in the same transaction as the redemption;
19146
- the redemption's own checks use the balance before it, a station the participant already holds is refused, and
19149
+ its stamps count toward this redemption's threshold and cost; a failure awards neither the stamp nor the prize.
19150
+ A station the participant already holds is refused, and
19147
19151
  redemption reverse revokes the awarded stamp. participant detail lists awardStations (alreadyCollected,
19148
19152
  blockedReason) and redemptions[].awardedStation. --request-id makes a retry safe (a retry of a since-reversed redemption is refused; use a new id).
19149
19153
  Station cover art: image-set uploads a jpeg/png/webp/gif (up to 25 MB) to the event's station-art folder and
@@ -19852,7 +19856,11 @@ var PASSPORT_TALLY_QUANTITY_MAX = 20;
19852
19856
  var PASSPORT_MENU_STOCK_MAX = 2147483647;
19853
19857
  var passportMenuItemsSchema = array(object({
19854
19858
  name: string2().trim().min(1).max(PASSPORT_TALLY_ITEM_NAME_MAX),
19855
- stock: number2().int().min(0).max(PASSPORT_MENU_STOCK_MAX).nullable()
19859
+ stock: number2().int().min(0).max(PASSPORT_MENU_STOCK_MAX).nullable(),
19860
+ siteStocks: array(object({
19861
+ site: string2().trim().min(1).max(60),
19862
+ stock: number2().int().min(0).max(PASSPORT_MENU_STOCK_MAX).nullable()
19863
+ }).strict()).max(30).optional()
19856
19864
  })).min(1).max(PASSPORT_TALLY_ITEMS_MAX).superRefine((items, context) => {
19857
19865
  const names = new Set;
19858
19866
  items.forEach((item, index) => {
@@ -19864,9 +19872,23 @@ var passportMenuItemsSchema = array(object({
19864
19872
  message: "Menu item names must be unique."
19865
19873
  });
19866
19874
  names.add(name);
19875
+ const sites = (item.siteStocks ?? []).map((row) => row.site.toLowerCase());
19876
+ const expected = (items[0]?.siteStocks ?? []).map((row) => row.site).sort();
19877
+ if (new Set(sites).size !== sites.length || JSON.stringify((item.siteStocks ?? []).map((row) => row.site).sort()) !== JSON.stringify(expected))
19878
+ context.addIssue({
19879
+ code: "custom",
19880
+ path: [index, "siteStocks"],
19881
+ message: "Every menu item must use the same site names and casing; site names must be unique ignoring case."
19882
+ });
19867
19883
  });
19868
19884
  });
19869
19885
  var validateMenuCollection = (config, context) => {
19886
+ if (config.collectionLimit !== undefined && (!config.menuItems?.length || config.collectionMode !== "STAFF_SCAN" || !["FOOD", "DRINK"].includes(config.category ?? "GAME")))
19887
+ context.addIssue({
19888
+ code: "custom",
19889
+ path: ["collectionLimit"],
19890
+ message: "Collection limits require a FOOD or DRINK staff-scan menu station."
19891
+ });
19870
19892
  if (config.menuItems && (config.collectionMode !== "STAFF_SCAN" || config.prizeDeskAward))
19871
19893
  context.addIssue({
19872
19894
  code: "custom",
@@ -20007,6 +20029,9 @@ var passportStationConfigSchema = object({
20007
20029
  tallyItems: passportTallyItemsSchema.optional(),
20008
20030
  tallyEarnsStamp: boolean2().optional(),
20009
20031
  menuItems: passportMenuItemsSchema.optional(),
20032
+ showHowToCollect: boolean2().optional(),
20033
+ showMyQr: boolean2().optional(),
20034
+ collectionLimit: _enum(["ONCE", "UNLIMITED"]).optional(),
20010
20035
  prizeDeskAward: boolean2().optional(),
20011
20036
  info: passportStationInfoSchema.optional().catch(undefined)
20012
20037
  }).superRefine((config, context) => {
@@ -20059,6 +20084,8 @@ var passportStationConfigSchema = object({
20059
20084
  });
20060
20085
  var passportStationCollectionSchema = discriminatedUnion("collectionMode", [
20061
20086
  object({
20087
+ showHowToCollect: boolean2().optional(),
20088
+ showMyQr: boolean2().optional(),
20062
20089
  collectionMode: literal("SELF_SCAN"),
20063
20090
  stampValue: stampValueSchema.optional(),
20064
20091
  category: passportStationCategorySchema.optional(),
@@ -20066,14 +20093,19 @@ var passportStationCollectionSchema = discriminatedUnion("collectionMode", [
20066
20093
  info: passportStationInfoInputSchema.optional()
20067
20094
  }).strict(),
20068
20095
  object({
20096
+ showHowToCollect: boolean2().optional(),
20097
+ showMyQr: boolean2().optional(),
20069
20098
  collectionMode: literal("STAFF_SCAN"),
20070
20099
  menuItems: passportMenuItemsSchema.nullable().optional(),
20100
+ collectionLimit: _enum(["ONCE", "UNLIMITED"]).optional(),
20071
20101
  stampValue: stampValueSchema.optional(),
20072
20102
  category: passportStationCategorySchema.optional(),
20073
20103
  prizeDeskAward: boolean2().optional(),
20074
20104
  info: passportStationInfoInputSchema.optional()
20075
20105
  }).strict(),
20076
20106
  object({
20107
+ showHowToCollect: boolean2().optional(),
20108
+ showMyQr: boolean2().optional(),
20077
20109
  collectionMode: literal("STAFF_SCORE"),
20078
20110
  maxPoints: pointsSchema,
20079
20111
  stampValue: stampValueSchema.optional(),
@@ -20081,6 +20113,8 @@ var passportStationCollectionSchema = discriminatedUnion("collectionMode", [
20081
20113
  info: passportStationInfoInputSchema.optional()
20082
20114
  }).strict(),
20083
20115
  object({
20116
+ showHowToCollect: boolean2().optional(),
20117
+ showMyQr: boolean2().optional(),
20084
20118
  collectionMode: literal("STAFF_TALLY"),
20085
20119
  tallyItems: passportTallyItemsSchema,
20086
20120
  tallyEarnsStamp: boolean2().default(false),
@@ -20101,6 +20135,8 @@ var passportPrintQrMutationSchema = passportStationIdSchema.extend({
20101
20135
  });
20102
20136
  var collectPassportStampByStaffSchema = passportStationIdSchema.extend({
20103
20137
  profileCode: string2().min(1).max(2048),
20138
+ site: string2().trim().min(1).max(60).optional(),
20139
+ requestId: uuid2().optional(),
20104
20140
  points: pointsSchema.optional(),
20105
20141
  item: string2().trim().min(1).max(PASSPORT_TALLY_ITEM_NAME_MAX).optional()
20106
20142
  });
@@ -20115,6 +20151,8 @@ var reversePassportTallySchema = passportEventIdSchema.extend({
20115
20151
  });
20116
20152
  var correctPassportStampSchema = passportStationIdSchema.extend({
20117
20153
  participantId: string2().min(1),
20154
+ collectionId: string2().min(1).optional(),
20155
+ site: string2().trim().min(1).max(60).optional(),
20118
20156
  stamped: boolean2(),
20119
20157
  reason: string2().trim().min(1).max(500),
20120
20158
  points: pointsSchema.optional(),
@@ -20316,9 +20354,13 @@ var signInToStationStaffSchema = passportEventIdSchema.extend({ password: string
20316
20354
  var setPassportStationPasswordSchema = passportEventIdSchema.extend({ password: stationStaffPasswordSchema }).strict();
20317
20355
  var participantCodeSchema = string2().min(1).max(2048);
20318
20356
  var stationStaffParticipantSchema = union([
20319
- passportStationIdSchema.extend({ profileCode: participantCodeSchema }),
20320
20357
  passportStationIdSchema.extend({
20321
- staffId: string2().trim().min(1).max(PASSPORT_ROSTER_STAFF_ID_MAX)
20358
+ profileCode: participantCodeSchema,
20359
+ site: string2().trim().min(1).max(60).optional()
20360
+ }),
20361
+ passportStationIdSchema.extend({
20362
+ staffId: string2().trim().min(1).max(PASSPORT_ROSTER_STAFF_ID_MAX),
20363
+ site: string2().trim().min(1).max(60).optional()
20322
20364
  })
20323
20365
  ]);
20324
20366
  var stationPrizeClaimParticipantSchema = union([
@@ -20821,6 +20863,8 @@ var date4 = (value, name) => {
20821
20863
  var parseStaffTallyCollection = (item, extras) => {
20822
20864
  keys(item, [
20823
20865
  "collectionMode",
20866
+ "showHowToCollect",
20867
+ "showMyQr",
20824
20868
  "tallyItems",
20825
20869
  "tallyEarnsStamp",
20826
20870
  "stampValue",
@@ -20849,15 +20893,21 @@ var parseStaffScanCollection = (item, extras) => {
20849
20893
  "stampValue",
20850
20894
  "category",
20851
20895
  "prizeDeskAward",
20896
+ "showHowToCollect",
20897
+ "showMyQr",
20898
+ "collectionLimit",
20852
20899
  "menuItems",
20853
20900
  "info"
20854
20901
  ], "collection");
20855
- if (item.collectionMode !== "STAFF_SCAN" && item.menuItems !== undefined)
20856
- throw new CliUsageError("Only STAFF_SCAN stations can configure menuItems.");
20902
+ if (item.collectionMode !== "STAFF_SCAN" && (item.menuItems !== undefined || item.collectionLimit !== undefined))
20903
+ throw new CliUsageError("Only STAFF_SCAN stations can configure menuItems or collectionLimit.");
20857
20904
  if (item.prizeDeskAward !== undefined && typeof item.prizeDeskAward !== "boolean")
20858
20905
  throw new CliUsageError("prizeDeskAward must be true or false.");
20906
+ if (item.collectionLimit !== undefined && item.collectionLimit !== "ONCE" && item.collectionLimit !== "UNLIMITED")
20907
+ throw new CliUsageError("collectionLimit must be ONCE or UNLIMITED.");
20859
20908
  return {
20860
20909
  collectionMode: item.collectionMode,
20910
+ ...item.collectionLimit === undefined ? {} : { collectionLimit: item.collectionLimit },
20861
20911
  ...item.menuItems === undefined ? {} : {
20862
20912
  menuItems: item.menuItems === null ? null : parseStaffScanMenuItems(item.menuItems)
20863
20913
  },
@@ -20872,23 +20922,41 @@ var parseStaffScanMenuItems = (value) => {
20872
20922
  throw new CliUsageError("menuItems must have 1 to 30 items.");
20873
20923
  const menuItems = value.map((raw, index) => {
20874
20924
  const item = object2(raw, `menuItems[${index}]`);
20875
- keys(item, ["name", "stock"], `menuItems[${index}]`);
20925
+ keys(item, ["name", "stock", "siteStocks"], `menuItems[${index}]`);
20876
20926
  return {
20877
20927
  name: text(item.name, `menuItems[${index}].name`, 60),
20928
+ ...item.siteStocks === undefined ? {} : { siteStocks: item.siteStocks },
20878
20929
  stock: item.stock === null ? null : integer2(item.stock, `menuItems[${index}].stock`)
20879
20930
  };
20880
20931
  });
20881
20932
  if (new Set(menuItems.map(({ name }) => name.trim().toLocaleLowerCase())).size !== menuItems.length)
20882
20933
  throw new CliUsageError("menuItems names must be unique ignoring case and surrounding whitespace.");
20883
- return menuItems;
20934
+ const parsed = passportMenuItemsSchema.safeParse(menuItems);
20935
+ if (!parsed.success)
20936
+ throw new CliUsageError(`menuItems is invalid: ${parsed.error.issues.map((issue) => `${issue.path.join(".")} ${issue.message}`).join("; ")}`);
20937
+ return parsed.data;
20884
20938
  };
20885
20939
  var parsePassportCollection = (raw) => {
20886
20940
  const item = object2(raw, "collection");
20887
20941
  const stampValue = item.stampValue === undefined ? {} : { stampValue: integer2(item.stampValue, "stampValue", 0, 1000) };
20888
20942
  const category = item.category === undefined ? {} : { category: stationCategory(item.category) };
20889
- const info = item.info === undefined ? {} : { info: stationInfo(item.info) };
20943
+ const info = {
20944
+ ...item.showMyQr === undefined ? {} : { showMyQr: boolean4(item.showMyQr, "showMyQr") },
20945
+ ...item.info === undefined ? {} : { info: stationInfo(item.info) },
20946
+ ...item.showHowToCollect === undefined ? {} : {
20947
+ showHowToCollect: boolean4(item.showHowToCollect, "showHowToCollect")
20948
+ }
20949
+ };
20890
20950
  if (item.collectionMode === "STAFF_SCORE") {
20891
- keys(item, ["collectionMode", "maxPoints", "stampValue", "category", "info"], "collection");
20951
+ keys(item, [
20952
+ "collectionMode",
20953
+ "maxPoints",
20954
+ "stampValue",
20955
+ "category",
20956
+ "info",
20957
+ "showHowToCollect",
20958
+ "showMyQr"
20959
+ ], "collection");
20892
20960
  return {
20893
20961
  collectionMode: "STAFF_SCORE",
20894
20962
  maxPoints: integer2(item.maxPoints, "maxPoints"),
@@ -21176,9 +21244,38 @@ var runPassportCommand = async (input) => {
21176
21244
  case "mine":
21177
21245
  operation = () => api2.event.passport.getMyPassport.query(event);
21178
21246
  break;
21179
- case "menu-stock":
21180
- operation = () => api2.event.passport.getMyPassportMenuStock.query(event);
21247
+ case "menu-stock": {
21248
+ allowed.push("station-id", "site");
21249
+ const stationId = flag(flags, "station-id", false);
21250
+ const site = flag(flags, "site", false);
21251
+ operation = async () => {
21252
+ 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) => ({
21253
+ stationId: row.id,
21254
+ menuStock: row.menuStock
21255
+ }));
21256
+ if (stationId !== undefined && !rows.length)
21257
+ throw new CliUsageError("No station with that ID exists in this passport.");
21258
+ if (site === undefined)
21259
+ return rows;
21260
+ const selected = rows.flatMap((row) => {
21261
+ const menuStock = row.menuStock.flatMap((item) => {
21262
+ const stock = item.siteStocks?.find((value) => value.site.toLocaleLowerCase() === site.trim().toLocaleLowerCase());
21263
+ return stock ? [
21264
+ {
21265
+ ...item,
21266
+ stock: stock.stock,
21267
+ remainingStock: stock.remainingStock
21268
+ }
21269
+ ] : [];
21270
+ });
21271
+ return menuStock.length ? [{ ...row, site, menuStock }] : [];
21272
+ });
21273
+ if (!selected.length)
21274
+ throw new CliUsageError("No menu stock is configured for that site.");
21275
+ return selected;
21276
+ };
21181
21277
  break;
21278
+ }
21182
21279
  case "bingo enable":
21183
21280
  operation = () => api2.event.passport.enablePassportBingo.mutate(event);
21184
21281
  break;
@@ -21276,12 +21373,19 @@ var runPassportCommand = async (input) => {
21276
21373
  break;
21277
21374
  }
21278
21375
  case "collect": {
21279
- allowed.push("station-id", "profile-code", "points", "item");
21376
+ allowed.push("station-id", "profile-code", "points", "item", "site", "request-id");
21280
21377
  const points = flag(flags, "points", false);
21281
21378
  const item = flag(flags, "item", false);
21282
21379
  const payload = {
21283
21380
  ...station(),
21284
21381
  profileCode: requiredFlag(flags, "profile-code"),
21382
+ ...optionalEntry("site", flag(flags, "site", false), (raw) => text(raw, "--site", 60)),
21383
+ ...optionalEntry("requestId", flag(flags, "request-id", false), (raw) => {
21384
+ const parsed = passportRedemptionRequestIdSchema.safeParse(raw);
21385
+ if (!parsed.success)
21386
+ throw new CliUsageError("--request-id must be a UUID.");
21387
+ return parsed.data;
21388
+ }),
21285
21389
  ...optionalEntry("points", points, (raw) => integer2(raw, "--points")),
21286
21390
  ...optionalEntry("item", item, (raw) => text(raw, "--item", 60))
21287
21391
  };
@@ -21295,13 +21399,15 @@ var runPassportCommand = async (input) => {
21295
21399
  break;
21296
21400
  }
21297
21401
  case "stamp correct": {
21298
- allowed.push("station-id", "participant-id", "stamped", "reason", "points", "item");
21402
+ allowed.push("station-id", "participant-id", "stamped", "reason", "points", "item", "collection-id", "site");
21299
21403
  confirm();
21300
21404
  const points = flag(flags, "points", false);
21301
21405
  const item = flag(flags, "item", false);
21302
21406
  const payload = {
21303
21407
  ...station(),
21304
21408
  participantId: requiredFlag(flags, "participant-id"),
21409
+ ...optionalEntry("collectionId", flag(flags, "collection-id", false), (raw) => text(raw, "--collection-id", 200)),
21410
+ ...optionalEntry("site", flag(flags, "site", false), (raw) => text(raw, "--site", 60)),
21305
21411
  stamped: boolean4(requiredFlag(flags, "stamped"), "--stamped"),
21306
21412
  reason: requiredFlag(flags, "reason"),
21307
21413
  ...optionalEntry("points", points, (raw) => integer2(raw, "--points")),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@go-labs-sg/event-tech",
3
- "version": "1.22.0",
3
+ "version": "1.24.0",
4
4
  "description": "Event Tech CLI for managing Event Tech resources through the Go Labs API.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",