@credal/sdk 0.0.27 → 0.0.29

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.
Files changed (57) hide show
  1. package/api/resources/copilots/client/Client.d.ts +18 -9
  2. package/api/resources/copilots/client/Client.js +121 -52
  3. package/api/resources/documentCatalog/client/Client.d.ts +6 -3
  4. package/api/resources/documentCatalog/client/Client.js +40 -16
  5. package/api/resources/documentCollections/client/Client.d.ts +12 -6
  6. package/api/resources/documentCollections/client/Client.js +80 -32
  7. package/api/resources/permissionsService/client/Client.d.ts +6 -3
  8. package/api/resources/permissionsService/client/Client.js +48 -21
  9. package/api/resources/search/client/Client.d.ts +2 -1
  10. package/api/resources/search/client/Client.js +16 -7
  11. package/api/resources/users/client/Client.d.ts +2 -1
  12. package/api/resources/users/client/Client.js +8 -2
  13. package/core/fetcher/APIResponse.d.ts +10 -0
  14. package/core/fetcher/Fetcher.js +7 -0
  15. package/core/fetcher/Headers.d.ts +2 -0
  16. package/core/fetcher/Headers.js +84 -0
  17. package/core/fetcher/HttpResponsePromise.d.ts +58 -0
  18. package/core/fetcher/HttpResponsePromise.js +103 -0
  19. package/core/fetcher/RawResponse.d.ts +29 -0
  20. package/core/fetcher/RawResponse.js +44 -0
  21. package/core/fetcher/index.d.ts +3 -0
  22. package/core/fetcher/index.js +7 -1
  23. package/core/index.d.ts +1 -1
  24. package/core/index.js +1 -1
  25. package/dist/api/resources/copilots/client/Client.d.ts +18 -9
  26. package/dist/api/resources/copilots/client/Client.js +121 -52
  27. package/dist/api/resources/documentCatalog/client/Client.d.ts +6 -3
  28. package/dist/api/resources/documentCatalog/client/Client.js +40 -16
  29. package/dist/api/resources/documentCollections/client/Client.d.ts +12 -6
  30. package/dist/api/resources/documentCollections/client/Client.js +80 -32
  31. package/dist/api/resources/permissionsService/client/Client.d.ts +6 -3
  32. package/dist/api/resources/permissionsService/client/Client.js +48 -21
  33. package/dist/api/resources/search/client/Client.d.ts +2 -1
  34. package/dist/api/resources/search/client/Client.js +16 -7
  35. package/dist/api/resources/users/client/Client.d.ts +2 -1
  36. package/dist/api/resources/users/client/Client.js +8 -2
  37. package/dist/core/fetcher/APIResponse.d.ts +10 -0
  38. package/dist/core/fetcher/Fetcher.js +7 -0
  39. package/dist/core/fetcher/Headers.d.ts +2 -0
  40. package/dist/core/fetcher/Headers.js +84 -0
  41. package/dist/core/fetcher/HttpResponsePromise.d.ts +58 -0
  42. package/dist/core/fetcher/HttpResponsePromise.js +103 -0
  43. package/dist/core/fetcher/RawResponse.d.ts +29 -0
  44. package/dist/core/fetcher/RawResponse.js +44 -0
  45. package/dist/core/fetcher/index.d.ts +3 -0
  46. package/dist/core/fetcher/index.js +7 -1
  47. package/dist/core/index.d.ts +1 -1
  48. package/dist/core/index.js +1 -1
  49. package/dist/errors/CredalError.d.ts +4 -1
  50. package/dist/errors/CredalError.js +4 -7
  51. package/dist/version.d.ts +1 -1
  52. package/dist/version.js +1 -1
  53. package/errors/CredalError.d.ts +4 -1
  54. package/errors/CredalError.js +4 -7
  55. package/package.json +3 -2
  56. package/version.d.ts +1 -1
  57. package/version.js +1 -1
