chofex-cli 0.1.11 → 0.1.13

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.
package/README.md CHANGED
@@ -23,5 +23,5 @@ token with `CHOFEX_TOKEN`.
23
23
  Use `CHOFEX_API_URL` to override the API URL when running against a hosted or
24
24
  local Chofex instance.
25
25
 
26
- Registration links use `https://andres.crafter.run` by default. Local or preview
26
+ Registration links use `https://andes.crafter.run` by default. Local or preview
27
27
  environments can override that origin with `CHOFEX_PUBLIC_SITE_URL`.
package/dist/index.js CHANGED
@@ -30971,7 +30971,7 @@ import { createServer } from "node:http";
30971
30971
  var oauthIssuer = process.env.CHOFEX_OAUTH_ISSUER ?? "https://close-newt-8265.clerk.accounts.dev";
30972
30972
  var config = {
30973
30973
  apiUrl: process.env.CHOFEX_API_URL ?? "http://localhost:3000",
30974
- publicSiteUrl: process.env.CHOFEX_PUBLIC_SITE_URL ?? "https://andres.crafter.run",
30974
+ publicSiteUrl: process.env.CHOFEX_PUBLIC_SITE_URL ?? "https://andes.crafter.run",
30975
30975
  oauthClientId: process.env.CHOFEX_OAUTH_CLIENT_ID ?? "1YfuXKgOXkdH094s",
30976
30976
  authorizationUrl: `${oauthIssuer}/oauth/authorize`,
30977
30977
  tokenUrl: `${oauthIssuer}/oauth/token`,
@@ -31824,8 +31824,22 @@ var registerCommand = exports_Command.make("register", { input: inputFlag }, exp
31824
31824
  const options = yield* root;
31825
31825
  const operation = exports_Effect.gen(function* () {
31826
31826
  const token = exports_Option.getOrUndefined(options.token);
31827
+ const client = { apiUrl: options.apiUrl, token };
31828
+ const current = yield* getRegistration(client).pipe(exports_Effect.map(exports_Option.some), exports_Effect.catch((error2) => {
31829
+ if (error2.code === "REGISTRATION_NOT_FOUND") {
31830
+ return exports_Effect.succeed(exports_Option.none());
31831
+ }
31832
+ return exports_Effect.fail(error2);
31833
+ }));
31834
+ if (exports_Option.isSome(current)) {
31835
+ const { status } = current.value.data.registration;
31836
+ const isAwaitingApproval = status === "submitted" || status === "under_review" || status === "waitlisted";
31837
+ if (isAwaitingApproval) {
31838
+ return yield* cliError("ACTIVE_APPLICATION_EXISTS", "Already registered. Wait for approval.", false, { currentStatus: status });
31839
+ }
31840
+ }
31827
31841
  const body = yield* applicationInput(exports_Option.getOrUndefined(input), config.publicSiteUrl);
31828
- return yield* register({ apiUrl: options.apiUrl, token }, body);
31842
+ return yield* register(client, body);
31829
31843
  });
31830
31844
  yield* execute(options.output, operation, createdText);
31831
31845
  })).pipe(exports_Command.withDescription("Submit an application, or apply again after a rejection"), exports_Command.withExamples([
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chofex-cli",
3
- "version": "0.1.11",
3
+ "version": "0.1.13",
4
4
  "description": "Command-line client for the Chofex Hackathon",
5
5
  "type": "module",
6
6
  "bin": {