@go-labs-sg/event-tech 0.12.0 → 1.0.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 +61 -0
  2. package/dist/index.js +233 -140
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -93,6 +93,8 @@ et event appearance update --event-id <id> --appearance-version <n> --appearance
93
93
  et event appearance reset --event-id <id> --appearance-version <n>
94
94
  et event appearance upload --event-id <id> --file ./background.mp4 --media-type video --content-type video/mp4
95
95
  et event photo-wall display-items --event-id <id> --limit 30
96
+ et lucky-draw participants replace --event-id <id> --participants '[{"luckyDrawId":"illustrative-001","name":"Example Person","email":"example@example.test"}]' --allow-state-change --target <id>
97
+ et lucky-draw participants list --event-id <id> --page 1 --per-page 100
96
98
  ```
97
99
 
98
100
  Commands emit deterministic JSON envelopes. Authentication credentials are never included in successful output, and bearer credentials are redacted from errors.
@@ -167,6 +169,65 @@ bun run packages/event-tech/cli/src/index.ts help
167
169
 
168
170
  Building is not publication or permission to mutate live data. Use focused temporary business-behavior tests and the final pre-push gate from the shared workflow. Use this package's actual scripts; do not assume it has a command-artifact generator.
169
171
 
172
+ ## Lucky draw participant source import
173
+
174
+ The participant import is an API-first rollout: use a deployment that includes
175
+ the replacement/readback API. It replaces the source-imported roster; it does
176
+ not append rows and does not evaluate eligibility, produce results, or discover
177
+ a draw. `pre-draw` commits winners, so do not use it for discovery.
178
+
179
+ Supply one JSON array either inline or from a file (the file form avoids roster
180
+ values in shell history). The identities in this example are illustrative only:
181
+
182
+ ```sh
183
+ et lucky-draw participants replace \
184
+ --event-id event-123 \
185
+ --participants-file ./illustrative-participants.json \
186
+ --allow-state-change \
187
+ --target event-123
188
+ ```
189
+
190
+ ```json
191
+ [
192
+ {
193
+ "luckyDrawId": "illustrative-001",
194
+ "name": "Example Person",
195
+ "email": "example@example.test"
196
+ }
197
+ ]
198
+ ```
199
+
200
+ `--allow-state-change` must be a bare, explicit acknowledgement, and `--target`
201
+ must exactly match `--event-id`; the CLI rejects either guard before accessing
202
+ native credentials or calling the API. The CLI does not trim or normalize IDs;
203
+ the API validates the roster: it must contain 1–20,000 participants, and
204
+ source IDs must be nonblank and unique as exact strings. The API also enforces name/email limits
205
+ and applies the replacement in one transaction.
206
+
207
+ The authenticated caller needs `event.setup`. The successful replacement
208
+ envelope preserves the API's additive readback:
209
+ `participants { id, luckyDrawId, name, email, luckyDrawPrizeId }`, plus a
210
+ `summary { added, updated, removed, unchanged, total, replay }` and a matching
211
+ human-readable `message`. Repeating an
212
+ unchanged import changes no participant rows and preserves participant row IDs
213
+ (it records one `lucky_draw_participants_replayed` activity-log entry). If any prize is
214
+ already assigned, including one held by a passport-linked or archived
215
+ participant, only the identical current imported roster is accepted.
216
+ Archived and passport-linked identity collisions conflict. This does not claim
217
+ that historical draws are frozen: existing unassign corrections remain
218
+ unchanged.
219
+
220
+ List the roster with the API's paginated readback:
221
+
222
+ ```sh
223
+ et lucky-draw participants list --event-id event-123 --page 1 --per-page 100
224
+ ```
225
+
226
+ `page` defaults to 1 and `per-page` defaults to 100 (range 1–100). Inspect all
227
+ pages: the response preserves `participants`, `pageCount`, and `totalCount`.
228
+ Listing can include passport-linked people outside the imported roster. It does
229
+ not create a draw, mutate it, or perform a pre-draw probe.
230
+
170
231
  ## Lucky draw pre-draw
171
232
 
172
233
  ```sh
