@hlmr/sdk-js 1.0.0
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/LICENSE +21 -0
- package/README.md +291 -0
- package/dist/cjs/client/HlmrClient.d.ts +23 -0
- package/dist/cjs/client/HlmrClient.d.ts.map +1 -0
- package/dist/cjs/client/HlmrClient.js +88 -0
- package/dist/cjs/client/HlmrClient.js.map +1 -0
- package/dist/cjs/index.d.ts +10 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +13 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/modules/auth.d.ts +8 -0
- package/dist/cjs/modules/auth.d.ts.map +1 -0
- package/dist/cjs/modules/auth.js +18 -0
- package/dist/cjs/modules/auth.js.map +1 -0
- package/dist/cjs/modules/system.d.ts +9 -0
- package/dist/cjs/modules/system.d.ts.map +1 -0
- package/dist/cjs/modules/system.js +23 -0
- package/dist/cjs/modules/system.js.map +1 -0
- package/dist/cjs/modules/user.d.ts +8 -0
- package/dist/cjs/modules/user.d.ts.map +1 -0
- package/dist/cjs/modules/user.js +14 -0
- package/dist/cjs/modules/user.js.map +1 -0
- package/dist/cjs/types/auth.d.ts +15 -0
- package/dist/cjs/types/auth.d.ts.map +1 -0
- package/dist/cjs/types/auth.js +3 -0
- package/dist/cjs/types/auth.js.map +1 -0
- package/dist/cjs/types/common.d.ts +33 -0
- package/dist/cjs/types/common.d.ts.map +1 -0
- package/dist/cjs/types/common.js +21 -0
- package/dist/cjs/types/common.js.map +1 -0
- package/dist/cjs/types/errors.d.ts +41 -0
- package/dist/cjs/types/errors.d.ts.map +1 -0
- package/dist/cjs/types/errors.js +56 -0
- package/dist/cjs/types/errors.js.map +1 -0
- package/dist/cjs/types/system.d.ts +20 -0
- package/dist/cjs/types/system.d.ts.map +1 -0
- package/dist/cjs/types/system.js +3 -0
- package/dist/cjs/types/system.js.map +1 -0
- package/dist/cjs/types/user.d.ts +14 -0
- package/dist/cjs/types/user.d.ts.map +1 -0
- package/dist/cjs/types/user.js +3 -0
- package/dist/cjs/types/user.js.map +1 -0
- package/dist/cjs/utils/http.d.ts +19 -0
- package/dist/cjs/utils/http.d.ts.map +1 -0
- package/dist/cjs/utils/http.js +139 -0
- package/dist/cjs/utils/http.js.map +1 -0
- package/dist/cjs/utils/jsend.d.ts +10 -0
- package/dist/cjs/utils/jsend.d.ts.map +1 -0
- package/dist/cjs/utils/jsend.js +54 -0
- package/dist/cjs/utils/jsend.js.map +1 -0
- package/dist/esm/client/HlmrClient.d.ts +23 -0
- package/dist/esm/client/HlmrClient.d.ts.map +1 -0
- package/dist/esm/client/HlmrClient.js +84 -0
- package/dist/esm/client/HlmrClient.js.map +1 -0
- package/dist/esm/index.d.ts +10 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +5 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/modules/auth.d.ts +8 -0
- package/dist/esm/modules/auth.d.ts.map +1 -0
- package/dist/esm/modules/auth.js +14 -0
- package/dist/esm/modules/auth.js.map +1 -0
- package/dist/esm/modules/system.d.ts +9 -0
- package/dist/esm/modules/system.d.ts.map +1 -0
- package/dist/esm/modules/system.js +19 -0
- package/dist/esm/modules/system.js.map +1 -0
- package/dist/esm/modules/user.d.ts +8 -0
- package/dist/esm/modules/user.d.ts.map +1 -0
- package/dist/esm/modules/user.js +10 -0
- package/dist/esm/modules/user.js.map +1 -0
- package/dist/esm/types/auth.d.ts +15 -0
- package/dist/esm/types/auth.d.ts.map +1 -0
- package/dist/esm/types/auth.js +2 -0
- package/dist/esm/types/auth.js.map +1 -0
- package/dist/esm/types/common.d.ts +33 -0
- package/dist/esm/types/common.d.ts.map +1 -0
- package/dist/esm/types/common.js +18 -0
- package/dist/esm/types/common.js.map +1 -0
- package/dist/esm/types/errors.d.ts +41 -0
- package/dist/esm/types/errors.d.ts.map +1 -0
- package/dist/esm/types/errors.js +52 -0
- package/dist/esm/types/errors.js.map +1 -0
- package/dist/esm/types/system.d.ts +20 -0
- package/dist/esm/types/system.d.ts.map +1 -0
- package/dist/esm/types/system.js +2 -0
- package/dist/esm/types/system.js.map +1 -0
- package/dist/esm/types/user.d.ts +14 -0
- package/dist/esm/types/user.d.ts.map +1 -0
- package/dist/esm/types/user.js +2 -0
- package/dist/esm/types/user.js.map +1 -0
- package/dist/esm/utils/http.d.ts +19 -0
- package/dist/esm/utils/http.d.ts.map +1 -0
- package/dist/esm/utils/http.js +135 -0
- package/dist/esm/utils/http.js.map +1 -0
- package/dist/esm/utils/jsend.d.ts +10 -0
- package/dist/esm/utils/jsend.d.ts.map +1 -0
- package/dist/esm/utils/jsend.js +44 -0
- package/dist/esm/utils/jsend.js.map +1 -0
- package/dist/types/client/HlmrClient.d.ts +23 -0
- package/dist/types/client/HlmrClient.d.ts.map +1 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/modules/auth.d.ts +8 -0
- package/dist/types/modules/auth.d.ts.map +1 -0
- package/dist/types/modules/system.d.ts +9 -0
- package/dist/types/modules/system.d.ts.map +1 -0
- package/dist/types/modules/user.d.ts +8 -0
- package/dist/types/modules/user.d.ts.map +1 -0
- package/dist/types/types/auth.d.ts +15 -0
- package/dist/types/types/auth.d.ts.map +1 -0
- package/dist/types/types/common.d.ts +33 -0
- package/dist/types/types/common.d.ts.map +1 -0
- package/dist/types/types/errors.d.ts +41 -0
- package/dist/types/types/errors.d.ts.map +1 -0
- package/dist/types/types/system.d.ts +20 -0
- package/dist/types/types/system.d.ts.map +1 -0
- package/dist/types/types/user.d.ts +14 -0
- package/dist/types/types/user.d.ts.map +1 -0
- package/dist/types/utils/http.d.ts +19 -0
- package/dist/types/utils/http.d.ts.map +1 -0
- package/dist/types/utils/jsend.d.ts +10 -0
- package/dist/types/utils/jsend.d.ts.map +1 -0
- package/dist/umd/hlmr-sdk.js +359 -0
- package/dist/umd/hlmr-sdk.js.map +1 -0
- package/dist/umd/hlmr-sdk.min.js +2 -0
- package/dist/umd/hlmr-sdk.min.js.map +1 -0
- package/package.json +74 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 CES Venture (Hello Mira)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
# Mira SDK JavaScript (Public)
|
|
2
|
+
|
|
3
|
+
[](https://badge.fury.io/js/hlmr-sdk-js)
|
|
4
|
+
[](https://www.typescriptlang.org/)
|
|
5
|
+
[](https://opensource.org/licenses/MIT)
|
|
6
|
+
|
|
7
|
+
SDK JavaScript officiel pour l'API Mira - Version publique avec routes sécurisées uniquement.
|
|
8
|
+
|
|
9
|
+
## 🚀 Installation
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install hlmr-sdk-js
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## 📖 Usage rapide
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
import { HlmrClient } from 'hlmr-sdk-js';
|
|
19
|
+
|
|
20
|
+
// Créer un client pour la production
|
|
21
|
+
const mira = HlmrClient.forProduction('your-app-id', 'your-bearer-token');
|
|
22
|
+
|
|
23
|
+
// Ou avec configuration personnalisée
|
|
24
|
+
const mira = new HlmrClient({
|
|
25
|
+
environment: 'production',
|
|
26
|
+
appId: 'your-app-id',
|
|
27
|
+
bearerToken: 'your-bearer-token'
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
// Utiliser les modules
|
|
31
|
+
try {
|
|
32
|
+
// Validation OAuth
|
|
33
|
+
const validation = await mira.auth.validateRedirect('app-id', 'https://app.com/callback');
|
|
34
|
+
|
|
35
|
+
// Profil utilisateur
|
|
36
|
+
const profile = await mira.user.getProfile();
|
|
37
|
+
|
|
38
|
+
// Health check
|
|
39
|
+
const ping = await mira.system.ping();
|
|
40
|
+
|
|
41
|
+
console.log('User:', profile.email);
|
|
42
|
+
} catch (error) {
|
|
43
|
+
if (error instanceof HlmrApiError) {
|
|
44
|
+
console.error('API Error:', error.message, error.statusCode);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## 🏗️ Architecture
|
|
50
|
+
|
|
51
|
+
### Modules disponibles
|
|
52
|
+
|
|
53
|
+
- **`auth`** - Authentification et validation OAuth
|
|
54
|
+
- **`user`** - Gestion du profil utilisateur
|
|
55
|
+
- **`system`** - Informations système et health checks
|
|
56
|
+
|
|
57
|
+
### Routes supportées (publiques uniquement)
|
|
58
|
+
|
|
59
|
+
| Module | Méthode | Route | Description |
|
|
60
|
+
|--------|---------|-------|-------------|
|
|
61
|
+
| `auth` | `validateRedirect()` | `POST /v1/apps/{app_id}/validate-redirect` | Validation OAuth redirect URI |
|
|
62
|
+
| `user` | `getProfile()` | `GET /v1/users/profile` | Profil utilisateur authentifié |
|
|
63
|
+
| `system` | `ping()` | `GET /ping` | Health check authentifié |
|
|
64
|
+
| `system` | `version()` | `GET /version` | Version de l'API |
|
|
65
|
+
|
|
66
|
+
## 🔧 Configuration
|
|
67
|
+
|
|
68
|
+
### Environnements prédéfinis
|
|
69
|
+
|
|
70
|
+
```typescript
|
|
71
|
+
// Production (défaut)
|
|
72
|
+
const client = HlmrClient.forProduction('app-id', 'token');
|
|
73
|
+
|
|
74
|
+
// Développement
|
|
75
|
+
const client = HlmrClient.forDevelopment('app-id', 'token');
|
|
76
|
+
|
|
77
|
+
// Staging
|
|
78
|
+
const client = HlmrClient.forStaging('app-id', 'token');
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Configuration personnalisée
|
|
82
|
+
|
|
83
|
+
```typescript
|
|
84
|
+
const client = new HlmrClient({
|
|
85
|
+
environment: {
|
|
86
|
+
name: 'custom',
|
|
87
|
+
url: 'https://api.custom.com'
|
|
88
|
+
},
|
|
89
|
+
appId: 'your-app-id',
|
|
90
|
+
bearerToken: 'your-token',
|
|
91
|
+
config: {
|
|
92
|
+
timeout: 30000,
|
|
93
|
+
debug: true,
|
|
94
|
+
customHeaders: {
|
|
95
|
+
'X-Custom-Header': 'value'
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## 🔐 Authentification
|
|
102
|
+
|
|
103
|
+
### Gestion du token Bearer
|
|
104
|
+
|
|
105
|
+
```typescript
|
|
106
|
+
// Définir le token
|
|
107
|
+
client.setBearerToken('new-token');
|
|
108
|
+
|
|
109
|
+
// Supprimer le token
|
|
110
|
+
client.clearBearerToken();
|
|
111
|
+
|
|
112
|
+
// Le token est automatiquement ajouté aux requêtes authentifiées
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Validation OAuth
|
|
116
|
+
|
|
117
|
+
```typescript
|
|
118
|
+
// Valider un redirect URI pour une application
|
|
119
|
+
const validation = await mira.auth.validateRedirect(
|
|
120
|
+
'client-app-id',
|
|
121
|
+
'https://app.com/oauth/callback'
|
|
122
|
+
);
|
|
123
|
+
|
|
124
|
+
if (validation.valid) {
|
|
125
|
+
console.log('App:', validation.app?.name);
|
|
126
|
+
} else {
|
|
127
|
+
console.error('Invalid redirect:', validation.error);
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## 👤 Gestion utilisateur
|
|
132
|
+
|
|
133
|
+
```typescript
|
|
134
|
+
// Récupérer le profil utilisateur
|
|
135
|
+
const profile = await mira.user.getProfile();
|
|
136
|
+
|
|
137
|
+
console.log({
|
|
138
|
+
id: profile.id,
|
|
139
|
+
email: profile.email,
|
|
140
|
+
fullName: profile.full_name,
|
|
141
|
+
createdAt: profile.created_at
|
|
142
|
+
});
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## 🔍 Monitoring système
|
|
146
|
+
|
|
147
|
+
```typescript
|
|
148
|
+
// Health check authentifié
|
|
149
|
+
const ping = await mira.system.ping();
|
|
150
|
+
console.log('Ping:', ping.message, ping.timestamp);
|
|
151
|
+
|
|
152
|
+
// Version de l'API (public)
|
|
153
|
+
const version = await mira.system.version();
|
|
154
|
+
console.log('API Version:', version.version);
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## 🚨 Gestion d'erreurs
|
|
158
|
+
|
|
159
|
+
```typescript
|
|
160
|
+
import { HlmrApiError } from 'hlmr-sdk-js';
|
|
161
|
+
|
|
162
|
+
try {
|
|
163
|
+
const profile = await mira.user.getProfile();
|
|
164
|
+
} catch (error) {
|
|
165
|
+
if (error instanceof HlmrApiError) {
|
|
166
|
+
// Erreur API structurée
|
|
167
|
+
console.error('Status:', error.statusCode);
|
|
168
|
+
console.error('Code:', error.code);
|
|
169
|
+
console.error('Message:', error.message);
|
|
170
|
+
|
|
171
|
+
// Vérifications spécifiques
|
|
172
|
+
if (error.isAuthError()) {
|
|
173
|
+
// Rediriger vers login
|
|
174
|
+
} else if (error.isPermissionError()) {
|
|
175
|
+
// Afficher message d'accès refusé
|
|
176
|
+
} else if (error.isNetworkError()) {
|
|
177
|
+
// Problème de connectivité
|
|
178
|
+
}
|
|
179
|
+
} else {
|
|
180
|
+
// Erreur JavaScript standard
|
|
181
|
+
console.error('Unexpected error:', error);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### Types d'erreurs
|
|
187
|
+
|
|
188
|
+
- **`isAuthError()`** - Erreur d'authentification (401)
|
|
189
|
+
- **`isPermissionError()`** - Erreur de permissions (403)
|
|
190
|
+
- **`isValidationError()`** - Erreur de validation (4xx)
|
|
191
|
+
- **`isServerError()`** - Erreur serveur (5xx)
|
|
192
|
+
- **`isNetworkError()`** - Erreur réseau/connectivité
|
|
193
|
+
- **`isTimeoutError()`** - Timeout de requête
|
|
194
|
+
|
|
195
|
+
## 📦 Formats supportés
|
|
196
|
+
|
|
197
|
+
Le SDK est disponible dans plusieurs formats :
|
|
198
|
+
|
|
199
|
+
- **ESM** : `import { HlmrClient } from 'hlmr-sdk-js'`
|
|
200
|
+
- **CommonJS** : `const { HlmrClient } = require('hlmr-sdk-js')`
|
|
201
|
+
- **UMD** : `<script src="hlmr-sdk.min.js"></script>`
|
|
202
|
+
|
|
203
|
+
## 🔧 Configuration avancée
|
|
204
|
+
|
|
205
|
+
### Debug et logging
|
|
206
|
+
|
|
207
|
+
```typescript
|
|
208
|
+
const client = new HlmrClient({
|
|
209
|
+
appId: 'app-id',
|
|
210
|
+
config: {
|
|
211
|
+
debug: true // Active les logs de debug
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
// Ou dynamiquement
|
|
216
|
+
client.setDebug(true);
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### Timeout personnalisé
|
|
220
|
+
|
|
221
|
+
```typescript
|
|
222
|
+
const client = new HlmrClient({
|
|
223
|
+
appId: 'app-id',
|
|
224
|
+
config: {
|
|
225
|
+
timeout: 60000 // 60 secondes
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
// Ou pour une requête spécifique
|
|
230
|
+
await mira.user.getProfile({ timeout: 10000 });
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
### Headers personnalisés
|
|
234
|
+
|
|
235
|
+
```typescript
|
|
236
|
+
const client = new HlmrClient({
|
|
237
|
+
appId: 'app-id',
|
|
238
|
+
config: {
|
|
239
|
+
customHeaders: {
|
|
240
|
+
'X-Client-Version': '1.0.0',
|
|
241
|
+
'X-Feature-Flag': 'beta'
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
});
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
## 🧪 Tests
|
|
248
|
+
|
|
249
|
+
```bash
|
|
250
|
+
# Lancer les tests
|
|
251
|
+
npm test
|
|
252
|
+
|
|
253
|
+
# Tests en mode watch
|
|
254
|
+
npm run test:watch
|
|
255
|
+
|
|
256
|
+
# Coverage
|
|
257
|
+
npm run test:coverage
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
## 🏗️ Build
|
|
261
|
+
|
|
262
|
+
```bash
|
|
263
|
+
# Build complet (ESM + CommonJS + UMD + Types)
|
|
264
|
+
npm run build
|
|
265
|
+
|
|
266
|
+
# Build en mode développement
|
|
267
|
+
npm run dev
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
## 📋 Prérequis
|
|
271
|
+
|
|
272
|
+
- **Node.js** >= 16.0.0
|
|
273
|
+
- **TypeScript** >= 5.0.0 (pour le développement)
|
|
274
|
+
- Support des **Promises/async-await**
|
|
275
|
+
- Support de **fetch** (natif dans les navigateurs modernes et Node.js 18+)
|
|
276
|
+
|
|
277
|
+
## 🔗 Liens utiles
|
|
278
|
+
|
|
279
|
+
- [Portail d'identité](https://id.hello-mira.com)
|
|
280
|
+
|
|
281
|
+
## 📄 Licence
|
|
282
|
+
|
|
283
|
+
MIT © CES Venture (Hello Mira)
|
|
284
|
+
|
|
285
|
+
## 🤝 Contribution
|
|
286
|
+
|
|
287
|
+
Ce SDK est maintenu par CES Venture (Hello Mira). Pour signaler des bugs ou proposer des améliorations, veuillez ouvrir une issue sur le repository GitHub.
|
|
288
|
+
|
|
289
|
+
---
|
|
290
|
+
|
|
291
|
+
**Note** : Ce SDK contient uniquement les routes publiques et sécurisées de l'API Mira.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { HlmrClientOptions, HlmrClientConfig } from '../types/common';
|
|
2
|
+
import { ENVIRONMENTS } from '../types/common';
|
|
3
|
+
import { AuthModule } from '../modules/auth';
|
|
4
|
+
import { UserModule } from '../modules/user';
|
|
5
|
+
import { SystemModule } from '../modules/system';
|
|
6
|
+
export declare class HlmrClient {
|
|
7
|
+
private httpClient;
|
|
8
|
+
readonly auth: AuthModule;
|
|
9
|
+
readonly user: UserModule;
|
|
10
|
+
readonly system: SystemModule;
|
|
11
|
+
constructor(options: HlmrClientOptions);
|
|
12
|
+
private buildConfig;
|
|
13
|
+
setBearerToken(token: string): void;
|
|
14
|
+
clearBearerToken(): void;
|
|
15
|
+
getConfig(): Partial<HlmrClientConfig>;
|
|
16
|
+
updateConfig(updates: Partial<Omit<HlmrClientConfig, 'baseUrl' | 'appId'>>): void;
|
|
17
|
+
setDebug(enabled: boolean): void;
|
|
18
|
+
static forEnvironment(environment: keyof typeof ENVIRONMENTS, appId: string, bearerToken?: string): HlmrClient;
|
|
19
|
+
static forProduction(appId: string, bearerToken?: string): HlmrClient;
|
|
20
|
+
static forDevelopment(appId: string, bearerToken?: string): HlmrClient;
|
|
21
|
+
static forStaging(appId: string, bearerToken?: string): HlmrClient;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=HlmrClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":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AM,GAAG,UAAU;CAGnE"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HlmrClient = void 0;
|
|
4
|
+
const common_1 = require("../types/common");
|
|
5
|
+
const errors_1 = require("../types/errors");
|
|
6
|
+
const http_1 = require("../utils/http");
|
|
7
|
+
const auth_1 = require("../modules/auth");
|
|
8
|
+
const user_1 = require("../modules/user");
|
|
9
|
+
const system_1 = require("../modules/system");
|
|
10
|
+
class HlmrClient {
|
|
11
|
+
constructor(options) {
|
|
12
|
+
const config = this.buildConfig(options);
|
|
13
|
+
this.httpClient = new http_1.HttpClient(config);
|
|
14
|
+
this.auth = new auth_1.AuthModule(this.httpClient);
|
|
15
|
+
this.user = new user_1.UserModule(this.httpClient);
|
|
16
|
+
this.system = new system_1.SystemModule(this.httpClient);
|
|
17
|
+
}
|
|
18
|
+
buildConfig(options) {
|
|
19
|
+
var _a, _b, _c;
|
|
20
|
+
let baseUrl;
|
|
21
|
+
if (typeof options.environment === 'string') {
|
|
22
|
+
const env = common_1.ENVIRONMENTS[options.environment];
|
|
23
|
+
if (!env) {
|
|
24
|
+
throw errors_1.HlmrApiError.configError(`Unknown environment: ${options.environment}`);
|
|
25
|
+
}
|
|
26
|
+
baseUrl = env.url;
|
|
27
|
+
}
|
|
28
|
+
else if (options.environment && typeof options.environment === 'object') {
|
|
29
|
+
baseUrl = options.environment.url;
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
baseUrl = common_1.ENVIRONMENTS.production.url;
|
|
33
|
+
}
|
|
34
|
+
if (!options.appId || typeof options.appId !== 'string') {
|
|
35
|
+
throw errors_1.HlmrApiError.configError('appId is required and must be a string');
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
baseUrl,
|
|
39
|
+
appId: options.appId,
|
|
40
|
+
bearerToken: options.bearerToken,
|
|
41
|
+
timeout: ((_a = options.config) === null || _a === void 0 ? void 0 : _a.timeout) || 30000,
|
|
42
|
+
customHeaders: ((_b = options.config) === null || _b === void 0 ? void 0 : _b.customHeaders) || {},
|
|
43
|
+
debug: ((_c = options.config) === null || _c === void 0 ? void 0 : _c.debug) || false
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
setBearerToken(token) {
|
|
47
|
+
if (!token || typeof token !== 'string') {
|
|
48
|
+
throw errors_1.HlmrApiError.configError('Bearer token must be a non-empty string');
|
|
49
|
+
}
|
|
50
|
+
this.httpClient.setBearerToken(token);
|
|
51
|
+
}
|
|
52
|
+
clearBearerToken() {
|
|
53
|
+
this.httpClient.clearBearerToken();
|
|
54
|
+
}
|
|
55
|
+
getConfig() {
|
|
56
|
+
return {
|
|
57
|
+
baseUrl: this.httpClient['config'].baseUrl,
|
|
58
|
+
appId: this.httpClient['config'].appId,
|
|
59
|
+
timeout: this.httpClient['config'].timeout,
|
|
60
|
+
customHeaders: { ...this.httpClient['config'].customHeaders },
|
|
61
|
+
debug: this.httpClient['config'].debug
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
updateConfig(updates) {
|
|
65
|
+
this.httpClient.updateConfig(updates);
|
|
66
|
+
}
|
|
67
|
+
setDebug(enabled) {
|
|
68
|
+
this.httpClient.updateConfig({ debug: enabled });
|
|
69
|
+
}
|
|
70
|
+
static forEnvironment(environment, appId, bearerToken) {
|
|
71
|
+
return new HlmrClient({
|
|
72
|
+
environment,
|
|
73
|
+
appId,
|
|
74
|
+
bearerToken
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
static forProduction(appId, bearerToken) {
|
|
78
|
+
return HlmrClient.forEnvironment('production', appId, bearerToken);
|
|
79
|
+
}
|
|
80
|
+
static forDevelopment(appId, bearerToken) {
|
|
81
|
+
return HlmrClient.forEnvironment('development', appId, bearerToken);
|
|
82
|
+
}
|
|
83
|
+
static forStaging(appId, bearerToken) {
|
|
84
|
+
return HlmrClient.forEnvironment('staging', appId, bearerToken);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
exports.HlmrClient = HlmrClient;
|
|
88
|
+
//# sourceMappingURL=HlmrClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HlmrClient.js","sourceRoot":"","sources":["../../../src/client/HlmrClient.ts"],"names":[],"mappings":";;;AAUA,4CAA+C;AAC/C,4CAA+C;AAC/C,wCAA2C;AAC3C,0CAA6C;AAC7C,0CAA6C;AAC7C,8CAAiD;AAKjD,MAAa,UAAU;IAYrB,YAAY,OAA0B;QACpC,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QACzC,IAAI,CAAC,UAAU,GAAG,IAAI,iBAAU,CAAC,MAAM,CAAC,CAAC;QAGzC,IAAI,CAAC,IAAI,GAAG,IAAI,iBAAU,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC5C,IAAI,CAAC,IAAI,GAAG,IAAI,iBAAU,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC5C,IAAI,CAAC,MAAM,GAAG,IAAI,qBAAY,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAClD,CAAC;IAKO,WAAW,CAAC,OAA0B;;QAC5C,IAAI,OAAe,CAAC;QAGpB,IAAI,OAAO,OAAO,CAAC,WAAW,KAAK,QAAQ,EAAE,CAAC;YAC5C,MAAM,GAAG,GAAI,qBAAoB,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;YACvD,IAAI,CAAC,GAAG,EAAE,CAAC;gBACT,MAAM,qBAAY,CAAC,WAAW,CAAC,wBAAwB,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;YAChF,CAAC;YACD,OAAO,GAAG,GAAG,CAAC,GAAG,CAAC;QACpB,CAAC;aAAM,IAAI,OAAO,CAAC,WAAW,IAAI,OAAO,OAAO,CAAC,WAAW,KAAK,QAAQ,EAAE,CAAC;YAC1E,OAAO,GAAG,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC;QACpC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AI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,KAAK;SACvC,CAAC;IACJ,CAAC;IAKD,YAAY,CAAC,OAA6D;QACxE,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;IACxC,CAAC;IAKD,QAAQ,CAAC,OAAgB;QACvB,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;IACnD,CAAC;IAKD,MAAM,CAAC,cAAc,CACnB,WAAsC,EACtC,KAAa,EACb,WAAoB;QAEpB,OAAO,IAAI,UAAU,CAAC;YACpB,WAAW;YACX,KAAK;YACL,WAAW;SACZ,CAAC,CAAC;IACL,CAAC;IAKD,MAAM,CAAC,aAAa,CAAC,KAAa,EAAE,WAAoB;QACtD,OAAO,UAAU,CAAC,cAAc,CAAC,YAAY,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC;IACrE,CAAC;IAKD,MAAM,CAAC,cAAc,CAAC,KAAa,EAAE,WAAoB;QACvD,OAAO,UAAU,CAAC,cAAc,CAAC,aAAa,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC;IACtE,CAAC;IAKD,MAAM,CAAC,UAAU,CAAC,KAAa,EAAE,WAAoB;QACnD,OAAO,UAAU,CAAC,cAAc,CAAC,SAAS,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC;IAClE,CAAC;CACF;AAzID,gCAyIC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { HlmrClient } from './client/HlmrClient';
|
|
2
|
+
export type { HlmrClientConfig, HlmrClientOptions, Environment } from './types/common';
|
|
3
|
+
export type { AuthValidateRedirectRequest, AuthValidateRedirectResponse } from './types/auth';
|
|
4
|
+
export type { UserProfile } from './types/user';
|
|
5
|
+
export type { SystemPingResponse, SystemVersionResponse } from './types/system';
|
|
6
|
+
export type { HlmrApiError, JSendResponse, JSendSuccessResponse, JSendFailResponse, JSendErrorResponse } from './types/errors';
|
|
7
|
+
export { isJSendResponse, isJSendSuccess, isJSendFail, isJSendError } from './utils/jsend';
|
|
8
|
+
export declare const SDK_VERSION = "1.0.0";
|
|
9
|
+
export declare const SDK_NAME = "hlmr-sdk-js";
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAGjD,YAAY,EACV,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,EACZ,MAAM,gBAAgB,CAAC;AAExB,YAAY,EACV,2BAA2B,EAC3B,4BAA4B,EAC7B,MAAM,cAAc,CAAC;AAEtB,YAAY,EACV,WAAW,EACZ,MAAM,cAAc,CAAC;AAEtB,YAAY,EACV,kBAAkB,EAClB,qBAAqB,EACtB,MAAM,gBAAgB,CAAC;AAExB,YAAY,EACV,YAAY,EACZ,aAAa,EACb,oBAAoB,EACpB,iBAAiB,EACjB,kBAAkB,EACnB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAG3F,eAAO,MAAM,WAAW,UAAU,CAAC;AACnC,eAAO,MAAM,QAAQ,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SDK_NAME = exports.SDK_VERSION = exports.isJSendError = exports.isJSendFail = exports.isJSendSuccess = exports.isJSendResponse = exports.HlmrClient = void 0;
|
|
4
|
+
var HlmrClient_1 = require("./client/HlmrClient");
|
|
5
|
+
Object.defineProperty(exports, "HlmrClient", { enumerable: true, get: function () { return HlmrClient_1.HlmrClient; } });
|
|
6
|
+
var jsend_1 = require("./utils/jsend");
|
|
7
|
+
Object.defineProperty(exports, "isJSendResponse", { enumerable: true, get: function () { return jsend_1.isJSendResponse; } });
|
|
8
|
+
Object.defineProperty(exports, "isJSendSuccess", { enumerable: true, get: function () { return jsend_1.isJSendSuccess; } });
|
|
9
|
+
Object.defineProperty(exports, "isJSendFail", { enumerable: true, get: function () { return jsend_1.isJSendFail; } });
|
|
10
|
+
Object.defineProperty(exports, "isJSendError", { enumerable: true, get: function () { return jsend_1.isJSendError; } });
|
|
11
|
+
exports.SDK_VERSION = '1.0.0';
|
|
12
|
+
exports.SDK_NAME = 'hlmr-sdk-js';
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AASA,kDAAiD;AAAxC,wGAAA,UAAU,OAAA;AAgCnB,uCAA2F;AAAlF,wGAAA,eAAe,OAAA;AAAE,uGAAA,cAAc,OAAA;AAAE,oGAAA,WAAW,OAAA;AAAE,qGAAA,YAAY,OAAA;AAGtD,QAAA,WAAW,GAAG,OAAO,CAAC;AACtB,QAAA,QAAQ,GAAG,aAAa,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { HttpClient } from '../utils/http';
|
|
2
|
+
import type { AuthValidateRedirectResponse } from '../types/auth';
|
|
3
|
+
export declare class AuthModule {
|
|
4
|
+
private http;
|
|
5
|
+
constructor(http: HttpClient);
|
|
6
|
+
validateRedirect(appId: string, redirectUri: string): Promise<AuthValidateRedirectResponse>;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/modules/auth.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAEV,4BAA4B,EAC7B,MAAM,eAAe,CAAC;AAKvB,qBAAa,UAAU;IACT,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAS9B,gBAAgB,CACpB,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,4BAA4B,CAAC;CAczC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AuthModule = void 0;
|
|
4
|
+
class AuthModule {
|
|
5
|
+
constructor(http) {
|
|
6
|
+
this.http = http;
|
|
7
|
+
}
|
|
8
|
+
async validateRedirect(appId, redirectUri) {
|
|
9
|
+
const request = {
|
|
10
|
+
app_id: appId,
|
|
11
|
+
redirect_uri: redirectUri
|
|
12
|
+
};
|
|
13
|
+
const response = await this.http.post(`apps/${appId}/validate-redirect`, request, { skipAuth: true });
|
|
14
|
+
return response.data;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.AuthModule = AuthModule;
|
|
18
|
+
//# sourceMappingURL=auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/modules/auth.ts"],"names":[],"mappings":";;;AAcA,MAAa,UAAU;IACrB,YAAoB,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;IAAG,CAAC;IASxC,KAAK,CAAC,gBAAgB,CACpB,KAAa,EACb,WAAmB;QAEnB,MAAM,OAAO,GAAgC;YAC3C,MAAM,EAAE,KAAK;YACb,YAAY,EAAE,WAAW;SAC1B,CAAC;QAEF,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CACnC,QAAQ,KAAK,oBAAoB,EACjC,OAAO,EACP,EAAE,QAAQ,EAAE,IAAI,EAAE,CACnB,CAAC;QAEF,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;CACF;AA3BD,gCA2BC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { HttpClient } from '../utils/http';
|
|
2
|
+
import type { SystemPingResponse, SystemVersionResponse } from '../types/system';
|
|
3
|
+
export declare class SystemModule {
|
|
4
|
+
private http;
|
|
5
|
+
constructor(http: HttpClient);
|
|
6
|
+
ping(): Promise<SystemPingResponse>;
|
|
7
|
+
version(): Promise<SystemVersionResponse>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=system.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"system.d.ts","sourceRoot":"","sources":["../../../src/modules/system.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EACV,kBAAkB,EAClB,qBAAqB,EACtB,MAAM,iBAAiB,CAAC;AAKzB,qBAAa,YAAY;IACX,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAO9B,IAAI,IAAI,OAAO,CAAC,kBAAkB,CAAC;IAYnC,OAAO,IAAI,OAAO,CAAC,qBAAqB,CAAC;CAOhD"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SystemModule = void 0;
|
|
4
|
+
class SystemModule {
|
|
5
|
+
constructor(http) {
|
|
6
|
+
this.http = http;
|
|
7
|
+
}
|
|
8
|
+
async ping() {
|
|
9
|
+
const response = await this.http.get('ping', {
|
|
10
|
+
apiVersion: ''
|
|
11
|
+
});
|
|
12
|
+
return response.data;
|
|
13
|
+
}
|
|
14
|
+
async version() {
|
|
15
|
+
const response = await this.http.get('version', {
|
|
16
|
+
apiVersion: '',
|
|
17
|
+
skipAuth: true
|
|
18
|
+
});
|
|
19
|
+
return response.data;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.SystemModule = SystemModule;
|
|
23
|
+
//# sourceMappingURL=system.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"system.js","sourceRoot":"","sources":["../../../src/modules/system.ts"],"names":[],"mappings":";;;AAcA,MAAa,YAAY;IACvB,YAAoB,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;IAAG,CAAC;IAOxC,KAAK,CAAC,IAAI;QACR,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,CAAqB,MAAM,EAAE;YAC/D,UAAU,EAAE,EAAE;SACf,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;IAOD,KAAK,CAAC,OAAO;QACX,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,CAAwB,SAAS,EAAE;YACrE,UAAU,EAAE,EAAE;YACd,QAAQ,EAAE,IAAI;SACf,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;CACF;AA3BD,oCA2BC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../../src/modules/user.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAKjD,qBAAa,UAAU;IACT,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAO9B,UAAU,IAAI,OAAO,CAAC,WAAW,CAAC;CAIzC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UserModule = void 0;
|
|
4
|
+
class UserModule {
|
|
5
|
+
constructor(http) {
|
|
6
|
+
this.http = http;
|
|
7
|
+
}
|
|
8
|
+
async getProfile() {
|
|
9
|
+
const response = await this.http.get('users/profile');
|
|
10
|
+
return response.data;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.UserModule = UserModule;
|
|
14
|
+
//# sourceMappingURL=user.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user.js","sourceRoot":"","sources":["../../../src/modules/user.ts"],"names":[],"mappings":";;;AAWA,MAAa,UAAU;IACrB,YAAoB,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;IAAG,CAAC;IAOxC,KAAK,CAAC,UAAU;QACd,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,CAAc,eAAe,CAAC,CAAC;QACnE,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;CACF;AAZD,gCAYC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface AuthValidateRedirectRequest {
|
|
2
|
+
app_id: string;
|
|
3
|
+
redirect_uri: string;
|
|
4
|
+
}
|
|
5
|
+
export interface AuthValidateRedirectResponse {
|
|
6
|
+
valid: boolean;
|
|
7
|
+
app?: {
|
|
8
|
+
id: string;
|
|
9
|
+
name: string;
|
|
10
|
+
base_url: string;
|
|
11
|
+
hosts: string[];
|
|
12
|
+
};
|
|
13
|
+
error?: string;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/types/auth.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,2BAA2B;IAE1C,MAAM,EAAE,MAAM,CAAC;IAGf,YAAY,EAAE,MAAM,CAAC;CACtB;AAKD,MAAM,WAAW,4BAA4B;IAE3C,KAAK,EAAE,OAAO,CAAC;IAGf,GAAG,CAAC,EAAE;QACJ,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,MAAM,CAAC;QACjB,KAAK,EAAE,MAAM,EAAE,CAAC;KACjB,CAAC;IAGF,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/types/auth.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export interface Environment {
|
|
2
|
+
name: string;
|
|
3
|
+
url: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare const ENVIRONMENTS: Record<string, Environment>;
|
|
7
|
+
export interface HlmrClientConfig {
|
|
8
|
+
baseUrl: string;
|
|
9
|
+
appId: string;
|
|
10
|
+
bearerToken?: string | undefined;
|
|
11
|
+
timeout?: number | undefined;
|
|
12
|
+
customHeaders?: Record<string, string>;
|
|
13
|
+
debug?: boolean | undefined;
|
|
14
|
+
}
|
|
15
|
+
export interface HlmrClientOptions {
|
|
16
|
+
environment?: string | Environment;
|
|
17
|
+
appId: string;
|
|
18
|
+
bearerToken?: string | undefined;
|
|
19
|
+
config?: Partial<Omit<HlmrClientConfig, 'baseUrl' | 'appId'>>;
|
|
20
|
+
}
|
|
21
|
+
export interface RequestOptions {
|
|
22
|
+
headers?: Record<string, string>;
|
|
23
|
+
timeout?: number;
|
|
24
|
+
skipAuth?: boolean;
|
|
25
|
+
apiVersion?: string;
|
|
26
|
+
}
|
|
27
|
+
export interface HttpResponse<T = any> {
|
|
28
|
+
status: number;
|
|
29
|
+
statusText: string;
|
|
30
|
+
headers: Record<string, string>;
|
|
31
|
+
data: T;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=common.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/types/common.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAKD,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAgBpD,CAAC;AAKF,MAAM,WAAW,gBAAgB;IAE/B,O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