@go-labs-sg/event-tech 0.5.0 → 0.7.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 +19 -0
  2. package/dist/index.js +17 -4
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -66,3 +66,22 @@ et event get --event-id <id>
66
66
  ```
67
67
 
68
68
  Commands emit deterministic JSON envelopes. Authentication credentials are never included in successful output, and bearer credentials are redacted from errors.
69
+
70
+ ## Lucky draw pre-draw
71
+
72
+ ```sh
73
+ et lucky-draw pre-draw --event-id <id> --prize-count 5
74
+ ```
75
+
76
+ This immediately assigns winners to the next five unassigned prizes in their
77
+ configured order. It calls the same backend pre-draw operation as the web UI,
78
+ using the live draw's random function and participant email/domain filters.
79
+ Previous winners are excluded, each participant can win only once per batch,
80
+ and the entire batch is saved in one transaction. Too few eligible participants
81
+ or unassigned prizes causes the request to fail.
82
+
83
+ `--prize-count` is required and must be a positive integer. The success envelope
84
+ contains `data.drawnCount` and `data.winners`, including each winner's participant
85
+ ID, name, lucky draw ID, and assigned prize. The command requires an authenticated
86
+ CLI session with access to the event and a deployment that includes the pre-draw
87
+ API.
package/dist/index.js CHANGED
@@ -19561,12 +19561,14 @@ Usage:
19561
19561
  et organization get --organization-id <id>
19562
19562
  et event list --organization-id <id> [--page <n>] [--per-page <n>] [--name <text>] [--status <status>] [--archive-status <status>]
19563
19563
  et event get --event-id <id>
19564
+ et lucky-draw pre-draw --event-id <id> --prize-count <n>
19565
+
19566
+ Lucky draw:
19567
+ pre-draw immediately saves winners for the next unassigned prizes in order.
19568
+ Uses the live draw random selection and participant filters in the backend.
19564
19569
 
19565
19570
  Global options:
19566
19571
  --api-url <url> Override EVENT_TECH_API_URL.
19567
- --target <resource> Exact resource for an effectful command.
19568
- --allow-state-change Permit an approved state change.
19569
- --allow-delete Permit an approved destructive change.
19570
19572
  --help Print this help as JSON.
19571
19573
  --version Print the CLI version as JSON.
19572
19574
 
@@ -19698,7 +19700,7 @@ var assertPositionalCount = (parsed, expectedCount) => {
19698
19700
  };
19699
19701
  var parsePositiveInteger = (value, name) => {
19700
19702
  const parsed = Number(value);
19701
- if (!Number.isInteger(parsed) || parsed <= 0) {
19703
+ if (!Number.isSafeInteger(parsed) || parsed <= 0) {
19702
19704
  throw new CliUsageError(`--${name} must be a positive integer.`);
19703
19705
  }
19704
19706
  return parsed;
@@ -19840,6 +19842,17 @@ Waiting for approval\u2026
19840
19842
  }));
19841
19843
  return;
19842
19844
  }
19845
+ if (group === "lucky-draw" && action === "pre-draw" && subAction === undefined) {
19846
+ assertPositionalCount(parsed, 2);
19847
+ assertOnlyFlags(parsed, ["event-id", "prize-count"]);
19848
+ const input2 = {
19849
+ eventId: getRequiredFlag(parsed, "event-id"),
19850
+ prizeCount: parsePositiveInteger(getRequiredFlag(parsed, "prize-count"), "prize-count")
19851
+ };
19852
+ await ensureAuthentication();
19853
+ writeSuccess(runtime2, await api2.event.luckyDraw.preDrawPrizes.mutate(input2));
19854
+ return;
19855
+ }
19843
19856
  throw new CliUsageError("Unknown command. Run `et --help` for available commands.");
19844
19857
  };
19845
19858
  var runCli = async (args, runtime2 = processRuntime, credentialStore = createBunCredentialStore({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@go-labs-sg/event-tech",
3
- "version": "0.5.0",
3
+ "version": "0.7.0",
4
4
  "description": "Event Tech CLI for managing Event Tech resources through the Go Labs API.",
5
5
  "type": "module",
6
6
  "bin": {