@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/logger.d.ts
CHANGED
|
@@ -1,46 +1,27 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { LOG_LEVEL, PathEvent, Unsubscribe } from '@ztimson/utils';
|
|
2
|
+
import { PathEventEmitter } from './core';
|
|
3
|
+
import { Momentum } from './momentum';
|
|
4
|
+
/** Log levels */
|
|
3
5
|
export type LogLevel = 'ERROR' | 'WARN' | 'INFO' | 'LOG' | 'DEBUG' | 'NONE';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
/** Log */
|
|
7
|
+
export type Log<T = any> = {
|
|
8
|
+
/** Time log was created */
|
|
9
|
+
readonly time?: Date;
|
|
10
|
+
/** Log level */
|
|
11
|
+
readonly level: LOG_LEVEL;
|
|
12
|
+
/** Logged data */
|
|
13
|
+
readonly log: any;
|
|
14
|
+
/** Log context information */
|
|
15
|
+
readonly ctx?: T;
|
|
9
16
|
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
ip: string;
|
|
14
|
-
cores: number | 'Unknown';
|
|
15
|
-
mem: number | 'Unknown';
|
|
16
|
-
res: [number, number];
|
|
17
|
-
ua: string | {
|
|
18
|
-
ua: string;
|
|
19
|
-
browser: {
|
|
20
|
-
name: string;
|
|
21
|
-
version: string;
|
|
22
|
-
major: string;
|
|
23
|
-
};
|
|
24
|
-
cpu: {
|
|
25
|
-
architecture: string;
|
|
26
|
-
};
|
|
27
|
-
device: {
|
|
28
|
-
mode?: string;
|
|
29
|
-
type?: string;
|
|
30
|
-
};
|
|
31
|
-
engine: {
|
|
32
|
-
name: string;
|
|
33
|
-
version: string;
|
|
34
|
-
};
|
|
35
|
-
os: {
|
|
36
|
-
name: string;
|
|
37
|
-
version: string;
|
|
38
|
-
};
|
|
39
|
-
};
|
|
40
|
-
}>;
|
|
17
|
+
/** New Log context */
|
|
18
|
+
export type CreateLog = Log<string>;
|
|
19
|
+
/** Publish logs to server */
|
|
41
20
|
export declare class Logger extends PathEventEmitter {
|
|
21
|
+
protected momentum: Momentum;
|
|
22
|
+
private static cache;
|
|
42
23
|
readonly channel: string;
|
|
43
|
-
|
|
24
|
+
readonly logLevel: LogLevel;
|
|
44
25
|
console: {
|
|
45
26
|
debug: {
|
|
46
27
|
(...data: any[]): void;
|
|
@@ -63,16 +44,65 @@ export declare class Logger extends PathEventEmitter {
|
|
|
63
44
|
(message?: any, ...optionalParams: any[]): void;
|
|
64
45
|
};
|
|
65
46
|
};
|
|
66
|
-
|
|
47
|
+
logs: Log[];
|
|
48
|
+
constructor(momentum: Momentum);
|
|
67
49
|
private buildLog;
|
|
68
50
|
private create;
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
51
|
+
/**
|
|
52
|
+
* Get available channels
|
|
53
|
+
* @return {Promise<string[]>} List of channel names
|
|
54
|
+
*/
|
|
55
|
+
channels(): Promise<string[]>;
|
|
56
|
+
/**
|
|
57
|
+
* Clear logs in channel
|
|
58
|
+
* @param {string} channel Channel to clear
|
|
59
|
+
* @return {Promise<number>} Reruns once complete
|
|
60
|
+
*/
|
|
61
|
+
delete(channel: string): Promise<number>;
|
|
62
|
+
/**
|
|
63
|
+
* Read logs from channel
|
|
64
|
+
* @param {string} channel Channel name
|
|
65
|
+
* @return {Promise<Log[]>} Logs in channel
|
|
66
|
+
*/
|
|
67
|
+
read(channel: string): Promise<Log[]>;
|
|
68
|
+
sync(channel: string, callback?: ((event: PathEvent, value: any) => any) | null, opts?: {
|
|
69
|
+
path?: string;
|
|
70
|
+
reload?: boolean;
|
|
71
|
+
}): Unsubscribe;
|
|
72
|
+
/**
|
|
73
|
+
* Create debug log
|
|
74
|
+
* @param log What you want to log
|
|
75
|
+
* @param {string} channel Channel to publish log to
|
|
76
|
+
* @return {Promise<void>} Log saved
|
|
77
|
+
*/
|
|
78
|
+
debug(log: any, channel?: string): void;
|
|
79
|
+
/**
|
|
80
|
+
* Create regular log
|
|
81
|
+
* @param log What you want to log
|
|
82
|
+
* @param {string} channel Channel to publish log to
|
|
83
|
+
* @return {Promise<void>} Log saved
|
|
84
|
+
*/
|
|
85
|
+
log(log: any, channel?: string): void;
|
|
86
|
+
/**
|
|
87
|
+
* Create info log
|
|
88
|
+
* @param log What you want to log
|
|
89
|
+
* @param {string} channel Channel to publish log to
|
|
90
|
+
* @return {Promise<void>} Log saved
|
|
91
|
+
*/
|
|
92
|
+
info(log: any, channel?: string): void;
|
|
93
|
+
/**
|
|
94
|
+
* Create warning log
|
|
95
|
+
* @param log What you want to log
|
|
96
|
+
* @param {string} channel Channel to publish log to
|
|
97
|
+
* @return {Promise<void>} Log saved
|
|
98
|
+
*/
|
|
99
|
+
warn(log: any, channel?: string): void;
|
|
100
|
+
/**
|
|
101
|
+
* Create error log
|
|
102
|
+
* @param log What you want to log
|
|
103
|
+
* @param {string} channel Channel to publish log to
|
|
104
|
+
* @return {Promise<void>} Log saved
|
|
105
|
+
*/
|
|
106
|
+
error(log: any, channel?: string): void;
|
|
77
107
|
}
|
|
78
108
|
//# sourceMappingURL=logger.d.ts.map
|
package/dist/logger.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAa,SAAS,EAAE,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAC5E,OAAO,EAAC,gBAAgB,EAAK,MAAM,QAAQ,CAAC;AAC5C,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AAEpC,iBAAiB;AACjB,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,MAAM,CAAC;AAE5E,UAAU;AACV,MAAM,MAAM,GAAG,CAAC,CAAC,GAAG,GAAG,IAAI;IAC1B,2BAA2B;IAC3B,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC;IACrB,gBAAgB;IAChB,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAC1B,kBAAkB;IAClB,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC;IAClB,8BAA8B;IAC9B,QAAQ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IAO7C;;;;;OAKG;IACH,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,GAAE,MAAqB;IAO7C;;;;;OAKG;IACH,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,GAAE,MAAqB;CAM9C"}
|
package/dist/momentum.d.ts
CHANGED
|
@@ -1,53 +1,107 @@
|
|
|
1
|
+
import { Database, HttpDefaults } from '@ztimson/utils';
|
|
1
2
|
import { Actions } from './actions';
|
|
2
3
|
import { Ai } from './ai';
|
|
3
4
|
import { Analytics } from './analytics';
|
|
4
|
-
import { Api
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { Api } from './api';
|
|
6
|
+
import { Audit } from './audit';
|
|
7
|
+
import { Auth } from './auth';
|
|
8
|
+
import { Call } from './call';
|
|
9
|
+
import { Discounts } from './discounts';
|
|
7
10
|
import { Email } from './email';
|
|
11
|
+
import { Notifications } from './notifications';
|
|
12
|
+
import { Data } from './data';
|
|
8
13
|
import { Forms } from './forms';
|
|
9
14
|
import { Groups } from './groups';
|
|
10
|
-
import { PathEventEmitter } from '@ztimson/utils';
|
|
11
15
|
import { Logger, LogLevel } from './logger';
|
|
12
|
-
import {
|
|
16
|
+
import { Routes } from './routes';
|
|
17
|
+
import { Templates } from './templates';
|
|
18
|
+
import { Transactions } from './transactions';
|
|
13
19
|
import { Pdf } from './pdf';
|
|
14
|
-
import {
|
|
20
|
+
import { Products } from './products';
|
|
21
|
+
import { Schemas } from './schemas';
|
|
22
|
+
import { Sms } from './sms';
|
|
15
23
|
import { Socket } from './sockets';
|
|
16
24
|
import { Storage } from './storage';
|
|
17
25
|
import { Client } from './client';
|
|
26
|
+
import { Tokens } from './tokens';
|
|
18
27
|
import { Users } from './users';
|
|
19
28
|
import { Settings } from './settings';
|
|
20
29
|
import { Static } from './static';
|
|
21
|
-
|
|
30
|
+
import { PathEvent, PathEventEmitter } from './core';
|
|
31
|
+
import { WebRtc } from './webRtc';
|
|
32
|
+
export type MomentumOptions = {
|
|
22
33
|
/** Name of application for logging */
|
|
23
|
-
app
|
|
24
|
-
/**
|
|
25
|
-
|
|
34
|
+
app: string;
|
|
35
|
+
/** Track analytics (anonymous - Force collect anonymously, force - force tracking without anonymity, prompt - track anonymously but ask for more permission, manual - allow tracking if manually enabled, false - disable all tracking) */
|
|
36
|
+
analytics: 'anonymous' | 'force' | 'prompt' | 'manual' | false;
|
|
37
|
+
/** Display console banner */
|
|
38
|
+
banner: boolean;
|
|
39
|
+
/** URL to checkout page */
|
|
40
|
+
checkoutUrl: string;
|
|
41
|
+
/** How to pass credentials to api */
|
|
42
|
+
credentialsStrategy: 'auto' | 'cookie' | 'header';
|
|
43
|
+
/** What to do on 401 errors */
|
|
44
|
+
expiredStrategy: 'ignore' | 'logout' | 'reload';
|
|
45
|
+
/** Set HTTP defaults for all API calls */
|
|
46
|
+
http?: HttpDefaults;
|
|
47
|
+
/** Install prompt frequency */
|
|
48
|
+
installPrompt: {
|
|
49
|
+
/** Prompt to install after X minutes */
|
|
50
|
+
delay: number;
|
|
51
|
+
/** Ask again after X days */
|
|
52
|
+
retry: number;
|
|
53
|
+
};
|
|
54
|
+
/** Automatically save console events that meet loglevel */
|
|
55
|
+
logLevel: LogLevel;
|
|
56
|
+
/** Path to login page */
|
|
57
|
+
loginUrl: string;
|
|
58
|
+
/** Enable offline support */
|
|
59
|
+
offline: boolean;
|
|
60
|
+
/** Persist user token & settings between sessions */
|
|
61
|
+
persist: boolean;
|
|
26
62
|
/** Connect to socket for live updates */
|
|
27
|
-
socket
|
|
63
|
+
socket: boolean;
|
|
28
64
|
/** URL to web worker or false to disable */
|
|
29
|
-
worker
|
|
65
|
+
worker: string | false;
|
|
30
66
|
};
|
|
31
67
|
export declare class Momentum extends PathEventEmitter {
|
|
68
|
+
static readonly pathEvent: typeof PathEvent;
|
|
69
|
+
static readonly version: string;
|
|
70
|
+
readonly pathEvent: typeof PathEvent;
|
|
71
|
+
readonly version: string;
|
|
72
|
+
readonly opts: MomentumOptions;
|
|
73
|
+
readonly url: URL;
|
|
32
74
|
api: Api;
|
|
33
75
|
actions: Actions;
|
|
34
76
|
ai: Ai;
|
|
35
77
|
analytics: Analytics;
|
|
78
|
+
audit: Audit;
|
|
36
79
|
auth: Auth;
|
|
80
|
+
call: Call;
|
|
37
81
|
client: Client;
|
|
38
82
|
data: Data;
|
|
83
|
+
database: Database;
|
|
84
|
+
discounts: Discounts;
|
|
39
85
|
email: Email;
|
|
40
86
|
forms: Forms;
|
|
41
87
|
groups: Groups;
|
|
42
88
|
logger: Logger;
|
|
43
|
-
|
|
44
|
-
phone: Phone;
|
|
89
|
+
notifications: Notifications;
|
|
45
90
|
pdf: Pdf;
|
|
91
|
+
products: Products;
|
|
92
|
+
routes: Routes;
|
|
93
|
+
schemas: Schemas;
|
|
46
94
|
settings: Settings;
|
|
95
|
+
sms: Sms;
|
|
47
96
|
socket?: Socket;
|
|
48
97
|
static: Static;
|
|
49
98
|
storage: Storage;
|
|
99
|
+
templates: Templates;
|
|
100
|
+
tokens: Tokens;
|
|
101
|
+
transactions: Transactions;
|
|
50
102
|
users: Users;
|
|
51
|
-
|
|
103
|
+
webRtc: WebRtc;
|
|
104
|
+
get banner(): string;
|
|
105
|
+
constructor(url?: string, opts?: Partial<MomentumOptions>);
|
|
52
106
|
}
|
|
53
107
|
//# sourceMappingURL=momentum.d.ts.map
|
package/dist/momentum.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"momentum.d.ts","sourceRoot":"","sources":["../src/momentum.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAClC,OAAO,EAAC,EAAE,EAAC,MAAM,MAAM,CAAC;AACxB,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AACtC,OAAO,EAAC,GAAG,
|
|
1
|
+
{"version":3,"file":"momentum.d.ts","sourceRoot":"","sources":["../src/momentum.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,Q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AO,CAAC,eAAe,CAAM;CAgH9E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"momentum.worker.d.mts","sourceRoot":"","sources":["../src/momentum.worker.mjs"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import {Momentum} from '/momentum.mjs';
|
|
2
|
+
|
|
3
|
+
const production = self.location.origin !== 'http://localhost:5173';
|
|
4
|
+
const apiUrl = production ? self.location.origin : 'http://localhost:3000';
|
|
5
|
+
const momentum = new Momentum(apiUrl, {
|
|
6
|
+
analytics: false,
|
|
7
|
+
banner: false,
|
|
8
|
+
offline: true,
|
|
9
|
+
socket: true,
|
|
10
|
+
worker: false,
|
|
11
|
+
});
|
|
12
|
+
const cache = caches.open(apiUrl);
|
|
13
|
+
|
|
14
|
+
async function reloadClients() {
|
|
15
|
+
const allClients = await self.clients.matchAll({ type: 'window', includeUncontrolled: true });
|
|
16
|
+
for (const client of allClients) {
|
|
17
|
+
client.postMessage({ update: true });
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
async function update() {
|
|
22
|
+
const c = await cache;
|
|
23
|
+
let files = await momentum.static.all();
|
|
24
|
+
// files.map(meta => momentum.static.open(meta.path, false));
|
|
25
|
+
// for (const file of files) {
|
|
26
|
+
// const req = new Request(file.path, {cache: 'no-cache'});
|
|
27
|
+
// try {
|
|
28
|
+
// const res = await fetch(req);
|
|
29
|
+
// if (res.ok) await c.put(req, res);
|
|
30
|
+
// else throw new Error();
|
|
31
|
+
// } catch (err) {
|
|
32
|
+
// await c.delete(req);
|
|
33
|
+
// }
|
|
34
|
+
// }
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
self.addEventListener('install', e => e.waitUntil(update()));
|
|
38
|
+
|
|
39
|
+
self.addEventListener('periodicsync', e => e.waitUntil(update()));
|
|
40
|
+
|
|
41
|
+
self.addEventListener('activate', e => {
|
|
42
|
+
e.waitUntil((async () => {
|
|
43
|
+
await self.clients.claim();
|
|
44
|
+
await reloadClients();
|
|
45
|
+
})());
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
// self.addEventListener('fetch', (event) => {
|
|
49
|
+
// const req = event.request;
|
|
50
|
+
// // Only cache static momentum assets
|
|
51
|
+
// if(!req.url.startsWith(momentum.url.origin) || req.url.startsWith(momentum.url.origin + 'api') || req.method !== 'GET') return;
|
|
52
|
+
//
|
|
53
|
+
// event.respondWith((async () => {
|
|
54
|
+
// const c = await cache;
|
|
55
|
+
// if(!self.navigator.onLine) {
|
|
56
|
+
// const cachedResponse = await c.match(req);
|
|
57
|
+
// if(cachedResponse) return cachedResponse;
|
|
58
|
+
// return new Response('You are offline', {status: 503, statusText: 'Service Unavailable'});
|
|
59
|
+
// }
|
|
60
|
+
// try {
|
|
61
|
+
// const response = await fetch(req);
|
|
62
|
+
// if(response.ok) await c.put(req, response.clone());
|
|
63
|
+
// else if(response.status === 404) await c.delete(req);
|
|
64
|
+
// return response;
|
|
65
|
+
// } catch (err) {
|
|
66
|
+
// const cachedResponse = await c.match(req);
|
|
67
|
+
// if(cachedResponse) return cachedResponse;
|
|
68
|
+
// throw err;
|
|
69
|
+
// }
|
|
70
|
+
// })());
|
|
71
|
+
// });
|
|
72
|
+
|
|
73
|
+
self.addEventListener('message', async (event) => {
|
|
74
|
+
if (event.data?.skipWaiting) {
|
|
75
|
+
await self.skipWaiting();
|
|
76
|
+
} else if (event.data?.update) {
|
|
77
|
+
if (self.registration.waiting) {
|
|
78
|
+
self.registration.waiting.postMessage({skipWaiting: true});
|
|
79
|
+
} else {
|
|
80
|
+
await reloadClients();
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
self.addEventListener('notificationclick', (event) => {
|
|
86
|
+
const data = event.notification.data;
|
|
87
|
+
event.notification.close();
|
|
88
|
+
if(data && data.link) event.waitUntil(clients.openWindow(data.link));
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
self.addEventListener('push', async (event) => {
|
|
92
|
+
let data;
|
|
93
|
+
try { data = event.data?.json() ?? {}; }
|
|
94
|
+
catch { data = {message: event.data?.text()}; }
|
|
95
|
+
event.waitUntil(
|
|
96
|
+
self.registration.showNotification(data.title || `Momentum Alert`, {
|
|
97
|
+
body: data.message || '',
|
|
98
|
+
tag: data.title || 'general',
|
|
99
|
+
icon: data.icon || `${self.location.origin}/favicon.ico`,
|
|
100
|
+
data
|
|
101
|
+
})
|
|
102
|
+
);
|
|
103
|
+
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Message, PathEventEmitter } from './core';
|
|
2
|
+
import { Momentum } from './momentum';
|
|
3
|
+
/** Push notification */
|
|
4
|
+
export type Notification = Message & {
|
|
5
|
+
/** Message recipients, null for everyone */
|
|
6
|
+
to?: string | string[] | null;
|
|
7
|
+
/** Message subject/title */
|
|
8
|
+
subject?: string;
|
|
9
|
+
/** Open link on interaction */
|
|
10
|
+
link?: string | null;
|
|
11
|
+
};
|
|
12
|
+
/** Send messages */
|
|
13
|
+
export declare class Notifications extends PathEventEmitter {
|
|
14
|
+
protected momentum: Momentum;
|
|
15
|
+
private _enabled;
|
|
16
|
+
/** Are notifications enabled */
|
|
17
|
+
get enabled(): boolean;
|
|
18
|
+
private set enabled(value);
|
|
19
|
+
/** Get Push Subscription info */
|
|
20
|
+
get subscription(): Promise<PushSubscription | null>;
|
|
21
|
+
constructor(momentum: Momentum);
|
|
22
|
+
/**
|
|
23
|
+
* Send a notification
|
|
24
|
+
* @param {Notification} notification Notification that will be sent to user
|
|
25
|
+
* @return {Promise<void>} Returns once complete
|
|
26
|
+
*/
|
|
27
|
+
create(notification: Notification): Promise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* Disable device notifications
|
|
30
|
+
* @return {Promise<void>} Resolves on success
|
|
31
|
+
*/
|
|
32
|
+
disable(): Promise<void>;
|
|
33
|
+
/**
|
|
34
|
+
* Enable device notifications
|
|
35
|
+
* @return {Promise<null>} Resolves on success
|
|
36
|
+
*/
|
|
37
|
+
enable(): Promise<null>;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=notifications.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notifications.d.ts","sourceRoot":"","sources":["../src/notifications.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,gBAAgB,EAAM,MAAM,QAAQ,CAAC;AACtD,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AAEpC,wBAAwB;AACxB,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG;IACpC,4CAA4C;IAC5C,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CAAC;IAC9B,4BAA4B;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,+BAA+B;IAC/B,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CACpB,CAAA;AAED,oBAAoB;AACpB,qBAAa,aAAc,SAAQ,gBAAgB;IAetC,SAAS,CAAC,QAAQ,EAAE,QAAQ;IAdxC,OAAO,CAAC,QAAQ,CAAS;IACzB,gCAAgC;IAChC,IAAI,OAAO,IAAI,OAAO,CAA0B;IAChD,OAAO,KAAK,OAAO,QAGlB;IAED,iCAAiC;IACjC,IAAI,YAAY,IAAI,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAGnD;gBAEqB,QAAQ,EAAE,QAAQ;IAKxC;;;;OAIG;IACH,MAAM,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAOjD;;;OAGG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAQ9B;;;OAGG;IACG,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;CAa7B"}
|
package/dist/pdf.d.ts
CHANGED
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { PathEventEmitter } from './core';
|
|
2
|
+
import { Momentum } from './momentum';
|
|
3
|
+
import { RenderTemplate } from './templates';
|
|
3
4
|
/** Options when creating a PDF */
|
|
4
5
|
export type PdfOptions = {
|
|
5
|
-
/**
|
|
6
|
+
/** Use cookies while loading URL */
|
|
6
7
|
cookies?: {
|
|
7
8
|
name: string;
|
|
8
9
|
value: string;
|
|
9
10
|
domain?: string;
|
|
10
11
|
path?: string;
|
|
11
12
|
}[];
|
|
12
|
-
/** Download after uploading */
|
|
13
|
-
download?: boolean;
|
|
14
13
|
/** Display page header/footer (The URL, page count, etc) */
|
|
15
14
|
displayHeaderFooter?: boolean;
|
|
16
|
-
/** Uploaded filename */
|
|
17
|
-
filename?: string;
|
|
18
15
|
/** Wait for x'ms of idle network traffic before creating PDF */
|
|
19
16
|
idleTime?: number;
|
|
20
17
|
/** Create the PDF in landscape orientation instead of portrait */
|
|
@@ -30,21 +27,41 @@ export type PdfOptions = {
|
|
|
30
27
|
mediaType?: 'screen' | 'print';
|
|
31
28
|
/** Enable background colors */
|
|
32
29
|
printBackground?: boolean;
|
|
33
|
-
/** Save PDF to storage location */
|
|
34
|
-
storagePath?: string;
|
|
35
30
|
/** Max amount of time request will wait before timing out */
|
|
36
31
|
timeout?: number;
|
|
37
32
|
/** Wait for custom dom event before continuing */
|
|
38
33
|
waitForEvent?: string;
|
|
39
34
|
/** Wait for builtin dom events before continuing */
|
|
40
35
|
waitUntil?: string[];
|
|
36
|
+
/** Download automatically with name */
|
|
37
|
+
downloadAs?: string;
|
|
38
|
+
/** Upload automatically to storage path */
|
|
39
|
+
uploadAs?: string;
|
|
41
40
|
};
|
|
42
41
|
export declare class Pdf extends PathEventEmitter {
|
|
43
|
-
|
|
44
|
-
constructor(
|
|
42
|
+
protected momentum: Momentum;
|
|
43
|
+
constructor(momentum: Momentum);
|
|
45
44
|
private createPdf;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
/**
|
|
46
|
+
* Create a PDF from raw HTML code
|
|
47
|
+
* @param {string} html HTML code
|
|
48
|
+
* @param {PdfOptions} options PDF rendering options
|
|
49
|
+
* @return {Promise<Blob>}
|
|
50
|
+
*/
|
|
51
|
+
fromHtml(html: string, options?: PdfOptions): Promise<Blob>;
|
|
52
|
+
/**
|
|
53
|
+
* Create a PDF from a server template
|
|
54
|
+
* @param {RenderTemplate} template Template path
|
|
55
|
+
* @param {PdfOptions} options PDF rendering options
|
|
56
|
+
* @return {Promise<Blob>}
|
|
57
|
+
*/
|
|
58
|
+
fromTemplate(template: RenderTemplate, options?: PdfOptions): Promise<Blob>;
|
|
59
|
+
/**
|
|
60
|
+
* Create PDF from a public URL
|
|
61
|
+
* @param {string} url HTTP(s) URL
|
|
62
|
+
* @param {PdfOptions} options PDF rendering option
|
|
63
|
+
* @return {Promise<Blob>}
|
|
64
|
+
*/
|
|
65
|
+
fromUrl(url: string, options?: PdfOptions): Promise<Blob>;
|
|
49
66
|
}
|
|
50
67
|
//# sourceMappingURL=pdf.d.ts.map
|
package/dist/pdf.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pdf.d.ts","sourceRoot":"","sources":["../src/pdf.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pdf.d.ts","sourceRoot":"","sources":["../src/pdf.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,gBAAgB,EAAM,MAAM,QAAQ,CAAC;AAC7C,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AACpC,OAAO,EAAC,cAAc,EAAC,MAAM,aAAa,CAAC;AAE3C,kCAAkC;AAClC,MAAM,MAAM,UAAU,GAAG;IACxB,oCAAoC;IACpC,OAAO,CAAC,EAAE;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAC,EAAE,CAAC;IAC1E,4DAA4D;IAC5D,mBAAmB,CAAC,EAAE,OAAO,CAAC;I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Unsubscribe } from './core';
|
|
3
|
+
import { Momentum } from './momentum';
|
|
4
|
+
/** Managed product */
|
|
5
|
+
export type Product<T = any> = T & {
|
|
6
|
+
/** Product ID number */
|
|
7
|
+
readonly _id: number;
|
|
8
|
+
/** Name of product */
|
|
9
|
+
readonly name: string;
|
|
10
|
+
/** Cost of product in dollars */
|
|
11
|
+
readonly cost: number;
|
|
12
|
+
/** If a subscription, number of days */
|
|
13
|
+
readonly subscription?: number;
|
|
14
|
+
/** Has available stock */
|
|
15
|
+
readonly stocked: boolean;
|
|
16
|
+
};
|
|
17
|
+
/** Get product information */
|
|
18
|
+
export declare class Products extends PathEventEmitter {
|
|
19
|
+
protected momentum: Momentum;
|
|
20
|
+
private controller;
|
|
21
|
+
get cache(): import('@ztimson/utils').Cache<string, any>;
|
|
22
|
+
constructor(momentum: Momentum);
|
|
23
|
+
/**
|
|
24
|
+
* Fetch all products
|
|
25
|
+
* @param {boolean} reload Force reload instead of using cache
|
|
26
|
+
* @return {Promise<Product[]>} List of products
|
|
27
|
+
*/
|
|
28
|
+
all(reload?: boolean): Promise<Product[]>;
|
|
29
|
+
/**
|
|
30
|
+
* Fetch specific product information
|
|
31
|
+
* @param {number} id Product ID
|
|
32
|
+
* @param {boolean} reload Force reload instead of using cache
|
|
33
|
+
* @return {Promise<Product>} Found product
|
|
34
|
+
*/
|
|
35
|
+
read(id: number | string, reload?: boolean): Promise<Product>;
|
|
36
|
+
/**
|
|
37
|
+
* Subscribe to live updates with callback
|
|
38
|
+
* @param {(value: Product[]) => any | null} callback Received changes
|
|
39
|
+
* @param opts Scope to single product
|
|
40
|
+
* @return {() => void} Function to unsubscribe
|
|
41
|
+
*/
|
|
42
|
+
sync(callback: (event: PathEvent, value: Product[]) => any | null, opts?: {
|
|
43
|
+
product?: number;
|
|
44
|
+
reload?: boolean;
|
|
45
|
+
}): Unsubscribe;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=products.d.ts.map
|
|
@@ -0,0 +1 @@
|
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AAO,CAAA;KAAM,GAAG,WAAW;CAGhI"}
|
package/dist/routes.d.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { PathEventEmitter } from '@ztimson/utils';
|
|
2
|
+
import { AssetController } from './asset-controller';
|
|
3
|
+
import { Meta } from './core';
|
|
4
|
+
import { Momentum } from './momentum';
|
|
5
|
+
export type Blacklisted = Meta & {
|
|
6
|
+
cidr: string;
|
|
7
|
+
};
|
|
8
|
+
export type RateLimit = Meta & {
|
|
9
|
+
match: {
|
|
10
|
+
path: string | null;
|
|
11
|
+
cidr: string | null;
|
|
12
|
+
};
|
|
13
|
+
required: {
|
|
14
|
+
cidr: string | null;
|
|
15
|
+
groups: string[];
|
|
16
|
+
captcha: number | null;
|
|
17
|
+
};
|
|
18
|
+
limit: {
|
|
19
|
+
ip: boolean;
|
|
20
|
+
user: boolean;
|
|
21
|
+
ttl: number | null;
|
|
22
|
+
value: number | null;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export declare class Blacklist extends AssetController<Blacklisted> {
|
|
26
|
+
protected momentum: Momentum;
|
|
27
|
+
constructor(momentum: Momentum);
|
|
28
|
+
update(ignore: Partial<Blacklisted>): Promise<Blacklisted>;
|
|
29
|
+
}
|
|
30
|
+
export declare class RateLimiter extends AssetController<RateLimit> {
|
|
31
|
+
protected momentum: Momentum;
|
|
32
|
+
constructor(momentum: Momentum);
|
|
33
|
+
}
|
|
34
|
+
export declare class Routes extends PathEventEmitter {
|
|
35
|
+
protected momentum: Momentum;
|
|
36
|
+
blacklist: Blacklist;
|
|
37
|
+
rateLimiter: RateLimiter;
|
|
38
|
+
constructor(momentum: Momentum);
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=routes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../src/routes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAC,MAAM,gBAAgB,CAAC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