@solvapay/core 1.0.0-preview.6 → 1.0.0-preview.8

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/dist/index.cjs CHANGED
@@ -22,6 +22,7 @@ var index_exports = {};
22
22
  __export(index_exports, {
23
23
  Env: () => Env,
24
24
  SolvaPayError: () => SolvaPayError,
25
+ getSolvaPayConfig: () => getSolvaPayConfig,
25
26
  version: () => version
26
27
  });
27
28
  module.exports = __toCommonJS(index_exports);
@@ -36,10 +37,22 @@ var SolvaPayError = class extends Error {
36
37
  this.name = "SolvaPayError";
37
38
  }
38
39
  };
40
+ function getSolvaPayConfig() {
41
+ const solvapaySecretKey = process.env.SOLVAPAY_SECRET_KEY;
42
+ const solvapayApiBaseUrl = process.env.SOLVAPAY_API_BASE_URL;
43
+ if (!solvapaySecretKey) {
44
+ throw new SolvaPayError("Server configuration error: SolvaPay secret key not configured. Missing SOLVAPAY_SECRET_KEY environment variable.");
45
+ }
46
+ return {
47
+ apiKey: solvapaySecretKey,
48
+ apiBaseUrl: solvapayApiBaseUrl
49
+ };
50
+ }
39
51
  var version = "0.1.0";
40
52
  // Annotate the CommonJS export names for ESM import in node:
41
53
  0 && (module.exports = {
42
54
  Env,
43
55
  SolvaPayError,
56
+ getSolvaPayConfig,
44
57
  version
45
58
  });
package/dist/index.d.cts CHANGED
@@ -14,6 +14,18 @@ type Env = z.infer<typeof Env>;
14
14
  declare class SolvaPayError extends Error {
15
15
  constructor(message: string);
16
16
  }
17
+ interface SolvaPayConfig {
18
+ apiKey: string;
19
+ apiBaseUrl?: string;
20
+ }
21
+ /**
22
+ * Validates and returns SolvaPay configuration from environment variables.
23
+ * Throws SolvaPayError if required environment variables are missing.
24
+ *
25
+ * @returns SolvaPayConfig object with apiKey and optional apiBaseUrl
26
+ * @throws SolvaPayError if SOLVAPAY_SECRET_KEY is missing
27
+ */
28
+ declare function getSolvaPayConfig(): SolvaPayConfig;
17
29
  declare const version = "0.1.0";
18
30
 
19
- export { Env, SolvaPayError, version };
31
+ export { Env, type SolvaPayConfig, SolvaPayError, getSolvaPayConfig, version };
package/dist/index.d.ts CHANGED
@@ -14,6 +14,18 @@ type Env = z.infer<typeof Env>;
14
14
  declare class SolvaPayError extends Error {
15
15
  constructor(message: string);
16
16
  }
17
+ interface SolvaPayConfig {
18
+ apiKey: string;
19
+ apiBaseUrl?: string;
20
+ }
21
+ /**
22
+ * Validates and returns SolvaPay configuration from environment variables.
23
+ * Throws SolvaPayError if required environment variables are missing.
24
+ *
25
+ * @returns SolvaPayConfig object with apiKey and optional apiBaseUrl
26
+ * @throws SolvaPayError if SOLVAPAY_SECRET_KEY is missing
27
+ */
28
+ declare function getSolvaPayConfig(): SolvaPayConfig;
17
29
  declare const version = "0.1.0";
18
30
 
19
- export { Env, SolvaPayError, version };
31
+ export { Env, type SolvaPayConfig, SolvaPayError, getSolvaPayConfig, version };
package/dist/index.js CHANGED
@@ -10,9 +10,21 @@ var SolvaPayError = class extends Error {
10
10
  this.name = "SolvaPayError";
11
11
  }
12
12
  };
13
+ function getSolvaPayConfig() {
14
+ const solvapaySecretKey = process.env.SOLVAPAY_SECRET_KEY;
15
+ const solvapayApiBaseUrl = process.env.SOLVAPAY_API_BASE_URL;
16
+ if (!solvapaySecretKey) {
17
+ throw new SolvaPayError("Server configuration error: SolvaPay secret key not configured. Missing SOLVAPAY_SECRET_KEY environment variable.");
18
+ }
19
+ return {
20
+ apiKey: solvapaySecretKey,
21
+ apiBaseUrl: solvapayApiBaseUrl
22
+ };
23
+ }
13
24
  var version = "0.1.0";
14
25
  export {
15
26
  Env,
16
27
  SolvaPayError,
28
+ getSolvaPayConfig,
17
29
  version
18
30
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solvapay/core",
3
- "version": "1.0.0-preview.6",
3
+ "version": "1.0.0-preview.8",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",