repowise 0.1.1 → 0.1.2

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.
@@ -26,13 +26,15 @@ var init_env = __esm({
26
26
  cognitoDomain: "auth-repowise",
27
27
  cognitoClientId: "",
28
28
  // TODO: set production client ID
29
- cognitoRegion: "us-east-1"
29
+ cognitoRegion: "us-east-1",
30
+ customDomain: false
30
31
  };
31
32
  STAGING = {
32
33
  apiUrl: "https://staging-api.repowise.ai",
33
- cognitoDomain: "auth-repowise-staging",
34
+ cognitoDomain: "auth-staging.repowise.ai",
34
35
  cognitoClientId: "7h0l0dhjcb1v5erer0gaclv0q6",
35
- cognitoRegion: "us-east-1"
36
+ cognitoRegion: "us-east-1",
37
+ customDomain: true
36
38
  };
37
39
  }
38
40
  });
@@ -48,9 +50,14 @@ function getCognitoConfig() {
48
50
  return {
49
51
  domain: process.env["REPOWISE_COGNITO_DOMAIN"] ?? env.cognitoDomain,
50
52
  clientId: process.env["REPOWISE_COGNITO_CLIENT_ID"] ?? env.cognitoClientId,
51
- region: process.env["REPOWISE_COGNITO_REGION"] ?? env.cognitoRegion
53
+ region: process.env["REPOWISE_COGNITO_REGION"] ?? env.cognitoRegion,
54
+ customDomain: env.customDomain
52
55
  };
53
56
  }
57
+ function getCognitoBaseUrl() {
58
+ const { domain, region, customDomain } = getCognitoConfig();
59
+ return customDomain ? `https://${domain}` : `https://${domain}.auth.${region}.amazoncognito.com`;
60
+ }
54
61
  function generateCodeVerifier() {
55
62
  return randomBytes(32).toString("base64url");
56
63
  }
@@ -76,11 +83,10 @@ function getAuthorizeUrl(codeChallenge, state) {
76
83
  scope: "openid email profile",
77
84
  state
78
85
  });
79
- return `https://${domain}.auth.${region}.amazoncognito.com/oauth2/authorize?${params.toString()}`;
86
+ return `${getCognitoBaseUrl()}/oauth2/authorize?${params.toString()}`;
80
87
  }
81
88
  function getTokenUrl() {
82
- const { domain, region } = getCognitoConfig();
83
- return `https://${domain}.auth.${region}.amazoncognito.com/oauth2/token`;
89
+ return `${getCognitoBaseUrl()}/oauth2/token`;
84
90
  }
85
91
  function startCallbackServer() {
86
92
  return new Promise((resolve, reject) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "repowise",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "type": "module",
5
5
  "description": "AI-optimized codebase context generator",
6
6
  "bin": {