dolphin-server-modules 2.11.2 → 2.11.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/DOLPHIN_MASTER_GUIDE_NEPALI.md +4 -4
- package/README.md +5 -5
- package/TUTORIAL_NEPALI.md +109 -181
- package/dist/adapters/mongoose/index.js +13 -0
- package/dist/adapters/mongoose/index.js.map +1 -1
- package/dist/authController/authController.d.ts +2 -1
- package/dist/authController/authController.js +36 -22
- package/dist/authController/authController.js.map +1 -1
- package/dist/authController/authController.test.js +2 -0
- package/dist/authController/authController.test.js.map +1 -1
- package/dist/bin/cli.js +142 -111
- package/dist/bin/cli.js.map +1 -1
- package/dist/client.test.js +6 -6
- package/dist/client.test.js.map +1 -1
- package/dist/curd/crud.d.ts +18 -0
- package/dist/curd/crud.js +11 -1
- package/dist/curd/crud.js.map +1 -1
- package/dist/curd/crud.test.js +10 -2
- package/dist/curd/crud.test.js.map +1 -1
- package/dist/demo-server.js +4 -4
- package/dist/demo-server.js.map +1 -1
- package/dist/dolphin-bench.js +1 -1
- package/dist/dolphin-bench.js.map +1 -1
- package/dist/index.d.ts +16 -4
- package/dist/index.js +15 -4
- package/dist/index.js.map +1 -1
- package/dist/real-test-mongoose.js +3 -3
- package/dist/real-test-mongoose.js.map +1 -1
- package/dist/realtime/camera.d.ts +1 -1
- package/dist/realtime/core.d.ts +5 -5
- package/dist/realtime/core.js +8 -8
- package/dist/realtime/core.js.map +1 -1
- package/dist/realtime/devicemanager.d.ts +102 -0
- package/dist/realtime/devicemanager.js +209 -1
- package/dist/realtime/devicemanager.js.map +1 -1
- package/dist/realtime/devicemanager.test.d.ts +1 -0
- package/dist/realtime/devicemanager.test.js +156 -0
- package/dist/realtime/devicemanager.test.js.map +1 -0
- package/dist/realtime/index.d.ts +7 -6
- package/dist/realtime/index.js +7 -6
- package/dist/realtime/index.js.map +1 -1
- package/dist/realtime/rtsp.d.ts +1 -1
- package/dist/server/client-serve.d.ts +1 -0
- package/dist/server/client-serve.js +17 -0
- package/dist/server/client-serve.js.map +1 -0
- package/dist/server/server.d.ts +8 -8
- package/dist/server/server.js +13 -15
- package/dist/server/server.js.map +1 -1
- package/dist/signaling/index.d.ts +1 -1
- package/dist/templates/index.d.ts +6 -0
- package/dist/templates/index.js +139 -20
- package/dist/templates/index.js.map +1 -1
- package/dist/test-2fa-real.js +1 -1
- package/dist/test-2fa-real.js.map +1 -1
- package/dist/test-dolphin.js +3 -3
- package/dist/test-dolphin.js.map +1 -1
- package/package.json +25 -5
- package/scripts/client.js +12 -11
- package/scripts/client.mjs +9 -0
package/scripts/client.js
CHANGED
|
@@ -197,7 +197,7 @@ class AuthHandler {
|
|
|
197
197
|
* @param {string} password
|
|
198
198
|
*/
|
|
199
199
|
async login(email, password) {
|
|
200
|
-
const res = await this.client.api.post('/auth/login', { email, password });
|
|
200
|
+
const res = await this.client.api.post('/api/auth/login', { email, password });
|
|
201
201
|
if (res.accessToken) {
|
|
202
202
|
this.client.setToken(res.accessToken);
|
|
203
203
|
this.user = res.user || null;
|
|
@@ -210,19 +210,19 @@ class AuthHandler {
|
|
|
210
210
|
* @param {{ email: string, password: string, [key: string]: any }} data
|
|
211
211
|
*/
|
|
212
212
|
async register(data) {
|
|
213
|
-
return this.client.api.post('/auth/register', data);
|
|
213
|
+
return this.client.api.post('/api/auth/register', data);
|
|
214
214
|
}
|
|
215
215
|
|
|
216
216
|
/** Get current user profile. */
|
|
217
217
|
async me() {
|
|
218
|
-
const res = await this.client.api.get('/auth/me');
|
|
218
|
+
const res = await this.client.api.get('/api/auth/me');
|
|
219
219
|
if (res.success) this.user = res.data;
|
|
220
220
|
return res;
|
|
221
221
|
}
|
|
222
222
|
|
|
223
223
|
/** Logout and clear token. */
|
|
224
224
|
async logout() {
|
|
225
|
-
try { await this.client.api.post('/auth/logout'); } catch {}
|
|
225
|
+
try { await this.client.api.post('/api/auth/logout'); } catch {}
|
|
226
226
|
this.client.setToken(null);
|
|
227
227
|
this.user = null;
|
|
228
228
|
}
|
|
@@ -241,7 +241,7 @@ class AuthHandler {
|
|
|
241
241
|
if (this._refreshing) return false;
|
|
242
242
|
this._refreshing = true;
|
|
243
243
|
try {
|
|
244
|
-
const res = await this.client.api.post('/auth/refresh', null, {}, true);
|
|
244
|
+
const res = await this.client.api.post('/api/auth/refresh', null, {}, true);
|
|
245
245
|
if (res.accessToken) {
|
|
246
246
|
this.client.setToken(res.accessToken);
|
|
247
247
|
return true;
|
|
@@ -265,7 +265,7 @@ class AuthHandler {
|
|
|
265
265
|
code,
|
|
266
266
|
email: email || this.user?.email,
|
|
267
267
|
};
|
|
268
|
-
const res = await this.client.api.post('/auth/2fa/verify', payload);
|
|
268
|
+
const res = await this.client.api.post('/api/auth/2fa/verify', payload);
|
|
269
269
|
if (res.accessToken) {
|
|
270
270
|
this.client.setToken(res.accessToken);
|
|
271
271
|
if (res.user) this.user = res.user;
|
|
@@ -277,7 +277,7 @@ class AuthHandler {
|
|
|
277
277
|
* Enable 2FA — returns QR code URL and secret.
|
|
278
278
|
*/
|
|
279
279
|
async enable2FA() {
|
|
280
|
-
return this.client.api.post('/auth/2fa/enable');
|
|
280
|
+
return this.client.api.post('/api/auth/2fa/enable');
|
|
281
281
|
}
|
|
282
282
|
|
|
283
283
|
/**
|
|
@@ -285,7 +285,7 @@ class AuthHandler {
|
|
|
285
285
|
* @param {string} code — current TOTP code to confirm
|
|
286
286
|
*/
|
|
287
287
|
async disable2FA(code) {
|
|
288
|
-
return this.client.api.post('/auth/2fa/disable', { code });
|
|
288
|
+
return this.client.api.post('/api/auth/2fa/disable', { code });
|
|
289
289
|
}
|
|
290
290
|
|
|
291
291
|
/**
|
|
@@ -293,7 +293,7 @@ class AuthHandler {
|
|
|
293
293
|
* @param {string} email
|
|
294
294
|
*/
|
|
295
295
|
async forgotPassword(email) {
|
|
296
|
-
return this.client.api.post('/auth/forgot-password', { email });
|
|
296
|
+
return this.client.api.post('/api/auth/forgot-password', { email });
|
|
297
297
|
}
|
|
298
298
|
|
|
299
299
|
/**
|
|
@@ -302,7 +302,7 @@ class AuthHandler {
|
|
|
302
302
|
* @param {string} newPassword
|
|
303
303
|
*/
|
|
304
304
|
async resetPassword(token, newPassword) {
|
|
305
|
-
return this.client.api.post('/auth/reset-password', { token, newPassword });
|
|
305
|
+
return this.client.api.post('/api/auth/reset-password', { token, newPassword });
|
|
306
306
|
}
|
|
307
307
|
}
|
|
308
308
|
|
|
@@ -835,4 +835,5 @@ if (typeof module !== 'undefined' && module.exports) {
|
|
|
835
835
|
module.exports = { DolphinClient };
|
|
836
836
|
}
|
|
837
837
|
|
|
838
|
-
export
|
|
838
|
+
// Note: No top-level `export` here so that this file can be loaded
|
|
839
|
+
// via classic <script src="..."> in browsers / React without "Unexpected token 'export'"
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// ESM entry point for "dolphin-server-modules/client"
|
|
2
|
+
// Allows: import { DolphinClient } from 'dolphin-server-modules/client'
|
|
3
|
+
// in Vite, React, Next.js, etc. without breaking classic <script src> usage.
|
|
4
|
+
|
|
5
|
+
import { createRequire } from 'node:module';
|
|
6
|
+
const require = createRequire(import.meta.url);
|
|
7
|
+
const { DolphinClient } = require('./client.js');
|
|
8
|
+
|
|
9
|
+
export { DolphinClient };
|