@remkoj/optimizely-cms-api 6.0.0-pre4 → 6.0.0-pre6

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.
@@ -57,6 +57,7 @@ declare class BaseApiClient {
57
57
  * @returns The version information from the running instance
58
58
  */
59
59
  getInstanceInfo(): Promise<InstanceApiVersionInfo>;
60
+ getOpenApiSpec(): Promise<any>;
60
61
  protected createClientConfig: CreateClientConfig;
61
62
  }
62
63
  export declare class ApiError extends Error {
@@ -156,6 +156,14 @@ class BaseApiClient {
156
156
  return result.data;
157
157
  throw new ApiError(result);
158
158
  }
159
+ async getOpenApiSpec() {
160
+ const result = await this._client.get({
161
+ url: '/docs/content-openapi.json'
162
+ });
163
+ if (result.data)
164
+ return result.data;
165
+ throw new ApiError(result);
166
+ }
159
167
  createClientConfig = (override) => {
160
168
  return {
161
169
  ...override,
@@ -102,13 +102,15 @@ const createClient = (config = {}) => {
102
102
  ...result,
103
103
  };
104
104
  }
105
- let error = await response.text();
105
+ const textError = await response.text();
106
+ let jsonError;
106
107
  try {
107
- error = JSON.parse(error);
108
+ jsonError = JSON.parse(textError);
108
109
  }
109
110
  catch {
110
111
  // noop
111
112
  }
113
+ const error = jsonError ?? textError;
112
114
  let finalError = error;
113
115
  for (const fn of interceptors.error._fns) {
114
116
  if (fn) {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@remkoj/optimizely-cms-api",
3
3
  "displayName": "Optimizely CMS - Integration API Client",
4
4
  "description": "A Javascript client for the Integration API provided by the Optimizely CMS.",
5
- "version": "6.0.0-pre4",
5
+ "version": "6.0.0-pre6",
6
6
  "type": "commonjs",
7
7
  "license": "Apache-2.0",
8
8
  "main": "./dist/index.js",
@@ -12,17 +12,17 @@
12
12
  ],
13
13
  "devDependencies": {
14
14
  "@hey-api/client-fetch": "^0.13.1",
15
- "@hey-api/openapi-ts": "^0.78.2",
16
- "@types/node": "^22.16.2",
17
- "dotenv": "^17.1.0",
15
+ "@hey-api/openapi-ts": "^0.78.3",
16
+ "@types/node": "^22.16.4",
17
+ "dotenv": "^17.2.0",
18
18
  "dotenv-expand": "^12.0.2",
19
19
  "glob": "^11.0.3",
20
20
  "rimraf": "^6.0.1",
21
21
  "typescript": "^5.8.3"
22
22
  },
23
23
  "dependencies": {
24
- "@types/node": "^22.16.2",
25
- "dotenv": "^17.1.0",
24
+ "@types/node": "^22.16.4",
25
+ "dotenv": "^17.2.0",
26
26
  "glob": "^11.0.3",
27
27
  "openapi-typescript-codegen": "^0.29.0",
28
28
  "tslib": "^2.8.1",