@go-labs-sg/event-tech 1.32.0 → 1.32.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -8384,39 +8384,11 @@ function share(_opts) {
8384
8384
  }
8385
8385
  __name(share, "share"), __name2(share, "share");
8386
8386
  var distinctUnsetMarker = /* @__PURE__ */ Symbol();
8387
- function callObserver(callback) {
8388
- try {
8389
- callback();
8390
- } catch (error2) {
8391
- setTimeout(() => {
8392
- throw error2;
8393
- });
8394
- }
8395
- }
8396
- __name(callObserver, "callObserver"), __name2(callObserver, "callObserver");
8397
- function behaviorSubject(initialValue) {
8398
- let value = initialValue;
8399
- const observerList = /* @__PURE__ */ new Set(), addObserver = __name2((observer) => {
8400
- value !== void 0 && observer.next(value), observerList.add(observer);
8401
- }, "addObserver"), removeObserver = __name2((observer) => {
8402
- observerList.delete(observer);
8403
- }, "removeObserver"), obs = observable((observer) => (addObserver(observer), () => {
8404
- removeObserver(observer);
8405
- }));
8406
- return obs.next = (nextValue) => {
8407
- if (value !== nextValue) {
8408
- value = nextValue;
8409
- for (const observer of [...observerList]) observerList.has(observer) && callObserver(() => observer.next(nextValue));
8410
- }
8411
- }, obs.get = () => value, obs;
8412
- }
8413
- __name(behaviorSubject, "behaviorSubject"), __name2(behaviorSubject, "behaviorSubject");
8414
8387
  function createChain(opts) {
8415
8388
  return observable((observer) => {
8416
8389
  function execute(index = 0, op = opts.op) {
8417
8390
  const next = opts.links[index];
8418
- if (!next)
8419
- throw new Error("No more links to execute - did you forget to add an ending link?");
8391
+ if (!next) throw new Error("No more links to execute - did you forget to add an ending link?");
8420
8392
  return next({ op, next(nextOp) {
8421
8393
  return execute(index + 1, nextOp);
8422
8394
  } });
@@ -8470,7 +8442,9 @@ function _objectSpread2(e) {
8470
8442
  var t = arguments[r] != null ? arguments[r] : {};
8471
8443
  r % 2 ? ownKeys(Object(t), !0).forEach(function(r2) {
8472
8444
  _defineProperty(e, r2, t[r2]);
8473
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r2) {
8445
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(
8446
+ t
8447
+ )) : ownKeys(Object(t)).forEach(function(r2) {
8474
8448
  Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
8475
8449
  });
8476
8450
  }
@@ -8501,12 +8475,13 @@ function createInnerProxy(callback, path2, memo2) {
8501
8475
  return lastOfPath === "call" ? opts = { args: args.length >= 2 ? [args[1]] : [], path: path2.slice(0, -1) } : lastOfPath === "apply" && (opts = { args: args.length >= 2 ? args[1] : [], path: path2.slice(0, -1) }), freezeIfAvailable(opts.args), freezeIfAvailable(opts.path), callback(opts);
8502
8476
  } })), memo2[cacheKey];
8503
8477
  }
8504
- __name(createInnerProxy, "createInnerProxy"), __name2(createInnerProxy, "createInnerProxy");
8478
+ __name(createInnerProxy, "createInnerProxy"), __name2(
8479
+ createInnerProxy,
8480
+ "createInnerProxy"
8481
+ );
8505
8482
  var createRecursiveProxy = __name2((callback) => createInnerProxy(callback, [], emptyObject()), "createRecursiveProxy"), createFlatProxy = __name2((callback) => new Proxy(noop, { get(_obj, name) {
8506
8483
  if (name !== "then") return callback(name);
8507
- } }), "createFlatProxy"), formattedShapeSymbol = /* @__PURE__ */ Symbol(
8508
- "trpc_formattedErrorShape"
8509
- );
8484
+ } }), "createFlatProxy"), formattedShapeSymbol = /* @__PURE__ */ Symbol("trpc_formattedErrorShape");
8510
8485
  function _typeof2(o) {
8511
8486
  "@babel/helpers - typeof";
8512
8487
  return _typeof2 = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(o2) {
@@ -8528,7 +8503,10 @@ function toPrimitive2(t, e) {
8528
8503
  }
8529
8504
  __name(toPrimitive2, "toPrimitive2"), __name2(toPrimitive2, "toPrimitive2");
8530
8505
  function toPropertyKey2(t) {
8531
- var i = toPrimitive2(t, "string");
8506
+ var i = toPrimitive2(
8507
+ t,
8508
+ "string"
8509
+ );
8532
8510
  return _typeof2(i) == "symbol" ? i : i + "";
8533
8511
  }
8534
8512
  __name(toPropertyKey2, "toPropertyKey2"), __name2(toPropertyKey2, "toPropertyKey2");
@@ -8664,15 +8642,14 @@ var TRPCClientError = class TRPCClientError2 extends Error {
8664
8642
  constructor(message, opts) {
8665
8643
  var _opts$result, _opts$result2;
8666
8644
  const cause = opts?.cause;
8667
- super(message, { cause }), _defineProperty(this, "cause", void 0), _defineProperty(this, "shape", void 0), _defineProperty(this, "data", void 0), _defineProperty(
8668
- this,
8669
- "meta",
8670
- void 0
8671
- ), this.meta = opts?.meta, this.cause = cause, this.shape = opts == null || (_opts$result = opts.result) === null || _opts$result === void 0 ? void 0 : _opts$result.error, this.data = opts == null || (_opts$result2 = opts.result) === null || _opts$result2 === void 0 ? void 0 : _opts$result2.error.data, this.name = "TRPCClientError", Object.setPrototypeOf(this, TRPCClientError2.prototype);
8645
+ super(message, { cause }), _defineProperty(this, "cause", void 0), _defineProperty(this, "shape", void 0), _defineProperty(this, "data", void 0), _defineProperty(this, "meta", void 0), this.meta = opts?.meta, this.cause = cause, this.shape = opts == null || (_opts$result = opts.result) === null || _opts$result === void 0 ? void 0 : _opts$result.error, this.data = opts == null || (_opts$result2 = opts.result) === null || _opts$result2 === void 0 ? void 0 : _opts$result2.error.data, this.name = "TRPCClientError", Object.setPrototypeOf(this, TRPCClientError2.prototype);
8672
8646
  }
8673
8647
  static from(_cause, opts = {}) {
8674
8648
  const cause = _cause;
8675
- return isTRPCClientError(cause) ? (opts.meta && (cause.meta = _objectSpread2(_objectSpread2({}, cause.meta), opts.meta)), cause) : isTRPCErrorResponse(cause) ? new TRPCClientError2(cause.error.message, _objectSpread2(_objectSpread2({}, opts), {}, { result: cause, cause: opts.cause })) : new TRPCClientError2(getMessageFromUnknownError(cause, "Unknown error"), _objectSpread2(_objectSpread2({}, opts), {}, { cause }));
8649
+ return isTRPCClientError(cause) ? (opts.meta && (cause.meta = _objectSpread2(_objectSpread2({}, cause.meta), opts.meta)), cause) : isTRPCErrorResponse(cause) ? new TRPCClientError2(cause.error.message, _objectSpread2(_objectSpread2({}, opts), {}, { result: cause, cause: opts.cause })) : new TRPCClientError2(
8650
+ getMessageFromUnknownError(cause, "Unknown error"),
8651
+ _objectSpread2(_objectSpread2({}, opts), {}, { cause })
8652
+ );
8676
8653
  }
8677
8654
  };
8678
8655
  function getTransformer(transformer) {
@@ -8699,12 +8676,9 @@ function allAbortSignals(...signals) {
8699
8676
  }
8700
8677
  __name(allAbortSignals, "allAbortSignals"), __name2(allAbortSignals, "allAbortSignals");
8701
8678
  function raceAbortSignalsWithCleanup(...signals) {
8702
- const ac = new AbortController(), cleanup = __name2(
8703
- () => {
8704
- for (const signal of signals) signal?.removeEventListener("abort", onAbort);
8705
- },
8706
- "cleanup"
8707
- ), onAbort = __name2(() => {
8679
+ const ac = new AbortController(), cleanup = __name2(() => {
8680
+ for (const signal of signals) signal?.removeEventListener("abort", onAbort);
8681
+ }, "cleanup"), onAbort = __name2(() => {
8708
8682
  cleanup(), ac.abort();
8709
8683
  }, "onAbort");
8710
8684
  for (const signal of signals) {
@@ -8733,9 +8707,7 @@ var AbortError = class extends Error {
8733
8707
  if (signal?.aborted) throw (_signal$throwIfAborte = signal.throwIfAborted) === null || _signal$throwIfAborte === void 0 || _signal$throwIfAborte.call(signal), typeof DOMException < "u" ? new DOMException("AbortError", "AbortError") : new AbortError();
8734
8708
  }, "throwIfAborted");
8735
8709
  function resolveHTTPLinkOptions(opts) {
8736
- return { url: opts.url.toString(), fetch: opts.fetch, transformer: getTransformer(opts.transformer), methodOverride: opts.methodOverride, pathSeparator: resolvePathSeparator(
8737
- opts.pathSeparator
8738
- ) };
8710
+ return { url: opts.url.toString(), fetch: opts.fetch, transformer: getTransformer(opts.transformer), methodOverride: opts.methodOverride, pathSeparator: resolvePathSeparator(opts.pathSeparator) };
8739
8711
  }
8740
8712
  __name(resolveHTTPLinkOptions, "resolveHTTPLinkOptions"), __name2(resolveHTTPLinkOptions, "resolveHTTPLinkOptions");
8741
8713
  function arrayToDict(array2) {
@@ -8792,9 +8764,7 @@ function dataLoader(batchLoader) {
8792
8764
  clearTimeout(dispatchTimer), dispatchTimer = null, pendingItems = null;
8793
8765
  }, "destroyTimerAndPendingItems");
8794
8766
  function groupItems(items) {
8795
- const groupedItems = [
8796
- []
8797
- ];
8767
+ const groupedItems = [[]];
8798
8768
  let index = 0;
8799
8769
  for (; ; ) {
8800
8770
  const item = items[index];
@@ -8833,8 +8803,7 @@ function dataLoader(batchLoader) {
8833
8803
  for (const items of groupedItems) {
8834
8804
  if (!items.length) continue;
8835
8805
  const batch = { items };
8836
- for (const item of items)
8837
- item.batch = batch;
8806
+ for (const item of items) item.batch = batch;
8838
8807
  batchLoader.fetch(batch.items.map((_item) => _item.key)).then(async (result) => {
8839
8808
  await Promise.all(result.map(async (valueOrPromise, index) => {
8840
8809
  const item = batch.items[index];
@@ -8863,13 +8832,7 @@ function dataLoader(batchLoader) {
8863
8832
  __name(dispatch, "dispatch"), __name2(dispatch, "dispatch");
8864
8833
  function load(key) {
8865
8834
  var _dispatchTimer;
8866
- const item = {
8867
- aborted: !1,
8868
- key,
8869
- batch: null,
8870
- resolve: throwFatalError,
8871
- reject: throwFatalError
8872
- }, promise = new Promise((resolve2, reject) => {
8835
+ const item = { aborted: !1, key, batch: null, resolve: throwFatalError, reject: throwFatalError }, promise = new Promise((resolve2, reject) => {
8873
8836
  var _pendingItems;
8874
8837
  item.reject = reject, item.resolve = resolve2, (_pendingItems = pendingItems) !== null && _pendingItems !== void 0 || (pendingItems = []), pendingItems.push(item);
8875
8838
  });
@@ -8886,159 +8849,36 @@ function httpBatchLink(opts) {
8886
8849
  if (maxURLLength === 1 / 0 && maxItems === 1 / 0) return !0;
8887
8850
  if (batchOps.length > maxItems) return !1;
8888
8851
  const path2 = batchOps.map((op) => op.path).join(","), inputs = batchOps.map((op) => op.input);
8889
- return getUrl(_objectSpread2(_objectSpread2(
8890
- {},
8891
- resolvedOpts
8892
- ), {}, { type, path: path2, inputs, signal: null })).length <= maxURLLength;
8852
+ return getUrl(_objectSpread2(_objectSpread2({}, resolvedOpts), {}, { type, path: path2, inputs, signal: null })).length <= maxURLLength;
8893
8853
  }, async fetch(batchOps) {
8894
8854
  const path2 = batchOps.map((op) => op.path).join(","), inputs = batchOps.map((op) => op.input), signal = allAbortSignals(...batchOps.map((op) => op.signal)), res = await jsonHttpRequester(_objectSpread2(_objectSpread2({}, resolvedOpts), {}, { path: path2, inputs, type, headers() {
8895
8855
  return opts.headers ? typeof opts.headers == "function" ? opts.headers({ opList: batchOps }) : opts.headers : {};
8896
8856
  }, signal }));
8897
8857
  return (Array.isArray(res.json) ? res.json : batchOps.map(() => res.json)).map((item) => ({ meta: res.meta, json: item }));
8898
8858
  } }), "batchLoader"), loaders = { query: dataLoader(batchLoader("query")), mutation: dataLoader(batchLoader("mutation")) };
8899
- return ({ op }) => observable((observer) => {
8900
- if (op.type === "subscription") throw new Error("Subscriptions are unsupported by `httpLink` - use `httpSubscriptionLink` or `wsLink`");
8901
- const ac = new AbortController(), { signal, cleanup } = raceAbortSignalsWithCleanup(op.signal, ac.signal), promise = loaders[op.type].load(_objectSpread2(_objectSpread2(
8902
- {},
8903
- op
8904
- ), {}, { signal }));
8905
- let isDone = !1, _res;
8906
- return promise.then((res) => {
8907
- isDone = !0, _res = res;
8908
- const transformed = transformResult(res.json, resolvedOpts.transformer.output);
8909
- if (!transformed.ok) {
8910
- observer.error(TRPCClientError.from(transformed.error, { meta: res.meta }));
8911
- return;
8912
- }
8913
- observer.next({ context: res.meta, result: transformed.result }), observer.complete();
8914
- }).catch((err) => {
8915
- isDone = !0, observer.error(TRPCClientError.from(err, { meta: _res?.meta }));
8916
- }), () => {
8917
- isDone || ac.abort(), cleanup();
8918
- };
8919
- });
8859
+ return ({ op }) => observable(
8860
+ (observer) => {
8861
+ if (op.type === "subscription") throw new Error("Subscriptions are unsupported by `httpLink` - use `httpSubscriptionLink` or `wsLink`");
8862
+ const ac = new AbortController(), { signal, cleanup } = raceAbortSignalsWithCleanup(op.signal, ac.signal), promise = loaders[op.type].load(_objectSpread2(_objectSpread2({}, op), {}, { signal }));
8863
+ let isDone = !1, _res;
8864
+ return promise.then((res) => {
8865
+ isDone = !0, _res = res;
8866
+ const transformed = transformResult(res.json, resolvedOpts.transformer.output);
8867
+ if (!transformed.ok) {
8868
+ observer.error(TRPCClientError.from(transformed.error, { meta: res.meta }));
8869
+ return;
8870
+ }
8871
+ observer.next({ context: res.meta, result: transformed.result }), observer.complete();
8872
+ }).catch((err) => {
8873
+ isDone = !0, observer.error(TRPCClientError.from(err, { meta: _res?.meta }));
8874
+ }), () => {
8875
+ isDone || ac.abort(), cleanup();
8876
+ };
8877
+ }
8878
+ );
8920
8879
  };
8921
8880
  }
8922
8881
  __name(httpBatchLink, "httpBatchLink"), __name2(httpBatchLink, "httpBatchLink");
8923
- var resultOf = __name2((value, ...args) => typeof value == "function" ? value(...args) : value, "resultOf");
8924
- function withResolvers() {
8925
- let resolve2, reject;
8926
- return { promise: new Promise((res, rej) => {
8927
- resolve2 = res, reject = rej;
8928
- }), resolve: resolve2, reject };
8929
- }
8930
- __name(withResolvers, "withResolvers"), __name2(withResolvers, "withResolvers");
8931
- async function prepareUrl(urlOptions) {
8932
- const url = await resultOf(urlOptions.url);
8933
- return urlOptions.connectionParams ? url + "".concat(url.includes("?") ? "&" : "?", "connectionParams=1") : url;
8934
- }
8935
- __name(prepareUrl, "prepareUrl"), __name2(prepareUrl, "prepareUrl");
8936
- async function buildConnectionMessage(connectionParams, encoder) {
8937
- const message = { method: "connectionParams", data: await resultOf(connectionParams) };
8938
- return encoder.encode(message);
8939
- }
8940
- __name(buildConnectionMessage, "buildConnectionMessage"), __name2(buildConnectionMessage, "buildConnectionMessage");
8941
- function asyncWsOpen(ws) {
8942
- const { promise, resolve: resolve2, reject } = withResolvers();
8943
- return ws.addEventListener("open", () => {
8944
- ws.removeEventListener("error", reject), resolve2();
8945
- }), ws.addEventListener("error", reject), promise;
8946
- }
8947
- __name(asyncWsOpen, "asyncWsOpen"), __name2(asyncWsOpen, "asyncWsOpen");
8948
- var pongCallbacks = /* @__PURE__ */ new WeakMap();
8949
- function sendPing(ws, onPong) {
8950
- let callbacks = pongCallbacks.get(ws);
8951
- if (!callbacks) {
8952
- const queue = [];
8953
- callbacks = queue, pongCallbacks.set(ws, queue), ws.addEventListener("message", ({ data }) => {
8954
- var _queue$shift;
8955
- data === "PONG" && ((_queue$shift = queue.shift()) === null || _queue$shift === void 0 || _queue$shift());
8956
- });
8957
- }
8958
- callbacks.push(onPong), ws.send("PING");
8959
- }
8960
- __name(sendPing, "sendPing"), __name2(sendPing, "sendPing");
8961
- function setupPingInterval(ws, { intervalMs, pongTimeoutMs }) {
8962
- let pingTimeout, pongTimeout;
8963
- function start() {
8964
- pingTimeout = setTimeout(
8965
- () => {
8966
- sendPing(ws, null), pongTimeout = setTimeout(() => {
8967
- ws.close();
8968
- }, pongTimeoutMs);
8969
- },
8970
- intervalMs
8971
- );
8972
- }
8973
- __name(start, "start"), __name2(start, "start");
8974
- function reset() {
8975
- clearTimeout(pingTimeout), start();
8976
- }
8977
- __name(reset, "reset"), __name2(reset, "reset");
8978
- function pong() {
8979
- clearTimeout(pongTimeout), reset();
8980
- }
8981
- __name(pong, "pong"), __name2(pong, "pong"), ws.addEventListener("open", start), ws.addEventListener("message", ({ data }) => {
8982
- clearTimeout(pingTimeout), start(), data === "PONG" && pong();
8983
- }), ws.addEventListener("close", () => {
8984
- clearTimeout(pingTimeout), clearTimeout(pongTimeout);
8985
- });
8986
- }
8987
- __name(setupPingInterval, "setupPingInterval"), __name2(setupPingInterval, "setupPingInterval");
8988
- var WsConnection = class WsConnection2 {
8989
- static {
8990
- __name(this, "WsConnection2");
8991
- }
8992
- static {
8993
- __name2(this, "WsConnection");
8994
- }
8995
- constructor(opts) {
8996
- var _opts$WebSocketPonyfi;
8997
- if (_defineProperty(this, "id", ++WsConnection2.connectCount), _defineProperty(this, "WebSocketPonyfill", void 0), _defineProperty(this, "urlOptions", void 0), _defineProperty(this, "keepAliveOpts", void 0), _defineProperty(this, "encoder", void 0), _defineProperty(this, "wsObservable", behaviorSubject(null)), _defineProperty(this, "openPromise", null), this.WebSocketPonyfill = (_opts$WebSocketPonyfi = opts.WebSocketPonyfill) !== null && _opts$WebSocketPonyfi !== void 0 ? _opts$WebSocketPonyfi : WebSocket, !this.WebSocketPonyfill) throw new Error("No WebSocket implementation found - you probably don't want to use this on the server, but if you do you need to pass a `WebSocket`-ponyfill");
8998
- this.urlOptions = opts.urlOptions, this.keepAliveOpts = opts.keepAlive, this.encoder = opts.encoder;
8999
- }
9000
- get ws() {
9001
- return this.wsObservable.get();
9002
- }
9003
- set ws(ws) {
9004
- this.wsObservable.next(ws);
9005
- }
9006
- isOpen() {
9007
- return !!this.ws && this.ws.readyState === this.WebSocketPonyfill.OPEN && !this.openPromise;
9008
- }
9009
- isClosed() {
9010
- return !!this.ws && (this.ws.readyState === this.WebSocketPonyfill.CLOSING || this.ws.readyState === this.WebSocketPonyfill.CLOSED);
9011
- }
9012
- async open() {
9013
- if (this.openPromise) return this.openPromise;
9014
- this.id = ++WsConnection2.connectCount;
9015
- const wsPromise = prepareUrl(this.urlOptions).then((url) => new this.WebSocketPonyfill(url));
9016
- this.openPromise = wsPromise.then(async (ws) => {
9017
- this.ws = ws, ws.binaryType = "arraybuffer", ws.addEventListener("message", function({ data }) {
9018
- data === "PING" && this.send("PONG");
9019
- }), this.keepAliveOpts.enabled && setupPingInterval(
9020
- ws,
9021
- this.keepAliveOpts
9022
- ), ws.addEventListener("close", () => {
9023
- this.ws === ws && (this.ws = null);
9024
- }), await asyncWsOpen(ws), this.urlOptions.connectionParams && ws.send(await buildConnectionMessage(this.urlOptions.connectionParams, this.encoder));
9025
- });
9026
- try {
9027
- await this.openPromise;
9028
- } finally {
9029
- this.openPromise = null;
9030
- }
9031
- }
9032
- async close() {
9033
- try {
9034
- await this.openPromise;
9035
- } finally {
9036
- var _this$ws;
9037
- (_this$ws = this.ws) === null || _this$ws === void 0 || _this$ws.close();
9038
- }
9039
- }
9040
- };
9041
- _defineProperty(WsConnection, "connectCount", 0);
9042
8882
  var observerKeys = ["onStarted", "onData", "onError", "onStopped", "onComplete", "onConnectionStateChange"], TRPCUntypedClient = class {
9043
8883
  static {
9044
8884
  __name(this, "TRPCUntypedClient");
@@ -9047,7 +8887,11 @@ var observerKeys = ["onStarted", "onData", "onError", "onStopped", "onComplete",
9047
8887
  __name2(this, "TRPCUntypedClient");
9048
8888
  }
9049
8889
  constructor(opts) {
9050
- _defineProperty(this, "links", void 0), _defineProperty(this, "runtime", void 0), _defineProperty(this, "requestId", void 0), this.requestId = 0, this.runtime = {}, this.links = opts.links.map((link) => link(this.runtime));
8890
+ _defineProperty(
8891
+ this,
8892
+ "links",
8893
+ void 0
8894
+ ), _defineProperty(this, "runtime", void 0), _defineProperty(this, "requestId", void 0), this.requestId = 0, this.runtime = {}, this.links = opts.links.map((link) => link(this.runtime));
9051
8895
  }
9052
8896
  $request(opts) {
9053
8897
  var _opts$context;
@@ -9068,7 +8912,13 @@ var observerKeys = ["onStarted", "onData", "onError", "onStopped", "onComplete",
9068
8912
  return this.requestAsPromise({ type: "mutation", path: path2, input, context: opts?.context, signal: opts?.signal });
9069
8913
  }
9070
8914
  subscription(path2, input, opts = {}) {
9071
- const hasCallbacks = observerKeys.some((key) => typeof opts[key] == "function"), observable$ = this.$request({ type: "subscription", path: path2, input, context: opts.context, signal: opts.signal });
8915
+ const hasCallbacks = observerKeys.some((key) => typeof opts[key] == "function"), observable$ = this.$request({
8916
+ type: "subscription",
8917
+ path: path2,
8918
+ input,
8919
+ context: opts.context,
8920
+ signal: opts.signal
8921
+ });
9072
8922
  if (!hasCallbacks) {
9073
8923
  var _opts$signal;
9074
8924
  const data$ = observable((observer) => observable$.subscribe({ next(envelope) {
@@ -9117,9 +8967,7 @@ function createTRPCClientProxy(client) {
9117
8967
  }
9118
8968
  __name(createTRPCClientProxy, "createTRPCClientProxy"), __name2(createTRPCClientProxy, "createTRPCClientProxy");
9119
8969
  function createTRPCClient(opts) {
9120
- return createTRPCClientProxy(
9121
- new TRPCUntypedClient(opts)
9122
- );
8970
+ return createTRPCClientProxy(new TRPCUntypedClient(opts));
9123
8971
  }
9124
8972
  __name(createTRPCClient, "createTRPCClient"), __name2(createTRPCClient, "createTRPCClient");
9125
8973
  function _OverloadYield2(e, d) {
@@ -9149,7 +8997,10 @@ function AsyncGenerator2(e) {
9149
8997
  function settle2(e2, r) {
9150
8998
  e2 === 2 ? t.reject(r) : t.resolve({ value: r, done: e2 }), (t = t.next) ? resume(t.key, t.arg) : n = null;
9151
8999
  }
9152
- __name(settle2, "settle2"), __name2(settle2, "settle"), this._invoke = function(e2, r) {
9000
+ __name(settle2, "settle2"), __name2(
9001
+ settle2,
9002
+ "settle"
9003
+ ), this._invoke = function(e2, r) {
9153
9004
  return new Promise(function(o, u) {
9154
9005
  var i = { key: e2, arg: r, resolve: o, reject: u, next: null };
9155
9006
  n ? n = n.next = i : (t = n = i, resume(e2, r));
@@ -9188,24 +9039,15 @@ var normalizeApiBaseUrl = __name2((value) => {
9188
9039
  }
9189
9040
  const isLocalHttp = url.protocol === "http:" && (url.hostname === "localhost" || url.hostname === "127.0.0.1");
9190
9041
  if (url.protocol !== "https:" && !isLocalHttp) throw new CliConfigurationError("Event Tech API URL must use HTTPS, except for localhost development.");
9191
- return url.pathname = url.pathname.replace(new __cliRegExp("\\/$", ""), ""), url.toString().replace(
9192
- new __cliRegExp("\\/$", ""),
9193
- ""
9194
- );
9042
+ return url.pathname = url.pathname.replace(new __cliRegExp("\\/$", ""), ""), url.toString().replace(new __cliRegExp("\\/$", ""), "");
9195
9043
  }, "normalizeApiBaseUrl"), createEventTechClient = __name2((apiBaseUrl, readAccessToken, fetchImplementation = fetch) => createTRPCClient({ links: [httpBatchLink({ url: "".concat(apiBaseUrl, "/api/trpc"), transformer: SuperJSON, fetch: fetchImplementation, headers: __name2(() => ({ Authorization: "Bearer ".concat(readAccessToken()), "x-trpc-source": "event-tech-cli" }), "headers") })] }), "createEventTechClient"), createEventTechPublicClient = __name2((apiBaseUrl, fetchImplementation = fetch) => createTRPCClient({ links: [httpBatchLink({ url: "".concat(apiBaseUrl, "/api/trpc"), transformer: SuperJSON, fetch: fetchImplementation, headers: __name2(() => ({ "x-trpc-source": "event-tech-cli" }), "headers") })] }), "createEventTechPublicClient"), activeApiBaseUrl = DEFAULT_EVENT_TECH_API_BASE_URL, activeAccessToken, readActiveAccessToken = __name2(() => {
9196
9044
  if (!activeAccessToken) throw new CliConfigurationError("Not authenticated. Run `et auth login` first.");
9197
9045
  return activeAccessToken;
9198
- }, "readActiveAccessToken"), activeClient = createEventTechClient(
9199
- activeApiBaseUrl,
9200
- readActiveAccessToken
9201
- ), activePublicClient = createEventTechPublicClient(activeApiBaseUrl), testingClient, configureEventTechApiBaseUrl = __name2((value) => (activeApiBaseUrl = normalizeApiBaseUrl(value), activeClient = createEventTechClient(activeApiBaseUrl, readActiveAccessToken), activePublicClient = createEventTechPublicClient(activeApiBaseUrl), activeApiBaseUrl), "configureEventTechApiBaseUrl"), configureEventTechApiFromEnvironment = __name2(() => configureEventTechApiBaseUrl(process.env.EVENT_TECH_API_URL ?? DEFAULT_EVENT_TECH_API_BASE_URL), "configureEventTechApiFromEnvironment"), getEventTechApiBaseUrl = __name2(() => activeApiBaseUrl, "getEventTechApiBaseUrl"), configureEventTechAccessToken = __name2((accessToken) => {
9046
+ }, "readActiveAccessToken"), activeClient = createEventTechClient(activeApiBaseUrl, readActiveAccessToken), activePublicClient = createEventTechPublicClient(activeApiBaseUrl), testingClient, configureEventTechApiBaseUrl = __name2((value) => (activeApiBaseUrl = normalizeApiBaseUrl(value), activeClient = createEventTechClient(activeApiBaseUrl, readActiveAccessToken), activePublicClient = createEventTechPublicClient(activeApiBaseUrl), activeApiBaseUrl), "configureEventTechApiBaseUrl"), configureEventTechApiFromEnvironment = __name2(() => configureEventTechApiBaseUrl(process.env.EVENT_TECH_API_URL ?? DEFAULT_EVENT_TECH_API_BASE_URL), "configureEventTechApiFromEnvironment"), getEventTechApiBaseUrl = __name2(() => activeApiBaseUrl, "getEventTechApiBaseUrl"), configureEventTechAccessToken = __name2((accessToken) => {
9202
9047
  activeAccessToken = accessToken;
9203
9048
  }, "configureEventTechAccessToken"), api2 = new Proxy({}, { get: __name2((_target, property, receiver) => Reflect.get(property === "public" ? testingClient ?? activePublicClient : testingClient ?? activeClient, property, receiver), "get") });
9204
9049
  import { readFile as readFile2 } from "fs/promises";
9205
- var processRuntime = {
9206
- stdout: process.stdout,
9207
- stderr: process.stderr
9208
- };
9050
+ var processRuntime = { stdout: process.stdout, stderr: process.stderr };
9209
9051
  class CliUsageError extends Error {
9210
9052
  static {
9211
9053
  __name(this, "CliUsageError");
@@ -9218,9 +9060,12 @@ class CliUsageError extends Error {
9218
9060
  super(message), this.name = "CliUsageError";
9219
9061
  }
9220
9062
  }
9221
- var canonicalize = __name2((value) => Array.isArray(value) ? value.map(canonicalize) : value instanceof Date ? value.toJSON() : typeof value == "object" && value !== null ? Object.fromEntries(Object.entries(value).sort(([left], [right]) => left.localeCompare(right)).map(([key, nested]) => [key, canonicalize(nested)])) : value, "canonicalize"), serialize = __name2((value) => "".concat(JSON.stringify(canonicalize(value), null, 2), "\n"), "serialize"), writeSuccess = __name2((runtime, data) => {
9222
- runtime.stdout.write(serialize({ ok: !0, data }));
9223
- }, "writeSuccess"), sanitizeErrorMessage = __name2((message) => message.replace(new __cliRegExp("\\bBearer\\s+\\S+", "giu"), "Bearer [REDACTED]"), "sanitizeErrorMessage"), errorCode = __name2((error2) => {
9063
+ var canonicalize = __name2((value) => Array.isArray(value) ? value.map(canonicalize) : value instanceof Date ? value.toJSON() : typeof value == "object" && value !== null ? Object.fromEntries(Object.entries(value).sort(([left], [right]) => left.localeCompare(right)).map(([key, nested]) => [key, canonicalize(nested)])) : value, "canonicalize"), serialize = __name2((value) => "".concat(JSON.stringify(canonicalize(value), null, 2), "\n"), "serialize"), writeSuccess = __name2(
9064
+ (runtime, data) => {
9065
+ runtime.stdout.write(serialize({ ok: !0, data }));
9066
+ },
9067
+ "writeSuccess"
9068
+ ), sanitizeErrorMessage = __name2((message) => message.replace(new __cliRegExp("\\bBearer\\s+\\S+", "giu"), "Bearer [REDACTED]"), "sanitizeErrorMessage"), errorCode = __name2((error2) => {
9224
9069
  if (error2 instanceof CliUsageError || error2 instanceof CliConfigurationError) return error2.code;
9225
9070
  if (typeof error2 == "object" && error2 !== null && "data" in error2) {
9226
9071
  const data = error2.data;
@@ -9269,9 +9114,7 @@ var canonicalize = __name2((value) => Array.isArray(value) ? value.map(canonical
9269
9114
  if (!value) throw new CliUsageError("--".concat(name, " is required."));
9270
9115
  return value;
9271
9116
  }, "getRequiredFlag"), assertOnlyFlags = __name2((parsed, allowedFlags) => {
9272
- const allowed = /* @__PURE__ */ new Set(
9273
- ["api-url", ...allowedFlags]
9274
- ), unknown2 = [...parsed.flags.keys()].filter((name) => !allowed.has(name));
9117
+ const allowed = /* @__PURE__ */ new Set(["api-url", ...allowedFlags]), unknown2 = [...parsed.flags.keys()].filter((name) => !allowed.has(name));
9275
9118
  if (unknown2.length > 0) throw new CliUsageError("Unknown option".concat(unknown2.length === 1 ? "" : "s", ": ").concat(unknown2.map((name) => "--".concat(name)).join(", "), "."));
9276
9119
  }, "assertOnlyFlags"), assertPositionalCount = __name2((parsed, expectedCount) => {
9277
9120
  if (parsed.positionals.length !== expectedCount) throw new CliUsageError("Unexpected positional arguments.");
@@ -9280,9 +9123,7 @@ var canonicalize = __name2((value) => Array.isArray(value) ? value.map(canonical
9280
9123
  if (getRequiredFlag(parsed, "target") !== eventId) throw new CliUsageError("--target must exactly match --event-id.");
9281
9124
  }, "assertStateChangeTarget"), readInlineOrFile = __name2(async (parsed, inlineFlag, fileFlag) => {
9282
9125
  const inlineValue = getOptionalFlag(parsed, inlineFlag), filePath = getOptionalFlag(parsed, fileFlag);
9283
- if (inlineValue === void 0 == (filePath === void 0)) throw new CliUsageError(
9284
- "Provide exactly one of --".concat(inlineFlag, " or --").concat(fileFlag, ".")
9285
- );
9126
+ if (inlineValue === void 0 == (filePath === void 0)) throw new CliUsageError("Provide exactly one of --".concat(inlineFlag, " or --").concat(fileFlag, "."));
9286
9127
  if (inlineValue !== void 0) return inlineValue;
9287
9128
  try {
9288
9129
  return await readFile2(filePath, "utf8");
@@ -9378,8 +9219,43 @@ var LuckyDrawSegmentText = { NAME: "NAME", LUCKY_DRAW_ID: "LUCKY_DRAW_ID", BOTH:
9378
9219
  prizePositionY: number2(),
9379
9220
  prizeDivWidth: number2(),
9380
9221
  prizeDivHeight: number2()
9381
- }), luckyDrawConfigInputProcedureSchema = object({ eventId: string2(), config: luckyDrawConfigSchema }), luckyDrawConfigInputSchema = object({ ...luckyDrawConfigSchema.omit({ customBackgroundImage: !0 }).shape, customBackgroundImage: union([_instanceof(File), string2()]).optional().nullable() }), DEFAULT_LUCKY_DRAW_CONFIG_INPUT_VALUES = { title: "Lucky Draw Title", titleColor: "#111111", isTitleVisible: !0, titleFontSize: 40, prizeColor: "#111111", prizeFontSize: 30, isPrizeVisible: !0, slotBackgroundColor: "#ffffff", slotBorderColor: "#ffffff", slotTextColor: "#111111", slotFontSize: 5, backgroundPreset: "#ede9fe", numberOfSegments: 12, includeDomains: [], excludeDomains: [], includeEmails: [], excludeEmails: [], segmentPreset: "Vibrant", segmentText: LuckyDrawSegmentText.NAME, luckyDrawType: LuckyDrawType.WHEEL, titleFont: "font-sans", prizeFont: "font-sans", wheelSegmentFont: "font-sans", wheelSegmentFontSize: 12, slotTextFont: "font-sans", customBackgroundImage: null, titlePositionX: 750,
9382
- titlePositionY: 100, slotPositionX: 600, slotPositionY: 300, prizePositionX: 800, prizePositionY: 200, prizeDivWidth: 500, prizeDivHeight: 100, wheelSegmentColorsPreset: "Vibrant" }, luckyDrawPrizeInputSchema = object({ name: string2().min(1), description: string2().optional() }), multipleLuckyDrawPrizeInputSchema = object({ eventId: string2().min(1, "EventID is required"), prizes: array(luckyDrawPrizeInputSchema) }), LUCKY_DRAW_BACKGROUND_FOLDER = "lucky-draw/backgrounds", luckyDrawConfigPatchSchema = luckyDrawConfigSchema.partial().strict(), formatIssues = __name2((label, issues) => "".concat(label, " is invalid: ").concat(issues.map((issue2) => {
9222
+ }), luckyDrawConfigInputProcedureSchema = object({ eventId: string2(), config: luckyDrawConfigSchema }), luckyDrawConfigInputSchema = object({ ...luckyDrawConfigSchema.omit({ customBackgroundImage: !0 }).shape, customBackgroundImage: union([_instanceof(File), string2()]).optional().nullable() }), DEFAULT_LUCKY_DRAW_CONFIG_INPUT_VALUES = {
9223
+ title: "Lucky Draw Title",
9224
+ titleColor: "#111111",
9225
+ isTitleVisible: !0,
9226
+ titleFontSize: 40,
9227
+ prizeColor: "#111111",
9228
+ prizeFontSize: 30,
9229
+ isPrizeVisible: !0,
9230
+ slotBackgroundColor: "#ffffff",
9231
+ slotBorderColor: "#ffffff",
9232
+ slotTextColor: "#111111",
9233
+ slotFontSize: 5,
9234
+ backgroundPreset: "#ede9fe",
9235
+ numberOfSegments: 12,
9236
+ includeDomains: [],
9237
+ excludeDomains: [],
9238
+ includeEmails: [],
9239
+ excludeEmails: [],
9240
+ segmentPreset: "Vibrant",
9241
+ segmentText: LuckyDrawSegmentText.NAME,
9242
+ luckyDrawType: LuckyDrawType.WHEEL,
9243
+ titleFont: "font-sans",
9244
+ prizeFont: "font-sans",
9245
+ wheelSegmentFont: "font-sans",
9246
+ wheelSegmentFontSize: 12,
9247
+ slotTextFont: "font-sans",
9248
+ customBackgroundImage: null,
9249
+ titlePositionX: 750,
9250
+ titlePositionY: 100,
9251
+ slotPositionX: 600,
9252
+ slotPositionY: 300,
9253
+ prizePositionX: 800,
9254
+ prizePositionY: 200,
9255
+ prizeDivWidth: 500,
9256
+ prizeDivHeight: 100,
9257
+ wheelSegmentColorsPreset: "Vibrant"
9258
+ }, luckyDrawPrizeInputSchema = object({ name: string2().min(1), description: string2().optional() }), multipleLuckyDrawPrizeInputSchema = object({ eventId: string2().min(1, "EventID is required"), prizes: array(luckyDrawPrizeInputSchema) }), LUCKY_DRAW_BACKGROUND_FOLDER = "lucky-draw/backgrounds", luckyDrawConfigPatchSchema = luckyDrawConfigSchema.partial().strict(), formatIssues = __name2((label, issues) => "".concat(label, " is invalid: ").concat(issues.map((issue2) => {
9383
9259
  const path2 = issue2.path.map(String).join(".");
9384
9260
  return path2 ? "".concat(path2, ": ").concat(issue2.message) : issue2.message;
9385
9261
  }).join("; "), "."), "formatIssues"), parseLuckyDrawConfigPatch = __name2((raw) => {
@@ -9403,14 +9279,13 @@ titlePositionY: 100, slotPositionX: 600, slotPositionY: 300, prizePositionX: 800
9403
9279
  return result.data;
9404
9280
  });
9405
9281
  }, "parsePrizeList"), loadCurrentConfig = __name2(async (eventId) => (await api2.event.luckyDraw.getLuckyDrawByEventId.query({ eventId })).config, "loadCurrentConfig"), loadPrizes = __name2(async (eventId) => (await api2.event.luckyDraw.getLuckyDrawPrizesByEventId.query({ eventId })).prizes, "loadPrizes"), assertPrizesBelongToEvent = __name2((prizes, prizeIds, eventId) => {
9406
- const known = new Set(prizes.map((prize) => prize.id)), missing = prizeIds.filter((id) => !known.has(id));
9282
+ const known = new Set(prizes.map((prize) => prize.id)), missing = prizeIds.filter((id) => !known.has(
9283
+ id
9284
+ ));
9407
9285
  if (missing.length > 0) throw new CliUsageError("Prize ID(s) not found on event ".concat(eventId, ": ").concat(missing.join(", "), "."));
9408
9286
  }, "assertPrizesBelongToEvent"), saveConfig = __name2((eventId, config) => api2.event.luckyDraw.updateLuckyDrawConfigJson.mutate({ eventId, config }), "saveConfig"), runConfigGet = __name2(async ({ parsed, runtime, authenticate }) => {
9409
9287
  assertPositionalCount(parsed, 3), assertOnlyFlags(parsed, ["event-id"]);
9410
- const eventId = getRequiredFlag(
9411
- parsed,
9412
- "event-id"
9413
- );
9288
+ const eventId = getRequiredFlag(parsed, "event-id");
9414
9289
  await authenticate(), writeSuccess(runtime, await api2.event.luckyDraw.getLuckyDrawByEventId.query({ eventId }));
9415
9290
  }, "runConfigGet"), runConfigUpdate = __name2(async ({ parsed, runtime, authenticate }) => {
9416
9291
  assertPositionalCount(parsed, 3), assertOnlyFlags(parsed, ["event-id", "config", "config-file", "dry-run"]);
@@ -9424,10 +9299,7 @@ titlePositionY: 100, slotPositionX: 600, slotPositionY: 300, prizePositionX: 800
9424
9299
  writeSuccess(runtime, await saveConfig(eventId, config));
9425
9300
  }, "runConfigUpdate"), runBackgroundUpload = __name2(async ({ parsed, runtime, authenticate }) => {
9426
9301
  assertPositionalCount(parsed, 3), assertOnlyFlags(parsed, ["event-id", "file", "content-type"]);
9427
- const eventId = getRequiredFlag(parsed, "event-id"), filePath = getRequiredFlag(parsed, "file"), contentType = getRequiredFlag(
9428
- parsed,
9429
- "content-type"
9430
- );
9302
+ const eventId = getRequiredFlag(parsed, "event-id"), filePath = getRequiredFlag(parsed, "file"), contentType = getRequiredFlag(parsed, "content-type");
9431
9303
  if (!contentType.startsWith("image/")) throw new CliUsageError("--content-type must be an image MIME type.");
9432
9304
  let file;
9433
9305
  try {
@@ -9449,24 +9321,31 @@ titlePositionY: 100, slotPositionX: 600, slotPositionY: 300, prizePositionX: 800
9449
9321
  }, "runBackgroundClear"), runPrizesList = __name2(async ({ parsed, runtime, authenticate }) => {
9450
9322
  assertPositionalCount(parsed, 3), assertOnlyFlags(parsed, ["event-id"]);
9451
9323
  const eventId = getRequiredFlag(parsed, "event-id");
9452
- await authenticate(), writeSuccess(runtime, await api2.event.luckyDraw.getLuckyDrawPrizesByEventId.query({ eventId }));
9324
+ await authenticate(), writeSuccess(
9325
+ runtime,
9326
+ await api2.event.luckyDraw.getLuckyDrawPrizesByEventId.query({ eventId })
9327
+ );
9453
9328
  }, "runPrizesList"), runPrizesCreate = __name2(async ({ parsed, runtime, authenticate }) => {
9454
9329
  assertPositionalCount(parsed, 3), assertOnlyFlags(parsed, ["event-id", "name", "description", "prizes", "prizes-file"]);
9455
9330
  const eventId = getRequiredFlag(parsed, "event-id"), name = getOptionalFlag(parsed, "name"), description = getOptionalFlag(parsed, "description"), hasList = parsed.flags.has("prizes") || parsed.flags.has("prizes-file");
9456
9331
  if (hasList === (name !== void 0)) throw new CliUsageError("Provide either --name [--description] or one of --prizes / --prizes-file.");
9457
9332
  if (hasList && description !== void 0) throw new CliUsageError("--description is only valid with --name; include descriptions in the --prizes JSON.");
9458
9333
  const prizes = parsePrizeList(hasList ? await readInlineOrFile(parsed, "prizes", "prizes-file") : JSON.stringify([{ name, ...description === void 0 ? {} : { description } }]));
9459
- await authenticate(), writeSuccess(runtime, await api2.event.luckyDraw.createLuckyDrawPrize.mutate({ eventId, prizes }));
9334
+ await authenticate(), writeSuccess(runtime, await api2.event.luckyDraw.createLuckyDrawPrize.mutate(
9335
+ { eventId, prizes }
9336
+ ));
9460
9337
  }, "runPrizesCreate"), runPrizesUpdate = __name2(async ({ parsed, runtime, authenticate }) => {
9461
9338
  assertPositionalCount(parsed, 3), assertOnlyFlags(parsed, ["event-id", "prize-id", "name", "description"]);
9462
9339
  const eventId = getRequiredFlag(parsed, "event-id"), prizeId = getRequiredFlag(parsed, "prize-id"), name = getRequiredFlag(parsed, "name"), description = getOptionalFlag(parsed, "description");
9463
- await authenticate(), assertPrizesBelongToEvent(await loadPrizes(
9464
- eventId
9465
- ), [prizeId], eventId), writeSuccess(runtime, await api2.event.luckyDraw.updateLuckyDrawPrize.mutate({ id: prizeId, name, ...description === void 0 ? {} : { description } }));
9340
+ await authenticate(), assertPrizesBelongToEvent(await loadPrizes(eventId), [prizeId], eventId), writeSuccess(runtime, await api2.event.luckyDraw.updateLuckyDrawPrize.mutate({ id: prizeId, name, ...description === void 0 ? {} : { description } }));
9466
9341
  }, "runPrizesUpdate"), runPrizesDelete = __name2(async ({ parsed, runtime, authenticate }) => {
9467
9342
  assertPositionalCount(parsed, 3), assertOnlyFlags(parsed, ["event-id", "prize-ids", "allow-state-change", "target"]);
9468
9343
  const eventId = getRequiredFlag(parsed, "event-id"), prizeIds = parseIdList(getRequiredFlag(parsed, "prize-ids"), "prize-ids");
9469
- assertStateChangeTarget(parsed, eventId), await authenticate(), assertPrizesBelongToEvent(await loadPrizes(eventId), prizeIds, eventId), writeSuccess(runtime, await api2.event.luckyDraw.deleteLuckyDrawPrize.mutate({ prizeIds }));
9344
+ assertStateChangeTarget(parsed, eventId), await authenticate(), assertPrizesBelongToEvent(
9345
+ await loadPrizes(eventId),
9346
+ prizeIds,
9347
+ eventId
9348
+ ), writeSuccess(runtime, await api2.event.luckyDraw.deleteLuckyDrawPrize.mutate({ prizeIds }));
9470
9349
  }, "runPrizesDelete"), runPrizesReorder = __name2(async ({ parsed, runtime, authenticate }) => {
9471
9350
  assertPositionalCount(parsed, 3), assertOnlyFlags(parsed, ["event-id", "prize-ids"]);
9472
9351
  const eventId = getRequiredFlag(parsed, "event-id"), prizeIds = parseIdList(getRequiredFlag(parsed, "prize-ids"), "prize-ids");
@@ -9476,25 +9355,23 @@ titlePositionY: 100, slotPositionX: 600, slotPositionY: 300, prizePositionX: 800
9476
9355
  const namesById = new Map(prizes.map((prize) => [prize.id, prize.name]));
9477
9356
  writeSuccess(runtime, await api2.event.luckyDraw.updateLuckyDrawPrizesOrder.mutate({ eventId, prizes: prizeIds.map((id, order) => ({ id, order, name: namesById.get(id) ?? "" })) }));
9478
9357
  }, "runPrizesReorder"), LUCKY_DRAW_SETUP_HANDLERS = /* @__PURE__ */ new Map([["config get", runConfigGet], ["config update", runConfigUpdate], ["background upload", runBackgroundUpload], ["background clear", runBackgroundClear], ["prizes list", runPrizesList], ["prizes create", runPrizesCreate], ["prizes update", runPrizesUpdate], ["prizes delete", runPrizesDelete], ["prizes reorder", runPrizesReorder]]), runLuckyDrawSetupCommand = __name2(async (input) => {
9479
- const { parsed, runtime, authenticate } = input, [, action, subAction] = parsed.positionals, handler = LUCKY_DRAW_SETUP_HANDLERS.get(
9480
- "".concat(action, " ").concat(subAction)
9481
- );
9358
+ const { parsed, runtime, authenticate } = input, [, action, subAction] = parsed.positionals, handler = LUCKY_DRAW_SETUP_HANDLERS.get("".concat(action, " ").concat(subAction));
9482
9359
  return handler ? (await handler({ parsed, runtime, authenticate }), !0) : !1;
9483
9360
  }, "runLuckyDrawSetupCommand");
9484
9361
  import { readFile as readFile5 } from "fs/promises";
9485
9362
  import { basename as basename3 } from "path";
9486
- var import_jszip = __toESM(require_lib3(), 1), import_papaparse = __toESM(require_papaparse(), 1), MAX_ROWS = 5e4, MAX_COLUMNS = 200, isFilled = __name2((value) => !!value?.trim(), "isFilled"), rowLimitError = __name2(() => new Error("The file has data below row ".concat(MAX_ROWS.toLocaleString("en-US"), ". Remove blank rows or split the file, then try again.")), "rowLimitError"), columnLimitError = __name2(() => new Error("The file has data beyond column ".concat(MAX_COLUMNS, ". Delete the extra columns, then try again.")), "columnLimitError"), clampColumns = __name2((cells) => {
9363
+ var import_jszip = __toESM(require_lib3(), 1), import_papaparse = __toESM(require_papaparse(), 1), MAX_ROWS = 5e4, MAX_COLUMNS = 200, isFilled = __name2((value) => !!value?.trim(), "isFilled"), rowLimitError = __name2(
9364
+ () => new Error("The file has data below row ".concat(MAX_ROWS.toLocaleString("en-US"), ". Remove blank rows or split the file, then try again.")),
9365
+ "rowLimitError"
9366
+ ), columnLimitError = __name2(() => new Error("The file has data beyond column ".concat(MAX_COLUMNS, ". Delete the extra columns, then try again.")), "columnLimitError"), clampColumns = __name2((cells) => {
9487
9367
  if (cells.length <= MAX_COLUMNS) return cells;
9488
9368
  if (cells.slice(MAX_COLUMNS).some(isFilled)) throw columnLimitError();
9489
9369
  return cells.slice(0, MAX_COLUMNS);
9490
- }, "clampColumns"), isZip = __name2((bytes) => bytes[0] === 80 && bytes[1] === 75 && bytes[2] === 3, "isZip"), decodeXml = __name2(
9491
- (value) => value.replace(new __cliRegExp("_x([0-9A-Fa-f]{4})_", "g"), (_, hex) => String.fromCharCode(Number.parseInt(hex, 16))).replace(new __cliRegExp("&#x([0-9A-Fa-f]+);", "g"), (_, hex) => String.fromCodePoint(Number.parseInt(hex, 16))).replace(new __cliRegExp("&#(\\d+);", "g"), (_, digits) => String.fromCodePoint(Number.parseInt(digits, 10))).replace(new __cliRegExp("&lt;", "g"), "<").replace(new __cliRegExp("&gt;", "g"), ">").replace(new __cliRegExp("&quot;", "g"), '"').replace(new __cliRegExp("&apos;", "g"), "'").replace(new __cliRegExp("&amp;", "g"), "&"),
9492
- "decodeXml"
9493
- ), textRuns = __name2((xml) => [...xml.replace(new __cliRegExp("<rPh\\b[\\s\\S]*?<\\/rPh>", "g"), "").matchAll(new __cliRegExp("<t\\b[^>]*>([\\s\\S]*?)<\\/t>", "g"))].map((match) => decodeXml(match[1] ?? "")).join(""), "textRuns"), attribute = __name2((tag, name) => new RegExp("\\s".concat(name, '="([^"]*)"')).exec(tag)?.[1], "attribute"), columnIndex = __name2((reference) => {
9370
+ }, "clampColumns"), isZip = __name2((bytes) => bytes[0] === 80 && bytes[1] === 75 && bytes[2] === 3, "isZip"), decodeXml = __name2((value) => value.replace(new __cliRegExp("_x([0-9A-Fa-f]{4})_", "g"), (_, hex) => String.fromCharCode(Number.parseInt(hex, 16))).replace(new __cliRegExp("&#x([0-9A-Fa-f]+);", "g"), (_, hex) => String.fromCodePoint(Number.parseInt(hex, 16))).replace(new __cliRegExp("&#(\\d+);", "g"), (_, digits) => String.fromCodePoint(Number.parseInt(digits, 10))).replace(new __cliRegExp("&lt;", "g"), "<").replace(new __cliRegExp("&gt;", "g"), ">").replace(new __cliRegExp("&quot;", "g"), '"').replace(new __cliRegExp("&apos;", "g"), "'").replace(new __cliRegExp("&amp;", "g"), "&"), "decodeXml"), textRuns = __name2((xml) => [...xml.replace(new __cliRegExp("<rPh\\b[\\s\\S]*?<\\/rPh>", "g"), "").matchAll(new __cliRegExp("<t\\b[^>]*>([\\s\\S]*?)<\\/t>", "g"))].map((match) => decodeXml(match[1] ?? "")).join(""), "textRuns"), attribute = __name2((tag, name) => new RegExp("\\s".concat(
9371
+ name, '="([^"]*)"')).exec(tag)?.[1], "attribute"), columnIndex = __name2((reference) => {
9494
9372
  const letters = new __cliRegExp("^[A-Z]+", "").exec(reference)?.[0] ?? "";
9495
9373
  let index = 0;
9496
- for (const letter of letters)
9497
- index = index * 26 + letter.charCodeAt(0) - 64;
9374
+ for (const letter of letters) index = index * 26 + letter.charCodeAt(0) - 64;
9498
9375
  return index - 1;
9499
9376
  }, "columnIndex"), sheetPathFromTarget = __name2((target) => target.startsWith("/") ? target.slice(1) : "xl/".concat(target), "sheetPathFromTarget"), readWorkbookSheets = __name2(async (zip) => {
9500
9377
  const workbook = await zip.file("xl/workbook.xml")?.async("string");
@@ -9508,20 +9385,20 @@ var import_jszip = __toESM(require_lib3(), 1), import_papaparse = __toESM(requir
9508
9385
  if (sheetName === void 0) return sheets[0]?.path ?? DEFAULT_SHEET_PATH;
9509
9386
  const wanted = sheetName.trim().toLowerCase(), sheet = sheets.find((candidate) => candidate.name === sheetName) ?? sheets.find((candidate) => candidate.name.trim().toLowerCase() === wanted);
9510
9387
  if (!sheet) throw unknownSheetError(sheetName, sheets);
9511
- if (!sheet.path) throw new Error('The sheet "'.concat(sheet.name, '" could not be read.'));
9388
+ if (!sheet.path) throw new Error('The sheet "'.concat(
9389
+ sheet.name,
9390
+ '" could not be read.'
9391
+ ));
9512
9392
  return sheet.path;
9513
9393
  }, "resolveSheetPath"), cellValue = __name2((cellXml, sharedStrings) => {
9514
9394
  const open3 = new __cliRegExp("^<c\\b[^>]*>", "").exec(cellXml)?.[0] ?? "", type = attribute(open3, "t");
9515
9395
  if (type === "inlineStr") return textRuns(cellXml);
9516
9396
  const raw = new __cliRegExp("<v>([\\s\\S]*?)<\\/v>", "").exec(cellXml)?.[1];
9517
9397
  return raw === void 0 ? "" : type === "s" ? sharedStrings[Number(raw)] ?? "" : type === "b" ? raw === "1" ? "TRUE" : "FALSE" : decodeXml(raw);
9518
- }, "cellValue"), readSharedStrings = __name2(
9519
- async (zip) => {
9520
- const xml = await zip.file("xl/sharedStrings.xml")?.async("string");
9521
- return xml ? [...xml.matchAll(new __cliRegExp("<si\\b[^>]*>([\\s\\S]*?)<\\/si>", "g"))].map((match) => textRuns(match[1] ?? "")) : [];
9522
- },
9523
- "readSharedStrings"
9524
- ), readRowCells = __name2((rowXml, sharedStrings) => {
9398
+ }, "cellValue"), readSharedStrings = __name2(async (zip) => {
9399
+ const xml = await zip.file("xl/sharedStrings.xml")?.async("string");
9400
+ return xml ? [...xml.matchAll(new __cliRegExp("<si\\b[^>]*>([\\s\\S]*?)<\\/si>", "g"))].map((match) => textRuns(match[1] ?? "")) : [];
9401
+ }, "readSharedStrings"), readRowCells = __name2((rowXml, sharedStrings) => {
9525
9402
  const cells = [];
9526
9403
  for (const cellMatch of rowXml.matchAll(new __cliRegExp("<c\\b[^>]*?(?:\\/>|>[\\s\\S]*?<\\/c>)", "g"))) {
9527
9404
  const reference = attribute(cellMatch[0], "r"), column = reference ? columnIndex(reference) : cells.length, value = cellValue(cellMatch[0], sharedStrings);
@@ -9548,7 +9425,9 @@ var import_jszip = __toESM(require_lib3(), 1), import_papaparse = __toESM(requir
9548
9425
  }
9549
9426
  return table;
9550
9427
  }, "readXlsx"), readCsv = __name2((bytes) => {
9551
- const text2 = new TextDecoder("utf-8").decode(bytes).replace(new __cliRegExp("^\\uFEFF", ""), ""), parsed = import_papaparse.default.parse(text2, { skipEmptyLines: !1 }), badQuote = parsed.errors.find((error2) => error2.type === "Quotes");
9428
+ const text2 = new TextDecoder(
9429
+ "utf-8"
9430
+ ).decode(bytes).replace(new __cliRegExp("^\\uFEFF", ""), ""), parsed = import_papaparse.default.parse(text2, { skipEmptyLines: !1 }), badQuote = parsed.errors.find((error2) => error2.type === "Quotes");
9552
9431
  if (badQuote) {
9553
9432
  const near = badQuote.row === void 0 ? "" : " near row ".concat(badQuote.row + 1);
9554
9433
  throw new Error("The CSV has a misplaced or unclosed quote".concat(near, ". Fix it, then try again."));
@@ -9599,7 +9478,9 @@ var import_jszip = __toESM(require_lib3(), 1), import_papaparse = __toESM(requir
9599
9478
  seen.has(key) && context.addIssue({ code: "custom", path: [index], message: '"'.concat(item, '" is listed more than once.') }), seen.add(key);
9600
9479
  });
9601
9480
  }), PASSPORT_STATION_INFO_SUBTITLE_MAX = 80, PASSPORT_STATION_INFO_STEPS_MAX = 8, PASSPORT_STATION_INFO_STEP_MAX = 160, PASSPORT_STATION_INFO_MENU_MAX = 15, PASSPORT_STATION_INFO_MENU_NAME_MAX = 80, PASSPORT_STATION_INFO_MENU_DETAIL_MAX = 200, PASSPORT_STATION_INFO_NOTE_MAX = 240, optionalInfoText = __name2((maximum) => string2().trim().max(maximum).optional().transform((value) => value || void 0), "optionalInfoText"), 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 : void 0), passportStationInfoMenuSchema = array(object({ name: string2().trim().max(PASSPORT_STATION_INFO_MENU_NAME_MAX), detail: optionalInfoText(PASSPORT_STATION_INFO_MENU_DETAIL_MAX), contains: optionalInfoText(PASSPORT_STATION_INFO_MENU_DETAIL_MAX) })).transform((rows) => rows.filter((row) => row.name !== "" || row.
9602
- detail || row.contains).map(({ name, detail, contains }) => ({ name, ...detail ? { detail } : {}, ...contains ? { contains } : {} }))).pipe(array(object({ name: string2().min(1, "Menu items need a name."), detail: string2().optional(), contains: string2().optional() })).max(PASSPORT_STATION_INFO_MENU_MAX)).transform((rows) => rows.length > 0 ? rows : void 0), passportStationInfoSchema = object({ subtitle: optionalInfoText(PASSPORT_STATION_INFO_SUBTITLE_MAX), steps: passportStationInfoStepsSchema.optional(), menu: passportStationInfoMenuSchema.optional(), note: optionalInfoText(PASSPORT_STATION_INFO_NOTE_MAX) }).transform((info) => {
9481
+ detail || row.contains).map(({ name, detail, contains }) => ({ name, ...detail ? { detail } : {}, ...contains ? { contains } : {} }))).pipe(array(
9482
+ object({ name: string2().min(1, "Menu items need a name."), detail: string2().optional(), contains: string2().optional() })
9483
+ ).max(PASSPORT_STATION_INFO_MENU_MAX)).transform((rows) => rows.length > 0 ? rows : void 0), passportStationInfoSchema = object({ subtitle: optionalInfoText(PASSPORT_STATION_INFO_SUBTITLE_MAX), steps: passportStationInfoStepsSchema.optional(), menu: passportStationInfoMenuSchema.optional(), note: optionalInfoText(PASSPORT_STATION_INFO_NOTE_MAX) }).transform((info) => {
9603
9484
  const normalised = { ...info.subtitle ? { subtitle: info.subtitle } : {}, ...info.steps ? { steps: info.steps } : {}, ...info.menu ? { menu: info.menu } : {}, ...info.note ? { note: info.note } : {} };
9604
9485
  return Object.keys(normalised).length > 0 ? normalised : void 0;
9605
9486
  }), passportStationInfoInputSchema = union([_null3(), passportStationInfoSchema.transform((info) => info ?? null)]), passportLoginMethodsSchema = object({ emailOtp: boolean2(), google: boolean2(), guest: boolean2(), staffId: boolean2().default(!1), staffIdRequiresLastName: boolean2().default(!0) }).strict().refine((methods) => methods.emailOtp || methods.google || methods.staffId, { message: "Keep email OTP, Google or roster sign-in available for passport recovery." }), PASSPORT_QUEUE_STATUSES = ["UNDER_10_MIN", "UNDER_30_MIN", "OVER_30_MIN"], passportQueueStatusSchema = _enum(PASSPORT_QUEUE_STATUSES), PASSPORT_QUEUE_STATUS_STALE_MINUTES_MIN = 1, PASSPORT_QUEUE_STATUS_STALE_MINUTES_MAX = 240, PASSPORT_STAFF_ID_LABEL_DEFAULT = "Employee Number", PASSPORT_STAFF_ID_LABEL_MAX = 40, passportStaffIdLabelSchema = string2().trim().min(1).max(PASSPORT_STAFF_ID_LABEL_MAX), passportConfigSchema = object({ version: literal(1), loginMethods: passportLoginMethodsSchema, guestScan: boolean2().optional(),
@@ -9609,32 +9490,38 @@ simplifiedChinese: boolean2().optional(), staffIdLabel: passportStaffIdLabelSche
9609
9490
  const tally = config.collectionMode === "STAFF_TALLY";
9610
9491
  tally && !config.tallyItems && context.addIssue({ code: "custom", path: ["tallyItems"], message: "Tally stations need at least one item." }), !tally && (config.tallyItems !== void 0 || config.tallyEarnsStamp !== void 0) && context.addIssue({ code: "custom", path: ["tallyItems"], message: "Only tally stations can list items." }), config.prizeDeskAward === !0 && (PRIZE_DESK_AWARD_MODES.includes(config.collectionMode) || context.addIssue({ code: "custom", path: ["prizeDeskAward"], message: "Only self-scan and staff-scan stations can be awarded at the prize desk." }), config.category === "BINGO" && context.addIssue({ code: "custom", path: ["prizeDeskAward"], message: "The Bingo station cannot be awarded at the prize desk." })), config.collectionMode !== "STAFF_SCORE" && config.maxPoints !== 0 && context.addIssue({ code: "custom", path: ["maxPoints"], message: "Only scored stations can award points." }), config.collectionMode !== "SELF_SCAN" && config.printedQrEnabled && context.addIssue(
9611
9492
  { code: "custom", path: ["printedQrEnabled"], message: "Only self-scan stations can issue printed QR codes." });
9612
- }), passportStationCollectionSchema = discriminatedUnion("collectionMode", [object({ showHowToCollect: boolean2().optional(), showMyQr: boolean2().optional(), collectionMode: literal("SELF_SCAN"), stampValue: stampValueSchema.optional(), category: passportStationCategorySchema.optional(), prizeDeskAward: boolean2().optional(), info: passportStationInfoInputSchema.optional() }).strict(), object({
9493
+ }), passportStationCollectionSchema = discriminatedUnion("collectionMode", [object({
9613
9494
  showHowToCollect: boolean2().optional(),
9614
9495
  showMyQr: boolean2().optional(),
9615
- collectionMode: literal("STAFF_SCAN"),
9616
- menuItems: passportMenuItemsSchema.nullable().optional(),
9617
- collectionLimit: _enum(["ONCE", "UNLIMITED"]).optional(),
9496
+ collectionMode: literal("SELF_SCAN"),
9618
9497
  stampValue: stampValueSchema.optional(),
9619
9498
  category: passportStationCategorySchema.optional(),
9620
9499
  prizeDeskAward: boolean2().optional(),
9621
9500
  info: passportStationInfoInputSchema.optional()
9622
- }).strict(), object({ showHowToCollect: boolean2().optional(), showMyQr: boolean2().optional(), collectionMode: literal("STAFF_SCORE"), maxPoints: pointsSchema, stampValue: stampValueSchema.optional(), category: passportStationCategorySchema.optional(), info: passportStationInfoInputSchema.optional() }).strict(), object({ showHowToCollect: boolean2().optional(), showMyQr: boolean2().optional(), collectionMode: literal("STAFF_TALLY"), tallyItems: passportTallyItemsSchema, tallyEarnsStamp: boolean2().default(!1), stampValue: stampValueSchema.optional(), category: passportStationCategorySchema.optional(), info: passportStationInfoInputSchema.optional() }).strict()]), passportEventIdSchema = object({ eventId: string2().min(1) }), passportStationIdSchema = passportEventIdSchema.extend({ stationId: string2().min(1) }), passportQrInputSchema = passportEventIdSchema.extend({ code: string2().min(1).max(2048) }), passportPrintQrMutationSchema = passportStationIdSchema.extend({ expectedPrintedQrVersion: printVersionSchema }),
9623
- collectPassportStampByStaffSchema = passportStationIdSchema.extend({ profileCode: string2().min(1).max(2048), site: string2().trim().min(1).max(60).optional(), requestId: uuid2().optional(), points: pointsSchema.optional(), item: string2().trim().min(1).max(PASSPORT_TALLY_ITEM_NAME_MAX).optional() }), recordPassportTallySchema = passportStationIdSchema.extend({ profileCode: string2().min(1).max(2048), item: string2().trim().min(1).max(PASSPORT_TALLY_ITEM_NAME_MAX), quantity: number2().int().min(1).max(PASSPORT_TALLY_QUANTITY_MAX).default(1) }), reversePassportTallySchema = passportEventIdSchema.extend({ tallyId: string2().min(1), reason: string2().trim().min(1).max(200) }), correctPassportStampSchema = passportStationIdSchema.extend({ participantId: string2().min(1), collectionId: string2().min(1).optional(), site: string2().trim().min(1).max(60).optional(), stamped: boolean2(), reason: string2().trim().min(1).max(500), points: pointsSchema.optional(), item: string2().trim().min(
9624
- 1
9625
- ).max(PASSPORT_TALLY_ITEM_NAME_MAX).optional() }), beginPassportAccountLinkSchema = discriminatedUnion("method", [passportEventIdSchema.extend({ method: literal("EMAIL_OTP"), email: string2().trim().toLowerCase().pipe(email2()) }).strict(), passportEventIdSchema.extend({ method: literal("GOOGLE") }).strict()]), passportAccountLinkIntentSchema = passportEventIdSchema.extend({ intent: string2().regex(new __cliRegExp("^epl1\\.[A-Za-z0-9_-]{43}$", "")) }), requestPassportAccountLinkOtpSchema = passportAccountLinkIntentSchema.extend({ email: string2().trim().toLowerCase().pipe(email2()) }), joinPassportSchema = passportEventIdSchema.extend({ name: string2().trim().min(1).max(100) }), passportCategoryLabelInputSchema = string2().trim().max(PASSPORT_CATEGORY_LABEL_MAX), passportCategoryLabelEntryInputSchema = strictObject({ en: passportCategoryLabelInputSchema.optional(), "zh-CN": passportCategoryLabelInputSchema.optional() }), passportCategoryLabelsInputSchema = strictObject({ GAME: passportCategoryLabelEntryInputSchema.
9626
- optional(), FOOD: passportCategoryLabelEntryInputSchema.optional(), DRINK: passportCategoryLabelEntryInputSchema.optional(), BINGO: passportCategoryLabelEntryInputSchema.optional() }).transform((labels) => sanitizePassportCategoryLabels(labels) ?? {}), passportSettingsSchema = passportEventIdSchema.extend({ luckyDrawStampThreshold: number2().int().positive().nullable(), prizeStampThreshold: number2().int().positive().nullable(), maxRedemptionsPerParticipant: number2().int().min(0).max(2147483647), linkedDrawEventId: string2().min(1).nullable(), loginMethods: passportLoginMethodsSchema.optional(), guestScan: boolean2().optional(), simplifiedChinese: boolean2().optional(), staffIdLabel: union([_null3(), string2().trim().max(PASSPORT_STAFF_ID_LABEL_MAX).transform((label) => label === "" ? null : label)]).optional(), categoryLabels: union([_null3(), passportCategoryLabelsInputSchema]).optional(), queueStatus: boolean2().optional(), queueStatusStaleMinutes: number2().int().min(PASSPORT_QUEUE_STATUS_STALE_MINUTES_MIN).
9627
- max(PASSPORT_QUEUE_STATUS_STALE_MINUTES_MAX).nullable().optional() }), setPassportStationQueueStatusSchema = passportEventIdSchema.extend({ stationId: string2().min(1), status: passportQueueStatusSchema.nullable() }), renamePassportBingoSchema = passportEventIdSchema.extend({ name: string2().trim().min(1).max(100) }), passportStationSchema = passportEventIdSchema.extend({ id: string2().optional(), name: string2().trim().min(1).max(100), description: string2().trim().max(1e3).nullable(), location: string2().trim().max(200).nullable(), address: string2().trim().max(300).nullable().optional(), imageKey: string2().nullable().optional(), order: number2().int().min(0), opensAt: date2().nullable(), closesAt: date2().nullable(), collection: passportStationCollectionSchema.optional() }), passportPrizeSchema = passportEventIdSchema.extend({ id: string2().optional(), name: string2().trim().min(1).max(100), description: string2().trim().max(1e3).nullable(), imageKey: string2().max(2048).nullable().
9628
- optional(), stock: number2().int().min(0), stampCost: number2().int().min(0).max(PASSPORT_PRIZE_STAMP_COST_MAX).optional(), order: number2().int().min(0) }), passportRedemptionRequestIdSchema = uuid2(), redeemPassportPrizeSchema = passportEventIdSchema.extend({ participantId: string2().min(1), prizeId: string2().min(1), quantity: number2().int().min(1).max(PASSPORT_REDEMPTION_QUANTITY_MAX).default(1), awardStationId: string2().min(1).optional(), bonusStamps: passportBonusStampsSchema.default(0), requestId: passportRedemptionRequestIdSchema.optional() }), PASSPORT_ROSTER_STAFF_ID_MAX = 64, PASSPORT_ROSTER_NAME_MAX = 100, PASSPORT_ROSTER_IMPORT_MAX = 2e4, PASSPORT_ROSTER_PAGE_MAX = 100, normalizePassportRosterKey = __name2((value) => value.normalize("NFKD").replace(new __cliRegExp("\\p{M}", "gu"), "").toLocaleLowerCase("en").replace(new __cliRegExp("[^\\p{L}\\p{N}]", "gu"), ""), "normalizePassportRosterKey"), rosterStaffIdSchema = string2().trim().min(1, "Enter an ID.").max(PASSPORT_ROSTER_STAFF_ID_MAX).
9629
- refine((value) => normalizePassportRosterKey(value) !== "", { message: "The ID needs at least one letter or digit." }), rosterLastNameSchema = string2().trim().min(1, "Enter a last name.").max(PASSPORT_ROSTER_NAME_MAX).refine((value) => normalizePassportRosterKey(
9630
- value
9631
- ) !== "", { message: "Last name needs at least one letter or digit." }), 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." }), passportStaffIdSignInSchema = passportEventIdSchema.extend({ staffId: rosterStaffIdSchema, lastName: rosterLastNameSchema.optional() }).strict(), passportRosterEntrySchema = passportEventIdSchema.extend({ id: string2().min(1).optional(), staffId: rosterStaffIdSchema, lastName: rosterOptionalLastNameSchema, displayName: string2().trim().max(PASSPORT_ROSTER_NAME_MAX).nullable().transform((value) => value || null) }).strict(), passportRosterEntryIdSchema = passportEventIdSchema.extend({ entryId: string2().min(1) }).strict(), passportRosterListSchema = passportEventIdSchema.extend({ search: string2().trim().max(200).optional(), limit: number2().int().min(1).
9632
- max(PASSPORT_ROSTER_PAGE_MAX).default(25), cursor: string2().min(
9633
- 1
9634
- ).max(8192).nullish(), direction: literal("forward").optional() }).strict(), passportRosterCountsSchema = passportEventIdSchema.extend({ search: string2().trim().max(200).optional() }).strict(), passportRosterImportRowSchema = object({ row: number2().int().min(1), staffId: string2().max(1e3), lastName: string2().max(1e3), displayName: string2().max(1e3).nullable() }).strict(), importPassportRosterSchema = passportEventIdSchema.extend({ rows: array(passportRosterImportRowSchema).max(PASSPORT_ROSTER_IMPORT_MAX, "A roster can have at most ".concat(PASSPORT_ROSTER_IMPORT_MAX, " rows.")) }).strict(), passportRosterRejectReasonLabels = __name2((staffIdLabel) => ({ MISSING_STAFF_ID: "The ".concat(staffIdLabel, " is blank"), MISSING_LAST_NAME: "Last name is blank", DUPLICATE_STAFF_ID: "The ".concat(staffIdLabel, " appears earlier in the file"), TOO_LONG: "The ".concat(staffIdLabel, " is over ").concat(PASSPORT_ROSTER_STAFF_ID_MAX, " characters or a name is over ").concat(PASSPORT_ROSTER_NAME_MAX) }),
9635
- "passportRosterRejectReasonLabels"), passportRosterRejectReasonLabel = passportRosterRejectReasonLabels(
9636
- PASSPORT_STAFF_ID_LABEL_DEFAULT
9637
- ), cell = __name2((row, index) => index === null ? "" : (row[index] ?? "").trim(), "cell"), surnameOf = __name2((fullName, position) => {
9501
+ }).strict(), object({ showHowToCollect: boolean2().optional(), showMyQr: boolean2().optional(), collectionMode: literal("STAFF_SCAN"), menuItems: passportMenuItemsSchema.nullable().optional(), collectionLimit: _enum(["ONCE", "UNLIMITED"]).optional(), stampValue: stampValueSchema.optional(), category: passportStationCategorySchema.optional(), prizeDeskAward: boolean2().optional(), info: passportStationInfoInputSchema.optional() }).strict(), object({ showHowToCollect: boolean2().optional(), showMyQr: boolean2().optional(), collectionMode: literal("STAFF_SCORE"), maxPoints: pointsSchema, stampValue: stampValueSchema.optional(), category: passportStationCategorySchema.optional(), info: passportStationInfoInputSchema.optional() }).strict(), object({ showHowToCollect: boolean2().optional(), showMyQr: boolean2().optional(), collectionMode: literal(
9502
+ "STAFF_TALLY"
9503
+ ), tallyItems: passportTallyItemsSchema, tallyEarnsStamp: boolean2().default(!1), stampValue: stampValueSchema.optional(), category: passportStationCategorySchema.optional(), info: passportStationInfoInputSchema.optional() }).strict()]), passportEventIdSchema = object({ eventId: string2().min(1) }), passportStationIdSchema = passportEventIdSchema.extend({ stationId: string2().min(1) }), passportQrInputSchema = passportEventIdSchema.extend({ code: string2().min(1).max(2048) }), passportPrintQrMutationSchema = passportStationIdSchema.extend({ expectedPrintedQrVersion: printVersionSchema }), collectPassportStampByStaffSchema = passportStationIdSchema.extend({ profileCode: string2().min(1).max(2048), site: string2().trim().min(1).max(60).optional(), requestId: uuid2().optional(), points: pointsSchema.optional(), item: string2().trim().min(1).max(PASSPORT_TALLY_ITEM_NAME_MAX).optional() }), recordPassportTallySchema = passportStationIdSchema.extend({
9504
+ profileCode: string2().min(1).max(2048),
9505
+ item: string2().trim().min(1).max(PASSPORT_TALLY_ITEM_NAME_MAX),
9506
+ quantity: number2().int().min(1).max(PASSPORT_TALLY_QUANTITY_MAX).default(1)
9507
+ }), reversePassportTallySchema = passportEventIdSchema.extend({ tallyId: string2().min(1), reason: string2().trim().min(1).max(200) }), correctPassportStampSchema = passportStationIdSchema.extend({ participantId: string2().min(1), collectionId: string2().min(1).optional(), site: string2().trim().min(1).max(60).optional(), stamped: boolean2(), reason: string2().trim().min(1).max(500), points: pointsSchema.optional(), item: string2().trim().min(1).max(PASSPORT_TALLY_ITEM_NAME_MAX).optional() }), beginPassportAccountLinkSchema = discriminatedUnion("method", [passportEventIdSchema.extend({ method: literal("EMAIL_OTP"), email: string2().trim().toLowerCase().pipe(email2()) }).strict(), passportEventIdSchema.extend({ method: literal("GOOGLE") }).strict()]), passportAccountLinkIntentSchema = passportEventIdSchema.extend({ intent: string2().regex(new __cliRegExp("^epl1\\.[A-Za-z0-9_-]{43}$", "")) }), requestPassportAccountLinkOtpSchema = passportAccountLinkIntentSchema.extend({ email: string2().
9508
+ trim().toLowerCase().pipe(email2()) }), joinPassportSchema = passportEventIdSchema.extend({ name: string2().trim().min(1).max(100) }), passportCategoryLabelInputSchema = string2().trim().max(PASSPORT_CATEGORY_LABEL_MAX), passportCategoryLabelEntryInputSchema = strictObject({ en: passportCategoryLabelInputSchema.optional(), "zh-CN": passportCategoryLabelInputSchema.optional() }), passportCategoryLabelsInputSchema = strictObject({ GAME: passportCategoryLabelEntryInputSchema.optional(), FOOD: passportCategoryLabelEntryInputSchema.optional(), DRINK: passportCategoryLabelEntryInputSchema.optional(), BINGO: passportCategoryLabelEntryInputSchema.optional() }).transform((labels) => sanitizePassportCategoryLabels(labels) ?? {}), passportSettingsSchema = passportEventIdSchema.extend({
9509
+ luckyDrawStampThreshold: number2().int().positive().nullable(),
9510
+ prizeStampThreshold: number2().int().positive().nullable(),
9511
+ maxRedemptionsPerParticipant: number2().int().min(0).max(2147483647),
9512
+ linkedDrawEventId: string2().min(1).nullable(),
9513
+ loginMethods: passportLoginMethodsSchema.optional(),
9514
+ guestScan: boolean2().optional(),
9515
+ simplifiedChinese: boolean2().optional(),
9516
+ staffIdLabel: union([_null3(), string2().trim().max(PASSPORT_STAFF_ID_LABEL_MAX).transform((label) => label === "" ? null : label)]).optional(),
9517
+ categoryLabels: union([_null3(), passportCategoryLabelsInputSchema]).optional(),
9518
+ queueStatus: boolean2().optional(),
9519
+ queueStatusStaleMinutes: number2().int().min(PASSPORT_QUEUE_STATUS_STALE_MINUTES_MIN).max(PASSPORT_QUEUE_STATUS_STALE_MINUTES_MAX).nullable().optional()
9520
+ }), setPassportStationQueueStatusSchema = passportEventIdSchema.extend({ stationId: string2().min(1), status: passportQueueStatusSchema.nullable() }), renamePassportBingoSchema = passportEventIdSchema.extend({ name: string2().trim().min(1).max(100) }), passportStationSchema = passportEventIdSchema.extend({ id: string2().optional(), name: string2().trim().min(1).max(100), description: string2().trim().max(1e3).nullable(), location: string2().trim().max(200).nullable(), address: string2().trim().max(300).nullable().optional(), imageKey: string2().nullable().optional(), order: number2().int().min(0), opensAt: date2().nullable(), closesAt: date2().nullable(), collection: passportStationCollectionSchema.optional() }), passportPrizeSchema = passportEventIdSchema.extend({ id: string2().optional(), name: string2().trim().min(1).max(100), description: string2().trim().max(1e3).nullable(), imageKey: string2().max(2048).nullable().optional(), stock: number2().int().min(0), stampCost: number2().int().
9521
+ min(0).max(PASSPORT_PRIZE_STAMP_COST_MAX).optional(), order: number2().int().min(0) }), passportRedemptionRequestIdSchema = uuid2(), redeemPassportPrizeSchema = passportEventIdSchema.extend({ participantId: string2().min(1), prizeId: string2().min(1), quantity: number2().int().min(1).max(PASSPORT_REDEMPTION_QUANTITY_MAX).default(1), awardStationId: string2().min(1).optional(), bonusStamps: passportBonusStampsSchema.default(0), requestId: passportRedemptionRequestIdSchema.optional() }), PASSPORT_ROSTER_STAFF_ID_MAX = 64, PASSPORT_ROSTER_NAME_MAX = 100, PASSPORT_ROSTER_IMPORT_MAX = 2e4, PASSPORT_ROSTER_PAGE_MAX = 100, normalizePassportRosterKey = __name2((value) => value.normalize("NFKD").replace(new __cliRegExp("\\p{M}", "gu"), "").toLocaleLowerCase("en").replace(new __cliRegExp("[^\\p{L}\\p{N}]", "gu"), ""), "normalizePassportRosterKey"), rosterStaffIdSchema = string2().trim().min(1, "Enter an ID.").max(PASSPORT_ROSTER_STAFF_ID_MAX).refine((value) => normalizePassportRosterKey(value) !==
9522
+ "", { message: "The ID needs at least one letter or digit." }), rosterLastNameSchema = string2().trim().min(1, "Enter a last name.").max(PASSPORT_ROSTER_NAME_MAX).refine((value) => normalizePassportRosterKey(value) !== "", { message: "Last name needs at least one letter or digit." }), 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." }), passportStaffIdSignInSchema = passportEventIdSchema.extend({ staffId: rosterStaffIdSchema, lastName: rosterLastNameSchema.optional() }).strict(), passportRosterEntrySchema = passportEventIdSchema.extend({ id: string2().min(1).optional(), staffId: rosterStaffIdSchema, lastName: rosterOptionalLastNameSchema, displayName: string2().trim().max(PASSPORT_ROSTER_NAME_MAX).nullable().transform((value) => value || null) }).strict(), passportRosterEntryIdSchema = passportEventIdSchema.
9523
+ extend({ entryId: string2().min(1) }).strict(), passportRosterListSchema = passportEventIdSchema.extend({ search: string2().trim().max(200).optional(), limit: number2().int().min(1).max(PASSPORT_ROSTER_PAGE_MAX).default(25), cursor: string2().min(1).max(8192).nullish(), direction: literal("forward").optional() }).strict(), passportRosterCountsSchema = passportEventIdSchema.extend({ search: string2().trim().max(200).optional() }).strict(), passportRosterImportRowSchema = object({ row: number2().int().min(1), staffId: string2().max(1e3), lastName: string2().max(1e3), displayName: string2().max(1e3).nullable() }).strict(), importPassportRosterSchema = passportEventIdSchema.extend({ rows: array(passportRosterImportRowSchema).max(PASSPORT_ROSTER_IMPORT_MAX, "A roster can have at most ".concat(PASSPORT_ROSTER_IMPORT_MAX, " rows.")) }).strict(), passportRosterRejectReasonLabels = __name2((staffIdLabel) => ({ MISSING_STAFF_ID: "The ".concat(staffIdLabel, " is blank"), MISSING_LAST_NAME: "Last \
9524
+ name is blank", DUPLICATE_STAFF_ID: "The ".concat(staffIdLabel, " appears earlier in the file"), TOO_LONG: "The ".concat(staffIdLabel, " is over ").concat(PASSPORT_ROSTER_STAFF_ID_MAX, " characters or a name is over ").concat(PASSPORT_ROSTER_NAME_MAX) }), "passportRosterRejectReasonLabels"), passportRosterRejectReasonLabel = passportRosterRejectReasonLabels(PASSPORT_STAFF_ID_LABEL_DEFAULT), cell = __name2((row, index) => index === null ? "" : (row[index] ?? "").trim(), "cell"), surnameOf = __name2((fullName, position) => {
9638
9525
  const words = fullName.split(new __cliRegExp("\\s+", "")).filter(Boolean);
9639
9526
  return (position === "first" ? words[0] : words.at(-1)) ?? "";
9640
9527
  }, "surnameOf"), assertPassportRosterMapping = __name2((mapping, columnCount, requireLastName) => {
@@ -9645,25 +9532,22 @@ max(PASSPORT_ROSTER_PAGE_MAX).default(25), cursor: string2().min(
9645
9532
  const rows = [];
9646
9533
  if (table.slice(1).forEach((row, index) => {
9647
9534
  if (row.every((value) => value.trim() === "")) return;
9648
- const fullName = cell(
9649
- row,
9650
- mapping.fullName
9651
- ), lastName = mapping.lastName === null ? surnameOf(fullName, mapping.surnamePosition) : cell(row, mapping.lastName), displayName = cell(row, mapping.displayName ?? mapping.fullName) || null;
9535
+ const fullName = cell(row, mapping.fullName), lastName = mapping.lastName === null ? surnameOf(fullName, mapping.surnamePosition) : cell(row, mapping.lastName), displayName = cell(row, mapping.displayName ?? mapping.fullName) || null;
9652
9536
  rows.push({ row: index + 2, staffId: cell(row, mapping.staffId), lastName, displayName });
9653
9537
  }), rows.length > PASSPORT_ROSTER_IMPORT_MAX) throw new Error("This file has ".concat(rows.length.toLocaleString("en-US"), " rows with data. A roster can have at most ").concat(PASSPORT_ROSTER_IMPORT_MAX.toLocaleString("en-US"), ". Split the file or remove rows you do not need."));
9654
9538
  return rows;
9655
- }, "mapPassportRosterTable"), headerPatterns = { staffId: new __cliRegExp("^(staff|employee|emp|personnel|badge|worker)[\\s_-]*(id|no|number|#|code)?$|^(staff|employee)$|^id$", ""), lastName: new __cliRegExp("^(last[\\s_-]*name|surname|family[\\s_-]*name|lname)$", ""), fullName: new __cliRegExp("^(full[\\s_-]*name|name|staff[\\s_-]*name|employee[\\s_-]*name)$", ""), displayName: new __cliRegExp("^(display[\\s_-]*name|preferred[\\s_-]*name|nickname)$", "") }, guessPassportRosterMapping = __name2(
9656
- (headers) => {
9657
- const find = __name2((pattern) => {
9658
- const index = headers.findIndex((header) => pattern.test(header.trim().toLowerCase()));
9659
- return index === -1 ? null : index;
9660
- }, "find");
9661
- return { staffId: find(headerPatterns.staffId) ?? 0, lastName: find(headerPatterns.lastName), fullName: find(headerPatterns.fullName), displayName: find(headerPatterns.displayName), surnamePosition: "last" };
9662
- },
9663
- "guessPassportRosterMapping"
9664
- ), PASSPORT_STATION_PASSWORD_MIN = 6, PASSPORT_STATION_PASSWORD_MAX = 128, PASSPORT_STATION_RECIPIENTS_PAGE_MAX = 100, stationStaffPasswordSchema = string2().min(PASSPORT_STATION_PASSWORD_MIN, "Use at least ".concat(PASSPORT_STATION_PASSWORD_MIN, " characters.")).max(PASSPORT_STATION_PASSWORD_MAX, "Use at most ".concat(PASSPORT_STATION_PASSWORD_MAX, " characters.")).refine((value) => value === value.trim(), { message: "Remove the spaces at the start or end of the password." }), signInToStationStaffSchema = passportEventIdSchema.extend({ password: string2().min(1).max(PASSPORT_STATION_PASSWORD_MAX) }).strict(), setPassportStationPasswordSchema = passportEventIdSchema.extend({ password: stationStaffPasswordSchema }).strict(), participantCodeSchema = string2().min(1).max(2048), stationStaffParticipantSchema = union([passportStationIdSchema.extend({ profileCode: participantCodeSchema, site: string2().trim().min(1).max(60).optional() }), passportStationIdSchema.extend({ staffId: string2().trim().
9665
- min(1).max(PASSPORT_ROSTER_STAFF_ID_MAX), site: string2().trim().min(1).max(60).optional() })]), stationPrizeClaimParticipantSchema = union([passportEventIdSchema.extend({ profileCode: participantCodeSchema }), passportEventIdSchema.extend({ staffId: string2().trim().min(1).max(PASSPORT_ROSTER_STAFF_ID_MAX) })]), redeemPrizeAsStationStaffSchema = passportEventIdSchema.extend({ profileCode: participantCodeSchema, prizeId: string2().min(1), awardStationId: string2().min(1).optional(), bonusStamps: passportBonusStampsSchema.default(0), requestId: passportRedemptionRequestIdSchema.optional() }).strict(), stationStampRecipientFiltersSchema = object({ search: string2().trim().max(200).optional() }).strict(), passportStationStampRecipientsSchema = passportStationIdSchema.extend({ filters: stationStampRecipientFiltersSchema.default({}), limit: number2().int().min(1).max(PASSPORT_STATION_RECIPIENTS_PAGE_MAX).default(25), cursor: string2().min(1).max(8192).nullish(), direction: _enum(["forward",
9666
- "backward"]).default("forward") }).strict().refine((input) => input.direction === "forward" || !!input.cursor, { message: "A backward page needs a cursor.", path: ["cursor"] }), passportStationStampRecipientCountsSchema = passportStationIdSchema.extend({ filters: stationStampRecipientFiltersSchema.default({}) }).strict();
9539
+ }, "mapPassportRosterTable"), headerPatterns = { staffId: new __cliRegExp("^(staff|employee|emp|personnel|badge|worker)[\\s_-]*(id|no|number|#|code)?$|^(staff|employee)$|^id$", ""), lastName: new __cliRegExp("^(last[\\s_-]*name|surname|family[\\s_-]*name|lname)$", ""), fullName: new __cliRegExp("^(full[\\s_-]*name|name|staff[\\s_-]*name|employee[\\s_-]*name)$", ""), displayName: new __cliRegExp("^(display[\\s_-]*name|preferred[\\s_-]*name|nickname)$", "") }, guessPassportRosterMapping = __name2((headers) => {
9540
+ const find = __name2((pattern) => {
9541
+ const index = headers.findIndex((header) => pattern.test(header.trim().toLowerCase()));
9542
+ return index === -1 ? null : index;
9543
+ }, "find");
9544
+ return { staffId: find(headerPatterns.staffId) ?? 0, lastName: find(headerPatterns.lastName), fullName: find(headerPatterns.fullName), displayName: find(headerPatterns.displayName), surnamePosition: "last" };
9545
+ }, "guessPassportRosterMapping"), PASSPORT_STATION_PASSWORD_MIN = 6, PASSPORT_STATION_PASSWORD_MAX = 128, PASSPORT_STATION_RECIPIENTS_PAGE_MAX = 100, stationStaffPasswordSchema = string2().min(PASSPORT_STATION_PASSWORD_MIN, "Use at least ".concat(PASSPORT_STATION_PASSWORD_MIN, " characters.")).max(PASSPORT_STATION_PASSWORD_MAX, "Use at most ".concat(PASSPORT_STATION_PASSWORD_MAX, " characters.")).refine((value) => value === value.trim(), { message: "Remove the spaces at the start or end of the password." }), signInToStationStaffSchema = passportEventIdSchema.extend({ password: string2().min(1).max(PASSPORT_STATION_PASSWORD_MAX) }).strict(), setPassportStationPasswordSchema = passportEventIdSchema.extend({ password: stationStaffPasswordSchema }).strict(), participantCodeSchema = string2().min(1).max(2048), stationStaffParticipantSchema = union([passportStationIdSchema.extend({ profileCode: participantCodeSchema, site: string2().trim().min(1).max(60).optional() }), passportStationIdSchema.
9546
+ extend({
9547
+ staffId: string2().trim().min(1).max(PASSPORT_ROSTER_STAFF_ID_MAX),
9548
+ site: string2().trim().min(1).max(60).optional()
9549
+ })]), stationPrizeClaimParticipantSchema = union([passportEventIdSchema.extend({ profileCode: participantCodeSchema }), passportEventIdSchema.extend({ staffId: string2().trim().min(1).max(PASSPORT_ROSTER_STAFF_ID_MAX) })]), redeemPrizeAsStationStaffSchema = passportEventIdSchema.extend({ profileCode: participantCodeSchema, prizeId: string2().min(1), awardStationId: string2().min(1).optional(), bonusStamps: passportBonusStampsSchema.default(0), requestId: passportRedemptionRequestIdSchema.optional() }).strict(), stationStampRecipientFiltersSchema = object({ search: string2().trim().max(200).optional() }).strict(), passportStationStampRecipientsSchema = passportStationIdSchema.extend({ filters: stationStampRecipientFiltersSchema.default({}), limit: number2().int().min(1).max(PASSPORT_STATION_RECIPIENTS_PAGE_MAX).default(25), cursor: string2().min(1).max(8192).nullish(), direction: _enum(["forward", "backward"]).default("forward") }).strict().refine((input) => input.direction === "forward" ||
9550
+ !!input.cursor, { message: "A backward page needs a cursor.", path: ["cursor"] }), passportStationStampRecipientCountsSchema = passportStationIdSchema.extend({ filters: stationStampRecipientFiltersSchema.default({}) }).strict();
9667
9551
  import { readFile as readFile4 } from "fs/promises";
9668
9552
  import { basename as basename2 } from "path";
9669
9553
  var MAX_EVENT_IMAGE_UPLOAD_BYTES = 25 * 1024 * 1024, MAX_EVENT_VIDEO_UPLOAD_BYTES = 200 * 1024 * 1024, MAX_HUMAN_BINGO_MEDIA_UPLOAD_BYTES = 1024 * 1024 * 1024, SAFE_IMAGE_CONTENT_TYPES = ["image/jpeg", "image/png", "image/webp", "image/gif"], VIDEO_CONTENT_TYPES = ["video/mp4", "video/quicktime", "video/webm", "video/ogg"], SAFE_EVENT_IMAGE_CONTENT_TYPES = [...SAFE_IMAGE_CONTENT_TYPES], SAFE_EVENT_VIDEO_CONTENT_TYPES = [...VIDEO_CONTENT_TYPES], SAFE_EVENT_UPLOAD_CONTENT_TYPES = [...SAFE_IMAGE_CONTENT_TYPES, ...VIDEO_CONTENT_TYPES], getEventPassportUploadBaseFolder = __name2((kind) => "event-passport/".concat(kind), "getEventPassportUploadBaseFolder"), EVENT_TECH_EVENT_TYPES = Object.values(EventType), HEX_COLOR_PATTERN = new __cliRegExp("^#[0-9a-f]{6}$", "i"), isEventThemeHexColor = __name2((value) => HEX_COLOR_PATTERN.test(value), "isEventThemeHexColor"), DEFAULT_PASSPORT_SKIN_SETTINGS = { heroImage: null, logo: null, colors: { graphic: null, dark: null }, emphasis: "accent" }, isRecord = __name2(
@@ -9679,42 +9563,24 @@ var MAX_EVENT_IMAGE_UPLOAD_BYTES = 25 * 1024 * 1024, MAX_EVENT_VIDEO_UPLOAD_BYTE
9679
9563
  if (!isRecord(value)) return DEFAULT_PASSPORT_SKIN_SETTINGS;
9680
9564
  const colors = isRecord(value.colors) ? value.colors : {};
9681
9565
  return { heroImage: readHeroImage(value.heroImage), logo: readLogo(value.logo), colors: { graphic: toHex(colors.graphic), dark: toHex(colors.dark) }, emphasis: value.emphasis === "ink" ? "ink" : "accent" };
9682
- }, "resolvePassportSkinSettings"), resolvePassportSkinSettingsFromAppearance = __name2((appearance) => resolvePassportSkinSettings(isRecord(appearance) ? appearance.passport : void 0), "resolvePassportSkinSettingsFromAppearance"), photoWallScreenSchema = object({ width: number2().int().min(240).max(16384), height: number2().int().min(240).max(16384) }), photoWallSubmissionSettingsSchema = object({
9683
- mode: _enum(["photo-only", "comment-only", "photo-and-comment"]),
9684
- photoRequired: boolean2(),
9685
- commentRequired: boolean2()
9686
- }), DEFAULT_PHOTO_WALL_SUBMISSION_SETTINGS = { mode: "photo-and-comment", photoRequired: !0, commentRequired: !1 }, hexColorSchema = string2().trim().regex(new __cliRegExp("^#[0-9a-f]{6}$", "i"), "Color must be a six-digit hex color").transform((value) => value.toLowerCase()), getRelativeLuminance = __name2((color) => {
9687
- const toLinear = __name2((channel) => {
9688
- const normalized = channel / 255;
9689
- return normalized <= 0.04045 ? normalized / 12.92 : ((normalized + 0.055) / 1.055) ** 2.4;
9690
- }, "toLinear"), red = toLinear(Number.parseInt(color.slice(1, 3), 16)), green = toLinear(Number.parseInt(color.slice(3, 5), 16)), blue = toLinear(Number.parseInt(color.slice(5, 7), 16));
9691
- return 0.2126 * red + 0.7152 * green + 0.0722 * blue;
9692
- }, "getRelativeLuminance"), hasReadableTextContrast = __name2((textColor, backgroundColor) => {
9566
+ }, "resolvePassportSkinSettings"), resolvePassportSkinSettingsFromAppearance = __name2((appearance) => resolvePassportSkinSettings(isRecord(appearance) ? appearance.passport : void 0), "resolvePassportSkinSettingsFromAppearance"), photoWallScreenSchema = object({ width: number2().int().min(240).max(16384), height: number2().int().min(240).max(16384) }), photoWallSubmissionSettingsSchema = object({ mode: _enum(["photo-only", "comment-only", "photo-and-comment"]), photoRequired: boolean2(), commentRequired: boolean2() }), DEFAULT_PHOTO_WALL_SUBMISSION_SETTINGS = { mode: "photo-and-comment", photoRequired: !0, commentRequired: !1 }, hexColorSchema = string2().trim().regex(new __cliRegExp("^#[0-9a-f]{6}$", "i"), "Color must be a six-digit hex color").transform((value) => value.toLowerCase()), getRelativeLuminance = __name2(
9567
+ (color) => {
9568
+ const toLinear = __name2((channel) => {
9569
+ const normalized = channel / 255;
9570
+ return normalized <= 0.04045 ? normalized / 12.92 : ((normalized + 0.055) / 1.055) ** 2.4;
9571
+ }, "toLinear"), red = toLinear(Number.parseInt(color.slice(1, 3), 16)), green = toLinear(Number.parseInt(color.slice(3, 5), 16)), blue = toLinear(Number.parseInt(color.slice(5, 7), 16));
9572
+ return 0.2126 * red + 0.7152 * green + 0.0722 * blue;
9573
+ },
9574
+ "getRelativeLuminance"
9575
+ ), hasReadableTextContrast = __name2((textColor, backgroundColor) => {
9693
9576
  const textLuminance = getRelativeLuminance(textColor), backgroundLuminance = getRelativeLuminance(backgroundColor);
9694
9577
  return (Math.max(textLuminance, backgroundLuminance) + 0.05) / (Math.min(textLuminance, backgroundLuminance) + 0.05) >= 4.5;
9695
- }, "hasReadableTextContrast"), eventThemeSchema = object(
9696
- { accentColor: hexColorSchema, backgroundColor: hexColorSchema, textColor: hexColorSchema, fontFamily: _enum(["SYSTEM", "JAKARTA", "SERIF"]) }
9697
- ).superRefine((theme, context) => {
9578
+ }, "hasReadableTextContrast"), eventThemeSchema = object({ accentColor: hexColorSchema, backgroundColor: hexColorSchema, textColor: hexColorSchema, fontFamily: _enum(["SYSTEM", "JAKARTA", "SERIF"]) }).superRefine((theme, context) => {
9698
9579
  hasReadableTextContrast(theme.textColor, theme.backgroundColor) || context.addIssue({ code: "custom", message: "Text color must have at least 4.5:1 contrast on the background color", path: ["textColor"] });
9699
9580
  }), appearanceMediaSchema = discriminatedUnion("type", [object({ type: literal("none"), key: _null3() }), object({ type: literal("image"), key: string2().min(1).max(1024) })]), displayMediaSchema = discriminatedUnion("type", [object({ type: literal("none"), key: _null3() }), object({ type: literal("image"), key: string2().min(1).max(1024) }), object({ type: literal("video"), key: string2().min(1).max(1024) })]), passportImageKeySchema = string2().trim().min(1).max(1024), passportFocalSchema = number2().min(0).max(100), passportSkinSchema = object({ heroImage: object({ key: passportImageKeySchema, focalX: passportFocalSchema.default(50), focalY: passportFocalSchema.default(50) }).nullable().default(null), logo: object({ key: passportImageKeySchema }).nullable().default(null), colors: object({ graphic: hexColorSchema.nullable().default(null), dark: hexColorSchema.nullable().default(null).refine((color) => color === null || hasReadableTextContrast("#ffffff", color), "Dark colour must have\
9700
- at least 4.5:1 contrast with white text") }).default({ graphic: null, dark: null }), emphasis: _enum(["accent", "ink"]).default("accent") }), bingoScreenAppearanceSchema = object({ title: string2().trim().max(80).default(""), joinHeading: string2().trim().min(1).max(40).default("Scan to join"), joinInstructions: string2().trim().min(1).max(180).default("Open your camera, scan the QR code and enter your name."), titleFontSize: number2().int().min(32).max(96).default(64), nameFontSize: number2().int().min(24).max(52).default(40) }), DEFAULT_BINGO_SCREEN_APPEARANCE = bingoScreenAppearanceSchema.parse({}), eventAppearanceSchema = object({
9701
- version: literal(1),
9702
- theme: eventThemeSchema,
9703
- guestBackground: appearanceMediaSchema,
9704
- displayBackground: displayMediaSchema,
9705
- passport: passportSkinSchema.optional(),
9706
- humanBingo: bingoScreenAppearanceSchema.optional(),
9707
- photoWall: object({ durationSeconds: number2().int().min(10).max(40), maxVisible: number2().int().min(1).max(16), motion: _enum(["gentle", "lively", "roaming"]), showQrCode: boolean2(), qrCodeLabel: string2().trim().max(80, "QR code text must be 80 characters or fewer").transform((value) => value || "Scan to share").default("Scan to share"), showEventName: boolean2(), screen: photoWallScreenSchema.nullable().default(null), submission: photoWallSubmissionSettingsSchema.default(DEFAULT_PHOTO_WALL_SUBMISSION_SETTINGS) })
9708
- }), DEFAULT_PASSPORT_SKIN = { heroImage: null, logo: null, colors: { graphic: null, dark: null }, emphasis: "accent" }, DEFAULT_EVENT_APPEARANCE2 = { version: 1, theme: { accentColor: "#f84404", backgroundColor: "#f6f7f9", textColor: "#20242a", fontFamily: "SYSTEM" }, guestBackground: { type: "none", key: null }, displayBackground: { type: "none", key: null }, photoWall: {
9709
- durationSeconds: 18,
9710
- maxVisible: 4,
9711
- motion: "gentle",
9712
- showQrCode: !0,
9713
- qrCodeLabel: "Scan to share",
9714
- showEventName: !0,
9715
- screen: null,
9716
- submission: DEFAULT_PHOTO_WALL_SUBMISSION_SETTINGS
9717
- } }, IMAGE_CONTENT_TYPES = ["image/jpeg", "image/png", "image/webp", "image/gif"], PASSPORT_SKIN_UPLOAD_KINDS = ["hero", "logo"], requiredValue = __name2((flags, name) => {
9581
+ at least 4.5:1 contrast with white text") }).default({ graphic: null, dark: null }), emphasis: _enum(["accent", "ink"]).default("accent") }), bingoScreenAppearanceSchema = object({ title: string2().trim().max(80).default(""), joinHeading: string2().trim().min(1).max(40).default("Scan to join"), joinInstructions: string2().trim().min(1).max(180).default("Open your camera, scan the QR code and enter your name."), titleFontSize: number2().int().min(32).max(96).default(64), nameFontSize: number2().int().min(24).max(52).default(40) }), DEFAULT_BINGO_SCREEN_APPEARANCE = bingoScreenAppearanceSchema.parse({}), eventAppearanceSchema = object({ version: literal(1), theme: eventThemeSchema, guestBackground: appearanceMediaSchema, displayBackground: displayMediaSchema, passport: passportSkinSchema.optional(), humanBingo: bingoScreenAppearanceSchema.optional(), photoWall: object({ durationSeconds: number2().int().min(10).max(40), maxVisible: number2().int().min(1).max(16), motion: _enum(["gentle",
9582
+ "lively", "roaming"]), showQrCode: boolean2(), qrCodeLabel: string2().trim().max(80, "QR code text must be 80 characters or fewer").transform((value) => value || "Scan to share").default("Scan to share"), showEventName: boolean2(), screen: photoWallScreenSchema.nullable().default(null), submission: photoWallSubmissionSettingsSchema.default(DEFAULT_PHOTO_WALL_SUBMISSION_SETTINGS) }) }), DEFAULT_PASSPORT_SKIN = { heroImage: null, logo: null, colors: { graphic: null, dark: null }, emphasis: "accent" }, DEFAULT_EVENT_APPEARANCE2 = { version: 1, theme: { accentColor: "#f84404", backgroundColor: "#f6f7f9", textColor: "#20242a", fontFamily: "SYSTEM" }, guestBackground: { type: "none", key: null }, displayBackground: { type: "none", key: null }, photoWall: { durationSeconds: 18, maxVisible: 4, motion: "gentle", showQrCode: !0, qrCodeLabel: "Scan to share", showEventName: !0, screen: null, submission: DEFAULT_PHOTO_WALL_SUBMISSION_SETTINGS } }, IMAGE_CONTENT_TYPES = ["image/jpeg", "image/png", "\
9583
+ image/webp", "image/gif"], PASSPORT_SKIN_UPLOAD_KINDS = ["hero", "logo"], requiredValue = __name2((flags, name) => {
9718
9584
  const value = flags.get(name);
9719
9585
  if (typeof value != "string" || value === "") throw new CliUsageError("--".concat(name, " is required and needs a value."));
9720
9586
  return value;
@@ -9734,24 +9600,32 @@ var MAX_EVENT_IMAGE_UPLOAD_BYTES = 25 * 1024 * 1024, MAX_EVENT_VIDEO_UPLOAD_BYTE
9734
9600
  }, "parseJsonRecord"), mergeSkinPatch = __name2((current, patch) => {
9735
9601
  const allowed = ["heroImage", "logo", "colors", "emphasis"];
9736
9602
  if (Object.keys(patch).some((key) => !allowed.includes(key))) throw new CliUsageError("--skin-json supports only: ".concat(allowed.join(", "), "."));
9737
- const merged = { heroImage: patch.heroImage === void 0 ? current.heroImage : isRecord2(patch.heroImage) ? { ...current.heroImage, ...patch.heroImage } : patch.heroImage, logo: patch.logo === void 0 ? current.logo : isRecord2(patch.logo) ? { ...current.logo, ...patch.logo } : patch.logo, colors: isRecord2(patch.colors) ? { ...current.colors, ...patch.colors } : patch.colors ?? current.colors, emphasis: patch.emphasis ?? current.emphasis }, parsed = passportSkinSchema.safeParse(merged);
9603
+ const merged = {
9604
+ heroImage: patch.heroImage === void 0 ? current.heroImage : isRecord2(patch.heroImage) ? { ...current.heroImage, ...patch.heroImage } : patch.heroImage,
9605
+ logo: patch.logo === void 0 ? current.logo : isRecord2(patch.logo) ? { ...current.logo, ...patch.logo } : patch.logo,
9606
+ colors: isRecord2(patch.colors) ? { ...current.colors, ...patch.colors } : patch.colors ?? current.colors,
9607
+ emphasis: patch.emphasis ?? current.emphasis
9608
+ }, parsed = passportSkinSchema.safeParse(merged);
9738
9609
  if (!parsed.success) throw new CliUsageError("Invalid passport skin: ".concat(parsed.error.issues.map((issue2) => "".concat(issue2.path.join(".") || "skin", ": ").concat(issue2.message)).join("; ")));
9739
9610
  return parsed.data;
9740
9611
  }, "mergeSkinPatch"), readCanonicalAppearance = __name2(async (eventId) => {
9741
9612
  const projection = await api2.event.getEventAppearance.query({ eventId }), appearance = eventAppearanceSchema.parse(projection.appearance ?? DEFAULT_EVENT_APPEARANCE2);
9742
9613
  return { projection, appearance };
9743
9614
  }, "readCanonicalAppearance"), getPassportSkin = __name2(async (eventId) => {
9744
- const { projection, appearance } = await readCanonicalAppearance(eventId);
9615
+ const { projection, appearance } = await readCanonicalAppearance(
9616
+ eventId
9617
+ );
9745
9618
  return { appearanceVersion: projection.appearanceVersion, hasCustomAppearance: projection.hasCustomAppearance, passport: resolvePassportSkinSettingsFromAppearance(appearance), passportHeroImageUrl: projection.passportHeroImageUrl, passportLogoUrl: projection.passportLogoUrl };
9746
9619
  }, "getPassportSkin"), saveSkin = __name2(async (eventId, appearanceVersion, buildSkin) => {
9747
9620
  const { projection, appearance } = await readCanonicalAppearance(eventId);
9748
9621
  if (projection.appearanceVersion !== appearanceVersion) throw new CliUsageError("The appearance is at version ".concat(projection.appearanceVersion, ", not ").concat(appearanceVersion, ". Read it with `et passport skin get` and retry."));
9749
- const next = { ...appearance, passport: buildSkin(resolvePassportSkinSettingsFromAppearance(
9750
- appearance
9751
- )) };
9622
+ const next = { ...appearance, passport: buildSkin(resolvePassportSkinSettingsFromAppearance(appearance)) };
9752
9623
  return api2.event.updateEventAppearance.mutate({ eventId, appearance: next, appearanceVersion });
9753
9624
  }, "saveSkin"), isUploadKind = __name2((kinds, value) => kinds.some((kind) => kind === value), "isUploadKind"), uploadPassportImage = __name2(async (eventId, kind, flags) => {
9754
- const filePath = requiredValue(flags, "file"), contentType = requiredValue(flags, "content-type");
9625
+ const filePath = requiredValue(
9626
+ flags,
9627
+ "file"
9628
+ ), contentType = requiredValue(flags, "content-type");
9755
9629
  if (!IMAGE_CONTENT_TYPES.some((allowed) => allowed === contentType)) throw new CliUsageError("--content-type must be one of: ".concat(IMAGE_CONTENT_TYPES.join(", "), "."));
9756
9630
  const file = await readFile4(filePath);
9757
9631
  if (file.byteLength > MAX_EVENT_IMAGE_UPLOAD_BYTES) throw new CliUsageError("The image must be 25 MB or smaller.");
@@ -9776,36 +9650,27 @@ var MAX_EVENT_IMAGE_UPLOAD_BYTES = 25 * 1024 * 1024, MAX_EVENT_VIDEO_UPLOAD_BYTE
9776
9650
  allowed.push("kind", "file", "content-type");
9777
9651
  const kind = requiredValue(flags, "kind");
9778
9652
  if (!isUploadKind(PASSPORT_SKIN_UPLOAD_KINDS, kind)) throw new CliUsageError("--kind must be one of: ".concat(PASSPORT_SKIN_UPLOAD_KINDS.join(", "), "."));
9779
- return () => uploadPassportImage(
9780
- eventId,
9781
- kind,
9782
- flags
9783
- );
9653
+ return () => uploadPassportImage(eventId, kind, flags);
9784
9654
  }
9785
9655
  default:
9786
9656
  return null;
9787
9657
  }
9788
9658
  }, "createSkinOperation"), setStationImage = __name2(async (eventId, stationId, imageKey) => {
9789
9659
  const station = (await api2.event.passport.getPassportOverview.query({ eventId })).stations.find((item) => item.id === stationId);
9790
- if (!station) throw new CliUsageError("Station not found for this event.");
9660
+ if (!station) throw new CliUsageError(
9661
+ "Station not found for this event."
9662
+ );
9791
9663
  return api2.event.passport.upsertPassportStation.mutate({ eventId, id: station.id, name: station.name, description: station.description, location: station.location, imageKey: imageKey ? await imageKey() : null, order: station.order, opensAt: station.opensAt, closesAt: station.closesAt });
9792
9664
  }, "setStationImage"), setPrizeImage = __name2(async (eventId, prizeId, imageKey) => {
9793
9665
  const prize = (await api2.event.passport.getPassportOverview.query({ eventId })).prizes.find((item) => item.id === prizeId);
9794
9666
  if (!prize) throw new CliUsageError("Prize not found for this event.");
9795
- return api2.event.passport.upsertPassportPrize.mutate({
9796
- eventId,
9797
- id: prize.id,
9798
- name: prize.name,
9799
- description: prize.description,
9800
- imageKey: imageKey ? await imageKey() : null,
9801
- stock: prize.stock,
9802
- stampCost: prize.stampCost,
9803
- order: prize.order
9804
- });
9667
+ return api2.event.passport.upsertPassportPrize.mutate({ eventId, id: prize.id, name: prize.name, description: prize.description, imageKey: imageKey ? await imageKey() : null, stock: prize.stock, stampCost: prize.stampCost, order: prize.order });
9805
9668
  }, "setPrizeImage"), createImageOperation = __name2((resource, subcommand, { eventId, flags, allowed }) => {
9806
9669
  if (subcommand !== "image-set" && subcommand !== "image-clear") return null;
9807
9670
  const idFlag = "".concat(resource, "-id");
9808
- allowed.push(idFlag);
9671
+ allowed.push(
9672
+ idFlag
9673
+ );
9809
9674
  const id = requiredValue(flags, idFlag), save = __name2((imageKey) => resource === "station" ? setStationImage(eventId, id, imageKey) : setPrizeImage(eventId, id, imageKey), "save");
9810
9675
  return subcommand === "image-clear" ? () => save(null) : (allowed.push("file", "content-type"), requiredValue(flags, "file"), requiredValue(flags, "content-type"), () => save(async () => (await uploadPassportImage(eventId, resource === "station" ? "stations" : "prizes", flags)).key));
9811
9676
  }, "createImageOperation"), createPassportMediaOperation = __name2((action, context) => {
@@ -9817,7 +9682,9 @@ var MAX_EVENT_IMAGE_UPLOAD_BYTES = 25 * 1024 * 1024, MAX_EVENT_VIDEO_UPLOAD_BYTE
9817
9682
  return value;
9818
9683
  }, "flag"), requiredFlag = __name2((flags, name) => {
9819
9684
  const value = flag(flags, name);
9820
- if (!value) throw new CliUsageError("--".concat(name, " is required."));
9685
+ if (!value) throw new CliUsageError(
9686
+ "--".concat(name, " is required.")
9687
+ );
9821
9688
  return value;
9822
9689
  }, "requiredFlag"), integer2 = __name2((value, name, minimum = 0, maximum = 2147483647) => {
9823
9690
  const parsed = typeof value == "string" && value.trim() !== "" ? Number(value) : value;
@@ -9832,7 +9699,10 @@ var MAX_EVENT_IMAGE_UPLOAD_BYTES = 25 * 1024 * 1024, MAX_EVENT_VIDEO_UPLOAD_BYTE
9832
9699
  if (value === !1 || value === "false") return !1;
9833
9700
  throw new CliUsageError("".concat(name, " must be true or false."));
9834
9701
  }, "boolean4"), text = __name2((value, name, maximum) => {
9835
- if (typeof value != "string" || !value.trim() || value.trim().length > maximum) throw new CliUsageError("".concat(name, " must be a non-empty string of at most ").concat(maximum, " characters."));
9702
+ if (typeof value != "string" || !value.trim() || value.trim().length > maximum) throw new CliUsageError("".concat(
9703
+ name,
9704
+ " must be a non-empty string of at most "
9705
+ ).concat(maximum, " characters."));
9836
9706
  return value.trim();
9837
9707
  }, "text"), nullableText = __name2((value, name, maximum) => {
9838
9708
  if (value == null) return null;
@@ -9860,8 +9730,7 @@ var MAX_EVENT_IMAGE_UPLOAD_BYTES = 25 * 1024 * 1024, MAX_EVENT_VIDEO_UPLOAD_BYTE
9860
9730
  }, "json"), keys = __name2((value, allowed, name) => {
9861
9731
  if (Object.keys(value).some((key) => !allowed.includes(key))) throw new CliUsageError("".concat(name, " contains unsupported fields."));
9862
9732
  }, "keys"), date4 = __name2((value, name) => {
9863
- if (value == null)
9864
- return null;
9733
+ if (value == null) return null;
9865
9734
  if (typeof value != "string" || !new __cliRegExp("^\\d{4}-\\d\\d-\\d\\dT", "").test(value)) throw new CliUsageError("".concat(name, " must be an ISO date-time or null."));
9866
9735
  const parsed = new Date(value);
9867
9736
  if (Number.isNaN(parsed.getTime())) throw new CliUsageError("".concat(name, " must be a valid ISO date-time."));
@@ -9877,35 +9746,24 @@ var MAX_EVENT_IMAGE_UPLOAD_BYTES = 25 * 1024 * 1024, MAX_EVENT_VIDEO_UPLOAD_BYTE
9877
9746
  if (keys(item, ["collectionMode", "stampValue", "category", "prizeDeskAward", "showHowToCollect", "showMyQr", "collectionLimit", "menuItems", "info"], "collection"), item.collectionMode !== "STAFF_SCAN" && (item.menuItems !== void 0 || item.collectionLimit !== void 0)) throw new CliUsageError("Only STAFF_SCAN stations can configure menuItems or collectionLimit.");
9878
9747
  if (item.prizeDeskAward !== void 0 && typeof item.prizeDeskAward != "boolean") throw new CliUsageError("prizeDeskAward must be true or false.");
9879
9748
  if (item.collectionLimit !== void 0 && item.collectionLimit !== "ONCE" && item.collectionLimit !== "UNLIMITED") throw new CliUsageError("collectionLimit must be ONCE or UNLIMITED.");
9880
- return {
9881
- collectionMode: item.collectionMode,
9882
- ...item.collectionLimit === void 0 ? {} : { collectionLimit: item.collectionLimit },
9883
- ...item.menuItems === void 0 ? {} : { menuItems: item.menuItems === null ? null : parseStaffScanMenuItems(item.menuItems) },
9884
- ...extras,
9885
- ...item.prizeDeskAward === void 0 ? {} : { prizeDeskAward: item.prizeDeskAward }
9886
- };
9887
- }, "parseStaffScanCollection"), parseStaffScanMenuItems = __name2((value) => {
9888
- if (!Array.isArray(value)) throw new CliUsageError("menuItems must be an array of menu item objects.");
9889
- if (value.length < 1 || value.length > 30) throw new CliUsageError("menuItems must have 1 to 30 items.");
9890
- const menuItems = value.map((raw, index) => {
9891
- const item = object2(raw, "menuItems[".concat(index, "]"));
9892
- return keys(item, ["name", "stock", "siteStocks"], "menuItems[".concat(index, "]")), { name: text(item.name, "menuItems[".concat(index, "].name"), 60), ...item.siteStocks === void 0 ? {} : { siteStocks: item.siteStocks }, stock: item.stock === null ? null : integer2(item.stock, "menuItems[".concat(index, "].stock")) };
9893
- });
9894
- if (new Set(menuItems.map(({ name }) => name.trim().toLocaleLowerCase())).size !== menuItems.length) throw new CliUsageError("menuItems names must be unique ignoring case and surrounding whitespace.");
9895
- const parsed = passportMenuItemsSchema.safeParse(menuItems);
9896
- if (!parsed.success) throw new CliUsageError("menuItems is invalid: ".concat(parsed.error.issues.map((issue2) => "".concat(issue2.path.join("."), " ").concat(issue2.message)).join("; ")));
9897
- return parsed.data;
9898
- }, "parseStaffScanMenuItems"), parsePassportCollection = __name2((raw) => {
9749
+ return { collectionMode: item.collectionMode, ...item.collectionLimit === void 0 ? {} : { collectionLimit: item.collectionLimit }, ...item.menuItems === void 0 ? {} : { menuItems: item.menuItems === null ? null : parseStaffScanMenuItems(item.menuItems) }, ...extras, ...item.prizeDeskAward === void 0 ? {} : { prizeDeskAward: item.prizeDeskAward } };
9750
+ }, "parseStaffScanCollection"), parseStaffScanMenuItems = __name2(
9751
+ (value) => {
9752
+ if (!Array.isArray(value)) throw new CliUsageError("menuItems must be an array of menu item objects.");
9753
+ if (value.length < 1 || value.length > 30) throw new CliUsageError("menuItems must have 1 to 30 items.");
9754
+ const menuItems = value.map((raw, index) => {
9755
+ const item = object2(raw, "menuItems[".concat(index, "]"));
9756
+ return keys(item, ["name", "stock", "siteStocks"], "menuItems[".concat(index, "]")), { name: text(item.name, "menuItems[".concat(index, "].name"), 60), ...item.siteStocks === void 0 ? {} : { siteStocks: item.siteStocks }, stock: item.stock === null ? null : integer2(item.stock, "menuItems[".concat(index, "].stock")) };
9757
+ });
9758
+ if (new Set(menuItems.map(({ name }) => name.trim().toLocaleLowerCase())).size !== menuItems.length) throw new CliUsageError("menuItems names must be unique ignoring case and surrounding whitespace.");
9759
+ const parsed = passportMenuItemsSchema.safeParse(menuItems);
9760
+ if (!parsed.success) throw new CliUsageError("menuItems is invalid: ".concat(parsed.error.issues.map((issue2) => "".concat(issue2.path.join("."), " ").concat(issue2.message)).join("; ")));
9761
+ return parsed.data;
9762
+ },
9763
+ "parseStaffScanMenuItems"
9764
+ ), parsePassportCollection = __name2((raw) => {
9899
9765
  const item = object2(raw, "collection"), stampValue = item.stampValue === void 0 ? {} : { stampValue: integer2(item.stampValue, "stampValue", 0, 1e3) }, category = item.category === void 0 ? {} : { category: stationCategory(item.category) }, info = { ...item.showMyQr === void 0 ? {} : { showMyQr: boolean4(item.showMyQr, "showMyQr") }, ...item.info === void 0 ? {} : { info: stationInfo(item.info) }, ...item.showHowToCollect === void 0 ? {} : { showHowToCollect: boolean4(item.showHowToCollect, "showHowToCollect") } };
9900
- if (item.collectionMode === "STAFF_SCORE") return keys(item, [
9901
- "collectionMode",
9902
- "maxPoints",
9903
- "stampValue",
9904
- "category",
9905
- "info",
9906
- "showHowToCollect",
9907
- "showMyQr"
9908
- ], "collection"), { collectionMode: "STAFF_SCORE", maxPoints: integer2(item.maxPoints, "maxPoints"), ...stampValue, ...category, ...info };
9766
+ if (item.collectionMode === "STAFF_SCORE") return keys(item, ["collectionMode", "maxPoints", "stampValue", "category", "info", "showHowToCollect", "showMyQr"], "collection"), { collectionMode: "STAFF_SCORE", maxPoints: integer2(item.maxPoints, "maxPoints"), ...stampValue, ...category, ...info };
9909
9767
  if (item.collectionMode === "STAFF_TALLY") return parseStaffTallyCollection(item, { ...stampValue, ...category, ...info });
9910
9768
  if (item.collectionMode === "SELF_SCAN" || item.collectionMode === "STAFF_SCAN") return parseStaffScanCollection(item, { ...stampValue, ...category, ...info });
9911
9769
  throw new CliUsageError("collectionMode must be SELF_SCAN, STAFF_SCAN, STAFF_SCORE or STAFF_TALLY.");
@@ -9920,12 +9778,7 @@ var MAX_EVENT_IMAGE_UPLOAD_BYTES = 25 * 1024 * 1024, MAX_EVENT_VIDEO_UPLOAD_BYTE
9920
9778
  return status;
9921
9779
  }, "queueStatusFlag"), parseSettingsSwitches = __name2((value) => {
9922
9780
  const switches = {};
9923
- value.queueStatusStaleMinutes !== void 0 && (switches.queueStatusStaleMinutes = value.queueStatusStaleMinutes === null ? null : integer2(
9924
- value.queueStatusStaleMinutes,
9925
- "queueStatusStaleMinutes",
9926
- PASSPORT_QUEUE_STATUS_STALE_MINUTES_MIN,
9927
- PASSPORT_QUEUE_STATUS_STALE_MINUTES_MAX
9928
- )), value.staffIdLabel !== void 0 && (switches.staffIdLabel = nullableText(value.staffIdLabel, "staffIdLabel", PASSPORT_STAFF_ID_LABEL_MAX)), value.categoryLabels !== void 0 && (switches.categoryLabels = categoryLabels(value.categoryLabels));
9781
+ value.queueStatusStaleMinutes !== void 0 && (switches.queueStatusStaleMinutes = value.queueStatusStaleMinutes === null ? null : integer2(value.queueStatusStaleMinutes, "queueStatusStaleMinutes", PASSPORT_QUEUE_STATUS_STALE_MINUTES_MIN, PASSPORT_QUEUE_STATUS_STALE_MINUTES_MAX)), value.staffIdLabel !== void 0 && (switches.staffIdLabel = nullableText(value.staffIdLabel, "staffIdLabel", PASSPORT_STAFF_ID_LABEL_MAX)), value.categoryLabels !== void 0 && (switches.categoryLabels = categoryLabels(value.categoryLabels));
9929
9782
  for (const name of ["guestScan", "simplifiedChinese", "queueStatus"]) {
9930
9783
  const item = value[name];
9931
9784
  if (item !== void 0) {
@@ -9945,10 +9798,7 @@ var MAX_EVENT_IMAGE_UPLOAD_BYTES = 25 * 1024 * 1024, MAX_EVENT_VIDEO_UPLOAD_BYTE
9945
9798
  if (loginMethods = { emailOtp: methods.emailOtp, google: methods.google, guest: methods.guest, staffId: methods.staffId === !0, staffIdRequiresLastName: methods.staffIdRequiresLastName !== !1 }, !loginMethods.emailOtp && !loginMethods.google && !loginMethods.staffId) throw new CliUsageError("Keep email OTP, Google or roster sign-in available for recovery.");
9946
9799
  }
9947
9800
  if (value.linkedDrawEventId === void 0) throw new CliUsageError("linkedDrawEventId is required (use null to disable).");
9948
- return { eventId, luckyDrawStampThreshold: threshold(
9949
- value.luckyDrawStampThreshold,
9950
- "luckyDrawStampThreshold"
9951
- ), prizeStampThreshold: threshold(value.prizeStampThreshold, "prizeStampThreshold"), maxRedemptionsPerParticipant: integer2(value.maxRedemptionsPerParticipant, "maxRedemptionsPerParticipant", 0), linkedDrawEventId: value.linkedDrawEventId === null ? null : text(value.linkedDrawEventId, "linkedDrawEventId", 200), ...loginMethods ? { loginMethods } : {}, ...switches };
9801
+ return { eventId, luckyDrawStampThreshold: threshold(value.luckyDrawStampThreshold, "luckyDrawStampThreshold"), prizeStampThreshold: threshold(value.prizeStampThreshold, "prizeStampThreshold"), maxRedemptionsPerParticipant: integer2(value.maxRedemptionsPerParticipant, "maxRedemptionsPerParticipant", 0), linkedDrawEventId: value.linkedDrawEventId === null ? null : text(value.linkedDrawEventId, "linkedDrawEventId", 200), ...loginMethods ? { loginMethods } : {}, ...switches };
9952
9802
  }, "parsePassportSettingsInput"), parsePassportRosterEntryInput = __name2((raw, eventId) => {
9953
9803
  const value = json(raw, "--entry-json");
9954
9804
  if (keys(value, ["id", "staffId", "lastName", "displayName"], "Roster entry"), value.lastName === void 0) throw new CliUsageError("lastName is required (use null for none).");
@@ -9980,14 +9830,15 @@ var MAX_EVENT_IMAGE_UPLOAD_BYTES = 25 * 1024 * 1024, MAX_EVENT_VIDEO_UPLOAD_BYTE
9980
9830
  throw new CliUsageError("Could not import ".concat(path2, ": ").concat(error2 instanceof Error ? error2.message : "unknown error"));
9981
9831
  }
9982
9832
  }, "readRosterRows"), optionalEntry = __name2((key, value, parse) => value === void 0 ? {} : { [key]: parse(value) }, "optionalEntry"), readPasswordFromStdin = __name2(async () => {
9983
- if (process.stdin.isTTY) throw new CliUsageError(
9984
- "--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 ..."
9985
- );
9833
+ if (process.stdin.isTTY) 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 ...");
9986
9834
  return (await Bun.stdin.text()).replace(new __cliRegExp("\\r?\\n$", ""), "");
9987
- }, "readPasswordFromStdin"), searchFilters = __name2((flags) => {
9988
- const search = flag(flags, "search", !1);
9989
- return search === void 0 ? {} : { search: text(search, "--search", 200) };
9990
- }, "searchFilters"), recipientDirection = __name2((value) => {
9835
+ }, "readPasswordFromStdin"), searchFilters = __name2(
9836
+ (flags) => {
9837
+ const search = flag(flags, "search", !1);
9838
+ return search === void 0 ? {} : { search: text(search, "--search", 200) };
9839
+ },
9840
+ "searchFilters"
9841
+ ), recipientDirection = __name2((value) => {
9991
9842
  if (value !== void 0) {
9992
9843
  if (value === "forward" || value === "backward") return value;
9993
9844
  throw new CliUsageError("--direction must be forward or backward.");
@@ -9995,12 +9846,7 @@ var MAX_EVENT_IMAGE_UPLOAD_BYTES = 25 * 1024 * 1024, MAX_EVENT_VIDEO_UPLOAD_BYTE
9995
9846
  }, "recipientDirection"), parseStampRecipientsInput = __name2((flags, station) => {
9996
9847
  const limit = flag(flags, "limit", !1), cursor = flag(flags, "cursor", !1), direction = recipientDirection(flag(flags, "direction", !1));
9997
9848
  if (direction === "backward" && cursor === void 0) throw new CliUsageError("--direction backward needs --cursor.");
9998
- return { ...station, filters: searchFilters(flags), ...optionalEntry("limit", limit, (raw) => integer2(
9999
- raw,
10000
- "--limit",
10001
- 1,
10002
- PASSPORT_STATION_RECIPIENTS_PAGE_MAX
10003
- )), ...optionalEntry("cursor", cursor, (raw) => text(raw, "--cursor", 8192)), ...direction === void 0 ? {} : { direction } };
9849
+ return { ...station, filters: searchFilters(flags), ...optionalEntry("limit", limit, (raw) => integer2(raw, "--limit", 1, PASSPORT_STATION_RECIPIENTS_PAGE_MAX)), ...optionalEntry("cursor", cursor, (raw) => text(raw, "--cursor", 8192)), ...direction === void 0 ? {} : { direction } };
10004
9850
  }, "parseStampRecipientsInput"), createStationAccessOperation = __name2(async (action, { eventId, flags, allowed, station, confirm }) => {
10005
9851
  const event = { eventId };
10006
9852
  let operation;
@@ -10036,10 +9882,7 @@ var MAX_EVENT_IMAGE_UPLOAD_BYTES = 25 * 1024 * 1024, MAX_EVENT_VIDEO_UPLOAD_BYTE
10036
9882
  }
10037
9883
  return operation;
10038
9884
  }, "createStationAccessOperation"), runPassportCommand = __name2(async (input) => {
10039
- const { flags, positionals } = input, action = positionals.slice(1).join(" "), allowed = ["event-id"], eventId = requiredFlag(flags, "event-id"), event = { eventId }, station = __name2(
10040
- () => ({ eventId, stationId: requiredFlag(flags, "station-id") }),
10041
- "station"
10042
- ), version2 = __name2(() => integer2(requiredFlag(flags, "expected-printed-qr-version"), "--expected-printed-qr-version"), "version"), confirm = __name2(() => {
9885
+ const { flags, positionals } = input, action = positionals.slice(1).join(" "), allowed = ["event-id"], eventId = requiredFlag(flags, "event-id"), event = { eventId }, station = __name2(() => ({ eventId, stationId: requiredFlag(flags, "station-id") }), "station"), version2 = __name2(() => integer2(requiredFlag(flags, "expected-printed-qr-version"), "--expected-printed-qr-version"), "version"), confirm = __name2(() => {
10043
9886
  if (allowed.push("allow-state-change", "target"), flags.get("allow-state-change") !== !0 || requiredFlag(flags, "target") !== eventId) throw new CliUsageError("This operation requires --allow-state-change and --target exactly equal to --event-id.");
10044
9887
  }, "confirm");
10045
9888
  let operation;
@@ -10076,9 +9919,7 @@ var MAX_EVENT_IMAGE_UPLOAD_BYTES = 25 * 1024 * 1024, MAX_EVENT_VIDEO_UPLOAD_BYTE
10076
9919
  operation = __name2(() => api2.event.passport.joinPassportBingo.mutate(event), "operation");
10077
9920
  break;
10078
9921
  case "bingo claim-stamp":
10079
- operation = __name2(() => api2.event.passport.claimPassportBingoStamp.mutate(
10080
- event
10081
- ), "operation");
9922
+ operation = __name2(() => api2.event.passport.claimPassportBingoStamp.mutate(event), "operation");
10082
9923
  break;
10083
9924
  case "bingo status":
10084
9925
  operation = __name2(() => api2.event.passport.getMyPassportBingo.query(event), "operation");
@@ -10086,7 +9927,9 @@ var MAX_EVENT_IMAGE_UPLOAD_BYTES = 25 * 1024 * 1024, MAX_EVENT_VIDEO_UPLOAD_BYTE
10086
9927
  case "bingo rename": {
10087
9928
  allowed.push("name");
10088
9929
  const parsed = renamePassportBingoSchema.safeParse({ eventId, name: requiredFlag(flags, "name") });
10089
- if (!parsed.success) throw new CliUsageError("--name ".concat(parsed.error.issues[0]?.message ?? "is invalid", "."));
9930
+ if (!parsed.success) throw new CliUsageError(
9931
+ "--name ".concat(parsed.error.issues[0]?.message ?? "is invalid", ".")
9932
+ );
10090
9933
  operation = __name2(() => api2.event.passport.renamePassportBingo.mutate(parsed.data), "operation");
10091
9934
  break;
10092
9935
  }
@@ -10127,9 +9970,7 @@ var MAX_EVENT_IMAGE_UPLOAD_BYTES = 25 * 1024 * 1024, MAX_EVENT_VIDEO_UPLOAD_BYTE
10127
9970
  case "station archive": {
10128
9971
  allowed.push("station-id"), confirm();
10129
9972
  const payload = station();
10130
- operation = __name2(() => api2.event.passport.archivePassportStation.mutate(
10131
- payload
10132
- ), "operation");
9973
+ operation = __name2(() => api2.event.passport.archivePassportStation.mutate(payload), "operation");
10133
9974
  break;
10134
9975
  }
10135
9976
  case "station hidden": {
@@ -10174,7 +10015,10 @@ var MAX_EVENT_IMAGE_UPLOAD_BYTES = 25 * 1024 * 1024, MAX_EVENT_VIDEO_UPLOAD_BYTE
10174
10015
  }
10175
10016
  case "stamp correct": {
10176
10017
  allowed.push("station-id", "participant-id", "stamped", "reason", "points", "item", "collection-id", "site"), confirm();
10177
- const points = flag(flags, "points", !1), item = flag(flags, "item", !1), payload = { ...station(), participantId: requiredFlag(flags, "participant-id"), ...optionalEntry("collectionId", flag(flags, "collection-id", !1), (raw) => text(raw, "--collection-id", 200)), ...optionalEntry("site", flag(flags, "site", !1), (raw) => text(raw, "--site", 60)), stamped: boolean4(requiredFlag(flags, "stamped"), "--stamped"), reason: requiredFlag(flags, "reason"), ...optionalEntry("points", points, (raw) => integer2(raw, "--points")), ...optionalEntry("item", item, (raw) => text(raw, "--item", 60)) };
10018
+ const points = flag(flags, "points", !1), item = flag(flags, "item", !1), payload = { ...station(), participantId: requiredFlag(flags, "participant-id"), ...optionalEntry("collectionId", flag(flags, "collection-id", !1), (raw) => text(raw, "--collection-id", 200)), ...optionalEntry("site", flag(flags, "site", !1), (raw) => text(raw, "--site", 60)), stamped: boolean4(requiredFlag(
10019
+ flags,
10020
+ "stamped"
10021
+ ), "--stamped"), reason: requiredFlag(flags, "reason"), ...optionalEntry("points", points, (raw) => integer2(raw, "--points")), ...optionalEntry("item", item, (raw) => text(raw, "--item", 60)) };
10178
10022
  operation = __name2(() => api2.event.passport.correctPassportStamp.mutate(payload), "operation");
10179
10023
  break;
10180
10024
  }
@@ -10194,7 +10038,16 @@ var MAX_EVENT_IMAGE_UPLOAD_BYTES = 25 * 1024 * 1024, MAX_EVENT_VIDEO_UPLOAD_BYTE
10194
10038
  allowed.push("prize-json");
10195
10039
  const value = json(requiredFlag(flags, "prize-json"), "--prize-json");
10196
10040
  keys(value, ["id", "name", "description", "imageKey", "stock", "stampCost", "order"], "Prize");
10197
- const payload = { eventId, ...optionalEntry("id", value.id, (raw) => text(raw, "id", 200)), name: text(value.name, "name", 100), description: nullableText(value.description, "description", 1e3), ...optionalEntry("imageKey", value.imageKey, (raw) => nullableText(raw, "imageKey", 2048)), stock: integer2(value.stock, "stock"), ...optionalEntry("stampCost", value.stampCost, (raw) => integer2(raw, "stampCost", 0, 1e5)), order: integer2(value.order ?? 0, "order") };
10041
+ const payload = {
10042
+ eventId,
10043
+ ...optionalEntry("id", value.id, (raw) => text(raw, "id", 200)),
10044
+ name: text(value.name, "name", 100),
10045
+ description: nullableText(value.description, "description", 1e3),
10046
+ ...optionalEntry("imageKey", value.imageKey, (raw) => nullableText(raw, "imageKey", 2048)),
10047
+ stock: integer2(value.stock, "stock"),
10048
+ ...optionalEntry("stampCost", value.stampCost, (raw) => integer2(raw, "stampCost", 0, 1e5)),
10049
+ order: integer2(value.order ?? 0, "order")
10050
+ };
10198
10051
  operation = __name2(() => api2.event.passport.upsertPassportPrize.mutate(payload), "operation");
10199
10052
  break;
10200
10053
  }
@@ -10205,15 +10058,13 @@ var MAX_EVENT_IMAGE_UPLOAD_BYTES = 25 * 1024 * 1024, MAX_EVENT_VIDEO_UPLOAD_BYTE
10205
10058
  break;
10206
10059
  }
10207
10060
  case "redemption create": {
10208
- allowed.push(
10209
- "prize-id",
10210
- "participant-id",
10211
- "quantity",
10212
- "award-station-id",
10213
- "bonus-stamps",
10214
- "request-id"
10215
- );
10216
- const quantity = flag(flags, "quantity", !1), awardStationId = flag(flags, "award-station-id", !1), bonusStamps = flag(flags, "bonus-stamps", !1), requestId = flag(flags, "request-id", !1), payload = { eventId, ...optionalEntry("quantity", quantity, (raw) => integer2(raw, "--quantity", 1, 20)), ...optionalEntry("bonusStamps", bonusStamps, (raw) => {
10061
+ allowed.push("prize-id", "participant-id", "quantity", "award-station-id", "bonus-stamps", "request-id");
10062
+ const quantity = flag(flags, "quantity", !1), awardStationId = flag(flags, "award-station-id", !1), bonusStamps = flag(flags, "bonus-stamps", !1), requestId = flag(flags, "request-id", !1), payload = { eventId, ...optionalEntry("quantity", quantity, (raw) => integer2(
10063
+ raw,
10064
+ "--quantity",
10065
+ 1,
10066
+ 20
10067
+ )), ...optionalEntry("bonusStamps", bonusStamps, (raw) => {
10217
10068
  const value = integer2(raw, "--bonus-stamps", 0, 1e3);
10218
10069
  return redeemPassportPrizeSchema.shape.bonusStamps.parse(value);
10219
10070
  }), ...optionalEntry("awardStationId", awardStationId, (raw) => text(raw, "--award-station-id", 200)), ...optionalEntry("requestId", requestId, (raw) => {
@@ -10231,7 +10082,12 @@ var MAX_EVENT_IMAGE_UPLOAD_BYTES = 25 * 1024 * 1024, MAX_EVENT_VIDEO_UPLOAD_BYTE
10231
10082
  break;
10232
10083
  }
10233
10084
  case "tally record": {
10234
- allowed.push("station-id", "profile-code", "item", "quantity");
10085
+ allowed.push(
10086
+ "station-id",
10087
+ "profile-code",
10088
+ "item",
10089
+ "quantity"
10090
+ );
10235
10091
  const quantity = flag(flags, "quantity", !1), payload = { ...station(), profileCode: requiredFlag(flags, "profile-code"), item: requiredFlag(flags, "item"), ...optionalEntry("quantity", quantity, (raw) => integer2(raw, "--quantity", 1, 20)) };
10236
10092
  operation = __name2(() => api2.event.passport.recordPassportTally.mutate(payload), "operation");
10237
10093
  break;
@@ -10244,11 +10100,7 @@ var MAX_EVENT_IMAGE_UPLOAD_BYTES = 25 * 1024 * 1024, MAX_EVENT_VIDEO_UPLOAD_BYTE
10244
10100
  }
10245
10101
  case "roster list": {
10246
10102
  allowed.push("search", "limit", "cursor");
10247
- const search = flag(
10248
- flags,
10249
- "search",
10250
- !1
10251
- ), limit = flag(flags, "limit", !1), cursor = flag(flags, "cursor", !1), payload = { eventId, ...optionalEntry("search", search, (raw) => text(raw, "--search", 200)), ...optionalEntry("limit", limit, (raw) => integer2(raw, "--limit", 1, PASSPORT_ROSTER_PAGE_MAX)), ...optionalEntry("cursor", cursor, (raw) => text(raw, "--cursor", 8192)) };
10103
+ const search = flag(flags, "search", !1), limit = flag(flags, "limit", !1), cursor = flag(flags, "cursor", !1), payload = { eventId, ...optionalEntry("search", search, (raw) => text(raw, "--search", 200)), ...optionalEntry("limit", limit, (raw) => integer2(raw, "--limit", 1, PASSPORT_ROSTER_PAGE_MAX)), ...optionalEntry("cursor", cursor, (raw) => text(raw, "--cursor", 8192)) };
10252
10104
  operation = __name2(() => api2.event.passport.getPassportRoster.query(payload), "operation");
10253
10105
  break;
10254
10106
  }
@@ -10266,10 +10118,7 @@ var MAX_EVENT_IMAGE_UPLOAD_BYTES = 25 * 1024 * 1024, MAX_EVENT_VIDEO_UPLOAD_BYTE
10266
10118
  }
10267
10119
  case "roster remove": {
10268
10120
  allowed.push("entry-id"), confirm();
10269
- const payload = { eventId, entryId: requiredFlag(
10270
- flags,
10271
- "entry-id"
10272
- ) };
10121
+ const payload = { eventId, entryId: requiredFlag(flags, "entry-id") };
10273
10122
  operation = __name2(() => api2.event.passport.deletePassportRosterEntry.mutate(payload), "operation");
10274
10123
  break;
10275
10124
  }
@@ -10292,60 +10141,56 @@ var MAX_EVENT_IMAGE_UPLOAD_BYTES = 25 * 1024 * 1024, MAX_EVENT_VIDEO_UPLOAD_BYTE
10292
10141
  allowed.push("station-id"), operation = __name2(() => api2.event.passport.getPassportStationTallies.query(station()), "operation");
10293
10142
  break;
10294
10143
  default: {
10295
- const mediaOperation = await createStationAccessOperation(
10296
- action,
10297
- { eventId, flags, allowed, station, confirm }
10298
- ) ?? createPassportMediaOperation(action, { eventId, flags, allowed });
10144
+ const mediaOperation = await createStationAccessOperation(action, { eventId, flags, allowed, station, confirm }) ?? createPassportMediaOperation(action, { eventId, flags, allowed });
10299
10145
  if (!mediaOperation) throw new CliUsageError("Unknown passport command. Run et --help for supported commands.");
10300
10146
  operation = mediaOperation;
10301
10147
  }
10302
10148
  }
10303
- const unknown2 = [...flags.keys()].filter((key) => key !== "api-url" && !allowed.includes(key));
10149
+ const unknown2 = [...flags.keys()].filter(
10150
+ (key) => key !== "api-url" && !allowed.includes(key)
10151
+ );
10304
10152
  if (unknown2.length) throw new CliUsageError("Unknown option(s): ".concat(unknown2.map((key) => "--".concat(key)).join(", "), "."));
10305
10153
  await input.authenticate(), writeSuccess(input.runtime, await operation());
10306
10154
  }, "runPassportCommand");
10307
10155
  import { readFile as readFile6, writeFile } from "fs/promises";
10308
10156
  import { basename as basename4 } from "path";
10309
10157
  var STAFF_REDEMPTION_NAME_MAX = 120, STAFF_REDEMPTION_EMPLOYEE_ID_MAX = 64, STAFF_REDEMPTION_SHIFT_MAX = 8, STAFF_REDEMPTION_ELIGIBLE_SHIFTS_MAX = 20, STAFF_REDEMPTION_ALLOWANCE_MAX = 20, STAFF_REDEMPTION_QUANTITY_MAX = 1e5, STAFF_REDEMPTION_REASON_MAX = 500, STAFF_REDEMPTION_ROLLOVER_REASON_MAX = 300, STAFF_REDEMPTION_ROLLOVER_LIST_DEFAULT = 20, STAFF_REDEMPTION_ROLLOVER_LIST_MAX = 50, STAFF_REDEMPTION_PAGE_MAX = 100, STAFF_REDEMPTION_CLAIM_ITEMS_MAX = 20, STAFF_REDEMPTION_ITEM_RULES = ["ONE_FROM_EACH_GROUP", "AT_MOST_ONE_PER_GROUP", "AT_MOST_ONE_PER_GROUP_OR_NONE"], STAFF_REDEMPTION_WRONG_SITE_RULES = ["REFUSE", "SERVE_FROM_COUNTER"], STAFF_REDEMPTION_SESSION_RULES = ["OWN_SHIFT", "ANY_OPEN_SESSION"], STAFF_REDEMPTION_WALK_IN_DRAWS = ["NO_PRIZE", "AT_COUNTER_SITE"], STAFF_REDEMPTION_DRAW_POLICIES = ["REMAINING_HEADCOUNT", "FIXED_RATE"], STAFF_REDEMPTION_COUNTER_ORDERS = ["FOOD_THEN_DRAW", "DRAW_THEN_FOOD"], STAFF_REDEMPTION_ARCHIVABLE = ["site", "session", "itemGroup", "item", "prize",
10310
- "rosterEntry"], idSchema = string2().min(1).max(64), nameSchema = string2().trim().min(1).max(STAFF_REDEMPTION_NAME_MAX), orderSchema = number2().int().min(0).max(1e4), quantitySchema = number2().int().min(0).max(STAFF_REDEMPTION_QUANTITY_MAX), reasonSchema = string2().trim().min(1).max(STAFF_REDEMPTION_REASON_MAX), staffRedemptionShiftSchema = string2().trim().min(1).max(STAFF_REDEMPTION_SHIFT_MAX).transform((value) => value.toUpperCase()).refine(
10311
- (value) => new __cliRegExp("^[A-Z0-9]+$", "").test(value),
10312
- { message: "Use letters and digits only." }
10313
- ), staffRedemptionEmployeeIdSchema = string2().trim().min(1).max(STAFF_REDEMPTION_EMPLOYEE_ID_MAX), staffRedemptionClientRequestIdSchema = uuid2(), staffRedemptionEventIdSchema = object({ eventId: idSchema }).strict(), staffRedemptionSiteIdSchema = staffRedemptionEventIdSchema.extend({ siteId: idSchema }).strict(), STAFF_REDEMPTION_STAFF_ID_LABEL_MAX = PASSPORT_STAFF_ID_LABEL_MAX, STAFF_REDEMPTION_WRONG_SITE_MESSAGE_MAX = 300, STAFF_REDEMPTION_LAST_NAME_MAX = STAFF_REDEMPTION_NAME_MAX, staffRedemptionLoginMethodsSchema = object({ emailOtp: boolean2(), google: boolean2(), guest: boolean2(), staffId: boolean2().default(!1), staffIdRequiresLastName: boolean2().default(!0) }).strict(), customTextOrNull = __name2((max) => union([_null3(), string2().trim().max(max).transform((value) => value === "" ? null : value)]), "customTextOrNull"), lastNameSchema = string2().trim().min(1).max(STAFF_REDEMPTION_LAST_NAME_MAX).optional(), signInToStaffRedemptionEmployeeSchema = staffRedemptionEventIdSchema.
10314
- extend({ employeeId: staffRedemptionEmployeeIdSchema, lastName: lastNameSchema }).strict(), requestStaffRedemptionEmployeeEmailOtpSchema = staffRedemptionEventIdSchema.extend({ email: email2().trim().toLowerCase() }).strict(), updateStaffRedemptionSettingsSchema = staffRedemptionEventIdSchema.extend({ eligibleShifts: array(staffRedemptionShiftSchema).min(1).max(STAFF_REDEMPTION_ELIGIBLE_SHIFTS_MAX).optional(), itemRule: _enum(STAFF_REDEMPTION_ITEM_RULES).optional(), wrongSite: _enum(STAFF_REDEMPTION_WRONG_SITE_RULES).optional(), sessionRule: _enum(STAFF_REDEMPTION_SESSION_RULES).optional(), drawPolicy: _enum(STAFF_REDEMPTION_DRAW_POLICIES).optional(), walkInDraw: _enum(STAFF_REDEMPTION_WALK_IN_DRAWS).optional(), fixedWinRatePercent: number2().min(0).max(100).optional(), counterOrder: _enum(STAFF_REDEMPTION_COUNTER_ORDERS).optional(), loginMethods: staffRedemptionLoginMethodsSchema.optional(), staffIdLabel: customTextOrNull(STAFF_REDEMPTION_STAFF_ID_LABEL_MAX).optional(), wrongSiteMessage: customTextOrNull(
10315
- STAFF_REDEMPTION_WRONG_SITE_MESSAGE_MAX).optional(), overrideReason: reasonSchema.optional() }).strict(), upsertStaffRedemptionSiteSchema = staffRedemptionEventIdSchema.extend({ siteId: idSchema.optional(), name: nameSchema, order: orderSchema.optional() }).strict(), setStaffRedemptionCrewPasswordSchema = staffRedemptionSiteIdSchema.extend({ password: stationStaffPasswordSchema }).strict(), signInToStaffRedemptionCrewSchema = staffRedemptionSiteIdSchema.extend({ password: string2().min(1).max(128) }).strict(), upsertStaffRedemptionSessionSchema = staffRedemptionEventIdSchema.extend({ sessionId: idSchema.optional(), name: nameSchema, shift: staffRedemptionShiftSchema, startsAt: exports_coerce.date().nullable().default(null), endsAt: exports_coerce.date().nullable().default(null) }).strict().refine((input) => input.startsAt === null || input.endsAt === null || input.endsAt > input.startsAt, { message: "The session must end after it starts.", path: ["endsAt"] }), setStaffRedemptionSlotSchema = staffRedemptionEventIdSchema.
10316
- extend({ sessionId: idSchema, siteId: idSchema, setQuantity: quantitySchema }).strict(), rolloverSessionsShape = { fromSessionId: idSchema.describe("Session whose leftover sets and prizes move out (id from setup get). Must belong to this event and not be archived."), toSessionId: idSchema.describe("Session that receives them (id from setup get). Must differ from fromSessionId, belong to this event and not be archived.") }, rolloverReasonSchema = __name2((description) => string2().trim().min(1).max(STAFF_REDEMPTION_ROLLOVER_REASON_MAX).describe(description), "rolloverReasonSchema"), staffRedemptionRolloverPreviewSchema = staffRedemptionEventIdSchema.extend(rolloverSessionsShape).strict(), rolloverStaffRedemptionStockSchema = staffRedemptionEventIdSchema.extend({ ...rolloverSessionsShape, sets: boolean2().default(!0).describe("Move the leftover sets (set quantity minus active, not voided, redemptions) of each site. Defaults to true."), prizes: boolean2().default(!0).describe("Move the le\
10317
- ftover prizes (stock minus prizes drawn and not released) of each site. Defaults to true."), reason: rolloverReasonSchema(
10318
- "Why the leftovers move (1 to 300 characters). Recorded in the activity log."
10319
- ) }).strict().refine((input) => input.sets || input.prizes, { message: "Choose sets, prizes or both.", path: ["sets"] }), staffRedemptionRolloversSchema = staffRedemptionEventIdSchema.extend({ limit: number2().int().min(1).max(STAFF_REDEMPTION_ROLLOVER_LIST_MAX).default(STAFF_REDEMPTION_ROLLOVER_LIST_DEFAULT).describe("How many rollovers to return, newest first (1 to 50). Defaults to 20.") }).strict(), undoStaffRedemptionRolloverSchema = staffRedemptionEventIdSchema.extend({ rolloverId: idSchema.describe("Id of the rollover to undo (id from rollover list). Must belong to this event and not be undone already."), reason: rolloverReasonSchema("Why the rollover is undone (1 to 300 characters). Recorded in the activity log.") }).strict(), upsertStaffRedemptionItemGroupSchema = staffRedemptionEventIdSchema.extend({ groupId: idSchema.optional(), name: nameSchema, order: orderSchema.optional() }).strict(), upsertStaffRedemptionItemSchema = staffRedemptionEventIdSchema.extend({ itemId: idSchema.
10320
- optional(), groupId: idSchema, name: nameSchema, order: orderSchema.optional() }).strict(), upsertStaffRedemptionPrizeSchema = staffRedemptionEventIdSchema.extend({ prizeId: idSchema.optional(), name: nameSchema, order: orderSchema.optional() }).strict(), setStaffRedemptionPrizeStockSchema = staffRedemptionEventIdSchema.extend({ slotId: idSchema, prizeId: idSchema, quantity: quantitySchema, reason: reasonSchema.optional() }).strict(), setStaffRedemptionArchivedSchema = staffRedemptionEventIdSchema.extend({ entity: _enum(STAFF_REDEMPTION_ARCHIVABLE), id: idSchema, archived: boolean2() }).strict(), upsertStaffRedemptionRosterEntrySchema = staffRedemptionEventIdSchema.extend({ employeeId: staffRedemptionEmployeeIdSchema, name: string2().trim().max(STAFF_REDEMPTION_NAME_MAX).nullable(), siteName: string2().trim().max(STAFF_REDEMPTION_NAME_MAX).nullable(), shift: staffRedemptionShiftSchema.nullable(), workShift: string2().trim().max(STAFF_REDEMPTION_NAME_MAX).nullable(), allowance: number2().
10321
- int().min(0).max(STAFF_REDEMPTION_ALLOWANCE_MAX).optional() }).strict(), rosterFiltersShape = { search: string2().trim().max(200).optional(), siteId: idSchema.optional(), shift: staffRedemptionShiftSchema.optional(), archived: _enum(["active", "archived", "all"]).default("active"), collected: _enum(["any", "collected", "not-collected"]).default("any") }, staffRedemptionRosterListSchema = staffRedemptionEventIdSchema.extend({ ...rosterFiltersShape, limit: number2().int().min(1).max(STAFF_REDEMPTION_PAGE_MAX).default(25), cursor: string2().min(1).max(8192).nullish(), direction: literal("forward").optional() }).strict(), staffRedemptionRosterCountsSchema = staffRedemptionEventIdSchema.extend(rosterFiltersShape).strict(), STAFF_REDEMPTION_EMPLOYEE_CODE_MAX = 512, lookupStaffRedemptionSchema = staffRedemptionSiteIdSchema.extend({ employeeId: staffRedemptionEmployeeIdSchema.optional(), code: string2().trim().min(1).max(STAFF_REDEMPTION_EMPLOYEE_CODE_MAX).optional().describe("Employee QR code\
10322
- as scanned from the employee page. Give either employeeId or code.") }).strict().refine((input) => input.employeeId === void 0 != (input.code === void 0), { message: "Give either an Employee ID or a QR code.", path: ["employeeId"] }), claimItemIdsSchema = array(idSchema).max(STAFF_REDEMPTION_CLAIM_ITEMS_MAX).refine((ids) => new Set(ids).size === ids.length, { message: "Pick each item once." }), redeemStaffRedemptionSchema = staffRedemptionSiteIdSchema.extend({ employeeId: staffRedemptionEmployeeIdSchema, clientRequestId: staffRedemptionClientRequestIdSchema, itemIds: claimItemIdsSchema }).strict(), recordStaffRedemptionClaimItemsSchema = staffRedemptionSiteIdSchema.extend({ claimId: idSchema, itemIds: claimItemIdsSchema }).strict(), STAFF_REDEMPTION_COUNTER_CLAIM_SCOPES = ["mine", "site"], staffRedemptionCounterClaimsSchema = staffRedemptionSiteIdSchema.extend({ limit: number2().int().min(1).max(50).default(20), scope: _enum(STAFF_REDEMPTION_COUNTER_CLAIM_SCOPES).default("mine"), status: _enum(
10323
- ["all", "items-pending"]).default("all") }).strict(), STAFF_REDEMPTION_CLAIM_STATUSES = ["active", "items-pending", "voided", "all"], claimFiltersShape = { search: string2().trim().max(200).optional(), siteId: idSchema.optional(), sessionId: idSchema.optional(), status: _enum(STAFF_REDEMPTION_CLAIM_STATUSES).default("all") }, staffRedemptionClaimListSchema = staffRedemptionEventIdSchema.extend({ ...claimFiltersShape, limit: number2().int().min(1).max(STAFF_REDEMPTION_PAGE_MAX).default(25), cursor: string2().min(1).max(8192).nullish(), direction: literal("forward").optional() }).strict(), staffRedemptionClaimCountsSchema = staffRedemptionEventIdSchema.extend(claimFiltersShape).strict(), voidStaffRedemptionClaimSchema = staffRedemptionEventIdSchema.extend({ claimId: idSchema, reason: reasonSchema }).strict(), releaseStaffRedemptionDrawSchema = staffRedemptionEventIdSchema.extend({ drawId: idSchema, reason: reasonSchema, allowWhileClaimActive: boolean2().optional().describe("Override: rel\
10324
- ease the draw even though an active (not voided) redemption still shows it, for a redemption that stays recorded (for example a paper entry with no spin). Omit to refuse while any active redemption uses the draw.") }).strict(), staffRedemptionExportSchema = staffRedemptionEventIdSchema.extend(claimFiltersShape).strict(), STAFF_REDEMPTION_EMPLOYEE_ISSUE_KINDS = ["qr-not-visible", "qr-render-failed", "qr-refresh-failed", "qr-expired", "page-load-failed", "device-problem", "reload-tapped"], STAFF_REDEMPTION_DEVICE_PROBLEMS = ["offline", "site-data-blocked", "in-app-browser", "forced-colors", "forced-dark-mode", "old-browser", "data-saver", "clock-wrong"], STAFF_REDEMPTION_EMPLOYEE_PAGE_STATES = ["loading", "signed-out", "crew-device", "needs-employee-id", "not-on-roster", "ready", "error"], staffRedemptionEmployeeIssueKindSchema = _enum(STAFF_REDEMPTION_EMPLOYEE_ISSUE_KINDS), staffRedemptionDeviceProblemSchema = _enum(STAFF_REDEMPTION_DEVICE_PROBLEMS), deviceDimensionSchema = number2().int().
10325
- min(0).max(1e5), staffRedemptionDeviceSnapshotSchema = object({
10326
- userAgent: string2().max(500),
10327
- platform: string2().max(100).nullable(),
10328
- language: string2().max(35).nullable(),
10329
- timeZone: string2().max(64).nullable(),
10330
- screenWidth: deviceDimensionSchema,
10331
- screenHeight: deviceDimensionSchema,
10332
- viewportWidth: deviceDimensionSchema,
10333
- viewportHeight: deviceDimensionSchema,
10334
- pixelRatio: number2().min(0).max(20),
10335
- online: boolean2(),
10336
- siteDataAllowed: boolean2(),
10337
- inAppBrowser: string2().max(40).nullable(),
10338
- browser: string2().max(40).nullable(),
10339
- os: string2().max(40).nullable(),
10340
- colorScheme: _enum(["light", "dark"]),
10341
- forcedColors: boolean2(),
10342
- standalone: boolean2(),
10343
- connection: string2().max(20).nullable(),
10344
- saveData: boolean2(),
10345
- clockOffsetMs: number2().int().nullable()
10346
- }), staffRedemptionEmployeeIssueSchema = staffRedemptionEventIdSchema.extend({ kind: staffRedemptionEmployeeIssueKindSchema, problems: array(staffRedemptionDeviceProblemSchema).max(8), detail: string2().trim().max(300).optional(), pageState: _enum(STAFF_REDEMPTION_EMPLOYEE_PAGE_STATES), device: staffRedemptionDeviceSnapshotSchema }).strict(), STAFF_REDEMPTION_DEVICE_ISSUES_LIMIT_MAX = 100, STAFF_REDEMPTION_DEVICE_ISSUES_LIMIT_DEFAULT = 50, deviceIssueFiltersShape = { kind: staffRedemptionEmployeeIssueKindSchema.optional() }, staffRedemptionDeviceIssuesSchema = staffRedemptionEventIdSchema.extend({ ...deviceIssueFiltersShape, limit: number2().int().min(1).max(STAFF_REDEMPTION_DEVICE_ISSUES_LIMIT_MAX).default(STAFF_REDEMPTION_DEVICE_ISSUES_LIMIT_DEFAULT), cursor: string2().min(1).max(8192).nullish(), direction: literal("forward").optional() }).strict(), staffRedemptionDeviceIssueCountsSchema = staffRedemptionEventIdSchema.extend(deviceIssueFiltersShape).strict(), STAFF_REDEMPTION_ROSTER_IMPORT_MAX = 2e4,
10347
- staffRedemptionRosterImportRowSchema = object({ row: number2().int().min(1), employeeId: string2().max(1e3), name: string2().max(1e3).nullable(), siteName: string2().max(1e3).nullable(), shift: string2().max(1e3).nullable(), workShift: string2().max(1e3).nullable(), allowance: string2().max(1e3).nullable() }).strict(), importStaffRedemptionRosterSchema = staffRedemptionEventIdSchema.extend({ rows: array(staffRedemptionRosterImportRowSchema).min(1).max(STAFF_REDEMPTION_ROSTER_IMPORT_MAX, "A roster can have at most ".concat(STAFF_REDEMPTION_ROSTER_IMPORT_MAX, " rows.")), archiveMissing: boolean2().default(!1) }).strict(), HEADER_PATTERNS = { employeeId: new __cliRegExp("^(employee|staff|worker)\\s*(id|no|number)$|^(emp|staff)\\s*id$", "i"), name: new __cliRegExp("^(worker|name|full\\s*name|employee\\s*name|staff\\s*name)$", "i"), siteName: new __cliRegExp("^(site|location|fab)$", "i"), shift: new __cliRegExp("^shift$", "i"), workShift: new __cliRegExp("^work\\s*shift$", "i"), allowance: new __cliRegExp(
10348
- "^(allowance|sets|entitlement|balance)$", "i") }, guessStaffRedemptionRosterMapping = __name2((header) => {
10158
+ "rosterEntry"], idSchema = string2().min(1).max(64), nameSchema = string2().trim().min(1).max(STAFF_REDEMPTION_NAME_MAX), orderSchema = number2().int().min(0).max(1e4), quantitySchema = number2().int().min(0).max(STAFF_REDEMPTION_QUANTITY_MAX), reasonSchema = string2().trim().min(1).max(STAFF_REDEMPTION_REASON_MAX), staffRedemptionShiftSchema = string2().trim().min(1).max(STAFF_REDEMPTION_SHIFT_MAX).transform((value) => value.toUpperCase()).refine((value) => new __cliRegExp("^[A-Z0-9]+$", "").test(value), { message: "Use letters and digits only." }), staffRedemptionEmployeeIdSchema = string2().trim().min(1).max(STAFF_REDEMPTION_EMPLOYEE_ID_MAX), staffRedemptionClientRequestIdSchema = uuid2(), staffRedemptionEventIdSchema = object({
10159
+ eventId: idSchema
10160
+ }).strict(), staffRedemptionSiteIdSchema = staffRedemptionEventIdSchema.extend({ siteId: idSchema }).strict(), STAFF_REDEMPTION_STAFF_ID_LABEL_MAX = PASSPORT_STAFF_ID_LABEL_MAX, STAFF_REDEMPTION_WRONG_SITE_MESSAGE_MAX = 300, STAFF_REDEMPTION_LAST_NAME_MAX = STAFF_REDEMPTION_NAME_MAX, staffRedemptionLoginMethodsSchema = object({ emailOtp: boolean2(), google: boolean2(), guest: boolean2(), staffId: boolean2().default(!1), staffIdRequiresLastName: boolean2().default(!0) }).strict(), customTextOrNull = __name2((max) => union([_null3(), string2().trim().max(max).transform((value) => value === "" ? null : value)]), "customTextOrNull"), lastNameSchema = string2().trim().min(1).max(STAFF_REDEMPTION_LAST_NAME_MAX).optional(), signInToStaffRedemptionEmployeeSchema = staffRedemptionEventIdSchema.extend({ employeeId: staffRedemptionEmployeeIdSchema, lastName: lastNameSchema }).strict(), requestStaffRedemptionEmployeeEmailOtpSchema = staffRedemptionEventIdSchema.extend({ email: email2().trim().toLowerCase() }).
10161
+ strict(), updateStaffRedemptionSettingsSchema = staffRedemptionEventIdSchema.extend({ eligibleShifts: array(staffRedemptionShiftSchema).min(1).max(STAFF_REDEMPTION_ELIGIBLE_SHIFTS_MAX).optional(), itemRule: _enum(STAFF_REDEMPTION_ITEM_RULES).optional(), wrongSite: _enum(STAFF_REDEMPTION_WRONG_SITE_RULES).optional(), sessionRule: _enum(STAFF_REDEMPTION_SESSION_RULES).optional(), drawPolicy: _enum(STAFF_REDEMPTION_DRAW_POLICIES).optional(), walkInDraw: _enum(STAFF_REDEMPTION_WALK_IN_DRAWS).optional(), fixedWinRatePercent: number2().min(0).max(100).optional(), counterOrder: _enum(STAFF_REDEMPTION_COUNTER_ORDERS).optional(), loginMethods: staffRedemptionLoginMethodsSchema.optional(), staffIdLabel: customTextOrNull(STAFF_REDEMPTION_STAFF_ID_LABEL_MAX).optional(), wrongSiteMessage: customTextOrNull(STAFF_REDEMPTION_WRONG_SITE_MESSAGE_MAX).optional(), overrideReason: reasonSchema.optional() }).strict(), upsertStaffRedemptionSiteSchema = staffRedemptionEventIdSchema.extend({ siteId: idSchema.optional(),
10162
+ name: nameSchema, order: orderSchema.optional() }).strict(), setStaffRedemptionCrewPasswordSchema = staffRedemptionSiteIdSchema.extend({ password: stationStaffPasswordSchema }).strict(), signInToStaffRedemptionCrewSchema = staffRedemptionSiteIdSchema.extend({ password: string2().min(1).max(128) }).strict(), upsertStaffRedemptionSessionSchema = staffRedemptionEventIdSchema.extend({ sessionId: idSchema.optional(), name: nameSchema, shift: staffRedemptionShiftSchema, startsAt: exports_coerce.date().nullable().default(null), endsAt: exports_coerce.date().nullable().default(null) }).strict().refine((input) => input.startsAt === null || input.endsAt === null || input.endsAt > input.startsAt, { message: "The session must end after it starts.", path: ["endsAt"] }), setStaffRedemptionSlotSchema = staffRedemptionEventIdSchema.extend({ sessionId: idSchema, siteId: idSchema, setQuantity: quantitySchema }).strict(), rolloverSessionsShape = { fromSessionId: idSchema.describe("Session whose leftover \
10163
+ sets and prizes move out (id from setup get). Must belong to this event and not be archived."), toSessionId: idSchema.describe("Session that receives them (id from setup get). Must differ from fromSessionId, belong to this event and not be archived.") }, rolloverReasonSchema = __name2((description) => string2().trim().min(1).max(STAFF_REDEMPTION_ROLLOVER_REASON_MAX).describe(description), "rolloverReasonSchema"), staffRedemptionRolloverPreviewSchema = staffRedemptionEventIdSchema.extend(rolloverSessionsShape).strict(), rolloverStaffRedemptionStockSchema = staffRedemptionEventIdSchema.extend({ ...rolloverSessionsShape, sets: boolean2().default(!0).describe("Move the leftover sets (set quantity minus active, not voided, redemptions) of each site. Defaults to true."), prizes: boolean2().default(!0).describe("Move the leftover prizes (stock minus prizes drawn and not released) of each site. Defaults to true."), reason: rolloverReasonSchema("Why the leftovers move (1 to 300 characters). Rec\
10164
+ orded in the activity log.") }).strict().refine((input) => input.sets || input.prizes, { message: "Choose sets, prizes or both.", path: ["sets"] }), staffRedemptionRolloversSchema = staffRedemptionEventIdSchema.extend({ limit: number2().int().min(1).max(STAFF_REDEMPTION_ROLLOVER_LIST_MAX).default(STAFF_REDEMPTION_ROLLOVER_LIST_DEFAULT).describe("How many rollovers to return, newest first (1 to 50). Defaults to 20.") }).strict(), undoStaffRedemptionRolloverSchema = staffRedemptionEventIdSchema.extend({ rolloverId: idSchema.describe("Id of the rollover to undo (id from rollover list). Must belong to this event and not be undone already."), reason: rolloverReasonSchema("Why the rollover is undone (1 to 300 characters). Recorded in the activity log.") }).strict(), upsertStaffRedemptionItemGroupSchema = staffRedemptionEventIdSchema.extend({ groupId: idSchema.optional(), name: nameSchema, order: orderSchema.optional() }).strict(), upsertStaffRedemptionItemSchema = staffRedemptionEventIdSchema.
10165
+ extend({ itemId: idSchema.optional(), groupId: idSchema, name: nameSchema, order: orderSchema.optional() }).strict(), upsertStaffRedemptionPrizeSchema = staffRedemptionEventIdSchema.extend({ prizeId: idSchema.optional(), name: nameSchema, order: orderSchema.optional() }).strict(), setStaffRedemptionPrizeStockSchema = staffRedemptionEventIdSchema.extend({ slotId: idSchema, prizeId: idSchema, quantity: quantitySchema, reason: reasonSchema.optional() }).strict(), setStaffRedemptionArchivedSchema = staffRedemptionEventIdSchema.extend({ entity: _enum(STAFF_REDEMPTION_ARCHIVABLE), id: idSchema, archived: boolean2() }).strict(), upsertStaffRedemptionRosterEntrySchema = staffRedemptionEventIdSchema.extend({ employeeId: staffRedemptionEmployeeIdSchema, name: string2().trim().max(STAFF_REDEMPTION_NAME_MAX).nullable(), siteName: string2().trim().max(STAFF_REDEMPTION_NAME_MAX).nullable(), shift: staffRedemptionShiftSchema.nullable(), workShift: string2().trim().max(STAFF_REDEMPTION_NAME_MAX).nullable(),
10166
+ allowance: number2().int().min(0).max(STAFF_REDEMPTION_ALLOWANCE_MAX).optional() }).strict(), rosterFiltersShape = { search: string2().trim().max(200).optional(), siteId: idSchema.optional(), shift: staffRedemptionShiftSchema.optional(), archived: _enum(["active", "archived", "all"]).default("active"), collected: _enum([
10167
+ "any",
10168
+ "collected",
10169
+ "not-collected"
10170
+ ]).default("any") }, staffRedemptionRosterListSchema = staffRedemptionEventIdSchema.extend({ ...rosterFiltersShape, limit: number2().int().min(1).max(STAFF_REDEMPTION_PAGE_MAX).default(25), cursor: string2().min(1).max(8192).nullish(), direction: literal("forward").optional() }).strict(), staffRedemptionRosterCountsSchema = staffRedemptionEventIdSchema.extend(rosterFiltersShape).strict(), STAFF_REDEMPTION_EMPLOYEE_CODE_MAX = 512, lookupStaffRedemptionSchema = staffRedemptionSiteIdSchema.extend({ employeeId: staffRedemptionEmployeeIdSchema.optional(), code: string2().trim().min(1).max(STAFF_REDEMPTION_EMPLOYEE_CODE_MAX).optional().describe("Employee QR code as scanned from the employee page. Give either employeeId or code.") }).strict().refine((input) => input.employeeId === void 0 != (input.code === void 0), { message: "Give either an Employee ID or a QR code.", path: ["employeeId"] }), claimItemIdsSchema = array(idSchema).max(STAFF_REDEMPTION_CLAIM_ITEMS_MAX).refine(
10171
+ (ids) => new Set(ids).size === ids.length,
10172
+ { message: "Pick each item once." }
10173
+ ), redeemStaffRedemptionSchema = staffRedemptionSiteIdSchema.extend({ employeeId: staffRedemptionEmployeeIdSchema, clientRequestId: staffRedemptionClientRequestIdSchema, itemIds: claimItemIdsSchema }).strict(), recordStaffRedemptionClaimItemsSchema = staffRedemptionSiteIdSchema.extend({ claimId: idSchema, itemIds: claimItemIdsSchema }).strict(), STAFF_REDEMPTION_COUNTER_CLAIM_SCOPES = ["mine", "site"], staffRedemptionCounterClaimsSchema = staffRedemptionSiteIdSchema.extend({ limit: number2().int().min(1).max(50).default(20), scope: _enum(STAFF_REDEMPTION_COUNTER_CLAIM_SCOPES).default("mine"), status: _enum(["all", "items-pending"]).default("all") }).strict(), STAFF_REDEMPTION_CLAIM_STATUSES = ["active", "items-pending", "voided", "all"], claimFiltersShape = { search: string2().trim().max(200).optional(), siteId: idSchema.optional(), sessionId: idSchema.optional(), status: _enum(STAFF_REDEMPTION_CLAIM_STATUSES).default("all") }, staffRedemptionClaimListSchema = staffRedemptionEventIdSchema.
10174
+ extend({
10175
+ ...claimFiltersShape,
10176
+ limit: number2().int().min(1).max(STAFF_REDEMPTION_PAGE_MAX).default(25),
10177
+ cursor: string2().min(1).max(8192).nullish(),
10178
+ direction: literal("forward").optional()
10179
+ }).strict(), staffRedemptionClaimCountsSchema = staffRedemptionEventIdSchema.extend(claimFiltersShape).strict(), voidStaffRedemptionClaimSchema = staffRedemptionEventIdSchema.extend({ claimId: idSchema, reason: reasonSchema }).strict(), releaseStaffRedemptionDrawSchema = staffRedemptionEventIdSchema.extend({ drawId: idSchema, reason: reasonSchema, allowWhileClaimActive: boolean2().optional().describe("Override: release the draw even though an active (not voided) redemption still shows it, for a redemption that stays recorded (for example a paper entry with no spin). Omit to refuse while any active redemption uses the draw.") }).strict(), staffRedemptionExportSchema = staffRedemptionEventIdSchema.extend(claimFiltersShape).strict(), STAFF_REDEMPTION_EMPLOYEE_ISSUE_KINDS = ["qr-not-visible", "qr-render-failed", "qr-refresh-failed", "qr-expired", "page-load-failed", "device-problem", "reload-tapped"], STAFF_REDEMPTION_DEVICE_PROBLEMS = ["offline", "site-data-blocked", "in-app-browser", "fo\
10180
+ rced-colors", "forced-dark-mode", "old-browser", "data-saver", "clock-wrong"], STAFF_REDEMPTION_EMPLOYEE_PAGE_STATES = ["loading", "signed-out", "crew-device", "needs-employee-id", "not-on-roster", "ready", "error"], staffRedemptionEmployeeIssueKindSchema = _enum(STAFF_REDEMPTION_EMPLOYEE_ISSUE_KINDS), staffRedemptionDeviceProblemSchema = _enum(STAFF_REDEMPTION_DEVICE_PROBLEMS), deviceDimensionSchema = number2().int().min(0).max(1e5), staffRedemptionDeviceSnapshotSchema = object({ userAgent: string2().max(500), platform: string2().max(100).nullable(), language: string2().max(35).nullable(), timeZone: string2().max(64).nullable(), screenWidth: deviceDimensionSchema, screenHeight: deviceDimensionSchema, viewportWidth: deviceDimensionSchema, viewportHeight: deviceDimensionSchema, pixelRatio: number2().min(0).max(20), online: boolean2(), siteDataAllowed: boolean2(), inAppBrowser: string2().max(40).nullable(), browser: string2().max(40).nullable(), os: string2().max(40).nullable(), colorScheme: _enum(
10181
+ ["light", "dark"]), forcedColors: boolean2(), standalone: boolean2(), connection: string2().max(20).nullable(), saveData: boolean2(), clockOffsetMs: number2().int().nullable() }), staffRedemptionEmployeeIssueSchema = staffRedemptionEventIdSchema.extend({ kind: staffRedemptionEmployeeIssueKindSchema, problems: array(staffRedemptionDeviceProblemSchema).max(8), detail: string2().trim().max(300).optional(), pageState: _enum(STAFF_REDEMPTION_EMPLOYEE_PAGE_STATES), device: staffRedemptionDeviceSnapshotSchema }).strict(), STAFF_REDEMPTION_DEVICE_ISSUES_LIMIT_MAX = 100, STAFF_REDEMPTION_DEVICE_ISSUES_LIMIT_DEFAULT = 50, deviceIssueFiltersShape = { kind: staffRedemptionEmployeeIssueKindSchema.optional() }, staffRedemptionDeviceIssuesSchema = staffRedemptionEventIdSchema.extend({
10182
+ ...deviceIssueFiltersShape,
10183
+ limit: number2().int().min(1).max(STAFF_REDEMPTION_DEVICE_ISSUES_LIMIT_MAX).default(STAFF_REDEMPTION_DEVICE_ISSUES_LIMIT_DEFAULT),
10184
+ cursor: string2().min(1).max(8192).nullish(),
10185
+ direction: literal("forward").optional()
10186
+ }).strict(), staffRedemptionDeviceIssueCountsSchema = staffRedemptionEventIdSchema.extend(deviceIssueFiltersShape).strict(), STAFF_REDEMPTION_ROSTER_IMPORT_MAX = 2e4, staffRedemptionRosterImportRowSchema = object({ row: number2().int().min(1), employeeId: string2().max(1e3), name: string2().max(1e3).nullable(), siteName: string2().max(1e3).nullable(), shift: string2().max(1e3).nullable(), workShift: string2().max(1e3).nullable(), allowance: string2().max(1e3).nullable() }).strict(), importStaffRedemptionRosterSchema = staffRedemptionEventIdSchema.extend({ rows: array(staffRedemptionRosterImportRowSchema).min(1).max(STAFF_REDEMPTION_ROSTER_IMPORT_MAX, "A roster can have at most ".concat(STAFF_REDEMPTION_ROSTER_IMPORT_MAX, " rows.")), archiveMissing: boolean2().default(!1) }).strict(), HEADER_PATTERNS = {
10187
+ employeeId: new __cliRegExp("^(employee|staff|worker)\\s*(id|no|number)$|^(emp|staff)\\s*id$", "i"),
10188
+ name: new __cliRegExp("^(worker|name|full\\s*name|employee\\s*name|staff\\s*name)$", "i"),
10189
+ siteName: new __cliRegExp("^(site|location|fab)$", "i"),
10190
+ shift: new __cliRegExp("^shift$", "i"),
10191
+ workShift: new __cliRegExp("^work\\s*shift$", "i"),
10192
+ allowance: new __cliRegExp("^(allowance|sets|entitlement|balance)$", "i")
10193
+ }, guessStaffRedemptionRosterMapping = __name2((header) => {
10349
10194
  const find = __name2((key) => {
10350
10195
  const index = header.findIndex((cell2) => HEADER_PATTERNS[key].test(cell2.trim()));
10351
10196
  return index === -1 ? null : index;
@@ -10354,43 +10199,49 @@ staffRedemptionRosterImportRowSchema = object({ row: number2().int().min(1), emp
10354
10199
  }, "guessStaffRedemptionRosterMapping"), mapStaffRedemptionRosterTable = __name2((table, mapping) => {
10355
10200
  const cell2 = __name2((line, index) => index === null ? null : line[index] ?? "", "cell"), rows = [];
10356
10201
  if (table.slice(1).forEach((line, offset) => {
10357
- line.every((value) => !value?.trim()) || rows.push({ row: offset + 2, employeeId: line[mapping.employeeId] ?? "", name: cell2(line, mapping.name), siteName: cell2(line, mapping.siteName), shift: cell2(line, mapping.shift), workShift: cell2(line, mapping.workShift), allowance: cell2(line, mapping.allowance) });
10202
+ line.every((value) => !value?.trim()) || rows.push({ row: offset + 2, employeeId: line[mapping.employeeId] ?? "", name: cell2(line, mapping.name), siteName: cell2(line, mapping.siteName), shift: cell2(line, mapping.shift), workShift: cell2(
10203
+ line,
10204
+ mapping.workShift
10205
+ ), allowance: cell2(line, mapping.allowance) });
10358
10206
  }), rows.length > STAFF_REDEMPTION_ROSTER_IMPORT_MAX) throw new Error("A roster can have at most ".concat(STAFF_REDEMPTION_ROSTER_IMPORT_MAX, " rows."));
10359
10207
  return rows;
10360
10208
  }, "mapStaffRedemptionRosterTable"), optionalRosterColumns = [["name", "name-column"], ["siteName", "site-column"], ["shift", "shift-column"], ["workShift", "work-shift-column"], ["allowance", "allowance-column"]], rosterImportFlags = ["event-id", "file", "sheet", "employee-id-column", ...optionalRosterColumns.map(([, flag2]) => flag2), "archive-missing", "allow-state-change", "target"], exportFlags = ["event-id", "search", "site-id", "session-id", "status", "csv-file", "force"], headerIndex2 = __name2((headers, name) => {
10361
10209
  const wanted = name.trim().toLowerCase(), index = headers.findIndex((header) => header.trim().toLowerCase() === wanted);
10362
10210
  if (index === -1) throw new CliUsageError('Column "'.concat(name, '" is not in the file. Headers: ').concat(headers.join(", "), "."));
10363
10211
  return index;
10364
- }, "headerIndex2"), resolveStaffRedemptionRosterMapping = __name2((headers, parsed) => {
10365
- const mapping = guessStaffRedemptionRosterMapping(headers), employeeIdColumn = getOptionalFlag(parsed, "employee-id-column");
10366
- employeeIdColumn !== void 0 && (mapping.employeeId = headerIndex2(headers, employeeIdColumn));
10367
- for (const [key, flag2] of optionalRosterColumns) {
10368
- const value = getOptionalFlag(parsed, flag2);
10369
- value !== void 0 && (mapping[key] = value.trim().toLowerCase() === "none" ? null : headerIndex2(headers, value));
10370
- }
10371
- return mapping;
10372
- }, "resolveStaffRedemptionRosterMapping"), readRosterTable = __name2(async (path2, sheetName) => {
10212
+ }, "headerIndex2"), resolveStaffRedemptionRosterMapping = __name2(
10213
+ (headers, parsed) => {
10214
+ const mapping = guessStaffRedemptionRosterMapping(headers), employeeIdColumn = getOptionalFlag(parsed, "employee-id-column");
10215
+ employeeIdColumn !== void 0 && (mapping.employeeId = headerIndex2(headers, employeeIdColumn));
10216
+ for (const [key, flag2] of optionalRosterColumns) {
10217
+ const value = getOptionalFlag(parsed, flag2);
10218
+ value !== void 0 && (mapping[key] = value.trim().toLowerCase() === "none" ? null : headerIndex2(headers, value));
10219
+ }
10220
+ return mapping;
10221
+ },
10222
+ "resolveStaffRedemptionRosterMapping"
10223
+ ), readRosterTable = __name2(async (path2, sheetName) => {
10373
10224
  try {
10374
10225
  return await readSpreadsheetTable(basename4(path2), await readFile6(path2), { sheetName });
10375
10226
  } catch (error2) {
10376
10227
  throw new CliUsageError("Could not read ".concat(path2, ": ").concat(error2 instanceof Error ? error2.message : "unknown error"));
10377
10228
  }
10378
- }, "readRosterTable"), prepareRosterImport = __name2(
10379
- async (parsed) => {
10380
- const eventId = getRequiredFlag(parsed, "event-id"), path2 = getRequiredFlag(parsed, "file"), sheet = getOptionalFlag(parsed, "sheet");
10381
- assertStateChangeTarget(parsed, eventId);
10382
- const table = await readRosterTable(path2, sheet), mapping = resolveStaffRedemptionRosterMapping(table[0] ?? [], parsed);
10383
- let rows;
10384
- try {
10385
- rows = mapStaffRedemptionRosterTable(table, mapping);
10386
- } catch (error2) {
10387
- throw new CliUsageError("Could not import ".concat(path2, ": ").concat(error2 instanceof Error ? error2.message : "unknown error"));
10388
- }
10389
- if (rows.length === 0) throw new CliUsageError("".concat(path2, " has a header but no data rows."));
10390
- return { eventId, rows, archiveMissing: parsed.flags.get("archive-missing") === !0 };
10391
- },
10392
- "prepareRosterImport"
10393
- ), exportFilters = __name2((parsed, eventId) => {
10229
+ }, "readRosterTable"), prepareRosterImport = __name2(async (parsed) => {
10230
+ const eventId = getRequiredFlag(parsed, "event-id"), path2 = getRequiredFlag(parsed, "file"), sheet = getOptionalFlag(parsed, "sheet");
10231
+ assertStateChangeTarget(parsed, eventId);
10232
+ const table = await readRosterTable(
10233
+ path2,
10234
+ sheet
10235
+ ), mapping = resolveStaffRedemptionRosterMapping(table[0] ?? [], parsed);
10236
+ let rows;
10237
+ try {
10238
+ rows = mapStaffRedemptionRosterTable(table, mapping);
10239
+ } catch (error2) {
10240
+ throw new CliUsageError("Could not import ".concat(path2, ": ").concat(error2 instanceof Error ? error2.message : "unknown error"));
10241
+ }
10242
+ if (rows.length === 0) throw new CliUsageError("".concat(path2, " has a header but no data rows."));
10243
+ return { eventId, rows, archiveMissing: parsed.flags.get("archive-missing") === !0 };
10244
+ }, "prepareRosterImport"), exportFilters = __name2((parsed, eventId) => {
10394
10245
  const checked = staffRedemptionExportSchema.safeParse({ eventId, search: getOptionalFlag(parsed, "search"), siteId: getOptionalFlag(parsed, "site-id"), sessionId: getOptionalFlag(parsed, "session-id"), status: getOptionalFlag(parsed, "status") });
10395
10246
  if (!checked.success) {
10396
10247
  const issue2 = checked.error.issues[0], name = String(issue2?.path[0] ?? "filter");
@@ -10400,40 +10251,24 @@ staffRedemptionRosterImportRowSchema = object({ row: number2().int().min(1), emp
10400
10251
  }, "exportFilters"), formulaStart = new __cliRegExp("^[=+\\-@\\t\\r]", ""), csvCell = __name2((value) => {
10401
10252
  const text2 = value ?? "", safe = formulaStart.test(text2) ? "'".concat(text2) : text2;
10402
10253
  return new __cliRegExp('[",\\r\\n]', "").test(safe) ? '"'.concat(safe.replaceAll('"', '""'), '"') : safe;
10403
- }, "csvCell"), csvColumns = [
10404
- ["Created at", (row) => row.createdAt.toISOString()],
10405
- ["Employee ID", (row) => row.employeeId],
10406
- ["Name", (row) => row.name],
10407
- ["Site", (row) => row.site.name],
10408
- ["Roster site", (row) => row.rosterSiteName],
10409
- ["Away from roster site", (row) => row.awayFromRosterSite ? "yes" : "no"],
10410
- ["Session", (row) => row.session.name],
10411
- ["Items", (row) => row.items.map((item) => {
10412
- const label = "".concat(item.groupName, ": ").concat(item.name);
10413
- return item.quantity === 1 ? label : "".concat(label, " x").concat(item.quantity);
10414
- }).join("; ")],
10415
- ["Items recorded", (row) => row.itemsPending ? "no" : "yes"],
10416
- ["Items recorded at", (row) => row.itemsRecordedAt?.toISOString() ?? null],
10417
- ["Outcome", (row) => row.draw?.outcome ?? null],
10418
- ["Prize", (row) => row.draw?.prize?.name ?? null],
10419
- ["Operator kind", (row) => row.operatorKind],
10420
- ["Voided at", (row) => row.voidedAt?.toISOString() ?? null],
10421
- ["Void reason", (row) => row.voidReason],
10422
- ["Draw released at", (row) => row.draw?.releasedAt?.toISOString() ?? null]
10423
- ], staffRedemptionClaimsToCsv = __name2((rows) => {
10254
+ }, "csvCell"), csvColumns = [["Created at", (row) => row.createdAt.toISOString()], ["Employee ID", (row) => row.employeeId], ["Name", (row) => row.name], ["Site", (row) => row.site.name], ["Roster site", (row) => row.rosterSiteName], ["Away from roster site", (row) => row.awayFromRosterSite ? "yes" : "no"], ["Session", (row) => row.session.name], ["Items", (row) => row.items.map((item) => {
10255
+ const label = "".concat(item.groupName, ": ").concat(item.name);
10256
+ return item.quantity === 1 ? label : "".concat(label, " x").concat(item.quantity);
10257
+ }).join("; ")], ["Items recorded", (row) => row.itemsPending ? "no" : "yes"], ["Items recorded at", (row) => row.itemsRecordedAt?.toISOString() ?? null], ["Outcome", (row) => row.draw?.outcome ?? null], ["Prize", (row) => row.draw?.prize?.name ?? null], ["Operator kind", (row) => row.operatorKind], ["Voided at", (row) => row.voidedAt?.toISOString() ?? null], ["Void reason", (row) => row.voidReason], ["Draw released at", (row) => row.draw?.releasedAt?.toISOString() ?? null]], staffRedemptionClaimsToCsv = __name2((rows) => {
10424
10258
  const lines = [csvColumns.map(([header]) => csvCell(header)).join(","), ...rows.map((row) => csvColumns.map(([, read]) => csvCell(read(row))).join(","))];
10425
10259
  return "\uFEFF".concat(lines.join("\r\n"), "\r\n");
10426
10260
  }, "staffRedemptionClaimsToCsv"), writeCsvFile = __name2(async (path2, content, force) => {
10427
10261
  try {
10428
10262
  await writeFile(path2, content, { encoding: "utf8", flag: force ? "w" : "wx" });
10429
10263
  } catch (error2) {
10430
- throw (error2 instanceof Error && "code" in error2 ? error2.code : void 0) === "EEXIST" ? new CliUsageError("".concat(path2, " already exists. Choose another --csv-file or pass --force to overwrite it.")) : new CliUsageError(
10431
- "Could not write ".concat(path2, ": ").concat(error2 instanceof Error ? error2.message : "unknown error")
10432
- );
10264
+ throw (error2 instanceof Error && "code" in error2 ? error2.code : void 0) === "EEXIST" ? new CliUsageError("".concat(path2, " already exists. Choose another --csv-file or pass --force to overwrite it.")) : new CliUsageError("Could not write ".concat(path2, ": ").concat(error2 instanceof Error ? error2.message : "unknown error"));
10433
10265
  }
10434
10266
  }, "writeCsvFile"), exportClaims = __name2(async (input) => {
10435
10267
  const { parsed, runtime } = input;
10436
- assertOnlyFlags(parsed, exportFlags), assertPositionalCount(parsed, 2);
10268
+ assertOnlyFlags(
10269
+ parsed,
10270
+ exportFlags
10271
+ ), assertPositionalCount(parsed, 2);
10437
10272
  const eventId = getRequiredFlag(parsed, "event-id"), filters = exportFilters(parsed, eventId), csvFile = getOptionalFlag(parsed, "csv-file");
10438
10273
  if (csvFile === void 0 && parsed.flags.has("force")) throw new CliUsageError("--force only applies with --csv-file.");
10439
10274
  await input.authenticate();
@@ -10446,9 +10281,7 @@ staffRedemptionRosterImportRowSchema = object({ row: number2().int().min(1), emp
10446
10281
  }, "exportClaims"), importRoster = __name2(async (input) => {
10447
10282
  const { parsed, runtime } = input;
10448
10283
  assertOnlyFlags(parsed, rosterImportFlags), assertPositionalCount(parsed, 3);
10449
- const payload = await prepareRosterImport(
10450
- parsed
10451
- );
10284
+ const payload = await prepareRosterImport(parsed);
10452
10285
  await input.authenticate(), writeSuccess(runtime, await api2.event.staffRedemption.importStaffRedemptionRoster.mutate(payload));
10453
10286
  }, "importRoster"), runStaffRedemptionCommand = __name2(async (input) => {
10454
10287
  switch (input.parsed.positionals.slice(1).join(" ")) {
@@ -10462,12 +10295,7 @@ staffRedemptionRosterImportRowSchema = object({ row: number2().int().min(1), emp
10462
10295
  throw new CliUsageError("Unknown staff-redemption command. Run `et commands` for the registry commands and `et --help` for the rest.");
10463
10296
  }
10464
10297
  }, "runStaffRedemptionCommand"), command_manifest_default = [
10465
- { path: ["organization", "member", "list"], procedure: "organization.getOrganizationMembersById", operation: "query", summary: "List an organization's members and pending invitations (paged; expired links included until resent or canceled), with each invitation's stored emailDeliveryStatus.", effects: [], dates: [], input: { type: "object", properties: { organizationId: { type: "string" }, page: { default: 1, type: "integer", exclusiveMinimum: 0, maximum: 9007199254740991 }, perPage: {
10466
- default: 10,
10467
- type: "integer",
10468
- minimum: 1,
10469
- maximum: 100
10470
- }, search: { default: "", type: "string" } }, required: ["organizationId"] } },
10298
+ { path: ["organization", "member", "list"], procedure: "organization.getOrganizationMembersById", operation: "query", summary: "List an organization's members and pending invitations (paged; expired links included until resent or canceled), with each invitation's stored emailDeliveryStatus.", effects: [], dates: [], input: { type: "object", properties: { organizationId: { type: "string" }, page: { default: 1, type: "integer", exclusiveMinimum: 0, maximum: 9007199254740991 }, perPage: { default: 10, type: "integer", minimum: 1, maximum: 100 }, search: { default: "", type: "string" } }, required: ["organizationId"] } },
10471
10299
  { path: ["organization", "member", "list-all"], procedure: "organization.getMembersByOrganization", operation: "query", summary: "List every member of an organization without paging.", effects: [], dates: [], input: { type: "object", properties: { organizationId: { type: "string" } }, required: ["organizationId"] } },
10472
10300
  { path: ["organization", "member", "invite"], procedure: "organization.createOrganizationMember", operation: "mutation", summary: "Invite a member to an organization and email the invitation; reports deliveryStatus and the stored emailDeliveryStatus.", effects: ["state-change", "email"], target: "email", dates: [], input: { type: "object", properties: { email: { type: "string", format: "email", pattern: "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$" }, organizationId: { type: "string", minLength: 1 }, organizationRole: { default: "MEMBER", type: "string", enum: ["OWNER", "ADMIN", "MEMBER"] } }, required: ["email", "organizationId"] } },
10473
10301
  { path: ["organization", "member", "invitation-resend"], procedure: "organization.resendOrganizationMemberInvitation", operation: "mutation", summary: "Resend the invitation email to a pending legacy member invitation created before organization invitations; reports deliveryStatus and the stored emailDeliveryStatus.", effects: ["state-change", "email"], target: "memberId", dates: [], input: { type: "object", properties: { organizationId: { type: "string", minLength: 1 }, memberId: { type: "string", minLength: 1 } }, required: ["organizationId", "memberId"] } },
@@ -10480,21 +10308,28 @@ staffRedemptionRosterImportRowSchema = object({ row: number2().int().min(1), emp
10480
10308
  { path: ["organization", "invitation", "accept"], procedure: "organization.acceptInvitation", operation: "mutation", summary: "Accept the current user's invitation to an organization.", effects: ["state-change"], target: "organizationId", dates: [], input: { type: "object", properties: { organizationId: { type: "string" } }, required: ["organizationId"] } },
10481
10309
  { path: ["organization", "invitation", "reject"], procedure: "organization.rejectInvitation", operation: "mutation", summary: "Reject the current user's invitation to an organization.", effects: ["state-change"], target: "organizationId", dates: [], input: { type: "object", properties: { organizationId: { type: "string" } }, required: ["organizationId"] } },
10482
10310
  { path: ["organization", "invitation", "accept-access"], procedure: "organization.acceptAccessInvitation", operation: "mutation", summary: "Accept an access invitation (organization or event staff) by invitation ID.", effects: ["state-change"], target: "invitationId", dates: [], input: { type: "object", properties: { invitationId: { type: "string", minLength: 1 } }, required: ["invitationId"] } },
10483
- { path: ["organization", "invitation", "reject-access"], procedure: "organization.rejectAccessInvitation", operation: "mutation", summary: "Reject an access invitation by invitation ID.", effects: ["state-change"], target: "invitationId", dates: [], input: { type: "object", properties: { invitationId: { type: "string", minLength: 1 } }, required: [
10484
- "invitationId"
10485
- ] } },
10311
+ { path: ["organization", "invitation", "reject-access"], procedure: "organization.rejectAccessInvitation", operation: "mutation", summary: "Reject an access invitation by invitation ID.", effects: ["state-change"], target: "invitationId", dates: [], input: { type: "object", properties: { invitationId: { type: "string", minLength: 1 } }, required: ["invitationId"] } },
10486
10312
  { path: ["organization", "invitation", "cancel"], procedure: "organization.cancelInvitation", operation: "mutation", summary: "Cancel a pending organization invitation.", effects: ["state-change"], target: "invitationId", dates: [], input: { type: "object", properties: { organizationId: { type: "string", minLength: 1 }, invitationId: { type: "string", minLength: 1 } }, required: ["organizationId", "invitationId"] } },
10487
10313
  { path: ["organization", "invitation", "resend"], procedure: "organization.resendInvitation", operation: "mutation", summary: "Replace a pending organization invitation (including an expired one) and email a fresh link; reports deliveryStatus and the stored emailDeliveryStatus.", effects: ["state-change", "email"], target: "invitationId", dates: [], input: { type: "object", properties: { organizationId: { type: "string", minLength: 1 }, invitationId: { type: "string", minLength: 1 } }, required: ["organizationId", "invitationId"] } },
10488
- { path: ["organization", "update"], procedure: "organization.updateOrganizationById", operation: "mutation", summary: "Update organization details. name is required; omitted optional fields are unchanged.", effects: ["state-change"], target: "organizationId", dates: [], input: { type: "object", properties: { organizationId: { type: "string", minLength: 1 }, name: { type: "string", minLength: 1 }, slug: { type: "string" }, description: { type: "string" }, website: { anyOf: [{ type: "string", format: "uri" }, { type: "string", const: "" }] }, email: { anyOf: [{ type: "string", format: "email", pattern: "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$" }, { type: "string", const: "" }] }, allowedEventTypes: { type: "array", items: { type: "string", enum: ["POST_IT_NOTE", "PHOTO_WALL", "STORY_COLLECTION", "LUCKY_DRAW", "SCAVENGER_HUNT", "HUMAN_BINGO", "SIGNATURE_WALL", "GARDENS_BY_THE_BAY", "RATING_SYSTEM", "EVENT_PASSPORT", "ST\
10489
- AFF_REDEMPTION"] } }, image: { type: ["string", "null"] } }, required: ["organizationId", "name"] } },
10490
- { path: ["organization", "image", "update"], procedure: "organization.updateOrganizationImageById", operation: "mutation", summary: "Set the organization image to an uploaded key (see et upload, folder organization-images).", effects: ["state-change"], target: "organizationId", dates: [], input: { type: "object", properties: { organizationId: { type: "string" }, image: { type: ["string", "null"] } }, required: ["organizationId", "image"] } },
10314
+ { path: ["organization", "update"], procedure: "organization.updateOrganizationById", operation: "mutation", summary: "Update organization details. name is required; omitted optional fields are unchanged.", effects: ["state-change"], target: "organizationId", dates: [], input: { type: "object", properties: { organizationId: {
10315
+ type: "string",
10316
+ minLength: 1
10317
+ }, name: { type: "string", minLength: 1 }, slug: { type: "string" }, description: { type: "string" }, website: { anyOf: [{ type: "string", format: "uri" }, { type: "string", const: "" }] }, email: { anyOf: [{ type: "string", format: "email", pattern: "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$" }, { type: "string", const: "" }] }, allowedEventTypes: { type: "array", items: { type: "string", enum: ["POST_IT_NOTE", "PHOTO_WALL", "STORY_COLLECTION", "LUCKY_DRAW", "SCAVENGER_HUNT", "HUMAN_BINGO", "SIGNATURE_WALL", "GARDENS_BY_THE_BAY", "RATING_SYSTEM", "EVENT_PASSPORT", "STAFF_REDEMPTION"] } }, image: { type: ["string", "null"] } }, required: ["organizationId", "name"] } },
10318
+ { path: ["organization", "image", "update"], procedure: "organization.updateOrganizationImageById", operation: "mutation", summary: "Set the organization image to an uploaded key (see et upload, folder organization-images).", effects: ["state-change"], target: "organizationId", dates: [], input: { type: "object", properties: { organizationId: {
10319
+ type: "string"
10320
+ }, image: { type: ["string", "null"] } }, required: ["organizationId", "image"] } },
10491
10321
  { path: ["organization", "archive"], procedure: "organization.archiveOrganization", operation: "mutation", summary: "Archive an organization as its owner.", effects: ["state-change"], target: "organizationId", dates: [], input: { type: "object", properties: { organizationId: { type: "string" } }, required: ["organizationId"] } },
10492
10322
  { path: ["organization", "access", "check"], procedure: "organization.checkOrganizationAccess", operation: "query", summary: "Check the current user's access to an organization.", effects: [], dates: [], input: { type: "object", properties: { organizationId: { type: "string" } }, required: ["organizationId"] } },
10493
10323
  { path: ["organization", "dashboard"], procedure: "organization.getOrganizationDashboardStats", operation: "query", summary: "Get an organization's dashboard totals.", effects: [], dates: [], input: { type: "object", properties: { organizationId: { type: "string" } }, required: ["organizationId"] } },
10494
10324
  { path: ["organization", "analytics"], procedure: "organization.getOrganizationEventAnalytics", operation: "query", summary: "Get per-event analytics for an organization.", effects: [], dates: [], input: { type: "object", properties: { organizationId: { type: "string" } }, required: ["organizationId"] } },
10495
10325
  { path: ["organization", "event-types"], procedure: "organization.getAllowedEventTypeByOrganizationId", operation: "query", summary: "List the event types an organization may create.", effects: [], dates: [], input: { type: "object", properties: { organizationId: { type: "string" } }, required: ["organizationId"] } },
10496
10326
  { path: ["organization", "onboarding"], procedure: "organization.getOnboardingState", operation: "query", summary: "Get the current user's onboarding state.", effects: [], dates: [], input: null },
10497
- { path: ["admin", "organization", "list"], procedure: "admin.organization.getOrganizations", operation: "query", summary: "List every organization (paged, searchable) as a global admin.", effects: [], dates: [], input: { type: "object", properties: { archiveStatus: { default: "active", type: "string", enum: ["active", "archived", "all"] }, page: { default: 1, type: "number", minimum: 1 }, perPage: { default: 6, type: "number", minimum: 1, maximum: 100 }, search: { default: "", type: "string" } } } },
10327
+ { path: ["admin", "organization", "list"], procedure: "admin.organization.getOrganizations", operation: "query", summary: "List every organization (paged, searchable) as a global admin.", effects: [], dates: [], input: { type: "object", properties: {
10328
+ archiveStatus: { default: "active", type: "string", enum: ["active", "archived", "all"] },
10329
+ page: { default: 1, type: "number", minimum: 1 },
10330
+ perPage: { default: 6, type: "number", minimum: 1, maximum: 100 },
10331
+ search: { default: "", type: "string" }
10332
+ } } },
10498
10333
  { path: ["admin", "organization", "get"], procedure: "admin.organization.getOrganization", operation: "query", summary: "Get any organization by ID as a global admin.", effects: [], dates: [], input: { type: "object", properties: { id: { type: "string" } }, required: ["id"] } },
10499
10334
  { path: ["admin", "organization", "members"], procedure: "admin.organization.getOrganizationMembers", operation: "query", 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).", effects: [], dates: [], input: { type: "object", properties: { organizationId: { type: "string" }, search: { default: "", type: "string" }, role: { default: "ALL", type: "string", enum: ["ALL", "ADMIN", "MEMBER"] }, status: { default: "ALL", type: "string", enum: ["ALL", "PENDING", "ACTIVE", "LEFT", "REMOVED", "REJECTED"] } }, required: ["organizationId"] } },
10500
10335
  { path: ["admin", "organization", "stats"], procedure: "organization.getOrganizationStats", operation: "query", summary: "Get platform-wide organization totals as a global admin.", effects: [], dates: [], input: null },
@@ -10502,106 +10337,133 @@ AFF_REDEMPTION"] } }, image: { type: ["string", "null"] } }, required: ["organiz
10502
10337
  { path: ["admin", "organization", "restore"], procedure: "admin.organization.restoreOrganization", operation: "mutation", summary: "Restore an archived organization as a global admin.", effects: ["state-change"], target: "id", dates: [], input: { type: "object", properties: { id: { type: "string" } }, required: ["id"] } },
10503
10338
  { path: ["admin", "event", "list"], procedure: "admin.event.getEvents", operation: "query", summary: "List an organization's events as a global admin.", effects: [], dates: [], input: { type: "object", properties: { organizationId: { type: "string" }, archiveStatus: { default: "active", type: "string", enum: ["active", "archived", "all"] }, limit: { default: 50, type: "number", minimum: 1, maximum: 100 }, offset: { default: 0, type: "number", minimum: 0 } }, required: ["organizationId"] } },
10504
10339
  { path: ["admin", "event", "get"], procedure: "admin.event.getEvent", operation: "query", summary: "Get any event by ID as a global admin.", effects: [], dates: [], input: { type: "object", properties: { id: { type: "string" } }, required: ["id"] } },
10505
- { path: ["admin", "member", "list"], procedure: "admin.member.getAllMembers", operation: "query", summary: "List organization members across every organization (paged; filter by search, organizationId, role, status, joinedFrom/joinedTo).", effects: [], dates: ["joinedFrom", "joinedTo"], input: { type: "object", properties: { search: { type: "string", maxLength: 200 }, organizationId: { type: "string", minLength: 1 }, role: { type: "string", enum: ["OWNER", "ADMIN", "MEMBER"] }, status: { type: "string", enum: ["PENDING", "ACTIVE", "LEFT", "REMOVED", "REJECTED"] }, joinedFrom: { type: "string", format: "date-time" }, joinedTo: { type: "string", format: "date-time" }, limit: { default: 25, type: "integer", minimum: 1, maximum: 100 }, cursor: { anyOf: [{ type: "string", minLength: 1, maxLength: 2048 }, { type: "null" }] }, direction: { type: "string", const: "forward" } }, additionalProperties: !1 } },
10340
+ { path: ["admin", "member", "list"], procedure: "admin.member.getAllMembers", operation: "query", summary: "List organization members across every organization (paged; filter by search, organizationId, role, status, joinedFrom/joinedTo).", effects: [], dates: ["joinedFrom", "joinedTo"], input: { type: "object", properties: { search: { type: "string", maxLength: 200 }, organizationId: { type: "string", minLength: 1 }, role: { type: "string", enum: ["OWNER", "ADMIN", "MEMBER"] }, status: { type: "string", enum: ["PENDING", "ACTIVE", "LEFT", "REMOVED", "REJECTED"] }, joinedFrom: { type: "string", format: "date-time" }, joinedTo: {
10341
+ type: "string",
10342
+ format: "date-time"
10343
+ }, limit: { default: 25, type: "integer", minimum: 1, maximum: 100 }, cursor: { anyOf: [{ type: "string", minLength: 1, maxLength: 2048 }, { type: "null" }] }, direction: { type: "string", const: "forward" } }, additionalProperties: !1 } },
10506
10344
  { path: ["admin", "member", "count"], procedure: "admin.member.getMemberCounts", operation: "query", summary: "Count members matching the list filters, with role and status splits.", effects: [], dates: ["joinedFrom", "joinedTo"], input: { type: "object", properties: { search: { type: "string", maxLength: 200 }, organizationId: { type: "string", minLength: 1 }, role: { type: "string", enum: ["OWNER", "ADMIN", "MEMBER"] }, status: { type: "string", enum: ["PENDING", "ACTIVE", "LEFT", "REMOVED", "REJECTED"] }, joinedFrom: { type: "string", format: "date-time" }, joinedTo: { type: "string", format: "date-time" } }, additionalProperties: !1 } },
10507
10345
  { path: ["admin", "member", "export"], procedure: "admin.member.exportMembers", operation: "query", summary: "Export every member matching the list filters (fails above 5,000 rows).", effects: [], dates: ["joinedFrom", "joinedTo"], input: { type: "object", properties: { search: { type: "string", maxLength: 200 }, organizationId: { type: "string", minLength: 1 }, role: { type: "string", enum: ["OWNER", "ADMIN", "MEMBER"] }, status: { type: "string", enum: ["PENDING", "ACTIVE", "LEFT", "REMOVED", "REJECTED"] }, joinedFrom: { type: "string", format: "date-time" }, joinedTo: { type: "string", format: "date-time" } }, additionalProperties: !1 } },
10508
10346
  { path: ["admin", "member", "role-update"], procedure: "admin.member.updateMemberRole", operation: "mutation", summary: "Change any organization member's role as a global admin.", effects: ["state-change"], target: "memberId", dates: [], input: { type: "object", properties: { organizationId: { type: "string", minLength: 1 }, memberId: { type: "string", minLength: 1 }, newRole: { type: "string", enum: ["OWNER", "ADMIN", "MEMBER"] } }, required: ["organizationId", "memberId", "newRole"] } },
10509
10347
  { path: ["admin", "member", "remove"], procedure: "admin.member.removeMember", operation: "mutation", summary: "Remove a member from an organization and delete their allowed-email entries.", effects: ["state-change", "delete"], target: "memberId", dates: [], input: { type: "object", properties: { organizationId: { type: "string", minLength: 1 }, memberId: { type: "string", minLength: 1 } }, required: ["organizationId", "memberId"] } },
10510
10348
  { path: ["admin", "activity", "list"], procedure: "admin.activity.getAll", operation: "query", summary: "List organization and member activity-log events (paged; filter by search, organizationId, eventType, from/to).", effects: [], dates: ["from", "to"], input: { type: "object", properties: { search: { type: "string", maxLength: 200 }, organizationId: { type: "string", minLength: 1 }, eventType: { type: "string", enum: ["organization_provisioned", "organization_updated", "organization_archived", "organization_restored", "member_invited", "member_joined", "member_role_changed", "member_invitation_rejected", "member_left", "member_removed", "ownership_transferred"] }, from: { type: "string", format: "date-time" }, to: { type: "string", format: "date-time" }, limit: { default: 25, type: "integer", minimum: 1, maximum: 100 }, cursor: { anyOf: [{ type: "string", minLength: 1, maxLength: 2048 }, { type: "null" }] }, direction: { type: "string", const: "forward" } }, additionalProperties: !1 } },
10511
10349
  { path: ["admin", "activity", "count"], procedure: "admin.activity.getCounts", operation: "query", summary: "Count activity matching the filters, with 30-day daily and type splits.", effects: [], dates: ["from", "to"], input: { type: "object", properties: { search: { type: "string", maxLength: 200 }, organizationId: { type: "string", minLength: 1 }, eventType: { type: "string", enum: ["organization_provisioned", "organization_updated", "organization_archived", "organization_restored", "member_invited", "member_joined", "member_role_changed", "member_invitation_rejected", "member_left", "member_removed", "ownership_transferred"] }, from: { type: "string", format: "date-time" }, to: { type: "string", format: "date-time" } }, additionalProperties: !1 } },
10512
- { path: ["admin", "activity", "export"], procedure: "admin.activity.export", operation: "query", summary: "Export every activity event matching the filters (fails above 5,000 rows).", effects: [], dates: ["from", "to"], input: { type: "object", properties: { search: { type: "string", maxLength: 200 }, organizationId: { type: "string", minLength: 1 }, eventType: { type: "string", enum: ["organization_provisioned", "organization_updated", "organization_archived", "organization_restored", "member_invited", "member_joined", "member_role_changed", "member_invitation_rejected", "member_left", "member_removed", "ownership_transferred"] }, from: { type: "string", format: "date-time" }, to: { type: "string", format: "date-time" } }, additionalProperties: !1 } },
10350
+ { path: ["admin", "activity", "export"], procedure: "admin.activity.export", operation: "query", summary: "Export every activity event matching the filters (fails above 5,000 rows).", effects: [], dates: [
10351
+ "from",
10352
+ "to"
10353
+ ], input: { type: "object", properties: { search: { type: "string", maxLength: 200 }, organizationId: { type: "string", minLength: 1 }, eventType: { type: "string", enum: ["organization_provisioned", "organization_updated", "organization_archived", "organization_restored", "member_invited", "member_joined", "member_role_changed", "member_invitation_rejected", "member_left", "member_removed", "ownership_transferred"] }, from: { type: "string", format: "date-time" }, to: { type: "string", format: "date-time" } }, additionalProperties: !1 } },
10513
10354
  { path: ["admin", "dashboard", "event-analytics"], procedure: "admin.dashboard.getEventAnalytics", operation: "query", summary: "Get platform event analytics as a global admin.", effects: [], dates: [], input: null },
10514
- { path: ["admin", "user", "list"], procedure: "admin.user.getUsers", operation: "query", summary: "List users A to Z by name (paged; filter by search).", effects: [], dates: [], input: { type: "object", properties: { search: { type: "string", maxLength: 200 }, limit: { default: 25, type: "integer", minimum: 1, maximum: 100 }, cursor: { anyOf: [{ type: "string", minLength: 1, maxLength: 2048 }, { type: "null" }] }, direction: { type: "string", const: "forward" } }, additionalProperties: !1 } },
10355
+ { path: ["admin", "user", "list"], procedure: "admin.user.getUsers", operation: "query", summary: "List users A to Z by name (paged; filter by search).", effects: [], dates: [], input: { type: "object", properties: { search: { type: "string", maxLength: 200 }, limit: { default: 25, type: "integer", minimum: 1, maximum: 100 }, cursor: { anyOf: [
10356
+ { type: "string", minLength: 1, maxLength: 2048 },
10357
+ { type: "null" }
10358
+ ] }, direction: { type: "string", const: "forward" } }, additionalProperties: !1 } },
10515
10359
  { path: ["admin", "user", "get"], procedure: "admin.user.getUserById", operation: "query", summary: "Get one user as a global admin.", effects: [], dates: [], input: { type: "object", properties: { userId: { type: "string", minLength: 1 } }, required: ["userId"] } },
10516
10360
  { path: ["admin", "user", "role-update"], procedure: "admin.user.updateSystemRole", operation: "mutation", summary: "Change a user's system role (ADMIN, USER, GUEST).", effects: ["state-change"], target: "userId", dates: [], input: { type: "object", properties: { role: { type: "string", enum: ["ADMIN", "USER", "GUEST"] }, userId: { type: "string", minLength: 1 } }, required: ["role", "userId"] } },
10517
- {
10518
- path: ["event", "access", "mine"],
10519
- procedure: "access.getMyEventAccess",
10520
- operation: "query",
10521
- summary: "Show the current user's role and permissions for an event.",
10522
- effects: [],
10523
- dates: [],
10524
- input: { type: "object", properties: { eventId: { type: "string", minLength: 1 }, organizationId: { type: "string", minLength: 1 }, allowArchived: { type: "boolean" } }, required: ["eventId", "organizationId"] }
10525
- },
10361
+ { path: ["event", "access", "mine"], procedure: "access.getMyEventAccess", operation: "query", summary: "Show the current user's role and permissions for an event.", effects: [], dates: [], input: { type: "object", properties: {
10362
+ eventId: { type: "string", minLength: 1 },
10363
+ organizationId: { type: "string", minLength: 1 },
10364
+ allowArchived: { type: "boolean" }
10365
+ }, required: ["eventId", "organizationId"] } },
10526
10366
  { path: ["event", "access", "my-assignments"], procedure: "access.listMyEventAssignments", operation: "query", summary: "List the current user's own event staff assignments in an organization (optionally one eventId), each with status ACTIVE, SCHEDULED, ENDED or REVOKED.", effects: [], dates: [], input: { type: "object", properties: { eventId: { type: "string", minLength: 1 }, organizationId: { type: "string", minLength: 1 } }, required: ["organizationId"] } },
10527
- { path: ["event", "access", "list"], procedure: "access.listEventAssignments", operation: "query", summary: "List event staff assignments and pending staff invitations (expired links included until resent or revoked), with each invitation's stored emailDeliveryStatus.", effects: [], dates: [], input: {
10528
- type: "object",
10529
- properties: { eventId: { type: "string", minLength: 1 }, organizationId: { type: "string", minLength: 1 } },
10530
- required: ["eventId", "organizationId"]
10531
- } },
10532
- { path: ["event", "access", "invite"], procedure: "access.inviteEventStaff", operation: "mutation", summary: "Invite event staff by email; roles include HELPDESK for Event Passport roster lookup and new entries only. Reports deliveryStatus and the stored emailDeliveryStatus. startsAt/expiresAt are ISO date-times or null; set expiresAt for temporary access.", effects: ["state-change", "email"], target: "email", dates: ["expiresAt", "startsAt"], input: { type: "object", properties: { eventId: { type: "string", minLength: 1 }, organizationId: { type: "string", minLength: 1 }, canExport: { default: !1, type: "boolean" }, email: { type: "string" }, expiresAt: { anyOf: [{ type: "string", format: "date-time" }, { type: "null" }] }, role: { type: "string", enum: ["MANAGER", "OPERATOR", "VIEWER", "HELPDESK"] }, startsAt: { anyOf: [{ type: "string", format: "date-time" }, { type: "null" }] } }, required: ["eventId", "organizationId", "email", "role"] } },
10533
- { path: [
10534
- "event",
10535
- "access",
10536
- "invitation-resend"
10537
- ], procedure: "access.resendEventStaffInvitation", operation: "mutation", summary: "Replace a pending event staff invitation (including an expired one) and email a fresh link; reports deliveryStatus and the stored emailDeliveryStatus.", effects: ["state-change", "email"], target: "invitationId", dates: [], input: { type: "object", properties: { eventId: { type: "string", minLength: 1 }, organizationId: { type: "string", minLength: 1 }, invitationId: { type: "string", minLength: 1 } }, required: ["eventId", "organizationId", "invitationId"] } },
10538
- { path: ["event", "access", "invitation-revoke"], procedure: "access.revokeEventStaffInvitation", operation: "mutation", summary: "Revoke a pending event staff invitation.", effects: ["state-change"], target: "invitationId", dates: [], input: { type: "object", properties: { eventId: { type: "string", minLength: 1 }, organizationId: { type: "string", minLength: 1 }, invitationId: { type: "string", minLength: 1 } }, required: ["eventId", "organizationId", "invitationId"] } },
10367
+ { path: ["event", "access", "list"], procedure: "access.listEventAssignments", operation: "query", summary: "List event staff assignments and pending staff invitations (expired links included until resent or revoked), with each invitation's stored emailDeliveryStatus.", effects: [], dates: [], input: { type: "object", properties: { eventId: { type: "string", minLength: 1 }, organizationId: { type: "string", minLength: 1 } }, required: ["eventId", "organizationId"] } },
10539
10368
  {
10540
- path: ["event", "access", "assign"],
10541
- procedure: "access.upsertEventAssignment",
10369
+ path: ["event", "access", "invite"],
10370
+ procedure: "access.inviteEventStaff",
10542
10371
  operation: "mutation",
10543
- summary: "Create or update an existing user's event staff assignment. HELPDESK can look up the Event Passport roster and add new entries only; set expiresAt for temporary access.",
10544
- effects: ["state-change"],
10545
- target: "userId",
10372
+ summary: "Invite event staff by email; roles include HELPDESK for Event Passport roster lookup and new entries only. Reports deliveryStatus and the stored emailDeliveryStatus. startsAt/expiresAt are ISO date-times or null; set expiresAt for temporary access.",
10373
+ effects: ["state-change", "email"],
10374
+ target: "email",
10546
10375
  dates: ["expiresAt", "startsAt"],
10547
- input: { type: "object", properties: { eventId: { type: "string", minLength: 1 }, organizationId: { type: "string", minLength: 1 }, canExport: { default: !1, type: "boolean" }, expiresAt: { anyOf: [{ type: "string", format: "date-time" }, { type: "null" }] }, role: { type: "string", enum: ["MANAGER", "OPERATOR", "VIEWER", "HELPDESK"] }, startsAt: { anyOf: [{ type: "string", format: "date-time" }, { type: "null" }] }, userId: { type: "string", minLength: 1 } }, required: ["eventId", "organizationId", "role", "userId"] }
10376
+ input: { type: "object", properties: { eventId: { type: "string", minLength: 1 }, organizationId: { type: "string", minLength: 1 }, canExport: { default: !1, type: "boolean" }, email: { type: "string" }, expiresAt: { anyOf: [{ type: "string", format: "date-time" }, { type: "null" }] }, role: { type: "string", enum: ["MANAGER", "OPERATOR", "VIEWER", "HELPDESK"] }, startsAt: { anyOf: [{ type: "string", format: "date-time" }, { type: "null" }] } }, required: ["eventId", "organizationId", "email", "role"] }
10548
10377
  },
10378
+ { path: ["event", "access", "invitation-resend"], procedure: "access.resendEventStaffInvitation", operation: "mutation", summary: "Replace a pending event staff invitation (including an expired one) and email a fresh link; reports deliveryStatus and the stored emailDeliveryStatus.", effects: ["state-change", "email"], target: "invitationId", dates: [], input: { type: "object", properties: { eventId: { type: "string", minLength: 1 }, organizationId: { type: "string", minLength: 1 }, invitationId: { type: "string", minLength: 1 } }, required: ["eventId", "organizationId", "invitationId"] } },
10379
+ { path: ["event", "access", "invitation-revoke"], procedure: "access.revokeEventStaffInvitation", operation: "mutation", summary: "Revoke a pending event staff invitation.", effects: ["state-change"], target: "invitationId", dates: [], input: { type: "object", properties: { eventId: { type: "string", minLength: 1 }, organizationId: { type: "string", minLength: 1 }, invitationId: { type: "string", minLength: 1 } }, required: ["eventId", "organizationId", "invitationId"] } },
10380
+ { path: ["event", "access", "assign"], procedure: "access.upsertEventAssignment", operation: "mutation", summary: "Create or update an existing user's event staff assignment. HELPDESK can look up the Event Passport roster and add new entries only; set expiresAt for temporary access.", effects: ["state-change"], target: "userId", dates: ["expiresAt", "startsAt"], input: { type: "object", properties: { eventId: { type: "string", minLength: 1 }, organizationId: { type: "string", minLength: 1 }, canExport: { default: !1, type: "boolean" }, expiresAt: { anyOf: [{ type: "string", format: "date-time" }, { type: "null" }] }, role: { type: "string", enum: ["MANAGER", "OPERATOR", "VIEWER", "HELPDESK"] }, startsAt: { anyOf: [{ type: "string", format: "date-time" }, { type: "null" }] }, userId: { type: "string", minLength: 1 } }, required: ["eventId", "organizationId", "role", "userId"] } },
10549
10381
  { path: ["event", "access", "revoke"], procedure: "access.revokeEventAssignment", operation: "mutation", summary: "Revoke a user's event staff assignment.", effects: ["state-change"], target: "userId", dates: [], input: { type: "object", properties: { eventId: { type: "string", minLength: 1 }, organizationId: { type: "string", minLength: 1 }, userId: { type: "string", minLength: 1 } }, required: ["eventId", "organizationId", "userId"] } },
10550
10382
  { path: ["activity", "list"], procedure: "activity.getByResource", operation: "query", summary: "List the activity log for an organization, event or other resource (cursor paged).", effects: [], dates: ["startAt", "endAt"], input: { type: "object", properties: { organizationId: { type: "string" }, resourceType: { type: "string", minLength: 1 }, resourceId: { type: "string", minLength: 1 }, eventId: { type: "string" }, includeEventChildren: { default: !1, type: "boolean" }, eventCategory: { type: "string", enum: ["ORGANIZATION", "MEMBER", "EVENT", "CONFIG", "SUBMISSION", "PARTICIPANT", "EXPORT", "SYSTEM"] }, actorUserId: { type: "string" }, startAt: { type: "string", format: "date-time" }, endAt: { type: "string", format: "date-time" }, cursor: { type: "string" }, limit: { default: 25, type: "number", minimum: 1, maximum: 50 } }, required: ["organizationId", "resourceType", "resourceId"] } },
10551
10383
  { path: ["event", "recent"], procedure: "event.getRecentEvents", operation: "query", summary: "List the events the current user opened most recently.", effects: [], dates: [], input: null },
10552
- { path: ["event", "details"], procedure: "event.getEventById", operation: "query", summary: "Get an event's full details (description, tags, background, dates).", effects: [], dates: [], input: { type: "object", properties: { eventId: { type: "string", minLength: 1 } }, required: ["eventId"] } },
10553
- { path: ["event", "update"], procedure: "event.updateEvent", operation: "mutation", summary: "Replace an event's details. Send every field from event details; dates are ISO.", effects: ["state-change"], target: "id", dates: ["eventDateRange.from", "eventDateRange.to"], input: { type: "object", properties: { organizationId: { type: "string", minLength: 1 }, name: { type: "string", minLength: 1, maxLength: 100 }, type: { type: "string", enum: ["POST_IT_NOTE", "PHOTO_WALL", "STORY_COLLECTION", "LUCKY_DRAW", "SCAVENGER_HUNT", "HUMAN_BINGO", "SIGNATURE_WALL", "GARDENS_BY_THE_BAY", "RATING_SYSTEM", "EVENT_PASSPORT", "STAFF_REDEMPTION"] }, descriptionDelta: {}, descriptionRichText: {
10554
- anyOf: [{}, { type: "null" }]
10555
- }, filtering: { type: "boolean" }, location: { type: "string", minLength: 1 }, eventDateRange: { type: "object", properties: { from: { type: "string", format: "date-time" }, to: { type: "string", format: "date-time" } }, required: ["from"] }, tags: { type: "array", items: { type: "string" } }, backgroundImageKey: { type: ["string", "null"] }, id: { type: "string", minLength: 1 } }, required: ["organizationId", "name", "type", "location", "eventDateRange", "id"] } },
10384
+ {
10385
+ path: ["event", "details"],
10386
+ procedure: "event.getEventById",
10387
+ operation: "query",
10388
+ summary: "Get an event's full details (description, tags, background, dates).",
10389
+ effects: [],
10390
+ dates: [],
10391
+ input: { type: "object", properties: { eventId: { type: "string", minLength: 1 } }, required: ["eventId"] }
10392
+ },
10393
+ { path: ["event", "update"], procedure: "event.updateEvent", operation: "mutation", summary: "Replace an event's details. Send every field from event details; dates are ISO.", effects: ["state-change"], target: "id", dates: ["eventDateRange.from", "eventDateRange.to"], input: { type: "object", properties: { organizationId: { type: "string", minLength: 1 }, name: { type: "string", minLength: 1, maxLength: 100 }, type: { type: "string", enum: ["POST_IT_NOTE", "PHOTO_WALL", "STORY_COLLECTION", "LUCKY_DRAW", "SCAVENGER_HUNT", "HUMAN_BINGO", "SIGNATURE_WALL", "GARDENS_BY_THE_BAY", "RATING_SYSTEM", "EVENT_PASSPORT", "STAFF_REDEMPTION"] }, descriptionDelta: {}, descriptionRichText: { anyOf: [{}, { type: "null" }] }, filtering: { type: "boolean" }, location: { type: "string", minLength: 1 }, eventDateRange: { type: "object", properties: { from: { type: "string", format: "date-time" }, to: { type: "string", format: "date-time" } }, required: ["from"] }, tags: { type: "array", items: { type: "\
10394
+ string" } }, backgroundImageKey: { type: ["string", "null"] }, id: { type: "string", minLength: 1 } }, required: ["organizationId", "name", "type", "location", "eventDateRange", "id"] } },
10556
10395
  { path: ["event", "status-update"], procedure: "event.updateEventStatus", operation: "mutation", summary: "Set an event's status (DRAFT, ONGOING, COMPLETED).", effects: ["state-change"], target: "eventId", dates: [], input: { type: "object", properties: { eventId: { type: "string" }, organizationId: { type: "string" }, status: { type: "string", enum: ["DRAFT", "ONGOING", "COMPLETED"] } }, required: ["eventId", "organizationId", "status"] } },
10557
- { path: ["event", "archive"], procedure: "event.archiveEvent", operation: "mutation", summary: "Archive an event.", effects: ["state-change"], target: "eventId", dates: [], input: {
10558
- type: "object",
10559
- properties: { eventId: { type: "string", minLength: 1 }, organizationId: { type: "string", minLength: 1 } },
10560
- required: ["eventId", "organizationId"]
10561
- } },
10396
+ { path: ["event", "archive"], procedure: "event.archiveEvent", operation: "mutation", summary: "Archive an event.", effects: ["state-change"], target: "eventId", dates: [], input: { type: "object", properties: { eventId: { type: "string", minLength: 1 }, organizationId: { type: "string", minLength: 1 } }, required: ["eventId", "organizationId"] } },
10562
10397
  { path: ["event", "restore"], procedure: "event.restoreEvent", operation: "mutation", summary: "Restore an archived event.", effects: ["state-change"], target: "eventId", dates: [], input: { type: "object", properties: { eventId: { type: "string", minLength: 1 }, organizationId: { type: "string", minLength: 1 } }, required: ["eventId", "organizationId"] } },
10563
10398
  { path: ["event", "duplicate"], procedure: "event.duplicateEvent", operation: "mutation", summary: "Duplicate an event and its setup into a new draft.", effects: ["state-change"], target: "eventId", dates: [], input: { type: "object", properties: { eventId: { type: "string" } }, required: ["eventId"] } },
10564
10399
  { path: ["event", "export"], procedure: "event.getEventDataToExport", operation: "query", summary: "Export an event's submissions and results.", effects: [], dates: [], input: { type: "object", properties: { eventId: { type: "string" } }, required: ["eventId"] } },
10565
10400
  { path: ["event", "retired", "export"], procedure: "event.getRetiredEventExport", operation: "query", summary: "Export a retired Scavenger Hunt or Gardens by the Bay event (read-only): full setup and results with stable IDs, archived rows marked by archivedAt, and 1-hour signed media links. These types cannot be created or edited.", effects: [], dates: [], input: { type: "object", properties: { eventId: { type: "string" } }, required: ["eventId"] } },
10566
10401
  { path: ["event", "background", "get"], procedure: "event.getEventBackgroundImage", operation: "query", summary: "Get an event's background image URL.", effects: [], dates: [], input: { type: "object", properties: { eventId: { type: "string" } }, required: ["eventId"] } },
10567
10402
  { path: ["event", "story", "list"], procedure: "event.getStoryItemsByEventId", operation: "query", summary: "List Story Collection submissions (paged).", effects: [], dates: [], input: { type: "object", properties: { eventId: { type: "string" }, email: { type: "string" }, page: { default: 1, type: "number", minimum: 1 }, perPage: { default: 5, type: "number", minimum: 1, maximum: 100 } }, required: ["eventId"] } },
10568
- { path: [
10569
- "event",
10570
- "story",
10571
- "archive"
10572
- ], procedure: "event.archiveStoryItems", operation: "mutation", summary: "Archive Story Collection submissions by ID. --target is the comma-joined ids.", effects: ["state-change"], target: "ids", dates: [], input: { type: "object", properties: { eventId: { type: "string" }, ids: { type: "array", items: { type: "string" } } }, required: ["eventId", "ids"] } },
10403
+ { path: ["event", "story", "archive"], procedure: "event.archiveStoryItems", operation: "mutation", summary: "Archive Story Collection submissions by ID. --target is the comma-joined ids.", effects: [
10404
+ "state-change"
10405
+ ], target: "ids", dates: [], input: { type: "object", properties: { eventId: { type: "string" }, ids: { type: "array", items: { type: "string" } } }, required: ["eventId", "ids"] } },
10573
10406
  { path: ["lucky-draw", "passport-sync"], procedure: "event.luckyDraw.getPassportDrawSyncStatus", operation: "query", summary: "Show whether a Passport-linked draw roster is in sync.", effects: [], dates: [], input: { type: "object", properties: { eventId: { type: "string", minLength: 1 } }, required: ["eventId"] } },
10574
10407
  { path: ["lucky-draw", "participants", "eligible"], procedure: "event.luckyDraw.getFilteredLuckyDrawParticipantsByEventId", operation: "query", summary: "List participants still eligible after domain/email filters and winners.", effects: [], dates: [], input: { type: "object", properties: { eventId: { type: "string" } }, required: ["eventId"] } },
10575
10408
  { path: ["lucky-draw", "wheel", "participants"], procedure: "event.luckyDraw.getLuckyDrawWheelParticipantsByEventId", operation: "query", summary: "List the participants currently shown on the draw board.", effects: [], dates: [], input: { type: "object", properties: { eventId: { type: "string" } }, required: ["eventId"] } },
10576
10409
  { path: ["lucky-draw", "boards", "list"], procedure: "event.luckyDraw.getLuckyDrawItemsByEventId", operation: "query", summary: "List an event's lucky draw boards (paged).", effects: [], dates: [], input: { type: "object", properties: { eventId: { type: "string" }, name: { type: "string" }, note: { type: "string" }, page: { default: 1, type: "number", minimum: 1 }, perPage: { default: 10, type: "number", minimum: 1, maximum: 100 } }, required: ["eventId"] } },
10577
10410
  { path: ["lucky-draw", "winners", "list"], procedure: "event.luckyDraw.getLuckyDrawPrizesWinnerByEventId", operation: "query", summary: "List prizes with their winners.", effects: [], dates: [], input: { type: "object", properties: { eventId: { type: "string" } }, required: ["eventId"] } },
10578
- { path: ["lucky-draw", "winners", "accept"], procedure: "event.luckyDraw.acceptWinner", operation: "mutation", summary: "Assign a prize to a drawn participant.", effects: ["state-change"], target: "winnerLuckyDrawParticipantId", dates: [], input: { type: "object", properties: { winnerLuckyDrawParticipantId: { type: "string" }, winnerLuckyDrawPrizeId: { type: "string" } }, required: ["winnerLuckyDrawParticipantId", "winnerLuckyDrawPrizeId"] } },
10411
+ { path: ["lucky-draw", "winners", "accept"], procedure: "event.luckyDraw.acceptWinner", operation: "mutation", summary: "Assign a prize to a drawn participant.", effects: ["state-change"], target: "winnerLuckyDrawParticipantId", dates: [], input: { type: "object", properties: { winnerLuckyDrawParticipantId: {
10412
+ type: "string"
10413
+ }, winnerLuckyDrawPrizeId: { type: "string" } }, required: ["winnerLuckyDrawParticipantId", "winnerLuckyDrawPrizeId"] } },
10579
10414
  { path: ["lucky-draw", "winners", "remove"], procedure: "event.luckyDraw.removeLuckyDrawPrize", operation: "mutation", summary: "Take the prize back from a winning participant.", effects: ["state-change"], target: "participantId", dates: [], input: { type: "object", properties: { participantId: { type: "string" } }, required: ["participantId"] } },
10580
- { path: ["lucky-draw", "participants", "delete"], procedure: "event.luckyDraw.deleteLuckyDrawParticipant", operation: "mutation", summary: "Permanently delete participants by ID. --target is the comma-joined ids.", effects: ["state-change", "delete"], target: "ids", dates: [], input: { type: "object", properties: { eventId: { type: "string" }, ids: { type: "array", items: { type: "string" } } }, required: [
10581
- "eventId",
10582
- "ids"
10583
- ] } },
10584
- { path: ["passport", "lucky-draws"], procedure: "event.passport.getAvailableLuckyDraws", operation: "query", summary: "List lucky draw events a Passport can link to.", effects: [], dates: [], input: { type: "object", properties: { eventId: { type: "string", minLength: 1 } }, required: ["eventId"] } },
10415
+ { path: ["lucky-draw", "participants", "delete"], procedure: "event.luckyDraw.deleteLuckyDrawParticipant", operation: "mutation", summary: "Permanently delete participants by ID. --target is the comma-joined ids.", effects: ["state-change", "delete"], target: "ids", dates: [], input: { type: "object", properties: { eventId: { type: "string" }, ids: { type: "array", items: { type: "string" } } }, required: ["eventId", "ids"] } },
10416
+ {
10417
+ path: ["passport", "lucky-draws"],
10418
+ procedure: "event.passport.getAvailableLuckyDraws",
10419
+ operation: "query",
10420
+ summary: "List lucky draw events a Passport can link to.",
10421
+ effects: [],
10422
+ dates: [],
10423
+ input: { type: "object", properties: { eventId: { type: "string", minLength: 1 } }, required: ["eventId"] }
10424
+ },
10585
10425
  { path: ["passport", "operator-metadata"], procedure: "event.passport.getPassportOperatorMetadata", operation: "query", summary: "Get the staff operator view metadata (stations, prizes, permissions).", effects: [], dates: [], input: { type: "object", properties: { eventId: { type: "string", minLength: 1 } }, required: ["eventId"] } },
10586
10426
  { path: ["photo-wall", "items", "list"], procedure: "event.photoWall.getPhotoWallItemsByEventId", operation: "query", summary: "List Photo Wall photos (paged).", effects: [], dates: [], input: { type: "object", properties: { eventId: { type: "string" }, name: { type: "string" }, page: { default: 1, type: "number", minimum: 1 }, perPage: { default: 5, type: "number", minimum: 1, maximum: 100 } }, required: ["eventId"] } },
10587
- { path: ["photo-wall", "items", "archive"], procedure: "event.photoWall.archivePhotoWallItems", operation: "mutation", summary: "Archive Photo Wall photos by ID. --target is the comma-joined ids.", effects: ["state-change"], target: "ids", dates: [], input: { type: "object", properties: { eventId: { type: "string" }, ids: { type: "array", items: { type: "string" } } }, required: ["eventId", "ids"] } },
10427
+ {
10428
+ path: ["photo-wall", "items", "archive"],
10429
+ procedure: "event.photoWall.archivePhotoWallItems",
10430
+ operation: "mutation",
10431
+ summary: "Archive Photo Wall photos by ID. --target is the comma-joined ids.",
10432
+ effects: ["state-change"],
10433
+ target: "ids",
10434
+ dates: [],
10435
+ input: { type: "object", properties: { eventId: { type: "string" }, ids: { type: "array", items: { type: "string" } } }, required: ["eventId", "ids"] }
10436
+ },
10588
10437
  { path: ["photo-wall", "submissions", "list"], procedure: "event.photoWall.getPhotoWallSubmissionForApproval", operation: "query", summary: "List Photo Wall submissions for moderation (filter by state).", effects: [], dates: [], input: { type: "object", properties: { eventId: { type: "string" }, state: { default: "PENDING", type: "string", enum: ["PENDING", "APPROVED", "REJECTED"] }, page: { default: 1, type: "number", minimum: 1 }, perPage: { default: 6, type: "number", minimum: 1, maximum: 100 } }, required: ["eventId"] } },
10589
10438
  { path: ["photo-wall", "submissions", "respond"], procedure: "event.photoWall.respondToPhotoWallSubmission", operation: "mutation", summary: "Approve or reject a Photo Wall submission.", effects: ["state-change"], target: "id", dates: [], input: { type: "object", properties: { eventId: { type: "string" }, id: { type: "string" }, status: { type: "string", enum: ["PENDING", "APPROVED", "REJECTED"] } }, required: ["eventId", "id", "status"] } },
10590
- { path: ["photo-wall", "display-link"], procedure: "event.photoWall.getPhotoWallDisplayLink", operation: "mutation", summary: "Get the Photo Wall display link, creating its access code on first use.", effects: ["state-change"], target: "eventId", dates: [], input: { type: "object", properties: { eventId: { type: "string", minLength: 1, maxLength: 128, pattern: "^[a-zA-Z0-9_-]+$" } }, required: ["eventId"] } },
10439
+ { path: [
10440
+ "photo-wall",
10441
+ "display-link"
10442
+ ], procedure: "event.photoWall.getPhotoWallDisplayLink", operation: "mutation", summary: "Get the Photo Wall display link, creating its access code on first use.", effects: ["state-change"], target: "eventId", dates: [], input: { type: "object", properties: { eventId: { type: "string", minLength: 1, maxLength: 128, pattern: "^[a-zA-Z0-9_-]+$" } }, required: ["eventId"] } },
10591
10443
  { path: ["post-it", "notes", "list"], procedure: "event.postItNote.getPostItNotesByEventId", operation: "query", summary: "List approved Post-it Notes (paged).", effects: [], dates: [], input: { type: "object", properties: { eventId: { type: "string" }, name: { type: "string" }, note: { type: "string" }, page: { default: 1, type: "number", minimum: 1 }, perPage: { default: 10, type: "number", minimum: 1, maximum: 100 } }, required: ["eventId"] } },
10592
- { path: ["post-it", "notes", "list-all"], procedure: "event.postItNote.getAllPostItNotesByEventId", operation: "query", summary: "List every Post-it Note for an event.", effects: [], dates: [], input: { type: "object", properties: { eventId: { type: "string" } }, required: ["eventId"] } },
10444
+ { path: ["post-it", "notes", "list-all"], procedure: "event.postItNote.getAllPostItNotesByEventId", operation: "query", summary: "List every Post-it Note for an event.", effects: [], dates: [], input: { type: "object", properties: { eventId: { type: "string" } }, required: [
10445
+ "eventId"
10446
+ ] } },
10593
10447
  { path: ["post-it", "notes", "table"], procedure: "event.postItNote.getPostItNoteTable", operation: "query", summary: "List Post-it Notes in the admin table shape (paged).", effects: [], dates: [], input: { type: "object", properties: { eventId: { type: "string" }, name: { type: "string" }, note: { type: "string" }, page: { default: 1, type: "number", minimum: 1 }, perPage: { default: 10, type: "number", minimum: 1, maximum: 100 } }, required: ["eventId"] } },
10594
10448
  { path: ["post-it", "notes", "archive"], procedure: "event.postItNote.archivePostItNotes", operation: "mutation", summary: "Archive Post-it Notes by ID. --target is the comma-joined ids.", effects: ["state-change"], target: "ids", dates: [], input: { type: "object", properties: { eventId: { type: "string" }, ids: { type: "array", items: { type: "string" } } }, required: ["eventId", "ids"] } },
10595
- { path: [
10596
- "post-it",
10597
- "submissions",
10598
- "list"
10599
- ], procedure: "event.postItNote.getPostItNoteSubmissionForApproval", operation: "query", summary: "List Post-it Note submissions for moderation.", effects: [], dates: [], input: { type: "object", properties: { eventId: { type: "string" }, name: { type: "string" }, note: { type: "string" }, state: { type: "string", enum: ["PENDING", "APPROVED", "REJECTED"] }, page: { default: 1, type: "number", minimum: 1 }, perPage: { default: 6, type: "number", minimum: 1, maximum: 100 } }, required: ["eventId"] } },
10449
+ { path: ["post-it", "submissions", "list"], procedure: "event.postItNote.getPostItNoteSubmissionForApproval", operation: "query", summary: "List Post-it Note submissions for moderation.", effects: [], dates: [], input: { type: "object", properties: {
10450
+ eventId: { type: "string" },
10451
+ name: { type: "string" },
10452
+ note: { type: "string" },
10453
+ state: { type: "string", enum: ["PENDING", "APPROVED", "REJECTED"] },
10454
+ page: { default: 1, type: "number", minimum: 1 },
10455
+ perPage: { default: 6, type: "number", minimum: 1, maximum: 100 }
10456
+ }, required: ["eventId"] } },
10600
10457
  { path: ["post-it", "submissions", "respond"], procedure: "event.postItNote.respondToPostItNoteSubmission", operation: "mutation", summary: "Approve or reject a Post-it Note submission.", effects: ["state-change"], target: "id", dates: [], input: { type: "object", properties: { eventId: { type: "string" }, id: { type: "string" }, status: { type: "string", enum: ["PENDING", "APPROVED", "REJECTED"] } }, required: ["eventId", "id", "status"] } },
10601
10458
  { path: ["signature-wall", "config", "get"], procedure: "event.signatureWall.getSignatureWallByEventId", operation: "query", summary: "Get the Signature Wall config.", effects: [], dates: [], input: { type: "object", properties: { eventId: { type: "string" } }, required: ["eventId"] } },
10602
10459
  { path: ["signature-wall", "config", "update"], procedure: "event.signatureWall.updateSignatureWallConfigs", operation: "mutation", summary: "Replace the Signature Wall config.", effects: ["state-change"], target: "eventId", dates: [], input: { type: "object", properties: { eventId: { type: "string" }, config: { type: "object", properties: { backgroundColor: { type: "string" }, titleColor: { type: "string" }, titleFontSize: { type: "number" }, titleFont: { type: "string" }, title: { type: "string" }, cardBackgroundColor: { type: "string" }, cardBorderColor: { type: "string" }, nameColor: { type: "string" }, nameCardBackgroundColor: { type: "string" }, nameCardBorderColor: { type: "string" }, animationVideoKey: { type: ["string", "null"] }, signatureCounts: { type: "number" } }, required: ["backgroundColor", "titleColor", "titleFontSize", "titleFont", "title", "cardBackgroundColor", "cardBorderColor", "nameColor", "nameCardBackgroundColor", "nameCardBorderColor"] } }, required: ["even\
10603
10460
  tId", "config"] } },
10604
- { path: ["signature-wall", "signatures", "list"], procedure: "event.signatureWall.getSignatureTable", operation: "query", summary: "List signatures (paged).", effects: [], dates: [], input: { type: "object", properties: { eventId: { type: "string" }, name: { type: "string" }, page: { default: 1, type: "number", minimum: 1 }, perPage: { default: 10, type: "number", minimum: 1, maximum: 100 } }, required: ["eventId"] } },
10461
+ { path: ["signature-wall", "signatures", "list"], procedure: "event.signatureWall.getSignatureTable", operation: "query", summary: "List signatures (paged).", effects: [], dates: [], input: { type: "object", properties: {
10462
+ eventId: { type: "string" },
10463
+ name: { type: "string" },
10464
+ page: { default: 1, type: "number", minimum: 1 },
10465
+ perPage: { default: 10, type: "number", minimum: 1, maximum: 100 }
10466
+ }, required: ["eventId"] } },
10605
10467
  { path: ["signature-wall", "signatures", "strokes"], procedure: "event.signatureWall.getSignatureStrokes", operation: "query", summary: "Get one signature's pen strokes (list rows omit them).", effects: [], dates: [], input: { type: "object", properties: { eventId: { type: "string" }, signatureId: { type: "string" } }, required: ["eventId", "signatureId"] } },
10606
10468
  { path: ["signature-wall", "signatures", "archive"], procedure: "event.signatureWall.archiveSignatures", operation: "mutation", summary: "Archive signatures by ID. --target is the comma-joined ids.", effects: ["state-change"], target: "ids", dates: [], input: { type: "object", properties: { ids: { type: "array", items: { type: "string" } } }, required: ["ids"] } },
10607
10469
  { path: ["rating", "config", "get"], procedure: "event.ratingSystem.getRatingSystemByEventId", operation: "query", summary: "Get the Rating System config.", effects: [], dates: [], input: { type: "object", properties: { eventId: { type: "string" } }, required: ["eventId"] } },
@@ -10612,40 +10474,38 @@ tId", "config"] } },
10612
10474
  { path: ["rating", "subjects", "update"], procedure: "event.ratingSystem.updateRatingSubject", operation: "mutation", summary: "Update a rating subject.", effects: ["state-change"], target: "id", dates: [], input: { type: "object", properties: { id: { type: "string" }, name: { type: "string", minLength: 1 }, description: { type: ["string", "null"] }, order: { type: "integer", minimum: -9007199254740991, maximum: 9007199254740991 }, imageKey: { type: ["string", "null"] } }, required: ["id"] } },
10613
10475
  { path: ["rating", "subjects", "archive"], procedure: "event.ratingSystem.archiveRatingSubject", operation: "mutation", summary: "Archive a rating subject.", effects: ["state-change"], target: "id", dates: [], input: { type: "object", properties: { id: { type: "string" } }, required: ["id"] } },
10614
10476
  { path: ["human-bingo", "config", "get"], procedure: "event.humanBingo.getHumanBingoByEventId", operation: "query", summary: "Get the Human Bingo board and config.", effects: [], dates: [], input: { type: "object", properties: { eventId: { type: "string" } }, required: ["eventId"] } },
10615
- { path: ["human-bingo", "config", "update"], procedure: "event.humanBingo.updateHumanBingoConfigs", operation: "mutation", summary: "Replace the Human Bingo config.", effects: ["state-change"], target: "eventId", dates: [], input: { type: "object", properties: { eventId: { type: "string" }, config: { type: "object", properties: { textColor: { type: "string" }, titleFontSize: { type: "number" }, backgroundColor: {
10477
+ { path: ["human-bingo", "config", "update"], procedure: "event.humanBingo.updateHumanBingoConfigs", operation: "mutation", summary: "Replace the Human Bingo config.", effects: ["state-change"], target: "eventId", dates: [], input: { type: "object", properties: { eventId: { type: "string" }, config: { type: "object", properties: { textColor: { type: "string" }, titleFontSize: { type: "number" }, backgroundColor: { type: "string" }, backgroundImageKey: { type: ["string", "null"] }, nameCardTextColor: { type: "string" }, nameCardBackgroundColor: { type: "string" }, nameCardBorderColor: { type: "string" }, cardBackgroundColor: { type: "string" }, cardBorderColor: {
10616
10478
  type: "string"
10617
- }, backgroundImageKey: { type: ["string", "null"] }, nameCardTextColor: { type: "string" }, nameCardBackgroundColor: { type: "string" }, nameCardBorderColor: { type: "string" }, cardBackgroundColor: { type: "string" }, cardBorderColor: { type: "string" }, cardTextColor: { type: "string" }, numberOfParticipants: { type: "number" }, bingoCellDialogBackgroundColor: { type: "string" }, bingoCellDialogTextColor: { type: "string" }, bingoCellDialogButtonTextColor: { type: "string" }, bingoCellDialogButtonColor: { type: "string" }, bingoCellDialogUploadTextColor: { type: "string" }, bingoCellImageKey: { type: ["string", "null"] }, minRowsForBingo: { type: "number" }, infoTextColor: { type: "string" }, infoTextPosition: { type: "string" }, mobileBackgroundColor: { type: "string" }, mobileBackgroundImageKey: { type: ["string", "null"] }, loginTitle: { type: "string" }, loginDescription: { type: ["string", "null"] }, loginTitleColor: { type: "string" }, loginButtonColor: { type: "string" }, loginButtonTextColor: {
10618
- type: "string" }, loginCardBackgroundColor: { type: "string" }, loginInputColor: { type: "string" }, leaderboardCardBackgroundColor: {
10619
- type: "string"
10620
- }, leaderboardCardTextColor: { type: "string" }, leaderboardBorderColor: { type: "string" } }, required: ["textColor", "titleFontSize", "backgroundColor", "nameCardTextColor", "nameCardBackgroundColor", "nameCardBorderColor", "cardBackgroundColor", "cardBorderColor", "cardTextColor", "numberOfParticipants", "bingoCellDialogBackgroundColor", "bingoCellDialogTextColor", "bingoCellDialogButtonTextColor", "bingoCellDialogButtonColor", "bingoCellDialogUploadTextColor", "minRowsForBingo", "infoTextColor", "infoTextPosition", "mobileBackgroundColor", "loginTitle", "loginTitleColor", "loginButtonColor", "loginButtonTextColor", "loginCardBackgroundColor", "loginInputColor", "leaderboardCardBackgroundColor", "leaderboardCardTextColor", "leaderboardBorderColor"] } }, required: ["eventId", "config"] } },
10621
- { path: ["human-bingo", "background", "get"], procedure: "event.humanBingo.getHumanBingoBoardBackgroundByEventId", operation: "query", summary: "Get the Human Bingo board background images.", effects: [], dates: [], input: { type: "object", properties: {
10622
- eventId: { type: "string" }
10623
- }, required: ["eventId"] } },
10479
+ }, cardTextColor: { type: "string" }, numberOfParticipants: { type: "number" }, bingoCellDialogBackgroundColor: { type: "string" }, bingoCellDialogTextColor: { type: "string" }, bingoCellDialogButtonTextColor: { type: "string" }, bingoCellDialogButtonColor: { type: "string" }, bingoCellDialogUploadTextColor: { type: "string" }, bingoCellImageKey: { type: ["string", "null"] }, minRowsForBingo: { type: "number" }, infoTextColor: { type: "string" }, infoTextPosition: { type: "string" }, mobileBackgroundColor: { type: "string" }, mobileBackgroundImageKey: { type: ["string", "null"] }, loginTitle: { type: "string" }, loginDescription: { type: ["string", "null"] }, loginTitleColor: { type: "string" }, loginButtonColor: { type: "string" }, loginButtonTextColor: { type: "string" }, loginCardBackgroundColor: { type: "string" }, loginInputColor: { type: "string" }, leaderboardCardBackgroundColor: { type: "string" }, leaderboardCardTextColor: { type: "string" }, leaderboardBorderColor: { type: "\
10480
+ string" } }, required: ["textColor", "titleFontSize", "backgroundColor", "nameCardTextColor", "nameCardBackgroundColor", "nameCardBorderColor", "cardBackgroundColor", "cardBorderColor", "cardTextColor", "numberOfParticipants", "bingoCellDialogBackgroundColor", "bingoCellDialogTextColor", "bingoCellDialogButtonTextColor", "bingoCellDialogButtonColor", "bingoCellDialogUploadTextColor", "minRowsForBingo", "infoTextColor", "infoTextPosition", "mobileBackgroundColor", "loginTitle", "loginTitleColor", "loginButtonColor", "loginButtonTextColor", "loginCardBackgroundColor", "loginInputColor", "leaderboardCardBackgroundColor", "leaderboardCardTextColor", "leaderboardBorderColor"] } }, required: ["eventId", "config"] } },
10481
+ { path: ["human-bingo", "background", "get"], procedure: "event.humanBingo.getHumanBingoBoardBackgroundByEventId", operation: "query", summary: "Get the Human Bingo board background images.", effects: [], dates: [], input: { type: "object", properties: { eventId: { type: "string" } }, required: ["eventId"] } },
10624
10482
  { path: ["human-bingo", "items", "list"], procedure: "event.humanBingo.admin.getHumanBingoItemsByEventId", operation: "query", summary: "List Human Bingo items.", effects: [], dates: [], input: { type: "object", properties: { eventId: { type: "string" }, archiveStatus: { default: "active", type: "string", enum: ["active", "archived", "all"] } }, required: ["eventId"] } },
10625
10483
  { path: ["human-bingo", "items", "table"], procedure: "event.humanBingo.admin.getHumanBingoItemsTable", operation: "query", summary: "List Human Bingo items in the admin table shape (paged).", effects: [], dates: [], input: { type: "object", properties: { eventId: { type: "string" }, name: { type: "string" }, page: { default: 1, type: "number", minimum: 1 }, perPage: { default: 10, type: "number", minimum: 1, maximum: 100 }, archiveStatus: { default: "active", type: "string", enum: ["active", "archived", "all"] } }, required: ["eventId"] } },
10626
- { path: ["human-bingo", "items", "replace"], procedure: "event.humanBingo.admin.createHumanBingoItems", operation: "mutation", summary: "Replace every Human Bingo item: existing items are deleted first.", effects: ["state-change", "delete"], target: "eventId", dates: [], input: { type: "object", properties: { eventId: { type: "string", minLength: 1 }, items: { type: "array", items: { type: "object", properties: { name: { type: "string", minLength: 1, maxLength: 200 }, description: { type: "string", maxLength: 500 }, type: { default: "PHOTO_UPLOAD", type: "string", enum: ["SINGLE_SELECT", "TEXT_INPUT", "PHOTO_UPLOAD", "VIDEO_UPLOAD"] }, options: { default: [], maxItems: 20, type: "array", items: { type: "object", properties: { name: { type: "string", minLength: 1, maxLength: 100 }, isCorrect: { default: !1, type: "boolean" } }, required: ["name"] } }, correctAnswer: { type: "string", maxLength: 100 } }, required: ["name"] } } }, required: ["eventId", "items"] } },
10627
- { path: ["human-bingo", "items", "update"], procedure: "event.humanBingo.admin.editHumanBingoItems", operation: "mutation", summary: "Update one Human Bingo item.", effects: ["state-change"], target: "id", dates: [], input: { type: "object", properties: { name: { type: "string", minLength: 1, maxLength: 200 }, description: {
10628
- type: "string",
10629
- maxLength: 500
10630
- }, type: { default: "PHOTO_UPLOAD", type: "string", enum: ["SINGLE_SELECT", "TEXT_INPUT", "PHOTO_UPLOAD", "VIDEO_UPLOAD"] }, options: { default: [], maxItems: 20, type: "array", items: { type: "object", properties: { name: { type: "string", minLength: 1, maxLength: 100 }, isCorrect: { default: !1, type: "boolean" } }, required: ["name"] } }, correctAnswer: { type: "string", maxLength: 100 }, id: { type: "string", minLength: 1 } }, required: ["name", "id"] } },
10631
- { path: ["human-bingo", "items", "archive"], procedure: "event.humanBingo.admin.archiveHumanBingoItem", operation: "mutation", summary: "Archive one Human Bingo item.", effects: ["state-change"], target: "id", dates: [], input: { type: "object", properties: { id: { type: "string" } }, required: ["id"] } },
10632
- { path: ["human-bingo", "items", "archive-many"], procedure: "event.humanBingo.admin.archiveManyHumanBingoItems", operation: "mutation", summary: "Archive Human Bingo items by ID. --target is the comma-joined ids.", effects: ["state-change"], target: "ids", dates: [], input: { type: "object", properties: { ids: {
10484
+ { path: ["human-bingo", "items", "replace"], procedure: "event.humanBingo.admin.createHumanBingoItems", operation: "mutation", summary: "Replace every Human Bingo item: existing items are deleted first.", effects: ["state-change", "delete"], target: "eventId", dates: [], input: { type: "object", properties: { eventId: { type: "string", minLength: 1 }, items: {
10633
10485
  type: "array",
10634
- items: { type: "string" }
10635
- } }, required: ["ids"] } },
10486
+ items: { type: "object", properties: { name: { type: "string", minLength: 1, maxLength: 200 }, description: { type: "string", maxLength: 500 }, type: { default: "PHOTO_UPLOAD", type: "string", enum: ["SINGLE_SELECT", "TEXT_INPUT", "PHOTO_UPLOAD", "VIDEO_UPLOAD"] }, options: { default: [], maxItems: 20, type: "array", items: { type: "object", properties: { name: { type: "string", minLength: 1, maxLength: 100 }, isCorrect: { default: !1, type: "boolean" } }, required: ["name"] } }, correctAnswer: { type: "string", maxLength: 100 } }, required: ["name"] }
10487
+ } }, required: ["eventId", "items"] } },
10488
+ { path: ["human-bingo", "items", "update"], procedure: "event.humanBingo.admin.editHumanBingoItems", operation: "mutation", summary: "Update one Human Bingo item.", effects: ["state-change"], target: "id", dates: [], input: { type: "object", properties: { name: { type: "string", minLength: 1, maxLength: 200 }, description: { type: "string", maxLength: 500 }, type: { default: "PHOTO_UPLOAD", type: "string", enum: ["SINGLE_SELECT", "TEXT_INPUT", "PHOTO_UPLOAD", "VIDEO_UPLOAD"] }, options: { default: [], maxItems: 20, type: "array", items: { type: "object", properties: { name: { type: "string", minLength: 1, maxLength: 100 }, isCorrect: { default: !1, type: "boolean" } }, required: ["name"] } }, correctAnswer: { type: "string", maxLength: 100 }, id: { type: "string", minLength: 1 } }, required: ["name", "id"] } },
10489
+ { path: ["human-bingo", "items", "archive"], procedure: "event.humanBingo.admin.archiveHumanBingoItem", operation: "mutation", summary: "Archive one Human Bingo item.", effects: ["state-change"], target: "id", dates: [], input: { type: "object", properties: { id: { type: "string" } }, required: ["id"] } },
10490
+ { path: ["human-bingo", "items", "archive-many"], procedure: "event.humanBingo.admin.archiveManyHumanBingoItems", operation: "mutation", summary: "Archive Human Bingo items by ID. --target is the comma-joined ids.", effects: ["state-change"], target: "ids", dates: [], input: { type: "object", properties: { ids: { type: "array", items: { type: "string" } } }, required: ["ids"] } },
10636
10491
  { path: ["human-bingo", "items", "restore"], procedure: "event.humanBingo.admin.restoreHumanBingoItem", operation: "mutation", summary: "Restore an archived Human Bingo item.", effects: ["state-change"], target: "id", dates: [], input: { type: "object", properties: { id: { type: "string" } }, required: ["id"] } },
10637
10492
  { path: ["human-bingo", "leaderboard"], procedure: "event.humanBingo.admin.getLeaderboard", operation: "query", summary: "Get the completed-card leaderboard (eventRoomId is the Human Bingo ID).", effects: [], dates: [], input: { type: "object", properties: { eventRoomId: { type: "string" } }, required: ["eventRoomId"] } },
10638
10493
  { path: ["human-bingo", "participants", "leaderboard"], procedure: "event.humanBingo.admin.getParticipantLeaderboard", operation: "query", summary: "Get the participant leaderboard.", effects: [], dates: [], input: { type: "object", properties: { eventId: { type: "string" } }, required: ["eventId"] } },
10639
- { path: ["human-bingo", "participants", "list"], procedure: "event.humanBingo.admin.getParticipantsByEvent", operation: "query", summary: "List Human Bingo participants.", effects: [], dates: [], input: { type: "object", properties: { eventId: { type: "string" }, archiveStatus: { default: "active", type: "string", enum: ["active", "archived", "all"] } }, required: ["eventId"] } },
10494
+ { path: ["human-bingo", "participants", "list"], procedure: "event.humanBingo.admin.getParticipantsByEvent", operation: "query", summary: "List Human Bingo participants.", effects: [], dates: [], input: { type: "object", properties: { eventId: { type: "string" }, archiveStatus: {
10495
+ default: "active",
10496
+ type: "string",
10497
+ enum: ["active", "archived", "all"]
10498
+ } }, required: ["eventId"] } },
10640
10499
  { path: ["human-bingo", "participants", "table"], procedure: "event.humanBingo.admin.getParticipantsTable", operation: "query", summary: "List Human Bingo participants in the admin table shape (paged).", effects: [], dates: [], input: { type: "object", properties: { eventId: { type: "string" }, name: { type: "string" }, page: { default: 1, type: "number", minimum: 1 }, perPage: { default: 10, type: "number", minimum: 1, maximum: 100 }, archiveStatus: { default: "active", type: "string", enum: ["active", "archived", "all"] } }, required: ["eventId"] } },
10641
- { path: ["human-bingo", "participants", "card"], procedure: "event.humanBingo.admin.getParticipantBingoCard", operation: "query", summary: "Get one participant's bingo card.", effects: [], dates: [], input: { type: "object", properties: { eventId: { type: "string" }, participantId: { type: "string" } }, required: [
10642
- "eventId",
10643
- "participantId"
10644
- ] } },
10500
+ { path: ["human-bingo", "participants", "card"], procedure: "event.humanBingo.admin.getParticipantBingoCard", operation: "query", summary: "Get one participant's bingo card.", effects: [], dates: [], input: { type: "object", properties: { eventId: { type: "string" }, participantId: { type: "string" } }, required: ["eventId", "participantId"] } },
10645
10501
  { path: ["human-bingo", "participants", "ban"], procedure: "event.humanBingo.admin.updateParticipantBanStatus", operation: "mutation", summary: "Ban or unban a participant.", effects: ["state-change"], target: "participantId", dates: [], input: { type: "object", properties: { eventId: { type: "string" }, participantId: { type: "string" }, banned: { type: "boolean" } }, required: ["eventId", "participantId", "banned"] } },
10646
10502
  { path: ["human-bingo", "participants", "archive"], procedure: "event.humanBingo.admin.archiveHumanBingoParticipants", operation: "mutation", summary: "Archive participants by ID. --target is the comma-joined ids.", effects: ["state-change"], target: "ids", dates: [], input: { type: "object", properties: { ids: { type: "array", items: { type: "string" } } }, required: ["ids"] } },
10647
10503
  { path: ["human-bingo", "participants", "restore"], procedure: "event.humanBingo.admin.restoreHumanBingoParticipants", operation: "mutation", summary: "Restore participants; cards that no longer match the board are deleted and rebuilt.", effects: ["state-change", "delete"], target: "ids", dates: [], input: { type: "object", properties: { ids: { type: "array", items: { type: "string" } } }, required: ["ids"] } },
10648
- { path: ["human-bingo", "submissions", "list"], procedure: "event.humanBingo.admin.getSubmissions", operation: "query", summary: "List Human Bingo submissions (paged).", effects: [], dates: [], input: { type: "object", properties: { eventId: { type: "string" }, page: { type: "number", minimum: 1 }, cursor: { type: "number", minimum: 1 }, perPage: { default: 6, type: "number", minimum: 1, maximum: 50 }, direction: { type: "string", enum: ["forward", "backward"] } }, required: ["eventId"] } },
10504
+ { path: [
10505
+ "human-bingo",
10506
+ "submissions",
10507
+ "list"
10508
+ ], procedure: "event.humanBingo.admin.getSubmissions", operation: "query", summary: "List Human Bingo submissions (paged).", effects: [], dates: [], input: { type: "object", properties: { eventId: { type: "string" }, page: { type: "number", minimum: 1 }, cursor: { type: "number", minimum: 1 }, perPage: { default: 6, type: "number", minimum: 1, maximum: 50 }, direction: { type: "string", enum: ["forward", "backward"] } }, required: ["eventId"] } },
10649
10509
  { path: ["human-bingo", "submissions", "pending"], procedure: "event.humanBingo.admin.getHumanBingoSubmissionsForApproval", operation: "query", summary: "List Human Bingo submissions for moderation (filter by state).", effects: [], dates: [], input: { type: "object", properties: { eventId: { type: "string" }, page: { default: 1, type: "integer", exclusiveMinimum: 0, maximum: 9007199254740991 }, perPage: { default: 10, type: "integer", minimum: 1, maximum: 100 }, name: { type: "string" }, state: { default: "PENDING", type: "string", enum: ["PENDING", "APPROVED", "REJECTED"] } }, required: ["eventId"] } },
10650
10510
  { path: ["human-bingo", "submissions", "respond"], procedure: "event.humanBingo.admin.respondToBingoCardItemSubmission", operation: "mutation", summary: "Approve or reject a Human Bingo card item submission.", effects: ["state-change"], target: "id", dates: [], input: { type: "object", properties: { eventId: { type: "string" }, id: { type: "string" }, status: { type: "string", enum: ["PENDING", "APPROVED", "REJECTED"] }, bingoCardId: { type: "string" } }, required: ["eventId", "id", "status", "bingoCardId"] } },
10651
10511
  { path: ["staff-redemption", "setup", "get"], procedure: "event.staffRedemption.getStaffRedemptionSetup", operation: "query", summary: "Get the whole staff redemption setup: settings (including counterOrder, always resolved: FOOD_THEN_DRAW when never set, walkInDraw, always resolved: NO_PRIZE when never set, and the employee sign-in settings loginMethods, staffIdLabel and wrongSiteMessage, the two texts null while unset), employeeLogin.googleAvailable (whether Google sign-in can be turned on), missingPolicies and policiesLocked, sites (with crew access status), sessions, slots with setsIssued, item groups and items, prizes and prize stock. readiness lists what is still missing before counters can serve people (ready, and items of code plus short text); truncated is true when a list was cut at its cap. Archived rows are included with archivedAt; holds no personal data. Needs event.operate.", effects: [], dates: [], input: { type: "object", properties: { eventId: { type: "string", minLength: 1,
@@ -10653,56 +10513,77 @@ tId", "config"] } },
10653
10513
  { path: ["staff-redemption", "settings", "update"], procedure: "event.staffRedemption.updateStaffRedemptionSettings", operation: "mutation", summary: "Update eligibleShifts, itemRule, wrongSite, sessionRule, drawPolicy, walkInDraw, fixedWinRatePercent, counterOrder and the employee sign-in settings loginMethods (emailOtp, google, guest, staffId, staffIdRequiresLastName; every method is off until turned on; google needs the server's Google sign-in), staffIdLabel (what the roster identifier is called, default 'Employee ID') and wrongSiteMessage (the warning both counters show for a person rostered at another site, max 300 characters); null or blank resets a text to its default. Omitted fields are unchanged. sessionRule is OWN_SHIFT (the default when unset: only during the person's own shift's session, from its sets and prizes) or ANY_OPEN_SESSION ('any open session: own shift's stock first'. A person rostered at the counter's site gets their set, from their session's (Singapore) day on\
10654
10514
  wards whatever the hour (on an earlier day they are served like a walk-in), from their own shift's slot there while it has sets left, else from the slot at the same site of the open session with the most sets left (NO_SETS_LEFT when none has), and always draws from their own shift's slot's prizes there; they are never refused NO_OPEN_SESSION. A walk-in rostered at another site (or none) is served only while a session is open (NO_OPEN_SESSION otherwise), from their own shift's slot at the counter's site while their session is open and it has sets left, else from the open session's slot there with the most sets left, and their spin is no prize unless walkInDraw is AT_COUNTER_SITE; works with either drawPolicy, and under REMAINING_HEADCOUNT a site's prizes are shared only over its own people). walkInDraw is NO_PRIZE (the default when unset) or AT_COUNTER_SITE: under ANY_OPEN_SESSION with wrongSite SERVE_FROM_COUNTER and drawPolicy REMAINING_HEADCOUNT, a walk-in draws from the prizes of th\
10655
10515
  e counter site's slot their set comes from, added to that slot's people (odds prizes left / (headcount + 1)), so each walk-in win is one fewer prize for that site's own people; ignored (no prize) under any other combination. counterOrder is FOOD_THEN_DRAW (the default when never set) or DRAW_THEN_FOOD (the person spins first and the food is recorded afterwards); it is not a required policy (never in missingPolicies). Policies, sessionRule, walkInDraw and counterOrder included, lock once a redemption exists (setup get shows policiesLocked): then a change needs overrideReason, recorded in the activity log. loginMethods, staffIdLabel and wrongSiteMessage are not policies: they never lock and never need overrideReason.", effects: ["state-change"], target: "eventId", dates: [], input: { type: "object", properties: { eventId: { type: "string", minLength: 1, maxLength: 64 }, eligibleShifts: { minItems: 1, maxItems: 20, type: "array", items: { type: "string", minLength: 1, maxLength: 8 } }, itemRule: {
10656
- type: "string", enum: ["ONE_FROM_EACH_GROUP", "AT_MOST_ONE_PER_GROUP", "AT_MOST_ONE_PER_GROUP_OR_NONE"] }, wrongSite: { type: "string", enum: ["REFUSE", "SERVE_FROM_COUNTER"] }, sessionRule: { type: "string", enum: ["OWN_SHIFT", "ANY_OPEN_SESSION"] }, drawPolicy: { type: "string", enum: ["REMAINING_HEADCOUNT", "FIXED_RATE"] }, walkInDraw: { type: "string", enum: ["NO_PRIZE", "AT_COUNTER_SITE"] }, fixedWinRatePercent: { type: "number", minimum: 0, maximum: 100 }, counterOrder: {
10657
- type: "string",
10658
- enum: ["FOOD_THEN_DRAW", "DRAW_THEN_FOOD"]
10659
- }, loginMethods: { type: "object", properties: { emailOtp: { type: "boolean" }, google: { type: "boolean" }, guest: { type: "boolean" }, staffId: { default: !1, type: "boolean" }, staffIdRequiresLastName: { default: !0, type: "boolean" } }, required: ["emailOtp", "google", "guest"], additionalProperties: !1 }, staffIdLabel: { anyOf: [{ type: "null" }, { type: "string", maxLength: 40 }] }, wrongSiteMessage: { anyOf: [{ type: "null" }, { type: "string", maxLength: 300 }] }, overrideReason: { type: "string", minLength: 1, maxLength: 500 } }, required: ["eventId"], additionalProperties: !1 } },
10660
- { path: ["staff-redemption", "site", "upsert"], procedure: "event.staffRedemption.upsertStaffRedemptionSite", operation: "mutation", summary: "Create a site (omit siteId) or rename and reorder one (give siteId). Use staff-redemption archive set to archive or unarchive it.", effects: ["state-change"], target: "eventId", dates: [], input: { type: "object", properties: {
10661
- eventId: { type: "string", minLength: 1, maxLength: 64 },
10662
- siteId: { type: "string", minLength: 1, maxLength: 64 },
10663
- name: { type: "string", minLength: 1, maxLength: 120 },
10664
- order: { type: "integer", minimum: 0, maximum: 1e4 }
10665
- }, required: ["eventId", "name"], additionalProperties: !1 } },
10516
+ type: "string", enum: ["ONE_FROM_EACH_GROUP", "AT_MOST_ONE_PER_GROUP", "AT_MOST_ONE_PER_GROUP_OR_NONE"] }, wrongSite: { type: "string", enum: ["REFUSE", "SERVE_FROM_COUNTER"] }, sessionRule: { type: "string", enum: ["OWN_SHIFT", "ANY_OPEN_SESSION"] }, drawPolicy: { type: "string", enum: ["REMAINING_HEADCOUNT", "FIXED_RATE"] }, walkInDraw: { type: "string", enum: ["NO_PRIZE", "AT_COUNTER_SITE"] }, fixedWinRatePercent: { type: "number", minimum: 0, maximum: 100 }, counterOrder: { type: "string", enum: ["FOOD_THEN_DRAW", "DRAW_THEN_FOOD"] }, loginMethods: { type: "object", properties: { emailOtp: { type: "boolean" }, google: { type: "boolean" }, guest: { type: "boolean" }, staffId: { default: !1, type: "boolean" }, staffIdRequiresLastName: { default: !0, type: "boolean" } }, required: ["emailOtp", "google", "guest"], additionalProperties: !1 }, staffIdLabel: { anyOf: [{ type: "null" }, { type: "string", maxLength: 40 }] }, wrongSiteMessage: { anyOf: [{ type: "null" }, { type: "string", maxLength: 300 }] },
10517
+ overrideReason: { type: "string", minLength: 1, maxLength: 500 } }, required: ["eventId"], additionalProperties: !1 } },
10518
+ { path: ["staff-redemption", "site", "upsert"], procedure: "event.staffRedemption.upsertStaffRedemptionSite", operation: "mutation", summary: "Create a site (omit siteId) or rename and reorder one (give siteId). Use staff-redemption archive set to archive or unarchive it.", effects: ["state-change"], target: "eventId", dates: [], input: { type: "object", properties: { eventId: { type: "string", minLength: 1, maxLength: 64 }, siteId: { type: "string", minLength: 1, maxLength: 64 }, name: { type: "string", minLength: 1, maxLength: 120 }, order: { type: "integer", minimum: 0, maximum: 1e4 } }, required: ["eventId", "name"], additionalProperties: !1 } },
10666
10519
  { path: ["staff-redemption", "crew-password", "set"], procedure: "event.staffRedemption.setStaffRedemptionCrewPassword", operation: "mutation", summary: "Set a site's shared crew password (6-128 characters), which turns the site's crew link on. Ends every crew session at that site. Prefer --input-file over --input so the password stays out of shell history.", effects: ["state-change"], target: "eventId", dates: [], input: { type: "object", properties: { eventId: { type: "string", minLength: 1, maxLength: 64 }, siteId: { type: "string", minLength: 1, maxLength: 64 }, password: { type: "string", minLength: 6, maxLength: 128 } }, required: ["eventId", "siteId", "password"], additionalProperties: !1 } },
10667
- { path: ["staff-redemption", "crew-password", "clear"], procedure: "event.staffRedemption.clearStaffRedemptionCrewPassword", operation: "mutation", summary: "Clear a site's crew password, which turns its crew link off and ends every crew session at that site.", effects: ["state-change"], target: "eventId", dates: [], input: { type: "object", properties: { eventId: { type: "string", minLength: 1, maxLength: 64 }, siteId: { type: "string", minLength: 1, maxLength: 64 } }, required: ["eventId", "siteId"], additionalProperties: !1 } },
10520
+ { path: ["staff-redemption", "crew-password", "clear"], procedure: "event.staffRedemption.clearStaffRedemptionCrewPassword", operation: "mutation", summary: "Clear a site's crew password, which turns its crew link off and ends every crew session at that site.", effects: ["state-change"], target: "eventId", dates: [], input: { type: "object", properties: { eventId: {
10521
+ type: "string",
10522
+ minLength: 1,
10523
+ maxLength: 64
10524
+ }, siteId: { type: "string", minLength: 1, maxLength: 64 } }, required: ["eventId", "siteId"], additionalProperties: !1 } },
10668
10525
  { path: ["staff-redemption", "session", "upsert"], procedure: "event.staffRedemption.upsertStaffRedemptionSession", operation: "mutation", summary: "Create a session (omit sessionId) or update one: name, shift letter, and optional startsAt and endsAt (ISO date-times; null or omitted means the session is open whenever the event is). Each shift has one session; a session with redemptions or unreleased draws in its slots keeps its shift. Under sessionRule ANY_OPEN_SESSION the times decide which other sessions' stock counters may use: only sessions open now (started, or no startsAt, and not ended, or no endsAt). A person rostered at the counter's site uses their own shift's slot there from their session's (Singapore) day onwards, whatever the hour, (the set while it has sets left, prizes always), then the open session's slot there with the most sets left. A walk-in from another site gets a set only from sessions open now (their own shift's slot there while their session is open and it ha\
10669
10526
  s sets left, else the open session's slot with the most sets left; NO_OPEN_SESSION when none is open) and always spins for no prize. Set the times correctly.", effects: ["state-change"], target: "eventId", dates: ["startsAt", "endsAt"], input: { type: "object", properties: { eventId: { type: "string", minLength: 1, maxLength: 64 }, sessionId: { type: "string", minLength: 1, maxLength: 64 }, name: { type: "string", minLength: 1, maxLength: 120 }, shift: { type: "string", minLength: 1, maxLength: 8 }, startsAt: { default: null, anyOf: [{ type: "string", format: "date-time" }, { type: "null" }] }, endsAt: { default: null, anyOf: [{ type: "string", format: "date-time" }, { type: "null" }] } }, required: ["eventId", "name", "shift"], additionalProperties: !1 } },
10670
10527
  { path: ["staff-redemption", "slot", "set"], procedure: "event.staffRedemption.setStaffRedemptionSlot", operation: "mutation", summary: "Set how many sets a site has for a session (setQuantity). It cannot go below the sets already issued.", effects: ["state-change"], target: "eventId", dates: [], input: { type: "object", properties: { eventId: { type: "string", minLength: 1, maxLength: 64 }, sessionId: { type: "string", minLength: 1, maxLength: 64 }, siteId: { type: "string", minLength: 1, maxLength: 64 }, setQuantity: { type: "integer", minimum: 0, maximum: 1e5 } }, required: ["eventId", "sessionId", "siteId", "setQuantity"], additionalProperties: !1 } },
10671
- { path: ["staff-redemption", "item-group", "upsert"], procedure: "event.staffRedemption.upsertStaffRedemptionItemGroup", operation: "mutation", summary: "Create an item group (omit groupId; a choice such as wrap or pancake) or rename and reorder one.", effects: ["state-change"], target: "eventId", dates: [], input: { type: "object", properties: { eventId: { type: "string", minLength: 1, maxLength: 64 }, groupId: { type: "string", minLength: 1, maxLength: 64 }, name: {
10528
+ { path: ["staff-redemption", "item-group", "upsert"], procedure: "event.staffRedemption.upsertStaffRedemptionItemGroup", operation: "mutation", summary: "Create an item group (omit groupId; a choice such as wrap or pancake) or rename and reorder one.", effects: ["state-change"], target: "eventId", dates: [], input: { type: "object", properties: { eventId: { type: "string", minLength: 1, maxLength: 64 }, groupId: { type: "string", minLength: 1, maxLength: 64 }, name: { type: "string", minLength: 1, maxLength: 120 }, order: { type: "integer", minimum: 0, maximum: 1e4 } }, required: ["eventId", "name"], additionalProperties: !1 } },
10529
+ { path: ["staff-redemption", "item", "upsert"], procedure: "event.staffRedemption.upsertStaffRedemptionItem", operation: "mutation", summary: "Create an item in a group (omit itemId) or rename, reorder or move one to another groupId; past claims keep their group.", effects: ["state-change"], target: "eventId", dates: [], input: { type: "object", properties: { eventId: { type: "string", minLength: 1, maxLength: 64 }, itemId: { type: "string", minLength: 1, maxLength: 64 }, groupId: { type: "string", minLength: 1, maxLength: 64 }, name: { type: "string", minLength: 1, maxLength: 120 }, order: { type: "integer", minimum: 0, maximum: 1e4 } }, required: ["eventId", "groupId", "name"], additionalProperties: !1 } },
10530
+ { path: ["staff-redemption", "prize", "upsert"], procedure: "event.staffRedemption.upsertStaffRedemptionPrize", operation: "mutation", summary: "Create a prize (omit prizeId) or rename and reorder one. Stock is set per slot with staff-redemption prize-stock set.", effects: ["state-change"], target: "eventId", dates: [], input: { type: "object", properties: { eventId: { type: "string", minLength: 1, maxLength: 64 }, prizeId: {
10672
10531
  type: "string",
10673
10532
  minLength: 1,
10674
- maxLength: 120
10675
- }, order: { type: "integer", minimum: 0, maximum: 1e4 } }, required: ["eventId", "name"], additionalProperties: !1 } },
10676
- { path: ["staff-redemption", "item", "upsert"], procedure: "event.staffRedemption.upsertStaffRedemptionItem", operation: "mutation", summary: "Create an item in a group (omit itemId) or rename, reorder or move one to another groupId; past claims keep their group.", effects: ["state-change"], target: "eventId", dates: [], input: { type: "object", properties: { eventId: { type: "string", minLength: 1, maxLength: 64 }, itemId: { type: "string", minLength: 1, maxLength: 64 }, groupId: { type: "string", minLength: 1, maxLength: 64 }, name: { type: "string", minLength: 1, maxLength: 120 }, order: { type: "integer", minimum: 0, maximum: 1e4 } }, required: ["eventId", "groupId", "name"], additionalProperties: !1 } },
10677
- { path: ["staff-redemption", "prize", "upsert"], procedure: "event.staffRedemption.upsertStaffRedemptionPrize", operation: "mutation", summary: "Create a prize (omit prizeId) or rename and reorder one. Stock is set per slot with staff-redemption prize-stock set.", effects: ["state-change"], target: "eventId", dates: [], input: { type: "object", properties: { eventId: { type: "string", minLength: 1, maxLength: 64 }, prizeId: { type: "string", minLength: 1, maxLength: 64 }, name: { type: "string", minLength: 1, maxLength: 120 }, order: { type: "integer", minimum: 0, maximum: 1e4 } }, required: ["eventId", "name"], additionalProperties: !1 } },
10533
+ maxLength: 64
10534
+ }, name: { type: "string", minLength: 1, maxLength: 120 }, order: { type: "integer", minimum: 0, maximum: 1e4 } }, required: ["eventId", "name"], additionalProperties: !1 } },
10678
10535
  { path: ["staff-redemption", "prize-stock", "set"], procedure: "event.staffRedemption.setStaffRedemptionPrizeStock", operation: "mutation", summary: "Set a prize's stock for one slot (slotId from setup get). An optional reason is recorded; stock cannot go below the prizes already drawn there and not released.", effects: ["state-change"], target: "eventId", dates: [], input: { type: "object", properties: { eventId: { type: "string", minLength: 1, maxLength: 64 }, slotId: { type: "string", minLength: 1, maxLength: 64 }, prizeId: { type: "string", minLength: 1, maxLength: 64 }, quantity: { type: "integer", minimum: 0, maximum: 1e5 }, reason: { type: "string", minLength: 1, maxLength: 500 } }, required: ["eventId", "slotId", "prizeId", "quantity"], additionalProperties: !1 } },
10679
10536
  { path: ["staff-redemption", "rollover", "preview"], procedure: "event.staffRedemption.getStaffRedemptionRolloverPreview", operation: "query", summary: "Preview rolling leftovers from fromSessionId into toSessionId, per site: sets left (set quantity minus active, not voided, redemptions) and prizes left (stock minus prizes drawn and not released) in the source, what would move and the target afterwards. A site is skipped, with a reason, unless the target session already has a slot there with sets (a rollover never creates a slot). Advisory; rollover run recomputes under lock. Needs event.setup.", effects: [], dates: [], input: { type: "object", properties: { eventId: { type: "string", minLength: 1, maxLength: 64 }, fromSessionId: { type: "string", minLength: 1, maxLength: 64, description: "Session whose leftover sets and prizes move out (id from setup get). Must belong to this event and not be archived." }, toSessionId: { type: "string", minLength: 1, maxLength: 64, description: "Ses\
10680
- sion that receives them (id from setup get). Must differ from fromSessionId, belong to this event and not be archived." } }, required: ["eventId", "fromSessionId", "toSessionId"], additionalProperties: !1 } },
10537
+ sion that receives them (id from setup get). Must differ from fromSessionId, belong to this event and not be archived." } }, required: [
10538
+ "eventId",
10539
+ "fromSessionId",
10540
+ "toSessionId"
10541
+ ], additionalProperties: !1 } },
10681
10542
  { path: ["staff-redemption", "rollover", "run"], procedure: "event.staffRedemption.rolloverStaffRedemptionStock", operation: "mutation", summary: "Move the leftover sets (sets) and/or prizes (prizes), both default true, of every site from fromSessionId into toSessionId, with a required reason (1-300 characters) that is logged. The source keeps exactly what it issued, so it never drops below issued. Skipped sites come back with a reason; moved is false and nothing is written (no quantity, log entry or lock) when nothing would move. Undo it exactly with rollover undo (the result's rolloverId is the id); running it the other way is not an undo. Returns rolloverId, null when nothing moved. Not automatic: a manager runs it. Needs event.setup.", effects: ["state-change"], target: "eventId", dates: [], input: { type: "object", properties: { eventId: { type: "string", minLength: 1, maxLength: 64 }, fromSessionId: { type: "string", minLength: 1, maxLength: 64, description: "Session whose left\
10682
10543
  over sets and prizes move out (id from setup get). Must belong to this event and not be archived." }, toSessionId: { type: "string", minLength: 1, maxLength: 64, description: "Session that receives them (id from setup get). Must differ from fromSessionId, belong to this event and not be archived." }, sets: { default: !0, description: "Move the leftover sets (set quantity minus active, not voided, redemptions) of each site. Defaults to true.", type: "boolean" }, prizes: { default: !0, description: "Move the leftover prizes (stock minus prizes drawn and not released) of each site. Defaults to true.", type: "boolean" }, reason: { type: "string", minLength: 1, maxLength: 300, description: "Why the leftovers move (1 to 300 characters). Recorded in the activity log." } }, required: ["eventId", "fromSessionId", "toSessionId", "reason"], additionalProperties: !1 } },
10683
10544
  { path: ["staff-redemption", "rollover", "list"], procedure: "event.staffRedemption.getStaffRedemptionRollovers", operation: "query", summary: "List the event's rollovers, newest first (limit 1-50, default 20): id (use it for rollover undo), who ran it and when, reason, from and to sessions, totals, the sets and prizes moved per site, undoable, and undone (null, or who, when and why). total counts all of them. Needs event.setup.", effects: [], dates: [], input: { type: "object", properties: { eventId: { type: "string", minLength: 1, maxLength: 64 }, limit: { default: 20, description: "How many rollovers to return, newest first (1 to 50). Defaults to 20.", type: "integer", minimum: 1, maximum: 50 } }, required: ["eventId"], additionalProperties: !1 } },
10684
10545
  { path: ["staff-redemption", "rollover", "undo"], procedure: "event.staffRedemption.undoStaffRedemptionRollover", operation: "mutation", summary: "Undo one rollover exactly (rolloverId from rollover list), with a required reason (1-300 characters) that is logged: subtract exactly the sets and prizes it moved from the target session's slots and add them back to the source's, including a source left at 0 sets. The target's own sets and prizes are untouched. All or nothing: refused with CONFLICT, listing the sites and prizes, when a target site has since handed out or drawn part of what moved (it must still have the moved amount unissued), and with CONFLICT when already undone. A rolloverId of another event is NOT_FOUND. Does not check archived state: it restores exactly even if a session, site or prize was archived since. Redo or release voided target redemptions first, as an unreleased void's set counts as free. Recorded as its own activity entry. Needs event.setup.", effects: ["state\
10685
- -change"], target: "eventId", dates: [], input: { type: "object", properties: { eventId: { type: "string", minLength: 1, maxLength: 64 }, rolloverId: { type: "string", minLength: 1, maxLength: 64, description: "Id of the rollover to undo (id from rollover list). Must belong to this event and not be undone already." }, reason: {
10686
- type: "string",
10687
- minLength: 1,
10688
- maxLength: 300,
10689
- description: "Why the rollover is undone (1 to 300 characters). Recorded in the activity log."
10690
- } }, required: ["eventId", "rolloverId", "reason"], additionalProperties: !1 } },
10546
+ -change"], target: "eventId", dates: [], input: { type: "object", properties: { eventId: { type: "string", minLength: 1, maxLength: 64 }, rolloverId: { type: "string", minLength: 1, maxLength: 64, description: "Id of the rollover to undo (id from rollover list). Must belong to this event and not be undone already." }, reason: { type: "string", minLength: 1, maxLength: 300, description: "Why the rollover is undone (1 to 300 characters). Recorded in the activity log." } }, required: ["eventId", "rolloverId", "reason"], additionalProperties: !1 } },
10691
10547
  { path: ["staff-redemption", "archive", "set"], procedure: "event.staffRedemption.setStaffRedemptionArchived", operation: "mutation", summary: "Archive (archived true) or unarchive (archived false) a site, session, itemGroup, item, prize or rosterEntry by entity and id. Setup get and roster list show the current state.", effects: ["state-change"], target: "eventId", dates: [], input: { type: "object", properties: { eventId: { type: "string", minLength: 1, maxLength: 64 }, entity: { type: "string", enum: ["site", "session", "itemGroup", "item", "prize", "rosterEntry"] }, id: { type: "string", minLength: 1, maxLength: 64 }, archived: { type: "boolean" } }, required: ["eventId", "entity", "id", "archived"], additionalProperties: !1 } },
10692
- { path: ["staff-redemption", "roster", "list"], procedure: "event.staffRedemption.getStaffRedemptionRoster", operation: "query", summary: "List roster entries (cursor paged); filter by search, siteId, shift, archived (active, archived, all) and collected (any, collected, not-collected).", effects: [], dates: [], input: { type: "object", properties: { eventId: { type: "string", minLength: 1, maxLength: 64 }, search: { type: "string", maxLength: 200 }, siteId: { type: "string", minLength: 1, maxLength: 64 }, shift: { type: "string", minLength: 1, maxLength: 8 }, archived: { default: "active", type: "string", enum: ["active", "archived", "all"] }, collected: { default: "any", type: "string", enum: ["any", "collected", "not-collected"] }, limit: { default: 25, type: "integer", minimum: 1, maximum: 100 }, cursor: { anyOf: [{ type: "string", minLength: 1, maxLength: 8192 }, { type: "null" }] }, direction: { type: "string", const: "forward" } }, required: ["eventId"], additionalProperties: !1 } },
10693
- { path: ["staff-redemption", "roster", "counts"], procedure: "event.staffRedemption.getStaffRedemptionRosterCounts", operation: "query", summary: "Count roster entries matching the same filters as roster list.", effects: [], dates: [], input: { type: "object", properties: { eventId: { type: "string", minLength: 1, maxLength: 64 }, search: { type: "string", maxLength: 200 }, siteId: { type: "string", minLength: 1, maxLength: 64 }, shift: { type: "string", minLength: 1, maxLength: 8 }, archived: { default: "active", type: "string", enum: ["active", "archived", "all"] }, collected: { default: "any", type: "string", enum: ["any", "collected", "not-collected"] } }, required: ["eventId"], additionalProperties: !1 } },
10694
- { path: ["staff-redemption", "roster", "upsert"], procedure: "event.staffRedemption.upsertStaffRedemptionRosterEntry", operation: "mutation", summary: "Add or update one roster entry by employeeId (name, siteName, shift and workShift are required and can be null; allowance is optional). The site is matched by name, and allowance cannot go below the sets the person already collected. The archived state is unchanged (use staff-redemption archive set).", effects: ["state-change"], target: "eventId", dates: [], input: { type: "object", properties: { eventId: { type: "string", minLength: 1, maxLength: 64 }, employeeId: { type: "string", minLength: 1, maxLength: 64 }, name: {
10695
- anyOf: [{ type: "string", maxLength: 120 }, { type: "null" }]
10696
- }, siteName: { anyOf: [{ type: "string", maxLength: 120 }, { type: "null" }] }, shift: { anyOf: [{ type: "string", minLength: 1, maxLength: 8 }, { type: "null" }] }, workShift: { anyOf: [{ type: "string", maxLength: 120 }, { type: "null" }] }, allowance: { type: "integer", minimum: 0, maximum: 20 } }, required: ["eventId", "employeeId", "name", "siteName", "shift", "workShift"], additionalProperties: !1 } },
10697
- { path: ["staff-redemption", "claims", "list"], procedure: "event.staffRedemption.getStaffRedemptionClaims", operation: "query", summary: "List redemption claims, newest first (cursor paged), with items (with groupName), draw outcome (draw.slot is the site and session the draw was made in, where a released prize returns; it can differ from the claim's when the set came from another session or the draw was reused), site, awayFromRosterSite (served at a site other than the roster site), session and void state; each row also has itemsPending (true while the prize was drawn but the food is not recorded yet) and itemsRecordedAt; filter by search, siteId, sessionId and status (active, items-pending, voided, all). items-pending is active claims that still wait for their food.", effects: [], dates: [], input: { type: "object", properties: { eventId: { type: "string", minLength: 1, maxLength: 64 }, search: { type: "string", maxLength: 200 }, siteId: { type: "string", minLength: 1, maxLength: 64 },
10698
- sessionId: { type: "string", minLength: 1, maxLength: 64 }, status: { default: "all", type: "string", enum: ["active", "items-pending", "voided", "all"] }, limit: { default: 25, type: "integer", minimum: 1, maximum: 100 }, cursor: { anyOf: [{ type: "string", minLength: 1, maxLength: 8192 }, { type: "null" }] }, direction: { type: "string", const: "forward" } }, required: ["eventId"], additionalProperties: !1 } },
10699
- { path: ["staff-redemption", "claims", "counts"], procedure: "event.staffRedemption.getStaffRedemptionClaimCounts", operation: "query", summary: "Count claims matching the same filters as claims list : returns totalCount (all filters, status included), then activeCount, itemsPendingCount (active claims whose food is not recorded yet) and voidedCount, which ignore the status filter.", effects: [], dates: [], input: { type: "object", properties: { eventId: { type: "string", minLength: 1, maxLength: 64 }, search: { type: "string", maxLength: 200 }, siteId: { type: "string", minLength: 1, maxLength: 64 }, sessionId: { type: "string", minLength: 1, maxLength: 64 }, status: { default: "all", type: "string", enum: ["active", "items-pending", "voided", "all"] } }, required: ["eventId"], additionalProperties: !1 } },
10700
- { path: ["staff-redemption", "claims", "void"], procedure: "event.staffRedemption.voidStaffRedemptionClaim", operation: "mutation", summary: "Void a claim with a reason (a claim still waiting for its food too). The set returns to the person and the slot; the prize draw is kept, so a redo shows the same outcome (even a draw made in another slot or a no-prize draw) until staff-redemption draw release. Claims list shows each draw's activeClaimCount.", effects: ["state-change"], target: "eventId", dates: [], input: { type: "object", properties: { eventId: { type: "string", minLength: 1, maxLength: 64 }, claimId: { type: "string", minLength: 1, maxLength: 64 }, reason: { type: "string", minLength: 1, maxLength: 500 } }, required: ["eventId", "claimId", "reason"], additionalProperties: !1 } },
10701
- { path: ["staff-redemption", "draw", "release"], procedure: "event.staffRedemption.releaseStaffRedemptionDraw", operation: "mutation", summary: "Release a person's prize draw (draw.id from claims list) with a reason: a won prize returns to the stock of the slot it was drawn in (claims list draw.slot) and the person draws again on their next redemption. Refused (CONFLICT) while an active, not voided redemption still shows the draw (claims list draw.activeClaimCount > 0); void it first, or pass the explicit override allowWhileClaimActive: true to release a prize while its redemption stays recorded (for example a paper entry). The override is recorded in the activity log.", effects: ["state-change"], target: "eventId", dates: [], input: { type: "object", properties: { eventId: { type: "string", minLength: 1, maxLength: 64 }, drawId: {
10548
+ { path: ["staff-redemption", "roster", "list"], procedure: "event.staffRedemption.getStaffRedemptionRoster", operation: "query", summary: "List roster entries (cursor paged); filter by search, siteId, shift, archived (active, archived, all) and collected (any, collected, not-collected).", effects: [], dates: [], input: { type: "object", properties: {
10549
+ eventId: { type: "string", minLength: 1, maxLength: 64 },
10550
+ search: { type: "string", maxLength: 200 },
10551
+ siteId: { type: "string", minLength: 1, maxLength: 64 },
10552
+ shift: { type: "string", minLength: 1, maxLength: 8 },
10553
+ archived: { default: "active", type: "string", enum: ["active", "archived", "all"] },
10554
+ collected: { default: "any", type: "string", enum: ["any", "collected", "not-collected"] },
10555
+ limit: { default: 25, type: "integer", minimum: 1, maximum: 100 },
10556
+ cursor: { anyOf: [{ type: "string", minLength: 1, maxLength: 8192 }, { type: "null" }] },
10557
+ direction: { type: "string", const: "forward" }
10558
+ }, required: ["eventId"], additionalProperties: !1 } },
10559
+ { path: ["staff-redemption", "roster", "counts"], procedure: "event.staffRedemption.getStaffRedemptionRosterCounts", operation: "query", summary: "Count roster entries matching the same filters as roster list.", effects: [], dates: [], input: { type: "object", properties: { eventId: { type: "string", minLength: 1, maxLength: 64 }, search: { type: "string", maxLength: 200 }, siteId: { type: "string", minLength: 1, maxLength: 64 }, shift: { type: "string", minLength: 1, maxLength: 8 }, archived: {
10560
+ default: "active",
10702
10561
  type: "string",
10703
- minLength: 1,
10704
- maxLength: 64
10705
- }, reason: { type: "string", minLength: 1, maxLength: 500 }, allowWhileClaimActive: { description: "Override: release the draw even though an active (not voided) redemption still shows it, for a redemption that stays recorded (for example a paper entry with no spin). Omit to refuse while any active redemption uses the draw.", type: "boolean" } }, required: ["eventId", "drawId", "reason"], additionalProperties: !1 } },
10562
+ enum: ["active", "archived", "all"]
10563
+ }, collected: { default: "any", type: "string", enum: ["any", "collected", "not-collected"] } }, required: ["eventId"], additionalProperties: !1 } },
10564
+ { path: ["staff-redemption", "roster", "upsert"], procedure: "event.staffRedemption.upsertStaffRedemptionRosterEntry", operation: "mutation", summary: "Add or update one roster entry by employeeId (name, siteName, shift and workShift are required and can be null; allowance is optional). The site is matched by name, and allowance cannot go below the sets the person already collected. The archived state is unchanged (use staff-redemption archive set).", effects: ["state-change"], target: "eventId", dates: [], input: { type: "object", properties: { eventId: { type: "string", minLength: 1, maxLength: 64 }, employeeId: { type: "string", minLength: 1, maxLength: 64 }, name: { anyOf: [{ type: "string", maxLength: 120 }, { type: "null" }] }, siteName: { anyOf: [{ type: "string", maxLength: 120 }, { type: "null" }] }, shift: { anyOf: [
10565
+ { type: "string", minLength: 1, maxLength: 8 },
10566
+ { type: "null" }
10567
+ ] }, workShift: { anyOf: [{ type: "string", maxLength: 120 }, { type: "null" }] }, allowance: { type: "integer", minimum: 0, maximum: 20 } }, required: ["eventId", "employeeId", "name", "siteName", "shift", "workShift"], additionalProperties: !1 } },
10568
+ {
10569
+ path: ["staff-redemption", "claims", "list"],
10570
+ procedure: "event.staffRedemption.getStaffRedemptionClaims",
10571
+ operation: "query",
10572
+ summary: "List redemption claims, newest first (cursor paged), with items (with groupName), draw outcome (draw.slot is the site and session the draw was made in, where a released prize returns; it can differ from the claim's when the set came from another session or the draw was reused), site, awayFromRosterSite (served at a site other than the roster site), session and void state; each row also has itemsPending (true while the prize was drawn but the food is not recorded yet) and itemsRecordedAt; filter by search, siteId, sessionId and status (active, items-pending, voided, all). items-pending is active claims that still wait for their food.",
10573
+ effects: [],
10574
+ dates: [],
10575
+ input: { type: "object", properties: { eventId: { type: "string", minLength: 1, maxLength: 64 }, search: { type: "string", maxLength: 200 }, siteId: { type: "string", minLength: 1, maxLength: 64 }, sessionId: { type: "string", minLength: 1, maxLength: 64 }, status: { default: "all", type: "string", enum: ["active", "items-pending", "voided", "all"] }, limit: { default: 25, type: "integer", minimum: 1, maximum: 100 }, cursor: { anyOf: [{ type: "string", minLength: 1, maxLength: 8192 }, { type: "null" }] }, direction: { type: "string", const: "forward" } }, required: ["eventId"], additionalProperties: !1 }
10576
+ },
10577
+ { path: ["staff-redemption", "claims", "counts"], procedure: "event.staffRedemption.getStaffRedemptionClaimCounts", operation: "query", summary: "Count claims matching the same filters as claims list : returns totalCount (all filters, status included), then activeCount, itemsPendingCount (active claims whose food is not recorded yet) and voidedCount, which ignore the status filter.", effects: [], dates: [], input: { type: "object", properties: {
10578
+ eventId: { type: "string", minLength: 1, maxLength: 64 },
10579
+ search: { type: "string", maxLength: 200 },
10580
+ siteId: { type: "string", minLength: 1, maxLength: 64 },
10581
+ sessionId: { type: "string", minLength: 1, maxLength: 64 },
10582
+ status: { default: "all", type: "string", enum: ["active", "items-pending", "voided", "all"] }
10583
+ }, required: ["eventId"], additionalProperties: !1 } },
10584
+ { path: ["staff-redemption", "claims", "void"], procedure: "event.staffRedemption.voidStaffRedemptionClaim", operation: "mutation", summary: "Void a claim with a reason (a claim still waiting for its food too). The set returns to the person and the slot; the prize draw is kept, so a redo shows the same outcome (even a draw made in another slot or a no-prize draw) until staff-redemption draw release. Claims list shows each draw's activeClaimCount.", effects: ["state-change"], target: "eventId", dates: [], input: { type: "object", properties: { eventId: { type: "string", minLength: 1, maxLength: 64 }, claimId: { type: "string", minLength: 1, maxLength: 64 }, reason: { type: "string", minLength: 1, maxLength: 500 } }, required: ["eventId", "claimId", "reason"], additionalProperties: !1 } },
10585
+ { path: ["staff-redemption", "draw", "release"], procedure: "event.staffRedemption.releaseStaffRedemptionDraw", operation: "mutation", summary: "Release a person's prize draw (draw.id from claims list) with a reason: a won prize returns to the stock of the slot it was drawn in (claims list draw.slot) and the person draws again on their next redemption. Refused (CONFLICT) while an active, not voided redemption still shows the draw (claims list draw.activeClaimCount > 0); void it first, or pass the explicit override allowWhileClaimActive: true to release a prize while its redemption stays recorded (for example a paper entry). The override is recorded in the activity log.", effects: ["state-change"], target: "eventId", dates: [], input: { type: "object", properties: { eventId: { type: "string", minLength: 1, maxLength: 64 }, drawId: { type: "string", minLength: 1, maxLength: 64 }, reason: { type: "string", minLength: 1, maxLength: 500 }, allowWhileClaimActive: { description: "Override: \
10586
+ release the draw even though an active (not voided) redemption still shows it, for a redemption that stays recorded (for example a paper entry with no spin). Omit to refuse while any active redemption uses the draw.", type: "boolean" } }, required: ["eventId", "drawId", "reason"], additionalProperties: !1 } },
10706
10587
  { path: ["staff-redemption", "stock", "summary"], procedure: "event.staffRedemption.getStaffRedemptionStockSummary", operation: "query", summary: "Show sets and prizes issued and left per site and session, with per-slot item counts (items), roster headcount and how many of them collected, walk-ins (walkIns: unreleased draws in the slot by people whose roster site or shift is not the slot's, leaving out no-prize draws by another shift, which are the placeholders recorded where a set came from when no prize slot could be used) and how many of them won (walkInPrizes; under ANY_OPEN_SESSION walk-ins from another site spin for no prize since 19 Nov 2026 unless walkInDraw is AT_COUNTER_SITE, so otherwise it only counts earlier draws there), plus event-wide item totals.", effects: [], dates: [], input: { type: "object", properties: { eventId: { type: "string", minLength: 1, maxLength: 64 } }, required: ["eventId"], additionalProperties: !1 } },
10707
10588
  { path: ["staff-redemption", "counter", "context"], procedure: "event.staffRedemption.getStaffRedemptionCounterContext", operation: "query", summary: "Counter view for one site (siteId): the event (name, status, dates), counterOrder (FOOD_THEN_DRAW or DRAW_THEN_FOOD, the order crew follow), items to choose from, the site's sessions with sets and prizes left, and any missing policies. wrongSite is the policy for people rostered at another site (null while unset), wrongSiteMessage the warning to show for them and staffIdLabel what the roster identifier is called (defaults applied). sessionRule is the session policy; under ANY_OPEN_SESSION, openSessionIds are the sessions open now and openSessionChangesAt when that next changes (serverTime is the server clock at the read); openSession (the open session that started most recently) is informational only, as no single session serves everyone (a person rostered at the site uses their own shift's slot from that session's Singapore day onward\
10708
10589
  s, whatever the hour; walk-ins and people whose session is on a later day use only open sessions' stock). Needs event.operate.", effects: [], dates: [], input: { type: "object", properties: { eventId: { type: "string", minLength: 1, maxLength: 64 }, siteId: { type: "string", minLength: 1, maxLength: 64 } }, required: ["eventId", "siteId"], additionalProperties: !1 } },
@@ -10712,8 +10593,12 @@ s, whatever the hour; walk-ins and people whose session is on a later day use on
10712
10593
  { path: ["staff-redemption", "redeem"], procedure: "event.staffRedemption.redeemStaffRedemption", operation: "mutation", summary: "Redeem for an Employee ID at a site: records the chosen itemIds and reveals the prize outcome the server decides in the same transaction. clientRequestId is a UUID you generate; retry with the same one and you get the stored receipt, never a second redemption. The set and the draw follow the event's sessionRule. Under ANY_OPEN_SESSION a person rostered at this site gets the set, from their session's (Singapore) day onwards whatever the hour (on an earlier day they are served like a walk-in), from their own shift's slot here while it has sets left, else the open session's slot here with the most sets left (receipt.session names it; NO_SETS_LEFT when none has), and always draws from their own shift's slot's prizes here; a walk-in rostered at another site is served only while a session is open (NO_OPEN_SESSION otherwise), from their own shift's slot here whi\
10713
10594
  le their session is open and it has sets left, else the open session's slot here with the most sets left, and always gets no prize. receipt.draw.slot is the slot, session and site the draw was made in (a reused draw keeps its own). When the event's counterOrder is DRAW_THEN_FOOD, itemIds must be [] (anything else is BAD_REQUEST): the claim, the set and the prize draw are recorded together and the receipt has itemsPending true until staff-redemption claims record-items. The item rule is not checked at the spin. Needs event.operate.", effects: ["state-change"], target: "eventId", dates: [], input: { type: "object", properties: { eventId: { type: "string", minLength: 1, maxLength: 64 }, siteId: { type: "string", minLength: 1, maxLength: 64 }, employeeId: { type: "string", minLength: 1, maxLength: 64 }, clientRequestId: { type: "string", format: "uuid", pattern: "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|\
10714
10595
  ffffffff-ffff-ffff-ffff-ffffffffffff)$" }, itemIds: { maxItems: 20, type: "array", items: { type: "string", minLength: 1, maxLength: 64 } } }, required: ["eventId", "siteId", "employeeId", "clientRequestId", "itemIds"], additionalProperties: !1 } },
10715
- { path: ["staff-redemption", "claims", "record-items"], procedure: "event.staffRedemption.recordStaffRedemptionClaimItems", operation: "mutation", summary: "Record the food (itemIds, checked against the item rule) for a claim that was drawn first (itemsPending true, counterOrder DRAW_THEN_FOOD). siteId must be the claim's own site (claims list shows it). Writes the items, sets itemsPending false and itemsRecordedAt, and logs it; it deducts no set and makes no draw. Idempotent: the same items again return replayed true with the stored receipt. CONFLICT when different items were already recorded, when the claim is voided, or when the claim was food-first (nothing pending). Needs event.operate at that site (a manager has it). Returns status recorded, replayed and the receipt.", effects: ["state-change"], target: "eventId", dates: [], input: { type: "object", properties: { eventId: { type: "string", minLength: 1, maxLength: 64 }, siteId: { type: "string", minLength: 1, maxLength: 64 }, claimId: {
10716
- type: "string", minLength: 1, maxLength: 64 }, itemIds: { maxItems: 20, type: "array", items: { type: "string", minLength: 1, maxLength: 64 } } }, required: ["eventId", "siteId", "claimId", "itemIds"], additionalProperties: !1 } },
10596
+ { path: ["staff-redemption", "claims", "record-items"], procedure: "event.staffRedemption.recordStaffRedemptionClaimItems", operation: "mutation", summary: "Record the food (itemIds, checked against the item rule) for a claim that was drawn first (itemsPending true, counterOrder DRAW_THEN_FOOD). siteId must be the claim's own site (claims list shows it). Writes the items, sets itemsPending false and itemsRecordedAt, and logs it; it deducts no set and makes no draw. Idempotent: the same items again return replayed true with the stored receipt. CONFLICT when different items were already recorded, when the claim is voided, or when the claim was food-first (nothing pending). Needs event.operate at that site (a manager has it). Returns status recorded, replayed and the receipt.", effects: ["state-change"], target: "eventId", dates: [], input: { type: "object", properties: {
10597
+ eventId: { type: "string", minLength: 1, maxLength: 64 },
10598
+ siteId: { type: "string", minLength: 1, maxLength: 64 },
10599
+ claimId: { type: "string", minLength: 1, maxLength: 64 },
10600
+ itemIds: { maxItems: 20, type: "array", items: { type: "string", minLength: 1, maxLength: 64 } }
10601
+ }, required: ["eventId", "siteId", "claimId", "itemIds"], additionalProperties: !1 } },
10717
10602
  { path: ["staff-redemption", "device-issues", "list"], procedure: "event.staffRedemption.getStaffRedemptionDeviceIssues", operation: "query", summary: "List the problems the employee QR page reported, newest first, one cursor page per call (limit 1-100, default 50; cursor and direction forward from the previous pageInfo.nextCursor; optional kind filter; a cursor from other filters is rejected, so restart without it): returns { items, pageInfo: { hasNextPage, nextCursor } }. Each item has id, createdAt, kind (qr-not-visible, qr-render-failed, qr-refresh-failed, qr-expired, page-load-failed, device-problem or reload-tapped), problems found by the device check (offline, site-data-blocked, in-app-browser, forced-colors, forced-dark-mode, old-browser, data-saver, clock-wrong), detail, pageState, employeeId and employeeName when the browser was signed in as an employee, the device snapshot (browser, OS, screen, viewport, language, time zone, connection, clockOffsetMs and more), userAgent a\
10718
10603
  nd ipAddress. Totals are in device-issues counts. Holds names and device details; needs event.setup.", effects: [], dates: [], input: { type: "object", properties: { eventId: { type: "string", minLength: 1, maxLength: 64 }, kind: { type: "string", enum: ["qr-not-visible", "qr-render-failed", "qr-refresh-failed", "qr-expired", "page-load-failed", "device-problem", "reload-tapped"] }, limit: { default: 50, type: "integer", minimum: 1, maximum: 100 }, cursor: { anyOf: [{ type: "string", minLength: 1, maxLength: 8192 }, { type: "null" }] }, direction: { type: "string", const: "forward" } }, required: ["eventId"], additionalProperties: !1 } },
10719
10604
  { path: ["staff-redemption", "device-issues", "counts"], procedure: "event.staffRedemption.getStaffRedemptionDeviceIssueCounts", operation: "query", summary: "Count the employee QR page reports for the same optional kind filter as device-issues list: returns totalCount (follows the kind filter), allCount (every report of the event) and counts (reports per kind, never filtered). Needs event.setup.", effects: [], dates: [], input: { type: "object", properties: { eventId: { type: "string", minLength: 1, maxLength: 64 }, kind: { type: "string", enum: ["qr-not-visible", "qr-render-failed", "qr-refresh-failed", "qr-expired", "page-load-failed", "device-problem", "reload-tapped"] } }, required: ["eventId"], additionalProperties: !1 } },
@@ -10728,11 +10613,7 @@ nd ipAddress. Totals are in device-issues counts. Holds names and device details
10728
10613
  }
10729
10614
  const isArray = head.endsWith("[]"), key = isArray ? head.slice(0, -2) : head, apply = __name2((child) => isArray ? Array.isArray(child) ? child.map((item) => coerceDateAt(item, rest, label)) : child : coerceDateAt(child, rest, label), "apply");
10730
10615
  return key === "" ? apply(value) : !isRecord3(value) || !(key in value) ? value : { ...value, [key]: apply(value[key]) };
10731
- }, "coerceDateAt"), coerceDates = __name2((input, datePaths) => datePaths.reduce((current, path2) => coerceDateAt(
10732
- current,
10733
- path2 === "" ? [] : path2.split("."),
10734
- path2 || "input"
10735
- ), input), "coerceDates"), readInput = __name2(async (parsed, entry) => {
10616
+ }, "coerceDateAt"), coerceDates = __name2((input, datePaths) => datePaths.reduce((current, path2) => coerceDateAt(current, path2 === "" ? [] : path2.split("."), path2 || "input"), input), "coerceDates"), readInput = __name2(async (parsed, entry) => {
10736
10617
  const provided = parsed.flags.has("input") || parsed.flags.has("input-file");
10737
10618
  if (!entry.input) {
10738
10619
  if (provided) throw new CliUsageError("".concat(commandName(entry), " does not take --input."));
@@ -10756,7 +10637,9 @@ nd ipAddress. Totals are in device-issues counts. Holds names and device details
10756
10637
  if (Array.isArray(value) && value.length > 0 && value.every((item) => typeof item == "string")) return value.join(",");
10757
10638
  }, "targetText"), assertConfirmed = __name2((parsed, entry, input) => {
10758
10639
  if (entry.effects.length === 0) return;
10759
- const missing = entry.effects.map((effect) => "allow-".concat(effect)).filter((flag2) => parsed.flags.get(flag2) !== !0);
10640
+ const missing = entry.effects.map((effect) => "allow-".concat(effect)).filter(
10641
+ (flag2) => parsed.flags.get(flag2) !== !0
10642
+ );
10760
10643
  if (missing.length > 0) throw new CliUsageError("".concat(commandName(entry), " requires ").concat(missing.map((flag2) => "--".concat(flag2)).join(" "), " as explicit acknowledgement."));
10761
10644
  if (!entry.target) return;
10762
10645
  const expected = targetText(isRecord3(input) ? input[entry.target] : void 0);
@@ -10773,7 +10656,10 @@ nd ipAddress. Totals are in device-issues counts. Holds names and device details
10773
10656
  return writeSuccess(runtime, entry.operation === "query" ? await client.query(procedureInput) : await client.mutate(procedureInput)), !0;
10774
10657
  }, "runRegistryCommand"), getInstalledCliVersion = __name2(() => {
10775
10658
  try {
10776
- const packageJson = JSON.parse(readFileSync(resolve(import.meta.dir, "../package.json"), "utf8"));
10659
+ const packageJson = JSON.parse(readFileSync(
10660
+ resolve(import.meta.dir, "../package.json"),
10661
+ "utf8"
10662
+ ));
10777
10663
  return typeof packageJson.version == "string" ? packageJson.version : "unknown";
10778
10664
  } catch {
10779
10665
  return "unknown";
@@ -10793,7 +10679,10 @@ nd ipAddress. Totals are in device-issues counts. Holds names and device details
10793
10679
  if (typeof parsed.createdAt != "string") throw new CliUsageError("--cursor.createdAt must be an ISO date string.");
10794
10680
  const createdAt = new Date(parsed.createdAt);
10795
10681
  if (Number.isNaN(createdAt.getTime())) throw new CliUsageError("--cursor.createdAt must be a valid date.");
10796
- return { createdAt, id: parsed.id };
10682
+ return {
10683
+ createdAt,
10684
+ id: parsed.id
10685
+ };
10797
10686
  }, "parseCursor"), parseRetainedIds = __name2((value) => {
10798
10687
  let parsed;
10799
10688
  try {
@@ -10806,9 +10695,7 @@ nd ipAddress. Totals are in device-issues counts. Holds names and device details
10806
10695
  return parsed;
10807
10696
  }, "parseRetainedIds"), luckyDrawParticipantFields = /* @__PURE__ */ new Set(["email", "luckyDrawId", "name"]), asParticipantRecord = __name2((participant, index) => {
10808
10697
  if (typeof participant != "object" || participant === null || Array.isArray(participant)) throw new CliUsageError("--participants[".concat(index, "] must be an object."));
10809
- if (Object.keys(participant).some((key) => !luckyDrawParticipantFields.has(key))) throw new CliUsageError(
10810
- "--participants[".concat(index, "] contains an unsupported field.")
10811
- );
10698
+ if (Object.keys(participant).some((key) => !luckyDrawParticipantFields.has(key))) throw new CliUsageError("--participants[".concat(index, "] contains an unsupported field."));
10812
10699
  return participant;
10813
10700
  }, "asParticipantRecord"), readParticipantField = __name2((participant, key) => key in participant ? participant[key] : void 0, "readParticipantField"), parseLuckyDrawParticipant = __name2((participant, index) => {
10814
10701
  const record = asParticipantRecord(participant, index), luckyDrawId = readParticipantField(record, "luckyDrawId"), name = readParticipantField(record, "name"), email3 = readParticipantField(record, "email");
@@ -10816,19 +10703,16 @@ nd ipAddress. Totals are in device-issues counts. Holds names and device details
10816
10703
  if (name !== void 0 && typeof name != "string") throw new CliUsageError("--participants[".concat(index, "].name must be a string."));
10817
10704
  if (email3 != null && typeof email3 != "string") throw new CliUsageError("--participants[".concat(index, "].email must be a string or null."));
10818
10705
  return { luckyDrawId, ...name === void 0 ? {} : { name }, ...email3 === void 0 ? {} : { email: email3 } };
10819
- }, "parseLuckyDrawParticipant"), parseLuckyDrawParticipants = __name2(
10820
- (value) => {
10821
- let parsed;
10822
- try {
10823
- parsed = JSON.parse(value);
10824
- } catch {
10825
- throw new CliUsageError("--participants must be valid JSON.");
10826
- }
10827
- if (!Array.isArray(parsed)) throw new CliUsageError("--participants must be a JSON array.");
10828
- return parsed.map(parseLuckyDrawParticipant);
10829
- },
10830
- "parseLuckyDrawParticipants"
10831
- ), parseAppearanceMediaType = __name2((value) => {
10706
+ }, "parseLuckyDrawParticipant"), parseLuckyDrawParticipants = __name2((value) => {
10707
+ let parsed;
10708
+ try {
10709
+ parsed = JSON.parse(value);
10710
+ } catch {
10711
+ throw new CliUsageError("--participants must be valid JSON.");
10712
+ }
10713
+ if (!Array.isArray(parsed)) throw new CliUsageError("--participants must be a JSON array.");
10714
+ return parsed.map(parseLuckyDrawParticipant);
10715
+ }, "parseLuckyDrawParticipants"), parseAppearanceMediaType = __name2((value) => {
10832
10716
  if (value === "image" || value === "video") return value;
10833
10717
  throw new CliUsageError("--media-type must be one of: image, video.");
10834
10718
  }, "parseAppearanceMediaType"), eventStatuses = ["DRAFT", "ONGOING", "COMPLETED", "ALL"], archiveStatuses = ["active", "archived", "all"], parseEventListStatus = __name2((value) => {
@@ -10837,14 +10721,11 @@ nd ipAddress. Totals are in device-issues counts. Holds names and device details
10837
10721
  }, "parseEventListStatus"), parseArchiveStatus = __name2((value) => {
10838
10722
  if (!archiveStatuses.some((status) => status === value)) throw new CliUsageError("--archive-status must be one of: ".concat(archiveStatuses.join(", "), "."));
10839
10723
  return value;
10840
- }, "parseArchiveStatus"), parseCreatableEventType = __name2(
10841
- (value) => {
10842
- const result = activeEventTypeSchema.safeParse(value);
10843
- if (!result.success) throw new CliUsageError("--type must be one of: ".concat(activeEventTypeSchema.options.join(", "), "."));
10844
- return result.data;
10845
- },
10846
- "parseCreatableEventType"
10847
- ), parseEventTypeList = __name2((value) => {
10724
+ }, "parseArchiveStatus"), parseCreatableEventType = __name2((value) => {
10725
+ const result = activeEventTypeSchema.safeParse(value);
10726
+ if (!result.success) throw new CliUsageError("--type must be one of: ".concat(activeEventTypeSchema.options.join(", "), "."));
10727
+ return result.data;
10728
+ }, "parseCreatableEventType"), parseEventTypeList = __name2((value) => {
10848
10729
  const types = value.split(",").map((type) => type.trim());
10849
10730
  return [...new Set(types)].map((type) => {
10850
10731
  const result = activeEventTypeSchema.safeParse(type);
@@ -10856,10 +10737,7 @@ nd ipAddress. Totals are in device-issues counts. Holds names and device details
10856
10737
  const parsed = new Date(value);
10857
10738
  if (Number.isNaN(parsed.getTime())) throw new CliUsageError("--".concat(name, " must be a valid date-time."));
10858
10739
  return parsed;
10859
- }, "parseIsoDateTime"), commandKey = __name2(
10860
- (action, subAction) => JSON.stringify([action ?? null, subAction ?? null]),
10861
- "commandKey"
10862
- ), runAuthLogin = __name2(async ({ parsed, runtime, credentialStore, apiBaseUrl, cliVersion }) => {
10740
+ }, "parseIsoDateTime"), commandKey = __name2((action, subAction) => JSON.stringify([action ?? null, subAction ?? null]), "commandKey"), runAuthLogin = __name2(async ({ parsed, runtime, credentialStore, apiBaseUrl, cliVersion }) => {
10863
10741
  assertPositionalCount(parsed, 2), assertOnlyFlags(parsed, ["no-browser"]);
10864
10742
  const credentials = await loginWithBrowser({ apiBaseUrl, clientVersion: cliVersion, onVerification: __name2(({ browserOpened, userCode, verificationUriComplete }) => {
10865
10743
  runtime.stderr.write("".concat(browserOpened ? "Opened" : "Open", " ").concat(verificationUriComplete, "\nCode: ").concat(userCode, "\nWaiting for approval\u2026\n"));
@@ -10868,7 +10746,13 @@ nd ipAddress. Totals are in device-issues counts. Holds names and device details
10868
10746
  }, "runAuthLogin"), runAuthStatus = __name2(async ({ parsed, runtime, credentialStore, apiBaseUrl }) => {
10869
10747
  assertPositionalCount(parsed, 2), assertOnlyFlags(parsed, []);
10870
10748
  const credentials = await credentialStore.get();
10871
- writeSuccess(runtime, credentials && isCliCredentialForIssuer(credentials, apiBaseUrl) ? { authenticated: !0, accessTokenExpiresAt: credentials.accessTokenExpiresAt, refreshTokenExpiresAt: credentials.refreshTokenExpiresAt, session: credentials.session, storage: "Bun.secrets" } : { authenticated: !1, storage: "Bun.secrets" });
10749
+ writeSuccess(runtime, credentials && isCliCredentialForIssuer(credentials, apiBaseUrl) ? {
10750
+ authenticated: !0,
10751
+ accessTokenExpiresAt: credentials.accessTokenExpiresAt,
10752
+ refreshTokenExpiresAt: credentials.refreshTokenExpiresAt,
10753
+ session: credentials.session,
10754
+ storage: "Bun.secrets"
10755
+ } : { authenticated: !1, storage: "Bun.secrets" });
10872
10756
  }, "runAuthStatus"), runAuthLogout = __name2(async ({ parsed, runtime, credentialStore, apiBaseUrl }) => {
10873
10757
  assertPositionalCount(parsed, 2), assertOnlyFlags(parsed, []), writeSuccess(runtime, { loggedOut: !0, ...await logoutCliSession({ apiBaseUrl, store: credentialStore }) });
10874
10758
  }, "runAuthLogout"), runAuthWhoami = __name2(async ({ parsed, runtime, ensureAuthentication }) => {
@@ -10883,7 +10767,10 @@ nd ipAddress. Totals are in device-issues counts. Holds names and device details
10883
10767
  await ensureAuthentication(), writeSuccess(runtime, await api2.admin.organization.createOrganization.mutate(input));
10884
10768
  }, "runOrganizationCreate"), runEventCreate = __name2(async ({ parsed, runtime, ensureAuthentication }) => {
10885
10769
  assertPositionalCount(parsed, 2), assertOnlyFlags(parsed, ["organization-id", "name", "type", "start", "end", "location"]);
10886
- const end = getOptionalFlag(parsed, "end"), input = { organizationId: getRequiredFlag(parsed, "organization-id"), name: getRequiredFlag(parsed, "name"), type: parseCreatableEventType(getRequiredFlag(parsed, "type")), location: getRequiredFlag(parsed, "location"), eventDateRange: { from: parseIsoDateTime(getRequiredFlag(parsed, "start"), "start"), ...end === void 0 ? {} : { to: parseIsoDateTime(end, "end") } } };
10770
+ const end = getOptionalFlag(parsed, "end"), input = { organizationId: getRequiredFlag(
10771
+ parsed,
10772
+ "organization-id"
10773
+ ), name: getRequiredFlag(parsed, "name"), type: parseCreatableEventType(getRequiredFlag(parsed, "type")), location: getRequiredFlag(parsed, "location"), eventDateRange: { from: parseIsoDateTime(getRequiredFlag(parsed, "start"), "start"), ...end === void 0 ? {} : { to: parseIsoDateTime(end, "end") } } };
10887
10774
  await ensureAuthentication(), writeSuccess(runtime, await api2.event.createEvent.mutate(input));
10888
10775
  }, "runEventCreate"), runEventList = __name2(async ({ parsed, runtime, ensureAuthentication }) => {
10889
10776
  assertPositionalCount(parsed, 2), assertOnlyFlags(parsed, ["organization-id", "page", "per-page", "name", "status", "archive-status"]);
@@ -10900,17 +10787,16 @@ nd ipAddress. Totals are in device-issues counts. Holds names and device details
10900
10787
  }
10901
10788
  await ensureAuthentication(), writeSuccess(runtime, await api2.event.getEventAppearance.query({ eventId }));
10902
10789
  }, "runEventAppearanceGet"), runEventAppearanceUpdate = __name2(async ({ parsed, runtime, ensureAuthentication }) => {
10903
- assertPositionalCount(parsed, 3), assertOnlyFlags(parsed, ["event-id", "appearance-version", "appearance", "reset"]);
10790
+ assertPositionalCount(parsed, 3), assertOnlyFlags(
10791
+ parsed,
10792
+ ["event-id", "appearance-version", "appearance", "reset"]
10793
+ );
10904
10794
  const reset = parsed.positionals[2] === "reset" || parsed.flags.get("reset") === !0, appearanceValue = getOptionalFlag(parsed, "appearance");
10905
10795
  if (reset && appearanceValue !== void 0) throw new CliUsageError("Use either --appearance or --reset, not both.");
10906
10796
  if (!reset && appearanceValue === void 0) throw new CliUsageError("--appearance is required unless --reset is provided.");
10907
10797
  const input = { eventId: getRequiredFlag(parsed, "event-id"), appearanceVersion: parseNonnegativeInteger(getRequiredFlag(parsed, "appearance-version"), "appearance-version"), appearance: reset ? null : parseAppearance(appearanceValue) };
10908
10798
  await ensureAuthentication(), writeSuccess(runtime, await api2.event.updateEventAppearance.mutate(input));
10909
- }, "runEventAppearanceUpdate"), runEventAppearanceUpload = __name2(async ({
10910
- parsed,
10911
- runtime,
10912
- ensureAuthentication
10913
- }) => {
10799
+ }, "runEventAppearanceUpdate"), runEventAppearanceUpload = __name2(async ({ parsed, runtime, ensureAuthentication }) => {
10914
10800
  assertPositionalCount(parsed, 3), assertOnlyFlags(parsed, ["event-id", "file", "content-type", "media-type"]);
10915
10801
  const eventId = getRequiredFlag(parsed, "event-id"), filePath = getRequiredFlag(parsed, "file"), contentType = getRequiredFlag(parsed, "content-type"), mediaType = parseAppearanceMediaType(getRequiredFlag(parsed, "media-type")), file = await readFile7(filePath);
10916
10802
  await ensureAuthentication();
@@ -10918,20 +10804,14 @@ nd ipAddress. Totals are in device-issues counts. Holds names and device details
10918
10804
  if (!uploadResponse.ok) throw new Error("Appearance media upload failed with HTTP ".concat(uploadResponse.status, "."));
10919
10805
  writeSuccess(runtime, signed);
10920
10806
  }, "runEventAppearanceUpload"), runPhotoWallDisplayItems = __name2(async ({ parsed, runtime, ensureAuthentication }) => {
10921
- assertPositionalCount(
10922
- parsed,
10923
- 3
10924
- ), assertOnlyFlags(parsed, ["event-id", "limit", "cursor", "retained-ids"]);
10807
+ assertPositionalCount(parsed, 3), assertOnlyFlags(parsed, ["event-id", "limit", "cursor", "retained-ids"]);
10925
10808
  const cursorValue = getOptionalFlag(parsed, "cursor"), retainedIdsValue = getOptionalFlag(parsed, "retained-ids"), input = { eventId: getRequiredFlag(parsed, "event-id"), limit: parseBoundedInteger(getOptionalFlag(parsed, "limit") ?? "30", "limit", 1, 60), ...cursorValue === void 0 ? {} : { cursor: parseCursor(cursorValue) }, retainedIds: retainedIdsValue === void 0 ? [] : parseRetainedIds(retainedIdsValue) };
10926
10809
  await ensureAuthentication(), writeSuccess(runtime, await api2.event.photoWall.getPhotoWallDisplayItems.query(input));
10927
- }, "runPhotoWallDisplayItems"), runLuckyDrawPreDraw = __name2(
10928
- async ({ parsed, runtime, ensureAuthentication }) => {
10929
- assertPositionalCount(parsed, 2), assertOnlyFlags(parsed, ["event-id", "prize-count"]);
10930
- const input = { eventId: getRequiredFlag(parsed, "event-id"), prizeCount: parsePositiveInteger(getRequiredFlag(parsed, "prize-count"), "prize-count") };
10931
- await ensureAuthentication(), writeSuccess(runtime, await api2.event.luckyDraw.preDrawPrizes.mutate(input));
10932
- },
10933
- "runLuckyDrawPreDraw"
10934
- ), runLuckyDrawParticipantsReplace = __name2(async ({ parsed, runtime, ensureAuthentication }) => {
10810
+ }, "runPhotoWallDisplayItems"), runLuckyDrawPreDraw = __name2(async ({ parsed, runtime, ensureAuthentication }) => {
10811
+ assertPositionalCount(parsed, 2), assertOnlyFlags(parsed, ["event-id", "prize-count"]);
10812
+ const input = { eventId: getRequiredFlag(parsed, "event-id"), prizeCount: parsePositiveInteger(getRequiredFlag(parsed, "prize-count"), "prize-count") };
10813
+ await ensureAuthentication(), writeSuccess(runtime, await api2.event.luckyDraw.preDrawPrizes.mutate(input));
10814
+ }, "runLuckyDrawPreDraw"), runLuckyDrawParticipantsReplace = __name2(async ({ parsed, runtime, ensureAuthentication }) => {
10935
10815
  assertPositionalCount(parsed, 3), assertOnlyFlags(parsed, ["event-id", "participants", "participants-file", "allow-state-change", "target"]);
10936
10816
  const eventId = getRequiredFlag(parsed, "event-id");
10937
10817
  assertStateChangeTarget(parsed, eventId);
@@ -10941,10 +10821,13 @@ nd ipAddress. Totals are in device-issues counts. Holds names and device details
10941
10821
  assertPositionalCount(parsed, 3), assertOnlyFlags(parsed, ["event-id", "page", "per-page"]);
10942
10822
  const input = { eventId: getRequiredFlag(parsed, "event-id"), page: parsePositiveInteger(getOptionalFlag(parsed, "page") ?? "1", "page"), perPage: parseBoundedInteger(getOptionalFlag(parsed, "per-page") ?? "100", "per-page", 1, 100) };
10943
10823
  await ensureAuthentication(), writeSuccess(runtime, await api2.event.luckyDraw.getLuckyDrawParticipantsByEventId.query(input));
10944
- }, "runLuckyDrawParticipantsList"), organizationCommands = /* @__PURE__ */ new Map([[commandKey("list"), runOrganizationList], [commandKey("get"), runOrganizationGet], [commandKey("create"), runOrganizationCreate]]), commandTable = /* @__PURE__ */ new Map([["auth", /* @__PURE__ */ new Map([[commandKey("login"), runAuthLogin], [commandKey("status"), runAuthStatus], [commandKey("logout"), runAuthLogout], [commandKey("whoami"), runAuthWhoami]])], ["organization", organizationCommands], ["org", organizationCommands], ["event", /* @__PURE__ */ new Map([[commandKey("create"), runEventCreate], [commandKey("list"), runEventList], [commandKey("get"), runEventGet], [commandKey("appearance", "get"), runEventAppearanceGet], [commandKey("appearance", "update"), runEventAppearanceUpdate], [commandKey("appearance", "reset"), runEventAppearanceUpdate], [commandKey("appearance", "upload"), runEventAppearanceUpload], [commandKey("photo-wall", "display-items"), runPhotoWallDisplayItems], [commandKey(
10945
- "photo-wall",
10946
- "display"
10947
- ), runPhotoWallDisplayItems]])], ["lucky-draw", /* @__PURE__ */ new Map([[commandKey("pre-draw"), runLuckyDrawPreDraw], [commandKey("participants", "replace"), runLuckyDrawParticipantsReplace], [commandKey("participants", "list"), runLuckyDrawParticipantsList]])]]), runCommand = __name2(async (parsed, runtime, credentialStore, apiBaseUrl, configureAccessToken) => {
10824
+ }, "runLuckyDrawParticipantsList"), organizationCommands = /* @__PURE__ */ new Map(
10825
+ [[commandKey("list"), runOrganizationList], [commandKey("get"), runOrganizationGet], [commandKey("create"), runOrganizationCreate]]
10826
+ ), commandTable = /* @__PURE__ */ new Map([["auth", /* @__PURE__ */ new Map([[commandKey("login"), runAuthLogin], [commandKey("status"), runAuthStatus], [commandKey("logout"), runAuthLogout], [commandKey("whoami"), runAuthWhoami]])], ["organization", organizationCommands], ["org", organizationCommands], ["event", /* @__PURE__ */ new Map([[commandKey("create"), runEventCreate], [commandKey("list"), runEventList], [commandKey("get"), runEventGet], [commandKey("appearance", "get"), runEventAppearanceGet], [commandKey("appearance", "update"), runEventAppearanceUpdate], [commandKey("appearance", "reset"), runEventAppearanceUpdate], [commandKey("appearance", "upload"), runEventAppearanceUpload], [commandKey("photo-wall", "display-items"), runPhotoWallDisplayItems], [commandKey("photo-wall", "display"), runPhotoWallDisplayItems]])], ["lucky-draw", /* @__PURE__ */ new Map([
10827
+ [commandKey("pre-draw"), runLuckyDrawPreDraw],
10828
+ [commandKey("participants", "replace"), runLuckyDrawParticipantsReplace],
10829
+ [commandKey("participants", "list"), runLuckyDrawParticipantsList]
10830
+ ])]]), runCommand = __name2(async (parsed, runtime, credentialStore, apiBaseUrl, configureAccessToken) => {
10948
10831
  const [group, action, subAction] = parsed.positionals, cliVersion = getInstalledCliVersion();
10949
10832
  let accessToken;
10950
10833
  const ensureAuthentication = __name2(async () => {
@@ -10978,7 +10861,13 @@ nd ipAddress. Totals are in device-issues counts. Holds names and device details
10978
10861
  }, "runCommand"), runCli = __name2(async (args, runtime = processRuntime, credentialStore = createBunCredentialStore({ product: "event-tech" }), configureAccessToken = configureEventTechAccessToken) => {
10979
10862
  try {
10980
10863
  const parsed = parseArguments(args), apiUrl = getOptionalFlag(parsed, "api-url");
10981
- return apiUrl ? configureEventTechApiBaseUrl(apiUrl) : configureEventTechApiFromEnvironment(), await runCommand(parsed, runtime, credentialStore, getEventTechApiBaseUrl(), configureAccessToken), 0;
10864
+ return apiUrl ? configureEventTechApiBaseUrl(apiUrl) : configureEventTechApiFromEnvironment(), await runCommand(
10865
+ parsed,
10866
+ runtime,
10867
+ credentialStore,
10868
+ getEventTechApiBaseUrl(),
10869
+ configureAccessToken
10870
+ ), 0;
10982
10871
  } catch (error2) {
10983
10872
  return writeError(runtime, error2), error2 instanceof CliUsageError ? 2 : 1;
10984
10873
  }