@@ -0,0 +1,29 @@
1
+ /**
2
+ * The raw response from the fetch call excluding the body.
3
+ */
4
+ export type RawResponse = Omit<{
5
+ [K in keyof Response as Response[K] extends Function ? never : K]: Response[K];
6
+ }, "ok" | "body" | "bodyUsed">;
7
+ /**
8
+ * A raw response indicating that the request was aborted.
9
+ */
10
+ export declare const abortRawResponse: RawResponse;
11
+ /**
12
+ * A raw response indicating an unknown error.
13
+ */
14
+ export declare const unknownRawResponse: RawResponse;
15
+ /**
16
+ * Converts a `RawResponse` object into a `RawResponse` by extracting its properties,
17
+ * excluding the `body` and `bodyUsed` fields.
18
+ *
19
+ * @param response - The `RawResponse` object to convert.
20
+ * @returns A `RawResponse` object containing the extracted properties of the input response.
21
+ */
22
+ export declare function toRawResponse(response: Response): RawResponse;
23
+ /**
24
+ * Creates a `RawResponse` from a standard `Response` object.
25
+ */
26
+ export interface WithRawResponse<T> {
27
+ readonly data: T;
28
+ readonly rawResponse: RawResponse;
29
+ }
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.unknownRawResponse = exports.abortRawResponse = void 0;
4
+ exports.toRawResponse = toRawResponse;
5
+ const Headers_1 = require("./Headers");
6
+ /**
7
+ * A raw response indicating that the request was aborted.
8
+ */
9
+ exports.abortRawResponse = {
10
+ headers: new Headers_1.Headers(),
11
+ redirected: false,
12
+ status: 499,
13
+ statusText: "Client Closed Request",
14
+ type: "error",
15
+ url: "",
16
+ };
17
+ /**
18
+ * A raw response indicating an unknown error.
19
+ */
20
+ exports.unknownRawResponse = {
21
+ headers: new Headers_1.Headers(),
22
+ redirected: false,
23
+ status: 0,
24
+ statusText: "Unknown Error",
25
+ type: "error",
26
+ url: "",
27
+ };
28
+ /**
29
+ * Converts a `RawResponse` object into a `RawResponse` by extracting its properties,
30
+ * excluding the `body` and `bodyUsed` fields.
31
+ *
32
+ * @param response - The `RawResponse` object to convert.
33
+ * @returns A `RawResponse` object containing the extracted properties of the input response.
34
+ */
35
+ function toRawResponse(response) {
36
+ return {
37
+ headers: response.headers,
38
+ redirected: response.redirected,
39
+ status: response.status,
40
+ statusText: response.statusText,
41
+ type: response.type,
42
+ url: response.url,
43
+ };
44
+ }
@@ -3,3 +3,6 @@ export { fetcher } from "./Fetcher";
3
3
  export type { Fetcher, FetchFunction } from "./Fetcher";
4
4
  export { getHeader } from "./getHeader";
5
5
  export { Supplier } from "./Supplier";
6
+ export { abortRawResponse, toRawResponse, unknownRawResponse } from "./RawResponse";
7
+ export type { RawResponse, WithRawResponse } from "./RawResponse";
8
+ export { HttpResponsePromise } from "./HttpResponsePromise";
@@ -1,9 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Supplier = exports.getHeader = exports.fetcher = void 0;
3
+ exports.HttpResponsePromise = exports.unknownRawResponse = exports.toRawResponse = exports.abortRawResponse = exports.Supplier = exports.getHeader = exports.fetcher = void 0;
4
4
  var Fetcher_1 = require("./Fetcher");
5
5
  Object.defineProperty(exports, "fetcher", { enumerable: true, get: function () { return Fetcher_1.fetcher; } });
6
6
  var getHeader_1 = require("./getHeader");
7
7
  Object.defineProperty(exports, "getHeader", { enumerable: true, get: function () { return getHeader_1.getHeader; } });
8
8
  var Supplier_1 = require("./Supplier");
9
9
  Object.defineProperty(exports, "Supplier", { enumerable: true, get: function () { return Supplier_1.Supplier; } });
10
+ var RawResponse_1 = require("./RawResponse");
11
+ Object.defineProperty(exports, "abortRawResponse", { enumerable: true, get: function () { return RawResponse_1.abortRawResponse; } });
12
+ Object.defineProperty(exports, "toRawResponse", { enumerable: true, get: function () { return RawResponse_1.toRawResponse; } });
13
+ Object.defineProperty(exports, "unknownRawResponse", { enumerable: true, get: function () { return RawResponse_1.unknownRawResponse; } });
14
+ var HttpResponsePromise_1 = require("./HttpResponsePromise");
15
+ Object.defineProperty(exports, "HttpResponsePromise", { enumerable: true, get: function () { return HttpResponsePromise_1.HttpResponsePromise; } });
@@ -1,5 +1,5 @@
1
1
  export * from "./fetcher";
