firstly 0.2.1 → 0.4.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.
Files changed (210) hide show
  1. package/CHANGELOG.md +65 -0
  2. package/esm/SqlDatabase/FF_LogToConsole.js +9 -14
  3. package/esm/carbone/CarboneController.js +2 -1
  4. package/esm/changeLog/index.d.ts +0 -10
  5. package/esm/{internals → core}/BaseEnum.d.ts +1 -1
  6. package/esm/core/FF_Entity.js +5 -0
  7. package/esm/core/helper.d.ts +2 -0
  8. package/esm/core/helper.js +3 -0
  9. package/esm/core/index.d.ts +0 -0
  10. package/esm/core/index.js +5 -0
  11. package/esm/core/tailwind.d.ts +21 -0
  12. package/esm/core/tailwind.js +22 -0
  13. package/esm/core/tryCatch.d.ts +44 -0
  14. package/esm/core/tryCatch.js +34 -0
  15. package/esm/cron/server/index.js +1 -1
  16. package/esm/feedback/FeedbackController.js +3 -2
  17. package/esm/feedback/index.d.ts +7 -2
  18. package/esm/feedback/index.js +1 -2
  19. package/esm/feedback/server/index.d.ts +0 -5
  20. package/esm/feedback/server/index.js +1 -1
  21. package/esm/formats/strings.js +2 -2
  22. package/esm/index.d.ts +16 -0
  23. package/esm/index.js +13 -0
  24. package/esm/svelte/FF_Repo.svelte.d.ts +9 -2
  25. package/esm/svelte/FF_Repo.svelte.js +40 -17
  26. package/esm/svelte/class/SP.svelte.js +14 -2
  27. package/esm/svelte/helpers/debounce.js +1 -1
  28. package/esm/svelte/index.d.ts +2 -24
  29. package/esm/svelte/index.js +2 -22
  30. package/esm/{ui → svelte/ui}/Icon.svelte +1 -1
  31. package/esm/virtual/StateDemoEnum.d.ts +3 -3
  32. package/esm/virtual/StateDemoEnum.js +3 -3
  33. package/esm/virtual/UIEntity.js +1 -2
  34. package/package.json +8 -39
  35. package/esm/auth/AuthController.d.ts +0 -58
  36. package/esm/auth/AuthController.js +0 -114
  37. package/esm/auth/Entities.d.ts +0 -47
  38. package/esm/auth/Entities.js +0 -182
  39. package/esm/auth/README.md +0 -3
  40. package/esm/auth/index.d.ts +0 -5
  41. package/esm/auth/index.js +0 -5
  42. package/esm/auth/server/AuthController.server.d.ts +0 -58
  43. package/esm/auth/server/AuthController.server.js +0 -518
  44. package/esm/auth/server/handleAuth.d.ts +0 -4
  45. package/esm/auth/server/handleAuth.js +0 -142
  46. package/esm/auth/server/handleGuard.d.ts +0 -22
  47. package/esm/auth/server/handleGuard.js +0 -34
  48. package/esm/auth/server/helperDb.d.ts +0 -10
  49. package/esm/auth/server/helperDb.js +0 -56
  50. package/esm/auth/server/helperFirstly.d.ts +0 -1
  51. package/esm/auth/server/helperFirstly.js +0 -9
  52. package/esm/auth/server/helperOslo.d.ts +0 -7
  53. package/esm/auth/server/helperOslo.js +0 -24
  54. package/esm/auth/server/helperRemultServer.d.ts +0 -5
  55. package/esm/auth/server/helperRemultServer.js +0 -44
  56. package/esm/auth/server/helperRole.d.ts +0 -19
  57. package/esm/auth/server/helperRole.js +0 -57
  58. package/esm/auth/server/index.d.ts +0 -8
  59. package/esm/auth/server/index.js +0 -8
  60. package/esm/auth/server/module.d.ts +0 -300
  61. package/esm/auth/server/module.js +0 -230
  62. package/esm/auth/server/providers/github.d.ts +0 -33
  63. package/esm/auth/server/providers/github.js +0 -87
  64. package/esm/auth/server/providers/helperProvider.d.ts +0 -1
  65. package/esm/auth/server/providers/helperProvider.js +0 -25
  66. package/esm/auth/static/assets/Page-BHW08QWz.css +0 -1
  67. package/esm/auth/static/assets/Page-BRNWcY5Z.d.ts +0 -2
  68. package/esm/auth/static/assets/Page-BRNWcY5Z.js +0 -1
  69. package/esm/auth/static/assets/Page-CFcEsGK8.d.ts +0 -2
  70. package/esm/auth/static/assets/Page-CFcEsGK8.js +0 -7
  71. package/esm/auth/static/assets/Page-tLVs5slF.d.ts +0 -2
  72. package/esm/auth/static/assets/Page-tLVs5slF.js +0 -1
  73. package/esm/auth/static/assets/index-D38rqu4x.d.ts +0 -201
  74. package/esm/auth/static/assets/index-D38rqu4x.js +0 -2
  75. package/esm/auth/static/assets/index-DKWpA6v7.css +0 -4
  76. package/esm/auth/static/favicon.svg +0 -79
  77. package/esm/auth/static/index.html +0 -13
  78. package/esm/auth/types.d.ts +0 -73
  79. package/esm/bin/cmd.d.ts +0 -1
  80. package/esm/bin/cmd.js +0 -793
  81. package/esm/feedback/ui/DialogIssue.svelte +0 -149
  82. package/esm/feedback/ui/DialogIssue.svelte.d.ts +0 -22
  83. package/esm/feedback/ui/DialogIssues.svelte +0 -114
  84. package/esm/feedback/ui/DialogIssues.svelte.d.ts +0 -22
  85. package/esm/feedback/ui/DialogMilestones.svelte +0 -43
  86. package/esm/feedback/ui/DialogMilestones.svelte.d.ts +0 -20
  87. package/esm/feedback/ui/Feedback.svelte +0 -16
  88. package/esm/feedback/ui/Feedback.svelte.d.ts +0 -18
  89. package/esm/internals/FF_Entity.d.ts +0 -2
  90. package/esm/internals/FF_Entity.js +0 -21
  91. package/esm/internals/FF_Fields.d.ts +0 -11
  92. package/esm/internals/FF_Fields.js +0 -144
  93. package/esm/internals/cellsBuildor.d.ts +0 -47
  94. package/esm/internals/cellsBuildor.js +0 -140
  95. package/esm/internals/helper.d.ts +0 -49
  96. package/esm/internals/helper.js +0 -162
  97. package/esm/internals/index.d.ts +0 -82
  98. package/esm/internals/index.js +0 -45
  99. package/esm/internals/storeItem.d.ts +0 -28
  100. package/esm/internals/storeItem.js +0 -176
  101. package/esm/internals/storeList.d.ts +0 -34
  102. package/esm/internals/storeList.js +0 -108
  103. package/esm/internals/theme.d.ts +0 -4
  104. package/esm/internals/theme.js +0 -4
  105. package/esm/server/index.d.ts +0 -52
  106. package/esm/server/index.js +0 -87
  107. package/esm/svelte/FF_Cell.svelte +0 -103
  108. package/esm/svelte/FF_Cell.svelte.d.ts +0 -33
  109. package/esm/svelte/FF_Cell_Caption.svelte +0 -20
  110. package/esm/svelte/FF_Cell_Caption.svelte.d.ts +0 -31
  111. package/esm/svelte/FF_Cell_Display.svelte +0 -61
  112. package/esm/svelte/FF_Cell_Display.svelte.d.ts +0 -29
  113. package/esm/svelte/FF_Cell_Edit.svelte +0 -104
  114. package/esm/svelte/FF_Cell_Edit.svelte.d.ts +0 -32
  115. package/esm/svelte/FF_Cell_Error.svelte +0 -20
  116. package/esm/svelte/FF_Cell_Error.svelte.d.ts +0 -31
  117. package/esm/svelte/FF_Cell_Hint.svelte +0 -20
  118. package/esm/svelte/FF_Cell_Hint.svelte.d.ts +0 -31
  119. package/esm/svelte/FF_Config.svelte +0 -29
  120. package/esm/svelte/FF_Config.svelte.d.ts +0 -9
  121. package/esm/svelte/FF_Form.svelte +0 -155
  122. package/esm/svelte/FF_Form.svelte.d.ts +0 -37
  123. package/esm/svelte/FF_Grid.svelte +0 -257
  124. package/esm/svelte/FF_Grid.svelte.d.ts +0 -37
  125. package/esm/svelte/FF_Layout.svelte +0 -62
  126. package/esm/svelte/FF_Layout.svelte.d.ts +0 -31
  127. package/esm/svelte/actions/intersection.d.ts +0 -6
  128. package/esm/svelte/actions/intersection.js +0 -17
  129. package/esm/svelte/customField.d.ts +0 -69
  130. package/esm/svelte/customField.js +0 -4
  131. package/esm/svelte/dialog/DialogManagement.svelte +0 -98
  132. package/esm/svelte/dialog/DialogManagement.svelte.d.ts +0 -18
  133. package/esm/svelte/dialog/DialogPrimitive.svelte +0 -156
  134. package/esm/svelte/dialog/DialogPrimitive.svelte.d.ts +0 -38
  135. package/esm/svelte/dialog/dialog.d.ts +0 -58
  136. package/esm/svelte/dialog/dialog.js +0 -130
  137. package/esm/svelte/ff_Config.svelte.d.ts +0 -91
  138. package/esm/svelte/ff_Config.svelte.js +0 -111
  139. package/esm/svelte/firstly.css +0 -14
  140. package/esm/svelte/helpers.d.ts +0 -30
  141. package/esm/svelte/helpers.js +0 -38
  142. package/esm/svelte/tryCatch.d.ts +0 -12
  143. package/esm/svelte/tryCatch.js +0 -18
  144. package/esm/sveltekit/server/index.d.ts +0 -5
  145. package/esm/sveltekit/server/index.js +0 -24
  146. package/esm/ui/Button.svelte +0 -138
  147. package/esm/ui/Button.svelte.d.ts +0 -13
  148. package/esm/ui/Clipboardable.svelte +0 -25
  149. package/esm/ui/Clipboardable.svelte.d.ts +0 -12
  150. package/esm/ui/Field.svelte +0 -382
  151. package/esm/ui/Field.svelte.d.ts +0 -40
  152. package/esm/ui/FieldGroup.svelte +0 -117
  153. package/esm/ui/FieldGroup.svelte.d.ts +0 -44
  154. package/esm/ui/Grid.svelte +0 -265
  155. package/esm/ui/Grid.svelte.d.ts +0 -57
  156. package/esm/ui/Grid2.svelte +0 -293
  157. package/esm/ui/Grid2.svelte.d.ts +0 -57
  158. package/esm/ui/GridLoading.svelte +0 -58
  159. package/esm/ui/GridLoading.svelte.d.ts +0 -23
  160. package/esm/ui/GridPaginate.svelte +0 -69
  161. package/esm/ui/GridPaginate.svelte.d.ts +0 -23
  162. package/esm/ui/GridPaginate2.svelte +0 -25
  163. package/esm/ui/GridPaginate2.svelte.d.ts +0 -7
  164. package/esm/ui/Loading.svelte +0 -16
  165. package/esm/ui/Loading.svelte.d.ts +0 -31
  166. package/esm/ui/Tooltip.svelte +0 -45
  167. package/esm/ui/Tooltip.svelte.d.ts +0 -32
  168. package/esm/ui/dialog/DialogForm.svelte +0 -76
  169. package/esm/ui/dialog/DialogForm.svelte.d.ts +0 -21
  170. package/esm/ui/dialog/DialogManagement.svelte +0 -96
  171. package/esm/ui/dialog/DialogManagement.svelte.d.ts +0 -26
  172. package/esm/ui/dialog/DialogPrimitive.svelte +0 -90
  173. package/esm/ui/dialog/DialogPrimitive.svelte.d.ts +0 -38
  174. package/esm/ui/dialog/FormEditAction.svelte +0 -62
  175. package/esm/ui/dialog/FormEditAction.svelte.d.ts +0 -31
  176. package/esm/ui/dialog/dialog.d.ts +0 -60
  177. package/esm/ui/dialog/dialog.js +0 -100
  178. package/esm/ui/index.d.ts +0 -6
  179. package/esm/ui/index.js +0 -20
  180. package/esm/ui/internals/FieldContainer.svelte +0 -39
  181. package/esm/ui/internals/FieldContainer.svelte.d.ts +0 -18
  182. package/esm/ui/internals/Input.svelte +0 -143
  183. package/esm/ui/internals/Input.svelte.d.ts +0 -37
  184. package/esm/ui/internals/Textarea.svelte +0 -66
  185. package/esm/ui/internals/Textarea.svelte.d.ts +0 -33
  186. package/esm/ui/internals/select/MultiSelectMelt.svelte +0 -260
  187. package/esm/ui/internals/select/MultiSelectMelt.svelte.d.ts +0 -32
  188. package/esm/ui/internals/select/Select2.svelte +0 -88
  189. package/esm/ui/internals/select/Select2.svelte.d.ts +0 -12
  190. package/esm/ui/internals/select/SelectMelt.svelte +0 -280
  191. package/esm/ui/internals/select/SelectMelt.svelte.d.ts +0 -40
  192. package/esm/ui/internals/select/SelectRadio.svelte +0 -43
  193. package/esm/ui/internals/select/SelectRadio.svelte.d.ts +0 -27
  194. package/esm/ui/link/Link.svelte +0 -33
  195. package/esm/ui/link/Link.svelte.d.ts +0 -33
  196. package/esm/ui/link/LinkPlus.svelte +0 -63
  197. package/esm/ui/link/LinkPlus.svelte.d.ts +0 -9
  198. package/esm/utils/tailwind.d.ts +0 -2
  199. package/esm/utils/tailwind.js +0 -3
  200. package/esm/utils/transition.d.ts +0 -9
  201. package/esm/utils/transition.js +0 -33
  202. package/esm/utils/types.js +0 -1
  203. /package/esm/{internals → core}/BaseEnum.js +0 -0
  204. /package/esm/{internals → core}/common.d.ts +0 -0
  205. /package/esm/{internals → core}/common.js +0 -0
  206. /package/esm/{utils → core}/types.d.ts +0 -0
  207. /package/esm/{auth → core}/types.js +0 -0
  208. /package/esm/{ui → svelte/ui}/Icon.svelte.d.ts +0 -0
  209. /package/esm/{ui → svelte/ui}/LibIcon.d.ts +0 -0
  210. /package/esm/{ui → svelte/ui}/LibIcon.js +0 -0
