firstly 0.2.1 → 0.3.0
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 +13 -0
- package/esm/bin/cmd.js +1 -156
- package/esm/changeLog/index.d.ts +1 -6
- package/esm/internals/BaseEnum.d.ts +1 -1
- package/esm/internals/FF_Entity.js +1 -17
- package/esm/internals/cellsBuildor.js +5 -4
- package/esm/internals/index.d.ts +2 -6
- package/esm/internals/storeItem.d.ts +12 -21
- package/esm/internals/storeItem.js +20 -6
- package/esm/svelte/FF_Repo.svelte.d.ts +9 -0
- package/esm/svelte/FF_Repo.svelte.js +39 -0
- package/esm/svelte/class/SP.svelte.js +14 -2
- package/esm/ui/Button.svelte +4 -52
- package/esm/ui/Button.svelte.d.ts +0 -2
- package/esm/ui/Field.svelte +10 -1
- package/esm/ui/Grid.svelte +2 -5
- package/esm/ui/Grid2.svelte +1 -4
- package/esm/ui/internals/select/MultiSelectMelt.svelte +4 -4
- package/esm/ui/internals/select/MultiSelectMelt.svelte.d.ts +1 -1
- package/esm/ui/internals/select/SelectMelt.svelte +28 -19
- package/esm/ui/internals/select/SelectMelt.svelte.d.ts +1 -1
- package/esm/ui/internals/select/SelectRadio.svelte +1 -1
- package/esm/ui/internals/select/SelectRadio.svelte.d.ts +1 -1
- package/package.json +6 -19
- package/esm/auth/AuthController.d.ts +0 -58
- package/esm/auth/AuthController.js +0 -114
- package/esm/auth/Entities.d.ts +0 -47
- package/esm/auth/Entities.js +0 -182
- package/esm/auth/README.md +0 -3
- package/esm/auth/index.d.ts +0 -5
- package/esm/auth/index.js +0 -5
- package/esm/auth/server/AuthController.server.d.ts +0 -58
- package/esm/auth/server/AuthController.server.js +0 -518
- package/esm/auth/server/handleAuth.d.ts +0 -4
- package/esm/auth/server/handleAuth.js +0 -142
- package/esm/auth/server/handleGuard.d.ts +0 -22
- package/esm/auth/server/handleGuard.js +0 -34
- package/esm/auth/server/helperDb.d.ts +0 -10
- package/esm/auth/server/helperDb.js +0 -56
- package/esm/auth/server/helperFirstly.d.ts +0 -1
- package/esm/auth/server/helperFirstly.js +0 -9
- package/esm/auth/server/helperOslo.d.ts +0 -7
- package/esm/auth/server/helperOslo.js +0 -24
- package/esm/auth/server/helperRemultServer.d.ts +0 -5
- package/esm/auth/server/helperRemultServer.js +0 -44
- package/esm/auth/server/helperRole.d.ts +0 -19
- package/esm/auth/server/helperRole.js +0 -57
- package/esm/auth/server/index.d.ts +0 -8
- package/esm/auth/server/index.js +0 -8
- package/esm/auth/server/module.d.ts +0 -300
- package/esm/auth/server/module.js +0 -230
- package/esm/auth/server/providers/github.d.ts +0 -33
- package/esm/auth/server/providers/github.js +0 -87
- package/esm/auth/server/providers/helperProvider.d.ts +0 -1
- package/esm/auth/server/providers/helperProvider.js +0 -25
- package/esm/auth/static/assets/Page-BHW08QWz.css +0 -1
- package/esm/auth/static/assets/Page-BRNWcY5Z.d.ts +0 -2
- package/esm/auth/static/assets/Page-BRNWcY5Z.js +0 -1
- package/esm/auth/static/assets/Page-CFcEsGK8.d.ts +0 -2
- package/esm/auth/static/assets/Page-CFcEsGK8.js +0 -7
- package/esm/auth/static/assets/Page-tLVs5slF.d.ts +0 -2
- package/esm/auth/static/assets/Page-tLVs5slF.js +0 -1
- package/esm/auth/static/assets/index-D38rqu4x.d.ts +0 -201
- package/esm/auth/static/assets/index-D38rqu4x.js +0 -2
- package/esm/auth/static/assets/index-DKWpA6v7.css +0 -4
- package/esm/auth/static/favicon.svg +0 -79
- package/esm/auth/static/index.html +0 -13
- package/esm/auth/types.d.ts +0 -73
- package/esm/auth/types.js +0 -1
package/esm/ui/Button.svelte
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { createTooltip } from '@melt-ui/svelte'
|
|
3
|
-
import type { Action } from 'svelte/action'
|
|
4
3
|
import { fade, fly } from 'svelte/transition'
|
|
5
4
|
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
import { BaseEnum, tw } from '../internals'
|
|
5
|
+
import { tw } from '../internals'
|
|
9
6
|
|
|
10
7
|
// TODO: extend HTMLButtonAttributes ?
|
|
11
8
|
interface Props {
|
|
12
9
|
isLoading?: boolean
|
|
13
|
-
permission?: BaseEnum[] | BaseEnum | undefined
|
|
14
10
|
tooltip?: import('svelte').Snippet
|
|
15
11
|
class?: string
|
|
16
12
|
children?: import('svelte').Snippet
|
|
@@ -21,15 +17,13 @@
|
|
|
21
17
|
let {
|
|
22
18
|
isLoading = false,
|
|
23
19
|
class: className = '',
|
|
24
|
-
permission = undefined,
|
|
25
20
|
children,
|
|
26
21
|
tooltip,
|
|
27
22
|
disabled: disabledProp,
|
|
28
23
|
...rest
|
|
29
24
|
}: Props = $props()
|
|
30
25
|
|
|
31
|
-
let
|
|
32
|
-
let disabled = $derived(disabledProp || permissionDisabled || isLoading)
|
|
26
|
+
let disabled = $derived(disabledProp || isLoading)
|
|
33
27
|
|
|
34
28
|
// let's trigger the annimation if it's more than 200ms
|
|
35
29
|
let triggerAnnimation = $state(false)
|
|
@@ -42,43 +36,6 @@
|
|
|
42
36
|
}, 200)
|
|
43
37
|
})
|
|
44
38
|
|
|
45
|
-
let updates = (param: { permission: BaseEnum[] | BaseEnum | undefined }) => {
|
|
46
|
-
if (param && param.permission) {
|
|
47
|
-
permissionDisabled = !remult.isAllowed(
|
|
48
|
-
Array.isArray(param.permission) ? param.permission.map((c) => c.id) : param.permission.id,
|
|
49
|
-
)
|
|
50
|
-
if (permissionDisabled) {
|
|
51
|
-
disabledWhy = `Vous n'avez pas la permission: ${Array.isArray(param.permission) ? param.permission.map((c) => `"${c.caption}"`).join(' ou ') : `"${param.permission.caption}"`}`
|
|
52
|
-
} else {
|
|
53
|
-
disabledWhy = ''
|
|
54
|
-
}
|
|
55
|
-
} else {
|
|
56
|
-
permissionDisabled = false
|
|
57
|
-
disabledWhy = ''
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
let disabledWhy = $state('')
|
|
62
|
-
const isAllowed: Action<HTMLElement, { permission: BaseEnum[] | BaseEnum | undefined }> = (
|
|
63
|
-
node,
|
|
64
|
-
param,
|
|
65
|
-
) => {
|
|
66
|
-
// the node has been mounted in the DOM
|
|
67
|
-
// @ts-ignore
|
|
68
|
-
updates(param)
|
|
69
|
-
|
|
70
|
-
return {
|
|
71
|
-
update(param) {
|
|
72
|
-
// the value of `bar` has changed
|
|
73
|
-
updates(param)
|
|
74
|
-
},
|
|
75
|
-
|
|
76
|
-
destroy() {
|
|
77
|
-
// the node has been removed from the DOM
|
|
78
|
-
},
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
39
|
const {
|
|
83
40
|
elements: { trigger, content, arrow },
|
|
84
41
|
states: { open },
|
|
@@ -98,7 +55,6 @@
|
|
|
98
55
|
<button
|
|
99
56
|
{...$trigger}
|
|
100
57
|
use:trigger
|
|
101
|
-
use:isAllowed={{ permission }}
|
|
102
58
|
{...rest}
|
|
103
59
|
class={tw(['btn', className])}
|
|
104
60
|
{disabled}
|
|
@@ -112,7 +68,7 @@
|
|
|
112
68
|
{/if}
|
|
113
69
|
</button>
|
|
114
70
|
|
|
115
|
-
{#if $open &&
|
|
71
|
+
{#if $open && tooltip}
|
|
116
72
|
<div
|
|
117
73
|
{...$content}
|
|
118
74
|
use:content
|
|
@@ -121,11 +77,7 @@
|
|
|
121
77
|
>
|
|
122
78
|
<div {...$arrow} use:arrow></div>
|
|
123
79
|
<div class="px-4 py-1">
|
|
124
|
-
{
|
|
125
|
-
{@render tooltip?.()}
|
|
126
|
-
{:else}
|
|
127
|
-
{disabledWhy}
|
|
128
|
-
{/if}
|
|
80
|
+
{@render tooltip?.()}
|
|
129
81
|
</div>
|
|
130
82
|
</div>
|
|
131
83
|
{/if}
|
package/esm/ui/Field.svelte
CHANGED
|
@@ -167,7 +167,16 @@
|
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
169
|
|
|
170
|
-
|
|
170
|
+
const items = arr.map((r) => getEntityDisplayValue(metaTypeObj.repoTarget, r))
|
|
171
|
+
|
|
172
|
+
// Add "nobody" option at the beginning for filters if configured
|
|
173
|
+
// @ts-ignore
|
|
174
|
+
const filterNobodyLabel = cell.field?.options.filterNobodyLabel
|
|
175
|
+
if (mode === 'filtre' && filterNobodyLabel && str === '') {
|
|
176
|
+
items.unshift({ id: null, caption: filterNobodyLabel })
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
return { items, totalCount }
|
|
171
180
|
}
|
|
172
181
|
|
|
173
182
|
const getMultiValues = (value: any) => {
|
package/esm/ui/Grid.svelte
CHANGED
|
@@ -120,7 +120,6 @@
|
|
|
120
120
|
<div class="flex justify-end">
|
|
121
121
|
{#if withAdd}
|
|
122
122
|
<Button
|
|
123
|
-
permission={store.getRepo().metadata.options.permissionApiInsert}
|
|
124
123
|
disabled={!store.getRepo().metadata.apiInsertAllowed()}
|
|
125
124
|
class="btn btn-square btn-ghost btn-xs"
|
|
126
125
|
onclick={() => dispatch('add', {})}
|
|
@@ -203,13 +202,13 @@
|
|
|
203
202
|
<Clipboardable value={t}>
|
|
204
203
|
<!-- 20 is a cool value ! -->
|
|
205
204
|
<span class={t.length < 20 ? 'text-nowrap' : ''}>
|
|
206
|
-
{t}
|
|
205
|
+
{@html t}
|
|
207
206
|
</span>
|
|
208
207
|
</Clipboardable>
|
|
209
208
|
{:else}
|
|
210
209
|
<!-- 20 is a cool value ! -->
|
|
211
210
|
<span class={t.length < 20 ? 'text-nowrap' : ''}>
|
|
212
|
-
{t}
|
|
211
|
+
{@html t}
|
|
213
212
|
</span>
|
|
214
213
|
{/if}
|
|
215
214
|
{/if}
|
|
@@ -221,7 +220,6 @@
|
|
|
221
220
|
<div class="flex justify-end gap-2">
|
|
222
221
|
{#if withEdit}
|
|
223
222
|
<Button
|
|
224
|
-
permission={store.getRepo().metadata.options.permissionApiUpdate}
|
|
225
223
|
disabled={!store.getRepo().metadata.apiUpdateAllowed()}
|
|
226
224
|
class="btn btn-square btn-ghost btn-xs"
|
|
227
225
|
onclick={() => dispatch('edit', row)}
|
|
@@ -231,7 +229,6 @@
|
|
|
231
229
|
{/if}
|
|
232
230
|
{#if withDelete}
|
|
233
231
|
<Button
|
|
234
|
-
permission={store.getRepo().metadata.options.permissionApiDelete}
|
|
235
232
|
disabled={!store.getRepo().metadata.apiDeleteAllowed()}
|
|
236
233
|
class="btn btn-square btn-ghost btn-xs"
|
|
237
234
|
onclick={() => dispatch('delete', row)}
|
package/esm/ui/Grid2.svelte
CHANGED
|
@@ -122,7 +122,6 @@
|
|
|
122
122
|
<div class="flex justify-end">
|
|
123
123
|
{#if withAdd}
|
|
124
124
|
<Button
|
|
125
|
-
permission={r.metadata.options.permissionApiInsert}
|
|
126
125
|
disabled={!r.metadata.apiInsertAllowed()}
|
|
127
126
|
class="btn btn-square btn-ghost btn-xs"
|
|
128
127
|
onclick={() => dispatch('add', {})}
|
|
@@ -226,8 +225,7 @@
|
|
|
226
225
|
<div class="flex justify-end gap-2">
|
|
227
226
|
{#if withEdit}
|
|
228
227
|
<Button
|
|
229
|
-
|
|
230
|
-
disabled={!r.metadata.apiUpdateAllowed()}
|
|
228
|
+
disabled={!r.metadata.apiUpdateAllowed(row)}
|
|
231
229
|
class="btn btn-square btn-ghost btn-xs"
|
|
232
230
|
onclick={() => dispatch('edit', row)}
|
|
233
231
|
>
|
|
@@ -236,7 +234,6 @@
|
|
|
236
234
|
{/if}
|
|
237
235
|
{#if withDelete}
|
|
238
236
|
<Button
|
|
239
|
-
permission={r.metadata.options.permissionApiDelete}
|
|
240
237
|
disabled={!r.metadata.apiDeleteAllowed()}
|
|
241
238
|
class="btn btn-square btn-ghost btn-xs"
|
|
242
239
|
onclick={() => dispatch('delete', row)}
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
export let loadOptions:
|
|
24
24
|
| ((str: string) => Promise<{ items: BaseItem[]; totalCount: number }>)
|
|
25
25
|
| undefined = undefined
|
|
26
|
-
export let values: string[] | undefined = undefined
|
|
26
|
+
export let values: (string | null)[] | undefined = undefined
|
|
27
27
|
export let clearable = false
|
|
28
28
|
|
|
29
29
|
const dispatch = createEventDispatcher()
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
}
|
|
43
43
|
})
|
|
44
44
|
|
|
45
|
-
const getDefaultValues = (_selectedValue: string[] | undefined) => {
|
|
45
|
+
const getDefaultValues = (_selectedValue: (string | null)[] | undefined) => {
|
|
46
46
|
if (!items) {
|
|
47
47
|
return []
|
|
48
48
|
}
|
|
@@ -99,14 +99,14 @@
|
|
|
99
99
|
// Create a map to count occurrences of each element
|
|
100
100
|
// TODO: switch to: Use SvelteMap instead svelte/prefer-svelte-reactivity
|
|
101
101
|
// eslint-disable-next-line
|
|
102
|
-
const countMap: Map<string, number> = new Map()
|
|
102
|
+
const countMap: Map<string | null, number> = new Map()
|
|
103
103
|
|
|
104
104
|
list.forEach((item) => {
|
|
105
105
|
countMap.set(item, (countMap.get(item) || 0) + 1)
|
|
106
106
|
})
|
|
107
107
|
|
|
108
108
|
// Filter the list to include only elements that occur exactly once
|
|
109
|
-
const uniqueList: string[] = list.filter((item) => countMap.get(item) === 1)
|
|
109
|
+
const uniqueList: (string | null)[] = list.filter((item) => countMap.get(item) === 1)
|
|
110
110
|
|
|
111
111
|
const newIds = uniqueList.sort().join(',')
|
|
112
112
|
const oldSelectedValues = (values ?? []).sort().join(',')
|
|
@@ -21,7 +21,7 @@ declare const MultiSelectMelt: $$__sveltets_2_IsomorphicComponent<{
|
|
|
21
21
|
items: BaseItem[];
|
|
22
22
|
totalCount: number;
|
|
23
23
|
}>) | undefined;
|
|
24
|
-
values?: string[] | undefined;
|
|
24
|
+
values?: (string | null)[] | undefined;
|
|
25
25
|
clearable?: boolean;
|
|
26
26
|
}, {
|
|
27
27
|
selected: CustomEvent<any>;
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
export let loadOptions:
|
|
34
34
|
| ((str: string) => Promise<{ items: BaseItem[]; totalCount: number }>)
|
|
35
35
|
| undefined = undefined
|
|
36
|
-
export let value: string | undefined = undefined
|
|
36
|
+
export let value: string | null | undefined = undefined
|
|
37
37
|
export let clearable = false
|
|
38
38
|
export let createOptionWhenNoResult = false
|
|
39
39
|
export let default_select_if_one_item = false
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
sync.selected(getDefaultValue(value))
|
|
71
71
|
})
|
|
72
72
|
|
|
73
|
-
const getDefaultValue = (_selectedValue: string | undefined) => {
|
|
73
|
+
const getDefaultValue = (_selectedValue: string | null | undefined) => {
|
|
74
74
|
if (!items) {
|
|
75
75
|
return
|
|
76
76
|
}
|
|
@@ -129,8 +129,15 @@
|
|
|
129
129
|
value = v?.value?.id
|
|
130
130
|
})
|
|
131
131
|
|
|
132
|
+
// Helper to strip HTML tags from caption for display in input
|
|
133
|
+
const stripHtml = (html: string): string => {
|
|
134
|
+
const tmp = document.createElement('div')
|
|
135
|
+
tmp.innerHTML = html
|
|
136
|
+
return tmp.textContent || tmp.innerText || ''
|
|
137
|
+
}
|
|
138
|
+
|
|
132
139
|
$: if (!$open) {
|
|
133
|
-
$inputValue = $localSelected?.label
|
|
140
|
+
$inputValue = $localSelected?.label ? stripHtml($localSelected.label) : ''
|
|
134
141
|
}
|
|
135
142
|
|
|
136
143
|
$: filteredItems = items
|
|
@@ -213,28 +220,30 @@
|
|
|
213
220
|
<li
|
|
214
221
|
{...$option(toOption(item))}
|
|
215
222
|
use:$option.action
|
|
216
|
-
class="relative flex cursor-pointer scroll-my-2 items-
|
|
223
|
+
class="relative flex cursor-pointer scroll-my-2 items-start rounded-md px-1
|
|
217
224
|
py-2
|
|
218
225
|
data-[disabled]:opacity-50
|
|
219
226
|
data-[highlighted]:bg-primary
|
|
220
227
|
data-[highlighted]:text-primary-content"
|
|
221
228
|
>
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
229
|
+
<div class="flex items-center">
|
|
230
|
+
{#if $localSelected?.value?.id === item.id}
|
|
231
|
+
<Icon data={LibIcon_Check} class="w-6"></Icon>
|
|
232
|
+
{:else}
|
|
233
|
+
<!-- just to book the place -->
|
|
234
|
+
<span class="w-6"></span>
|
|
235
|
+
{/if}
|
|
236
|
+
{#if item.icon?.data}
|
|
237
|
+
<Icon
|
|
238
|
+
data={item.icon.data}
|
|
239
|
+
class={tw(['flex-shrink-0', item.icon.class])}
|
|
240
|
+
style={item.icon.style}
|
|
241
|
+
size={item.icon.size}
|
|
242
|
+
></Icon>
|
|
243
|
+
{/if}
|
|
244
|
+
</div>
|
|
236
245
|
<div class="pl-2">
|
|
237
|
-
<span class="font-medium">{item.caption}</span>
|
|
246
|
+
<span class="font-medium">{@html item.caption}</span>
|
|
238
247
|
</div>
|
|
239
248
|
</li>
|
|
240
249
|
{:else}
|
|
@@ -22,7 +22,7 @@ declare const SelectMelt: $$__sveltets_2_IsomorphicComponent<{
|
|
|
22
22
|
items: BaseItem[];
|
|
23
23
|
totalCount: number;
|
|
24
24
|
}>) | undefined;
|
|
25
|
-
value?: string | undefined;
|
|
25
|
+
value?: string | null | undefined;
|
|
26
26
|
clearable?: boolean;
|
|
27
27
|
createOptionWhenNoResult?: boolean;
|
|
28
28
|
default_select_if_one_item?: boolean;
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
export let disabled: boolean = false
|
|
9
9
|
export let placeholder: string = ''
|
|
10
10
|
export let items: BaseItem[] = []
|
|
11
|
-
export let value: string | number | undefined = undefined
|
|
11
|
+
export let value: string | number | null | undefined = undefined
|
|
12
12
|
|
|
13
13
|
const dispatch = createEventDispatcher()
|
|
14
14
|
|
|
@@ -17,7 +17,7 @@ declare const SelectRadio: $$__sveltets_2_IsomorphicComponent<{
|
|
|
17
17
|
disabled?: boolean;
|
|
18
18
|
placeholder?: string;
|
|
19
19
|
items?: BaseItem[];
|
|
20
|
-
value?: string | number | undefined;
|
|
20
|
+
value?: string | number | null | undefined;
|
|
21
21
|
}, {
|
|
22
22
|
selected: CustomEvent<any>;
|
|
23
23
|
} & {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "firstly",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Firstly, an opinionated Remult setup!",
|
|
6
6
|
"funding": "https://github.com/sponsors/jycouet",
|
|
@@ -32,27 +32,22 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@clack/prompts": "0.11.0",
|
|
35
|
-
"@kitql/internals": "0.
|
|
35
|
+
"@kitql/internals": "0.11.0",
|
|
36
36
|
"@layerstack/svelte-actions": "1.0.0",
|
|
37
37
|
"@layerstack/utils": "1.0.0",
|
|
38
38
|
"@mdi/js": "7.4.47",
|
|
39
|
-
"@melt-ui/svelte": "0.86.6",
|
|
40
|
-
"@oslojs/crypto": "1.0.1",
|
|
41
|
-
"@oslojs/encoding": "1.1.0",
|
|
42
|
-
"@oslojs/otp": "1.1.0",
|
|
43
39
|
"@types/nodemailer": "7.0.2",
|
|
44
|
-
"
|
|
45
|
-
"bcryptjs": "3.0.2",
|
|
40
|
+
"@melt-ui/svelte": "0.86.6",
|
|
46
41
|
"clsx": "2.1.1",
|
|
47
42
|
"cron": "4.4.0",
|
|
48
43
|
"daisyui": "5.5.3",
|
|
49
44
|
"esm-env": "1.2.2",
|
|
50
45
|
"nodemailer": "7.0.4",
|
|
51
46
|
"svelecte": "5.3.0",
|
|
52
|
-
"tailwind-merge": "
|
|
47
|
+
"tailwind-merge": "3.5.0",
|
|
53
48
|
"tailwindcss": "4.1.14",
|
|
54
|
-
"vite-plugin-kit-routes": "1.0.
|
|
55
|
-
"vite-plugin-stripper": "0.
|
|
49
|
+
"vite-plugin-kit-routes": "1.0.3",
|
|
50
|
+
"vite-plugin-stripper": "0.10.0"
|
|
56
51
|
},
|
|
57
52
|
"sideEffects": false,
|
|
58
53
|
"bin": "./esm/bin/cmd.js",
|
|
@@ -86,14 +81,6 @@
|
|
|
86
81
|
"types": "./esm/formats/index.d.ts",
|
|
87
82
|
"default": "./esm/formats/index.js"
|
|
88
83
|
},
|
|
89
|
-
"./auth": {
|
|
90
|
-
"types": "./esm/auth/index.d.ts",
|
|
91
|
-
"default": "./esm/auth/index.js"
|
|
92
|
-
},
|
|
93
|
-
"./auth/server": {
|
|
94
|
-
"types": "./esm/auth/server/index.d.ts",
|
|
95
|
-
"default": "./esm/auth/server/index.js"
|
|
96
|
-
},
|
|
97
84
|
"./changeLog": {
|
|
98
85
|
"types": "./esm/changeLog/index.d.ts",
|
|
99
86
|
"default": "./esm/changeLog/index.js"
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import type { AuthServerAbstraction, ProviderConfigured } from './types';
|
|
2
|
-
export declare class AuthController {
|
|
3
|
-
#private;
|
|
4
|
-
static _setAbstraction(impl: AuthServerAbstraction): void;
|
|
5
|
-
/**
|
|
6
|
-
* Sign out the current user
|
|
7
|
-
*/
|
|
8
|
-
static signOut(): Promise<import("./types").AuthResponse>;
|
|
9
|
-
/**
|
|
10
|
-
* Sign in with a demo account
|
|
11
|
-
* _(The easiest way to demo & test your application)_
|
|
12
|
-
*/
|
|
13
|
-
static signInDemo(name: string): Promise<import("./types").AuthResponse>;
|
|
14
|
-
/**
|
|
15
|
-
* This is for login / password authentication Invite someone
|
|
16
|
-
*/
|
|
17
|
-
static invite(email: string): Promise<import("./types").AuthResponse>;
|
|
18
|
-
/**
|
|
19
|
-
* This is for login / password authentication SignUp
|
|
20
|
-
*/
|
|
21
|
-
static signUpPassword(email: string, password: string): Promise<import("./types").AuthResponse>;
|
|
22
|
-
/**
|
|
23
|
-
* This is for login / password authentication SignIn
|
|
24
|
-
*/
|
|
25
|
-
static signInPassword(email: string, password: string): Promise<import("./types").AuthResponse>;
|
|
26
|
-
/**
|
|
27
|
-
* Forgot your password ? Send a mail to reset it.
|
|
28
|
-
*/
|
|
29
|
-
static forgotPassword(email: string): Promise<import("./types").AuthResponse>;
|
|
30
|
-
/**
|
|
31
|
-
* Reset your password with a token
|
|
32
|
-
*/
|
|
33
|
-
static resetPassword(token: string, password: string): Promise<import("./types").AuthResponse>;
|
|
34
|
-
/** OTP */
|
|
35
|
-
static signInOTP(email: string): Promise<import("./types").AuthResponse>;
|
|
36
|
-
/**
|
|
37
|
-
* Verify the OTP code
|
|
38
|
-
*/
|
|
39
|
-
static verifyOtp(email: string, otp: string): Promise<import("./types").AuthResponse>;
|
|
40
|
-
/** OAUTH */
|
|
41
|
-
/**
|
|
42
|
-
* The the url to redirect to for the OAuth provider
|
|
43
|
-
* @param provider Has to mach one of `AUTH_OPTIONS.providers.oAuths` your configured
|
|
44
|
-
*
|
|
45
|
-
* To be used like this for example:
|
|
46
|
-
* ```
|
|
47
|
-
* const url = await Auth.signInOAuthGetUrl('github')
|
|
48
|
-
* window.location.href = url
|
|
49
|
-
* ```
|
|
50
|
-
*
|
|
51
|
-
* _(popup example should work too, and a nice example/componant would be appreciated)_
|
|
52
|
-
*/
|
|
53
|
-
static signInOAuthGetUrl<T extends keyof ProviderConfigured>(o: {
|
|
54
|
-
provider: T;
|
|
55
|
-
options?: ProviderConfigured[T];
|
|
56
|
-
redirect?: string;
|
|
57
|
-
}): Promise<string>;
|
|
58
|
-
}
|
|
@@ -1,114 +0,0 @@
|
|
|
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 { BackendMethod } from 'remult';
|
|
8
|
-
import { FF_Role_Auth } from './Entities';
|
|
9
|
-
export class AuthController {
|
|
10
|
-
static #server;
|
|
11
|
-
// Internal setter method that can be used by the module
|
|
12
|
-
static _setAbstraction(impl) {
|
|
13
|
-
this.#server = impl;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Sign out the current user
|
|
17
|
-
*/
|
|
18
|
-
static async signOut() {
|
|
19
|
-
return await AuthController.#server.signOut();
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Sign in with a demo account
|
|
23
|
-
* _(The easiest way to demo & test your application)_
|
|
24
|
-
*/
|
|
25
|
-
static async signInDemo(name) {
|
|
26
|
-
return await AuthController.#server.signInDemo(name);
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* This is for login / password authentication Invite someone
|
|
30
|
-
*/
|
|
31
|
-
static async invite(email) {
|
|
32
|
-
return await AuthController.#server.invite(email);
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* This is for login / password authentication SignUp
|
|
36
|
-
*/
|
|
37
|
-
static async signUpPassword(email, password) {
|
|
38
|
-
return await AuthController.#server.signUpPassword(email, password);
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* This is for login / password authentication SignIn
|
|
42
|
-
*/
|
|
43
|
-
static async signInPassword(email, password) {
|
|
44
|
-
return await AuthController.#server.signInPassword(email, password);
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Forgot your password ? Send a mail to reset it.
|
|
48
|
-
*/
|
|
49
|
-
static async forgotPassword(email) {
|
|
50
|
-
return await AuthController.#server.forgotPassword(email);
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Reset your password with a token
|
|
54
|
-
*/
|
|
55
|
-
static async resetPassword(token, password) {
|
|
56
|
-
return await AuthController.#server.resetPassword(token, password);
|
|
57
|
-
}
|
|
58
|
-
/** OTP */
|
|
59
|
-
static async signInOTP(email) {
|
|
60
|
-
return await AuthController.#server.signInOTP(email);
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Verify the OTP code
|
|
64
|
-
*/
|
|
65
|
-
static async verifyOtp(email, otp) {
|
|
66
|
-
return await AuthController.#server.verifyOtp(email, otp);
|
|
67
|
-
}
|
|
68
|
-
/** OAUTH */
|
|
69
|
-
/**
|
|
70
|
-
* The the url to redirect to for the OAuth provider
|
|
71
|
-
* @param provider Has to mach one of `AUTH_OPTIONS.providers.oAuths` your configured
|
|
72
|
-
*
|
|
73
|
-
* To be used like this for example:
|
|
74
|
-
* ```
|
|
75
|
-
* const url = await Auth.signInOAuthGetUrl('github')
|
|
76
|
-
* window.location.href = url
|
|
77
|
-
* ```
|
|
78
|
-
*
|
|
79
|
-
* _(popup example should work too, and a nice example/componant would be appreciated)_
|
|
80
|
-
*/
|
|
81
|
-
static async signInOAuthGetUrl(o) {
|
|
82
|
-
return await AuthController.#server.signInOAuthGetUrl(o);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
__decorate([
|
|
86
|
-
BackendMethod({ allowed: true })
|
|
87
|
-
], AuthController, "signOut", null);
|
|
88
|
-
__decorate([
|
|
89
|
-
BackendMethod({ allowed: true })
|
|
90
|
-
], AuthController, "signInDemo", null);
|
|
91
|
-
__decorate([
|
|
92
|
-
BackendMethod({ allowed: FF_Role_Auth.FF_Role_Auth_Invite })
|
|
93
|
-
], AuthController, "invite", null);
|
|
94
|
-
__decorate([
|
|
95
|
-
BackendMethod({ allowed: true })
|
|
96
|
-
], AuthController, "signUpPassword", null);
|
|
97
|
-
__decorate([
|
|
98
|
-
BackendMethod({ allowed: true })
|
|
99
|
-
], AuthController, "signInPassword", null);
|
|
100
|
-
__decorate([
|
|
101
|
-
BackendMethod({ allowed: true })
|
|
102
|
-
], AuthController, "forgotPassword", null);
|
|
103
|
-
__decorate([
|
|
104
|
-
BackendMethod({ allowed: true })
|
|
105
|
-
], AuthController, "resetPassword", null);
|
|
106
|
-
__decorate([
|
|
107
|
-
BackendMethod({ allowed: true })
|
|
108
|
-
], AuthController, "signInOTP", null);
|
|
109
|
-
__decorate([
|
|
110
|
-
BackendMethod({ allowed: true })
|
|
111
|
-
], AuthController, "verifyOtp", null);
|
|
112
|
-
__decorate([
|
|
113
|
-
BackendMethod({ allowed: true })
|
|
114
|
-
], AuthController, "signInOAuthGetUrl", null);
|
package/esm/auth/Entities.d.ts
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import type { OAuth2Tokens } from 'arctic';
|
|
2
|
-
import { BaseEnum } from '../internals';
|
|
3
|
-
import type { BaseEnumOptions } from '../internals';
|
|
4
|
-
import type { OAuth2UserInfo } from './types';
|
|
5
|
-
export declare const FF_Role_Auth: {
|
|
6
|
-
readonly FF_Role_Auth_Admin: "FF_Role_Auth.Admin";
|
|
7
|
-
readonly FF_Role_Auth_Invite: "FF_Role_Auth.Invite";
|
|
8
|
-
};
|
|
9
|
-
export declare class FFAuthUser {
|
|
10
|
-
id: string;
|
|
11
|
-
createdAt: Date;
|
|
12
|
-
updatedAt?: Date;
|
|
13
|
-
name: string;
|
|
14
|
-
roles: string[];
|
|
15
|
-
accounts: FFAuthAccount[];
|
|
16
|
-
sessions: FFAuthUserSession[];
|
|
17
|
-
}
|
|
18
|
-
export declare class FFAuthAccount {
|
|
19
|
-
id: string;
|
|
20
|
-
createdAt: Date;
|
|
21
|
-
updatedAt?: Date;
|
|
22
|
-
userId: string;
|
|
23
|
-
user: FFAuthUser;
|
|
24
|
-
provider: string;
|
|
25
|
-
providerUserId: string;
|
|
26
|
-
email?: string | null;
|
|
27
|
-
hashPassword?: string;
|
|
28
|
-
token?: string;
|
|
29
|
-
expiresAt?: Date;
|
|
30
|
-
lastVerifiedAt?: Date;
|
|
31
|
-
metadata?: OAuth2UserInfo & {
|
|
32
|
-
tokens_data: OAuth2Tokens['data'];
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
export declare class FFAuthUserSession {
|
|
36
|
-
id: string;
|
|
37
|
-
expiresAt: Date;
|
|
38
|
-
userId: string;
|
|
39
|
-
user: FFAuthUser;
|
|
40
|
-
}
|
|
41
|
-
export declare class FFAuthProvider extends BaseEnum {
|
|
42
|
-
static DEMO: FFAuthProvider;
|
|
43
|
-
static PASSWORD: FFAuthProvider;
|
|
44
|
-
static OTP: FFAuthProvider;
|
|
45
|
-
static OAUTH: FFAuthProvider;
|
|
46
|
-
constructor(id: string, o?: BaseEnumOptions);
|
|
47
|
-
}
|