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
package/esm/index.js
CHANGED
|
@@ -1,47 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import { default as Button } from './ui/Button.svelte';
|
|
5
|
-
import { default as Clipboardable } from './ui/Clipboardable.svelte';
|
|
6
|
-
import { default as DialogManagement } from './ui/dialog/DialogManagement.svelte';
|
|
7
|
-
import { default as FormEditAction } from './ui/dialog/FormEditAction.svelte';
|
|
8
|
-
import { default as Field } from './ui/Field.svelte';
|
|
9
|
-
import { default as FieldGroup } from './ui/FieldGroup.svelte';
|
|
10
|
-
import { default as Grid } from './ui/Grid.svelte';
|
|
11
|
-
import { default as Grid2 } from './ui/Grid2.svelte';
|
|
12
|
-
import { default as GridPaginate } from './ui/GridPaginate.svelte';
|
|
13
|
-
import { default as GridPaginate2 } from './ui/GridPaginate2.svelte';
|
|
14
|
-
import { default as Icon } from './ui/Icon.svelte';
|
|
15
|
-
import { default as FieldContainer } from './ui/internals/FieldContainer.svelte';
|
|
16
|
-
import { default as SelectMelt } from './ui/internals/select/SelectMelt.svelte';
|
|
17
|
-
import { default as Link } from './ui/link/Link.svelte';
|
|
18
|
-
import { default as LinkPlus } from './ui/link/LinkPlus.svelte';
|
|
19
|
-
import { default as Loading } from './ui/Loading.svelte';
|
|
20
|
-
import { default as Tooltip } from './ui/Tooltip.svelte';
|
|
21
|
-
// ******************************
|
|
22
|
-
// Svelte Components
|
|
23
|
-
// ******************************
|
|
24
|
-
export { Field, FormEditAction, Grid, Grid2, GridPaginate, GridPaginate2, FieldGroup, Icon, Link, LinkPlus, Loading, Button, Tooltip, DialogManagement, FieldContainer, SelectMelt, Clipboardable, };
|
|
25
|
-
export { FF_Role, ff_Log };
|
|
26
|
-
// ******************************
|
|
27
|
-
// Helpers
|
|
28
|
-
// ******************************
|
|
29
|
-
export { FF_Fields } from './FF_Fields.js';
|
|
30
|
-
export { FF_Entity } from './FF_Entity.js';
|
|
31
|
-
export { FF_LogToConsole } from './SqlDatabase/FF_LogToConsole.js';
|
|
32
|
-
export { BaseEnum } from './BaseEnum.js';
|
|
33
|
-
export { dialog } from './ui/dialog/dialog.js';
|
|
34
|
-
export { getEntityDisplayValue, isError, getFieldLinkDisplayValue, getEnum, getEnums, onDelete, } from './helper.js';
|
|
35
|
-
export { buildWhere, getPlaceholder, buildSearchWhere, cellsBuildor, cellBuildor, fieldsOf, containsWords, } from './cellsBuildor.js';
|
|
36
|
-
export { storeItem };
|
|
37
|
-
export { storeList };
|
|
38
|
-
export { displayPhone, arrToStr } from './formats/strings.js';
|
|
39
|
-
export { displayCurrency } from './formats/numbers.js';
|
|
40
|
-
export { tw } from './utils/tailwind.js';
|
|
41
|
-
// Hummm... I don't know if we should keep it...
|
|
42
|
-
export { FilterEntity } from './virtual/FilterEntity.js';
|
|
43
|
-
export { UIEntity } from './virtual/UIEntity.js';
|
|
44
|
-
// ******************************
|
|
45
|
-
// Icons
|
|
46
|
-
// ******************************
|
|
47
|
-
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';
|
|
1
|
+
import * as log from '@kitql/helpers';
|
|
2
|
+
export { log };
|
|
3
|
+
export const ff_Log = new log.Log('firstly');
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { type EntityOptions } from 'remult';
|
|
2
|
+
export declare function FF_Entity<entityType>(key: string, options?: EntityOptions<entityType extends new (...args: any) => any ? InstanceType<entityType> : entityType>): (target: any, info?: import("remult/src/remult3/remult3").ClassDecoratorContextStub<entityType extends infer T ? T extends entityType ? T extends new (...args: any) => any ? entityType : never : never : never> | undefined) => any;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Entity, isBackend } from 'remult';
|
|
2
|
-
import { recordDeleted, recordSaved } from '
|
|
2
|
+
import { recordDeleted, recordSaved } from '../changeLog';
|
|
3
3
|
const toAllow = (permission) => {
|
|
4
4
|
if (permission) {
|
|
5
5
|
if (Array.isArray(permission)) {
|
|
@@ -12,31 +12,31 @@ const toAllow = (permission) => {
|
|
|
12
12
|
export function FF_Entity(key, options) {
|
|
13
13
|
return Entity(key, {
|
|
14
14
|
...options,
|
|
15
|
-
allowApiCrud: options
|
|
16
|
-
allowApiDelete: options
|
|
17
|
-
allowApiInsert: options
|
|
18
|
-
allowApiRead: options
|
|
19
|
-
allowApiUpdate: options
|
|
15
|
+
allowApiCrud: options?.allowApiCrud ?? toAllow(options?.permissionApiCrud),
|
|
16
|
+
allowApiDelete: options?.allowApiDelete ?? toAllow(options?.permissionApiDelete),
|
|
17
|
+
allowApiInsert: options?.allowApiInsert ?? toAllow(options?.permissionApiInsert),
|
|
18
|
+
allowApiRead: options?.allowApiRead ?? toAllow(options?.permissionApiRead),
|
|
19
|
+
allowApiUpdate: options?.allowApiUpdate ?? toAllow(options?.permissionApiUpdate),
|
|
20
20
|
// changesLogs
|
|
21
21
|
saved: async (entity, e) => {
|
|
22
22
|
await options?.saved?.(entity, e);
|
|
23
|
-
if (options
|
|
23
|
+
if (options?.changeLog === false) {
|
|
24
24
|
// Don't log changes
|
|
25
25
|
}
|
|
26
26
|
else {
|
|
27
27
|
if (isBackend()) {
|
|
28
|
-
await recordSaved(entity, e, options
|
|
28
|
+
await recordSaved(entity, e, options?.changeLog);
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
},
|
|
32
32
|
deleted: async (entity, e) => {
|
|
33
33
|
await options?.deleted?.(entity, e);
|
|
34
|
-
if (options
|
|
34
|
+
if (options?.changeLog === false) {
|
|
35
35
|
// Don't log changes
|
|
36
36
|
}
|
|
37
37
|
else {
|
|
38
38
|
if (isBackend()) {
|
|
39
|
-
await recordDeleted(entity, e, options
|
|
39
|
+
await recordDeleted(entity, e, options?.changeLog);
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Fields, Validators, } from 'remult';
|
|
2
|
-
import { displayCurrency } from '
|
|
2
|
+
import { displayCurrency } from '../formats';
|
|
3
3
|
import { getEnums } from './helper';
|
|
4
4
|
// Translate default messages
|
|
5
5
|
// REMULT P3 JYC: I need to set this here the one of my app are not overwriting these...
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { SvelteComponent } from 'svelte';
|
|
2
2
|
import { type ClassType, type EntityFilter, type FieldMetadata, type Repository } from 'remult';
|
|
3
|
-
import type { UnArray } from '
|
|
3
|
+
import type { UnArray } from '../utils/types.js';
|
|
4
4
|
export type VisibilityMode = 'view' | 'edit' | 'hide';
|
|
5
5
|
type CellInternal<Entity> = {
|
|
6
6
|
col?: keyof Entity;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EntityError, getEntityRef, getValueList } from 'remult';
|
|
2
2
|
import { getRelationFieldInfo } from 'remult/internals';
|
|
3
|
-
import { suffixWithS } from '
|
|
3
|
+
import { suffixWithS } from '../formats/strings.js';
|
|
4
4
|
export function isError(object) {
|
|
5
5
|
return object;
|
|
6
6
|
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import type { FindOptionsBase } from 'remult';
|
|
2
|
+
import type { ColumnDeciderArgs } from '../changeLog/index.js';
|
|
3
|
+
import { default as Button } from '../ui/Button.svelte';
|
|
4
|
+
import { default as Clipboardable } from '../ui/Clipboardable.svelte';
|
|
5
|
+
import type { dialog } from '../ui/dialog/dialog.js';
|
|
6
|
+
import { default as DialogManagement } from '../ui/dialog/DialogManagement.svelte';
|
|
7
|
+
import { default as FormEditAction } from '../ui/dialog/FormEditAction.svelte';
|
|
8
|
+
import { default as Field } from '../ui/Field.svelte';
|
|
9
|
+
import { default as FieldGroup } from '../ui/FieldGroup.svelte';
|
|
10
|
+
import { default as Grid } from '../ui/Grid.svelte';
|
|
11
|
+
import { default as Grid2 } from '../ui/Grid2.svelte';
|
|
12
|
+
import { default as GridPaginate } from '../ui/GridPaginate.svelte';
|
|
13
|
+
import { default as GridPaginate2 } from '../ui/GridPaginate2.svelte';
|
|
14
|
+
import { default as Icon } from '../ui/Icon.svelte';
|
|
15
|
+
import { default as FieldContainer } from '../ui/internals/FieldContainer.svelte';
|
|
16
|
+
import { default as SelectMelt } from '../ui/internals/select/SelectMelt.svelte';
|
|
17
|
+
import { default as Link } from '../ui/link/Link.svelte';
|
|
18
|
+
import { default as LinkPlus } from '../ui/link/LinkPlus.svelte';
|
|
19
|
+
import { default as Loading } from '../ui/Loading.svelte';
|
|
20
|
+
import { default as Tooltip } from '../ui/Tooltip.svelte';
|
|
21
|
+
import type { BaseEnum, BaseItem, FF_Icon } from './BaseEnum.js';
|
|
22
|
+
import type { CellsInput as CellsInput_ForExport } from './cellsBuildor.js';
|
|
23
|
+
import { FF_Role } from './common.js';
|
|
24
|
+
import { storeItem } from './storeItem.js';
|
|
25
|
+
import { storeList } from './storeList.js';
|
|
26
|
+
export { Field, FormEditAction, Grid, Grid2, GridPaginate, GridPaginate2, FieldGroup, Icon, Link, LinkPlus, Loading, Button, Tooltip, DialogManagement, FieldContainer, SelectMelt, Clipboardable, };
|
|
27
|
+
export type { BaseEnumOptions } from './BaseEnum.js';
|
|
28
|
+
export type { BaseItem };
|
|
29
|
+
export type BaseItemLight = Partial<BaseItem>;
|
|
30
|
+
export type { DialogMetaDataInternal } from '../ui/dialog/dialog.js';
|
|
31
|
+
export type CellsInput<entityType> = CellsInput_ForExport<entityType>;
|
|
32
|
+
export type { Cell, VisibilityMode } from './cellsBuildor.js';
|
|
33
|
+
export type { FF_FindOptions } from './storeList.js';
|
|
34
|
+
export type StoreItem<T> = ReturnType<typeof storeItem<T>>;
|
|
35
|
+
export type StoreList<T> = ReturnType<typeof storeList<T>>;
|
|
36
|
+
export type { ResolvedType, UnArray, RecursivePartial } from '../utils/types.js';
|
|
37
|
+
export { FF_Fields } from './FF_Fields.js';
|
|
38
|
+
export { FF_Entity } from './FF_Entity.js';
|
|
39
|
+
export { FF_LogToConsole } from '../SqlDatabase/FF_LogToConsole.js';
|
|
40
|
+
export { BaseEnum } from './BaseEnum.js';
|
|
41
|
+
export { dialog } from '../ui/dialog/dialog.js';
|
|
42
|
+
export { getEntityDisplayValue, displayWithDefaultAndSuffix, isError, getFieldLinkDisplayValue, getEnum, getEnums, onDelete, } from './helper.js';
|
|
43
|
+
export { buildWhere, getPlaceholder, buildSearchWhere, cellsBuildor, cellBuildor, fieldsOf, containsWords, } from './cellsBuildor.js';
|
|
44
|
+
export { storeItem };
|
|
45
|
+
export { storeList };
|
|
46
|
+
export { tw } from '../utils/tailwind.js';
|
|
47
|
+
export { FF_Role };
|
|
48
|
+
export { FilterEntity } from '../virtual/FilterEntity.js';
|
|
49
|
+
export { UIEntity } from '../virtual/UIEntity.js';
|
|
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';
|
|
51
|
+
export type { FF_Icon };
|
|
52
|
+
declare module 'remult' {
|
|
53
|
+
interface FieldOptions<entityType, valueType> {
|
|
54
|
+
placeholder?: string;
|
|
55
|
+
suffix?: string;
|
|
56
|
+
suffixWithS?: boolean;
|
|
57
|
+
suffixEdit?: string;
|
|
58
|
+
suffixEditWithS?: boolean;
|
|
59
|
+
styleRadioUntil?: number;
|
|
60
|
+
step?: '1' | '0.1' | '0.01';
|
|
61
|
+
href?: (item: entityType) => string;
|
|
62
|
+
findOptionsForEdit?: ((entity: entityType) => FindOptionsBase<valueType>) | FindOptionsBase<valueType>;
|
|
63
|
+
findOptionsLimit?: number;
|
|
64
|
+
createOptionWhenNoResult?: {
|
|
65
|
+
onCreateRequest: (item: entityType, strCreateNew: string) => Parameters<typeof dialog.form>;
|
|
66
|
+
onSuccess: (entity: entityType, newItem: any) => Promise<void>;
|
|
67
|
+
onError?: () => void;
|
|
68
|
+
};
|
|
69
|
+
default_select_if_one_item?: boolean;
|
|
70
|
+
multiSelect?: boolean;
|
|
71
|
+
skipForDefaultField?: boolean;
|
|
72
|
+
}
|
|
73
|
+
interface EntityOptions<entityType> {
|
|
74
|
+
searchableFind?: (str: string) => FindOptionsBase<entityType>;
|
|
75
|
+
displayValue?: (item: entityType) => BaseItem;
|
|
76
|
+
permissionApiCrud?: BaseEnum[] | BaseEnum;
|
|
77
|
+
permissionApiDelete?: BaseEnum[] | BaseEnum;
|
|
78
|
+
permissionApiInsert?: BaseEnum[] | BaseEnum;
|
|
79
|
+
permissionApiRead?: BaseEnum[] | BaseEnum;
|
|
80
|
+
permissionApiUpdate?: BaseEnum[] | BaseEnum;
|
|
81
|
+
changeLog?: false | ColumnDeciderArgs<entityType>;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { default as Button } from '../ui/Button.svelte';
|
|
2
|
+
import { default as Clipboardable } from '../ui/Clipboardable.svelte';
|
|
3
|
+
import { default as DialogManagement } from '../ui/dialog/DialogManagement.svelte';
|
|
4
|
+
import { default as FormEditAction } from '../ui/dialog/FormEditAction.svelte';
|
|
5
|
+
import { default as Field } from '../ui/Field.svelte';
|
|
6
|
+
import { default as FieldGroup } from '../ui/FieldGroup.svelte';
|
|
7
|
+
import { default as Grid } from '../ui/Grid.svelte';
|
|
8
|
+
import { default as Grid2 } from '../ui/Grid2.svelte';
|
|
9
|
+
import { default as GridPaginate } from '../ui/GridPaginate.svelte';
|
|
10
|
+
import { default as GridPaginate2 } from '../ui/GridPaginate2.svelte';
|
|
11
|
+
import { default as Icon } from '../ui/Icon.svelte';
|
|
12
|
+
import { default as FieldContainer } from '../ui/internals/FieldContainer.svelte';
|
|
13
|
+
import { default as SelectMelt } from '../ui/internals/select/SelectMelt.svelte';
|
|
14
|
+
import { default as Link } from '../ui/link/Link.svelte';
|
|
15
|
+
import { default as LinkPlus } from '../ui/link/LinkPlus.svelte';
|
|
16
|
+
import { default as Loading } from '../ui/Loading.svelte';
|
|
17
|
+
import { default as Tooltip } from '../ui/Tooltip.svelte';
|
|
18
|
+
import { FF_Role } from './common.js';
|
|
19
|
+
import { storeItem } from './storeItem.js';
|
|
20
|
+
import { storeList } from './storeList.js';
|
|
21
|
+
// ******************************
|
|
22
|
+
// Svelte Components
|
|
23
|
+
// ******************************
|
|
24
|
+
export { Field, FormEditAction, Grid, Grid2, GridPaginate, GridPaginate2, FieldGroup, Icon, Link, LinkPlus, Loading, Button, Tooltip, DialogManagement, FieldContainer, SelectMelt, Clipboardable, };
|
|
25
|
+
// ******************************
|
|
26
|
+
// Helpers
|
|
27
|
+
// ******************************
|
|
28
|
+
export { FF_Fields } from './FF_Fields.js';
|
|
29
|
+
export { FF_Entity } from './FF_Entity.js';
|
|
30
|
+
export { FF_LogToConsole } from '../SqlDatabase/FF_LogToConsole.js';
|
|
31
|
+
export { BaseEnum } from './BaseEnum.js';
|
|
32
|
+
export { dialog } from '../ui/dialog/dialog.js';
|
|
33
|
+
export { getEntityDisplayValue, displayWithDefaultAndSuffix, isError, getFieldLinkDisplayValue, getEnum, getEnums, onDelete, } from './helper.js';
|
|
34
|
+
export { buildWhere, getPlaceholder, buildSearchWhere, cellsBuildor, cellBuildor, fieldsOf, containsWords, } from './cellsBuildor.js';
|
|
35
|
+
export { storeItem };
|
|
36
|
+
export { storeList };
|
|
37
|
+
export { tw } from '../utils/tailwind.js';
|
|
38
|
+
export { FF_Role };
|
|
39
|
+
// Hummm... I don't know if we should keep it...
|
|
40
|
+
export { FilterEntity } from '../virtual/FilterEntity.js';
|
|
41
|
+
export { UIEntity } from '../virtual/UIEntity.js';
|
|
42
|
+
// ******************************
|
|
43
|
+
// Icons
|
|
44
|
+
// ******************************
|
|
45
|
+
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';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BROWSER } from 'esm-env';
|
|
2
2
|
import { derived, get, writable } from 'svelte/store';
|
|
3
|
-
import { ff_Log } from '
|
|
4
|
-
import { isError } from './helper';
|
|
3
|
+
import { ff_Log } from '../index.js';
|
|
4
|
+
import { isError } from './helper.js';
|
|
5
5
|
export const storeItem = (repo, initValues = {
|
|
6
6
|
item: undefined,
|
|
7
7
|
loading: true,
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
declare const statuses: readonly ["transport_not_configured", "sent", "error"];
|
|
2
|
+
type StatusType = (typeof statuses)[number];
|
|
3
|
+
export declare class Mail {
|
|
4
|
+
id?: string;
|
|
5
|
+
createdAt: Date;
|
|
6
|
+
topic: string;
|
|
7
|
+
to: string;
|
|
8
|
+
metadata: Record<string, any>;
|
|
9
|
+
html: string;
|
|
10
|
+
status: StatusType;
|
|
11
|
+
errorInfo: string;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
package/esm/mail/Mail.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
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_Mail } from './Role_Mail';
|
|
9
|
+
const statuses = ['transport_not_configured', 'sent', 'error'];
|
|
10
|
+
let Mail = class Mail {
|
|
11
|
+
id;
|
|
12
|
+
createdAt = new Date();
|
|
13
|
+
topic;
|
|
14
|
+
to;
|
|
15
|
+
metadata = {};
|
|
16
|
+
html = '';
|
|
17
|
+
status = 'sent';
|
|
18
|
+
errorInfo = '';
|
|
19
|
+
};
|
|
20
|
+
__decorate([
|
|
21
|
+
Fields.cuid()
|
|
22
|
+
], Mail.prototype, "id", void 0);
|
|
23
|
+
__decorate([
|
|
24
|
+
Fields.createdAt()
|
|
25
|
+
], Mail.prototype, "createdAt", void 0);
|
|
26
|
+
__decorate([
|
|
27
|
+
Fields.string({ required: true })
|
|
28
|
+
], Mail.prototype, "topic", void 0);
|
|
29
|
+
__decorate([
|
|
30
|
+
Fields.string({ required: true })
|
|
31
|
+
], Mail.prototype, "to", void 0);
|
|
32
|
+
__decorate([
|
|
33
|
+
Fields.json()
|
|
34
|
+
], Mail.prototype, "metadata", void 0);
|
|
35
|
+
__decorate([
|
|
36
|
+
Fields.string()
|
|
37
|
+
], Mail.prototype, "html", void 0);
|
|
38
|
+
__decorate([
|
|
39
|
+
Fields.literal(() => statuses)
|
|
40
|
+
], Mail.prototype, "status", void 0);
|
|
41
|
+
__decorate([
|
|
42
|
+
Fields.string()
|
|
43
|
+
], Mail.prototype, "errorInfo", void 0);
|
|
44
|
+
Mail = __decorate([
|
|
45
|
+
Entity('_ff_mails', {
|
|
46
|
+
caption: 'Mails',
|
|
47
|
+
allowApiCrud: Role_Mail.Mail_Admin,
|
|
48
|
+
defaultOrderBy: { createdAt: 'desc' },
|
|
49
|
+
})
|
|
50
|
+
], Mail);
|
|
51
|
+
export { Mail };
|
package/esm/mail/index.d.ts
CHANGED
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { Log } from '@kitql/helpers';
|
|
2
|
+
import { Mail } from './Mail';
|
|
3
|
+
export declare const key = "mail";
|
|
4
|
+
export declare const log: Log;
|
|
5
|
+
export declare const mailEntities: {
|
|
6
|
+
Mail: typeof Mail;
|
|
7
|
+
};
|
package/esm/mail/index.js
CHANGED
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { Log } from '@kitql/helpers';
|
|
2
|
+
import { Mail } from './Mail';
|
|
3
|
+
export const key = 'mail';
|
|
4
|
+
export const log = new Log(key);
|
|
5
|
+
export const mailEntities = {
|
|
6
|
+
Mail,
|
|
7
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type MailStyle = {
|
|
2
|
+
service: string;
|
|
3
|
+
primaryColor: string;
|
|
4
|
+
secondaryColor: string;
|
|
5
|
+
subject: string;
|
|
6
|
+
title: string;
|
|
7
|
+
sections: {
|
|
8
|
+
html: string;
|
|
9
|
+
cta?: {
|
|
10
|
+
html: string;
|
|
11
|
+
link: string;
|
|
12
|
+
} | undefined;
|
|
13
|
+
}[];
|
|
14
|
+
footer: string;
|
|
15
|
+
};
|
|
16
|
+
export declare const toHtml: (args: MailStyle) => string;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
export const toHtml = (args) => {
|
|
2
|
+
const { service, primaryColor, secondaryColor, title, footer, sections } = args;
|
|
3
|
+
return `<body style="background-color: #f4f4f4; margin: 0 !important; padding: 0 !important; color: black">
|
|
4
|
+
<table border="0" cellpadding="0" cellspacing="0" width="100%">
|
|
5
|
+
<tr>
|
|
6
|
+
<td bgcolor="${primaryColor}" align="center">
|
|
7
|
+
<table border="0" cellpadding="0" cellspacing="0" width="480">
|
|
8
|
+
<tr>
|
|
9
|
+
<td align="center" valign="top" style="padding: 30px 10px 30px 10px;">
|
|
10
|
+
<div
|
|
11
|
+
style="display: block; font-family: Helvetica, Arial, sans-serif; color: #ffffff; font-size: 18px;"
|
|
12
|
+
border="0"
|
|
13
|
+
>
|
|
14
|
+
${service}
|
|
15
|
+
</div>
|
|
16
|
+
</td>
|
|
17
|
+
</tr>
|
|
18
|
+
</table>
|
|
19
|
+
</td>
|
|
20
|
+
</tr>
|
|
21
|
+
<tr>
|
|
22
|
+
<td bgcolor="${primaryColor}" align="center" style="padding: 0px 35px 0px 35px;">
|
|
23
|
+
<table border="0" cellpadding="0" cellspacing="0" width="100%">
|
|
24
|
+
<tr>
|
|
25
|
+
<td
|
|
26
|
+
bgcolor="#ffffff"
|
|
27
|
+
align="left"
|
|
28
|
+
valign="top"
|
|
29
|
+
style="padding: 30px 30px 20px 30px; border-radius: 20px 20px 0px 0px; color: #111111; font-family: Helvetica, Arial, sans-serif; font-size: 48px; font-weight: 400; line-height: 48px;"
|
|
30
|
+
>
|
|
31
|
+
<h1 style="font-size: 32px; font-weight: 400; margin: 0;">${title}</h1>
|
|
32
|
+
</td>
|
|
33
|
+
</tr>
|
|
34
|
+
</table>
|
|
35
|
+
</td>
|
|
36
|
+
</tr>
|
|
37
|
+
<tr>
|
|
38
|
+
<td bgcolor="#f4f4f4" align="center" style="padding: 0px 35px 0px 35px;">
|
|
39
|
+
<table border="0" cellpadding="0" cellspacing="0" width="100%">
|
|
40
|
+
${sections.map((section, i) => sectionToHtml(i, primaryColor, secondaryColor, section))
|
|
41
|
+
.join(`
|
|
42
|
+
`)}
|
|
43
|
+
</table>
|
|
44
|
+
</td>
|
|
45
|
+
</tr>
|
|
46
|
+
<tr>
|
|
47
|
+
<td bgcolor="#f4f4f4" align="center" style="padding: 0px 10px 0px 10px;">
|
|
48
|
+
<table border="0" cellpadding="0" cellspacing="0" width="480">
|
|
49
|
+
<tr>
|
|
50
|
+
<td
|
|
51
|
+
bgcolor="#f4f4f4"
|
|
52
|
+
align="left"
|
|
53
|
+
style="padding: 30px 30px 30px 30px; color: #666666; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: 400; line-height: 18px;"
|
|
54
|
+
>
|
|
55
|
+
<center>
|
|
56
|
+
${footer}
|
|
57
|
+
</center>
|
|
58
|
+
</td>
|
|
59
|
+
</tr>
|
|
60
|
+
</table>
|
|
61
|
+
</td>
|
|
62
|
+
</tr>
|
|
63
|
+
</table>
|
|
64
|
+
</body>
|
|
65
|
+
`;
|
|
66
|
+
};
|
|
67
|
+
const sectionToHtml = (i, primaryColor, secondaryColor, section) => `
|
|
68
|
+
<tr>
|
|
69
|
+
<td bgcolor="#ffffff" align="left">
|
|
70
|
+
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
|
71
|
+
<tr>
|
|
72
|
+
<td
|
|
73
|
+
bgcolor="#ffffff"
|
|
74
|
+
align="left"
|
|
75
|
+
style="padding: 30px 30px 30px 30px; ${i > 0 ? `border-top:1px solid ${primaryColor};` : ''}"
|
|
76
|
+
>
|
|
77
|
+
${section.html}
|
|
78
|
+
${section.cta ? ctaToHtml(secondaryColor, section.cta.html, section.cta.link) : ''}
|
|
79
|
+
</td>
|
|
80
|
+
</tr>
|
|
81
|
+
</table>
|
|
82
|
+
</td>
|
|
83
|
+
</tr>
|
|
84
|
+
`;
|
|
85
|
+
const ctaToHtml = (secondaryColor, html, href) => `
|
|
86
|
+
<tr>
|
|
87
|
+
<td bgcolor="#ffffff" align="center">
|
|
88
|
+
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
|
89
|
+
<tr>
|
|
90
|
+
<td
|
|
91
|
+
bgcolor="#ffffff"
|
|
92
|
+
align="center"
|
|
93
|
+
style="padding: 0 0 30px 0;"
|
|
94
|
+
>
|
|
95
|
+
<table border="0" cellspacing="0" cellpadding="0">
|
|
96
|
+
<tr>
|
|
97
|
+
<td align="left" style="border-radius: 3px;" bgcolor="${secondaryColor}">
|
|
98
|
+
<!-- CTA -->
|
|
99
|
+
<a
|
|
100
|
+
href="${href}"
|
|
101
|
+
target="_blank"
|
|
102
|
+
style="font-size: 20px; font-family: Helvetica, Arial, sans-serif; text-decoration: none; color: #ffffff; text-decoration: none; padding: 11px 22px; border-radius: 2px; display: inline-block;"
|
|
103
|
+
>${html}</a
|
|
104
|
+
>
|
|
105
|
+
</td>
|
|
106
|
+
</tr>
|
|
107
|
+
</table>
|
|
108
|
+
</td>
|
|
109
|
+
</tr>
|
|
110
|
+
</table>
|
|
111
|
+
</td>
|
|
112
|
+
</tr>
|
|
113
|
+
`;
|
|
@@ -1,38 +1,51 @@
|
|
|
1
1
|
import type * as typeNodemailer from 'nodemailer';
|
|
2
2
|
import type JSONTransport from 'nodemailer/lib/json-transport';
|
|
3
|
-
import type Mail from 'nodemailer/lib/mailer';
|
|
4
3
|
import type SendmailTransport from 'nodemailer/lib/sendmail-transport';
|
|
5
4
|
import type SESTransport from 'nodemailer/lib/ses-transport';
|
|
6
5
|
import type SMTPPool from 'nodemailer/lib/smtp-pool';
|
|
7
6
|
import type SMTPTransport from 'nodemailer/lib/smtp-transport';
|
|
8
7
|
import type StreamTransport from 'nodemailer/lib/stream-transport';
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
export type
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
from?:
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
8
|
+
import { Module } from 'remult/server';
|
|
9
|
+
import { type MailStyle } from './formatMailHelper';
|
|
10
|
+
export type TransportTypes = SMTPPool | SMTPPool.Options | SendmailTransport | SendmailTransport.Options | StreamTransport | StreamTransport.Options | JSONTransport | JSONTransport.Options | SESTransport | SESTransport.Options | SMTPTransport | SMTPTransport.Options | string;
|
|
11
|
+
export type DefaultOptions = typeNodemailer.SendMailOptions;
|
|
12
|
+
type GlobalEasyOptions = {
|
|
13
|
+
saveHtml?: boolean;
|
|
14
|
+
from?: DefaultOptions['from'];
|
|
15
|
+
service?: string;
|
|
16
|
+
primaryColor?: string;
|
|
17
|
+
secondaryColor?: string;
|
|
18
|
+
footer?: string;
|
|
19
|
+
toHtml?: (args: MailStyle) => string;
|
|
20
|
+
};
|
|
21
|
+
export type MailOptions = GlobalEasyOptions & {
|
|
22
|
+
nodemailer?: {
|
|
23
|
+
transport?: TransportTypes;
|
|
24
|
+
defaults?: DefaultOptions;
|
|
19
25
|
};
|
|
20
|
-
transport?: TransportTypes;
|
|
21
|
-
defaults?: DefaultOptions;
|
|
22
|
-
apiUrl?: Parameters<typeof typeNodemailer.createTestAccount>[0];
|
|
23
26
|
};
|
|
24
27
|
declare let transporter: ReturnType<typeof typeNodemailer.createTransport>;
|
|
25
28
|
declare module 'remult' {
|
|
26
29
|
interface RemultContext {
|
|
27
|
-
/** Better checking is it's present or not, that's why it's "?" */
|
|
28
30
|
sendMail?: SendMail;
|
|
29
31
|
}
|
|
30
32
|
}
|
|
31
33
|
export type SendMail = typeof sendMail;
|
|
32
|
-
export declare const sendMail:
|
|
34
|
+
export declare const sendMail: (
|
|
33
35
|
/** usefull for logs, it has NO impact on the mail itself */
|
|
34
|
-
topic: string,
|
|
35
|
-
|
|
36
|
+
topic: string, easyOptions: GlobalEasyOptions & {
|
|
37
|
+
to: Required<DefaultOptions>['to'];
|
|
38
|
+
subject: Required<DefaultOptions>['subject'];
|
|
39
|
+
title?: string;
|
|
40
|
+
sections: {
|
|
41
|
+
html: string;
|
|
42
|
+
cta?: {
|
|
43
|
+
html: string;
|
|
44
|
+
link: string;
|
|
45
|
+
} | undefined;
|
|
46
|
+
}[];
|
|
47
|
+
}, options?: {
|
|
48
|
+
nodemailer?: MailOptions['nodemailer'];
|
|
36
49
|
}) => ReturnType<typeof transporter.sendMail>;
|
|
37
|
-
export declare const mail: (o?: MailOptions
|
|
50
|
+
export declare const mail: (o?: MailOptions) => Module<unknown>;
|
|
38
51
|
export {};
|