@@ -25,7 +25,7 @@
25
25
  export let size: string | number = '1.5rem'
26
26
 
27
27
  export let caption: string | undefined = undefined
28
- const rmvWarning = caption
28
+ void caption
29
29
 
30
30
  /**
31
31
  * By default, svg are not rendered on the server side.
@@ -1,6 +1,6 @@
1
- import { BaseEnum } from '../internals/BaseEnum';
2
- import type { BaseEnumOptions } from '../internals/BaseEnum';
3
- import '../ui/LibIcon';
1
+ import { BaseEnum } from '../core/BaseEnum';
2
+ import type { BaseEnumOptions } from '../core/BaseEnum';
3
+ import '../svelte/ui/LibIcon';
4
4
  export declare class StateDemoEnum extends BaseEnum {
5
5
  static CHECK: StateDemoEnum;
6
6
  static EDIT: StateDemoEnum;
@@ -6,9 +6,9 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
6
6
  };
7
7
  var StateDemoEnum_1;
8
8
  import { ValueListFieldType } from 'remult';
9
- import { BaseEnum } from '../internals/BaseEnum';
10
- import '../ui/LibIcon';
11
- import { LibIcon_Add, LibIcon_Delete, LibIcon_Edit } from '../ui/LibIcon';
9
+ import { BaseEnum } from '../core/BaseEnum';
10
+ import '../svelte/ui/LibIcon';
11
+ import { LibIcon_Add, LibIcon_Delete, LibIcon_Edit } from '../svelte/ui/LibIcon';
12
12
  let StateDemoEnum = class StateDemoEnum extends BaseEnum {
13
13
  static { StateDemoEnum_1 = this; }
14
14
  static CHECK = new StateDemoEnum_1('CHECK', {
@@ -42,7 +42,6 @@ __decorate([
42
42
  required: true,
43
43
  caption: "Nom de l'utilisateur",
44
44
  placeholder: 'Jean-Yves',
45
- suffix: 'SUF!',
46
45
  })
47
46
  ], UIEntity.prototype, "username", void 0);
48
47
  __decorate([
@@ -71,7 +70,7 @@ __decorate([
71
70
  Fields.boolean({ allowNull: true })
72
71
  ], UIEntity.prototype, "isSubContractor", void 0);
73
72
  __decorate([
74
- Fields.number({ allowNull: true, suffix: '%' })
73
+ Fields.number({ allowNull: true })
75
74
  ], UIEntity.prototype, "rate", void 0);
76
75
  __decorate([
77
76
  Fields.date({ allowNull: true, allowApiUpdate: false })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "firstly",
3
- "version": "0.2.1",
3
+ "version": "0.4.0",
4
4
  "type": "module",
5
5
  "description": "Firstly, an opinionated Remult setup!",
6
6
  "funding": "https://github.com/sponsors/jycouet",
@@ -16,7 +16,7 @@
16
16
  },
17
17
  "peerDependencies": {
18
18
  "@sveltejs/kit": ">=1.0.0 <3.0.0",
19
- "remult": ">=3.3.2",
19
+ "remult": ">=3.3.7",
20
20
  "svelte": ">=5"
21
21
  },
22
22
  "peerDependenciesMeta": {
@@ -31,45 +31,25 @@
31
31
  }
32
32
  },
33
33
  "dependencies": {
34
- "@clack/prompts": "0.11.0",
35
- "@kitql/internals": "0.10.5",
36
- "@layerstack/svelte-actions": "1.0.0",
37
34
  "@layerstack/utils": "1.0.0",
38
35
  "@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
- "@types/nodemailer": "7.0.2",
44
- "arctic": "3.7.0",
45
- "bcryptjs": "3.0.2",
36
+ "@types/nodemailer": "8.0.0",
46
37
  "clsx": "2.1.1",
47
38
  "cron": "4.4.0",
48
- "daisyui": "5.5.3",
49
39
  "esm-env": "1.2.2",
50
- "nodemailer": "7.0.4",
51
- "svelecte": "5.3.0",
52
- "tailwind-merge": "2.6.0",
53
- "tailwindcss": "4.1.14",
54
- "vite-plugin-kit-routes": "1.0.2",
55
- "vite-plugin-stripper": "0.9.2"
40
+ "nodemailer": "8.0.5",
41
+ "tailwind-merge": "3.5.0",
42
+ "tailwindcss": "4.2.2",
43
+ "vite-plugin-kit-routes": "1.0.3",
44
+ "vite-plugin-stripper": "0.10.1"
56
45
  },
57
46
  "sideEffects": false,
58
- "bin": "./esm/bin/cmd.js",
59
47
  "exports": {
60
48
  ".": {
61
49
  "types": "./esm/index.d.ts",
62
50
  "svelte": "./esm/index.js",
63
51
  "default": "./esm/index.js"
64
52
  },
65
- "./internals": {
66
- "types": "./esm/internals/index.d.ts",
67
- "default": "./esm/internals/index.js"
68
- },
69
- "./server": {
70
- "types": "./esm/server/index.d.ts",
71
- "default": "./esm/server/index.js"
72
- },
73
53
  "./svelte": {
74
54
  "types": "./esm/svelte/index.d.ts",
75
55
  "svelte": "./esm/svelte/index.js",
@@ -79,21 +59,10 @@
79
59
  "types": "./esm/vite/index.d.ts",
80
60
  "default": "./esm/vite/index.js"
81
61
  },
82
- "./bin": {
83
- "default": "./esm/bin/cmd.js"
84
- },
85
62
  "./formats": {
86
63
  "types": "./esm/formats/index.d.ts",
87
64
  "default": "./esm/formats/index.js"
88
65
  },
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
66
  "./changeLog": {
98
67
  "types": "./esm/changeLog/index.d.ts",
99
68
  "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);
@@ -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
- }
@@ -1,182 +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
- var FFAuthProvider_1;
8
- import { Fields, Relations, Validators, ValueListFieldType } from 'remult';
9
- import { BaseEnum, FF_Entity, FF_Role } from '../internals';
10
- export const FF_Role_Auth = {
11
- FF_Role_Auth_Admin: 'FF_Role_Auth.Admin',
12
- FF_Role_Auth_Invite: 'FF_Role_Auth.Invite',
13
- };
14
- let FFAuthUser = class FFAuthUser {
15
- id;
16
- createdAt;
17
- updatedAt;
18
- name;
19
- roles = [];
20
- accounts;
21
- sessions;
22
- };
23
- __decorate([
24
- Fields.id()
25
- ], FFAuthUser.prototype, "id", void 0);
26
- __decorate([
27
- Fields.createdAt({ includeInApi: [FF_Role_Auth.FF_Role_Auth_Admin, FF_Role.FF_Role_Admin] })
28
- ], FFAuthUser.prototype, "createdAt", void 0);
29
- __decorate([
30
- Fields.updatedAt({ includeInApi: [FF_Role_Auth.FF_Role_Auth_Admin, FF_Role.FF_Role_Admin] })
31
- ], FFAuthUser.prototype, "updatedAt", void 0);
32
- __decorate([
33
- Fields.string({
34
- required: true,
35
- validate: [Validators.unique(), Validators.required()],
36
- })
37
- ], FFAuthUser.prototype, "name", void 0);
38
- __decorate([
39
- Fields.json(() => [], {
40
- includeInApi: [FF_Role_Auth.FF_Role_Auth_Admin, FF_Role.FF_Role_Admin],
41
- inputType: 'selectEnum',
42
- valueConverter: {
43
- toDb: (x) => {
44
- if (x === null)
45
- return null;
46
- if (Array.isArray(x))
47
- return x.join(',');
48
- return x;
49
- },
50
- //FIXME: refacto this + remove "permissions" & add a disable user!
51
- fromDb: (x) => {
52
- return x
53
- ? x
54
- .split(',')
55
- .map((c) => c.replace('{', '').replace('}', ''))
56
- .filter((c) => c !== '')
57
- : [];
58
- },
59
- },
60
- })
61
- ], FFAuthUser.prototype, "roles", void 0);
62
- __decorate([
63
- Relations.toMany(() => FFAuthAccount, 'userId')
64
- ], FFAuthUser.prototype, "accounts", void 0);
65
- __decorate([
66
- Relations.toMany(() => FFAuthUserSession, 'userId')
67
- ], FFAuthUser.prototype, "sessions", void 0);
68
- FFAuthUser = __decorate([
69
- FF_Entity('ff_auth.users', {
70
- allowApiCrud: [FF_Role_Auth.FF_Role_Auth_Admin, FF_Role.FF_Role_Admin],
71
- caption: 'FF Auth - Users',
72
- })
73
- ], FFAuthUser);
74
- export { FFAuthUser };
75
- let FFAuthAccount = class FFAuthAccount {
76
- id;
77
- createdAt;
78
- updatedAt;
79
- userId;
80
- user;
81
- provider = FFAuthProvider.PASSWORD.id;
82
- providerUserId = '';
83
- email = null;
84
- hashPassword;
85
- token;
86
- expiresAt;
87
- lastVerifiedAt;
88
- metadata;
89
- };
90
- __decorate([
91
- Fields.id()
92
- ], FFAuthAccount.prototype, "id", void 0);
93
- __decorate([
94
- Fields.createdAt()
95
- ], FFAuthAccount.prototype, "createdAt", void 0);
96
- __decorate([
97
- Fields.updatedAt()
98
- ], FFAuthAccount.prototype, "updatedAt", void 0);
99
- __decorate([
100
- Fields.string()
101
- ], FFAuthAccount.prototype, "userId", void 0);
102
- __decorate([
103
- Relations.toOne(() => FFAuthUser, 'userId')
104
- ], FFAuthAccount.prototype, "user", void 0);
105
- __decorate([
106
- Fields.string()
107
- ], FFAuthAccount.prototype, "provider", void 0);
108
- __decorate([
109
- Fields.string()
110
- ], FFAuthAccount.prototype, "providerUserId", void 0);
111
- __decorate([
112
- Fields.string({ allowNull: true })
113
- ], FFAuthAccount.prototype, "email", void 0);
114
- __decorate([
115
- Fields.string({ includeInApi: false, allowNull: true })
116
- ], FFAuthAccount.prototype, "hashPassword", void 0);
117
- __decorate([
118
- Fields.string({ includeInApi: false, allowNull: true })
119
- ], FFAuthAccount.prototype, "token", void 0);
120
- __decorate([
121
- Fields.date({ includeInApi: false, allowNull: true })
122
- ], FFAuthAccount.prototype, "expiresAt", void 0);
123
- __decorate([
124
- Fields.date({ includeInApi: false, allowNull: true })
125
- ], FFAuthAccount.prototype, "lastVerifiedAt", void 0);
126
- __decorate([
127
- Fields.json({ includeInApi: false, allowNull: true })
128
- ], FFAuthAccount.prototype, "metadata", void 0);
129
- FFAuthAccount = __decorate([
130
- FF_Entity('ff_auth.accounts', {
131
- allowApiCrud: [FF_Role_Auth.FF_Role_Auth_Admin, FF_Role.FF_Role_Admin],
132
- caption: 'FF Auth - Accounts',
133
- changeLog: {
134
- excludeColumns: (e) => {
135
- return [e.hashPassword, e.token];
136
- },
137
- },
138
- })
139
- ], FFAuthAccount);
140
- export { FFAuthAccount };
141
- let FFAuthUserSession = class FFAuthUserSession {
142
- id;
143
- expiresAt;
144
- userId;
145
- user;
146
- };
147
- __decorate([
148
- Fields.string()
149
- ], FFAuthUserSession.prototype, "id", void 0);
150
- __decorate([
151
- Fields.date()
152
- ], FFAuthUserSession.prototype, "expiresAt", void 0);
153
- __decorate([
154
- Fields.string()
155
- ], FFAuthUserSession.prototype, "userId", void 0);
156
- __decorate([
157
- Relations.toOne(() => FFAuthUser, 'userId')
158
- ], FFAuthUserSession.prototype, "user", void 0);
159
- FFAuthUserSession = __decorate([
160
- FF_Entity('ff_auth.users_sessions', {
161
- allowApiCrud: [FF_Role_Auth.FF_Role_Auth_Admin, FF_Role.FF_Role_Admin],
162
- caption: 'FF Auth - Users sessions',
163
- changeLog: false,
164
- })
165
- ], FFAuthUserSession);
166
- export { FFAuthUserSession };
167
- let FFAuthProvider = class FFAuthProvider extends BaseEnum {
168
- static { FFAuthProvider_1 = this; }
169
- static DEMO = new FFAuthProvider_1('DEMO', { caption: 'Demo' });
170
- static PASSWORD = new FFAuthProvider_1('PASSWORD', { caption: 'Password' });
171
- static OTP = new FFAuthProvider_1('OTP', { caption: 'TOTP' });
172
- static OAUTH = new FFAuthProvider_1('OAUTH', { caption: 'OAUTH' });
173
- constructor(id, o) {
174
- super(id, {
175
- ...o,
176
- });
177
- }
178
- };
179
- FFAuthProvider = FFAuthProvider_1 = __decorate([
180
- ValueListFieldType()
181
- ], FFAuthProvider);
182
- export { FFAuthProvider };
@@ -1,3 +0,0 @@
1
- # Firstly - Module - Auth
2
-
3
- ➡️ Doc available [here](https://firstly.fun/modules/auth).
@@ -1,5 +0,0 @@
1
- import { AuthController } from './AuthController';
2
- import { FFAuthAccount, FFAuthProvider, FFAuthUser, FFAuthUserSession } from './Entities';
3
- export { FF_Role_Auth } from './Entities';
4
- export { AuthController };
5
- export { FFAuthUser, FFAuthAccount, FFAuthProvider, FFAuthUserSession };
package/esm/auth/index.js DELETED
@@ -1,5 +0,0 @@
1
- import { AuthController } from './AuthController';
2
- import { FFAuthAccount, FFAuthProvider, FFAuthUser, FFAuthUserSession } from './Entities';
3
- export { FF_Role_Auth } from './Entities';
4
- export { AuthController };
5
- export { FFAuthUser, FFAuthAccount, FFAuthProvider, FFAuthUserSession };
@@ -1,58 +0,0 @@
1
- import type { AuthResponse, ProviderConfigured } from '../types.js';
2
- export declare class AuthControllerServer {
3
- /**
4
- * Sign out the current user
5
- */
6
- static signOut(): Promise<AuthResponse>;
7
- /**
8
- * Sign in with a demo account
9
- * _(The easiest way to demo & test your application)_
10
- */
11
- static signInDemo(name: string): Promise<AuthResponse>;
12
- /**
13
- * This is for login / password authentication invite
14
- */
15
- static invite(emailParam: string): Promise<AuthResponse>;
16
- /**
17
- * This is for login / password authentication SignUp
18
- * _(The first param `email` can be "anything")_
19
- */
20
- static signUpPassword(emailParam: string, password: string): Promise<AuthResponse>;
21
- /**
22
- * This is for login / password authentication SignIn
23
- * _(The first param `email` can be "anything")_
24
- */
25
- static signInPassword(emailParam: string, password: string): Promise<AuthResponse>;
26
- /**
27
- * Forgot your password ? Send a mail to reset it.
28
- */
29
- static forgotPassword(emailParam: string): Promise<AuthResponse>;
30
- /**
31
- * Reset your password with a token
32
- */
33
- static resetPassword(token: string, password: string): Promise<AuthResponse>;
34
- /** OTP */
35
- static signInOTP(emailParam: string): Promise<AuthResponse>;
36
- /**
37
- * Verify the OTP code
38
- */
39
- static verifyOtp(emailParam: string, otp: string): Promise<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
- }