@go-labs-sg/event-tech 1.12.0 → 1.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +15 -0
  2. package/dist/index.js +62 -20
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -329,6 +329,21 @@ every other station setting and the collection mode. `image-clear` removes it.
329
329
  A new `imageKey` passed through `station upsert` must also be an upload to this
330
330
  event's `event-passport/stations` folder; an unchanged key always passes.
331
331
 
332
+ Prize photos use the prize's optional `imageKey`, with the same flow and limits:
333
+
334
+ ```sh
335
+ et passport prize image-set --event-id <id> --prize-id <id> --file ./prize.jpg --content-type image/jpeg
336
+ et passport prize image-clear --event-id <id> --prize-id <id>
337
+ ```
338
+
339
+ `image-set` uploads to the event's prize folder (`event-passport/prizes`) and
340
+ saves the key, keeping the prize's name, description, stock, `stampCost` and
341
+ order. `image-clear` removes the photo, and guests see the gift illustration
342
+ again. `prize upsert` accepts `imageKey` in `--prize-json`: omit it to keep the
343
+ stored photo, pass `null` to clear it. A new key must be an upload to this
344
+ event's `event-passport/prizes` folder; an unchanged key always passes. `overview`
345
+ returns `imageKey` and a signed `imageUrl` for each prize.
346
+
332
347
  ### Deprecated event types
333
348
 
334
349
  Scavenger Hunt (Amazing Race) and Gardens by the Bay are deprecated and frozen.
package/dist/index.js CHANGED
@@ -9352,7 +9352,7 @@ var require_lib3 = __commonJS(function(exports, module) {
9352
9352
  module.exports = JSZip;
9353
9353
  });
9354
9354
 
