backprompter-server-sdk 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/README.md +2 -2
- package/index.js +0 -12
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -15,8 +15,7 @@ import BackprompterServer from 'backprompter-server-sdk';
|
|
|
15
15
|
|
|
16
16
|
const bp = new BackprompterServer({
|
|
17
17
|
apiKey: process.env.BACKPROMPTER_API_KEY,
|
|
18
|
-
tenantId: process.env.BACKPROMPTER_APP_KEY
|
|
19
|
-
backendUrl: process.env.BACKPROMPTER_BACKEND_URL
|
|
18
|
+
tenantId: process.env.BACKPROMPTER_APP_KEY
|
|
20
19
|
});
|
|
21
20
|
|
|
22
21
|
const result = await bp.run({
|
|
@@ -34,3 +33,4 @@ console.log(result.response);
|
|
|
34
33
|
- Requires Node.js 18+ (uses built-in fetch).
|
|
35
34
|
- Uses `x-bp-api-key` authentication.
|
|
36
35
|
- `tenantId` can be passed in constructor or per-call (`run({ tenantId })`).
|
|
36
|
+
- Uses Backprompter hosted backend by default (no URL configuration needed).
|
package/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
const DEFAULT_BACKEND_URL = 'https://backprompter-us-628834831216.us-central1.run.app';
|
|
2
|
-
const LOCAL_BACKEND_URL = 'http://localhost:8080';
|
|
3
2
|
|
|
4
3
|
function normalizeBackendUrl(url) {
|
|
5
4
|
const raw = String(url || '').trim();
|
|
@@ -32,10 +31,6 @@ export default class BackprompterServer {
|
|
|
32
31
|
return DEFAULT_BACKEND_URL;
|
|
33
32
|
}
|
|
34
33
|
|
|
35
|
-
static get LOCAL_BACKEND_URL() {
|
|
36
|
-
return LOCAL_BACKEND_URL;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
34
|
setApiKey(apiKey) {
|
|
40
35
|
this._apiKey = String(apiKey || '').trim();
|
|
41
36
|
return this._apiKey;
|
|
@@ -53,13 +48,6 @@ export default class BackprompterServer {
|
|
|
53
48
|
return this._backendUrl;
|
|
54
49
|
}
|
|
55
50
|
|
|
56
|
-
setEnvironment(env) {
|
|
57
|
-
const normalizedEnv = String(env || '').trim().toLowerCase();
|
|
58
|
-
if (normalizedEnv === 'local') return this.setBackendUrl(LOCAL_BACKEND_URL);
|
|
59
|
-
if (normalizedEnv === 'production' || normalizedEnv === 'prod') return this.setBackendUrl(DEFAULT_BACKEND_URL);
|
|
60
|
-
throw new Error("BackprompterServer: setEnvironment expects 'local' or 'production'.");
|
|
61
|
-
}
|
|
62
|
-
|
|
63
51
|
getBackendUrl() {
|
|
64
52
|
return this._backendUrl;
|
|
65
53
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "backprompter-server-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Backprompter server-side SDK for Node.js backends",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
"node"
|
|
21
21
|
],
|
|
22
22
|
"license": "MIT"
|
|
23
|
-
}
|
|
23
|
+
}
|