edmaxlabs-core 2.5.4 → 2.5.6

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
@@ -206,7 +206,6 @@ declare class CollectionRef {
206
206
 
207
207
  declare class Batch {
208
208
  private app;
209
- private config;
210
209
  private ops;
211
210
  constructor(app: EdmaxLabs, config: EdmaxLabsConfig);
212
211
  set(docRef: DocumentRef, data: any): Batch;
@@ -274,8 +273,8 @@ declare class Realtime {
274
273
  }
275
274
 
276
275
  declare class Functions {
277
- private config;
278
- constructor(config: EdmaxLabsConfig);
276
+ private app;
277
+ constructor(app: EdmaxLabs);
279
278
  call(functionName: string, data?: Record<string, any>): Promise<any>;
280
279
  }
281
280
 
@@ -415,8 +414,7 @@ declare class StorageSnapshot {
415
414
 
416
415
  declare class StorageRef {
417
416
  private app;
418
- private config;
419
- constructor(app: EdmaxLabs, config: EdmaxLabsConfig);
417
+ constructor(app: EdmaxLabs);
420
418
  get(id: string): Promise<StorageSnapshot | null | undefined>;
421
419
  getMeta(id: string): Promise<StorageSnapshot | null | undefined>;
422
420
  upload(srcFile: File): Promise<StorageSnapshot | null | undefined>;
package/dist/index.d.ts CHANGED
@@ -206,7 +206,6 @@ declare class CollectionRef {
206
206
 
207
207
  declare class Batch {
208
208
  private app;
209
- private config;
210
209
  private ops;
211
210
  constructor(app: EdmaxLabs, config: EdmaxLabsConfig);
212
211
  set(docRef: DocumentRef, data: any): Batch;
@@ -274,8 +273,8 @@ declare class Realtime {
274
273
  }
275
274
 
276
275
  declare class Functions {
277
- private config;
278
- constructor(config: EdmaxLabsConfig);
276
+ private app;
277
+ constructor(app: EdmaxLabs);
279
278
  call(functionName: string, data?: Record<string, any>): Promise<any>;
280
279
  }
281
280
 
@@ -415,8 +414,7 @@ declare class StorageSnapshot {
415
414
 
416
415
  declare class StorageRef {
417
416
  private app;
418
- private config;
419
- constructor(app: EdmaxLabs, config: EdmaxLabsConfig);
417
+ constructor(app: EdmaxLabs);
420
418
  get(id: string): Promise<StorageSnapshot | null | undefined>;
421
419
  getMeta(id: string): Promise<StorageSnapshot | null | undefined>;
422
420
  upload(srcFile: File): Promise<StorageSnapshot | null | undefined>;
package/dist/index.mjs CHANGED
@@ -300,7 +300,6 @@ var _Authentication = class _Authentication {
300
300
  return;
301
301
  userDocUnsubscribe = userRef.onSnapshot(
302
302
  (snapshot, change) => {
303
- console.log(snapshot);
304
303
  if (change === "delete") {
305
304
  this.saveCredentials(null);
306
305
  onSignOut?.();
@@ -911,7 +910,6 @@ var Batch = class {
911
910
  constructor(app, config) {
912
911
  this.ops = [];
913
912
  this.app = app;
914
- this.config = config;
915
913
  }
916
914
  set(docRef, data) {
917
915
  this.ops.push({
@@ -997,7 +995,7 @@ var Batch = class {
997
995
  const res = await new HttpsRequest({
998
996
  method: "POST" /* POST */,
999
997
  endpoint: `${serverURI}/db/batch`,
1000
- headers: { authorization: this.config.token, "x-project": this.config.project },
998
+ headers: { authorization: this.app.getConfig().token, "x-project": this.app.getConfig().project },
1001
999
  body: { ops: this.ops }
1002
1000
  }).sendRequest();
1003
1001
  if (res?.error) {
@@ -1234,15 +1232,15 @@ var Realtime = class {
1234
1232
 
1235
1233
  // src/functions/Functions.ts
1236
1234
  var Functions = class {
1237
- constructor(config) {
1238
- this.config = config;
1235
+ constructor(app) {
1236
+ this.app = app;
1239
1237
  }
1240
1238
  async call(functionName, data) {
1241
1239
  try {
1242
1240
  const res = await new HttpsRequest({
1243
1241
  method: "POST" /* POST */,
1244
1242
  endpoint: serverURI + "/functions/call/" + functionName,
1245
- headers: { authorization: this.config.token, "x-project": this.config.project },
1243
+ headers: { authorization: this.app.getConfig().token, "x-project": this.app.getConfig().project },
1246
1244
  body: data
1247
1245
  }).sendRequest();
1248
1246
  return res;
@@ -2256,9 +2254,8 @@ var StorageSnapshot = class _StorageSnapshot {
2256
2254
 
2257
2255
  // src/storage/StorageRef.ts
2258
2256
  var StorageRef = class {
2259
- constructor(app, config) {
2257
+ constructor(app) {
2260
2258
  this.app = app;
2261
- this.config = config;
2262
2259
  }
2263
2260
  async get(id) {
2264
2261
  const res = await new HttpsRequest({
@@ -2302,7 +2299,7 @@ var StorageRef = class {
2302
2299
  const res = await new HttpsRequest({
2303
2300
  method: "POST" /* POST */,
2304
2301
  endpoint: serverURI + "/storage/file/upload",
2305
- headers: { authorization: this.config.token, "x-project": this.config.project },
2302
+ headers: { authorization: this.app.getConfig().token, "x-project": this.app.getConfig().project },
2306
2303
  file: srcFile,
2307
2304
  isMultipart: true
2308
2305
  }).sendRequest();
@@ -2318,8 +2315,8 @@ var StorageRef = class {
2318
2315
  async delete(id) {
2319
2316
  const res = await new HttpsRequest({
2320
2317
  method: "POST" /* POST */,
2321
- endpoint: this.config + "/storage/file/delete",
2322
- headers: { authorization: this.config.token, "x-project": this.config.project },
2318
+ endpoint: serverURI + "/storage/file/delete",
2319
+ headers: { authorization: this.app.getConfig().token, "x-project": this.app.getConfig().project },
2323
2320
  body: {
2324
2321
  file_id: id
2325
2322
  }
@@ -2376,10 +2373,10 @@ var _EdmaxLabs = class _EdmaxLabs {
2376
2373
  return this._db;
2377
2374
  }
2378
2375
  get getFunctions() {
2379
- return new Functions(this._config);
2376
+ return new Functions(this);
2380
2377
  }
2381
2378
  get getStorage() {
2382
- return new StorageRef(this, this._config);
2379
+ return new StorageRef(this);
2383
2380
  }
2384
2381
  get getAuthentication() {
2385
2382
  if (!Authentication.instance) {