@go-labs-sg/event-tech 1.15.0 → 1.17.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/dist/index.js CHANGED
@@ -33,6 +33,19 @@ var __toESM = (mod, isNodeMode, target) => {
33
33
  return to;
34
34
  };
35
35
  var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
36
+ var __returnValue = (v) => v;
37
+ function __exportSetter(name, newValue) {
38
+ this[name] = __returnValue.bind(null, newValue);
39
+ }
40
+ var __export = (target, all) => {
41
+ for (var name in all)
42
+ __defProp(target, name, {
43
+ get: all[name],
44
+ enumerable: true,
45
+ configurable: true,
46
+ set: __exportSetter.bind(all, name)
47
+ });
48
+ };
36
49
  var __require = import.meta.require;
37
50
 
38
51
  // ../../../node_modules/.bun/dotenv@18.0.10/node_modules/dotenv/dist/index.cjs
@@ -10631,6 +10644,16 @@ var require_papaparse = __commonJS(function(exports, module) {
10631
10644
  });
10632
10645
  });
10633
10646
 
10647
+ // ../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/classic/coerce.js
10648
+ var exports_coerce = {};
10649
+ __export(exports_coerce, {
10650
+ bigint: () => bigint2,
10651
+ boolean: () => boolean3,
10652
+ date: () => date3,
10653
+ number: () => number3,
10654
+ string: () => string3
10655
+ });
10656
+
10634
10657
  // src/load-env.ts
10635
10658
  var import_dotenv = __toESM(require_dist(), 1);
10636
10659
  import path from "path";
@@ -11662,6 +11685,7 @@ function datetime(args) {
11662
11685
  return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
11663
11686
  }
11664
11687
  var anyString = /^[\s\S]{0,}$/;
11688
+ var bigint = /^-?\d+n?$/;
11665
11689
  var number = /^-?\d+(?:\.\d+)?$/;
11666
11690
  var boolean = /^(?:true|false)$/i;
11667
11691
  var _null = /^null$/i;
@@ -12601,6 +12625,25 @@ var $ZodBoolean = /* @__PURE__ */ $constructor("$ZodBoolean", (inst, def) => {
12601
12625
  return payload;
12602
12626
  };
12603
12627
  });
