chofex-cli 0.1.37 → 0.1.38

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 (2) hide show
  1. package/dist/index.js +25 -0
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -58607,6 +58607,17 @@ var CurrentUserSchema = exports_Schema.Struct({
58607
58607
  tokenType: exports_Schema.Literals(["oauth_token", "session_token"]),
58608
58608
  clerkPictureUrl: exports_Schema.optional(exports_Schema.String)
58609
58609
  });
58610
+ var BadgeStatus = exports_Schema.Literals([
58611
+ "not_started",
58612
+ "pending",
58613
+ "running",
58614
+ "completed",
58615
+ "failed"
58616
+ ]);
58617
+ var BadgeResultSchema = exports_Schema.Struct({
58618
+ status: BadgeStatus,
58619
+ url: exports_Schema.optional(exports_Schema.String)
58620
+ });
58610
58621
  var PictureUploadSchema = exports_Schema.Struct({
58611
58622
  url: exports_Schema.String,
58612
58623
  contentType: PictureContentType,
@@ -59085,6 +59096,7 @@ var request3 = exports_Effect.fn("apiRequest")(function* (options, path4, init,
59085
59096
  return yield* decodeResponse(body).pipe(exports_Effect.mapError((error2) => cliError("INVALID_API_RESPONSE", "The API response did not match protocol version 1", false, { issues: String(error2) })));
59086
59097
  });
59087
59098
  var decodeCreatedRegistration = exports_Schema.decodeUnknownEffect(ApiSuccessSchema(CreatedRegistrationSchema));
59099
+ var decodeBadgeResult = exports_Schema.decodeUnknownEffect(ApiSuccessSchema(BadgeResultSchema));
59088
59100
  var decodeCurrentUser = exports_Schema.decodeUnknownEffect(ApiSuccessSchema(CurrentUserSchema));
59089
59101
  var decodeRegistrationResult = exports_Schema.decodeUnknownEffect(ApiSuccessSchema(RegistrationResultSchema));
59090
59102
  var decodePictureUploadGrant = exports_Schema.decodeUnknownEffect(ApiSuccessSchema(PictureUploadGrantSchema));
@@ -59095,6 +59107,7 @@ var register = (options, input) => request3(options, "/api/v1/registrations", {
59095
59107
  }, decodeCreatedRegistration);
59096
59108
  var getCurrentUser = (options) => request3(options, "/api/v1/me", { method: "GET" }, decodeCurrentUser);
59097
59109
  var getRegistration = (options) => request3(options, "/api/v1/registration", { method: "GET" }, decodeRegistrationResult);
59110
+ var getBadge = (options) => request3(options, "/api/v1/badge", { method: "GET" }, decodeBadgeResult);
59098
59111
  var confirmAttendance = (options, input) => request3(options, "/api/v1/registration/attendance", { method: "PUT", body: JSON.stringify(input) }, decodeRegistrationResult);
59099
59112
  var beginPictureUpload = (options, input) => request3(options, "/api/v1/profile-picture", { method: "POST", body: JSON.stringify(input) }, decodePictureUploadGrant);
59100
59113
  var completePictureUpload = (options, input) => request3(options, "/api/v1/profile-picture", { method: "PUT", body: JSON.stringify(input) }, decodePictureUpload);
@@ -59567,6 +59580,11 @@ var registrationText = (result3) => [
59567
59580
  var createdText = (result3) => ["Application submitted successfully.", registrationText(result3)].join(`
59568
59581
  `);
59569
59582
  var requirementsOnlyText = (result3) => requirementsText(result3);
59583
+ var badgeText = (result3) => {
59584
+ if (result3.url)
59585
+ return result3.url;
59586
+ return "You don't have a badge yet.";
59587
+ };
59570
59588
 
59571
59589
  // src/picture-upload.ts
59572
59590
  import { readFile as readFile4, stat as stat3 } from "node:fs/promises";
@@ -61297,6 +61315,12 @@ var requirementsCommand = exports_Command.make("requirements", {}, exports_Effec
61297
61315
  });
61298
61316
  yield* execute(options.output, operation, requirementsOnlyText);
61299
61317
  })).pipe(exports_Command.withDescription("Show information you still need to provide"));
61318
+ var badgeCommand = exports_Command.make("badge", {}, exports_Effect.fn("badgeCommand")(function* () {
61319
+ const options = yield* root;
61320
+ const token = exports_Option.getOrUndefined(options.token);
61321
+ const operation = getBadge({ apiUrl: options.apiUrl, token });
61322
+ yield* execute(options.output, operation, badgeText);
61323
+ })).pipe(exports_Command.withDescription("Show your generated participant badge"));
61300
61324
  var confirmCommand = exports_Command.make("confirm", {
61301
61325
  input: inputFlag,
61302
61326
  picture: exports_Flag.string("picture").pipe(exports_Flag.optional, exports_Flag.withDescription("Path to a JPEG, PNG, or WebP picture (5 MB max)"))
@@ -61458,6 +61482,7 @@ var command = root.pipe(exports_Command.withSubcommands([
61458
61482
  registerCommand,
61459
61483
  statusCommand,
61460
61484
  requirementsCommand,
61485
+ badgeCommand,
61461
61486
  confirmCommand,
61462
61487
  schemaCommand
61463
61488
  ]));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chofex-cli",
3
- "version": "0.1.37",
3
+ "version": "0.1.38",
4
4
  "description": "Command-line client for the Chofex Hackathon",
5
5
  "type": "module",
6
6
  "bin": {