@go-labs-sg/event-tech 1.17.0 → 1.18.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 +28 -8
- package/command-reference.md +13 -10
- package/dist/index.js +88 -17
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -448,7 +448,7 @@ returns `imageKey` and a signed `imageUrl` for each prize.
|
|
|
448
448
|
items handed over and reveal a prize outcome the server decides in the same transaction.
|
|
449
449
|
Everything uses the same tRPC procedures and permissions as the web app. Setup and the roster
|
|
450
450
|
need `event.setup`, the export needs `event.export`, and the counter commands (`counter`,
|
|
451
|
-
`lookup`, `redeem`) need `event.operate`. Site crew sign in with a site password in the browser
|
|
451
|
+
`lookup`, `redeem`, `claims record-items`) need `event.operate`. Site crew sign in with a site password in the browser
|
|
452
452
|
only; crew sign-in and the counter access check have no CLI command.
|
|
453
453
|
|
|
454
454
|
All commands except `roster import` and `export` are registry commands: pass the procedure input
|
|
@@ -459,7 +459,7 @@ confirm every write with `--allow-state-change --target <event-id>`. The command
|
|
|
459
459
|
| --- | --- |
|
|
460
460
|
| Setup | `setup get`, `settings update`, `site upsert`, `crew-password set`, `crew-password clear`, `session upsert`, `slot set`, `item-group upsert`, `item upsert`, `prize upsert`, `prize-stock set`, `rollover preview`, `rollover run`, `rollover list`, `rollover undo`, `archive set` |
|
|
461
461
|
| Roster | `roster list`, `roster counts`, `roster upsert`, `roster import` |
|
|
462
|
-
| Redemption log | `claims list`, `claims counts`, `claims void`, `draw release`, `stock summary`, `export` |
|
|
462
|
+
| Redemption log | `claims list`, `claims counts`, `claims void`, `claims record-items`, `draw release`, `stock summary`, `export` |
|
|
463
463
|
| Counter | `counter context`, `lookup`, `redeem`, `counter claims` |
|
|
464
464
|
|
|
465
465
|
A walkthrough with made-up names and IDs. Nothing here is an instruction to change a live event;
|
|
@@ -475,8 +475,12 @@ et event create --organization-id <org-id> --name "Example Staff Appreciation" \
|
|
|
475
475
|
# items a person may take (ONE_FROM_EACH_GROUP, AT_MOST_ONE_PER_GROUP or
|
|
476
476
|
# AT_MOST_ONE_PER_GROUP_OR_NONE), what happens at the wrong site (REFUSE or
|
|
477
477
|
# SERVE_FROM_COUNTER) and the draw (REMAINING_HEADCOUNT, or FIXED_RATE with
|
|
478
|
-
# fixedWinRatePercent).
|
|
479
|
-
#
|
|
478
|
+
# fixedWinRatePercent). sessionRule is optional: OWN_SHIFT (the default) serves people
|
|
479
|
+
# only during their own shift's session; ANY_OPEN_SESSION serves them during whichever
|
|
480
|
+
# session is open now, from that session's sets. counterOrder is optional too:
|
|
481
|
+
# FOOD_THEN_DRAW (the default when unset: items first, then the wheel) or DRAW_THEN_FOOD
|
|
482
|
+
# (spin first, record the food afterwards). They lock once the first redemption exists;
|
|
483
|
+
# changing them then needs overrideReason.
|
|
480
484
|
et staff-redemption settings update --allow-state-change --target <event-id> \
|
|
481
485
|
--input '{"eventId":"<event-id>","eligibleShifts":["A","B","C","D"],"itemRule":"ONE_FROM_EACH_GROUP","wrongSite":"REFUSE","drawPolicy":"REMAINING_HEADCOUNT"}'
|
|
482
486
|
|
|
@@ -527,6 +531,21 @@ et staff-redemption lookup \
|
|
|
527
531
|
et staff-redemption redeem --allow-state-change --target <event-id> \
|
|
528
532
|
--input "{\"eventId\":\"<event-id>\",\"siteId\":\"<site-id>\",\"employeeId\":\"E1001\",\"clientRequestId\":\"$(uuidgen | tr A-Z a-z)\",\"itemIds\":[\"<item-id>\"]}"
|
|
529
533
|
|
|
534
|
+
# 8b. Draw first (counterOrder DRAW_THEN_FOOD). redeem must send itemIds [] (anything else is
|
|
535
|
+
# BAD_REQUEST): it records the claim, the set and the prize draw together, and the receipt
|
|
536
|
+
# has itemsPending true. The food is recorded later, on the claim, with record-items (the
|
|
537
|
+
# claim's own siteId; claimId from the receipt or claims list). The same items again return
|
|
538
|
+
# replayed true; different items once recorded, a voided claim and a food-first claim are
|
|
539
|
+
# CONFLICT. counter claims and claims list show itemsPending and itemsRecordedAt;
|
|
540
|
+
# claims list --status items-pending finds claims still waiting for food.
|
|
541
|
+
et staff-redemption settings update --allow-state-change --target <event-id> \
|
|
542
|
+
--input '{"eventId":"<event-id>","counterOrder":"DRAW_THEN_FOOD"}'
|
|
543
|
+
et staff-redemption redeem --allow-state-change --target <event-id> \
|
|
544
|
+
--input "{\"eventId\":\"<event-id>\",\"siteId\":\"<site-id>\",\"employeeId\":\"E1001\",\"clientRequestId\":\"$(uuidgen | tr A-Z a-z)\",\"itemIds\":[]}"
|
|
545
|
+
et staff-redemption claims record-items --allow-state-change --target <event-id> \
|
|
546
|
+
--input '{"eventId":"<event-id>","siteId":"<site-id>","claimId":"<claim-id>","itemIds":["<item-id>"]}'
|
|
547
|
+
et staff-redemption claims list --input '{"eventId":"<event-id>","status":"items-pending"}'
|
|
548
|
+
|
|
530
549
|
# 9. Fix a mistake. void returns the set (the prize outcome stays, so a redo shows the same
|
|
531
550
|
# result); draw release also returns a won prize to stock so the person draws again.
|
|
532
551
|
# draw release is refused while an active redemption still shows the draw (claims list
|
|
@@ -592,10 +611,10 @@ An unknown name fails and lists the workbook's sheets; nothing changes. A CSV ha
|
|
|
592
611
|
`--sheet` with a CSV fails.
|
|
593
612
|
|
|
594
613
|
**Export.** `export --event-id <id>` prints the redemption rows as JSON, oldest first. Filters:
|
|
595
|
-
`--search`, `--site-id`, `--session-id` and `--status active|voided|all` (default all). With
|
|
614
|
+
`--search`, `--site-id`, `--session-id` and `--status active|items-pending|voided|all` (default all). With
|
|
596
615
|
`--csv-file <path>` it writes a CSV instead and prints `{ "file", "rows" }`. The CSV has one row
|
|
597
|
-
per claim with the columns Created at, Employee ID, Name, Site, Session, Items,
|
|
598
|
-
Operator kind, Voided at, Void reason and Draw released at. It is UTF-8 with a byte order mark and
|
|
616
|
+
per claim with the columns Created at, Employee ID, Name, Site, Session, Items, Items recorded
|
|
617
|
+
(yes or no), Items recorded at, Outcome, Prize, Operator kind, Voided at, Void reason and Draw released at. It is UTF-8 with a byte order mark and
|
|
599
618
|
CRLF line ends so Excel opens it correctly; text that would run as a spreadsheet formula (a
|
|
600
619
|
leading `=`, `+`, `-` or `@`) gets a leading apostrophe. An existing file is never overwritten
|
|
601
620
|
unless you pass `--force`. The export needs `event.export` and fails above 20,000 rows; narrow
|
|
@@ -619,7 +638,8 @@ it with the filters.
|
|
|
619
638
|
when the person was served at a site other than their roster site; false when their roster
|
|
620
639
|
site matches no site). The CSV export adds "Roster site" and "Away from roster site" columns
|
|
621
640
|
and writes items as `Group: Item`.
|
|
622
|
-
- `counter context` adds `event` (`{ id, name, status, startDateTime, endDateTime }`)
|
|
641
|
+
- `counter context` adds `event` (`{ id, name, status, startDateTime, endDateTime }`) and `counterOrder`.
|
|
642
|
+
- Draw-first claims: `claims list`, `export` and `counter claims` rows and receipts carry `itemsPending` (true until the food is recorded) and `itemsRecordedAt` (null until then; also null on food-first claims). `claims counts` returns `totalCount`, `activeCount`, `itemsPendingCount` and `voidedCount`. Voiding a claim that is still pending releases its set; a redo reuses the same prize outcome and is pending again.
|
|
623
643
|
- `counter claims` takes `scope`: `mine` (default) is the claims made by you at the site (a crew
|
|
624
644
|
device sees its own crew session's), `site` is every claim at the site whoever served it.
|
|
625
645
|
Both need the same counter access, so `event.operate` for the CLI:
|
package/command-reference.md
CHANGED
|
@@ -306,9 +306,9 @@ Run `et <command> --help` for the full input JSON Schema.
|
|
|
306
306
|
- Approve or reject a Human Bingo card item submission.
|
|
307
307
|
- Confirm: `--allow-state-change` `--target <input.id>`
|
|
308
308
|
- `et staff-redemption setup get` → `event.staffRedemption.getStaffRedemptionSetup` (query)
|
|
309
|
-
- Get the whole staff redemption setup: settings, missingPolicies and policiesLocked, sites (with crew access status), sessions, slots with setsIssued, item groups and items, prizes and prize stock. readiness lists what is still missing before counters can serve people (ready, and items of code plus short text); truncated is true when a list was cut at its cap. Archived rows are included with archivedAt; holds no personal data. Needs event.operate.
|
|
309
|
+
- Get the whole staff redemption setup: settings (including counterOrder, always resolved: FOOD_THEN_DRAW when never set), missingPolicies and policiesLocked, sites (with crew access status), sessions, slots with setsIssued, item groups and items, prizes and prize stock. readiness lists what is still missing before counters can serve people (ready, and items of code plus short text); truncated is true when a list was cut at its cap. Archived rows are included with archivedAt; holds no personal data. Needs event.operate.
|
|
310
310
|
- `et staff-redemption settings update` → `event.staffRedemption.updateStaffRedemptionSettings` (mutation)
|
|
311
|
-
- Update eligibleShifts, itemRule, wrongSite, drawPolicy and
|
|
311
|
+
- Update eligibleShifts, itemRule, wrongSite, sessionRule, drawPolicy, fixedWinRatePercent and counterOrder; omitted fields are unchanged. sessionRule is OWN_SHIFT (the default when unset: only during the person's own shift's session) or ANY_OPEN_SESSION (whichever session is open now, from that session's sets; needs drawPolicy FIXED_RATE). counterOrder is FOOD_THEN_DRAW (the default when never set) or DRAW_THEN_FOOD (the person spins first and the food is recorded afterwards); it is not a required policy (never in missingPolicies). Policies, sessionRule and counterOrder included, lock once a redemption exists (setup get shows policiesLocked): then a change needs overrideReason, recorded in the activity log.
|
|
312
312
|
- Confirm: `--allow-state-change` `--target <input.eventId>`
|
|
313
313
|
- `et staff-redemption site upsert` → `event.staffRedemption.upsertStaffRedemptionSite` (mutation)
|
|
314
314
|
- Create a site (omit siteId) or rename and reorder one (give siteId). Use staff-redemption archive set to archive or unarchive it.
|
|
@@ -320,7 +320,7 @@ Run `et <command> --help` for the full input JSON Schema.
|
|
|
320
320
|
- Clear a site's crew password, which turns its crew link off and ends every crew session at that site.
|
|
321
321
|
- Confirm: `--allow-state-change` `--target <input.eventId>`
|
|
322
322
|
- `et staff-redemption session upsert` → `event.staffRedemption.upsertStaffRedemptionSession` (mutation)
|
|
323
|
-
- Create a session (omit sessionId) or update one: name, shift letter, and optional startsAt and endsAt (ISO date-times; null or omitted means the session is open whenever the event is). Each shift has one session; a session with redemptions keeps its shift.
|
|
323
|
+
- Create a session (omit sessionId) or update one: name, shift letter, and optional startsAt and endsAt (ISO date-times; null or omitted means the session is open whenever the event is). Each shift has one session; a session with redemptions keeps its shift. Under sessionRule ANY_OPEN_SESSION, counters serve everyone from the open session that started most recently, so a session with no endsAt is used until a later one starts.
|
|
324
324
|
- Confirm: `--allow-state-change` `--target <input.eventId>`
|
|
325
325
|
- Date fields: `startsAt`, `endsAt`
|
|
326
326
|
- `et staff-redemption slot set` → `event.staffRedemption.setStaffRedemptionSlot` (mutation)
|
|
@@ -359,11 +359,11 @@ Run `et <command> --help` for the full input JSON Schema.
|
|
|
359
359
|
- Add or update one roster entry by employeeId (name, siteName, shift and workShift are required and can be null; allowance is optional). The site is matched by name, and allowance cannot go below the sets the person already collected. The archived state is unchanged (use staff-redemption archive set).
|
|
360
360
|
- Confirm: `--allow-state-change` `--target <input.eventId>`
|
|
361
361
|
- `et staff-redemption claims list` → `event.staffRedemption.getStaffRedemptionClaims` (query)
|
|
362
|
-
- List redemption claims, newest first (cursor paged), with items (with groupName), draw outcome, site, awayFromRosterSite (served at a site other than the roster site), session and void state; filter by search, siteId, sessionId and status (active, voided, all).
|
|
362
|
+
- List redemption claims, newest first (cursor paged), with items (with groupName), draw outcome, site, awayFromRosterSite (served at a site other than the roster site), session and void state; each row also has itemsPending (true while the prize was drawn but the food is not recorded yet) and itemsRecordedAt; filter by search, siteId, sessionId and status (active, items-pending, voided, all). items-pending is active claims that still wait for their food.
|
|
363
363
|
- `et staff-redemption claims counts` → `event.staffRedemption.getStaffRedemptionClaimCounts` (query)
|
|
364
|
-
- Count claims matching the same filters as claims list.
|
|
364
|
+
- Count claims matching the same filters as claims list : returns totalCount (all filters, status included), then activeCount, itemsPendingCount (active claims whose food is not recorded yet) and voidedCount, which ignore the status filter.
|
|
365
365
|
- `et staff-redemption claims void` → `event.staffRedemption.voidStaffRedemptionClaim` (mutation)
|
|
366
|
-
- Void a claim with a reason. The set returns to the person and the slot; the prize draw is kept, so a redo shows the same outcome until staff-redemption draw release. Claims list shows each draw's activeClaimCount.
|
|
366
|
+
- Void a claim with a reason (a claim still waiting for its food too). The set returns to the person and the slot; the prize draw is kept, so a redo shows the same outcome until staff-redemption draw release. Claims list shows each draw's activeClaimCount.
|
|
367
367
|
- Confirm: `--allow-state-change` `--target <input.eventId>`
|
|
368
368
|
- `et staff-redemption draw release` → `event.staffRedemption.releaseStaffRedemptionDraw` (mutation)
|
|
369
369
|
- Release a person's prize draw (draw.id from claims list) with a reason: a won prize returns to its slot's stock and the person draws again on their next redemption. Refused (CONFLICT) while an active, not voided redemption still shows the draw (claims list draw.activeClaimCount > 0); void it first, or pass the explicit override allowWhileClaimActive: true to release a prize while its redemption stays recorded (for example a paper entry). The override is recorded in the activity log.
|
|
@@ -371,14 +371,17 @@ Run `et <command> --help` for the full input JSON Schema.
|
|
|
371
371
|
- `et staff-redemption stock summary` → `event.staffRedemption.getStaffRedemptionStockSummary` (query)
|
|
372
372
|
- Show sets and prizes issued and left per site and session, with per-slot item counts (items), roster headcount and how many of them collected, plus event-wide item totals.
|
|
373
373
|
- `et staff-redemption counter context` → `event.staffRedemption.getStaffRedemptionCounterContext` (query)
|
|
374
|
-
- Counter view for one site (siteId): the event (name, status, dates), items to choose from, the site's sessions with sets and prizes left, and any missing policies. Needs event.operate.
|
|
374
|
+
- Counter view for one site (siteId): the event (name, status, dates), counterOrder (FOOD_THEN_DRAW or DRAW_THEN_FOOD, the order crew follow), items to choose from, the site's sessions with sets and prizes left, and any missing policies. sessionRule is the session policy; under ANY_OPEN_SESSION, openSession is the session every counter serves from now (null when none is open) and openSessionChangesAt when that next changes (serverTime is the server clock at the read). Needs event.operate.
|
|
375
375
|
- `et staff-redemption lookup` → `event.staffRedemption.lookupStaffRedemptionEmployee` (mutation)
|
|
376
|
-
- Look up an Employee ID at a site: who they are, what they already collected and whether a redemption would go ahead (refusal code otherwise). Writes nothing but failed-lookup throttle records, so it needs no confirmation flags. Needs event.operate.
|
|
376
|
+
- Look up an Employee ID at a site: who they are, what they already collected (a collected card's receipt carries itemsPending and itemsRecordedAt), the session whose sets would be used (card.session; under ANY_OPEN_SESSION with none open, the next to open or else the last to close) and whether a redemption would go ahead (refusal code otherwise). Writes nothing but failed-lookup throttle records, so it needs no confirmation flags. Needs event.operate.
|
|
377
377
|
- `et staff-redemption redeem` → `event.staffRedemption.redeemStaffRedemption` (mutation)
|
|
378
|
-
- Redeem for an Employee ID at a site: records the chosen itemIds and reveals the prize outcome the server decides in the same transaction. clientRequestId is a UUID you generate; retry with the same one and you get the stored receipt, never a second redemption. Needs event.operate.
|
|
378
|
+
- Redeem for an Employee ID at a site: records the chosen itemIds and reveals the prize outcome the server decides in the same transaction. clientRequestId is a UUID you generate; retry with the same one and you get the stored receipt, never a second redemption. When the event's counterOrder is DRAW_THEN_FOOD, itemIds must be [] (anything else is BAD_REQUEST): the claim, the set and the prize draw are recorded together and the receipt has itemsPending true until staff-redemption claims record-items. The item rule is not checked at the spin. Needs event.operate.
|
|
379
|
+
- Confirm: `--allow-state-change` `--target <input.eventId>`
|
|
380
|
+
- `et staff-redemption claims record-items` → `event.staffRedemption.recordStaffRedemptionClaimItems` (mutation)
|
|
381
|
+
- Record the food (itemIds, checked against the item rule) for a claim that was drawn first (itemsPending true, counterOrder DRAW_THEN_FOOD). siteId must be the claim's own site (claims list shows it). Writes the items, sets itemsPending false and itemsRecordedAt, and logs it; it deducts no set and makes no draw. Idempotent: the same items again return replayed true with the stored receipt. CONFLICT when different items were already recorded, when the claim is voided, or when the claim was food-first (nothing pending). Needs event.operate at that site (a manager has it). Returns status recorded, replayed and the receipt.
|
|
379
382
|
- Confirm: `--allow-state-change` `--target <input.eventId>`
|
|
380
383
|
- `et staff-redemption counter claims` → `event.staffRedemption.getStaffRedemptionCounterClaims` (query)
|
|
381
|
-
- List a site's recent claims (limit 1-50, default 20) as the counter sees them. scope mine (default) is the claims you made at the site, site is every claim at the site. Needs event.operate.
|
|
384
|
+
- List a site's recent claims (limit 1-50, default 20) as the counter sees them. scope mine (default) is the claims you made at the site, site is every claim at the site. Each receipt carries itemsPending and itemsRecordedAt. Needs event.operate.
|
|
382
385
|
|
|
383
386
|
## Procedures without a registry command
|
|
384
387
|
|
package/dist/index.js
CHANGED
|
@@ -21446,10 +21446,18 @@ var STAFF_REDEMPTION_WRONG_SITE_RULES = [
|
|
|
21446
21446
|
"REFUSE",
|
|
21447
21447
|
"SERVE_FROM_COUNTER"
|
|
21448
21448
|
];
|
|
21449
|
+
var STAFF_REDEMPTION_SESSION_RULES = [
|
|
21450
|
+
"OWN_SHIFT",
|
|
21451
|
+
"ANY_OPEN_SESSION"
|
|
21452
|
+
];
|
|
21449
21453
|
var STAFF_REDEMPTION_DRAW_POLICIES = [
|
|
21450
21454
|
"REMAINING_HEADCOUNT",
|
|
21451
21455
|
"FIXED_RATE"
|
|
21452
21456
|
];
|
|
21457
|
+
var STAFF_REDEMPTION_COUNTER_ORDERS = [
|
|
21458
|
+
"FOOD_THEN_DRAW",
|
|
21459
|
+
"DRAW_THEN_FOOD"
|
|
21460
|
+
];
|
|
21453
21461
|
var STAFF_REDEMPTION_ARCHIVABLE = [
|
|
21454
21462
|
"site",
|
|
21455
21463
|
"session",
|
|
@@ -21474,8 +21482,10 @@ var updateStaffRedemptionSettingsSchema = staffRedemptionEventIdSchema.extend({
|
|
|
21474
21482
|
eligibleShifts: array(staffRedemptionShiftSchema).min(1).max(STAFF_REDEMPTION_ELIGIBLE_SHIFTS_MAX).optional(),
|
|
21475
21483
|
itemRule: _enum(STAFF_REDEMPTION_ITEM_RULES).optional(),
|
|
21476
21484
|
wrongSite: _enum(STAFF_REDEMPTION_WRONG_SITE_RULES).optional(),
|
|
21485
|
+
sessionRule: _enum(STAFF_REDEMPTION_SESSION_RULES).optional(),
|
|
21477
21486
|
drawPolicy: _enum(STAFF_REDEMPTION_DRAW_POLICIES).optional(),
|
|
21478
21487
|
fixedWinRatePercent: number2().min(0).max(100).optional(),
|
|
21488
|
+
counterOrder: _enum(STAFF_REDEMPTION_COUNTER_ORDERS).optional(),
|
|
21479
21489
|
overrideReason: reasonSchema.optional()
|
|
21480
21490
|
}).strict();
|
|
21481
21491
|
var upsertStaffRedemptionSiteSchema = staffRedemptionEventIdSchema.extend({
|
|
@@ -21572,23 +21582,34 @@ var staffRedemptionRosterListSchema = staffRedemptionEventIdSchema.extend({
|
|
|
21572
21582
|
}).strict();
|
|
21573
21583
|
var staffRedemptionRosterCountsSchema = staffRedemptionEventIdSchema.extend(rosterFiltersShape).strict();
|
|
21574
21584
|
var lookupStaffRedemptionSchema = staffRedemptionSiteIdSchema.extend({ employeeId: staffRedemptionEmployeeIdSchema }).strict();
|
|
21585
|
+
var claimItemIdsSchema = array(idSchema).max(STAFF_REDEMPTION_CLAIM_ITEMS_MAX).refine((ids) => new Set(ids).size === ids.length, {
|
|
21586
|
+
message: "Pick each item once."
|
|
21587
|
+
});
|
|
21575
21588
|
var redeemStaffRedemptionSchema = staffRedemptionSiteIdSchema.extend({
|
|
21576
21589
|
employeeId: staffRedemptionEmployeeIdSchema,
|
|
21577
21590
|
clientRequestId: staffRedemptionClientRequestIdSchema,
|
|
21578
|
-
itemIds:
|
|
21579
|
-
|
|
21580
|
-
|
|
21591
|
+
itemIds: claimItemIdsSchema
|
|
21592
|
+
}).strict();
|
|
21593
|
+
var recordStaffRedemptionClaimItemsSchema = staffRedemptionSiteIdSchema.extend({
|
|
21594
|
+
claimId: idSchema,
|
|
21595
|
+
itemIds: claimItemIdsSchema
|
|
21581
21596
|
}).strict();
|
|
21582
21597
|
var STAFF_REDEMPTION_COUNTER_CLAIM_SCOPES = ["mine", "site"];
|
|
21583
21598
|
var staffRedemptionCounterClaimsSchema = staffRedemptionSiteIdSchema.extend({
|
|
21584
21599
|
limit: number2().int().min(1).max(50).default(20),
|
|
21585
21600
|
scope: _enum(STAFF_REDEMPTION_COUNTER_CLAIM_SCOPES).default("mine")
|
|
21586
21601
|
}).strict();
|
|
21602
|
+
var STAFF_REDEMPTION_CLAIM_STATUSES = [
|
|
21603
|
+
"active",
|
|
21604
|
+
"items-pending",
|
|
21605
|
+
"voided",
|
|
21606
|
+
"all"
|
|
21607
|
+
];
|
|
21587
21608
|
var claimFiltersShape = {
|
|
21588
21609
|
search: string2().trim().max(200).optional(),
|
|
21589
21610
|
siteId: idSchema.optional(),
|
|
21590
21611
|
sessionId: idSchema.optional(),
|
|
21591
|
-
status: _enum(
|
|
21612
|
+
status: _enum(STAFF_REDEMPTION_CLAIM_STATUSES).default("all")
|
|
21592
21613
|
};
|
|
21593
21614
|
var staffRedemptionClaimListSchema = staffRedemptionEventIdSchema.extend({
|
|
21594
21615
|
...claimFiltersShape,
|
|
@@ -21751,7 +21772,7 @@ var exportFilters = (parsed, eventId) => {
|
|
|
21751
21772
|
if (!checked.success) {
|
|
21752
21773
|
const issue = checked.error.issues[0];
|
|
21753
21774
|
const name = String(issue?.path[0] ?? "filter");
|
|
21754
|
-
throw new CliUsageError(name === "status" ? "--status must be active, voided or all." : `Invalid ${name}: ${issue?.message ?? "the value is invalid"}.`);
|
|
21775
|
+
throw new CliUsageError(name === "status" ? "--status must be active, items-pending, voided or all." : `Invalid ${name}: ${issue?.message ?? "the value is invalid"}.`);
|
|
21755
21776
|
}
|
|
21756
21777
|
return checked.data;
|
|
21757
21778
|
};
|
|
@@ -21776,6 +21797,8 @@ var csvColumns = [
|
|
|
21776
21797
|
return item.quantity === 1 ? label : `${label} x${item.quantity}`;
|
|
21777
21798
|
}).join("; ")
|
|
21778
21799
|
],
|
|
21800
|
+
["Items recorded", (row) => row.itemsPending ? "no" : "yes"],
|
|
21801
|
+
["Items recorded at", (row) => row.itemsRecordedAt?.toISOString() ?? null],
|
|
21779
21802
|
["Outcome", (row) => row.draw?.outcome ?? null],
|
|
21780
21803
|
["Prize", (row) => row.draw?.prize?.name ?? null],
|
|
21781
21804
|
["Operator kind", (row) => row.operatorKind],
|
|
@@ -25160,7 +25183,7 @@ var command_manifest_default = [
|
|
|
25160
25183
|
path: ["staff-redemption", "setup", "get"],
|
|
25161
25184
|
procedure: "event.staffRedemption.getStaffRedemptionSetup",
|
|
25162
25185
|
operation: "query",
|
|
25163
|
-
summary: "Get the whole staff redemption setup: settings, missingPolicies and policiesLocked, sites (with crew access status), sessions, slots with setsIssued, item groups and items, prizes and prize stock. readiness lists what is still missing before counters can serve people (ready, and items of code plus short text); truncated is true when a list was cut at its cap. Archived rows are included with archivedAt; holds no personal data. Needs event.operate.",
|
|
25186
|
+
summary: "Get the whole staff redemption setup: settings (including counterOrder, always resolved: FOOD_THEN_DRAW when never set), missingPolicies and policiesLocked, sites (with crew access status), sessions, slots with setsIssued, item groups and items, prizes and prize stock. readiness lists what is still missing before counters can serve people (ready, and items of code plus short text); truncated is true when a list was cut at its cap. Archived rows are included with archivedAt; holds no personal data. Needs event.operate.",
|
|
25164
25187
|
effects: [],
|
|
25165
25188
|
dates: [],
|
|
25166
25189
|
input: {
|
|
@@ -25180,7 +25203,7 @@ var command_manifest_default = [
|
|
|
25180
25203
|
path: ["staff-redemption", "settings", "update"],
|
|
25181
25204
|
procedure: "event.staffRedemption.updateStaffRedemptionSettings",
|
|
25182
25205
|
operation: "mutation",
|
|
25183
|
-
summary: "Update eligibleShifts, itemRule, wrongSite, drawPolicy and
|
|
25206
|
+
summary: "Update eligibleShifts, itemRule, wrongSite, sessionRule, drawPolicy, fixedWinRatePercent and counterOrder; omitted fields are unchanged. sessionRule is OWN_SHIFT (the default when unset: only during the person's own shift's session) or ANY_OPEN_SESSION (whichever session is open now, from that session's sets; needs drawPolicy FIXED_RATE). counterOrder is FOOD_THEN_DRAW (the default when never set) or DRAW_THEN_FOOD (the person spins first and the food is recorded afterwards); it is not a required policy (never in missingPolicies). Policies, sessionRule and counterOrder included, lock once a redemption exists (setup get shows policiesLocked): then a change needs overrideReason, recorded in the activity log.",
|
|
25184
25207
|
effects: ["state-change"],
|
|
25185
25208
|
target: "eventId",
|
|
25186
25209
|
dates: [],
|
|
@@ -25214,6 +25237,10 @@ var command_manifest_default = [
|
|
|
25214
25237
|
type: "string",
|
|
25215
25238
|
enum: ["REFUSE", "SERVE_FROM_COUNTER"]
|
|
25216
25239
|
},
|
|
25240
|
+
sessionRule: {
|
|
25241
|
+
type: "string",
|
|
25242
|
+
enum: ["OWN_SHIFT", "ANY_OPEN_SESSION"]
|
|
25243
|
+
},
|
|
25217
25244
|
drawPolicy: {
|
|
25218
25245
|
type: "string",
|
|
25219
25246
|
enum: ["REMAINING_HEADCOUNT", "FIXED_RATE"]
|
|
@@ -25223,6 +25250,10 @@ var command_manifest_default = [
|
|
|
25223
25250
|
minimum: 0,
|
|
25224
25251
|
maximum: 100
|
|
25225
25252
|
},
|
|
25253
|
+
counterOrder: {
|
|
25254
|
+
type: "string",
|
|
25255
|
+
enum: ["FOOD_THEN_DRAW", "DRAW_THEN_FOOD"]
|
|
25256
|
+
},
|
|
25226
25257
|
overrideReason: {
|
|
25227
25258
|
type: "string",
|
|
25228
25259
|
minLength: 1,
|
|
@@ -25330,7 +25361,7 @@ var command_manifest_default = [
|
|
|
25330
25361
|
path: ["staff-redemption", "session", "upsert"],
|
|
25331
25362
|
procedure: "event.staffRedemption.upsertStaffRedemptionSession",
|
|
25332
25363
|
operation: "mutation",
|
|
25333
|
-
summary: "Create a session (omit sessionId) or update one: name, shift letter, and optional startsAt and endsAt (ISO date-times; null or omitted means the session is open whenever the event is). Each shift has one session; a session with redemptions keeps its shift.",
|
|
25364
|
+
summary: "Create a session (omit sessionId) or update one: name, shift letter, and optional startsAt and endsAt (ISO date-times; null or omitted means the session is open whenever the event is). Each shift has one session; a session with redemptions keeps its shift. Under sessionRule ANY_OPEN_SESSION, counters serve everyone from the open session that started most recently, so a session with no endsAt is used until a later one starts.",
|
|
25334
25365
|
effects: ["state-change"],
|
|
25335
25366
|
target: "eventId",
|
|
25336
25367
|
dates: ["startsAt", "endsAt"],
|
|
@@ -25954,7 +25985,7 @@ var command_manifest_default = [
|
|
|
25954
25985
|
path: ["staff-redemption", "claims", "list"],
|
|
25955
25986
|
procedure: "event.staffRedemption.getStaffRedemptionClaims",
|
|
25956
25987
|
operation: "query",
|
|
25957
|
-
summary: "List redemption claims, newest first (cursor paged), with items (with groupName), draw outcome, site, awayFromRosterSite (served at a site other than the roster site), session and void state; filter by search, siteId, sessionId and status (active, voided, all).",
|
|
25988
|
+
summary: "List redemption claims, newest first (cursor paged), with items (with groupName), draw outcome, site, awayFromRosterSite (served at a site other than the roster site), session and void state; each row also has itemsPending (true while the prize was drawn but the food is not recorded yet) and itemsRecordedAt; filter by search, siteId, sessionId and status (active, items-pending, voided, all). items-pending is active claims that still wait for their food.",
|
|
25958
25989
|
effects: [],
|
|
25959
25990
|
dates: [],
|
|
25960
25991
|
input: {
|
|
@@ -25982,7 +26013,7 @@ var command_manifest_default = [
|
|
|
25982
26013
|
status: {
|
|
25983
26014
|
default: "all",
|
|
25984
26015
|
type: "string",
|
|
25985
|
-
enum: ["active", "voided", "all"]
|
|
26016
|
+
enum: ["active", "items-pending", "voided", "all"]
|
|
25986
26017
|
},
|
|
25987
26018
|
limit: {
|
|
25988
26019
|
default: 25,
|
|
@@ -26015,7 +26046,7 @@ var command_manifest_default = [
|
|
|
26015
26046
|
path: ["staff-redemption", "claims", "counts"],
|
|
26016
26047
|
procedure: "event.staffRedemption.getStaffRedemptionClaimCounts",
|
|
26017
26048
|
operation: "query",
|
|
26018
|
-
summary: "Count claims matching the same filters as claims list.",
|
|
26049
|
+
summary: "Count claims matching the same filters as claims list : returns totalCount (all filters, status included), then activeCount, itemsPendingCount (active claims whose food is not recorded yet) and voidedCount, which ignore the status filter.",
|
|
26019
26050
|
effects: [],
|
|
26020
26051
|
dates: [],
|
|
26021
26052
|
input: {
|
|
@@ -26043,7 +26074,7 @@ var command_manifest_default = [
|
|
|
26043
26074
|
status: {
|
|
26044
26075
|
default: "all",
|
|
26045
26076
|
type: "string",
|
|
26046
|
-
enum: ["active", "voided", "all"]
|
|
26077
|
+
enum: ["active", "items-pending", "voided", "all"]
|
|
26047
26078
|
}
|
|
26048
26079
|
},
|
|
26049
26080
|
required: ["eventId"],
|
|
@@ -26054,7 +26085,7 @@ var command_manifest_default = [
|
|
|
26054
26085
|
path: ["staff-redemption", "claims", "void"],
|
|
26055
26086
|
procedure: "event.staffRedemption.voidStaffRedemptionClaim",
|
|
26056
26087
|
operation: "mutation",
|
|
26057
|
-
summary: "Void a claim with a reason. The set returns to the person and the slot; the prize draw is kept, so a redo shows the same outcome until staff-redemption draw release. Claims list shows each draw's activeClaimCount.",
|
|
26088
|
+
summary: "Void a claim with a reason (a claim still waiting for its food too). The set returns to the person and the slot; the prize draw is kept, so a redo shows the same outcome until staff-redemption draw release. Claims list shows each draw's activeClaimCount.",
|
|
26058
26089
|
effects: ["state-change"],
|
|
26059
26090
|
target: "eventId",
|
|
26060
26091
|
dates: [],
|
|
@@ -26140,7 +26171,7 @@ var command_manifest_default = [
|
|
|
26140
26171
|
path: ["staff-redemption", "counter", "context"],
|
|
26141
26172
|
procedure: "event.staffRedemption.getStaffRedemptionCounterContext",
|
|
26142
26173
|
operation: "query",
|
|
26143
|
-
summary: "Counter view for one site (siteId): the event (name, status, dates), items to choose from, the site's sessions with sets and prizes left, and any missing policies. Needs event.operate.",
|
|
26174
|
+
summary: "Counter view for one site (siteId): the event (name, status, dates), counterOrder (FOOD_THEN_DRAW or DRAW_THEN_FOOD, the order crew follow), items to choose from, the site's sessions with sets and prizes left, and any missing policies. sessionRule is the session policy; under ANY_OPEN_SESSION, openSession is the session every counter serves from now (null when none is open) and openSessionChangesAt when that next changes (serverTime is the server clock at the read). Needs event.operate.",
|
|
26144
26175
|
effects: [],
|
|
26145
26176
|
dates: [],
|
|
26146
26177
|
input: {
|
|
@@ -26165,7 +26196,7 @@ var command_manifest_default = [
|
|
|
26165
26196
|
path: ["staff-redemption", "lookup"],
|
|
26166
26197
|
procedure: "event.staffRedemption.lookupStaffRedemptionEmployee",
|
|
26167
26198
|
operation: "mutation",
|
|
26168
|
-
summary: "Look up an Employee ID at a site: who they are, what they already collected and whether a redemption would go ahead (refusal code otherwise). Writes nothing but failed-lookup throttle records, so it needs no confirmation flags. Needs event.operate.",
|
|
26199
|
+
summary: "Look up an Employee ID at a site: who they are, what they already collected (a collected card's receipt carries itemsPending and itemsRecordedAt), the session whose sets would be used (card.session; under ANY_OPEN_SESSION with none open, the next to open or else the last to close) and whether a redemption would go ahead (refusal code otherwise). Writes nothing but failed-lookup throttle records, so it needs no confirmation flags. Needs event.operate.",
|
|
26169
26200
|
effects: [],
|
|
26170
26201
|
dates: [],
|
|
26171
26202
|
input: {
|
|
@@ -26195,7 +26226,7 @@ var command_manifest_default = [
|
|
|
26195
26226
|
path: ["staff-redemption", "redeem"],
|
|
26196
26227
|
procedure: "event.staffRedemption.redeemStaffRedemption",
|
|
26197
26228
|
operation: "mutation",
|
|
26198
|
-
summary: "Redeem for an Employee ID at a site: records the chosen itemIds and reveals the prize outcome the server decides in the same transaction. clientRequestId is a UUID you generate; retry with the same one and you get the stored receipt, never a second redemption. Needs event.operate.",
|
|
26229
|
+
summary: "Redeem for an Employee ID at a site: records the chosen itemIds and reveals the prize outcome the server decides in the same transaction. clientRequestId is a UUID you generate; retry with the same one and you get the stored receipt, never a second redemption. When the event's counterOrder is DRAW_THEN_FOOD, itemIds must be [] (anything else is BAD_REQUEST): the claim, the set and the prize draw are recorded together and the receipt has itemsPending true until staff-redemption claims record-items. The item rule is not checked at the spin. Needs event.operate.",
|
|
26199
26230
|
effects: ["state-change"],
|
|
26200
26231
|
target: "eventId",
|
|
26201
26232
|
dates: [],
|
|
@@ -26242,11 +26273,51 @@ var command_manifest_default = [
|
|
|
26242
26273
|
additionalProperties: false
|
|
26243
26274
|
}
|
|
26244
26275
|
},
|
|
26276
|
+
{
|
|
26277
|
+
path: ["staff-redemption", "claims", "record-items"],
|
|
26278
|
+
procedure: "event.staffRedemption.recordStaffRedemptionClaimItems",
|
|
26279
|
+
operation: "mutation",
|
|
26280
|
+
summary: "Record the food (itemIds, checked against the item rule) for a claim that was drawn first (itemsPending true, counterOrder DRAW_THEN_FOOD). siteId must be the claim's own site (claims list shows it). Writes the items, sets itemsPending false and itemsRecordedAt, and logs it; it deducts no set and makes no draw. Idempotent: the same items again return replayed true with the stored receipt. CONFLICT when different items were already recorded, when the claim is voided, or when the claim was food-first (nothing pending). Needs event.operate at that site (a manager has it). Returns status recorded, replayed and the receipt.",
|
|
26281
|
+
effects: ["state-change"],
|
|
26282
|
+
target: "eventId",
|
|
26283
|
+
dates: [],
|
|
26284
|
+
input: {
|
|
26285
|
+
type: "object",
|
|
26286
|
+
properties: {
|
|
26287
|
+
eventId: {
|
|
26288
|
+
type: "string",
|
|
26289
|
+
minLength: 1,
|
|
26290
|
+
maxLength: 64
|
|
26291
|
+
},
|
|
26292
|
+
siteId: {
|
|
26293
|
+
type: "string",
|
|
26294
|
+
minLength: 1,
|
|
26295
|
+
maxLength: 64
|
|
26296
|
+
},
|
|
26297
|
+
claimId: {
|
|
26298
|
+
type: "string",
|
|
26299
|
+
minLength: 1,
|
|
26300
|
+
maxLength: 64
|
|
26301
|
+
},
|
|
26302
|
+
itemIds: {
|
|
26303
|
+
maxItems: 20,
|
|
26304
|
+
type: "array",
|
|
26305
|
+
items: {
|
|
26306
|
+
type: "string",
|
|
26307
|
+
minLength: 1,
|
|
26308
|
+
maxLength: 64
|
|
26309
|
+
}
|
|
26310
|
+
}
|
|
26311
|
+
},
|
|
26312
|
+
required: ["eventId", "siteId", "claimId", "itemIds"],
|
|
26313
|
+
additionalProperties: false
|
|
26314
|
+
}
|
|
26315
|
+
},
|
|
26245
26316
|
{
|
|
26246
26317
|
path: ["staff-redemption", "counter", "claims"],
|
|
26247
26318
|
procedure: "event.staffRedemption.getStaffRedemptionCounterClaims",
|
|
26248
26319
|
operation: "query",
|
|
26249
|
-
summary: "List a site's recent claims (limit 1-50, default 20) as the counter sees them. scope mine (default) is the claims you made at the site, site is every claim at the site. Needs event.operate.",
|
|
26320
|
+
summary: "List a site's recent claims (limit 1-50, default 20) as the counter sees them. scope mine (default) is the claims you made at the site, site is every claim at the site. Each receipt carries itemsPending and itemsRecordedAt. Needs event.operate.",
|
|
26250
26321
|
effects: [],
|
|
26251
26322
|
dates: [],
|
|
26252
26323
|
input: {
|