@go-labs-sg/event-tech 1.14.0 → 1.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +220 -1
- package/command-reference.md +81 -0
- package/dist/index.js +1923 -81
- package/package.json +1 -1
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);
|
|
@@ -16443,6 +16562,22 @@ function _instanceof(cls, params = {}) {
|
|
|
16443
16562
|
};
|
|
16444
16563
|
return inst;
|
|
16445
16564
|
}
|
|
16565
|
+
// ../../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/classic/coerce.js
|
|
16566
|
+
function string3(params) {
|
|
16567
|
+
return _coercedString(ZodString, params);
|
|
16568
|
+
}
|
|
16569
|
+
function number3(params) {
|
|
16570
|
+
return _coercedNumber(ZodNumber, params);
|
|
16571
|
+
}
|
|
16572
|
+
function boolean3(params) {
|
|
16573
|
+
return _coercedBoolean(ZodBoolean, params);
|
|
16574
|
+
}
|
|
16575
|
+
function bigint2(params) {
|
|
16576
|
+
return _coercedBigint(ZodBigInt, params);
|
|
16577
|
+
}
|
|
16578
|
+
function date3(params) {
|
|
16579
|
+
return _coercedDate(ZodDate, params);
|
|
16580
|
+
}
|
|
16446
16581
|
// ../../cli-auth/src/protocol/schemas.ts
|
|
16447
16582
|
var dateTimeString = string2().refine((value) => Number.isFinite(Date.parse(value)), "Invalid datetime");
|
|
16448
16583
|
var base64Url2 = string2().min(43).max(128).regex(/^[A-Za-z0-9_-]+$/);
|
|
@@ -17182,8 +17317,8 @@ var logoutCliSession = async ({
|
|
|
17182
17317
|
};
|
|
17183
17318
|
// src/cli.ts
|
|
17184
17319
|
import { readFileSync } from "fs";
|
|
17185
|
-
import { readFile as
|
|
17186
|
-
import { basename as
|
|
17320
|
+
import { readFile as readFile7 } from "fs/promises";
|
|
17321
|
+
import { basename as basename5, resolve } from "path";
|
|
17187
17322
|
|
|
17188
17323
|
// ../db/src/generated/prisma/enums.ts
|
|
17189
17324
|
var EventType = {
|
|
@@ -17196,7 +17331,8 @@ var EventType = {
|
|
|
17196
17331
|
SIGNATURE_WALL: "SIGNATURE_WALL",
|
|
17197
17332
|
GARDENS_BY_THE_BAY: "GARDENS_BY_THE_BAY",
|
|
17198
17333
|
RATING_SYSTEM: "RATING_SYSTEM",
|
|
17199
|
-
EVENT_PASSPORT: "EVENT_PASSPORT"
|
|
17334
|
+
EVENT_PASSPORT: "EVENT_PASSPORT",
|
|
17335
|
+
STAFF_REDEMPTION: "STAFF_REDEMPTION"
|
|
17200
17336
|
};
|
|
17201
17337
|
|
|
17202
17338
|
// ../validators/src/event-type.schema.ts
|
|
@@ -18755,7 +18891,9 @@ var booleanFlags = new Set([
|
|
|
18755
18891
|
"allow-delete",
|
|
18756
18892
|
"allow-email",
|
|
18757
18893
|
"allow-state-change",
|
|
18894
|
+
"archive-missing",
|
|
18758
18895
|
"dry-run",
|
|
18896
|
+
"force",
|
|
18759
18897
|
"help",
|
|
18760
18898
|
"no-browser",
|
|
18761
18899
|
"password-stdin",
|
|
@@ -18923,13 +19061,14 @@ Usage:
|
|
|
18923
19061
|
et passport overview --event-id <id>
|
|
18924
19062
|
et passport mine --event-id <id>
|
|
18925
19063
|
et passport login-options --event-id <id>
|
|
19064
|
+
et passport queue-status --event-id <id> (what guests see: enabled, staleMinutes and the visible stations that have a wait set; overview lists every station's wait)
|
|
18926
19065
|
et passport bingo enable --event-id <id> (host: creates the hidden Bingo station and the HumanBingo)
|
|
18927
19066
|
et passport bingo rename --event-id <id> --name <name> (host: the game's display name guests see; 1-100 chars, default "Human Bingo")
|
|
18928
19067
|
et passport bingo join --event-id <id> (guest, passport participants only)
|
|
18929
19068
|
et passport bingo claim-stamp --event-id <id> (guest: catch-up award for a completed card)
|
|
18930
19069
|
et passport bingo status --event-id <id> (guest: own bingo progress and stamp)
|
|
18931
19070
|
et passport export --event-id <id>
|
|
18932
|
-
et passport settings update --event-id <id> --settings-json <json> (maxRedemptionsPerParticipant 0 = no cap; optional guestScan true|false)
|
|
19071
|
+
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 queueStatus true|false and queueStatusStaleMinutes 1-240|null)
|
|
18933
19072
|
et passport station upsert --event-id <id> --station-json <json> (collection.stampValue 0-1000, default 1; collection.category GAME|FOOD|DRINK|BINGO, default GAME)
|
|
18934
19073
|
et passport station-access get --event-id <id>
|
|
18935
19074
|
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)
|
|
@@ -18944,6 +19083,7 @@ Usage:
|
|
|
18944
19083
|
et passport station image-set --event-id <id> --station-id <id> --file <path> --content-type <image-mime>
|
|
18945
19084
|
et passport station image-clear --event-id <id> --station-id <id>
|
|
18946
19085
|
et passport station hidden --event-id <id> --station-id <id> --hidden <true|false>
|
|
19086
|
+
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; needs queueStatus on; re-sending a wait refreshes its time)
|
|
18947
19087
|
et passport station archive --event-id <id> --station-id <id> --allow-state-change --target <same-event-id>
|
|
18948
19088
|
et passport station print-get --event-id <id> --station-id <id>
|
|
18949
19089
|
et passport station print-issue --event-id <id> --station-id <id> --expected-printed-qr-version <n>
|
|
@@ -18971,6 +19111,8 @@ Usage:
|
|
|
18971
19111
|
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
19112
|
et passport roster remove --event-id <id> --entry-id <id> --allow-state-change --target <same-event-id>
|
|
18973
19113
|
et passport roster purge --event-id <id> --allow-state-change --target <same-event-id>
|
|
19114
|
+
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>
|
|
19115
|
+
et staff-redemption export --event-id <id> [--search <text>] [--site-id <id>] [--session-id <id>] [--status <active|voided|all>] [--csv-file <path> [--force]]
|
|
18974
19116
|
|
|
18975
19117
|
Event Passport:
|
|
18976
19118
|
Uses the same typed procedures and event permissions as the web app.
|
|
@@ -19001,15 +19143,33 @@ Event Passport:
|
|
|
19001
19143
|
focal point; null clears heroImage or logo. skin upload --kind hero|logo returns the key to reference
|
|
19002
19144
|
in skin set. skin clear returns the event to the Go Labs default look and keeps the rest of the appearance.
|
|
19003
19145
|
Other appearance saves that omit passport keep the stored skin. colors.dark needs 4.5:1 contrast with white.
|
|
19146
|
+
Staff Redemption events use the same block and commands: colors.graphic, colors.dark and emphasis (with the event
|
|
19147
|
+
theme) also theme the crew counter and its prize wheel (Settings > Appearance > Counter look). heroImage and logo are
|
|
19148
|
+
Passport-only: the counter ignores them; skin set keeps stored ones unless the patch names them, skin clear resets
|
|
19149
|
+
the whole block.
|
|
19004
19150
|
Date-time fields are ISO strings or null; order defaults to zero.
|
|
19005
19151
|
Settings JSON requires linkedDrawEventId, luckyDrawStampThreshold, prizeStampThreshold,
|
|
19006
19152
|
maxRedemptionsPerParticipant; optional loginMethods is {emailOtp,google,guest,staffId,staffIdRequiresLastName}.
|
|
19007
|
-
Keep email OTP, Google or
|
|
19153
|
+
Keep email OTP, Google or roster sign-in (staffId) enabled for recovery; staffId defaults to false and
|
|
19008
19154
|
staffIdRequiresLastName to true, so set it false again whenever you resend loginMethods.
|
|
19009
19155
|
Omit loginMethods to preserve it. Optional guestScan (boolean) turns guest station QR scanning
|
|
19010
19156
|
on or off; omit it to keep the stored value (absent means on). When off, guests cannot self-scan
|
|
19011
19157
|
(staff and station crew still stamp) and the guest passport hides the Scan tab. overview shows
|
|
19012
|
-
passport.guestScan and mine shows settings.guestScanEnabled.
|
|
19158
|
+
passport.guestScan and mine shows settings.guestScanEnabled. Optional simplifiedChinese (boolean,
|
|
19159
|
+
absent means off) offers a Simplified Chinese option on the guest passport; organiser-entered text
|
|
19160
|
+
stays as entered. overview shows passport.simplifiedChinese and login-options shows simplifiedChinese.
|
|
19161
|
+
Optional staffIdLabel (string up to 40 chars, or null to reset) names the roster identifier guests,
|
|
19162
|
+
station crew and organisers see; it defaults to "Employee Number", so send "Staff ID" for events
|
|
19163
|
+
that call it that. Omit it to keep the stored label; the Chinese passport keeps \u5458\u5DE5\u7F16\u53F7. overview
|
|
19164
|
+
shows passport.staffIdLabel, login-options shows staffIdLabel, mine shows settings.staffIdLabel and
|
|
19165
|
+
export returns staffIdLabel. Only the wording changes; the staffId fields and flags keep their names.
|
|
19166
|
+
Optional queueStatus (boolean, absent means off) lets station crew set a wait per station that guests
|
|
19167
|
+
see in their passport: under-10, under-30 or over-30 minutes. Optional queueStatusStaleMinutes (1-240,
|
|
19168
|
+
or null to reset to 20) is how long a set wait stays trusted before guests see "Not updated recently".
|
|
19169
|
+
overview shows passport.queueStatus, passport.queueStatusStaleMinutes and each station's queueStatus
|
|
19170
|
+
({status,updatedAt} or null); queue-status shows the guest view. station queue-status sets or clears one
|
|
19171
|
+
wait as an event operator (crew do the same in the browser), is refused while queueStatus is off, and
|
|
19172
|
+
every change is recorded in the activity log. Turning queueStatus off hides waits from guests but keeps them.
|
|
19013
19173
|
Staff roster (event hosts only): import replaces the roster and returns imported, replaced and
|
|
19014
19174
|
rejected rows (blank, too long, or a Staff ID repeated in the file). Columns are matched from
|
|
19015
19175
|
header names; override with the column flags. Without a last-name column, the last name is
|
|
@@ -19024,6 +19184,28 @@ Event Passport:
|
|
|
19024
19184
|
Points are scores only; existing stamp-based Lucky Draw and prize thresholds still apply.
|
|
19025
19185
|
Guest enrollment and account-linking require the browser; CLI uses existing device-approved auth.
|
|
19026
19186
|
|
|
19187
|
+
Staff redemption (STAFF_REDEMPTION events; most commands are registry commands, see below):
|
|
19188
|
+
Crew look up an Employee ID at a site counter, record the food items handed over and reveal a prize
|
|
19189
|
+
outcome the server decides in the same transaction. Setup is: settings, sites, crew passwords,
|
|
19190
|
+
sessions (one per shift), slots (sets per session and site), item groups and items, prizes, prize
|
|
19191
|
+
stock, roster. Run 'et staff-redemption setup get' for the IDs and what is still missing.
|
|
19192
|
+
roster import reads a CSV, or an XLSX sheet (the first unless --sheet <name> names another; an unknown
|
|
19193
|
+
name lists the workbook's sheets; a CSV has no sheets and refuses --sheet), matches columns from header names (override
|
|
19194
|
+
with the column flags; "none" clears an optional column), adds new Employee IDs and updates existing
|
|
19195
|
+
ones, and reports created, updated, unchanged, archived, rejectedCount, rejected rows and
|
|
19196
|
+
unmatchedSites. Existing rows are never deleted, so redemptions survive a re-import; --archive-missing archives active entries that are not in the file.
|
|
19197
|
+
Use --sheet "Master list" to import that tab of a workbook (exact name, else ignoring case and spaces).
|
|
19198
|
+
export prints the redemption rows as JSON, or with --csv-file writes a CSV (UTF-8 with BOM, CRLF,
|
|
19199
|
+
one row per claim, oldest first, text that would run as a spreadsheet formula gets a leading
|
|
19200
|
+
apostrophe) and prints { file, rows }. It never overwrites a file unless --force. It needs event.export
|
|
19201
|
+
and fails above 20,000 rows; narrow the filters.
|
|
19202
|
+
Crew sign-in with a site password and the counter access check are browser-only; the CLI operates
|
|
19203
|
+
counters as event staff (event.operate) and names the site with siteId.
|
|
19204
|
+
Archive and unarchive use 'staff-redemption archive set' with archived true or false.
|
|
19205
|
+
Every write repeats the event ID as --target. Lookup needs no confirmation (it writes nothing
|
|
19206
|
+
but failed-lookup throttle records). Redeem takes a clientRequestId UUID you generate;
|
|
19207
|
+
retrying with the same UUID returns the stored receipt and never redeems twice.
|
|
19208
|
+
|
|
19027
19209
|
Organization and event setup:
|
|
19028
19210
|
organization create is global-admin only. It provisions the org and emails an owner invitation
|
|
19029
19211
|
to --owner-email after it is saved; deliveryStatus (sent/failed) and
|
|
@@ -19064,7 +19246,9 @@ Registry commands (staff and admin operations, one per API procedure):
|
|
|
19064
19246
|
admin organization/event/member/user/activity/dashboard, event access/details/update/
|
|
19065
19247
|
status-update/archive/restore/duplicate/export/recent/background/story, activity list,
|
|
19066
19248
|
lucky-draw winners/boards/participants eligible|delete/wheel/passport-sync,
|
|
19067
|
-
passport lucky-draws/operator-metadata, photo-wall, post-it, signature-wall, rating, human-bingo
|
|
19249
|
+
passport lucky-draws/operator-metadata, photo-wall, post-it, signature-wall, rating, human-bingo,
|
|
19250
|
+
staff-redemption setup/settings/site/crew-password/session/slot/item-group/item/prize/prize-stock/
|
|
19251
|
+
archive/roster list|counts|upsert/claims/draw/stock/counter/lookup/redeem.
|
|
19068
19252
|
--input is passed unchanged to the procedure, so field names match the web app.
|
|
19069
19253
|
Date fields take ISO 8601 strings and are sent as dates.
|
|
19070
19254
|
Writes require --allow-state-change and --target equal to the input key shown by --help
|
|
@@ -19505,16 +19689,35 @@ var columnIndex = (reference) => {
|
|
|
19505
19689
|
index = index * 26 + letter.charCodeAt(0) - 64;
|
|
19506
19690
|
return index - 1;
|
|
19507
19691
|
};
|
|
19508
|
-
var
|
|
19692
|
+
var sheetPathFromTarget = (target) => target.startsWith("/") ? target.slice(1) : `xl/${target}`;
|
|
19693
|
+
var readWorkbookSheets = async (zip) => {
|
|
19509
19694
|
const workbook = await zip.file("xl/workbook.xml")?.async("string");
|
|
19695
|
+
if (!workbook)
|
|
19696
|
+
return [];
|
|
19510
19697
|
const rels = await zip.file("xl/_rels/workbook.xml.rels")?.async("string");
|
|
19511
|
-
const
|
|
19512
|
-
|
|
19513
|
-
|
|
19514
|
-
|
|
19515
|
-
|
|
19516
|
-
return
|
|
19517
|
-
|
|
19698
|
+
const relationships = rels ? [...rels.matchAll(/<Relationship\b[^>]*>/g)].map((match) => match[0]) : [];
|
|
19699
|
+
return [...workbook.matchAll(/<sheet\b[^>]*>/g)].map((match) => {
|
|
19700
|
+
const relationId = attribute(match[0], "r:id");
|
|
19701
|
+
const relationship = relationships.find((tag) => attribute(tag, "Id") === relationId);
|
|
19702
|
+
const target = relationship ? attribute(relationship, "Target") : undefined;
|
|
19703
|
+
return {
|
|
19704
|
+
name: decodeXml(attribute(match[0], "name") ?? ""),
|
|
19705
|
+
path: target ? sheetPathFromTarget(target) : undefined
|
|
19706
|
+
};
|
|
19707
|
+
});
|
|
19708
|
+
};
|
|
19709
|
+
var DEFAULT_SHEET_PATH = "xl/worksheets/sheet1.xml";
|
|
19710
|
+
var unknownSheetError = (sheetName, sheets) => new Error(`The workbook has no sheet named "${sheetName}". Sheets: ${sheets.map((sheet) => `"${sheet.name}"`).join(", ") || "none"}.`);
|
|
19711
|
+
var resolveSheetPath = (sheets, sheetName) => {
|
|
19712
|
+
if (sheetName === undefined)
|
|
19713
|
+
return sheets[0]?.path ?? DEFAULT_SHEET_PATH;
|
|
19714
|
+
const wanted = sheetName.trim().toLowerCase();
|
|
19715
|
+
const sheet = sheets.find((candidate) => candidate.name === sheetName) ?? sheets.find((candidate) => candidate.name.trim().toLowerCase() === wanted);
|
|
19716
|
+
if (!sheet)
|
|
19717
|
+
throw unknownSheetError(sheetName, sheets);
|
|
19718
|
+
if (!sheet.path)
|
|
19719
|
+
throw new Error(`The sheet "${sheet.name}" could not be read.`);
|
|
19720
|
+
return sheet.path;
|
|
19518
19721
|
};
|
|
19519
19722
|
var cellValue = (cellXml, sharedStrings) => {
|
|
19520
19723
|
const open = /^<c\b[^>]*>/.exec(cellXml)?.[0] ?? "";
|
|
@@ -19551,10 +19754,11 @@ var readRowCells = (rowXml, sharedStrings) => {
|
|
|
19551
19754
|
}
|
|
19552
19755
|
return cells;
|
|
19553
19756
|
};
|
|
19554
|
-
var readXlsx = async (bytes) => {
|
|
19757
|
+
var readXlsx = async (bytes, sheetName) => {
|
|
19555
19758
|
const zip = await import_jszip.default.loadAsync(bytes);
|
|
19556
19759
|
const sharedStrings = await readSharedStrings(zip);
|
|
19557
|
-
const
|
|
19760
|
+
const sheetPath = resolveSheetPath(await readWorkbookSheets(zip), sheetName);
|
|
19761
|
+
const sheet = await zip.file(sheetPath)?.async("string");
|
|
19558
19762
|
if (!sheet)
|
|
19559
19763
|
throw new Error("The workbook has no readable sheet.");
|
|
19560
19764
|
const table = [];
|
|
@@ -19591,12 +19795,19 @@ var squareTable = (table) => {
|
|
|
19591
19795
|
const width = Math.max(0, ...table.map((row) => row.length));
|
|
19592
19796
|
return table.map((row) => Array.from({ length: width }, (_, index) => row[index] ?? ""));
|
|
19593
19797
|
};
|
|
19594
|
-
var
|
|
19595
|
-
|
|
19596
|
-
|
|
19597
|
-
if (
|
|
19798
|
+
var toBytes = (data) => data instanceof Uint8Array ? data : new Uint8Array(data);
|
|
19799
|
+
var isXlsx = (fileName, bytes) => fileName.toLowerCase().endsWith(".xlsx") || isZip(bytes);
|
|
19800
|
+
var assertNotLegacyXls = (fileName) => {
|
|
19801
|
+
if (fileName.toLowerCase().endsWith(".xls"))
|
|
19598
19802
|
throw new Error("Save the file as .xlsx or .csv and try again.");
|
|
19599
|
-
|
|
19803
|
+
};
|
|
19804
|
+
var readSpreadsheetTable = async (fileName, data, options = {}) => {
|
|
19805
|
+
assertNotLegacyXls(fileName);
|
|
19806
|
+
const bytes = toBytes(data);
|
|
19807
|
+
const xlsx = isXlsx(fileName, bytes);
|
|
19808
|
+
if (!xlsx && options.sheetName !== undefined)
|
|
19809
|
+
throw new Error("A CSV file has no sheets. Remove the sheet name or use an .xlsx file.");
|
|
19810
|
+
const table = xlsx ? await readXlsx(bytes, options.sheetName) : readCsv(bytes);
|
|
19600
19811
|
const squared = squareTable(table);
|
|
19601
19812
|
if (squared.length === 0)
|
|
19602
19813
|
throw new Error("The file is empty.");
|
|
@@ -19680,12 +19891,27 @@ var passportLoginMethodsSchema = object({
|
|
|
19680
19891
|
staffId: boolean2().default(false),
|
|
19681
19892
|
staffIdRequiresLastName: boolean2().default(true)
|
|
19682
19893
|
}).strict().refine((methods) => methods.emailOtp || methods.google || methods.staffId, {
|
|
19683
|
-
message: "Keep email OTP, Google or
|
|
19894
|
+
message: "Keep email OTP, Google or roster sign-in available for passport recovery."
|
|
19684
19895
|
});
|
|
19896
|
+
var PASSPORT_QUEUE_STATUSES = [
|
|
19897
|
+
"UNDER_10_MIN",
|
|
19898
|
+
"UNDER_30_MIN",
|
|
19899
|
+
"OVER_30_MIN"
|
|
19900
|
+
];
|
|
19901
|
+
var passportQueueStatusSchema = _enum(PASSPORT_QUEUE_STATUSES);
|
|
19902
|
+
var PASSPORT_QUEUE_STATUS_STALE_MINUTES_MIN = 1;
|
|
19903
|
+
var PASSPORT_QUEUE_STATUS_STALE_MINUTES_MAX = 240;
|
|
19904
|
+
var PASSPORT_STAFF_ID_LABEL_DEFAULT = "Employee Number";
|
|
19905
|
+
var PASSPORT_STAFF_ID_LABEL_MAX = 40;
|
|
19906
|
+
var passportStaffIdLabelSchema = string2().trim().min(1).max(PASSPORT_STAFF_ID_LABEL_MAX);
|
|
19685
19907
|
var passportConfigSchema = object({
|
|
19686
19908
|
version: literal(1),
|
|
19687
19909
|
loginMethods: passportLoginMethodsSchema,
|
|
19688
|
-
guestScan: boolean2().optional()
|
|
19910
|
+
guestScan: boolean2().optional(),
|
|
19911
|
+
simplifiedChinese: boolean2().optional(),
|
|
19912
|
+
staffIdLabel: passportStaffIdLabelSchema.optional().catch(undefined),
|
|
19913
|
+
queueStatus: boolean2().optional().catch(undefined),
|
|
19914
|
+
queueStatusStaleMinutes: number2().int().min(PASSPORT_QUEUE_STATUS_STALE_MINUTES_MIN).max(PASSPORT_QUEUE_STATUS_STALE_MINUTES_MAX).optional().catch(undefined)
|
|
19689
19915
|
});
|
|
19690
19916
|
var passportStationConfigSchema = object({
|
|
19691
19917
|
version: literal(1),
|
|
@@ -19814,7 +20040,18 @@ var passportSettingsSchema = passportEventIdSchema.extend({
|
|
|
19814
20040
|
maxRedemptionsPerParticipant: number2().int().min(0).max(2147483647),
|
|
19815
20041
|
linkedDrawEventId: string2().min(1).nullable(),
|
|
19816
20042
|
loginMethods: passportLoginMethodsSchema.optional(),
|
|
19817
|
-
guestScan: boolean2().optional()
|
|
20043
|
+
guestScan: boolean2().optional(),
|
|
20044
|
+
simplifiedChinese: boolean2().optional(),
|
|
20045
|
+
staffIdLabel: union([
|
|
20046
|
+
_null3(),
|
|
20047
|
+
string2().trim().max(PASSPORT_STAFF_ID_LABEL_MAX).transform((label) => label === "" ? null : label)
|
|
20048
|
+
]).optional(),
|
|
20049
|
+
queueStatus: boolean2().optional(),
|
|
20050
|
+
queueStatusStaleMinutes: number2().int().min(PASSPORT_QUEUE_STATUS_STALE_MINUTES_MIN).max(PASSPORT_QUEUE_STATUS_STALE_MINUTES_MAX).nullable().optional()
|
|
20051
|
+
});
|
|
20052
|
+
var setPassportStationQueueStatusSchema = passportEventIdSchema.extend({
|
|
20053
|
+
stationId: string2().min(1),
|
|
20054
|
+
status: passportQueueStatusSchema.nullable()
|
|
19818
20055
|
});
|
|
19819
20056
|
var renamePassportBingoSchema = passportEventIdSchema.extend({
|
|
19820
20057
|
name: string2().trim().min(1).max(100)
|
|
@@ -19852,8 +20089,8 @@ var PASSPORT_ROSTER_NAME_MAX = 100;
|
|
|
19852
20089
|
var PASSPORT_ROSTER_IMPORT_MAX = 20000;
|
|
19853
20090
|
var PASSPORT_ROSTER_PAGE_MAX = 100;
|
|
19854
20091
|
var normalizePassportRosterKey = (value) => value.normalize("NFKD").replace(/\p{M}/gu, "").toLocaleLowerCase("en").replace(/[^\p{L}\p{N}]/gu, "");
|
|
19855
|
-
var rosterStaffIdSchema = string2().trim().min(1, "Enter
|
|
19856
|
-
message: "
|
|
20092
|
+
var rosterStaffIdSchema = string2().trim().min(1, "Enter an ID.").max(PASSPORT_ROSTER_STAFF_ID_MAX).refine((value) => normalizePassportRosterKey(value) !== "", {
|
|
20093
|
+
message: "The ID needs at least one letter or digit."
|
|
19857
20094
|
});
|
|
19858
20095
|
var rosterLastNameSchema = string2().trim().min(1, "Enter a last name.").max(PASSPORT_ROSTER_NAME_MAX).refine((value) => normalizePassportRosterKey(value) !== "", {
|
|
19859
20096
|
message: "Last name needs at least one letter or digit."
|
|
@@ -19886,12 +20123,13 @@ var passportRosterImportRowSchema = object({
|
|
|
19886
20123
|
var importPassportRosterSchema = passportEventIdSchema.extend({
|
|
19887
20124
|
rows: array(passportRosterImportRowSchema).max(PASSPORT_ROSTER_IMPORT_MAX, `A roster can have at most ${PASSPORT_ROSTER_IMPORT_MAX} rows.`)
|
|
19888
20125
|
}).strict();
|
|
19889
|
-
var
|
|
19890
|
-
MISSING_STAFF_ID:
|
|
20126
|
+
var passportRosterRejectReasonLabels = (staffIdLabel) => ({
|
|
20127
|
+
MISSING_STAFF_ID: `The ${staffIdLabel} is blank`,
|
|
19891
20128
|
MISSING_LAST_NAME: "Last name is blank",
|
|
19892
|
-
DUPLICATE_STAFF_ID:
|
|
19893
|
-
TOO_LONG: `
|
|
19894
|
-
};
|
|
20129
|
+
DUPLICATE_STAFF_ID: `The ${staffIdLabel} appears earlier in the file`,
|
|
20130
|
+
TOO_LONG: `The ${staffIdLabel} is over ${PASSPORT_ROSTER_STAFF_ID_MAX} characters or a name is over ${PASSPORT_ROSTER_NAME_MAX}`
|
|
20131
|
+
});
|
|
20132
|
+
var passportRosterRejectReasonLabel = passportRosterRejectReasonLabels(PASSPORT_STAFF_ID_LABEL_DEFAULT);
|
|
19895
20133
|
var cell = (row, index) => index === null ? "" : (row[index] ?? "").trim();
|
|
19896
20134
|
var surnameOf = (fullName, position) => {
|
|
19897
20135
|
const words = fullName.split(/\s+/).filter(Boolean);
|
|
@@ -20396,7 +20634,7 @@ var stationCategory = (value) => {
|
|
|
20396
20634
|
throw new CliUsageError(`category must be ${PASSPORT_STATION_CATEGORIES.join(", ")}.`);
|
|
20397
20635
|
return match;
|
|
20398
20636
|
};
|
|
20399
|
-
var
|
|
20637
|
+
var boolean4 = (value, name) => {
|
|
20400
20638
|
if (value === true || value === "true")
|
|
20401
20639
|
return true;
|
|
20402
20640
|
if (value === false || value === "false")
|
|
@@ -20440,7 +20678,7 @@ var keys = (value, allowed, name) => {
|
|
|
20440
20678
|
if (Object.keys(value).some((key) => !allowed.includes(key)))
|
|
20441
20679
|
throw new CliUsageError(`${name} contains unsupported fields.`);
|
|
20442
20680
|
};
|
|
20443
|
-
var
|
|
20681
|
+
var date4 = (value, name) => {
|
|
20444
20682
|
if (value == null)
|
|
20445
20683
|
return null;
|
|
20446
20684
|
if (typeof value !== "string" || !/^\d{4}-\d\d-\d\dT/.test(value))
|
|
@@ -20532,11 +20770,43 @@ var parsePassportStationInput = (raw, eventId) => {
|
|
|
20532
20770
|
...value.address === undefined ? {} : { address: nullableText(value.address, "address", 300) },
|
|
20533
20771
|
...value.imageKey === undefined ? {} : { imageKey: nullableText(value.imageKey, "imageKey", 2048) },
|
|
20534
20772
|
order: integer2(value.order ?? 0, "order"),
|
|
20535
|
-
opensAt:
|
|
20536
|
-
closesAt:
|
|
20773
|
+
opensAt: date4(value.opensAt, "opensAt"),
|
|
20774
|
+
closesAt: date4(value.closesAt, "closesAt"),
|
|
20537
20775
|
...collection ? { collection } : {}
|
|
20538
20776
|
};
|
|
20539
20777
|
};
|
|
20778
|
+
var QUEUE_STATUS_FLAGS = {
|
|
20779
|
+
"under-10": "UNDER_10_MIN",
|
|
20780
|
+
"under-30": "UNDER_30_MIN",
|
|
20781
|
+
"over-30": "OVER_30_MIN",
|
|
20782
|
+
clear: null
|
|
20783
|
+
};
|
|
20784
|
+
var queueStatusFlag = (value) => {
|
|
20785
|
+
const status = QUEUE_STATUS_FLAGS[value];
|
|
20786
|
+
if (status === undefined)
|
|
20787
|
+
throw new CliUsageError(`--status must be one of ${Object.keys(QUEUE_STATUS_FLAGS).join(", ")}.`);
|
|
20788
|
+
return status;
|
|
20789
|
+
};
|
|
20790
|
+
var parseSettingsSwitches = (value) => {
|
|
20791
|
+
const switches = {};
|
|
20792
|
+
if (value.queueStatusStaleMinutes !== undefined)
|
|
20793
|
+
switches.queueStatusStaleMinutes = value.queueStatusStaleMinutes === null ? null : integer2(value.queueStatusStaleMinutes, "queueStatusStaleMinutes", PASSPORT_QUEUE_STATUS_STALE_MINUTES_MIN, PASSPORT_QUEUE_STATUS_STALE_MINUTES_MAX);
|
|
20794
|
+
if (value.staffIdLabel !== undefined)
|
|
20795
|
+
switches.staffIdLabel = nullableText(value.staffIdLabel, "staffIdLabel", PASSPORT_STAFF_ID_LABEL_MAX);
|
|
20796
|
+
for (const name of [
|
|
20797
|
+
"guestScan",
|
|
20798
|
+
"simplifiedChinese",
|
|
20799
|
+
"queueStatus"
|
|
20800
|
+
]) {
|
|
20801
|
+
const item = value[name];
|
|
20802
|
+
if (item === undefined)
|
|
20803
|
+
continue;
|
|
20804
|
+
if (typeof item !== "boolean")
|
|
20805
|
+
throw new CliUsageError(`${name} must be a JSON boolean.`);
|
|
20806
|
+
switches[name] = item;
|
|
20807
|
+
}
|
|
20808
|
+
return switches;
|
|
20809
|
+
};
|
|
20540
20810
|
var parsePassportSettingsInput = (raw, eventId) => {
|
|
20541
20811
|
const value = json(raw, "--settings-json");
|
|
20542
20812
|
keys(value, [
|
|
@@ -20545,10 +20815,13 @@ var parsePassportSettingsInput = (raw, eventId) => {
|
|
|
20545
20815
|
"maxRedemptionsPerParticipant",
|
|
20546
20816
|
"linkedDrawEventId",
|
|
20547
20817
|
"loginMethods",
|
|
20548
|
-
"guestScan"
|
|
20818
|
+
"guestScan",
|
|
20819
|
+
"simplifiedChinese",
|
|
20820
|
+
"staffIdLabel",
|
|
20821
|
+
"queueStatus",
|
|
20822
|
+
"queueStatusStaleMinutes"
|
|
20549
20823
|
], "Settings");
|
|
20550
|
-
|
|
20551
|
-
throw new CliUsageError("guestScan must be a JSON boolean.");
|
|
20824
|
+
const switches = parseSettingsSwitches(value);
|
|
20552
20825
|
const threshold = (item, name) => item === null ? null : integer2(item, name, 1);
|
|
20553
20826
|
let loginMethods;
|
|
20554
20827
|
if (value.loginMethods !== undefined) {
|
|
@@ -20564,7 +20837,7 @@ var parsePassportSettingsInput = (raw, eventId) => {
|
|
|
20564
20837
|
staffIdRequiresLastName: methods.staffIdRequiresLastName !== false
|
|
20565
20838
|
};
|
|
20566
20839
|
if (!loginMethods.emailOtp && !loginMethods.google && !loginMethods.staffId)
|
|
20567
|
-
throw new CliUsageError("Keep email OTP, Google or
|
|
20840
|
+
throw new CliUsageError("Keep email OTP, Google or roster sign-in available for recovery.");
|
|
20568
20841
|
}
|
|
20569
20842
|
if (value.linkedDrawEventId === undefined)
|
|
20570
20843
|
throw new CliUsageError("linkedDrawEventId is required (use null to disable).");
|
|
@@ -20575,7 +20848,7 @@ var parsePassportSettingsInput = (raw, eventId) => {
|
|
|
20575
20848
|
maxRedemptionsPerParticipant: integer2(value.maxRedemptionsPerParticipant, "maxRedemptionsPerParticipant", 0),
|
|
20576
20849
|
linkedDrawEventId: value.linkedDrawEventId === null ? null : text(value.linkedDrawEventId, "linkedDrawEventId", 200),
|
|
20577
20850
|
...loginMethods ? { loginMethods } : {},
|
|
20578
|
-
...
|
|
20851
|
+
...switches
|
|
20579
20852
|
};
|
|
20580
20853
|
};
|
|
20581
20854
|
var parsePassportRosterEntryInput = (raw, eventId) => {
|
|
@@ -20759,6 +21032,9 @@ var runPassportCommand = async (input) => {
|
|
|
20759
21032
|
case "login-options":
|
|
20760
21033
|
operation = () => api2.event.passport.getPassportLoginOptions.query(event);
|
|
20761
21034
|
break;
|
|
21035
|
+
case "queue-status":
|
|
21036
|
+
operation = () => api2.event.passport.getPassportQueueStatuses.query(event);
|
|
21037
|
+
break;
|
|
20762
21038
|
case "export":
|
|
20763
21039
|
operation = () => api2.event.passport.getPassportExportData.query(event);
|
|
20764
21040
|
break;
|
|
@@ -20800,11 +21076,20 @@ var runPassportCommand = async (input) => {
|
|
|
20800
21076
|
allowed.push("station-id", "hidden");
|
|
20801
21077
|
const payload = {
|
|
20802
21078
|
...station(),
|
|
20803
|
-
hidden:
|
|
21079
|
+
hidden: boolean4(requiredFlag(flags, "hidden"), "--hidden")
|
|
20804
21080
|
};
|
|
20805
21081
|
operation = () => api2.event.passport.setPassportStationHidden.mutate(payload);
|
|
20806
21082
|
break;
|
|
20807
21083
|
}
|
|
21084
|
+
case "station queue-status": {
|
|
21085
|
+
allowed.push("station-id", "status");
|
|
21086
|
+
const payload = {
|
|
21087
|
+
...station(),
|
|
21088
|
+
status: queueStatusFlag(requiredFlag(flags, "status"))
|
|
21089
|
+
};
|
|
21090
|
+
operation = () => api2.event.passport.setStationQueueStatusAsStationStaff.mutate(payload);
|
|
21091
|
+
break;
|
|
21092
|
+
}
|
|
20808
21093
|
case "station start-qr": {
|
|
20809
21094
|
allowed.push("station-id");
|
|
20810
21095
|
const payload = station();
|
|
@@ -20841,7 +21126,7 @@ var runPassportCommand = async (input) => {
|
|
|
20841
21126
|
const payload = {
|
|
20842
21127
|
...station(),
|
|
20843
21128
|
participantId: requiredFlag(flags, "participant-id"),
|
|
20844
|
-
stamped:
|
|
21129
|
+
stamped: boolean4(requiredFlag(flags, "stamped"), "--stamped"),
|
|
20845
21130
|
reason: requiredFlag(flags, "reason"),
|
|
20846
21131
|
...optionalEntry("points", points, (raw) => integer2(raw, "--points"))
|
|
20847
21132
|
};
|
|
@@ -21021,6 +21306,431 @@ var runPassportCommand = async (input) => {
|
|
|
21021
21306
|
writeSuccess(input.runtime, await operation());
|
|
21022
21307
|
};
|
|
21023
21308
|
|
|
21309
|
+
// src/commands/staff-redemption.ts
|
|
21310
|
+
import { readFile as readFile6, writeFile } from "fs/promises";
|
|
21311
|
+
import { basename as basename4 } from "path";
|
|
21312
|
+
|
|
21313
|
+
// ../validators/src/staff-redemption/staff-redemption-input.schema.ts
|
|
21314
|
+
var STAFF_REDEMPTION_NAME_MAX = 120;
|
|
21315
|
+
var STAFF_REDEMPTION_EMPLOYEE_ID_MAX = 64;
|
|
21316
|
+
var STAFF_REDEMPTION_SHIFT_MAX = 8;
|
|
21317
|
+
var STAFF_REDEMPTION_ELIGIBLE_SHIFTS_MAX = 20;
|
|
21318
|
+
var STAFF_REDEMPTION_ALLOWANCE_MAX = 20;
|
|
21319
|
+
var STAFF_REDEMPTION_QUANTITY_MAX = 1e5;
|
|
21320
|
+
var STAFF_REDEMPTION_REASON_MAX = 500;
|
|
21321
|
+
var STAFF_REDEMPTION_ROLLOVER_REASON_MAX = 300;
|
|
21322
|
+
var STAFF_REDEMPTION_ROLLOVER_LIST_DEFAULT = 20;
|
|
21323
|
+
var STAFF_REDEMPTION_ROLLOVER_LIST_MAX = 50;
|
|
21324
|
+
var STAFF_REDEMPTION_PAGE_MAX = 100;
|
|
21325
|
+
var STAFF_REDEMPTION_CLAIM_ITEMS_MAX = 20;
|
|
21326
|
+
var STAFF_REDEMPTION_ITEM_RULES = [
|
|
21327
|
+
"ONE_FROM_EACH_GROUP",
|
|
21328
|
+
"AT_MOST_ONE_PER_GROUP",
|
|
21329
|
+
"AT_MOST_ONE_PER_GROUP_OR_NONE"
|
|
21330
|
+
];
|
|
21331
|
+
var STAFF_REDEMPTION_WRONG_SITE_RULES = [
|
|
21332
|
+
"REFUSE",
|
|
21333
|
+
"SERVE_FROM_COUNTER"
|
|
21334
|
+
];
|
|
21335
|
+
var STAFF_REDEMPTION_DRAW_POLICIES = [
|
|
21336
|
+
"REMAINING_HEADCOUNT",
|
|
21337
|
+
"FIXED_RATE"
|
|
21338
|
+
];
|
|
21339
|
+
var STAFF_REDEMPTION_ARCHIVABLE = [
|
|
21340
|
+
"site",
|
|
21341
|
+
"session",
|
|
21342
|
+
"itemGroup",
|
|
21343
|
+
"item",
|
|
21344
|
+
"prize",
|
|
21345
|
+
"rosterEntry"
|
|
21346
|
+
];
|
|
21347
|
+
var idSchema = string2().min(1).max(64);
|
|
21348
|
+
var nameSchema = string2().trim().min(1).max(STAFF_REDEMPTION_NAME_MAX);
|
|
21349
|
+
var orderSchema = number2().int().min(0).max(1e4);
|
|
21350
|
+
var quantitySchema = number2().int().min(0).max(STAFF_REDEMPTION_QUANTITY_MAX);
|
|
21351
|
+
var reasonSchema = string2().trim().min(1).max(STAFF_REDEMPTION_REASON_MAX);
|
|
21352
|
+
var staffRedemptionShiftSchema = string2().trim().min(1).max(STAFF_REDEMPTION_SHIFT_MAX).transform((value) => value.toUpperCase()).refine((value) => /^[A-Z0-9]+$/.test(value), {
|
|
21353
|
+
message: "Use letters and digits only."
|
|
21354
|
+
});
|
|
21355
|
+
var staffRedemptionEmployeeIdSchema = string2().trim().min(1).max(STAFF_REDEMPTION_EMPLOYEE_ID_MAX);
|
|
21356
|
+
var staffRedemptionClientRequestIdSchema = uuid2();
|
|
21357
|
+
var staffRedemptionEventIdSchema = object({ eventId: idSchema }).strict();
|
|
21358
|
+
var staffRedemptionSiteIdSchema = staffRedemptionEventIdSchema.extend({ siteId: idSchema }).strict();
|
|
21359
|
+
var updateStaffRedemptionSettingsSchema = staffRedemptionEventIdSchema.extend({
|
|
21360
|
+
eligibleShifts: array(staffRedemptionShiftSchema).min(1).max(STAFF_REDEMPTION_ELIGIBLE_SHIFTS_MAX).optional(),
|
|
21361
|
+
itemRule: _enum(STAFF_REDEMPTION_ITEM_RULES).optional(),
|
|
21362
|
+
wrongSite: _enum(STAFF_REDEMPTION_WRONG_SITE_RULES).optional(),
|
|
21363
|
+
drawPolicy: _enum(STAFF_REDEMPTION_DRAW_POLICIES).optional(),
|
|
21364
|
+
fixedWinRatePercent: number2().min(0).max(100).optional(),
|
|
21365
|
+
overrideReason: reasonSchema.optional()
|
|
21366
|
+
}).strict();
|
|
21367
|
+
var upsertStaffRedemptionSiteSchema = staffRedemptionEventIdSchema.extend({
|
|
21368
|
+
siteId: idSchema.optional(),
|
|
21369
|
+
name: nameSchema,
|
|
21370
|
+
order: orderSchema.optional()
|
|
21371
|
+
}).strict();
|
|
21372
|
+
var setStaffRedemptionCrewPasswordSchema = staffRedemptionSiteIdSchema.extend({ password: stationStaffPasswordSchema }).strict();
|
|
21373
|
+
var signInToStaffRedemptionCrewSchema = staffRedemptionSiteIdSchema.extend({ password: string2().min(1).max(128) }).strict();
|
|
21374
|
+
var upsertStaffRedemptionSessionSchema = staffRedemptionEventIdSchema.extend({
|
|
21375
|
+
sessionId: idSchema.optional(),
|
|
21376
|
+
name: nameSchema,
|
|
21377
|
+
shift: staffRedemptionShiftSchema,
|
|
21378
|
+
startsAt: exports_coerce.date().nullable().default(null),
|
|
21379
|
+
endsAt: exports_coerce.date().nullable().default(null)
|
|
21380
|
+
}).strict().refine((input) => input.startsAt === null || input.endsAt === null || input.endsAt > input.startsAt, {
|
|
21381
|
+
message: "The session must end after it starts.",
|
|
21382
|
+
path: ["endsAt"]
|
|
21383
|
+
});
|
|
21384
|
+
var setStaffRedemptionSlotSchema = staffRedemptionEventIdSchema.extend({
|
|
21385
|
+
sessionId: idSchema,
|
|
21386
|
+
siteId: idSchema,
|
|
21387
|
+
setQuantity: quantitySchema
|
|
21388
|
+
}).strict();
|
|
21389
|
+
var rolloverSessionsShape = {
|
|
21390
|
+
fromSessionId: idSchema.describe("Session whose leftover sets and prizes move out (id from setup get). Must belong to this event and not be archived."),
|
|
21391
|
+
toSessionId: idSchema.describe("Session that receives them (id from setup get). Must differ from fromSessionId, belong to this event and not be archived.")
|
|
21392
|
+
};
|
|
21393
|
+
var rolloverReasonSchema = (description) => string2().trim().min(1).max(STAFF_REDEMPTION_ROLLOVER_REASON_MAX).describe(description);
|
|
21394
|
+
var staffRedemptionRolloverPreviewSchema = staffRedemptionEventIdSchema.extend(rolloverSessionsShape).strict();
|
|
21395
|
+
var rolloverStaffRedemptionStockSchema = staffRedemptionEventIdSchema.extend({
|
|
21396
|
+
...rolloverSessionsShape,
|
|
21397
|
+
sets: boolean2().default(true).describe("Move the leftover sets (set quantity minus active, not voided, redemptions) of each site. Defaults to true."),
|
|
21398
|
+
prizes: boolean2().default(true).describe("Move the leftover prizes (stock minus prizes drawn and not released) of each site. Defaults to true."),
|
|
21399
|
+
reason: rolloverReasonSchema("Why the leftovers move (1 to 300 characters). Recorded in the activity log.")
|
|
21400
|
+
}).strict().refine((input) => input.sets || input.prizes, {
|
|
21401
|
+
message: "Choose sets, prizes or both.",
|
|
21402
|
+
path: ["sets"]
|
|
21403
|
+
});
|
|
21404
|
+
var staffRedemptionRolloversSchema = staffRedemptionEventIdSchema.extend({
|
|
21405
|
+
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.")
|
|
21406
|
+
}).strict();
|
|
21407
|
+
var undoStaffRedemptionRolloverSchema = staffRedemptionEventIdSchema.extend({
|
|
21408
|
+
rolloverId: idSchema.describe("Id of the rollover to undo (id from rollover list). Must belong to this event and not be undone already."),
|
|
21409
|
+
reason: rolloverReasonSchema("Why the rollover is undone (1 to 300 characters). Recorded in the activity log.")
|
|
21410
|
+
}).strict();
|
|
21411
|
+
var upsertStaffRedemptionItemGroupSchema = staffRedemptionEventIdSchema.extend({
|
|
21412
|
+
groupId: idSchema.optional(),
|
|
21413
|
+
name: nameSchema,
|
|
21414
|
+
order: orderSchema.optional()
|
|
21415
|
+
}).strict();
|
|
21416
|
+
var upsertStaffRedemptionItemSchema = staffRedemptionEventIdSchema.extend({
|
|
21417
|
+
itemId: idSchema.optional(),
|
|
21418
|
+
groupId: idSchema,
|
|
21419
|
+
name: nameSchema,
|
|
21420
|
+
order: orderSchema.optional()
|
|
21421
|
+
}).strict();
|
|
21422
|
+
var upsertStaffRedemptionPrizeSchema = staffRedemptionEventIdSchema.extend({
|
|
21423
|
+
prizeId: idSchema.optional(),
|
|
21424
|
+
name: nameSchema,
|
|
21425
|
+
order: orderSchema.optional()
|
|
21426
|
+
}).strict();
|
|
21427
|
+
var setStaffRedemptionPrizeStockSchema = staffRedemptionEventIdSchema.extend({
|
|
21428
|
+
slotId: idSchema,
|
|
21429
|
+
prizeId: idSchema,
|
|
21430
|
+
quantity: quantitySchema,
|
|
21431
|
+
reason: reasonSchema.optional()
|
|
21432
|
+
}).strict();
|
|
21433
|
+
var setStaffRedemptionArchivedSchema = staffRedemptionEventIdSchema.extend({
|
|
21434
|
+
entity: _enum(STAFF_REDEMPTION_ARCHIVABLE),
|
|
21435
|
+
id: idSchema,
|
|
21436
|
+
archived: boolean2()
|
|
21437
|
+
}).strict();
|
|
21438
|
+
var upsertStaffRedemptionRosterEntrySchema = staffRedemptionEventIdSchema.extend({
|
|
21439
|
+
employeeId: staffRedemptionEmployeeIdSchema,
|
|
21440
|
+
name: string2().trim().max(STAFF_REDEMPTION_NAME_MAX).nullable(),
|
|
21441
|
+
siteName: string2().trim().max(STAFF_REDEMPTION_NAME_MAX).nullable(),
|
|
21442
|
+
shift: staffRedemptionShiftSchema.nullable(),
|
|
21443
|
+
workShift: string2().trim().max(STAFF_REDEMPTION_NAME_MAX).nullable(),
|
|
21444
|
+
allowance: number2().int().min(0).max(STAFF_REDEMPTION_ALLOWANCE_MAX).optional()
|
|
21445
|
+
}).strict();
|
|
21446
|
+
var rosterFiltersShape = {
|
|
21447
|
+
search: string2().trim().max(200).optional(),
|
|
21448
|
+
siteId: idSchema.optional(),
|
|
21449
|
+
shift: staffRedemptionShiftSchema.optional(),
|
|
21450
|
+
archived: _enum(["active", "archived", "all"]).default("active"),
|
|
21451
|
+
collected: _enum(["any", "collected", "not-collected"]).default("any")
|
|
21452
|
+
};
|
|
21453
|
+
var staffRedemptionRosterListSchema = staffRedemptionEventIdSchema.extend({
|
|
21454
|
+
...rosterFiltersShape,
|
|
21455
|
+
limit: number2().int().min(1).max(STAFF_REDEMPTION_PAGE_MAX).default(25),
|
|
21456
|
+
cursor: string2().min(1).max(8192).nullish(),
|
|
21457
|
+
direction: literal("forward").optional()
|
|
21458
|
+
}).strict();
|
|
21459
|
+
var staffRedemptionRosterCountsSchema = staffRedemptionEventIdSchema.extend(rosterFiltersShape).strict();
|
|
21460
|
+
var lookupStaffRedemptionSchema = staffRedemptionSiteIdSchema.extend({ employeeId: staffRedemptionEmployeeIdSchema }).strict();
|
|
21461
|
+
var redeemStaffRedemptionSchema = staffRedemptionSiteIdSchema.extend({
|
|
21462
|
+
employeeId: staffRedemptionEmployeeIdSchema,
|
|
21463
|
+
clientRequestId: staffRedemptionClientRequestIdSchema,
|
|
21464
|
+
itemIds: array(idSchema).max(STAFF_REDEMPTION_CLAIM_ITEMS_MAX).refine((ids) => new Set(ids).size === ids.length, {
|
|
21465
|
+
message: "Pick each item once."
|
|
21466
|
+
})
|
|
21467
|
+
}).strict();
|
|
21468
|
+
var STAFF_REDEMPTION_COUNTER_CLAIM_SCOPES = ["mine", "site"];
|
|
21469
|
+
var staffRedemptionCounterClaimsSchema = staffRedemptionSiteIdSchema.extend({
|
|
21470
|
+
limit: number2().int().min(1).max(50).default(20),
|
|
21471
|
+
scope: _enum(STAFF_REDEMPTION_COUNTER_CLAIM_SCOPES).default("mine")
|
|
21472
|
+
}).strict();
|
|
21473
|
+
var claimFiltersShape = {
|
|
21474
|
+
search: string2().trim().max(200).optional(),
|
|
21475
|
+
siteId: idSchema.optional(),
|
|
21476
|
+
sessionId: idSchema.optional(),
|
|
21477
|
+
status: _enum(["active", "voided", "all"]).default("all")
|
|
21478
|
+
};
|
|
21479
|
+
var staffRedemptionClaimListSchema = staffRedemptionEventIdSchema.extend({
|
|
21480
|
+
...claimFiltersShape,
|
|
21481
|
+
limit: number2().int().min(1).max(STAFF_REDEMPTION_PAGE_MAX).default(25),
|
|
21482
|
+
cursor: string2().min(1).max(8192).nullish(),
|
|
21483
|
+
direction: literal("forward").optional()
|
|
21484
|
+
}).strict();
|
|
21485
|
+
var staffRedemptionClaimCountsSchema = staffRedemptionEventIdSchema.extend(claimFiltersShape).strict();
|
|
21486
|
+
var voidStaffRedemptionClaimSchema = staffRedemptionEventIdSchema.extend({ claimId: idSchema, reason: reasonSchema }).strict();
|
|
21487
|
+
var releaseStaffRedemptionDrawSchema = staffRedemptionEventIdSchema.extend({
|
|
21488
|
+
drawId: idSchema,
|
|
21489
|
+
reason: reasonSchema,
|
|
21490
|
+
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.")
|
|
21491
|
+
}).strict();
|
|
21492
|
+
var staffRedemptionExportSchema = staffRedemptionEventIdSchema.extend(claimFiltersShape).strict();
|
|
21493
|
+
|
|
21494
|
+
// ../validators/src/staff-redemption/staff-redemption-roster.schema.ts
|
|
21495
|
+
var STAFF_REDEMPTION_ROSTER_IMPORT_MAX = 20000;
|
|
21496
|
+
var staffRedemptionRosterImportRowSchema = object({
|
|
21497
|
+
row: number2().int().min(1),
|
|
21498
|
+
employeeId: string2().max(1000),
|
|
21499
|
+
name: string2().max(1000).nullable(),
|
|
21500
|
+
siteName: string2().max(1000).nullable(),
|
|
21501
|
+
shift: string2().max(1000).nullable(),
|
|
21502
|
+
workShift: string2().max(1000).nullable(),
|
|
21503
|
+
allowance: string2().max(1000).nullable()
|
|
21504
|
+
}).strict();
|
|
21505
|
+
var importStaffRedemptionRosterSchema = staffRedemptionEventIdSchema.extend({
|
|
21506
|
+
rows: array(staffRedemptionRosterImportRowSchema).min(1).max(STAFF_REDEMPTION_ROSTER_IMPORT_MAX, `A roster can have at most ${STAFF_REDEMPTION_ROSTER_IMPORT_MAX} rows.`),
|
|
21507
|
+
archiveMissing: boolean2().default(false)
|
|
21508
|
+
}).strict();
|
|
21509
|
+
var HEADER_PATTERNS = {
|
|
21510
|
+
employeeId: /^(employee|staff|worker)\s*(id|no|number)$|^(emp|staff)\s*id$/i,
|
|
21511
|
+
name: /^(worker|name|full\s*name|employee\s*name|staff\s*name)$/i,
|
|
21512
|
+
siteName: /^(site|location|fab)$/i,
|
|
21513
|
+
shift: /^shift$/i,
|
|
21514
|
+
workShift: /^work\s*shift$/i,
|
|
21515
|
+
allowance: /^(allowance|sets|entitlement|balance)$/i
|
|
21516
|
+
};
|
|
21517
|
+
var guessStaffRedemptionRosterMapping = (header) => {
|
|
21518
|
+
const find = (key) => {
|
|
21519
|
+
const index = header.findIndex((cell) => HEADER_PATTERNS[key].test(cell.trim()));
|
|
21520
|
+
return index === -1 ? null : index;
|
|
21521
|
+
};
|
|
21522
|
+
return {
|
|
21523
|
+
employeeId: find("employeeId") ?? 0,
|
|
21524
|
+
name: find("name"),
|
|
21525
|
+
siteName: find("siteName"),
|
|
21526
|
+
shift: find("shift"),
|
|
21527
|
+
workShift: find("workShift"),
|
|
21528
|
+
allowance: find("allowance")
|
|
21529
|
+
};
|
|
21530
|
+
};
|
|
21531
|
+
var mapStaffRedemptionRosterTable = (table, mapping) => {
|
|
21532
|
+
const cell = (line, index) => index === null ? null : line[index] ?? "";
|
|
21533
|
+
const rows = [];
|
|
21534
|
+
table.slice(1).forEach((line, offset) => {
|
|
21535
|
+
if (line.every((value) => !value?.trim()))
|
|
21536
|
+
return;
|
|
21537
|
+
rows.push({
|
|
21538
|
+
row: offset + 2,
|
|
21539
|
+
employeeId: line[mapping.employeeId] ?? "",
|
|
21540
|
+
name: cell(line, mapping.name),
|
|
21541
|
+
siteName: cell(line, mapping.siteName),
|
|
21542
|
+
shift: cell(line, mapping.shift),
|
|
21543
|
+
workShift: cell(line, mapping.workShift),
|
|
21544
|
+
allowance: cell(line, mapping.allowance)
|
|
21545
|
+
});
|
|
21546
|
+
});
|
|
21547
|
+
if (rows.length > STAFF_REDEMPTION_ROSTER_IMPORT_MAX)
|
|
21548
|
+
throw new Error(`A roster can have at most ${STAFF_REDEMPTION_ROSTER_IMPORT_MAX} rows.`);
|
|
21549
|
+
return rows;
|
|
21550
|
+
};
|
|
21551
|
+
|
|
21552
|
+
// src/commands/staff-redemption.ts
|
|
21553
|
+
var optionalRosterColumns = [
|
|
21554
|
+
["name", "name-column"],
|
|
21555
|
+
["siteName", "site-column"],
|
|
21556
|
+
["shift", "shift-column"],
|
|
21557
|
+
["workShift", "work-shift-column"],
|
|
21558
|
+
["allowance", "allowance-column"]
|
|
21559
|
+
];
|
|
21560
|
+
var rosterImportFlags = [
|
|
21561
|
+
"event-id",
|
|
21562
|
+
"file",
|
|
21563
|
+
"sheet",
|
|
21564
|
+
"employee-id-column",
|
|
21565
|
+
...optionalRosterColumns.map(([, flag]) => flag),
|
|
21566
|
+
"archive-missing",
|
|
21567
|
+
"allow-state-change",
|
|
21568
|
+
"target"
|
|
21569
|
+
];
|
|
21570
|
+
var exportFlags = [
|
|
21571
|
+
"event-id",
|
|
21572
|
+
"search",
|
|
21573
|
+
"site-id",
|
|
21574
|
+
"session-id",
|
|
21575
|
+
"status",
|
|
21576
|
+
"csv-file",
|
|
21577
|
+
"force"
|
|
21578
|
+
];
|
|
21579
|
+
var headerIndex2 = (headers, name) => {
|
|
21580
|
+
const wanted = name.trim().toLowerCase();
|
|
21581
|
+
const index = headers.findIndex((header) => header.trim().toLowerCase() === wanted);
|
|
21582
|
+
if (index === -1)
|
|
21583
|
+
throw new CliUsageError(`Column "${name}" is not in the file. Headers: ${headers.join(", ")}.`);
|
|
21584
|
+
return index;
|
|
21585
|
+
};
|
|
21586
|
+
var resolveStaffRedemptionRosterMapping = (headers, parsed) => {
|
|
21587
|
+
const mapping = guessStaffRedemptionRosterMapping(headers);
|
|
21588
|
+
const employeeIdColumn = getOptionalFlag(parsed, "employee-id-column");
|
|
21589
|
+
if (employeeIdColumn !== undefined)
|
|
21590
|
+
mapping.employeeId = headerIndex2(headers, employeeIdColumn);
|
|
21591
|
+
for (const [key, flag] of optionalRosterColumns) {
|
|
21592
|
+
const value = getOptionalFlag(parsed, flag);
|
|
21593
|
+
if (value === undefined)
|
|
21594
|
+
continue;
|
|
21595
|
+
mapping[key] = value.trim().toLowerCase() === "none" ? null : headerIndex2(headers, value);
|
|
21596
|
+
}
|
|
21597
|
+
return mapping;
|
|
21598
|
+
};
|
|
21599
|
+
var readRosterTable = async (path, sheetName) => {
|
|
21600
|
+
try {
|
|
21601
|
+
return await readSpreadsheetTable(basename4(path), await readFile6(path), {
|
|
21602
|
+
sheetName
|
|
21603
|
+
});
|
|
21604
|
+
} catch (error) {
|
|
21605
|
+
throw new CliUsageError(`Could not read ${path}: ${error instanceof Error ? error.message : "unknown error"}`);
|
|
21606
|
+
}
|
|
21607
|
+
};
|
|
21608
|
+
var prepareRosterImport = async (parsed) => {
|
|
21609
|
+
const eventId = getRequiredFlag(parsed, "event-id");
|
|
21610
|
+
const path = getRequiredFlag(parsed, "file");
|
|
21611
|
+
const sheet = getOptionalFlag(parsed, "sheet");
|
|
21612
|
+
assertStateChangeTarget(parsed, eventId);
|
|
21613
|
+
const table = await readRosterTable(path, sheet);
|
|
21614
|
+
const mapping = resolveStaffRedemptionRosterMapping(table[0] ?? [], parsed);
|
|
21615
|
+
let rows;
|
|
21616
|
+
try {
|
|
21617
|
+
rows = mapStaffRedemptionRosterTable(table, mapping);
|
|
21618
|
+
} catch (error) {
|
|
21619
|
+
throw new CliUsageError(`Could not import ${path}: ${error instanceof Error ? error.message : "unknown error"}`);
|
|
21620
|
+
}
|
|
21621
|
+
if (rows.length === 0)
|
|
21622
|
+
throw new CliUsageError(`${path} has a header but no data rows.`);
|
|
21623
|
+
return {
|
|
21624
|
+
eventId,
|
|
21625
|
+
rows,
|
|
21626
|
+
archiveMissing: parsed.flags.get("archive-missing") === true
|
|
21627
|
+
};
|
|
21628
|
+
};
|
|
21629
|
+
var exportFilters = (parsed, eventId) => {
|
|
21630
|
+
const checked = staffRedemptionExportSchema.safeParse({
|
|
21631
|
+
eventId,
|
|
21632
|
+
search: getOptionalFlag(parsed, "search"),
|
|
21633
|
+
siteId: getOptionalFlag(parsed, "site-id"),
|
|
21634
|
+
sessionId: getOptionalFlag(parsed, "session-id"),
|
|
21635
|
+
status: getOptionalFlag(parsed, "status")
|
|
21636
|
+
});
|
|
21637
|
+
if (!checked.success) {
|
|
21638
|
+
const issue = checked.error.issues[0];
|
|
21639
|
+
const name = String(issue?.path[0] ?? "filter");
|
|
21640
|
+
throw new CliUsageError(name === "status" ? "--status must be active, voided or all." : `Invalid ${name}: ${issue?.message ?? "the value is invalid"}.`);
|
|
21641
|
+
}
|
|
21642
|
+
return checked.data;
|
|
21643
|
+
};
|
|
21644
|
+
var formulaStart = /^[=+\-@\t\r]/;
|
|
21645
|
+
var csvCell = (value) => {
|
|
21646
|
+
const text = value ?? "";
|
|
21647
|
+
const safe = formulaStart.test(text) ? `'${text}` : text;
|
|
21648
|
+
return /[",\r\n]/.test(safe) ? `"${safe.replaceAll('"', '""')}"` : safe;
|
|
21649
|
+
};
|
|
21650
|
+
var csvColumns = [
|
|
21651
|
+
["Created at", (row) => row.createdAt.toISOString()],
|
|
21652
|
+
["Employee ID", (row) => row.employeeId],
|
|
21653
|
+
["Name", (row) => row.name],
|
|
21654
|
+
["Site", (row) => row.site.name],
|
|
21655
|
+
["Roster site", (row) => row.rosterSiteName],
|
|
21656
|
+
["Away from roster site", (row) => row.awayFromRosterSite ? "yes" : "no"],
|
|
21657
|
+
["Session", (row) => row.session.name],
|
|
21658
|
+
[
|
|
21659
|
+
"Items",
|
|
21660
|
+
(row) => row.items.map((item) => {
|
|
21661
|
+
const label = `${item.groupName}: ${item.name}`;
|
|
21662
|
+
return item.quantity === 1 ? label : `${label} x${item.quantity}`;
|
|
21663
|
+
}).join("; ")
|
|
21664
|
+
],
|
|
21665
|
+
["Outcome", (row) => row.draw?.outcome ?? null],
|
|
21666
|
+
["Prize", (row) => row.draw?.prize?.name ?? null],
|
|
21667
|
+
["Operator kind", (row) => row.operatorKind],
|
|
21668
|
+
["Voided at", (row) => row.voidedAt?.toISOString() ?? null],
|
|
21669
|
+
["Void reason", (row) => row.voidReason],
|
|
21670
|
+
["Draw released at", (row) => row.draw?.releasedAt?.toISOString() ?? null]
|
|
21671
|
+
];
|
|
21672
|
+
var staffRedemptionClaimsToCsv = (rows) => {
|
|
21673
|
+
const lines = [
|
|
21674
|
+
csvColumns.map(([header]) => csvCell(header)).join(","),
|
|
21675
|
+
...rows.map((row) => csvColumns.map(([, read]) => csvCell(read(row))).join(","))
|
|
21676
|
+
];
|
|
21677
|
+
return `\uFEFF${lines.join(`\r
|
|
21678
|
+
`)}\r
|
|
21679
|
+
`;
|
|
21680
|
+
};
|
|
21681
|
+
var writeCsvFile = async (path, content, force) => {
|
|
21682
|
+
try {
|
|
21683
|
+
await writeFile(path, content, {
|
|
21684
|
+
encoding: "utf8",
|
|
21685
|
+
flag: force ? "w" : "wx"
|
|
21686
|
+
});
|
|
21687
|
+
} catch (error) {
|
|
21688
|
+
const code = error instanceof Error && "code" in error ? error.code : undefined;
|
|
21689
|
+
if (code === "EEXIST")
|
|
21690
|
+
throw new CliUsageError(`${path} already exists. Choose another --csv-file or pass --force to overwrite it.`);
|
|
21691
|
+
throw new CliUsageError(`Could not write ${path}: ${error instanceof Error ? error.message : "unknown error"}`);
|
|
21692
|
+
}
|
|
21693
|
+
};
|
|
21694
|
+
var exportClaims = async (input) => {
|
|
21695
|
+
const { parsed, runtime } = input;
|
|
21696
|
+
assertOnlyFlags(parsed, exportFlags);
|
|
21697
|
+
assertPositionalCount(parsed, 2);
|
|
21698
|
+
const eventId = getRequiredFlag(parsed, "event-id");
|
|
21699
|
+
const filters = exportFilters(parsed, eventId);
|
|
21700
|
+
const csvFile = getOptionalFlag(parsed, "csv-file");
|
|
21701
|
+
if (csvFile === undefined && parsed.flags.has("force"))
|
|
21702
|
+
throw new CliUsageError("--force only applies with --csv-file.");
|
|
21703
|
+
await input.authenticate();
|
|
21704
|
+
const { rows } = await api2.event.staffRedemption.getStaffRedemptionExportData.query(filters);
|
|
21705
|
+
if (csvFile === undefined) {
|
|
21706
|
+
writeSuccess(runtime, { rows });
|
|
21707
|
+
return;
|
|
21708
|
+
}
|
|
21709
|
+
await writeCsvFile(csvFile, staffRedemptionClaimsToCsv(rows), parsed.flags.get("force") === true);
|
|
21710
|
+
writeSuccess(runtime, { file: csvFile, rows: rows.length });
|
|
21711
|
+
};
|
|
21712
|
+
var importRoster = async (input) => {
|
|
21713
|
+
const { parsed, runtime } = input;
|
|
21714
|
+
assertOnlyFlags(parsed, rosterImportFlags);
|
|
21715
|
+
assertPositionalCount(parsed, 3);
|
|
21716
|
+
const payload = await prepareRosterImport(parsed);
|
|
21717
|
+
await input.authenticate();
|
|
21718
|
+
writeSuccess(runtime, await api2.event.staffRedemption.importStaffRedemptionRoster.mutate(payload));
|
|
21719
|
+
};
|
|
21720
|
+
var runStaffRedemptionCommand = async (input) => {
|
|
21721
|
+
const action = input.parsed.positionals.slice(1).join(" ");
|
|
21722
|
+
switch (action) {
|
|
21723
|
+
case "roster import":
|
|
21724
|
+
await importRoster(input);
|
|
21725
|
+
return;
|
|
21726
|
+
case "export":
|
|
21727
|
+
await exportClaims(input);
|
|
21728
|
+
return;
|
|
21729
|
+
default:
|
|
21730
|
+
throw new CliUsageError("Unknown staff-redemption command. Run `et commands` for the registry commands and `et --help` for the rest.");
|
|
21731
|
+
}
|
|
21732
|
+
};
|
|
21733
|
+
|
|
21024
21734
|
// src/registry/command-manifest.json
|
|
21025
21735
|
var command_manifest_default = [
|
|
21026
21736
|
{
|
|
@@ -21430,7 +22140,8 @@ var command_manifest_default = [
|
|
|
21430
22140
|
"SIGNATURE_WALL",
|
|
21431
22141
|
"GARDENS_BY_THE_BAY",
|
|
21432
22142
|
"RATING_SYSTEM",
|
|
21433
|
-
"EVENT_PASSPORT"
|
|
22143
|
+
"EVENT_PASSPORT",
|
|
22144
|
+
"STAFF_REDEMPTION"
|
|
21434
22145
|
]
|
|
21435
22146
|
}
|
|
21436
22147
|
},
|
|
@@ -22556,7 +23267,8 @@ var command_manifest_default = [
|
|
|
22556
23267
|
"SIGNATURE_WALL",
|
|
22557
23268
|
"GARDENS_BY_THE_BAY",
|
|
22558
23269
|
"RATING_SYSTEM",
|
|
22559
|
-
"EVENT_PASSPORT"
|
|
23270
|
+
"EVENT_PASSPORT",
|
|
23271
|
+
"STAFF_REDEMPTION"
|
|
22560
23272
|
]
|
|
22561
23273
|
},
|
|
22562
23274
|
descriptionDelta: {},
|
|
@@ -24329,41 +25041,1163 @@ var command_manifest_default = [
|
|
|
24329
25041
|
},
|
|
24330
25042
|
required: ["eventId", "id", "status", "bingoCardId"]
|
|
24331
25043
|
}
|
|
24332
|
-
}
|
|
24333
|
-
|
|
24334
|
-
|
|
24335
|
-
|
|
24336
|
-
|
|
24337
|
-
|
|
24338
|
-
|
|
24339
|
-
|
|
24340
|
-
|
|
24341
|
-
|
|
24342
|
-
|
|
24343
|
-
|
|
24344
|
-
|
|
24345
|
-
|
|
24346
|
-
|
|
24347
|
-
|
|
24348
|
-
|
|
24349
|
-
|
|
24350
|
-
|
|
24351
|
-
summary: entry.summary,
|
|
24352
|
-
effects: entry.effects
|
|
24353
|
-
}));
|
|
24354
|
-
var coerceDateAt = (value, segments, label) => {
|
|
24355
|
-
const [head, ...rest] = segments;
|
|
24356
|
-
if (head === undefined) {
|
|
24357
|
-
if (typeof value !== "string")
|
|
24358
|
-
return value;
|
|
24359
|
-
const parsed = new Date(value);
|
|
24360
|
-
if (!isoDateTimePattern.test(value) || Number.isNaN(parsed.getTime())) {
|
|
24361
|
-
throw new CliUsageError(`${label} must be an ISO 8601 date-time such as 2026-11-20T18:00:00+08:00.`);
|
|
25044
|
+
},
|
|
25045
|
+
{
|
|
25046
|
+
path: ["staff-redemption", "setup", "get"],
|
|
25047
|
+
procedure: "event.staffRedemption.getStaffRedemptionSetup",
|
|
25048
|
+
operation: "query",
|
|
25049
|
+
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.",
|
|
25050
|
+
effects: [],
|
|
25051
|
+
dates: [],
|
|
25052
|
+
input: {
|
|
25053
|
+
type: "object",
|
|
25054
|
+
properties: {
|
|
25055
|
+
eventId: {
|
|
25056
|
+
type: "string",
|
|
25057
|
+
minLength: 1,
|
|
25058
|
+
maxLength: 64
|
|
25059
|
+
}
|
|
25060
|
+
},
|
|
25061
|
+
required: ["eventId"],
|
|
25062
|
+
additionalProperties: false
|
|
24362
25063
|
}
|
|
24363
|
-
|
|
24364
|
-
|
|
24365
|
-
|
|
24366
|
-
|
|
25064
|
+
},
|
|
25065
|
+
{
|
|
25066
|
+
path: ["staff-redemption", "settings", "update"],
|
|
25067
|
+
procedure: "event.staffRedemption.updateStaffRedemptionSettings",
|
|
25068
|
+
operation: "mutation",
|
|
25069
|
+
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.",
|
|
25070
|
+
effects: ["state-change"],
|
|
25071
|
+
target: "eventId",
|
|
25072
|
+
dates: [],
|
|
25073
|
+
input: {
|
|
25074
|
+
type: "object",
|
|
25075
|
+
properties: {
|
|
25076
|
+
eventId: {
|
|
25077
|
+
type: "string",
|
|
25078
|
+
minLength: 1,
|
|
25079
|
+
maxLength: 64
|
|
25080
|
+
},
|
|
25081
|
+
eligibleShifts: {
|
|
25082
|
+
minItems: 1,
|
|
25083
|
+
maxItems: 20,
|
|
25084
|
+
type: "array",
|
|
25085
|
+
items: {
|
|
25086
|
+
type: "string",
|
|
25087
|
+
minLength: 1,
|
|
25088
|
+
maxLength: 8
|
|
25089
|
+
}
|
|
25090
|
+
},
|
|
25091
|
+
itemRule: {
|
|
25092
|
+
type: "string",
|
|
25093
|
+
enum: [
|
|
25094
|
+
"ONE_FROM_EACH_GROUP",
|
|
25095
|
+
"AT_MOST_ONE_PER_GROUP",
|
|
25096
|
+
"AT_MOST_ONE_PER_GROUP_OR_NONE"
|
|
25097
|
+
]
|
|
25098
|
+
},
|
|
25099
|
+
wrongSite: {
|
|
25100
|
+
type: "string",
|
|
25101
|
+
enum: ["REFUSE", "SERVE_FROM_COUNTER"]
|
|
25102
|
+
},
|
|
25103
|
+
drawPolicy: {
|
|
25104
|
+
type: "string",
|
|
25105
|
+
enum: ["REMAINING_HEADCOUNT", "FIXED_RATE"]
|
|
25106
|
+
},
|
|
25107
|
+
fixedWinRatePercent: {
|
|
25108
|
+
type: "number",
|
|
25109
|
+
minimum: 0,
|
|
25110
|
+
maximum: 100
|
|
25111
|
+
},
|
|
25112
|
+
overrideReason: {
|
|
25113
|
+
type: "string",
|
|
25114
|
+
minLength: 1,
|
|
25115
|
+
maxLength: 500
|
|
25116
|
+
}
|
|
25117
|
+
},
|
|
25118
|
+
required: ["eventId"],
|
|
25119
|
+
additionalProperties: false
|
|
25120
|
+
}
|
|
25121
|
+
},
|
|
25122
|
+
{
|
|
25123
|
+
path: ["staff-redemption", "site", "upsert"],
|
|
25124
|
+
procedure: "event.staffRedemption.upsertStaffRedemptionSite",
|
|
25125
|
+
operation: "mutation",
|
|
25126
|
+
summary: "Create a site (omit siteId) or rename and reorder one (give siteId). Use staff-redemption archive set to archive or unarchive it.",
|
|
25127
|
+
effects: ["state-change"],
|
|
25128
|
+
target: "eventId",
|
|
25129
|
+
dates: [],
|
|
25130
|
+
input: {
|
|
25131
|
+
type: "object",
|
|
25132
|
+
properties: {
|
|
25133
|
+
eventId: {
|
|
25134
|
+
type: "string",
|
|
25135
|
+
minLength: 1,
|
|
25136
|
+
maxLength: 64
|
|
25137
|
+
},
|
|
25138
|
+
siteId: {
|
|
25139
|
+
type: "string",
|
|
25140
|
+
minLength: 1,
|
|
25141
|
+
maxLength: 64
|
|
25142
|
+
},
|
|
25143
|
+
name: {
|
|
25144
|
+
type: "string",
|
|
25145
|
+
minLength: 1,
|
|
25146
|
+
maxLength: 120
|
|
25147
|
+
},
|
|
25148
|
+
order: {
|
|
25149
|
+
type: "integer",
|
|
25150
|
+
minimum: 0,
|
|
25151
|
+
maximum: 1e4
|
|
25152
|
+
}
|
|
25153
|
+
},
|
|
25154
|
+
required: ["eventId", "name"],
|
|
25155
|
+
additionalProperties: false
|
|
25156
|
+
}
|
|
25157
|
+
},
|
|
25158
|
+
{
|
|
25159
|
+
path: ["staff-redemption", "crew-password", "set"],
|
|
25160
|
+
procedure: "event.staffRedemption.setStaffRedemptionCrewPassword",
|
|
25161
|
+
operation: "mutation",
|
|
25162
|
+
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.",
|
|
25163
|
+
effects: ["state-change"],
|
|
25164
|
+
target: "eventId",
|
|
25165
|
+
dates: [],
|
|
25166
|
+
input: {
|
|
25167
|
+
type: "object",
|
|
25168
|
+
properties: {
|
|
25169
|
+
eventId: {
|
|
25170
|
+
type: "string",
|
|
25171
|
+
minLength: 1,
|
|
25172
|
+
maxLength: 64
|
|
25173
|
+
},
|
|
25174
|
+
siteId: {
|
|
25175
|
+
type: "string",
|
|
25176
|
+
minLength: 1,
|
|
25177
|
+
maxLength: 64
|
|
25178
|
+
},
|
|
25179
|
+
password: {
|
|
25180
|
+
type: "string",
|
|
25181
|
+
minLength: 6,
|
|
25182
|
+
maxLength: 128
|
|
25183
|
+
}
|
|
25184
|
+
},
|
|
25185
|
+
required: ["eventId", "siteId", "password"],
|
|
25186
|
+
additionalProperties: false
|
|
25187
|
+
}
|
|
25188
|
+
},
|
|
25189
|
+
{
|
|
25190
|
+
path: ["staff-redemption", "crew-password", "clear"],
|
|
25191
|
+
procedure: "event.staffRedemption.clearStaffRedemptionCrewPassword",
|
|
25192
|
+
operation: "mutation",
|
|
25193
|
+
summary: "Clear a site's crew password, which turns its crew link off and ends every crew session at that site.",
|
|
25194
|
+
effects: ["state-change"],
|
|
25195
|
+
target: "eventId",
|
|
25196
|
+
dates: [],
|
|
25197
|
+
input: {
|
|
25198
|
+
type: "object",
|
|
25199
|
+
properties: {
|
|
25200
|
+
eventId: {
|
|
25201
|
+
type: "string",
|
|
25202
|
+
minLength: 1,
|
|
25203
|
+
maxLength: 64
|
|
25204
|
+
},
|
|
25205
|
+
siteId: {
|
|
25206
|
+
type: "string",
|
|
25207
|
+
minLength: 1,
|
|
25208
|
+
maxLength: 64
|
|
25209
|
+
}
|
|
25210
|
+
},
|
|
25211
|
+
required: ["eventId", "siteId"],
|
|
25212
|
+
additionalProperties: false
|
|
25213
|
+
}
|
|
25214
|
+
},
|
|
25215
|
+
{
|
|
25216
|
+
path: ["staff-redemption", "session", "upsert"],
|
|
25217
|
+
procedure: "event.staffRedemption.upsertStaffRedemptionSession",
|
|
25218
|
+
operation: "mutation",
|
|
25219
|
+
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.",
|
|
25220
|
+
effects: ["state-change"],
|
|
25221
|
+
target: "eventId",
|
|
25222
|
+
dates: ["startsAt", "endsAt"],
|
|
25223
|
+
input: {
|
|
25224
|
+
type: "object",
|
|
25225
|
+
properties: {
|
|
25226
|
+
eventId: {
|
|
25227
|
+
type: "string",
|
|
25228
|
+
minLength: 1,
|
|
25229
|
+
maxLength: 64
|
|
25230
|
+
},
|
|
25231
|
+
sessionId: {
|
|
25232
|
+
type: "string",
|
|
25233
|
+
minLength: 1,
|
|
25234
|
+
maxLength: 64
|
|
25235
|
+
},
|
|
25236
|
+
name: {
|
|
25237
|
+
type: "string",
|
|
25238
|
+
minLength: 1,
|
|
25239
|
+
maxLength: 120
|
|
25240
|
+
},
|
|
25241
|
+
shift: {
|
|
25242
|
+
type: "string",
|
|
25243
|
+
minLength: 1,
|
|
25244
|
+
maxLength: 8
|
|
25245
|
+
},
|
|
25246
|
+
startsAt: {
|
|
25247
|
+
default: null,
|
|
25248
|
+
anyOf: [
|
|
25249
|
+
{
|
|
25250
|
+
type: "string",
|
|
25251
|
+
format: "date-time"
|
|
25252
|
+
},
|
|
25253
|
+
{
|
|
25254
|
+
type: "null"
|
|
25255
|
+
}
|
|
25256
|
+
]
|
|
25257
|
+
},
|
|
25258
|
+
endsAt: {
|
|
25259
|
+
default: null,
|
|
25260
|
+
anyOf: [
|
|
25261
|
+
{
|
|
25262
|
+
type: "string",
|
|
25263
|
+
format: "date-time"
|
|
25264
|
+
},
|
|
25265
|
+
{
|
|
25266
|
+
type: "null"
|
|
25267
|
+
}
|
|
25268
|
+
]
|
|
25269
|
+
}
|
|
25270
|
+
},
|
|
25271
|
+
required: ["eventId", "name", "shift"],
|
|
25272
|
+
additionalProperties: false
|
|
25273
|
+
}
|
|
25274
|
+
},
|
|
25275
|
+
{
|
|
25276
|
+
path: ["staff-redemption", "slot", "set"],
|
|
25277
|
+
procedure: "event.staffRedemption.setStaffRedemptionSlot",
|
|
25278
|
+
operation: "mutation",
|
|
25279
|
+
summary: "Set how many sets a site has for a session (setQuantity). It cannot go below the sets already issued.",
|
|
25280
|
+
effects: ["state-change"],
|
|
25281
|
+
target: "eventId",
|
|
25282
|
+
dates: [],
|
|
25283
|
+
input: {
|
|
25284
|
+
type: "object",
|
|
25285
|
+
properties: {
|
|
25286
|
+
eventId: {
|
|
25287
|
+
type: "string",
|
|
25288
|
+
minLength: 1,
|
|
25289
|
+
maxLength: 64
|
|
25290
|
+
},
|
|
25291
|
+
sessionId: {
|
|
25292
|
+
type: "string",
|
|
25293
|
+
minLength: 1,
|
|
25294
|
+
maxLength: 64
|
|
25295
|
+
},
|
|
25296
|
+
siteId: {
|
|
25297
|
+
type: "string",
|
|
25298
|
+
minLength: 1,
|
|
25299
|
+
maxLength: 64
|
|
25300
|
+
},
|
|
25301
|
+
setQuantity: {
|
|
25302
|
+
type: "integer",
|
|
25303
|
+
minimum: 0,
|
|
25304
|
+
maximum: 1e5
|
|
25305
|
+
}
|
|
25306
|
+
},
|
|
25307
|
+
required: ["eventId", "sessionId", "siteId", "setQuantity"],
|
|
25308
|
+
additionalProperties: false
|
|
25309
|
+
}
|
|
25310
|
+
},
|
|
25311
|
+
{
|
|
25312
|
+
path: ["staff-redemption", "item-group", "upsert"],
|
|
25313
|
+
procedure: "event.staffRedemption.upsertStaffRedemptionItemGroup",
|
|
25314
|
+
operation: "mutation",
|
|
25315
|
+
summary: "Create an item group (omit groupId; a choice such as wrap or pancake) or rename and reorder one.",
|
|
25316
|
+
effects: ["state-change"],
|
|
25317
|
+
target: "eventId",
|
|
25318
|
+
dates: [],
|
|
25319
|
+
input: {
|
|
25320
|
+
type: "object",
|
|
25321
|
+
properties: {
|
|
25322
|
+
eventId: {
|
|
25323
|
+
type: "string",
|
|
25324
|
+
minLength: 1,
|
|
25325
|
+
maxLength: 64
|
|
25326
|
+
},
|
|
25327
|
+
groupId: {
|
|
25328
|
+
type: "string",
|
|
25329
|
+
minLength: 1,
|
|
25330
|
+
maxLength: 64
|
|
25331
|
+
},
|
|
25332
|
+
name: {
|
|
25333
|
+
type: "string",
|
|
25334
|
+
minLength: 1,
|
|
25335
|
+
maxLength: 120
|
|
25336
|
+
},
|
|
25337
|
+
order: {
|
|
25338
|
+
type: "integer",
|
|
25339
|
+
minimum: 0,
|
|
25340
|
+
maximum: 1e4
|
|
25341
|
+
}
|
|
25342
|
+
},
|
|
25343
|
+
required: ["eventId", "name"],
|
|
25344
|
+
additionalProperties: false
|
|
25345
|
+
}
|
|
25346
|
+
},
|
|
25347
|
+
{
|
|
25348
|
+
path: ["staff-redemption", "item", "upsert"],
|
|
25349
|
+
procedure: "event.staffRedemption.upsertStaffRedemptionItem",
|
|
25350
|
+
operation: "mutation",
|
|
25351
|
+
summary: "Create an item in a group (omit itemId) or rename, reorder or move one to another groupId; past claims keep their group.",
|
|
25352
|
+
effects: ["state-change"],
|
|
25353
|
+
target: "eventId",
|
|
25354
|
+
dates: [],
|
|
25355
|
+
input: {
|
|
25356
|
+
type: "object",
|
|
25357
|
+
properties: {
|
|
25358
|
+
eventId: {
|
|
25359
|
+
type: "string",
|
|
25360
|
+
minLength: 1,
|
|
25361
|
+
maxLength: 64
|
|
25362
|
+
},
|
|
25363
|
+
itemId: {
|
|
25364
|
+
type: "string",
|
|
25365
|
+
minLength: 1,
|
|
25366
|
+
maxLength: 64
|
|
25367
|
+
},
|
|
25368
|
+
groupId: {
|
|
25369
|
+
type: "string",
|
|
25370
|
+
minLength: 1,
|
|
25371
|
+
maxLength: 64
|
|
25372
|
+
},
|
|
25373
|
+
name: {
|
|
25374
|
+
type: "string",
|
|
25375
|
+
minLength: 1,
|
|
25376
|
+
maxLength: 120
|
|
25377
|
+
},
|
|
25378
|
+
order: {
|
|
25379
|
+
type: "integer",
|
|
25380
|
+
minimum: 0,
|
|
25381
|
+
maximum: 1e4
|
|
25382
|
+
}
|
|
25383
|
+
},
|
|
25384
|
+
required: ["eventId", "groupId", "name"],
|
|
25385
|
+
additionalProperties: false
|
|
25386
|
+
}
|
|
25387
|
+
},
|
|
25388
|
+
{
|
|
25389
|
+
path: ["staff-redemption", "prize", "upsert"],
|
|
25390
|
+
procedure: "event.staffRedemption.upsertStaffRedemptionPrize",
|
|
25391
|
+
operation: "mutation",
|
|
25392
|
+
summary: "Create a prize (omit prizeId) or rename and reorder one. Stock is set per slot with staff-redemption prize-stock set.",
|
|
25393
|
+
effects: ["state-change"],
|
|
25394
|
+
target: "eventId",
|
|
25395
|
+
dates: [],
|
|
25396
|
+
input: {
|
|
25397
|
+
type: "object",
|
|
25398
|
+
properties: {
|
|
25399
|
+
eventId: {
|
|
25400
|
+
type: "string",
|
|
25401
|
+
minLength: 1,
|
|
25402
|
+
maxLength: 64
|
|
25403
|
+
},
|
|
25404
|
+
prizeId: {
|
|
25405
|
+
type: "string",
|
|
25406
|
+
minLength: 1,
|
|
25407
|
+
maxLength: 64
|
|
25408
|
+
},
|
|
25409
|
+
name: {
|
|
25410
|
+
type: "string",
|
|
25411
|
+
minLength: 1,
|
|
25412
|
+
maxLength: 120
|
|
25413
|
+
},
|
|
25414
|
+
order: {
|
|
25415
|
+
type: "integer",
|
|
25416
|
+
minimum: 0,
|
|
25417
|
+
maximum: 1e4
|
|
25418
|
+
}
|
|
25419
|
+
},
|
|
25420
|
+
required: ["eventId", "name"],
|
|
25421
|
+
additionalProperties: false
|
|
25422
|
+
}
|
|
25423
|
+
},
|
|
25424
|
+
{
|
|
25425
|
+
path: ["staff-redemption", "prize-stock", "set"],
|
|
25426
|
+
procedure: "event.staffRedemption.setStaffRedemptionPrizeStock",
|
|
25427
|
+
operation: "mutation",
|
|
25428
|
+
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.",
|
|
25429
|
+
effects: ["state-change"],
|
|
25430
|
+
target: "eventId",
|
|
25431
|
+
dates: [],
|
|
25432
|
+
input: {
|
|
25433
|
+
type: "object",
|
|
25434
|
+
properties: {
|
|
25435
|
+
eventId: {
|
|
25436
|
+
type: "string",
|
|
25437
|
+
minLength: 1,
|
|
25438
|
+
maxLength: 64
|
|
25439
|
+
},
|
|
25440
|
+
slotId: {
|
|
25441
|
+
type: "string",
|
|
25442
|
+
minLength: 1,
|
|
25443
|
+
maxLength: 64
|
|
25444
|
+
},
|
|
25445
|
+
prizeId: {
|
|
25446
|
+
type: "string",
|
|
25447
|
+
minLength: 1,
|
|
25448
|
+
maxLength: 64
|
|
25449
|
+
},
|
|
25450
|
+
quantity: {
|
|
25451
|
+
type: "integer",
|
|
25452
|
+
minimum: 0,
|
|
25453
|
+
maximum: 1e5
|
|
25454
|
+
},
|
|
25455
|
+
reason: {
|
|
25456
|
+
type: "string",
|
|
25457
|
+
minLength: 1,
|
|
25458
|
+
maxLength: 500
|
|
25459
|
+
}
|
|
25460
|
+
},
|
|
25461
|
+
required: ["eventId", "slotId", "prizeId", "quantity"],
|
|
25462
|
+
additionalProperties: false
|
|
25463
|
+
}
|
|
25464
|
+
},
|
|
25465
|
+
{
|
|
25466
|
+
path: ["staff-redemption", "rollover", "preview"],
|
|
25467
|
+
procedure: "event.staffRedemption.getStaffRedemptionRolloverPreview",
|
|
25468
|
+
operation: "query",
|
|
25469
|
+
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.",
|
|
25470
|
+
effects: [],
|
|
25471
|
+
dates: [],
|
|
25472
|
+
input: {
|
|
25473
|
+
type: "object",
|
|
25474
|
+
properties: {
|
|
25475
|
+
eventId: {
|
|
25476
|
+
type: "string",
|
|
25477
|
+
minLength: 1,
|
|
25478
|
+
maxLength: 64
|
|
25479
|
+
},
|
|
25480
|
+
fromSessionId: {
|
|
25481
|
+
type: "string",
|
|
25482
|
+
minLength: 1,
|
|
25483
|
+
maxLength: 64,
|
|
25484
|
+
description: "Session whose leftover sets and prizes move out (id from setup get). Must belong to this event and not be archived."
|
|
25485
|
+
},
|
|
25486
|
+
toSessionId: {
|
|
25487
|
+
type: "string",
|
|
25488
|
+
minLength: 1,
|
|
25489
|
+
maxLength: 64,
|
|
25490
|
+
description: "Session that receives them (id from setup get). Must differ from fromSessionId, belong to this event and not be archived."
|
|
25491
|
+
}
|
|
25492
|
+
},
|
|
25493
|
+
required: ["eventId", "fromSessionId", "toSessionId"],
|
|
25494
|
+
additionalProperties: false
|
|
25495
|
+
}
|
|
25496
|
+
},
|
|
25497
|
+
{
|
|
25498
|
+
path: ["staff-redemption", "rollover", "run"],
|
|
25499
|
+
procedure: "event.staffRedemption.rolloverStaffRedemptionStock",
|
|
25500
|
+
operation: "mutation",
|
|
25501
|
+
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.",
|
|
25502
|
+
effects: ["state-change"],
|
|
25503
|
+
target: "eventId",
|
|
25504
|
+
dates: [],
|
|
25505
|
+
input: {
|
|
25506
|
+
type: "object",
|
|
25507
|
+
properties: {
|
|
25508
|
+
eventId: {
|
|
25509
|
+
type: "string",
|
|
25510
|
+
minLength: 1,
|
|
25511
|
+
maxLength: 64
|
|
25512
|
+
},
|
|
25513
|
+
fromSessionId: {
|
|
25514
|
+
type: "string",
|
|
25515
|
+
minLength: 1,
|
|
25516
|
+
maxLength: 64,
|
|
25517
|
+
description: "Session whose leftover sets and prizes move out (id from setup get). Must belong to this event and not be archived."
|
|
25518
|
+
},
|
|
25519
|
+
toSessionId: {
|
|
25520
|
+
type: "string",
|
|
25521
|
+
minLength: 1,
|
|
25522
|
+
maxLength: 64,
|
|
25523
|
+
description: "Session that receives them (id from setup get). Must differ from fromSessionId, belong to this event and not be archived."
|
|
25524
|
+
},
|
|
25525
|
+
sets: {
|
|
25526
|
+
default: true,
|
|
25527
|
+
description: "Move the leftover sets (set quantity minus active, not voided, redemptions) of each site. Defaults to true.",
|
|
25528
|
+
type: "boolean"
|
|
25529
|
+
},
|
|
25530
|
+
prizes: {
|
|
25531
|
+
default: true,
|
|
25532
|
+
description: "Move the leftover prizes (stock minus prizes drawn and not released) of each site. Defaults to true.",
|
|
25533
|
+
type: "boolean"
|
|
25534
|
+
},
|
|
25535
|
+
reason: {
|
|
25536
|
+
type: "string",
|
|
25537
|
+
minLength: 1,
|
|
25538
|
+
maxLength: 300,
|
|
25539
|
+
description: "Why the leftovers move (1 to 300 characters). Recorded in the activity log."
|
|
25540
|
+
}
|
|
25541
|
+
},
|
|
25542
|
+
required: ["eventId", "fromSessionId", "toSessionId", "reason"],
|
|
25543
|
+
additionalProperties: false
|
|
25544
|
+
}
|
|
25545
|
+
},
|
|
25546
|
+
{
|
|
25547
|
+
path: ["staff-redemption", "rollover", "list"],
|
|
25548
|
+
procedure: "event.staffRedemption.getStaffRedemptionRollovers",
|
|
25549
|
+
operation: "query",
|
|
25550
|
+
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.",
|
|
25551
|
+
effects: [],
|
|
25552
|
+
dates: [],
|
|
25553
|
+
input: {
|
|
25554
|
+
type: "object",
|
|
25555
|
+
properties: {
|
|
25556
|
+
eventId: {
|
|
25557
|
+
type: "string",
|
|
25558
|
+
minLength: 1,
|
|
25559
|
+
maxLength: 64
|
|
25560
|
+
},
|
|
25561
|
+
limit: {
|
|
25562
|
+
default: 20,
|
|
25563
|
+
description: "How many rollovers to return, newest first (1 to 50). Defaults to 20.",
|
|
25564
|
+
type: "integer",
|
|
25565
|
+
minimum: 1,
|
|
25566
|
+
maximum: 50
|
|
25567
|
+
}
|
|
25568
|
+
},
|
|
25569
|
+
required: ["eventId"],
|
|
25570
|
+
additionalProperties: false
|
|
25571
|
+
}
|
|
25572
|
+
},
|
|
25573
|
+
{
|
|
25574
|
+
path: ["staff-redemption", "rollover", "undo"],
|
|
25575
|
+
procedure: "event.staffRedemption.undoStaffRedemptionRollover",
|
|
25576
|
+
operation: "mutation",
|
|
25577
|
+
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.",
|
|
25578
|
+
effects: ["state-change"],
|
|
25579
|
+
target: "eventId",
|
|
25580
|
+
dates: [],
|
|
25581
|
+
input: {
|
|
25582
|
+
type: "object",
|
|
25583
|
+
properties: {
|
|
25584
|
+
eventId: {
|
|
25585
|
+
type: "string",
|
|
25586
|
+
minLength: 1,
|
|
25587
|
+
maxLength: 64
|
|
25588
|
+
},
|
|
25589
|
+
rolloverId: {
|
|
25590
|
+
type: "string",
|
|
25591
|
+
minLength: 1,
|
|
25592
|
+
maxLength: 64,
|
|
25593
|
+
description: "Id of the rollover to undo (id from rollover list). Must belong to this event and not be undone already."
|
|
25594
|
+
},
|
|
25595
|
+
reason: {
|
|
25596
|
+
type: "string",
|
|
25597
|
+
minLength: 1,
|
|
25598
|
+
maxLength: 300,
|
|
25599
|
+
description: "Why the rollover is undone (1 to 300 characters). Recorded in the activity log."
|
|
25600
|
+
}
|
|
25601
|
+
},
|
|
25602
|
+
required: ["eventId", "rolloverId", "reason"],
|
|
25603
|
+
additionalProperties: false
|
|
25604
|
+
}
|
|
25605
|
+
},
|
|
25606
|
+
{
|
|
25607
|
+
path: ["staff-redemption", "archive", "set"],
|
|
25608
|
+
procedure: "event.staffRedemption.setStaffRedemptionArchived",
|
|
25609
|
+
operation: "mutation",
|
|
25610
|
+
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.",
|
|
25611
|
+
effects: ["state-change"],
|
|
25612
|
+
target: "eventId",
|
|
25613
|
+
dates: [],
|
|
25614
|
+
input: {
|
|
25615
|
+
type: "object",
|
|
25616
|
+
properties: {
|
|
25617
|
+
eventId: {
|
|
25618
|
+
type: "string",
|
|
25619
|
+
minLength: 1,
|
|
25620
|
+
maxLength: 64
|
|
25621
|
+
},
|
|
25622
|
+
entity: {
|
|
25623
|
+
type: "string",
|
|
25624
|
+
enum: [
|
|
25625
|
+
"site",
|
|
25626
|
+
"session",
|
|
25627
|
+
"itemGroup",
|
|
25628
|
+
"item",
|
|
25629
|
+
"prize",
|
|
25630
|
+
"rosterEntry"
|
|
25631
|
+
]
|
|
25632
|
+
},
|
|
25633
|
+
id: {
|
|
25634
|
+
type: "string",
|
|
25635
|
+
minLength: 1,
|
|
25636
|
+
maxLength: 64
|
|
25637
|
+
},
|
|
25638
|
+
archived: {
|
|
25639
|
+
type: "boolean"
|
|
25640
|
+
}
|
|
25641
|
+
},
|
|
25642
|
+
required: ["eventId", "entity", "id", "archived"],
|
|
25643
|
+
additionalProperties: false
|
|
25644
|
+
}
|
|
25645
|
+
},
|
|
25646
|
+
{
|
|
25647
|
+
path: ["staff-redemption", "roster", "list"],
|
|
25648
|
+
procedure: "event.staffRedemption.getStaffRedemptionRoster",
|
|
25649
|
+
operation: "query",
|
|
25650
|
+
summary: "List roster entries (cursor paged); filter by search, siteId, shift, archived (active, archived, all) and collected (any, collected, not-collected).",
|
|
25651
|
+
effects: [],
|
|
25652
|
+
dates: [],
|
|
25653
|
+
input: {
|
|
25654
|
+
type: "object",
|
|
25655
|
+
properties: {
|
|
25656
|
+
eventId: {
|
|
25657
|
+
type: "string",
|
|
25658
|
+
minLength: 1,
|
|
25659
|
+
maxLength: 64
|
|
25660
|
+
},
|
|
25661
|
+
search: {
|
|
25662
|
+
type: "string",
|
|
25663
|
+
maxLength: 200
|
|
25664
|
+
},
|
|
25665
|
+
siteId: {
|
|
25666
|
+
type: "string",
|
|
25667
|
+
minLength: 1,
|
|
25668
|
+
maxLength: 64
|
|
25669
|
+
},
|
|
25670
|
+
shift: {
|
|
25671
|
+
type: "string",
|
|
25672
|
+
minLength: 1,
|
|
25673
|
+
maxLength: 8
|
|
25674
|
+
},
|
|
25675
|
+
archived: {
|
|
25676
|
+
default: "active",
|
|
25677
|
+
type: "string",
|
|
25678
|
+
enum: ["active", "archived", "all"]
|
|
25679
|
+
},
|
|
25680
|
+
collected: {
|
|
25681
|
+
default: "any",
|
|
25682
|
+
type: "string",
|
|
25683
|
+
enum: ["any", "collected", "not-collected"]
|
|
25684
|
+
},
|
|
25685
|
+
limit: {
|
|
25686
|
+
default: 25,
|
|
25687
|
+
type: "integer",
|
|
25688
|
+
minimum: 1,
|
|
25689
|
+
maximum: 100
|
|
25690
|
+
},
|
|
25691
|
+
cursor: {
|
|
25692
|
+
anyOf: [
|
|
25693
|
+
{
|
|
25694
|
+
type: "string",
|
|
25695
|
+
minLength: 1,
|
|
25696
|
+
maxLength: 8192
|
|
25697
|
+
},
|
|
25698
|
+
{
|
|
25699
|
+
type: "null"
|
|
25700
|
+
}
|
|
25701
|
+
]
|
|
25702
|
+
},
|
|
25703
|
+
direction: {
|
|
25704
|
+
type: "string",
|
|
25705
|
+
const: "forward"
|
|
25706
|
+
}
|
|
25707
|
+
},
|
|
25708
|
+
required: ["eventId"],
|
|
25709
|
+
additionalProperties: false
|
|
25710
|
+
}
|
|
25711
|
+
},
|
|
25712
|
+
{
|
|
25713
|
+
path: ["staff-redemption", "roster", "counts"],
|
|
25714
|
+
procedure: "event.staffRedemption.getStaffRedemptionRosterCounts",
|
|
25715
|
+
operation: "query",
|
|
25716
|
+
summary: "Count roster entries matching the same filters as roster list.",
|
|
25717
|
+
effects: [],
|
|
25718
|
+
dates: [],
|
|
25719
|
+
input: {
|
|
25720
|
+
type: "object",
|
|
25721
|
+
properties: {
|
|
25722
|
+
eventId: {
|
|
25723
|
+
type: "string",
|
|
25724
|
+
minLength: 1,
|
|
25725
|
+
maxLength: 64
|
|
25726
|
+
},
|
|
25727
|
+
search: {
|
|
25728
|
+
type: "string",
|
|
25729
|
+
maxLength: 200
|
|
25730
|
+
},
|
|
25731
|
+
siteId: {
|
|
25732
|
+
type: "string",
|
|
25733
|
+
minLength: 1,
|
|
25734
|
+
maxLength: 64
|
|
25735
|
+
},
|
|
25736
|
+
shift: {
|
|
25737
|
+
type: "string",
|
|
25738
|
+
minLength: 1,
|
|
25739
|
+
maxLength: 8
|
|
25740
|
+
},
|
|
25741
|
+
archived: {
|
|
25742
|
+
default: "active",
|
|
25743
|
+
type: "string",
|
|
25744
|
+
enum: ["active", "archived", "all"]
|
|
25745
|
+
},
|
|
25746
|
+
collected: {
|
|
25747
|
+
default: "any",
|
|
25748
|
+
type: "string",
|
|
25749
|
+
enum: ["any", "collected", "not-collected"]
|
|
25750
|
+
}
|
|
25751
|
+
},
|
|
25752
|
+
required: ["eventId"],
|
|
25753
|
+
additionalProperties: false
|
|
25754
|
+
}
|
|
25755
|
+
},
|
|
25756
|
+
{
|
|
25757
|
+
path: ["staff-redemption", "roster", "upsert"],
|
|
25758
|
+
procedure: "event.staffRedemption.upsertStaffRedemptionRosterEntry",
|
|
25759
|
+
operation: "mutation",
|
|
25760
|
+
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).",
|
|
25761
|
+
effects: ["state-change"],
|
|
25762
|
+
target: "eventId",
|
|
25763
|
+
dates: [],
|
|
25764
|
+
input: {
|
|
25765
|
+
type: "object",
|
|
25766
|
+
properties: {
|
|
25767
|
+
eventId: {
|
|
25768
|
+
type: "string",
|
|
25769
|
+
minLength: 1,
|
|
25770
|
+
maxLength: 64
|
|
25771
|
+
},
|
|
25772
|
+
employeeId: {
|
|
25773
|
+
type: "string",
|
|
25774
|
+
minLength: 1,
|
|
25775
|
+
maxLength: 64
|
|
25776
|
+
},
|
|
25777
|
+
name: {
|
|
25778
|
+
anyOf: [
|
|
25779
|
+
{
|
|
25780
|
+
type: "string",
|
|
25781
|
+
maxLength: 120
|
|
25782
|
+
},
|
|
25783
|
+
{
|
|
25784
|
+
type: "null"
|
|
25785
|
+
}
|
|
25786
|
+
]
|
|
25787
|
+
},
|
|
25788
|
+
siteName: {
|
|
25789
|
+
anyOf: [
|
|
25790
|
+
{
|
|
25791
|
+
type: "string",
|
|
25792
|
+
maxLength: 120
|
|
25793
|
+
},
|
|
25794
|
+
{
|
|
25795
|
+
type: "null"
|
|
25796
|
+
}
|
|
25797
|
+
]
|
|
25798
|
+
},
|
|
25799
|
+
shift: {
|
|
25800
|
+
anyOf: [
|
|
25801
|
+
{
|
|
25802
|
+
type: "string",
|
|
25803
|
+
minLength: 1,
|
|
25804
|
+
maxLength: 8
|
|
25805
|
+
},
|
|
25806
|
+
{
|
|
25807
|
+
type: "null"
|
|
25808
|
+
}
|
|
25809
|
+
]
|
|
25810
|
+
},
|
|
25811
|
+
workShift: {
|
|
25812
|
+
anyOf: [
|
|
25813
|
+
{
|
|
25814
|
+
type: "string",
|
|
25815
|
+
maxLength: 120
|
|
25816
|
+
},
|
|
25817
|
+
{
|
|
25818
|
+
type: "null"
|
|
25819
|
+
}
|
|
25820
|
+
]
|
|
25821
|
+
},
|
|
25822
|
+
allowance: {
|
|
25823
|
+
type: "integer",
|
|
25824
|
+
minimum: 0,
|
|
25825
|
+
maximum: 20
|
|
25826
|
+
}
|
|
25827
|
+
},
|
|
25828
|
+
required: [
|
|
25829
|
+
"eventId",
|
|
25830
|
+
"employeeId",
|
|
25831
|
+
"name",
|
|
25832
|
+
"siteName",
|
|
25833
|
+
"shift",
|
|
25834
|
+
"workShift"
|
|
25835
|
+
],
|
|
25836
|
+
additionalProperties: false
|
|
25837
|
+
}
|
|
25838
|
+
},
|
|
25839
|
+
{
|
|
25840
|
+
path: ["staff-redemption", "claims", "list"],
|
|
25841
|
+
procedure: "event.staffRedemption.getStaffRedemptionClaims",
|
|
25842
|
+
operation: "query",
|
|
25843
|
+
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).",
|
|
25844
|
+
effects: [],
|
|
25845
|
+
dates: [],
|
|
25846
|
+
input: {
|
|
25847
|
+
type: "object",
|
|
25848
|
+
properties: {
|
|
25849
|
+
eventId: {
|
|
25850
|
+
type: "string",
|
|
25851
|
+
minLength: 1,
|
|
25852
|
+
maxLength: 64
|
|
25853
|
+
},
|
|
25854
|
+
search: {
|
|
25855
|
+
type: "string",
|
|
25856
|
+
maxLength: 200
|
|
25857
|
+
},
|
|
25858
|
+
siteId: {
|
|
25859
|
+
type: "string",
|
|
25860
|
+
minLength: 1,
|
|
25861
|
+
maxLength: 64
|
|
25862
|
+
},
|
|
25863
|
+
sessionId: {
|
|
25864
|
+
type: "string",
|
|
25865
|
+
minLength: 1,
|
|
25866
|
+
maxLength: 64
|
|
25867
|
+
},
|
|
25868
|
+
status: {
|
|
25869
|
+
default: "all",
|
|
25870
|
+
type: "string",
|
|
25871
|
+
enum: ["active", "voided", "all"]
|
|
25872
|
+
},
|
|
25873
|
+
limit: {
|
|
25874
|
+
default: 25,
|
|
25875
|
+
type: "integer",
|
|
25876
|
+
minimum: 1,
|
|
25877
|
+
maximum: 100
|
|
25878
|
+
},
|
|
25879
|
+
cursor: {
|
|
25880
|
+
anyOf: [
|
|
25881
|
+
{
|
|
25882
|
+
type: "string",
|
|
25883
|
+
minLength: 1,
|
|
25884
|
+
maxLength: 8192
|
|
25885
|
+
},
|
|
25886
|
+
{
|
|
25887
|
+
type: "null"
|
|
25888
|
+
}
|
|
25889
|
+
]
|
|
25890
|
+
},
|
|
25891
|
+
direction: {
|
|
25892
|
+
type: "string",
|
|
25893
|
+
const: "forward"
|
|
25894
|
+
}
|
|
25895
|
+
},
|
|
25896
|
+
required: ["eventId"],
|
|
25897
|
+
additionalProperties: false
|
|
25898
|
+
}
|
|
25899
|
+
},
|
|
25900
|
+
{
|
|
25901
|
+
path: ["staff-redemption", "claims", "counts"],
|
|
25902
|
+
procedure: "event.staffRedemption.getStaffRedemptionClaimCounts",
|
|
25903
|
+
operation: "query",
|
|
25904
|
+
summary: "Count claims matching the same filters as claims list.",
|
|
25905
|
+
effects: [],
|
|
25906
|
+
dates: [],
|
|
25907
|
+
input: {
|
|
25908
|
+
type: "object",
|
|
25909
|
+
properties: {
|
|
25910
|
+
eventId: {
|
|
25911
|
+
type: "string",
|
|
25912
|
+
minLength: 1,
|
|
25913
|
+
maxLength: 64
|
|
25914
|
+
},
|
|
25915
|
+
search: {
|
|
25916
|
+
type: "string",
|
|
25917
|
+
maxLength: 200
|
|
25918
|
+
},
|
|
25919
|
+
siteId: {
|
|
25920
|
+
type: "string",
|
|
25921
|
+
minLength: 1,
|
|
25922
|
+
maxLength: 64
|
|
25923
|
+
},
|
|
25924
|
+
sessionId: {
|
|
25925
|
+
type: "string",
|
|
25926
|
+
minLength: 1,
|
|
25927
|
+
maxLength: 64
|
|
25928
|
+
},
|
|
25929
|
+
status: {
|
|
25930
|
+
default: "all",
|
|
25931
|
+
type: "string",
|
|
25932
|
+
enum: ["active", "voided", "all"]
|
|
25933
|
+
}
|
|
25934
|
+
},
|
|
25935
|
+
required: ["eventId"],
|
|
25936
|
+
additionalProperties: false
|
|
25937
|
+
}
|
|
25938
|
+
},
|
|
25939
|
+
{
|
|
25940
|
+
path: ["staff-redemption", "claims", "void"],
|
|
25941
|
+
procedure: "event.staffRedemption.voidStaffRedemptionClaim",
|
|
25942
|
+
operation: "mutation",
|
|
25943
|
+
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.",
|
|
25944
|
+
effects: ["state-change"],
|
|
25945
|
+
target: "eventId",
|
|
25946
|
+
dates: [],
|
|
25947
|
+
input: {
|
|
25948
|
+
type: "object",
|
|
25949
|
+
properties: {
|
|
25950
|
+
eventId: {
|
|
25951
|
+
type: "string",
|
|
25952
|
+
minLength: 1,
|
|
25953
|
+
maxLength: 64
|
|
25954
|
+
},
|
|
25955
|
+
claimId: {
|
|
25956
|
+
type: "string",
|
|
25957
|
+
minLength: 1,
|
|
25958
|
+
maxLength: 64
|
|
25959
|
+
},
|
|
25960
|
+
reason: {
|
|
25961
|
+
type: "string",
|
|
25962
|
+
minLength: 1,
|
|
25963
|
+
maxLength: 500
|
|
25964
|
+
}
|
|
25965
|
+
},
|
|
25966
|
+
required: ["eventId", "claimId", "reason"],
|
|
25967
|
+
additionalProperties: false
|
|
25968
|
+
}
|
|
25969
|
+
},
|
|
25970
|
+
{
|
|
25971
|
+
path: ["staff-redemption", "draw", "release"],
|
|
25972
|
+
procedure: "event.staffRedemption.releaseStaffRedemptionDraw",
|
|
25973
|
+
operation: "mutation",
|
|
25974
|
+
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.",
|
|
25975
|
+
effects: ["state-change"],
|
|
25976
|
+
target: "eventId",
|
|
25977
|
+
dates: [],
|
|
25978
|
+
input: {
|
|
25979
|
+
type: "object",
|
|
25980
|
+
properties: {
|
|
25981
|
+
eventId: {
|
|
25982
|
+
type: "string",
|
|
25983
|
+
minLength: 1,
|
|
25984
|
+
maxLength: 64
|
|
25985
|
+
},
|
|
25986
|
+
drawId: {
|
|
25987
|
+
type: "string",
|
|
25988
|
+
minLength: 1,
|
|
25989
|
+
maxLength: 64
|
|
25990
|
+
},
|
|
25991
|
+
reason: {
|
|
25992
|
+
type: "string",
|
|
25993
|
+
minLength: 1,
|
|
25994
|
+
maxLength: 500
|
|
25995
|
+
},
|
|
25996
|
+
allowWhileClaimActive: {
|
|
25997
|
+
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.",
|
|
25998
|
+
type: "boolean"
|
|
25999
|
+
}
|
|
26000
|
+
},
|
|
26001
|
+
required: ["eventId", "drawId", "reason"],
|
|
26002
|
+
additionalProperties: false
|
|
26003
|
+
}
|
|
26004
|
+
},
|
|
26005
|
+
{
|
|
26006
|
+
path: ["staff-redemption", "stock", "summary"],
|
|
26007
|
+
procedure: "event.staffRedemption.getStaffRedemptionStockSummary",
|
|
26008
|
+
operation: "query",
|
|
26009
|
+
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.",
|
|
26010
|
+
effects: [],
|
|
26011
|
+
dates: [],
|
|
26012
|
+
input: {
|
|
26013
|
+
type: "object",
|
|
26014
|
+
properties: {
|
|
26015
|
+
eventId: {
|
|
26016
|
+
type: "string",
|
|
26017
|
+
minLength: 1,
|
|
26018
|
+
maxLength: 64
|
|
26019
|
+
}
|
|
26020
|
+
},
|
|
26021
|
+
required: ["eventId"],
|
|
26022
|
+
additionalProperties: false
|
|
26023
|
+
}
|
|
26024
|
+
},
|
|
26025
|
+
{
|
|
26026
|
+
path: ["staff-redemption", "counter", "context"],
|
|
26027
|
+
procedure: "event.staffRedemption.getStaffRedemptionCounterContext",
|
|
26028
|
+
operation: "query",
|
|
26029
|
+
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.",
|
|
26030
|
+
effects: [],
|
|
26031
|
+
dates: [],
|
|
26032
|
+
input: {
|
|
26033
|
+
type: "object",
|
|
26034
|
+
properties: {
|
|
26035
|
+
eventId: {
|
|
26036
|
+
type: "string",
|
|
26037
|
+
minLength: 1,
|
|
26038
|
+
maxLength: 64
|
|
26039
|
+
},
|
|
26040
|
+
siteId: {
|
|
26041
|
+
type: "string",
|
|
26042
|
+
minLength: 1,
|
|
26043
|
+
maxLength: 64
|
|
26044
|
+
}
|
|
26045
|
+
},
|
|
26046
|
+
required: ["eventId", "siteId"],
|
|
26047
|
+
additionalProperties: false
|
|
26048
|
+
}
|
|
26049
|
+
},
|
|
26050
|
+
{
|
|
26051
|
+
path: ["staff-redemption", "lookup"],
|
|
26052
|
+
procedure: "event.staffRedemption.lookupStaffRedemptionEmployee",
|
|
26053
|
+
operation: "mutation",
|
|
26054
|
+
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.",
|
|
26055
|
+
effects: [],
|
|
26056
|
+
dates: [],
|
|
26057
|
+
input: {
|
|
26058
|
+
type: "object",
|
|
26059
|
+
properties: {
|
|
26060
|
+
eventId: {
|
|
26061
|
+
type: "string",
|
|
26062
|
+
minLength: 1,
|
|
26063
|
+
maxLength: 64
|
|
26064
|
+
},
|
|
26065
|
+
siteId: {
|
|
26066
|
+
type: "string",
|
|
26067
|
+
minLength: 1,
|
|
26068
|
+
maxLength: 64
|
|
26069
|
+
},
|
|
26070
|
+
employeeId: {
|
|
26071
|
+
type: "string",
|
|
26072
|
+
minLength: 1,
|
|
26073
|
+
maxLength: 64
|
|
26074
|
+
}
|
|
26075
|
+
},
|
|
26076
|
+
required: ["eventId", "siteId", "employeeId"],
|
|
26077
|
+
additionalProperties: false
|
|
26078
|
+
}
|
|
26079
|
+
},
|
|
26080
|
+
{
|
|
26081
|
+
path: ["staff-redemption", "redeem"],
|
|
26082
|
+
procedure: "event.staffRedemption.redeemStaffRedemption",
|
|
26083
|
+
operation: "mutation",
|
|
26084
|
+
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.",
|
|
26085
|
+
effects: ["state-change"],
|
|
26086
|
+
target: "eventId",
|
|
26087
|
+
dates: [],
|
|
26088
|
+
input: {
|
|
26089
|
+
type: "object",
|
|
26090
|
+
properties: {
|
|
26091
|
+
eventId: {
|
|
26092
|
+
type: "string",
|
|
26093
|
+
minLength: 1,
|
|
26094
|
+
maxLength: 64
|
|
26095
|
+
},
|
|
26096
|
+
siteId: {
|
|
26097
|
+
type: "string",
|
|
26098
|
+
minLength: 1,
|
|
26099
|
+
maxLength: 64
|
|
26100
|
+
},
|
|
26101
|
+
employeeId: {
|
|
26102
|
+
type: "string",
|
|
26103
|
+
minLength: 1,
|
|
26104
|
+
maxLength: 64
|
|
26105
|
+
},
|
|
26106
|
+
clientRequestId: {
|
|
26107
|
+
type: "string",
|
|
26108
|
+
format: "uuid",
|
|
26109
|
+
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)$"
|
|
26110
|
+
},
|
|
26111
|
+
itemIds: {
|
|
26112
|
+
maxItems: 20,
|
|
26113
|
+
type: "array",
|
|
26114
|
+
items: {
|
|
26115
|
+
type: "string",
|
|
26116
|
+
minLength: 1,
|
|
26117
|
+
maxLength: 64
|
|
26118
|
+
}
|
|
26119
|
+
}
|
|
26120
|
+
},
|
|
26121
|
+
required: [
|
|
26122
|
+
"eventId",
|
|
26123
|
+
"siteId",
|
|
26124
|
+
"employeeId",
|
|
26125
|
+
"clientRequestId",
|
|
26126
|
+
"itemIds"
|
|
26127
|
+
],
|
|
26128
|
+
additionalProperties: false
|
|
26129
|
+
}
|
|
26130
|
+
},
|
|
26131
|
+
{
|
|
26132
|
+
path: ["staff-redemption", "counter", "claims"],
|
|
26133
|
+
procedure: "event.staffRedemption.getStaffRedemptionCounterClaims",
|
|
26134
|
+
operation: "query",
|
|
26135
|
+
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.",
|
|
26136
|
+
effects: [],
|
|
26137
|
+
dates: [],
|
|
26138
|
+
input: {
|
|
26139
|
+
type: "object",
|
|
26140
|
+
properties: {
|
|
26141
|
+
eventId: {
|
|
26142
|
+
type: "string",
|
|
26143
|
+
minLength: 1,
|
|
26144
|
+
maxLength: 64
|
|
26145
|
+
},
|
|
26146
|
+
siteId: {
|
|
26147
|
+
type: "string",
|
|
26148
|
+
minLength: 1,
|
|
26149
|
+
maxLength: 64
|
|
26150
|
+
},
|
|
26151
|
+
limit: {
|
|
26152
|
+
default: 20,
|
|
26153
|
+
type: "integer",
|
|
26154
|
+
minimum: 1,
|
|
26155
|
+
maximum: 50
|
|
26156
|
+
},
|
|
26157
|
+
scope: {
|
|
26158
|
+
default: "mine",
|
|
26159
|
+
type: "string",
|
|
26160
|
+
enum: ["mine", "site"]
|
|
26161
|
+
}
|
|
26162
|
+
},
|
|
26163
|
+
required: ["eventId", "siteId"],
|
|
26164
|
+
additionalProperties: false
|
|
26165
|
+
}
|
|
26166
|
+
}
|
|
26167
|
+
];
|
|
26168
|
+
|
|
26169
|
+
// src/registry/run-registry-command.ts
|
|
26170
|
+
var manifest = command_manifest_default;
|
|
26171
|
+
var registryFlags = [
|
|
26172
|
+
"input",
|
|
26173
|
+
"input-file",
|
|
26174
|
+
"allow-state-change",
|
|
26175
|
+
"allow-delete",
|
|
26176
|
+
"allow-email",
|
|
26177
|
+
"target"
|
|
26178
|
+
];
|
|
26179
|
+
var isoDateTimePattern = /^\d{4}-\d\d-\d\dT\d\d:\d\d/;
|
|
26180
|
+
var isRecord3 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
26181
|
+
var commandName = (entry) => `et ${entry.path.join(" ")}`;
|
|
26182
|
+
var findManifestEntry = (positionals) => manifest.find((entry) => entry.path.length === positionals.length && entry.path.every((segment, index) => positionals[index] === segment));
|
|
26183
|
+
var listRegistryCommands = () => manifest.map((entry) => ({
|
|
26184
|
+
command: commandName(entry),
|
|
26185
|
+
summary: entry.summary,
|
|
26186
|
+
effects: entry.effects
|
|
26187
|
+
}));
|
|
26188
|
+
var coerceDateAt = (value, segments, label) => {
|
|
26189
|
+
const [head, ...rest] = segments;
|
|
26190
|
+
if (head === undefined) {
|
|
26191
|
+
if (typeof value !== "string")
|
|
26192
|
+
return value;
|
|
26193
|
+
const parsed = new Date(value);
|
|
26194
|
+
if (!isoDateTimePattern.test(value) || Number.isNaN(parsed.getTime())) {
|
|
26195
|
+
throw new CliUsageError(`${label} must be an ISO 8601 date-time such as 2026-11-20T18:00:00+08:00.`);
|
|
26196
|
+
}
|
|
26197
|
+
return parsed;
|
|
26198
|
+
}
|
|
26199
|
+
const isArray = head.endsWith("[]");
|
|
26200
|
+
const key = isArray ? head.slice(0, -2) : head;
|
|
24367
26201
|
const apply = (child) => isArray ? Array.isArray(child) ? child.map((item) => coerceDateAt(item, rest, label)) : child : coerceDateAt(child, rest, label);
|
|
24368
26202
|
if (key === "")
|
|
24369
26203
|
return apply(value);
|
|
@@ -24827,11 +26661,11 @@ var runEventAppearanceUpload = async ({
|
|
|
24827
26661
|
const filePath = getRequiredFlag(parsed, "file");
|
|
24828
26662
|
const contentType = getRequiredFlag(parsed, "content-type");
|
|
24829
26663
|
const mediaType = parseAppearanceMediaType(getRequiredFlag(parsed, "media-type"));
|
|
24830
|
-
const file = await
|
|
26664
|
+
const file = await readFile7(filePath);
|
|
24831
26665
|
await ensureAuthentication();
|
|
24832
26666
|
const signed = await api2.attachment.getPresignedUrlToUpload.mutate({
|
|
24833
26667
|
folder: `event-appearance/${mediaType === "image" ? "images" : "videos"}`,
|
|
24834
|
-
fileName:
|
|
26668
|
+
fileName: basename5(filePath),
|
|
24835
26669
|
contentType,
|
|
24836
26670
|
size: file.byteLength,
|
|
24837
26671
|
eventId
|
|
@@ -24997,6 +26831,14 @@ var runCommand = async (parsed, runtime, credentialStore, apiBaseUrl, configureA
|
|
|
24997
26831
|
});
|
|
24998
26832
|
return;
|
|
24999
26833
|
}
|
|
26834
|
+
if (group === "staff-redemption") {
|
|
26835
|
+
await runStaffRedemptionCommand({
|
|
26836
|
+
parsed,
|
|
26837
|
+
runtime,
|
|
26838
|
+
authenticate: ensureAuthentication
|
|
26839
|
+
});
|
|
26840
|
+
return;
|
|
26841
|
+
}
|
|
25000
26842
|
if (group === "lucky-draw" && await runLuckyDrawSetupCommand({
|
|
25001
26843
|
parsed,
|
|
25002
26844
|
runtime,
|