12628
+ var $ZodBigInt = /* @__PURE__ */ $constructor("$ZodBigInt", (inst, def) => {
12629
+ $ZodType.init(inst, def);
12630
+ inst._zod.pattern = bigint;
12631
+ inst._zod.parse = (payload, _ctx) => {
12632
+ if (def.coerce)
12633
+ try {
12634
+ payload.value = BigInt(payload.value);
12635
+ } catch (_) {}
12636
+ if (typeof payload.value === "bigint")
12637
+ return payload;
12638
+ payload.issues.push({
12639
+ expected: "bigint",
12640
+ code: "invalid_type",
12641
+ input: payload.value,
12642
+ inst
12643
+ });
12644
+ return payload;
12645
+ };
12646
+ });
12604
12647
  var $ZodNull = /* @__PURE__ */ $constructor("$ZodNull", (inst, def) => {
12605
12648
  $ZodType.init(inst, def);
12606
12649
  inst._zod.pattern = _null;
@@ -14036,6 +14079,9 @@ function snapshotChecks(def) {
14036
14079
  function _string(Class, params) {
14037
14080
  return new Class(snapshotChecks({ type: "string", ...normalizeParams(params) }));
14038
14081
  }
14082
+ function _coercedString(Class, params) {
14083
+ return new Class(snapshotChecks({ type: "string", coerce: true, ...normalizeParams(params) }));
14084
+ }
14039
14085
  function _email(Class, params) {
14040
14086
  return new Class({
14041
14087
  type: "string",
@@ -14276,6 +14322,9 @@ function _isoDuration(Class, params) {
14276
14322
  function _number(Class, params) {
14277
14323
  return new Class(snapshotChecks({ type: "number", checks: [], ...normalizeParams(params) }));
14278
14324
  }
14325
+ function _coercedNumber(Class, params) {
14326
+ return new Class(snapshotChecks({ type: "number", coerce: true, checks: [], ...normalizeParams(params) }));
14327
+ }
14279
14328
  function _int(Class, params) {
14280
14329
  return new Class({
14281
14330
  type: "number",
@@ -14291,6 +14340,20 @@ function _boolean(Class, params) {
14291
14340
  ...normalizeParams(params)
14292
14341
  });
14293
14342
  }
14343
+ function _coercedBoolean(Class, params) {
14344
+ return new Class({
14345
+ type: "boolean",
14346
+ coerce: true,
14347
+ ...normalizeParams(params)
14348
+ });
14349
+ }
14350
+ function _coercedBigint(Class, params) {
14351
+ return new Class({
14352
+ type: "bigint",
14353
+ coerce: true,
14354
+ ...normalizeParams(params)
14355
+ });
14356
+ }
14294
14357
  function _null2(Class, params) {
14295
14358
  return new Class({
14296
14359
  type: "null",
@@ -14314,6 +14377,13 @@ function _date(Class, params) {
14314
14377
  ...normalizeParams(params)
14315
14378
  });
14316
14379
  }
14380
+ function _coercedDate(Class, params) {
14381
+ return new Class({
14382
+ type: "date",
14383
+ coerce: true,
14384
+ ...normalizeParams(params)
14385
+ });
14386
+ }
14317
14387
  function _lt(value, params) {
14318
14388
  return new $ZodCheckLessThan({
14319
14389
  check: "less_than",
@@ -15195,6 +15265,9 @@ var numberProcessor = (schema, ctx, _json, params) => {
15195
15265
  var booleanProcessor = (_schema, _ctx, json, _params) => {
15196
15266
  json.type = "boolean";
15197
15267
  };
15268
+ var bigintProcessor = (schema, ctx, json, params) => {
15269
+ handleUnrepresentable(schema, ctx, json, params, "BigInt cannot be represented in JSON Schema");
15270
+ };
15198
15271
  var nullProcessor = (_schema, ctx, json, _params) => {
15199
15272
  if (ctx.target === "openapi-3.0") {
15200
15273
  json.type = "string";
@@ -15864,6 +15937,9 @@ var ZodUUID = /* @__PURE__ */ $constructor("ZodUUID", (inst, def) => {
15864
15937
  $ZodUUID.init(inst, def);
15865
15938
  ZodStringFormat.init(inst, def);
15866
15939
  });
15940
+ function uuid2(params) {
15941
+ return _uuid(ZodUUID, params);
15942
+ }
15867
15943
  var ZodURL = /* @__PURE__ */ $constructor("ZodURL", (inst, def) => {
15868
15944
  $ZodURL.init(inst, def);
15869
15945
  ZodStringFormat.init(inst, def);
@@ -16012,6 +16088,49 @@ var ZodBoolean = /* @__PURE__ */ $constructor("ZodBoolean", (inst, def) => {
16012
16088
  function boolean2(params) {
16013
16089
  return _boolean(ZodBoolean, params);
16014
16090
  }
16091
+ var ZodBigInt = /* @__PURE__ */ $constructor("ZodBigInt", (inst, def) => {
16092
+ $ZodBigInt.init(inst, def);
16093
+ ZodType.init(inst, def);
16094
+ inst._zod.processJSONSchema = (ctx, json, params) => bigintProcessor(inst, ctx, json, params);
16095
+ }, /* @__PURE__ */ derived({
16096
+ minValue: (inst) => aggregateChecks(inst).minimum ?? null,
16097
+ maxValue: (inst) => aggregateChecks(inst).maximum ?? null,
16098
+ format: (inst) => aggregateChecks(inst).format ?? null
16099
+ }, {
16100
+ gte(value, params) {
16101
+ return this.check(_gte(value, params));
16102
+ },
16103
+ min(value, params) {
16104
+ return this.check(_gte(value, params));
16105
+ },
16106
+ gt(value, params) {
16107
+ return this.check(_gt(value, params));
16108
+ },
16109
+ lt(value, params) {
16110
+ return this.check(_lt(value, params));
16111
+ },
16112
+ lte(value, params) {
16113
+ return this.check(_lte(value, params));
16114
+ },
16115
+ max(value, params) {
16116
+ return this.check(_lte(value, params));
16117
+ },
16118
+ positive(params) {
16119
+ return this.check(_gt(BigInt(0), params));
16120
+ },
16121
+ negative(params) {
16122
+ return this.check(_lt(BigInt(0), params));
16123
+ },
16124
+ nonpositive(params) {
16125
+ return this.check(_lte(BigInt(0), params));
16126
+ },
16127
+ nonnegative(params) {
16128
+ return this.check(_gte(BigInt(0), params));
16129
+ },
16130
+ multipleOf(value, params) {
16131
+ return this.check(_multipleOf(value, params));
16132
+ }
16133
+ }));
16015
16134
  var ZodNull = /* @__PURE__ */ $constructor("ZodNull", (inst, def) => {
16016
16135
  $ZodNull.init(inst, def);
16017
16136
  ZodType.init(inst, def);
@@ -16139,6 +16258,14 @@ function object(shape, params) {
16139
16258
  };
16140
16259
  return new ZodObject(def);
16141
16260
  }
16261
+ function strictObject(shape, params) {
16262
+ return new ZodObject({
16263
+ type: "object",
16264
+ shape,
16265
+ catchall: never(),
16266
+ ...normalizeParams(params)
16267
+ });
16268
+ }
16142
16269
  var ZodUnion = /* @__PURE__ */ $constructor("ZodUnion", (inst, def) => {
16143
16270
  $ZodUnion.init(inst, def);
16144
16271
  ZodType.init(inst, def);
@@ -16443,6 +16570,22 @@ function _instanceof(cls, params = {}) {
16443
16570
  };
16444
16571
  return inst;
16445
16572
  }
16573
+ // ../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/classic/coerce.js
16574
+ function string3(params) {
16575
+ return _coercedString(ZodString, params);
16576
+ }
16577
+ function number3(params) {
16578
+ return _coercedNumber(ZodNumber, params);
16579
+ }
16580
+ function boolean3(params) {
16581
+ return _coercedBoolean(ZodBoolean, params);
16582
+ }
16583
+ function bigint2(params) {
16584
+ return _coercedBigint(ZodBigInt, params);
16585
+ }
16586
+ function date3(params) {
16587
+ return _coercedDate(ZodDate, params);
16588
+ }
16446
16589
  // ../../cli-auth/src/protocol/schemas.ts
16447
16590
  var dateTimeString = string2().refine((value) => Number.isFinite(Date.parse(value)), "Invalid datetime");
16448
16591
  var base64Url2 = string2().min(43).max(128).regex(/^[A-Za-z0-9_-]+$/);
@@ -17182,8 +17325,8 @@ var logoutCliSession = async ({
17182
17325
  };
17183
17326
  // src/cli.ts
17184
17327
  import { readFileSync } from "fs";
17185
- import { readFile as readFile6 } from "fs/promises";
17186
- import { basename as basename4, resolve } from "path";
17328
+ import { readFile as readFile7 } from "fs/promises";
17329
+ import { basename as basename5, resolve } from "path";
17187
17330
 
17188
17331
  // ../db/src/generated/prisma/enums.ts
17189
17332
  var EventType = {
@@ -17196,7 +17339,8 @@ var EventType = {
17196
17339
  SIGNATURE_WALL: "SIGNATURE_WALL",
17197
17340
  GARDENS_BY_THE_BAY: "GARDENS_BY_THE_BAY",
17198
17341
  RATING_SYSTEM: "RATING_SYSTEM",
17199
- EVENT_PASSPORT: "EVENT_PASSPORT"
17342
+ EVENT_PASSPORT: "EVENT_PASSPORT",
17343
+ STAFF_REDEMPTION: "STAFF_REDEMPTION"
17200
17344
  };
17201
17345
 
17202
17346
  // ../validators/src/event-type.schema.ts
@@ -18755,7 +18899,9 @@ var booleanFlags = new Set([
18755
18899
  "allow-delete",
18756
18900
  "allow-email",
18757
18901
  "allow-state-change",
18902
+ "archive-missing",
18758
18903
  "dry-run",
18904
+ "force",
18759
18905
  "help",
18760
18906
  "no-browser",
18761
18907
  "password-stdin",
@@ -18923,14 +19069,15 @@ Usage:
18923
19069
  et passport overview --event-id <id>
18924
19070
  et passport mine --event-id <id>
18925
19071
  et passport login-options --event-id <id>
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)
18926
19073
  et passport bingo enable --event-id <id> (host: creates the hidden Bingo station and the HumanBingo)
18927
19074
  et passport bingo rename --event-id <id> --name <name> (host: the game's display name guests see; 1-100 chars, default "Human Bingo")
18928
19075
  et passport bingo join --event-id <id> (guest, passport participants only)
18929
19076
  et passport bingo claim-stamp --event-id <id> (guest: catch-up award for a completed card)
18930
19077
  et passport bingo status --event-id <id> (guest: own bingo progress and stamp)
18931
19078
  et passport export --event-id <id>
18932
- et passport settings update --event-id <id> --settings-json <json> (maxRedemptionsPerParticipant 0 = no cap; optional guestScan and simplifiedChinese true|false)
18933
- et passport station upsert --event-id <id> --station-json <json> (collection.stampValue 0-1000, default 1; collection.category GAME|FOOD|DRINK|BINGO, default GAME)
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)
18934
19081
  et passport station-access get --event-id <id>
18935
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)
18936
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)
@@ -18944,6 +19091,7 @@ Usage:
18944
19091
  et passport station image-set --event-id <id> --station-id <id> --file <path> --content-type <image-mime>
18945
19092
  et passport station image-clear --event-id <id> --station-id <id>
18946
19093
  et passport station hidden --event-id <id> --station-id <id> --hidden <true|false>
19094
+ et passport station queue-status --event-id <id> --station-id <id> --status <under-10|under-30|over-30|clear> (set or clear the wait guests see; clear returns the station to the "< 10 mins" default; needs queueStatus on; re-sending a wait refreshes its time)
18947
19095
  et passport station archive --event-id <id> --station-id <id> --allow-state-change --target <same-event-id>
18948
19096
  et passport station print-get --event-id <id> --station-id <id>
18949
19097
  et passport station print-issue --event-id <id> --station-id <id> --expected-printed-qr-version <n>
@@ -18959,7 +19107,7 @@ Usage:
18959
19107
  et passport prize image-set --event-id <id> --prize-id <id> --file <path> --content-type <image-mime>
18960
19108
  et passport prize image-clear --event-id <id> --prize-id <id>
18961
19109
  et passport prize archive --event-id <id> --prize-id <id> --allow-state-change --target <same-event-id>
18962
- et passport redemption create --event-id <id> --participant-id <id> --prize-id <id> [--quantity <1-20>]
19110
+ et passport redemption create --event-id <id> --participant-id <id> --prize-id <id> [--quantity <1-20>] [--award-station-id <id>] [--request-id <uuid>]
18963
19111
  et passport redemption reverse --event-id <id> --redemption-id <id> --reason <text> --allow-state-change --target <same-event-id>
18964
19112
  et passport tally record --event-id <id> --station-id <id> --profile-code <code> --item <name> [--quantity <1-20>]
18965
19113
  et passport tally reverse --event-id <id> --tally-id <id> --reason <text> --allow-state-change --target <same-event-id>
@@ -18971,6 +19119,8 @@ Usage:
18971
19119
  et passport roster upsert --event-id <id> --entry-json <json> ({id?,staffId,lastName,displayName}; lastName may be null only when the event does not require it)
18972
19120
  et passport roster remove --event-id <id> --entry-id <id> --allow-state-change --target <same-event-id>
18973
19121
  et passport roster purge --event-id <id> --allow-state-change --target <same-event-id>
19122
+ et staff-redemption roster import --event-id <id> --file <path.csv|path.xlsx> [--sheet <name>] [--employee-id-column <header>] [--name-column <header|none>] [--site-column <header|none>] [--shift-column <header|none>] [--work-shift-column <header|none>] [--allowance-column <header|none>] [--archive-missing] --allow-state-change --target <same-event-id>
19123
+ et staff-redemption export --event-id <id> [--search <text>] [--site-id <id>] [--session-id <id>] [--status <active|voided|all>] [--csv-file <path> [--force]]
18974
19124
 
18975
19125
  Event Passport:
18976
19126
  Uses the same typed procedures and event permissions as the web app.
@@ -18986,8 +19136,15 @@ Event Passport:
18986
19136
  pick a station and stamp guests. station-access get shows whether a password is set and how many station sessions are
18987
19137
  active; set-password (stdin only) and clear-password both end every existing station session; no password means links are
18988
19138
  off. stamps stats reports per-station stamp counts; stamps recipients lists who each station stamped and how
18989
- (issuedBy.kind: participant self-scan, station-link, staff by name, or bingo for a bingo award; page with
19139
+ (issuedBy.kind: participant self-scan, station-link, staff by name, bingo for a bingo award, or prize-desk for a stamp
19140
+ awarded with a prize redemption; page with
18990
19141
  --cursor, backward needs a cursor). Station sessions themselves are browser-only.
19142
+ Prize-desk award: collection.prizeDeskAward (true|false, SELF_SCAN and STAFF_SCAN only, not the Bingo category; omit
19143
+ to keep, absent means off) lets crew give that station's stamp with a prize. redemption create --award-station-id
19144
+ <id> gives one such station's stamp (its stampValue, source PRIZE_DESK) in the same transaction as the redemption;
19145
+ the redemption's own checks use the balance before it, a station the participant already holds is refused, and
19146
+ redemption reverse revokes the awarded stamp. participant detail lists awardStations (alreadyCollected,
19147
+ blockedReason) and redemptions[].awardedStation. --request-id makes a retry safe (a retry of a since-reversed redemption is refused; use a new id).
18991
19148
  Station cover art: image-set uploads a jpeg/png/webp/gif (up to 25 MB) to the event's station-art folder and
18992
19149
  saves it as the station's imageKey, keeping every other station setting; image-clear removes it. A new
18993
19150
  imageKey given in station JSON must be an upload to this event's event-passport/stations folder.
@@ -19001,10 +19158,14 @@ Event Passport:
19001
19158
  focal point; null clears heroImage or logo. skin upload --kind hero|logo returns the key to reference
19002
19159
  in skin set. skin clear returns the event to the Go Labs default look and keeps the rest of the appearance.
19003
19160
  Other appearance saves that omit passport keep the stored skin. colors.dark needs 4.5:1 contrast with white.
19161
+ Staff Redemption events use the same block and commands: colors.graphic, colors.dark and emphasis (with the event
19162
+ theme) also theme the crew counter and its prize wheel (Settings > Appearance > Counter look). heroImage and logo are
19163
+ Passport-only: the counter ignores them; skin set keeps stored ones unless the patch names them, skin clear resets
19164
+ the whole block.
19004
19165
  Date-time fields are ISO strings or null; order defaults to zero.
19005
19166
  Settings JSON requires linkedDrawEventId, luckyDrawStampThreshold, prizeStampThreshold,
19006
19167
  maxRedemptionsPerParticipant; optional loginMethods is {emailOtp,google,guest,staffId,staffIdRequiresLastName}.
19007
- Keep email OTP, Google or Staff ID enabled for recovery; staffId defaults to false and
19168
+ Keep email OTP, Google or roster sign-in (staffId) enabled for recovery; staffId defaults to false and
19008
19169
  staffIdRequiresLastName to true, so set it false again whenever you resend loginMethods.
19009
19170
  Omit loginMethods to preserve it. Optional guestScan (boolean) turns guest station QR scanning
19010
19171
  on or off; omit it to keep the stored value (absent means on). When off, guests cannot self-scan
@@ -19012,6 +19173,28 @@ Event Passport:
19012
19173
  passport.guestScan and mine shows settings.guestScanEnabled. Optional simplifiedChinese (boolean,
19013
19174
  absent means off) offers a Simplified Chinese option on the guest passport; organiser-entered text
19014
19175
  stays as entered. overview shows passport.simplifiedChinese and login-options shows simplifiedChinese.
19176
+ Optional staffIdLabel (string up to 40 chars, or null to reset) names the roster identifier guests,
19177
+ station crew and organisers see; it defaults to "Employee Number", so send "Staff ID" for events
19178
+ that call it that. Omit it to keep the stored label; the Chinese passport keeps \u5458\u5DE5\u7F16\u53F7. overview
19179
+ shows passport.staffIdLabel, login-options shows staffIdLabel, mine shows settings.staffIdLabel and
19180
+ export returns staffIdLabel. Only the wording changes; the staffId fields and flags keep their names.
19181
+ Optional categoryLabels ({GAME,FOOD,DRINK,BINGO: {en,"zh-CN"}}, each name 1-40 chars after trimming, or null
19182
+ to clear) renames the station categories guests, crew and organisers see; omit it to keep the stored names,
19183
+ send an object to replace them all (a blank name means the built-in wording) and null to clear them. A
19184
+ Simplified Chinese guest sees the zh-CN name, else the built-in Chinese, never the English one. overview
19185
+ shows passport.categoryLabels, login-options shows categoryLabels and mine shows settings.categoryLabels.
19186
+ Optional queueStatus (boolean, absent means off) lets station crew set a wait per station that guests
19187
+ see in their passport: under-10, under-30 or over-30 minutes. Optional queueStatusStaleMinutes (1-240,
19188
+ or null to reset to 10) is how long a set wait stays trusted before guests see "Not updated recently".
19189
+ overview shows passport.queueStatus, passport.queueStatusStaleMinutes and each station's queueStatus
19190
+ ({status,updatedAt} for a crew-set wait, else null) and queueStatusDefault; queue-status shows the guest
19191
+ view. While queueStatus is on, every visible station shows a wait: a station crew never set (or cleared)
19192
+ has queueStatus null and queueStatusDefault UNDER_10_MIN ("< 10 mins"), a default that never goes stale; a
19193
+ crew-set wait overrides it (queueStatusDefault null) and reads "Not updated recently" after
19194
+ queueStatusStaleMinutes. queueStatusDefault is null while queueStatus is off and for hidden stations.
19195
+ station queue-status sets or clears one wait as an event operator (crew do the same in the browser; clear
19196
+ prints queueStatus null and queueStatusDefault UNDER_10_MIN), is refused while queueStatus is off, and
19197
+ every change is recorded in the activity log. Turning queueStatus off hides waits from guests but keeps them.
19015
19198
  Staff roster (event hosts only): import replaces the roster and returns imported, replaced and
19016
19199
  rejected rows (blank, too long, or a Staff ID repeated in the file). Columns are matched from
19017
19200
  header names; override with the column flags. Without a last-name column, the last name is
@@ -19026,6 +19209,28 @@ Event Passport:
19026
19209
  Points are scores only; existing stamp-based Lucky Draw and prize thresholds still apply.
19027
19210
  Guest enrollment and account-linking require the browser; CLI uses existing device-approved auth.
19028
19211
 
19212
+ Staff redemption (STAFF_REDEMPTION events; most commands are registry commands, see below):
19213
+ Crew look up an Employee ID at a site counter, record the food items handed over and reveal a prize
19214
+ outcome the server decides in the same transaction. Setup is: settings, sites, crew passwords,
19215
+ sessions (one per shift), slots (sets per session and site), item groups and items, prizes, prize
19216
+ stock, roster. Run 'et staff-redemption setup get' for the IDs and what is still missing.
19217
+ roster import reads a CSV, or an XLSX sheet (the first unless --sheet <name> names another; an unknown
19218
+ name lists the workbook's sheets; a CSV has no sheets and refuses --sheet), matches columns from header names (override
19219
+ with the column flags; "none" clears an optional column), adds new Employee IDs and updates existing
19220
+ ones, and reports created, updated, unchanged, archived, rejectedCount, rejected rows and
19221
+ unmatchedSites. Existing rows are never deleted, so redemptions survive a re-import; --archive-missing archives active entries that are not in the file.
19222
+ Use --sheet "Master list" to import that tab of a workbook (exact name, else ignoring case and spaces).
19223
+ export prints the redemption rows as JSON, or with --csv-file writes a CSV (UTF-8 with BOM, CRLF,
19224
+ one row per claim, oldest first, text that would run as a spreadsheet formula gets a leading
19225
+ apostrophe) and prints { file, rows }. It never overwrites a file unless --force. It needs event.export
19226
+ and fails above 20,000 rows; narrow the filters.
19227
+ Crew sign-in with a site password and the counter access check are browser-only; the CLI operates
19228
+ counters as event staff (event.operate) and names the site with siteId.
19229
+ Archive and unarchive use 'staff-redemption archive set' with archived true or false.
19230
+ Every write repeats the event ID as --target. Lookup needs no confirmation (it writes nothing
19231
+ but failed-lookup throttle records). Redeem takes a clientRequestId UUID you generate;
19232
+ retrying with the same UUID returns the stored receipt and never redeems twice.
19233
+
19029
19234
  Organization and event setup:
19030
19235
  organization create is global-admin only. It provisions the org and emails an owner invitation
19031
19236
  to --owner-email after it is saved; deliveryStatus (sent/failed) and
@@ -19066,7 +19271,9 @@ Registry commands (staff and admin operations, one per API procedure):
19066
19271
  admin organization/event/member/user/activity/dashboard, event access/details/update/
19067
19272
  status-update/archive/restore/duplicate/export/recent/background/story, activity list,
19068
19273
  lucky-draw winners/boards/participants eligible|delete/wheel/passport-sync,
19069
- passport lucky-draws/operator-metadata, photo-wall, post-it, signature-wall, rating, human-bingo.
19274
+ passport lucky-draws/operator-metadata, photo-wall, post-it, signature-wall, rating, human-bingo,
19275
+ staff-redemption setup/settings/site/crew-password/session/slot/item-group/item/prize/prize-stock/
19276
+ archive/roster list|counts|upsert/claims/draw/stock/counter/lookup/redeem.
19070
19277
  --input is passed unchanged to the procedure, so field names match the web app.
19071
19278
  Date fields take ISO 8601 strings and are sent as dates.
19072
19279
  Writes require --allow-state-change and --target equal to the input key shown by --help
@@ -19507,16 +19714,35 @@ var columnIndex = (reference) => {
19507
19714
  index = index * 26 + letter.charCodeAt(0) - 64;
19508
19715
  return index - 1;
19509
19716
  };
19510
- var readFirstSheetPath = async (zip) => {
19717
+ var sheetPathFromTarget = (target) => target.startsWith("/") ? target.slice(1) : `xl/${target}`;
19718
+ var readWorkbookSheets = async (zip) => {
19511
19719
  const workbook = await zip.file("xl/workbook.xml")?.async("string");
19720
+ if (!workbook)
19721
+ return [];
19512
19722
  const rels = await zip.file("xl/_rels/workbook.xml.rels")?.async("string");
19513
- const sheetTag = workbook ? /<sheet\b[^>]*>/.exec(workbook)?.[0] : undefined;
19514
- const relationId = sheetTag ? attribute(sheetTag, "r:id") : undefined;
19515
- const relationship = rels ? [...rels.matchAll(/<Relationship\b[^>]*>/g)].map((match) => match[0]).find((tag) => attribute(tag, "Id") === relationId) : undefined;
19516
- const target = relationship ? attribute(relationship, "Target") : undefined;
19517
- if (!target)
19518
- return "xl/worksheets/sheet1.xml";
19519
- return target.startsWith("/") ? target.slice(1) : `xl/${target}`;
19723
+ const relationships = rels ? [...rels.matchAll(/<Relationship\b[^>]*>/g)].map((match) => match[0]) : [];
19724
+ return [...workbook.matchAll(/<sheet\b[^>]*>/g)].map((match) => {
19725
+ const relationId = attribute(match[0], "r:id");
19726
+ const relationship = relationships.find((tag) => attribute(tag, "Id") === relationId);
19727
+ const target = relationship ? attribute(relationship, "Target") : undefined;
19728
+ return {
19729
+ name: decodeXml(attribute(match[0], "name") ?? ""),
19730
+ path: target ? sheetPathFromTarget(target) : undefined
19731
+ };
19732
+ });
19733
+ };
19734
+ var DEFAULT_SHEET_PATH = "xl/worksheets/sheet1.xml";
19735
+ var unknownSheetError = (sheetName, sheets) => new Error(`The workbook has no sheet named "${sheetName}". Sheets: ${sheets.map((sheet) => `"${sheet.name}"`).join(", ") || "none"}.`);
19736
+ var resolveSheetPath = (sheets, sheetName) => {
19737
+ if (sheetName === undefined)
19738
+ return sheets[0]?.path ?? DEFAULT_SHEET_PATH;
19739
+ const wanted = sheetName.trim().toLowerCase();
19740
+ const sheet = sheets.find((candidate) => candidate.name === sheetName) ?? sheets.find((candidate) => candidate.name.trim().toLowerCase() === wanted);
19741
+ if (!sheet)
19742
+ throw unknownSheetError(sheetName, sheets);
19743
+ if (!sheet.path)
19744
+ throw new Error(`The sheet "${sheet.name}" could not be read.`);
19745
+ return sheet.path;
19520
19746
  };
19521
19747
  var cellValue = (cellXml, sharedStrings) => {
19522
19748
  const open = /^<c\b[^>]*>/.exec(cellXml)?.[0] ?? "";
@@ -19553,10 +19779,11 @@ var readRowCells = (rowXml, sharedStrings) => {
19553
19779
  }
19554
19780
  return cells;
19555
19781
  };
19556
- var readXlsx = async (bytes) => {
19782
+ var readXlsx = async (bytes, sheetName) => {
19557
19783
  const zip = await import_jszip.default.loadAsync(bytes);
19558
19784
  const sharedStrings = await readSharedStrings(zip);
19559
- const sheet = await zip.file(await readFirstSheetPath(zip))?.async("string");
19785
+ const sheetPath = resolveSheetPath(await readWorkbookSheets(zip), sheetName);
19786
+ const sheet = await zip.file(sheetPath)?.async("string");
19560
19787
  if (!sheet)
19561
19788
  throw new Error("The workbook has no readable sheet.");
19562
19789
  const table = [];
@@ -19593,12 +19820,19 @@ var squareTable = (table) => {
19593
19820
  const width = Math.max(0, ...table.map((row) => row.length));
19594
19821
  return table.map((row) => Array.from({ length: width }, (_, index) => row[index] ?? ""));
19595
19822
  };
19596
- var readSpreadsheetTable = async (fileName, data) => {
19597
- const bytes = data instanceof Uint8Array ? data : new Uint8Array(data);
19598
- const lower = fileName.toLowerCase();
19599
- if (lower.endsWith(".xls"))
19823
+ var toBytes = (data) => data instanceof Uint8Array ? data : new Uint8Array(data);
19824
+ var isXlsx = (fileName, bytes) => fileName.toLowerCase().endsWith(".xlsx") || isZip(bytes);
19825
+ var assertNotLegacyXls = (fileName) => {
19826
+ if (fileName.toLowerCase().endsWith(".xls"))
19600
19827
  throw new Error("Save the file as .xlsx or .csv and try again.");
19601
- const table = lower.endsWith(".xlsx") || isZip(bytes) ? await readXlsx(bytes) : readCsv(bytes);
19828
+ };
19829
+ var readSpreadsheetTable = async (fileName, data, options = {}) => {
19830
+ assertNotLegacyXls(fileName);
19831
+ const bytes = toBytes(data);
19832
+ const xlsx = isXlsx(fileName, bytes);
19833
+ if (!xlsx && options.sheetName !== undefined)
19834
+ throw new Error("A CSV file has no sheets. Remove the sheet name or use an .xlsx file.");
19835
+ const table = xlsx ? await readXlsx(bytes, options.sheetName) : readCsv(bytes);
19602
19836
  const squared = squareTable(table);
19603
19837
  if (squared.length === 0)
19604
19838
  throw new Error("The file is empty.");
@@ -19622,6 +19856,28 @@ var PASSPORT_STATION_CATEGORIES = [
19622
19856
  "BINGO"
19623
19857
  ];
19624
19858
  var passportStationCategorySchema = _enum(PASSPORT_STATION_CATEGORIES);
19859
+ var PASSPORT_CATEGORY_LABEL_MAX = 40;
19860
+ var PASSPORT_CATEGORY_LABEL_LOCALES = ["en", "zh-CN"];
19861
+ var passportCategoryLabelTextSchema = string2().trim().min(1).max(PASSPORT_CATEGORY_LABEL_MAX);
19862
+ var sanitizePassportCategoryLabels = (value) => {
19863
+ if (typeof value !== "object" || value === null || Array.isArray(value))
19864
+ return;
19865
+ const labels = {};
19866
+ for (const category of PASSPORT_STATION_CATEGORIES) {
19867
+ const entry = Reflect.get(value, category);
19868
+ if (typeof entry !== "object" || entry === null)
19869
+ continue;
19870
+ const names = {};
19871
+ for (const locale of PASSPORT_CATEGORY_LABEL_LOCALES) {
19872
+ const parsed = passportCategoryLabelTextSchema.safeParse(Reflect.get(entry, locale));
19873
+ if (parsed.success)
19874
+ names[locale] = parsed.data;
19875
+ }
19876
+ if (Object.keys(names).length > 0)
19877
+ labels[category] = names;
19878
+ }
19879
+ return Object.keys(labels).length > 0 ? labels : undefined;
19880
+ };
19625
19881
  var passportTallyItemsSchema = array(string2().trim().min(1).max(PASSPORT_TALLY_ITEM_NAME_MAX)).min(1).max(PASSPORT_TALLY_ITEMS_MAX).superRefine((items, context) => {
19626
19882
  const seen = new Set;
19627
19883
  items.forEach((item, index) => {
@@ -19682,14 +19938,33 @@ var passportLoginMethodsSchema = object({
19682
19938
  staffId: boolean2().default(false),
19683
19939
  staffIdRequiresLastName: boolean2().default(true)
19684
19940
  }).strict().refine((methods) => methods.emailOtp || methods.google || methods.staffId, {
19685
- message: "Keep email OTP, Google or Staff ID available for passport recovery."
19941
+ message: "Keep email OTP, Google or roster sign-in available for passport recovery."
19686
19942
  });
19943
+ var PASSPORT_QUEUE_STATUSES = [
19944
+ "UNDER_10_MIN",
19945
+ "UNDER_30_MIN",
19946
+ "OVER_30_MIN"
19947
+ ];
19948
+ var passportQueueStatusSchema = _enum(PASSPORT_QUEUE_STATUSES);
19949
+ var PASSPORT_QUEUE_STATUS_STALE_MINUTES_MIN = 1;
19950
+ var PASSPORT_QUEUE_STATUS_STALE_MINUTES_MAX = 240;
19951
+ var PASSPORT_STAFF_ID_LABEL_DEFAULT = "Employee Number";
19952
+ var PASSPORT_STAFF_ID_LABEL_MAX = 40;
19953
+ var passportStaffIdLabelSchema = string2().trim().min(1).max(PASSPORT_STAFF_ID_LABEL_MAX);
19687
19954
  var passportConfigSchema = object({
19688
19955
  version: literal(1),
19689
19956
  loginMethods: passportLoginMethodsSchema,
19690
19957
  guestScan: boolean2().optional(),
19691
- simplifiedChinese: boolean2().optional()
19958
+ simplifiedChinese: boolean2().optional(),
19959
+ staffIdLabel: passportStaffIdLabelSchema.optional().catch(undefined),
19960
+ categoryLabels: unknown().transform(sanitizePassportCategoryLabels).optional(),
19961
+ queueStatus: boolean2().optional().catch(undefined),
19962
+ queueStatusStaleMinutes: number2().int().min(PASSPORT_QUEUE_STATUS_STALE_MINUTES_MIN).max(PASSPORT_QUEUE_STATUS_STALE_MINUTES_MAX).optional().catch(undefined)
19692
19963
  });
19964
+ var PRIZE_DESK_AWARD_MODES = [
19965
+ "SELF_SCAN",
19966
+ "STAFF_SCAN"
19967
+ ];
19693
19968
  var passportStationConfigSchema = object({
19694
19969
  version: literal(1),
19695
19970
  collectionMode: _enum([
@@ -19705,6 +19980,7 @@ var passportStationConfigSchema = object({
19705
19980
  category: passportStationCategorySchema.optional(),
19706
19981
  tallyItems: passportTallyItemsSchema.optional(),
19707
19982
  tallyEarnsStamp: boolean2().optional(),
19983
+ prizeDeskAward: boolean2().optional(),
19708
19984
  info: passportStationInfoSchema.optional().catch(undefined)
19709
19985
  }).superRefine((config, context) => {
19710
19986
  const tally = config.collectionMode === "STAFF_TALLY";
@@ -19722,6 +19998,22 @@ var passportStationConfigSchema = object({
19722
19998
  message: "Only tally stations can list items."
19723
19999
  });
19724
20000
  }
20001
+ if (config.prizeDeskAward === true) {
20002
+ if (!PRIZE_DESK_AWARD_MODES.includes(config.collectionMode)) {
20003
+ context.addIssue({
20004
+ code: "custom",
20005
+ path: ["prizeDeskAward"],
20006
+ message: "Only self-scan and staff-scan stations can be awarded at the prize desk."
20007
+ });
20008
+ }
20009
+ if (config.category === "BINGO") {
20010
+ context.addIssue({
20011
+ code: "custom",
20012
+ path: ["prizeDeskAward"],
20013
+ message: "The Bingo station cannot be awarded at the prize desk."
20014
+ });
20015
+ }
20016
+ }
19725
20017
  if (config.collectionMode !== "STAFF_SCORE" && config.maxPoints !== 0) {
19726
20018
  context.addIssue({
19727
20019
  code: "custom",
@@ -19742,12 +20034,14 @@ var passportStationCollectionSchema = discriminatedUnion("collectionMode", [
19742
20034
  collectionMode: literal("SELF_SCAN"),
19743
20035
  stampValue: stampValueSchema.optional(),
19744
20036
  category: passportStationCategorySchema.optional(),
20037
+ prizeDeskAward: boolean2().optional(),
19745
20038
  info: passportStationInfoInputSchema.optional()
19746
20039
  }).strict(),
19747
20040
  object({
19748
20041
  collectionMode: literal("STAFF_SCAN"),
19749
20042
  stampValue: stampValueSchema.optional(),
19750
20043
  category: passportStationCategorySchema.optional(),
20044
+ prizeDeskAward: boolean2().optional(),
19751
20045
  info: passportStationInfoInputSchema.optional()
19752
20046
  }).strict(),
19753
20047
  object({
@@ -19811,6 +20105,17 @@ var requestPassportAccountLinkOtpSchema = passportAccountLinkIntentSchema.extend
19811
20105
  var joinPassportSchema = passportEventIdSchema.extend({
19812
20106
  name: string2().trim().min(1).max(100)
19813
20107
  });
20108
+ var passportCategoryLabelInputSchema = string2().trim().max(PASSPORT_CATEGORY_LABEL_MAX);
20109
+ var passportCategoryLabelEntryInputSchema = strictObject({
20110
+ en: passportCategoryLabelInputSchema.optional(),
20111
+ "zh-CN": passportCategoryLabelInputSchema.optional()
20112
+ });
20113
+ var passportCategoryLabelsInputSchema = strictObject({
20114
+ GAME: passportCategoryLabelEntryInputSchema.optional(),
20115
+ FOOD: passportCategoryLabelEntryInputSchema.optional(),
20116
+ DRINK: passportCategoryLabelEntryInputSchema.optional(),
20117
+ BINGO: passportCategoryLabelEntryInputSchema.optional()
20118
+ }).transform((labels) => sanitizePassportCategoryLabels(labels) ?? {});
19814
20119
  var passportSettingsSchema = passportEventIdSchema.extend({
19815
20120
  luckyDrawStampThreshold: number2().int().positive().nullable(),
19816
20121
  prizeStampThreshold: number2().int().positive().nullable(),
@@ -19818,7 +20123,18 @@ var passportSettingsSchema = passportEventIdSchema.extend({
19818
20123
  linkedDrawEventId: string2().min(1).nullable(),
19819
20124
  loginMethods: passportLoginMethodsSchema.optional(),
19820
20125
  guestScan: boolean2().optional(),
19821
- simplifiedChinese: boolean2().optional()
20126
+ simplifiedChinese: boolean2().optional(),
20127
+ staffIdLabel: union([
20128
+ _null3(),
20129
+ string2().trim().max(PASSPORT_STAFF_ID_LABEL_MAX).transform((label) => label === "" ? null : label)
20130
+ ]).optional(),
20131
+ categoryLabels: union([_null3(), passportCategoryLabelsInputSchema]).optional(),
20132
+ queueStatus: boolean2().optional(),
20133
+ queueStatusStaleMinutes: number2().int().min(PASSPORT_QUEUE_STATUS_STALE_MINUTES_MIN).max(PASSPORT_QUEUE_STATUS_STALE_MINUTES_MAX).nullable().optional()
20134
+ });
20135
+ var setPassportStationQueueStatusSchema = passportEventIdSchema.extend({
20136
+ stationId: string2().min(1),
20137
+ status: passportQueueStatusSchema.nullable()
19822
20138
  });
19823
20139
  var renamePassportBingoSchema = passportEventIdSchema.extend({
19824
20140
  name: string2().trim().min(1).max(100)
@@ -19844,10 +20160,13 @@ var passportPrizeSchema = passportEventIdSchema.extend({
19844
20160
  stampCost: number2().int().min(0).max(PASSPORT_PRIZE_STAMP_COST_MAX).optional(),
19845
20161
  order: number2().int().min(0)
19846
20162
  });
20163
+ var passportRedemptionRequestIdSchema = uuid2();
19847
20164
  var redeemPassportPrizeSchema = passportEventIdSchema.extend({
19848
20165
  participantId: string2().min(1),
19849
20166
  prizeId: string2().min(1),
19850
- quantity: number2().int().min(1).max(PASSPORT_REDEMPTION_QUANTITY_MAX).default(1)
20167
+ quantity: number2().int().min(1).max(PASSPORT_REDEMPTION_QUANTITY_MAX).default(1),
20168
+ awardStationId: string2().min(1).optional(),
20169
+ requestId: passportRedemptionRequestIdSchema.optional()
19851
20170
  });
19852
20171
 
19853
20172
  // ../validators/src/event-passport/passport-roster.schema.ts
@@ -19856,8 +20175,8 @@ var PASSPORT_ROSTER_NAME_MAX = 100;
19856
20175
  var PASSPORT_ROSTER_IMPORT_MAX = 20000;
19857
20176
  var PASSPORT_ROSTER_PAGE_MAX = 100;
19858
20177
  var normalizePassportRosterKey = (value) => value.normalize("NFKD").replace(/\p{M}/gu, "").toLocaleLowerCase("en").replace(/[^\p{L}\p{N}]/gu, "");
19859
- var rosterStaffIdSchema = string2().trim().min(1, "Enter a Staff ID.").max(PASSPORT_ROSTER_STAFF_ID_MAX).refine((value) => normalizePassportRosterKey(value) !== "", {
19860
- message: "Staff ID needs at least one letter or digit."
20178
+ var rosterStaffIdSchema = string2().trim().min(1, "Enter an ID.").max(PASSPORT_ROSTER_STAFF_ID_MAX).refine((value) => normalizePassportRosterKey(value) !== "", {
20179
+ message: "The ID needs at least one letter or digit."
19861
20180
  });
19862
20181
  var rosterLastNameSchema = string2().trim().min(1, "Enter a last name.").max(PASSPORT_ROSTER_NAME_MAX).refine((value) => normalizePassportRosterKey(value) !== "", {
19863
20182
  message: "Last name needs at least one letter or digit."
@@ -19890,12 +20209,13 @@ var passportRosterImportRowSchema = object({
19890
20209
  var importPassportRosterSchema = passportEventIdSchema.extend({
19891
20210
  rows: array(passportRosterImportRowSchema).max(PASSPORT_ROSTER_IMPORT_MAX, `A roster can have at most ${PASSPORT_ROSTER_IMPORT_MAX} rows.`)
19892
20211
  }).strict();
19893
- var passportRosterRejectReasonLabel = {
19894
- MISSING_STAFF_ID: "Staff ID is blank",
20212
+ var passportRosterRejectReasonLabels = (staffIdLabel) => ({
20213
+ MISSING_STAFF_ID: `The ${staffIdLabel} is blank`,
19895
20214
  MISSING_LAST_NAME: "Last name is blank",
19896
- DUPLICATE_STAFF_ID: "Staff ID appears earlier in the file",
19897
- TOO_LONG: `Staff ID is over ${PASSPORT_ROSTER_STAFF_ID_MAX} or a name is over ${PASSPORT_ROSTER_NAME_MAX} characters`
19898
- };
20215
+ DUPLICATE_STAFF_ID: `The ${staffIdLabel} appears earlier in the file`,
20216
+ TOO_LONG: `The ${staffIdLabel} is over ${PASSPORT_ROSTER_STAFF_ID_MAX} characters or a name is over ${PASSPORT_ROSTER_NAME_MAX}`
20217
+ });
20218
+ var passportRosterRejectReasonLabel = passportRosterRejectReasonLabels(PASSPORT_STAFF_ID_LABEL_DEFAULT);
19899
20219
  var cell = (row, index) => index === null ? "" : (row[index] ?? "").trim();
19900
20220
  var surnameOf = (fullName, position) => {
19901
20221
  const words = fullName.split(/\s+/).filter(Boolean);
@@ -19976,7 +20296,12 @@ var stationPrizeClaimParticipantSchema = union([
19976
20296
  staffId: string2().trim().min(1).max(PASSPORT_ROSTER_STAFF_ID_MAX)
19977
20297
  })
19978
20298
  ]);
19979
- var redeemPrizeAsStationStaffSchema = passportEventIdSchema.extend({ profileCode: participantCodeSchema, prizeId: string2().min(1) }).strict();
20299
+ var redeemPrizeAsStationStaffSchema = passportEventIdSchema.extend({
20300
+ profileCode: participantCodeSchema,
20301
+ prizeId: string2().min(1),
20302
+ awardStationId: string2().min(1).optional(),
20303
+ requestId: passportRedemptionRequestIdSchema.optional()
20304
+ }).strict();
19980
20305
  var stationStampRecipientFiltersSchema = object({ search: string2().trim().max(200).optional() }).strict();
19981
20306
  var passportStationStampRecipientsSchema = passportStationIdSchema.extend({
19982
20307
  filters: stationStampRecipientFiltersSchema.default({}),
@@ -20400,7 +20725,7 @@ var stationCategory = (value) => {
20400
20725
  throw new CliUsageError(`category must be ${PASSPORT_STATION_CATEGORIES.join(", ")}.`);
20401
20726
  return match;
20402
20727
  };
20403
- var boolean3 = (value, name) => {
20728
+ var boolean4 = (value, name) => {
20404
20729
  if (value === true || value === "true")
20405
20730
  return true;
20406
20731
  if (value === false || value === "false")
@@ -20419,6 +20744,14 @@ var nullableText = (value, name, maximum) => {
20419
20744
  throw new CliUsageError(`${name} must be a string of at most ${maximum} characters or null.`);
20420
20745
  return value.trim();
20421
20746
  };
20747
+ var categoryLabels = (value) => {
20748
+ if (value === null)
20749
+ return null;
20750
+ const parsed = passportCategoryLabelsInputSchema.safeParse(value);
20751
+ if (!parsed.success)
20752
+ throw new CliUsageError(`categoryLabels is invalid: ${parsed.error.issues.map((issue) => `${issue.path.join(".") || "categoryLabels"} ${issue.message}`).join("; ")}`);
20753
+ return parsed.data;
20754
+ };
20422
20755
  var stationInfo = (value) => {
20423
20756
  const parsed = passportStationInfoInputSchema.safeParse(value);
20424
20757
  if (!parsed.success)
@@ -20444,7 +20777,7 @@ var keys = (value, allowed, name) => {
20444
20777
  if (Object.keys(value).some((key) => !allowed.includes(key)))
20445
20778
  throw new CliUsageError(`${name} contains unsupported fields.`);
20446
20779
  };
20447
- var date3 = (value, name) => {
20780
+ var date4 = (value, name) => {
20448
20781
  if (value == null)
20449
20782
  return null;
20450
20783
  if (typeof value !== "string" || !/^\d{4}-\d\d-\d\dT/.test(value))
@@ -20502,11 +20835,14 @@ var parsePassportCollection = (raw) => {
20502
20835
  });
20503
20836
  }
20504
20837
  if (item.collectionMode === "SELF_SCAN" || item.collectionMode === "STAFF_SCAN") {
20505
- keys(item, ["collectionMode", "stampValue", "category", "info"], "collection");
20838
+ keys(item, ["collectionMode", "stampValue", "category", "prizeDeskAward", "info"], "collection");
20839
+ if (item.prizeDeskAward !== undefined && typeof item.prizeDeskAward !== "boolean")
20840
+ throw new CliUsageError("prizeDeskAward must be true or false.");
20506
20841
  return {
20507
20842
  collectionMode: item.collectionMode,
20508
20843
  ...stampValue,
20509
20844
  ...category,
20845
+ ...item.prizeDeskAward === undefined ? {} : { prizeDeskAward: item.prizeDeskAward },
20510
20846
  ...info
20511
20847
  };
20512
20848
  }
@@ -20536,14 +20872,36 @@ var parsePassportStationInput = (raw, eventId) => {
20536
20872
  ...value.address === undefined ? {} : { address: nullableText(value.address, "address", 300) },
20537
20873
  ...value.imageKey === undefined ? {} : { imageKey: nullableText(value.imageKey, "imageKey", 2048) },
20538
20874
  order: integer2(value.order ?? 0, "order"),
20539
- opensAt: date3(value.opensAt, "opensAt"),
20540
- closesAt: date3(value.closesAt, "closesAt"),
20875
+ opensAt: date4(value.opensAt, "opensAt"),
20876
+ closesAt: date4(value.closesAt, "closesAt"),
20541
20877
  ...collection ? { collection } : {}
20542
20878
  };
20543
20879
  };
20880
+ var QUEUE_STATUS_FLAGS = {
20881
+ "under-10": "UNDER_10_MIN",
20882
+ "under-30": "UNDER_30_MIN",
20883
+ "over-30": "OVER_30_MIN",
20884
+ clear: null
20885
+ };
20886
+ var queueStatusFlag = (value) => {
20887
+ const status = QUEUE_STATUS_FLAGS[value];
20888
+ if (status === undefined)
20889
+ throw new CliUsageError(`--status must be one of ${Object.keys(QUEUE_STATUS_FLAGS).join(", ")}.`);
20890
+ return status;
20891
+ };
20544
20892
  var parseSettingsSwitches = (value) => {
20545
20893
  const switches = {};
20546
- for (const name of ["guestScan", "simplifiedChinese"]) {
20894
+ if (value.queueStatusStaleMinutes !== undefined)
20895
+ switches.queueStatusStaleMinutes = value.queueStatusStaleMinutes === null ? null : integer2(value.queueStatusStaleMinutes, "queueStatusStaleMinutes", PASSPORT_QUEUE_STATUS_STALE_MINUTES_MIN, PASSPORT_QUEUE_STATUS_STALE_MINUTES_MAX);
20896
+ if (value.staffIdLabel !== undefined)
20897
+ switches.staffIdLabel = nullableText(value.staffIdLabel, "staffIdLabel", PASSPORT_STAFF_ID_LABEL_MAX);
20898
+ if (value.categoryLabels !== undefined)
20899
+ switches.categoryLabels = categoryLabels(value.categoryLabels);
20900
+ for (const name of [
20901
+ "guestScan",
20902
+ "simplifiedChinese",
20903
+ "queueStatus"
20904
+ ]) {
20547
20905
  const item = value[name];
20548
20906
  if (item === undefined)
20549
20907
  continue;
@@ -20562,7 +20920,11 @@ var parsePassportSettingsInput = (raw, eventId) => {
20562
20920
  "linkedDrawEventId",
20563
20921
  "loginMethods",
20564
20922
  "guestScan",
20565
- "simplifiedChinese"
20923
+ "simplifiedChinese",
20924
+ "staffIdLabel",
20925
+ "categoryLabels",
20926
+ "queueStatus",
20927
+ "queueStatusStaleMinutes"
20566
20928
  ], "Settings");
20567
20929
  const switches = parseSettingsSwitches(value);
20568
20930
  const threshold = (item, name) => item === null ? null : integer2(item, name, 1);
@@ -20580,7 +20942,7 @@ var parsePassportSettingsInput = (raw, eventId) => {
20580
20942
  staffIdRequiresLastName: methods.staffIdRequiresLastName !== false
20581
20943
  };
20582
20944
  if (!loginMethods.emailOtp && !loginMethods.google && !loginMethods.staffId)
20583
- throw new CliUsageError("Keep email OTP, Google or Staff ID available for recovery.");
20945
+ throw new CliUsageError("Keep email OTP, Google or roster sign-in available for recovery.");
20584
20946
  }
20585
20947
  if (value.linkedDrawEventId === undefined)
20586
20948
  throw new CliUsageError("linkedDrawEventId is required (use null to disable).");
@@ -20775,6 +21137,9 @@ var runPassportCommand = async (input) => {
20775
21137
  case "login-options":
20776
21138
  operation = () => api2.event.passport.getPassportLoginOptions.query(event);
20777
21139
  break;
21140
+ case "queue-status":
21141
+ operation = () => api2.event.passport.getPassportQueueStatuses.query(event);
21142
+ break;
20778
21143
  case "export":
20779
21144
  operation = () => api2.event.passport.getPassportExportData.query(event);
20780
21145
  break;
@@ -20816,11 +21181,20 @@ var runPassportCommand = async (input) => {
20816
21181
  allowed.push("station-id", "hidden");
20817
21182
  const payload = {
20818
21183
  ...station(),
20819
- hidden: boolean3(requiredFlag(flags, "hidden"), "--hidden")
21184
+ hidden: boolean4(requiredFlag(flags, "hidden"), "--hidden")
20820
21185
  };
20821
21186
  operation = () => api2.event.passport.setPassportStationHidden.mutate(payload);
20822
21187
  break;
20823
21188
  }
21189
+ case "station queue-status": {
21190
+ allowed.push("station-id", "status");
21191
+ const payload = {
21192
+ ...station(),
21193
+ status: queueStatusFlag(requiredFlag(flags, "status"))
21194
+ };
21195
+ operation = () => api2.event.passport.setStationQueueStatusAsStationStaff.mutate(payload);
21196
+ break;
21197
+ }
20824
21198
  case "station start-qr": {
20825
21199
  allowed.push("station-id");
20826
21200
  const payload = station();
@@ -20857,7 +21231,7 @@ var runPassportCommand = async (input) => {
20857
21231
  const payload = {
20858
21232
  ...station(),
20859
21233
  participantId: requiredFlag(flags, "participant-id"),
20860
- stamped: boolean3(requiredFlag(flags, "stamped"), "--stamped"),
21234
+ stamped: boolean4(requiredFlag(flags, "stamped"), "--stamped"),
20861
21235
  reason: requiredFlag(flags, "reason"),
20862
21236
  ...optionalEntry("points", points, (raw) => integer2(raw, "--points"))
20863
21237
  };
@@ -20912,11 +21286,20 @@ var runPassportCommand = async (input) => {
20912
21286
  break;
20913
21287
  }
20914
21288
  case "redemption create": {
20915
- allowed.push("prize-id", "participant-id", "quantity");
21289
+ allowed.push("prize-id", "participant-id", "quantity", "award-station-id", "request-id");
20916
21290
  const quantity = flag(flags, "quantity", false);
21291
+ const awardStationId = flag(flags, "award-station-id", false);
21292
+ const requestId = flag(flags, "request-id", false);
20917
21293
  const payload = {
20918
21294
  eventId,
20919
21295
  ...optionalEntry("quantity", quantity, (raw) => integer2(raw, "--quantity", 1, 20)),
21296
+ ...optionalEntry("awardStationId", awardStationId, (raw) => text(raw, "--award-station-id", 200)),
21297
+ ...optionalEntry("requestId", requestId, (raw) => {
21298
+ const parsed = passportRedemptionRequestIdSchema.safeParse(raw);
21299
+ if (!parsed.success)
21300
+ throw new CliUsageError("--request-id must be a UUID.");
21301
+ return parsed.data;
21302
+ }),
20920
21303
  prizeId: requiredFlag(flags, "prize-id"),
20921
21304
  participantId: requiredFlag(flags, "participant-id")
20922
21305
  };
@@ -21037,6 +21420,431 @@ var runPassportCommand = async (input) => {
21037
21420
  writeSuccess(input.runtime, await operation());
21038
21421
  };
21039
21422
 
21423
+ // src/commands/staff-redemption.ts
21424
+ import { readFile as readFile6, writeFile } from "fs/promises";
21425
+ import { basename as basename4 } from "path";
21426
+
21427
+ // ../validators/src/staff-redemption/staff-redemption-input.schema.ts
21428
+ var STAFF_REDEMPTION_NAME_MAX = 120;
21429
+ var STAFF_REDEMPTION_EMPLOYEE_ID_MAX = 64;
21430
+ var STAFF_REDEMPTION_SHIFT_MAX = 8;
21431
+ var STAFF_REDEMPTION_ELIGIBLE_SHIFTS_MAX = 20;
21432
+ var STAFF_REDEMPTION_ALLOWANCE_MAX = 20;
21433
+ var STAFF_REDEMPTION_QUANTITY_MAX = 1e5;
21434
+ var STAFF_REDEMPTION_REASON_MAX = 500;
21435
+ var STAFF_REDEMPTION_ROLLOVER_REASON_MAX = 300;
21436
+ var STAFF_REDEMPTION_ROLLOVER_LIST_DEFAULT = 20;
21437
+ var STAFF_REDEMPTION_ROLLOVER_LIST_MAX = 50;
21438
+ var STAFF_REDEMPTION_PAGE_MAX = 100;
21439
+ var STAFF_REDEMPTION_CLAIM_ITEMS_MAX = 20;
21440
+ var STAFF_REDEMPTION_ITEM_RULES = [
21441
+ "ONE_FROM_EACH_GROUP",
21442
+ "AT_MOST_ONE_PER_GROUP",
21443
+ "AT_MOST_ONE_PER_GROUP_OR_NONE"
21444
+ ];
21445
+ var STAFF_REDEMPTION_WRONG_SITE_RULES = [
21446
+ "REFUSE",
21447
+ "SERVE_FROM_COUNTER"
21448
+ ];
21449
+ var STAFF_REDEMPTION_DRAW_POLICIES = [
21450
+ "REMAINING_HEADCOUNT",
21451
+ "FIXED_RATE"
21452
+ ];
21453
+ var STAFF_REDEMPTION_ARCHIVABLE = [
21454
+ "site",
21455
+ "session",
21456
+ "itemGroup",
21457
+ "item",
21458
+ "prize",
21459
+ "rosterEntry"
21460
+ ];
21461
+ var idSchema = string2().min(1).max(64);
21462
+ var nameSchema = string2().trim().min(1).max(STAFF_REDEMPTION_NAME_MAX);
21463
+ var orderSchema = number2().int().min(0).max(1e4);
21464
+ var quantitySchema = number2().int().min(0).max(STAFF_REDEMPTION_QUANTITY_MAX);
21465
+ var reasonSchema = string2().trim().min(1).max(STAFF_REDEMPTION_REASON_MAX);
21466
+ var staffRedemptionShiftSchema = string2().trim().min(1).max(STAFF_REDEMPTION_SHIFT_MAX).transform((value) => value.toUpperCase()).refine((value) => /^[A-Z0-9]+$/.test(value), {
21467
+ message: "Use letters and digits only."
21468
+ });
21469
+ var staffRedemptionEmployeeIdSchema = string2().trim().min(1).max(STAFF_REDEMPTION_EMPLOYEE_ID_MAX);
21470
+ var staffRedemptionClientRequestIdSchema = uuid2();
21471
+ var staffRedemptionEventIdSchema = object({ eventId: idSchema }).strict();
21472
+ var staffRedemptionSiteIdSchema = staffRedemptionEventIdSchema.extend({ siteId: idSchema }).strict();
21473
+ var updateStaffRedemptionSettingsSchema = staffRedemptionEventIdSchema.extend({
21474
+ eligibleShifts: array(staffRedemptionShiftSchema).min(1).max(STAFF_REDEMPTION_ELIGIBLE_SHIFTS_MAX).optional(),
21475
+ itemRule: _enum(STAFF_REDEMPTION_ITEM_RULES).optional(),
21476
+ wrongSite: _enum(STAFF_REDEMPTION_WRONG_SITE_RULES).optional(),
21477
+ drawPolicy: _enum(STAFF_REDEMPTION_DRAW_POLICIES).optional(),
21478
+ fixedWinRatePercent: number2().min(0).max(100).optional(),
21479
+ overrideReason: reasonSchema.optional()
21480
+ }).strict();
21481
+ var upsertStaffRedemptionSiteSchema = staffRedemptionEventIdSchema.extend({
21482
+ siteId: idSchema.optional(),
21483
+ name: nameSchema,
21484
+ order: orderSchema.optional()
21485
+ }).strict();
21486
+ var setStaffRedemptionCrewPasswordSchema = staffRedemptionSiteIdSchema.extend({ password: stationStaffPasswordSchema }).strict();
21487
+ var signInToStaffRedemptionCrewSchema = staffRedemptionSiteIdSchema.extend({ password: string2().min(1).max(128) }).strict();
21488
+ var upsertStaffRedemptionSessionSchema = staffRedemptionEventIdSchema.extend({
21489
+ sessionId: idSchema.optional(),
21490
+ name: nameSchema,
21491
+ shift: staffRedemptionShiftSchema,
21492
+ startsAt: exports_coerce.date().nullable().default(null),
21493
+ endsAt: exports_coerce.date().nullable().default(null)
21494
+ }).strict().refine((input) => input.startsAt === null || input.endsAt === null || input.endsAt > input.startsAt, {
21495
+ message: "The session must end after it starts.",
21496
+ path: ["endsAt"]
21497
+ });
21498
+ var setStaffRedemptionSlotSchema = staffRedemptionEventIdSchema.extend({
21499
+ sessionId: idSchema,
21500
+ siteId: idSchema,
21501
+ setQuantity: quantitySchema
21502
+ }).strict();
21503
+ var rolloverSessionsShape = {
21504
+ fromSessionId: idSchema.describe("Session whose leftover sets and prizes move out (id from setup get). Must belong to this event and not be archived."),
21505
+ toSessionId: idSchema.describe("Session that receives them (id from setup get). Must differ from fromSessionId, belong to this event and not be archived.")
21506
+ };
21507
+ var rolloverReasonSchema = (description) => string2().trim().min(1).max(STAFF_REDEMPTION_ROLLOVER_REASON_MAX).describe(description);
21508
+ var staffRedemptionRolloverPreviewSchema = staffRedemptionEventIdSchema.extend(rolloverSessionsShape).strict();
21509
+ var rolloverStaffRedemptionStockSchema = staffRedemptionEventIdSchema.extend({
21510
+ ...rolloverSessionsShape,
21511
+ sets: boolean2().default(true).describe("Move the leftover sets (set quantity minus active, not voided, redemptions) of each site. Defaults to true."),
21512
+ prizes: boolean2().default(true).describe("Move the leftover prizes (stock minus prizes drawn and not released) of each site. Defaults to true."),
21513
+ reason: rolloverReasonSchema("Why the leftovers move (1 to 300 characters). Recorded in the activity log.")
21514
+ }).strict().refine((input) => input.sets || input.prizes, {
21515
+ message: "Choose sets, prizes or both.",
21516
+ path: ["sets"]
21517
+ });
21518
+ var staffRedemptionRolloversSchema = staffRedemptionEventIdSchema.extend({
21519
+ limit: number2().int().min(1).max(STAFF_REDEMPTION_ROLLOVER_LIST_MAX).default(STAFF_REDEMPTION_ROLLOVER_LIST_DEFAULT).describe("How many rollovers to return, newest first (1 to 50). Defaults to 20.")
21520
+ }).strict();
21521
+ var undoStaffRedemptionRolloverSchema = staffRedemptionEventIdSchema.extend({
21522
+ rolloverId: idSchema.describe("Id of the rollover to undo (id from rollover list). Must belong to this event and not be undone already."),
21523
+ reason: rolloverReasonSchema("Why the rollover is undone (1 to 300 characters). Recorded in the activity log.")
21524
+ }).strict();
21525
+ var upsertStaffRedemptionItemGroupSchema = staffRedemptionEventIdSchema.extend({
21526
+ groupId: idSchema.optional(),
21527
+ name: nameSchema,
21528
+ order: orderSchema.optional()
21529
+ }).strict();
21530
+ var upsertStaffRedemptionItemSchema = staffRedemptionEventIdSchema.extend({
21531
+ itemId: idSchema.optional(),
21532
+ groupId: idSchema,
21533
+ name: nameSchema,
21534
+ order: orderSchema.optional()
21535
+ }).strict();
21536
+ var upsertStaffRedemptionPrizeSchema = staffRedemptionEventIdSchema.extend({
21537
+ prizeId: idSchema.optional(),
21538
+ name: nameSchema,
21539
+ order: orderSchema.optional()
21540
+ }).strict();
21541
+ var setStaffRedemptionPrizeStockSchema = staffRedemptionEventIdSchema.extend({
21542
+ slotId: idSchema,
21543
+ prizeId: idSchema,
21544
+ quantity: quantitySchema,
21545
+ reason: reasonSchema.optional()
21546
+ }).strict();
21547
+ var setStaffRedemptionArchivedSchema = staffRedemptionEventIdSchema.extend({
21548
+ entity: _enum(STAFF_REDEMPTION_ARCHIVABLE),
21549
+ id: idSchema,
21550
+ archived: boolean2()
21551
+ }).strict();
21552
+ var upsertStaffRedemptionRosterEntrySchema = staffRedemptionEventIdSchema.extend({
21553
+ employeeId: staffRedemptionEmployeeIdSchema,
21554
+ name: string2().trim().max(STAFF_REDEMPTION_NAME_MAX).nullable(),
21555
+ siteName: string2().trim().max(STAFF_REDEMPTION_NAME_MAX).nullable(),
21556
+ shift: staffRedemptionShiftSchema.nullable(),
21557
+ workShift: string2().trim().max(STAFF_REDEMPTION_NAME_MAX).nullable(),
21558
+ allowance: number2().int().min(0).max(STAFF_REDEMPTION_ALLOWANCE_MAX).optional()
21559
+ }).strict();
21560
+ var rosterFiltersShape = {
21561
+ search: string2().trim().max(200).optional(),
21562
+ siteId: idSchema.optional(),
21563
+ shift: staffRedemptionShiftSchema.optional(),
21564
+ archived: _enum(["active", "archived", "all"]).default("active"),
21565
+ collected: _enum(["any", "collected", "not-collected"]).default("any")
21566
+ };
21567
+ var staffRedemptionRosterListSchema = staffRedemptionEventIdSchema.extend({
21568
+ ...rosterFiltersShape,
21569
+ limit: number2().int().min(1).max(STAFF_REDEMPTION_PAGE_MAX).default(25),
21570
+ cursor: string2().min(1).max(8192).nullish(),
21571
+ direction: literal("forward").optional()
21572
+ }).strict();
21573
+ var staffRedemptionRosterCountsSchema = staffRedemptionEventIdSchema.extend(rosterFiltersShape).strict();
21574
+ var lookupStaffRedemptionSchema = staffRedemptionSiteIdSchema.extend({ employeeId: staffRedemptionEmployeeIdSchema }).strict();
21575
+ var redeemStaffRedemptionSchema = staffRedemptionSiteIdSchema.extend({
21576
+ employeeId: staffRedemptionEmployeeIdSchema,
21577
+ clientRequestId: staffRedemptionClientRequestIdSchema,
21578
+ itemIds: array(idSchema).max(STAFF_REDEMPTION_CLAIM_ITEMS_MAX).refine((ids) => new Set(ids).size === ids.length, {
21579
+ message: "Pick each item once."
21580
+ })
21581
+ }).strict();
21582
+ var STAFF_REDEMPTION_COUNTER_CLAIM_SCOPES = ["mine", "site"];
21583
+ var staffRedemptionCounterClaimsSchema = staffRedemptionSiteIdSchema.extend({
21584
+ limit: number2().int().min(1).max(50).default(20),
21585
+ scope: _enum(STAFF_REDEMPTION_COUNTER_CLAIM_SCOPES).default("mine")
21586
+ }).strict();
21587
+ var claimFiltersShape = {
21588
+ search: string2().trim().max(200).optional(),
21589
+ siteId: idSchema.optional(),
21590
+ sessionId: idSchema.optional(),
21591
+ status: _enum(["active", "voided", "all"]).default("all")
21592
+ };
21593
+ var staffRedemptionClaimListSchema = staffRedemptionEventIdSchema.extend({
21594
+ ...claimFiltersShape,
21595
+ limit: number2().int().min(1).max(STAFF_REDEMPTION_PAGE_MAX).default(25),
21596
+ cursor: string2().min(1).max(8192).nullish(),
21597
+ direction: literal("forward").optional()
21598
+ }).strict();
21599
+ var staffRedemptionClaimCountsSchema = staffRedemptionEventIdSchema.extend(claimFiltersShape).strict();
21600
+ var voidStaffRedemptionClaimSchema = staffRedemptionEventIdSchema.extend({ claimId: idSchema, reason: reasonSchema }).strict();
21601
+ var releaseStaffRedemptionDrawSchema = staffRedemptionEventIdSchema.extend({
21602
+ drawId: idSchema,
21603
+ reason: reasonSchema,
21604
+ allowWhileClaimActive: boolean2().optional().describe("Override: release the draw even though an active (not voided) redemption still shows it, for a redemption that stays recorded (for example a paper entry with no spin). Omit to refuse while any active redemption uses the draw.")
21605
+ }).strict();
21606
+ var staffRedemptionExportSchema = staffRedemptionEventIdSchema.extend(claimFiltersShape).strict();
21607
+
21608
+ // ../validators/src/staff-redemption/staff-redemption-roster.schema.ts
21609
+ var STAFF_REDEMPTION_ROSTER_IMPORT_MAX = 20000;
21610
+ var staffRedemptionRosterImportRowSchema = object({
21611
+ row: number2().int().min(1),
21612
+ employeeId: string2().max(1000),
21613
+ name: string2().max(1000).nullable(),
21614
+ siteName: string2().max(1000).nullable(),
21615
+ shift: string2().max(1000).nullable(),
21616
+ workShift: string2().max(1000).nullable(),
21617
+ allowance: string2().max(1000).nullable()
21618
+ }).strict();
21619
+ var importStaffRedemptionRosterSchema = staffRedemptionEventIdSchema.extend({
21620
+ rows: array(staffRedemptionRosterImportRowSchema).min(1).max(STAFF_REDEMPTION_ROSTER_IMPORT_MAX, `A roster can have at most ${STAFF_REDEMPTION_ROSTER_IMPORT_MAX} rows.`),
21621
+ archiveMissing: boolean2().default(false)
21622
+ }).strict();
21623
+ var HEADER_PATTERNS = {
21624
+ employeeId: /^(employee|staff|worker)\s*(id|no|number)$|^(emp|staff)\s*id$/i,
21625
+ name: /^(worker|name|full\s*name|employee\s*name|staff\s*name)$/i,
21626
+ siteName: /^(site|location|fab)$/i,
21627
+ shift: /^shift$/i,
21628
+ workShift: /^work\s*shift$/i,
21629
+ allowance: /^(allowance|sets|entitlement|balance)$/i
21630
+ };
21631
+ var guessStaffRedemptionRosterMapping = (header) => {
21632
+ const find = (key) => {
21633
+ const index = header.findIndex((cell) => HEADER_PATTERNS[key].test(cell.trim()));
21634
+ return index === -1 ? null : index;
21635
+ };
21636
+ return {
21637
+ employeeId: find("employeeId") ?? 0,
21638
+ name: find("name"),
21639
+ siteName: find("siteName"),
21640
+ shift: find("shift"),
21641
+ workShift: find("workShift"),
21642
+ allowance: find("allowance")
21643
+ };
21644
+ };
21645
+ var mapStaffRedemptionRosterTable = (table, mapping) => {
21646
+ const cell = (line, index) => index === null ? null : line[index] ?? "";
21647
+ const rows = [];
21648
+ table.slice(1).forEach((line, offset) => {
21649
+ if (line.every((value) => !value?.trim()))
21650
+ return;
21651
+ rows.push({
21652
+ row: offset + 2,
21653
+ employeeId: line[mapping.employeeId] ?? "",
21654
+ name: cell(line, mapping.name),
21655
+ siteName: cell(line, mapping.siteName),
21656
+ shift: cell(line, mapping.shift),
21657
+ workShift: cell(line, mapping.workShift),
21658
+ allowance: cell(line, mapping.allowance)
21659
+ });
21660
+ });
21661
+ if (rows.length > STAFF_REDEMPTION_ROSTER_IMPORT_MAX)
21662
+ throw new Error(`A roster can have at most ${STAFF_REDEMPTION_ROSTER_IMPORT_MAX} rows.`);
21663
+ return rows;
21664
+ };
21665
+
21666
+ // src/commands/staff-redemption.ts
21667
+ var optionalRosterColumns = [
21668
+ ["name", "name-column"],
21669
+ ["siteName", "site-column"],
21670
+ ["shift", "shift-column"],
21671
+ ["workShift", "work-shift-column"],
21672
+ ["allowance", "allowance-column"]
21673
+ ];
21674
+ var rosterImportFlags = [
21675
+ "event-id",
21676
+ "file",
21677
+ "sheet",
21678
+ "employee-id-column",
21679
+ ...optionalRosterColumns.map(([, flag]) => flag),
21680
+ "archive-missing",
21681
+ "allow-state-change",
21682
+ "target"
21683
+ ];
21684
+ var exportFlags = [
21685
+ "event-id",
21686
+ "search",
21687
+ "site-id",
21688
+ "session-id",
21689
+ "status",
21690
+ "csv-file",
21691
+ "force"
21692
+ ];
21693
+ var headerIndex2 = (headers, name) => {
21694
+ const wanted = name.trim().toLowerCase();
21695
+ const index = headers.findIndex((header) => header.trim().toLowerCase() === wanted);
21696
+ if (index === -1)
21697
+ throw new CliUsageError(`Column "${name}" is not in the file. Headers: ${headers.join(", ")}.`);
21698
+ return index;
21699
+ };
21700
+ var resolveStaffRedemptionRosterMapping = (headers, parsed) => {
21701
+ const mapping = guessStaffRedemptionRosterMapping(headers);
21702
+ const employeeIdColumn = getOptionalFlag(parsed, "employee-id-column");
21703
+ if (employeeIdColumn !== undefined)
21704
+ mapping.employeeId = headerIndex2(headers, employeeIdColumn);
21705
+ for (const [key, flag] of optionalRosterColumns) {
21706
+ const value = getOptionalFlag(parsed, flag);
21707
+ if (value === undefined)
21708
+ continue;
21709
+ mapping[key] = value.trim().toLowerCase() === "none" ? null : headerIndex2(headers, value);
21710
+ }
21711
+ return mapping;
21712
+ };
21713
+ var readRosterTable = async (path, sheetName) => {
21714
+ try {
21715
+ return await readSpreadsheetTable(basename4(path), await readFile6(path), {
21716
+ sheetName
21717
+ });
21718
+ } catch (error) {
21719
+ throw new CliUsageError(`Could not read ${path}: ${error instanceof Error ? error.message : "unknown error"}`);
21720
+ }
21721
+ };
21722
+ var prepareRosterImport = async (parsed) => {
21723
+ const eventId = getRequiredFlag(parsed, "event-id");
21724
+ const path = getRequiredFlag(parsed, "file");
21725
+ const sheet = getOptionalFlag(parsed, "sheet");
21726
+ assertStateChangeTarget(parsed, eventId);
21727
+ const table = await readRosterTable(path, sheet);
21728
+ const mapping = resolveStaffRedemptionRosterMapping(table[0] ?? [], parsed);
21729
+ let rows;
21730
+ try {
21731
+ rows = mapStaffRedemptionRosterTable(table, mapping);
21732
+ } catch (error) {
21733
+ throw new CliUsageError(`Could not import ${path}: ${error instanceof Error ? error.message : "unknown error"}`);
21734
+ }
21735
+ if (rows.length === 0)
21736
+ throw new CliUsageError(`${path} has a header but no data rows.`);
21737
+ return {
21738
+ eventId,
21739
+ rows,
21740
+ archiveMissing: parsed.flags.get("archive-missing") === true
21741
+ };
21742
+ };
21743
+ var exportFilters = (parsed, eventId) => {
21744
+ const checked = staffRedemptionExportSchema.safeParse({
21745
+ eventId,
21746
+ search: getOptionalFlag(parsed, "search"),
21747
+ siteId: getOptionalFlag(parsed, "site-id"),
21748
+ sessionId: getOptionalFlag(parsed, "session-id"),
21749
+ status: getOptionalFlag(parsed, "status")
21750
+ });
21751
+ if (!checked.success) {
21752
+ const issue = checked.error.issues[0];
21753
+ 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"}.`);
21755
+ }
21756
+ return checked.data;
21757
+ };
21758
+ var formulaStart = /^[=+\-@\t\r]/;
21759
+ var csvCell = (value) => {
21760
+ const text = value ?? "";
21761
+ const safe = formulaStart.test(text) ? `'${text}` : text;
21762
+ return /[",\r\n]/.test(safe) ? `"${safe.replaceAll('"', '""')}"` : safe;
21763
+ };
21764
+ var csvColumns = [
21765
+ ["Created at", (row) => row.createdAt.toISOString()],
21766
+ ["Employee ID", (row) => row.employeeId],
21767
+ ["Name", (row) => row.name],
21768
+ ["Site", (row) => row.site.name],
21769
+ ["Roster site", (row) => row.rosterSiteName],
21770
+ ["Away from roster site", (row) => row.awayFromRosterSite ? "yes" : "no"],
21771
+ ["Session", (row) => row.session.name],
21772
+ [
21773
+ "Items",
21774
+ (row) => row.items.map((item) => {
21775
+ const label = `${item.groupName}: ${item.name}`;
21776
+ return item.quantity === 1 ? label : `${label} x${item.quantity}`;
21777
+ }).join("; ")
21778
+ ],
21779
+ ["Outcome", (row) => row.draw?.outcome ?? null],
21780
+ ["Prize", (row) => row.draw?.prize?.name ?? null],
21781
+ ["Operator kind", (row) => row.operatorKind],
21782
+ ["Voided at", (row) => row.voidedAt?.toISOString() ?? null],
21783
+ ["Void reason", (row) => row.voidReason],
21784
+ ["Draw released at", (row) => row.draw?.releasedAt?.toISOString() ?? null]
21785
+ ];
21786
+ var staffRedemptionClaimsToCsv = (rows) => {
21787
+ const lines = [
21788
+ csvColumns.map(([header]) => csvCell(header)).join(","),
21789
+ ...rows.map((row) => csvColumns.map(([, read]) => csvCell(read(row))).join(","))
21790
+ ];
21791
+ return `\uFEFF${lines.join(`\r
21792
+ `)}\r
21793
+ `;
21794
+ };
21795
+ var writeCsvFile = async (path, content, force) => {
21796
+ try {
21797
+ await writeFile(path, content, {
21798
+ encoding: "utf8",
21799
+ flag: force ? "w" : "wx"
21800
+ });
21801
+ } catch (error) {
21802
+ const code = error instanceof Error && "code" in error ? error.code : undefined;
21803
+ if (code === "EEXIST")
21804
+ throw new CliUsageError(`${path} already exists. Choose another --csv-file or pass --force to overwrite it.`);
21805
+ throw new CliUsageError(`Could not write ${path}: ${error instanceof Error ? error.message : "unknown error"}`);
21806
+ }
21807
+ };
21808
+ var exportClaims = async (input) => {
21809
+ const { parsed, runtime } = input;
21810
+ assertOnlyFlags(parsed, exportFlags);
21811
+ assertPositionalCount(parsed, 2);
21812
+ const eventId = getRequiredFlag(parsed, "event-id");
21813
+ const filters = exportFilters(parsed, eventId);
21814
+ const csvFile = getOptionalFlag(parsed, "csv-file");
21815
+ if (csvFile === undefined && parsed.flags.has("force"))
21816
+ throw new CliUsageError("--force only applies with --csv-file.");
21817
+ await input.authenticate();
21818
+ const { rows } = await api2.event.staffRedemption.getStaffRedemptionExportData.query(filters);
21819
+ if (csvFile === undefined) {
21820
+ writeSuccess(runtime, { rows });
21821
+ return;
21822
+ }
21823
+ await writeCsvFile(csvFile, staffRedemptionClaimsToCsv(rows), parsed.flags.get("force") === true);
21824
+ writeSuccess(runtime, { file: csvFile, rows: rows.length });
21825
+ };
21826
+ var importRoster = async (input) => {
21827
+ const { parsed, runtime } = input;
21828
+ assertOnlyFlags(parsed, rosterImportFlags);
21829
+ assertPositionalCount(parsed, 3);
21830
+ const payload = await prepareRosterImport(parsed);
21831
+ await input.authenticate();
21832
+ writeSuccess(runtime, await api2.event.staffRedemption.importStaffRedemptionRoster.mutate(payload));
21833
+ };
21834
+ var runStaffRedemptionCommand = async (input) => {
21835
+ const action = input.parsed.positionals.slice(1).join(" ");
21836
+ switch (action) {
21837
+ case "roster import":
21838
+ await importRoster(input);
21839
+ return;
21840
+ case "export":
21841
+ await exportClaims(input);
21842
+ return;
21843
+ default:
21844
+ throw new CliUsageError("Unknown staff-redemption command. Run `et commands` for the registry commands and `et --help` for the rest.");
21845
+ }
21846
+ };
21847
+
21040
21848
  // src/registry/command-manifest.json
21041
21849
  var command_manifest_default = [
21042
21850
  {
@@ -21446,7 +22254,8 @@ var command_manifest_default = [
21446
22254
  "SIGNATURE_WALL",
21447
22255
  "GARDENS_BY_THE_BAY",
21448
22256
  "RATING_SYSTEM",
21449
- "EVENT_PASSPORT"
22257
+ "EVENT_PASSPORT",
22258
+ "STAFF_REDEMPTION"
21450
22259
  ]
21451
22260
  }
21452
22261
  },
@@ -22572,7 +23381,8 @@ var command_manifest_default = [
22572
23381
  "SIGNATURE_WALL",
22573
23382
  "GARDENS_BY_THE_BAY",
22574
23383
  "RATING_SYSTEM",
22575
- "EVENT_PASSPORT"
23384
+ "EVENT_PASSPORT",
23385
+ "STAFF_REDEMPTION"
22576
23386
  ]
22577
23387
  },
22578
23388
  descriptionDelta: {},
@@ -24345,26 +25155,1148 @@ var command_manifest_default = [
24345
25155
  },
24346
25156
  required: ["eventId", "id", "status", "bingoCardId"]
24347
25157
  }
24348
- }
24349
- ];
24350
-
24351
- // src/registry/run-registry-command.ts
24352
- var manifest = command_manifest_default;
24353
- var registryFlags = [
24354
- "input",
24355
- "input-file",
24356
- "allow-state-change",
24357
- "allow-delete",
24358
- "allow-email",
24359
- "target"
24360
- ];
24361
- var isoDateTimePattern = /^\d{4}-\d\d-\d\dT\d\d:\d\d/;
24362
- var isRecord3 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
24363
- var commandName = (entry) => `et ${entry.path.join(" ")}`;
24364
- var findManifestEntry = (positionals) => manifest.find((entry) => entry.path.length === positionals.length && entry.path.every((segment, index) => positionals[index] === segment));
24365
- var listRegistryCommands = () => manifest.map((entry) => ({
24366
- command: commandName(entry),
24367
- summary: entry.summary,
25158
+ },
25159
+ {
25160
+ path: ["staff-redemption", "setup", "get"],
25161
+ procedure: "event.staffRedemption.getStaffRedemptionSetup",
25162
+ 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.",
25164
+ effects: [],
25165
+ dates: [],
25166
+ input: {
25167
+ type: "object",
25168
+ properties: {
25169
+ eventId: {
25170
+ type: "string",
25171
+ minLength: 1,
25172
+ maxLength: 64
25173
+ }
25174
+ },
25175
+ required: ["eventId"],
25176
+ additionalProperties: false
25177
+ }
25178
+ },
25179
+ {
25180
+ path: ["staff-redemption", "settings", "update"],
25181
+ procedure: "event.staffRedemption.updateStaffRedemptionSettings",
25182
+ operation: "mutation",
25183
+ summary: "Update eligibleShifts, itemRule, wrongSite, drawPolicy and fixedWinRatePercent; omitted fields are unchanged. Policies lock once a redemption exists (setup get shows policiesLocked): then a change needs overrideReason, recorded in the activity log.",
25184
+ effects: ["state-change"],
25185
+ target: "eventId",
25186
+ dates: [],
25187
+ input: {
25188
+ type: "object",
25189
+ properties: {
25190
+ eventId: {
25191
+ type: "string",
25192
+ minLength: 1,
25193
+ maxLength: 64
25194
+ },
25195
+ eligibleShifts: {
25196
+ minItems: 1,
25197
+ maxItems: 20,
25198
+ type: "array",
25199
+ items: {
25200
+ type: "string",
25201
+ minLength: 1,
25202
+ maxLength: 8
25203
+ }
25204
+ },
25205
+ itemRule: {
25206
+ type: "string",
25207
+ enum: [
25208
+ "ONE_FROM_EACH_GROUP",
25209
+ "AT_MOST_ONE_PER_GROUP",
25210
+ "AT_MOST_ONE_PER_GROUP_OR_NONE"
25211
+ ]
25212
+ },
25213
+ wrongSite: {
25214
+ type: "string",
25215
+ enum: ["REFUSE", "SERVE_FROM_COUNTER"]
25216
+ },
25217
+ drawPolicy: {
25218
+ type: "string",
25219
+ enum: ["REMAINING_HEADCOUNT", "FIXED_RATE"]
25220
+ },
25221
+ fixedWinRatePercent: {
25222
+ type: "number",
25223
+ minimum: 0,
25224
+ maximum: 100
25225
+ },
25226
+ overrideReason: {
25227
+ type: "string",
25228
+ minLength: 1,
25229
+ maxLength: 500
25230
+ }
25231
+ },
25232
+ required: ["eventId"],
25233
+ additionalProperties: false
25234
+ }
25235
+ },
25236
+ {
25237
+ path: ["staff-redemption", "site", "upsert"],
25238
+ procedure: "event.staffRedemption.upsertStaffRedemptionSite",
25239
+ operation: "mutation",
25240
+ summary: "Create a site (omit siteId) or rename and reorder one (give siteId). Use staff-redemption archive set to archive or unarchive it.",
25241
+ effects: ["state-change"],
25242
+ target: "eventId",
25243
+ dates: [],
25244
+ input: {
25245
+ type: "object",
25246
+ properties: {
25247
+ eventId: {
25248
+ type: "string",
25249
+ minLength: 1,
25250
+ maxLength: 64
25251
+ },
25252
+ siteId: {
25253
+ type: "string",
25254
+ minLength: 1,
25255
+ maxLength: 64
25256
+ },
25257
+ name: {
25258
+ type: "string",
25259
+ minLength: 1,
25260
+ maxLength: 120
25261
+ },
25262
+ order: {
25263
+ type: "integer",
25264
+ minimum: 0,
25265
+ maximum: 1e4
25266
+ }
25267
+ },
25268
+ required: ["eventId", "name"],
25269
+ additionalProperties: false
25270
+ }
25271
+ },
25272
+ {
25273
+ path: ["staff-redemption", "crew-password", "set"],
25274
+ procedure: "event.staffRedemption.setStaffRedemptionCrewPassword",
25275
+ operation: "mutation",
25276
+ summary: "Set a site's shared crew password (6-128 characters), which turns the site's crew link on. Ends every crew session at that site. Prefer --input-file over --input so the password stays out of shell history.",
25277
+ effects: ["state-change"],
25278
+ target: "eventId",
25279
+ dates: [],
25280
+ input: {
25281
+ type: "object",
25282
+ properties: {
25283
+ eventId: {
25284
+ type: "string",
25285
+ minLength: 1,
25286
+ maxLength: 64
25287
+ },
25288
+ siteId: {
25289
+ type: "string",
25290
+ minLength: 1,
25291
+ maxLength: 64
25292
+ },
25293
+ password: {
25294
+ type: "string",
25295
+ minLength: 6,
25296
+ maxLength: 128
25297
+ }
25298
+ },
25299
+ required: ["eventId", "siteId", "password"],
25300
+ additionalProperties: false
25301
+ }
25302
+ },
25303
+ {
25304
+ path: ["staff-redemption", "crew-password", "clear"],
25305
+ procedure: "event.staffRedemption.clearStaffRedemptionCrewPassword",
25306
+ operation: "mutation",
25307
+ summary: "Clear a site's crew password, which turns its crew link off and ends every crew session at that site.",
25308
+ effects: ["state-change"],
25309
+ target: "eventId",
25310
+ dates: [],
25311
+ input: {
25312
+ type: "object",
25313
+ properties: {
25314
+ eventId: {
25315
+ type: "string",
25316
+ minLength: 1,
25317
+ maxLength: 64
25318
+ },
25319
+ siteId: {
25320
+ type: "string",
25321
+ minLength: 1,
25322
+ maxLength: 64
25323
+ }
25324
+ },
25325
+ required: ["eventId", "siteId"],
25326
+ additionalProperties: false
25327
+ }
25328
+ },
25329
+ {
25330
+ path: ["staff-redemption", "session", "upsert"],
25331
+ procedure: "event.staffRedemption.upsertStaffRedemptionSession",
25332
+ 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.",
25334
+ effects: ["state-change"],
25335
+ target: "eventId",
25336
+ dates: ["startsAt", "endsAt"],
25337
+ input: {
25338
+ type: "object",
25339
+ properties: {
25340
+ eventId: {
25341
+ type: "string",
25342
+ minLength: 1,
25343
+ maxLength: 64
25344
+ },
25345
+ sessionId: {
25346
+ type: "string",
25347
+ minLength: 1,
25348
+ maxLength: 64
25349
+ },
25350
+ name: {
25351
+ type: "string",
25352
+ minLength: 1,
25353
+ maxLength: 120
25354
+ },
25355
+ shift: {
25356
+ type: "string",
25357
+ minLength: 1,
25358
+ maxLength: 8
25359
+ },
25360
+ startsAt: {
25361
+ default: null,
25362
+ anyOf: [
25363
+ {
25364
+ type: "string",
25365
+ format: "date-time"
25366
+ },
25367
+ {
25368
+ type: "null"
25369
+ }
25370
+ ]
25371
+ },
25372
+ endsAt: {
25373
+ default: null,
25374
+ anyOf: [
25375
+ {
25376
+ type: "string",
25377
+ format: "date-time"
25378
+ },
25379
+ {
25380
+ type: "null"
25381
+ }
25382
+ ]
25383
+ }
25384
+ },
25385
+ required: ["eventId", "name", "shift"],
25386
+ additionalProperties: false
25387
+ }
25388
+ },
25389
+ {
25390
+ path: ["staff-redemption", "slot", "set"],
25391
+ procedure: "event.staffRedemption.setStaffRedemptionSlot",
25392
+ operation: "mutation",
25393
+ summary: "Set how many sets a site has for a session (setQuantity). It cannot go below the sets already issued.",
25394
+ effects: ["state-change"],
25395
+ target: "eventId",
25396
+ dates: [],
25397
+ input: {
25398
+ type: "object",
25399
+ properties: {
25400
+ eventId: {
25401
+ type: "string",
25402
+ minLength: 1,
25403
+ maxLength: 64
25404
+ },
25405
+ sessionId: {
25406
+ type: "string",
25407
+ minLength: 1,
25408
+ maxLength: 64
25409
+ },
25410
+ siteId: {
25411
+ type: "string",
25412
+ minLength: 1,
25413
+ maxLength: 64
25414
+ },
25415
+ setQuantity: {
25416
+ type: "integer",
25417
+ minimum: 0,
25418
+ maximum: 1e5
25419
+ }
25420
+ },
25421
+ required: ["eventId", "sessionId", "siteId", "setQuantity"],
25422
+ additionalProperties: false
25423
+ }
25424
+ },
25425
+ {
25426
+ path: ["staff-redemption", "item-group", "upsert"],
25427
+ procedure: "event.staffRedemption.upsertStaffRedemptionItemGroup",
25428
+ operation: "mutation",
25429
+ summary: "Create an item group (omit groupId; a choice such as wrap or pancake) or rename and reorder one.",
25430
+ effects: ["state-change"],
25431
+ target: "eventId",
25432
+ dates: [],
25433
+ input: {
25434
+ type: "object",
25435
+ properties: {
25436
+ eventId: {
25437
+ type: "string",
25438
+ minLength: 1,
25439
+ maxLength: 64
25440
+ },
25441
+ groupId: {
25442
+ type: "string",
25443
+ minLength: 1,
25444
+ maxLength: 64
25445
+ },
25446
+ name: {
25447
+ type: "string",
25448
+ minLength: 1,
25449
+ maxLength: 120
25450
+ },
25451
+ order: {
25452
+ type: "integer",
25453
+ minimum: 0,
25454
+ maximum: 1e4
25455
+ }
25456
+ },
25457
+ required: ["eventId", "name"],
25458
+ additionalProperties: false
25459
+ }
25460
+ },
25461
+ {
25462
+ path: ["staff-redemption", "item", "upsert"],
25463
+ procedure: "event.staffRedemption.upsertStaffRedemptionItem",
25464
+ operation: "mutation",
25465
+ summary: "Create an item in a group (omit itemId) or rename, reorder or move one to another groupId; past claims keep their group.",
25466
+ effects: ["state-change"],
25467
+ target: "eventId",
25468
+ dates: [],
25469
+ input: {
25470
+ type: "object",
25471
+ properties: {
25472
+ eventId: {
25473
+ type: "string",
25474
+ minLength: 1,
25475
+ maxLength: 64
25476
+ },
25477
+ itemId: {
25478
+ type: "string",
25479
+ minLength: 1,
25480
+ maxLength: 64
25481
+ },
25482
+ groupId: {
25483
+ type: "string",
25484
+ minLength: 1,
25485
+ maxLength: 64
25486
+ },
25487
+ name: {
25488
+ type: "string",
25489
+ minLength: 1,
25490
+ maxLength: 120
25491
+ },
25492
+ order: {
25493
+ type: "integer",
25494
+ minimum: 0,
25495
+ maximum: 1e4
25496
+ }
25497
+ },
25498
+ required: ["eventId", "groupId", "name"],
25499
+ additionalProperties: false
25500
+ }
25501
+ },
25502
+ {
25503
+ path: ["staff-redemption", "prize", "upsert"],
25504
+ procedure: "event.staffRedemption.upsertStaffRedemptionPrize",
25505
+ operation: "mutation",
25506
+ summary: "Create a prize (omit prizeId) or rename and reorder one. Stock is set per slot with staff-redemption prize-stock set.",
25507
+ effects: ["state-change"],
25508
+ target: "eventId",
25509
+ dates: [],
25510
+ input: {
25511
+ type: "object",
25512
+ properties: {
25513
+ eventId: {
25514
+ type: "string",
25515
+ minLength: 1,
25516
+ maxLength: 64
25517
+ },
25518
+ prizeId: {
25519
+ type: "string",
25520
+ minLength: 1,
25521
+ maxLength: 64
25522
+ },
25523
+ name: {
25524
+ type: "string",
25525
+ minLength: 1,
25526
+ maxLength: 120
25527
+ },
25528
+ order: {
25529
+ type: "integer",
25530
+ minimum: 0,
25531
+ maximum: 1e4
25532
+ }
25533
+ },
25534
+ required: ["eventId", "name"],
25535
+ additionalProperties: false
25536
+ }
25537
+ },
25538
+ {
25539
+ path: ["staff-redemption", "prize-stock", "set"],
25540
+ procedure: "event.staffRedemption.setStaffRedemptionPrizeStock",
25541
+ operation: "mutation",
25542
+ summary: "Set a prize's stock for one slot (slotId from setup get). An optional reason is recorded; stock cannot go below the prizes already drawn there and not released.",
25543
+ effects: ["state-change"],
25544
+ target: "eventId",
25545
+ dates: [],
25546
+ input: {
25547
+ type: "object",
25548
+ properties: {
25549
+ eventId: {
25550
+ type: "string",
25551
+ minLength: 1,
25552
+ maxLength: 64
25553
+ },
25554
+ slotId: {
25555
+ type: "string",
25556
+ minLength: 1,
25557
+ maxLength: 64
25558
+ },
25559
+ prizeId: {
25560
+ type: "string",
25561
+ minLength: 1,
25562
+ maxLength: 64
25563
+ },
25564
+ quantity: {
25565
+ type: "integer",
25566
+ minimum: 0,
25567
+ maximum: 1e5
25568
+ },
25569
+ reason: {
25570
+ type: "string",
25571
+ minLength: 1,
25572
+ maxLength: 500
25573
+ }
25574
+ },
25575
+ required: ["eventId", "slotId", "prizeId", "quantity"],
25576
+ additionalProperties: false
25577
+ }
25578
+ },
25579
+ {
25580
+ path: ["staff-redemption", "rollover", "preview"],
25581
+ procedure: "event.staffRedemption.getStaffRedemptionRolloverPreview",
25582
+ operation: "query",
25583
+ summary: "Preview rolling leftovers from fromSessionId into toSessionId, per site: sets left (set quantity minus active, not voided, redemptions) and prizes left (stock minus prizes drawn and not released) in the source, what would move and the target afterwards. A site is skipped, with a reason, unless the target session already has a slot there with sets (a rollover never creates a slot). Advisory; rollover run recomputes under lock. Needs event.setup.",
25584
+ effects: [],
25585
+ dates: [],
25586
+ input: {
25587
+ type: "object",
25588
+ properties: {
25589
+ eventId: {
25590
+ type: "string",
25591
+ minLength: 1,
25592
+ maxLength: 64
25593
+ },
25594
+ fromSessionId: {
25595
+ type: "string",
25596
+ minLength: 1,
25597
+ maxLength: 64,
25598
+ description: "Session whose leftover sets and prizes move out (id from setup get). Must belong to this event and not be archived."
25599
+ },
25600
+ toSessionId: {
25601
+ type: "string",
25602
+ minLength: 1,
25603
+ maxLength: 64,
25604
+ description: "Session that receives them (id from setup get). Must differ from fromSessionId, belong to this event and not be archived."
25605
+ }
25606
+ },
25607
+ required: ["eventId", "fromSessionId", "toSessionId"],
25608
+ additionalProperties: false
25609
+ }
25610
+ },
25611
+ {
25612
+ path: ["staff-redemption", "rollover", "run"],
25613
+ procedure: "event.staffRedemption.rolloverStaffRedemptionStock",
25614
+ operation: "mutation",
25615
+ summary: "Move the leftover sets (sets) and/or prizes (prizes), both default true, of every site from fromSessionId into toSessionId, with a required reason (1-300 characters) that is logged. The source keeps exactly what it issued, so it never drops below issued. Skipped sites come back with a reason; moved is false and nothing is written (no quantity, log entry or lock) when nothing would move. Undo it exactly with rollover undo (the result's rolloverId is the id); running it the other way is not an undo. Returns rolloverId, null when nothing moved. Not automatic: a manager runs it. Needs event.setup.",
25616
+ effects: ["state-change"],
25617
+ target: "eventId",
25618
+ dates: [],
25619
+ input: {
25620
+ type: "object",
25621
+ properties: {
25622
+ eventId: {
25623
+ type: "string",
25624
+ minLength: 1,
25625
+ maxLength: 64
25626
+ },
25627
+ fromSessionId: {
25628
+ type: "string",
25629
+ minLength: 1,
25630
+ maxLength: 64,
25631
+ description: "Session whose leftover sets and prizes move out (id from setup get). Must belong to this event and not be archived."
25632
+ },
25633
+ toSessionId: {
25634
+ type: "string",
25635
+ minLength: 1,
25636
+ maxLength: 64,
25637
+ description: "Session that receives them (id from setup get). Must differ from fromSessionId, belong to this event and not be archived."
25638
+ },
25639
+ sets: {
25640
+ default: true,
25641
+ description: "Move the leftover sets (set quantity minus active, not voided, redemptions) of each site. Defaults to true.",
25642
+ type: "boolean"
25643
+ },
25644
+ prizes: {
25645
+ default: true,
25646
+ description: "Move the leftover prizes (stock minus prizes drawn and not released) of each site. Defaults to true.",
25647
+ type: "boolean"
25648
+ },
25649
+ reason: {
25650
+ type: "string",
25651
+ minLength: 1,
25652
+ maxLength: 300,
25653
+ description: "Why the leftovers move (1 to 300 characters). Recorded in the activity log."
25654
+ }
25655
+ },
25656
+ required: ["eventId", "fromSessionId", "toSessionId", "reason"],
25657
+ additionalProperties: false
25658
+ }
25659
+ },
25660
+ {
25661
+ path: ["staff-redemption", "rollover", "list"],
25662
+ procedure: "event.staffRedemption.getStaffRedemptionRollovers",
25663
+ operation: "query",
25664
+ summary: "List the event's rollovers, newest first (limit 1-50, default 20): id (use it for rollover undo), who ran it and when, reason, from and to sessions, totals, the sets and prizes moved per site, undoable, and undone (null, or who, when and why). total counts all of them. Needs event.setup.",
25665
+ effects: [],
25666
+ dates: [],
25667
+ input: {
25668
+ type: "object",
25669
+ properties: {
25670
+ eventId: {
25671
+ type: "string",
25672
+ minLength: 1,
25673
+ maxLength: 64
25674
+ },
25675
+ limit: {
25676
+ default: 20,
25677
+ description: "How many rollovers to return, newest first (1 to 50). Defaults to 20.",
25678
+ type: "integer",
25679
+ minimum: 1,
25680
+ maximum: 50
25681
+ }
25682
+ },
25683
+ required: ["eventId"],
25684
+ additionalProperties: false
25685
+ }
25686
+ },
25687
+ {
25688
+ path: ["staff-redemption", "rollover", "undo"],
25689
+ procedure: "event.staffRedemption.undoStaffRedemptionRollover",
25690
+ operation: "mutation",
25691
+ summary: "Undo one rollover exactly (rolloverId from rollover list), with a required reason (1-300 characters) that is logged: subtract exactly the sets and prizes it moved from the target session's slots and add them back to the source's, including a source left at 0 sets. The target's own sets and prizes are untouched. All or nothing: refused with CONFLICT, listing the sites and prizes, when a target site has since handed out or drawn part of what moved (it must still have the moved amount unissued), and with CONFLICT when already undone. A rolloverId of another event is NOT_FOUND. Does not check archived state: it restores exactly even if a session, site or prize was archived since. Redo or release voided target redemptions first, as an unreleased void's set counts as free. Recorded as its own activity entry. Needs event.setup.",
25692
+ effects: ["state-change"],
25693
+ target: "eventId",
25694
+ dates: [],
25695
+ input: {
25696
+ type: "object",
25697
+ properties: {
25698
+ eventId: {
25699
+ type: "string",
25700
+ minLength: 1,
25701
+ maxLength: 64
25702
+ },
25703
+ rolloverId: {
25704
+ type: "string",
25705
+ minLength: 1,
25706
+ maxLength: 64,
25707
+ description: "Id of the rollover to undo (id from rollover list). Must belong to this event and not be undone already."
25708
+ },
25709
+ reason: {
25710
+ type: "string",
25711
+ minLength: 1,
25712
+ maxLength: 300,
25713
+ description: "Why the rollover is undone (1 to 300 characters). Recorded in the activity log."
25714
+ }
25715
+ },
25716
+ required: ["eventId", "rolloverId", "reason"],
25717
+ additionalProperties: false
25718
+ }
25719
+ },
25720
+ {
25721
+ path: ["staff-redemption", "archive", "set"],
25722
+ procedure: "event.staffRedemption.setStaffRedemptionArchived",
25723
+ operation: "mutation",
25724
+ summary: "Archive (archived true) or unarchive (archived false) a site, session, itemGroup, item, prize or rosterEntry by entity and id. Setup get and roster list show the current state.",
25725
+ effects: ["state-change"],
25726
+ target: "eventId",
25727
+ dates: [],
25728
+ input: {
25729
+ type: "object",
25730
+ properties: {
25731
+ eventId: {
25732
+ type: "string",
25733
+ minLength: 1,
25734
+ maxLength: 64
25735
+ },
25736
+ entity: {
25737
+ type: "string",
25738
+ enum: [
25739
+ "site",
25740
+ "session",
25741
+ "itemGroup",
25742
+ "item",
25743
+ "prize",
25744
+ "rosterEntry"
25745
+ ]
25746
+ },
25747
+ id: {
25748
+ type: "string",
25749
+ minLength: 1,
25750
+ maxLength: 64
25751
+ },
25752
+ archived: {
25753
+ type: "boolean"
25754
+ }
25755
+ },
25756
+ required: ["eventId", "entity", "id", "archived"],
25757
+ additionalProperties: false
25758
+ }
25759
+ },
25760
+ {
25761
+ path: ["staff-redemption", "roster", "list"],
25762
+ procedure: "event.staffRedemption.getStaffRedemptionRoster",
25763
+ operation: "query",
25764
+ summary: "List roster entries (cursor paged); filter by search, siteId, shift, archived (active, archived, all) and collected (any, collected, not-collected).",
25765
+ effects: [],
25766
+ dates: [],
25767
+ input: {
25768
+ type: "object",
25769
+ properties: {
25770
+ eventId: {
25771
+ type: "string",
25772
+ minLength: 1,
25773
+ maxLength: 64
25774
+ },
25775
+ search: {
25776
+ type: "string",
25777
+ maxLength: 200
25778
+ },
25779
+ siteId: {
25780
+ type: "string",
25781
+ minLength: 1,
25782
+ maxLength: 64
25783
+ },
25784
+ shift: {
25785
+ type: "string",
25786
+ minLength: 1,
25787
+ maxLength: 8
25788
+ },
25789
+ archived: {
25790
+ default: "active",
25791
+ type: "string",
25792
+ enum: ["active", "archived", "all"]
25793
+ },
25794
+ collected: {
25795
+ default: "any",
25796
+ type: "string",
25797
+ enum: ["any", "collected", "not-collected"]
25798
+ },
25799
+ limit: {
25800
+ default: 25,
25801
+ type: "integer",
25802
+ minimum: 1,
25803
+ maximum: 100
25804
+ },
25805
+ cursor: {
25806
+ anyOf: [
25807
+ {
25808
+ type: "string",
25809
+ minLength: 1,
25810
+ maxLength: 8192
25811
+ },
25812
+ {
25813
+ type: "null"
25814
+ }
25815
+ ]
25816
+ },
25817
+ direction: {
25818
+ type: "string",
25819
+ const: "forward"
25820
+ }
25821
+ },
25822
+ required: ["eventId"],
25823
+ additionalProperties: false
25824
+ }
25825
+ },
25826
+ {
25827
+ path: ["staff-redemption", "roster", "counts"],
25828
+ procedure: "event.staffRedemption.getStaffRedemptionRosterCounts",
25829
+ operation: "query",
25830
+ summary: "Count roster entries matching the same filters as roster list.",
25831
+ effects: [],
25832
+ dates: [],
25833
+ input: {
25834
+ type: "object",
25835
+ properties: {
25836
+ eventId: {
25837
+ type: "string",
25838
+ minLength: 1,
25839
+ maxLength: 64
25840
+ },
25841
+ search: {
25842
+ type: "string",
25843
+ maxLength: 200
25844
+ },
25845
+ siteId: {
25846
+ type: "string",
25847
+ minLength: 1,
25848
+ maxLength: 64
25849
+ },
25850
+ shift: {
25851
+ type: "string",
25852
+ minLength: 1,
25853
+ maxLength: 8
25854
+ },
25855
+ archived: {
25856
+ default: "active",
25857
+ type: "string",
25858
+ enum: ["active", "archived", "all"]
25859
+ },
25860
+ collected: {
25861
+ default: "any",
25862
+ type: "string",
25863
+ enum: ["any", "collected", "not-collected"]
25864
+ }
25865
+ },
25866
+ required: ["eventId"],
25867
+ additionalProperties: false
25868
+ }
25869
+ },
25870
+ {
25871
+ path: ["staff-redemption", "roster", "upsert"],
25872
+ procedure: "event.staffRedemption.upsertStaffRedemptionRosterEntry",
25873
+ operation: "mutation",
25874
+ summary: "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).",
25875
+ effects: ["state-change"],
25876
+ target: "eventId",
25877
+ dates: [],
25878
+ input: {
25879
+ type: "object",
25880
+ properties: {
25881
+ eventId: {
25882
+ type: "string",
25883
+ minLength: 1,
25884
+ maxLength: 64
25885
+ },
25886
+ employeeId: {
25887
+ type: "string",
25888
+ minLength: 1,
25889
+ maxLength: 64
25890
+ },
25891
+ name: {
25892
+ anyOf: [
25893
+ {
25894
+ type: "string",
25895
+ maxLength: 120
25896
+ },
25897
+ {
25898
+ type: "null"
25899
+ }
25900
+ ]
25901
+ },
25902
+ siteName: {
25903
+ anyOf: [
25904
+ {
25905
+ type: "string",
25906
+ maxLength: 120
25907
+ },
25908
+ {
25909
+ type: "null"
25910
+ }
25911
+ ]
25912
+ },
25913
+ shift: {
25914
+ anyOf: [
25915
+ {
25916
+ type: "string",
25917
+ minLength: 1,
25918
+ maxLength: 8
25919
+ },
25920
+ {
25921
+ type: "null"
25922
+ }
25923
+ ]
25924
+ },
25925
+ workShift: {
25926
+ anyOf: [
25927
+ {
25928
+ type: "string",
25929
+ maxLength: 120
25930
+ },
25931
+ {
25932
+ type: "null"
25933
+ }
25934
+ ]
25935
+ },
25936
+ allowance: {
25937
+ type: "integer",
25938
+ minimum: 0,
25939
+ maximum: 20
25940
+ }
25941
+ },
25942
+ required: [
25943
+ "eventId",
25944
+ "employeeId",
25945
+ "name",
25946
+ "siteName",
25947
+ "shift",
25948
+ "workShift"
25949
+ ],
25950
+ additionalProperties: false
25951
+ }
25952
+ },
25953
+ {
25954
+ path: ["staff-redemption", "claims", "list"],
25955
+ procedure: "event.staffRedemption.getStaffRedemptionClaims",
25956
+ 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).",
25958
+ effects: [],
25959
+ dates: [],
25960
+ input: {
25961
+ type: "object",
25962
+ properties: {
25963
+ eventId: {
25964
+ type: "string",
25965
+ minLength: 1,
25966
+ maxLength: 64
25967
+ },
25968
+ search: {
25969
+ type: "string",
25970
+ maxLength: 200
25971
+ },
25972
+ siteId: {
25973
+ type: "string",
25974
+ minLength: 1,
25975
+ maxLength: 64
25976
+ },
25977
+ sessionId: {
25978
+ type: "string",
25979
+ minLength: 1,
25980
+ maxLength: 64
25981
+ },
25982
+ status: {
25983
+ default: "all",
25984
+ type: "string",
25985
+ enum: ["active", "voided", "all"]
25986
+ },
25987
+ limit: {
25988
+ default: 25,
25989
+ type: "integer",
25990
+ minimum: 1,
25991
+ maximum: 100
25992
+ },
25993
+ cursor: {
25994
+ anyOf: [
25995
+ {
25996
+ type: "string",
25997
+ minLength: 1,
25998
+ maxLength: 8192
25999
+ },
26000
+ {
26001
+ type: "null"
26002
+ }
26003
+ ]
26004
+ },
26005
+ direction: {
26006
+ type: "string",
26007
+ const: "forward"
26008
+ }
26009
+ },
26010
+ required: ["eventId"],
26011
+ additionalProperties: false
26012
+ }
26013
+ },
26014
+ {
26015
+ path: ["staff-redemption", "claims", "counts"],
26016
+ procedure: "event.staffRedemption.getStaffRedemptionClaimCounts",
26017
+ operation: "query",
26018
+ summary: "Count claims matching the same filters as claims list.",
26019
+ effects: [],
26020
+ dates: [],
26021
+ input: {
26022
+ type: "object",
26023
+ properties: {
26024
+ eventId: {
26025
+ type: "string",
26026
+ minLength: 1,
26027
+ maxLength: 64
26028
+ },
26029
+ search: {
26030
+ type: "string",
26031
+ maxLength: 200
26032
+ },
26033
+ siteId: {
26034
+ type: "string",
26035
+ minLength: 1,
26036
+ maxLength: 64
26037
+ },
26038
+ sessionId: {
26039
+ type: "string",
26040
+ minLength: 1,
26041
+ maxLength: 64
26042
+ },
26043
+ status: {
26044
+ default: "all",
26045
+ type: "string",
26046
+ enum: ["active", "voided", "all"]
26047
+ }
26048
+ },
26049
+ required: ["eventId"],
26050
+ additionalProperties: false
26051
+ }
26052
+ },
26053
+ {
26054
+ path: ["staff-redemption", "claims", "void"],
26055
+ procedure: "event.staffRedemption.voidStaffRedemptionClaim",
26056
+ 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.",
26058
+ effects: ["state-change"],
26059
+ target: "eventId",
26060
+ dates: [],
26061
+ input: {
26062
+ type: "object",
26063
+ properties: {
26064
+ eventId: {
26065
+ type: "string",
26066
+ minLength: 1,
26067
+ maxLength: 64
26068
+ },
26069
+ claimId: {
26070
+ type: "string",
26071
+ minLength: 1,
26072
+ maxLength: 64
26073
+ },
26074
+ reason: {
26075
+ type: "string",
26076
+ minLength: 1,
26077
+ maxLength: 500
26078
+ }
26079
+ },
26080
+ required: ["eventId", "claimId", "reason"],
26081
+ additionalProperties: false
26082
+ }
26083
+ },
26084
+ {
26085
+ path: ["staff-redemption", "draw", "release"],
26086
+ procedure: "event.staffRedemption.releaseStaffRedemptionDraw",
26087
+ operation: "mutation",
26088
+ summary: "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.",
26089
+ effects: ["state-change"],
26090
+ target: "eventId",
26091
+ dates: [],
26092
+ input: {
26093
+ type: "object",
26094
+ properties: {
26095
+ eventId: {
26096
+ type: "string",
26097
+ minLength: 1,
26098
+ maxLength: 64
26099
+ },
26100
+ drawId: {
26101
+ type: "string",
26102
+ minLength: 1,
26103
+ maxLength: 64
26104
+ },
26105
+ reason: {
26106
+ type: "string",
26107
+ minLength: 1,
26108
+ maxLength: 500
26109
+ },
26110
+ allowWhileClaimActive: {
26111
+ description: "Override: release the draw even though an active (not voided) redemption still shows it, for a redemption that stays recorded (for example a paper entry with no spin). Omit to refuse while any active redemption uses the draw.",
26112
+ type: "boolean"
26113
+ }
26114
+ },
26115
+ required: ["eventId", "drawId", "reason"],
26116
+ additionalProperties: false
26117
+ }
26118
+ },
26119
+ {
26120
+ path: ["staff-redemption", "stock", "summary"],
26121
+ procedure: "event.staffRedemption.getStaffRedemptionStockSummary",
26122
+ operation: "query",
26123
+ summary: "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.",
26124
+ effects: [],
26125
+ dates: [],
26126
+ input: {
26127
+ type: "object",
26128
+ properties: {
26129
+ eventId: {
26130
+ type: "string",
26131
+ minLength: 1,
26132
+ maxLength: 64
26133
+ }
26134
+ },
26135
+ required: ["eventId"],
26136
+ additionalProperties: false
26137
+ }
26138
+ },
26139
+ {
26140
+ path: ["staff-redemption", "counter", "context"],
26141
+ procedure: "event.staffRedemption.getStaffRedemptionCounterContext",
26142
+ 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.",
26144
+ effects: [],
26145
+ dates: [],
26146
+ input: {
26147
+ type: "object",
26148
+ properties: {
26149
+ eventId: {
26150
+ type: "string",
26151
+ minLength: 1,
26152
+ maxLength: 64
26153
+ },
26154
+ siteId: {
26155
+ type: "string",
26156
+ minLength: 1,
26157
+ maxLength: 64
26158
+ }
26159
+ },
26160
+ required: ["eventId", "siteId"],
26161
+ additionalProperties: false
26162
+ }
26163
+ },
26164
+ {
26165
+ path: ["staff-redemption", "lookup"],
26166
+ procedure: "event.staffRedemption.lookupStaffRedemptionEmployee",
26167
+ 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.",
26169
+ effects: [],
26170
+ dates: [],
26171
+ input: {
26172
+ type: "object",
26173
+ properties: {
26174
+ eventId: {
26175
+ type: "string",
26176
+ minLength: 1,
26177
+ maxLength: 64
26178
+ },
26179
+ siteId: {
26180
+ type: "string",
26181
+ minLength: 1,
26182
+ maxLength: 64
26183
+ },
26184
+ employeeId: {
26185
+ type: "string",
26186
+ minLength: 1,
26187
+ maxLength: 64
26188
+ }
26189
+ },
26190
+ required: ["eventId", "siteId", "employeeId"],
26191
+ additionalProperties: false
26192
+ }
26193
+ },
26194
+ {
26195
+ path: ["staff-redemption", "redeem"],
26196
+ procedure: "event.staffRedemption.redeemStaffRedemption",
26197
+ 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.",
26199
+ effects: ["state-change"],
26200
+ target: "eventId",
26201
+ dates: [],
26202
+ input: {
26203
+ type: "object",
26204
+ properties: {
26205
+ eventId: {
26206
+ type: "string",
26207
+ minLength: 1,
26208
+ maxLength: 64
26209
+ },
26210
+ siteId: {
26211
+ type: "string",
26212
+ minLength: 1,
26213
+ maxLength: 64
26214
+ },
26215
+ employeeId: {
26216
+ type: "string",
26217
+ minLength: 1,
26218
+ maxLength: 64
26219
+ },
26220
+ clientRequestId: {
26221
+ type: "string",
26222
+ format: "uuid",
26223
+ pattern: "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
26224
+ },
26225
+ itemIds: {
26226
+ maxItems: 20,
26227
+ type: "array",
26228
+ items: {
26229
+ type: "string",
26230
+ minLength: 1,
26231
+ maxLength: 64
26232
+ }
26233
+ }
26234
+ },
26235
+ required: [
26236
+ "eventId",
26237
+ "siteId",
26238
+ "employeeId",
26239
+ "clientRequestId",
26240
+ "itemIds"
26241
+ ],
26242
+ additionalProperties: false
26243
+ }
26244
+ },
26245
+ {
26246
+ path: ["staff-redemption", "counter", "claims"],
26247
+ procedure: "event.staffRedemption.getStaffRedemptionCounterClaims",
26248
+ 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.",
26250
+ effects: [],
26251
+ dates: [],
26252
+ input: {
26253
+ type: "object",
26254
+ properties: {
26255
+ eventId: {
26256
+ type: "string",
26257
+ minLength: 1,
26258
+ maxLength: 64
26259
+ },
26260
+ siteId: {
26261
+ type: "string",
26262
+ minLength: 1,
26263
+ maxLength: 64
26264
+ },
26265
+ limit: {
26266
+ default: 20,
26267
+ type: "integer",
26268
+ minimum: 1,
26269
+ maximum: 50
26270
+ },
26271
+ scope: {
26272
+ default: "mine",
26273
+ type: "string",
26274
+ enum: ["mine", "site"]
26275
+ }
26276
+ },
26277
+ required: ["eventId", "siteId"],
26278
+ additionalProperties: false
26279
+ }
26280
+ }
26281
+ ];
26282
+
26283
+ // src/registry/run-registry-command.ts
26284
+ var manifest = command_manifest_default;
26285
+ var registryFlags = [
26286
+ "input",
26287
+ "input-file",
26288
+ "allow-state-change",
26289
+ "allow-delete",
26290
+ "allow-email",
26291
+ "target"
26292
+ ];
26293
+ var isoDateTimePattern = /^\d{4}-\d\d-\d\dT\d\d:\d\d/;
26294
+ var isRecord3 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
26295
+ var commandName = (entry) => `et ${entry.path.join(" ")}`;
26296
+ var findManifestEntry = (positionals) => manifest.find((entry) => entry.path.length === positionals.length && entry.path.every((segment, index) => positionals[index] === segment));
26297
+ var listRegistryCommands = () => manifest.map((entry) => ({
26298
+ command: commandName(entry),
26299
+ summary: entry.summary,
24368
26300
  effects: entry.effects
24369
26301
  }));
24370
26302
  var coerceDateAt = (value, segments, label) => {
@@ -24843,11 +26775,11 @@ var runEventAppearanceUpload = async ({
24843
26775
  const filePath = getRequiredFlag(parsed, "file");
24844
26776
  const contentType = getRequiredFlag(parsed, "content-type");
24845
26777
  const mediaType = parseAppearanceMediaType(getRequiredFlag(parsed, "media-type"));
24846
- const file = await readFile6(filePath);
26778
+ const file = await readFile7(filePath);
24847
26779
  await ensureAuthentication();
24848
26780
  const signed = await api2.attachment.getPresignedUrlToUpload.mutate({
24849
26781
  folder: `event-appearance/${mediaType === "image" ? "images" : "videos"}`,
24850
- fileName: basename4(filePath),
26782
+ fileName: basename5(filePath),
24851
26783
  contentType,
24852
26784
  size: file.byteLength,
24853
26785
  eventId
@@ -25013,6 +26945,14 @@ var runCommand = async (parsed, runtime, credentialStore, apiBaseUrl, configureA
25013
26945
  });
25014
26946
  return;
25015
26947
  }
26948
+ if (group === "staff-redemption") {
26949
+ await runStaffRedemptionCommand({
26950
+ parsed,
26951
+ runtime,
26952
+ authenticate: ensureAuthentication
26953
+ });
26954
+ return;
26955
+ }
25016
26956
  if (group === "lucky-draw" && await runLuckyDrawSetupCommand({
25017
26957
  parsed,
25018
26958
  runtime,