2
- export * from "./auth";
3
2
  export * from "./runtime";
3
+ export * from "./auth";
4
4
  export * from "./streaming-fetcher";
5
5
  export * as serialization from "./schemas";
@@ -38,7 +38,7 @@ var __importStar = (this && this.__importStar) || (function () {
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.serialization = void 0;
40
40
  __exportStar(require("./fetcher"), exports);
41
- __exportStar(require("./auth"), exports);
42
41
  __exportStar(require("./runtime"), exports);
42
+ __exportStar(require("./auth"), exports);
43
43
  __exportStar(require("./streaming-fetcher"), exports);
44
44
  exports.serialization = __importStar(require("./schemas"));
@@ -1,12 +1,15 @@
1
1
  /**
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
+ import * as core from "../core";
4
5
  export declare class CredalError extends Error {
5
6
  readonly statusCode?: number;
6
7
  readonly body?: unknown;
7
- constructor({ message, statusCode, body }: {
8
+ readonly rawResponse?: core.RawResponse;
9
+ constructor({ message, statusCode, body, rawResponse, }: {
8
10
  message?: string;
9
11
  statusCode?: number;
10
12
  body?: unknown;
13
+ rawResponse?: core.RawResponse;
11
14
  });
12
15
  }
@@ -6,15 +6,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.CredalError = void 0;
7
7
  const json_1 = require("../core/json");
8
8
  class CredalError extends Error {
9
- constructor({ message, statusCode, body }) {
9
+ constructor({ message, statusCode, body, rawResponse, }) {
10
10
  super(buildMessage({ message, statusCode, body }));
11
11
  Object.setPrototypeOf(this, CredalError.prototype);
12
- if (statusCode != null) {
13
- this.statusCode = statusCode;
14
- }
15
- if (body !== undefined) {
16
- this.body = body;
17
- }
12
+ this.statusCode = statusCode;
13
+ this.body = body;
14
+ this.rawResponse = rawResponse;
18
15
  }
19
16
  }
20
17
  exports.CredalError = CredalError;
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.0.27";
1
+ export declare const SDK_VERSION = "0.0.29";
package/dist/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = void 0;
4
- exports.SDK_VERSION = "0.0.27";
4
+ exports.SDK_VERSION = "0.0.29";
@@ -1,12 +1,15 @@
1
1
  /**
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
+ import * as core from "../core";
4
5
  export declare class CredalError extends Error {
5
6
  readonly statusCode?: number;
6
7
  readonly body?: unknown;
7
- constructor({ message, statusCode, body }: {
8
+ readonly rawResponse?: core.RawResponse;
9
+ constructor({ message, statusCode, body, rawResponse, }: {
8
10
  message?: string;
9
11
  statusCode?: number;
10
12
  body?: unknown;
13
+ rawResponse?: core.RawResponse;
11
14
  });
12
15
  }
@@ -6,15 +6,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.CredalError = void 0;
7
7
  const json_1 = require("../core/json");
8
8
  class CredalError extends Error {
9
- constructor({ message, statusCode, body }) {
9
+ constructor({ message, statusCode, body, rawResponse, }) {
10
10
  super(buildMessage({ message, statusCode, body }));
11
11
  Object.setPrototypeOf(this, CredalError.prototype);
12
- if (statusCode != null) {
13
- this.statusCode = statusCode;
14
- }
15
- if (body !== undefined) {
16
- this.body = body;
17
- }
12
+ this.statusCode = statusCode;
13
+ this.body = body;
14
+ this.rawResponse = rawResponse;
18
15
  }
19
16
  }
20
17
  exports.CredalError = CredalError;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@credal/sdk",
3
- "version": "0.0.27",
3
+ "version": "0.0.29",
4
4
  "private": false,
5
5
  "repository": "https://github.com/credal-ai/credal-typescript-sdk",
6
6
  "main": "./index.js",
@@ -39,5 +39,6 @@
39
39
  "fs": false,
40
40
  "os": false,
41
41
  "path": false
42
- }
42
+ },
43
+ "packageManager": "yarn@1.22.22"
43
44
  }
package/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.0.27";
1
+ export declare const SDK_VERSION = "0.0.29";
package/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = void 0;
4
- exports.SDK_VERSION = "0.0.27";
4
+ exports.SDK_VERSION = "0.0.29";