@bettercms-ai/sdk 1.7.0 → 1.8.0
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 +4 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -594,12 +594,20 @@ interface BetterCMSManagementOptions {
|
|
|
594
594
|
baseUrl?: string;
|
|
595
595
|
/** A content:manage scoped API key. */
|
|
596
596
|
apiKey: string;
|
|
597
|
+
/**
|
|
598
|
+
* Target project (id or slug), sent as the X-BCMS-Project header.
|
|
599
|
+
* REQUIRED for workspace-scoped keys — content writes (createEntry, createPage,
|
|
600
|
+
* createModel, …) must land in a project. Project-scoped keys (`bcms_proj_…`)
|
|
601
|
+
* don't need it; if set, it must match the key's own project.
|
|
602
|
+
*/
|
|
603
|
+
project?: string;
|
|
597
604
|
/** Request timeout per attempt in ms. Defaults to 10000. */
|
|
598
605
|
timeout?: number;
|
|
599
606
|
}
|
|
600
607
|
declare class BetterCMSManagementClient extends BetterCMSDeliveryClient {
|
|
601
608
|
readonly timeout: number;
|
|
602
609
|
private readonly _apiKey;
|
|
610
|
+
private readonly _project?;
|
|
603
611
|
constructor(options: BetterCMSManagementOptions);
|
|
604
612
|
headers(): Record<string, string>;
|
|
605
613
|
/** Management API URL: baseUrl + path (path is workspace-scoped via the key). */
|
package/dist/index.d.ts
CHANGED
|
@@ -594,12 +594,20 @@ interface BetterCMSManagementOptions {
|
|
|
594
594
|
baseUrl?: string;
|
|
595
595
|
/** A content:manage scoped API key. */
|
|
596
596
|
apiKey: string;
|
|
597
|
+
/**
|
|
598
|
+
* Target project (id or slug), sent as the X-BCMS-Project header.
|
|
599
|
+
* REQUIRED for workspace-scoped keys — content writes (createEntry, createPage,
|
|
600
|
+
* createModel, …) must land in a project. Project-scoped keys (`bcms_proj_…`)
|
|
601
|
+
* don't need it; if set, it must match the key's own project.
|
|
602
|
+
*/
|
|
603
|
+
project?: string;
|
|
597
604
|
/** Request timeout per attempt in ms. Defaults to 10000. */
|
|
598
605
|
timeout?: number;
|
|
599
606
|
}
|
|
600
607
|
declare class BetterCMSManagementClient extends BetterCMSDeliveryClient {
|
|
601
608
|
readonly timeout: number;
|
|
602
609
|
private readonly _apiKey;
|
|
610
|
+
private readonly _project?;
|
|
603
611
|
constructor(options: BetterCMSManagementOptions);
|
|
604
612
|
headers(): Record<string, string>;
|
|
605
613
|
/** Management API URL: baseUrl + path (path is workspace-scoped via the key). */
|
package/dist/index.js
CHANGED
|
@@ -673,15 +673,18 @@ var RETRY_DELAYS2 = [1e3, 2e3, 4e3];
|
|
|
673
673
|
var BetterCMSManagementClient = class extends BetterCMSDeliveryClient {
|
|
674
674
|
timeout;
|
|
675
675
|
_apiKey;
|
|
676
|
+
_project;
|
|
676
677
|
constructor(options) {
|
|
677
678
|
super({ workspace: "", baseUrl: options.baseUrl ?? DEFAULT_BASE_URL2 });
|
|
678
679
|
this._apiKey = options.apiKey;
|
|
680
|
+
this._project = options.project;
|
|
679
681
|
this.timeout = options.timeout ?? DEFAULT_TIMEOUT2;
|
|
680
682
|
}
|
|
681
683
|
headers() {
|
|
682
684
|
return {
|
|
683
685
|
"Content-Type": "application/json",
|
|
684
|
-
"X-API-Key": this._apiKey
|
|
686
|
+
"X-API-Key": this._apiKey,
|
|
687
|
+
...this._project ? { "X-BCMS-Project": this._project } : {}
|
|
685
688
|
};
|
|
686
689
|
}
|
|
687
690
|
/** Management API URL: baseUrl + path (path is workspace-scoped via the key). */
|