firstly 0.0.11 → 0.0.13

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 (139) 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 +20 -21
  10. package/esm/api/index.js +74 -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} +133 -171
  20. package/esm/auth/server/handleAuth.d.ts +2 -0
  21. package/esm/auth/server/handleAuth.js +140 -0
  22. package/esm/auth/server/handleGuard.d.ts +16 -0
  23. package/esm/auth/server/handleGuard.js +67 -0
  24. package/esm/auth/server/helperDb.d.ts +10 -0
  25. package/esm/auth/server/helperDb.js +56 -0
  26. package/esm/auth/server/helperFirstly.d.ts +1 -0
  27. package/esm/auth/server/helperFirstly.js +8 -0
  28. package/esm/auth/server/helperOslo.d.ts +7 -0
  29. package/esm/auth/server/helperOslo.js +24 -0
  30. package/esm/auth/server/helperRemultServer.d.ts +5 -0
  31. package/esm/auth/server/helperRemultServer.js +44 -0
  32. package/esm/auth/{RoleHelpers.d.ts → server/helperRole.d.ts} +1 -1
  33. package/esm/auth/{RoleHelpers.js → server/helperRole.js} +1 -1
  34. package/esm/auth/server/index.d.ts +7 -0
  35. package/esm/auth/server/index.js +7 -0
  36. package/esm/auth/server/module.d.ts +257 -0
  37. package/esm/auth/server/module.js +197 -0
  38. package/esm/auth/{providers → server/providers}/github.d.ts +6 -4
  39. package/esm/auth/{providers → server/providers}/github.js +29 -20
  40. package/esm/auth/{providers/index.d.ts → server/providers/helperProvider.d.ts} +0 -2
  41. package/esm/auth/{providers/index.js → server/providers/helperProvider.js} +5 -6
  42. package/esm/auth/static/assets/Page-BUfjaN-D.d.ts +5 -0
  43. package/esm/auth/static/assets/Page-BUfjaN-D.js +19 -0
  44. package/esm/auth/static/assets/Page-CJ58H1vl.css +1 -0
  45. package/esm/auth/static/assets/Page-CaDAqmBS.d.ts +5 -0
  46. package/esm/auth/static/assets/Page-CaDAqmBS.js +1 -0
  47. package/esm/auth/static/assets/Page-DhdZddzJ.d.ts +5 -0
  48. package/esm/auth/static/assets/Page-DhdZddzJ.js +1 -0
  49. package/esm/auth/static/assets/index-BDy4A_14.css +4 -0
  50. package/esm/auth/static/assets/index-D-Ztdt2o.d.ts +54 -0
  51. package/esm/auth/static/assets/index-D-Ztdt2o.js +2 -0
  52. package/esm/auth/static/index.html +11 -11
  53. package/esm/auth/types.d.ts +5 -0
  54. package/esm/bin/cmd.js +122 -54
  55. package/esm/cellsBuildor.js +7 -7
  56. package/esm/changeLog/index.d.ts +0 -36
  57. package/esm/changeLog/index.js +3 -43
  58. package/esm/changeLog/server/index.d.ts +36 -0
  59. package/esm/changeLog/server/index.js +42 -0
  60. package/esm/common.d.ts +5 -0
  61. package/esm/common.js +8 -0
  62. package/esm/cron/{index.d.ts → server/index.d.ts} +1 -1
  63. package/esm/cron/server/index.js +103 -0
  64. package/esm/feedback/FeedbackController.js +4 -5
  65. package/esm/feedback/index.d.ts +0 -16
  66. package/esm/feedback/index.js +0 -11
  67. package/esm/feedback/server/index.d.ts +17 -0
  68. package/esm/feedback/server/index.js +13 -0
  69. package/esm/feedback/ui/DialogIssue.svelte +52 -56
  70. package/esm/feedback/ui/DialogIssues.svelte +71 -71
  71. package/esm/feedback/ui/DialogMilestones.svelte +22 -22
  72. package/esm/helper.js +3 -3
  73. package/esm/index.d.ts +3 -20
  74. package/esm/index.js +3 -10
  75. package/esm/mail/index.d.ts +2 -30
  76. package/esm/mail/index.js +2 -79
  77. package/esm/mail/server/index.d.ts +31 -0
  78. package/esm/mail/server/index.js +88 -0
  79. package/esm/mail/templates/DefaultMail.svelte +17 -17
  80. package/esm/storeItem.js +8 -2
  81. package/esm/storeList.d.ts +1 -1
  82. package/esm/storeList.js +1 -1
  83. package/esm/sveltekit/server/index.d.ts +14 -0
  84. package/esm/sveltekit/server/index.js +24 -0
  85. package/esm/ui/Button.svelte +33 -33
  86. package/esm/ui/Button.svelte.d.ts +2 -2
  87. package/esm/ui/Clipboardable.svelte +11 -8
  88. package/esm/ui/Clipboardable.svelte.d.ts +4 -4
  89. package/esm/ui/Field.svelte +142 -149
  90. package/esm/ui/Field.svelte.d.ts +2 -2
  91. package/esm/ui/FieldGroup.svelte +38 -38
  92. package/esm/ui/Grid.svelte +212 -222
  93. package/esm/ui/GridLoading.svelte +18 -22
  94. package/esm/ui/GridPaginate.svelte +38 -38
  95. package/esm/ui/Icon.svelte +50 -49
  96. package/esm/ui/Icon.svelte.d.ts +18 -18
  97. package/esm/ui/Loading.svelte +5 -2
  98. package/esm/ui/Tooltip.svelte +16 -16
  99. package/esm/ui/dialog/DialogForm.svelte +23 -23
  100. package/esm/ui/dialog/DialogManagement.svelte +74 -74
  101. package/esm/ui/dialog/DialogPrimitive.svelte +50 -51
  102. package/esm/ui/dialog/FormEditAction.svelte +34 -34
  103. package/esm/ui/dialog/dialog.d.ts +2 -2
  104. package/esm/ui/dialog/dialog.js +1 -1
  105. package/esm/ui/internals/FieldContainer.svelte +11 -12
  106. package/esm/ui/internals/FieldContainer.svelte.d.ts +3 -3
  107. package/esm/ui/internals/Input.svelte +25 -25
  108. package/esm/ui/internals/Input.svelte.d.ts +1 -1
  109. package/esm/ui/internals/Textarea.svelte +21 -21
  110. package/esm/ui/internals/Textarea.svelte.d.ts +2 -2
  111. package/esm/ui/internals/select/MultiSelectMelt.svelte +69 -73
  112. package/esm/ui/internals/select/SelectMelt.svelte +86 -86
  113. package/esm/ui/internals/select/SelectRadio.svelte +22 -22
  114. package/esm/ui/link/Link.svelte +14 -14
  115. package/esm/ui/link/Link.svelte.d.ts +3 -4
  116. package/esm/ui/link/LinkPlus.svelte +33 -35
  117. package/esm/vite/index.js +24 -25
  118. package/package.json +50 -42
  119. package/esm/auth/Adapter.d.ts +0 -10
  120. package/esm/auth/Adapter.js +0 -50
  121. package/esm/auth/client/index.d.ts +0 -7
  122. package/esm/auth/client/index.js +0 -7
  123. package/esm/auth/helper.d.ts +0 -6
  124. package/esm/auth/helper.js +0 -14
  125. package/esm/auth/providers/strava.d.ts +0 -30
  126. package/esm/auth/providers/strava.js +0 -60
  127. package/esm/auth/static/assets/Page-BEFYPjis.d.ts +0 -4
  128. package/esm/auth/static/assets/Page-BEFYPjis.js +0 -1
  129. package/esm/auth/static/assets/Page-BGTO8LC5.css +0 -1
  130. package/esm/auth/static/assets/Page-Cfysx_UV.d.ts +0 -6
  131. package/esm/auth/static/assets/Page-Cfysx_UV.js +0 -18
  132. package/esm/auth/static/assets/Page-DtgkOCJs.d.ts +0 -4
  133. package/esm/auth/static/assets/Page-DtgkOCJs.js +0 -1
  134. package/esm/auth/static/assets/index-CR_3yNaJ.css +0 -4
  135. package/esm/auth/static/assets/index-QypqCYwC.d.ts +0 -63
  136. package/esm/auth/static/assets/index-QypqCYwC.js +0 -2
  137. package/esm/cron/index.js +0 -102
  138. package/esm/handle/index.d.ts +0 -7
  139. package/esm/handle/index.js +0 -40
