@go-labs-sg/event-tech 1.12.0 → 1.14.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 +20 -2
  2. package/dist/index.js +65 -22
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -326,8 +326,26 @@ et passport station image-clear --event-id <id> --station-id <id>
326
326
 
327
327
  `image-set` uploads to the event's station-art folder and saves the key, keeping
328
328
  every other station setting and the collection mode. `image-clear` removes it.
329
- A new `imageKey` passed through `station upsert` must also be an upload to this
330
- event's `event-passport/stations` folder; an unchanged key always passes.
329
+ `station upsert` keeps the stored cover art when `--station-json` omits
330
+ `imageKey`, so an upsert after `image-set` does not remove the image; pass
331
+ `null` to clear it. A new `imageKey` passed through `station upsert` must also
332
+ be an upload to this event's `event-passport/stations` folder; an unchanged key
333
+ always passes.
334
+
335
+ Prize photos use the prize's optional `imageKey`, with the same flow and limits:
336
+
337
+ ```sh
338
+ et passport prize image-set --event-id <id> --prize-id <id> --file ./prize.jpg --content-type image/jpeg
339
+ et passport prize image-clear --event-id <id> --prize-id <id>
340
+ ```
341
+
342
+ `image-set` uploads to the event's prize folder (`event-passport/prizes`) and
343
+ saves the key, keeping the prize's name, description, stock, `stampCost` and
344
+ order. `image-clear` removes the photo, and guests see the gift illustration
345
+ again. `prize upsert` accepts `imageKey` in `--prize-json`: omit it to keep the
346
+ stored photo, pass `null` to clear it. A new key must be an upload to this
347
+ event's `event-passport/prizes` folder; an unchanged key always passes. `overview`
348
+ returns `imageKey` and a signed `imageUrl` for each prize.
331
349
 
332
350
  ### Deprecated event types
333
351
 
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>
@@ -18971,6 +18980,7 @@ Event Passport:
18971
18980
  collection.category groups stations for guests: GAME, FOOD, DRINK or BINGO. Omit it to keep the stored one.
18972
18981
  Omit collection on an existing station to preserve its current mode.
18973
18982
  Station JSON supports id/name/description/location/address/imageKey/order/opensAt/closesAt/collection.
18983
+ imageKey is the cover art: omit it to keep the stored image, null clears it.
18974
18984
  location is the in-venue spot ("Level 2 pantry"); address is the street or site address (up to 300 chars, null clears it, omit keeps it).
18975
18985
  Station links: one shared password per passport lets staff without accounts open /events/<id>/event-passport/station,
18976
18986
  pick a station and stamp guests. station-access get shows whether a password is set and how many station sessions are
@@ -18981,6 +18991,9 @@ Event Passport:
18981
18991
  Station cover art: image-set uploads a jpeg/png/webp/gif (up to 25 MB) to the event's station-art folder and
18982
18992
  saves it as the station's imageKey, keeping every other station setting; image-clear removes it. A new
18983
18993
  imageKey given in station JSON must be an upload to this event's event-passport/stations folder.
18994
+ 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
18995
+ saves it as the prize's imageKey, keeping every other prize setting; image-clear removes it (guests then see the gift
18996
+ illustration). A new imageKey given in prize JSON must be an upload to this event's event-passport/prizes folder.
18984
18997
  Passport skin (optional per-event look; no skin renders the Go Labs default): lives in the event
18985
18998
  appearance as the optional passport block {heroImage:{key,focalX,focalY}|null, logo:{key}|null,
18986
18999
  colors:{graphic,dark}, emphasis:accent|ink}. skin get reads it with the version and image URLs.
