edmaxlabs-core 2.5.4 → 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
@@ -943,7 +943,6 @@ var Batch = class {
943
943
  constructor(app, config) {
944
944
  this.ops = [];
945
945
  this.app = app;
946
- this.config = config;
947
946
  }
948
947
  set(docRef, data) {
949
948
  this.ops.push({
@@ -1029,7 +1028,7 @@ var Batch = class {
1029
1028
  const res = await new HttpsRequest({
1030
1029
  method: "POST" /* POST */,
1031
1030
  endpoint: `${serverURI}/db/batch`,
1032
- headers: { authorization: this.config.token, "x-project": this.config.project },
1031
+ headers: { authorization: this.app.getConfig().token, "x-project": this.app.getConfig().project },
1033
1032
  body: { ops: this.ops }
1034
1033
  }).sendRequest();
1035
1034
  if (res?.error) {
@@ -1266,15 +1265,15 @@ var Realtime = class {
1266
1265
 
1267
1266
  // src/functions/Functions.ts
1268
1267
  var Functions = class {
1269
- constructor(config) {
1270
- this.config = config;
1268
+ constructor(app) {
1269
+ this.app = app;
1271
1270
  }
1272
1271
  async call(functionName, data) {
1273
1272
  try {
1274
1273
  const res = await new HttpsRequest({
1275
1274
  method: "POST" /* POST */,
1276
1275
  endpoint: serverURI + "/functions/call/" + functionName,
1277
- headers: { authorization: this.config.token, "x-project": this.config.project },
1276
+ headers: { authorization: this.app.getConfig().token, "x-project": this.app.getConfig().project },
1278
1277
  body: data
1279
1278
  }).sendRequest();
1280
1279
  return res;
@@ -2288,9 +2287,8 @@ var StorageSnapshot = class _StorageSnapshot {
2288
2287
 
2289
2288
  // src/storage/StorageRef.ts
2290
2289
  var StorageRef = class {
2291
- constructor(app, config) {
2290
+ constructor(app) {
2292
2291
  this.app = app;
2293
- this.config = config;
2294
2292
  }
2295
2293
  async get(id) {
2296
2294
  const res = await new HttpsRequest({
@@ -2334,7 +2332,7 @@ var StorageRef = class {
2334
2332
  const res = await new HttpsRequest({
2335
2333
  method: "POST" /* POST */,
2336
2334
  endpoint: serverURI + "/storage/file/upload",
2337
- headers: { authorization: this.config.token, "x-project": this.config.project },
2335
+ headers: { authorization: this.app.getConfig().token, "x-project": this.app.getConfig().project },
2338
2336
  file: srcFile,
2339
2337
  isMultipart: true
2340
2338
  }).sendRequest();
@@ -2350,8 +2348,8 @@ var StorageRef = class {
2350
2348
  async delete(id) {
2351
2349
  const res = await new HttpsRequest({
2352
2350
  method: "POST" /* POST */,
2353
- endpoint: this.config + "/storage/file/delete",
2354
- headers: { authorization: this.config.token, "x-project": this.config.project },
2351
+ endpoint: serverURI + "/storage/file/delete",
2352
+ headers: { authorization: this.app.getConfig().token, "x-project": this.app.getConfig().project },
2355
2353
  body: {
2356
2354
  file_id: id
2357
2355
  }
@@ -2408,10 +2406,10 @@ var _EdmaxLabs = class _EdmaxLabs {
2408
2406
  return this._db;
2409
2407
  }
2410
2408
  get getFunctions() {
2411
- return new Functions(this._config);
2409
+ return new Functions(this);
2412
2410
  }
2413
2411
  get getStorage() {
2414
- return new StorageRef(this, this._config);
2412
+ return new StorageRef(this);
2415
2413
  }
2416
2414
  get getAuthentication() {
2417
2415
  if (!Authentication.instance) {