@examplary/sdk 1.0.0 → 1.0.2

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/src/index.js CHANGED
@@ -1,81 +1,47 @@
1
1
  "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
- var __assign = (this && this.__assign) || function () {
18
- __assign = Object.assign || function(t) {
19
- for (var s, i = 1, n = arguments.length; i < n; i++) {
20
- s = arguments[i];
21
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
22
- t[p] = s[p];
23
- }
24
- return t;
25
- };
26
- return __assign.apply(this, arguments);
27
- };
28
- var __rest = (this && this.__rest) || function (s, e) {
29
- var t = {};
30
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
31
- t[p] = s[p];
32
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
33
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
34
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
35
- t[p[i]] = s[p[i]];
36
- }
37
- return t;
38
- };
39
2
  Object.defineProperty(exports, "__esModule", { value: true });
40
3
  exports.createExamplaryClient = exports.ExamplaryClientError = void 0;
41
- var axios_1 = require("axios");
42
- var client_1 = require("../generated/client");
43
- var client_2 = require("../generated/client/client");
44
- var ExamplaryClientError = /** @class */ (function (_super) {
45
- __extends(ExamplaryClientError, _super);
46
- function ExamplaryClientError(message, code, config, request, response) {
47
- var _this = _super.call(this, message, code, config, request, response) || this;
48
- _this.name = "ExamplaryClientError";
49
- return _this;
4
+ const axios_1 = require("axios");
5
+ const client_1 = require("../generated/client");
6
+ const client_2 = require("../generated/client/client");
7
+ class ExamplaryClientError extends axios_1.AxiosError {
8
+ constructor(message, code, config, request, response) {
9
+ super(message, code, config, request, response);
10
+ this.name = "ExamplaryClientError";
50
11
  }
51
- ExamplaryClientError.fromAxiosError = function (error) {
52
- var _a, _b;
53
- var e = new ExamplaryClientError(error.message, error.code, error.config, error.request, error.response);
54
- var responseData = (_a = error.response) === null || _a === void 0 ? void 0 : _a.data;
55
- if (responseData === null || responseData === void 0 ? void 0 : responseData.error) {
12
+ static fromAxiosError(error) {
13
+ const e = new ExamplaryClientError(error.message, error.code, error.config, error.request, error.response);
14
+ const responseData = error.response?.data;
15
+ if (responseData?.error) {
56
16
  if (typeof responseData.error === "string") {
57
17
  e.originalMessage = error.message;
58
18
  e.message = responseData.error;
59
19
  }
60
- else if (((_b = responseData.error) === null || _b === void 0 ? void 0 : _b.message) &&
20
+ else if (responseData.error?.message &&
61
21
  typeof responseData.error.message === "string") {
62
22
  e.originalMessage = error.message;
63
23
  e.message = responseData.error.message;
64
24
  }
65
25
  }
66
26
  return e;
67
- };
68
- return ExamplaryClientError;
69
- }(axios_1.AxiosError));
27
+ }
28
+ }
70
29
  exports.ExamplaryClientError = ExamplaryClientError;
71
- var createExamplaryClient = function (options) {
72
- var apiKey = options.apiKey, baseUrl = options.baseUrl, rest = __rest(options, ["apiKey", "baseUrl"]);
73
- var client = (0, client_2.createClient)(__assign(__assign({ baseURL: baseUrl || "https://api.examplary.ai" }, rest), { headers: __assign({ Authorization: apiKey ? "Bearer ".concat(apiKey) : undefined }, rest.headers) }));
74
- client.instance.interceptors.response.use(function (response) { return Promise.resolve(response); }, function (error) {
30
+ const createExamplaryClient = (options) => {
31
+ const { apiKey, baseUrl, ...rest } = options;
32
+ const client = (0, client_2.createClient)({
33
+ baseURL: baseUrl || "https://api.examplary.ai",
34
+ ...rest,
35
+ headers: {
36
+ Authorization: apiKey ? `Bearer ${apiKey}` : undefined,
37
+ ...rest.headers,
38
+ },
39
+ });
40
+ client.instance.interceptors.response.use((response) => Promise.resolve(response), (error) => {
75
41
  return Promise.reject(ExamplaryClientError.fromAxiosError(error));
76
42
  });
77
43
  return new client_1.Examplary({
78
- client: client,
44
+ client,
79
45
  });
80
46
  };
81
47
  exports.createExamplaryClient = createExamplaryClient;
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@examplary/sdk",
3
- "packageManager": "yarn@4.8.1",
4
- "version": "1.0.0",
3
+ "packageManager": "yarn@4.13.0",
4
+ "version": "1.0.2",
5
5
  "description": "TypeScript SDK for accessing the Examplary API.",
6
6
  "scripts": {
7
- "build:client": "openapi-ts && tsx scripts/cleanup.ts",
7
+ "build:client": "openapi-ts",
8
8
  "build:tsc": "tsc",
9
9
  "build": "yarn build:client && yarn build:tsc",
10
- "release": "semantic-release -e semantic-release-monorepo",
10
+ "release": "yarn remove @hey-api/openapi-ts tsx typescript vitest && npm publish",
11
11
  "test": "vitest"
12
12
  },
13
13
  "files": [
@@ -16,17 +16,11 @@
16
16
  "publishConfig": {
17
17
  "access": "public"
18
18
  },
19
- "main": "./dist/index.js",
20
- "types": "./dist/index.d.ts",
21
- "devDependencies": {
22
- "@hey-api/openapi-ts": "^0.91.1",
23
- "tsx": "^4.21.0",
24
- "typescript": "^5.9.3",
25
- "vitest": "^4.0.18"
26
- },
19
+ "main": "./dist/src/index.js",
20
+ "types": "./dist/src/index.d.ts",
27
21
  "dependencies": {
28
- "axios": "^1.13.4",
29
- "openapi-typescript": "^7.10.1",
22
+ "axios": "^1.15.0",
23
+ "openapi-typescript": "^7.13.0",
30
24
  "zod": "^4.3.6"
31
25
  },
32
26
  "homepage": "https://developers.examplary.ai/",