@@ -19812,7 +19825,7 @@ var passportStationSchema = passportEventIdSchema.extend({
19812
19825
  description: string2().trim().max(1000).nullable(),
19813
19826
  location: string2().trim().max(200).nullable(),
19814
19827
  address: string2().trim().max(300).nullable().optional(),
19815
- imageKey: string2().nullable(),
19828
+ imageKey: string2().nullable().optional(),
19816
19829
  order: number2().int().min(0),
19817
19830
  opensAt: date2().nullable(),
19818
19831
  closesAt: date2().nullable(),
@@ -19822,6 +19835,7 @@ var passportPrizeSchema = passportEventIdSchema.extend({
19822
19835
  id: string2().optional(),
19823
19836
  name: string2().trim().min(1).max(100),
19824
19837
  description: string2().trim().max(1000).nullable(),
19838
+ imageKey: string2().max(2048).nullable().optional(),
19825
19839
  stock: number2().int().min(0),
19826
19840
  stampCost: number2().int().min(0).max(PASSPORT_PRIZE_STAMP_COST_MAX).optional(),
19827
19841
  order: number2().int().min(0)
@@ -20312,18 +20326,38 @@ var setStationImage = async (eventId, stationId, imageKey) => {
20312
20326
  closesAt: station.closesAt
20313
20327
  });
20314
20328
  };
20315
- var createStationImageOperation = (subcommand, { eventId, flags, allowed }) => {
20329
+ var setPrizeImage = async (eventId, prizeId, imageKey) => {
20330
+ const overview = await api2.event.passport.getPassportOverview.query({
20331
+ eventId
20332
+ });
20333
+ const prize = overview.prizes.find((item) => item.id === prizeId);
20334
+ if (!prize)
20335
+ throw new CliUsageError("Prize not found for this event.");
20336
+ return api2.event.passport.upsertPassportPrize.mutate({
20337
+ eventId,
20338
+ id: prize.id,
20339
+ name: prize.name,
20340
+ description: prize.description,
20341
+ imageKey: imageKey ? await imageKey() : null,
20342
+ stock: prize.stock,
20343
+ stampCost: prize.stampCost,
20344
+ order: prize.order
20345
+ });
20346
+ };
20347
+ var createImageOperation = (resource, subcommand, { eventId, flags, allowed }) => {
20316
20348
  if (subcommand !== "image-set" && subcommand !== "image-clear")
20317
20349
  return null;
20318
- allowed.push("station-id");
20319
- const stationId = requiredValue(flags, "station-id");
20350
+ const idFlag = `${resource}-id`;
20351
+ allowed.push(idFlag);
20352
+ const id = requiredValue(flags, idFlag);
20353
+ const save = (imageKey) => resource === "station" ? setStationImage(eventId, id, imageKey) : setPrizeImage(eventId, id, imageKey);
20320
20354
  if (subcommand === "image-clear")
20321
- return () => setStationImage(eventId, stationId, null);
20355
+ return () => save(null);
20322
20356
  allowed.push("file", "content-type");
20323
20357
  requiredValue(flags, "file");
20324
20358
  requiredValue(flags, "content-type");
20325
- return () => setStationImage(eventId, stationId, async () => {
20326
- const signed = await uploadPassportImage(eventId, "stations", flags);
20359
+ return () => save(async () => {
20360
+ const signed = await uploadPassportImage(eventId, resource === "station" ? "stations" : "prizes", flags);
20327
20361
  return signed.key;
20328
20362
  });
20329
20363
  };
@@ -20331,8 +20365,8 @@ var createPassportMediaOperation = (action, context) => {
20331
20365
  const [first, second] = action.split(" ");
20332
20366
  if (first === "skin" && second)
20333
20367
  return createSkinOperation(second, context);
20334
- if (first === "station" && second)
20335
- return createStationImageOperation(second, context);
20368
+ if ((first === "station" || first === "prize") && second)
20369
+ return createImageOperation(first, second, context);
20336
20370
  return null;
20337
20371
  };
20338
20372
 
@@ -20496,7 +20530,7 @@ var parsePassportStationInput = (raw, eventId) => {
20496
20530
  description: nullableText(value.description, "description", 1000),
20497
20531
  location: nullableText(value.location, "location", 200),
20498
20532
  ...value.address === undefined ? {} : { address: nullableText(value.address, "address", 300) },
20499
- imageKey: nullableText(value.imageKey, "imageKey", 2048),
20533
+ ...value.imageKey === undefined ? {} : { imageKey: nullableText(value.imageKey, "imageKey", 2048) },
20500
20534
  order: integer2(value.order ?? 0, "order"),
20501
20535
  opensAt: date3(value.opensAt, "opensAt"),
20502
20536
  closesAt: date3(value.closesAt, "closesAt"),
@@ -20832,12 +20866,21 @@ var runPassportCommand = async (input) => {
20832
20866
  case "prize upsert": {
20833
20867
  allowed.push("prize-json");
20834
20868
  const value = json(requiredFlag(flags, "prize-json"), "--prize-json");
20835
- keys(value, ["id", "name", "description", "stock", "stampCost", "order"], "Prize");
20869
+ keys(value, [
20870
+ "id",
20871
+ "name",
20872
+ "description",
20873
+ "imageKey",
20874
+ "stock",
20875
+ "stampCost",
20876
+ "order"
20877
+ ], "Prize");
20836
20878
  const payload = {
20837
20879
  eventId,
20838
20880
  ...optionalEntry("id", value.id, (raw) => text(raw, "id", 200)),
20839
20881
  name: text(value.name, "name", 100),
20840
20882
  description: nullableText(value.description, "description", 1000),
20883
+ ...optionalEntry("imageKey", value.imageKey, (raw) => nullableText(raw, "imageKey", 2048)),
20841
20884
  stock: integer2(value.stock, "stock"),
20842
20885
  ...optionalEntry("stampCost", value.stampCost, (raw) => integer2(raw, "stampCost", 0, 1e5)),
20843
20886
  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.14.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",