@frenchbaas/js 0.1.0 → 0.1.1
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 +20 -9
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ npm install @frenchbaas/js
|
|
|
14
14
|
import { FrenchBaas } from '@frenchbaas/js'
|
|
15
15
|
|
|
16
16
|
const client = new FrenchBaas({
|
|
17
|
-
url: 'https://
|
|
17
|
+
url: 'https://app.frenchbaas.com',
|
|
18
18
|
apiKey: 'votre-clé-api',
|
|
19
19
|
})
|
|
20
20
|
```
|
|
@@ -59,17 +59,27 @@ const schema = await col.schema()
|
|
|
59
59
|
|
|
60
60
|
## Gestion des erreurs
|
|
61
61
|
|
|
62
|
-
```
|
|
63
|
-
import {
|
|
62
|
+
```ts
|
|
63
|
+
import {
|
|
64
|
+
AuthError,
|
|
65
|
+
ValidationError,
|
|
66
|
+
NotFoundError,
|
|
67
|
+
QuotaError,
|
|
68
|
+
RateLimitError,
|
|
69
|
+
NetworkError,
|
|
70
|
+
ServerError,
|
|
71
|
+
} from '@frenchbaas/js'
|
|
64
72
|
|
|
65
73
|
try {
|
|
66
74
|
await client.collection('col-id').create({ title: 'Test' })
|
|
67
75
|
} catch (e) {
|
|
68
|
-
if (e instanceof AuthError)
|
|
69
|
-
if (e instanceof ValidationError)
|
|
70
|
-
if (e instanceof NotFoundError)
|
|
71
|
-
if (e instanceof QuotaError)
|
|
72
|
-
if (e instanceof
|
|
76
|
+
if (e instanceof AuthError) console.error('Non connecté ou session expirée')
|
|
77
|
+
if (e instanceof ValidationError) console.error('Données invalides', e.errors)
|
|
78
|
+
if (e instanceof NotFoundError) console.error('Introuvable')
|
|
79
|
+
if (e instanceof QuotaError) console.error('Quota dépassé')
|
|
80
|
+
if (e instanceof RateLimitError) console.error('Trop de requêtes, réessayez dans quelques instants')
|
|
81
|
+
if (e instanceof NetworkError) console.error('Hors ligne')
|
|
82
|
+
if (e instanceof ServerError) console.error('Erreur interne du serveur')
|
|
73
83
|
}
|
|
74
84
|
```
|
|
75
85
|
|
|
@@ -78,7 +88,7 @@ try {
|
|
|
78
88
|
```js
|
|
79
89
|
// Persister la session dans localStorage (rechargement de page)
|
|
80
90
|
const client = new FrenchBaas({
|
|
81
|
-
url: 'https://
|
|
91
|
+
url: 'https://app.frenchbaas.com',
|
|
82
92
|
apiKey: 'votre-clé-api',
|
|
83
93
|
storage: 'localStorage', // défaut : 'memory'
|
|
84
94
|
})
|
|
@@ -96,3 +106,4 @@ const client = new FrenchBaas({
|
|
|
96
106
|
## License
|
|
97
107
|
|
|
98
108
|
MIT
|
|
109
|
+
# frenchbaas-js
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frenchbaas/js",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "SDK JavaScript officiel pour FrenchBaas",
|
|
5
5
|
"author": "FrenchBaas",
|
|
6
6
|
"license": "MIT",
|
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
"dist/**/*.js",
|
|
19
19
|
"dist/**/*.cjs",
|
|
20
20
|
"dist/**/*.d.ts",
|
|
21
|
-
"dist/**/*.d.mts"
|
|
21
|
+
"dist/**/*.d.mts",
|
|
22
|
+
"README.md"
|
|
22
23
|
],
|
|
23
24
|
"scripts": {
|
|
24
25
|
"build": "tsup",
|