firstly 0.0.10 → 0.0.12
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/CHANGELOG.md +16 -0
- package/esm/BaseEnum.d.ts +2 -0
- package/esm/BaseEnum.js +2 -0
- package/esm/FF_Fields.js +0 -1
- package/esm/ROUTES.d.ts +2 -2
- package/esm/ROUTES.js +10 -5
- package/esm/SqlDatabase/FF_LogToConsole.d.ts +1 -0
- package/esm/SqlDatabase/FF_LogToConsole.js +22 -16
- package/esm/api/index.d.ts +19 -21
- package/esm/api/index.js +72 -62
- package/esm/auth/{client/Auth.d.ts → AuthController.d.ts} +18 -25
- package/esm/auth/{client/Auth.js → AuthController.js} +48 -44
- package/esm/auth/{client/Entities.d.ts → Entities.d.ts} +4 -3
- package/esm/auth/{client/Entities.js → Entities.js} +7 -7
- package/esm/auth/README.md +0 -10
- package/esm/auth/index.d.ts +5 -149
- package/esm/auth/index.js +5 -316
- package/esm/auth/{AuthController.server.d.ts → server/AuthController.server.d.ts} +10 -10
- package/esm/auth/{AuthController.server.js → server/AuthController.server.js} +126 -164
- package/esm/auth/server/handleAuth.d.ts +2 -0
- package/esm/auth/server/handleAuth.js +140 -0
- package/esm/auth/server/helperDb.d.ts +10 -0
- package/esm/auth/server/helperDb.js +56 -0
- package/esm/auth/server/helperFirstly.d.ts +1 -0
- package/esm/auth/server/helperFirstly.js +8 -0
- package/esm/auth/server/helperOslo.d.ts +7 -0
- package/esm/auth/server/helperOslo.js +24 -0
- package/esm/auth/server/helperRemultServer.d.ts +5 -0
- package/esm/auth/server/helperRemultServer.js +44 -0
- package/esm/auth/{RoleHelpers.d.ts → server/helperRole.d.ts} +1 -1
- package/esm/auth/{RoleHelpers.js → server/helperRole.js} +1 -1
- package/esm/auth/server/index.d.ts +5 -0
- package/esm/auth/server/index.js +5 -0
- package/esm/auth/server/module.d.ts +238 -0
- package/esm/auth/server/module.js +184 -0
- package/esm/auth/{providers → server/providers}/github.d.ts +6 -5
- package/esm/auth/{providers → server/providers}/github.js +30 -21
- package/esm/auth/{providers/index.d.ts → server/providers/helperProvider.d.ts} +0 -2
- package/esm/auth/{providers/index.js → server/providers/helperProvider.js} +5 -6
- package/esm/auth/static/assets/{Page-BEFYPjis.d.ts → Page-Bb8bFlrP.d.ts} +1 -1
- package/esm/auth/static/assets/{Page-DtgkOCJs.js → Page-Bb8bFlrP.js} +1 -1
- package/esm/auth/static/assets/{Page-DtgkOCJs.d.ts → Page-BxomFlZ8.d.ts} +1 -1
- package/esm/auth/static/assets/{Page-BEFYPjis.js → Page-BxomFlZ8.js} +1 -1
- package/esm/auth/static/assets/Page-CaIYu0-y.d.ts +6 -0
- package/esm/auth/static/assets/Page-CaIYu0-y.js +19 -0
- package/esm/auth/static/assets/Page-MkYglNtu.css +1 -0
- package/esm/auth/static/assets/index-Bl0Bk5u0.d.ts +64 -0
- package/esm/auth/static/assets/index-Bl0Bk5u0.js +2 -0
- package/esm/auth/static/assets/{index-CR_3yNaJ.css → index-R27C_TlP.css} +1 -1
- package/esm/auth/static/index.html +2 -2
- package/esm/auth/types.d.ts +5 -0
- package/esm/bin/cmd.js +13 -22
- package/esm/cellsBuildor.js +6 -6
- package/esm/changeLog/index.d.ts +0 -36
- package/esm/changeLog/index.js +3 -43
- package/esm/changeLog/server/index.d.ts +36 -0
- package/esm/changeLog/server/index.js +42 -0
- package/esm/cron/{index.d.ts → server/index.d.ts} +1 -1
- package/esm/cron/server/index.js +103 -0
- package/esm/feedback/FeedbackController.js +3 -3
- package/esm/feedback/index.d.ts +0 -16
- package/esm/feedback/index.js +0 -11
- package/esm/feedback/server/index.d.ts +17 -0
- package/esm/feedback/server/index.js +13 -0
- package/esm/feedback/ui/DialogIssue.svelte +4 -2
- package/esm/feedback/ui/DialogIssues.svelte +13 -4
- package/esm/feedback/ui/DialogMilestones.svelte +1 -1
- package/esm/feedback/ui/Feedback.svelte +3 -1
- package/esm/helper.d.ts +0 -1
- package/esm/helper.js +3 -17
- package/esm/index.d.ts +3 -17
- package/esm/index.js +3 -4
- package/esm/mail/index.d.ts +2 -30
- package/esm/mail/index.js +2 -79
- package/esm/mail/server/index.d.ts +31 -0
- package/esm/mail/server/index.js +88 -0
- package/esm/storeItem.d.ts +4 -1
- package/esm/storeItem.js +8 -2
- package/esm/storeList.d.ts +5 -2
- package/esm/storeList.js +1 -1
- package/esm/sveltekit/server/index.d.ts +11 -0
- package/esm/sveltekit/server/index.js +21 -0
- package/esm/ui/Button.svelte +1 -1
- package/esm/ui/Clipboardable.svelte +5 -2
- package/esm/ui/Field.svelte +4 -1
- package/esm/ui/Loading.svelte +4 -1
- package/esm/ui/Tooltip.svelte +2 -2
- package/esm/ui/dialog/DialogForm.svelte +1 -1
- package/esm/ui/dialog/DialogPrimitive.svelte +1 -2
- package/esm/ui/dialog/dialog.d.ts +6 -3
- package/esm/ui/dialog/dialog.js +1 -1
- package/esm/ui/internals/FieldContainer.svelte +0 -1
- package/esm/ui/internals/Input.svelte +3 -1
- package/esm/ui/internals/Textarea.svelte +2 -2
- package/esm/vite/index.js +24 -25
- package/package.json +50 -38
- package/esm/auth/Adapter.d.ts +0 -10
- package/esm/auth/Adapter.js +0 -50
- package/esm/auth/client/index.d.ts +0 -7
- package/esm/auth/client/index.js +0 -7
- package/esm/auth/helper.d.ts +0 -6
- package/esm/auth/helper.js +0 -14
- package/esm/auth/providers/strava.d.ts +0 -30
- package/esm/auth/providers/strava.js +0 -60
- package/esm/auth/static/assets/Page-BGTO8LC5.css +0 -1
- package/esm/auth/static/assets/Page-Cfysx_UV.d.ts +0 -6
- package/esm/auth/static/assets/Page-Cfysx_UV.js +0 -18
- package/esm/auth/static/assets/index-QypqCYwC.d.ts +0 -63
- package/esm/auth/static/assets/index-QypqCYwC.js +0 -2
- package/esm/cron/index.js +0 -102
- package/esm/handle/index.d.ts +0 -7
- package/esm/handle/index.js +0 -40
package/esm/cron/index.js
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import { CronJob } from 'cron';
|
|
2
|
-
import { green, Log, magenta, red, yellow } from '@kitql/helpers';
|
|
3
|
-
const log = new Log('firstly | cron');
|
|
4
|
-
export const jobs = {};
|
|
5
|
-
/**
|
|
6
|
-
* Link to a nice Cheatsheet TODO
|
|
7
|
-
*/
|
|
8
|
-
export const cronTime = {
|
|
9
|
-
/**
|
|
10
|
-
* Every morning is actually at 4 am and 7 minutes. (because I like this number!)
|
|
11
|
-
*/
|
|
12
|
-
every_morning: '0 7 4 * * *',
|
|
13
|
-
/**
|
|
14
|
-
* Every second
|
|
15
|
-
*/
|
|
16
|
-
every_second: '* * * * * *',
|
|
17
|
-
/**
|
|
18
|
-
* Every minute
|
|
19
|
-
*/
|
|
20
|
-
every_minute: '0 * * * * *',
|
|
21
|
-
/**
|
|
22
|
-
* Every 10 minute
|
|
23
|
-
*/
|
|
24
|
-
every_10_minute: '*/10 * * * *',
|
|
25
|
-
/**
|
|
26
|
-
* Every friday at 5:11 am
|
|
27
|
-
*/
|
|
28
|
-
every_friday_morning: '11 5 * * 5',
|
|
29
|
-
};
|
|
30
|
-
/**
|
|
31
|
-
* usage:
|
|
32
|
-
*
|
|
33
|
-
* ```ts
|
|
34
|
-
* import { cron, cronTime } from 'firstly/cron'
|
|
35
|
-
*
|
|
36
|
-
* export const api = firstly({
|
|
37
|
-
* modules: [
|
|
38
|
-
* cron([{
|
|
39
|
-
* topic: 'first_cron',
|
|
40
|
-
* cronTime: cronTime.every_second,
|
|
41
|
-
* onTick: () => { console.log('hello') },
|
|
42
|
-
* start: !dev, // Start in production
|
|
43
|
-
* // runOnInit: dev, // nice in dev environement
|
|
44
|
-
* }])
|
|
45
|
-
* ]
|
|
46
|
-
* })
|
|
47
|
-
* ```
|
|
48
|
-
*
|
|
49
|
-
* using [cron](https://www.npmjs.com/package/cron) library under the hood
|
|
50
|
-
*/
|
|
51
|
-
export const cron = (jobsInfos) => {
|
|
52
|
-
return {
|
|
53
|
-
name: 'cron',
|
|
54
|
-
initApi: async () => {
|
|
55
|
-
jobsInfos.forEach((infos) => {
|
|
56
|
-
const { topic, runOnInit, logs, concurrent, ...params } = infos;
|
|
57
|
-
const concurrentToUse = concurrent ?? 1;
|
|
58
|
-
const onTickSaved = params.onTick;
|
|
59
|
-
const fullOnTick = async () => {
|
|
60
|
-
if (jobs[topic].concurrentInProgress < concurrentToUse) {
|
|
61
|
-
jobs[topic].concurrentInProgress = jobs[topic].concurrentInProgress + 1;
|
|
62
|
-
if (logs?.starting === undefined || logs?.starting === true) {
|
|
63
|
-
logJobs(topic, job, 'starting...', false, false);
|
|
64
|
-
}
|
|
65
|
-
// @ts-ignore
|
|
66
|
-
await onTickSaved();
|
|
67
|
-
if (logs?.ended === undefined || logs?.ended === true) {
|
|
68
|
-
logJobs(topic, job, 'done');
|
|
69
|
-
}
|
|
70
|
-
jobs[topic].concurrentInProgress = jobs[topic].concurrentInProgress - 1;
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
logJobs(topic, job, `skipped because of concurrent limit (${yellow(concurrentToUse.toString())})`, false, false);
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
params.onTick = fullOnTick;
|
|
77
|
-
const job = CronJob.from(params);
|
|
78
|
-
jobs[topic] = { job, concurrentInProgress: 0 };
|
|
79
|
-
logJobs(topic, job, 'setup done');
|
|
80
|
-
// If not it will be done too early
|
|
81
|
-
if (runOnInit) {
|
|
82
|
-
job.fireOnTick();
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
},
|
|
86
|
-
};
|
|
87
|
-
};
|
|
88
|
-
const logJobs = (topic, job, message, with_metadata = true, isSuccess = true) => {
|
|
89
|
-
const l = [];
|
|
90
|
-
l.push(magenta(`[${topic}]`));
|
|
91
|
-
l.push(message);
|
|
92
|
-
if (with_metadata) {
|
|
93
|
-
// If the job is "stopped", there will still be a next date, but it will not fire it. The job has to start.
|
|
94
|
-
l.push(`(${job.running ? green('running') : red('stopped')}, next at ${yellow(job.nextDate().toISO())})`);
|
|
95
|
-
}
|
|
96
|
-
if (isSuccess) {
|
|
97
|
-
log.success(l.join(' '));
|
|
98
|
-
}
|
|
99
|
-
else {
|
|
100
|
-
log.info(l.join(' '));
|
|
101
|
-
}
|
|
102
|
-
};
|
package/esm/handle/index.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { Handle } from '@sveltejs/kit';
|
|
2
|
-
import type { RemultSveltekitServer } from 'remult/remult-sveltekit';
|
|
3
|
-
import type { Module } from '../api';
|
|
4
|
-
export declare const firstly: (api: {
|
|
5
|
-
server: RemultSveltekitServer;
|
|
6
|
-
modulesSorted: Module[];
|
|
7
|
-
}) => Handle;
|
package/esm/handle/index.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { sequence } from '@sveltejs/kit/hooks';
|
|
2
|
-
// const log = new Log('firstly')
|
|
3
|
-
/**
|
|
4
|
-
* to bring `remult.` on the server side (after this hook, you have assess to `remult.user` for example !)
|
|
5
|
-
*/
|
|
6
|
-
const internalRemultHandle = (api, modules) => async (h) => {
|
|
7
|
-
return await api.withRemult(h.event, async () => {
|
|
8
|
-
if (modules !== undefined) {
|
|
9
|
-
for (let i = 0; i < modules.length; i++) {
|
|
10
|
-
const early = modules[i].earlyReturn;
|
|
11
|
-
if (early) {
|
|
12
|
-
const ret = await early(h);
|
|
13
|
-
if (ret.early) {
|
|
14
|
-
return ret.resolve;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
return await h.resolve(h.event);
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
export const firstly = ({ server, modulesSorted }) => {
|
|
23
|
-
const handlesPre = [];
|
|
24
|
-
const handlesPost = [];
|
|
25
|
-
for (let i = 0; i < modulesSorted.length; i++) {
|
|
26
|
-
if (modulesSorted[i].handlePreRemult) {
|
|
27
|
-
handlesPre.push(modulesSorted[i].handlePreRemult);
|
|
28
|
-
}
|
|
29
|
-
if (modulesSorted[i].handlePosRemult) {
|
|
30
|
-
handlesPost.push(modulesSorted[i].handlePosRemult);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
return sequence(
|
|
34
|
-
// First
|
|
35
|
-
sequence(...handlesPre),
|
|
36
|
-
// Then
|
|
37
|
-
internalRemultHandle(server, modulesSorted),
|
|
38
|
-
// Finally
|
|
39
|
-
sequence(...handlesPost));
|
|
40
|
-
};
|