nexabase-console 1.0.0 → 1.0.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 +10 -47
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# NexaBase JavaScript SDK (`nexabase`)
|
|
1
|
+
# NexaBase JavaScript SDK (`nexabase-console`)
|
|
2
2
|
|
|
3
3
|
SDK Client Resmi untuk **NexaBase**: Platform sinkronisasi database modern yang menyatukan fungsionalitas Firestore NoSQL, Real-Time Database, File Storage, dan Edge Authentication dengan dukungan **Offline-First (IndexedDB)** serta **Passwordless OTP**.
|
|
4
4
|
|
|
@@ -19,45 +19,9 @@ SDK Client Resmi untuk **NexaBase**: Platform sinkronisasi database modern yang
|
|
|
19
19
|
Instal package melalui npm atau yarn:
|
|
20
20
|
|
|
21
21
|
```bash
|
|
22
|
-
npm install nexabase
|
|
22
|
+
npm install nexabase-console
|
|
23
23
|
# atau
|
|
24
|
-
yarn add nexabase
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
---
|
|
28
|
-
|
|
29
|
-
## ⚡ Panduan Rilis (Publishing)
|
|
30
|
-
|
|
31
|
-
Jika Anda ingin mengunggah SDK ini ke repositori **GitHub** Anda sendiri atau merilisnya ke registry **NPM**, ikuti langkah mudah berikut:
|
|
32
|
-
|
|
33
|
-
### 1. Inisialisasi Repositori Git & GitHub
|
|
34
|
-
```bash
|
|
35
|
-
# Masuk ke direktori SDK
|
|
36
|
-
cd nexabase-sdk
|
|
37
|
-
|
|
38
|
-
# Inisialisasi Git
|
|
39
|
-
git init
|
|
40
|
-
git add .
|
|
41
|
-
git commit -m "Inisialisasi rilis perdana NexaBase SDK v1.0.0"
|
|
42
|
-
|
|
43
|
-
# Tambahkan remote repositori GitHub Anda
|
|
44
|
-
git remote add origin https://github.com/USERNAME/REPOS_NAME.git
|
|
45
|
-
git branch -M main
|
|
46
|
-
git push -u origin main
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
### 2. Publikasi ke NPM Registry
|
|
50
|
-
Pastikan Anda sudah memiliki akun di [npmjs.com](https://www.npmjs.com/).
|
|
51
|
-
|
|
52
|
-
```bash
|
|
53
|
-
# Login ke akun NPM Anda melalui terminal
|
|
54
|
-
npm login
|
|
55
|
-
|
|
56
|
-
# Jalankan build compiler TypeScript
|
|
57
|
-
npm run build
|
|
58
|
-
|
|
59
|
-
# Publikasikan ke registry NPM secara publik
|
|
60
|
-
npm publish --access public
|
|
24
|
+
yarn add nexabase-console
|
|
61
25
|
```
|
|
62
26
|
|
|
63
27
|
---
|
|
@@ -67,12 +31,11 @@ npm publish --access public
|
|
|
67
31
|
### 1. Inisialisasi Aplikasi
|
|
68
32
|
|
|
69
33
|
```javascript
|
|
70
|
-
import { initializeApp, getFirestore } from 'nexabase';
|
|
34
|
+
import { initializeApp, getFirestore } from 'nexabase-console';
|
|
71
35
|
|
|
72
36
|
const app = initializeApp({
|
|
73
37
|
projectId: 'PROYEK_NEXABASE_ID_ANDA',
|
|
74
|
-
apiKey: 'NEXABASE_API_KEY_ANDA'
|
|
75
|
-
endpoint: 'https://nexabase-server.yourdomain.com' // Alamat URL server backend
|
|
38
|
+
apiKey: 'NEXABASE_API_KEY_ANDA' // Opsional, default endpoint mengarah ke https://db.nexabase.id
|
|
76
39
|
});
|
|
77
40
|
|
|
78
41
|
const db = getFirestore(app);
|
|
@@ -84,7 +47,7 @@ const db = getFirestore(app);
|
|
|
84
47
|
|
|
85
48
|
#### Menulis Data Baru (Set Doc)
|
|
86
49
|
```javascript
|
|
87
|
-
import { doc, setDoc } from 'nexabase';
|
|
50
|
+
import { doc, setDoc } from 'nexabase-console';
|
|
88
51
|
|
|
89
52
|
const main = async () => {
|
|
90
53
|
const profileRef = doc(db, 'users', 'budi_santoso');
|
|
@@ -103,7 +66,7 @@ main();
|
|
|
103
66
|
|
|
104
67
|
#### Memperbarui Sebagian Data (Update Doc)
|
|
105
68
|
```javascript
|
|
106
|
-
import { doc, updateDoc } from 'nexabase';
|
|
69
|
+
import { doc, updateDoc } from 'nexabase-console';
|
|
107
70
|
|
|
108
71
|
const editData = async () => {
|
|
109
72
|
const profileRef = doc(db, 'users', 'budi_santoso');
|
|
@@ -115,7 +78,7 @@ const editData = async () => {
|
|
|
115
78
|
|
|
116
79
|
#### Membaca Satu Dokumen (Get Doc)
|
|
117
80
|
```javascript
|
|
118
|
-
import { doc, getDoc } from 'nexabase';
|
|
81
|
+
import { doc, getDoc } from 'nexabase-console';
|
|
119
82
|
|
|
120
83
|
const readData = async () => {
|
|
121
84
|
const profileRef = doc(db, 'users', 'budi_santoso');
|
|
@@ -131,7 +94,7 @@ const readData = async () => {
|
|
|
131
94
|
|
|
132
95
|
#### Mendengarkan Perubahan Data secara Real-Time (onSnapshot)
|
|
133
96
|
```javascript
|
|
134
|
-
import { doc, onSnapshot } from 'nexabase';
|
|
97
|
+
import { doc, onSnapshot } from 'nexabase-console';
|
|
135
98
|
|
|
136
99
|
const listenLive = () => {
|
|
137
100
|
const docRef = doc(db, 'chats', 'global_room');
|
|
@@ -148,7 +111,7 @@ const listenLive = () => {
|
|
|
148
111
|
|
|
149
112
|
#### Menggunakan Atomic Write Batch
|
|
150
113
|
```javascript
|
|
151
|
-
import { doc, writeBatch } from 'nexabase';
|
|
114
|
+
import { doc, writeBatch } from 'nexabase-console';
|
|
152
115
|
|
|
153
116
|
const executeBatch = async () => {
|
|
154
117
|
const batch = writeBatch(db);
|
package/dist/index.js
CHANGED
|
@@ -29,7 +29,7 @@ class NexaApp {
|
|
|
29
29
|
this.token = savedToken;
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
this.endpoint = config.endpoint ||
|
|
32
|
+
this.endpoint = config.endpoint || 'https://db.nexabase.id';
|
|
33
33
|
this.client = axios_1.default.create({
|
|
34
34
|
baseURL: this.endpoint,
|
|
35
35
|
headers: {
|
package/package.json
CHANGED