edgee 0.1.0 → 0.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.
package/dist/index.d.ts CHANGED
@@ -55,9 +55,13 @@ export interface SendResponse {
55
55
  total_tokens: number;
56
56
  };
57
57
  }
58
+ export interface EdgeeConfig {
59
+ apiKey?: string;
60
+ baseUrl?: string;
61
+ }
58
62
  export default class Edgee {
59
63
  private apiKey;
60
64
  private baseUrl;
61
- constructor(apiKey?: string);
65
+ constructor(config?: string | EdgeeConfig);
62
66
  send(options: SendOptions): Promise<SendResponse>;
63
67
  }
package/dist/index.js CHANGED
@@ -1,10 +1,21 @@
1
1
  export default class Edgee {
2
- constructor(apiKey) {
3
- this.baseUrl = "https://api.edgee.ai";
2
+ constructor(config) {
3
+ let apiKey;
4
+ let baseUrl;
5
+ if (typeof config === "string") {
6
+ // Backward compatibility: accept apiKey as string
7
+ apiKey = config;
8
+ }
9
+ else if (config) {
10
+ // New format: accept config object
11
+ apiKey = config.apiKey;
12
+ baseUrl = config.baseUrl;
13
+ }
4
14
  this.apiKey = apiKey || process.env.EDGEE_API_KEY || "";
5
15
  if (!this.apiKey) {
6
16
  throw new Error("EDGEE_API_KEY is not set");
7
17
  }
18
+ this.baseUrl = baseUrl || process.env.EDGEE_BASE_URL || "https://api.edgee.ai";
8
19
  }
9
20
  async send(options) {
10
21
  const { input } = options;
package/package.json CHANGED
@@ -1,9 +1,13 @@
1
1
  {
2
2
  "name": "edgee",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/edgee-cloud/typescript-sdk"
10
+ },
7
11
  "exports": {
8
12
  ".": {
9
13
  "types": "./dist/index.d.ts",