@go-labs-sg/event-tech 1.3.0 → 1.5.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
@@ -85,8 +85,10 @@ Use `EVENT_TECH_API_URL` or `--api-url` to target another HTTPS deployment. Plai
85
85
  et --help
86
86
  et organization list
87
87
  et organization get --organization-id <id>
88
+ et organization create --name "Example Org" --owner-email owner@example.test --allowed-event-types LUCKY_DRAW
88
89
  et event list --organization-id <id>
89
90
  et event get --event-id <id>
91
+ et event create --organization-id <id> --name "Example Dinner" --type LUCKY_DRAW --location "Ballroom" --start 2026-11-20T18:00:00+08:00
90
92
  et event appearance get --event-id <id>
91
93
  et event appearance get --event-id <id> --public
92
94
  et event appearance update --event-id <id> --appearance-version <n> --appearance '<json>'
@@ -95,10 +97,31 @@ et event appearance upload --event-id <id> --file ./background.mp4 --media-type
95
97
  et event photo-wall display-items --event-id <id> --limit 30
96
98
  et lucky-draw participants replace --event-id <id> --participants '[{"luckyDrawId":"illustrative-001","name":"Example Person","email":"example@example.test"}]' --allow-state-change --target <id>
97
99
  et lucky-draw participants list --event-id <id> --page 1 --per-page 100
100
+ et lucky-draw config get --event-id <id>
101
+ et lucky-draw config update --event-id <id> --config '{"luckyDrawType":"SLOT"}'
102
+ et lucky-draw background upload --event-id <id> --file ./board.png --content-type image/png
103
+ et lucky-draw prizes list --event-id <id>
98
104
  ```
99
105
 
100
106
  Commands emit deterministic JSON envelopes. Authentication credentials are never included in successful output, and bearer credentials are redacted from errors.
101
107
 
108
+ ### Registry commands (every staff and admin operation)
109
+
110
+ Besides the named commands above, `et` exposes every staff/admin Event Tech API procedure as a registry command. [`command-reference.md`](./command-reference.md) lists them all, plus the procedures that intentionally have none (participant-only, public/display, browser-only, the frozen Scavenger Hunt, and web navigation helpers).
111
+
112
+ ```sh
113
+ et commands # list every registry command
114
+ et lucky-draw winners accept --help # input JSON Schema and required confirmations
115
+ et lucky-draw winners list --input '{"eventId":"<id>"}'
116
+ et event access invite --input-file ./invite.json --allow-state-change --allow-email --target staff@example.test
117
+ et lucky-draw participants delete --input '{"eventId":"<id>","ids":["<p1>","<p2>"]}' --allow-state-change --allow-delete --target <p1>,<p2>
118
+ ```
119
+
120
+ - `--input`/`--input-file` is passed unchanged to the procedure, so field names match the web app and the server validates them with the same schemas and permissions.
121
+ - Date fields (listed by `--help`) take ISO 8601 strings, for example `2026-11-20T18:00:00+08:00`.
122
+ - Every write needs `--allow-state-change` and `--target` equal to the input key shown by `--help` (arrays joined with commas). Hard deletes also need `--allow-delete`; writes that send email need `--allow-email`.
123
+ - The build fails if an API procedure has no CLI decision, so new procedures must be registered or explicitly excluded in `src/registry/coverage.ts`.
124
+
102
125
  ### Event Passport
103
126
 
104
127
  `et passport` uses the same typed procedures and event permissions as the web app.
@@ -109,6 +132,10 @@ an instruction to change a live event:
109
132
  et passport overview --event-id <id>
110
133
  et passport login-options --event-id <id>
111
134
  et passport mine --event-id <id>
135
+ et passport bingo enable --event-id <id>
136
+ et passport bingo join --event-id <id>
137
+ et passport bingo status --event-id <id>
138
+ et passport bingo claim-stamp --event-id <id>
112
139
  et passport station upsert --event-id <id> --station-json '{"name":"Balance trail","collection":{"collectionMode":"STAFF_SCORE","maxPoints":20}}'
113
140
  et passport station print-get --event-id <id> --station-id <id>
114
141
  et passport station print-issue --event-id <id> --station-id <id> --expected-printed-qr-version <last-read-version>
@@ -116,10 +143,22 @@ et passport station print-revoke --event-id <id> --station-id <id> --expected-pr
116
143
  et passport collect --event-id <id> --station-id <id> --profile-code <participant-code> --points 15
117
144
  et passport claim --event-id <id> --code <station-code>
118
145
  et passport participant detail --event-id <id> --participant-id <id>
146
+ et passport prize upsert --event-id <id> --prize-json '{"name":"Tote bag","description":null,"stock":50,"stampCost":5,"order":0}'
147
+ et passport redemption create --event-id <id> --participant-id <id> --prize-id <id> --quantity 2
148
+ et passport station upsert --event-id <id> --station-json '{"name":"Ring toss","collection":{"collectionMode":"STAFF_SCAN","stampValue":3,"category":"GAME"}}'
149
+ et passport station upsert --event-id <id> --station-json '{"name":"Food counter","collection":{"collectionMode":"STAFF_TALLY","tallyItems":["Laksa","Teh"],"tallyEarnsStamp":true}}'
150
+ et passport tally record --event-id <id> --station-id <id> --profile-code <participant-code> --item Laksa --quantity 2
151
+ et passport tally list --event-id <id> --station-id <id>
152
+ et passport tally summary --event-id <id>
153
+ et passport tally reverse --event-id <id> --tally-id <id> --reason "Scanned twice" --allow-state-change --target <same-event-id>
119
154
  et passport export --event-id <id>
120
155
  ```
