@go-labs-sg/event-tech 1.9.0 → 1.11.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 +54 -8
- package/command-reference.md +1 -0
- package/dist/index.js +570 -154
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -95,6 +95,8 @@ et event appearance update --event-id <id> --appearance-version <n> --appearance
|
|
|
95
95
|
et event appearance reset --event-id <id> --appearance-version <n>
|
|
96
96
|
et event appearance upload --event-id <id> --file ./background.mp4 --media-type video --content-type video/mp4
|
|
97
97
|
et event photo-wall display-items --event-id <id> --limit 30
|
|
98
|
+
et passport skin get --event-id <id>
|
|
99
|
+
et passport station image-set --event-id <id> --station-id <id> --file ./cover.jpg --content-type image/jpeg
|
|
98
100
|
et lucky-draw participants replace --event-id <id> --participants '[{"luckyDrawId":"illustrative-001","name":"Example Person","email":"example@example.test"}]' --allow-state-change --target <id>
|
|
99
101
|
et lucky-draw participants list --event-id <id> --page 1 --per-page 100
|
|
100
102
|
et lucky-draw config get --event-id <id>
|
|
@@ -133,6 +135,7 @@ et passport overview --event-id <id>
|
|
|
133
135
|
et passport login-options --event-id <id>
|
|
134
136
|
et passport mine --event-id <id>
|
|
135
137
|
et passport bingo enable --event-id <id>
|
|
138
|
+
et passport bingo rename --event-id <id> --name "Staff Bingo"
|
|
136
139
|
et passport bingo join --event-id <id>
|
|
137
140
|
et passport bingo status --event-id <id>
|
|
138
141
|
et passport bingo claim-stamp --event-id <id>
|
|
@@ -180,7 +183,7 @@ them accidentally. Its JSON requires `linkedDrawEventId`,
|
|
|
180
183
|
`luckyDrawStampThreshold`, `prizeStampThreshold` and
|
|
181
184
|
`maxRedemptionsPerParticipant`; optional `loginMethods` is
|
|
182
185
|
`{"emailOtp":true,"google":false,"guest":true,"staffId":false}` (`staffId` may be
|
|
183
|
-
omitted and defaults to false). Omit `loginMethods` to preserve it. At least
|
|
186
|
+
omitted and defaults to false; `staffIdRequiresLastName` may be omitted and defaults to true, so include it as false each time you resend `loginMethods` on an event that has it off). Omit `loginMethods` to preserve it. At least
|
|
184
187
|
email OTP, Google or Staff ID must remain enabled for recovery, and enabling
|
|
185
188
|
Google requires configured provider credentials. Points never replace the
|
|
186
189
|
existing stamp-based reward thresholds.
|
|
@@ -216,11 +219,16 @@ returns per-item totals; `tally list` returns a station's tallies; `export`
|
|
|
216
219
|
includes `tallies` and `tallySummary`. Plain `collect`, `claim` and rotating QR routes reject tally stations; only a manager stamp correction can add or remove the
|
|
217
220
|
station stamp there. Reversing a tally keeps the station stamp, and a revoked station stamp is not restored by later tallies. The CLI prints the server response unchanged.
|
|
218
221
|
|
|
219
|
-
Bingo: `bingo enable` (manager) creates the hunt and a hidden Bingo station (stamp value 3 by default). `bingo join`, `bingo status` and `bingo claim-stamp` act as the signed-in passport participant; `claim-stamp` is the catch-up for a completed card. Overview, participant detail and `export` report bingo joined, completed and stamp counts.
|
|
222
|
+
Bingo: `bingo enable` (manager) creates the hunt and a hidden Bingo station (stamp value 3 by default). The game's display name is that station's name (default "Human Bingo"); `bingo rename --name <name>` (manager, 1-100 characters, bingo must be enabled) changes it, and `bingo status` returns it as `name`. `bingo join`, `bingo status` and `bingo claim-stamp` act as the signed-in passport participant; `claim-stamp` is the catch-up for a completed card. Overview, participant detail and `export` report bingo joined, completed and stamp counts.
|
|
220
223
|
|
|
221
|
-
Staff roster: with `loginMethods.staffId` on, guests sign in with a Staff ID and
|
|
222
|
-
last name from the event
|
|
223
|
-
punctuation and accents).
|
|
224
|
+
Staff roster: with `loginMethods.staffId` on, guests sign in with a Staff ID and,
|
|
225
|
+
unless `loginMethods.staffIdRequiresLastName` is false, a last name from the event
|
|
226
|
+
roster (matched case-insensitively, ignoring spaces, punctuation and accents). With
|
|
227
|
+
the requirement off, a Staff ID alone signs in, so anyone who knows or guesses one
|
|
228
|
+
can open that passport; use it only when Staff IDs are hard to guess. Blank last
|
|
229
|
+
names are then accepted in `roster import` and `roster upsert` (`"lastName":null`).
|
|
230
|
+
If the requirement is turned back on, those entries cannot sign in until they have
|
|
231
|
+
a last name; `roster counts` reports them as `missingLastNameCount`. One Staff ID owns one passport per event, so signing in
|
|
224
232
|
again on another device resumes it. Failed attempts lock a Staff ID for 10 minutes
|
|
225
233
|
after 5 misses, and an IP after 50. Only event hosts (setup permission) can read
|
|
226
234
|
or change the roster. `roster import` reads a CSV or `.xlsx` file locally,
|
|
@@ -229,9 +237,12 @@ header row, and replaces the whole roster. Override a guess with the column
|
|
|
229
237
|
flags, or pass `none` to ignore an optional column. Without a last-name column
|
|
230
238
|
the last name is the last word of the full name, or the first word with
|
|
231
239
|
`--surname-position first`. The response reports `imported`, `replaced` and
|
|
232
|
-
each `rejected` row (`MISSING_STAFF_ID`, `MISSING_LAST_NAME
|
|
233
|
-
`DUPLICATE_STAFF_ID` or `TOO_LONG`). Re-importing is safe: existing Staff ID
|
|
234
|
-
passports keep their stamps.
|
|
240
|
+
each `rejected` row (`MISSING_STAFF_ID`, `MISSING_LAST_NAME` when the event
|
|
241
|
+
requires one, `DUPLICATE_STAFF_ID` or `TOO_LONG`). Re-importing is safe: existing Staff ID
|
|
242
|
+
passports keep their stamps. A file may hold up to 20,000 rows with data and
|
|
243
|
+
200 columns. A file with data past those limits (including data below row
|
|
244
|
+
50,000), a misplaced or unclosed CSV quote, or no importable rows at all is refused and the
|
|
245
|
+
roster is left unchanged; use `roster purge` to empty a roster on purpose. Participant search, detail and `export` include
|
|
235
246
|
`staffId`. Staff ID sign-in itself is browser-only.
|
|
236
247
|
|
|
237
248
|
Guest enrollment/account linking is browser-only: it requires the original guest
|
|
@@ -240,6 +251,41 @@ owned by the current CLI identity; it cannot recover a guest by name or assume a
|
|
|
240
251
|
participant ID. No CLI auth transport or organiser access boundary is bypassed.
|
|
241
252
|
See the [Passport workflow and rollout gates](../../../docs/design/event-tech-passport-event-type.md).
|
|
242
253
|
|
|
254
|
+
#### Passport skin and station art
|
|
255
|
+
|
|
256
|
+
Every event renders the Go Labs default Passport look. An organiser may skin one
|
|
257
|
+
event through the optional `passport` block of the event appearance (hero key
|
|
258
|
+
visual with a focal point, logo, a graphics-only colour, a dark block colour and
|
|
259
|
+
`emphasis`). `skin` commands read and write only that block, using the same
|
|
260
|
+
version-fenced `updateEventAppearance` procedure and `event.setup` permission as
|
|
261
|
+
the web editor; every other appearance setting is preserved.
|
|
262
|
+
|
|
263
|
+
```sh
|
|
264
|
+
et passport skin get --event-id <id>
|
|
265
|
+
et passport skin upload --event-id <id> --kind hero --file ./key-visual.jpg --content-type image/jpeg
|
|
266
|
+
et passport skin set --event-id <id> --appearance-version 3 \
|
|
267
|
+
--skin-json '{"heroImage":{"key":"<key from upload>","focalX":60,"focalY":30},"colors":{"graphic":"#e8483b","dark":"#0b2d5b"},"emphasis":"ink"}'
|
|
268
|
+
et passport skin set --event-id <id> --appearance-version 4 --skin-json '{"heroImage":{"focalX":30}}'
|
|
269
|
+
et passport skin clear --event-id <id> --appearance-version 5
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
- `skin set` is a merge patch. Omitted keys keep their stored value, an object merges into the stored `heroImage`, `logo` or `colors`, and `null` clears `heroImage` or `logo`.
|
|
273
|
+
- `colors.graphic` paints shapes only, never text. `colors.dark` needs 4.5:1 contrast with white.
|
|
274
|
+
- `skin clear` returns the event to the Go Labs default look (the reverse of `skin set`). Appearance saves that omit `passport`, including `event appearance update`, keep the stored skin.
|
|
275
|
+
- Uploads accept JPEG, PNG, WebP or GIF up to 25 MB. SVG is not allowed.
|
|
276
|
+
|
|
277
|
+
Station cover art uses the station's existing `imageKey`:
|
|
278
|
+
|
|
279
|
+
```sh
|
|
280
|
+
et passport station image-set --event-id <id> --station-id <id> --file ./cover.jpg --content-type image/jpeg
|
|
281
|
+
et passport station image-clear --event-id <id> --station-id <id>
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
`image-set` uploads to the event's station-art folder and saves the key, keeping
|
|
285
|
+
every other station setting and the collection mode. `image-clear` removes it.
|
|
286
|
+
A new `imageKey` passed through `station upsert` must also be an upload to this
|
|
287
|
+
event's `event-passport/stations` folder; an unchanged key always passes.
|
|
288
|
+
|
|
243
289
|
### Deprecated event types
|
|
244
290
|
|
|
245
291
|
Scavenger Hunt (Amazing Race) and Gardens by the Bay are deprecated and frozen.
|
package/command-reference.md
CHANGED
|
@@ -378,6 +378,7 @@ Run `et <command> --help` for the full input JSON Schema.
|
|
|
378
378
|
- `event.passport.getPassportTallySummary`: hand-written
|
|
379
379
|
- `event.passport.getPassportStationTallies`: hand-written
|
|
380
380
|
- `event.passport.enablePassportBingo`: hand-written
|
|
381
|
+
- `event.passport.renamePassportBingo`: hand-written
|
|
381
382
|
- `event.passport.joinPassportBingo`: hand-written
|
|
382
383
|
- `event.passport.claimPassportBingoStamp`: hand-written
|
|
383
384
|
- `event.passport.getMyPassportBingo`: hand-written
|
package/dist/index.js
CHANGED
|
@@ -17175,8 +17175,8 @@ var logoutCliSession = async ({
|
|
|
17175
17175
|
};
|
|
17176
17176
|
// src/cli.ts
|
|
17177
17177
|
import { readFileSync } from "fs";
|
|
17178
|
-
import { readFile as
|
|
17179
|
-
import { basename as
|
|
17178
|
+
import { readFile as readFile6 } from "fs/promises";
|
|
17179
|
+
import { basename as basename4, resolve } from "path";
|
|
17180
17180
|
|
|
17181
17181
|
// ../db/src/generated/prisma/enums.ts
|
|
17182
17182
|
var EventType = {
|
|
@@ -17200,7 +17200,7 @@ var DEPRECATED_EVENT_TYPES = [
|
|
|
17200
17200
|
var activeEventTypeSchema = _enum(EventType).exclude(DEPRECATED_EVENT_TYPES);
|
|
17201
17201
|
var ACTIVE_EVENT_TYPES = activeEventTypeSchema.options;
|
|
17202
17202
|
|
|
17203
|
-
// ../../../node_modules/.bun/@trpc+server@11.
|
|
17203
|
+
// ../../../node_modules/.bun/@trpc+server@11.28.0+431a08decb845963/node_modules/@trpc/server/dist/observable-CodTG6Sf.mjs
|
|
17204
17204
|
function observable(subscribe) {
|
|
17205
17205
|
const self2 = {
|
|
17206
17206
|
subscribe(observer) {
|
|
@@ -17416,7 +17416,7 @@ function observableToAsyncIterable(observable, signal) {
|
|
|
17416
17416
|
return iterator;
|
|
17417
17417
|
}
|
|
17418
17418
|
|
|
17419
|
-
// ../../../node_modules/.bun/@trpc+server@11.
|
|
17419
|
+
// ../../../node_modules/.bun/@trpc+server@11.28.0+431a08decb845963/node_modules/@trpc/server/dist/observable-BjUZYMQq.mjs
|
|
17420
17420
|
function share(_opts) {
|
|
17421
17421
|
return (source) => {
|
|
17422
17422
|
let refCount = 0;
|
|
@@ -17538,7 +17538,7 @@ function behaviorSubject(initialValue) {
|
|
|
17538
17538
|
return obs;
|
|
17539
17539
|
}
|
|
17540
17540
|
|
|
17541
|
-
// ../../../node_modules/.bun/@trpc+client@11.
|
|
17541
|
+
// ../../../node_modules/.bun/@trpc+client@11.28.0+86c0a2ff0813b553/node_modules/@trpc/client/dist/splitLink-PFsRy7Mf.mjs
|
|
17542
17542
|
function createChain(opts) {
|
|
17543
17543
|
return observable((observer) => {
|
|
17544
17544
|
function execute(index = 0, op = opts.op) {
|
|
@@ -17556,7 +17556,7 @@ function createChain(opts) {
|
|
|
17556
17556
|
});
|
|
17557
17557
|
}
|
|
17558
17558
|
|
|
17559
|
-
// ../../../node_modules/.bun/@trpc+client@11.
|
|
17559
|
+
// ../../../node_modules/.bun/@trpc+client@11.28.0+86c0a2ff0813b553/node_modules/@trpc/client/dist/objectSpread2-pyA4QVO4.mjs
|
|
17560
17560
|
function _typeof(o) {
|
|
17561
17561
|
"@babel/helpers - typeof";
|
|
17562
17562
|
return _typeof = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(o) {
|
|
@@ -17565,17 +17565,17 @@ function _typeof(o) {
|
|
|
17565
17565
|
return o && typeof Symbol == "function" && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
17566
17566
|
}, _typeof(o);
|
|
17567
17567
|
}
|
|
17568
|
-
function toPrimitive(t,
|
|
17568
|
+
function toPrimitive(t, e) {
|
|
17569
17569
|
if (_typeof(t) != "object" || !t)
|
|
17570
17570
|
return t;
|
|
17571
|
-
var
|
|
17572
|
-
if (
|
|
17573
|
-
var i =
|
|
17571
|
+
var r;
|
|
17572
|
+
if (typeof Symbol != "undefined" && (r = t[Symbol.toPrimitive]) !== undefined) {
|
|
17573
|
+
var i = r.call(t, e || "default");
|
|
17574
17574
|
if (_typeof(i) != "object")
|
|
17575
17575
|
return i;
|
|
17576
17576
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
17577
17577
|
}
|
|
17578
|
-
return (
|
|
17578
|
+
return (e === "string" ? String : Number)(t);
|
|
17579
17579
|
}
|
|
17580
17580
|
function toPropertyKey(t) {
|
|
17581
17581
|
var i = toPrimitive(t, "string");
|
|
@@ -17611,7 +17611,7 @@ function _objectSpread2(e) {
|
|
|
17611
17611
|
return e;
|
|
17612
17612
|
}
|
|
17613
17613
|
|
|
17614
|
-
// ../../../node_modules/.bun/@trpc+server@11.
|
|
17614
|
+
// ../../../node_modules/.bun/@trpc+server@11.28.0+431a08decb845963/node_modules/@trpc/server/dist/codes-BCsCCyMj.mjs
|
|
17615
17615
|
function isObject2(value) {
|
|
17616
17616
|
return !!value && !Array.isArray(value) && typeof value === "object";
|
|
17617
17617
|
}
|
|
@@ -17648,7 +17648,7 @@ var retryableRpcCodes = [
|
|
|
17648
17648
|
TRPC_ERROR_CODES_BY_KEY.INTERNAL_SERVER_ERROR
|
|
17649
17649
|
];
|
|
17650
17650
|
|
|
17651
|
-
// ../../../node_modules/.bun/@trpc+server@11.
|
|
17651
|
+
// ../../../node_modules/.bun/@trpc+server@11.28.0+431a08decb845963/node_modules/@trpc/server/dist/getErrorShape-CVrl8_-w.mjs
|
|
17652
17652
|
var noop = () => {};
|
|
17653
17653
|
var freezeIfAvailable = (obj) => {
|
|
17654
17654
|
if (Object.freeze)
|
|
@@ -17705,17 +17705,17 @@ function _typeof2(o) {
|
|
|
17705
17705
|
return o && typeof Symbol == "function" && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
17706
17706
|
}, _typeof2(o);
|
|
17707
17707
|
}
|
|
17708
|
-
function toPrimitive2(t,
|
|
17708
|
+
function toPrimitive2(t, e) {
|
|
17709
17709
|
if (_typeof2(t) != "object" || !t)
|
|
17710
17710
|
return t;
|
|
17711
|
-
var
|
|
17712
|
-
if (
|
|
17713
|
-
var i =
|
|
17711
|
+
var r;
|
|
17712
|
+
if (typeof Symbol != "undefined" && (r = t[Symbol.toPrimitive]) !== undefined) {
|
|
17713
|
+
var i = r.call(t, e || "default");
|
|
17714
17714
|
if (_typeof2(i) != "object")
|
|
17715
17715
|
return i;
|
|
17716
17716
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
17717
17717
|
}
|
|
17718
|
-
return (
|
|
17718
|
+
return (e === "string" ? String : Number)(t);
|
|
17719
17719
|
}
|
|
17720
17720
|
function toPropertyKey2(t) {
|
|
17721
17721
|
var i = toPrimitive2(t, "string");
|
|
@@ -17751,7 +17751,7 @@ function _objectSpread22(e) {
|
|
|
17751
17751
|
return e;
|
|
17752
17752
|
}
|
|
17753
17753
|
|
|
17754
|
-
// ../../../node_modules/.bun/@trpc+server@11.
|
|
17754
|
+
// ../../../node_modules/.bun/@trpc+server@11.28.0+431a08decb845963/node_modules/@trpc/server/dist/asyncGeneratorDelegate-BRQGtkYG.mjs
|
|
17755
17755
|
function transformResultInner(response, transformer) {
|
|
17756
17756
|
if ("error" in response) {
|
|
17757
17757
|
const error = transformer.deserialize(response.error);
|
|
@@ -17798,54 +17798,41 @@ function _OverloadYield(e, d) {
|
|
|
17798
17798
|
this.v = e, this.k = d;
|
|
17799
17799
|
}
|
|
17800
17800
|
function AsyncGenerator(e) {
|
|
17801
|
-
var
|
|
17802
|
-
function resume(
|
|
17801
|
+
var t, n;
|
|
17802
|
+
function resume(t, n) {
|
|
17803
17803
|
try {
|
|
17804
|
-
var
|
|
17805
|
-
Promise.resolve(u ? o.v : o).then(function(
|
|
17804
|
+
var r = e[t](n), o = r.value, u = o instanceof _OverloadYield;
|
|
17805
|
+
Promise.resolve(u ? o.v : o).then(function(n) {
|
|
17806
17806
|
if (u) {
|
|
17807
|
-
var i =
|
|
17808
|
-
if (!o.k ||
|
|
17809
|
-
return resume(i,
|
|
17810
|
-
|
|
17807
|
+
var i = t === "return" && o.k ? t : "next";
|
|
17808
|
+
if (!o.k || n.done)
|
|
17809
|
+
return resume(i, n);
|
|
17810
|
+
n = e[i](n).value;
|
|
17811
17811
|
}
|
|
17812
|
-
settle(
|
|
17812
|
+
settle(!!r.done, n);
|
|
17813
17813
|
}, function(e) {
|
|
17814
17814
|
resume("throw", e);
|
|
17815
17815
|
});
|
|
17816
17816
|
} catch (e) {
|
|
17817
|
-
settle(
|
|
17817
|
+
settle(2, e);
|
|
17818
17818
|
}
|
|
17819
17819
|
}
|
|
17820
|
-
function settle(e,
|
|
17821
|
-
|
|
17822
|
-
|
|
17823
|
-
|
|
17824
|
-
|
|
17825
|
-
done: true
|
|
17826
|
-
});
|
|
17827
|
-
break;
|
|
17828
|
-
case "throw":
|
|
17829
|
-
r.reject(n);
|
|
17830
|
-
break;
|
|
17831
|
-
default:
|
|
17832
|
-
r.resolve({
|
|
17833
|
-
value: n,
|
|
17834
|
-
done: false
|
|
17835
|
-
});
|
|
17836
|
-
}
|
|
17837
|
-
(r = r.next) ? resume(r.key, r.arg) : t = null;
|
|
17820
|
+
function settle(e, r) {
|
|
17821
|
+
e === 2 ? t.reject(r) : t.resolve({
|
|
17822
|
+
value: r,
|
|
17823
|
+
done: e
|
|
17824
|
+
}), (t = t.next) ? resume(t.key, t.arg) : n = null;
|
|
17838
17825
|
}
|
|
17839
|
-
this._invoke = function(e,
|
|
17826
|
+
this._invoke = function(e, r) {
|
|
17840
17827
|
return new Promise(function(o, u) {
|
|
17841
17828
|
var i = {
|
|
17842
17829
|
key: e,
|
|
17843
|
-
arg:
|
|
17830
|
+
arg: r,
|
|
17844
17831
|
resolve: o,
|
|
17845
17832
|
reject: u,
|
|
17846
17833
|
next: null
|
|
17847
17834
|
};
|
|
17848
|
-
|
|
17835
|
+
n ? n = n.next = i : (t = n = i, resume(e, r));
|
|
17849
17836
|
});
|
|
17850
17837
|
}, typeof e["return"] != "function" && (this["return"] = undefined);
|
|
17851
17838
|
}
|
|
@@ -17860,7 +17847,7 @@ AsyncGenerator.prototype[typeof Symbol == "function" && Symbol.asyncIterator ||
|
|
|
17860
17847
|
};
|
|
17861
17848
|
var trackedSymbol = Symbol();
|
|
17862
17849
|
|
|
17863
|
-
// ../../../node_modules/.bun/@trpc+client@11.
|
|
17850
|
+
// ../../../node_modules/.bun/@trpc+client@11.28.0+86c0a2ff0813b553/node_modules/@trpc/client/dist/TRPCClientError-DE6-fd1n.mjs
|
|
17864
17851
|
function isTRPCClientError(cause) {
|
|
17865
17852
|
return cause instanceof TRPCClientError;
|
|
17866
17853
|
}
|
|
@@ -17906,7 +17893,7 @@ var TRPCClientError = class TRPCClientError extends Error {
|
|
|
17906
17893
|
}
|
|
17907
17894
|
};
|
|
17908
17895
|
|
|
17909
|
-
// ../../../node_modules/.bun/@trpc+client@11.
|
|
17896
|
+
// ../../../node_modules/.bun/@trpc+client@11.28.0+86c0a2ff0813b553/node_modules/@trpc/client/dist/unstable-internals.mjs
|
|
17910
17897
|
function getTransformer(transformer) {
|
|
17911
17898
|
const _transformer = transformer;
|
|
17912
17899
|
if (!_transformer)
|
|
@@ -17928,7 +17915,7 @@ function getTransformer(transformer) {
|
|
|
17928
17915
|
};
|
|
17929
17916
|
}
|
|
17930
17917
|
|
|
17931
|
-
// ../../../node_modules/.bun/@trpc+client@11.
|
|
17918
|
+
// ../../../node_modules/.bun/@trpc+client@11.28.0+86c0a2ff0813b553/node_modules/@trpc/client/dist/httpUtils-CtMuyl9j.mjs
|
|
17932
17919
|
var isFunction2 = (fn) => typeof fn === "function";
|
|
17933
17920
|
function getFetch(customFetchImpl) {
|
|
17934
17921
|
if (customFetchImpl)
|
|
@@ -17976,6 +17963,23 @@ function raceAbortSignalsWithCleanup(...signals) {
|
|
|
17976
17963
|
cleanup
|
|
17977
17964
|
};
|
|
17978
17965
|
}
|
|
17966
|
+
var AbortError = class extends Error {
|
|
17967
|
+
constructor() {
|
|
17968
|
+
const name = "AbortError";
|
|
17969
|
+
super(name);
|
|
17970
|
+
this.name = name;
|
|
17971
|
+
this.message = name;
|
|
17972
|
+
}
|
|
17973
|
+
};
|
|
17974
|
+
var throwIfAborted = (signal) => {
|
|
17975
|
+
var _signal$throwIfAborte;
|
|
17976
|
+
if (!(signal === null || signal === undefined ? undefined : signal.aborted))
|
|
17977
|
+
return;
|
|
17978
|
+
(_signal$throwIfAborte = signal.throwIfAborted) === null || _signal$throwIfAborte === undefined || _signal$throwIfAborte.call(signal);
|
|
17979
|
+
if (typeof DOMException !== "undefined")
|
|
17980
|
+
throw new DOMException("AbortError", "AbortError");
|
|
17981
|
+
throw new AbortError;
|
|
17982
|
+
};
|
|
17979
17983
|
function resolveHTTPLinkOptions(opts) {
|
|
17980
17984
|
return {
|
|
17981
17985
|
url: opts.url.toString(),
|
|
@@ -18031,23 +18035,6 @@ var jsonHttpRequester = (opts) => {
|
|
|
18031
18035
|
getBody
|
|
18032
18036
|
}));
|
|
18033
18037
|
};
|
|
18034
|
-
var AbortError = class extends Error {
|
|
18035
|
-
constructor() {
|
|
18036
|
-
const name = "AbortError";
|
|
18037
|
-
super(name);
|
|
18038
|
-
this.name = name;
|
|
18039
|
-
this.message = name;
|
|
18040
|
-
}
|
|
18041
|
-
};
|
|
18042
|
-
var throwIfAborted = (signal) => {
|
|
18043
|
-
var _signal$throwIfAborte;
|
|
18044
|
-
if (!(signal === null || signal === undefined ? undefined : signal.aborted))
|
|
18045
|
-
return;
|
|
18046
|
-
(_signal$throwIfAborte = signal.throwIfAborted) === null || _signal$throwIfAborte === undefined || _signal$throwIfAborte.call(signal);
|
|
18047
|
-
if (typeof DOMException !== "undefined")
|
|
18048
|
-
throw new DOMException("AbortError", "AbortError");
|
|
18049
|
-
throw new AbortError;
|
|
18050
|
-
};
|
|
18051
18038
|
async function fetchHTTPResponse(opts) {
|
|
18052
18039
|
var _opts$methodOverride, _opts$trpcAcceptHeade;
|
|
18053
18040
|
throwIfAborted(opts.signal);
|
|
@@ -18081,7 +18068,7 @@ async function httpRequest(opts) {
|
|
|
18081
18068
|
};
|
|
18082
18069
|
}
|
|
18083
18070
|
|
|
18084
|
-
// ../../../node_modules/.bun/@trpc+client@11.
|
|
18071
|
+
// ../../../node_modules/.bun/@trpc+client@11.28.0+86c0a2ff0813b553/node_modules/@trpc/client/dist/httpBatchLink-BkVNtNND.mjs
|
|
18085
18072
|
var throwFatalError = () => {
|
|
18086
18073
|
throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new");
|
|
18087
18074
|
};
|
|
@@ -18276,7 +18263,7 @@ function httpBatchLink(opts) {
|
|
|
18276
18263
|
};
|
|
18277
18264
|
}
|
|
18278
18265
|
|
|
18279
|
-
// ../../../node_modules/.bun/@trpc+client@11.
|
|
18266
|
+
// ../../../node_modules/.bun/@trpc+client@11.28.0+86c0a2ff0813b553/node_modules/@trpc/client/dist/wsLink-BiIe_j6D.mjs
|
|
18280
18267
|
var resultOf = (value, ...args) => {
|
|
18281
18268
|
return typeof value === "function" ? value(...args) : value;
|
|
18282
18269
|
};
|
|
@@ -18429,7 +18416,7 @@ var WsConnection = class WsConnection {
|
|
|
18429
18416
|
};
|
|
18430
18417
|
_defineProperty(WsConnection, "connectCount", 0);
|
|
18431
18418
|
|
|
18432
|
-
// ../../../node_modules/.bun/@trpc+client@11.
|
|
18419
|
+
// ../../../node_modules/.bun/@trpc+client@11.28.0+86c0a2ff0813b553/node_modules/@trpc/client/dist/index.mjs
|
|
18433
18420
|
var observerKeys = [
|
|
18434
18421
|
"onStarted",
|
|
18435
18422
|
"onData",
|
|
@@ -18573,54 +18560,41 @@ function _OverloadYield2(e, d) {
|
|
|
18573
18560
|
this.v = e, this.k = d;
|
|
18574
18561
|
}
|
|
18575
18562
|
function AsyncGenerator2(e) {
|
|
18576
|
-
var
|
|
18577
|
-
function resume(
|
|
18563
|
+
var t, n;
|
|
18564
|
+
function resume(t, n) {
|
|
18578
18565
|
try {
|
|
18579
|
-
var
|
|
18580
|
-
Promise.resolve(u ? o.v : o).then(function(
|
|
18566
|
+
var r = e[t](n), o = r.value, u = o instanceof _OverloadYield2;
|
|
18567
|
+
Promise.resolve(u ? o.v : o).then(function(n) {
|
|
18581
18568
|
if (u) {
|
|
18582
|
-
var i =
|
|
18583
|
-
if (!o.k ||
|
|
18584
|
-
return resume(i,
|
|
18585
|
-
|
|
18569
|
+
var i = t === "return" && o.k ? t : "next";
|
|
18570
|
+
if (!o.k || n.done)
|
|
18571
|
+
return resume(i, n);
|
|
18572
|
+
n = e[i](n).value;
|
|
18586
18573
|
}
|
|
18587
|
-
settle(
|
|
18574
|
+
settle(!!r.done, n);
|
|
18588
18575
|
}, function(e) {
|
|
18589
18576
|
resume("throw", e);
|
|
18590
18577
|
});
|
|
18591
18578
|
} catch (e) {
|
|
18592
|
-
settle(
|
|
18579
|
+
settle(2, e);
|
|
18593
18580
|
}
|
|
18594
18581
|
}
|
|
18595
|
-
function settle(e,
|
|
18596
|
-
|
|
18597
|
-
|
|
18598
|
-
|
|
18599
|
-
|
|
18600
|
-
done: true
|
|
18601
|
-
});
|
|
18602
|
-
break;
|
|
18603
|
-
case "throw":
|
|
18604
|
-
r.reject(n);
|
|
18605
|
-
break;
|
|
18606
|
-
default:
|
|
18607
|
-
r.resolve({
|
|
18608
|
-
value: n,
|
|
18609
|
-
done: false
|
|
18610
|
-
});
|
|
18611
|
-
}
|
|
18612
|
-
(r = r.next) ? resume(r.key, r.arg) : t = null;
|
|
18582
|
+
function settle(e, r) {
|
|
18583
|
+
e === 2 ? t.reject(r) : t.resolve({
|
|
18584
|
+
value: r,
|
|
18585
|
+
done: e
|
|
18586
|
+
}), (t = t.next) ? resume(t.key, t.arg) : n = null;
|
|
18613
18587
|
}
|
|
18614
|
-
this._invoke = function(e,
|
|
18588
|
+
this._invoke = function(e, r) {
|
|
18615
18589
|
return new Promise(function(o, u) {
|
|
18616
18590
|
var i = {
|
|
18617
18591
|
key: e,
|
|
18618
|
-
arg:
|
|
18592
|
+
arg: r,
|
|
18619
18593
|
resolve: o,
|
|
18620
18594
|
reject: u,
|
|
18621
18595
|
next: null
|
|
18622
18596
|
};
|
|
18623
|
-
|
|
18597
|
+
n ? n = n.next = i : (t = n = i, resume(e, r));
|
|
18624
18598
|
});
|
|
18625
18599
|
}, typeof e["return"] != "function" && (this["return"] = undefined);
|
|
18626
18600
|
}
|
|
@@ -18942,12 +18916,19 @@ Usage:
|
|
|
18942
18916
|
et passport mine --event-id <id>
|
|
18943
18917
|
et passport login-options --event-id <id>
|
|
18944
18918
|
et passport bingo enable --event-id <id> (host: creates the hidden Bingo station and the HumanBingo)
|
|
18919
|
+
et passport bingo rename --event-id <id> --name <name> (host: the game's display name guests see; 1-100 chars, default "Human Bingo")
|
|
18945
18920
|
et passport bingo join --event-id <id> (guest, passport participants only)
|
|
18946
18921
|
et passport bingo claim-stamp --event-id <id> (guest: catch-up award for a completed card)
|
|
18947
18922
|
et passport bingo status --event-id <id> (guest: own bingo progress and stamp)
|
|
18948
18923
|
et passport export --event-id <id>
|
|
18949
18924
|
et passport settings update --event-id <id> --settings-json <json> (maxRedemptionsPerParticipant 0 = no cap)
|
|
18950
18925
|
et passport station upsert --event-id <id> --station-json <json> (collection.stampValue 0-1000, default 1; collection.category GAME|FOOD|DRINK|BINGO, default GAME)
|
|
18926
|
+
et passport skin get --event-id <id>
|
|
18927
|
+
et passport skin set --event-id <id> --appearance-version <n> --skin-json <json>
|
|
18928
|
+
et passport skin clear --event-id <id> --appearance-version <n>
|
|
18929
|
+
et passport skin upload --event-id <id> --kind <hero|logo> --file <path> --content-type <image-mime>
|
|
18930
|
+
et passport station image-set --event-id <id> --station-id <id> --file <path> --content-type <image-mime>
|
|
18931
|
+
et passport station image-clear --event-id <id> --station-id <id>
|
|
18951
18932
|
et passport station hidden --event-id <id> --station-id <id> --hidden <true|false>
|
|
18952
18933
|
et passport station archive --event-id <id> --station-id <id> --allow-state-change --target <same-event-id>
|
|
18953
18934
|
et passport station print-get --event-id <id> --station-id <id>
|
|
@@ -18971,7 +18952,7 @@ Usage:
|
|
|
18971
18952
|
et passport roster list --event-id <id> [--search <text>] [--limit <1-100>] [--cursor <cursor>]
|
|
18972
18953
|
et passport roster counts --event-id <id> [--search <text>]
|
|
18973
18954
|
et passport roster import --event-id <id> --file <path.csv|path.xlsx> [--staff-id-column <header>] [--last-name-column <header|none>] [--full-name-column <header|none>] [--display-name-column <header|none>] [--surname-position <last|first>]
|
|
18974
|
-
et passport roster upsert --event-id <id> --entry-json <json> ({id?,staffId,lastName,displayName})
|
|
18955
|
+
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)
|
|
18975
18956
|
et passport roster remove --event-id <id> --entry-id <id> --allow-state-change --target <same-event-id>
|
|
18976
18957
|
et passport roster purge --event-id <id> --allow-state-change --target <same-event-id>
|
|
18977
18958
|
|
|
@@ -18983,16 +18964,29 @@ Event Passport:
|
|
|
18983
18964
|
collection.category groups stations for guests: GAME, FOOD, DRINK or BINGO. Omit it to keep the stored one.
|
|
18984
18965
|
Omit collection on an existing station to preserve its current mode.
|
|
18985
18966
|
Station JSON supports id/name/description/location/imageKey/order/opensAt/closesAt/collection.
|
|
18967
|
+
Station cover art: image-set uploads a jpeg/png/webp/gif (up to 25 MB) to the event's station-art folder and
|
|
18968
|
+
saves it as the station's imageKey, keeping every other station setting; image-clear removes it. A new
|
|
18969
|
+
imageKey given in station JSON must be an upload to this event's event-passport/stations folder.
|
|
18970
|
+
Passport skin (optional per-event look; no skin renders the Go Labs default): lives in the event
|
|
18971
|
+
appearance as the optional passport block {heroImage:{key,focalX,focalY}|null, logo:{key}|null,
|
|
18972
|
+
colors:{graphic,dark}, emphasis:accent|ink}. skin get reads it with the version and image URLs.
|
|
18973
|
+
skin set is a version-fenced merge patch: --skin-json '{"heroImage":{"focalX":30}}' changes only the
|
|
18974
|
+
focal point; null clears heroImage or logo. skin upload --kind hero|logo returns the key to reference
|
|
18975
|
+
in skin set. skin clear returns the event to the Go Labs default look and keeps the rest of the appearance.
|
|
18976
|
+
Other appearance saves that omit passport keep the stored skin. colors.dark needs 4.5:1 contrast with white.
|
|
18986
18977
|
Date-time fields are ISO strings or null; order defaults to zero.
|
|
18987
18978
|
Settings JSON requires linkedDrawEventId, luckyDrawStampThreshold, prizeStampThreshold,
|
|
18988
|
-
maxRedemptionsPerParticipant; optional loginMethods is {emailOtp,google,guest,staffId}.
|
|
18989
|
-
Keep email OTP, Google or Staff ID enabled for recovery; staffId defaults to false
|
|
18979
|
+
maxRedemptionsPerParticipant; optional loginMethods is {emailOtp,google,guest,staffId,staffIdRequiresLastName}.
|
|
18980
|
+
Keep email OTP, Google or Staff ID enabled for recovery; staffId defaults to false and
|
|
18981
|
+
staffIdRequiresLastName to true, so set it false again whenever you resend loginMethods.
|
|
18990
18982
|
Omit loginMethods to preserve it.
|
|
18991
18983
|
Staff roster (event hosts only): import replaces the roster and returns imported, replaced and
|
|
18992
18984
|
rejected rows (blank, too long, or a Staff ID repeated in the file). Columns are matched from
|
|
18993
18985
|
header names; override with the column flags. Without a last-name column, the last name is
|
|
18994
|
-
taken from the full name (--surname-position last|first, default last).
|
|
18995
|
-
|
|
18986
|
+
taken from the full name (--surname-position last|first, default last). Files over 20,000 data
|
|
18987
|
+
rows or 200 columns, or with no importable rows, are refused and the roster is unchanged. A blank
|
|
18988
|
+
last name is rejected only when the event requires one; counts reports missingLastNameCount.
|
|
18989
|
+
Staff ID sign-in matches case-insensitively, ignoring spaces and punctuation, and needs the browser.
|
|
18996
18990
|
Printed QR issue/revoke requires the last observed print version; stale versions conflict.
|
|
18997
18991
|
claim scans a station QR; collect scans a participant profile QR as an event operator.
|
|
18998
18992
|
Repeat scans never add a second stamp or change its original points.
|
|
@@ -19450,14 +19444,24 @@ var runLuckyDrawSetupCommand = async (input) => {
|
|
|
19450
19444
|
};
|
|
19451
19445
|
|
|
19452
19446
|
// src/commands/passport.ts
|
|
19453
|
-
import { readFile as
|
|
19454
|
-
import { basename as
|
|
19447
|
+
import { readFile as readFile5 } from "fs/promises";
|
|
19448
|
+
import { basename as basename3 } from "path";
|
|
19455
19449
|
|
|
19456
19450
|
// ../utils/src/lib/spreadsheet-table.ts
|
|
19457
19451
|
var import_jszip = __toESM(require_lib3(), 1);
|
|
19458
19452
|
var import_papaparse = __toESM(require_papaparse(), 1);
|
|
19459
19453
|
var MAX_ROWS = 50000;
|
|
19460
19454
|
var MAX_COLUMNS = 200;
|
|
19455
|
+
var isFilled = (value) => Boolean(value?.trim());
|
|
19456
|
+
var rowLimitError = () => new Error(`The file has data below row ${MAX_ROWS.toLocaleString("en-US")}. Remove blank rows or split the file, then try again.`);
|
|
19457
|
+
var columnLimitError = () => new Error(`The file has data beyond column ${MAX_COLUMNS}. Delete the extra columns, then try again.`);
|
|
19458
|
+
var clampColumns = (cells) => {
|
|
19459
|
+
if (cells.length <= MAX_COLUMNS)
|
|
19460
|
+
return cells;
|
|
19461
|
+
if (cells.slice(MAX_COLUMNS).some(isFilled))
|
|
19462
|
+
throw columnLimitError();
|
|
19463
|
+
return cells.slice(0, MAX_COLUMNS);
|
|
19464
|
+
};
|
|
19461
19465
|
var isZip = (bytes) => bytes[0] === 80 && bytes[1] === 75 && bytes[2] === 3;
|
|
19462
19466
|
var decodeXml = (value) => value.replace(/_x([0-9A-Fa-f]{4})_/g, (_, hex) => String.fromCharCode(Number.parseInt(hex, 16))).replace(/&#x([0-9A-Fa-f]+);/g, (_, hex) => String.fromCodePoint(Number.parseInt(hex, 16))).replace(/&#(\d+);/g, (_, digits) => String.fromCodePoint(Number.parseInt(digits, 10))).replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'/g, "'").replace(/&/g, "&");
|
|
19463
19467
|
var textRuns = (xml) => [
|
|
@@ -19505,11 +19509,15 @@ var readRowCells = (rowXml, sharedStrings) => {
|
|
|
19505
19509
|
for (const cellMatch of rowXml.matchAll(/<c\b[^>]*?(?:\/>|>[\s\S]*?<\/c>)/g)) {
|
|
19506
19510
|
const reference = attribute(cellMatch[0], "r");
|
|
19507
19511
|
const column = reference ? columnIndex(reference) : cells.length;
|
|
19508
|
-
|
|
19512
|
+
const value = cellValue(cellMatch[0], sharedStrings);
|
|
19513
|
+
if (column < 0 || column >= MAX_COLUMNS) {
|
|
19514
|
+
if (isFilled(value))
|
|
19515
|
+
throw columnLimitError();
|
|
19509
19516
|
continue;
|
|
19517
|
+
}
|
|
19510
19518
|
while (cells.length < column)
|
|
19511
19519
|
cells.push("");
|
|
19512
|
-
cells[column] =
|
|
19520
|
+
cells[column] = value;
|
|
19513
19521
|
}
|
|
19514
19522
|
return cells;
|
|
19515
19523
|
};
|
|
@@ -19523,18 +19531,29 @@ var readXlsx = async (bytes) => {
|
|
|
19523
19531
|
for (const rowMatch of sheet.matchAll(/<row\b([^>]*?)(?:\/>|>([\s\S]*?)<\/row>)/g)) {
|
|
19524
19532
|
const rowNumber = Number(attribute(` ${rowMatch[1] ?? ""}`, "r"));
|
|
19525
19533
|
const index = Number.isInteger(rowNumber) ? rowNumber - 1 : table.length;
|
|
19526
|
-
|
|
19527
|
-
|
|
19534
|
+
const cells = readRowCells(rowMatch[2] ?? "", sharedStrings);
|
|
19535
|
+
if (index >= MAX_ROWS) {
|
|
19536
|
+
if (cells.some(isFilled))
|
|
19537
|
+
throw rowLimitError();
|
|
19538
|
+
continue;
|
|
19539
|
+
}
|
|
19528
19540
|
while (table.length < index)
|
|
19529
19541
|
table.push([]);
|
|
19530
|
-
table[index] =
|
|
19542
|
+
table[index] = cells;
|
|
19531
19543
|
}
|
|
19532
19544
|
return table;
|
|
19533
19545
|
};
|
|
19534
19546
|
var readCsv = (bytes) => {
|
|
19535
19547
|
const text = new TextDecoder("utf-8").decode(bytes).replace(/^\uFEFF/, "");
|
|
19536
19548
|
const parsed = import_papaparse.default.parse(text, { skipEmptyLines: false });
|
|
19537
|
-
|
|
19549
|
+
const badQuote = parsed.errors.find((error) => error.type === "Quotes");
|
|
19550
|
+
if (badQuote) {
|
|
19551
|
+
const near = badQuote.row === undefined ? "" : ` near row ${badQuote.row + 1}`;
|
|
19552
|
+
throw new Error(`The CSV has a misplaced or unclosed quote${near}. Fix it, then try again.`);
|
|
19553
|
+
}
|
|
19554
|
+
if (parsed.data.slice(MAX_ROWS).some((row) => row.some(isFilled)))
|
|
19555
|
+
throw rowLimitError();
|
|
19556
|
+
return parsed.data.slice(0, MAX_ROWS).map(clampColumns);
|
|
19538
19557
|
};
|
|
19539
19558
|
var squareTable = (table) => {
|
|
19540
19559
|
while (table.length > 0 && (table.at(-1) ?? []).every((value) => !value?.trim()))
|
|
@@ -19588,7 +19607,8 @@ var passportLoginMethodsSchema = object({
|
|
|
19588
19607
|
emailOtp: boolean2(),
|
|
19589
19608
|
google: boolean2(),
|
|
19590
19609
|
guest: boolean2(),
|
|
19591
|
-
staffId: boolean2().default(false)
|
|
19610
|
+
staffId: boolean2().default(false),
|
|
19611
|
+
staffIdRequiresLastName: boolean2().default(true)
|
|
19592
19612
|
}).strict().refine((methods) => methods.emailOtp || methods.google || methods.staffId, {
|
|
19593
19613
|
message: "Keep email OTP, Google or Staff ID available for passport recovery."
|
|
19594
19614
|
});
|
|
@@ -19719,6 +19739,9 @@ var passportSettingsSchema = passportEventIdSchema.extend({
|
|
|
19719
19739
|
linkedDrawEventId: string2().min(1).nullable(),
|
|
19720
19740
|
loginMethods: passportLoginMethodsSchema.optional()
|
|
19721
19741
|
});
|
|
19742
|
+
var renamePassportBingoSchema = passportEventIdSchema.extend({
|
|
19743
|
+
name: string2().trim().min(1).max(100)
|
|
19744
|
+
});
|
|
19722
19745
|
var passportStationSchema = passportEventIdSchema.extend({
|
|
19723
19746
|
id: string2().optional(),
|
|
19724
19747
|
name: string2().trim().min(1).max(100),
|
|
@@ -19756,11 +19779,15 @@ var rosterStaffIdSchema = string2().trim().min(1, "Enter a Staff ID.").max(PASSP
|
|
|
19756
19779
|
var rosterLastNameSchema = string2().trim().min(1, "Enter a last name.").max(PASSPORT_ROSTER_NAME_MAX).refine((value) => normalizePassportRosterKey(value) !== "", {
|
|
19757
19780
|
message: "Last name needs at least one letter or digit."
|
|
19758
19781
|
});
|
|
19759
|
-
var
|
|
19782
|
+
var rosterOptionalLastNameSchema = string2().trim().max(PASSPORT_ROSTER_NAME_MAX).nullable().transform((value) => value || null).refine((value) => value === null || normalizePassportRosterKey(value) !== "", { message: "Last name needs at least one letter or digit." });
|
|
19783
|
+
var passportStaffIdSignInSchema = passportEventIdSchema.extend({
|
|
19784
|
+
staffId: rosterStaffIdSchema,
|
|
19785
|
+
lastName: rosterLastNameSchema.optional()
|
|
19786
|
+
}).strict();
|
|
19760
19787
|
var passportRosterEntrySchema = passportEventIdSchema.extend({
|
|
19761
19788
|
id: string2().min(1).optional(),
|
|
19762
19789
|
staffId: rosterStaffIdSchema,
|
|
19763
|
-
lastName:
|
|
19790
|
+
lastName: rosterOptionalLastNameSchema,
|
|
19764
19791
|
displayName: string2().trim().max(PASSPORT_ROSTER_NAME_MAX).nullable().transform((value) => value || null)
|
|
19765
19792
|
}).strict();
|
|
19766
19793
|
var passportRosterEntryIdSchema = passportEventIdSchema.extend({ entryId: string2().min(1) }).strict();
|
|
@@ -19791,7 +19818,7 @@ var surnameOf = (fullName, position) => {
|
|
|
19791
19818
|
const words = fullName.split(/\s+/).filter(Boolean);
|
|
19792
19819
|
return (position === "first" ? words[0] : words.at(-1)) ?? "";
|
|
19793
19820
|
};
|
|
19794
|
-
var assertPassportRosterMapping = (mapping, columnCount) => {
|
|
19821
|
+
var assertPassportRosterMapping = (mapping, columnCount, requireLastName) => {
|
|
19795
19822
|
const columns = [
|
|
19796
19823
|
mapping.staffId,
|
|
19797
19824
|
mapping.lastName,
|
|
@@ -19800,11 +19827,11 @@ var assertPassportRosterMapping = (mapping, columnCount) => {
|
|
|
19800
19827
|
];
|
|
19801
19828
|
if (columns.some((index) => index !== null && (!Number.isInteger(index) || index < 0 || index >= columnCount)))
|
|
19802
19829
|
throw new Error("A mapped column is not in the file.");
|
|
19803
|
-
if (mapping.lastName === null && mapping.fullName === null)
|
|
19830
|
+
if (requireLastName && mapping.lastName === null && mapping.fullName === null)
|
|
19804
19831
|
throw new Error("Map a Last Name column or a Full Name column.");
|
|
19805
19832
|
};
|
|
19806
|
-
var mapPassportRosterTable = (table, mapping) => {
|
|
19807
|
-
assertPassportRosterMapping(mapping, table[0]?.length ?? 0);
|
|
19833
|
+
var mapPassportRosterTable = (table, mapping, { requireLastName }) => {
|
|
19834
|
+
assertPassportRosterMapping(mapping, table[0]?.length ?? 0, requireLastName);
|
|
19808
19835
|
const rows = [];
|
|
19809
19836
|
table.slice(1).forEach((row, index) => {
|
|
19810
19837
|
if (row.every((value) => value.trim() === ""))
|
|
@@ -19819,6 +19846,9 @@ var mapPassportRosterTable = (table, mapping) => {
|
|
|
19819
19846
|
displayName
|
|
19820
19847
|
});
|
|
19821
19848
|
});
|
|
19849
|
+
if (rows.length > PASSPORT_ROSTER_IMPORT_MAX) {
|
|
19850
|
+
throw new Error(`This file has ${rows.length.toLocaleString("en-US")} rows with data. A roster can have at most ${PASSPORT_ROSTER_IMPORT_MAX.toLocaleString("en-US")}. Split the file or remove rows you do not need.`);
|
|
19851
|
+
}
|
|
19822
19852
|
return rows;
|
|
19823
19853
|
};
|
|
19824
19854
|
var headerPatterns = {
|
|
@@ -19841,6 +19871,371 @@ var guessPassportRosterMapping = (headers) => {
|
|
|
19841
19871
|
};
|
|
19842
19872
|
};
|
|
19843
19873
|
|
|
19874
|
+
// src/commands/passport-media.ts
|
|
19875
|
+
import { readFile as readFile4 } from "fs/promises";
|
|
19876
|
+
import { basename as basename2 } from "path";
|
|
19877
|
+
|
|
19878
|
+
// ../utils/src/lib/event-s3-upload.ts
|
|
19879
|
+
var MAX_EVENT_IMAGE_UPLOAD_BYTES = 25 * 1024 * 1024;
|
|
19880
|
+
var MAX_EVENT_VIDEO_UPLOAD_BYTES = 200 * 1024 * 1024;
|
|
19881
|
+
var MAX_HUMAN_BINGO_MEDIA_UPLOAD_BYTES = 1024 * 1024 * 1024;
|
|
19882
|
+
var SAFE_IMAGE_CONTENT_TYPES = [
|
|
19883
|
+
"image/jpeg",
|
|
19884
|
+
"image/png",
|
|
19885
|
+
"image/webp",
|
|
19886
|
+
"image/gif"
|
|
19887
|
+
];
|
|
19888
|
+
var VIDEO_CONTENT_TYPES = [
|
|
19889
|
+
"video/mp4",
|
|
19890
|
+
"video/quicktime",
|
|
19891
|
+
"video/webm",
|
|
19892
|
+
"video/ogg"
|
|
19893
|
+
];
|
|
19894
|
+
var SAFE_EVENT_IMAGE_CONTENT_TYPES = [
|
|
19895
|
+
...SAFE_IMAGE_CONTENT_TYPES
|
|
19896
|
+
];
|
|
19897
|
+
var SAFE_EVENT_VIDEO_CONTENT_TYPES = [...VIDEO_CONTENT_TYPES];
|
|
19898
|
+
var SAFE_EVENT_UPLOAD_CONTENT_TYPES = [
|
|
19899
|
+
...SAFE_IMAGE_CONTENT_TYPES,
|
|
19900
|
+
...VIDEO_CONTENT_TYPES
|
|
19901
|
+
];
|
|
19902
|
+
var getEventPassportUploadBaseFolder = (kind) => `event-passport/${kind}`;
|
|
19903
|
+
|
|
19904
|
+
// ../utils/src/lib/event-theme.ts
|
|
19905
|
+
var EVENT_TECH_EVENT_TYPES = Object.values(EventType);
|
|
19906
|
+
var HEX_COLOR_PATTERN = /^#[0-9a-f]{6}$/i;
|
|
19907
|
+
var isEventThemeHexColor = (value) => HEX_COLOR_PATTERN.test(value);
|
|
19908
|
+
|
|
19909
|
+
// ../utils/src/lib/passport-skin.ts
|
|
19910
|
+
var DEFAULT_PASSPORT_SKIN_SETTINGS = {
|
|
19911
|
+
heroImage: null,
|
|
19912
|
+
logo: null,
|
|
19913
|
+
colors: { graphic: null, dark: null },
|
|
19914
|
+
emphasis: "accent"
|
|
19915
|
+
};
|
|
19916
|
+
var isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
19917
|
+
var toKey = (value) => typeof value === "string" && value.trim().length > 0 ? value.trim() : null;
|
|
19918
|
+
var toPercent = (value) => typeof value === "number" && Number.isFinite(value) ? Math.min(100, Math.max(0, value)) : 50;
|
|
19919
|
+
var toHex = (value) => typeof value === "string" && isEventThemeHexColor(value) ? value.toLowerCase() : null;
|
|
19920
|
+
var readHeroImage = (value) => {
|
|
19921
|
+
if (!isRecord(value))
|
|
19922
|
+
return null;
|
|
19923
|
+
const key = toKey(value.key);
|
|
19924
|
+
if (!key)
|
|
19925
|
+
return null;
|
|
19926
|
+
return {
|
|
19927
|
+
key,
|
|
19928
|
+
focalX: toPercent(value.focalX),
|
|
19929
|
+
focalY: toPercent(value.focalY)
|
|
19930
|
+
};
|
|
19931
|
+
};
|
|
19932
|
+
var readLogo = (value) => {
|
|
19933
|
+
if (!isRecord(value))
|
|
19934
|
+
return null;
|
|
19935
|
+
const key = toKey(value.key);
|
|
19936
|
+
return key ? { key } : null;
|
|
19937
|
+
};
|
|
19938
|
+
var resolvePassportSkinSettings = (value) => {
|
|
19939
|
+
if (!isRecord(value))
|
|
19940
|
+
return DEFAULT_PASSPORT_SKIN_SETTINGS;
|
|
19941
|
+
const colors = isRecord(value.colors) ? value.colors : {};
|
|
19942
|
+
return {
|
|
19943
|
+
heroImage: readHeroImage(value.heroImage),
|
|
19944
|
+
logo: readLogo(value.logo),
|
|
19945
|
+
colors: { graphic: toHex(colors.graphic), dark: toHex(colors.dark) },
|
|
19946
|
+
emphasis: value.emphasis === "ink" ? "ink" : "accent"
|
|
19947
|
+
};
|
|
19948
|
+
};
|
|
19949
|
+
var resolvePassportSkinSettingsFromAppearance = (appearance) => resolvePassportSkinSettings(isRecord(appearance) ? appearance.passport : undefined);
|
|
19950
|
+
|
|
19951
|
+
// ../validators/src/photo-wall-screen.schema.ts
|
|
19952
|
+
var photoWallScreenSchema = object({
|
|
19953
|
+
width: number2().int().min(240).max(16384),
|
|
19954
|
+
height: number2().int().min(240).max(16384)
|
|
19955
|
+
});
|
|
19956
|
+
|
|
19957
|
+
// ../validators/src/photo-wall-submission-settings.schema.ts
|
|
19958
|
+
var photoWallSubmissionSettingsSchema = object({
|
|
19959
|
+
mode: _enum(["photo-only", "comment-only", "photo-and-comment"]),
|
|
19960
|
+
photoRequired: boolean2(),
|
|
19961
|
+
commentRequired: boolean2()
|
|
19962
|
+
});
|
|
19963
|
+
var DEFAULT_PHOTO_WALL_SUBMISSION_SETTINGS = {
|
|
19964
|
+
mode: "photo-and-comment",
|
|
19965
|
+
photoRequired: true,
|
|
19966
|
+
commentRequired: false
|
|
19967
|
+
};
|
|
19968
|
+
|
|
19969
|
+
// ../validators/src/event-appearance.schema.ts
|
|
19970
|
+
var hexColorSchema = string2().trim().regex(/^#[0-9a-f]{6}$/i, "Color must be a six-digit hex color").transform((value) => value.toLowerCase());
|
|
19971
|
+
var getRelativeLuminance = (color) => {
|
|
19972
|
+
const toLinear = (channel) => {
|
|
19973
|
+
const normalized = channel / 255;
|
|
19974
|
+
return normalized <= 0.04045 ? normalized / 12.92 : ((normalized + 0.055) / 1.055) ** 2.4;
|
|
19975
|
+
};
|
|
19976
|
+
const red = toLinear(Number.parseInt(color.slice(1, 3), 16));
|
|
19977
|
+
const green = toLinear(Number.parseInt(color.slice(3, 5), 16));
|
|
19978
|
+
const blue = toLinear(Number.parseInt(color.slice(5, 7), 16));
|
|
19979
|
+
return 0.2126 * red + 0.7152 * green + 0.0722 * blue;
|
|
19980
|
+
};
|
|
19981
|
+
var hasReadableTextContrast = (textColor, backgroundColor) => {
|
|
19982
|
+
const textLuminance = getRelativeLuminance(textColor);
|
|
19983
|
+
const backgroundLuminance = getRelativeLuminance(backgroundColor);
|
|
19984
|
+
return (Math.max(textLuminance, backgroundLuminance) + 0.05) / (Math.min(textLuminance, backgroundLuminance) + 0.05) >= 4.5;
|
|
19985
|
+
};
|
|
19986
|
+
var eventThemeSchema = object({
|
|
19987
|
+
accentColor: hexColorSchema,
|
|
19988
|
+
backgroundColor: hexColorSchema,
|
|
19989
|
+
textColor: hexColorSchema,
|
|
19990
|
+
fontFamily: _enum(["SYSTEM", "JAKARTA", "SERIF"])
|
|
19991
|
+
}).superRefine((theme, context) => {
|
|
19992
|
+
if (!hasReadableTextContrast(theme.textColor, theme.backgroundColor)) {
|
|
19993
|
+
context.addIssue({
|
|
19994
|
+
code: "custom",
|
|
19995
|
+
message: "Text color must have at least 4.5:1 contrast on the background color",
|
|
19996
|
+
path: ["textColor"]
|
|
19997
|
+
});
|
|
19998
|
+
}
|
|
19999
|
+
});
|
|
20000
|
+
var appearanceMediaSchema = discriminatedUnion("type", [
|
|
20001
|
+
object({ type: literal("none"), key: _null3() }),
|
|
20002
|
+
object({ type: literal("image"), key: string2().min(1).max(1024) })
|
|
20003
|
+
]);
|
|
20004
|
+
var displayMediaSchema = discriminatedUnion("type", [
|
|
20005
|
+
object({ type: literal("none"), key: _null3() }),
|
|
20006
|
+
object({ type: literal("image"), key: string2().min(1).max(1024) }),
|
|
20007
|
+
object({ type: literal("video"), key: string2().min(1).max(1024) })
|
|
20008
|
+
]);
|
|
20009
|
+
var passportImageKeySchema = string2().trim().min(1).max(1024);
|
|
20010
|
+
var passportFocalSchema = number2().min(0).max(100);
|
|
20011
|
+
var passportSkinSchema = object({
|
|
20012
|
+
heroImage: object({
|
|
20013
|
+
key: passportImageKeySchema,
|
|
20014
|
+
focalX: passportFocalSchema.default(50),
|
|
20015
|
+
focalY: passportFocalSchema.default(50)
|
|
20016
|
+
}).nullable().default(null),
|
|
20017
|
+
logo: object({ key: passportImageKeySchema }).nullable().default(null),
|
|
20018
|
+
colors: object({
|
|
20019
|
+
graphic: hexColorSchema.nullable().default(null),
|
|
20020
|
+
dark: hexColorSchema.nullable().default(null).refine((color) => color === null || hasReadableTextContrast("#ffffff", color), "Dark colour must have at least 4.5:1 contrast with white text")
|
|
20021
|
+
}).default({ graphic: null, dark: null }),
|
|
20022
|
+
emphasis: _enum(["accent", "ink"]).default("accent")
|
|
20023
|
+
});
|
|
20024
|
+
var eventAppearanceSchema = object({
|
|
20025
|
+
version: literal(1),
|
|
20026
|
+
theme: eventThemeSchema,
|
|
20027
|
+
guestBackground: appearanceMediaSchema,
|
|
20028
|
+
displayBackground: displayMediaSchema,
|
|
20029
|
+
passport: passportSkinSchema.optional(),
|
|
20030
|
+
photoWall: object({
|
|
20031
|
+
durationSeconds: number2().int().min(10).max(40),
|
|
20032
|
+
maxVisible: number2().int().min(1).max(16),
|
|
20033
|
+
motion: _enum(["gentle", "lively", "roaming"]),
|
|
20034
|
+
showQrCode: boolean2(),
|
|
20035
|
+
qrCodeLabel: string2().trim().max(80, "QR code text must be 80 characters or fewer").transform((value) => value || "Scan to share").default("Scan to share"),
|
|
20036
|
+
showEventName: boolean2(),
|
|
20037
|
+
screen: photoWallScreenSchema.nullable().default(null),
|
|
20038
|
+
submission: photoWallSubmissionSettingsSchema.default(DEFAULT_PHOTO_WALL_SUBMISSION_SETTINGS)
|
|
20039
|
+
})
|
|
20040
|
+
});
|
|
20041
|
+
var DEFAULT_PASSPORT_SKIN = {
|
|
20042
|
+
heroImage: null,
|
|
20043
|
+
logo: null,
|
|
20044
|
+
colors: { graphic: null, dark: null },
|
|
20045
|
+
emphasis: "accent"
|
|
20046
|
+
};
|
|
20047
|
+
var DEFAULT_EVENT_APPEARANCE2 = {
|
|
20048
|
+
version: 1,
|
|
20049
|
+
theme: {
|
|
20050
|
+
accentColor: "#f84404",
|
|
20051
|
+
backgroundColor: "#f6f7f9",
|
|
20052
|
+
textColor: "#20242a",
|
|
20053
|
+
fontFamily: "SYSTEM"
|
|
20054
|
+
},
|
|
20055
|
+
guestBackground: { type: "none", key: null },
|
|
20056
|
+
displayBackground: { type: "none", key: null },
|
|
20057
|
+
photoWall: {
|
|
20058
|
+
durationSeconds: 18,
|
|
20059
|
+
maxVisible: 4,
|
|
20060
|
+
motion: "gentle",
|
|
20061
|
+
showQrCode: true,
|
|
20062
|
+
qrCodeLabel: "Scan to share",
|
|
20063
|
+
showEventName: true,
|
|
20064
|
+
screen: null,
|
|
20065
|
+
submission: DEFAULT_PHOTO_WALL_SUBMISSION_SETTINGS
|
|
20066
|
+
}
|
|
20067
|
+
};
|
|
20068
|
+
|
|
20069
|
+
// src/commands/passport-media.ts
|
|
20070
|
+
var IMAGE_CONTENT_TYPES = [
|
|
20071
|
+
"image/jpeg",
|
|
20072
|
+
"image/png",
|
|
20073
|
+
"image/webp",
|
|
20074
|
+
"image/gif"
|
|
20075
|
+
];
|
|
20076
|
+
var PASSPORT_SKIN_UPLOAD_KINDS = ["hero", "logo"];
|
|
20077
|
+
var requiredValue = (flags, name) => {
|
|
20078
|
+
const value = flags.get(name);
|
|
20079
|
+
if (typeof value !== "string" || value === "")
|
|
20080
|
+
throw new CliUsageError(`--${name} is required and needs a value.`);
|
|
20081
|
+
return value;
|
|
20082
|
+
};
|
|
20083
|
+
var nonnegativeInteger = (value, name) => {
|
|
20084
|
+
const parsed = Number(value);
|
|
20085
|
+
if (!/^\d+$/.test(value) || !Number.isSafeInteger(parsed))
|
|
20086
|
+
throw new CliUsageError(`--${name} must be a non-negative whole number.`);
|
|
20087
|
+
return parsed;
|
|
20088
|
+
};
|
|
20089
|
+
var isRecord2 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
20090
|
+
var parseJsonRecord = (raw, name) => {
|
|
20091
|
+
let parsed;
|
|
20092
|
+
try {
|
|
20093
|
+
parsed = JSON.parse(raw);
|
|
20094
|
+
} catch {
|
|
20095
|
+
throw new CliUsageError(`--${name} must be valid JSON.`);
|
|
20096
|
+
}
|
|
20097
|
+
if (!isRecord2(parsed))
|
|
20098
|
+
throw new CliUsageError(`--${name} must be a JSON object.`);
|
|
20099
|
+
return parsed;
|
|
20100
|
+
};
|
|
20101
|
+
var mergeSkinPatch = (current, patch) => {
|
|
20102
|
+
const allowed = ["heroImage", "logo", "colors", "emphasis"];
|
|
20103
|
+
if (Object.keys(patch).some((key) => !allowed.includes(key)))
|
|
20104
|
+
throw new CliUsageError(`--skin-json supports only: ${allowed.join(", ")}.`);
|
|
20105
|
+
const merged = {
|
|
20106
|
+
heroImage: patch.heroImage === undefined ? current.heroImage : isRecord2(patch.heroImage) ? { ...current.heroImage, ...patch.heroImage } : patch.heroImage,
|
|
20107
|
+
logo: patch.logo === undefined ? current.logo : isRecord2(patch.logo) ? { ...current.logo, ...patch.logo } : patch.logo,
|
|
20108
|
+
colors: isRecord2(patch.colors) ? { ...current.colors, ...patch.colors } : patch.colors ?? current.colors,
|
|
20109
|
+
emphasis: patch.emphasis ?? current.emphasis
|
|
20110
|
+
};
|
|
20111
|
+
const parsed = passportSkinSchema.safeParse(merged);
|
|
20112
|
+
if (!parsed.success)
|
|
20113
|
+
throw new CliUsageError(`Invalid passport skin: ${parsed.error.issues.map((issue) => `${issue.path.join(".") || "skin"}: ${issue.message}`).join("; ")}`);
|
|
20114
|
+
return parsed.data;
|
|
20115
|
+
};
|
|
20116
|
+
var readCanonicalAppearance = async (eventId) => {
|
|
20117
|
+
const projection = await api2.event.getEventAppearance.query({ eventId });
|
|
20118
|
+
const appearance = eventAppearanceSchema.parse(projection.appearance ?? DEFAULT_EVENT_APPEARANCE2);
|
|
20119
|
+
return { projection, appearance };
|
|
20120
|
+
};
|
|
20121
|
+
var getPassportSkin = async (eventId) => {
|
|
20122
|
+
const { projection, appearance } = await readCanonicalAppearance(eventId);
|
|
20123
|
+
return {
|
|
20124
|
+
appearanceVersion: projection.appearanceVersion,
|
|
20125
|
+
hasCustomAppearance: projection.hasCustomAppearance,
|
|
20126
|
+
passport: resolvePassportSkinSettingsFromAppearance(appearance),
|
|
20127
|
+
passportHeroImageUrl: projection.passportHeroImageUrl,
|
|
20128
|
+
passportLogoUrl: projection.passportLogoUrl
|
|
20129
|
+
};
|
|
20130
|
+
};
|
|
20131
|
+
var saveSkin = async (eventId, appearanceVersion, buildSkin) => {
|
|
20132
|
+
const { projection, appearance } = await readCanonicalAppearance(eventId);
|
|
20133
|
+
if (projection.appearanceVersion !== appearanceVersion)
|
|
20134
|
+
throw new CliUsageError(`The appearance is at version ${projection.appearanceVersion}, not ${appearanceVersion}. Read it with \`et passport skin get\` and retry.`);
|
|
20135
|
+
const next = {
|
|
20136
|
+
...appearance,
|
|
20137
|
+
passport: buildSkin(resolvePassportSkinSettingsFromAppearance(appearance))
|
|
20138
|
+
};
|
|
20139
|
+
return api2.event.updateEventAppearance.mutate({
|
|
20140
|
+
eventId,
|
|
20141
|
+
appearance: next,
|
|
20142
|
+
appearanceVersion
|
|
20143
|
+
});
|
|
20144
|
+
};
|
|
20145
|
+
var isUploadKind = (kinds, value) => kinds.some((kind) => kind === value);
|
|
20146
|
+
var uploadPassportImage = async (eventId, kind, flags) => {
|
|
20147
|
+
const filePath = requiredValue(flags, "file");
|
|
20148
|
+
const contentType = requiredValue(flags, "content-type");
|
|
20149
|
+
if (!IMAGE_CONTENT_TYPES.some((allowed) => allowed === contentType))
|
|
20150
|
+
throw new CliUsageError(`--content-type must be one of: ${IMAGE_CONTENT_TYPES.join(", ")}.`);
|
|
20151
|
+
const file = await readFile4(filePath);
|
|
20152
|
+
if (file.byteLength > MAX_EVENT_IMAGE_UPLOAD_BYTES)
|
|
20153
|
+
throw new CliUsageError("The image must be 25 MB or smaller.");
|
|
20154
|
+
const signed = await api2.attachment.getPresignedUrlToUpload.mutate({
|
|
20155
|
+
folder: getEventPassportUploadBaseFolder(kind),
|
|
20156
|
+
fileName: basename2(filePath),
|
|
20157
|
+
contentType,
|
|
20158
|
+
size: file.byteLength,
|
|
20159
|
+
eventId
|
|
20160
|
+
});
|
|
20161
|
+
const uploadResponse = await fetch(signed.uploadUrl, {
|
|
20162
|
+
method: "PUT",
|
|
20163
|
+
headers: { "content-type": contentType },
|
|
20164
|
+
body: file
|
|
20165
|
+
});
|
|
20166
|
+
if (!uploadResponse.ok)
|
|
20167
|
+
throw new Error(`Passport image upload failed with HTTP ${uploadResponse.status}.`);
|
|
20168
|
+
return signed;
|
|
20169
|
+
};
|
|
20170
|
+
var createSkinOperation = (subcommand, { eventId, flags, allowed }) => {
|
|
20171
|
+
switch (subcommand) {
|
|
20172
|
+
case "get":
|
|
20173
|
+
return () => getPassportSkin(eventId);
|
|
20174
|
+
case "set": {
|
|
20175
|
+
allowed.push("appearance-version", "skin-json");
|
|
20176
|
+
const version = nonnegativeInteger(requiredValue(flags, "appearance-version"), "appearance-version");
|
|
20177
|
+
const patch = parseJsonRecord(requiredValue(flags, "skin-json"), "skin-json");
|
|
20178
|
+
return () => saveSkin(eventId, version, (current) => mergeSkinPatch(current, patch));
|
|
20179
|
+
}
|
|
20180
|
+
case "clear": {
|
|
20181
|
+
allowed.push("appearance-version");
|
|
20182
|
+
const version = nonnegativeInteger(requiredValue(flags, "appearance-version"), "appearance-version");
|
|
20183
|
+
return () => saveSkin(eventId, version, () => DEFAULT_PASSPORT_SKIN);
|
|
20184
|
+
}
|
|
20185
|
+
case "upload": {
|
|
20186
|
+
allowed.push("kind", "file", "content-type");
|
|
20187
|
+
const kind = requiredValue(flags, "kind");
|
|
20188
|
+
if (!isUploadKind(PASSPORT_SKIN_UPLOAD_KINDS, kind))
|
|
20189
|
+
throw new CliUsageError(`--kind must be one of: ${PASSPORT_SKIN_UPLOAD_KINDS.join(", ")}.`);
|
|
20190
|
+
return () => uploadPassportImage(eventId, kind, flags);
|
|
20191
|
+
}
|
|
20192
|
+
default:
|
|
20193
|
+
return null;
|
|
20194
|
+
}
|
|
20195
|
+
};
|
|
20196
|
+
var setStationImage = async (eventId, stationId, imageKey) => {
|
|
20197
|
+
const overview = await api2.event.passport.getPassportOverview.query({
|
|
20198
|
+
eventId
|
|
20199
|
+
});
|
|
20200
|
+
const station = overview.stations.find((item) => item.id === stationId);
|
|
20201
|
+
if (!station)
|
|
20202
|
+
throw new CliUsageError("Station not found for this event.");
|
|
20203
|
+
return api2.event.passport.upsertPassportStation.mutate({
|
|
20204
|
+
eventId,
|
|
20205
|
+
id: station.id,
|
|
20206
|
+
name: station.name,
|
|
20207
|
+
description: station.description,
|
|
20208
|
+
location: station.location,
|
|
20209
|
+
imageKey: imageKey ? await imageKey() : null,
|
|
20210
|
+
order: station.order,
|
|
20211
|
+
opensAt: station.opensAt,
|
|
20212
|
+
closesAt: station.closesAt
|
|
20213
|
+
});
|
|
20214
|
+
};
|
|
20215
|
+
var createStationImageOperation = (subcommand, { eventId, flags, allowed }) => {
|
|
20216
|
+
if (subcommand !== "image-set" && subcommand !== "image-clear")
|
|
20217
|
+
return null;
|
|
20218
|
+
allowed.push("station-id");
|
|
20219
|
+
const stationId = requiredValue(flags, "station-id");
|
|
20220
|
+
if (subcommand === "image-clear")
|
|
20221
|
+
return () => setStationImage(eventId, stationId, null);
|
|
20222
|
+
allowed.push("file", "content-type");
|
|
20223
|
+
requiredValue(flags, "file");
|
|
20224
|
+
requiredValue(flags, "content-type");
|
|
20225
|
+
return () => setStationImage(eventId, stationId, async () => {
|
|
20226
|
+
const signed = await uploadPassportImage(eventId, "stations", flags);
|
|
20227
|
+
return signed.key;
|
|
20228
|
+
});
|
|
20229
|
+
};
|
|
20230
|
+
var createPassportMediaOperation = (action, context) => {
|
|
20231
|
+
const [first, second] = action.split(" ");
|
|
20232
|
+
if (first === "skin" && second)
|
|
20233
|
+
return createSkinOperation(second, context);
|
|
20234
|
+
if (first === "station" && second)
|
|
20235
|
+
return createStationImageOperation(second, context);
|
|
20236
|
+
return null;
|
|
20237
|
+
};
|
|
20238
|
+
|
|
19844
20239
|
// src/commands/passport.ts
|
|
19845
20240
|
var flag = (flags, name, required = true) => {
|
|
19846
20241
|
const value = flags.get(name);
|
|
@@ -20005,14 +20400,15 @@ var parsePassportSettingsInput = (raw, eventId) => {
|
|
|
20005
20400
|
let loginMethods;
|
|
20006
20401
|
if (value.loginMethods !== undefined) {
|
|
20007
20402
|
const methods = object2(value.loginMethods, "loginMethods");
|
|
20008
|
-
keys(methods, ["emailOtp", "google", "guest", "staffId"], "loginMethods");
|
|
20009
|
-
if (typeof methods.emailOtp !== "boolean" || typeof methods.google !== "boolean" || typeof methods.guest !== "boolean" || methods.staffId !== undefined && typeof methods.staffId !== "boolean")
|
|
20403
|
+
keys(methods, ["emailOtp", "google", "guest", "staffId", "staffIdRequiresLastName"], "loginMethods");
|
|
20404
|
+
if (typeof methods.emailOtp !== "boolean" || typeof methods.google !== "boolean" || typeof methods.guest !== "boolean" || methods.staffId !== undefined && typeof methods.staffId !== "boolean" || methods.staffIdRequiresLastName !== undefined && typeof methods.staffIdRequiresLastName !== "boolean")
|
|
20010
20405
|
throw new CliUsageError("loginMethods values must be JSON booleans.");
|
|
20011
20406
|
loginMethods = {
|
|
20012
20407
|
emailOtp: methods.emailOtp,
|
|
20013
20408
|
google: methods.google,
|
|
20014
20409
|
guest: methods.guest,
|
|
20015
|
-
staffId: methods.staffId === true
|
|
20410
|
+
staffId: methods.staffId === true,
|
|
20411
|
+
staffIdRequiresLastName: methods.staffIdRequiresLastName !== false
|
|
20016
20412
|
};
|
|
20017
20413
|
if (!loginMethods.emailOtp && !loginMethods.google && !loginMethods.staffId)
|
|
20018
20414
|
throw new CliUsageError("Keep email OTP, Google or Staff ID available for recovery.");
|
|
@@ -20031,11 +20427,13 @@ var parsePassportSettingsInput = (raw, eventId) => {
|
|
|
20031
20427
|
var parsePassportRosterEntryInput = (raw, eventId) => {
|
|
20032
20428
|
const value = json(raw, "--entry-json");
|
|
20033
20429
|
keys(value, ["id", "staffId", "lastName", "displayName"], "Roster entry");
|
|
20430
|
+
if (value.lastName === undefined)
|
|
20431
|
+
throw new CliUsageError("lastName is required (use null for none).");
|
|
20034
20432
|
return {
|
|
20035
20433
|
eventId,
|
|
20036
20434
|
...value.id === undefined ? {} : { id: text(value.id, "id", 200) },
|
|
20037
20435
|
staffId: text(value.staffId, "staffId", 64),
|
|
20038
|
-
lastName:
|
|
20436
|
+
lastName: nullableText(value.lastName, "lastName", 100) || null,
|
|
20039
20437
|
displayName: nullableText(value.displayName, "displayName", 100) || null
|
|
20040
20438
|
};
|
|
20041
20439
|
};
|
|
@@ -20046,7 +20444,7 @@ var headerIndex = (headers, name) => {
|
|
|
20046
20444
|
throw new CliUsageError(`Column "${name}" is not in the file. Headers: ${headers.join(", ")}.`);
|
|
20047
20445
|
return index;
|
|
20048
20446
|
};
|
|
20049
|
-
var resolvePassportRosterMapping = (headers, flags) => {
|
|
20447
|
+
var resolvePassportRosterMapping = (headers, flags, requireLastName) => {
|
|
20050
20448
|
const guess = guessPassportRosterMapping(headers);
|
|
20051
20449
|
const column = (name, fallback) => {
|
|
20052
20450
|
const value = flag(flags, name, false);
|
|
@@ -20065,19 +20463,23 @@ var resolvePassportRosterMapping = (headers, flags) => {
|
|
|
20065
20463
|
displayName: column("display-name-column", guess.displayName),
|
|
20066
20464
|
surnamePosition: position
|
|
20067
20465
|
};
|
|
20068
|
-
if (mapping.lastName === null && mapping.fullName === null)
|
|
20466
|
+
if (requireLastName && mapping.lastName === null && mapping.fullName === null)
|
|
20069
20467
|
throw new CliUsageError("Map a last-name column (--last-name-column) or a full-name column (--full-name-column).");
|
|
20070
20468
|
return mapping;
|
|
20071
20469
|
};
|
|
20072
|
-
var readRosterRows = async (path, flags) => {
|
|
20470
|
+
var readRosterRows = async (path, flags, requireLastName) => {
|
|
20073
20471
|
let table;
|
|
20074
20472
|
try {
|
|
20075
|
-
table = await readSpreadsheetTable(
|
|
20473
|
+
table = await readSpreadsheetTable(basename3(path), await readFile5(path));
|
|
20076
20474
|
} catch (error) {
|
|
20077
20475
|
throw new CliUsageError(`Could not read ${path}: ${error instanceof Error ? error.message : "unknown error"}`);
|
|
20078
20476
|
}
|
|
20079
|
-
const mapping = resolvePassportRosterMapping(table[0] ?? [], flags);
|
|
20080
|
-
|
|
20477
|
+
const mapping = resolvePassportRosterMapping(table[0] ?? [], flags, requireLastName);
|
|
20478
|
+
try {
|
|
20479
|
+
return mapPassportRosterTable(table, mapping, { requireLastName });
|
|
20480
|
+
} catch (error) {
|
|
20481
|
+
throw new CliUsageError(`Could not import ${path}: ${error instanceof Error ? error.message : "unknown error"}`);
|
|
20482
|
+
}
|
|
20081
20483
|
};
|
|
20082
20484
|
var optionalEntry = (key, value, parse) => value === undefined ? {} : { [key]: parse(value) };
|
|
20083
20485
|
var runPassportCommand = async (input) => {
|
|
@@ -20116,6 +20518,17 @@ var runPassportCommand = async (input) => {
|
|
|
20116
20518
|
case "bingo status":
|
|
20117
20519
|
operation = () => api2.event.passport.getMyPassportBingo.query(event);
|
|
20118
20520
|
break;
|
|
20521
|
+
case "bingo rename": {
|
|
20522
|
+
allowed.push("name");
|
|
20523
|
+
const parsed = renamePassportBingoSchema.safeParse({
|
|
20524
|
+
eventId,
|
|
20525
|
+
name: requiredFlag(flags, "name")
|
|
20526
|
+
});
|
|
20527
|
+
if (!parsed.success)
|
|
20528
|
+
throw new CliUsageError(`--name ${parsed.error.issues[0]?.message ?? "is invalid"}.`);
|
|
20529
|
+
operation = () => api2.event.passport.renamePassportBingo.mutate(parsed.data);
|
|
20530
|
+
break;
|
|
20531
|
+
}
|
|
20119
20532
|
case "login-options":
|
|
20120
20533
|
operation = () => api2.event.passport.getPassportLoginOptions.query(event);
|
|
20121
20534
|
break;
|
|
@@ -20336,10 +20749,13 @@ var runPassportCommand = async (input) => {
|
|
|
20336
20749
|
case "roster import": {
|
|
20337
20750
|
allowed.push("file", "staff-id-column", "last-name-column", "full-name-column", "display-name-column", "surname-position");
|
|
20338
20751
|
const path = requiredFlag(flags, "file");
|
|
20339
|
-
operation = async () =>
|
|
20340
|
-
|
|
20341
|
-
|
|
20342
|
-
|
|
20752
|
+
operation = async () => {
|
|
20753
|
+
const { loginMethods } = await api2.event.passport.getPassportLoginOptions.query(event);
|
|
20754
|
+
return api2.event.passport.importPassportRoster.mutate({
|
|
20755
|
+
eventId,
|
|
20756
|
+
rows: await readRosterRows(path, flags, loginMethods.staffIdRequiresLastName)
|
|
20757
|
+
});
|
|
20758
|
+
};
|
|
20343
20759
|
break;
|
|
20344
20760
|
}
|
|
20345
20761
|
case "tally summary":
|
|
@@ -20349,8 +20765,16 @@ var runPassportCommand = async (input) => {
|
|
|
20349
20765
|
allowed.push("station-id");
|
|
20350
20766
|
operation = () => api2.event.passport.getPassportStationTallies.query(station());
|
|
20351
20767
|
break;
|
|
20352
|
-
default:
|
|
20353
|
-
|
|
20768
|
+
default: {
|
|
20769
|
+
const mediaOperation = createPassportMediaOperation(action, {
|
|
20770
|
+
eventId,
|
|
20771
|
+
flags,
|
|
20772
|
+
allowed
|
|
20773
|
+
});
|
|
20774
|
+
if (!mediaOperation)
|
|
20775
|
+
throw new CliUsageError("Unknown passport command. Run et --help for supported commands.");
|
|
20776
|
+
operation = mediaOperation;
|
|
20777
|
+
}
|
|
20354
20778
|
}
|
|
20355
20779
|
const unknown = [...flags.keys()].filter((key) => key !== "api-url" && !allowed.includes(key));
|
|
20356
20780
|
if (unknown.length)
|
|
@@ -23240,10 +23664,6 @@ var command_manifest_default = [
|
|
|
23240
23664
|
correctAnswer: {
|
|
23241
23665
|
type: "string",
|
|
23242
23666
|
maxLength: 100
|
|
23243
|
-
},
|
|
23244
|
-
manualReview: {
|
|
23245
|
-
default: false,
|
|
23246
|
-
type: "boolean"
|
|
23247
23667
|
}
|
|
23248
23668
|
},
|
|
23249
23669
|
required: ["name"]
|
|
@@ -23307,10 +23727,6 @@ var command_manifest_default = [
|
|
|
23307
23727
|
type: "string",
|
|
23308
23728
|
maxLength: 100
|
|
23309
23729
|
},
|
|
23310
|
-
manualReview: {
|
|
23311
|
-
default: false,
|
|
23312
|
-
type: "boolean"
|
|
23313
|
-
},
|
|
23314
23730
|
id: {
|
|
23315
23731
|
type: "string",
|
|
23316
23732
|
minLength: 1
|
|
@@ -23667,7 +24083,7 @@ var registryFlags = [
|
|
|
23667
24083
|
"target"
|
|
23668
24084
|
];
|
|
23669
24085
|
var isoDateTimePattern = /^\d{4}-\d\d-\d\dT\d\d:\d\d/;
|
|
23670
|
-
var
|
|
24086
|
+
var isRecord3 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
23671
24087
|
var commandName = (entry) => `et ${entry.path.join(" ")}`;
|
|
23672
24088
|
var findManifestEntry = (positionals) => manifest.find((entry) => entry.path.length === positionals.length && entry.path.every((segment, index) => positionals[index] === segment));
|
|
23673
24089
|
var listRegistryCommands = () => manifest.map((entry) => ({
|
|
@@ -23691,7 +24107,7 @@ var coerceDateAt = (value, segments, label) => {
|
|
|
23691
24107
|
const apply = (child) => isArray ? Array.isArray(child) ? child.map((item) => coerceDateAt(item, rest, label)) : child : coerceDateAt(child, rest, label);
|
|
23692
24108
|
if (key === "")
|
|
23693
24109
|
return apply(value);
|
|
23694
|
-
if (!
|
|
24110
|
+
if (!isRecord3(value) || !(key in value))
|
|
23695
24111
|
return value;
|
|
23696
24112
|
return { ...value, [key]: apply(value[key]) };
|
|
23697
24113
|
};
|
|
@@ -23717,7 +24133,7 @@ var readInput = async (parsed, entry) => {
|
|
|
23717
24133
|
} catch {
|
|
23718
24134
|
throw new CliUsageError("--input must be valid JSON.");
|
|
23719
24135
|
}
|
|
23720
|
-
if (!
|
|
24136
|
+
if (!isRecord3(value)) {
|
|
23721
24137
|
throw new CliUsageError("--input must be a JSON object.");
|
|
23722
24138
|
}
|
|
23723
24139
|
return coerceDates(value, entry.dates);
|
|
@@ -23740,7 +24156,7 @@ var assertConfirmed = (parsed, entry, input) => {
|
|
|
23740
24156
|
}
|
|
23741
24157
|
if (!entry.target)
|
|
23742
24158
|
return;
|
|
23743
|
-
const expected = targetText(
|
|
24159
|
+
const expected = targetText(isRecord3(input) ? input[entry.target] : undefined);
|
|
23744
24160
|
if (expected === undefined) {
|
|
23745
24161
|
throw new CliUsageError(`--input must include ${entry.target} so the target can be confirmed.`);
|
|
23746
24162
|
}
|
|
@@ -24151,11 +24567,11 @@ var runEventAppearanceUpload = async ({
|
|
|
24151
24567
|
const filePath = getRequiredFlag(parsed, "file");
|
|
24152
24568
|
const contentType = getRequiredFlag(parsed, "content-type");
|
|
24153
24569
|
const mediaType = parseAppearanceMediaType(getRequiredFlag(parsed, "media-type"));
|
|
24154
|
-
const file = await
|
|
24570
|
+
const file = await readFile6(filePath);
|
|
24155
24571
|
await ensureAuthentication();
|
|
24156
24572
|
const signed = await api2.attachment.getPresignedUrlToUpload.mutate({
|
|
24157
24573
|
folder: `event-appearance/${mediaType === "image" ? "images" : "videos"}`,
|
|
24158
|
-
fileName:
|
|
24574
|
+
fileName: basename4(filePath),
|
|
24159
24575
|
contentType,
|
|
24160
24576
|
size: file.byteLength,
|
|
24161
24577
|
eventId
|