@ztimson/momentum 0.53.1 → 0.58.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/README.md +200 -148
- package/bin/build-models.mjs +28 -37
- package/dist/actions.d.ts +32 -43
- package/dist/actions.d.ts.map +1 -1
- package/dist/ai.d.ts +38 -17
- package/dist/ai.d.ts.map +1 -1
- package/dist/analytics.d.ts +169 -36
- package/dist/analytics.d.ts.map +1 -1
- package/dist/api.d.ts +22 -22
- package/dist/api.d.ts.map +1 -1
- package/dist/asset-controller.d.ts +92 -0
- package/dist/asset-controller.d.ts.map +1 -0
- package/dist/audit.d.ts +22 -0
- package/dist/audit.d.ts.map +1 -0
- package/dist/auth.d.ts +39 -92
- package/dist/auth.d.ts.map +1 -1
- package/dist/call.d.ts +39 -0
- package/dist/call.d.ts.map +1 -0
- package/dist/captcha.d.ts +14 -0
- package/dist/captcha.d.ts.map +1 -0
- package/dist/client.d.ts +44 -33
- package/dist/client.d.ts.map +1 -1
- package/dist/core.d.ts +50 -21
- package/dist/core.d.ts.map +1 -1
- package/dist/data.d.ts +59 -77
- package/dist/data.d.ts.map +1 -1
- package/dist/dialog.d.ts +11 -0
- package/dist/dialog.d.ts.map +1 -0
- package/dist/discounts.d.ts +8 -12
- package/dist/discounts.d.ts.map +1 -1
- package/dist/email.d.ts +19 -19
- package/dist/email.d.ts.map +1 -1
- package/dist/forms.d.ts +6 -13
- package/dist/forms.d.ts.map +1 -1
- package/dist/groups.d.ts +22 -16
- package/dist/groups.d.ts.map +1 -1
- package/dist/index.d.ts +13 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4446 -0
- package/dist/index.mjs +3422 -1731
- package/dist/logger.d.ts +78 -48
- package/dist/logger.d.ts.map +1 -1
- package/dist/momentum.d.ts +69 -15
- package/dist/momentum.d.ts.map +1 -1
- package/dist/momentum.worker.d.mts +2 -0
- package/dist/momentum.worker.d.mts.map +1 -0
- package/dist/momentum.worker.mjs +103 -0
- package/dist/notifications.d.ts +39 -0
- package/dist/notifications.d.ts.map +1 -0
- package/dist/pdf.d.ts +31 -14
- package/dist/pdf.d.ts.map +1 -1
- package/dist/products.d.ts +47 -0
- package/dist/products.d.ts.map +1 -0
- package/dist/routes.d.ts +40 -0
- package/dist/routes.d.ts.map +1 -0
- package/dist/schemas.d.ts +79 -0
- package/dist/schemas.d.ts.map +1 -0
- package/dist/settings.d.ts +30 -14
- package/dist/settings.d.ts.map +1 -1
- package/dist/sms.d.ts +14 -0
- package/dist/sms.d.ts.map +1 -0
- package/dist/sockets.d.ts +21 -10
- package/dist/sockets.d.ts.map +1 -1
- package/dist/static.d.ts +4 -2
- package/dist/static.d.ts.map +1 -1
- package/dist/storage.d.ts +103 -24
- package/dist/storage.d.ts.map +1 -1
- package/dist/templates.d.ts +23 -0
- package/dist/templates.d.ts.map +1 -0
- package/dist/tokens.d.ts +50 -0
- package/dist/tokens.d.ts.map +1 -0
- package/dist/totp.d.ts +45 -0
- package/dist/totp.d.ts.map +1 -0
- package/dist/transactions.d.ts +153 -0
- package/dist/transactions.d.ts.map +1 -0
- package/dist/users.d.ts +63 -25
- package/dist/users.d.ts.map +1 -1
- package/dist/webRtc.d.ts +39 -0
- package/dist/webRtc.d.ts.map +1 -0
- package/package.json +53 -43
- package/dist/index.cjs +0 -2755
- package/dist/momentum.worker.js +0 -16
- package/dist/payments.d.ts +0 -184
- package/dist/payments.d.ts.map +0 -1
- package/dist/phone.d.ts +0 -19
- package/dist/phone.d.ts.map +0 -1
package/dist/auth.d.ts
CHANGED
|
@@ -1,87 +1,27 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { PathEvent, PathEventEmitter } from './core';
|
|
2
|
+
import { Momentum } from './momentum';
|
|
3
|
+
import { Totp, TotpMethods } from './totp';
|
|
4
4
|
import { User } from './users';
|
|
5
|
-
export type
|
|
6
|
-
/**
|
|
7
|
-
|
|
5
|
+
export type SessionData = {
|
|
6
|
+
/** User token */
|
|
7
|
+
token: string | null;
|
|
8
|
+
/** Current user */
|
|
9
|
+
user: User | null;
|
|
10
|
+
/** Combined custom values */
|
|
11
|
+
custom: any;
|
|
12
|
+
/** UI dashboard page */
|
|
13
|
+
dashboardUrl: string | null;
|
|
14
|
+
/** Redirect user to URL on login */
|
|
15
|
+
loginRedirect: string | null;
|
|
16
|
+
/** Combined permissions */
|
|
17
|
+
permissions: string[];
|
|
8
18
|
};
|
|
9
|
-
export type UserToken = Meta & {
|
|
10
|
-
/** User defined name */
|
|
11
|
-
name: string;
|
|
12
|
-
/** Assigned to */
|
|
13
|
-
owner: string;
|
|
14
|
-
/** Token value */
|
|
15
|
-
token: string;
|
|
16
|
-
/** Expiration */
|
|
17
|
-
expire: null | Date;
|
|
18
|
-
};
|
|
19
|
-
/** Manage user tokens */
|
|
20
|
-
export declare class Token extends PathEventEmitter {
|
|
21
|
-
private api;
|
|
22
|
-
constructor(api: Api);
|
|
23
|
-
/**
|
|
24
|
-
* Fetch all tokens for user
|
|
25
|
-
* @param {string} username User to search
|
|
26
|
-
* @return {Promise<UserToken[]>} List of tokens
|
|
27
|
-
*/
|
|
28
|
-
all(username: string): Promise<UserToken[]>;
|
|
29
|
-
/**
|
|
30
|
-
* Create a new user token
|
|
31
|
-
* @param {{name: string, owner: string, expire: null | Date}} token Token settings
|
|
32
|
-
* @return {Promise<UserToken>} Crated token
|
|
33
|
-
*/
|
|
34
|
-
create(token: {
|
|
35
|
-
name: string;
|
|
36
|
-
owner: string;
|
|
37
|
-
expire: null | Date;
|
|
38
|
-
}): Promise<UserToken>;
|
|
39
|
-
/**
|
|
40
|
-
* Delete an existing user token
|
|
41
|
-
* @param {string} id Token ID
|
|
42
|
-
* @return {Promise<void>} Resolves once complete
|
|
43
|
-
*/
|
|
44
|
-
delete(id: string): Promise<void>;
|
|
45
|
-
}
|
|
46
|
-
/** Mange user 2FA */
|
|
47
|
-
export declare class Totp {
|
|
48
|
-
private api;
|
|
49
|
-
constructor(api: Api);
|
|
50
|
-
/**
|
|
51
|
-
* Disable 2FA for user
|
|
52
|
-
* @param {string} username User to disable 2FA for
|
|
53
|
-
* @return {Promise<void>} Resolves once complete
|
|
54
|
-
*/
|
|
55
|
-
disable(username: string): import('@ztimson/utils').PromiseProgress<void>;
|
|
56
|
-
/**
|
|
57
|
-
* Enable 2FA for user
|
|
58
|
-
* @param {string} username User to reset
|
|
59
|
-
* @return {Promise<void>} Resolves once complete
|
|
60
|
-
*/
|
|
61
|
-
enable: (username: string) => Promise<void>;
|
|
62
|
-
/**
|
|
63
|
-
* Reset users 2FA
|
|
64
|
-
* @param {string} username User to reset
|
|
65
|
-
* @return {Promise<void>} Resolves once complete
|
|
66
|
-
*/
|
|
67
|
-
reset(username: string): Promise<void>;
|
|
68
|
-
/**
|
|
69
|
-
* Setup 2FA authentication method
|
|
70
|
-
* @param {string} username User to setup
|
|
71
|
-
* @param {string} method Authenticator type
|
|
72
|
-
* @param {string | null} totp null to being process, 2FA code to validate method
|
|
73
|
-
* @return {Promise<void>} Resolves once complete
|
|
74
|
-
*/
|
|
75
|
-
setup(username: string, method?: string, totp?: string): import('@ztimson/utils').PromiseProgress<void>;
|
|
76
|
-
}
|
|
77
19
|
/** Manage User Authentication */
|
|
78
20
|
export declare class Auth extends PathEventEmitter {
|
|
79
|
-
|
|
80
|
-
private readonly api;
|
|
81
|
-
/** Manage user tokens */
|
|
82
|
-
token: Token;
|
|
21
|
+
protected momentum: Momentum;
|
|
83
22
|
/** Manage user 2FA */
|
|
84
23
|
totp: Totp;
|
|
24
|
+
session?: SessionData | null;
|
|
85
25
|
private _permissions;
|
|
86
26
|
/** Get current user permissions */
|
|
87
27
|
get permissions(): string[];
|
|
@@ -91,12 +31,18 @@ export declare class Auth extends PathEventEmitter {
|
|
|
91
31
|
get user(): User | null | undefined;
|
|
92
32
|
/** Update user info without changing the session */
|
|
93
33
|
set user(user: User | null | undefined);
|
|
94
|
-
constructor(
|
|
34
|
+
constructor(momentum: Momentum);
|
|
35
|
+
/** Filter list of permissions to ones the user has */
|
|
95
36
|
filter: (...events: (string | PathEvent)[]) => PathEvent[];
|
|
37
|
+
/** Does user have any permissions (or) */
|
|
96
38
|
has: (...events: (string | PathEvent)[]) => boolean;
|
|
39
|
+
/** Does user have all permissions (and) */
|
|
97
40
|
hasAll: (...events: (string | PathEvent)[]) => boolean;
|
|
41
|
+
/** Raise error if user has no permissions (or) */
|
|
98
42
|
hasFatal: (...events: (string | PathEvent)[]) => void;
|
|
43
|
+
/** Raise error if user missing any permissions (and) */
|
|
99
44
|
hasAllFatal: (...events: (string | PathEvent)[]) => void;
|
|
45
|
+
handleLogin(reload?: boolean): Promise<SessionData | null | undefined>;
|
|
100
46
|
/**
|
|
101
47
|
* Check if origin is recognized & whitelisted
|
|
102
48
|
* @param {string} host Origin to check
|
|
@@ -105,15 +51,19 @@ export declare class Auth extends PathEventEmitter {
|
|
|
105
51
|
knownHost(host?: string): Promise<void>;
|
|
106
52
|
/**
|
|
107
53
|
* Login a user & return the account
|
|
108
|
-
* @param {string}
|
|
54
|
+
* @param {string} id username
|
|
109
55
|
* @param {string} password user's password
|
|
110
|
-
* @param {{totp: string, expire: null | number | Date}} opts 2FA code and expiry options (null to never expire)
|
|
111
|
-
* @return {Promise<
|
|
56
|
+
* @param {{totp: string, totpMethod: TotpMethods, expire: null | number | Date}} opts 2FA code, 2FA code push method, and expiry options (null to never expire)
|
|
57
|
+
* @return {Promise<{reset?: string, token?: string} | null>} User account on success
|
|
112
58
|
*/
|
|
113
|
-
login(
|
|
59
|
+
login(id: string, password?: string, opts?: {
|
|
114
60
|
totp?: string;
|
|
61
|
+
totpMethod?: TotpMethods;
|
|
115
62
|
expire?: number | Date | null;
|
|
116
|
-
}): Promise<
|
|
63
|
+
}): Promise<{
|
|
64
|
+
reset?: string;
|
|
65
|
+
token?: string;
|
|
66
|
+
} | null>;
|
|
117
67
|
/**
|
|
118
68
|
* Login via Momentum single sign on
|
|
119
69
|
* @param {string} host Host origin attempting to login
|
|
@@ -123,14 +73,14 @@ export declare class Auth extends PathEventEmitter {
|
|
|
123
73
|
/**
|
|
124
74
|
* Logout current user
|
|
125
75
|
*/
|
|
126
|
-
logout(): void
|
|
76
|
+
logout(): Promise<void>;
|
|
127
77
|
/**
|
|
128
78
|
* Create a new user with login
|
|
129
79
|
* @param {Partial<User> & {password: string}} user User data with password
|
|
130
80
|
* @return {Promise<User>} Registered user data
|
|
131
81
|
*/
|
|
132
82
|
register(user: Partial<User> & {
|
|
133
|
-
|
|
83
|
+
_id: string;
|
|
134
84
|
password: string;
|
|
135
85
|
}): Promise<User>;
|
|
136
86
|
/**
|
|
@@ -152,12 +102,9 @@ export declare class Auth extends PathEventEmitter {
|
|
|
152
102
|
* @param {boolean} set Set as current active session
|
|
153
103
|
* @return {Promise<{token: string, user: User, permissions: string[], custom: any} | null>} Session information
|
|
154
104
|
*/
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
permissions: string[];
|
|
159
|
-
custom: any;
|
|
160
|
-
} | null>;
|
|
105
|
+
readSession(token?: string | null, set?: boolean): Promise<SessionData | null>;
|
|
106
|
+
/** Unlock an account that has been locked from too many login attempts */
|
|
107
|
+
unlock(username: string): Promise<void>;
|
|
161
108
|
/**
|
|
162
109
|
* Update password for user
|
|
163
110
|
* @param {string} username User to reset
|
package/dist/auth.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,SAAS,EAAE,gBAAgB,EAAM,MAAM,QAAQ,CAAC;AACxD,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AACpC,OAAO,EAAC,IAAI,EAAE,WAAW,EAAC,MAAM,QAAQ,CAAC;AACzC,OAAO,KAAK,EAAC,IAA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W,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,EAAE,GAAG,UAAQ,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;IAkBlF,0EAA0E;IACpE,MAAM,CAAC,QAAQ,EAAE,MAAM;IAI7B;;;;;;OAMG;IACG,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAW7F"}
|
package/dist/call.d.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Message, PathEventEmitter } from './core';
|
|
2
|
+
import { Momentum } from './momentum';
|
|
3
|
+
export type InteractiveCall = {
|
|
4
|
+
/** Default message */
|
|
5
|
+
'_': string | {
|
|
6
|
+
forward: {
|
|
7
|
+
user: string;
|
|
8
|
+
} | {
|
|
9
|
+
number: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
/** Interactive voice response on key press */
|
|
13
|
+
[key: string]: string | {
|
|
14
|
+
forward: {
|
|
15
|
+
user: string;
|
|
16
|
+
} | {
|
|
17
|
+
number: string;
|
|
18
|
+
};
|
|
19
|
+
} | InteractiveCall;
|
|
20
|
+
};
|
|
21
|
+
/** Create call with steps */
|
|
22
|
+
export type PhoneCall = Omit<Message, 'body'> & {
|
|
23
|
+
/** Text to speech, use dictionary to create an interactive voice response system (IVR) */
|
|
24
|
+
body: string | InteractiveCall;
|
|
25
|
+
/** Create voice recording of call */
|
|
26
|
+
record?: boolean;
|
|
27
|
+
};
|
|
28
|
+
/** Send messages */
|
|
29
|
+
export declare class Call extends PathEventEmitter {
|
|
30
|
+
protected momentum: Momentum;
|
|
31
|
+
constructor(momentum: Momentum);
|
|
32
|
+
/**
|
|
33
|
+
* Place a call to number
|
|
34
|
+
* @param {Call} message Text that will be converted to speech
|
|
35
|
+
* @return {Promise<any>} Twilio call instance
|
|
36
|
+
*/
|
|
37
|
+
create(message: PhoneCall): Promise<any>;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=call.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"call.d.ts","sourceRoot":"","sources":["../src/call.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,gBAAgB,EAAM,MAAM,QAAQ,CAAC;AACtD,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AAEpC,MAAM,MAAM,eAAe,GAAG;IAC7B,sBAAsB;IACtB,GAAG,EAAE,MAAM,GAAG;QAAC,OAAO,EAAE;YAAC,IAAI,EAAE,MAAM,CAAA;SAAC,GAAG;YAAC,MAAM,EAAE,MAAM,CAAA;SAAC,CAAA;KAAC,CAAC;IAC3D,8CAA8C;IAC9C,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG;QAAC,OAAO,EAAE;YAAC,IAAI,EAAE,MAAM,CAAA;SAAC,GAAG;YAAC,MAAM,EAAE,MAAM,CAAA;SAAC,CAAA;KAAC,GAAG,eAAe,CAAC;CACvF,CAAC;AAEF,6BAA6B;AAC7B,MAAM,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,GAAG;IAC/C,0FAA0F;IAC1F,IAAI,EAAE,MAAM,GAAG,eAAe,CAAC;IAC/B,qCAAqC;IACrC,MAAM,CAAC,EAAE,OAAO,CAAC;CACjB,CAAA;AAED,oBAAoB;AACpB,qBAAa,IAAK,SAAQ,gBAAgB;IAC7B,SAAS,CAAC,QAAQ,EAAE,QAAQ;gBAAlB,QAAQ,EAAE,QAAQ;IAIxC;;;;OAIG;IACH,MAAM,CAAC,OAAO,EAAE,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC;CAIxC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare class Captcha {
|
|
2
|
+
private start;
|
|
3
|
+
private events;
|
|
4
|
+
private lastMouse;
|
|
5
|
+
private velocities;
|
|
6
|
+
private _score;
|
|
7
|
+
private set score(value);
|
|
8
|
+
get score(): number;
|
|
9
|
+
get verdict(): 'unknown' | 'human' | 'bot';
|
|
10
|
+
constructor();
|
|
11
|
+
private validUserAgent;
|
|
12
|
+
update(): void;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=captcha.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"captcha.d.ts","sourceRoot":"","sources":["../src/captcha.ts"],"names":[],"mappings":"AAAA,qBAAa,OAAO;IACnB,OAAO,CAAC,KAAK,CAAc;IAC3B,OAAO,CAAC,MAAM,CAAoF;IAClG,OAAO,CAAC,SAAS,CAAkD;IACnE,OAAO,CAAC,UAAU,CAAgB;IAElC,OAAO,CAAC,MAAM,CAAO;IACrB,OAAO,KAAK,KAAK,QAAwB;IACzC,IAAI,KAAK,WAA0B;IAEnC,IAAI,OAAO,IAAI,SAAS,GAAG,OAAO,GAAG,KAAK,CAIzC;;IAsCD,OAAO,CAAC,cAAc;IAStB,MAAM;CAyCN"}
|
package/dist/client.d.ts
CHANGED
|
@@ -1,50 +1,61 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { Settings } from './settings';
|
|
1
|
+
import { Momentum } from './momentum';
|
|
2
|
+
import { PathEventEmitter } from './core';
|
|
4
3
|
export type Platform = 'windows' | 'android' | 'ios' | 'mac' | 'linux' | 'unknown';
|
|
4
|
+
/** Handle device settings */
|
|
5
5
|
export declare class Client extends PathEventEmitter {
|
|
6
|
-
|
|
7
|
-
private
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
get
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
|
|
15
|
-
|
|
6
|
+
protected momentum: Momentum;
|
|
7
|
+
private captcha;
|
|
8
|
+
private nativePwaPrompt?;
|
|
9
|
+
private speed;
|
|
10
|
+
private updating;
|
|
11
|
+
get actorType(): 'unknown' | 'human' | 'bot';
|
|
12
|
+
get captchaScore(): number;
|
|
13
|
+
/** Check for updates */
|
|
14
|
+
readonly updateReady: Promise<boolean>;
|
|
15
|
+
/** Check if PWA can be installed */
|
|
16
|
+
get canInstall(): boolean;
|
|
17
|
+
/** Running inside a container */
|
|
18
|
+
get isApp(): boolean;
|
|
19
|
+
/** Running inside an electron app */
|
|
20
|
+
get isElectron(): boolean;
|
|
21
|
+
/** Headless client without access to DOM */
|
|
22
|
+
get isHeadless(): boolean;
|
|
23
|
+
/** Running inside an iframe */
|
|
24
|
+
get isIframe(): boolean;
|
|
25
|
+
/** Running on a mobile device */
|
|
26
|
+
get isMobile(): boolean;
|
|
27
|
+
private _isPwa?;
|
|
28
|
+
/** Running as a PWA */
|
|
29
|
+
get isPwa(): boolean;
|
|
16
30
|
private _platform?;
|
|
17
31
|
/** Get the current platform type */
|
|
18
32
|
get platform(): Platform;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
private _pwa?;
|
|
22
|
-
/** Check if running as a PWA */
|
|
23
|
-
get pwa(): boolean;
|
|
24
|
-
constructor(api: Api, settings: Settings);
|
|
33
|
+
get storage(): boolean;
|
|
34
|
+
constructor(momentum: Momentum);
|
|
25
35
|
/**
|
|
26
36
|
* Inject the client theme settings, meta tags & PWA prompt
|
|
27
37
|
* @param opts Injection options: reload - use cached settings or reload; pwa - disabled auto pwa prompt
|
|
28
38
|
* @return {Promise<void>} Resolves on completion
|
|
29
39
|
*/
|
|
30
|
-
|
|
40
|
+
inject(opts?: {
|
|
41
|
+
install?: boolean;
|
|
31
42
|
reload?: boolean;
|
|
32
|
-
|
|
33
|
-
|
|
43
|
+
}): Promise<{
|
|
44
|
+
[key: string]: any;
|
|
45
|
+
}>;
|
|
34
46
|
/**
|
|
35
|
-
*
|
|
36
|
-
* @param
|
|
47
|
+
* Get current network speed
|
|
48
|
+
* @param {boolean} format false = number (bytes-per-second), true = formated string
|
|
49
|
+
* @returns {Promise<number | string>}
|
|
37
50
|
*/
|
|
38
|
-
|
|
51
|
+
networkSpeed(format: true): Promise<string>;
|
|
52
|
+
networkSpeed(format?: false): Promise<number>;
|
|
39
53
|
/**
|
|
40
|
-
*
|
|
41
|
-
* @
|
|
54
|
+
* Create an installation prompt popup
|
|
55
|
+
* @param platform Platform specific prompt, leave blank to auto-detect
|
|
42
56
|
*/
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
|
|
46
|
-
* @return {Promise<void>} Resolves on success
|
|
47
|
-
*/
|
|
48
|
-
disableNotifications(): Promise<void>;
|
|
57
|
+
install(platform?: Platform): Promise<unknown>;
|
|
58
|
+
/** Update service worker & other tabs */
|
|
59
|
+
update(): void;
|
|
49
60
|
}
|
|
50
61
|
//# sourceMappingURL=client.d.ts.map
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AACpC,OAAO,EAAC,gBAAgB,EAAM,MAAM,QAAQ,CAAA;AAE5C,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,KAAK,GAAG,KAAK,GAAG,OAAO,GAAG,SAAS,CAAC;AAEnF,6BAA6B;AAC7B,qBAAa,MAAO,SAAQ,gBAAgB;IAmE/B,SAAS,CAAC,QAAQ,EAAE,QAAQ;IAlExC,OAAO,CAAC,OAAO,CAAiB;IAChC,OAAO,CAAC,eAAe,CAAC,CAAM;IAC9B,OAAO,CAAC,KAAK,CAAmB;IAChC,OAAO,CAAC,QAAQ,CAAS;IAEzB,IAAI,SAAS,IAAI,SAAS,GAAG,OAAO,GAAG,KAAK,CAAiC;IAC7E,IAAI,YAAY,IAAI,MAAM,CAA+B;IAEzD,wBAAwB;IACxB,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC,OAAO,CAAC,CAYnC;IAEH,oCAAoC;IACpC,IAAI,UAAU,IAAI,OAAO,CAAmC;IAE5D,iCAAiC;IACjC,IAAI,KAAK,IAAI,OAAO,CAA2D;IAE/E,qCAAqC;IACrC,IAAI,UAAU,IAAI,OAAO,CAAgD;IAEzE,4CAA4C;IAC5C,IAAI,UAAU,IAAI,OAAO,CAAyC;IAElE,+BAA+B;IAC/B,IAAI,QAAQ,IAAI,OAAO,CAAyC;IAEhE,iCAAiC;IACjC,IAAI,QAAQ,IAAI,OAAO,CAAuD;IAE9E,OAAO,CAAC,MAAM,CAAC,CAAU;IACzB,uBAAuB;IACvB,IAAI,KAAK,IAAI,OAAO,CAInB;IAED,OAAO,CAAC,SAAS,CAAC,CAAW;IAC7B,oCAAoC;IACpC,IAAI,QAAQ,IAAI,QAAQ,CAWvB;IAED,IAAI,OAAO,YAAiD;gBAEtC,QAAQ,EAAE,QAAQ;IAyBxC;;;;OAIG;IACG,MAAM,CAAC,IAAI,GAAE;QAAC,OAAO,CAAC,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,OAAO,CAAA;KAAM,GAAG,OAAO,CAAC;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAC,CAAC;IA+F7F;;;;OAIG;IACH,YAAY,CAAC,MAAM,EAAE,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC;IAC3C,YAAY,CAAC,MAAM,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC;IAO7C;;;OAGG;IACG,OAAO,CAAC,QAAQ,GAAE,QAAwB;IAqGhD,yCAAyC;IACzC,MAAM;CAUN"}
|
package/dist/core.d.ts
CHANGED
|
@@ -1,33 +1,57 @@
|
|
|
1
|
-
|
|
1
|
+
/** Communication method */
|
|
2
|
+
export type AlertMethod = 'call' | 'email' | 'notification' | 'sms';
|
|
3
|
+
/** Alert */
|
|
4
|
+
export type Alert = {
|
|
5
|
+
/** Triggering event */
|
|
6
|
+
event: string;
|
|
7
|
+
/** Notify via methods */
|
|
8
|
+
method: AlertMethod[];
|
|
9
|
+
/** Notification name/title */
|
|
10
|
+
message: Omit<Message, 'to'> & {
|
|
11
|
+
/** Include link */
|
|
12
|
+
link?: string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
/** Excel formula column type */
|
|
16
|
+
export type Formula = string | any;
|
|
17
|
+
/** Link column type */
|
|
18
|
+
export type Link = string;
|
|
2
19
|
/** Metadata model */
|
|
3
20
|
export type Meta = {
|
|
4
21
|
/** Document ID */
|
|
5
|
-
_id?: string | any;
|
|
22
|
+
readonly _id?: string | any;
|
|
6
23
|
/** Creator username */
|
|
7
|
-
_createdBy
|
|
24
|
+
readonly _createdBy?: string | null;
|
|
8
25
|
/** Created timestamp */
|
|
9
|
-
_createdDate
|
|
26
|
+
readonly _createdDate?: Date | null;
|
|
10
27
|
/** Modifier username */
|
|
11
|
-
_updatedBy
|
|
28
|
+
readonly _updatedBy?: string | null;
|
|
12
29
|
/** Modified timestamp */
|
|
13
|
-
_updatedDate
|
|
30
|
+
readonly _updatedDate?: Date | null;
|
|
14
31
|
};
|
|
15
|
-
/**
|
|
16
|
-
export type
|
|
17
|
-
/**
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
32
|
+
/** SMS or Phone call message */
|
|
33
|
+
export type Message = {
|
|
34
|
+
/** Message recipients */
|
|
35
|
+
to: string | string[];
|
|
36
|
+
/** Message subject/title */
|
|
37
|
+
subject?: string;
|
|
38
|
+
/** Leave blank or specify a from address if there are options */
|
|
39
|
+
from?: string;
|
|
40
|
+
/** Message body */
|
|
41
|
+
body: string;
|
|
42
|
+
};
|
|
43
|
+
/** Saved message log */
|
|
44
|
+
export type MessageLog<T> = {
|
|
45
|
+
/** Message UID */
|
|
46
|
+
readonly _id: string;
|
|
47
|
+
/** Sent timestamp */
|
|
48
|
+
readonly _createdBy: string | null;
|
|
49
|
+
/** Message initiator */
|
|
50
|
+
readonly _createdDate: Date;
|
|
51
|
+
/** Message body */
|
|
52
|
+
message: T;
|
|
29
53
|
};
|
|
30
|
-
export type
|
|
54
|
+
export { type IPathEventEmitter, PE, PES, PathEvent, type PathListener, type PathUnsubscribe, PathEventEmitter } from '@ztimson/utils';
|
|
31
55
|
/** Recursive type for defining tree data */
|
|
32
56
|
export type TreeNode<T> = T & {
|
|
33
57
|
/** Name of node */
|
|
@@ -35,4 +59,9 @@ export type TreeNode<T> = T & {
|
|
|
35
59
|
/** Node children */
|
|
36
60
|
children: TreeNode<T>[];
|
|
37
61
|
};
|
|
62
|
+
export { type Unsubscribe } from '@ztimson/utils';
|
|
63
|
+
export declare function treeBuilder<T extends {
|
|
64
|
+
path: string;
|
|
65
|
+
}>(schemas: T[]): TreeNode<T>[];
|
|
66
|
+
export declare function validEvent(event: string): boolean;
|
|
38
67
|
//# sourceMappingURL=core.d.ts.map
|
package/dist/core.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,OAAO,GAAG,cAAc,GAAG,KAAK,CAAC;AAEpE,YAAY;AACZ,MAAM,MAAM,KAAK,GAAG;IACnB,uBAAuB;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,yBAAyB;IACzB,MAAM,EAAE,WAAW,EAAE,CAAC;IACtB,8BAA8B;IAC9B,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,GAAG;QAC9B,mBAAmB;QACnB,IAAI,CAAC,EAAE,MAAM,CAAC;KACd,CAAC;CACF,CAAA;AAED,gCAAgC;AAChC,MAAM,MAAM,OAAO,GAAG,MA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4C;AAC5C,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG;IAC7B,mBAAmB;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,oBAAoB;IACpB,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;CACxB,CAAC;AAEF,OAAO,EAAC,KAAK,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAEhD,wBAAgB,WAAW,CAAC,CAAC,SAAS;IAAC,IAAI,EAAE,MAAM,CAAA;CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,GAAG,QAAQ,CAAC,CAAC,CAAC,EAAE,CA0CjF;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,WAMvC"}
|
package/dist/data.d.ts
CHANGED
|
@@ -1,91 +1,73 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Meta,
|
|
3
|
-
import {
|
|
1
|
+
import { Unsubscribe } from '@ztimson/utils';
|
|
2
|
+
import { Meta, PathEventEmitter } from './core';
|
|
3
|
+
import { Momentum } from './momentum';
|
|
4
|
+
/** Generic MongoDB document */
|
|
4
5
|
export type Document<T> = Meta & T;
|
|
6
|
+
/** Raw MongoDB query */
|
|
5
7
|
export type RawQuery = {
|
|
6
|
-
|
|
8
|
+
/** Query operation type */
|
|
9
|
+
operand: 'delete' | 'deleteOne' | 'find' | 'findOne' | 'insertOne' | 'replaceOne' | 'update' | 'updateOne';
|
|
10
|
+
/** Filter affected documents */
|
|
7
11
|
filter?: any;
|
|
12
|
+
/** Query */
|
|
8
13
|
data?: any;
|
|
14
|
+
/** MongoDB operation options */
|
|
9
15
|
options?: any;
|
|
16
|
+
/** Return document count */
|
|
10
17
|
count?: boolean;
|
|
11
18
|
};
|
|
12
|
-
|
|
13
|
-
/** Collection path/name */
|
|
14
|
-
path: string;
|
|
15
|
-
/** Description of data */
|
|
16
|
-
description?: string;
|
|
17
|
-
/** Associated form for viewing/editing */
|
|
18
|
-
form?: string;
|
|
19
|
-
/** Hide columns */
|
|
20
|
-
hide?: string[];
|
|
21
|
-
/** Lock collection from changes */
|
|
22
|
-
lock?: boolean;
|
|
23
|
-
/** Data must match defined columns */
|
|
24
|
-
strict?: boolean;
|
|
25
|
-
/** Allow updates to create row if missing */
|
|
26
|
-
upsert?: boolean;
|
|
27
|
-
/** Defined fields */
|
|
28
|
-
columns?: SchemaColumn[];
|
|
29
|
-
};
|
|
30
|
-
export type SchemaColumn = {
|
|
31
|
-
/** Display label */
|
|
32
|
-
label: string;
|
|
33
|
-
/** Property key */
|
|
34
|
-
prop: string;
|
|
35
|
-
/** Variable type */
|
|
36
|
-
type?: 'any' | 'boolean' | 'formula' | 'javascript' | 'link' | 'number' | 'string' | 'timestamp';
|
|
37
|
-
/** Display formating */
|
|
38
|
-
format?: any;
|
|
39
|
-
/** Default value */
|
|
40
|
-
default?: any;
|
|
41
|
-
/** Must have value */
|
|
42
|
-
required?: boolean;
|
|
43
|
-
/** Style */
|
|
44
|
-
style: SchemaColumnStyle;
|
|
45
|
-
};
|
|
46
|
-
export type SchemaColumnStyle = {
|
|
47
|
-
/** Align column content */
|
|
48
|
-
align?: 'center' | 'left' | 'right';
|
|
49
|
-
/** Background color */
|
|
50
|
-
background?: string;
|
|
51
|
-
/** Bold column text */
|
|
52
|
-
bold?: boolean;
|
|
53
|
-
/** Column text color */
|
|
54
|
-
color?: string;
|
|
55
|
-
/** Italicize column text */
|
|
56
|
-
italics?: boolean;
|
|
57
|
-
/** Strikethrough column text */
|
|
58
|
-
strike?: boolean;
|
|
59
|
-
/** Underline column text */
|
|
60
|
-
underline?: boolean;
|
|
61
|
-
/** Column width */
|
|
62
|
-
width?: string;
|
|
63
|
-
/** Conditional formating */
|
|
64
|
-
conditional: (Omit<SchemaColumnStyle, 'conditional'> & {
|
|
65
|
-
condition: string;
|
|
66
|
-
})[];
|
|
67
|
-
};
|
|
68
|
-
declare class Schemas extends PathEventEmitter {
|
|
69
|
-
private api;
|
|
70
|
-
constructor(api: Api);
|
|
71
|
-
delete(path: string): PromiseProgress<any>;
|
|
72
|
-
read(tree?: false): Promise<Schema[]>;
|
|
73
|
-
read(tree: true): Promise<TreeNode<Schema>[]>;
|
|
74
|
-
read(path: string): Promise<Schema>;
|
|
75
|
-
update(schema: Partial<Schema> & {
|
|
76
|
-
path: string;
|
|
77
|
-
}): PromiseProgress<Schema>;
|
|
78
|
-
}
|
|
19
|
+
/** Create custom data collections */
|
|
79
20
|
export declare class Data extends PathEventEmitter {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
21
|
+
protected momentum: Momentum;
|
|
22
|
+
protected readonly subscribers: {
|
|
23
|
+
[key: string]: Unsubscribe;
|
|
24
|
+
};
|
|
25
|
+
constructor(momentum: Momentum);
|
|
26
|
+
/**
|
|
27
|
+
* Create new document in collection
|
|
28
|
+
* @param {string} collection Target collection
|
|
29
|
+
* @param {Document<T>} document New document
|
|
30
|
+
* @return {Promise<Document<T>>} New saved document
|
|
31
|
+
*/
|
|
83
32
|
create<T>(collection: string, document: Document<T>): Promise<Document<T>>;
|
|
84
|
-
|
|
33
|
+
/**
|
|
34
|
+
* Delete document from collection
|
|
35
|
+
* @param {string} collection Target collection
|
|
36
|
+
* @param {number} id Document ID
|
|
37
|
+
* @return {Promise<void>} Returns once complete
|
|
38
|
+
*/
|
|
39
|
+
delete(collection: string, id: number): Promise<number>;
|
|
40
|
+
/**
|
|
41
|
+
* Read collection/document
|
|
42
|
+
* @param {string} collection target collection/document
|
|
43
|
+
* @return {Promise<T[] | T>} Found collection of documents
|
|
44
|
+
*/
|
|
85
45
|
read<T extends Meta>(collection: string): Promise<T[]>;
|
|
86
46
|
read<T extends Meta>(collection: string, id: number): Promise<T>;
|
|
47
|
+
/**
|
|
48
|
+
* Update document in collection
|
|
49
|
+
* @param {string} collection Target collection
|
|
50
|
+
* @param {Document<T>} document Document to update
|
|
51
|
+
* @param {boolean} append Append or replace existing document
|
|
52
|
+
* @return {Promise<Document<T>>} New saved document
|
|
53
|
+
*/
|
|
87
54
|
update<T>(collection: string, document: Document<T>, append?: boolean): Promise<Document<T>>;
|
|
88
|
-
|
|
55
|
+
/**
|
|
56
|
+
* Create raw MongoDB query
|
|
57
|
+
* @param {string} collection Target collection name
|
|
58
|
+
* @param {RawQuery} query Raw query
|
|
59
|
+
* @return {Promise<any>} Query response
|
|
60
|
+
*/
|
|
61
|
+
raw<T>(collection: string, query: RawQuery): Promise<any>;
|
|
62
|
+
/**
|
|
63
|
+
* Subscribe to live updates with callback
|
|
64
|
+
* @param path Path to data
|
|
65
|
+
* @param {(value: T[]) => any | null} callback Received changes
|
|
66
|
+
* @param opts Reload data immediately
|
|
67
|
+
* @return {() => void} Function to unsubscribe
|
|
68
|
+
*/
|
|
69
|
+
sync<T>(path: string, callback: ((value: T | T[]) => any), opts?: {
|
|
70
|
+
reload?: boolean;
|
|
71
|
+
}): Unsubscribe;
|
|
89
72
|
}
|
|
90
|
-
export {};
|
|
91
73
|
//# 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,
|
|
1
|
+
{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../src/data.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAC,KAAK,IAAI,EAAE,gBAAgB,EAAM,MAAM,QAAQ,CAAC;AACxD,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AAEpC,+BAA+B;AAC/B,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,IAAI,GAAG,CAAC,CAAC;AAEnC,wBAAwB;AACxB,MAAM,MAAM,QAAQ,GAAG;IACtB,2BAA2B;IAC3B,OAAO,EAAE,QAAQ,GAAG,WAAW,GAAG,MAAM,GAAG,SAAS,GAAG,WAAW,GAAG,YAAY,GAAG,QAAQ,GAAG,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