@go-labs-sg/event-tech 1.10.0 → 1.12.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 +104 -11
- package/command-reference.md +23 -6
- package/dist/index.js +726 -100
- package/package.json +1 -1
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) {
|
|
@@ -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)
|
|
@@ -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);
|
|
@@ -17847,7 +17847,7 @@ AsyncGenerator.prototype[typeof Symbol == "function" && Symbol.asyncIterator ||
|
|
|
17847
17847
|
};
|
|
17848
17848
|
var trackedSymbol = Symbol();
|
|
17849
17849
|
|
|
17850
|
-
// ../../../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
|
|
17851
17851
|
function isTRPCClientError(cause) {
|
|
17852
17852
|
return cause instanceof TRPCClientError;
|
|
17853
17853
|
}
|
|
@@ -17893,7 +17893,7 @@ var TRPCClientError = class TRPCClientError extends Error {
|
|
|
17893
17893
|
}
|
|
17894
17894
|
};
|
|
17895
17895
|
|
|
17896
|
-
// ../../../node_modules/.bun/@trpc+client@11.
|
|
17896
|
+
// ../../../node_modules/.bun/@trpc+client@11.28.0+86c0a2ff0813b553/node_modules/@trpc/client/dist/unstable-internals.mjs
|
|
17897
17897
|
function getTransformer(transformer) {
|
|
17898
17898
|
const _transformer = transformer;
|
|
17899
17899
|
if (!_transformer)
|
|
@@ -17915,7 +17915,7 @@ function getTransformer(transformer) {
|
|
|
17915
17915
|
};
|
|
17916
17916
|
}
|
|
17917
17917
|
|
|
17918
|
-
// ../../../node_modules/.bun/@trpc+client@11.
|
|
17918
|
+
// ../../../node_modules/.bun/@trpc+client@11.28.0+86c0a2ff0813b553/node_modules/@trpc/client/dist/httpUtils-CtMuyl9j.mjs
|
|
17919
17919
|
var isFunction2 = (fn) => typeof fn === "function";
|
|
17920
17920
|
function getFetch(customFetchImpl) {
|
|
17921
17921
|
if (customFetchImpl)
|
|
@@ -17963,6 +17963,23 @@ function raceAbortSignalsWithCleanup(...signals) {
|
|
|
17963
17963
|
cleanup
|
|
17964
17964
|
};
|
|
17965
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
|
+
};
|
|
17966
17983
|
function resolveHTTPLinkOptions(opts) {
|
|
17967
17984
|
return {
|
|
17968
17985
|
url: opts.url.toString(),
|
|
@@ -18018,23 +18035,6 @@ var jsonHttpRequester = (opts) => {
|
|
|
18018
18035
|
getBody
|
|
18019
18036
|
}));
|
|
18020
18037
|
};
|
|
18021
|
-
var AbortError = class extends Error {
|
|
18022
|
-
constructor() {
|
|
18023
|
-
const name = "AbortError";
|
|
18024
|
-
super(name);
|
|
18025
|
-
this.name = name;
|
|
18026
|
-
this.message = name;
|
|
18027
|
-
}
|
|
18028
|
-
};
|
|
18029
|
-
var throwIfAborted = (signal) => {
|
|
18030
|
-
var _signal$throwIfAborte;
|
|
18031
|
-
if (!(signal === null || signal === undefined ? undefined : signal.aborted))
|
|
18032
|
-
return;
|
|
18033
|
-
(_signal$throwIfAborte = signal.throwIfAborted) === null || _signal$throwIfAborte === undefined || _signal$throwIfAborte.call(signal);
|
|
18034
|
-
if (typeof DOMException !== "undefined")
|
|
18035
|
-
throw new DOMException("AbortError", "AbortError");
|
|
18036
|
-
throw new AbortError;
|
|
18037
|
-
};
|
|
18038
18038
|
async function fetchHTTPResponse(opts) {
|
|
18039
18039
|
var _opts$methodOverride, _opts$trpcAcceptHeade;
|
|
18040
18040
|
throwIfAborted(opts.signal);
|
|
@@ -18068,7 +18068,7 @@ async function httpRequest(opts) {
|
|
|
18068
18068
|
};
|
|
18069
18069
|
}
|
|
18070
18070
|
|
|
18071
|
-
// ../../../node_modules/.bun/@trpc+client@11.
|
|
18071
|
+
// ../../../node_modules/.bun/@trpc+client@11.28.0+86c0a2ff0813b553/node_modules/@trpc/client/dist/httpBatchLink-BkVNtNND.mjs
|
|
18072
18072
|
var throwFatalError = () => {
|
|
18073
18073
|
throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new");
|
|
18074
18074
|
};
|
|
@@ -18263,7 +18263,7 @@ function httpBatchLink(opts) {
|
|
|
18263
18263
|
};
|
|
18264
18264
|
}
|
|
18265
18265
|
|
|
18266
|
-
// ../../../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
|
|
18267
18267
|
var resultOf = (value, ...args) => {
|
|
18268
18268
|
return typeof value === "function" ? value(...args) : value;
|
|
18269
18269
|
};
|
|
@@ -18416,7 +18416,7 @@ var WsConnection = class WsConnection {
|
|
|
18416
18416
|
};
|
|
18417
18417
|
_defineProperty(WsConnection, "connectCount", 0);
|
|
18418
18418
|
|
|
18419
|
-
// ../../../node_modules/.bun/@trpc+client@11.
|
|
18419
|
+
// ../../../node_modules/.bun/@trpc+client@11.28.0+86c0a2ff0813b553/node_modules/@trpc/client/dist/index.mjs
|
|
18420
18420
|
var observerKeys = [
|
|
18421
18421
|
"onStarted",
|
|
18422
18422
|
"onData",
|
|
@@ -18751,6 +18751,7 @@ var booleanFlags = new Set([
|
|
|
18751
18751
|
"dry-run",
|
|
18752
18752
|
"help",
|
|
18753
18753
|
"no-browser",
|
|
18754
|
+
"password-stdin",
|
|
18754
18755
|
"public",
|
|
18755
18756
|
"version"
|
|
18756
18757
|
]);
|
|
@@ -18916,12 +18917,25 @@ Usage:
|
|
|
18916
18917
|
et passport mine --event-id <id>
|
|
18917
18918
|
et passport login-options --event-id <id>
|
|
18918
18919
|
et passport bingo enable --event-id <id> (host: creates the hidden Bingo station and the HumanBingo)
|
|
18920
|
+
et passport bingo rename --event-id <id> --name <name> (host: the game's display name guests see; 1-100 chars, default "Human Bingo")
|
|
18919
18921
|
et passport bingo join --event-id <id> (guest, passport participants only)
|
|
18920
18922
|
et passport bingo claim-stamp --event-id <id> (guest: catch-up award for a completed card)
|
|
18921
18923
|
et passport bingo status --event-id <id> (guest: own bingo progress and stamp)
|
|
18922
18924
|
et passport export --event-id <id>
|
|
18923
|
-
et passport settings update --event-id <id> --settings-json <json> (maxRedemptionsPerParticipant 0 = no cap)
|
|
18925
|
+
et passport settings update --event-id <id> --settings-json <json> (maxRedemptionsPerParticipant 0 = no cap; optional guestScan true|false)
|
|
18924
18926
|
et passport station upsert --event-id <id> --station-json <json> (collection.stampValue 0-1000, default 1; collection.category GAME|FOOD|DRINK|BINGO, default GAME)
|
|
18927
|
+
et passport station-access get --event-id <id>
|
|
18928
|
+
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)
|
|
18929
|
+
et passport station-access clear-password --event-id <id> --allow-state-change --target <same-event-id> (turns station links off; ends every station session)
|
|
18930
|
+
et passport stamps stats --event-id <id>
|
|
18931
|
+
et passport stamps recipients --event-id <id> --station-id <id> [--search <text>] [--limit <1-100>] [--cursor <cursor>] [--direction <forward|backward>]
|
|
18932
|
+
et passport stamps recipient-counts --event-id <id> --station-id <id> [--search <text>]
|
|
18933
|
+
et passport skin get --event-id <id>
|
|
18934
|
+
et passport skin set --event-id <id> --appearance-version <n> --skin-json <json>
|
|
18935
|
+
et passport skin clear --event-id <id> --appearance-version <n>
|
|
18936
|
+
et passport skin upload --event-id <id> --kind <hero|logo> --file <path> --content-type <image-mime>
|
|
18937
|
+
et passport station image-set --event-id <id> --station-id <id> --file <path> --content-type <image-mime>
|
|
18938
|
+
et passport station image-clear --event-id <id> --station-id <id>
|
|
18925
18939
|
et passport station hidden --event-id <id> --station-id <id> --hidden <true|false>
|
|
18926
18940
|
et passport station archive --event-id <id> --station-id <id> --allow-state-change --target <same-event-id>
|
|
18927
18941
|
et passport station print-get --event-id <id> --station-id <id>
|
|
@@ -18945,7 +18959,7 @@ Usage:
|
|
|
18945
18959
|
et passport roster list --event-id <id> [--search <text>] [--limit <1-100>] [--cursor <cursor>]
|
|
18946
18960
|
et passport roster counts --event-id <id> [--search <text>]
|
|
18947
18961
|
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>]
|
|
18948
|
-
et passport roster upsert --event-id <id> --entry-json <json> ({id?,staffId,lastName,displayName})
|
|
18962
|
+
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)
|
|
18949
18963
|
et passport roster remove --event-id <id> --entry-id <id> --allow-state-change --target <same-event-id>
|
|
18950
18964
|
et passport roster purge --event-id <id> --allow-state-change --target <same-event-id>
|
|
18951
18965
|
|
|
@@ -18956,18 +18970,40 @@ Event Passport:
|
|
|
18956
18970
|
Include collection.maxPoints only for STAFF_SCORE; zero is a valid score.
|
|
18957
18971
|
collection.category groups stations for guests: GAME, FOOD, DRINK or BINGO. Omit it to keep the stored one.
|
|
18958
18972
|
Omit collection on an existing station to preserve its current mode.
|
|
18959
|
-
Station JSON supports id/name/description/location/imageKey/order/opensAt/closesAt/collection.
|
|
18973
|
+
Station JSON supports id/name/description/location/address/imageKey/order/opensAt/closesAt/collection.
|
|
18974
|
+
location is the in-venue spot ("Level 2 pantry"); address is the street or site address (up to 300 chars, null clears it, omit keeps it).
|
|
18975
|
+
Station links: one shared password per passport lets staff without accounts open /events/<id>/event-passport/station,
|
|
18976
|
+
pick a station and stamp guests. station-access get shows whether a password is set and how many station sessions are
|
|
18977
|
+
active; set-password (stdin only) and clear-password both end every existing station session; no password means links are
|
|
18978
|
+
off. stamps stats reports per-station stamp counts; stamps recipients lists who each station stamped and how
|
|
18979
|
+
(issuedBy.kind: participant self-scan, station-link, staff by name, or bingo for a bingo award; page with
|
|
18980
|
+
--cursor, backward needs a cursor). Station sessions themselves are browser-only.
|
|
18981
|
+
Station cover art: image-set uploads a jpeg/png/webp/gif (up to 25 MB) to the event's station-art folder and
|
|
18982
|
+
saves it as the station's imageKey, keeping every other station setting; image-clear removes it. A new
|
|
18983
|
+
imageKey given in station JSON must be an upload to this event's event-passport/stations folder.
|
|
18984
|
+
Passport skin (optional per-event look; no skin renders the Go Labs default): lives in the event
|
|
18985
|
+
appearance as the optional passport block {heroImage:{key,focalX,focalY}|null, logo:{key}|null,
|
|
18986
|
+
colors:{graphic,dark}, emphasis:accent|ink}. skin get reads it with the version and image URLs.
|
|
18987
|
+
skin set is a version-fenced merge patch: --skin-json '{"heroImage":{"focalX":30}}' changes only the
|
|
18988
|
+
focal point; null clears heroImage or logo. skin upload --kind hero|logo returns the key to reference
|
|
18989
|
+
in skin set. skin clear returns the event to the Go Labs default look and keeps the rest of the appearance.
|
|
18990
|
+
Other appearance saves that omit passport keep the stored skin. colors.dark needs 4.5:1 contrast with white.
|
|
18960
18991
|
Date-time fields are ISO strings or null; order defaults to zero.
|
|
18961
18992
|
Settings JSON requires linkedDrawEventId, luckyDrawStampThreshold, prizeStampThreshold,
|
|
18962
|
-
maxRedemptionsPerParticipant; optional loginMethods is {emailOtp,google,guest,staffId}.
|
|
18963
|
-
Keep email OTP, Google or Staff ID enabled for recovery; staffId defaults to false
|
|
18964
|
-
|
|
18993
|
+
maxRedemptionsPerParticipant; optional loginMethods is {emailOtp,google,guest,staffId,staffIdRequiresLastName}.
|
|
18994
|
+
Keep email OTP, Google or Staff ID enabled for recovery; staffId defaults to false and
|
|
18995
|
+
staffIdRequiresLastName to true, so set it false again whenever you resend loginMethods.
|
|
18996
|
+
Omit loginMethods to preserve it. Optional guestScan (boolean) turns guest station QR scanning
|
|
18997
|
+
on or off; omit it to keep the stored value (absent means on). When off, guests cannot self-scan
|
|
18998
|
+
(staff and station crew still stamp) and the guest passport hides the Scan tab. overview shows
|
|
18999
|
+
passport.guestScan and mine shows settings.guestScanEnabled.
|
|
18965
19000
|
Staff roster (event hosts only): import replaces the roster and returns imported, replaced and
|
|
18966
19001
|
rejected rows (blank, too long, or a Staff ID repeated in the file). Columns are matched from
|
|
18967
19002
|
header names; override with the column flags. Without a last-name column, the last name is
|
|
18968
19003
|
taken from the full name (--surname-position last|first, default last). Files over 20,000 data
|
|
18969
|
-
rows or 200 columns, or with no importable rows, are refused and the roster is unchanged.
|
|
18970
|
-
|
|
19004
|
+
rows or 200 columns, or with no importable rows, are refused and the roster is unchanged. A blank
|
|
19005
|
+
last name is rejected only when the event requires one; counts reports missingLastNameCount.
|
|
19006
|
+
Staff ID sign-in matches case-insensitively, ignoring spaces and punctuation, and needs the browser.
|
|
18971
19007
|
Printed QR issue/revoke requires the last observed print version; stale versions conflict.
|
|
18972
19008
|
claim scans a station QR; collect scans a participant profile QR as an event operator.
|
|
18973
19009
|
Repeat scans never add a second stamp or change its original points.
|
|
@@ -19425,8 +19461,8 @@ var runLuckyDrawSetupCommand = async (input) => {
|
|
|
19425
19461
|
};
|
|
19426
19462
|
|
|
19427
19463
|
// src/commands/passport.ts
|
|
19428
|
-
import { readFile as
|
|
19429
|
-
import { basename as
|
|
19464
|
+
import { readFile as readFile5 } from "fs/promises";
|
|
19465
|
+
import { basename as basename3 } from "path";
|
|
19430
19466
|
|
|
19431
19467
|
// ../utils/src/lib/spreadsheet-table.ts
|
|
19432
19468
|
var import_jszip = __toESM(require_lib3(), 1);
|
|
@@ -19584,17 +19620,59 @@ var passportTallyItemsSchema = array(string2().trim().min(1).max(PASSPORT_TALLY_
|
|
|
19584
19620
|
seen.add(key);
|
|
19585
19621
|
});
|
|
19586
19622
|
});
|
|
19623
|
+
var PASSPORT_STATION_INFO_SUBTITLE_MAX = 80;
|
|
19624
|
+
var PASSPORT_STATION_INFO_STEPS_MAX = 8;
|
|
19625
|
+
var PASSPORT_STATION_INFO_STEP_MAX = 160;
|
|
19626
|
+
var PASSPORT_STATION_INFO_MENU_MAX = 15;
|
|
19627
|
+
var PASSPORT_STATION_INFO_MENU_NAME_MAX = 80;
|
|
19628
|
+
var PASSPORT_STATION_INFO_MENU_DETAIL_MAX = 200;
|
|
19629
|
+
var PASSPORT_STATION_INFO_NOTE_MAX = 240;
|
|
19630
|
+
var optionalInfoText = (maximum) => string2().trim().max(maximum).optional().transform((value) => value || undefined);
|
|
19631
|
+
var passportStationInfoStepsSchema = array(string2().trim().max(PASSPORT_STATION_INFO_STEP_MAX)).transform((steps) => steps.filter((step) => step !== "")).pipe(array(string2()).max(PASSPORT_STATION_INFO_STEPS_MAX)).transform((steps) => steps.length > 0 ? steps : undefined);
|
|
19632
|
+
var passportStationInfoMenuSchema = array(object({
|
|
19633
|
+
name: string2().trim().max(PASSPORT_STATION_INFO_MENU_NAME_MAX),
|
|
19634
|
+
detail: optionalInfoText(PASSPORT_STATION_INFO_MENU_DETAIL_MAX),
|
|
19635
|
+
contains: optionalInfoText(PASSPORT_STATION_INFO_MENU_DETAIL_MAX)
|
|
19636
|
+
})).transform((rows) => rows.filter((row) => row.name !== "" || row.detail || row.contains).map(({ name, detail, contains }) => ({
|
|
19637
|
+
name,
|
|
19638
|
+
...detail ? { detail } : {},
|
|
19639
|
+
...contains ? { contains } : {}
|
|
19640
|
+
}))).pipe(array(object({
|
|
19641
|
+
name: string2().min(1, "Menu items need a name."),
|
|
19642
|
+
detail: string2().optional(),
|
|
19643
|
+
contains: string2().optional()
|
|
19644
|
+
})).max(PASSPORT_STATION_INFO_MENU_MAX)).transform((rows) => rows.length > 0 ? rows : undefined);
|
|
19645
|
+
var passportStationInfoSchema = object({
|
|
19646
|
+
subtitle: optionalInfoText(PASSPORT_STATION_INFO_SUBTITLE_MAX),
|
|
19647
|
+
steps: passportStationInfoStepsSchema.optional(),
|
|
19648
|
+
menu: passportStationInfoMenuSchema.optional(),
|
|
19649
|
+
note: optionalInfoText(PASSPORT_STATION_INFO_NOTE_MAX)
|
|
19650
|
+
}).transform((info) => {
|
|
19651
|
+
const normalised = {
|
|
19652
|
+
...info.subtitle ? { subtitle: info.subtitle } : {},
|
|
19653
|
+
...info.steps ? { steps: info.steps } : {},
|
|
19654
|
+
...info.menu ? { menu: info.menu } : {},
|
|
19655
|
+
...info.note ? { note: info.note } : {}
|
|
19656
|
+
};
|
|
19657
|
+
return Object.keys(normalised).length > 0 ? normalised : undefined;
|
|
19658
|
+
});
|
|
19659
|
+
var passportStationInfoInputSchema = union([
|
|
19660
|
+
_null3(),
|
|
19661
|
+
passportStationInfoSchema.transform((info) => info ?? null)
|
|
19662
|
+
]);
|
|
19587
19663
|
var passportLoginMethodsSchema = object({
|
|
19588
19664
|
emailOtp: boolean2(),
|
|
19589
19665
|
google: boolean2(),
|
|
19590
19666
|
guest: boolean2(),
|
|
19591
|
-
staffId: boolean2().default(false)
|
|
19667
|
+
staffId: boolean2().default(false),
|
|
19668
|
+
staffIdRequiresLastName: boolean2().default(true)
|
|
19592
19669
|
}).strict().refine((methods) => methods.emailOtp || methods.google || methods.staffId, {
|
|
19593
19670
|
message: "Keep email OTP, Google or Staff ID available for passport recovery."
|
|
19594
19671
|
});
|
|
19595
19672
|
var passportConfigSchema = object({
|
|
19596
19673
|
version: literal(1),
|
|
19597
|
-
loginMethods: passportLoginMethodsSchema
|
|
19674
|
+
loginMethods: passportLoginMethodsSchema,
|
|
19675
|
+
guestScan: boolean2().optional()
|
|
19598
19676
|
});
|
|
19599
19677
|
var passportStationConfigSchema = object({
|
|
19600
19678
|
version: literal(1),
|
|
@@ -19610,7 +19688,8 @@ var passportStationConfigSchema = object({
|
|
|
19610
19688
|
stampValue: stampValueSchema.optional(),
|
|
19611
19689
|
category: passportStationCategorySchema.optional(),
|
|
19612
19690
|
tallyItems: passportTallyItemsSchema.optional(),
|
|
19613
|
-
tallyEarnsStamp: boolean2().optional()
|
|
19691
|
+
tallyEarnsStamp: boolean2().optional(),
|
|
19692
|
+
info: passportStationInfoSchema.optional().catch(undefined)
|
|
19614
19693
|
}).superRefine((config, context) => {
|
|
19615
19694
|
const tally = config.collectionMode === "STAFF_TALLY";
|
|
19616
19695
|
if (tally && !config.tallyItems) {
|
|
@@ -19646,25 +19725,29 @@ var passportStationCollectionSchema = discriminatedUnion("collectionMode", [
|
|
|
19646
19725
|
object({
|
|
19647
19726
|
collectionMode: literal("SELF_SCAN"),
|
|
19648
19727
|
stampValue: stampValueSchema.optional(),
|
|
19649
|
-
category: passportStationCategorySchema.optional()
|
|
19728
|
+
category: passportStationCategorySchema.optional(),
|
|
19729
|
+
info: passportStationInfoInputSchema.optional()
|
|
19650
19730
|
}).strict(),
|
|
19651
19731
|
object({
|
|
19652
19732
|
collectionMode: literal("STAFF_SCAN"),
|
|
19653
19733
|
stampValue: stampValueSchema.optional(),
|
|
19654
|
-
category: passportStationCategorySchema.optional()
|
|
19734
|
+
category: passportStationCategorySchema.optional(),
|
|
19735
|
+
info: passportStationInfoInputSchema.optional()
|
|
19655
19736
|
}).strict(),
|
|
19656
19737
|
object({
|
|
19657
19738
|
collectionMode: literal("STAFF_SCORE"),
|
|
19658
19739
|
maxPoints: pointsSchema,
|
|
19659
19740
|
stampValue: stampValueSchema.optional(),
|
|
19660
|
-
category: passportStationCategorySchema.optional()
|
|
19741
|
+
category: passportStationCategorySchema.optional(),
|
|
19742
|
+
info: passportStationInfoInputSchema.optional()
|
|
19661
19743
|
}).strict(),
|
|
19662
19744
|
object({
|
|
19663
19745
|
collectionMode: literal("STAFF_TALLY"),
|
|
19664
19746
|
tallyItems: passportTallyItemsSchema,
|
|
19665
19747
|
tallyEarnsStamp: boolean2().default(false),
|
|
19666
19748
|
stampValue: stampValueSchema.optional(),
|
|
19667
|
-
category: passportStationCategorySchema.optional()
|
|
19749
|
+
category: passportStationCategorySchema.optional(),
|
|
19750
|
+
info: passportStationInfoInputSchema.optional()
|
|
19668
19751
|
}).strict()
|
|
19669
19752
|
]);
|
|
19670
19753
|
var passportEventIdSchema = object({ eventId: string2().min(1) });
|
|
@@ -19717,13 +19800,18 @@ var passportSettingsSchema = passportEventIdSchema.extend({
|
|
|
19717
19800
|
prizeStampThreshold: number2().int().positive().nullable(),
|
|
19718
19801
|
maxRedemptionsPerParticipant: number2().int().min(0).max(2147483647),
|
|
19719
19802
|
linkedDrawEventId: string2().min(1).nullable(),
|
|
19720
|
-
loginMethods: passportLoginMethodsSchema.optional()
|
|
19803
|
+
loginMethods: passportLoginMethodsSchema.optional(),
|
|
19804
|
+
guestScan: boolean2().optional()
|
|
19805
|
+
});
|
|
19806
|
+
var renamePassportBingoSchema = passportEventIdSchema.extend({
|
|
19807
|
+
name: string2().trim().min(1).max(100)
|
|
19721
19808
|
});
|
|
19722
19809
|
var passportStationSchema = passportEventIdSchema.extend({
|
|
19723
19810
|
id: string2().optional(),
|
|
19724
19811
|
name: string2().trim().min(1).max(100),
|
|
19725
19812
|
description: string2().trim().max(1000).nullable(),
|
|
19726
19813
|
location: string2().trim().max(200).nullable(),
|
|
19814
|
+
address: string2().trim().max(300).nullable().optional(),
|
|
19727
19815
|
imageKey: string2().nullable(),
|
|
19728
19816
|
order: number2().int().min(0),
|
|
19729
19817
|
opensAt: date2().nullable(),
|
|
@@ -19756,11 +19844,15 @@ var rosterStaffIdSchema = string2().trim().min(1, "Enter a Staff ID.").max(PASSP
|
|
|
19756
19844
|
var rosterLastNameSchema = string2().trim().min(1, "Enter a last name.").max(PASSPORT_ROSTER_NAME_MAX).refine((value) => normalizePassportRosterKey(value) !== "", {
|
|
19757
19845
|
message: "Last name needs at least one letter or digit."
|
|
19758
19846
|
});
|
|
19759
|
-
var
|
|
19847
|
+
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." });
|
|
19848
|
+
var passportStaffIdSignInSchema = passportEventIdSchema.extend({
|
|
19849
|
+
staffId: rosterStaffIdSchema,
|
|
19850
|
+
lastName: rosterLastNameSchema.optional()
|
|
19851
|
+
}).strict();
|
|
19760
19852
|
var passportRosterEntrySchema = passportEventIdSchema.extend({
|
|
19761
19853
|
id: string2().min(1).optional(),
|
|
19762
19854
|
staffId: rosterStaffIdSchema,
|
|
19763
|
-
lastName:
|
|
19855
|
+
lastName: rosterOptionalLastNameSchema,
|
|
19764
19856
|
displayName: string2().trim().max(PASSPORT_ROSTER_NAME_MAX).nullable().transform((value) => value || null)
|
|
19765
19857
|
}).strict();
|
|
19766
19858
|
var passportRosterEntryIdSchema = passportEventIdSchema.extend({ entryId: string2().min(1) }).strict();
|
|
@@ -19791,7 +19883,7 @@ var surnameOf = (fullName, position) => {
|
|
|
19791
19883
|
const words = fullName.split(/\s+/).filter(Boolean);
|
|
19792
19884
|
return (position === "first" ? words[0] : words.at(-1)) ?? "";
|
|
19793
19885
|
};
|
|
19794
|
-
var assertPassportRosterMapping = (mapping, columnCount) => {
|
|
19886
|
+
var assertPassportRosterMapping = (mapping, columnCount, requireLastName) => {
|
|
19795
19887
|
const columns = [
|
|
19796
19888
|
mapping.staffId,
|
|
19797
19889
|
mapping.lastName,
|
|
@@ -19800,11 +19892,11 @@ var assertPassportRosterMapping = (mapping, columnCount) => {
|
|
|
19800
19892
|
];
|
|
19801
19893
|
if (columns.some((index) => index !== null && (!Number.isInteger(index) || index < 0 || index >= columnCount)))
|
|
19802
19894
|
throw new Error("A mapped column is not in the file.");
|
|
19803
|
-
if (mapping.lastName === null && mapping.fullName === null)
|
|
19895
|
+
if (requireLastName && mapping.lastName === null && mapping.fullName === null)
|
|
19804
19896
|
throw new Error("Map a Last Name column or a Full Name column.");
|
|
19805
19897
|
};
|
|
19806
|
-
var mapPassportRosterTable = (table, mapping) => {
|
|
19807
|
-
assertPassportRosterMapping(mapping, table[0]?.length ?? 0);
|
|
19898
|
+
var mapPassportRosterTable = (table, mapping, { requireLastName }) => {
|
|
19899
|
+
assertPassportRosterMapping(mapping, table[0]?.length ?? 0, requireLastName);
|
|
19808
19900
|
const rows = [];
|
|
19809
19901
|
table.slice(1).forEach((row, index) => {
|
|
19810
19902
|
if (row.every((value) => value.trim() === ""))
|
|
@@ -19844,6 +19936,406 @@ var guessPassportRosterMapping = (headers) => {
|
|
|
19844
19936
|
};
|
|
19845
19937
|
};
|
|
19846
19938
|
|
|
19939
|
+
// ../validators/src/event-passport/passport-station-access.schema.ts
|
|
19940
|
+
var PASSPORT_STATION_PASSWORD_MIN = 6;
|
|
19941
|
+
var PASSPORT_STATION_PASSWORD_MAX = 128;
|
|
19942
|
+
var PASSPORT_STATION_RECIPIENTS_PAGE_MAX = 100;
|
|
19943
|
+
var stationStaffPasswordSchema = string2().min(PASSPORT_STATION_PASSWORD_MIN, `Use at least ${PASSPORT_STATION_PASSWORD_MIN} characters.`).max(PASSPORT_STATION_PASSWORD_MAX, `Use at most ${PASSPORT_STATION_PASSWORD_MAX} characters.`).refine((value) => value === value.trim(), {
|
|
19944
|
+
message: "Remove the spaces at the start or end of the password."
|
|
19945
|
+
});
|
|
19946
|
+
var signInToStationStaffSchema = passportEventIdSchema.extend({ password: string2().min(1).max(PASSPORT_STATION_PASSWORD_MAX) }).strict();
|
|
19947
|
+
var setPassportStationPasswordSchema = passportEventIdSchema.extend({ password: stationStaffPasswordSchema }).strict();
|
|
19948
|
+
var participantCodeSchema = string2().min(1).max(2048);
|
|
19949
|
+
var stationStaffParticipantSchema = union([
|
|
19950
|
+
passportStationIdSchema.extend({ profileCode: participantCodeSchema }),
|
|
19951
|
+
passportStationIdSchema.extend({
|
|
19952
|
+
staffId: string2().trim().min(1).max(PASSPORT_ROSTER_STAFF_ID_MAX)
|
|
19953
|
+
})
|
|
19954
|
+
]);
|
|
19955
|
+
var stationPrizeClaimParticipantSchema = union([
|
|
19956
|
+
passportEventIdSchema.extend({ profileCode: participantCodeSchema }),
|
|
19957
|
+
passportEventIdSchema.extend({
|
|
19958
|
+
staffId: string2().trim().min(1).max(PASSPORT_ROSTER_STAFF_ID_MAX)
|
|
19959
|
+
})
|
|
19960
|
+
]);
|
|
19961
|
+
var redeemPrizeAsStationStaffSchema = passportEventIdSchema.extend({ profileCode: participantCodeSchema, prizeId: string2().min(1) }).strict();
|
|
19962
|
+
var stationStampRecipientFiltersSchema = object({ search: string2().trim().max(200).optional() }).strict();
|
|
19963
|
+
var passportStationStampRecipientsSchema = passportStationIdSchema.extend({
|
|
19964
|
+
filters: stationStampRecipientFiltersSchema.default({}),
|
|
19965
|
+
limit: number2().int().min(1).max(PASSPORT_STATION_RECIPIENTS_PAGE_MAX).default(25),
|
|
19966
|
+
cursor: string2().min(1).max(8192).nullish(),
|
|
19967
|
+
direction: _enum(["forward", "backward"]).default("forward")
|
|
19968
|
+
}).strict().refine((input) => input.direction === "forward" || Boolean(input.cursor), {
|
|
19969
|
+
message: "A backward page needs a cursor.",
|
|
19970
|
+
path: ["cursor"]
|
|
19971
|
+
});
|
|
19972
|
+
var passportStationStampRecipientCountsSchema = passportStationIdSchema.extend({ filters: stationStampRecipientFiltersSchema.default({}) }).strict();
|
|
19973
|
+
|
|
19974
|
+
// src/commands/passport-media.ts
|
|
19975
|
+
import { readFile as readFile4 } from "fs/promises";
|
|
19976
|
+
import { basename as basename2 } from "path";
|
|
19977
|
+
|
|
19978
|
+
// ../utils/src/lib/event-s3-upload.ts
|
|
19979
|
+
var MAX_EVENT_IMAGE_UPLOAD_BYTES = 25 * 1024 * 1024;
|
|
19980
|
+
var MAX_EVENT_VIDEO_UPLOAD_BYTES = 200 * 1024 * 1024;
|
|
19981
|
+
var MAX_HUMAN_BINGO_MEDIA_UPLOAD_BYTES = 1024 * 1024 * 1024;
|
|
19982
|
+
var SAFE_IMAGE_CONTENT_TYPES = [
|
|
19983
|
+
"image/jpeg",
|
|
19984
|
+
"image/png",
|
|
19985
|
+
"image/webp",
|
|
19986
|
+
"image/gif"
|
|
19987
|
+
];
|
|
19988
|
+
var VIDEO_CONTENT_TYPES = [
|
|
19989
|
+
"video/mp4",
|
|
19990
|
+
"video/quicktime",
|
|
19991
|
+
"video/webm",
|
|
19992
|
+
"video/ogg"
|
|
19993
|
+
];
|
|
19994
|
+
var SAFE_EVENT_IMAGE_CONTENT_TYPES = [
|
|
19995
|
+
...SAFE_IMAGE_CONTENT_TYPES
|
|
19996
|
+
];
|
|
19997
|
+
var SAFE_EVENT_VIDEO_CONTENT_TYPES = [...VIDEO_CONTENT_TYPES];
|
|
19998
|
+
var SAFE_EVENT_UPLOAD_CONTENT_TYPES = [
|
|
19999
|
+
...SAFE_IMAGE_CONTENT_TYPES,
|
|
20000
|
+
...VIDEO_CONTENT_TYPES
|
|
20001
|
+
];
|
|
20002
|
+
var getEventPassportUploadBaseFolder = (kind) => `event-passport/${kind}`;
|
|
20003
|
+
|
|
20004
|
+
// ../utils/src/lib/event-theme.ts
|
|
20005
|
+
var EVENT_TECH_EVENT_TYPES = Object.values(EventType);
|
|
20006
|
+
var HEX_COLOR_PATTERN = /^#[0-9a-f]{6}$/i;
|
|
20007
|
+
var isEventThemeHexColor = (value) => HEX_COLOR_PATTERN.test(value);
|
|
20008
|
+
|
|
20009
|
+
// ../utils/src/lib/passport-skin.ts
|
|
20010
|
+
var DEFAULT_PASSPORT_SKIN_SETTINGS = {
|
|
20011
|
+
heroImage: null,
|
|
20012
|
+
logo: null,
|
|
20013
|
+
colors: { graphic: null, dark: null },
|
|
20014
|
+
emphasis: "accent"
|
|
20015
|
+
};
|
|
20016
|
+
var isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
20017
|
+
var toKey = (value) => typeof value === "string" && value.trim().length > 0 ? value.trim() : null;
|
|
20018
|
+
var toPercent = (value) => typeof value === "number" && Number.isFinite(value) ? Math.min(100, Math.max(0, value)) : 50;
|
|
20019
|
+
var toHex = (value) => typeof value === "string" && isEventThemeHexColor(value) ? value.toLowerCase() : null;
|
|
20020
|
+
var readHeroImage = (value) => {
|
|
20021
|
+
if (!isRecord(value))
|
|
20022
|
+
return null;
|
|
20023
|
+
const key = toKey(value.key);
|
|
20024
|
+
if (!key)
|
|
20025
|
+
return null;
|
|
20026
|
+
return {
|
|
20027
|
+
key,
|
|
20028
|
+
focalX: toPercent(value.focalX),
|
|
20029
|
+
focalY: toPercent(value.focalY)
|
|
20030
|
+
};
|
|
20031
|
+
};
|
|
20032
|
+
var readLogo = (value) => {
|
|
20033
|
+
if (!isRecord(value))
|
|
20034
|
+
return null;
|
|
20035
|
+
const key = toKey(value.key);
|
|
20036
|
+
return key ? { key } : null;
|
|
20037
|
+
};
|
|
20038
|
+
var resolvePassportSkinSettings = (value) => {
|
|
20039
|
+
if (!isRecord(value))
|
|
20040
|
+
return DEFAULT_PASSPORT_SKIN_SETTINGS;
|
|
20041
|
+
const colors = isRecord(value.colors) ? value.colors : {};
|
|
20042
|
+
return {
|
|
20043
|
+
heroImage: readHeroImage(value.heroImage),
|
|
20044
|
+
logo: readLogo(value.logo),
|
|
20045
|
+
colors: { graphic: toHex(colors.graphic), dark: toHex(colors.dark) },
|
|
20046
|
+
emphasis: value.emphasis === "ink" ? "ink" : "accent"
|
|
20047
|
+
};
|
|
20048
|
+
};
|
|
20049
|
+
var resolvePassportSkinSettingsFromAppearance = (appearance) => resolvePassportSkinSettings(isRecord(appearance) ? appearance.passport : undefined);
|
|
20050
|
+
|
|
20051
|
+
// ../validators/src/photo-wall-screen.schema.ts
|
|
20052
|
+
var photoWallScreenSchema = object({
|
|
20053
|
+
width: number2().int().min(240).max(16384),
|
|
20054
|
+
height: number2().int().min(240).max(16384)
|
|
20055
|
+
});
|
|
20056
|
+
|
|
20057
|
+
// ../validators/src/photo-wall-submission-settings.schema.ts
|
|
20058
|
+
var photoWallSubmissionSettingsSchema = object({
|
|
20059
|
+
mode: _enum(["photo-only", "comment-only", "photo-and-comment"]),
|
|
20060
|
+
photoRequired: boolean2(),
|
|
20061
|
+
commentRequired: boolean2()
|
|
20062
|
+
});
|
|
20063
|
+
var DEFAULT_PHOTO_WALL_SUBMISSION_SETTINGS = {
|
|
20064
|
+
mode: "photo-and-comment",
|
|
20065
|
+
photoRequired: true,
|
|
20066
|
+
commentRequired: false
|
|
20067
|
+
};
|
|
20068
|
+
|
|
20069
|
+
// ../validators/src/event-appearance.schema.ts
|
|
20070
|
+
var hexColorSchema = string2().trim().regex(/^#[0-9a-f]{6}$/i, "Color must be a six-digit hex color").transform((value) => value.toLowerCase());
|
|
20071
|
+
var getRelativeLuminance = (color) => {
|
|
20072
|
+
const toLinear = (channel) => {
|
|
20073
|
+
const normalized = channel / 255;
|
|
20074
|
+
return normalized <= 0.04045 ? normalized / 12.92 : ((normalized + 0.055) / 1.055) ** 2.4;
|
|
20075
|
+
};
|
|
20076
|
+
const red = toLinear(Number.parseInt(color.slice(1, 3), 16));
|
|
20077
|
+
const green = toLinear(Number.parseInt(color.slice(3, 5), 16));
|
|
20078
|
+
const blue = toLinear(Number.parseInt(color.slice(5, 7), 16));
|
|
20079
|
+
return 0.2126 * red + 0.7152 * green + 0.0722 * blue;
|
|
20080
|
+
};
|
|
20081
|
+
var hasReadableTextContrast = (textColor, backgroundColor) => {
|
|
20082
|
+
const textLuminance = getRelativeLuminance(textColor);
|
|
20083
|
+
const backgroundLuminance = getRelativeLuminance(backgroundColor);
|
|
20084
|
+
return (Math.max(textLuminance, backgroundLuminance) + 0.05) / (Math.min(textLuminance, backgroundLuminance) + 0.05) >= 4.5;
|
|
20085
|
+
};
|
|
20086
|
+
var eventThemeSchema = object({
|
|
20087
|
+
accentColor: hexColorSchema,
|
|
20088
|
+
backgroundColor: hexColorSchema,
|
|
20089
|
+
textColor: hexColorSchema,
|
|
20090
|
+
fontFamily: _enum(["SYSTEM", "JAKARTA", "SERIF"])
|
|
20091
|
+
}).superRefine((theme, context) => {
|
|
20092
|
+
if (!hasReadableTextContrast(theme.textColor, theme.backgroundColor)) {
|
|
20093
|
+
context.addIssue({
|
|
20094
|
+
code: "custom",
|
|
20095
|
+
message: "Text color must have at least 4.5:1 contrast on the background color",
|
|
20096
|
+
path: ["textColor"]
|
|
20097
|
+
});
|
|
20098
|
+
}
|
|
20099
|
+
});
|
|
20100
|
+
var appearanceMediaSchema = discriminatedUnion("type", [
|
|
20101
|
+
object({ type: literal("none"), key: _null3() }),
|
|
20102
|
+
object({ type: literal("image"), key: string2().min(1).max(1024) })
|
|
20103
|
+
]);
|
|
20104
|
+
var displayMediaSchema = discriminatedUnion("type", [
|
|
20105
|
+
object({ type: literal("none"), key: _null3() }),
|
|
20106
|
+
object({ type: literal("image"), key: string2().min(1).max(1024) }),
|
|
20107
|
+
object({ type: literal("video"), key: string2().min(1).max(1024) })
|
|
20108
|
+
]);
|
|
20109
|
+
var passportImageKeySchema = string2().trim().min(1).max(1024);
|
|
20110
|
+
var passportFocalSchema = number2().min(0).max(100);
|
|
20111
|
+
var passportSkinSchema = object({
|
|
20112
|
+
heroImage: object({
|
|
20113
|
+
key: passportImageKeySchema,
|
|
20114
|
+
focalX: passportFocalSchema.default(50),
|
|
20115
|
+
focalY: passportFocalSchema.default(50)
|
|
20116
|
+
}).nullable().default(null),
|
|
20117
|
+
logo: object({ key: passportImageKeySchema }).nullable().default(null),
|
|
20118
|
+
colors: object({
|
|
20119
|
+
graphic: hexColorSchema.nullable().default(null),
|
|
20120
|
+
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")
|
|
20121
|
+
}).default({ graphic: null, dark: null }),
|
|
20122
|
+
emphasis: _enum(["accent", "ink"]).default("accent")
|
|
20123
|
+
});
|
|
20124
|
+
var eventAppearanceSchema = object({
|
|
20125
|
+
version: literal(1),
|
|
20126
|
+
theme: eventThemeSchema,
|
|
20127
|
+
guestBackground: appearanceMediaSchema,
|
|
20128
|
+
displayBackground: displayMediaSchema,
|
|
20129
|
+
passport: passportSkinSchema.optional(),
|
|
20130
|
+
photoWall: object({
|
|
20131
|
+
durationSeconds: number2().int().min(10).max(40),
|
|
20132
|
+
maxVisible: number2().int().min(1).max(16),
|
|
20133
|
+
motion: _enum(["gentle", "lively", "roaming"]),
|
|
20134
|
+
showQrCode: boolean2(),
|
|
20135
|
+
qrCodeLabel: string2().trim().max(80, "QR code text must be 80 characters or fewer").transform((value) => value || "Scan to share").default("Scan to share"),
|
|
20136
|
+
showEventName: boolean2(),
|
|
20137
|
+
screen: photoWallScreenSchema.nullable().default(null),
|
|
20138
|
+
submission: photoWallSubmissionSettingsSchema.default(DEFAULT_PHOTO_WALL_SUBMISSION_SETTINGS)
|
|
20139
|
+
})
|
|
20140
|
+
});
|
|
20141
|
+
var DEFAULT_PASSPORT_SKIN = {
|
|
20142
|
+
heroImage: null,
|
|
20143
|
+
logo: null,
|
|
20144
|
+
colors: { graphic: null, dark: null },
|
|
20145
|
+
emphasis: "accent"
|
|
20146
|
+
};
|
|
20147
|
+
var DEFAULT_EVENT_APPEARANCE2 = {
|
|
20148
|
+
version: 1,
|
|
20149
|
+
theme: {
|
|
20150
|
+
accentColor: "#f84404",
|
|
20151
|
+
backgroundColor: "#f6f7f9",
|
|
20152
|
+
textColor: "#20242a",
|
|
20153
|
+
fontFamily: "SYSTEM"
|
|
20154
|
+
},
|
|
20155
|
+
guestBackground: { type: "none", key: null },
|
|
20156
|
+
displayBackground: { type: "none", key: null },
|
|
20157
|
+
photoWall: {
|
|
20158
|
+
durationSeconds: 18,
|
|
20159
|
+
maxVisible: 4,
|
|
20160
|
+
motion: "gentle",
|
|
20161
|
+
showQrCode: true,
|
|
20162
|
+
qrCodeLabel: "Scan to share",
|
|
20163
|
+
showEventName: true,
|
|
20164
|
+
screen: null,
|
|
20165
|
+
submission: DEFAULT_PHOTO_WALL_SUBMISSION_SETTINGS
|
|
20166
|
+
}
|
|
20167
|
+
};
|
|
20168
|
+
|
|
20169
|
+
// src/commands/passport-media.ts
|
|
20170
|
+
var IMAGE_CONTENT_TYPES = [
|
|
20171
|
+
"image/jpeg",
|
|
20172
|
+
"image/png",
|
|
20173
|
+
"image/webp",
|
|
20174
|
+
"image/gif"
|
|
20175
|
+
];
|
|
20176
|
+
var PASSPORT_SKIN_UPLOAD_KINDS = ["hero", "logo"];
|
|
20177
|
+
var requiredValue = (flags, name) => {
|
|
20178
|
+
const value = flags.get(name);
|
|
20179
|
+
if (typeof value !== "string" || value === "")
|
|
20180
|
+
throw new CliUsageError(`--${name} is required and needs a value.`);
|
|
20181
|
+
return value;
|
|
20182
|
+
};
|
|
20183
|
+
var nonnegativeInteger = (value, name) => {
|
|
20184
|
+
const parsed = Number(value);
|
|
20185
|
+
if (!/^\d+$/.test(value) || !Number.isSafeInteger(parsed))
|
|
20186
|
+
throw new CliUsageError(`--${name} must be a non-negative whole number.`);
|
|
20187
|
+
return parsed;
|
|
20188
|
+
};
|
|
20189
|
+
var isRecord2 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
20190
|
+
var parseJsonRecord = (raw, name) => {
|
|
20191
|
+
let parsed;
|
|
20192
|
+
try {
|
|
20193
|
+
parsed = JSON.parse(raw);
|
|
20194
|
+
} catch {
|
|
20195
|
+
throw new CliUsageError(`--${name} must be valid JSON.`);
|
|
20196
|
+
}
|
|
20197
|
+
if (!isRecord2(parsed))
|
|
20198
|
+
throw new CliUsageError(`--${name} must be a JSON object.`);
|
|
20199
|
+
return parsed;
|
|
20200
|
+
};
|
|
20201
|
+
var mergeSkinPatch = (current, patch) => {
|
|
20202
|
+
const allowed = ["heroImage", "logo", "colors", "emphasis"];
|
|
20203
|
+
if (Object.keys(patch).some((key) => !allowed.includes(key)))
|
|
20204
|
+
throw new CliUsageError(`--skin-json supports only: ${allowed.join(", ")}.`);
|
|
20205
|
+
const merged = {
|
|
20206
|
+
heroImage: patch.heroImage === undefined ? current.heroImage : isRecord2(patch.heroImage) ? { ...current.heroImage, ...patch.heroImage } : patch.heroImage,
|
|
20207
|
+
logo: patch.logo === undefined ? current.logo : isRecord2(patch.logo) ? { ...current.logo, ...patch.logo } : patch.logo,
|
|
20208
|
+
colors: isRecord2(patch.colors) ? { ...current.colors, ...patch.colors } : patch.colors ?? current.colors,
|
|
20209
|
+
emphasis: patch.emphasis ?? current.emphasis
|
|
20210
|
+
};
|
|
20211
|
+
const parsed = passportSkinSchema.safeParse(merged);
|
|
20212
|
+
if (!parsed.success)
|
|
20213
|
+
throw new CliUsageError(`Invalid passport skin: ${parsed.error.issues.map((issue) => `${issue.path.join(".") || "skin"}: ${issue.message}`).join("; ")}`);
|
|
20214
|
+
return parsed.data;
|
|
20215
|
+
};
|
|
20216
|
+
var readCanonicalAppearance = async (eventId) => {
|
|
20217
|
+
const projection = await api2.event.getEventAppearance.query({ eventId });
|
|
20218
|
+
const appearance = eventAppearanceSchema.parse(projection.appearance ?? DEFAULT_EVENT_APPEARANCE2);
|
|
20219
|
+
return { projection, appearance };
|
|
20220
|
+
};
|
|
20221
|
+
var getPassportSkin = async (eventId) => {
|
|
20222
|
+
const { projection, appearance } = await readCanonicalAppearance(eventId);
|
|
20223
|
+
return {
|
|
20224
|
+
appearanceVersion: projection.appearanceVersion,
|
|
20225
|
+
hasCustomAppearance: projection.hasCustomAppearance,
|
|
20226
|
+
passport: resolvePassportSkinSettingsFromAppearance(appearance),
|
|
20227
|
+
passportHeroImageUrl: projection.passportHeroImageUrl,
|
|
20228
|
+
passportLogoUrl: projection.passportLogoUrl
|
|
20229
|
+
};
|
|
20230
|
+
};
|
|
20231
|
+
var saveSkin = async (eventId, appearanceVersion, buildSkin) => {
|
|
20232
|
+
const { projection, appearance } = await readCanonicalAppearance(eventId);
|
|
20233
|
+
if (projection.appearanceVersion !== appearanceVersion)
|
|
20234
|
+
throw new CliUsageError(`The appearance is at version ${projection.appearanceVersion}, not ${appearanceVersion}. Read it with \`et passport skin get\` and retry.`);
|
|
20235
|
+
const next = {
|
|
20236
|
+
...appearance,
|
|
20237
|
+
passport: buildSkin(resolvePassportSkinSettingsFromAppearance(appearance))
|
|
20238
|
+
};
|
|
20239
|
+
return api2.event.updateEventAppearance.mutate({
|
|
20240
|
+
eventId,
|
|
20241
|
+
appearance: next,
|
|
20242
|
+
appearanceVersion
|
|
20243
|
+
});
|
|
20244
|
+
};
|
|
20245
|
+
var isUploadKind = (kinds, value) => kinds.some((kind) => kind === value);
|
|
20246
|
+
var uploadPassportImage = async (eventId, kind, flags) => {
|
|
20247
|
+
const filePath = requiredValue(flags, "file");
|
|
20248
|
+
const contentType = requiredValue(flags, "content-type");
|
|
20249
|
+
if (!IMAGE_CONTENT_TYPES.some((allowed) => allowed === contentType))
|
|
20250
|
+
throw new CliUsageError(`--content-type must be one of: ${IMAGE_CONTENT_TYPES.join(", ")}.`);
|
|
20251
|
+
const file = await readFile4(filePath);
|
|
20252
|
+
if (file.byteLength > MAX_EVENT_IMAGE_UPLOAD_BYTES)
|
|
20253
|
+
throw new CliUsageError("The image must be 25 MB or smaller.");
|
|
20254
|
+
const signed = await api2.attachment.getPresignedUrlToUpload.mutate({
|
|
20255
|
+
folder: getEventPassportUploadBaseFolder(kind),
|
|
20256
|
+
fileName: basename2(filePath),
|
|
20257
|
+
contentType,
|
|
20258
|
+
size: file.byteLength,
|
|
20259
|
+
eventId
|
|
20260
|
+
});
|
|
20261
|
+
const uploadResponse = await fetch(signed.uploadUrl, {
|
|
20262
|
+
method: "PUT",
|
|
20263
|
+
headers: { "content-type": contentType },
|
|
20264
|
+
body: file
|
|
20265
|
+
});
|
|
20266
|
+
if (!uploadResponse.ok)
|
|
20267
|
+
throw new Error(`Passport image upload failed with HTTP ${uploadResponse.status}.`);
|
|
20268
|
+
return signed;
|
|
20269
|
+
};
|
|
20270
|
+
var createSkinOperation = (subcommand, { eventId, flags, allowed }) => {
|
|
20271
|
+
switch (subcommand) {
|
|
20272
|
+
case "get":
|
|
20273
|
+
return () => getPassportSkin(eventId);
|
|
20274
|
+
case "set": {
|
|
20275
|
+
allowed.push("appearance-version", "skin-json");
|
|
20276
|
+
const version = nonnegativeInteger(requiredValue(flags, "appearance-version"), "appearance-version");
|
|
20277
|
+
const patch = parseJsonRecord(requiredValue(flags, "skin-json"), "skin-json");
|
|
20278
|
+
return () => saveSkin(eventId, version, (current) => mergeSkinPatch(current, patch));
|
|
20279
|
+
}
|
|
20280
|
+
case "clear": {
|
|
20281
|
+
allowed.push("appearance-version");
|
|
20282
|
+
const version = nonnegativeInteger(requiredValue(flags, "appearance-version"), "appearance-version");
|
|
20283
|
+
return () => saveSkin(eventId, version, () => DEFAULT_PASSPORT_SKIN);
|
|
20284
|
+
}
|
|
20285
|
+
case "upload": {
|
|
20286
|
+
allowed.push("kind", "file", "content-type");
|
|
20287
|
+
const kind = requiredValue(flags, "kind");
|
|
20288
|
+
if (!isUploadKind(PASSPORT_SKIN_UPLOAD_KINDS, kind))
|
|
20289
|
+
throw new CliUsageError(`--kind must be one of: ${PASSPORT_SKIN_UPLOAD_KINDS.join(", ")}.`);
|
|
20290
|
+
return () => uploadPassportImage(eventId, kind, flags);
|
|
20291
|
+
}
|
|
20292
|
+
default:
|
|
20293
|
+
return null;
|
|
20294
|
+
}
|
|
20295
|
+
};
|
|
20296
|
+
var setStationImage = async (eventId, stationId, imageKey) => {
|
|
20297
|
+
const overview = await api2.event.passport.getPassportOverview.query({
|
|
20298
|
+
eventId
|
|
20299
|
+
});
|
|
20300
|
+
const station = overview.stations.find((item) => item.id === stationId);
|
|
20301
|
+
if (!station)
|
|
20302
|
+
throw new CliUsageError("Station not found for this event.");
|
|
20303
|
+
return api2.event.passport.upsertPassportStation.mutate({
|
|
20304
|
+
eventId,
|
|
20305
|
+
id: station.id,
|
|
20306
|
+
name: station.name,
|
|
20307
|
+
description: station.description,
|
|
20308
|
+
location: station.location,
|
|
20309
|
+
imageKey: imageKey ? await imageKey() : null,
|
|
20310
|
+
order: station.order,
|
|
20311
|
+
opensAt: station.opensAt,
|
|
20312
|
+
closesAt: station.closesAt
|
|
20313
|
+
});
|
|
20314
|
+
};
|
|
20315
|
+
var createStationImageOperation = (subcommand, { eventId, flags, allowed }) => {
|
|
20316
|
+
if (subcommand !== "image-set" && subcommand !== "image-clear")
|
|
20317
|
+
return null;
|
|
20318
|
+
allowed.push("station-id");
|
|
20319
|
+
const stationId = requiredValue(flags, "station-id");
|
|
20320
|
+
if (subcommand === "image-clear")
|
|
20321
|
+
return () => setStationImage(eventId, stationId, null);
|
|
20322
|
+
allowed.push("file", "content-type");
|
|
20323
|
+
requiredValue(flags, "file");
|
|
20324
|
+
requiredValue(flags, "content-type");
|
|
20325
|
+
return () => setStationImage(eventId, stationId, async () => {
|
|
20326
|
+
const signed = await uploadPassportImage(eventId, "stations", flags);
|
|
20327
|
+
return signed.key;
|
|
20328
|
+
});
|
|
20329
|
+
};
|
|
20330
|
+
var createPassportMediaOperation = (action, context) => {
|
|
20331
|
+
const [first, second] = action.split(" ");
|
|
20332
|
+
if (first === "skin" && second)
|
|
20333
|
+
return createSkinOperation(second, context);
|
|
20334
|
+
if (first === "station" && second)
|
|
20335
|
+
return createStationImageOperation(second, context);
|
|
20336
|
+
return null;
|
|
20337
|
+
};
|
|
20338
|
+
|
|
19847
20339
|
// src/commands/passport.ts
|
|
19848
20340
|
var flag = (flags, name, required = true) => {
|
|
19849
20341
|
const value = flags.get(name);
|
|
@@ -19889,6 +20381,12 @@ var nullableText = (value, name, maximum) => {
|
|
|
19889
20381
|
throw new CliUsageError(`${name} must be a string of at most ${maximum} characters or null.`);
|
|
19890
20382
|
return value.trim();
|
|
19891
20383
|
};
|
|
20384
|
+
var stationInfo = (value) => {
|
|
20385
|
+
const parsed = passportStationInfoInputSchema.safeParse(value);
|
|
20386
|
+
if (!parsed.success)
|
|
20387
|
+
throw new CliUsageError(`info is invalid: ${parsed.error.issues.map((issue) => `${issue.path.join(".") || "info"} ${issue.message}`).join("; ")}`);
|
|
20388
|
+
return parsed.data;
|
|
20389
|
+
};
|
|
19892
20390
|
var object2 = (value, name) => {
|
|
19893
20391
|
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
19894
20392
|
throw new CliUsageError(`${name} must be an object.`);
|
|
@@ -19924,7 +20422,8 @@ var parseStaffTallyCollection = (item, extras) => {
|
|
|
19924
20422
|
"tallyItems",
|
|
19925
20423
|
"tallyEarnsStamp",
|
|
19926
20424
|
"stampValue",
|
|
19927
|
-
"category"
|
|
20425
|
+
"category",
|
|
20426
|
+
"info"
|
|
19928
20427
|
], "collection");
|
|
19929
20428
|
if (!Array.isArray(item.tallyItems))
|
|
19930
20429
|
throw new CliUsageError("tallyItems must be an array of item names.");
|
|
@@ -19946,24 +20445,31 @@ var parsePassportCollection = (raw) => {
|
|
|
19946
20445
|
const item = object2(raw, "collection");
|
|
19947
20446
|
const stampValue = item.stampValue === undefined ? {} : { stampValue: integer2(item.stampValue, "stampValue", 0, 1000) };
|
|
19948
20447
|
const category = item.category === undefined ? {} : { category: stationCategory(item.category) };
|
|
20448
|
+
const info = item.info === undefined ? {} : { info: stationInfo(item.info) };
|
|
19949
20449
|
if (item.collectionMode === "STAFF_SCORE") {
|
|
19950
|
-
keys(item, ["collectionMode", "maxPoints", "stampValue", "category"], "collection");
|
|
20450
|
+
keys(item, ["collectionMode", "maxPoints", "stampValue", "category", "info"], "collection");
|
|
19951
20451
|
return {
|
|
19952
20452
|
collectionMode: "STAFF_SCORE",
|
|
19953
20453
|
maxPoints: integer2(item.maxPoints, "maxPoints"),
|
|
19954
20454
|
...stampValue,
|
|
19955
|
-
...category
|
|
20455
|
+
...category,
|
|
20456
|
+
...info
|
|
19956
20457
|
};
|
|
19957
20458
|
}
|
|
19958
20459
|
if (item.collectionMode === "STAFF_TALLY") {
|
|
19959
|
-
return parseStaffTallyCollection(item, {
|
|
20460
|
+
return parseStaffTallyCollection(item, {
|
|
20461
|
+
...stampValue,
|
|
20462
|
+
...category,
|
|
20463
|
+
...info
|
|
20464
|
+
});
|
|
19960
20465
|
}
|
|
19961
20466
|
if (item.collectionMode === "SELF_SCAN" || item.collectionMode === "STAFF_SCAN") {
|
|
19962
|
-
keys(item, ["collectionMode", "stampValue", "category"], "collection");
|
|
20467
|
+
keys(item, ["collectionMode", "stampValue", "category", "info"], "collection");
|
|
19963
20468
|
return {
|
|
19964
20469
|
collectionMode: item.collectionMode,
|
|
19965
20470
|
...stampValue,
|
|
19966
|
-
...category
|
|
20471
|
+
...category,
|
|
20472
|
+
...info
|
|
19967
20473
|
};
|
|
19968
20474
|
}
|
|
19969
20475
|
throw new CliUsageError("collectionMode must be SELF_SCAN, STAFF_SCAN, STAFF_SCORE or STAFF_TALLY.");
|
|
@@ -19975,6 +20481,7 @@ var parsePassportStationInput = (raw, eventId) => {
|
|
|
19975
20481
|
"name",
|
|
19976
20482
|
"description",
|
|
19977
20483
|
"location",
|
|
20484
|
+
"address",
|
|
19978
20485
|
"imageKey",
|
|
19979
20486
|
"order",
|
|
19980
20487
|
"opensAt",
|
|
@@ -19988,6 +20495,7 @@ var parsePassportStationInput = (raw, eventId) => {
|
|
|
19988
20495
|
name: text(value.name, "name", 100),
|
|
19989
20496
|
description: nullableText(value.description, "description", 1000),
|
|
19990
20497
|
location: nullableText(value.location, "location", 200),
|
|
20498
|
+
...value.address === undefined ? {} : { address: nullableText(value.address, "address", 300) },
|
|
19991
20499
|
imageKey: nullableText(value.imageKey, "imageKey", 2048),
|
|
19992
20500
|
order: integer2(value.order ?? 0, "order"),
|
|
19993
20501
|
opensAt: date3(value.opensAt, "opensAt"),
|
|
@@ -20002,20 +20510,24 @@ var parsePassportSettingsInput = (raw, eventId) => {
|
|
|
20002
20510
|
"prizeStampThreshold",
|
|
20003
20511
|
"maxRedemptionsPerParticipant",
|
|
20004
20512
|
"linkedDrawEventId",
|
|
20005
|
-
"loginMethods"
|
|
20513
|
+
"loginMethods",
|
|
20514
|
+
"guestScan"
|
|
20006
20515
|
], "Settings");
|
|
20516
|
+
if (value.guestScan !== undefined && typeof value.guestScan !== "boolean")
|
|
20517
|
+
throw new CliUsageError("guestScan must be a JSON boolean.");
|
|
20007
20518
|
const threshold = (item, name) => item === null ? null : integer2(item, name, 1);
|
|
20008
20519
|
let loginMethods;
|
|
20009
20520
|
if (value.loginMethods !== undefined) {
|
|
20010
20521
|
const methods = object2(value.loginMethods, "loginMethods");
|
|
20011
|
-
keys(methods, ["emailOtp", "google", "guest", "staffId"], "loginMethods");
|
|
20012
|
-
if (typeof methods.emailOtp !== "boolean" || typeof methods.google !== "boolean" || typeof methods.guest !== "boolean" || methods.staffId !== undefined && typeof methods.staffId !== "boolean")
|
|
20522
|
+
keys(methods, ["emailOtp", "google", "guest", "staffId", "staffIdRequiresLastName"], "loginMethods");
|
|
20523
|
+
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")
|
|
20013
20524
|
throw new CliUsageError("loginMethods values must be JSON booleans.");
|
|
20014
20525
|
loginMethods = {
|
|
20015
20526
|
emailOtp: methods.emailOtp,
|
|
20016
20527
|
google: methods.google,
|
|
20017
20528
|
guest: methods.guest,
|
|
20018
|
-
staffId: methods.staffId === true
|
|
20529
|
+
staffId: methods.staffId === true,
|
|
20530
|
+
staffIdRequiresLastName: methods.staffIdRequiresLastName !== false
|
|
20019
20531
|
};
|
|
20020
20532
|
if (!loginMethods.emailOtp && !loginMethods.google && !loginMethods.staffId)
|
|
20021
20533
|
throw new CliUsageError("Keep email OTP, Google or Staff ID available for recovery.");
|
|
@@ -20028,17 +20540,20 @@ var parsePassportSettingsInput = (raw, eventId) => {
|
|
|
20028
20540
|
prizeStampThreshold: threshold(value.prizeStampThreshold, "prizeStampThreshold"),
|
|
20029
20541
|
maxRedemptionsPerParticipant: integer2(value.maxRedemptionsPerParticipant, "maxRedemptionsPerParticipant", 0),
|
|
20030
20542
|
linkedDrawEventId: value.linkedDrawEventId === null ? null : text(value.linkedDrawEventId, "linkedDrawEventId", 200),
|
|
20031
|
-
...loginMethods ? { loginMethods } : {}
|
|
20543
|
+
...loginMethods ? { loginMethods } : {},
|
|
20544
|
+
...value.guestScan === undefined ? {} : { guestScan: value.guestScan }
|
|
20032
20545
|
};
|
|
20033
20546
|
};
|
|
20034
20547
|
var parsePassportRosterEntryInput = (raw, eventId) => {
|
|
20035
20548
|
const value = json(raw, "--entry-json");
|
|
20036
20549
|
keys(value, ["id", "staffId", "lastName", "displayName"], "Roster entry");
|
|
20550
|
+
if (value.lastName === undefined)
|
|
20551
|
+
throw new CliUsageError("lastName is required (use null for none).");
|
|
20037
20552
|
return {
|
|
20038
20553
|
eventId,
|
|
20039
20554
|
...value.id === undefined ? {} : { id: text(value.id, "id", 200) },
|
|
20040
20555
|
staffId: text(value.staffId, "staffId", 64),
|
|
20041
|
-
lastName:
|
|
20556
|
+
lastName: nullableText(value.lastName, "lastName", 100) || null,
|
|
20042
20557
|
displayName: nullableText(value.displayName, "displayName", 100) || null
|
|
20043
20558
|
};
|
|
20044
20559
|
};
|
|
@@ -20049,7 +20564,7 @@ var headerIndex = (headers, name) => {
|
|
|
20049
20564
|
throw new CliUsageError(`Column "${name}" is not in the file. Headers: ${headers.join(", ")}.`);
|
|
20050
20565
|
return index;
|
|
20051
20566
|
};
|
|
20052
|
-
var resolvePassportRosterMapping = (headers, flags) => {
|
|
20567
|
+
var resolvePassportRosterMapping = (headers, flags, requireLastName) => {
|
|
20053
20568
|
const guess = guessPassportRosterMapping(headers);
|
|
20054
20569
|
const column = (name, fallback) => {
|
|
20055
20570
|
const value = flag(flags, name, false);
|
|
@@ -20068,25 +20583,98 @@ var resolvePassportRosterMapping = (headers, flags) => {
|
|
|
20068
20583
|
displayName: column("display-name-column", guess.displayName),
|
|
20069
20584
|
surnamePosition: position
|
|
20070
20585
|
};
|
|
20071
|
-
if (mapping.lastName === null && mapping.fullName === null)
|
|
20586
|
+
if (requireLastName && mapping.lastName === null && mapping.fullName === null)
|
|
20072
20587
|
throw new CliUsageError("Map a last-name column (--last-name-column) or a full-name column (--full-name-column).");
|
|
20073
20588
|
return mapping;
|
|
20074
20589
|
};
|
|
20075
|
-
var readRosterRows = async (path, flags) => {
|
|
20590
|
+
var readRosterRows = async (path, flags, requireLastName) => {
|
|
20076
20591
|
let table;
|
|
20077
20592
|
try {
|
|
20078
|
-
table = await readSpreadsheetTable(
|
|
20593
|
+
table = await readSpreadsheetTable(basename3(path), await readFile5(path));
|
|
20079
20594
|
} catch (error) {
|
|
20080
20595
|
throw new CliUsageError(`Could not read ${path}: ${error instanceof Error ? error.message : "unknown error"}`);
|
|
20081
20596
|
}
|
|
20082
|
-
const mapping = resolvePassportRosterMapping(table[0] ?? [], flags);
|
|
20597
|
+
const mapping = resolvePassportRosterMapping(table[0] ?? [], flags, requireLastName);
|
|
20083
20598
|
try {
|
|
20084
|
-
return mapPassportRosterTable(table, mapping);
|
|
20599
|
+
return mapPassportRosterTable(table, mapping, { requireLastName });
|
|
20085
20600
|
} catch (error) {
|
|
20086
20601
|
throw new CliUsageError(`Could not import ${path}: ${error instanceof Error ? error.message : "unknown error"}`);
|
|
20087
20602
|
}
|
|
20088
20603
|
};
|
|
20089
20604
|
var optionalEntry = (key, value, parse) => value === undefined ? {} : { [key]: parse(value) };
|
|
20605
|
+
var readPasswordFromStdin = async () => {
|
|
20606
|
+
if (process.stdin.isTTY)
|
|
20607
|
+
throw new CliUsageError(`--password-stdin reads the password from stdin. Pipe it in, for example: printf '%s' "$PASSWORD" | et passport station-access set-password --event-id <id> --password-stdin ...`);
|
|
20608
|
+
return (await Bun.stdin.text()).replace(/\r?\n$/, "");
|
|
20609
|
+
};
|
|
20610
|
+
var searchFilters = (flags) => {
|
|
20611
|
+
const search = flag(flags, "search", false);
|
|
20612
|
+
return search === undefined ? {} : { search: text(search, "--search", 200) };
|
|
20613
|
+
};
|
|
20614
|
+
var recipientDirection = (value) => {
|
|
20615
|
+
if (value === undefined)
|
|
20616
|
+
return;
|
|
20617
|
+
if (value === "forward" || value === "backward")
|
|
20618
|
+
return value;
|
|
20619
|
+
throw new CliUsageError("--direction must be forward or backward.");
|
|
20620
|
+
};
|
|
20621
|
+
var parseStampRecipientsInput = (flags, station) => {
|
|
20622
|
+
const limit = flag(flags, "limit", false);
|
|
20623
|
+
const cursor = flag(flags, "cursor", false);
|
|
20624
|
+
const direction = recipientDirection(flag(flags, "direction", false));
|
|
20625
|
+
if (direction === "backward" && cursor === undefined)
|
|
20626
|
+
throw new CliUsageError("--direction backward needs --cursor.");
|
|
20627
|
+
return {
|
|
20628
|
+
...station,
|
|
20629
|
+
filters: searchFilters(flags),
|
|
20630
|
+
...optionalEntry("limit", limit, (raw) => integer2(raw, "--limit", 1, PASSPORT_STATION_RECIPIENTS_PAGE_MAX)),
|
|
20631
|
+
...optionalEntry("cursor", cursor, (raw) => text(raw, "--cursor", 8192)),
|
|
20632
|
+
...direction === undefined ? {} : { direction }
|
|
20633
|
+
};
|
|
20634
|
+
};
|
|
20635
|
+
var createStationAccessOperation = async (action, { eventId, flags, allowed, station, confirm }) => {
|
|
20636
|
+
const event = { eventId };
|
|
20637
|
+
let operation;
|
|
20638
|
+
switch (action) {
|
|
20639
|
+
case "station-access get":
|
|
20640
|
+
operation = () => api2.event.passport.getPassportStationAccess.query(event);
|
|
20641
|
+
break;
|
|
20642
|
+
case "station-access set-password": {
|
|
20643
|
+
allowed.push("password-stdin");
|
|
20644
|
+
confirm();
|
|
20645
|
+
if (flags.get("password-stdin") !== true)
|
|
20646
|
+
throw new CliUsageError("--password-stdin is required; the password is never accepted as a flag value.");
|
|
20647
|
+
const parsed = setPassportStationPasswordSchema.safeParse({
|
|
20648
|
+
eventId,
|
|
20649
|
+
password: await readPasswordFromStdin()
|
|
20650
|
+
});
|
|
20651
|
+
if (!parsed.success)
|
|
20652
|
+
throw new CliUsageError(parsed.error.issues[0]?.message ?? "The password is invalid.");
|
|
20653
|
+
operation = () => api2.event.passport.setPassportStationPassword.mutate(parsed.data);
|
|
20654
|
+
break;
|
|
20655
|
+
}
|
|
20656
|
+
case "station-access clear-password":
|
|
20657
|
+
confirm();
|
|
20658
|
+
operation = () => api2.event.passport.clearPassportStationPassword.mutate(event);
|
|
20659
|
+
break;
|
|
20660
|
+
case "stamps stats":
|
|
20661
|
+
operation = () => api2.event.passport.getPassportStationStampStats.query(event);
|
|
20662
|
+
break;
|
|
20663
|
+
case "stamps recipients": {
|
|
20664
|
+
allowed.push("station-id", "search", "limit", "cursor", "direction");
|
|
20665
|
+
const payload = parseStampRecipientsInput(flags, station());
|
|
20666
|
+
operation = () => api2.event.passport.getPassportStationStampRecipients.query(payload);
|
|
20667
|
+
break;
|
|
20668
|
+
}
|
|
20669
|
+
case "stamps recipient-counts": {
|
|
20670
|
+
allowed.push("station-id", "search");
|
|
20671
|
+
const payload = { ...station(), filters: searchFilters(flags) };
|
|
20672
|
+
operation = () => api2.event.passport.getPassportStationStampRecipientCounts.query(payload);
|
|
20673
|
+
break;
|
|
20674
|
+
}
|
|
20675
|
+
}
|
|
20676
|
+
return operation;
|
|
20677
|
+
};
|
|
20090
20678
|
var runPassportCommand = async (input) => {
|
|
20091
20679
|
const { flags, positionals } = input;
|
|
20092
20680
|
const action = positionals.slice(1).join(" ");
|
|
@@ -20123,6 +20711,17 @@ var runPassportCommand = async (input) => {
|
|
|
20123
20711
|
case "bingo status":
|
|
20124
20712
|
operation = () => api2.event.passport.getMyPassportBingo.query(event);
|
|
20125
20713
|
break;
|
|
20714
|
+
case "bingo rename": {
|
|
20715
|
+
allowed.push("name");
|
|
20716
|
+
const parsed = renamePassportBingoSchema.safeParse({
|
|
20717
|
+
eventId,
|
|
20718
|
+
name: requiredFlag(flags, "name")
|
|
20719
|
+
});
|
|
20720
|
+
if (!parsed.success)
|
|
20721
|
+
throw new CliUsageError(`--name ${parsed.error.issues[0]?.message ?? "is invalid"}.`);
|
|
20722
|
+
operation = () => api2.event.passport.renamePassportBingo.mutate(parsed.data);
|
|
20723
|
+
break;
|
|
20724
|
+
}
|
|
20126
20725
|
case "login-options":
|
|
20127
20726
|
operation = () => api2.event.passport.getPassportLoginOptions.query(event);
|
|
20128
20727
|
break;
|
|
@@ -20343,10 +20942,13 @@ var runPassportCommand = async (input) => {
|
|
|
20343
20942
|
case "roster import": {
|
|
20344
20943
|
allowed.push("file", "staff-id-column", "last-name-column", "full-name-column", "display-name-column", "surname-position");
|
|
20345
20944
|
const path = requiredFlag(flags, "file");
|
|
20346
|
-
operation = async () =>
|
|
20347
|
-
|
|
20348
|
-
|
|
20349
|
-
|
|
20945
|
+
operation = async () => {
|
|
20946
|
+
const { loginMethods } = await api2.event.passport.getPassportLoginOptions.query(event);
|
|
20947
|
+
return api2.event.passport.importPassportRoster.mutate({
|
|
20948
|
+
eventId,
|
|
20949
|
+
rows: await readRosterRows(path, flags, loginMethods.staffIdRequiresLastName)
|
|
20950
|
+
});
|
|
20951
|
+
};
|
|
20350
20952
|
break;
|
|
20351
20953
|
}
|
|
20352
20954
|
case "tally summary":
|
|
@@ -20356,8 +20958,18 @@ var runPassportCommand = async (input) => {
|
|
|
20356
20958
|
allowed.push("station-id");
|
|
20357
20959
|
operation = () => api2.event.passport.getPassportStationTallies.query(station());
|
|
20358
20960
|
break;
|
|
20359
|
-
default:
|
|
20360
|
-
|
|
20961
|
+
default: {
|
|
20962
|
+
const mediaOperation = await createStationAccessOperation(action, {
|
|
20963
|
+
eventId,
|
|
20964
|
+
flags,
|
|
20965
|
+
allowed,
|
|
20966
|
+
station,
|
|
20967
|
+
confirm
|
|
20968
|
+
}) ?? createPassportMediaOperation(action, { eventId, flags, allowed });
|
|
20969
|
+
if (!mediaOperation)
|
|
20970
|
+
throw new CliUsageError("Unknown passport command. Run et --help for supported commands.");
|
|
20971
|
+
operation = mediaOperation;
|
|
20972
|
+
}
|
|
20361
20973
|
}
|
|
20362
20974
|
const unknown = [...flags.keys()].filter((key) => key !== "api-url" && !allowed.includes(key));
|
|
20363
20975
|
if (unknown.length)
|
|
@@ -20372,7 +20984,7 @@ var command_manifest_default = [
|
|
|
20372
20984
|
path: ["organization", "member", "list"],
|
|
20373
20985
|
procedure: "organization.getOrganizationMembersById",
|
|
20374
20986
|
operation: "query",
|
|
20375
|
-
summary: "List an organization's members and pending invitations (paged), with each invitation's stored emailDeliveryStatus.",
|
|
20987
|
+
summary: "List an organization's members and pending invitations (paged; expired links included until resent or canceled), with each invitation's stored emailDeliveryStatus.",
|
|
20376
20988
|
effects: [],
|
|
20377
20989
|
dates: [],
|
|
20378
20990
|
input: {
|
|
@@ -20451,7 +21063,7 @@ var command_manifest_default = [
|
|
|
20451
21063
|
path: ["organization", "member", "invitation-resend"],
|
|
20452
21064
|
procedure: "organization.resendOrganizationMemberInvitation",
|
|
20453
21065
|
operation: "mutation",
|
|
20454
|
-
summary: "Resend the invitation email to a pending legacy
|
|
21066
|
+
summary: "Resend the invitation email to a pending legacy member invitation created before organization invitations; reports deliveryStatus and the stored emailDeliveryStatus.",
|
|
20455
21067
|
effects: ["state-change", "email"],
|
|
20456
21068
|
target: "memberId",
|
|
20457
21069
|
dates: [],
|
|
@@ -20692,7 +21304,7 @@ var command_manifest_default = [
|
|
|
20692
21304
|
path: ["organization", "invitation", "resend"],
|
|
20693
21305
|
procedure: "organization.resendInvitation",
|
|
20694
21306
|
operation: "mutation",
|
|
20695
|
-
summary: "Replace a pending organization invitation and email
|
|
21307
|
+
summary: "Replace a pending organization invitation (including an expired one) and email a fresh link; reports deliveryStatus and the stored emailDeliveryStatus.",
|
|
20696
21308
|
effects: ["state-change", "email"],
|
|
20697
21309
|
target: "invitationId",
|
|
20698
21310
|
dates: [],
|
|
@@ -20956,7 +21568,7 @@ var command_manifest_default = [
|
|
|
20956
21568
|
path: ["admin", "organization", "members"],
|
|
20957
21569
|
procedure: "admin.organization.getOrganizationMembers",
|
|
20958
21570
|
operation: "query",
|
|
20959
|
-
summary: "List an organization's members as a global admin.",
|
|
21571
|
+
summary: "List an organization's members as a global admin, plus pendingInvitations not yet accepted (expired links included; shown when status is ALL or PENDING, filtered by search and role).",
|
|
20960
21572
|
effects: [],
|
|
20961
21573
|
dates: [],
|
|
20962
21574
|
input: {
|
|
@@ -21539,11 +22151,33 @@ var command_manifest_default = [
|
|
|
21539
22151
|
required: ["eventId", "organizationId"]
|
|
21540
22152
|
}
|
|
21541
22153
|
},
|
|
22154
|
+
{
|
|
22155
|
+
path: ["event", "access", "my-assignments"],
|
|
22156
|
+
procedure: "access.listMyEventAssignments",
|
|
22157
|
+
operation: "query",
|
|
22158
|
+
summary: "List the current user's own event staff assignments in an organization (optionally one eventId), each with status ACTIVE, SCHEDULED, ENDED or REVOKED.",
|
|
22159
|
+
effects: [],
|
|
22160
|
+
dates: [],
|
|
22161
|
+
input: {
|
|
22162
|
+
type: "object",
|
|
22163
|
+
properties: {
|
|
22164
|
+
eventId: {
|
|
22165
|
+
type: "string",
|
|
22166
|
+
minLength: 1
|
|
22167
|
+
},
|
|
22168
|
+
organizationId: {
|
|
22169
|
+
type: "string",
|
|
22170
|
+
minLength: 1
|
|
22171
|
+
}
|
|
22172
|
+
},
|
|
22173
|
+
required: ["organizationId"]
|
|
22174
|
+
}
|
|
22175
|
+
},
|
|
21542
22176
|
{
|
|
21543
22177
|
path: ["event", "access", "list"],
|
|
21544
22178
|
procedure: "access.listEventAssignments",
|
|
21545
22179
|
operation: "query",
|
|
21546
|
-
summary: "List event staff assignments and pending staff invitations, with each invitation's stored emailDeliveryStatus.",
|
|
22180
|
+
summary: "List event staff assignments and pending staff invitations (expired links included until resent or revoked), with each invitation's stored emailDeliveryStatus.",
|
|
21547
22181
|
effects: [],
|
|
21548
22182
|
dates: [],
|
|
21549
22183
|
input: {
|
|
@@ -21621,7 +22255,7 @@ var command_manifest_default = [
|
|
|
21621
22255
|
path: ["event", "access", "invitation-resend"],
|
|
21622
22256
|
procedure: "access.resendEventStaffInvitation",
|
|
21623
22257
|
operation: "mutation",
|
|
21624
|
-
summary: "Replace a pending event staff invitation and email
|
|
22258
|
+
summary: "Replace a pending event staff invitation (including an expired one) and email a fresh link; reports deliveryStatus and the stored emailDeliveryStatus.",
|
|
21625
22259
|
effects: ["state-change", "email"],
|
|
21626
22260
|
target: "invitationId",
|
|
21627
22261
|
dates: [],
|
|
@@ -23247,10 +23881,6 @@ var command_manifest_default = [
|
|
|
23247
23881
|
correctAnswer: {
|
|
23248
23882
|
type: "string",
|
|
23249
23883
|
maxLength: 100
|
|
23250
|
-
},
|
|
23251
|
-
manualReview: {
|
|
23252
|
-
default: false,
|
|
23253
|
-
type: "boolean"
|
|
23254
23884
|
}
|
|
23255
23885
|
},
|
|
23256
23886
|
required: ["name"]
|
|
@@ -23314,10 +23944,6 @@ var command_manifest_default = [
|
|
|
23314
23944
|
type: "string",
|
|
23315
23945
|
maxLength: 100
|
|
23316
23946
|
},
|
|
23317
|
-
manualReview: {
|
|
23318
|
-
default: false,
|
|
23319
|
-
type: "boolean"
|
|
23320
|
-
},
|
|
23321
23947
|
id: {
|
|
23322
23948
|
type: "string",
|
|
23323
23949
|
minLength: 1
|
|
@@ -23674,7 +24300,7 @@ var registryFlags = [
|
|
|
23674
24300
|
"target"
|
|
23675
24301
|
];
|
|
23676
24302
|
var isoDateTimePattern = /^\d{4}-\d\d-\d\dT\d\d:\d\d/;
|
|
23677
|
-
var
|
|
24303
|
+
var isRecord3 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
23678
24304
|
var commandName = (entry) => `et ${entry.path.join(" ")}`;
|
|
23679
24305
|
var findManifestEntry = (positionals) => manifest.find((entry) => entry.path.length === positionals.length && entry.path.every((segment, index) => positionals[index] === segment));
|
|
23680
24306
|
var listRegistryCommands = () => manifest.map((entry) => ({
|
|
@@ -23698,7 +24324,7 @@ var coerceDateAt = (value, segments, label) => {
|
|
|
23698
24324
|
const apply = (child) => isArray ? Array.isArray(child) ? child.map((item) => coerceDateAt(item, rest, label)) : child : coerceDateAt(child, rest, label);
|
|
23699
24325
|
if (key === "")
|
|
23700
24326
|
return apply(value);
|
|
23701
|
-
if (!
|
|
24327
|
+
if (!isRecord3(value) || !(key in value))
|
|
23702
24328
|
return value;
|
|
23703
24329
|
return { ...value, [key]: apply(value[key]) };
|
|
23704
24330
|
};
|
|
@@ -23724,7 +24350,7 @@ var readInput = async (parsed, entry) => {
|
|
|
23724
24350
|
} catch {
|
|
23725
24351
|
throw new CliUsageError("--input must be valid JSON.");
|
|
23726
24352
|
}
|
|
23727
|
-
if (!
|
|
24353
|
+
if (!isRecord3(value)) {
|
|
23728
24354
|
throw new CliUsageError("--input must be a JSON object.");
|
|
23729
24355
|
}
|
|
23730
24356
|
return coerceDates(value, entry.dates);
|
|
@@ -23747,7 +24373,7 @@ var assertConfirmed = (parsed, entry, input) => {
|
|
|
23747
24373
|
}
|
|
23748
24374
|
if (!entry.target)
|
|
23749
24375
|
return;
|
|
23750
|
-
const expected = targetText(
|
|
24376
|
+
const expected = targetText(isRecord3(input) ? input[entry.target] : undefined);
|
|
23751
24377
|
if (expected === undefined) {
|
|
23752
24378
|
throw new CliUsageError(`--input must include ${entry.target} so the target can be confirmed.`);
|
|
23753
24379
|
}
|
|
@@ -24158,11 +24784,11 @@ var runEventAppearanceUpload = async ({
|
|
|
24158
24784
|
const filePath = getRequiredFlag(parsed, "file");
|
|
24159
24785
|
const contentType = getRequiredFlag(parsed, "content-type");
|
|
24160
24786
|
const mediaType = parseAppearanceMediaType(getRequiredFlag(parsed, "media-type"));
|
|
24161
|
-
const file = await
|
|
24787
|
+
const file = await readFile6(filePath);
|
|
24162
24788
|
await ensureAuthentication();
|
|
24163
24789
|
const signed = await api2.attachment.getPresignedUrlToUpload.mutate({
|
|
24164
24790
|
folder: `event-appearance/${mediaType === "image" ? "images" : "videos"}`,
|
|
24165
|
-
fileName:
|
|
24791
|
+
fileName: basename4(filePath),
|
|
24166
24792
|
contentType,
|
|
24167
24793
|
size: file.byteLength,
|
|
24168
24794
|
eventId
|