9355
- // ../../../node_modules/.bun/papaparse@5.7.0/node_modules/papaparse/papaparse.js
9355
+ // ../../../node_modules/.bun/papaparse@5.7.1/node_modules/papaparse/papaparse.js
9356
9356
  var require_papaparse = __commonJS(function(exports, module) {
9357
9357
  (function(root, factory) {
9358
9358
  if (typeof define === "function" && define.amd) {
@@ -9479,7 +9479,9 @@ var require_papaparse = __commonJS(function(exports, module) {
9479
9479
  if (typeof _input === "string")
9480
9480
  _input = JSON.parse(_input);
9481
9481
  if (Array.isArray(_input)) {
9482
- if (!_input.length || Array.isArray(_input[0]))
9482
+ if (!_input.length)
9483
+ return serialize(_columns, _input, _skipEmptyLines);
9484
+ else if (Array.isArray(_input[0]))
9483
9485
  return serialize(null, _input, _skipEmptyLines);
9484
9486
  else if (typeof _input[0] === "object")
9485
9487
  return serialize(_columns || Object.keys(_input[0]), _input, _skipEmptyLines);
@@ -9553,7 +9555,7 @@ var require_papaparse = __commonJS(function(exports, module) {
9553
9555
  var emptyLine = false;
9554
9556
  var nullLine = hasHeader ? Object.keys(data[row]).length === 0 : data[row].length === 0;
9555
9557
  if (skipEmptyLines && !hasHeader) {
9556
- emptyLine = skipEmptyLines === "greedy" ? data[row].join("").trim() === "" : data[row].length === 1 && data[row][0].length === 0;
9558
+ emptyLine = skipEmptyLines === "greedy" ? data[row].join("").trim() === "" : data[row].length === 1 && (data[row][0] === null || data[row][0] === undefined || data[row][0].length === 0);
9557
9559
  }
9558
9560
  if (skipEmptyLines === "greedy" && hasHeader) {
9559
9561
  var line = [];
@@ -9586,11 +9588,12 @@ var require_papaparse = __commonJS(function(exports, module) {
9586
9588
  return str.toISOString();
9587
9589
  }
9588
9590
  var needsQuotes = false;
9589
- if (_escapeFormulae && typeof str === "string" && _escapeFormulae.test(str)) {
9590
- str = "'" + str;
9591
+ var strValue = str.toString();
9592
+ if (_escapeFormulae && typeof str !== "number" && typeof str !== "bigint" && typeof str !== "boolean" && _escapeFormulae.test(strValue)) {
9593
+ strValue = "'" + strValue;
9594
+ str = strValue;
9591
9595
  needsQuotes = true;
9592
9596
  }
9593
- var strValue = str.toString();
9594
9597
  var escapedQuoteStr = strValue.replace(quoteCharRegex, _escapedQuote);
9595
9598
  needsQuotes = needsQuotes || _quotes === true || typeof _quotes === "function" && _quotes(str, col) || Array.isArray(_quotes) && _quotes[col] || hasAny(escapedQuoteStr, Papa.BAD_DELIMITERS) || escapedQuoteStr.indexOf(_delimiter) > -1 || strValue.indexOf(_quoteChar) > -1 || escapedQuoteStr.charAt(0) === " " || escapedQuoteStr.charAt(escapedQuoteStr.length - 1) === " ";
9596
9599
  return needsQuotes ? _quoteChar + escapedQuoteStr + _quoteChar : escapedQuoteStr;
@@ -10375,15 +10378,18 @@ var require_papaparse = __commonJS(function(exports, module) {
10375
10378
  if (input[quoteSearch + 1 + spacesBetweenQuoteAndDelimiter + delimLen] !== quoteChar) {
10376
10379
  quoteSearch = input.indexOf(quoteChar, cursor);
10377
10380
  }
10378
- nextDelim = input.indexOf(delim, cursor);
10379
- nextNewline = input.indexOf(newline, cursor);
10381
+ if (nextDelim !== -1 && nextDelim < cursor)
10382
+ nextDelim = input.indexOf(delim, cursor);
10383
+ if (nextNewline !== -1 && nextNewline < cursor)
10384
+ nextNewline = input.indexOf(newline, cursor);
10380
10385
  break;
10381
10386
  }
10382
10387
  var spacesBetweenQuoteAndNewLine = extraSpaces(nextNewline);
10383
10388
  if (input.substring(quoteSearch + 1 + spacesBetweenQuoteAndNewLine, quoteSearch + 1 + spacesBetweenQuoteAndNewLine + newlineLen) === newline) {
10384
10389
  row.push(input.substring(cursor, quoteSearch).replace(quoteCharRegex, quoteChar));
10385
10390
  saveRow(quoteSearch + 1 + spacesBetweenQuoteAndNewLine + newlineLen);
10386
- nextDelim = input.indexOf(delim, cursor);
10391
+ if (nextDelim !== -1 && nextDelim < cursor)
10392
+ nextDelim = input.indexOf(delim, cursor);
10387
10393
  quoteSearch = input.indexOf(quoteChar, cursor);
10388
10394
  if (stepIsFunction) {
10389
10395
  doStep();
@@ -10411,7 +10417,8 @@ var require_papaparse = __commonJS(function(exports, module) {
10411
10417
  return returnable();
10412
10418
  cursor = nextNewline + newlineLen;
10413
10419
  nextNewline = input.indexOf(newline, cursor);
10414
- nextDelim = input.indexOf(delim, cursor);
10420
+ if (nextDelim !== -1 && nextDelim < cursor)
10421
+ nextDelim = input.indexOf(delim, cursor);
10415
10422
  continue;
10416
10423
  }
10417
10424
  if (nextDelim !== -1 && (nextDelim < nextNewline || nextNewline === -1)) {
@@ -18948,7 +18955,9 @@ Usage:
18948
18955
  et passport participant search --event-id <id> [--query <text>]
18949
18956
  et passport participant detail --event-id <id> --participant-id <id>
18950
18957
  et passport stamp correct --event-id <id> --station-id <id> --participant-id <id> --stamped <true|false> --reason <text> [--points <n>] --allow-state-change --target <same-event-id>
18951
- et passport prize upsert --event-id <id> --prize-json <json> (stampCost: stamps per unit, default 0)
18958
+ et passport prize upsert --event-id <id> --prize-json <json> (stampCost: stamps per unit, default 0; imageKey: omit keeps the photo, null clears it)
18959
+ et passport prize image-set --event-id <id> --prize-id <id> --file <path> --content-type <image-mime>
18960
+ et passport prize image-clear --event-id <id> --prize-id <id>
18952
18961
  et passport prize archive --event-id <id> --prize-id <id> --allow-state-change --target <same-event-id>
18953
18962
  et passport redemption create --event-id <id> --participant-id <id> --prize-id <id> [--quantity <1-20>]
18954
18963
  et passport redemption reverse --event-id <id> --redemption-id <id> --reason <text> --allow-state-change --target <same-event-id>
@@ -18981,6 +18990,9 @@ Event Passport:
18981
18990
  Station cover art: image-set uploads a jpeg/png/webp/gif (up to 25 MB) to the event's station-art folder and
18982
18991
  saves it as the station's imageKey, keeping every other station setting; image-clear removes it. A new
18983
18992
  imageKey given in station JSON must be an upload to this event's event-passport/stations folder.
18993
+ Prize photos work the same way: prize image-set uploads a jpeg/png/webp/gif (up to 25 MB) to the event's prize folder and
18994
+ saves it as the prize's imageKey, keeping every other prize setting; image-clear removes it (guests then see the gift
18995
+ illustration). A new imageKey given in prize JSON must be an upload to this event's event-passport/prizes folder.
18984
18996
  Passport skin (optional per-event look; no skin renders the Go Labs default): lives in the event
18985
18997
  appearance as the optional passport block {heroImage:{key,focalX,focalY}|null, logo:{key}|null,
18986
18998
  colors:{graphic,dark}, emphasis:accent|ink}. skin get reads it with the version and image URLs.
@@ -19822,6 +19834,7 @@ var passportPrizeSchema = passportEventIdSchema.extend({
19822
19834
  id: string2().optional(),
19823
19835
  name: string2().trim().min(1).max(100),
19824
19836
  description: string2().trim().max(1000).nullable(),
19837
+ imageKey: string2().max(2048).nullable().optional(),
19825
19838
  stock: number2().int().min(0),
19826
19839
  stampCost: number2().int().min(0).max(PASSPORT_PRIZE_STAMP_COST_MAX).optional(),
19827
19840
  order: number2().int().min(0)
@@ -20312,18 +20325,38 @@ var setStationImage = async (eventId, stationId, imageKey) => {
20312
20325
  closesAt: station.closesAt
20313
20326
  });
20314
20327
  };
20315
- var createStationImageOperation = (subcommand, { eventId, flags, allowed }) => {
20328
+ var setPrizeImage = async (eventId, prizeId, imageKey) => {
20329
+ const overview = await api2.event.passport.getPassportOverview.query({
20330
+ eventId
20331
+ });
20332
+ const prize = overview.prizes.find((item) => item.id === prizeId);
20333
+ if (!prize)
20334
+ throw new CliUsageError("Prize not found for this event.");
20335
+ return api2.event.passport.upsertPassportPrize.mutate({
20336
+ eventId,
20337
+ id: prize.id,
20338
+ name: prize.name,
20339
+ description: prize.description,
20340
+ imageKey: imageKey ? await imageKey() : null,
20341
+ stock: prize.stock,
20342
+ stampCost: prize.stampCost,
20343
+ order: prize.order
20344
+ });
20345
+ };
20346
+ var createImageOperation = (resource, subcommand, { eventId, flags, allowed }) => {
20316
20347
  if (subcommand !== "image-set" && subcommand !== "image-clear")
20317
20348
  return null;
20318
- allowed.push("station-id");
20319
- const stationId = requiredValue(flags, "station-id");
20349
+ const idFlag = `${resource}-id`;
20350
+ allowed.push(idFlag);
20351
+ const id = requiredValue(flags, idFlag);
20352
+ const save = (imageKey) => resource === "station" ? setStationImage(eventId, id, imageKey) : setPrizeImage(eventId, id, imageKey);
20320
20353
  if (subcommand === "image-clear")
20321
- return () => setStationImage(eventId, stationId, null);
20354
+ return () => save(null);
20322
20355
  allowed.push("file", "content-type");
20323
20356
  requiredValue(flags, "file");
20324
20357
  requiredValue(flags, "content-type");
20325
- return () => setStationImage(eventId, stationId, async () => {
20326
- const signed = await uploadPassportImage(eventId, "stations", flags);
20358
+ return () => save(async () => {
20359
+ const signed = await uploadPassportImage(eventId, resource === "station" ? "stations" : "prizes", flags);
20327
20360
  return signed.key;
20328
20361
  });
20329
20362
  };
@@ -20331,8 +20364,8 @@ var createPassportMediaOperation = (action, context) => {
20331
20364
  const [first, second] = action.split(" ");
20332
20365
  if (first === "skin" && second)
20333
20366
  return createSkinOperation(second, context);
20334
- if (first === "station" && second)
20335
- return createStationImageOperation(second, context);
20367
+ if ((first === "station" || first === "prize") && second)
20368
+ return createImageOperation(first, second, context);
20336
20369
  return null;
20337
20370
  };
20338
20371
 
@@ -20832,12 +20865,21 @@ var runPassportCommand = async (input) => {
20832
20865
  case "prize upsert": {
20833
20866
  allowed.push("prize-json");
20834
20867
  const value = json(requiredFlag(flags, "prize-json"), "--prize-json");
20835
- keys(value, ["id", "name", "description", "stock", "stampCost", "order"], "Prize");
20868
+ keys(value, [
20869
+ "id",
20870
+ "name",
20871
+ "description",
20872
+ "imageKey",
20873
+ "stock",
20874
+ "stampCost",
20875
+ "order"
20876
+ ], "Prize");
20836
20877
  const payload = {
20837
20878
  eventId,
20838
20879
  ...optionalEntry("id", value.id, (raw) => text(raw, "id", 200)),
20839
20880
  name: text(value.name, "name", 100),
20840
20881
  description: nullableText(value.description, "description", 1000),
20882
+ ...optionalEntry("imageKey", value.imageKey, (raw) => nullableText(raw, "imageKey", 2048)),
20841
20883
  stock: integer2(value.stock, "stock"),
20842
20884
  ...optionalEntry("stampCost", value.stampCost, (raw) => integer2(raw, "stampCost", 0, 1e5)),
20843
20885
  order: integer2(value.order ?? 0, "order")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@go-labs-sg/event-tech",
3
- "version": "1.12.0",
3
+ "version": "1.13.0",
4
4
  "description": "Event Tech CLI for managing Event Tech resources through the Go Labs API.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",