extractia-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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "extractia-sdk",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "JavaScript SDK for the ExtractIA API",
5
5
  "author": "Tu Nombre o Empresa",
6
6
  "license": "MIT",
package/src/apiClient.js CHANGED
@@ -1,22 +1,21 @@
1
- // src/apiClient.js
2
1
  import axios from 'axios';
3
2
 
4
3
  let token = null;
5
4
 
6
- export const setToken = (newToken) => {
7
- token = newToken;
8
- };
9
-
10
- const instance = axios.create({
5
+ const api = axios.create({
11
6
  baseURL: 'https://www.extractia-api.cat/api/public',
12
7
  timeout: 10000,
13
8
  });
14
9
 
15
- instance.interceptors.request.use((config) => {
10
+ api.interceptors.request.use((config) => {
16
11
  if (token) {
17
12
  config.headers.Authorization = `Bearer ${token}`;
18
13
  }
19
14
  return config;
20
15
  });
21
16
 
22
- export default instance;
17
+ export function setToken(newToken) {
18
+ token = newToken;
19
+ }
20
+
21
+ export default api;
package/src/auth.js CHANGED
@@ -1,6 +1,5 @@
1
1
  // src/auth.js
2
- import api from './apiClient.js';
3
- import { setToken } from './apiClient.js';
2
+ import api, { setToken } from './apiClient.js';
4
3
 
5
4
  export async function getMyProfile() {
6
5
  const response = await api.get('/me');
@@ -14,4 +13,4 @@ export async function updateWebhook(url) {
14
13
  return response.data;
15
14
  }
16
15
 
17
- export { setToken };
16
+ export { setToken };
package/src/index.js CHANGED
@@ -1,4 +1,15 @@
1
- // src/index.js
1
+ import * as auth from './auth.js';
2
+ import * as templates from './templates.js';
3
+ import * as documents from './documents.js';
4
+
2
5
  export * from './auth.js';
3
6
  export * from './templates.js';
4
7
  export * from './documents.js';
8
+
9
+ const extractia = {
10
+ ...auth,
11
+ ...templates,
12
+ ...documents,
13
+ };
14
+
15
+ export default extractia;