121
156
 
122
- Station collection modes are `SELF_SCAN`, `STAFF_SCAN` and `STAFF_SCORE`.
157
+ Station collection modes are `SELF_SCAN`, `STAFF_SCAN`, `STAFF_SCORE` and `STAFF_TALLY`.
158
+ `collection.stampValue` (0 to 1000, default 1) is the stamps one collection adds.
159
+ `collection.category` is `GAME`, `FOOD`, `DRINK` or `BINGO` (default `GAME`) and
160
+ groups stations for guests; the CLI rejects any other value before calling the API.
161
+ Omit either field on an existing station to keep the stored value.
123
162
  `SELF_SCAN` uses a reusable printable QR; `STAFF_SCAN` is stamp-only; only
124
163
  `STAFF_SCORE` accepts `collection.maxPoints` and a collection `--points` value.
125
164
  Zero is valid. Repeat collection returns the original receipt without changing
@@ -145,6 +184,32 @@ scores on revocation. Prize setup and redemption commands remain in `et --help`.
145
184
  Participant reads/exports include points and nullable guest contact emails; do
146
185
  not treat a null contact as an account lookup key.
147
186
 
187
+ Stamp balance: each station awards `stampValue` stamps (0 to 1000, default 1) set
188
+ as `collection.stampValue` in `--station-json`; omit it on an edit to keep the
189
+ stored value. Prizes carry `stampCost` per unit (0 to 100000, default 0; omit on
190
+ update to keep it). `redemption create` takes `--quantity` (whole number 1 to 20,
191
+ default 1) and spends `stampCost x quantity` stamps. A participant's balance is
192
+ stamps earned minus stamps spent; reversing a redemption refunds its stamps.
193
+ `mine` also prints the participant's `profileCode` and `profileCodeExpiresAt`; the
194
+ code is valid for 5 minutes from issue, so run `mine` again for a fresh one.
195
+ `mine`, `participant detail`, `overview` and `export` return the earned, spent and
196
+ remaining figures plus redemption `quantity` and `stampsSpent`; the CLI prints the
197
+ server response unchanged. `maxRedemptionsPerParticipant` in `settings update`
198
+ counts units across all prizes and `0` means no cap. Stock is first come first
199
+ served: a redemption that loses a race for the last units fails and can be retried.
200
+
201
+ Food and drink tally: a `STAFF_TALLY` station (`tallyItems` 1 to 30 unique names,
202
+ `tallyEarnsStamp` default false) lets operators record items against a participant
203
+ profile code. `tally record` takes an optional `--quantity` 1 to 20 (default 1) and repeat scans have no
204
+ cap. With `tallyEarnsStamp` the first collection also gives the station stamp once.
205
+ `tally reverse` needs a reason (1 to 200 characters) and the same
206
+ `--allow-state-change --target <same-event-id>` confirmation. `tally summary`
207
+ returns per-item totals; `tally list` returns a station's tallies; `export`
208
+ includes `tallies` and `tallySummary`. Plain `collect`, `claim` and rotating QR routes reject tally stations; only a manager stamp correction can add or remove the
209
+ 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.
210
+
211
+ Bingo: `bingo enable` (manager) creates the hunt and a hidden Bingo station (stamp value 3 by default). `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.
212
+
148
213
  Guest enrollment/account linking is browser-only: it requires the original guest
149
214
  cookie and verified email/Google authentication. `mine` can read only the passport
150
215
  owned by the current CLI identity; it cannot recover a guest by name or assume a
@@ -231,6 +296,102 @@ bun run packages/event-tech/cli/src/index.ts help
231
296
 
232
297
  Building is not publication or permission to mutate live data. Use focused temporary business-behavior tests and the final pre-push gate from the shared workflow. Use this package's actual scripts; do not assume it has a command-artifact generator.
233
298
 
299
+ ## Lucky draw setup from scratch
300
+
301
+ An admin can set up a lucky draw without the browser. Each command uses the
302
+ same tRPC procedure and permission as the web flow: `organization create` is
303
+ global-admin only, `event create` needs organization owner/admin (or global
304
+ admin), and config, background and prize writes need `event.setup`.
305
+
306
+ ```sh
307
+ # 1. Organization (skip if it exists; check with `et organization get`).
308
+ et organization create --name "Example Org" \
309
+ --owner-email owner@example.test --allowed-event-types LUCKY_DRAW
310
+
311
+ # 2. LUCKY_DRAW event. The board row and default config are created with it.
312
+ et event create --organization-id <org-id> --name "Example Dinner" \
313
+ --type LUCKY_DRAW --location "Ballroom" \
314
+ --start 2026-11-20T18:00:00+08:00 --end 2026-11-20T23:00:00+08:00
315
+
316
+ # 3. 1920x1080 background (jpeg/png/webp/gif).
317
+ et lucky-draw background upload --event-id <event-id> \
318
+ --file ./board-1920x1080.png --content-type image/png
319
+
320
+ # 4. Slot mode plus theme. Preview first with --dry-run.
321
+ et lucky-draw config update --event-id <event-id> --config-file ./theme.json --dry-run
322
+ et lucky-draw config update --event-id <event-id> --config-file ./theme.json
323
+
324
+ # 5. Prizes, then the participant roster.
325
+ et lucky-draw prizes create --event-id <event-id> --prizes-file ./prizes.json
326
+ et lucky-draw participants replace --event-id <event-id> \
327
+ --participants-file ./participants.json --allow-state-change --target <event-id>
328
+
329
+ # 6. Read everything back.
330
+ et lucky-draw config get --event-id <event-id>
331
+ et lucky-draw prizes list --event-id <event-id>
332
+ ```
333
+
334
+ `organization create` also emails an owner invitation to `--owner-email`;
335
+ `data.deliveryStatus` reports `sent` or `failed`. The name must be unique among
336
+ active organizations (case-insensitive), otherwise the API returns `CONFLICT`.
337
+
338
+ `event create` requires `--location` and `--start` because the API does. Dates
339
+ are ISO 8601 date-times; include an offset so the time is unambiguous.
340
+
341
+ ### Config merge patch
342
+
343
+ `config update` reads the current config, applies only the keys you pass, and
344
+ saves the full result. Example `theme.json`:
345
+
346
+ ```json
347
+ {
348
+ "luckyDrawType": "SLOT",
349
+ "backgroundPreset": "#050d24",
350
+ "title": "Lucky Draw",
351
+ "titleColor": "#ffffff",
352
+ "titleFont": "font-serif",
353
+ "slotBorderColor": "#67ddf2",
354
+ "slotTextColor": "#ffffff",
355
+ "slotPositionX": 600,
356
+ "slotPositionY": 420
357
+ }
358
+ ```
359
+
360
+ Keys are validated with the API's `luckyDrawConfigSchema` before any request:
361
+ unknown keys, wrong types and invalid enum values (`luckyDrawType`:
362
+ `WHEEL|SLOT`; `segmentText`: `NAME|LUCKY_DRAW_ID|BOTH`) fail with a `USAGE`
363
+ error that names the field. Arrays such as `includeDomains` are replaced, not
364
+ appended. Fields missing from an older stored config fall back to the web
365
+ form's defaults. `--dry-run` prints `changedFields` and the merged config
366
+ without saving. It must be passed bare: `--dry-run=true` (or any
367
+ `--flag=value` form of a bare flag) is a `USAGE` error, never a write. Run `et --help` for the full key list; positions are pixels on
368
+ the 1920x1080 board.
369
+
370
+ ### Background
371
+
372
+ `background upload` uploads through the same presigned
373
+ `lucky-draw/backgrounds` flow as the preview page, then stores the key in
374
+ `customBackgroundImage`. It prints the `config get` readback, where
375
+ `customBackgroundImage` is a signed `/api/images/...` URL relative to the
376
+ Event Tech app. `background clear --allow-state-change --target <event-id>`
377
+ unsets it.
378
+
379
+ ### Prizes
380
+
381
+ `prizes create` appends after the last prize. Pass one prize with `--name`
382
+ (and optional `--description`) or many with `--prizes`/`--prizes-file`
383
+ (`[{"name":"Grand Prize","description":"Optional"}]`, up to 500).
384
+
385
+ `prizes update --prize-id <id> --name <text> [--description <text>]` renames a
386
+ prize. `prizes reorder --prize-ids <id,...>` must list every active prize ID
387
+ exactly once, in the new order.
388
+
389
+ `prizes delete --prize-ids <id,...> --allow-state-change --target <event-id>`
390
+ permanently deletes the prizes (the API hard-deletes them) and renumbers the
391
+ rest. A prize already assigned to a winner cannot be deleted (`CONFLICT`).
392
+ Before update, delete and reorder, the CLI checks that every prize ID belongs
393
+ to `--event-id`.
394
+
234
395
  ## Lucky draw participant source import
235
396
 
236
397
  The participant import is an API-first rollout: use a deployment that includes