@go-labs-sg/registration 1.0.0 → 1.1.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 (2) hide show
  1. package/dist/index.js +84 -78
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -372,9 +372,6 @@ var import_dotenv = __toESM(require_main(), 1);
372
372
  import path from "path";
373
373
  import_dotenv.config({ path: path.resolve(process.cwd(), ".env"), quiet: true });
374
374
 
375
- // src/index.ts
376
- import { readFileSync } from "fs";
377
-
378
375
  // ../../cli-auth/src/protocol/constants.ts
379
376
  var CLI_ACCESS_TOKEN_TTL_MS = 15 * 60 * 1000;
380
377
  var CLI_DEVICE_AUTHORIZATION_TTL_MS = 10 * 60 * 1000;
@@ -14947,24 +14944,16 @@ var logoutCliSession = async ({
14947
14944
  await store.delete();
14948
14945
  return { remoteRevoked };
14949
14946
  };
14947
+ // src/cli.ts
14948
+ import { readFileSync } from "fs";
14949
+
14950
14950
  // src/api-client.ts
14951
14951
  import {
14952
14952
  createTRPCProxyClient,
14953
14953
  httpBatchLink
14954
14954
  } from "@trpc/client";
14955
14955
  import SuperJSON from "superjson";
14956
- var DEFAULT_API_BASE_URL = "https://registration.getout.events";
14957
- var normalizeApiBaseUrl = (value) => {
14958
- const url2 = new URL(value);
14959
- const localHttp = url2.protocol === "http:" && (url2.hostname === "localhost" || url2.hostname === "127.0.0.1");
14960
- if (url2.protocol !== "https:" && !localHttp) {
14961
- throw new Error("Registration API URL must use HTTPS, except for localhost development.");
14962
- }
14963
- url2.pathname = url2.pathname.replace(/\/$/, "");
14964
- return url2.toString().replace(/\/$/, "");
14965
- };
14966
- var getApiBaseUrl = (override) => normalizeApiBaseUrl(override ?? process.env.REG_API_URL ?? DEFAULT_API_BASE_URL);
14967
- var createApiClient = (apiBaseUrl, accessToken) => createTRPCProxyClient({
14956
+ var createRegistrationClient = (apiBaseUrl, accessToken) => createTRPCProxyClient({
14968
14957
  links: [
14969
14958
  httpBatchLink({
14970
14959
  url: `${apiBaseUrl}/api/trpc`,
@@ -14976,6 +14965,8 @@ var createApiClient = (apiBaseUrl, accessToken) => createTRPCProxyClient({
14976
14965
  })
14977
14966
  ]
14978
14967
  });
14968
+
14969
+ // src/command-client.ts
14979
14970
  var invokeCommand = (client, procedure, input) => {
14980
14971
  const objectInput = input ?? {};
14981
14972
  switch (procedure) {
@@ -15102,72 +15093,13 @@ var invokeCommand = (client, procedure, input) => {
15102
15093
  }
15103
15094
  };
15104
15095
  var createCommandClient = (apiBaseUrl, accessToken) => {
15105
- const client = createApiClient(apiBaseUrl, accessToken);
15096
+ const client = createRegistrationClient(apiBaseUrl, accessToken);
15106
15097
  return {
15107
15098
  invoke: (procedure, input) => invokeCommand(client, procedure, input)
15108
15099
  };
15109
15100
  };
15110
15101
 
15111
- // src/parse-args.ts
15112
- var BOOLEAN_FLAGS = new Set([
15113
- "allow-state-change",
15114
- "allow-email",
15115
- "allow-external-write",
15116
- "allow-delete",
15117
- "allow-financial-write",
15118
- "ack-sensitive-data",
15119
- "debug",
15120
- "help",
15121
- "no-browser",
15122
- "quiet"
15123
- ]);
15124
- var KNOWN_FLAGS = new Set([...BOOLEAN_FLAGS, "api-url", "input", "target"]);
15125
- var parseArguments = (args) => {
15126
- const flags = new Map;
15127
- const positionals = [];
15128
- for (let index = 0;index < args.length; index += 1) {
15129
- const arg = args[index];
15130
- if (arg === "-q") {
15131
- flags.set("quiet", true);
15132
- continue;
15133
- }
15134
- if (!arg?.startsWith("--")) {
15135
- if (arg)
15136
- positionals.push(arg);
15137
- continue;
15138
- }
15139
- const [rawName, inlineValue] = arg.slice(2).split(/=(.*)/s, 2);
15140
- if (!rawName)
15141
- throw new Error(`Invalid option: ${arg}`);
15142
- if (inlineValue !== undefined) {
15143
- flags.set(rawName, inlineValue);
15144
- continue;
15145
- }
15146
- if (BOOLEAN_FLAGS.has(rawName)) {
15147
- flags.set(rawName, true);
15148
- continue;
15149
- }
15150
- const value = args[index + 1];
15151
- if (!value || value.startsWith("--")) {
15152
- throw new Error(`--${rawName} requires a value`);
15153
- }
15154
- flags.set(rawName, value);
15155
- index += 1;
15156
- }
15157
- return { flags, positionals };
15158
- };
15159
- var assertKnownFlags = (flags) => {
15160
- const unknown2 = [...flags.keys()].filter((name) => !KNOWN_FLAGS.has(name));
15161
- if (unknown2.length === 0)
15162
- return;
15163
- throw new Error(`Unknown option${unknown2.length === 1 ? "" : "s"}: ${unknown2.map((name) => `--${name}`).join(", ")}.`);
15164
- };
15165
- var getStringFlag = (flags, name) => {
15166
- const value = flags.get(name);
15167
- return typeof value === "string" ? value : undefined;
15168
- };
15169
-
15170
- // src/registry.ts
15102
+ // src/commands/index.ts
15171
15103
  var globalCommandOptions = [
15172
15104
  "--api-url <url>",
15173
15105
  "--input <json>",
@@ -15323,7 +15255,79 @@ _arguments '*: :(${words})'
15323
15255
  }
15324
15256
  };
15325
15257
 
15326
- // src/runtime.ts
15258
+ // src/config.ts
15259
+ var DEFAULT_API_BASE_URL = "https://registration.getout.events";
15260
+ var normalizeApiBaseUrl = (value) => {
15261
+ const url2 = new URL(value);
15262
+ const localHttp = url2.protocol === "http:" && (url2.hostname === "localhost" || url2.hostname === "127.0.0.1");
15263
+ if (url2.protocol !== "https:" && !localHttp) {
15264
+ throw new Error("Registration API URL must use HTTPS, except for localhost development.");
15265
+ }
15266
+ url2.pathname = url2.pathname.replace(/\/$/, "");
15267
+ return url2.toString().replace(/\/$/, "");
15268
+ };
15269
+ var getApiBaseUrl = (override) => normalizeApiBaseUrl(override ?? process.env.REG_API_URL ?? DEFAULT_API_BASE_URL);
15270
+
15271
+ // src/parse-args.ts
15272
+ var BOOLEAN_FLAGS = new Set([
15273
+ "allow-state-change",
15274
+ "allow-email",
15275
+ "allow-external-write",
15276
+ "allow-delete",
15277
+ "allow-financial-write",
15278
+ "ack-sensitive-data",
15279
+ "debug",
15280
+ "help",
15281
+ "no-browser",
15282
+ "quiet"
15283
+ ]);
15284
+ var KNOWN_FLAGS = new Set([...BOOLEAN_FLAGS, "api-url", "input", "target"]);
15285
+ var parseArguments = (args) => {
15286
+ const flags = new Map;
15287
+ const positionals = [];
15288
+ for (let index = 0;index < args.length; index += 1) {
15289
+ const arg = args[index];
15290
+ if (arg === "-q") {
15291
+ flags.set("quiet", true);
15292
+ continue;
15293
+ }
15294
+ if (!arg?.startsWith("--")) {
15295
+ if (arg)
15296
+ positionals.push(arg);
15297
+ continue;
15298
+ }
15299
+ const [rawName, inlineValue] = arg.slice(2).split(/=(.*)/s, 2);
15300
+ if (!rawName)
15301
+ throw new Error(`Invalid option: ${arg}`);
15302
+ if (inlineValue !== undefined) {
15303
+ flags.set(rawName, inlineValue);
15304
+ continue;
15305
+ }
15306
+ if (BOOLEAN_FLAGS.has(rawName)) {
15307
+ flags.set(rawName, true);
15308
+ continue;
15309
+ }
15310
+ const value = args[index + 1];
15311
+ if (!value || value.startsWith("--")) {
15312
+ throw new Error(`--${rawName} requires a value`);
15313
+ }
15314
+ flags.set(rawName, value);
15315
+ index += 1;
15316
+ }
15317
+ return { flags, positionals };
15318
+ };
15319
+ var assertKnownFlags = (flags) => {
15320
+ const unknown2 = [...flags.keys()].filter((name) => !KNOWN_FLAGS.has(name));
15321
+ if (unknown2.length === 0)
15322
+ return;
15323
+ throw new Error(`Unknown option${unknown2.length === 1 ? "" : "s"}: ${unknown2.map((name) => `--${name}`).join(", ")}.`);
15324
+ };
15325
+ var getStringFlag = (flags, name) => {
15326
+ const value = flags.get(name);
15327
+ return typeof value === "string" ? value : undefined;
15328
+ };
15329
+
15330
+ // src/runtime/index.ts
15327
15331
  class CliError extends Error {
15328
15332
  code;
15329
15333
  details;
@@ -15429,7 +15433,7 @@ var normalizeError = (error51) => {
15429
15433
  };
15430
15434
  };
15431
15435
 
15432
- // src/index.ts
15436
+ // src/cli.ts
15433
15437
  var dateInputKeys = new Set([
15434
15438
  "from",
15435
15439
  "to",
@@ -15656,6 +15660,8 @@ Waiting for approval\u2026
15656
15660
  return ["USAGE", "VALIDATION", "CONFIRMATION_REQUIRED"].includes(normalized.code) ? 2 : 1;
15657
15661
  }
15658
15662
  };
15663
+
15664
+ // src/index.ts
15659
15665
  if (import.meta.main) {
15660
15666
  assertBunRuntime();
15661
15667
  process.exitCode = await runCli();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@go-labs-sg/registration",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "Registration System CLI for organizations, events, forms, registrations, and attendee operations.",
5
5
  "type": "module",
6
6
  "bin": {