@@ -0,0 +1,103 @@
1
+ import { CronJob } from 'cron';
2
+ import { green, magenta, red, yellow } from '@kitql/helpers';
3
+ import { Module } from '../../api';
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
+ const m = new Module({
53
+ name: 'cron',
54
+ });
55
+ const logJobs = (topic, job, message, with_metadata = true, isSuccess = true) => {
56
+ const l = [];
57
+ l.push(magenta(`[${topic}]`));
58
+ l.push(message);
59
+ if (with_metadata) {
60
+ // If the job is "stopped", there will still be a next date, but it will not fire it. The job has to start.
61
+ l.push(`(${job.isActive ? green('running') : red('stopped')}, next at ${yellow(job.nextDate().toISO())})`);
62
+ }
63
+ if (isSuccess) {
64
+ m.log.success(l.join(' '));
65
+ }
66
+ else {
67
+ m.log.info(l.join(' '));
68
+ }
69
+ };
70
+ m.initApi = async () => {
71
+ jobsInfos.forEach((infos) => {
72
+ const { topic, runOnInit, logs, concurrent, ...params } = infos;
73
+ const concurrentToUse = concurrent ?? 1;
74
+ const onTickSaved = params.onTick;
75
+ const fullOnTick = async () => {
76
+ if (jobs[topic].concurrentInProgress < concurrentToUse) {
77
+ jobs[topic].concurrentInProgress = jobs[topic].concurrentInProgress + 1;
78
+ if (logs?.starting === undefined || logs?.starting === true) {
79
+ logJobs(topic, job, 'starting...', false, false);
80
+ }
81
+ // @ts-ignore
82
+ await onTickSaved();
83
+ if (logs?.ended === undefined || logs?.ended === true) {
84
+ logJobs(topic, job, 'done');
85
+ }
86
+ jobs[topic].concurrentInProgress = jobs[topic].concurrentInProgress - 1;
87
+ }
88
+ else {
89
+ logJobs(topic, job, `skipped because of concurrent limit (${yellow(concurrentToUse.toString())})`, false, false);
90
+ }
91
+ };
92
+ params.onTick = fullOnTick;
93
+ const job = CronJob.from(params);
94
+ jobs[topic] = { job, concurrentInProgress: 0 };
95
+ logJobs(topic, job, 'setup done');
96
+ // If not it will be done too early
97
+ if (runOnInit) {
98
+ job.fireOnTick();
99
+ }
100
+ });
101
+ };
102
+ return m;
103
+ };
@@ -4,13 +4,13 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
4
4
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
- import { Allow, BackendMethod, remult } from 'remult';
7
+ import { Allow, BackendMethod, EntityError, remult } from 'remult';
8
8
  import { stry } from '@kitql/helpers';
