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.cjs CHANGED
@@ -791,6 +791,10 @@ var Query = class {
791
791
  }
792
792
  };
793
793
 
794
+ // src/utils/constants.ts
795
+ var serverURI = "https://api.edmaxlabs.com/api/v2";
796
+ var socketURI = "https://api.edmaxlabs.com";
797
+
794
798
  // src/database/CollectionRef.ts
795
799
  var CollectionRef = class {
796
800
  constructor(app, collection) {
@@ -818,7 +822,7 @@ var CollectionRef = class {
818
822
  try {
819
823
  const res = await new HttpsRequest({
820
824
  method: "POST" /* POST */,
821
- endpoint: `${this.app.getBaseUrl()}/db/read`,
825
+ endpoint: `${serverURI}/db/read`,
822
826
  headers: {
823
827
  authorization: this.app.getConfig().token,
824
828
  "x-project": this.app.getConfig().project
@@ -846,7 +850,7 @@ var CollectionRef = class {
846
850
  try {
847
851
  const res = await new HttpsRequest({
848
852
  method: "POST" /* POST */,
849
- endpoint: `${this.app.getBaseUrl()}/db/read`,
853
+ endpoint: `${serverURI}/db/read`,
850
854
  headers: {
851
855
  authorization: this.app.getConfig().token,
852
856
  "x-project": this.app.getConfig().project
@@ -936,7 +940,7 @@ var CollectionRef = class {
936
940
 
937
941
  // src/database/Batch.ts
938
942
  var Batch = class {
939
- constructor(app) {
943
+ constructor(app, config) {
940
944
  this.ops = [];
941
945
  this.app = app;
942
946
  }
@@ -1023,7 +1027,7 @@ var Batch = class {
1023
1027
  }
1024
1028
  const res = await new HttpsRequest({
1025
1029
  method: "POST" /* POST */,
1026
- endpoint: `${this.app.getBaseUrl()}/db/batch`,
1030
+ endpoint: `${serverURI}/db/batch`,
1027
1031
  headers: { authorization: this.app.getConfig().token, "x-project": this.app.getConfig().project },
1028
1032
  body: { ops: this.ops }
1029
1033
  }).sendRequest();
@@ -1050,7 +1054,7 @@ var Database = class {
1050
1054
  throw new Error("doc(path) expects format 'collection/documentId'");
1051
1055
  }
1052
1056
  batch() {
1053
- return new Batch(this.app);
1057
+ return new Batch(this.app, this.app.getConfig());
1054
1058
  }
1055
1059
  /**
1056
1060
  * Server-side transaction (unchanged, but improved error handling)
@@ -1268,7 +1272,7 @@ var Functions = class {
1268
1272
  try {
1269
1273
  const res = await new HttpsRequest({
1270
1274
  method: "POST" /* POST */,
1271
- endpoint: this.app.getBaseUrl() + "/functions/call/" + functionName,
1275
+ endpoint: serverURI + "/functions/call/" + functionName,
1272
1276
  headers: { authorization: this.app.getConfig().token, "x-project": this.app.getConfig().project },
1273
1277
  body: data
1274
1278
  }).sendRequest();
@@ -2289,7 +2293,7 @@ var StorageRef = class {
2289
2293
  async get(id) {
2290
2294
  const res = await new HttpsRequest({
2291
2295
  method: "GET" /* GET */,
2292
- endpoint: this.app.getBaseUrl() + `/storage/${id}`,
2296
+ endpoint: serverURI + `/storage/${id}`,
2293
2297
  headers: {
2294
2298
  //authorization: this.app.getConfig.token,
2295
2299
  }
@@ -2306,7 +2310,7 @@ var StorageRef = class {
2306
2310
  async getMeta(id) {
2307
2311
  const res = await new HttpsRequest({
2308
2312
  method: "GET" /* GET */,
2309
- endpoint: this.app.getBaseUrl() + `/storage/${id}/info`,
2313
+ endpoint: serverURI + `/storage/${id}/info`,
2310
2314
  headers: {
2311
2315
  //authorization: this.app.getConfig.token,
2312
2316
  }
@@ -2327,7 +2331,7 @@ var StorageRef = class {
2327
2331
  console.log("SRCF");
2328
2332
  const res = await new HttpsRequest({
2329
2333
  method: "POST" /* POST */,
2330
- endpoint: this.app.getBaseUrl() + "/storage/file/upload",
2334
+ endpoint: serverURI + "/storage/file/upload",
2331
2335
  headers: { authorization: this.app.getConfig().token, "x-project": this.app.getConfig().project },
2332
2336
  file: srcFile,
2333
2337
  isMultipart: true
@@ -2344,7 +2348,7 @@ var StorageRef = class {
2344
2348
  async delete(id) {
2345
2349
  const res = await new HttpsRequest({
2346
2350
  method: "POST" /* POST */,
2347
- endpoint: this.app.getBaseUrl() + "/storage/file/delete",
2351
+ endpoint: serverURI + "/storage/file/delete",
2348
2352
  headers: { authorization: this.app.getConfig().token, "x-project": this.app.getConfig().project },
2349
2353
  body: {
2350
2354
  file_id: id
@@ -2354,20 +2358,6 @@ var StorageRef = class {
2354
2358
  }
2355
2359
  };
2356
2360
 
2357
- // src/storage/Storage.ts
2358
- var Storage = class {
2359
- constructor(app) {
2360
- this.app = app;
2361
- }
2362
- getStorage() {
2363
- return new StorageRef(this.app);
2364
- }
2365
- };
2366
-
2367
- // src/utils/constants.ts
2368
- var serverURI = "https://api.edmaxlabs.com/api/v2";
2369
- var socketURI = "https://api.edmaxlabs.com";
2370
-
2371
2361
  // src/core/EdmaxLabs.ts
2372
2362
  var _EdmaxLabs = class _EdmaxLabs {
2373
2363
  constructor(config) {
@@ -2419,7 +2409,7 @@ var _EdmaxLabs = class _EdmaxLabs {
2419
2409
  return new Functions(this);
2420
2410
  }
2421
2411
  get getStorage() {
2422
- return new Storage(this);
2412
+ return new StorageRef(this);
2423
2413
  }
2424
2414
  get getAuthentication() {
2425
2415
  if (!Authentication.instance) {