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.
Files changed (112) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/esm/BaseEnum.d.ts +2 -0
  3. package/esm/BaseEnum.js +2 -0
  4. package/esm/FF_Fields.js +0 -1
  5. package/esm/ROUTES.d.ts +2 -2
  6. package/esm/ROUTES.js +10 -5
  7. package/esm/SqlDatabase/FF_LogToConsole.d.ts +1 -0
  8. package/esm/SqlDatabase/FF_LogToConsole.js +22 -16
  9. package/esm/api/index.d.ts +19 -21
  10. package/esm/api/index.js +72 -62
  11. package/esm/auth/{client/Auth.d.ts → AuthController.d.ts} +18 -25
  12. package/esm/auth/{client/Auth.js → AuthController.js} +48 -44
  13. package/esm/auth/{client/Entities.d.ts → Entities.d.ts} +4 -3
  14. package/esm/auth/{client/Entities.js → Entities.js} +7 -7
  15. package/esm/auth/README.md +0 -10
  16. package/esm/auth/index.d.ts +5 -149
  17. package/esm/auth/index.js +5 -316
  18. package/esm/auth/{AuthController.server.d.ts → server/AuthController.server.d.ts} +10 -10
  19. package/esm/auth/{AuthController.server.js → server/AuthController.server.js} +126 -164
  20. package/esm/auth/server/handleAuth.d.ts +2 -0
  21. package/esm/auth/server/handleAuth.js +140 -0
  22. package/esm/auth/server/helperDb.d.ts +10 -0
  23. package/esm/auth/server/helperDb.js +56 -0
  24. package/esm/auth/server/helperFirstly.d.ts +1 -0
  25. package/esm/auth/server/helperFirstly.js +8 -0
  26. package/esm/auth/server/helperOslo.d.ts +7 -0
  27. package/esm/auth/server/helperOslo.js +24 -0
  28. package/esm/auth/server/helperRemultServer.d.ts +5 -0
  29. package/esm/auth/server/helperRemultServer.js +44 -0
  30. package/esm/auth/{RoleHelpers.d.ts → server/helperRole.d.ts} +1 -1
  31. package/esm/auth/{RoleHelpers.js → server/helperRole.js} +1 -1
  32. package/esm/auth/server/index.d.ts +5 -0
  33. package/esm/auth/server/index.js +5 -0
  34. package/esm/auth/server/module.d.ts +238 -0
  35. package/esm/auth/server/module.js +184 -0
  36. package/esm/auth/{providers → server/providers}/github.d.ts +6 -5
  37. package/esm/auth/{providers → server/providers}/github.js +30 -21
  38. package/esm/auth/{providers/index.d.ts → server/providers/helperProvider.d.ts} +0 -2
  39. package/esm/auth/{providers/index.js → server/providers/helperProvider.js} +5 -6
  40. package/esm/auth/static/assets/{Page-BEFYPjis.d.ts → Page-Bb8bFlrP.d.ts} +1 -1
  41. package/esm/auth/static/assets/{Page-DtgkOCJs.js → Page-Bb8bFlrP.js} +1 -1
  42. package/esm/auth/static/assets/{Page-DtgkOCJs.d.ts → Page-BxomFlZ8.d.ts} +1 -1
  43. package/esm/auth/static/assets/{Page-BEFYPjis.js → Page-BxomFlZ8.js} +1 -1
  44. package/esm/auth/static/assets/Page-CaIYu0-y.d.ts +6 -0
  45. package/esm/auth/static/assets/Page-CaIYu0-y.js +19 -0
  46. package/esm/auth/static/assets/Page-MkYglNtu.css +1 -0
  47. package/esm/auth/static/assets/index-Bl0Bk5u0.d.ts +64 -0
  48. package/esm/auth/static/assets/index-Bl0Bk5u0.js +2 -0
  49. package/esm/auth/static/assets/{index-CR_3yNaJ.css → index-R27C_TlP.css} +1 -1
  50. package/esm/auth/static/index.html +2 -2
  51. package/esm/auth/types.d.ts +5 -0
  52. package/esm/bin/cmd.js +13 -22
  53. package/esm/cellsBuildor.js +6 -6
  54. package/esm/changeLog/index.d.ts +0 -36
  55. package/esm/changeLog/index.js +3 -43
  56. package/esm/changeLog/server/index.d.ts +36 -0
  57. package/esm/changeLog/server/index.js +42 -0
  58. package/esm/cron/{index.d.ts → server/index.d.ts} +1 -1
  59. package/esm/cron/server/index.js +103 -0
  60. package/esm/feedback/FeedbackController.js +3 -3
  61. package/esm/feedback/index.d.ts +0 -16
  62. package/esm/feedback/index.js +0 -11
  63. package/esm/feedback/server/index.d.ts +17 -0
  64. package/esm/feedback/server/index.js +13 -0
  65. package/esm/feedback/ui/DialogIssue.svelte +4 -2
  66. package/esm/feedback/ui/DialogIssues.svelte +13 -4
  67. package/esm/feedback/ui/DialogMilestones.svelte +1 -1
  68. package/esm/feedback/ui/Feedback.svelte +3 -1
  69. package/esm/helper.d.ts +0 -1
  70. package/esm/helper.js +3 -17
  71. package/esm/index.d.ts +3 -17
  72. package/esm/index.js +3 -4
  73. package/esm/mail/index.d.ts +2 -30
  74. package/esm/mail/index.js +2 -79
  75. package/esm/mail/server/index.d.ts +31 -0
  76. package/esm/mail/server/index.js +88 -0
  77. package/esm/storeItem.d.ts +4 -1
  78. package/esm/storeItem.js +8 -2
  79. package/esm/storeList.d.ts +5 -2
  80. package/esm/storeList.js +1 -1
  81. package/esm/sveltekit/server/index.d.ts +11 -0
  82. package/esm/sveltekit/server/index.js +21 -0
  83. package/esm/ui/Button.svelte +1 -1
  84. package/esm/ui/Clipboardable.svelte +5 -2
  85. package/esm/ui/Field.svelte +4 -1
  86. package/esm/ui/Loading.svelte +4 -1
  87. package/esm/ui/Tooltip.svelte +2 -2
  88. package/esm/ui/dialog/DialogForm.svelte +1 -1
  89. package/esm/ui/dialog/DialogPrimitive.svelte +1 -2
  90. package/esm/ui/dialog/dialog.d.ts +6 -3
  91. package/esm/ui/dialog/dialog.js +1 -1
  92. package/esm/ui/internals/FieldContainer.svelte +0 -1
  93. package/esm/ui/internals/Input.svelte +3 -1
  94. package/esm/ui/internals/Textarea.svelte +2 -2
  95. package/esm/vite/index.js +24 -25
  96. package/package.json +50 -38
  97. package/esm/auth/Adapter.d.ts +0 -10
  98. package/esm/auth/Adapter.js +0 -50
  99. package/esm/auth/client/index.d.ts +0 -7
  100. package/esm/auth/client/index.js +0 -7
  101. package/esm/auth/helper.d.ts +0 -6
  102. package/esm/auth/helper.js +0 -14
  103. package/esm/auth/providers/strava.d.ts +0 -30
  104. package/esm/auth/providers/strava.js +0 -60
  105. package/esm/auth/static/assets/Page-BGTO8LC5.css +0 -1
  106. package/esm/auth/static/assets/Page-Cfysx_UV.d.ts +0 -6
  107. package/esm/auth/static/assets/Page-Cfysx_UV.js +0 -18
  108. package/esm/auth/static/assets/index-QypqCYwC.d.ts +0 -63
  109. package/esm/auth/static/assets/index-QypqCYwC.js +0 -2
  110. package/esm/cron/index.js +0 -102
  111. package/esm/handle/index.d.ts +0 -7
  112. 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
- };
@@ -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;
@@ -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
- };