@ztimson/momentum 0.41.0 → 0.42.0
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/client.d.ts +1 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/data.d.ts +26 -3
- package/dist/data.d.ts.map +1 -1
- package/dist/index.cjs +23 -8
- package/dist/index.mjs +23 -8
- package/package.json +2 -2
package/dist/client.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { Settings } from './settings';
|
|
|
2
2
|
export type Platform = 'windows' | 'android' | 'ios' | 'mac' | 'linux' | 'unknown';
|
|
3
3
|
export declare class Client {
|
|
4
4
|
private readonly settings;
|
|
5
|
+
get mobile(): boolean;
|
|
5
6
|
private _platform?;
|
|
6
7
|
get platform(): Platform;
|
|
7
8
|
private _pwa?;
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AAEpC,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,KAAK,GAAG,KAAK,GAAG,OAAO,GAAG,SAAS,CAAC;AAEnF,qBAAa,MAAM;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AAEpC,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,KAAK,GAAG,KAAK,GAAG,OAAO,GAAG,SAAS,CAAC;AAEnF,qBAAa,MAAM;IAyBN,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAvBrC,IAAI,MAAM,YAAyD;IAEnE,OAAO,CAAC,SAAS,CAAC,CAAW;IAC7B,IAAI,QAAQ,IAAI,QAAQ,CAWvB;IAED,OAAO,CAAC,IAAI,CAAC,CAAU;IACvB,IAAI,GAAG,IAAI,OAAO,CAIjB;gBAE4B,QAAQ,EAAE,QAAQ;IAEzC,MAAM,CAAC,MAAM,UAAQ;IA0F3B,SAAS,CAAC,QAAQ,CAAC,EAAE,SAAS,GAAG,KAAK;CAiItC"}
|
package/dist/data.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Api } from './api';
|
|
2
2
|
import { Meta } from './core';
|
|
3
|
-
import { TypedEmitter, TypedEvents } from '@ztimson/utils';
|
|
3
|
+
import { PromiseProgress, TypedEmitter, TypedEvents } from '@ztimson/utils';
|
|
4
4
|
export type Document<T> = Meta & T;
|
|
5
5
|
export type RawQuery = {
|
|
6
6
|
operand: 'delete' | 'deleteOne' | 'find' | 'findOne' | 'insert' | 'replaceOne' | 'update' | 'updateOne';
|
|
@@ -9,10 +9,26 @@ export type RawQuery = {
|
|
|
9
9
|
options?: any;
|
|
10
10
|
count?: boolean;
|
|
11
11
|
};
|
|
12
|
+
export type Schema = Meta & {
|
|
13
|
+
path: string;
|
|
14
|
+
description?: string;
|
|
15
|
+
autoIncrement?: number;
|
|
16
|
+
fields?: SchemaField[];
|
|
17
|
+
};
|
|
18
|
+
export type SchemaField = {
|
|
19
|
+
key: string;
|
|
20
|
+
type: string;
|
|
21
|
+
format: string;
|
|
22
|
+
default: any;
|
|
23
|
+
null: boolean;
|
|
24
|
+
};
|
|
12
25
|
/**
|
|
13
|
-
* Recursive type for defining data schema
|
|
26
|
+
* Recursive type for defining data schema
|
|
14
27
|
*/
|
|
15
|
-
export type
|
|
28
|
+
export type SchemaNode = Schema & {
|
|
29
|
+
name: string;
|
|
30
|
+
children: SchemaNode[];
|
|
31
|
+
};
|
|
16
32
|
export type DataEvents = TypedEvents & {
|
|
17
33
|
create: (collection: string, document: any) => any;
|
|
18
34
|
read: (collection: string, documents: any | any[]) => any;
|
|
@@ -29,5 +45,12 @@ export declare class Data extends TypedEmitter<DataEvents> {
|
|
|
29
45
|
update<T>(collection: string, document: Document<T>, append?: boolean): Promise<Document<T>>;
|
|
30
46
|
delete(collection: string, id: number): Promise<void>;
|
|
31
47
|
raw<T>(collection: string, query: RawQuery): Promise<Document<T>>;
|
|
48
|
+
deleteSchema(collection: string): PromiseProgress<void>;
|
|
49
|
+
getSchema(tree?: false): Promise<string[]>;
|
|
50
|
+
getSchema(tree?: boolean): Promise<SchemaNode[]>;
|
|
51
|
+
getSchema(path?: string): Promise<Schema>;
|
|
52
|
+
setSchema(schema: Partial<Schema> & {
|
|
53
|
+
path: string;
|
|
54
|
+
}): PromiseProgress<unknown>;
|
|
32
55
|
}
|
|
33
56
|
//# sourceMappingURL=data.d.ts.map
|
package/dist/data.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../src/data.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAC,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,KAAK,IAAI,EAAC,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAC,YAAY,EAAE,KAAK,WAAW,EAAC,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../src/data.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAC,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,KAAK,IAAI,EAAC,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAC,eAAe,EAAE,YAAY,EAAE,KAAK,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAE/E,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,IAAI,GAAG,CAAC,CAAC;AAEnC,MAAM,MAAM,QAAQ,GAAG;IACtB,OAAO,EAAE,QAAQ,GAAG,WAAW,GAAG,MAAM,GAAG,SAAS,GAAG,QAAQ,GAAG,YAAY,GAAG,QAAQ,GAAG,WAAW,CAAC;IACxG,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,IAAI,CA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"sy
|
|
|
665
665
|
set token(token) {
|
|
666
666
|
if (token == this._token) return;
|
|
667
667
|
this._token = token;
|
|
668
|
-
this.headers["Authorization"] = token ? `Bearer ${token}` :
|
|
668
|
+
this.headers["Authorization"] = token ? `Bearer ${token}` : null;
|
|
669
669
|
this.emit("token", token);
|
|
670
670
|
}
|
|
671
671
|
healthcheck() {
|
|
@@ -948,6 +948,9 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
948
948
|
__publicField(this, "_pwa");
|
|
949
949
|
this.settings = settings;
|
|
950
950
|
}
|
|
951
|
+
get mobile() {
|
|
952
|
+
return ["android", "ios"].includes(this.platform);
|
|
953
|
+
}
|
|
951
954
|
get platform() {
|
|
952
955
|
if (!this._platform) {
|
|
953
956
|
const userAgent = navigator.userAgent || navigator.vendor;
|
|
@@ -1036,7 +1039,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1036
1039
|
window.document.head.append(link);
|
|
1037
1040
|
setTimeout(() => {
|
|
1038
1041
|
const dismissed = !!localStorage.getItem("momentum:install-prompt");
|
|
1039
|
-
if (!dismissed && !this.pwa && this.
|
|
1042
|
+
if (!dismissed && !this.pwa && this.mobile) this.pwaPrompt();
|
|
1040
1043
|
}, 500);
|
|
1041
1044
|
}
|
|
1042
1045
|
}
|
|
@@ -1170,7 +1173,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1170
1173
|
}
|
|
1171
1174
|
create(collection, document2) {
|
|
1172
1175
|
return this.api.request({
|
|
1173
|
-
url: `/api/data/${collection}`,
|
|
1176
|
+
url: `/api/data/${collection.replaceAll(/(^\/|\/$)/g, "")}`,
|
|
1174
1177
|
method: "POST",
|
|
1175
1178
|
body: document2
|
|
1176
1179
|
}).then((resp) => {
|
|
@@ -1179,7 +1182,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1179
1182
|
});
|
|
1180
1183
|
}
|
|
1181
1184
|
read(collection, id) {
|
|
1182
|
-
return this.api.request({ url: `/api/data/${collection}
|
|
1185
|
+
return this.api.request({ url: `/api/data/${collection.replaceAll(/(^\/|\/$)/g, "")}/${id ?? ""}` }).then((resp) => {
|
|
1183
1186
|
this.emit("read", collection, resp);
|
|
1184
1187
|
return resp;
|
|
1185
1188
|
});
|
|
@@ -1187,7 +1190,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1187
1190
|
update(collection, document2, append = true) {
|
|
1188
1191
|
if (!document2._id) return this.create(collection, document2);
|
|
1189
1192
|
return this.api.request({
|
|
1190
|
-
url: `/api/data/${collection}/${document2._id}`,
|
|
1193
|
+
url: `/api/data/${collection.replaceAll(/(^\/|\/$)/g, "")}/${document2._id}`,
|
|
1191
1194
|
method: append ? "PATCH" : "PUT",
|
|
1192
1195
|
body: document2
|
|
1193
1196
|
}).then((resp) => {
|
|
@@ -1197,16 +1200,28 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1197
1200
|
}
|
|
1198
1201
|
delete(collection, id) {
|
|
1199
1202
|
return this.api.request({
|
|
1200
|
-
url: `/api/data/${collection}/${id}`,
|
|
1203
|
+
url: `/api/data/${collection.replaceAll(/(^\/|\/$)/g, "")}/${id}`,
|
|
1201
1204
|
method: "DELETE"
|
|
1202
1205
|
}).then(() => this.emit("delete", collection, id));
|
|
1203
1206
|
}
|
|
1204
1207
|
raw(collection, query) {
|
|
1205
|
-
return this.api.request({ url: `/api/data/${collection}`, body: query }).then((resp) => {
|
|
1208
|
+
return this.api.request({ url: `/api/data/${collection.replaceAll(/(^\/|\/$)/g, "")}`, body: query }).then((resp) => {
|
|
1206
1209
|
this.emit("raw", collection, query, resp);
|
|
1207
1210
|
return resp;
|
|
1208
1211
|
});
|
|
1209
1212
|
}
|
|
1213
|
+
deleteSchema(collection) {
|
|
1214
|
+
return this.api.request({ url: `/api/data/schema/${collection.replaceAll(/(^\/|\/$)/g, "")}`, method: "DELETE" });
|
|
1215
|
+
}
|
|
1216
|
+
getSchema(pathOrTree) {
|
|
1217
|
+
let url = "/api/data/schema";
|
|
1218
|
+
if (typeof pathOrTree == "string") url += `/${pathOrTree.replaceAll(/(^\/|\/$)/g, "")}`;
|
|
1219
|
+
else if (typeof pathOrTree == "boolean") url += `?tree=${pathOrTree}`;
|
|
1220
|
+
return this.api.request({ url });
|
|
1221
|
+
}
|
|
1222
|
+
setSchema(schema) {
|
|
1223
|
+
return this.api.request({ url: `/api/data/schema/${schema.path.replaceAll(/(^\/|\/$)/g, "")}`, body: schema });
|
|
1224
|
+
}
|
|
1210
1225
|
}
|
|
1211
1226
|
class Email extends _ {
|
|
1212
1227
|
constructor(api) {
|
|
@@ -1605,7 +1620,7 @@ ${log}`;
|
|
|
1605
1620
|
this.api = typeof api == "string" ? new Api(api) : api;
|
|
1606
1621
|
}
|
|
1607
1622
|
async all(detailed = false, reload) {
|
|
1608
|
-
if (!detailed && this.cache.complete
|
|
1623
|
+
if (!reload && !detailed && this.cache.complete) return this.cache;
|
|
1609
1624
|
return this.api.request({ url: `/api/settings` + (detailed ? "?detailed" : "") }).then((resp) => {
|
|
1610
1625
|
Object.entries(resp).forEach(([key, value]) => this.cache.set(key, detailed ? value.value : value));
|
|
1611
1626
|
this.cache.complete = true;
|
package/dist/index.mjs
CHANGED
|
@@ -661,7 +661,7 @@ class Api extends F {
|
|
|
661
661
|
set token(token) {
|
|
662
662
|
if (token == this._token) return;
|
|
663
663
|
this._token = token;
|
|
664
|
-
this.headers["Authorization"] = token ? `Bearer ${token}` :
|
|
664
|
+
this.headers["Authorization"] = token ? `Bearer ${token}` : null;
|
|
665
665
|
this.emit("token", token);
|
|
666
666
|
}
|
|
667
667
|
healthcheck() {
|
|
@@ -944,6 +944,9 @@ class Client {
|
|
|
944
944
|
__publicField(this, "_pwa");
|
|
945
945
|
this.settings = settings;
|
|
946
946
|
}
|
|
947
|
+
get mobile() {
|
|
948
|
+
return ["android", "ios"].includes(this.platform);
|
|
949
|
+
}
|
|
947
950
|
get platform() {
|
|
948
951
|
if (!this._platform) {
|
|
949
952
|
const userAgent = navigator.userAgent || navigator.vendor;
|
|
@@ -1032,7 +1035,7 @@ class Client {
|
|
|
1032
1035
|
window.document.head.append(link);
|
|
1033
1036
|
setTimeout(() => {
|
|
1034
1037
|
const dismissed = !!localStorage.getItem("momentum:install-prompt");
|
|
1035
|
-
if (!dismissed && !this.pwa && this.
|
|
1038
|
+
if (!dismissed && !this.pwa && this.mobile) this.pwaPrompt();
|
|
1036
1039
|
}, 500);
|
|
1037
1040
|
}
|
|
1038
1041
|
}
|
|
@@ -1166,7 +1169,7 @@ class Data extends _ {
|
|
|
1166
1169
|
}
|
|
1167
1170
|
create(collection, document2) {
|
|
1168
1171
|
return this.api.request({
|
|
1169
|
-
url: `/api/data/${collection}`,
|
|
1172
|
+
url: `/api/data/${collection.replaceAll(/(^\/|\/$)/g, "")}`,
|
|
1170
1173
|
method: "POST",
|
|
1171
1174
|
body: document2
|
|
1172
1175
|
}).then((resp) => {
|
|
@@ -1175,7 +1178,7 @@ class Data extends _ {
|
|
|
1175
1178
|
});
|
|
1176
1179
|
}
|
|
1177
1180
|
read(collection, id) {
|
|
1178
|
-
return this.api.request({ url: `/api/data/${collection}
|
|
1181
|
+
return this.api.request({ url: `/api/data/${collection.replaceAll(/(^\/|\/$)/g, "")}/${id ?? ""}` }).then((resp) => {
|
|
1179
1182
|
this.emit("read", collection, resp);
|
|
1180
1183
|
return resp;
|
|
1181
1184
|
});
|
|
@@ -1183,7 +1186,7 @@ class Data extends _ {
|
|
|
1183
1186
|
update(collection, document2, append = true) {
|
|
1184
1187
|
if (!document2._id) return this.create(collection, document2);
|
|
1185
1188
|
return this.api.request({
|
|
1186
|
-
url: `/api/data/${collection}/${document2._id}`,
|
|
1189
|
+
url: `/api/data/${collection.replaceAll(/(^\/|\/$)/g, "")}/${document2._id}`,
|
|
1187
1190
|
method: append ? "PATCH" : "PUT",
|
|
1188
1191
|
body: document2
|
|
1189
1192
|
}).then((resp) => {
|
|
@@ -1193,16 +1196,28 @@ class Data extends _ {
|
|
|
1193
1196
|
}
|
|
1194
1197
|
delete(collection, id) {
|
|
1195
1198
|
return this.api.request({
|
|
1196
|
-
url: `/api/data/${collection}/${id}`,
|
|
1199
|
+
url: `/api/data/${collection.replaceAll(/(^\/|\/$)/g, "")}/${id}`,
|
|
1197
1200
|
method: "DELETE"
|
|
1198
1201
|
}).then(() => this.emit("delete", collection, id));
|
|
1199
1202
|
}
|
|
1200
1203
|
raw(collection, query) {
|
|
1201
|
-
return this.api.request({ url: `/api/data/${collection}`, body: query }).then((resp) => {
|
|
1204
|
+
return this.api.request({ url: `/api/data/${collection.replaceAll(/(^\/|\/$)/g, "")}`, body: query }).then((resp) => {
|
|
1202
1205
|
this.emit("raw", collection, query, resp);
|
|
1203
1206
|
return resp;
|
|
1204
1207
|
});
|
|
1205
1208
|
}
|
|
1209
|
+
deleteSchema(collection) {
|
|
1210
|
+
return this.api.request({ url: `/api/data/schema/${collection.replaceAll(/(^\/|\/$)/g, "")}`, method: "DELETE" });
|
|
1211
|
+
}
|
|
1212
|
+
getSchema(pathOrTree) {
|
|
1213
|
+
let url = "/api/data/schema";
|
|
1214
|
+
if (typeof pathOrTree == "string") url += `/${pathOrTree.replaceAll(/(^\/|\/$)/g, "")}`;
|
|
1215
|
+
else if (typeof pathOrTree == "boolean") url += `?tree=${pathOrTree}`;
|
|
1216
|
+
return this.api.request({ url });
|
|
1217
|
+
}
|
|
1218
|
+
setSchema(schema) {
|
|
1219
|
+
return this.api.request({ url: `/api/data/schema/${schema.path.replaceAll(/(^\/|\/$)/g, "")}`, body: schema });
|
|
1220
|
+
}
|
|
1206
1221
|
}
|
|
1207
1222
|
class Email extends _ {
|
|
1208
1223
|
constructor(api) {
|
|
@@ -1601,7 +1616,7 @@ class Settings extends _ {
|
|
|
1601
1616
|
this.api = typeof api == "string" ? new Api(api) : api;
|
|
1602
1617
|
}
|
|
1603
1618
|
async all(detailed = false, reload) {
|
|
1604
|
-
if (!detailed && this.cache.complete
|
|
1619
|
+
if (!reload && !detailed && this.cache.complete) return this.cache;
|
|
1605
1620
|
return this.api.request({ url: `/api/settings` + (detailed ? "?detailed" : "") }).then((resp) => {
|
|
1606
1621
|
Object.entries(resp).forEach(([key, value]) => this.cache.set(key, detailed ? value.value : value));
|
|
1607
1622
|
this.cache.complete = true;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ztimson/momentum",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.42.0",
|
|
4
4
|
"description": "Client library for momentum",
|
|
5
5
|
"keywords": ["Momentum"],
|
|
6
6
|
"author": "Zak Timson <zaktimson@gmail.com>",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"postbuild": "node -e \"const fs=require('fs');fs.cpSync('dist/index.mjs','../server/public/momentum.mjs');fs.cpSync('dist/index.cjs','../server/public/momentum.js')\""
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@ztimson/utils": "0.17.
|
|
27
|
+
"@ztimson/utils": "0.17.1"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@types/node": "^22.5.4",
|