firstly 0.0.11 → 0.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/esm/BaseEnum.d.ts +2 -0
- package/esm/BaseEnum.js +2 -0
- package/esm/FF_Fields.js +0 -1
- package/esm/ROUTES.d.ts +2 -2
- package/esm/ROUTES.js +10 -5
- package/esm/SqlDatabase/FF_LogToConsole.d.ts +1 -0
- package/esm/SqlDatabase/FF_LogToConsole.js +22 -16
- package/esm/api/index.d.ts +20 -21
- package/esm/api/index.js +74 -62
- package/esm/auth/{client/Auth.d.ts → AuthController.d.ts} +18 -25
- package/esm/auth/{client/Auth.js → AuthController.js} +48 -44
- package/esm/auth/{client/Entities.d.ts → Entities.d.ts} +4 -3
- package/esm/auth/{client/Entities.js → Entities.js} +7 -7
- package/esm/auth/README.md +0 -10
- package/esm/auth/index.d.ts +5 -149
- package/esm/auth/index.js +5 -316
- package/esm/auth/{AuthController.server.d.ts → server/AuthController.server.d.ts} +10 -10
- package/esm/auth/{AuthController.server.js → server/AuthController.server.js} +133 -171
- package/esm/auth/server/handleAuth.d.ts +2 -0
- package/esm/auth/server/handleAuth.js +140 -0
- package/esm/auth/server/handleGuard.d.ts +16 -0
- package/esm/auth/server/handleGuard.js +67 -0
- package/esm/auth/server/helperDb.d.ts +10 -0
- package/esm/auth/server/helperDb.js +56 -0
- package/esm/auth/server/helperFirstly.d.ts +1 -0
- package/esm/auth/server/helperFirstly.js +8 -0
- package/esm/auth/server/helperOslo.d.ts +7 -0
- package/esm/auth/server/helperOslo.js +24 -0
- package/esm/auth/server/helperRemultServer.d.ts +5 -0
- package/esm/auth/server/helperRemultServer.js +44 -0
- package/esm/auth/{RoleHelpers.d.ts → server/helperRole.d.ts} +1 -1
- package/esm/auth/{RoleHelpers.js → server/helperRole.js} +1 -1
- package/esm/auth/server/index.d.ts +7 -0
- package/esm/auth/server/index.js +7 -0
- package/esm/auth/server/module.d.ts +257 -0
- package/esm/auth/server/module.js +197 -0
- package/esm/auth/{providers → server/providers}/github.d.ts +6 -4
- package/esm/auth/{providers → server/providers}/github.js +29 -20
- package/esm/auth/{providers/index.d.ts → server/providers/helperProvider.d.ts} +0 -2
- package/esm/auth/{providers/index.js → server/providers/helperProvider.js} +5 -6
- package/esm/auth/static/assets/Page-BUfjaN-D.d.ts +5 -0
- package/esm/auth/static/assets/Page-BUfjaN-D.js +19 -0
- package/esm/auth/static/assets/Page-CJ58H1vl.css +1 -0
- package/esm/auth/static/assets/Page-CaDAqmBS.d.ts +5 -0
- package/esm/auth/static/assets/Page-CaDAqmBS.js +1 -0
- package/esm/auth/static/assets/Page-DhdZddzJ.d.ts +5 -0
- package/esm/auth/static/assets/Page-DhdZddzJ.js +1 -0
- package/esm/auth/static/assets/index-BDy4A_14.css +4 -0
- package/esm/auth/static/assets/index-D-Ztdt2o.d.ts +54 -0
- package/esm/auth/static/assets/index-D-Ztdt2o.js +2 -0
- package/esm/auth/static/index.html +11 -11
- package/esm/auth/types.d.ts +5 -0
- package/esm/bin/cmd.js +122 -54
- package/esm/cellsBuildor.js +7 -7
- package/esm/changeLog/index.d.ts +0 -36
- package/esm/changeLog/index.js +3 -43
- package/esm/changeLog/server/index.d.ts +36 -0
- package/esm/changeLog/server/index.js +42 -0
- package/esm/common.d.ts +5 -0
- package/esm/common.js +8 -0
- package/esm/cron/{index.d.ts → server/index.d.ts} +1 -1
- package/esm/cron/server/index.js +103 -0
- package/esm/feedback/FeedbackController.js +4 -5
- package/esm/feedback/index.d.ts +0 -16
- package/esm/feedback/index.js +0 -11
- package/esm/feedback/server/index.d.ts +17 -0
- package/esm/feedback/server/index.js +13 -0
- package/esm/feedback/ui/DialogIssue.svelte +52 -56
- package/esm/feedback/ui/DialogIssues.svelte +71 -71
- package/esm/feedback/ui/DialogMilestones.svelte +22 -22
- package/esm/helper.js +3 -3
- package/esm/index.d.ts +3 -20
- package/esm/index.js +3 -10
- package/esm/mail/index.d.ts +2 -30
- package/esm/mail/index.js +2 -79
- package/esm/mail/server/index.d.ts +31 -0
- package/esm/mail/server/index.js +88 -0
- package/esm/mail/templates/DefaultMail.svelte +17 -17
- package/esm/storeItem.js +8 -2
- package/esm/storeList.d.ts +1 -1
- package/esm/storeList.js +1 -1
- package/esm/sveltekit/server/index.d.ts +14 -0
- package/esm/sveltekit/server/index.js +24 -0
- package/esm/ui/Button.svelte +33 -33
- package/esm/ui/Button.svelte.d.ts +2 -2
- package/esm/ui/Clipboardable.svelte +11 -8
- package/esm/ui/Clipboardable.svelte.d.ts +4 -4
- package/esm/ui/Field.svelte +142 -149
- package/esm/ui/Field.svelte.d.ts +2 -2
- package/esm/ui/FieldGroup.svelte +38 -38
- package/esm/ui/Grid.svelte +212 -222
- package/esm/ui/GridLoading.svelte +18 -22
- package/esm/ui/GridPaginate.svelte +38 -38
- package/esm/ui/Icon.svelte +50 -49
- package/esm/ui/Icon.svelte.d.ts +18 -18
- package/esm/ui/Loading.svelte +5 -2
- package/esm/ui/Tooltip.svelte +16 -16
- package/esm/ui/dialog/DialogForm.svelte +23 -23
- package/esm/ui/dialog/DialogManagement.svelte +74 -74
- package/esm/ui/dialog/DialogPrimitive.svelte +50 -51
- package/esm/ui/dialog/FormEditAction.svelte +34 -34
- package/esm/ui/dialog/dialog.d.ts +2 -2
- package/esm/ui/dialog/dialog.js +1 -1
- package/esm/ui/internals/FieldContainer.svelte +11 -12
- package/esm/ui/internals/FieldContainer.svelte.d.ts +3 -3
- package/esm/ui/internals/Input.svelte +25 -25
- package/esm/ui/internals/Input.svelte.d.ts +1 -1
- package/esm/ui/internals/Textarea.svelte +21 -21
- package/esm/ui/internals/Textarea.svelte.d.ts +2 -2
- package/esm/ui/internals/select/MultiSelectMelt.svelte +69 -73
- package/esm/ui/internals/select/SelectMelt.svelte +86 -86
- package/esm/ui/internals/select/SelectRadio.svelte +22 -22
- package/esm/ui/link/Link.svelte +14 -14
- package/esm/ui/link/Link.svelte.d.ts +3 -4
- package/esm/ui/link/LinkPlus.svelte +33 -35
- package/esm/vite/index.js +24 -25
- package/package.json +50 -42
- package/esm/auth/Adapter.d.ts +0 -10
- package/esm/auth/Adapter.js +0 -50
- package/esm/auth/client/index.d.ts +0 -7
- package/esm/auth/client/index.js +0 -7
- package/esm/auth/helper.d.ts +0 -6
- package/esm/auth/helper.js +0 -14
- package/esm/auth/providers/strava.d.ts +0 -30
- package/esm/auth/providers/strava.js +0 -60
- package/esm/auth/static/assets/Page-BEFYPjis.d.ts +0 -4
- package/esm/auth/static/assets/Page-BEFYPjis.js +0 -1
- package/esm/auth/static/assets/Page-BGTO8LC5.css +0 -1
- package/esm/auth/static/assets/Page-Cfysx_UV.d.ts +0 -6
- package/esm/auth/static/assets/Page-Cfysx_UV.js +0 -18
- package/esm/auth/static/assets/Page-DtgkOCJs.d.ts +0 -4
- package/esm/auth/static/assets/Page-DtgkOCJs.js +0 -1
- package/esm/auth/static/assets/index-CR_3yNaJ.css +0 -4
- package/esm/auth/static/assets/index-QypqCYwC.d.ts +0 -63
- package/esm/auth/static/assets/index-QypqCYwC.js +0 -2
- package/esm/cron/index.js +0 -102
- package/esm/handle/index.d.ts +0 -7
- package/esm/handle/index.js +0 -40
|
@@ -17,40 +17,38 @@ const hasSomethingToDisplay = (item2) => {
|
|
|
17
17
|
</script>
|
|
18
18
|
|
|
19
19
|
<div class="flex items-center gap-4">
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
20
|
+
{#if item}
|
|
21
|
+
{#if item.icon?.data && !noIcon}
|
|
22
|
+
{#if item.icon.caption}
|
|
23
|
+
<Tooltip text={item.icon.caption}>
|
|
24
|
+
<Icon {...item.icon} />
|
|
25
|
+
</Tooltip>
|
|
26
|
+
{:else}
|
|
27
|
+
<Icon {...item.icon} />
|
|
28
|
+
{/if}
|
|
29
|
+
{/if}
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
{/if}
|
|
55
|
-
{/if}
|
|
31
|
+
{#if hasSomethingToDisplay(item)}
|
|
32
|
+
<div class="flex flex-col items-start">
|
|
33
|
+
{#if item.href}
|
|
34
|
+
<div>
|
|
35
|
+
<Link href={item.href}>{item.caption}</Link>
|
|
36
|
+
{#if item.captionSub && captionSubStyle === 'inline'}
|
|
37
|
+
<span class="text-base-content/70 text-xs italic">{item.captionSub}</span>
|
|
38
|
+
{/if}
|
|
39
|
+
</div>
|
|
40
|
+
{:else}
|
|
41
|
+
<!-- 20 is a cool value ! -->
|
|
42
|
+
<span
|
|
43
|
+
class="text-base-content {item.class} {(item.caption ?? '').length < 20 ? 'text-nowrap' : ''}"
|
|
44
|
+
>
|
|
45
|
+
{item.caption ?? '-'}
|
|
46
|
+
</span>
|
|
47
|
+
{/if}
|
|
48
|
+
{#if item.captionSub && captionSubStyle === 'under'}
|
|
49
|
+
<span class="text-base-content/70 text-xs italic">{item.captionSub}</span>
|
|
50
|
+
{/if}
|
|
51
|
+
</div>
|
|
52
|
+
{/if}
|
|
53
|
+
{/if}
|
|
56
54
|
</div>
|
package/esm/vite/index.js
CHANGED
|
@@ -1,34 +1,33 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {} from 'vite';
|
|
2
2
|
import { kitRoutes } from 'vite-plugin-kit-routes';
|
|
3
3
|
import { stripper } from 'vite-plugin-stripper';
|
|
4
4
|
// import { Log } from '@kitql/helpers'
|
|
5
|
-
// const toRemove = ['
|
|
5
|
+
// const toRemove = ['@node-rs/argon2', '@node-rs/bcrypt']
|
|
6
6
|
// oslo needs to be in the dependencies (not devDependencies) !!
|
|
7
|
-
const toRemove = ['oslo/password', 'oslo']
|
|
7
|
+
// const toRemove = ['oslo/password', 'oslo']
|
|
8
8
|
export function firstly(options) {
|
|
9
|
-
//
|
|
10
|
-
// console.log(`toRemove`, toRemove)
|
|
9
|
+
// @ts-ignore
|
|
11
10
|
return [
|
|
12
|
-
{
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
},
|
|
11
|
+
// {
|
|
12
|
+
// name: 'vite-plugin-firstly',
|
|
13
|
+
// enforce: 'pre',
|
|
14
|
+
// config: async (a) => {
|
|
15
|
+
// return mergeConfig(a, {
|
|
16
|
+
// build: {
|
|
17
|
+
// // THE ERROR:
|
|
18
|
+
// // RollupError: Unexpected character '�' or Unexpected character '\u{7f}'
|
|
19
|
+
// // This code (A) is to fix in `build` mode
|
|
20
|
+
// rollupOptions: {
|
|
21
|
+
// external: toRemove,
|
|
22
|
+
// },
|
|
23
|
+
// },
|
|
24
|
+
// // This code (B) is to fix in `dev` mode
|
|
25
|
+
// optimizeDeps: {
|
|
26
|
+
// exclude: toRemove,
|
|
27
|
+
// },
|
|
28
|
+
// })
|
|
29
|
+
// },
|
|
30
|
+
// },
|
|
32
31
|
// @ts-ignore
|
|
33
32
|
...kitRoutes({
|
|
34
33
|
...(options?.kitRoutes ?? {}),
|
package/package.json
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "firstly",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.13",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Firstly, an opinionated Remult setup!",
|
|
6
|
+
"funding": "https://github.com/sponsors/jycouet",
|
|
7
|
+
"homepage": "https://firstly.fun/",
|
|
6
8
|
"repository": {
|
|
7
9
|
"type": "git",
|
|
8
10
|
"url": "https://github.com/jycouet/firstly",
|
|
@@ -14,46 +16,44 @@
|
|
|
14
16
|
},
|
|
15
17
|
"peerDependencies": {
|
|
16
18
|
"@sveltejs/kit": ">=1.0.0 <3.0.0",
|
|
17
|
-
"remult": "2.7.
|
|
19
|
+
"remult": "2.7.31",
|
|
18
20
|
"svelte": ">=4.2.18"
|
|
19
21
|
},
|
|
20
22
|
"dependencies": {
|
|
21
|
-
"@clack/prompts": "
|
|
22
|
-
"@kitql/internals": "0.
|
|
23
|
-
"@mdi/js": "
|
|
24
|
-
"@melt-ui/svelte": "
|
|
25
|
-
"@
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"vite
|
|
23
|
+
"@clack/prompts": "0.10.0",
|
|
24
|
+
"@kitql/internals": "0.10.3",
|
|
25
|
+
"@mdi/js": "7.4.47",
|
|
26
|
+
"@melt-ui/svelte": "0.86.3",
|
|
27
|
+
"@oslojs/crypto": "1.0.1",
|
|
28
|
+
"@oslojs/encoding": "1.1.0",
|
|
29
|
+
"@oslojs/otp": "1.1.0",
|
|
30
|
+
"@types/nodemailer": "6.4.14",
|
|
31
|
+
"arctic": "3.5.0",
|
|
32
|
+
"bcryptjs": "3.0.2",
|
|
33
|
+
"clsx": "2.1.1",
|
|
34
|
+
"cron": "4.1.0",
|
|
35
|
+
"daisyui": "4.12.14",
|
|
36
|
+
"esm-env": "1.2.2",
|
|
37
|
+
"nodemailer": "6.10.0",
|
|
38
|
+
"svelty-email": "0.0.11",
|
|
39
|
+
"tailwind-merge": "2.6.0",
|
|
40
|
+
"tailwindcss": "3.4.4",
|
|
41
|
+
"vite": "5.4.1",
|
|
42
|
+
"vite-plugin-kit-routes": "0.8.3",
|
|
43
|
+
"vite-plugin-stripper": "0.6.4"
|
|
40
44
|
},
|
|
41
45
|
"sideEffects": false,
|
|
42
46
|
"bin": "./esm/bin/cmd.js",
|
|
43
47
|
"exports": {
|
|
44
48
|
".": {
|
|
45
49
|
"types": "./esm/index.d.ts",
|
|
46
|
-
"
|
|
47
|
-
"
|
|
50
|
+
"svelte": "./esm/index.js",
|
|
51
|
+
"default": "./esm/index.js"
|
|
48
52
|
},
|
|
49
53
|
"./api": {
|
|
50
54
|
"types": "./esm/api/index.d.ts",
|
|
51
55
|
"default": "./esm/api/index.js"
|
|
52
56
|
},
|
|
53
|
-
"./handle": {
|
|
54
|
-
"types": "./esm/handle/index.d.ts",
|
|
55
|
-
"default": "./esm/handle/index.js"
|
|
56
|
-
},
|
|
57
57
|
"./vite": {
|
|
58
58
|
"types": "./esm/vite/index.d.ts",
|
|
59
59
|
"default": "./esm/vite/index.js"
|
|
@@ -65,33 +65,41 @@
|
|
|
65
65
|
"types": "./esm/formats/index.d.ts",
|
|
66
66
|
"default": "./esm/formats/index.js"
|
|
67
67
|
},
|
|
68
|
-
"./auth": {
|
|
68
|
+
"./auth/client": {
|
|
69
69
|
"types": "./esm/auth/index.d.ts",
|
|
70
70
|
"default": "./esm/auth/index.js"
|
|
71
71
|
},
|
|
72
|
-
"./auth/
|
|
73
|
-
"types": "./esm/auth/
|
|
74
|
-
"default": "./esm/auth/
|
|
72
|
+
"./auth/server": {
|
|
73
|
+
"types": "./esm/auth/server/index.d.ts",
|
|
74
|
+
"default": "./esm/auth/server/index.js"
|
|
75
75
|
},
|
|
76
|
-
"./
|
|
77
|
-
"types": "./esm/
|
|
78
|
-
"default": "./esm/
|
|
76
|
+
"./changeLog/client": {
|
|
77
|
+
"types": "./esm/changeLog/index.d.ts",
|
|
78
|
+
"default": "./esm/changeLog/index.js"
|
|
79
79
|
},
|
|
80
|
-
"./
|
|
80
|
+
"./changeLog/server": {
|
|
81
|
+
"types": "./esm/changeLog/server/index.d.ts",
|
|
82
|
+
"default": "./esm/changeLog/server/index.js"
|
|
83
|
+
},
|
|
84
|
+
"./cron/server": {
|
|
85
|
+
"types": "./esm/cron/server/index.d.ts",
|
|
86
|
+
"default": "./esm/cron/server/index.js"
|
|
87
|
+
},
|
|
88
|
+
"./feedback/client": {
|
|
81
89
|
"types": "./esm/feedback/index.d.ts",
|
|
82
90
|
"default": "./esm/feedback/index.js"
|
|
83
91
|
},
|
|
84
|
-
"./
|
|
85
|
-
"types": "./esm/
|
|
86
|
-
"default": "./esm/
|
|
92
|
+
"./feedback/server": {
|
|
93
|
+
"types": "./esm/feedback/server/index.d.ts",
|
|
94
|
+
"default": "./esm/feedback/server/index.js"
|
|
87
95
|
},
|
|
88
|
-
"./mail": {
|
|
96
|
+
"./mail/client": {
|
|
89
97
|
"types": "./esm/mail/index.d.ts",
|
|
90
98
|
"default": "./esm/mail/index.js"
|
|
91
99
|
},
|
|
92
|
-
"./
|
|
93
|
-
"types": "./esm/
|
|
94
|
-
"default": "./esm/
|
|
100
|
+
"./mail/server": {
|
|
101
|
+
"types": "./esm/mail/server/index.d.ts",
|
|
102
|
+
"default": "./esm/mail/server/index.js"
|
|
95
103
|
}
|
|
96
104
|
},
|
|
97
105
|
"keywords": [
|
package/esm/auth/Adapter.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { Adapter, DatabaseSession, DatabaseUser } from 'lucia';
|
|
2
|
-
export declare class RemultLuciaAdapter implements Adapter {
|
|
3
|
-
getSessionAndUser(sessionId: string): Promise<[session: DatabaseSession | null, user: DatabaseUser | null]>;
|
|
4
|
-
getUserSessions(userId: string): Promise<DatabaseSession[]>;
|
|
5
|
-
setSession(session: DatabaseSession): Promise<void>;
|
|
6
|
-
updateSessionExpiration(sessionId: string, expiresAt: Date): Promise<void>;
|
|
7
|
-
deleteSession(sessionId: string): Promise<void>;
|
|
8
|
-
deleteUserSessions(userId: string): Promise<void>;
|
|
9
|
-
deleteExpiredSessions(): Promise<void>;
|
|
10
|
-
}
|
package/esm/auth/Adapter.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { remult } from 'remult';
|
|
2
|
-
import { getSafeOptions } from './index.js';
|
|
3
|
-
export class RemultLuciaAdapter {
|
|
4
|
-
async getSessionAndUser(sessionId) {
|
|
5
|
-
const oSafe = getSafeOptions();
|
|
6
|
-
const session = await remult.repo(oSafe.Session).findId(sessionId);
|
|
7
|
-
if (session) {
|
|
8
|
-
const user = await remult.repo(oSafe.User).findId(session.userId);
|
|
9
|
-
if (user) {
|
|
10
|
-
return [
|
|
11
|
-
{ ...session, attributes: {} },
|
|
12
|
-
{ ...user, attributes: oSafe.transformDbUserToClientUser(session, user) },
|
|
13
|
-
];
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
return [null, null];
|
|
17
|
-
}
|
|
18
|
-
async getUserSessions(userId) {
|
|
19
|
-
const oSafe = getSafeOptions();
|
|
20
|
-
return (await remult.repo(oSafe.Session).find({ where: { userId } })).map((s) => {
|
|
21
|
-
return { ...s, attributes: {} };
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
async setSession(session) {
|
|
25
|
-
const oSafe = getSafeOptions();
|
|
26
|
-
await remult.repo(oSafe.Session).insert(session);
|
|
27
|
-
}
|
|
28
|
-
async updateSessionExpiration(sessionId, expiresAt) {
|
|
29
|
-
const oSafe = getSafeOptions();
|
|
30
|
-
await remult.repo(oSafe.Session).update(sessionId, { expiresAt });
|
|
31
|
-
}
|
|
32
|
-
async deleteSession(sessionId) {
|
|
33
|
-
const oSafe = getSafeOptions();
|
|
34
|
-
await remult.repo(oSafe.Session).delete(sessionId);
|
|
35
|
-
}
|
|
36
|
-
async deleteUserSessions(userId) {
|
|
37
|
-
const oSafe = getSafeOptions();
|
|
38
|
-
const all = await remult.repo(oSafe.Session).find({ where: { userId } });
|
|
39
|
-
for (const s of all) {
|
|
40
|
-
await remult.repo(oSafe.Session).delete(s);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
async deleteExpiredSessions() {
|
|
44
|
-
const oSafe = getSafeOptions();
|
|
45
|
-
const all = await remult.repo(oSafe.Session).find({ where: { expiresAt: { $lt: new Date() } } });
|
|
46
|
-
for (const s of all) {
|
|
47
|
-
await remult.repo(oSafe.Session).delete(s);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { Log } from '@kitql/helpers';
|
|
2
|
-
import { Auth } from './Auth';
|
|
3
|
-
import { FFAuthAccount, FFAuthProvider, FFAuthUser, FFAuthUserSession } from './Entities';
|
|
4
|
-
export declare const logAuth: Log;
|
|
5
|
-
export { FF_Role_Auth } from './Entities';
|
|
6
|
-
export { Auth };
|
|
7
|
-
export { FFAuthUser, FFAuthAccount, FFAuthProvider, FFAuthUserSession };
|
package/esm/auth/client/index.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { Log } from '@kitql/helpers';
|
|
2
|
-
import { Auth } from './Auth';
|
|
3
|
-
import { FFAuthAccount, FFAuthProvider, FFAuthUser, FFAuthUserSession } from './Entities';
|
|
4
|
-
export const logAuth = new Log('firstly | auth');
|
|
5
|
-
export { FF_Role_Auth } from './Entities';
|
|
6
|
-
export { Auth };
|
|
7
|
-
export { FFAuthUser, FFAuthAccount, FFAuthProvider, FFAuthUserSession };
|
package/esm/auth/helper.d.ts
DELETED
package/esm/auth/helper.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { remult } from 'remult';
|
|
2
|
-
import { lucia } from '.';
|
|
3
|
-
/**
|
|
4
|
-
* Create or extend a session for a user.
|
|
5
|
-
* If you pass a session, it will extend it.
|
|
6
|
-
*/
|
|
7
|
-
export async function createOrExtendSession(userId, session) {
|
|
8
|
-
const sessionToUser = session ? session : await lucia.createSession(userId, {});
|
|
9
|
-
const sessionCookie = lucia.createSessionCookie(sessionToUser.id);
|
|
10
|
-
remult.context.setCookie(sessionCookie.name, sessionCookie.value, {
|
|
11
|
-
path: '/',
|
|
12
|
-
...sessionCookie.attributes,
|
|
13
|
-
});
|
|
14
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { Strava } from 'arctic';
|
|
2
|
-
import { type FFOAuth2Provider } from '../';
|
|
3
|
-
/**
|
|
4
|
-
* ## Strava OAuth2 provider
|
|
5
|
-
*
|
|
6
|
-
* 1. Get your **id** & **secret** from [Strava (direct link)](https://www.strava.com/settings/api).
|
|
7
|
-
* 2. In Strava, set your callback url to
|
|
8
|
-
* - [ ] dev: `http://localhost:5173/api/auth_callback`
|
|
9
|
-
* - [ ] prod: `https://MY_SUPER_SITE/api/auth_callback`
|
|
10
|
-
* 3. In your project add a `.env` file with the following:
|
|
11
|
-
* ```bash
|
|
12
|
-
* STRAVA_CLIENT_ID = 'your-client-id'
|
|
13
|
-
* STRAVA_CLIENT_SECRET = 'your-client-secret'
|
|
14
|
-
* # STRAVA_REDIRECT_URI = '' # optional, will default to "${origin}/api/auth_callback"
|
|
15
|
-
* ```
|
|
16
|
-
* 4. In your frontend, under a button click call something like:
|
|
17
|
-
* ```ts
|
|
18
|
-
* async function oauth() {
|
|
19
|
-
* window.location.href = await Auth.signInOAuthGetUrl({ provider: 'strava', redirect: window.location.pathname })
|
|
20
|
-
* }
|
|
21
|
-
* ```
|
|
22
|
-
* 5. Enjoy 🥳
|
|
23
|
-
*/
|
|
24
|
-
export declare function strava(options?: {
|
|
25
|
-
STRAVA_CLIENT_ID?: string;
|
|
26
|
-
STRAVA_CLIENT_SECRET?: string;
|
|
27
|
-
STRAVA_REDIRECT_URI?: string;
|
|
28
|
-
authorizationURLOptions?: ReturnType<FFOAuth2Provider<'strava', Strava>['authorizationURLOptions']>;
|
|
29
|
-
log?: boolean;
|
|
30
|
-
}): FFOAuth2Provider<'strava', Strava>;
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { Strava } from 'arctic';
|
|
2
|
-
import { remult } from 'remult';
|
|
3
|
-
import { env } from '$env/dynamic/private';
|
|
4
|
-
import { checkOAuthConfig } from '.';
|
|
5
|
-
import {} from '../';
|
|
6
|
-
import { logAuth } from '../client';
|
|
7
|
-
/**
|
|
8
|
-
* ## Strava OAuth2 provider
|
|
9
|
-
*
|
|
10
|
-
* 1. Get your **id** & **secret** from [Strava (direct link)](https://www.strava.com/settings/api).
|
|
11
|
-
* 2. In Strava, set your callback url to
|
|
12
|
-
* - [ ] dev: `http://localhost:5173/api/auth_callback`
|
|
13
|
-
* - [ ] prod: `https://MY_SUPER_SITE/api/auth_callback`
|
|
14
|
-
* 3. In your project add a `.env` file with the following:
|
|
15
|
-
* ```bash
|
|
16
|
-
* STRAVA_CLIENT_ID = 'your-client-id'
|
|
17
|
-
* STRAVA_CLIENT_SECRET = 'your-client-secret'
|
|
18
|
-
* # STRAVA_REDIRECT_URI = '' # optional, will default to "${origin}/api/auth_callback"
|
|
19
|
-
* ```
|
|
20
|
-
* 4. In your frontend, under a button click call something like:
|
|
21
|
-
* ```ts
|
|
22
|
-
* async function oauth() {
|
|
23
|
-
* window.location.href = await Auth.signInOAuthGetUrl({ provider: 'strava', redirect: window.location.pathname })
|
|
24
|
-
* }
|
|
25
|
-
* ```
|
|
26
|
-
* 5. Enjoy 🥳
|
|
27
|
-
*/
|
|
28
|
-
export function strava(options) {
|
|
29
|
-
const name = 'strava';
|
|
30
|
-
const clientID = options?.STRAVA_CLIENT_ID ?? env.STRAVA_CLIENT_ID ?? '';
|
|
31
|
-
const secret = options?.STRAVA_CLIENT_SECRET ?? env.STRAVA_CLIENT_SECRET ?? '';
|
|
32
|
-
const urlForKeys = 'https://www.strava.com/settings/api';
|
|
33
|
-
checkOAuthConfig(name, clientID, secret, urlForKeys, false);
|
|
34
|
-
return {
|
|
35
|
-
name,
|
|
36
|
-
isPKCE: false,
|
|
37
|
-
getArcticProvider: () => {
|
|
38
|
-
const redirectURI = options?.STRAVA_REDIRECT_URI ??
|
|
39
|
-
env.STRAVA_REDIRECT_URI ??
|
|
40
|
-
`${remult.context.url.origin}/api/auth_callback`;
|
|
41
|
-
checkOAuthConfig(name, clientID, secret, urlForKeys, true);
|
|
42
|
-
return new Strava(clientID, secret, redirectURI);
|
|
43
|
-
},
|
|
44
|
-
authorizationURLOptions: () => {
|
|
45
|
-
return options?.authorizationURLOptions ?? { scopes: [] };
|
|
46
|
-
},
|
|
47
|
-
getUserInfo: async (tokens) => {
|
|
48
|
-
const res = await fetch('https://www.strava.com/api/v3/athlete', {
|
|
49
|
-
headers: {
|
|
50
|
-
Authorization: `Bearer ${tokens.accessToken}`,
|
|
51
|
-
},
|
|
52
|
-
});
|
|
53
|
-
const user = await res.json();
|
|
54
|
-
if (options?.log) {
|
|
55
|
-
logAuth.info(`user`, user);
|
|
56
|
-
}
|
|
57
|
-
return { raw: user, providerUserId: String(user.id), nameOptions: [user.login] };
|
|
58
|
-
},
|
|
59
|
-
};
|
|
60
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{S as l,b as d,a as f,d as i,h as m,M as p,t as u,n as r,z as h}from"./index-QypqCYwC.js";function c(s){let e;const n={c:function(){e=p("Hello from admin")},l:function(t){throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option")},m:function(t,o){u(t,e,o)},p:r,i:r,o:r,d:function(t){t&&h(e)}};return i("SvelteRegisterBlock",{block:n,id:c.name,type:"component",source:"",ctx:s}),n}function w(s,e){let{$$slots:n={},$$scope:a}=e;m("Page",n,[]);const t=[];return Object.keys(e).forEach(o=>{!~t.indexOf(o)&&o.slice(0,2)!=="$$"&&o!=="slot"&&console.warn(`<Page> was created with unknown prop '${o}'`)}),[]}class v extends l{constructor(e){super(e),d(this,e,w,c,f,{}),i("SvelteRegisterComponent",{component:this,tagName:"Page",options:e,id:c.name})}}export{v as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
form.s-KT008SdmQprk,form.s-N0DaQgJ_T5_C,form.s-85Tmcm64bnMI{display:flex;flex-direction:column}.message.s-85Tmcm64bnMI:empty{display:none}.message.s-85Tmcm64bnMI{background:var(--pico-muted-border-color);padding:var(--pico-form-element-spacing-vertical) var(--pico-form-element-spacing-horizontal);border-radius:var(--pico-border-radius);margin-bottom:calc(var(--pico-typography-spacing-vertical) * 2)}.message.error.s-85Tmcm64bnMI{background:var(--pico-del-color);color:#4c1513}form.s-FRwn6sVlvC6z{display:flex;flex-direction:column}.message.s-FRwn6sVlvC6z:empty{display:none}.message.s-FRwn6sVlvC6z{background:var(--pico-muted-border-color);padding:var(--pico-form-element-spacing-vertical) var(--pico-form-element-spacing-horizontal);border-radius:var(--pico-border-radius);margin-bottom:calc(var(--pico-typography-spacing-vertical) * 2)}.message.error.s-FRwn6sVlvC6z{background:var(--pico-del-color);color:#4c1513}.wrapper.s-NO-a_LAEXXH5{min-height:100vh;display:flex;justify-content:center;align-items:center;margin:0 auto}.form.s-NO-a_LAEXXH5{padding:1rem;max-width:360px;width:100%}.form-footer.s-NO-a_LAEXXH5{margin-top:1rem;display:flex;flex-direction:column;justify-content:center;align-items:center}.fallback.s-NO-a_LAEXXH5{display:flex;justify-content:center;align-items:center}
|