firstly 0.0.16-next.2 → 0.1.0-next.4
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 +42 -0
- package/esm/SqlDatabase/FF_LogToConsole.d.ts +14 -0
- package/esm/SqlDatabase/FF_LogToConsole.js +24 -5
- package/esm/auth/Entities.d.ts +4 -3
- package/esm/auth/Entities.js +19 -15
- package/esm/auth/server/AuthController.server.js +86 -93
- package/esm/auth/server/handleAuth.d.ts +4 -2
- package/esm/auth/server/handleAuth.js +8 -4
- package/esm/auth/server/helperRole.d.ts +11 -4
- package/esm/auth/server/helperRole.js +29 -20
- package/esm/auth/server/index.d.ts +1 -0
- package/esm/auth/server/index.js +1 -0
- package/esm/auth/server/module.d.ts +27 -5
- package/esm/auth/server/module.js +24 -10
- package/esm/auth/server/providers/github.js +13 -2
- package/esm/auth/static/assets/Page-5iUUg7GN.d.ts +2 -0
- package/esm/auth/static/assets/Page-5iUUg7GN.js +1 -0
- package/esm/auth/static/assets/Page-BHW08QWz.css +1 -0
- package/esm/auth/static/assets/Page-BcSzu3xq.d.ts +2 -0
- package/esm/auth/static/assets/Page-BcSzu3xq.js +20 -0
- package/esm/auth/static/assets/Page-sEK21EQB.d.ts +2 -0
- package/esm/auth/static/assets/Page-sEK21EQB.js +1 -0
- package/esm/auth/static/assets/index-RpcgeXPm.d.ts +232 -0
- package/esm/auth/static/assets/index-RpcgeXPm.js +2 -0
- package/esm/auth/static/index.html +1 -1
- package/esm/auth/types.d.ts +1 -0
- package/esm/bin/cmd.js +16 -16
- package/esm/changeLog/changeLogEntities.d.ts +21 -0
- package/esm/changeLog/changeLogEntities.js +57 -0
- package/esm/changeLog/index.d.ts +3 -15
- package/esm/changeLog/index.js +3 -51
- package/esm/changeLog/server/index.d.ts +39 -28
- package/esm/changeLog/server/index.js +40 -29
- package/esm/cron/Cron.d.ts +11 -0
- package/esm/cron/Cron.js +43 -0
- package/esm/cron/Role_Cron.d.ts +3 -0
- package/esm/cron/Role_Cron.js +3 -0
- package/esm/cron/index.d.ts +3 -0
- package/esm/cron/index.js +3 -0
- package/esm/cron/server/index.d.ts +29 -11
- package/esm/cron/server/index.js +29 -13
- package/esm/feedback/FeedbackController.d.ts +3 -1
- package/esm/feedback/FeedbackController.js +23 -1
- package/esm/feedback/server/index.d.ts +2 -2
- package/esm/feedback/server/index.js +2 -2
- package/esm/feedback/types.d.ts +6 -0
- package/esm/feedback/ui/DialogIssue.svelte +16 -2
- package/esm/feedback/ui/DialogIssues.svelte +2 -2
- package/esm/feedback/ui/DialogMilestones.svelte +2 -3
- package/esm/feedback/ui/Feedback.svelte +1 -1
- package/esm/formats/dates.js +1 -1
- package/esm/formats/index.d.ts +1 -1
- package/esm/formats/index.js +1 -1
- package/esm/formats/strings.d.ts +2 -0
- package/esm/formats/strings.js +22 -0
- package/esm/index.d.ts +3 -84
- package/esm/index.js +3 -47
- package/esm/internals/FF_Entity.d.ts +2 -0
- package/esm/{FF_Entity.js → internals/FF_Entity.js} +10 -10
- package/esm/{FF_Fields.js → internals/FF_Fields.js} +1 -1
- package/esm/{cellsBuildor.d.ts → internals/cellsBuildor.d.ts} +1 -1
- package/esm/{common.d.ts → internals/common.d.ts} +0 -2
- package/esm/internals/common.js +3 -0
- package/esm/{helper.js → internals/helper.js} +1 -1
- package/esm/internals/index.d.ts +83 -0
- package/esm/internals/index.js +45 -0
- package/esm/{storeItem.js → internals/storeItem.js} +2 -2
- package/esm/mail/Mail.d.ts +13 -0
- package/esm/mail/Mail.js +51 -0
- package/esm/mail/Role_Mail.d.ts +3 -0
- package/esm/mail/Role_Mail.js +3 -0
- package/esm/mail/index.d.ts +7 -2
- package/esm/mail/index.js +7 -2
- package/esm/mail/server/formatMailHelper.d.ts +16 -0
- package/esm/mail/server/formatMailHelper.js +113 -0
- package/esm/mail/server/index.d.ts +32 -19
- package/esm/mail/server/index.js +113 -38
- package/esm/server/index.d.ts +9 -6
- package/esm/server/index.js +28 -50
- package/esm/svelte/FF_Layout.svelte +2 -2
- package/esm/svelte/dialog/DialogManagement.svelte +2 -2
- package/esm/svelte/dialog/DialogPrimitive.svelte +1 -1
- package/esm/svelte/dialog/DialogPrimitive.svelte.d.ts +1 -1
- package/esm/svelte/dialog/dialog.d.ts +1 -1
- package/esm/svelte/dialog/dialog.js +1 -1
- package/esm/svelte/helpers.d.ts +1 -0
- package/esm/svelte/index.d.ts +1 -0
- package/esm/svelte/index.js +1 -0
- package/esm/svelte/initRemultSvelteReactivity.d.ts +1 -0
- package/esm/svelte/initRemultSvelteReactivity.js +29 -0
- package/esm/sveltekit/server/index.d.ts +2 -2
- package/esm/sveltekit/server/index.js +2 -2
- package/esm/ui/Button.svelte +2 -2
- package/esm/ui/Button.svelte.d.ts +1 -1
- package/esm/ui/Field.svelte +7 -5
- package/esm/ui/Field.svelte.d.ts +5 -2
- package/esm/ui/FieldGroup.svelte +4 -3
- package/esm/ui/FieldGroup.svelte.d.ts +7 -4
- package/esm/ui/Grid.svelte +3 -3
- package/esm/ui/Grid.svelte.d.ts +2 -2
- package/esm/ui/Grid2.svelte +3 -3
- package/esm/ui/Grid2.svelte.d.ts +1 -1
- package/esm/ui/GridPaginate.svelte +2 -2
- package/esm/ui/GridPaginate2.svelte +1 -1
- package/esm/ui/Loading.svelte +1 -1
- package/esm/ui/Tooltip.svelte +1 -1
- package/esm/ui/dialog/DialogForm.svelte +5 -5
- package/esm/ui/dialog/DialogManagement.svelte +2 -2
- package/esm/ui/dialog/DialogPrimitive.svelte +3 -3
- package/esm/ui/dialog/DialogPrimitive.svelte.d.ts +1 -1
- package/esm/ui/dialog/FormEditAction.svelte +3 -3
- package/esm/ui/dialog/FormEditAction.svelte.d.ts +1 -1
- package/esm/ui/dialog/dialog.d.ts +1 -1
- package/esm/ui/dialog/dialog.js +1 -1
- package/esm/ui/index.d.ts +1 -1
- package/esm/ui/internals/FieldContainer.svelte +2 -2
- package/esm/ui/internals/Textarea.svelte +3 -3
- package/esm/ui/internals/select/MultiSelectMelt.svelte +7 -7
- package/esm/ui/internals/select/MultiSelectMelt.svelte.d.ts +1 -1
- package/esm/ui/internals/select/SelectMelt.svelte +29 -15
- package/esm/ui/internals/select/SelectMelt.svelte.d.ts +5 -2
- package/esm/ui/internals/select/SelectRadio.svelte +1 -1
- package/esm/ui/internals/select/SelectRadio.svelte.d.ts +1 -1
- package/esm/ui/link/LinkPlus.svelte +3 -3
- package/esm/ui/link/LinkPlus.svelte.d.ts +1 -1
- package/esm/virtual/Customer.js +1 -1
- package/esm/virtual/StateDemoEnum.d.ts +2 -2
- package/esm/virtual/StateDemoEnum.js +1 -1
- package/esm/virtual/UIEntity.js +1 -1
- package/esm/vite/index.js +50 -52
- package/package.json +19 -12
- package/esm/FF_Entity.d.ts +0 -2
- package/esm/ROUTES.d.ts +0 -102
- package/esm/ROUTES.js +0 -106
- package/esm/auth/static/assets/Page-BorYIfy9.d.ts +0 -6
- package/esm/auth/static/assets/Page-BorYIfy9.js +0 -1
- package/esm/auth/static/assets/Page-Cm4MsdIa.d.ts +0 -6
- package/esm/auth/static/assets/Page-Cm4MsdIa.js +0 -20
- package/esm/auth/static/assets/Page-CqsLm8yQ.d.ts +0 -6
- package/esm/auth/static/assets/Page-CqsLm8yQ.js +0 -1
- package/esm/auth/static/assets/Page-JfNiCSIG.css +0 -1
- package/esm/auth/static/assets/index-Borxa2ns.d.ts +0 -234
- package/esm/auth/static/assets/index-Borxa2ns.js +0 -44
- package/esm/common.js +0 -8
- package/esm/mail/templates/DefaultMail.svelte +0 -86
- package/esm/mail/templates/DefaultMail.svelte.d.ts +0 -30
- /package/esm/{BaseEnum.d.ts → internals/BaseEnum.d.ts} +0 -0
- /package/esm/{BaseEnum.js → internals/BaseEnum.js} +0 -0
- /package/esm/{FF_Fields.d.ts → internals/FF_Fields.d.ts} +0 -0
- /package/esm/{cellsBuildor.js → internals/cellsBuildor.js} +0 -0
- /package/esm/{helper.d.ts → internals/helper.d.ts} +0 -0
- /package/esm/{storeItem.d.ts → internals/storeItem.d.ts} +0 -0
- /package/esm/{storeList.d.ts → internals/storeList.d.ts} +0 -0
- /package/esm/{storeList.js → internals/storeList.js} +0 -0
- /package/esm/{theme.d.ts → internals/theme.d.ts} +0 -0
- /package/esm/{theme.js → internals/theme.js} +0 -0
|
@@ -1,42 +1,53 @@
|
|
|
1
|
-
import { Module } from '
|
|
2
|
-
import { ChangeLog } from '../
|
|
1
|
+
import { Module } from 'remult/server';
|
|
2
|
+
import { ChangeLog } from '../changeLogEntities';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* We suggest you to create your own `@APP_Entity` decorator and use it instead of `@Entity`.
|
|
5
|
+
* Like this you opt-in to the change log feature Entity by Entity.
|
|
6
6
|
*
|
|
7
|
+
* @example
|
|
7
8
|
* ```ts
|
|
8
|
-
*
|
|
9
|
+
* // APP_Entity.ts example
|
|
10
|
+
* import { Entity, isBackend, type EntityOptions } from 'remult'
|
|
9
11
|
*
|
|
10
|
-
*
|
|
11
|
-
* // changeLog: false,
|
|
12
|
+
* import { recordDeleted, recordSaved } from '..'
|
|
12
13
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* ```
|
|
14
|
+
* export function APP_Entity<entityType>(
|
|
15
|
+
* key: string,
|
|
16
|
+
* options?: EntityOptions<
|
|
17
|
+
* entityType extends new (...args: any) => any ? InstanceType<entityType> : entityType
|
|
18
|
+
* >,
|
|
19
|
+
* ) {
|
|
20
|
+
* return Entity(key, {
|
|
21
|
+
* ...options,
|
|
22
22
|
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
23
|
+
* // changesLogs
|
|
24
|
+
* saved: async (entity, e) => {
|
|
25
|
+
* await options?.saved?.(entity, e)
|
|
26
|
+
* if (options?.changeLog === false) {
|
|
27
|
+
* // Don't log changes
|
|
28
|
+
* } else {
|
|
29
|
+
* if (isBackend()) {
|
|
30
|
+
* await recordSaved(entity, e, options?.changeLog)
|
|
31
|
+
* }
|
|
32
|
+
* }
|
|
33
|
+
* },
|
|
34
|
+
* deleted: async (entity, e) => {
|
|
35
|
+
* await options?.deleted?.(entity, e)
|
|
36
|
+
* if (options?.changeLog === false) {
|
|
37
|
+
* // Don't log changes
|
|
38
|
+
* } else {
|
|
39
|
+
* if (isBackend()) {
|
|
40
|
+
* await recordDeleted(entity, e, options?.changeLog)
|
|
41
|
+
* }
|
|
42
|
+
* }
|
|
43
|
+
* },
|
|
44
|
+
* })
|
|
45
|
+
* }
|
|
35
46
|
* ```
|
|
36
47
|
*/
|
|
37
48
|
export const changeLog = () => {
|
|
38
49
|
return new Module({
|
|
39
|
-
|
|
50
|
+
key: 'changeLog',
|
|
40
51
|
entities: [ChangeLog],
|
|
41
52
|
});
|
|
42
53
|
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare const statuses: readonly ["starting", "ended", "skipped"];
|
|
2
|
+
type StatusType = (typeof statuses)[number];
|
|
3
|
+
export declare class Cron {
|
|
4
|
+
id?: string;
|
|
5
|
+
topic: string;
|
|
6
|
+
startingAt: Date;
|
|
7
|
+
endedAt: Date | null;
|
|
8
|
+
result: Record<string, any>;
|
|
9
|
+
status: StatusType;
|
|
10
|
+
}
|
|
11
|
+
export {};
|
package/esm/cron/Cron.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
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
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { Entity, Fields } from 'remult';
|
|
8
|
+
import { Role_Cron } from './Role_Cron';
|
|
9
|
+
const statuses = ['starting', 'ended', 'skipped'];
|
|
10
|
+
let Cron = class Cron {
|
|
11
|
+
id;
|
|
12
|
+
topic;
|
|
13
|
+
startingAt = new Date();
|
|
14
|
+
endedAt = null;
|
|
15
|
+
result = {};
|
|
16
|
+
status = 'starting';
|
|
17
|
+
};
|
|
18
|
+
__decorate([
|
|
19
|
+
Fields.cuid()
|
|
20
|
+
], Cron.prototype, "id", void 0);
|
|
21
|
+
__decorate([
|
|
22
|
+
Fields.string({ required: true })
|
|
23
|
+
], Cron.prototype, "topic", void 0);
|
|
24
|
+
__decorate([
|
|
25
|
+
Fields.date()
|
|
26
|
+
], Cron.prototype, "startingAt", void 0);
|
|
27
|
+
__decorate([
|
|
28
|
+
Fields.date({ allowNull: true })
|
|
29
|
+
], Cron.prototype, "endedAt", void 0);
|
|
30
|
+
__decorate([
|
|
31
|
+
Fields.json()
|
|
32
|
+
], Cron.prototype, "result", void 0);
|
|
33
|
+
__decorate([
|
|
34
|
+
Fields.literal(() => statuses)
|
|
35
|
+
], Cron.prototype, "status", void 0);
|
|
36
|
+
Cron = __decorate([
|
|
37
|
+
Entity('_ff_crons', {
|
|
38
|
+
caption: 'Crons',
|
|
39
|
+
allowApiCrud: Role_Cron.Cron_Admin,
|
|
40
|
+
defaultOrderBy: { startingAt: 'desc' },
|
|
41
|
+
})
|
|
42
|
+
], Cron);
|
|
43
|
+
export { Cron };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CronJob } from 'cron';
|
|
2
|
-
import { Module } from '
|
|
2
|
+
import { Module } from 'remult/server';
|
|
3
3
|
export declare const jobs: Record<string, {
|
|
4
4
|
job: CronJob<null, unknown> | null;
|
|
5
5
|
concurrentInProgress: number;
|
|
@@ -29,18 +29,43 @@ export declare const cronTime: {
|
|
|
29
29
|
*/
|
|
30
30
|
every_friday_morning: string;
|
|
31
31
|
};
|
|
32
|
+
/**
|
|
33
|
+
* Type for onTick function that must return a Record<string, any>
|
|
34
|
+
*/
|
|
35
|
+
export type CronOnTick = () => Record<string, any> | Promise<Record<string, any>>;
|
|
36
|
+
/**
|
|
37
|
+
* Type for cron job parameters with enforced onTick return type
|
|
38
|
+
*/
|
|
39
|
+
export type CronJobParams = {
|
|
40
|
+
cronTime: string | Date;
|
|
41
|
+
onTick: CronOnTick;
|
|
42
|
+
topic: string;
|
|
43
|
+
concurrent?: number;
|
|
44
|
+
logs?: {
|
|
45
|
+
starting?: boolean;
|
|
46
|
+
ended?: boolean;
|
|
47
|
+
};
|
|
48
|
+
start?: boolean;
|
|
49
|
+
runOnInit?: boolean;
|
|
50
|
+
timeZone?: string;
|
|
51
|
+
utcOffset?: string | number;
|
|
52
|
+
onComplete?: () => void;
|
|
53
|
+
};
|
|
32
54
|
/**
|
|
33
55
|
* usage:
|
|
34
56
|
*
|
|
35
57
|
* ```ts
|
|
36
|
-
* import { cron, cronTime } from '
|
|
58
|
+
* import { cron, cronTime } from '..'
|
|
37
59
|
*
|
|
38
60
|
* export const api = firstly({
|
|
39
61
|
* modules: [
|
|
40
62
|
* cron([{
|
|
41
63
|
* topic: 'first_cron',
|
|
42
64
|
* cronTime: cronTime.every_second,
|
|
43
|
-
* onTick: () => {
|
|
65
|
+
* onTick: () => {
|
|
66
|
+
* console.log('hello')
|
|
67
|
+
* return { status: 'success' }
|
|
68
|
+
* },
|
|
44
69
|
* start: !dev, // Start in production
|
|
45
70
|
* // runOnInit: dev, // nice in dev environement
|
|
46
71
|
* }])
|
|
@@ -50,11 +75,4 @@ export declare const cronTime: {
|
|
|
50
75
|
*
|
|
51
76
|
* using [cron](https://www.npmjs.com/package/cron) library under the hood
|
|
52
77
|
*/
|
|
53
|
-
export declare const cron: (jobsInfos:
|
|
54
|
-
topic: string;
|
|
55
|
-
concurrent?: number;
|
|
56
|
-
logs?: {
|
|
57
|
-
starting?: boolean;
|
|
58
|
-
ended?: boolean;
|
|
59
|
-
};
|
|
60
|
-
})[]) => Module;
|
|
78
|
+
export declare const cron: (jobsInfos: CronJobParams[]) => Module<unknown>;
|
package/esm/cron/server/index.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { CronJob } from 'cron';
|
|
2
|
+
import { repo } from 'remult';
|
|
3
|
+
import { Module } from 'remult/server';
|
|
2
4
|
import { green, magenta, red, yellow } from '@kitql/helpers';
|
|
3
|
-
import {
|
|
5
|
+
import { log } from '..';
|
|
6
|
+
import { Cron } from '../Cron';
|
|
4
7
|
export const jobs = {};
|
|
5
8
|
/**
|
|
6
9
|
* Link to a nice Cheatsheet TODO
|
|
@@ -31,14 +34,17 @@ export const cronTime = {
|
|
|
31
34
|
* usage:
|
|
32
35
|
*
|
|
33
36
|
* ```ts
|
|
34
|
-
* import { cron, cronTime } from '
|
|
37
|
+
* import { cron, cronTime } from '..'
|
|
35
38
|
*
|
|
36
39
|
* export const api = firstly({
|
|
37
40
|
* modules: [
|
|
38
41
|
* cron([{
|
|
39
42
|
* topic: 'first_cron',
|
|
40
43
|
* cronTime: cronTime.every_second,
|
|
41
|
-
* onTick: () => {
|
|
44
|
+
* onTick: () => {
|
|
45
|
+
* console.log('hello')
|
|
46
|
+
* return { status: 'success' }
|
|
47
|
+
* },
|
|
42
48
|
* start: !dev, // Start in production
|
|
43
49
|
* // runOnInit: dev, // nice in dev environement
|
|
44
50
|
* }])
|
|
@@ -50,7 +56,8 @@ export const cronTime = {
|
|
|
50
56
|
*/
|
|
51
57
|
export const cron = (jobsInfos) => {
|
|
52
58
|
const m = new Module({
|
|
53
|
-
|
|
59
|
+
key: 'cron',
|
|
60
|
+
entities: [Cron],
|
|
54
61
|
});
|
|
55
62
|
const logJobs = (topic, job, message, with_metadata = true, isSuccess = true) => {
|
|
56
63
|
const l = [];
|
|
@@ -61,36 +68,45 @@ export const cron = (jobsInfos) => {
|
|
|
61
68
|
l.push(`(${job.isActive ? green('running') : red('stopped')}, next at ${yellow(job.nextDate().toISO())})`);
|
|
62
69
|
}
|
|
63
70
|
if (isSuccess) {
|
|
64
|
-
|
|
71
|
+
log.success(l.join(' '));
|
|
65
72
|
}
|
|
66
73
|
else {
|
|
67
|
-
|
|
74
|
+
log.info(l.join(' '));
|
|
68
75
|
}
|
|
69
76
|
};
|
|
70
77
|
m.initApi = async () => {
|
|
71
78
|
jobsInfos.forEach((infos) => {
|
|
72
|
-
const { topic, runOnInit, logs, concurrent, ...params } = infos;
|
|
79
|
+
const { topic, runOnInit, logs, concurrent, onTick: originalOnTick, ...params } = infos;
|
|
73
80
|
const concurrentToUse = concurrent ?? 1;
|
|
74
|
-
|
|
75
|
-
const
|
|
81
|
+
// Create a wrapper that converts the return type to void for CronJob
|
|
82
|
+
const wrappedOnTick = async () => {
|
|
76
83
|
if (jobs[topic].concurrentInProgress < concurrentToUse) {
|
|
77
84
|
jobs[topic].concurrentInProgress = jobs[topic].concurrentInProgress + 1;
|
|
85
|
+
const rCron = await repo(Cron).insert({ topic });
|
|
78
86
|
if (logs?.starting === undefined || logs?.starting === true) {
|
|
79
87
|
logJobs(topic, job, 'starting...', false, false);
|
|
80
88
|
}
|
|
81
|
-
|
|
82
|
-
|
|
89
|
+
const res = await originalOnTick();
|
|
90
|
+
log.info(`[${topic}] result:`, res);
|
|
91
|
+
rCron.result = res;
|
|
92
|
+
rCron.endedAt = new Date();
|
|
93
|
+
rCron.status = 'ended';
|
|
94
|
+
await repo(Cron).save(rCron);
|
|
83
95
|
if (logs?.ended === undefined || logs?.ended === true) {
|
|
84
96
|
logJobs(topic, job, 'done');
|
|
85
97
|
}
|
|
86
98
|
jobs[topic].concurrentInProgress = jobs[topic].concurrentInProgress - 1;
|
|
87
99
|
}
|
|
88
100
|
else {
|
|
101
|
+
const rCron = await repo(Cron).insert({ topic, status: 'skipped' });
|
|
89
102
|
logJobs(topic, job, `skipped because of concurrent limit (${yellow(concurrentToUse.toString())})`, false, false);
|
|
90
103
|
}
|
|
91
104
|
};
|
|
92
|
-
|
|
93
|
-
const job = CronJob.from(
|
|
105
|
+
// Use type assertion to bypass complex generic type issues
|
|
106
|
+
const job = CronJob.from({
|
|
107
|
+
...params,
|
|
108
|
+
onTick: wrappedOnTick,
|
|
109
|
+
});
|
|
94
110
|
jobs[topic] = { job, concurrentInProgress: 0 };
|
|
95
111
|
logJobs(topic, job, 'setup done');
|
|
96
112
|
// If not it will be done too early
|
|
@@ -19,15 +19,17 @@ export declare class FeedbackController {
|
|
|
19
19
|
who?: string;
|
|
20
20
|
createdAt: Date;
|
|
21
21
|
public: boolean;
|
|
22
|
+
title: string;
|
|
22
23
|
}[];
|
|
23
24
|
labels: any;
|
|
24
25
|
highlight: any;
|
|
26
|
+
title: any;
|
|
25
27
|
}>;
|
|
26
28
|
static createIssue(milestoneId: string, title: string, body: string, page: string): Promise<{
|
|
27
29
|
id: string;
|
|
28
30
|
number: number;
|
|
29
31
|
}>;
|
|
30
|
-
static addCommentOnIssue(issueId: string, body: string, page: string, labels: {
|
|
32
|
+
static addCommentOnIssue(issueId: string, issueNumber: number, title: string, body: string, page: string, labels: {
|
|
31
33
|
id: string;
|
|
32
34
|
name: string;
|
|
33
35
|
}[]): Promise<string>;
|
|
@@ -162,6 +162,7 @@ export class FeedbackController {
|
|
|
162
162
|
createdAt
|
|
163
163
|
bodyHTML
|
|
164
164
|
state
|
|
165
|
+
title
|
|
165
166
|
labels(first: 25){
|
|
166
167
|
nodes{
|
|
167
168
|
id
|
|
@@ -196,6 +197,7 @@ export class FeedbackController {
|
|
|
196
197
|
bodyHTML: data.repository.issue.bodyHTML,
|
|
197
198
|
createdAt: data.repository.issue.createdAt,
|
|
198
199
|
public: true,
|
|
200
|
+
title: data.repository.issue.title,
|
|
199
201
|
};
|
|
200
202
|
items.push(firstItem);
|
|
201
203
|
const comments = data.repository.issue.comments.nodes;
|
|
@@ -211,6 +213,7 @@ export class FeedbackController {
|
|
|
211
213
|
bodyHTML: comments[i].bodyHTML,
|
|
212
214
|
createdAt: new Date(comments[i].createdAt),
|
|
213
215
|
public: nbEye && nbEye > 0 ? true : false,
|
|
216
|
+
title: data.repository.issue.title,
|
|
214
217
|
});
|
|
215
218
|
}
|
|
216
219
|
}
|
|
@@ -223,6 +226,7 @@ export class FeedbackController {
|
|
|
223
226
|
items: items.filter((c) => c.public),
|
|
224
227
|
labels: data.repository.issue.labels.nodes,
|
|
225
228
|
highlight: hasWaitingForAnswerLabel,
|
|
229
|
+
title: data.repository.issue.title,
|
|
226
230
|
};
|
|
227
231
|
return toRet;
|
|
228
232
|
}
|
|
@@ -265,9 +269,18 @@ export class FeedbackController {
|
|
|
265
269
|
});
|
|
266
270
|
const toRet = newIssue.createIssue.issue;
|
|
267
271
|
await addMetaData(toRet.id, remult.user?.name, page);
|
|
272
|
+
remult.context.feedbackOptions.saved?.({
|
|
273
|
+
number: toRet.number,
|
|
274
|
+
title: title,
|
|
275
|
+
body,
|
|
276
|
+
metadata: {
|
|
277
|
+
author: JSON.stringify(remult.user?.name),
|
|
278
|
+
page,
|
|
279
|
+
},
|
|
280
|
+
});
|
|
268
281
|
return toRet;
|
|
269
282
|
}
|
|
270
|
-
static async addCommentOnIssue(issueId, body, page, labels) {
|
|
283
|
+
static async addCommentOnIssue(issueId, issueNumber, title, body, page, labels) {
|
|
271
284
|
const inputComment = {
|
|
272
285
|
subjectId: issueId,
|
|
273
286
|
body,
|
|
@@ -297,6 +310,15 @@ export class FeedbackController {
|
|
|
297
310
|
inputIssue,
|
|
298
311
|
});
|
|
299
312
|
await addMetaData(issueId, remult.user?.name, page);
|
|
313
|
+
remult.context.feedbackOptions.saved?.({
|
|
314
|
+
number: issueNumber,
|
|
315
|
+
title,
|
|
316
|
+
body,
|
|
317
|
+
metadata: {
|
|
318
|
+
author: JSON.stringify(remult.user?.name),
|
|
319
|
+
page,
|
|
320
|
+
},
|
|
321
|
+
});
|
|
300
322
|
return 'done';
|
|
301
323
|
}
|
|
302
324
|
static async close(issueId, labels) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ModuleFF } from '../../server';
|
|
2
2
|
import type { FeedbackOptions } from '../types';
|
|
3
|
-
export declare const feedback: (o: FeedbackOptions) =>
|
|
3
|
+
export declare const feedback: (o: FeedbackOptions) => ModuleFF;
|
|
4
4
|
declare module 'remult' {
|
|
5
5
|
interface RemultContext {
|
|
6
6
|
feedbackOptions: FeedbackOptions;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { remult } from 'remult';
|
|
2
|
-
import {
|
|
2
|
+
import { ModuleFF } from '../../server';
|
|
3
3
|
import { FeedbackController } from '../FeedbackController';
|
|
4
4
|
export const feedback = (o) => {
|
|
5
|
-
return new
|
|
5
|
+
return new ModuleFF({
|
|
6
6
|
name: 'feedback',
|
|
7
7
|
controllers: [FeedbackController],
|
|
8
8
|
initRequest: async (kitEvent, op) => {
|
package/esm/feedback/types.d.ts
CHANGED
|
@@ -10,5 +10,11 @@ export type FeedbackOptions = {
|
|
|
10
10
|
};
|
|
11
11
|
highlight_label?: string;
|
|
12
12
|
create_label?: string;
|
|
13
|
+
saved?: (args: {
|
|
14
|
+
number: number;
|
|
15
|
+
title: string;
|
|
16
|
+
body: string;
|
|
17
|
+
metadata: Record<string, any>;
|
|
18
|
+
}) => Promise<void>;
|
|
13
19
|
};
|
|
14
20
|
export declare const FEEDBACK_OPTIONS: FeedbackOptions;
|
|
@@ -6,7 +6,14 @@
|
|
|
6
6
|
import { page } from '$app/stores'
|
|
7
7
|
|
|
8
8
|
import { FeedbackController } from '..'
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
Button,
|
|
11
|
+
cellBuildor,
|
|
12
|
+
Field,
|
|
13
|
+
FilterEntity,
|
|
14
|
+
Loading,
|
|
15
|
+
type ResolvedType,
|
|
16
|
+
} from '../../internals'
|
|
10
17
|
import Textarea from '../../ui/internals/Textarea.svelte'
|
|
11
18
|
|
|
12
19
|
export let dialogId: number
|
|
@@ -41,7 +48,14 @@
|
|
|
41
48
|
const result = await FeedbackController.createIssue(milestoneId, title, content, p)
|
|
42
49
|
issueNumber = result.number
|
|
43
50
|
} else {
|
|
44
|
-
await FeedbackController.addCommentOnIssue(
|
|
51
|
+
await FeedbackController.addCommentOnIssue(
|
|
52
|
+
issue.id,
|
|
53
|
+
issueNumber!,
|
|
54
|
+
issue.title,
|
|
55
|
+
content,
|
|
56
|
+
p,
|
|
57
|
+
issue.labels,
|
|
58
|
+
)
|
|
45
59
|
}
|
|
46
60
|
|
|
47
61
|
content = ''
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
LibIcon_Search,
|
|
12
12
|
Loading,
|
|
13
13
|
type ResolvedType,
|
|
14
|
-
} from '
|
|
14
|
+
} from '../../internals'
|
|
15
15
|
import DialogIssue from './DialogIssue.svelte'
|
|
16
16
|
|
|
17
17
|
export let dialogId: number
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
>
|
|
87
87
|
<div class="flex w-full justify-center justify-items-center text-left">
|
|
88
88
|
<div class="flex-grow">
|
|
89
|
-
<span class="
|
|
89
|
+
<span class="mr-2 inline-block w-8 text-right text-xs italic text-base-content/60"
|
|
90
90
|
>#{issue.number}</span
|
|
91
91
|
>
|
|
92
92
|
{@html issue.titleHTML}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { onMount } from 'svelte'
|
|
3
3
|
|
|
4
|
-
import { FeedbackController } from '
|
|
5
|
-
import type
|
|
6
|
-
import { Button, dialog, Loading } from '../..'
|
|
4
|
+
import { FeedbackController } from '../../feedback/FeedbackController'
|
|
5
|
+
import { Button, dialog, Loading, type ResolvedType } from '../../internals'
|
|
7
6
|
import DialogIssues from './DialogIssues.svelte'
|
|
8
7
|
|
|
9
8
|
export let dialogId: number
|
package/esm/formats/dates.js
CHANGED
package/esm/formats/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { displayCurrency, displayCurrencyK, displayPercent, displayCurrencyWOSuffix, } from './numbers.js';
|
|
2
|
-
export { formatNumber, extractMailInfo } from './strings.js';
|
|
2
|
+
export { formatNumber, extractMailInfo, slugify, nameify, displayPhone, suffixWithS, arrToStr, mask, toTitleCase, } from './strings.js';
|
|
3
3
|
export { offsetedToPlainDate, plainDateCompare, isBetween, dateISOToPlainDate } from './dates.js';
|
|
4
4
|
export type { KitPlainDateRange } from './dates.js';
|
package/esm/formats/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { displayCurrency, displayCurrencyK, displayPercent, displayCurrencyWOSuffix, } from './numbers.js';
|
|
2
|
-
export { formatNumber, extractMailInfo } from './strings.js';
|
|
2
|
+
export { formatNumber, extractMailInfo, slugify, nameify, displayPhone, suffixWithS, arrToStr, mask, toTitleCase, } from './strings.js';
|
|
3
3
|
export { offsetedToPlainDate, plainDateCompare, isBetween, dateISOToPlainDate } from './dates.js';
|
package/esm/formats/strings.d.ts
CHANGED
|
@@ -9,3 +9,5 @@ export declare const extractMailInfo: (mail: string, withThrow?: boolean) => {
|
|
|
9
9
|
lastName: string;
|
|
10
10
|
email: string;
|
|
11
11
|
};
|
|
12
|
+
export declare function slugify(str: string | undefined): string | undefined;
|
|
13
|
+
export declare function nameify(str: string | undefined): string | undefined;
|
package/esm/formats/strings.js
CHANGED
|
@@ -96,3 +96,25 @@ export const extractMailInfo = (mail, withThrow = true) => {
|
|
|
96
96
|
email: '',
|
|
97
97
|
};
|
|
98
98
|
};
|
|
99
|
+
export function slugify(str) {
|
|
100
|
+
if (str === undefined)
|
|
101
|
+
return undefined;
|
|
102
|
+
return str
|
|
103
|
+
.toLowerCase()
|
|
104
|
+
.trim()
|
|
105
|
+
.replace(/[^\w.-]+/g, '-')
|
|
106
|
+
.replace(/[\s_-]+/g, '-')
|
|
107
|
+
.replace(/^-+|-+$/g, '');
|
|
108
|
+
}
|
|
109
|
+
export function nameify(str) {
|
|
110
|
+
if (str === undefined)
|
|
111
|
+
return undefined;
|
|
112
|
+
return str
|
|
113
|
+
.toLowerCase()
|
|
114
|
+
.trim()
|
|
115
|
+
.replace(/\./g, ' ')
|
|
116
|
+
.replace(/\s+/g, ' ')
|
|
117
|
+
.replace(/(?:^|\s|-)\S/g, (match) => match.toUpperCase())
|
|
118
|
+
.trim()
|
|
119
|
+
.split('@')[0];
|
|
120
|
+
}
|
package/esm/index.d.ts
CHANGED
|
@@ -1,84 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import type { ColumnDeciderArgs } from './changeLog/index.js';
|
|
5
|
-
import { ff_Log, FF_Role } from './common.js';
|
|
6
|
-
import { storeItem } from './storeItem.js';
|
|
7
|
-
import { storeList } from './storeList.js';
|
|
8
|
-
import { default as Button } from './ui/Button.svelte';
|
|
9
|
-
import { default as Clipboardable } from './ui/Clipboardable.svelte';
|
|
10
|
-
import type { dialog } from './ui/dialog/dialog.js';
|
|
11
|
-
import { default as DialogManagement } from './ui/dialog/DialogManagement.svelte';
|
|
12
|
-
import { default as FormEditAction } from './ui/dialog/FormEditAction.svelte';
|
|
13
|
-
import { default as Field } from './ui/Field.svelte';
|
|
14
|
-
import { default as FieldGroup } from './ui/FieldGroup.svelte';
|
|
15
|
-
import { default as Grid } from './ui/Grid.svelte';
|
|
16
|
-
import { default as Grid2 } from './ui/Grid2.svelte';
|
|
17
|
-
import { default as GridPaginate } from './ui/GridPaginate.svelte';
|
|
18
|
-
import { default as GridPaginate2 } from './ui/GridPaginate2.svelte';
|
|
19
|
-
import { default as Icon } from './ui/Icon.svelte';
|
|
20
|
-
import { default as FieldContainer } from './ui/internals/FieldContainer.svelte';
|
|
21
|
-
import { default as SelectMelt } from './ui/internals/select/SelectMelt.svelte';
|
|
22
|
-
import { default as Link } from './ui/link/Link.svelte';
|
|
23
|
-
import { default as LinkPlus } from './ui/link/LinkPlus.svelte';
|
|
24
|
-
import { default as Loading } from './ui/Loading.svelte';
|
|
25
|
-
import { default as Tooltip } from './ui/Tooltip.svelte';
|
|
26
|
-
export { Field, FormEditAction, Grid, Grid2, GridPaginate, GridPaginate2, FieldGroup, Icon, Link, LinkPlus, Loading, Button, Tooltip, DialogManagement, FieldContainer, SelectMelt, Clipboardable, };
|
|
27
|
-
export { FF_Role, ff_Log };
|
|
28
|
-
export type { BaseEnumOptions } from './BaseEnum.js';
|
|
29
|
-
export type { BaseItem };
|
|
30
|
-
export type BaseItemLight = Partial<BaseItem>;
|
|
31
|
-
export type { DialogMetaDataInternal } from './ui/dialog/dialog.js';
|
|
32
|
-
export type CellsInput<entityType> = CellsInput_ForExport<entityType>;
|
|
33
|
-
export type { Cell, VisibilityMode } from './cellsBuildor.js';
|
|
34
|
-
export type { FF_FindOptions } from './storeList.js';
|
|
35
|
-
export type StoreItem<T> = ReturnType<typeof storeItem<T>>;
|
|
36
|
-
export type StoreList<T> = ReturnType<typeof storeList<T>>;
|
|
37
|
-
export type { ResolvedType, UnArray, RecursivePartial } from './utils/types.js';
|
|
38
|
-
export { FF_Fields } from './FF_Fields.js';
|
|
39
|
-
export { FF_Entity } from './FF_Entity.js';
|
|
40
|
-
export { FF_LogToConsole } from './SqlDatabase/FF_LogToConsole.js';
|
|
41
|
-
export { BaseEnum } from './BaseEnum.js';
|
|
42
|
-
export { dialog } from './ui/dialog/dialog.js';
|
|
43
|
-
export { getEntityDisplayValue, isError, getFieldLinkDisplayValue, getEnum, getEnums, onDelete, } from './helper.js';
|
|
44
|
-
export { buildWhere, getPlaceholder, buildSearchWhere, cellsBuildor, cellBuildor, fieldsOf, containsWords, } from './cellsBuildor.js';
|
|
45
|
-
export { storeItem };
|
|
46
|
-
export { storeList };
|
|
47
|
-
export { displayPhone, arrToStr } from './formats/strings.js';
|
|
48
|
-
export { displayCurrency } from './formats/numbers.js';
|
|
49
|
-
export { tw } from './utils/tailwind.js';
|
|
50
|
-
export { FilterEntity } from './virtual/FilterEntity.js';
|
|
51
|
-
export { UIEntity } from './virtual/UIEntity.js';
|
|
52
|
-
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';
|
|
53
|
-
export type { FF_Icon };
|
|
54
|
-
declare module 'remult' {
|
|
55
|
-
interface FieldOptions<entityType, valueType> {
|
|
56
|
-
placeholder?: string;
|
|
57
|
-
suffix?: string;
|
|
58
|
-
suffixWithS?: boolean;
|
|
59
|
-
suffixEdit?: string;
|
|
60
|
-
suffixEditWithS?: boolean;
|
|
61
|
-
styleRadioUntil?: number;
|
|
62
|
-
step?: '1' | '0.1' | '0.01';
|
|
63
|
-
href?: (item: entityType) => string;
|
|
64
|
-
findOptionsForEdit?: ((entity: entityType) => FindOptionsBase<valueType>) | FindOptionsBase<valueType>;
|
|
65
|
-
findOptionsLimit?: number;
|
|
66
|
-
createOptionWhenNoResult?: {
|
|
67
|
-
onCreateRequest: (item: entityType, strCreateNew: string) => Parameters<typeof dialog.form>;
|
|
68
|
-
onSuccess: (entity: entityType, newItem: any) => Promise<void>;
|
|
69
|
-
onError?: () => void;
|
|
70
|
-
};
|
|
71
|
-
multiSelect?: boolean;
|
|
72
|
-
skipForDefaultField?: boolean;
|
|
73
|
-
}
|
|
74
|
-
interface EntityOptions<entityType> {
|
|
75
|
-
searchableFind?: (str: string) => FindOptionsBase<entityType>;
|
|
76
|
-
displayValue?: (item: entityType) => BaseItem;
|
|
77
|
-
permissionApiCrud?: BaseEnum[] | BaseEnum;
|
|
78
|
-
permissionApiDelete?: BaseEnum[] | BaseEnum;
|
|
79
|
-
permissionApiInsert?: BaseEnum[] | BaseEnum;
|
|
80
|
-
permissionApiRead?: BaseEnum[] | BaseEnum;
|
|
81
|
-
permissionApiUpdate?: BaseEnum[] | BaseEnum;
|
|
82
|
-
changeLog?: false | ColumnDeciderArgs<entityType>;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
1
|
+
import * as log from '@kitql/helpers';
|
|
2
|
+
export { log };
|
|
3
|
+
export declare const ff_Log: log.Log;
|