package/dist/index.js CHANGED
@@ -35,31 +35,31 @@ var __toESM = (mod, isNodeMode, target) => {
35
35
  var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
36
36
  var __require = import.meta.require;
37
37
 
38
- // ../../../node_modules/.bun/dotenv@18.0.6/node_modules/dotenv/dist/index.cjs
38
+ // ../../../node_modules/.bun/dotenv@18.0.7/node_modules/dotenv/dist/index.cjs
39
39
  var require_dist = __commonJS(function(exports, module) {
40
- var S = (e, o) => () => {
40
+ var k = (e, n) => () => {
41
41
  try {
42
- return o || e((o = { exports: {} }).exports, o), o.exports;
42
+ return n || e((n = { exports: {} }).exports, n), n.exports;
43
43
  } catch (t) {
44
- throw o = 0, t;
44
+ throw n = 0, t;
45
45
  }
46
46
  };
47
- var j = S((xe, U) => {
47
+ var I = k((xe, U) => {
48
48
  function G(e) {
49
49
  return typeof e == "string" ? !["false", "0", "no", "off", ""].includes(e.toLowerCase()) : !!e;
50
50
  }
51
- function X(e = process.env) {
52
- let o = {};
51
+ function Y(e = process.env) {
52
+ let n = {};
53
53
  for (let t of ["ENCODING", "PATH", "QUIET", "DEBUG", "OVERRIDE", "FAST"]) {
54
- let n = e[`DOTENV_${t}`] != null ? e[`DOTENV_${t}`] : e[`DOTENV_CONFIG_${t}`];
55
- n != null && (o[t.toLowerCase()] = t === "ENCODING" || t === "PATH" ? n : G(n));
54
+ let o = e[`DOTENV_${t}`] != null ? e[`DOTENV_${t}`] : e[`DOTENV_CONFIG_${t}`];
55
+ o != null && (n[t.toLowerCase()] = t === "ENCODING" || t === "PATH" ? o : G(o));
56
56
  }
57
- return o;
57
+ return n;
58
58
  }
59
- U.exports = { parseBoolean: G, optionsFromEnv: X };
59
+ U.exports = { parseBoolean: G, optionsFromEnv: Y };
60
60
  });
61
- var N = S((ye, x) => {
62
- var Y = __require("fs"), k = __require("path"), z = __require("os"), { URL: Z, fileURLToPath: ee } = __require("url"), { parseBoolean: $, optionsFromEnv: B } = j(), te = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg, b = new Uint8Array(256);
61
+ var N = k((ye, x) => {
62
+ var z = __require("fs"), S = __require("path"), Z = __require("os"), { URL: ee, fileURLToPath: te } = __require("url"), { parseBoolean: $, optionsFromEnv: B } = I(), re = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg, b = new Uint8Array(256);
63
63
  for (let e = 48;e <= 57; e++)
64
64
  b[e] = 1;
65
65
  for (let e = 65;e <= 90; e++)
@@ -69,92 +69,92 @@ var require_dist = __commonJS(function(exports, module) {
69
69
  b[45] = 1;
70
70
  b[46] = 1;
71
71
  b[95] = 1;
72
- function re(e) {
73
- let o = {}, t = e.toString();
72
+ function ne(e) {
73
+ let n = {}, t = e.toString();
74
74
  t = t.replace(/\r\n?/mg, `
75
75
  `);
76
- let n;
77
- for (;(n = te.exec(t)) != null; ) {
78
- let r = n[1], s = n[2] || "";
76
+ let o;
77
+ for (;(o = re.exec(t)) != null; ) {
78
+ let r = o[1], s = o[2] || "";
79
79
  s = s.trim();
80
80
  let i = s[0];
81
81
  s = s.replace(/^(['"`])([\s\S]*)\1$/mg, "$2"), i === '"' && (s = s.replace(/\\n/g, `
82
- `), s = s.replace(/\\r/g, "\r")), o[r] = s;
82
+ `), s = s.replace(/\\r/g, "\r")), n[r] = s;
83
83
  }
84
- return o;
84
+ return n;
85
85
  }
86
86
  function w(e) {
87
87
  return e <= 32 ? e === 32 || e >= 9 && e <= 13 : e >= 160 && (e === 160 || e === 5760 || e >= 8192 && e <= 8202 || e === 8232 || e === 8233 || e === 8239 || e === 8287 || e === 12288 || e === 65279);
88
88
  }
89
- function O(e) {
89
+ function q(e) {
90
90
  return e === 10 || e === 8232 || e === 8233;
91
91
  }
92
92
  function oe(e) {
93
- let o = {}, t = typeof e == "string" ? e : e.toString();
93
+ let n = {}, t = typeof e == "string" ? e : e.toString();
94
94
  t.indexOf("\r") !== -1 && (t = t.replace(/\r\n?/g, `
95
95
  `));
96
- let n = t.length, r = 0;
97
- for (;r < n; ) {
96
+ let o = t.length, r = 0;
97
+ for (;r < o; ) {
98
98
  let s = t.charCodeAt(r);
99
- for (;r < n && w(s); )
99
+ for (;r < o && w(s); )
100
100
  r++, s = t.charCodeAt(r);
101
- if (r >= n)
101
+ if (r >= o)
102
102
  break;
103
103
  if (s === 35) {
104
- for (;r < n && !O(t.charCodeAt(r)); )
104
+ for (;r < o && !q(t.charCodeAt(r)); )
105
105
  r++;
106
106
  continue;
107
107
  }
108
108
  let i = -1;
109
- if (s === 101 && r + 6 < n && t.charCodeAt(r + 1) === 120 && t.charCodeAt(r + 2) === 112 && t.charCodeAt(r + 3) === 111 && t.charCodeAt(r + 4) === 114 && t.charCodeAt(r + 5) === 116) {
109
+ if (s === 101 && r + 6 < o && t.charCodeAt(r + 1) === 120 && t.charCodeAt(r + 2) === 112 && t.charCodeAt(r + 3) === 111 && t.charCodeAt(r + 4) === 114 && t.charCodeAt(r + 5) === 116) {
110
110
  let v = t.charCodeAt(r + 6);
111
111
  if (w(v)) {
112
112
  let u = r + 7;
113
- for (;u < n && w(t.charCodeAt(u)); )
113
+ for (;u < o && w(t.charCodeAt(u)); )
114
114
  u++;
115
115
  b[t.charCodeAt(u)] && (i = r + 6, r = u);
116
116
  } else
117
117
  s = t.charCodeAt(r);
118
118
  }
119
119
  let l = r, d = 0;
120
- for (;r < n && (d = t.charCodeAt(r), b[d]); )
120
+ for (;r < o && (d = t.charCodeAt(r), b[d]); )
121
121
  r++;
122
122
  if (r === l) {
123
- for (;r < n && !O(t.charCodeAt(r)); )
123
+ for (;r < o && !q(t.charCodeAt(r)); )
124
124
  r++;
125
125
  continue;
126
126
  }
127
127
  let p = t.slice(l, r), f = r;
128
- if (r >= n && (d = 0), w(d))
128
+ if (r >= o && (d = 0), w(d))
129
129
  do
130
- r++, d = r < n ? t.charCodeAt(r) : 0;
130
+ r++, d = r < o ? t.charCodeAt(r) : 0;
131
131
  while (w(d));
132
132
  if (d === 61)
133
133
  r++;
134
- else if (d === 58 && r === f && r + 1 < n && w(t.charCodeAt(r + 1)))
134
+ else if (d === 58 && r === f && r + 1 < o && w(t.charCodeAt(r + 1)))
135
135
  r += 2;
136
136
  else {
137
- for (r = i === -1 ? f : i;r < n && !O(t.charCodeAt(r)); )
137
+ for (r = i === -1 ? f : i;r < o && !q(t.charCodeAt(r)); )
138
138
  r++;
139
139
  continue;
140
140
  }
141
141
  let c = r, a = r;
142
- for (;a < n && w(t.charCodeAt(a)); )
142
+ for (;a < o && w(t.charCodeAt(a)); )
143
143
  a++;
144
- let g = t.charCodeAt(a), h, y = false;
145
- if (g === 39 || g === 34 || g === 96) {
144
+ let h = t.charCodeAt(a), g, y = false;
145
+ if (h === 39 || h === 34 || h === 96) {
146
146
  let v = t[a], u = t.indexOf(v, a + 1), m = -1, C = -1;
147
147
  for (;u !== -1; ) {
148
- let q = t.charCodeAt(u - 1) === 92, E = u + 1;
149
- for (;E < n && !O(t.charCodeAt(E)) && w(t.charCodeAt(E)); )
148
+ let O = t.charCodeAt(u - 1) === 92, E = u + 1;
149
+ for (;E < o && !q(t.charCodeAt(E)) && w(t.charCodeAt(E)); )
150
150
  E++;
151
- if ((E === n || O(t.charCodeAt(E)) || t.charCodeAt(E) === 35) && (m = u, C = E), !q)
151
+ if ((E === o || q(t.charCodeAt(E)) || t.charCodeAt(E) === 35) && (m = u, C = E), !O)
152
152
  break;
153
153
  u = t.indexOf(v, u + 1);
154
154
  }
155
155
  if (m !== -1) {
156
- if (h = t.slice(a + 1, m), r = C, t.charCodeAt(r) === 35)
157
- for (;r < n && !O(t.charCodeAt(r)); )
156
+ if (g = t.slice(a + 1, m), r = C, t.charCodeAt(r) === 35)
157
+ for (;r < o && !q(t.charCodeAt(r)); )
158
158
  r++;
159
159
  y = true;
160
160
  }
@@ -162,9 +162,9 @@ var require_dist = __commonJS(function(exports, module) {
162
162
  if (!y) {
163
163
  let v = t.indexOf(`
164
164
  `, c);
165
- v === -1 && (v = n);
165
+ v === -1 && (v = o);
166
166
  let u;
167
- if (n < 4096)
167
+ if (o < 4096)
168
168
  u = t.indexOf("#", c), (u === -1 || u > v) && (u = v);
169
169
  else
170
170
  for (u = c;u < v && t.charCodeAt(u) !== 35; )
@@ -174,38 +174,41 @@ var require_dist = __commonJS(function(exports, module) {
174
174
  m++;
175
175
  for (;C > m && w(t.charCodeAt(C - 1)); )
176
176
  C--;
177
- let q = t.charCodeAt(m);
178
- if (C - m >= 2 && (q === 39 || q === 34 || q === 96) && t.charCodeAt(C - 1) === q ? h = t.slice(m + 1, C - 1) : h = t.slice(m, C), r = u, u < v)
179
- for (;r < n && !O(t.charCodeAt(r)); )
177
+ let O = t.charCodeAt(m);
178
+ if (C - m >= 2 && (O === 39 || O === 34 || O === 96) && t.charCodeAt(C - 1) === O ? g = t.slice(m + 1, C - 1) : g = t.slice(m, C), r = u, u < v)
179
+ for (;r < o && !q(t.charCodeAt(r)); )
180
180
  r++;
181
181
  }
182
- g === 34 && (y || a < r) && h.indexOf("\\") !== -1 && (h = h.replace(/\\n/g, `
183
- `).replace(/\\r/g, "\r")), o[p] = h;
182
+ h === 34 && (y || a < r) && g.indexOf("\\") !== -1 && (g = g.replace(/\\n/g, `
183
+ `).replace(/\\r/g, "\r")), n[p] = g;
184
184
  }
185
- return o;
185
+ return n;
186
186
  }
187
- function ne(e, o) {
188
- return o && $(o.fast) ? oe(e) : re(e);
187
+ function se(e, n) {
188
+ return n && $(n.fast) ? oe(e) : ne(e);
189
189
  }
190
190
  function T(e) {
191
191
  console.log(`\u2506 ${e}`);
192
192
  }
193
- function se(e) {
193
+ function ie(e) {
194
194
  console.error(`\u25C7 ${e}`);
195
195
  }
196
196
  function V(e) {
197
- return e[0] === "~" ? k.join(z.homedir(), e.slice(1)) : e;
197
+ return e[0] === "~" ? S.join(Z.homedir(), e.slice(1)) : e;
198
198
  }
199
- function ie(e = {}) {
200
- return { ...B(), ...e };
199
+ function ce(e = {}) {
200
+ let n = { ...e };
201
+ for (let t of Object.keys(n))
202
+ n[t] === undefined && delete n[t];
203
+ return { ...B(), ...n };
201
204
  }
202
- function ce(e) {
203
- e = ie(e);
204
- let o = k.resolve(process.cwd(), ".env"), t = "utf8", n = process.env;
205
- e && e.processEnv != null && (n = e.processEnv);
205
+ function ae(e) {
206
+ e = ce(e);
207
+ let n = S.resolve(process.cwd(), ".env"), t = "utf8", o = process.env;
208
+ e && e.processEnv != null && (o = e.processEnv);
206
209
  let r = $(e && e.debug);
207
210
  e && e.encoding ? t = e.encoding : r && T("no encoding is specified (UTF-8 is used by default)");
208
- let s = [o];
211
+ let s = [n];
209
212
  if (e && e.path)
210
213
  if (!Array.isArray(e.path))
211
214
  s = [V(e.path)];
@@ -217,106 +220,106 @@ var require_dist = __commonJS(function(exports, module) {
217
220
  let i, l = {}, d = { fast: e.fast };
218
221
  for (let c of s)
219
222
  try {
220
- let a = A.parse(Y.readFileSync(c, { encoding: t }), d);
223
+ let a = A.parse(z.readFileSync(c, { encoding: t }), d);
221
224
  A.populate(l, a, e);
222
225
  } catch (a) {
223
226
  r && T(`failed to load ${c} ${a.message}`), i = a;
224
227
  }
225
- let p = A.populate(n, l, e), f = $(Object.prototype.hasOwnProperty.call(e, "quiet") ? e.quiet : B(n).quiet);
228
+ let p = A.populate(o, l, e), f = $(Object.prototype.hasOwnProperty.call(e, "quiet") ? e.quiet : B(o).quiet);
226
229
  if (r || !f) {
227
230
  let c = Object.keys(p).length, a = [];
228
- for (let g of s)
231
+ for (let h of s)
229
232
  try {
230
- let h = k.relative(process.cwd(), g instanceof Z ? ee(g) : g);
231
- a.push(h);
232
- } catch (h) {
233
- r && T(`failed to load ${g} ${h.message}`), i = h;
233
+ let g = S.relative(process.cwd(), h instanceof ee ? te(h) : h);
234
+ a.push(g);
235
+ } catch (g) {
236
+ r && T(`failed to load ${h} ${g.message}`), i = g;
234
237
  }
235
- se(`injected env (${c}) from ${a.join(",")}`);
238
+ ie(`injected env (${c}) from ${a.join(",")}`);
236
239
  }
237
240
  return i ? { parsed: l, error: i } : { parsed: l };
238
241
  }
239
- function ae(e) {
242
+ function le(e) {
240
243
  return A.configDotenv(e);
241
244
  }
242
- function le(e, o, t = {}) {
243
- let n = $(t && t.debug), r = $(t && t.override), s = {};
244
- if (e === null || typeof e != "object" || o === null || typeof o != "object") {
245
+ function fe(e, n, t = {}) {
246
+ let o = $(t && t.debug), r = $(t && t.override), s = {};
247
+ if (e === null || typeof e != "object" || n === null || typeof n != "object") {
245
248
  let i = new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");
246
249
  throw i.code = "OBJECT_REQUIRED", i;
247
250
  }
248
- for (let i of Object.keys(o))
249
- Object.prototype.hasOwnProperty.call(e, i) ? (r === true && (e[i] = o[i], s[i] = o[i]), n && T(r === true ? `"${i}" is already defined and WAS overwritten` : `"${i}" is already defined and was NOT overwritten`)) : (e[i] = o[i], s[i] = o[i]);
251
+ for (let i of Object.keys(n))
252
+ Object.prototype.hasOwnProperty.call(e, i) ? (r === true && (e[i] = n[i], s[i] = n[i]), o && T(r === true ? `"${i}" is already defined and WAS overwritten` : `"${i}" is already defined and was NOT overwritten`)) : (e[i] = n[i], s[i] = n[i]);
250
253
  return s;
251
254
  }
252
- var A = { configDotenv: ce, config: ae, parse: ne, populate: le };
255
+ var A = { configDotenv: ae, config: le, parse: se, populate: fe };
253
256
  x.exports.configDotenv = A.configDotenv;
254
257
  x.exports.config = A.config;
255
258
  x.exports.parse = A.parse;
256
259
  x.exports.populate = A.populate;
257
260
  x.exports = A;
258
261
  });
259
- var M = S((Te, W) => {
260
- var _ = __require("child_process"), fe = __require("fs"), L = __require("path");
261
- function ue(e) {
262
- let o = ['"'], t = 0;
263
- for (let n of e) {
264
- if (n === "\\") {
262
+ var M = k((Te, W) => {
263
+ var _ = __require("child_process"), ue = __require("fs"), L = __require("path");
264
+ function de(e) {
265
+ let n = ['"'], t = 0;
266
+ for (let o of e) {
267
+ if (o === "\\") {
265
268
  t++;
266
269
  continue;
267
270
  }
268
- n === '"' ? o.push("\\".repeat(t * 2 + 1), '"') : o.push("\\".repeat(t), n), t = 0;
271
+ o === '"' ? n.push("\\".repeat(t * 2 + 1), '"') : n.push("\\".repeat(t), o), t = 0;
269
272
  }
270
- return o.push("\\".repeat(t * 2), '"'), o.join("");
273
+ return n.push("\\".repeat(t * 2), '"'), n.join("");
271
274
  }
272
- function H(e, o = 1) {
273
- for (let t = 0;t < o; t++) {
274
- let n = [];
275
+ function H(e, n = 1) {
276
+ for (let t = 0;t < n; t++) {
277
+ let o = [];
275
278
  for (let r of e) {
276
279
  let s = r.charCodeAt(0), i = s >= 48 && s <= 57 || s >= 65 && s <= 90 || s >= 97 && s <= 122, l = "\\/:._-".includes(r);
277
- !i && !l && s < 128 && n.push("^"), n.push(r);
280
+ !i && !l && s < 128 && o.push("^"), o.push(r);
278
281
  }
279
- e = n.join("");
282
+ e = o.join("");
280
283
  }
281
284
  return e;
282
285
  }
283
- function P(e, o) {
284
- let t = Object.keys(e).reverse().find((n) => n.toUpperCase() === o);
286
+ function P(e, n) {
287
+ let t = Object.keys(e).reverse().find((o) => o.toUpperCase() === n);
285
288
  return t === undefined ? undefined : e[t];
286
289
  }
287
- function de(e, o, t) {
288
- let n = (P(o, "PATHEXT") || ".COM;.EXE;.BAT;.CMD").split(";").filter(Boolean), s = n.some((l) => e.toLowerCase().endsWith(l.toLowerCase())) ? ["", ...n] : [...n, ""], i = /[\\/]/.test(e) ? [t] : [t, ...(P(o, "PATH") || "").split(";")];
290
+ function pe(e, n, t) {
291
+ let o = (P(n, "PATHEXT") || ".COM;.EXE;.BAT;.CMD").split(";").filter(Boolean), s = o.some((l) => e.toLowerCase().endsWith(l.toLowerCase())) ? ["", ...o] : [...o, ""], i = /[\\/]/.test(e) ? [t] : [t, ...(P(n, "PATH") || "").split(";")];
289
292
  for (let l of i)
290
293
  for (let d of s) {
291
294
  let p = L.resolve(t, l.replace(/^"|"$/g, ""), e + d);
292
295
  try {
293
- if (fe.statSync(p).isFile())
296
+ if (ue.statSync(p).isFile())
294
297
  return p;
295
298
  } catch {}
296
299
  }
297
300
  }
298
- function pe(e, o, t) {
301
+ function he(e, n, t) {
299
302
  if (process.platform !== "win32")
300
- return _.spawn(e, o, t);
301
- let n = t.env || process.env, r = de(e, n, t.cwd || process.cwd());
303
+ return _.spawn(e, n, t);
304
+ let o = t.env || process.env, r = pe(e, o, t.cwd || process.cwd());
302
305
  if (r && /\.(?:exe|com)$/i.test(r))
303
- return _.spawn(r, o, t);
306
+ return _.spawn(r, n, t);
304
307
  let s = /\.(?:bat|cmd)$/i.test(r || e), i = [H(L.normalize(r || e))];
305
- for (let d of o)
306
- i.push(H(ue(d), s ? 2 : 1));
308
+ for (let d of n)
309
+ i.push(H(de(d), s ? 2 : 1));
307
310
  let l = i.join(" ");
308
- return _.spawn(P(n, "COMSPEC") || "cmd.exe", ["/d", "/v:off", "/s", "/c", `"${l}"`], { ...t, windowsVerbatimArguments: true });
311
+ return _.spawn(P(o, "COMSPEC") || "cmd.exe", ["/d", "/v:off", "/s", "/c", `"${l}"`], { ...t, windowsVerbatimArguments: true });
309
312
  }
310
- W.exports = pe;
313
+ W.exports = he;
311
314
  });
312
- var K = S(($e, F) => {
313
- var he = __require("fs"), ge = __require("os"), Q = __require("path"), me = __require("child_process"), ve = M(), R = N(), { optionsFromEnv: Ce } = j();
315
+ var X = k(($e, F) => {
316
+ var ge = __require("fs"), me = __require("os"), Q = __require("path"), ve = __require("child_process"), Ce = M(), R = N(), { optionsFromEnv: J } = I();
314
317
  function D() {
315
318
  console.log(["Usage: dotenv run [--help] [-q|--quiet] [--debug] [--override] [--fast] [-f|--file <paths>] [--] <command> [args...]", "", "Run a command with environment variables from a .env file.", "Place dotenv options before the command; all following arguments go to the command.", "", "Options:", " -f, --file <paths> .env paths, comma-separated or repeated (default: .env)", " -q, --quiet suppress the injected env message", " --debug enable debug logging", " --override override existing environment variables", " --fast use the faster character-scanner parser", "", "Environment variables (DOTENV_CONFIG_* names remain as fallbacks):", " DOTENV_PATH, DOTENV_ENCODING, DOTENV_QUIET,", " DOTENV_DEBUG, DOTENV_OVERRIDE,", " DOTENV_FAST"].join(`
316
319
  `));
317
320
  }
318
321
  function we(e) {
319
- let o = [], t = false, n, r, s, i, l = -1;
322
+ let n = [], t = false, o, r, s, i, l = -1;
320
323
  for (let p = 0;p < e.length; p++) {
321
324
  let f = e[p];
322
325
  if (f === "--") {
@@ -326,7 +329,7 @@ var require_dist = __commonJS(function(exports, module) {
326
329
  if (f === "--help" || f === "-h")
327
330
  return { help: true };
328
331
  if (f === "--quiet" || f === "-q") {
329
- n = true;
332
+ o = true;
330
333
  continue;
331
334
  }
332
335
  if (f === "--debug") {
@@ -342,13 +345,13 @@ var require_dist = __commonJS(function(exports, module) {
342
345
  continue;
343
346
  }
344
347
  if (f === "-f" || f === "--file" || f.startsWith("-f=") || f.startsWith("--file=")) {
345
- let c = f.indexOf("="), a = c === -1 ? f : f.slice(0, c), g = c === -1 ? e[++p] : f.slice(c + 1);
346
- if (!g || g === "--")
348
+ let c = f.indexOf("="), a = c === -1 ? f : f.slice(0, c), h = c === -1 ? e[++p] : f.slice(c + 1);
349
+ if (!h || h === "--")
347
350
  return { error: `${a} requires a path` };
348
- let h = g.split(",").map((y) => y.trim()).filter(Boolean);
349
- if (h.length === 0)
351
+ let g = h.split(",").map((y) => y.trim()).filter(Boolean);
352
+ if (g.length === 0)
350
353
  return { error: `${a} requires a path` };
351
- o.push(...h), t = true;
354
+ n.push(...g), t = true;
352
355
  continue;
353
356
  }
354
357
  if (f.startsWith("-"))
@@ -357,36 +360,36 @@ var require_dist = __commonJS(function(exports, module) {
357
360
  break;
358
361
  }
359
362
  let d = l === -1 ? [] : e.slice(l);
360
- return { paths: o, pathSet: t, quiet: n, debug: r, override: s, fast: i, command: d };
363
+ return { paths: n, pathSet: t, quiet: o, debug: r, override: s, fast: i, command: d };
361
364
  }
362
365
  function Ae(e) {
363
- return e[0] === "~" ? Q.join(ge.homedir(), e.slice(1)) : e;
366
+ return e[0] === "~" ? Q.join(me.homedir(), e.slice(1)) : e;
364
367
  }
365
368
  function Ee(e) {
366
- let o = Ce(), t = { encoding: o.encoding || "utf8", quiet: o.quiet === true, debug: o.debug === true, override: o.override === true, fast: o.fast === true, paths: [".env"], defaultPath: true };
367
- return o.path != null && (t.paths = [o.path], t.defaultPath = false), e.pathSet && (t.paths = e.paths, t.defaultPath = false), e.quiet != null && (t.quiet = e.quiet), e.debug != null && (t.debug = e.debug), e.override != null && (t.override = e.override), e.fast != null && (t.fast = e.fast), t;
369
+ let n = J(), t = { encoding: n.encoding || "utf8", quiet: n.quiet, debug: n.debug === true, override: n.override === true, fast: n.fast === true, paths: [".env"], defaultPath: true };
370
+ return n.path != null && (t.paths = [n.path], t.defaultPath = false), e.pathSet && (t.paths = e.paths, t.defaultPath = false), e.quiet != null && (t.quiet = e.quiet), e.debug != null && (t.debug = e.debug), e.override != null && (t.override = e.override), e.fast != null && (t.fast = e.fast), t;
368
371
  }
369
372
  function be(e) {
370
- let o = {}, t = [], n = { override: e.override, debug: e.debug };
373
+ let n = {}, t = [], o = { override: e.override, debug: e.debug };
371
374
  for (let s of e.paths) {
372
375
  let i = Q.resolve(process.cwd(), Ae(s));
373
376
  try {
374
- let l = R.parse(he.readFileSync(i, { encoding: e.encoding }), { fast: e.fast });
375
- R.populate(o, l, n), t.push(s);
377
+ let l = R.parse(ge.readFileSync(i, { encoding: e.encoding }), { fast: e.fast });
378
+ R.populate(n, l, o), t.push(s);
376
379
  } catch (l) {
377
380
  if (e.debug && console.log(`\u2506 failed to load ${s} ${l.message}`), !(e.defaultPath && l.code === "ENOENT"))
378
381
  throw l;
379
382
  }
380
383
  }
381
- return { injected: R.populate(process.env, o, n), loadedPaths: t };
384
+ return { injected: R.populate(process.env, n, o), loadedPaths: t };
382
385
  }
383
- function J(e) {
384
- let o = e[0];
385
- if (o === "--help" || o === "-h") {
386
+ function K(e) {
387
+ let n = e[0];
388
+ if (n === "--help" || n === "-h") {
386
389
  D();
387
390
  return;
388
391
  }
389
- if (o !== "run") {
392
+ if (n !== "run") {
390
393
  D(), process.exitCode = 1;
391
394
  return;
392
395
  }
@@ -403,22 +406,22 @@ var require_dist = __commonJS(function(exports, module) {
403
406
  D(), process.exitCode = 1;
404
407
  return;
405
408
  }
406
- let n = Ee(t);
409
+ let o = Ee(t);
407
410
  try {
408
- let c = be(n);
409
- if (!n.quiet) {
410
- let a = `\u25C7 injected env (${Object.keys(c.injected).length})`;
411
- c.loadedPaths.length > 0 && (a += ` from ${c.loadedPaths.join(", ")}`), console.error(a);
411
+ let c = be(o);
412
+ if (!(o.quiet == null ? J().quiet : o.quiet)) {
413
+ let h = `\u25C7 injected env (${Object.keys(c.injected).length})`;
414
+ c.loadedPaths.length > 0 && (h += ` from ${c.loadedPaths.join(", ")}`), console.error(h);
412
415
  }
413
416
  } catch (c) {
414
417
  console.error(`dotenv: ${c.message}`), process.exitCode = 1;
415
418
  return;
416
419
  }
417
- let r = !!process.stdin.isTTY, s = process.platform !== "win32" && !r, i = ve(t.command[0], t.command.slice(1), { stdio: "inherit", detached: s }), l = new Map, d = 0;
420
+ let r = !!process.stdin.isTTY, s = process.platform !== "win32" && !r, i = Ce(t.command[0], t.command.slice(1), { stdio: "inherit", detached: s }), l = new Map, d = 0;
418
421
  function p(c) {
419
422
  if (!(!i.pid || i.exitCode !== null || i.signalCode !== null)) {
420
423
  if (process.platform === "win32") {
421
- me.spawnSync("taskkill", ["/pid", String(i.pid), "/T", "/F"], { stdio: "ignore" });
424
+ ve.spawnSync("taskkill", ["/pid", String(i.pid), "/T", "/F"], { stdio: "ignore" });
422
425
  return;
423
426
  }
424
427
  try {
@@ -453,16 +456,16 @@ var require_dist = __commonJS(function(exports, module) {
453
456
  f(), typeof c == "number" ? process.exit(c) : (setInterval(() => {}, 1000), process.kill(process.pid, a));
454
457
  });
455
458
  }
456
- F.exports = J;
457
- F === __require.main && J(process.argv.slice(2));
459
+ F.exports = K;
460
+ F === __require.main && K(process.argv.slice(2));
458
461
  });
459
- var I = N();
460
- var Oe = K();
461
- module.exports = I;
462
- module.exports.config = I.config;
463
- module.exports.configDotenv = I.configDotenv;
464
- module.exports.parse = I.parse;
465
- module.exports.populate = I.populate;
462
+ var j = N();
463
+ var qe = X();
464
+ module.exports = j;
465
+ module.exports.config = j.config;
466
+ module.exports.configDotenv = j.configDotenv;
467
+ module.exports.parse = j.parse;
468
+ module.exports.populate = j.populate;
466
469
  });
467
470
 
468
471
  // src/load-env.ts
@@ -6822,10 +6825,15 @@ Usage:
6822
6825
  et event appearance upload --event-id <id> --file <path> --media-type <image|video> --content-type <mime>
6823
6826
  et event photo-wall display-items --event-id <id> [--limit <n>] [--cursor <json>] [--retained-ids <json>]
6824
6827
  et lucky-draw pre-draw --event-id <id> --prize-count <n>
6828
+ et lucky-draw participants replace --event-id <id> (--participants <json-array> | --participants-file <path>) --allow-state-change --target <same-event-id>
6829
+ et lucky-draw participants list --event-id <id> [--page <n>] [--per-page <n>]
6825
6830
 
6826
6831
  Lucky draw:
6827
6832
  pre-draw immediately saves winners for the next unassigned prizes in order.
6828
6833
  Uses the live draw random selection and participant filters in the backend.
6834
+ participants replace replaces the imported source roster; it is not an append.
6835
+ It requires --allow-state-change and --target exactly equal to --event-id.
6836
+ participants list defaults to page 1 with 100 results per page; inspect every page.
6829
6837
 
6830
6838
  Global options:
6831
6839
  --api-url <url> Override EVENT_TECH_API_URL.
@@ -7027,6 +7035,50 @@ var parseRetainedIds = (value) => {
7027
7035
  }
7028
7036
  return parsed;
7029
7037
  };
7038
+ var luckyDrawParticipantFields = new Set(["email", "luckyDrawId", "name"]);
7039
+ var parseLuckyDrawParticipants = (value) => {
7040
+ let parsed;
7041
+ try {
7042
+ parsed = JSON.parse(value);
7043
+ } catch {
7044
+ throw new CliUsageError("--participants must be valid JSON.");
7045
+ }
7046
+ if (!Array.isArray(parsed)) {
7047
+ throw new CliUsageError("--participants must be a JSON array.");
7048
+ }
7049
+ return parsed.map((participant, index) => {
7050
+ if (typeof participant !== "object" || participant === null || Array.isArray(participant)) {
7051
+ throw new CliUsageError(`--participants[${index}] must be an object.`);
7052
+ }
7053
+ if (Object.keys(participant).some((key) => !luckyDrawParticipantFields.has(key))) {
7054
+ throw new CliUsageError(`--participants[${index}] contains an unsupported field.`);
7055
+ }
7056
+ const luckyDrawId = "luckyDrawId" in participant ? participant.luckyDrawId : undefined;
7057
+ const name = "name" in participant ? participant.name : undefined;
7058
+ const email = "email" in participant ? participant.email : undefined;
7059
+ if (typeof luckyDrawId !== "string") {
7060
+ throw new CliUsageError(`--participants[${index}].luckyDrawId must be a string.`);
7061
+ }
7062
+ if (name !== undefined && typeof name !== "string") {
7063
+ throw new CliUsageError(`--participants[${index}].name must be a string.`);
7064
+ }
7065
+ if (email !== undefined && email !== null && typeof email !== "string") {
7066
+ throw new CliUsageError(`--participants[${index}].email must be a string or null.`);
7067
+ }
7068
+ return {
7069
+ luckyDrawId,
7070
+ ...name === undefined ? {} : { name },
7071
+ ...email === undefined ? {} : { email }
7072
+ };
7073
+ });
7074
+ };
7075
+ var readParticipantsFile = async (path) => {
7076
+ try {
7077
+ return await readFile2(path, "utf8");
7078
+ } catch {
7079
+ throw new CliUsageError("--participants-file could not be read.");
7080
+ }
7081
+ };
7030
7082
  var parseAppearanceMediaType = (value) => {
7031
7083
  if (value === "image" || value === "video")
7032
7084
  return value;
@@ -7261,6 +7313,47 @@ Waiting for approval\u2026
7261
7313
  writeSuccess(runtime, await api2.event.luckyDraw.preDrawPrizes.mutate(input));
7262
7314
  return;
7263
7315
  }
7316
+ if (group === "lucky-draw" && action === "participants" && subAction === "replace") {
7317
+ assertPositionalCount(parsed, 3);
7318
+ assertOnlyFlags(parsed, [
7319
+ "event-id",
7320
+ "participants",
7321
+ "participants-file",
7322
+ "allow-state-change",
7323
+ "target"
7324
+ ]);
7325
+ if (parsed.flags.get("allow-state-change") !== true) {
7326
+ throw new CliUsageError("--allow-state-change is required as an explicit acknowledgement.");
7327
+ }
7328
+ const eventId = getRequiredFlag(parsed, "event-id");
7329
+ if (getRequiredFlag(parsed, "target") !== eventId) {
7330
+ throw new CliUsageError("--target must exactly match --event-id.");
7331
+ }
7332
+ const participantsValue = getOptionalFlag(parsed, "participants");
7333
+ const participantsFile = getOptionalFlag(parsed, "participants-file");
7334
+ if (participantsValue === undefined === (participantsFile === undefined)) {
7335
+ throw new CliUsageError("Provide exactly one of --participants or --participants-file.");
7336
+ }
7337
+ const input = {
7338
+ eventId,
7339
+ participants: parseLuckyDrawParticipants(participantsValue ?? await readParticipantsFile(getRequiredFlag(parsed, "participants-file")))
7340
+ };
7341
+ await ensureAuthentication();
7342
+ writeSuccess(runtime, await api2.event.luckyDraw.createLuckyDrawParticipant.mutate(input));
7343
+ return;
7344
+ }
7345
+ if (group === "lucky-draw" && action === "participants" && subAction === "list") {
7346
+ assertPositionalCount(parsed, 3);
7347
+ assertOnlyFlags(parsed, ["event-id", "page", "per-page"]);
7348
+ const input = {
7349
+ eventId: getRequiredFlag(parsed, "event-id"),
7350
+ page: parsePositiveInteger(getOptionalFlag(parsed, "page") ?? "1", "page"),
7351
+ perPage: parseBoundedInteger(getOptionalFlag(parsed, "per-page") ?? "100", "per-page", 1, 100)
7352
+ };
7353
+ await ensureAuthentication();
7354
+ writeSuccess(runtime, await api2.event.luckyDraw.getLuckyDrawParticipantsByEventId.query(input));
7355
+ return;
7356
+ }
7264
7357
  throw new CliUsageError("Unknown command. Run `et --help` for available commands.");
7265
7358
  };
7266
7359
  var runCli = async (args, runtime = processRuntime, credentialStore = createBunCredentialStore({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@go-labs-sg/event-tech",
3
- "version": "0.12.0",
3
+ "version": "1.0.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",
@@ -17,7 +17,7 @@
17
17
  ],
18
18
  "dependencies": {
19
19
  "@trpc/client": "^11.19.0",
20
- "dotenv": "^18.0.6",
20
+ "dotenv": "^18.0.7",
21
21
  "superjson": "^2.2.6"
22
22
  },
23
23
  "engines": {