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.
Files changed (59) hide show
  1. package/DOLPHIN_MASTER_GUIDE_NEPALI.md +4 -4
  2. package/README.md +5 -5
  3. package/TUTORIAL_NEPALI.md +109 -181
  4. package/dist/adapters/mongoose/index.js +13 -0
  5. package/dist/adapters/mongoose/index.js.map +1 -1
  6. package/dist/authController/authController.d.ts +2 -1
  7. package/dist/authController/authController.js +36 -22
  8. package/dist/authController/authController.js.map +1 -1
  9. package/dist/authController/authController.test.js +2 -0
  10. package/dist/authController/authController.test.js.map +1 -1
  11. package/dist/bin/cli.js +142 -111
  12. package/dist/bin/cli.js.map +1 -1
  13. package/dist/client.test.js +6 -6
  14. package/dist/client.test.js.map +1 -1
  15. package/dist/curd/crud.d.ts +18 -0
  16. package/dist/curd/crud.js +11 -1
  17. package/dist/curd/crud.js.map +1 -1
  18. package/dist/curd/crud.test.js +10 -2
  19. package/dist/curd/crud.test.js.map +1 -1
  20. package/dist/demo-server.js +4 -4
  21. package/dist/demo-server.js.map +1 -1
  22. package/dist/dolphin-bench.js +1 -1
  23. package/dist/dolphin-bench.js.map +1 -1
  24. package/dist/index.d.ts +16 -4
  25. package/dist/index.js +15 -4
  26. package/dist/index.js.map +1 -1
  27. package/dist/real-test-mongoose.js +3 -3
  28. package/dist/real-test-mongoose.js.map +1 -1
  29. package/dist/realtime/camera.d.ts +1 -1
  30. package/dist/realtime/core.d.ts +5 -5
  31. package/dist/realtime/core.js +8 -8
  32. package/dist/realtime/core.js.map +1 -1
  33. package/dist/realtime/devicemanager.d.ts +102 -0
  34. package/dist/realtime/devicemanager.js +209 -1
  35. package/dist/realtime/devicemanager.js.map +1 -1
  36. package/dist/realtime/devicemanager.test.d.ts +1 -0
  37. package/dist/realtime/devicemanager.test.js +156 -0
  38. package/dist/realtime/devicemanager.test.js.map +1 -0
  39. package/dist/realtime/index.d.ts +7 -6
  40. package/dist/realtime/index.js +7 -6
  41. package/dist/realtime/index.js.map +1 -1
  42. package/dist/realtime/rtsp.d.ts +1 -1
  43. package/dist/server/client-serve.d.ts +1 -0
  44. package/dist/server/client-serve.js +17 -0
  45. package/dist/server/client-serve.js.map +1 -0
  46. package/dist/server/server.d.ts +8 -8
  47. package/dist/server/server.js +13 -15
  48. package/dist/server/server.js.map +1 -1
  49. package/dist/signaling/index.d.ts +1 -1
  50. package/dist/templates/index.d.ts +6 -0
  51. package/dist/templates/index.js +139 -20
  52. package/dist/templates/index.js.map +1 -1
  53. package/dist/test-2fa-real.js +1 -1
  54. package/dist/test-2fa-real.js.map +1 -1
  55. package/dist/test-dolphin.js +3 -3
  56. package/dist/test-dolphin.js.map +1 -1
  57. package/package.json +25 -5
  58. package/scripts/client.js +12 -11
  59. 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 { DolphinClient };
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 };