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/cellsBuildor.js
CHANGED
|
@@ -55,9 +55,6 @@ export const buildSearchWhere = (entity, fields, search) => {
|
|
|
55
55
|
const f = [
|
|
56
56
|
{
|
|
57
57
|
$or: fields.map((f) => {
|
|
58
|
-
// REMULT P1: isServerExpression is false when sqlExpression there ?!
|
|
59
|
-
// if (f.isServerExpression || f.options.sqlExpression) {
|
|
60
|
-
// check if this field has a specific filter function
|
|
61
58
|
const fnName = f.key + 'Filter';
|
|
62
59
|
// @ts-ignore
|
|
63
60
|
if (entity && entity[fnName]) {
|
|
@@ -77,6 +74,9 @@ export const buildSearchWhere = (entity, fields, search) => {
|
|
|
77
74
|
return f;
|
|
78
75
|
};
|
|
79
76
|
export const containsWords = (fields, search) => {
|
|
77
|
+
if (!search) {
|
|
78
|
+
return {};
|
|
79
|
+
}
|
|
80
80
|
const sSplitted = search.split(' ').filter((s) => s.length > 0);
|
|
81
81
|
if (fields.length === 1) {
|
|
82
82
|
return {
|
|
@@ -84,8 +84,8 @@ export const containsWords = (fields, search) => {
|
|
|
84
84
|
};
|
|
85
85
|
}
|
|
86
86
|
return {
|
|
87
|
-
$
|
|
88
|
-
return { $
|
|
87
|
+
$and: sSplitted.map((s) => {
|
|
88
|
+
return { $or: fields.map((f) => ({ [f.key]: { $contains: s } })) };
|
|
89
89
|
}),
|
|
90
90
|
};
|
|
91
91
|
};
|
|
@@ -94,7 +94,7 @@ export const buildWhere = (entity, defaultWhere, fields_filter, fields_search, o
|
|
|
94
94
|
if (defaultWhere) {
|
|
95
95
|
and.push(defaultWhere);
|
|
96
96
|
}
|
|
97
|
-
if (obj.search) {
|
|
97
|
+
if (obj && obj.search) {
|
|
98
98
|
and.push(...buildSearchWhere(entity, fields_search, obj.search));
|
|
99
99
|
}
|
|
100
100
|
for (const field of fields_filter) {
|
package/esm/changeLog/index.d.ts
CHANGED
|
@@ -1,40 +1,4 @@
|
|
|
1
1
|
import { type FieldRef, type FieldsRef, type LifecycleEvent } from 'remult';
|
|
2
|
-
import type { Module } from '../api';
|
|
3
|
-
/**
|
|
4
|
-
* ## Default way
|
|
5
|
-
* The easiest is to switch from `@Entity` to `@FF_Entity` to the entities where you want to log changes.
|
|
6
|
-
*
|
|
7
|
-
* ```ts
|
|
8
|
-
* \@FF_Entity<User>('users', {
|
|
9
|
-
*
|
|
10
|
-
* // Optional => To disable change logs
|
|
11
|
-
* // changeLog: false,
|
|
12
|
-
*
|
|
13
|
-
* // Optional => To disable some columns from being logged
|
|
14
|
-
* // changeLog: {
|
|
15
|
-
* // excludeColumns: (e) => {
|
|
16
|
-
* // return [e.password]
|
|
17
|
-
* // },
|
|
18
|
-
* // },
|
|
19
|
-
* })
|
|
20
|
-
* export class User {}
|
|
21
|
-
* ```
|
|
22
|
-
*
|
|
23
|
-
* ## Manual way
|
|
24
|
-
* If you want to go more manual, you can import these functions and call them in your entity's lifecycle events.
|
|
25
|
-
* ```ts
|
|
26
|
-
* \@Entity<User>('users', {
|
|
27
|
-
* saved: async (entity, e) => {
|
|
28
|
-
* await recordSaved(entity, e)
|
|
29
|
-
* },
|
|
30
|
-
* deleted: async (entity, e) => {
|
|
31
|
-
* await recordDeleted(entity, e)
|
|
32
|
-
* },
|
|
33
|
-
* })
|
|
34
|
-
* export class User {}
|
|
35
|
-
* ```
|
|
36
|
-
*/
|
|
37
|
-
export declare const changeLog: () => Module;
|
|
38
2
|
export declare class ChangeLog {
|
|
39
3
|
id: string;
|
|
40
4
|
entity: string;
|
package/esm/changeLog/index.js
CHANGED
|
@@ -4,47 +4,7 @@ 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 { Entity, Fields, getEntityRef, IdEntity, isBackend, remult, } from 'remult';
|
|
8
|
-
/**
|
|
9
|
-
* ## Default way
|
|
10
|
-
* The easiest is to switch from `@Entity` to `@FF_Entity` to the entities where you want to log changes.
|
|
11
|
-
*
|
|
12
|
-
* ```ts
|
|
13
|
-
* \@FF_Entity<User>('users', {
|
|
14
|
-
*
|
|
15
|
-
* // Optional => To disable change logs
|
|
16
|
-
* // changeLog: false,
|
|
17
|
-
*
|
|
18
|
-
* // Optional => To disable some columns from being logged
|
|
19
|
-
* // changeLog: {
|
|
20
|
-
* // excludeColumns: (e) => {
|
|
21
|
-
* // return [e.password]
|
|
22
|
-
* // },
|
|
23
|
-
* // },
|
|
24
|
-
* })
|
|
25
|
-
* export class User {}
|
|
26
|
-
* ```
|
|
27
|
-
*
|
|
28
|
-
* ## Manual way
|
|
29
|
-
* If you want to go more manual, you can import these functions and call them in your entity's lifecycle events.
|
|
30
|
-
* ```ts
|
|
31
|
-
* \@Entity<User>('users', {
|
|
32
|
-
* saved: async (entity, e) => {
|
|
33
|
-
* await recordSaved(entity, e)
|
|
34
|
-
* },
|
|
35
|
-
* deleted: async (entity, e) => {
|
|
36
|
-
* await recordDeleted(entity, e)
|
|
37
|
-
* },
|
|
38
|
-
* })
|
|
39
|
-
* export class User {}
|
|
40
|
-
* ```
|
|
41
|
-
*/
|
|
42
|
-
export const changeLog = () => {
|
|
43
|
-
return {
|
|
44
|
-
name: 'changeLog',
|
|
45
|
-
entities: [ChangeLog],
|
|
46
|
-
};
|
|
47
|
-
};
|
|
7
|
+
import { Entity, Fields, getEntityRef, IdEntity, isBackend, remult, repo, } from 'remult';
|
|
48
8
|
let ChangeLog = class ChangeLog {
|
|
49
9
|
id = '';
|
|
50
10
|
entity = '';
|
|
@@ -120,7 +80,7 @@ export async function recordSaved(entity, e, options) {
|
|
|
120
80
|
}
|
|
121
81
|
}
|
|
122
82
|
if (changes.length > 0) {
|
|
123
|
-
await
|
|
83
|
+
await repo(ChangeLog).insert({
|
|
124
84
|
changeDate,
|
|
125
85
|
changes,
|
|
126
86
|
entity: e.metadata.key,
|
|
@@ -153,7 +113,7 @@ export async function recordDeleted(entity, e, options) {
|
|
|
153
113
|
throw err;
|
|
154
114
|
}
|
|
155
115
|
}
|
|
156
|
-
await
|
|
116
|
+
await repo(ChangeLog).insert({
|
|
157
117
|
changeDate,
|
|
158
118
|
changes,
|
|
159
119
|
entity: e.metadata.key,
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Module } from '../../api';
|
|
2
|
+
/**
|
|
3
|
+
* ## Default way
|
|
4
|
+
* The easiest is to switch from `@Entity` to `@FF_Entity` to the entities where you want to log changes.
|
|
5
|
+
*
|
|
6
|
+
* ```ts
|
|
7
|
+
* \@FF_Entity<User>('users', {
|
|
8
|
+
*
|
|
9
|
+
* // Optional => To disable change logs
|
|
10
|
+
* // changeLog: false,
|
|
11
|
+
*
|
|
12
|
+
* // Optional => To disable some columns from being logged
|
|
13
|
+
* // changeLog: {
|
|
14
|
+
* // excludeColumns: (e) => {
|
|
15
|
+
* // return [e.password]
|
|
16
|
+
* // },
|
|
17
|
+
* // },
|
|
18
|
+
* })
|
|
19
|
+
* export class User {}
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* ## Manual way
|
|
23
|
+
* If you want to go more manual, you can import these functions and call them in your entity's lifecycle events.
|
|
24
|
+
* ```ts
|
|
25
|
+
* \@Entity<User>('users', {
|
|
26
|
+
* saved: async (entity, e) => {
|
|
27
|
+
* await recordSaved(entity, e)
|
|
28
|
+
* },
|
|
29
|
+
* deleted: async (entity, e) => {
|
|
30
|
+
* await recordDeleted(entity, e)
|
|
31
|
+
* },
|
|
32
|
+
* })
|
|
33
|
+
* export class User {}
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare const changeLog: () => Module;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Module } from '../../api';
|
|
2
|
+
import { ChangeLog } from '../index';
|
|
3
|
+
/**
|
|
4
|
+
* ## Default way
|
|
5
|
+
* The easiest is to switch from `@Entity` to `@FF_Entity` to the entities where you want to log changes.
|
|
6
|
+
*
|
|
7
|
+
* ```ts
|
|
8
|
+
* \@FF_Entity<User>('users', {
|
|
9
|
+
*
|
|
10
|
+
* // Optional => To disable change logs
|
|
11
|
+
* // changeLog: false,
|
|
12
|
+
*
|
|
13
|
+
* // Optional => To disable some columns from being logged
|
|
14
|
+
* // changeLog: {
|
|
15
|
+
* // excludeColumns: (e) => {
|
|
16
|
+
* // return [e.password]
|
|
17
|
+
* // },
|
|
18
|
+
* // },
|
|
19
|
+
* })
|
|
20
|
+
* export class User {}
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* ## Manual way
|
|
24
|
+
* If you want to go more manual, you can import these functions and call them in your entity's lifecycle events.
|
|
25
|
+
* ```ts
|
|
26
|
+
* \@Entity<User>('users', {
|
|
27
|
+
* saved: async (entity, e) => {
|
|
28
|
+
* await recordSaved(entity, e)
|
|
29
|
+
* },
|
|
30
|
+
* deleted: async (entity, e) => {
|
|
31
|
+
* await recordDeleted(entity, e)
|
|
32
|
+
* },
|
|
33
|
+
* })
|
|
34
|
+
* export class User {}
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export const changeLog = () => {
|
|
38
|
+
return new Module({
|
|
39
|
+
name: 'changeLog',
|
|
40
|
+
entities: [ChangeLog],
|
|
41
|
+
});
|
|
42
|
+
};
|
|
@@ -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.running ? 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
|
|
13
|
+
throw new EntityError({ message: 'GITHUB_API_TOKEN not found in .env' });
|
|
14
14
|
}
|
|
15
15
|
try {
|
|
16
16
|
const headers = new Headers({
|
package/esm/feedback/index.d.ts
CHANGED
|
@@ -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;
|
package/esm/feedback/index.js
CHANGED
|
@@ -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
|
+
};
|
|
@@ -91,7 +91,7 @@ const disableButton = (issueNumber2, title2, content2) => {
|
|
|
91
91
|
<span class="badge badge-warning">En attente de réponse de TA part 😉, oui 🫵!</span>
|
|
92
92
|
{/if}
|
|
93
93
|
{#if issueNumber}
|
|
94
|
-
<button on:click={update} class="divider"></button>
|
|
94
|
+
<button on:click={update} aria-label="Actualiser" class="divider"></button>
|
|
95
95
|
{/if}
|
|
96
96
|
|
|
97
97
|
{#if issue?.state === 'CLOSED'}
|
|
@@ -102,7 +102,9 @@ const disableButton = (issueNumber2, title2, content2) => {
|
|
|
102
102
|
{#if issueNumber === null}
|
|
103
103
|
<Field cell={cellBuildor(repo(FilterEntity), 'title')} bind:value={title} />
|
|
104
104
|
{/if}
|
|
105
|
-
<Textarea
|
|
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!)"
|
|
106
108
|
></Textarea>
|
|
107
109
|
<div class="flex justify-between">
|
|
108
110
|
{#if issueNumber}
|
|
@@ -45,7 +45,7 @@ onMount(async () => {
|
|
|
45
45
|
on:click={async () => {
|
|
46
46
|
await dialog.show({
|
|
47
47
|
component: DialogIssue,
|
|
48
|
-
classes: { root: 'overflow-auto w-
|
|
48
|
+
classes: { root: 'overflow-auto w-[80vh] h-[80vh]' },
|
|
49
49
|
props: { issueNumber: null, milestoneId },
|
|
50
50
|
detail: {
|
|
51
51
|
caption: 'Nouveau Feedback',
|
|
@@ -64,10 +64,10 @@ onMount(async () => {
|
|
|
64
64
|
on:click={async () => {
|
|
65
65
|
await dialog.show({
|
|
66
66
|
component: DialogIssue,
|
|
67
|
-
classes: { root: 'overflow-auto w-
|
|
67
|
+
classes: { root: 'overflow-auto w-[80vh] h-[80vh]' },
|
|
68
68
|
props: { issueNumber: issue.number, milestoneId },
|
|
69
69
|
detail: {
|
|
70
|
-
caption: issue.titleHTML,
|
|
70
|
+
caption: '#' + issue.number + ' - ' + issue.titleHTML,
|
|
71
71
|
icon: { data: issue.state === 'OPEN' ? LibIcon_Search : LibIcon_Check },
|
|
72
72
|
},
|
|
73
73
|
})
|
|
@@ -77,6 +77,9 @@ onMount(async () => {
|
|
|
77
77
|
>
|
|
78
78
|
<div class="flex w-full justify-center justify-items-center text-left">
|
|
79
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
|
+
>
|
|
80
83
|
{@html issue.titleHTML}
|
|
81
84
|
</div>
|
|
82
85
|
{#if issue.highlight}
|
|
@@ -90,7 +93,13 @@ onMount(async () => {
|
|
|
90
93
|
<Loading class="h-12"></Loading>
|
|
91
94
|
<Loading class="h-12"></Loading>
|
|
92
95
|
{:else}
|
|
93
|
-
<p
|
|
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>
|
|
94
103
|
{/if}
|
|
95
104
|
{/each}
|
|
96
105
|
</div>
|
|
@@ -18,7 +18,7 @@ onMount(async () => {
|
|
|
18
18
|
on:click={() =>
|
|
19
19
|
dialog.show({
|
|
20
20
|
component: DialogIssues,
|
|
21
|
-
classes: { root: 'overflow-auto w-
|
|
21
|
+
classes: { root: 'overflow-auto w-[85vh] h-[85vh]' },
|
|
22
22
|
props: { milestoneNumber: milestone.number, milestoneId: milestone.id },
|
|
23
23
|
detail: { caption: milestone.title },
|
|
24
24
|
})}
|
|
@@ -3,10 +3,12 @@ import DialogMilestones from "./DialogMilestones.svelte";
|
|
|
3
3
|
const list = async () => {
|
|
4
4
|
await dialog.show({
|
|
5
5
|
component: DialogMilestones,
|
|
6
|
-
classes: { root: "overflow-auto w-
|
|
6
|
+
classes: { root: "overflow-auto w-[90vh] h-[90vh]" },
|
|
7
7
|
detail: { caption: "Feedback" }
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
</script>
|
|
11
11
|
|
|
12
12
|
<button class="text-secondary" on:click={list}>Feedback</button>
|
|
13
|
+
|
|
14
|
+
<!-- <span class="h-9/12 hidden w-9/12"></span> -->
|
package/esm/helper.d.ts
CHANGED
|
@@ -35,7 +35,6 @@ export declare const getFieldMetaType: (field?: FieldMetadata) => FieldMetaType;
|
|
|
35
35
|
export declare const displayWithDefaultAndSuffix: (field: FieldMetadata<any, any> | undefined, value: any) => string;
|
|
36
36
|
export declare const getEnum: <T extends BaseEnum>(baseEnum: ClassType<T>, id: string | undefined | null) => T | undefined;
|
|
37
37
|
export declare const getEnums: <T extends BaseEnum>(baseEnum: ClassType<T>) => T[];
|
|
38
|
-
export declare const upsert: <Entity>(currentRepo: Repository<Entity>, id: Parameters<typeof currentRepo.findId>[0], entity: Partial<Entity>) => Promise<void>;
|
|
39
38
|
/**
|
|
40
39
|
* To be used like:
|
|
41
40
|
* ```ts
|
package/esm/helper.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { getEntityRef, getValueList } from 'remult';
|
|
1
|
+
import { EntityError, getEntityRef, getValueList } from 'remult';
|
|
2
2
|
import { getRelationFieldInfo } from 'remult/internals';
|
|
3
|
-
import { stryEq } from '@kitql/helpers';
|
|
4
3
|
import { suffixWithS } from './formats/strings.js';
|
|
5
4
|
export function isError(object) {
|
|
6
5
|
return object;
|
|
@@ -77,7 +76,7 @@ export const getFieldMetaType = (field) => {
|
|
|
77
76
|
kind: 'enum',
|
|
78
77
|
subKind: 'single',
|
|
79
78
|
// @ts-ignore
|
|
80
|
-
values: field.options.valueConverter.values,
|
|
79
|
+
values: field.options.valueConverter.values.filter((v) => !v.hide),
|
|
81
80
|
field,
|
|
82
81
|
};
|
|
83
82
|
}
|
|
@@ -119,19 +118,6 @@ export const getEnum = (baseEnum, id) => {
|
|
|
119
118
|
export const getEnums = (baseEnum) => {
|
|
120
119
|
return getValueList(baseEnum) || [];
|
|
121
120
|
};
|
|
122
|
-
export const upsert = async (currentRepo, id, entity) => {
|
|
123
|
-
const found = await currentRepo.findId(id);
|
|
124
|
-
if (found) {
|
|
125
|
-
// @ts-ignore
|
|
126
|
-
if (!stryEq(found, entity)) {
|
|
127
|
-
// Opti => Sedn only the diff?
|
|
128
|
-
await currentRepo.update(id, entity);
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
else {
|
|
132
|
-
await currentRepo.insert(entity);
|
|
133
|
-
}
|
|
134
|
-
};
|
|
135
121
|
/**
|
|
136
122
|
* To be used like:
|
|
137
123
|
* ```ts
|
|
@@ -161,7 +147,7 @@ export const onDelete = async (item, e, mode = 'prevent') => {
|
|
|
161
147
|
if (nonEmptyRelations.length > 0) {
|
|
162
148
|
if (mode === 'prevent') {
|
|
163
149
|
const relationNames = nonEmptyRelations.map((r) => r.f.caption).join(', ');
|
|
164
|
-
throw
|
|
150
|
+
throw new EntityError({ message: `Can't with existing: ${relationNames}` });
|
|
165
151
|
}
|
|
166
152
|
else if (mode === 'cascade') {
|
|
167
153
|
nonEmptyRelations.forEach(async (r) => {
|
package/esm/index.d.ts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import type { RequestEvent } from '@sveltejs/kit';
|
|
2
1
|
import type { FindOptionsBase } from 'remult';
|
|
3
2
|
import { Log } from '@kitql/helpers';
|
|
4
3
|
import type { BaseEnum, BaseItem, FF_Icon } from './BaseEnum.js';
|
|
5
4
|
import type { CellsInput as CellsInput_ForExport } from './cellsBuildor.js';
|
|
6
5
|
import type { ColumnDeciderArgs } from './changeLog/index.js';
|
|
7
|
-
import { default as DefaultMail } from './mail/templates/DefaultMail.svelte';
|
|
8
6
|
import { storeItem } from './storeItem.js';
|
|
9
7
|
import { storeList } from './storeList.js';
|
|
10
8
|
import { default as Button } from './ui/Button.svelte';
|
|
@@ -23,10 +21,10 @@ import { default as Link } from './ui/link/Link.svelte';
|
|
|
23
21
|
import { default as LinkPlus } from './ui/link/LinkPlus.svelte';
|
|
24
22
|
import { default as Loading } from './ui/Loading.svelte';
|
|
25
23
|
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,
|
|
24
|
+
export { Field, FormEditAction, Grid, GridPaginate, FieldGroup, Icon, Link, LinkPlus, Loading, Button, Tooltip, DialogManagement, FieldContainer, SelectMelt, Clipboardable, };
|
|
27
25
|
export declare const ff_Log: Log;
|
|
28
26
|
export declare const FF_Role: {
|
|
29
|
-
|
|
27
|
+
readonly FF_Role_Admin: "FF_Role.Admin";
|
|
30
28
|
};
|
|
31
29
|
export type { BaseEnumOptions } from './BaseEnum.js';
|
|
32
30
|
export type { BaseItem };
|
|
@@ -43,7 +41,7 @@ export { FF_Entity } from './FF_Entity.js';
|
|
|
43
41
|
export { FF_LogToConsole } from './SqlDatabase/FF_LogToConsole.js';
|
|
44
42
|
export { BaseEnum } from './BaseEnum.js';
|
|
45
43
|
export { dialog } from './ui/dialog/dialog.js';
|
|
46
|
-
export { getEntityDisplayValue, isError, getFieldLinkDisplayValue, getEnum, getEnums,
|
|
44
|
+
export { getEntityDisplayValue, isError, getFieldLinkDisplayValue, getEnum, getEnums, onDelete, } from './helper.js';
|
|
47
45
|
export { buildWhere, getPlaceholder, buildSearchWhere, cellsBuildor, cellBuildor, fieldsOf, containsWords, } from './cellsBuildor.js';
|
|
48
46
|
export { storeItem };
|
|
49
47
|
export { storeList };
|
|
@@ -55,12 +53,6 @@ export { UIEntity } from './virtual/UIEntity.js';
|
|
|
55
53
|
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
54
|
export type { FF_Icon };
|
|
57
55
|
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
56
|
interface FieldOptions<entityType, valueType> {
|
|
65
57
|
placeholder?: string;
|
|
66
58
|
suffix?: string;
|
|
@@ -90,10 +82,4 @@ declare module 'remult' {
|
|
|
90
82
|
permissionApiUpdate?: BaseEnum[] | BaseEnum;
|
|
91
83
|
changeLog?: false | ColumnDeciderArgs<entityType>;
|
|
92
84
|
}
|
|
93
|
-
interface UserInfo {
|
|
94
|
-
session: {
|
|
95
|
-
id: string;
|
|
96
|
-
expiresAt: Date;
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
85
|
}
|
package/esm/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Log } from '@kitql/helpers';
|
|
2
|
-
import { default as DefaultMail } from './mail/templates/DefaultMail.svelte';
|
|
3
2
|
import { storeItem } from './storeItem.js';
|
|
4
3
|
import { storeList } from './storeList.js';
|
|
5
4
|
import { default as Button } from './ui/Button.svelte';
|
|
@@ -20,13 +19,13 @@ import { default as Tooltip } from './ui/Tooltip.svelte';
|
|
|
20
19
|
// ******************************
|
|
21
20
|
// Svelte Components
|
|
22
21
|
// ******************************
|
|
23
|
-
export { Field, FormEditAction, Grid, GridPaginate, FieldGroup, Icon, Link, LinkPlus, Loading, Button, Tooltip, DialogManagement, FieldContainer, SelectMelt, Clipboardable,
|
|
22
|
+
export { Field, FormEditAction, Grid, GridPaginate, FieldGroup, Icon, Link, LinkPlus, Loading, Button, Tooltip, DialogManagement, FieldContainer, SelectMelt, Clipboardable, };
|
|
24
23
|
// ******************************
|
|
25
24
|
// Objects
|
|
26
25
|
// ******************************
|
|
27
26
|
export const ff_Log = new Log('firstly');
|
|
28
27
|
export const FF_Role = {
|
|
29
|
-
|
|
28
|
+
FF_Role_Admin: 'FF_Role.Admin',
|
|
30
29
|
};
|
|
31
30
|
// ******************************
|
|
32
31
|
// Helpers
|
|
@@ -36,7 +35,7 @@ export { FF_Entity } from './FF_Entity.js';
|
|
|
36
35
|
export { FF_LogToConsole } from './SqlDatabase/FF_LogToConsole.js';
|
|
37
36
|
export { BaseEnum } from './BaseEnum.js';
|
|
38
37
|
export { dialog } from './ui/dialog/dialog.js';
|
|
39
|
-
export { getEntityDisplayValue, isError, getFieldLinkDisplayValue, getEnum, getEnums,
|
|
38
|
+
export { getEntityDisplayValue, isError, getFieldLinkDisplayValue, getEnum, getEnums, onDelete, } from './helper.js';
|
|
40
39
|
export { buildWhere, getPlaceholder, buildSearchWhere, cellsBuildor, cellBuildor, fieldsOf, containsWords, } from './cellsBuildor.js';
|
|
41
40
|
export { storeItem };
|
|
42
41
|
export { storeList };
|