@go-labs-sg/registration 1.1.0 → 1.1.1

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 +20 -4
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -14750,6 +14750,22 @@ var assertBunRuntime = (runtime = globalThis.Bun) => {
14750
14750
  };
14751
14751
 
14752
14752
  // ../../cli-auth/src/client/credential-store.ts
14753
+ class CliCredentialStoreUnavailableError extends Error {
14754
+ code = "CLI_CREDENTIAL_STORE_UNAVAILABLE";
14755
+ constructor(product, options) {
14756
+ super(`Secure credential storage is unavailable for the ${product} CLI. Bun.secrets requires the operating system credential store, including Secret Service on Linux. Browser authentication cannot continue without a supported secure store.`, options);
14757
+ this.name = "CliCredentialStoreUnavailableError";
14758
+ }
14759
+ }
14760
+ var useSecrets = async (product, operation) => {
14761
+ try {
14762
+ return await operation();
14763
+ } catch (cause) {
14764
+ if (cause instanceof CliCredentialStoreUnavailableError)
14765
+ throw cause;
14766
+ throw new CliCredentialStoreUnavailableError(product, { cause });
14767
+ }
14768
+ };
14753
14769
  var defaultSecrets = () => {
14754
14770
  assertBunRuntime();
14755
14771
  return Bun.secrets;
@@ -14762,10 +14778,10 @@ var createBunCredentialStore = ({
14762
14778
  const service = `go-labs-cli:${product}`;
14763
14779
  return {
14764
14780
  delete: async () => {
14765
- await secrets.delete({ name: account, service });
14781
+ await useSecrets(product, () => secrets.delete({ name: account, service }));
14766
14782
  },
14767
14783
  get: async () => {
14768
- const value = await secrets.get({ name: account, service });
14784
+ const value = await useSecrets(product, () => secrets.get({ name: account, service }));
14769
14785
  if (value === null)
14770
14786
  return null;
14771
14787
  try {
@@ -14776,11 +14792,11 @@ var createBunCredentialStore = ({
14776
14792
  },
14777
14793
  set: async (credentials) => {
14778
14794
  const parsed = storedCliCredentialsSchema.parse(credentials);
14779
- await secrets.set({
14795
+ await useSecrets(product, () => secrets.set({
14780
14796
  name: account,
14781
14797
  service,
14782
14798
  value: JSON.stringify(parsed)
14783
- });
14799
+ }));
14784
14800
  }
14785
14801
  };
14786
14802
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@go-labs-sg/registration",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Registration System CLI for organizations, events, forms, registrations, and attendee operations.",
5
5
  "type": "module",
6
6
  "bin": {