@ztimson/momentum 1.4.2 → 1.4.4
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/actions.d.ts +1 -1
- package/dist/actions.d.ts.map +1 -1
- package/dist/asset-controller.d.ts.map +1 -1
- package/dist/data.d.ts +11 -8
- package/dist/data.d.ts.map +1 -1
- package/dist/index.js +70 -75
- package/dist/index.mjs +70 -75
- package/dist/schemas.d.ts +2 -0
- package/dist/schemas.d.ts.map +1 -1
- package/dist/sockets.d.ts +4 -4
- package/dist/sockets.d.ts.map +1 -1
- package/dist/webRtc.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/actions.d.ts
CHANGED
|
@@ -103,7 +103,7 @@ export declare class Actions extends AssetController<Action> {
|
|
|
103
103
|
/**
|
|
104
104
|
* Manually trigger an actions execution with real-time updates
|
|
105
105
|
* @param {string} id Action ID
|
|
106
|
-
* @param {(payload:
|
|
106
|
+
* @param {(payload: ActionResult) => any} callback Get updates in real time
|
|
107
107
|
* @param {HttpRequestOptions} opts Additional arguments
|
|
108
108
|
* @return {Promise<string>} Run UID for socket subscription
|
|
109
109
|
*/
|
package/dist/actions.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../src/actions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,kBAAkB,EAAY,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAC,eAAe,EAAC,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AAEpC,MAAM,MAAM,QAAQ,GAAG;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG;QACtC,oBAAoB;QACpB,IAAI,EAAE,OAAO,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC;QAC3D,2BAA2B;Q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O,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACvC,2CAA2C;IAC3C,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC7B,CAAA;AAED,sDAAsD;AACtD,oBAAY,UAAU;IACrB,0BAA0B;IACzB,QAAQ,IAAI;IACb,wBAAwB;IACvB,MAAM,IAAI;IACX,yBAAyB;IACxB,OAAO,IAAI;IACZ,uBAAuB;IACtB,KAAK,IAAI;IACV,uBAAuB;IACtB,KAAK,IAAI;IACV,qBAAqB;IACpB,OAAO,IAAI;IACZ,eAAe;IACd,MAAM,IAAI;IACX,mBAAmB;IAClB,IAAI,IAAI;CACT;AAED,wCAAwC;AACxC,qBAAa,OAAQ,SAAQ,eAAe,CAAC,MAAM,CAAC;IACvC,SAAS,CAAC,QAAQ,EAAE,QAAQ;gBAAlB,QAAQ,EAAE,QAAQ;IAIxC;;;;;;OAMG;IACG,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,YAAY,CAAC,KAAK,GAAG,EAAE,IAAI,GAAE,kBAAuB,GAAG,OAAO,CAAC,MAAM,CAAC;IAU3H;;;;OAIG;IACH,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAKvC;;;;;OAKG;IACH,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,kBAAuB,GAAG,OAAO,CAAC,CAAC,CAAC;CAG/D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asset-controller.d.ts","sourceRoot":"","sources":["../src/asset-controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"asset-controller.d.ts","sourceRoot":"","sources":["../src/asset-controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAE,YAAY,EAAa,SAAS,EA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AAC;IAO3C;;;;;OAKG;IACG,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC;IASrD;;;;OAIG;IACG,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAY3C;;;;;OAKG;IACH,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,KAAK,GAAG,CAAC,GAAG,IAAI,EAAE,IAAI,GAAE;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,OAAO,CAAA;KAAM,GAAG,WAAW;CAe1H;AAED,qBAAa,mBAAmB,CAAC,CAAC,SAAS,IAAI,GAAG;IAAC,IAAI,EAAE,MAAM,CAAA;CAAC,CAAE,SAAQ,eAAe,CAAC,CAAC,CAAC;IAC3F;;;;OAIG;IACG,GAAG,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;IAKnD;;;;;OAKG;IACH,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,KAAK,GAAG,EAAE,IAAI,GAAE;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,OAAO,CAAA;KAAM,GAAG,WAAW;CAKhI"}
|
package/dist/data.d.ts
CHANGED
|
@@ -3,14 +3,18 @@ import { Meta, PathEventEmitter } from './core';
|
|
|
3
3
|
import { Momentum } from './momentum';
|
|
4
4
|
/** Comparison operators for filters */
|
|
5
5
|
export type FilterOperator = '=' | '!=' | '>' | '>=' | '<' | '<=' | 'in' | 'nin' | 'regex' | 'exists';
|
|
6
|
-
/** Filter value - primitive for equality
|
|
7
|
-
export type FilterValue<T = any> = T | [FilterOperator, T];
|
|
8
|
-
/** Filter object with comparison support */
|
|
9
|
-
export type Filter<T = any> = {
|
|
6
|
+
/** Filter value - primitive for equality, operator array, or top-level OR array */
|
|
7
|
+
export type FilterValue<T = any> = T | [FilterOperator | T | '||' | '&&', ...(T | FilterOperator | '||' | '&&')[]];
|
|
8
|
+
/** Filter object with comparison support, or array for top-level OR logic */
|
|
9
|
+
export type Filter<T = any> = ({
|
|
10
10
|
[K in keyof T]?: FilterValue<T[K]>;
|
|
11
11
|
} & {
|
|
12
12
|
[key: string]: FilterValue;
|
|
13
|
-
}
|
|
13
|
+
}) | Array<({
|
|
14
|
+
[K in keyof T]?: FilterValue<T[K]>;
|
|
15
|
+
} & {
|
|
16
|
+
[key: string]: FilterValue;
|
|
17
|
+
}) | '||'>;
|
|
14
18
|
/** Generic MongoDB document */
|
|
15
19
|
export type Document<T> = Meta & T;
|
|
16
20
|
/** Read query options */
|
|
@@ -51,9 +55,7 @@ export declare class Data extends PathEventEmitter {
|
|
|
51
55
|
[key: string]: Unsubscribe;
|
|
52
56
|
};
|
|
53
57
|
constructor(momentum: Momentum);
|
|
54
|
-
protected dataUrl(collection: string, pk?: number
|
|
55
|
-
[key: string]: any;
|
|
56
|
-
}): string;
|
|
58
|
+
protected dataUrl(collection: string, pk?: number): string;
|
|
57
59
|
/**
|
|
58
60
|
* Create new document(s) in collection
|
|
59
61
|
* @param {string} collection Target collection
|
|
@@ -69,6 +71,7 @@ export declare class Data extends PathEventEmitter {
|
|
|
69
71
|
* @return {Promise<number[]>} Array of deleted document IDs
|
|
70
72
|
*/
|
|
71
73
|
delete(collection: string, id: number, options?: DeleteOptions): Promise<number[]>;
|
|
74
|
+
delete(collection: string, ids: number[], options?: DeleteOptions): Promise<number[]>;
|
|
72
75
|
delete<T>(collection: string, filter: Filter<T>, options?: DeleteOptions): Promise<number[]>;
|
|
73
76
|
/**
|
|
74
77
|
* Read document(s) from collection
|
package/dist/data.d.ts.map
CHANGED
|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AC;IACjG,IAAI,CAAC,CAAC,SAAS,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,CAAC,CAAC;IAC5F,IAAI,CAAC,CAAC,SAAS,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC;IAsBjG;;;;;;OAMG;IACH,MAAM,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,EAAE,EAAE,OAAO,GAAE,aAAa,CAAC,CAAC,CAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;IAkB3I;;;;;OAKG;IACH,GAAG,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC;IASzD;;;;;;OAMG;IACH,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,GAAG,CAAC,EAAE,IAAI,GAAE;QAAC,MAAM,CAAC,EAAE,OAAO,CAAA;KAAM,GAAG,WAAW;CAmBtG"}
|
package/dist/index.js
CHANGED
|
@@ -1721,11 +1721,11 @@
|
|
|
1721
1721
|
this.opts.storage = { storage: momentum.database, key: "_" + this.opts.module };
|
|
1722
1722
|
this.cache = new Cache("_id", { persistentStorage: this.opts.storage });
|
|
1723
1723
|
this.momentum.auth.on("login:d", (e) => this.cache.clear());
|
|
1724
|
-
this.on(this.opts.module, (event, payload) => {
|
|
1725
|
-
if (Array.isArray(payload)) {
|
|
1724
|
+
this.on(this.opts.module + ":crud", (event, payload) => {
|
|
1725
|
+
if (!event.path && Array.isArray(payload)) {
|
|
1726
1726
|
this.cache.addAll(payload);
|
|
1727
1727
|
} else if ((event.create || event.update || event.read) && payload != null) {
|
|
1728
|
-
this.cache.add(
|
|
1728
|
+
makeArray(payload).forEach((p) => this.cache.add(p));
|
|
1729
1729
|
} else if (event.delete || payload == null) {
|
|
1730
1730
|
if (!event.path) return this.cache.clear();
|
|
1731
1731
|
const id = this.opts.key == "_id" ? event.name : this.cache.find({ [this.opts.key]: event.path })?._id;
|
|
@@ -1885,18 +1885,17 @@
|
|
|
1885
1885
|
/**
|
|
1886
1886
|
* Manually trigger an actions execution with real-time updates
|
|
1887
1887
|
* @param {string} id Action ID
|
|
1888
|
-
* @param {(payload:
|
|
1888
|
+
* @param {(payload: ActionResult) => any} callback Get updates in real time
|
|
1889
1889
|
* @param {HttpRequestOptions} opts Additional arguments
|
|
1890
1890
|
* @return {Promise<string>} Run UID for socket subscription
|
|
1891
1891
|
*/
|
|
1892
1892
|
async debug(id, callback, opts = {}) {
|
|
1893
1893
|
const uid = await this.momentum.api.request({ url: `api/actions/debug/${id}`, method: "POST", ...opts }).then((resp) => resp.uid);
|
|
1894
1894
|
if (!this.momentum.socket || !callback) return uid;
|
|
1895
|
-
const unsubscribe = this.momentum.socket.
|
|
1895
|
+
const unsubscribe = this.momentum.socket.subscribe(`actions/${id}/${uid}:x`, (event, payload) => {
|
|
1896
1896
|
if (payload.return) unsubscribe();
|
|
1897
1897
|
callback(payload);
|
|
1898
1898
|
});
|
|
1899
|
-
await this.momentum.socket.subscribe(`actions/${uid}`);
|
|
1900
1899
|
return uid;
|
|
1901
1900
|
}
|
|
1902
1901
|
/**
|
|
@@ -3197,14 +3196,8 @@ Must be either: call, email or sms`);
|
|
|
3197
3196
|
}
|
|
3198
3197
|
momentum;
|
|
3199
3198
|
subscribers = {};
|
|
3200
|
-
dataUrl(collection, pk
|
|
3201
|
-
|
|
3202
|
-
if (filter) params.set("q", JSON.stringify(filter));
|
|
3203
|
-
Object.entries(options ?? {}).forEach(([key, value]) => {
|
|
3204
|
-
if (value !== void 0 && value !== null) params.set(key, String(value));
|
|
3205
|
-
});
|
|
3206
|
-
const query = params.toString();
|
|
3207
|
-
return `api/data/${collection}${pk != null ? `/${pk}` : ""}${query ? `?${query}` : ""}`;
|
|
3199
|
+
dataUrl(collection, pk) {
|
|
3200
|
+
return `api/data/${collection}${pk != null ? `/${pk}` : ""}`;
|
|
3208
3201
|
}
|
|
3209
3202
|
/**
|
|
3210
3203
|
* Create new document(s) in collection
|
|
@@ -3226,19 +3219,29 @@ Must be either: call, email or sms`);
|
|
|
3226
3219
|
}
|
|
3227
3220
|
async delete(collection, filter, options) {
|
|
3228
3221
|
if (!collection || filter == null) throw new Error("Cannot delete document, missing collection or filter");
|
|
3229
|
-
const pk = typeof filter == "object" ? filter?._id ?? null : filter;
|
|
3230
|
-
const
|
|
3231
|
-
const
|
|
3232
|
-
|
|
3222
|
+
const pk = Array.isArray(filter) ? null : typeof filter == "object" ? filter?.["_id"] ?? null : filter;
|
|
3223
|
+
const url = this.dataUrl(collection, pk);
|
|
3224
|
+
const ids = await this.momentum.api.request({
|
|
3225
|
+
url,
|
|
3226
|
+
method: "DELETE",
|
|
3227
|
+
body: {
|
|
3228
|
+
filter: Array.isArray(filter) ? { _id: ["in", filter] } : typeof filter == "object" && pk == null ? filter : null,
|
|
3229
|
+
...options
|
|
3230
|
+
}
|
|
3231
|
+
});
|
|
3233
3232
|
ids.forEach((id) => this.emit(PES`data/${collection}/${id}:d`, id));
|
|
3234
3233
|
return ids;
|
|
3235
3234
|
}
|
|
3236
3235
|
read(collection, filter, options) {
|
|
3237
3236
|
if (!collection) throw new Error("Cannot read documents, missing collection");
|
|
3238
|
-
const pk = typeof filter == "object" ? filter?.["_id"] ?? null : filter;
|
|
3237
|
+
const pk = typeof filter == "object" ? Array.isArray(filter) ? null : filter?.["_id"] ?? null : filter;
|
|
3239
3238
|
const q = typeof filter == "object" && filter != null && Object.keys(filter).length && pk == null ? filter : null;
|
|
3240
|
-
const url = this.dataUrl(collection, pk
|
|
3241
|
-
return this.momentum.api.request({
|
|
3239
|
+
const url = this.dataUrl(collection, pk);
|
|
3240
|
+
return this.momentum.api.request({
|
|
3241
|
+
url,
|
|
3242
|
+
method: "POST",
|
|
3243
|
+
body: { filter: q, ...options, _read: true }
|
|
3244
|
+
}).then((resp) => {
|
|
3242
3245
|
if (!resp) return null;
|
|
3243
3246
|
if (Array.isArray(resp)) {
|
|
3244
3247
|
if (!q && !options?.limit) this.emit(PES`data/${collection}:r`, collection, resp);
|
|
@@ -3262,12 +3265,11 @@ Must be either: call, email or sms`);
|
|
|
3262
3265
|
const isArray = Array.isArray(documents);
|
|
3263
3266
|
const firstDoc = isArray ? documents[0] : documents;
|
|
3264
3267
|
const pk = isArray ? null : filter ? filter?._id ?? firstDoc._id : firstDoc._id;
|
|
3265
|
-
const
|
|
3266
|
-
const url = this.dataUrl(collection, pk, q, queryOptions);
|
|
3268
|
+
const url = this.dataUrl(collection, pk);
|
|
3267
3269
|
return this.momentum.api.request({
|
|
3268
3270
|
url,
|
|
3269
3271
|
method: append === false ? "PUT" : "PATCH",
|
|
3270
|
-
body: documents
|
|
3272
|
+
body: { data: documents, filter: filter && filter?._id == null ? filter : null, ...queryOptions }
|
|
3271
3273
|
}).then((resp) => {
|
|
3272
3274
|
if (!resp) return null;
|
|
3273
3275
|
makeArray(resp).forEach((r) => this.emit(PES`data/${collection}/${r._id}:u`, r));
|
|
@@ -3283,7 +3285,7 @@ Must be either: call, email or sms`);
|
|
|
3283
3285
|
raw(collection, query) {
|
|
3284
3286
|
if (!collection || !query) throw new Error("Cannot execute raw query, missing collection or query");
|
|
3285
3287
|
const mode = query.operand.startsWith("find") ? "r" : query.operand == "insertOne" ? "c" : query.operand.startsWith("delete") ? "d" : "u";
|
|
3286
|
-
return this.momentum.api.request({ url: `api/` + PES`data/${collection}
|
|
3288
|
+
return this.momentum.api.request({ url: `api/` + PES`data/${collection}`, method: "POST", body: { ...query, _raw: true } }).then((resp) => {
|
|
3287
3289
|
this.emit(PES`data/${collection}:${mode}`, resp);
|
|
3288
3290
|
return resp;
|
|
3289
3291
|
});
|
|
@@ -3920,6 +3922,11 @@ ${log}`;
|
|
|
3920
3922
|
this.momentum.auth.on("login:cd", (event, user) => {
|
|
3921
3923
|
if (user !== void 0 && this.momentum.api.token != this.token) this.connect();
|
|
3922
3924
|
});
|
|
3925
|
+
if (typeof window !== "undefined") {
|
|
3926
|
+
window.addEventListener("online", () => {
|
|
3927
|
+
if (this.reconnect && !this.connected) this.connect();
|
|
3928
|
+
});
|
|
3929
|
+
}
|
|
3923
3930
|
}
|
|
3924
3931
|
momentum;
|
|
3925
3932
|
static pollingSpeed = 15e3;
|
|
@@ -3928,7 +3935,6 @@ ${log}`;
|
|
|
3928
3935
|
connectingResolver;
|
|
3929
3936
|
events = {};
|
|
3930
3937
|
reconnect = true;
|
|
3931
|
-
pending = [];
|
|
3932
3938
|
token;
|
|
3933
3939
|
reconnectTimeout;
|
|
3934
3940
|
connected = false;
|
|
@@ -3943,19 +3949,17 @@ ${log}`;
|
|
|
3943
3949
|
console.debug("Disconnected from Momentum");
|
|
3944
3950
|
this.connected = false;
|
|
3945
3951
|
this.connection?.close();
|
|
3946
|
-
this.connection = void 0;
|
|
3952
|
+
this.connection = this.connecting = this.connectingResolver = void 0;
|
|
3947
3953
|
this.reconnect = !!reconnect;
|
|
3954
|
+
clearTimeout(this.reconnectTimeout);
|
|
3948
3955
|
if (this.reconnect) {
|
|
3949
3956
|
this.scheduleReconnect();
|
|
3950
3957
|
} else {
|
|
3951
3958
|
this.events = {};
|
|
3952
|
-
clearTimeout(this.reconnectTimeout);
|
|
3953
3959
|
}
|
|
3954
3960
|
}
|
|
3955
3961
|
connect() {
|
|
3956
|
-
if (!this.connecting)
|
|
3957
|
-
this.connecting = new Promise((res) => this.connectingResolver = res);
|
|
3958
|
-
}
|
|
3962
|
+
if (!this.connecting) this.connecting = new Promise((res) => this.connectingResolver = res);
|
|
3959
3963
|
if (typeof navigator != "undefined" && !navigator.onLine || this.connected && this.token == this.momentum.api.token) return this.connecting;
|
|
3960
3964
|
if (this.connected) this.close();
|
|
3961
3965
|
clearTimeout(this.reconnectTimeout);
|
|
@@ -3963,18 +3967,8 @@ ${log}`;
|
|
|
3963
3967
|
const url = this.momentum.url.toString().replace("http", "ws");
|
|
3964
3968
|
this.connection = new WebSocket(url + (this.momentum.api.token ? `?token=${this.momentum.api.token}&url=${location?.href || ""}` : ""));
|
|
3965
3969
|
this.connection.onopen = () => {
|
|
3966
|
-
console.debug("Connected to Momentum");
|
|
3967
|
-
this.connected = true;
|
|
3968
3970
|
this.token = this.momentum.api.token;
|
|
3969
3971
|
clearTimeout(this.reconnectTimeout);
|
|
3970
|
-
Object.keys(this.events).forEach((e) => this.send("subscribe", e));
|
|
3971
|
-
this.pending = this.pending.filter((p) => {
|
|
3972
|
-
this.send(p.event, p.payload);
|
|
3973
|
-
return false;
|
|
3974
|
-
});
|
|
3975
|
-
this.connectingResolver?.();
|
|
3976
|
-
this.connecting = void 0;
|
|
3977
|
-
this.connectingResolver = void 0;
|
|
3978
3972
|
};
|
|
3979
3973
|
this.connection.onclose = () => {
|
|
3980
3974
|
if (!this.reconnect) return;
|
|
@@ -3982,7 +3976,12 @@ ${log}`;
|
|
|
3982
3976
|
};
|
|
3983
3977
|
this.connection.onmessage = (message) => {
|
|
3984
3978
|
const data = JSONAttemptParse(message.data);
|
|
3985
|
-
if (data.connected ===
|
|
3979
|
+
if (data.connected === true) {
|
|
3980
|
+
console.debug("Connected to Momentum");
|
|
3981
|
+
Object.keys(this.events).forEach((e) => this.send("subscribe", e));
|
|
3982
|
+
this.connectingResolver?.();
|
|
3983
|
+
this.connected = true;
|
|
3984
|
+
} else if (data.connected === false) this.close(true);
|
|
3986
3985
|
else this.emit(data.event, data.payload);
|
|
3987
3986
|
};
|
|
3988
3987
|
this.scheduleReconnect();
|
|
@@ -3997,25 +3996,24 @@ ${log}`;
|
|
|
3997
3996
|
this.send("ping");
|
|
3998
3997
|
});
|
|
3999
3998
|
}
|
|
4000
|
-
send(channel, payload = null) {
|
|
3999
|
+
async send(channel, payload = null) {
|
|
4000
|
+
if (!this.connecting) await sleepWhile(() => !this.connecting);
|
|
4001
|
+
if (this.connecting) await this.connecting;
|
|
4001
4002
|
if (!this.connection || this.connection.readyState !== WebSocket.OPEN) {
|
|
4002
|
-
|
|
4003
|
-
} else {
|
|
4004
|
-
this.connection.send(JSON.stringify({ event: channel, payload }));
|
|
4003
|
+
throw new Error("WebSocket is not connected");
|
|
4005
4004
|
}
|
|
4005
|
+
this.connection.send(JSON.stringify({ event: channel, payload }));
|
|
4006
4006
|
}
|
|
4007
|
-
subscribe(event) {
|
|
4007
|
+
subscribe(event, callback) {
|
|
4008
4008
|
const e = new PathEvent(event).toString();
|
|
4009
|
+
const unsubscribe = callback ? this.on(e, callback) : null;
|
|
4009
4010
|
if (!this.events[e]) this.events[e] = 1;
|
|
4010
4011
|
else this.events[e]++;
|
|
4011
|
-
if (this.events[e] == 1)
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
this.send("subscribe", e.toString());
|
|
4017
|
-
});
|
|
4018
|
-
} else return Promise.resolve(true);
|
|
4012
|
+
if (this.events[e] == 1 && this.connected) this.send("subscribe", e.toString());
|
|
4013
|
+
return () => {
|
|
4014
|
+
this.unsubscribe(e);
|
|
4015
|
+
unsubscribe?.();
|
|
4016
|
+
};
|
|
4019
4017
|
}
|
|
4020
4018
|
async subscriptions() {
|
|
4021
4019
|
if (!this.connected) await this.connect();
|
|
@@ -4026,16 +4024,12 @@ ${log}`;
|
|
|
4026
4024
|
}
|
|
4027
4025
|
unsubscribe(event) {
|
|
4028
4026
|
const e = new PathEvent(event).toString();
|
|
4027
|
+
if (!this.events[e]) return;
|
|
4029
4028
|
this.events[e]--;
|
|
4030
4029
|
if (this.events[e] <= 0) {
|
|
4031
4030
|
delete this.events[e];
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
if (payload.event == e) res(payload.success);
|
|
4035
|
-
});
|
|
4036
|
-
this.send("unsubscribe", e.toString());
|
|
4037
|
-
});
|
|
4038
|
-
} else return Promise.resolve(true);
|
|
4031
|
+
if (this.connected) this.send("unsubscribe", e.toString());
|
|
4032
|
+
}
|
|
4039
4033
|
}
|
|
4040
4034
|
}
|
|
4041
4035
|
class Storage extends PathEventEmitter {
|
|
@@ -4068,7 +4062,7 @@ ${log}`;
|
|
|
4068
4062
|
*/
|
|
4069
4063
|
all(path) {
|
|
4070
4064
|
if (!path) path = "/";
|
|
4071
|
-
return this.momentum.api.request({ url: `api/${this.module}
|
|
4065
|
+
return this.momentum.api.request({ url: `api/${this.module}${path.startsWith("/") ? "" : "/"}${path}?all=true` }).then((resp) => {
|
|
4072
4066
|
this.emit(PES`${this.module}/${path}:r`, resp);
|
|
4073
4067
|
return resp;
|
|
4074
4068
|
});
|
|
@@ -4087,7 +4081,7 @@ ${log}`;
|
|
|
4087
4081
|
destination = [...path.slice(0, -1), destination].join("/");
|
|
4088
4082
|
if (!destination.startsWith("/")) destination = "/" + destination;
|
|
4089
4083
|
}
|
|
4090
|
-
return this.momentum.api.request({ url: `api/${this.module}
|
|
4084
|
+
return this.momentum.api.request({ url: `api/${this.module}${destination.startsWith("/") ? "" : "/"}${destination}`, body: { from: source } }).then((response) => {
|
|
4091
4085
|
this.emit(PES`${this.module}/${destination}:c`, response);
|
|
4092
4086
|
return response;
|
|
4093
4087
|
});
|
|
@@ -4099,7 +4093,7 @@ ${log}`;
|
|
|
4099
4093
|
*/
|
|
4100
4094
|
async delete(path) {
|
|
4101
4095
|
if (!path) throw new Error("Cannot delete file or folder, missing module");
|
|
4102
|
-
const count = await this.momentum.api.request({ url: `api/${this.module}
|
|
4096
|
+
const count = await this.momentum.api.request({ url: `api/${this.module}${path.startsWith("/") ? "" : "/"}${path}`, method: "DELETE" });
|
|
4103
4097
|
if (count) this.emit(PES`${this.module}/${path}:d`, path);
|
|
4104
4098
|
return count;
|
|
4105
4099
|
}
|
|
@@ -4119,7 +4113,7 @@ ${log}`;
|
|
|
4119
4113
|
*/
|
|
4120
4114
|
meta(path) {
|
|
4121
4115
|
if (!path) path = "/";
|
|
4122
|
-
return this.momentum.api.request({ url: `api/${this.module}
|
|
4116
|
+
return this.momentum.api.request({ url: `api/${this.module}${path.startsWith("/") ? "" : "/"}${path}?meta=true` }).then((resp) => {
|
|
4123
4117
|
this.emit(PES`${this.module}/${path}:r`, resp);
|
|
4124
4118
|
return resp;
|
|
4125
4119
|
});
|
|
@@ -4131,7 +4125,7 @@ ${log}`;
|
|
|
4131
4125
|
*/
|
|
4132
4126
|
mkdir(path) {
|
|
4133
4127
|
if (!path) throw new Error("Cannot make directory, missing module");
|
|
4134
|
-
return this.momentum.api.request({ url: `api/${this.module}
|
|
4128
|
+
return this.momentum.api.request({ url: `api/${this.module}${path.startsWith("/") ? "" : "/"}${path}`, body: { directory: true } }).then((resp) => {
|
|
4135
4129
|
this.emit(PES`${this.module}/${path}:c`, resp);
|
|
4136
4130
|
return resp;
|
|
4137
4131
|
});
|
|
@@ -4145,7 +4139,7 @@ ${log}`;
|
|
|
4145
4139
|
move(source, destination) {
|
|
4146
4140
|
if (!source || !destination) throw new Error("Cannot move file or folder, missing source or destination");
|
|
4147
4141
|
if (source == destination) return this.meta(destination);
|
|
4148
|
-
return this.momentum.api.request({ url: `api/${this.module}
|
|
4142
|
+
return this.momentum.api.request({ url: `api/${this.module}${source.startsWith("/") ? "" : "/"}${source}`, method: "PUT", body: { move: destination } }).then((response) => {
|
|
4149
4143
|
this.emit(PES`${this.module}/${source}:u`, response);
|
|
4150
4144
|
return response;
|
|
4151
4145
|
});
|
|
@@ -4155,7 +4149,7 @@ ${log}`;
|
|
|
4155
4149
|
const link = `${this.momentum.url.toString()}api/${this.module}/${path}`.replaceAll(/([^:])\/+/g, "$1/") + (!this.momentum.api.sameOrigin && this.momentum.api.token ? `?token=${this.momentum.api.token}` : "");
|
|
4156
4150
|
if (target === "url" || target === false) return link;
|
|
4157
4151
|
if (target === "_blank" || target == "_self") return window.open(link, target);
|
|
4158
|
-
return this.momentum.api.request({ url: `api/${this.module}
|
|
4152
|
+
return this.momentum.api.request({ url: `api/${this.module}${path.startsWith("/") ? "" : "/"}${path}?download=true`, decode: false }).then(async (response) => {
|
|
4159
4153
|
const blob = await response.blob();
|
|
4160
4154
|
if (target !== "blob") {
|
|
4161
4155
|
const name = target === "download" ? path.split("/").pop() : target;
|
|
@@ -4166,7 +4160,7 @@ ${log}`;
|
|
|
4166
4160
|
}
|
|
4167
4161
|
text(path, set) {
|
|
4168
4162
|
if (!path) throw new Error("Missing path");
|
|
4169
|
-
if (set !== void 0) return this.momentum.api.request({ url: `api/${this.module}
|
|
4163
|
+
if (set !== void 0) return this.momentum.api.request({ url: `api/${this.module}${path.startsWith("/") ? "" : "/"}${path}`, method: "PATCH", body: { text: set } });
|
|
4170
4164
|
else return this.momentum.api.request({ url: `api/${this.module}/${path}?text=true` });
|
|
4171
4165
|
}
|
|
4172
4166
|
/**
|
|
@@ -4186,7 +4180,7 @@ ${log}`;
|
|
|
4186
4180
|
f = [new File([f[0]], opts.rename, { type: f[0].type })];
|
|
4187
4181
|
}
|
|
4188
4182
|
return uploadWithProgress({
|
|
4189
|
-
url: `${this.momentum.url.toString()}api/${this.module}
|
|
4183
|
+
url: `${this.momentum.url.toString()}api/${this.module}${path.startsWith("/") ? "" : "/"}${path}`,
|
|
4190
4184
|
headers: this.momentum.api.headers,
|
|
4191
4185
|
files: f
|
|
4192
4186
|
}).onProgress((p) => {
|
|
@@ -4207,7 +4201,7 @@ ${log}`;
|
|
|
4207
4201
|
sync(path, callback, opts = {}) {
|
|
4208
4202
|
const e = PE`${this.module}/${path}`;
|
|
4209
4203
|
const unsubscribe = callback ? this.on(e.toString(), (event) => callback(event, this.cache.get(path))) : null;
|
|
4210
|
-
if (
|
|
4204
|
+
if (opts.reload) this.meta(path);
|
|
4211
4205
|
if (!this.subscribers.length) this.momentum.socket?.subscribe(e.toString());
|
|
4212
4206
|
const key = Object.keys(this.subscribers).length.toString();
|
|
4213
4207
|
this.subscribers[key] = () => {
|
|
@@ -4341,7 +4335,7 @@ ${log}`;
|
|
|
4341
4335
|
}
|
|
4342
4336
|
momentum;
|
|
4343
4337
|
}
|
|
4344
|
-
const version = "1.4.
|
|
4338
|
+
const version = "1.4.4";
|
|
4345
4339
|
class WebRtc extends PathEventEmitter {
|
|
4346
4340
|
constructor(momentum) {
|
|
4347
4341
|
super("webrtc");
|
|
@@ -4394,6 +4388,7 @@ ${log}`;
|
|
|
4394
4388
|
session.open = false;
|
|
4395
4389
|
Object.values(session.peers).forEach((p) => p.connection.close());
|
|
4396
4390
|
session.stream.getTracks().forEach((track) => track.stop());
|
|
4391
|
+
unsubscribe();
|
|
4397
4392
|
this.momentum.socket?.send(`webrtc/${id}/${session.uid}:d`, {
|
|
4398
4393
|
uid: session.uid,
|
|
4399
4394
|
username: this.momentum.auth.user?._id || "Anonymous",
|
|
@@ -4401,8 +4396,7 @@ ${log}`;
|
|
|
4401
4396
|
});
|
|
4402
4397
|
}
|
|
4403
4398
|
};
|
|
4404
|
-
this.momentum.socket?.subscribe(`webrtc/${id}
|
|
4405
|
-
this.momentum.socket?.on(`webrtc/${id}`, async (event, payload) => {
|
|
4399
|
+
const unsubscribe = this.momentum.socket?.subscribe(`webrtc/${id}`, async (event, payload) => {
|
|
4406
4400
|
if (event.name != session.uid) {
|
|
4407
4401
|
if (payload.connected) {
|
|
4408
4402
|
session.peers[event.name] = {
|
|
@@ -4448,6 +4442,7 @@ ${log}`;
|
|
|
4448
4442
|
this.emit(id, session);
|
|
4449
4443
|
}
|
|
4450
4444
|
}
|
|
4445
|
+
}) || (() => {
|
|
4451
4446
|
});
|
|
4452
4447
|
this.momentum.socket?.send(`webrtc/${id}/${session.uid}`, {
|
|
4453
4448
|
uid: session.uid,
|
package/dist/index.mjs
CHANGED
|
@@ -1717,11 +1717,11 @@ class AssetController extends PathEventEmitter {
|
|
|
1717
1717
|
this.opts.storage = { storage: momentum.database, key: "_" + this.opts.module };
|
|
1718
1718
|
this.cache = new Cache("_id", { persistentStorage: this.opts.storage });
|
|
1719
1719
|
this.momentum.auth.on("login:d", (e) => this.cache.clear());
|
|
1720
|
-
this.on(this.opts.module, (event, payload) => {
|
|
1721
|
-
if (Array.isArray(payload)) {
|
|
1720
|
+
this.on(this.opts.module + ":crud", (event, payload) => {
|
|
1721
|
+
if (!event.path && Array.isArray(payload)) {
|
|
1722
1722
|
this.cache.addAll(payload);
|
|
1723
1723
|
} else if ((event.create || event.update || event.read) && payload != null) {
|
|
1724
|
-
this.cache.add(
|
|
1724
|
+
makeArray(payload).forEach((p) => this.cache.add(p));
|
|
1725
1725
|
} else if (event.delete || payload == null) {
|
|
1726
1726
|
if (!event.path) return this.cache.clear();
|
|
1727
1727
|
const id = this.opts.key == "_id" ? event.name : this.cache.find({ [this.opts.key]: event.path })?._id;
|
|
@@ -1881,18 +1881,17 @@ class Actions extends AssetController {
|
|
|
1881
1881
|
/**
|
|
1882
1882
|
* Manually trigger an actions execution with real-time updates
|
|
1883
1883
|
* @param {string} id Action ID
|
|
1884
|
-
* @param {(payload:
|
|
1884
|
+
* @param {(payload: ActionResult) => any} callback Get updates in real time
|
|
1885
1885
|
* @param {HttpRequestOptions} opts Additional arguments
|
|
1886
1886
|
* @return {Promise<string>} Run UID for socket subscription
|
|
1887
1887
|
*/
|
|
1888
1888
|
async debug(id, callback, opts = {}) {
|
|
1889
1889
|
const uid = await this.momentum.api.request({ url: `api/actions/debug/${id}`, method: "POST", ...opts }).then((resp) => resp.uid);
|
|
1890
1890
|
if (!this.momentum.socket || !callback) return uid;
|
|
1891
|
-
const unsubscribe = this.momentum.socket.
|
|
1891
|
+
const unsubscribe = this.momentum.socket.subscribe(`actions/${id}/${uid}:x`, (event, payload) => {
|
|
1892
1892
|
if (payload.return) unsubscribe();
|
|
1893
1893
|
callback(payload);
|
|
1894
1894
|
});
|
|
1895
|
-
await this.momentum.socket.subscribe(`actions/${uid}`);
|
|
1896
1895
|
return uid;
|
|
1897
1896
|
}
|
|
1898
1897
|
/**
|
|
@@ -3193,14 +3192,8 @@ class Data extends PathEventEmitter {
|
|
|
3193
3192
|
}
|
|
3194
3193
|
momentum;
|
|
3195
3194
|
subscribers = {};
|
|
3196
|
-
dataUrl(collection, pk
|
|
3197
|
-
|
|
3198
|
-
if (filter) params.set("q", JSON.stringify(filter));
|
|
3199
|
-
Object.entries(options ?? {}).forEach(([key, value]) => {
|
|
3200
|
-
if (value !== void 0 && value !== null) params.set(key, String(value));
|
|
3201
|
-
});
|
|
3202
|
-
const query = params.toString();
|
|
3203
|
-
return `api/data/${collection}${pk != null ? `/${pk}` : ""}${query ? `?${query}` : ""}`;
|
|
3195
|
+
dataUrl(collection, pk) {
|
|
3196
|
+
return `api/data/${collection}${pk != null ? `/${pk}` : ""}`;
|
|
3204
3197
|
}
|
|
3205
3198
|
/**
|
|
3206
3199
|
* Create new document(s) in collection
|
|
@@ -3222,19 +3215,29 @@ class Data extends PathEventEmitter {
|
|
|
3222
3215
|
}
|
|
3223
3216
|
async delete(collection, filter, options) {
|
|
3224
3217
|
if (!collection || filter == null) throw new Error("Cannot delete document, missing collection or filter");
|
|
3225
|
-
const pk = typeof filter == "object" ? filter?._id ?? null : filter;
|
|
3226
|
-
const
|
|
3227
|
-
const
|
|
3228
|
-
|
|
3218
|
+
const pk = Array.isArray(filter) ? null : typeof filter == "object" ? filter?.["_id"] ?? null : filter;
|
|
3219
|
+
const url = this.dataUrl(collection, pk);
|
|
3220
|
+
const ids = await this.momentum.api.request({
|
|
3221
|
+
url,
|
|
3222
|
+
method: "DELETE",
|
|
3223
|
+
body: {
|
|
3224
|
+
filter: Array.isArray(filter) ? { _id: ["in", filter] } : typeof filter == "object" && pk == null ? filter : null,
|
|
3225
|
+
...options
|
|
3226
|
+
}
|
|
3227
|
+
});
|
|
3229
3228
|
ids.forEach((id) => this.emit(PES`data/${collection}/${id}:d`, id));
|
|
3230
3229
|
return ids;
|
|
3231
3230
|
}
|
|
3232
3231
|
read(collection, filter, options) {
|
|
3233
3232
|
if (!collection) throw new Error("Cannot read documents, missing collection");
|
|
3234
|
-
const pk = typeof filter == "object" ? filter?.["_id"] ?? null : filter;
|
|
3233
|
+
const pk = typeof filter == "object" ? Array.isArray(filter) ? null : filter?.["_id"] ?? null : filter;
|
|
3235
3234
|
const q = typeof filter == "object" && filter != null && Object.keys(filter).length && pk == null ? filter : null;
|
|
3236
|
-
const url = this.dataUrl(collection, pk
|
|
3237
|
-
return this.momentum.api.request({
|
|
3235
|
+
const url = this.dataUrl(collection, pk);
|
|
3236
|
+
return this.momentum.api.request({
|
|
3237
|
+
url,
|
|
3238
|
+
method: "POST",
|
|
3239
|
+
body: { filter: q, ...options, _read: true }
|
|
3240
|
+
}).then((resp) => {
|
|
3238
3241
|
if (!resp) return null;
|
|
3239
3242
|
if (Array.isArray(resp)) {
|
|
3240
3243
|
if (!q && !options?.limit) this.emit(PES`data/${collection}:r`, collection, resp);
|
|
@@ -3258,12 +3261,11 @@ class Data extends PathEventEmitter {
|
|
|
3258
3261
|
const isArray = Array.isArray(documents);
|
|
3259
3262
|
const firstDoc = isArray ? documents[0] : documents;
|
|
3260
3263
|
const pk = isArray ? null : filter ? filter?._id ?? firstDoc._id : firstDoc._id;
|
|
3261
|
-
const
|
|
3262
|
-
const url = this.dataUrl(collection, pk, q, queryOptions);
|
|
3264
|
+
const url = this.dataUrl(collection, pk);
|
|
3263
3265
|
return this.momentum.api.request({
|
|
3264
3266
|
url,
|
|
3265
3267
|
method: append === false ? "PUT" : "PATCH",
|
|
3266
|
-
body: documents
|
|
3268
|
+
body: { data: documents, filter: filter && filter?._id == null ? filter : null, ...queryOptions }
|
|
3267
3269
|
}).then((resp) => {
|
|
3268
3270
|
if (!resp) return null;
|
|
3269
3271
|
makeArray(resp).forEach((r) => this.emit(PES`data/${collection}/${r._id}:u`, r));
|
|
@@ -3279,7 +3281,7 @@ class Data extends PathEventEmitter {
|
|
|
3279
3281
|
raw(collection, query) {
|
|
3280
3282
|
if (!collection || !query) throw new Error("Cannot execute raw query, missing collection or query");
|
|
3281
3283
|
const mode = query.operand.startsWith("find") ? "r" : query.operand == "insertOne" ? "c" : query.operand.startsWith("delete") ? "d" : "u";
|
|
3282
|
-
return this.momentum.api.request({ url: `api/` + PES`data/${collection}
|
|
3284
|
+
return this.momentum.api.request({ url: `api/` + PES`data/${collection}`, method: "POST", body: { ...query, _raw: true } }).then((resp) => {
|
|
3283
3285
|
this.emit(PES`data/${collection}:${mode}`, resp);
|
|
3284
3286
|
return resp;
|
|
3285
3287
|
});
|
|
@@ -3916,6 +3918,11 @@ class Socket extends PathEventEmitter {
|
|
|
3916
3918
|
this.momentum.auth.on("login:cd", (event, user) => {
|
|
3917
3919
|
if (user !== void 0 && this.momentum.api.token != this.token) this.connect();
|
|
3918
3920
|
});
|
|
3921
|
+
if (typeof window !== "undefined") {
|
|
3922
|
+
window.addEventListener("online", () => {
|
|
3923
|
+
if (this.reconnect && !this.connected) this.connect();
|
|
3924
|
+
});
|
|
3925
|
+
}
|
|
3919
3926
|
}
|
|
3920
3927
|
momentum;
|
|
3921
3928
|
static pollingSpeed = 15e3;
|
|
@@ -3924,7 +3931,6 @@ class Socket extends PathEventEmitter {
|
|
|
3924
3931
|
connectingResolver;
|
|
3925
3932
|
events = {};
|
|
3926
3933
|
reconnect = true;
|
|
3927
|
-
pending = [];
|
|
3928
3934
|
token;
|
|
3929
3935
|
reconnectTimeout;
|
|
3930
3936
|
connected = false;
|
|
@@ -3939,19 +3945,17 @@ class Socket extends PathEventEmitter {
|
|
|
3939
3945
|
console.debug("Disconnected from Momentum");
|
|
3940
3946
|
this.connected = false;
|
|
3941
3947
|
this.connection?.close();
|
|
3942
|
-
this.connection = void 0;
|
|
3948
|
+
this.connection = this.connecting = this.connectingResolver = void 0;
|
|
3943
3949
|
this.reconnect = !!reconnect;
|
|
3950
|
+
clearTimeout(this.reconnectTimeout);
|
|
3944
3951
|
if (this.reconnect) {
|
|
3945
3952
|
this.scheduleReconnect();
|
|
3946
3953
|
} else {
|
|
3947
3954
|
this.events = {};
|
|
3948
|
-
clearTimeout(this.reconnectTimeout);
|
|
3949
3955
|
}
|
|
3950
3956
|
}
|
|
3951
3957
|
connect() {
|
|
3952
|
-
if (!this.connecting)
|
|
3953
|
-
this.connecting = new Promise((res) => this.connectingResolver = res);
|
|
3954
|
-
}
|
|
3958
|
+
if (!this.connecting) this.connecting = new Promise((res) => this.connectingResolver = res);
|
|
3955
3959
|
if (typeof navigator != "undefined" && !navigator.onLine || this.connected && this.token == this.momentum.api.token) return this.connecting;
|
|
3956
3960
|
if (this.connected) this.close();
|
|
3957
3961
|
clearTimeout(this.reconnectTimeout);
|
|
@@ -3959,18 +3963,8 @@ class Socket extends PathEventEmitter {
|
|
|
3959
3963
|
const url = this.momentum.url.toString().replace("http", "ws");
|
|
3960
3964
|
this.connection = new WebSocket(url + (this.momentum.api.token ? `?token=${this.momentum.api.token}&url=${location?.href || ""}` : ""));
|
|
3961
3965
|
this.connection.onopen = () => {
|
|
3962
|
-
console.debug("Connected to Momentum");
|
|
3963
|
-
this.connected = true;
|
|
3964
3966
|
this.token = this.momentum.api.token;
|
|
3965
3967
|
clearTimeout(this.reconnectTimeout);
|
|
3966
|
-
Object.keys(this.events).forEach((e) => this.send("subscribe", e));
|
|
3967
|
-
this.pending = this.pending.filter((p) => {
|
|
3968
|
-
this.send(p.event, p.payload);
|
|
3969
|
-
return false;
|
|
3970
|
-
});
|
|
3971
|
-
this.connectingResolver?.();
|
|
3972
|
-
this.connecting = void 0;
|
|
3973
|
-
this.connectingResolver = void 0;
|
|
3974
3968
|
};
|
|
3975
3969
|
this.connection.onclose = () => {
|
|
3976
3970
|
if (!this.reconnect) return;
|
|
@@ -3978,7 +3972,12 @@ class Socket extends PathEventEmitter {
|
|
|
3978
3972
|
};
|
|
3979
3973
|
this.connection.onmessage = (message) => {
|
|
3980
3974
|
const data = JSONAttemptParse(message.data);
|
|
3981
|
-
if (data.connected ===
|
|
3975
|
+
if (data.connected === true) {
|
|
3976
|
+
console.debug("Connected to Momentum");
|
|
3977
|
+
Object.keys(this.events).forEach((e) => this.send("subscribe", e));
|
|
3978
|
+
this.connectingResolver?.();
|
|
3979
|
+
this.connected = true;
|
|
3980
|
+
} else if (data.connected === false) this.close(true);
|
|
3982
3981
|
else this.emit(data.event, data.payload);
|
|
3983
3982
|
};
|
|
3984
3983
|
this.scheduleReconnect();
|
|
@@ -3993,25 +3992,24 @@ class Socket extends PathEventEmitter {
|
|
|
3993
3992
|
this.send("ping");
|
|
3994
3993
|
});
|
|
3995
3994
|
}
|
|
3996
|
-
send(channel, payload = null) {
|
|
3995
|
+
async send(channel, payload = null) {
|
|
3996
|
+
if (!this.connecting) await sleepWhile(() => !this.connecting);
|
|
3997
|
+
if (this.connecting) await this.connecting;
|
|
3997
3998
|
if (!this.connection || this.connection.readyState !== WebSocket.OPEN) {
|
|
3998
|
-
|
|
3999
|
-
} else {
|
|
4000
|
-
this.connection.send(JSON.stringify({ event: channel, payload }));
|
|
3999
|
+
throw new Error("WebSocket is not connected");
|
|
4001
4000
|
}
|
|
4001
|
+
this.connection.send(JSON.stringify({ event: channel, payload }));
|
|
4002
4002
|
}
|
|
4003
|
-
subscribe(event) {
|
|
4003
|
+
subscribe(event, callback) {
|
|
4004
4004
|
const e = new PathEvent(event).toString();
|
|
4005
|
+
const unsubscribe = callback ? this.on(e, callback) : null;
|
|
4005
4006
|
if (!this.events[e]) this.events[e] = 1;
|
|
4006
4007
|
else this.events[e]++;
|
|
4007
|
-
if (this.events[e] == 1)
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
|
|
4011
|
-
|
|
4012
|
-
this.send("subscribe", e.toString());
|
|
4013
|
-
});
|
|
4014
|
-
} else return Promise.resolve(true);
|
|
4008
|
+
if (this.events[e] == 1 && this.connected) this.send("subscribe", e.toString());
|
|
4009
|
+
return () => {
|
|
4010
|
+
this.unsubscribe(e);
|
|
4011
|
+
unsubscribe?.();
|
|
4012
|
+
};
|
|
4015
4013
|
}
|
|
4016
4014
|
async subscriptions() {
|
|
4017
4015
|
if (!this.connected) await this.connect();
|
|
@@ -4022,16 +4020,12 @@ class Socket extends PathEventEmitter {
|
|
|
4022
4020
|
}
|
|
4023
4021
|
unsubscribe(event) {
|
|
4024
4022
|
const e = new PathEvent(event).toString();
|
|
4023
|
+
if (!this.events[e]) return;
|
|
4025
4024
|
this.events[e]--;
|
|
4026
4025
|
if (this.events[e] <= 0) {
|
|
4027
4026
|
delete this.events[e];
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
if (payload.event == e) res(payload.success);
|
|
4031
|
-
});
|
|
4032
|
-
this.send("unsubscribe", e.toString());
|
|
4033
|
-
});
|
|
4034
|
-
} else return Promise.resolve(true);
|
|
4027
|
+
if (this.connected) this.send("unsubscribe", e.toString());
|
|
4028
|
+
}
|
|
4035
4029
|
}
|
|
4036
4030
|
}
|
|
4037
4031
|
class Storage extends PathEventEmitter {
|
|
@@ -4064,7 +4058,7 @@ class Storage extends PathEventEmitter {
|
|
|
4064
4058
|
*/
|
|
4065
4059
|
all(path) {
|
|
4066
4060
|
if (!path) path = "/";
|
|
4067
|
-
return this.momentum.api.request({ url: `api/${this.module}
|
|
4061
|
+
return this.momentum.api.request({ url: `api/${this.module}${path.startsWith("/") ? "" : "/"}${path}?all=true` }).then((resp) => {
|
|
4068
4062
|
this.emit(PES`${this.module}/${path}:r`, resp);
|
|
4069
4063
|
return resp;
|
|
4070
4064
|
});
|
|
@@ -4083,7 +4077,7 @@ class Storage extends PathEventEmitter {
|
|
|
4083
4077
|
destination = [...path.slice(0, -1), destination].join("/");
|
|
4084
4078
|
if (!destination.startsWith("/")) destination = "/" + destination;
|
|
4085
4079
|
}
|
|
4086
|
-
return this.momentum.api.request({ url: `api/${this.module}
|
|
4080
|
+
return this.momentum.api.request({ url: `api/${this.module}${destination.startsWith("/") ? "" : "/"}${destination}`, body: { from: source } }).then((response) => {
|
|
4087
4081
|
this.emit(PES`${this.module}/${destination}:c`, response);
|
|
4088
4082
|
return response;
|
|
4089
4083
|
});
|
|
@@ -4095,7 +4089,7 @@ class Storage extends PathEventEmitter {
|
|
|
4095
4089
|
*/
|
|
4096
4090
|
async delete(path) {
|
|
4097
4091
|
if (!path) throw new Error("Cannot delete file or folder, missing module");
|
|
4098
|
-
const count = await this.momentum.api.request({ url: `api/${this.module}
|
|
4092
|
+
const count = await this.momentum.api.request({ url: `api/${this.module}${path.startsWith("/") ? "" : "/"}${path}`, method: "DELETE" });
|
|
4099
4093
|
if (count) this.emit(PES`${this.module}/${path}:d`, path);
|
|
4100
4094
|
return count;
|
|
4101
4095
|
}
|
|
@@ -4115,7 +4109,7 @@ class Storage extends PathEventEmitter {
|
|
|
4115
4109
|
*/
|
|
4116
4110
|
meta(path) {
|
|
4117
4111
|
if (!path) path = "/";
|
|
4118
|
-
return this.momentum.api.request({ url: `api/${this.module}
|
|
4112
|
+
return this.momentum.api.request({ url: `api/${this.module}${path.startsWith("/") ? "" : "/"}${path}?meta=true` }).then((resp) => {
|
|
4119
4113
|
this.emit(PES`${this.module}/${path}:r`, resp);
|
|
4120
4114
|
return resp;
|
|
4121
4115
|
});
|
|
@@ -4127,7 +4121,7 @@ class Storage extends PathEventEmitter {
|
|
|
4127
4121
|
*/
|
|
4128
4122
|
mkdir(path) {
|
|
4129
4123
|
if (!path) throw new Error("Cannot make directory, missing module");
|
|
4130
|
-
return this.momentum.api.request({ url: `api/${this.module}
|
|
4124
|
+
return this.momentum.api.request({ url: `api/${this.module}${path.startsWith("/") ? "" : "/"}${path}`, body: { directory: true } }).then((resp) => {
|
|
4131
4125
|
this.emit(PES`${this.module}/${path}:c`, resp);
|
|
4132
4126
|
return resp;
|
|
4133
4127
|
});
|
|
@@ -4141,7 +4135,7 @@ class Storage extends PathEventEmitter {
|
|
|
4141
4135
|
move(source, destination) {
|
|
4142
4136
|
if (!source || !destination) throw new Error("Cannot move file or folder, missing source or destination");
|
|
4143
4137
|
if (source == destination) return this.meta(destination);
|
|
4144
|
-
return this.momentum.api.request({ url: `api/${this.module}
|
|
4138
|
+
return this.momentum.api.request({ url: `api/${this.module}${source.startsWith("/") ? "" : "/"}${source}`, method: "PUT", body: { move: destination } }).then((response) => {
|
|
4145
4139
|
this.emit(PES`${this.module}/${source}:u`, response);
|
|
4146
4140
|
return response;
|
|
4147
4141
|
});
|
|
@@ -4151,7 +4145,7 @@ class Storage extends PathEventEmitter {
|
|
|
4151
4145
|
const link = `${this.momentum.url.toString()}api/${this.module}/${path}`.replaceAll(/([^:])\/+/g, "$1/") + (!this.momentum.api.sameOrigin && this.momentum.api.token ? `?token=${this.momentum.api.token}` : "");
|
|
4152
4146
|
if (target === "url" || target === false) return link;
|
|
4153
4147
|
if (target === "_blank" || target == "_self") return window.open(link, target);
|
|
4154
|
-
return this.momentum.api.request({ url: `api/${this.module}
|
|
4148
|
+
return this.momentum.api.request({ url: `api/${this.module}${path.startsWith("/") ? "" : "/"}${path}?download=true`, decode: false }).then(async (response) => {
|
|
4155
4149
|
const blob = await response.blob();
|
|
4156
4150
|
if (target !== "blob") {
|
|
4157
4151
|
const name = target === "download" ? path.split("/").pop() : target;
|
|
@@ -4162,7 +4156,7 @@ class Storage extends PathEventEmitter {
|
|
|
4162
4156
|
}
|
|
4163
4157
|
text(path, set) {
|
|
4164
4158
|
if (!path) throw new Error("Missing path");
|
|
4165
|
-
if (set !== void 0) return this.momentum.api.request({ url: `api/${this.module}
|
|
4159
|
+
if (set !== void 0) return this.momentum.api.request({ url: `api/${this.module}${path.startsWith("/") ? "" : "/"}${path}`, method: "PATCH", body: { text: set } });
|
|
4166
4160
|
else return this.momentum.api.request({ url: `api/${this.module}/${path}?text=true` });
|
|
4167
4161
|
}
|
|
4168
4162
|
/**
|
|
@@ -4182,7 +4176,7 @@ class Storage extends PathEventEmitter {
|
|
|
4182
4176
|
f = [new File([f[0]], opts.rename, { type: f[0].type })];
|
|
4183
4177
|
}
|
|
4184
4178
|
return uploadWithProgress({
|
|
4185
|
-
url: `${this.momentum.url.toString()}api/${this.module}
|
|
4179
|
+
url: `${this.momentum.url.toString()}api/${this.module}${path.startsWith("/") ? "" : "/"}${path}`,
|
|
4186
4180
|
headers: this.momentum.api.headers,
|
|
4187
4181
|
files: f
|
|
4188
4182
|
}).onProgress((p) => {
|
|
@@ -4203,7 +4197,7 @@ class Storage extends PathEventEmitter {
|
|
|
4203
4197
|
sync(path, callback, opts = {}) {
|
|
4204
4198
|
const e = PE`${this.module}/${path}`;
|
|
4205
4199
|
const unsubscribe = callback ? this.on(e.toString(), (event) => callback(event, this.cache.get(path))) : null;
|
|
4206
|
-
if (
|
|
4200
|
+
if (opts.reload) this.meta(path);
|
|
4207
4201
|
if (!this.subscribers.length) this.momentum.socket?.subscribe(e.toString());
|
|
4208
4202
|
const key = Object.keys(this.subscribers).length.toString();
|
|
4209
4203
|
this.subscribers[key] = () => {
|
|
@@ -4337,7 +4331,7 @@ class Static extends Storage {
|
|
|
4337
4331
|
}
|
|
4338
4332
|
momentum;
|
|
4339
4333
|
}
|
|
4340
|
-
const version = "1.4.
|
|
4334
|
+
const version = "1.4.4";
|
|
4341
4335
|
class WebRtc extends PathEventEmitter {
|
|
4342
4336
|
constructor(momentum) {
|
|
4343
4337
|
super("webrtc");
|
|
@@ -4390,6 +4384,7 @@ class WebRtc extends PathEventEmitter {
|
|
|
4390
4384
|
session.open = false;
|
|
4391
4385
|
Object.values(session.peers).forEach((p) => p.connection.close());
|
|
4392
4386
|
session.stream.getTracks().forEach((track) => track.stop());
|
|
4387
|
+
unsubscribe();
|
|
4393
4388
|
this.momentum.socket?.send(`webrtc/${id}/${session.uid}:d`, {
|
|
4394
4389
|
uid: session.uid,
|
|
4395
4390
|
username: this.momentum.auth.user?._id || "Anonymous",
|
|
@@ -4397,8 +4392,7 @@ class WebRtc extends PathEventEmitter {
|
|
|
4397
4392
|
});
|
|
4398
4393
|
}
|
|
4399
4394
|
};
|
|
4400
|
-
this.momentum.socket?.subscribe(`webrtc/${id}
|
|
4401
|
-
this.momentum.socket?.on(`webrtc/${id}`, async (event, payload) => {
|
|
4395
|
+
const unsubscribe = this.momentum.socket?.subscribe(`webrtc/${id}`, async (event, payload) => {
|
|
4402
4396
|
if (event.name != session.uid) {
|
|
4403
4397
|
if (payload.connected) {
|
|
4404
4398
|
session.peers[event.name] = {
|
|
@@ -4444,6 +4438,7 @@ class WebRtc extends PathEventEmitter {
|
|
|
4444
4438
|
this.emit(id, session);
|
|
4445
4439
|
}
|
|
4446
4440
|
}
|
|
4441
|
+
}) || (() => {
|
|
4447
4442
|
});
|
|
4448
4443
|
this.momentum.socket?.send(`webrtc/${id}/${session.uid}`, {
|
|
4449
4444
|
uid: session.uid,
|
package/dist/schemas.d.ts
CHANGED
package/dist/schemas.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,mBAAmB,EAAC,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAC,KAAK,IAAI,EAAC,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AAEpC,MAAM,MAAM,MAAM,GAAG,IAAI,GAAG;IAC3B,sBAAsB;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,0BAA0B;IAC1B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,2BAA2B;IAC3B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,0CAA0C;IAC1C,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,mCAAmC;IACnC,IAAI,EAAE,OAAO,GAAG,IAAI,CAAC;IACrB,0BAA0B;IAC1B,IAAI,CAAC,EAAE;QACN,0BAA0B;QAC1B,IAAI,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ACf,4BAA4B;IAC5B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,gCAAgC;IAChC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,4BAA4B;IAC5B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,mBAAmB;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4BAA4B;IAC5B,WAAW,CAAC,EAAE,CAAC,IAAI,CAAC,iBAAiB,EAAE,aAAa,CAAC,GAAG;QAAC,SAAS,EAAE,MAAM,CAAA;KAAC,CAAC,EAAE,CAAA;CAC9E,CAAA;AAED,qBAAa,OAAQ,SAAQ,mBAAmB,CAAC,MAAM,CAAC;IAC3C,SAAS,CAAC,QAAQ,EAAE,QAAQ;gBAAlB,QAAQ,EAAE,QAAQ;CAGxC"}
|
package/dist/sockets.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Unsubscribe } from '@ztimson/utils';
|
|
1
2
|
import { PathEvent, PathEventEmitter } from './core';
|
|
2
3
|
import { Momentum } from './momentum';
|
|
3
4
|
export declare class Socket extends PathEventEmitter {
|
|
@@ -8,7 +9,6 @@ export declare class Socket extends PathEventEmitter {
|
|
|
8
9
|
private connectingResolver?;
|
|
9
10
|
private events;
|
|
10
11
|
private reconnect;
|
|
11
|
-
private pending;
|
|
12
12
|
private token?;
|
|
13
13
|
private reconnectTimeout;
|
|
14
14
|
connected: boolean;
|
|
@@ -17,9 +17,9 @@ export declare class Socket extends PathEventEmitter {
|
|
|
17
17
|
close(reconnect?: boolean): void;
|
|
18
18
|
connect(): Promise<void>;
|
|
19
19
|
ping(): Promise<number>;
|
|
20
|
-
send(channel: string, payload?: any): void
|
|
21
|
-
subscribe(event: string | PathEvent):
|
|
20
|
+
send(channel: string, payload?: any): Promise<void>;
|
|
21
|
+
subscribe(event: string | PathEvent, callback?: (event: PathEvent, payload: any) => any): Unsubscribe;
|
|
22
22
|
subscriptions(): Promise<string[]>;
|
|
23
|
-
unsubscribe(event: string | PathEvent):
|
|
23
|
+
unsubscribe(event: string | PathEvent): void;
|
|
24
24
|
}
|
|
25
25
|
//# sourceMappingURL=sockets.d.ts.map
|
package/dist/sockets.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sockets.d.ts","sourceRoot":"","sources":["../src/sockets.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sockets.d.ts","sourceRoot":"","sources":["../src/sockets.ts"],"names":[],"mappings":"AAAA,OAAO,EAA+B,WAAW,EAAC,MAAM,gBAAgB,CAAC;AACzE,OAAO,EAAC,SAAS,EAAE,gBAAgB,EAAC,MAAM,QAAQ,CAAC;AACnD,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AAEpC,qBAAa,MAAO,SAAQ,gBAAgB;IAW/B,SAAS,CAAC,QAAQ,EAAE,QAAQ;IAVxC,MAAM,CAAC,QAAQ,CAAC,YAAY,SAAS;IACrC,OAAO,CAAC,UAAU,CAAC,CAAY;IAC/B,OAAO,CAAC,UAAU,CAAC,CAAgB;IACnC,OAAO,CAAC,kBAAkB,CAAC,CAAW;IACtC,OAAO,CAAC,MAAM,CAA+B;IAC7C,OAAO,CAAC,SAAS,CAAQ;IACzB,OAAO,CAAC,KAAK,CAAC,CAAgB;IAC9B,OAAO,CAAC,gBAAgB,CAAM;IAC9B,SAAS,UAAS;gBAEI,QAAQ,EAAE,QAAQ;IAaxC,OAAO,CAAC,iBAAiB;IAQzB,KAAK,CAAC,SAAS,CAAC,EAAE,OAAO;IAczB,OAAO;IAqCD,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC;IASvB,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,GAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAS/D,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,KAAK,GAAG,GA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