edmaxlabs-core 2.5.3 → 2.5.5

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/dist/index.d.cts CHANGED
@@ -207,7 +207,7 @@ declare class CollectionRef {
207
207
  declare class Batch {
208
208
  private app;
209
209
  private ops;
210
- constructor(app: EdmaxLabs);
210
+ constructor(app: EdmaxLabs, config: EdmaxLabsConfig);
211
211
  set(docRef: DocumentRef, data: any): Batch;
212
212
  create(docRef: DocumentRef, data: any): Batch;
213
213
  update(docRef: DocumentRef, data: any): Batch;
@@ -273,7 +273,7 @@ declare class Realtime {
273
273
  }
274
274
 
275
275
  declare class Functions {
276
- app: EdmaxLabs;
276
+ private app;
277
277
  constructor(app: EdmaxLabs);
278
278
  call(functionName: string, data?: Record<string, any>): Promise<any>;
279
279
  }
@@ -413,7 +413,7 @@ declare class StorageSnapshot {
413
413
  }
414
414
 
415
415
  declare class StorageRef {
416
- app: EdmaxLabs;
416
+ private app;
417
417
  constructor(app: EdmaxLabs);
418
418
  get(id: string): Promise<StorageSnapshot | null | undefined>;
419
419
  getMeta(id: string): Promise<StorageSnapshot | null | undefined>;
@@ -424,12 +424,6 @@ declare class StorageRef {
424
424
  }>;
425
425
  }
426
426
 
427
- declare class Storage {
428
- app: EdmaxLabs;
429
- constructor(app: EdmaxLabs);
430
- getStorage(): StorageRef;
431
- }
432
-
433
427
  interface EdmaxLabsConfig {
434
428
  token: string;
435
429
  project: string;
@@ -456,7 +450,7 @@ declare class EdmaxLabs {
456
450
  static initialize(config: EdmaxLabsConfig): EdmaxLabs;
457
451
  get getDatabase(): Database;
458
452
  get getFunctions(): Functions;
459
- get getStorage(): Storage;
453
+ get getStorage(): StorageRef;
460
454
  get getAuthentication(): Authentication;
461
455
  /** Check if offline features are enabled */
462
456
  get isOfflineEnabled(): boolean;
package/dist/index.d.ts CHANGED
@@ -207,7 +207,7 @@ declare class CollectionRef {
207
207
  declare class Batch {
208
208
  private app;
209
209
  private ops;
210
- constructor(app: EdmaxLabs);
210
+ constructor(app: EdmaxLabs, config: EdmaxLabsConfig);
211
211
  set(docRef: DocumentRef, data: any): Batch;
212
212
  create(docRef: DocumentRef, data: any): Batch;
213
213
  update(docRef: DocumentRef, data: any): Batch;
@@ -273,7 +273,7 @@ declare class Realtime {
273
273
  }
274
274
 
275
275
  declare class Functions {
276
- app: EdmaxLabs;
276
+ private app;
277
277
  constructor(app: EdmaxLabs);
278
278
  call(functionName: string, data?: Record<string, any>): Promise<any>;
279
279
  }
@@ -413,7 +413,7 @@ declare class StorageSnapshot {
413
413
  }
414
414
 
415
415
  declare class StorageRef {
416
- app: EdmaxLabs;
416
+ private app;
417
417
  constructor(app: EdmaxLabs);
418
418
  get(id: string): Promise<StorageSnapshot | null | undefined>;
419
419
  getMeta(id: string): Promise<StorageSnapshot | null | undefined>;
@@ -424,12 +424,6 @@ declare class StorageRef {
424
424
  }>;
425
425
  }
426
426
 
427
- declare class Storage {
428
- app: EdmaxLabs;
429
- constructor(app: EdmaxLabs);
430
- getStorage(): StorageRef;
431
- }
432
-
433
427
  interface EdmaxLabsConfig {
434
428
  token: string;
435
429
  project: string;
@@ -456,7 +450,7 @@ declare class EdmaxLabs {
456
450
  static initialize(config: EdmaxLabsConfig): EdmaxLabs;
457
451
  get getDatabase(): Database;
458
452
  get getFunctions(): Functions;
459
- get getStorage(): Storage;
453
+ get getStorage(): StorageRef;
460
454
  get getAuthentication(): Authentication;
461
455
  /** Check if offline features are enabled */
462
456
  get isOfflineEnabled(): boolean;
package/dist/index.mjs CHANGED
@@ -759,6 +759,10 @@ var Query = class {
759
759
  }
760
760
  };
761
761
 
762
+ // src/utils/constants.ts
763
+ var serverURI = "https://api.edmaxlabs.com/api/v2";
764
+ var socketURI = "https://api.edmaxlabs.com";
765
+
762
766
  // src/database/CollectionRef.ts
763
767
  var CollectionRef = class {
764
768
  constructor(app, collection) {
@@ -786,7 +790,7 @@ var CollectionRef = class {
786
790
  try {
787
791
  const res = await new HttpsRequest({
788
792
  method: "POST" /* POST */,
789
- endpoint: `${this.app.getBaseUrl()}/db/read`,
793
+ endpoint: `${serverURI}/db/read`,
790
794
  headers: {
791
795
  authorization: this.app.getConfig().token,
792
796
  "x-project": this.app.getConfig().project
@@ -814,7 +818,7 @@ var CollectionRef = class {
814
818
  try {
815
819
  const res = await new HttpsRequest({
816
820
  method: "POST" /* POST */,
817
- endpoint: `${this.app.getBaseUrl()}/db/read`,
821
+ endpoint: `${serverURI}/db/read`,
818
822
  headers: {
819
823
  authorization: this.app.getConfig().token,
820
824
  "x-project": this.app.getConfig().project
@@ -904,7 +908,7 @@ var CollectionRef = class {
904
908
 
905
909
  // src/database/Batch.ts
906
910
  var Batch = class {
907
- constructor(app) {
911
+ constructor(app, config) {
908
912
  this.ops = [];
909
913
  this.app = app;
910
914
  }
@@ -991,7 +995,7 @@ var Batch = class {
991
995
  }
992
996
  const res = await new HttpsRequest({
993
997
  method: "POST" /* POST */,
994
- endpoint: `${this.app.getBaseUrl()}/db/batch`,
998
+ endpoint: `${serverURI}/db/batch`,
995
999
  headers: { authorization: this.app.getConfig().token, "x-project": this.app.getConfig().project },
996
1000
  body: { ops: this.ops }
997
1001
  }).sendRequest();
@@ -1018,7 +1022,7 @@ var Database = class {
1018
1022
  throw new Error("doc(path) expects format 'collection/documentId'");
1019
1023
  }
1020
1024
  batch() {
1021
- return new Batch(this.app);
1025
+ return new Batch(this.app, this.app.getConfig());
1022
1026
  }
1023
1027
  /**
1024
1028
  * Server-side transaction (unchanged, but improved error handling)
@@ -1236,7 +1240,7 @@ var Functions = class {
1236
1240
  try {
1237
1241
  const res = await new HttpsRequest({
1238
1242
  method: "POST" /* POST */,
1239
- endpoint: this.app.getBaseUrl() + "/functions/call/" + functionName,
1243
+ endpoint: serverURI + "/functions/call/" + functionName,
1240
1244
  headers: { authorization: this.app.getConfig().token, "x-project": this.app.getConfig().project },
1241
1245
  body: data
1242
1246
  }).sendRequest();
@@ -2257,7 +2261,7 @@ var StorageRef = class {
2257
2261
  async get(id) {
2258
2262
  const res = await new HttpsRequest({
2259
2263
  method: "GET" /* GET */,
2260
- endpoint: this.app.getBaseUrl() + `/storage/${id}`,
2264
+ endpoint: serverURI + `/storage/${id}`,
2261
2265
  headers: {
2262
2266
  //authorization: this.app.getConfig.token,
2263
2267
  }
@@ -2274,7 +2278,7 @@ var StorageRef = class {
2274
2278
  async getMeta(id) {
2275
2279
  const res = await new HttpsRequest({
2276
2280
  method: "GET" /* GET */,
2277
- endpoint: this.app.getBaseUrl() + `/storage/${id}/info`,
2281
+ endpoint: serverURI + `/storage/${id}/info`,
2278
2282
  headers: {
2279
2283
  //authorization: this.app.getConfig.token,
2280
2284
  }
@@ -2295,7 +2299,7 @@ var StorageRef = class {
2295
2299
  console.log("SRCF");
2296
2300
  const res = await new HttpsRequest({
2297
2301
  method: "POST" /* POST */,
2298
- endpoint: this.app.getBaseUrl() + "/storage/file/upload",
2302
+ endpoint: serverURI + "/storage/file/upload",
2299
2303
  headers: { authorization: this.app.getConfig().token, "x-project": this.app.getConfig().project },
2300
2304
  file: srcFile,
2301
2305
  isMultipart: true
@@ -2312,7 +2316,7 @@ var StorageRef = class {
2312
2316
  async delete(id) {
2313
2317
  const res = await new HttpsRequest({
2314
2318
  method: "POST" /* POST */,
2315
- endpoint: this.app.getBaseUrl() + "/storage/file/delete",
2319
+ endpoint: serverURI + "/storage/file/delete",
2316
2320
  headers: { authorization: this.app.getConfig().token, "x-project": this.app.getConfig().project },
2317
2321
  body: {
2318
2322
  file_id: id
@@ -2322,20 +2326,6 @@ var StorageRef = class {
2322
2326
  }
2323
2327
  };
2324
2328
 
2325
- // src/storage/Storage.ts
2326
- var Storage = class {
2327
- constructor(app) {
2328
- this.app = app;
2329
- }
2330
- getStorage() {
2331
- return new StorageRef(this.app);
2332
- }
2333
- };
2334
-
2335
- // src/utils/constants.ts
2336
- var serverURI = "https://api.edmaxlabs.com/api/v2";
2337
- var socketURI = "https://api.edmaxlabs.com";
2338
-
2339
2329
  // src/core/EdmaxLabs.ts
2340
2330
  var _EdmaxLabs = class _EdmaxLabs {
2341
2331
  constructor(config) {
@@ -2387,7 +2377,7 @@ var _EdmaxLabs = class _EdmaxLabs {
2387
2377
  return new Functions(this);
2388
2378
  }
2389
2379
  get getStorage() {
2390
- return new Storage(this);
2380
+ return new StorageRef(this);
2391
2381
  }
2392
2382
  get getAuthentication() {
2393
2383
  if (!Authentication.instance) {