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 +10 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -5
- package/dist/index.d.ts +3 -5
- package/dist/index.mjs +10 -12
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
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
|
|
278
|
-
constructor(
|
|
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
|
-
|
|
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
|
|
278
|
-
constructor(
|
|
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
|
-
|
|
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
|
@@ -911,7 +911,6 @@ var Batch = class {
|
|
|
911
911
|
constructor(app, config) {
|
|
912
912
|
this.ops = [];
|
|
913
913
|
this.app = app;
|
|
914
|
-
this.config = config;
|
|
915
914
|
}
|
|
916
915
|
set(docRef, data) {
|
|
917
916
|
this.ops.push({
|
|
@@ -997,7 +996,7 @@ var Batch = class {
|
|
|
997
996
|
const res = await new HttpsRequest({
|
|
998
997
|
method: "POST" /* POST */,
|
|
999
998
|
endpoint: `${serverURI}/db/batch`,
|
|
1000
|
-
headers: { authorization: this.
|
|
999
|
+
headers: { authorization: this.app.getConfig().token, "x-project": this.app.getConfig().project },
|
|
1001
1000
|
body: { ops: this.ops }
|
|
1002
1001
|
}).sendRequest();
|
|
1003
1002
|
if (res?.error) {
|
|
@@ -1234,15 +1233,15 @@ var Realtime = class {
|
|
|
1234
1233
|
|
|
1235
1234
|
// src/functions/Functions.ts
|
|
1236
1235
|
var Functions = class {
|
|
1237
|
-
constructor(
|
|
1238
|
-
this.
|
|
1236
|
+
constructor(app) {
|
|
1237
|
+
this.app = app;
|
|
1239
1238
|
}
|
|
1240
1239
|
async call(functionName, data) {
|
|
1241
1240
|
try {
|
|
1242
1241
|
const res = await new HttpsRequest({
|
|
1243
1242
|
method: "POST" /* POST */,
|
|
1244
1243
|
endpoint: serverURI + "/functions/call/" + functionName,
|
|
1245
|
-
headers: { authorization: this.
|
|
1244
|
+
headers: { authorization: this.app.getConfig().token, "x-project": this.app.getConfig().project },
|
|
1246
1245
|
body: data
|
|
1247
1246
|
}).sendRequest();
|
|
1248
1247
|
return res;
|
|
@@ -2256,9 +2255,8 @@ var StorageSnapshot = class _StorageSnapshot {
|
|
|
2256
2255
|
|
|
2257
2256
|
// src/storage/StorageRef.ts
|
|
2258
2257
|
var StorageRef = class {
|
|
2259
|
-
constructor(app
|
|
2258
|
+
constructor(app) {
|
|
2260
2259
|
this.app = app;
|
|
2261
|
-
this.config = config;
|
|
2262
2260
|
}
|
|
2263
2261
|
async get(id) {
|
|
2264
2262
|
const res = await new HttpsRequest({
|
|
@@ -2302,7 +2300,7 @@ var StorageRef = class {
|
|
|
2302
2300
|
const res = await new HttpsRequest({
|
|
2303
2301
|
method: "POST" /* POST */,
|
|
2304
2302
|
endpoint: serverURI + "/storage/file/upload",
|
|
2305
|
-
headers: { authorization: this.
|
|
2303
|
+
headers: { authorization: this.app.getConfig().token, "x-project": this.app.getConfig().project },
|
|
2306
2304
|
file: srcFile,
|
|
2307
2305
|
isMultipart: true
|
|
2308
2306
|
}).sendRequest();
|
|
@@ -2318,8 +2316,8 @@ var StorageRef = class {
|
|
|
2318
2316
|
async delete(id) {
|
|
2319
2317
|
const res = await new HttpsRequest({
|
|
2320
2318
|
method: "POST" /* POST */,
|
|
2321
|
-
endpoint:
|
|
2322
|
-
headers: { authorization: this.
|
|
2319
|
+
endpoint: serverURI + "/storage/file/delete",
|
|
2320
|
+
headers: { authorization: this.app.getConfig().token, "x-project": this.app.getConfig().project },
|
|
2323
2321
|
body: {
|
|
2324
2322
|
file_id: id
|
|
2325
2323
|
}
|
|
@@ -2376,10 +2374,10 @@ var _EdmaxLabs = class _EdmaxLabs {
|
|
|
2376
2374
|
return this._db;
|
|
2377
2375
|
}
|
|
2378
2376
|
get getFunctions() {
|
|
2379
|
-
return new Functions(this
|
|
2377
|
+
return new Functions(this);
|
|
2380
2378
|
}
|
|
2381
2379
|
get getStorage() {
|
|
2382
|
-
return new StorageRef(this
|
|
2380
|
+
return new StorageRef(this);
|
|
2383
2381
|
}
|
|
2384
2382
|
get getAuthentication() {
|
|
2385
2383
|
if (!Authentication.instance) {
|