chofex-cli 0.1.12 → 0.1.14

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 +15 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -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.12",
3
+ "version": "0.1.14",
4
4
  "description": "Command-line client for the Chofex Hackathon",
5
5
  "type": "module",
6
6
  "bin": {