9
- import { FEEDBACK_OPTIONS } from '.';
9
+ import { FEEDBACK_OPTIONS } from './server';
10
10
  const GITHUB_GRAPHQL_ENDPOINT = 'https://api.github.com/graphql';
11
11
  async function getGitHub(query, variables) {
12
12
  if (!FEEDBACK_OPTIONS.GITHUB_API_TOKEN) {
13
- throw new Error('GITHUB_API_TOKEN not found in .env');
13
+ throw new EntityError({ message: 'GITHUB_API_TOKEN not found in .env' });
14
14
  }
15
15
  try {
16
16
  const headers = new Headers({
@@ -200,8 +200,7 @@ export class FeedbackController {
200
200
  items[items.length - 1].public = true;
201
201
  }
202
202
  else {
203
- const nbEye = comments[i].reactionGroups.find((c) => c.content === 'EYES')?.reactors
204
- .totalCount;
203
+ const nbEye = comments[i].reactionGroups.find((c) => c.content === 'EYES')?.reactors.totalCount;
205
204
  items.push({
206
205
  bodyHTML: comments[i].bodyHTML,
207
206
  createdAt: new Date(comments[i].createdAt),
@@ -1,19 +1,3 @@
1
- import type { Module } from '../api';
2
1
  import { FeedbackController } from './FeedbackController';
3
2
  import { default as Feedback } from './ui/Feedback.svelte';
4
3
  export { FeedbackController, Feedback };
5
- type FeedbackOptions = {
6
- GITHUB_API_TOKEN: string;
7
- repo: {
8
- owner: string;
9
- name: string;
10
- };
11
- milestones?: {
12
- title_filter?: string;
13
- labels_filters?: string[];
14
- };
15
- highlight_label?: string;
16
- create_label?: string;
17
- };
18
- export declare let FEEDBACK_OPTIONS: FeedbackOptions;
19
- export declare const feedback: (o: FeedbackOptions) => Module;
@@ -1,14 +1,3 @@
1
1
  import { FeedbackController } from './FeedbackController';
2
2
  import { default as Feedback } from './ui/Feedback.svelte';
3
3
  export { FeedbackController, Feedback };
4
- export let FEEDBACK_OPTIONS = {
5
- GITHUB_API_TOKEN: '',
6
- repo: { owner: '', name: '' },
7
- };
8
- export const feedback = (o) => {
9
- FEEDBACK_OPTIONS = o;
10
- return {
11
- name: 'feedback',
12
- controllers: [FeedbackController],
13
- };
14
- };
@@ -0,0 +1,17 @@
1
+ import { Module } from '../../api';
2
+ type FeedbackOptions = {
3
+ GITHUB_API_TOKEN: string;
4
+ repo: {
5
+ owner: string;
6
+ name: string;
7
+ };
8
+ milestones?: {
9
+ title_filter?: string;
10
+ labels_filters?: string[];
11
+ };
12
+ highlight_label?: string;
13
+ create_label?: string;
14
+ };
15
+ export declare let FEEDBACK_OPTIONS: FeedbackOptions;
16
+ export declare const feedback: (o: FeedbackOptions) => Module;
17
+ export {};
@@ -0,0 +1,13 @@
1
+ import { Module } from '../../api';
2
+ import { FeedbackController } from '../FeedbackController';
3
+ export let FEEDBACK_OPTIONS = {
4
+ GITHUB_API_TOKEN: '',
5
+ repo: { owner: '', name: '' },
6
+ };
7
+ export const feedback = (o) => {
8
+ FEEDBACK_OPTIONS = o;
9
+ return new Module({
10
+ name: 'feedback',
11
+ controllers: [FeedbackController],
12
+ });
13
+ };
@@ -63,61 +63,57 @@ const disableButton = (issueNumber2, title2, content2) => {
63
63
  </script>
64
64
 
65
65
  <div class="mb-4 grid gap-4">
66
- {#if state === 'loading'}
67
- <Loading class="h-12"></Loading>
68
- <Loading class="h-12"></Loading>
69
- <Loading class="h-12"></Loading>
70
- {:else}
71
- {#each issue?.items ?? [] as item}
72
- <div class="chat {item.who ? 'chat-start' : 'chat-end'}">
73
- <div class="avatar chat-image">
74
- <div class="w-10 rounded-full">
75
- <div class="h-10 w-10 {item.who ? 'bg-primary' : 'bg-secondary'}"></div>
76
- </div>
77
- </div>
78
- <div class="chat-header">
79
- {item.who ?? 'Support'}
80
- <time class="text-xs opacity-50"
81
- >{new Date(item.createdAt).toLocaleDateString()} - {new Date(
82
- item.createdAt,
83
- ).toLocaleTimeString()}</time
84
- >
85
- </div>
86
- <div class="chat-bubble prose">{@html item.bodyHTML}</div>
87
- <!-- <div class="chat-footer opacity-50">Delivered</div> -->
88
- </div>
89
- {/each}
90
- {#if issue?.highlight && issue.state === 'OPEN'}
91
- <span class="badge badge-warning">En attente de réponse de TA part 😉, oui 🫵!</span>
92
- {/if}
93
- {#if issueNumber}
94
- <button on:click={update} aria-label="Actualiser" class="divider"></button>
95
- {/if}
66
+ {#if state === 'loading'}
67
+ <Loading class="h-12"></Loading>
68
+ <Loading class="h-12"></Loading>
69
+ <Loading class="h-12"></Loading>
70
+ {:else}
71
+ {#each issue?.items ?? [] as item}
72
+ <div class="chat {item.who ? 'chat-start' : 'chat-end'}">
73
+ <div class="avatar chat-image">
74
+ <div class="w-10 rounded-full">
75
+ <div class="h-10 w-10 {item.who ? 'bg-primary' : 'bg-secondary'}"></div>
76
+ </div>
77
+ </div>
78
+ <div class="chat-header">
79
+ {item.who ?? 'Support'}
80
+ <time class="text-xs opacity-50"
81
+ >{new Date(item.createdAt).toLocaleDateString()} - {new Date(
82
+ item.createdAt,
83
+ ).toLocaleTimeString()}</time
84
+ >
85
+ </div>
86
+ <div class="chat-bubble prose">{@html item.bodyHTML}</div>
87
+ <!-- <div class="chat-footer opacity-50">Delivered</div> -->
88
+ </div>
89
+ {/each}
90
+ {#if issue?.highlight && issue.state === 'OPEN'}
91
+ <span class="badge badge-warning">En attente de réponse de TA part 😉, oui 🫵!</span>
92
+ {/if}
93
+ {#if issueNumber}
94
+ <button on:click={update} aria-label="Actualiser" class="divider"></button>
95
+ {/if}
96
96
 
97
- {#if issue?.state === 'CLOSED'}
98
- <div class="flex justify-end">
99
- <Button on:click={reOpen} class="btn-neutral">Re Ouvrir</Button>
100
- </div>
101
- {:else}
102
- {#if issueNumber === null}
103
- <Field cell={cellBuildor(repo(FilterEntity), 'title')} bind:value={title} />
104
- {/if}
105
- <Textarea
106
- bind:value={content}
107
- placeholder="Un peu de détail c'est pas mal... Fais toi Plaiz' (Tu as même le droit d'utiliser le format markdown!)"
108
- ></Textarea>
109
- <div class="flex justify-between">
110
- {#if issueNumber}
111
- <Button on:click={close} tabIndex={-1} class="btn-outline btn-error"
112
- >Clore le feedback</Button
113
- >
114
- {:else}
115
- <div></div>
116
- {/if}
117
- <Button on:click={send} disabled={disableButton(issueNumber, title, content)}
118
- >Envoyer</Button
119
- >
120
- </div>
121
- {/if}
122
- {/if}
97
+ {#if issue?.state === 'CLOSED'}
98
+ <div class="flex justify-end">
99
+ <Button on:click={reOpen} class="btn-neutral">Re Ouvrir</Button>
100
+ </div>
101
+ {:else}
102
+ {#if issueNumber === null}
103
+ <Field cell={cellBuildor(repo(FilterEntity), 'title')} bind:value={title} />
104
+ {/if}
105
+ <Textarea
106
+ bind:value={content}
107
+ placeholder="Un peu de détail c'est pas mal... Fais toi Plaiz' (Tu as même le droit d'utiliser le format markdown!)"
108
+ ></Textarea>
109
+ <div class="flex justify-between">
110
+ {#if issueNumber}
111
+ <Button on:click={close} tabIndex={-1} class="btn-outline btn-error">Clore le feedback</Button>
112
+ {:else}
113
+ <div></div>
114
+ {/if}
115
+ <Button on:click={send} disabled={disableButton(issueNumber, title, content)}>Envoyer</Button>
116
+ </div>
117
+ {/if}
118
+ {/if}
123
119
  </div>
@@ -29,77 +29,77 @@ onMount(async () => {
29
29
  </script>
30
30
 
31
31
  <div class="mb-4 grid gap-4">
32
- <div class="flex justify-between">
33
- <div>
34
- <Button
35
- class={issueState === 'OPEN' ? 'btn-primary' : 'btn-ghost'}
36
- on:click={() => update('OPEN')}>En cours</Button
37
- >
38
- <Button
39
- class={issueState === 'CLOSED' ? 'btn-primary' : 'btn-ghost'}
40
- on:click={() => update('CLOSED')}>Clos</Button
41
- >
42
- </div>
32
+ <div class="flex justify-between">
33
+ <div>
34
+ <Button
35
+ class={issueState === 'OPEN' ? 'btn-primary' : 'btn-ghost'}
36
+ on:click={() => update('OPEN')}>En cours</Button
37
+ >
38
+ <Button
39
+ class={issueState === 'CLOSED' ? 'btn-primary' : 'btn-ghost'}
40
+ on:click={() => update('CLOSED')}>Clos</Button
41
+ >
42
+ </div>
43
43
 
44
- <Button
45
- on:click={async () => {
46
- await dialog.show({
47
- component: DialogIssue,
48
- classes: { root: 'overflow-auto w-[80vh] h-[80vh]' },
49
- props: { issueNumber: null, milestoneId },
50
- detail: {
51
- caption: 'Nouveau Feedback',
52
- icon: { data: LibIcon_Search },
53
- },
54
- })
55
- await update(issueState)
56
- }}
57
- >
58
- <Icon data={LibIcon_Add}></Icon>
59
- </Button>
60
- </div>
44
+ <Button
45
+ on:click={async () => {
46
+ await dialog.show({
47
+ component: DialogIssue,
48
+ classes: { root: 'overflow-auto w-[80vh] h-[80vh]' },
49
+ props: { issueNumber: null, milestoneId },
50
+ detail: {
51
+ caption: 'Nouveau Feedback',
52
+ icon: { data: LibIcon_Search },
53
+ },
54
+ })
55
+ await update(issueState)
56
+ }}
57
+ >
58
+ <Icon data={LibIcon_Add}></Icon>
59
+ </Button>
60
+ </div>
61
61
 
62
- {#each issues as issue}
63
- <Button
64
- on:click={async () => {
65
- await dialog.show({
66
- component: DialogIssue,
67
- classes: { root: 'overflow-auto w-[80vh] h-[80vh]' },
68
- props: { issueNumber: issue.number, milestoneId },
69
- detail: {
70
- caption: '#' + issue.number + ' - ' + issue.titleHTML,
71
- icon: { data: issue.state === 'OPEN' ? LibIcon_Search : LibIcon_Check },
72
- },
73
- })
74
- await update(issueState)
75
- }}
76
- class="btn-neutral"
77
- >
78
- <div class="flex w-full justify-center justify-items-center text-left">
79
- <div class="flex-grow">
80
- <span class="text-base-content/60 mr-2 inline-block w-8 text-right text-xs italic"
81
- >#{issue.number}</span
82
- >
83
- {@html issue.titleHTML}
84
- </div>
85
- {#if issue.highlight}
86
- <span class="badge badge-warning">En attente de réponse</span>
87
- {/if}
88
- </div>
89
- </Button>
90
- {:else}
91
- {#if state === 'loading'}
92
- <Loading class="h-12"></Loading>
93
- <Loading class="h-12"></Loading>
94
- <Loading class="h-12"></Loading>
95
- {:else}
96
- <div class="flex flex-col items-center justify-center p-8 text-center text-gray-500">
97
- <div class="mb-4">
98
- <Icon data={LibIcon_Search} size="4rem"></Icon>
99
- </div>
100
- <p class="text-lg font-medium">Aucun feedback <b>{issueState}</b> pour le moment</p>
101
- <p class="mt-2 text-sm">Soyez le premier à donner votre avis sur cette version !</p>
102
- </div>
103
- {/if}
104
- {/each}
62
+ {#each issues as issue}
63
+ <Button
64
+ on:click={async () => {
65
+ await dialog.show({
66
+ component: DialogIssue,
67
+ classes: { root: 'overflow-auto w-[80vh] h-[80vh]' },
68
+ props: { issueNumber: issue.number, milestoneId },
69
+ detail: {
70
+ caption: '#' + issue.number + ' - ' + issue.titleHTML,
71
+ icon: { data: issue.state === 'OPEN' ? LibIcon_Search : LibIcon_Check },
72
+ },
73
+ })
74
+ await update(issueState)
75
+ }}
76
+ class="btn-neutral"
77
+ >
78
+ <div class="flex w-full justify-center justify-items-center text-left">
79
+ <div class="flex-grow">
80
+ <span class="text-base-content/60 mr-2 inline-block w-8 text-right text-xs italic"
81
+ >#{issue.number}</span
82
+ >
83
+ {@html issue.titleHTML}
84
+ </div>
85
+ {#if issue.highlight}
86
+ <span class="badge badge-warning">En attente de réponse</span>
87
+ {/if}
88
+ </div>
89
+ </Button>
90
+ {:else}
91
+ {#if state === 'loading'}
92
+ <Loading class="h-12"></Loading>
93
+ <Loading class="h-12"></Loading>
94
+ <Loading class="h-12"></Loading>
95
+ {:else}
96
+ <div class="flex flex-col items-center justify-center p-8 text-center text-gray-500">
97
+ <div class="mb-4">
98
+ <Icon data={LibIcon_Search} size="4rem"></Icon>
99
+ </div>
100
+ <p class="text-lg font-medium">Aucun feedback <b>{issueState}</b> pour le moment</p>
101
+ <p class="mt-2 text-sm">Soyez le premier à donner votre avis sur cette version !</p>
102
+ </div>
103
+ {/if}
104
+ {/each}
105
105
  </div>
@@ -13,26 +13,26 @@ onMount(async () => {
13
13
  </script>
14
14
 
15
15
  <div class="mb-4 grid gap-4">
16
- {#each milestones as milestone}
17
- <Button
18
- on:click={() =>
19
- dialog.show({
20
- component: DialogIssues,
21
- classes: { root: 'overflow-auto w-[85vh] h-[85vh]' },
22
- props: { milestoneNumber: milestone.number, milestoneId: milestone.id },
23
- detail: { caption: milestone.title },
24
- })}
25
- class="btn-neutral"
26
- >
27
- {milestone.title}
28
- </Button>
29
- {:else}
30
- {#if state === 'loading'}
31
- <Loading class="h-12"></Loading>
32
- <Loading class="h-12"></Loading>
33
- <Loading class="h-12"></Loading>
34
- {:else}
35
- <p>No milestones found / Filter too strict!</p>
36
- {/if}
37
- {/each}
16
+ {#each milestones as milestone}
17
+ <Button
18
+ on:click={() =>
19
+ dialog.show({
20
+ component: DialogIssues,
21
+ classes: { root: 'overflow-auto w-[85vh] h-[85vh]' },
22
+ props: { milestoneNumber: milestone.number, milestoneId: milestone.id },
23
+ detail: { caption: milestone.title },
24
+ })}
25
+ class="btn-neutral"
26
+ >
27
+ {milestone.title}
28
+ </Button>
29
+ {:else}
30
+ {#if state === 'loading'}
31
+ <Loading class="h-12"></Loading>
32
+ <Loading class="h-12"></Loading>
33
+ <Loading class="h-12"></Loading>
34
+ {:else}
35
+ <p>No milestones found / Filter too strict!</p>
36
+ {/if}
37
+ {/each}
38
38
  </div>
package/esm/helper.js CHANGED
@@ -1,4 +1,4 @@
1
- import { getEntityRef, getValueList } from 'remult';
1
+ import { EntityError, getEntityRef, getValueList } from 'remult';
2
2
  import { getRelationFieldInfo } from 'remult/internals';
3
3
  import { suffixWithS } from './formats/strings.js';
4
4
  export function isError(object) {
@@ -76,7 +76,7 @@ export const getFieldMetaType = (field) => {
76
76
  kind: 'enum',
77
77
  subKind: 'single',
78
78
  // @ts-ignore
79
- values: field.options.valueConverter.values,
79
+ values: field.options.valueConverter.values.filter((v) => !v.hide),
80
80
  field,
81
81
  };
82
82
  }
@@ -147,7 +147,7 @@ export const onDelete = async (item, e, mode = 'prevent') => {
147
147
  if (nonEmptyRelations.length > 0) {
148
148
  if (mode === 'prevent') {
149
149
  const relationNames = nonEmptyRelations.map((r) => r.f.caption).join(', ');
150
- throw Error(`Can't with existing: ${relationNames}`);
150
+ throw new EntityError({ message: `Can't with existing: ${relationNames}` });
151
151
  }
152
152
  else if (mode === 'cascade') {
153
153
  nonEmptyRelations.forEach(async (r) => {
package/esm/index.d.ts CHANGED
@@ -1,10 +1,7 @@
1
- import type { RequestEvent } from '@sveltejs/kit';
2
1
  import type { FindOptionsBase } from 'remult';
3
- import { Log } from '@kitql/helpers';
4
2
  import type { BaseEnum, BaseItem, FF_Icon } from './BaseEnum.js';
5
3
  import type { CellsInput as CellsInput_ForExport } from './cellsBuildor.js';
6
4
  import type { ColumnDeciderArgs } from './changeLog/index.js';
7
- import { default as DefaultMail } from './mail/templates/DefaultMail.svelte';
8
5
  import { storeItem } from './storeItem.js';
9
6
  import { storeList } from './storeList.js';
10
7
  import { default as Button } from './ui/Button.svelte';
@@ -23,11 +20,9 @@ import { default as Link } from './ui/link/Link.svelte';
23
20
  import { default as LinkPlus } from './ui/link/LinkPlus.svelte';
24
21
  import { default as Loading } from './ui/Loading.svelte';
25
22
  import { default as Tooltip } from './ui/Tooltip.svelte';
26
- export { Field, FormEditAction, Grid, GridPaginate, FieldGroup, Icon, Link, LinkPlus, Loading, Button, Tooltip, DialogManagement, FieldContainer, SelectMelt, Clipboardable, DefaultMail, };
27
- export declare const ff_Log: Log;
28
- export declare const FF_Role: {
29
- Admin: string;
30
- };
23
+ export { Field, FormEditAction, Grid, GridPaginate, FieldGroup, Icon, Link, LinkPlus, Loading, Button, Tooltip, DialogManagement, FieldContainer, SelectMelt, Clipboardable, };
24
+ export { FF_Role } from './common.js';
25
+ export { ff_Log } from './common.js';
31
26
  export type { BaseEnumOptions } from './BaseEnum.js';
32
27
  export type { BaseItem };
33
28
  export type BaseItemLight = Partial<BaseItem>;
@@ -55,12 +50,6 @@ export { UIEntity } from './virtual/UIEntity.js';
55
50
  export { LibIcon_Empty, LibIcon_Forbidden, LibIcon_ChevronDown, LibIcon_ChevronUp, LibIcon_ChevronLeft, LibIcon_ChevronRight, LibIcon_Search, LibIcon_Check, LibIcon_MultiCheck, LibIcon_Add, LibIcon_MultiAdd, LibIcon_Edit, LibIcon_Delete, LibIcon_Cross, LibIcon_Save, LibIcon_Man, LibIcon_Woman, LibIcon_Send, LibIcon_Load, LibIcon_Settings, LibIcon_Sort, LibIcon_SortAsc, LibIcon_SortDesc, } from './ui/LibIcon.js';
56
51
  export type { FF_Icon };
57
52
  declare module 'remult' {
58
- interface RemultContext {
59
- url: URL;
60
- setHeaders(headers: Record<string, string>): void;
61
- setCookie(...args: Parameters<RequestEvent['cookies']['set']>): void;
62
- deleteCookie(...args: Parameters<RequestEvent['cookies']['delete']>): void;
63
- }
64
53
  interface FieldOptions<entityType, valueType> {
65
54
  placeholder?: string;
66
55
  suffix?: string;
@@ -90,10 +79,4 @@ declare module 'remult' {
90
79
  permissionApiUpdate?: BaseEnum[] | BaseEnum;
91
80
  changeLog?: false | ColumnDeciderArgs<entityType>;
92
81
  }
93
- interface UserInfo {
94
- session: {
95
- id: string;
96
- expiresAt: Date;
97
- };
98
- }
99
82
  }
package/esm/index.js CHANGED
@@ -1,5 +1,3 @@
1
- import { Log } from '@kitql/helpers';
2
- import { default as DefaultMail } from './mail/templates/DefaultMail.svelte';
3
1
  import { storeItem } from './storeItem.js';
4
2
  import { storeList } from './storeList.js';
5
3
  import { default as Button } from './ui/Button.svelte';
@@ -20,14 +18,9 @@ import { default as Tooltip } from './ui/Tooltip.svelte';
20
18
  // ******************************
21
19
  // Svelte Components
22
20
  // ******************************
23
- export { Field, FormEditAction, Grid, GridPaginate, FieldGroup, Icon, Link, LinkPlus, Loading, Button, Tooltip, DialogManagement, FieldContainer, SelectMelt, Clipboardable, DefaultMail, };
24
- // ******************************
25
- // Objects
26
- // ******************************
27
- export const ff_Log = new Log('firstly');
28
- export const FF_Role = {
29
- Admin: 'FF_Role.Admin',
30
- };
21
+ export { Field, FormEditAction, Grid, GridPaginate, FieldGroup, Icon, Link, LinkPlus, Loading, Button, Tooltip, DialogManagement, FieldContainer, SelectMelt, Clipboardable, };
22
+ export { FF_Role } from './common.js';
23
+ export { ff_Log } from './common.js';
31
24
  // ******************************
32
25
  // Helpers
33
26
  // ******************************
@@ -1,30 +1,2 @@
1
- import type * as typeNodemailer from 'nodemailer';
2
- import type JSONTransport from 'nodemailer/lib/json-transport';
3
- import type Mail from 'nodemailer/lib/mailer';
4
- import type SendmailTransport from 'nodemailer/lib/sendmail-transport';
5
- import type SESTransport from 'nodemailer/lib/ses-transport';
6
- import type SMTPPool from 'nodemailer/lib/smtp-pool';
7
- import type SMTPTransport from 'nodemailer/lib/smtp-transport';
8
- import type StreamTransport from 'nodemailer/lib/stream-transport';
9
- import type { ComponentProps, ComponentType, SvelteComponent } from 'svelte';
10
- import { DefaultMail } from '../';
11
- export type TransportTypes = SMTPTransport | SMTPTransport.Options | string | SMTPPool | SMTPPool.Options | SendmailTransport | SendmailTransport.Options | StreamTransport | StreamTransport.Options | JSONTransport | JSONTransport.Options | SESTransport | SESTransport.Options | typeNodemailer.Transport<any> | typeNodemailer.TransportOptions;
12
- export type DefaultOptions = SMTPTransport.Options | SMTPPool.Options | SendmailTransport.Options | StreamTransport.Options | JSONTransport.Options | SESTransport.Options | typeNodemailer.TransportOptions;
13
- export type MailOptions<ComponentTemplateDefault extends SvelteComponent> = {
14
- from?: Mail.Options['from'];
15
- template?: {
16
- component?: ComponentType<ComponentTemplateDefault>;
17
- brandColor?: string;
18
- };
19
- transport?: TransportTypes;
20
- defaults?: DefaultOptions;
21
- apiUrl?: Parameters<typeof typeNodemailer.createTestAccount>[0];
22
- };
23
- declare let transporter: ReturnType<typeof typeNodemailer.createTransport>;
24
- export declare const mailInit: (nodemailer: typeof typeNodemailer, o?: MailOptions<SvelteComponent>) => void;
25
- export declare const sendMail: <ComponentTemplateDefault extends SvelteComponent = DefaultMail>(
26
- /** usefull for logs, it has NO impact on the mail itself */
27
- topic: string, mailOptions: Parameters<typeof transporter.sendMail>[0] & {
28
- templateProps?: ComponentProps<ComponentTemplateDefault> | undefined;
29
- }) => ReturnType<typeof transporter.sendMail>;
30
- export {};
1
+ import { default as DefaultMail } from './templates/DefaultMail.svelte';
2
+ export { DefaultMail };