@arisnetxsolutions/quantum-core-sdk 1.0.3 → 1.0.4
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/README.md +126 -54
- package/dist/index.d.ts +74 -6
- package/dist/index.js +86 -12
- package/dist/types.d.ts +225 -0
- package/package.json +2 -3
package/README.md
CHANGED
|
@@ -1,78 +1,150 @@
|
|
|
1
|
-
# QuantumCore SDK 📦
|
|
1
|
+
# QuantumCore SDK 📦 🛡️
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+

|
|
4
|
+

|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
Librería oficial de **QuantumCore CMS** para el consumo de contenido de forma tipada, segura y eficiente. Diseñada especialmente para integraciones con React, Next.js, Vue y cualquier entorno Moderno de JavaScript/TypeScript.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## 🔥 Características Principales
|
|
12
|
+
|
|
13
|
+
- 💎 **Type-Safe**: Aprovecha el poder de TypeScript con interfaces completas para todos tus modelos.
|
|
14
|
+
- 🚀 **Zero Config**: Inicialización rápida con solo tu API Key y URL del servidor.
|
|
15
|
+
- 🔐 **Dual Auth**: Soporta tanto el consumo público (API Keys de Proyecto) como la gestión administrativa (JWT).
|
|
16
|
+
- 🖼️ **Asset Management**: Sistema integrado para obtener URLs absolutas de imágenes y archivos.
|
|
17
|
+
- 📑 **Modular**: Separación clara entre Blog, Servicios, Galería y Funciones Administrativas.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## ⚙️ Instalación
|
|
22
|
+
|
|
23
|
+
Instala el paquete mediante npm:
|
|
4
24
|
|
|
5
|
-
## Installation
|
|
6
25
|
```bash
|
|
7
|
-
|
|
8
|
-
npm install quantum-core-sdk
|
|
26
|
+
npm install @arisnetxsolutions/quantum-core-sdk
|
|
9
27
|
```
|
|
10
28
|
|
|
11
|
-
|
|
29
|
+
---
|
|
12
30
|
|
|
13
|
-
|
|
31
|
+
## 🚀 Inicio Rápido
|
|
14
32
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
33
|
+
### Inicialización del Cliente
|
|
34
|
+
Obtén tu **API Key** desde el panel de administración de QuantumCore en la sección "Proyectos".
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
import { QuantumCore } from '@arisnetxsolutions/quantum-core-sdk';
|
|
38
|
+
|
|
39
|
+
const qc = new QuantumCore({
|
|
40
|
+
baseUrl: 'https://tu-api.com/api/v1',
|
|
41
|
+
apiKey: 'tu_api_key_de_proyecto'
|
|
42
|
+
});
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## 📖 Módulos de Contenido (Público)
|
|
48
|
+
|
|
49
|
+
### 📰 Blog & Posts
|
|
50
|
+
Obtén tus artículos con soporte para paginación y SEO completo.
|
|
51
|
+
|
|
52
|
+
```typescript
|
|
53
|
+
// Listar todos los posts
|
|
54
|
+
const { data, pagination } = await qc.blog.getAll({ page: 1, limit: 12 });
|
|
55
|
+
|
|
56
|
+
// Obtener detalle por slug (Ideal para rutas dinámicas)
|
|
57
|
+
const post = await qc.blog.getBySlug('el-futuro-del-desarrollo-web');
|
|
58
|
+
|
|
59
|
+
// Obtener por ID
|
|
60
|
+
const postById = await qc.blog.getById(42);
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### 🛠️ Servicios
|
|
64
|
+
Gestiona tu catálogo de servicios, planes de precios y FAQs.
|
|
65
|
+
|
|
66
|
+
```typescript
|
|
67
|
+
// Listar servicios
|
|
68
|
+
const { services } = await qc.services.getAll();
|
|
69
|
+
|
|
70
|
+
// Obtener detalle completo
|
|
71
|
+
const service = await qc.services.getBySlug('desarrollo-personalizado');
|
|
18
72
|
```
|
|
19
73
|
|
|
74
|
+
### 🖼️ Galería de Imágenes
|
|
75
|
+
Acceso directo a tus activos visuales organizados por categorías.
|
|
76
|
+
|
|
20
77
|
```typescript
|
|
21
|
-
|
|
78
|
+
// Obtener imágenes de una categoría específica
|
|
79
|
+
const images = await qc.gallery.getAll({ category: 'Proyectos 2024' });
|
|
22
80
|
|
|
23
|
-
//
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
81
|
+
// Obtener URL absoluta de una imagen del CMS
|
|
82
|
+
const imagePath = images[0].url;
|
|
83
|
+
const fullUrl = qc.getImageUrl(imagePath);
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## 🔒 Gestión Administrativa (Auth)
|
|
89
|
+
|
|
90
|
+
El SDK permite realizar operaciones que requieren autenticación de administrador (JWT).
|
|
91
|
+
|
|
92
|
+
```typescript
|
|
93
|
+
// 1. Iniciar sesión para obtener el token
|
|
94
|
+
const { token, user } = await qc.admin.login({
|
|
95
|
+
email: 'admin@empresa.com',
|
|
96
|
+
password: 'tu_password_seguro'
|
|
27
97
|
});
|
|
28
98
|
|
|
29
|
-
//
|
|
30
|
-
|
|
31
|
-
|
|
99
|
+
// El SDK guarda el token automáticamente para futuras peticiones Admin
|
|
100
|
+
|
|
101
|
+
// 2. Crear un nuevo post desde el SDK
|
|
102
|
+
const newPost = await qc.admin.posts.create({
|
|
103
|
+
title: 'Anuncio Importante',
|
|
104
|
+
content: '<p>Contenido detallado...</p>',
|
|
105
|
+
status: 'Published'
|
|
32
106
|
});
|
|
33
107
|
|
|
34
|
-
|
|
35
|
-
const
|
|
108
|
+
// 3. Subir archivos
|
|
109
|
+
const formData = new FormData();
|
|
110
|
+
formData.append('image', file);
|
|
111
|
+
const uploadedImage = await qc.admin.images.upload(formData);
|
|
112
|
+
|
|
113
|
+
// 4. Obtener estadísticas globales
|
|
114
|
+
const stats = await qc.admin.getStats();
|
|
36
115
|
```
|
|
37
116
|
|
|
38
|
-
|
|
39
|
-
- **Full Type Safety**: All responses are fully typed.
|
|
40
|
-
- **Axios-based**: Reliable and customizable HTTP client.
|
|
41
|
-
- **Simplified API**: Simple methods for blog and gallery content.
|
|
42
|
-
|
|
43
|
-
## Publishing to npm
|
|
44
|
-
1. Ensure the `name` field in `packages/sdk/package.json` reflects the
|
|
45
|
-
package you intend to publish (currently `quantum-core-sdk`).
|
|
46
|
-
Since this is now an **unscoped** package there is no need to create an npm
|
|
47
|
-
organization or worry about scope permissions; simply pick a name that isn’t
|
|
48
|
-
already taken on the registry. If you ever switch back to a scoped name, the
|
|
49
|
-
rules earlier in this document about creating the scope and having publish
|
|
50
|
-
rights apply.
|
|
51
|
-
`quantum-core-sdk` instead.
|
|
52
|
-
2. Update the version (semantic versioning) and commit the change.
|
|
53
|
-
3. Run `npm run build` to regenerate `dist/`.
|
|
54
|
-
4. Authenticate using an OTP or a token with 2FA bypass:
|
|
55
|
-
```bash
|
|
56
|
-
# interactive
|
|
57
|
-
npm login
|
|
58
|
-
# you will be prompted for a 2FA code
|
|
117
|
+
---
|
|
59
118
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
119
|
+
## 🛠️ API Reference
|
|
120
|
+
|
|
121
|
+
### Clase `QuantumCore`
|
|
122
|
+
| Método | Descripción |
|
|
123
|
+
| :--- | :--- |
|
|
124
|
+
| `blog` | Acceso a posts y artículos. |
|
|
125
|
+
| `services` | Acceso a catálogo de servicios. |
|
|
126
|
+
| `gallery` | Acceso a imágenes y media. |
|
|
127
|
+
| `admin` | Operaciones CRUD y configuración (Requiere Auth). |
|
|
128
|
+
| `getImageUrl(path)` | Convierte un path relativo en una URL absoluta funcional. |
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## 🏗️ Desarrollo & Publicación
|
|
133
|
+
|
|
134
|
+
Para contribuidores o actualizaciones del SDK:
|
|
135
|
+
|
|
136
|
+
1. Modifica el código en `src/`.
|
|
137
|
+
2. Compila el proyecto:
|
|
138
|
+
```bash
|
|
139
|
+
npm run build
|
|
63
140
|
```
|
|
64
|
-
|
|
65
|
-
`--//registry.npmjs.org/:_authToken=$NPM_TOKEN`).
|
|
66
|
-
5. Publish:
|
|
141
|
+
3. Publica en el registro de NPM:
|
|
67
142
|
```bash
|
|
68
|
-
cd packages/sdk
|
|
69
143
|
npm publish --access public
|
|
70
144
|
```
|
|
71
145
|
|
|
72
|
-
|
|
73
|
-
permissions; 403 indicates a 2FA issue.
|
|
74
|
-
The `publish` script in `package.json` currently embeds a token – be
|
|
75
|
-
cautious about committing that to source control.
|
|
146
|
+
---
|
|
76
147
|
|
|
77
|
-
|
|
78
|
-
|
|
148
|
+
## 🛡️ Soporte
|
|
149
|
+
Creado con ❤️ por el equipo de **ArisnetX Solutions**.
|
|
150
|
+
Si encuentras un bug o tienes una sugerencia, contacta con soporte técnico.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,26 +1,94 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BlogDetailResponse, BlogListResponse, Image, Post, SDKConfig, ServiceListResponse, ServiceDetail, Project, User, Service } from './types';
|
|
2
2
|
export declare class QuantumCore {
|
|
3
3
|
private api;
|
|
4
4
|
constructor(config: SDKConfig);
|
|
5
|
+
getImageUrl(path: string | null | undefined): string;
|
|
5
6
|
blog: {
|
|
6
|
-
getAll: (
|
|
7
|
-
|
|
7
|
+
getAll: (params?: {
|
|
8
|
+
page?: number;
|
|
9
|
+
limit?: number;
|
|
10
|
+
}) => Promise<BlogListResponse>;
|
|
11
|
+
getBySlug: (slug: string) => Promise<BlogDetailResponse>;
|
|
12
|
+
getById: (id: number) => Promise<BlogDetailResponse>;
|
|
8
13
|
};
|
|
9
14
|
gallery: {
|
|
10
|
-
getAll: (
|
|
15
|
+
getAll: (params?: {
|
|
16
|
+
category?: string;
|
|
17
|
+
isVisible?: boolean;
|
|
18
|
+
}) => Promise<Image[]>;
|
|
19
|
+
getById: (id: number) => Promise<Image>;
|
|
20
|
+
};
|
|
21
|
+
services: {
|
|
22
|
+
getAll: (params?: {
|
|
23
|
+
page?: number;
|
|
24
|
+
limit?: number;
|
|
25
|
+
}) => Promise<ServiceListResponse>;
|
|
26
|
+
getBySlug: (slug: string) => Promise<ServiceDetail>;
|
|
11
27
|
};
|
|
12
28
|
admin: {
|
|
13
29
|
posts: {
|
|
14
30
|
getAll: () => Promise<Post[]>;
|
|
31
|
+
getById: (id: number | string) => Promise<Post>;
|
|
15
32
|
create: (data: Partial<Post>) => Promise<Post>;
|
|
16
|
-
|
|
33
|
+
update: (id: number | string, data: Partial<Post>) => Promise<Post>;
|
|
34
|
+
delete: (id: number | string) => Promise<any>;
|
|
35
|
+
publish: (id: number | string) => Promise<any>;
|
|
36
|
+
unpublish: (id: number | string) => Promise<any>;
|
|
37
|
+
duplicate: (id: number | string) => Promise<any>;
|
|
38
|
+
bulkDelete: (ids: (number | string)[]) => Promise<any>;
|
|
39
|
+
};
|
|
40
|
+
services: {
|
|
41
|
+
getAll: () => Promise<Service[]>;
|
|
42
|
+
getById: (id: number | string) => Promise<Service>;
|
|
43
|
+
create: (data: Partial<Service>) => Promise<Service>;
|
|
44
|
+
update: (id: number | string, data: Partial<Service>) => Promise<Service>;
|
|
45
|
+
delete: (id: number | string) => Promise<any>;
|
|
46
|
+
duplicate: (id: number | string) => Promise<any>;
|
|
47
|
+
bulkDelete: (ids: (number | string)[]) => Promise<any>;
|
|
17
48
|
};
|
|
18
49
|
images: {
|
|
19
50
|
getAll: () => Promise<Image[]>;
|
|
51
|
+
getById: (id: number | string) => Promise<Image>;
|
|
20
52
|
upload: (formData: FormData) => Promise<Image>;
|
|
21
|
-
|
|
53
|
+
bulkUpload: (formData: FormData) => Promise<Image[]>;
|
|
54
|
+
update: (id: number | string, formData: FormData) => Promise<Image>;
|
|
55
|
+
delete: (id: number | string) => Promise<any>;
|
|
56
|
+
bulkDelete: (ids: (number | string)[]) => Promise<any>;
|
|
57
|
+
updateVisibility: (ids: (number | string)[], isVisible: boolean) => Promise<any>;
|
|
58
|
+
updateCategory: (ids: (number | string)[], category: string) => Promise<any>;
|
|
59
|
+
};
|
|
60
|
+
projects: {
|
|
61
|
+
getAll: () => Promise<Project[]>;
|
|
62
|
+
getById: (id: number | string) => Promise<Project>;
|
|
63
|
+
create: (data: Partial<Project>) => Promise<Project>;
|
|
64
|
+
update: (id: number | string, data: Partial<Project>) => Promise<Project>;
|
|
65
|
+
delete: (id: number | string) => Promise<any>;
|
|
66
|
+
regenerateKey: (id: number | string) => Promise<any>;
|
|
67
|
+
};
|
|
68
|
+
users: {
|
|
69
|
+
getAll: () => Promise<User[]>;
|
|
70
|
+
getById: (id: number | string) => Promise<User>;
|
|
71
|
+
create: (data: any) => Promise<User>;
|
|
72
|
+
update: (id: number | string, data: any) => Promise<User>;
|
|
73
|
+
delete: (id: number | string) => Promise<any>;
|
|
74
|
+
updatePermissions: (id: number | string, data: any) => Promise<any>;
|
|
75
|
+
};
|
|
76
|
+
settings: {
|
|
77
|
+
get: () => Promise<any>;
|
|
78
|
+
update: (data: any) => Promise<any>;
|
|
22
79
|
};
|
|
23
80
|
getStats: () => Promise<any>;
|
|
81
|
+
login: (credentials: {
|
|
82
|
+
email: string;
|
|
83
|
+
password: string;
|
|
84
|
+
}) => Promise<{
|
|
85
|
+
token: string;
|
|
86
|
+
user: User;
|
|
87
|
+
}>;
|
|
88
|
+
setToken: (token: string) => void;
|
|
89
|
+
getMe: () => Promise<User>;
|
|
90
|
+
backup: () => Promise<any>;
|
|
91
|
+
restore: (formData: FormData) => Promise<any>;
|
|
24
92
|
};
|
|
25
93
|
}
|
|
26
94
|
export * from './types';
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
|
-
import dotenv from 'dotenv';
|
|
3
|
-
// load variables from .env in development or when running locally
|
|
4
|
-
dotenv.config();
|
|
5
2
|
export class QuantumCore {
|
|
6
3
|
constructor(config) {
|
|
7
4
|
this.blog = {
|
|
8
|
-
getAll: async () => {
|
|
9
|
-
const response = await this.api.get('/content/posts');
|
|
5
|
+
getAll: async (params) => {
|
|
6
|
+
const response = await this.api.get('/content/posts', { params });
|
|
7
|
+
return response.data;
|
|
8
|
+
},
|
|
9
|
+
getBySlug: async (slug) => {
|
|
10
|
+
const response = await this.api.get(`/content/posts/${encodeURIComponent(slug)}`);
|
|
10
11
|
return response.data;
|
|
11
12
|
},
|
|
12
13
|
getById: async (id) => {
|
|
@@ -15,29 +16,92 @@ export class QuantumCore {
|
|
|
15
16
|
}
|
|
16
17
|
};
|
|
17
18
|
this.gallery = {
|
|
18
|
-
getAll: async () => {
|
|
19
|
-
const response = await this.api.get('/content/images');
|
|
19
|
+
getAll: async (params) => {
|
|
20
|
+
const response = await this.api.get('/content/images', { params });
|
|
21
|
+
return response.data;
|
|
22
|
+
},
|
|
23
|
+
getById: async (id) => {
|
|
24
|
+
const response = await this.api.get(`/content/images/${id}`);
|
|
25
|
+
return response.data;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
this.services = {
|
|
29
|
+
getAll: async (params) => {
|
|
30
|
+
const response = await this.api.get('/content/services', { params });
|
|
31
|
+
return response.data;
|
|
32
|
+
},
|
|
33
|
+
getBySlug: async (slug) => {
|
|
34
|
+
const response = await this.api.get(`/content/services/${encodeURIComponent(slug)}`);
|
|
20
35
|
return response.data;
|
|
21
36
|
}
|
|
22
37
|
};
|
|
23
|
-
//
|
|
38
|
+
// Métodos de administración
|
|
24
39
|
this.admin = {
|
|
25
40
|
posts: {
|
|
26
41
|
getAll: async () => (await this.api.get('/admin/posts')).data,
|
|
42
|
+
getById: async (id) => (await this.api.get(`/admin/posts/${id}`)).data,
|
|
27
43
|
create: async (data) => (await this.api.post('/admin/posts', data)).data,
|
|
44
|
+
update: async (id, data) => (await this.api.put(`/admin/posts/${id}`, data)).data,
|
|
28
45
|
delete: async (id) => (await this.api.delete(`/admin/posts/${id}`)).data,
|
|
46
|
+
publish: async (id) => (await this.api.patch(`/admin/posts/${id}/publish`)).data,
|
|
47
|
+
unpublish: async (id) => (await this.api.patch(`/admin/posts/${id}/unpublish`)).data,
|
|
48
|
+
duplicate: async (id) => (await this.api.post(`/admin/posts/${id}/duplicate`)).data,
|
|
49
|
+
bulkDelete: async (ids) => (await this.api.post('/admin/posts/bulk-delete', { ids })).data,
|
|
50
|
+
},
|
|
51
|
+
services: {
|
|
52
|
+
getAll: async () => (await this.api.get('/admin/services')).data,
|
|
53
|
+
getById: async (id) => (await this.api.get(`/admin/services/${id}`)).data,
|
|
54
|
+
create: async (data) => (await this.api.post('/admin/services', data)).data,
|
|
55
|
+
update: async (id, data) => (await this.api.put(`/admin/services/${id}`, data)).data,
|
|
56
|
+
delete: async (id) => (await this.api.delete(`/admin/services/${id}`)).data,
|
|
57
|
+
duplicate: async (id) => (await this.api.post(`/admin/services/${id}/duplicate`)).data,
|
|
58
|
+
bulkDelete: async (ids) => (await this.api.post('/admin/services/bulk-delete', { ids })).data,
|
|
29
59
|
},
|
|
30
60
|
images: {
|
|
31
61
|
getAll: async () => (await this.api.get('/admin/images')).data,
|
|
62
|
+
getById: async (id) => (await this.api.get(`/admin/images/${id}`)).data,
|
|
32
63
|
upload: async (formData) => (await this.api.post('/admin/images', formData)).data,
|
|
64
|
+
bulkUpload: async (formData) => (await this.api.post('/admin/images/bulk-upload', formData)).data,
|
|
65
|
+
update: async (id, formData) => (await this.api.put(`/admin/images/${id}`, formData)).data,
|
|
33
66
|
delete: async (id) => (await this.api.delete(`/admin/images/${id}`)).data,
|
|
67
|
+
bulkDelete: async (ids) => (await this.api.post('/admin/images/bulk-delete', { ids })).data,
|
|
68
|
+
updateVisibility: async (ids, isVisible) => (await this.api.patch('/admin/images/bulk-visibility', { ids, isVisible })).data,
|
|
69
|
+
updateCategory: async (ids, category) => (await this.api.patch('/admin/images/bulk-category', { ids, category })).data,
|
|
70
|
+
},
|
|
71
|
+
projects: {
|
|
72
|
+
getAll: async () => (await this.api.get('/admin/projects')).data,
|
|
73
|
+
getById: async (id) => (await this.api.get(`/admin/projects/${id}`)).data,
|
|
74
|
+
create: async (data) => (await this.api.post('/admin/projects', data)).data,
|
|
75
|
+
update: async (id, data) => (await this.api.put(`/admin/projects/${id}`, data)).data,
|
|
76
|
+
delete: async (id) => (await this.api.delete(`/admin/projects/${id}`)).data,
|
|
77
|
+
regenerateKey: async (id) => (await this.api.post(`/admin/projects/${id}/regenerate-key`)).data,
|
|
78
|
+
},
|
|
79
|
+
users: {
|
|
80
|
+
getAll: async () => (await this.api.get('/admin/users')).data,
|
|
81
|
+
getById: async (id) => (await this.api.get(`/admin/users/${id}`)).data,
|
|
82
|
+
create: async (data) => (await this.api.post('/admin/users', data)).data,
|
|
83
|
+
update: async (id, data) => (await this.api.put(`/admin/users/${id}`, data)).data,
|
|
84
|
+
delete: async (id) => (await this.api.delete(`/admin/users/${id}`)).data,
|
|
85
|
+
updatePermissions: async (id, data) => (await this.api.patch(`/admin/users/${id}/permissions`, data)).data,
|
|
86
|
+
},
|
|
87
|
+
settings: {
|
|
88
|
+
get: async () => (await this.api.get('/admin/settings')).data,
|
|
89
|
+
update: async (data) => (await this.api.put('/admin/settings', data)).data,
|
|
34
90
|
},
|
|
35
91
|
getStats: async () => (await this.api.get('/admin/stats')).data,
|
|
92
|
+
login: async (credentials) => {
|
|
93
|
+
const response = await this.api.post('/admin/login', credentials);
|
|
94
|
+
this.api.defaults.headers.common['Authorization'] = `Bearer ${response.data.token}`;
|
|
95
|
+
return response.data;
|
|
96
|
+
},
|
|
97
|
+
setToken: (token) => {
|
|
98
|
+
this.api.defaults.headers.common['Authorization'] = `Bearer ${token}`;
|
|
99
|
+
},
|
|
100
|
+
getMe: async () => (await this.api.get('/admin/me')).data,
|
|
101
|
+
backup: async () => (await this.api.post('/admin/backup')).data,
|
|
102
|
+
restore: async (formData) => (await this.api.post('/admin/restore', formData)).data,
|
|
36
103
|
};
|
|
37
|
-
|
|
38
|
-
const baseURL = config.baseUrl ||
|
|
39
|
-
process.env.QUANTUMCORE_API_URL ||
|
|
40
|
-
'http://localhost:3000/api/v1';
|
|
104
|
+
const baseURL = config.baseUrl || 'http://localhost:3310/api/v1';
|
|
41
105
|
this.api = axios.create({
|
|
42
106
|
baseURL,
|
|
43
107
|
headers: {
|
|
@@ -45,5 +109,15 @@ export class QuantumCore {
|
|
|
45
109
|
}
|
|
46
110
|
});
|
|
47
111
|
}
|
|
112
|
+
getImageUrl(path) {
|
|
113
|
+
if (!path)
|
|
114
|
+
return '';
|
|
115
|
+
if (path.startsWith('http'))
|
|
116
|
+
return path;
|
|
117
|
+
const baseURL = this.api.defaults.baseURL || 'http://localhost:3310/api/v1';
|
|
118
|
+
const base = baseURL.split('/api/v1')[0];
|
|
119
|
+
const normalizedPath = path.startsWith('/') ? path : `/${path}`;
|
|
120
|
+
return `${base}${normalizedPath}`;
|
|
121
|
+
}
|
|
48
122
|
}
|
|
49
123
|
export * from './types';
|
package/dist/types.d.ts
CHANGED
|
@@ -8,10 +8,96 @@ export interface Post {
|
|
|
8
8
|
createdAt: string;
|
|
9
9
|
updatedAt: string;
|
|
10
10
|
}
|
|
11
|
+
export interface BlogCategory {
|
|
12
|
+
id: string;
|
|
13
|
+
name: string;
|
|
14
|
+
}
|
|
15
|
+
export interface BlogAuthor {
|
|
16
|
+
id: string;
|
|
17
|
+
name: string;
|
|
18
|
+
avatar?: string | null;
|
|
19
|
+
bio?: string | null;
|
|
20
|
+
social?: {
|
|
21
|
+
twitter?: string | null;
|
|
22
|
+
linkedin?: string | null;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export interface BlogListItem {
|
|
26
|
+
id: string;
|
|
27
|
+
title: string;
|
|
28
|
+
slug: string;
|
|
29
|
+
excerpt: string;
|
|
30
|
+
coverImage: string | null;
|
|
31
|
+
category: BlogCategory | null;
|
|
32
|
+
author: Pick<BlogAuthor, 'id' | 'name' | 'avatar'> | null;
|
|
33
|
+
publishedAt: string;
|
|
34
|
+
readingTime: number;
|
|
35
|
+
tags: string[];
|
|
36
|
+
}
|
|
37
|
+
export interface BlogListResponse {
|
|
38
|
+
data: BlogListItem[];
|
|
39
|
+
pagination: {
|
|
40
|
+
page: number;
|
|
41
|
+
limit: number;
|
|
42
|
+
total: number;
|
|
43
|
+
totalPages: number;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
export interface BlogDetail {
|
|
47
|
+
id: string;
|
|
48
|
+
title: string;
|
|
49
|
+
slug: string;
|
|
50
|
+
content: string;
|
|
51
|
+
coverImage: string | null;
|
|
52
|
+
gallery: string[];
|
|
53
|
+
category: BlogCategory | null;
|
|
54
|
+
author: BlogAuthor | null;
|
|
55
|
+
tags: string[];
|
|
56
|
+
seo: {
|
|
57
|
+
title: string | null;
|
|
58
|
+
description: string | null;
|
|
59
|
+
keywords: string[];
|
|
60
|
+
};
|
|
61
|
+
readingTime: number;
|
|
62
|
+
views: number;
|
|
63
|
+
publishedAt: string;
|
|
64
|
+
updatedAt: string;
|
|
65
|
+
}
|
|
66
|
+
export interface BlogDetailResponse {
|
|
67
|
+
data: BlogDetail;
|
|
68
|
+
}
|
|
11
69
|
export interface Image {
|
|
12
70
|
id: number;
|
|
13
71
|
url: string;
|
|
14
72
|
label?: string;
|
|
73
|
+
alt?: string | null;
|
|
74
|
+
sizes?: {
|
|
75
|
+
thumbnail: {
|
|
76
|
+
url: string | null;
|
|
77
|
+
width: number | null;
|
|
78
|
+
height: number | null;
|
|
79
|
+
};
|
|
80
|
+
small: {
|
|
81
|
+
url: string | null;
|
|
82
|
+
width: number | null;
|
|
83
|
+
height: number | null;
|
|
84
|
+
};
|
|
85
|
+
medium: {
|
|
86
|
+
url: string | null;
|
|
87
|
+
width: number | null;
|
|
88
|
+
height: number | null;
|
|
89
|
+
};
|
|
90
|
+
large: {
|
|
91
|
+
url: string | null;
|
|
92
|
+
width: number | null;
|
|
93
|
+
height: number | null;
|
|
94
|
+
};
|
|
95
|
+
original: {
|
|
96
|
+
url: string | null;
|
|
97
|
+
width: number | null;
|
|
98
|
+
height: number | null;
|
|
99
|
+
};
|
|
100
|
+
} | null;
|
|
15
101
|
metaTitle?: string;
|
|
16
102
|
metaDesc?: string;
|
|
17
103
|
projectId: number;
|
|
@@ -22,3 +108,142 @@ export interface SDKConfig {
|
|
|
22
108
|
apiKey: string;
|
|
23
109
|
baseUrl?: string;
|
|
24
110
|
}
|
|
111
|
+
export interface ServiceCategory {
|
|
112
|
+
id: string;
|
|
113
|
+
name: string;
|
|
114
|
+
}
|
|
115
|
+
export interface ServicePricingPlan {
|
|
116
|
+
name: string;
|
|
117
|
+
price: number;
|
|
118
|
+
features: string[];
|
|
119
|
+
}
|
|
120
|
+
export interface ServicePricing {
|
|
121
|
+
startingPrice?: number;
|
|
122
|
+
currency: string;
|
|
123
|
+
pricingModel: 'fixed' | 'hourly' | 'custom';
|
|
124
|
+
plans?: ServicePricingPlan[];
|
|
125
|
+
}
|
|
126
|
+
export interface ServiceImages {
|
|
127
|
+
cover?: string | null;
|
|
128
|
+
gallery: string[];
|
|
129
|
+
}
|
|
130
|
+
export interface ServiceDuration {
|
|
131
|
+
estimated?: string;
|
|
132
|
+
}
|
|
133
|
+
export interface ServiceFAQ {
|
|
134
|
+
question: string;
|
|
135
|
+
answer: string;
|
|
136
|
+
}
|
|
137
|
+
export interface ServiceTestimonial {
|
|
138
|
+
name: string;
|
|
139
|
+
company?: string;
|
|
140
|
+
rating: number;
|
|
141
|
+
comment: string;
|
|
142
|
+
}
|
|
143
|
+
export interface ServiceCTA {
|
|
144
|
+
label: string;
|
|
145
|
+
url: string;
|
|
146
|
+
}
|
|
147
|
+
export interface ServiceSEO {
|
|
148
|
+
title?: string;
|
|
149
|
+
description?: string;
|
|
150
|
+
keywords: string[];
|
|
151
|
+
}
|
|
152
|
+
export interface ServiceListItem {
|
|
153
|
+
id: string;
|
|
154
|
+
slug: string;
|
|
155
|
+
name: string;
|
|
156
|
+
shortDescription: string;
|
|
157
|
+
icon?: string | null;
|
|
158
|
+
coverImage?: string | null;
|
|
159
|
+
priceFrom?: number;
|
|
160
|
+
currency: string;
|
|
161
|
+
category?: string;
|
|
162
|
+
tags: string[];
|
|
163
|
+
featured: boolean;
|
|
164
|
+
rating: number;
|
|
165
|
+
reviews: number;
|
|
166
|
+
cta: ServiceCTA;
|
|
167
|
+
}
|
|
168
|
+
export interface ServiceListResponse {
|
|
169
|
+
services: ServiceListItem[];
|
|
170
|
+
pagination: {
|
|
171
|
+
total: number;
|
|
172
|
+
page: number;
|
|
173
|
+
limit: number;
|
|
174
|
+
totalPages: number;
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
export interface ServiceDetail {
|
|
178
|
+
id: string;
|
|
179
|
+
slug: string;
|
|
180
|
+
name: string;
|
|
181
|
+
shortDescription: string;
|
|
182
|
+
description?: string;
|
|
183
|
+
category?: ServiceCategory | null;
|
|
184
|
+
images: ServiceImages;
|
|
185
|
+
icon?: string | null;
|
|
186
|
+
features: string[];
|
|
187
|
+
technologies: string[];
|
|
188
|
+
pricing: ServicePricing;
|
|
189
|
+
duration: ServiceDuration;
|
|
190
|
+
faq: ServiceFAQ[];
|
|
191
|
+
testimonials: ServiceTestimonial[];
|
|
192
|
+
cta: ServiceCTA;
|
|
193
|
+
seo: ServiceSEO;
|
|
194
|
+
status: 'active' | 'inactive' | 'draft';
|
|
195
|
+
featured: boolean;
|
|
196
|
+
createdAt: string;
|
|
197
|
+
updatedAt: string;
|
|
198
|
+
}
|
|
199
|
+
export interface Project {
|
|
200
|
+
id: number;
|
|
201
|
+
name: string;
|
|
202
|
+
description: string | null;
|
|
203
|
+
apiKey: string;
|
|
204
|
+
url: string | null;
|
|
205
|
+
status: string;
|
|
206
|
+
createdAt: string;
|
|
207
|
+
updatedAt: string;
|
|
208
|
+
}
|
|
209
|
+
export interface User {
|
|
210
|
+
id: number;
|
|
211
|
+
email: string;
|
|
212
|
+
name: string;
|
|
213
|
+
role: 'owner' | 'admin' | 'editor';
|
|
214
|
+
permissions: any;
|
|
215
|
+
createdAt: string;
|
|
216
|
+
updatedAt: string;
|
|
217
|
+
}
|
|
218
|
+
export interface Service {
|
|
219
|
+
id: number;
|
|
220
|
+
name: string;
|
|
221
|
+
slug: string;
|
|
222
|
+
shortDescription: string;
|
|
223
|
+
description: string | null;
|
|
224
|
+
categoryId: string | null;
|
|
225
|
+
categoryName: string | null;
|
|
226
|
+
icon: string | null;
|
|
227
|
+
coverImage: string | null;
|
|
228
|
+
gallery: string[];
|
|
229
|
+
features: string[];
|
|
230
|
+
technologies: string[];
|
|
231
|
+
priceFrom: number | null;
|
|
232
|
+
currency: string;
|
|
233
|
+
pricingModel: string;
|
|
234
|
+
pricingPlans: any[];
|
|
235
|
+
estimatedDuration: string | null;
|
|
236
|
+
faq: any[];
|
|
237
|
+
testimonials: any[];
|
|
238
|
+
ctaLabel: string;
|
|
239
|
+
ctaUrl: string;
|
|
240
|
+
seoTitle: string | null;
|
|
241
|
+
seoDescription: string | null;
|
|
242
|
+
seoKeywords: string[];
|
|
243
|
+
status: string;
|
|
244
|
+
featured: boolean;
|
|
245
|
+
tags: string[];
|
|
246
|
+
projectId: number;
|
|
247
|
+
createdAt: string;
|
|
248
|
+
updatedAt: string;
|
|
249
|
+
}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arisnetxsolutions/quantum-core-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"build": "npx tsc",
|
|
9
|
-
"publish": "npm publish --access public --//registry.npmjs.org/:_authToken=
|
|
9
|
+
"publish": "npm publish --access public --//registry.npmjs.org/:_authToken=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"
|
|
10
10
|
},
|
|
11
11
|
"keywords": [],
|
|
12
12
|
"author": "",
|
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
"type": "module",
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"axios": "^1.13.6",
|
|
17
|
-
"dotenv": "^16.0.0",
|
|
18
17
|
"typescript": "^5.9.3"
|
|
19
18
|
},
|
|
20
19
|
"devDependencies": {
|