firstly 0.2.0 → 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.
Files changed (135) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/esm/bin/cmd.js +3 -158
  3. package/esm/changeLog/index.d.ts +1 -6
  4. package/esm/feedback/FeedbackController.d.ts +6 -2
  5. package/esm/feedback/FeedbackController.js +145 -143
  6. package/esm/feedback/server/index.d.ts +2 -2
  7. package/esm/feedback/server/index.js +3 -3
  8. package/esm/feedback/types.d.ts +5 -0
  9. package/esm/feedback/ui/DialogIssue.svelte +5 -5
  10. package/esm/feedback/ui/DialogIssues.svelte +5 -5
  11. package/esm/feedback/ui/DialogMilestones.svelte +1 -1
  12. package/esm/internals/BaseEnum.d.ts +2 -1
  13. package/esm/internals/FF_Entity.js +1 -17
  14. package/esm/internals/FF_Fields.d.ts +4 -3
  15. package/esm/internals/FF_Fields.js +14 -55
  16. package/esm/internals/cellsBuildor.d.ts +2 -1
  17. package/esm/internals/cellsBuildor.js +5 -4
  18. package/esm/internals/index.d.ts +7 -12
  19. package/esm/internals/storeItem.d.ts +12 -20
  20. package/esm/internals/storeItem.js +20 -6
  21. package/esm/mail/server/index.d.ts +8 -2
  22. package/esm/mail/server/index.js +35 -7
  23. package/esm/server/index.d.ts +1 -1
  24. package/esm/svelte/FF_Cell.svelte +3 -5
  25. package/esm/svelte/FF_Cell.svelte.d.ts +4 -2
  26. package/esm/svelte/FF_Form.svelte +4 -5
  27. package/esm/svelte/FF_Grid.svelte +2 -2
  28. package/esm/svelte/FF_Layout.svelte +3 -3
  29. package/esm/svelte/FF_Repo.svelte.d.ts +9 -0
  30. package/esm/svelte/FF_Repo.svelte.js +39 -0
  31. package/esm/svelte/class/SP.svelte.js +14 -2
  32. package/esm/svelte/dialog/DialogManagement.svelte +2 -5
  33. package/esm/svelte/dialog/DialogPrimitive.svelte +1 -2
  34. package/esm/svelte/dialog/dialog.js +2 -2
  35. package/esm/svelte/ff_Config.svelte.js +2 -2
  36. package/esm/svelte/index.d.ts +2 -7
  37. package/esm/svelte/index.js +2 -7
  38. package/esm/ui/Button.svelte +34 -66
  39. package/esm/ui/Button.svelte.d.ts +9 -35
  40. package/esm/ui/Clipboardable.svelte +13 -17
  41. package/esm/ui/Clipboardable.svelte.d.ts +9 -33
  42. package/esm/ui/Field.svelte +48 -9
  43. package/esm/ui/FieldGroup.svelte.d.ts +1 -1
  44. package/esm/ui/Grid.svelte +13 -87
  45. package/esm/ui/Grid.svelte.d.ts +0 -1
  46. package/esm/ui/Grid2.svelte +26 -90
  47. package/esm/ui/Grid2.svelte.d.ts +1 -2
  48. package/esm/ui/GridPaginate.svelte +1 -1
  49. package/esm/ui/GridPaginate2.svelte +2 -2
  50. package/esm/ui/Icon.svelte +2 -18
  51. package/esm/ui/Icon.svelte.d.ts +0 -2
  52. package/esm/ui/LibIcon.js +2 -2
  53. package/esm/ui/Loading.svelte +1 -1
  54. package/esm/ui/dialog/DialogManagement.svelte +14 -5
  55. package/esm/ui/dialog/DialogPrimitive.svelte +3 -3
  56. package/esm/ui/dialog/FormEditAction.svelte +4 -4
  57. package/esm/ui/dialog/dialog.d.ts +5 -2
  58. package/esm/ui/dialog/dialog.js +2 -2
  59. package/esm/ui/index.d.ts +1 -0
  60. package/esm/ui/index.js +1 -0
  61. package/esm/ui/internals/FieldContainer.svelte +25 -14
  62. package/esm/ui/internals/FieldContainer.svelte.d.ts +9 -30
  63. package/esm/ui/internals/Input.svelte.d.ts +1 -1
  64. package/esm/ui/internals/Textarea.svelte +2 -5
  65. package/esm/ui/internals/select/MultiSelectMelt.svelte +10 -8
  66. package/esm/ui/internals/select/MultiSelectMelt.svelte.d.ts +1 -1
  67. package/esm/ui/internals/select/Select2.svelte +88 -0
  68. package/esm/ui/internals/select/Select2.svelte.d.ts +12 -0
  69. package/esm/ui/internals/select/SelectMelt.svelte +33 -24
  70. package/esm/ui/internals/select/SelectMelt.svelte.d.ts +1 -1
  71. package/esm/ui/internals/select/SelectRadio.svelte +2 -2
  72. package/esm/ui/internals/select/SelectRadio.svelte.d.ts +1 -1
  73. package/esm/ui/link/Link.svelte +1 -1
  74. package/esm/ui/link/LinkPlus.svelte +9 -5
  75. package/esm/ui/link/LinkPlus.svelte.d.ts +5 -19
  76. package/esm/virtual/Customer.js +1 -2
  77. package/esm/virtual/UIEntity.js +9 -5
  78. package/package.json +11 -25
  79. package/esm/auth/AuthController.d.ts +0 -58
  80. package/esm/auth/AuthController.js +0 -114
  81. package/esm/auth/Entities.d.ts +0 -47
  82. package/esm/auth/Entities.js +0 -182
  83. package/esm/auth/README.md +0 -3
  84. package/esm/auth/index.d.ts +0 -5
  85. package/esm/auth/index.js +0 -5
  86. package/esm/auth/server/AuthController.server.d.ts +0 -58
  87. package/esm/auth/server/AuthController.server.js +0 -498
  88. package/esm/auth/server/handleAuth.d.ts +0 -4
  89. package/esm/auth/server/handleAuth.js +0 -142
  90. package/esm/auth/server/handleGuard.d.ts +0 -22
  91. package/esm/auth/server/handleGuard.js +0 -34
  92. package/esm/auth/server/helperDb.d.ts +0 -10
  93. package/esm/auth/server/helperDb.js +0 -56
  94. package/esm/auth/server/helperFirstly.d.ts +0 -1
  95. package/esm/auth/server/helperFirstly.js +0 -9
  96. package/esm/auth/server/helperOslo.d.ts +0 -7
  97. package/esm/auth/server/helperOslo.js +0 -24
  98. package/esm/auth/server/helperRemultServer.d.ts +0 -5
  99. package/esm/auth/server/helperRemultServer.js +0 -44
  100. package/esm/auth/server/helperRole.d.ts +0 -19
  101. package/esm/auth/server/helperRole.js +0 -57
  102. package/esm/auth/server/index.d.ts +0 -8
  103. package/esm/auth/server/index.js +0 -8
  104. package/esm/auth/server/module.d.ts +0 -300
  105. package/esm/auth/server/module.js +0 -230
  106. package/esm/auth/server/providers/github.d.ts +0 -33
  107. package/esm/auth/server/providers/github.js +0 -87
  108. package/esm/auth/server/providers/helperProvider.d.ts +0 -1
  109. package/esm/auth/server/providers/helperProvider.js +0 -25
  110. package/esm/auth/static/assets/Page-9Ytj29NS.d.ts +0 -2
  111. package/esm/auth/static/assets/Page-9Ytj29NS.js +0 -1
  112. package/esm/auth/static/assets/Page-BHW08QWz.css +0 -1
  113. package/esm/auth/static/assets/Page-C1pM-UDt.d.ts +0 -2
  114. package/esm/auth/static/assets/Page-C1pM-UDt.js +0 -20
  115. package/esm/auth/static/assets/Page-CPz6KCw_.d.ts +0 -2
  116. package/esm/auth/static/assets/Page-CPz6KCw_.js +0 -1
  117. package/esm/auth/static/assets/index-AoBb9Ds5.d.ts +0 -232
  118. package/esm/auth/static/assets/index-AoBb9Ds5.js +0 -2
  119. package/esm/auth/static/assets/index-DKWpA6v7.css +0 -4
  120. package/esm/auth/static/favicon.svg +0 -79
  121. package/esm/auth/static/index.html +0 -13
  122. package/esm/auth/types.d.ts +0 -73
  123. package/esm/auth/types.js +0 -1
  124. package/esm/svelte/FF_Display.svelte +0 -51
  125. package/esm/svelte/FF_Display.svelte.d.ts +0 -29
  126. package/esm/svelte/FF_Edit.svelte +0 -104
  127. package/esm/svelte/FF_Edit.svelte.d.ts +0 -32
  128. package/esm/svelte/FF_Error.svelte +0 -23
  129. package/esm/svelte/FF_Error.svelte.d.ts +0 -29
  130. package/esm/svelte/FF_Field.svelte +0 -62
  131. package/esm/svelte/FF_Field.svelte.d.ts +0 -29
  132. package/esm/svelte/FF_Hint.svelte +0 -21
  133. package/esm/svelte/FF_Hint.svelte.d.ts +0 -29
  134. package/esm/svelte/FF_Label.svelte +0 -23
  135. package/esm/svelte/FF_Label.svelte.d.ts +0 -29
package/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # firstly
2
2
 
3
+ ## 0.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#232](https://github.com/jycouet/firstly/pull/232) [`fec8bc0`](https://github.com/jycouet/firstly/commit/fec8bc088733d63ce6752b0a764b786f80b736cb) Thanks [@jycouet](https://github.com/jycouet)! - BREAKING: Remove deprecated lucia-style auth module (`firstly/auth`, `firstly/auth/server`).
8
+
9
+ Migrate to `better-auth` (see remult docs). Removed deps: `@oslojs/*`, `arctic`, `bcryptjs`.
10
+ Also removed `packages/ui` (was only used for the auth UI).
11
+
12
+ ### Patch Changes
13
+
14
+ - [#221](https://github.com/jycouet/firstly/pull/221) [`0b08040`](https://github.com/jycouet/firstly/commit/0b0804001c9a5bdff560fbcbb8b511c626d260f8) Thanks [@jycouet](https://github.com/jycouet)! - bump deps
15
+
16
+ ## 0.2.1
17
+
18
+ ### Patch Changes
19
+
20
+ - [#198](https://github.com/jycouet/firstly/pull/198) [`fa88af1`](https://github.com/jycouet/firstly/commit/fa88af1b1f405801dca642b243d4afdc9494de68) Thanks [@jycouet](https://github.com/jycouet)! - [BREAKING] - `FF_Fields.dateOnly` and `FF_Fields.string` are removed, use `Fields.dateOnly` and `Fields.string` instead. _(allowNull & required are now fully independent! Like in remult)_
21
+
22
+ - [#185](https://github.com/jycouet/firstly/pull/185) [`9689241`](https://github.com/jycouet/firstly/commit/9689241824fb7066e019e64d6a8afdb439fc6838) Thanks [@jycouet](https://github.com/jycouet)! - sendMail() return data & error now
23
+
24
+ - [`a4e3c6e`](https://github.com/jycouet/firstly/commit/a4e3c6ecf52dd48c10115214109426a0e35e5e8b) Thanks [@jycouet](https://github.com/jycouet)! - fix auth ui (with new remult 3.1)
25
+
3
26
  ## 0.2.0
4
27
 
5
28
  ### Minor Changes
package/esm/bin/cmd.js CHANGED
@@ -11,7 +11,6 @@ const pkg = JSON.parse(read('./package.json') ?? '{}');
11
11
  const version = pkg.devDependencies?.['firstly'] ?? pkg.dependencies?.['firstly'] ?? '???';
12
12
  console.info('');
13
13
  p.intro(`${green(`⚡️`)} Welcome to firstly world! ${gray(` - v${version}`)}`);
14
- const keys = ['all', 'module-demo', 'dependencies'];
15
14
  const options = [
16
15
  {
17
16
  value: 'all',
@@ -58,8 +57,8 @@ pkg.dependencies = mergeAndSort(pkg.dependencies, {});
58
57
  pkg.scripts = {
59
58
  ...pkg.scripts,
60
59
  '//// ---- BEST PRACTICES ---- ////': '',
61
- lint: 'kitql-lint',
62
- format: 'kitql-lint -f',
60
+ lint: 'kitql-lint -d',
61
+ format: 'kitql-lint -f -d',
63
62
  };
64
63
  if (res.includes('all') || res.includes('dependencies')) {
65
64
  write('./package.json', [JSON.stringify(pkg, null, 2)]);
@@ -142,11 +141,6 @@ export default {
142
141
  '.env.example': [
143
142
  `# Enable some roles
144
143
  # FF_ADMIN = 'JYC'
145
- # FF_AUTH_ADMIN = ''
146
-
147
- # Enable GitHub login
148
- # GITHUB_CLIENT_ID = ''
149
- # GITHUB_CLIENT_SECRET = ''
150
144
  `,
151
145
  ],
152
146
  './tsconfig.json': [
@@ -185,7 +179,6 @@ export default defineConfig({
185
179
  firstly<KIT_ROUTES>({
186
180
  kitRoutes: {
187
181
  LINKS: {
188
- login: 'ff/auth/sign-in',
189
182
  github: 'https://github.com/[owner]/[repo]',
190
183
  remult_admin: 'api/admin',
191
184
  },
@@ -198,13 +191,9 @@ export default defineConfig({
198
191
  ],
199
192
  './svelte.config.js': [
200
193
  `import adapter from '@sveltejs/adapter-auto'
201
- import { vitePreprocess } from '@sveltejs/vite-plugin-svelte'
202
194
 
203
195
  /** @type {import('@sveltejs/kit').Config} */
204
196
  const config = {
205
- // Consult https://svelte.dev/docs/kit/integrations
206
- // for more information about preprocessors
207
- preprocess: vitePreprocess(),
208
197
 
209
198
  kit: {
210
199
  // adapter-auto only supports some environments, see https://svelte.dev/docs/kit/adapter-auto for a list.
@@ -251,7 +240,6 @@ export { }
251
240
  './src/server/index.ts': [
252
241
  `import { FF_Role } from '../internals'
253
242
  import { firstly, Module } from '../server'
254
- import { auth } from '../auth/server'
255
243
  import { mail } from '../mail/server'
256
244
  import { changeLog } from '../changeLog/server'
257
245
 
@@ -259,44 +247,7 @@ import { log, Role } from '${libAlias}'
259
247
  import { task } from '${modulesAlias}/task/server'
260
248
 
261
249
  export const api = firstly({
262
- //----------------------------------------
263
- // To switch to postgres
264
- // NEEDS ON TOP OF THE FILE:
265
- // import { createPostgresConnection } from 'remult/postgres'
266
- // import { DATABASE_URL } from '$env/static/private'
267
- //----------------------------------------
268
- // dataProvider: await createPostgresConnection({
269
- // connectionString: DATABASE_URL,
270
- // }),
271
-
272
250
  modules: [
273
- //----------------------------------------
274
- // Core Module: auth
275
- //----------------------------------------
276
- auth({
277
- providers: {
278
- demo: [
279
- { name: 'Ermin' },
280
- { name: 'JYC', roles: [FF_Role.FF_Role_Admin] },
281
- { name: 'Noam', roles: [FF_Role.FF_Role_Admin, Role.Boss] },
282
- ],
283
-
284
- // password: {},
285
-
286
- // otp: {},
287
-
288
- oAuths: [
289
- //----------------------------------------
290
- // To enable OAuth via Github
291
- // Instructions by hovering the method \`github\`
292
- // NEEDS ON TOP OF THE FILE:
293
- // import { github } from '../auth/server'
294
- //----------------------------------------
295
- // github(),
296
- ],
297
- },
298
- }),
299
-
300
251
  //----------------------------------------
301
252
  // Core Module: mail
302
253
  //----------------------------------------
@@ -331,25 +282,11 @@ export const api = firstly({
331
282
  ],
332
283
  './src/hooks.server.ts': [
333
284
  `import { sequence } from '@sveltejs/kit/hooks'
334
- import { redirect } from '@sveltejs/kit'
335
285
 
336
- import { handleAuth, handleGuard } from '../auth/server'
337
- import { route } from '${libAlias}/ROUTES'
338
286
  import { api as handleRemult } from '${serverAlias}'
339
287
 
340
288
  export const handle = sequence(
341
- //
342
289
  handleRemult,
343
- handleAuth,
344
- // client side guard is not here!
345
- handleGuard({
346
- authenticated: ['/app*'],
347
- redirectToLogin: route('/'),
348
- // You want to redirect to the firstly UI ? change redirectToLogin to this 👇
349
- // redirectToLogin: route('login'),
350
- redirectAuthenticated: route('/app'),
351
- redirect,
352
- })
353
290
  )
354
291
  `,
355
292
  ],
@@ -390,8 +327,6 @@ export const load = (async (event) => {
390
327
  import { Remult, remult } from 'remult'
391
328
 
392
329
  import { route } from '${libAlias}/ROUTES'
393
- import SignIn from '${libAlias}/ui/SignIn.svelte'
394
- import SignOut from '${libAlias}/ui/SignOut.svelte'
395
330
 
396
331
  import type { LayoutData } from './$types'
397
332
 
@@ -453,26 +388,10 @@ import type { LayoutData } from './$types'
453
388
  <h1>${pkg.name}</h1>
454
389
 
455
390
  {#if remult.authenticated()}
456
- <div style="float:right;">
457
- <SignOut></SignOut>
458
- </div>
459
391
  <span>{remult.user?.name} ({remult.user?.roles})<br /><br /></span>
460
- {:else}
461
- <SignIn demo="Ermin"></SignIn>
462
- <SignIn demo="JYC"></SignIn>
463
- <SignIn demo="Noam"></SignIn>
464
- <br />
465
- <SignIn ffLink></SignIn>
466
- <br />
467
- <SignIn oauth="github"></SignIn>
468
392
  {/if}
469
393
 
470
- <hr />
471
-
472
- <a href={route('/')}>Home</a> |
473
- {#if remult.authenticated()}
474
- <a href={route('/app')}>App (Protected route)</a> |
475
- {/if}
394
+ <a href={route('/')}>Home</a> |
476
395
  <a href={route('/demo/task')}>Demo task</a>
477
396
 
478
397
  <hr />
@@ -523,7 +442,6 @@ export const load = (async (event) => {
523
442
  // Lib files
524
443
  './src/lib/index.ts': [
525
444
  `import { FF_Role } from '../internals'
526
- import { FF_Role_Auth } from '../auth'
527
445
  import { Log } from '@kitql/helpers'
528
446
 
529
447
  /**
@@ -536,81 +454,8 @@ export const log = new Log('${pkg.name}')
536
454
  */
537
455
  export const Role = {
538
456
  Boss: 'Boss',
539
- ...FF_Role_Auth,
540
457
  ...FF_Role,
541
458
  } as const
542
- `,
543
- ],
544
- './src/lib/ui/SignIn.svelte': [
545
- `<script lang="ts">
546
- import { isError } from '../internals'
547
- import { AuthController } from '../auth'
548
-
549
- import { goto, invalidateAll } from '$app/navigation'
550
-
551
- import { route } from '${libAlias}/ROUTES'
552
-
553
- // Examples of signin modes
554
- export let demo = ''
555
- export let ffLink = false
556
- export let oauth: 'github' | undefined = undefined
557
-
558
- const signinDemo = async (identif: string) => {
559
- try {
560
- await AuthController.signInDemo(identif)
561
- invalidateAll()
562
- } catch (error) {
563
- if (isError(error)) {
564
- // You will probably not leave this alert in production
565
- alert(error.message)
566
- }
567
- }
568
- }
569
-
570
- async function signinOAuth(provider: 'github') {
571
- try {
572
- window.location.href = await AuthController.signInOAuthGetUrl({
573
- provider,
574
- redirect: window.location.pathname,
575
- })
576
- } catch (error) {
577
- if (isError(error)) {
578
- // You will probably not leave this alert in production
579
- alert(error.message)
580
- }
581
- }
582
- }
583
- </script>
584
-
585
- {#if demo}
586
- <button on:click={() => signinDemo(demo)}>Login as {demo}</button>
587
- {:else if ffLink}
588
- <button on:click={() => goto(route('login'))}>Login with Firstly UI</button>
589
- {:else if oauth}
590
- <button on:click={() => signinOAuth(oauth)}>Login With {oauth}</button>
591
- {/if}
592
- `,
593
- ],
594
- './src/lib/ui/SignOut.svelte': [
595
- `<script lang="ts">
596
- import { isError } from '../internals'
597
- import { AuthController } from '../auth'
598
-
599
- import { invalidateAll } from '$app/navigation'
600
-
601
- const logout = async () => {
602
- try {
603
- await AuthController.signOut()
604
- invalidateAll()
605
- } catch (error) {
606
- if (isError(error)) {
607
- alert(error.message)
608
- }
609
- }
610
- }
611
- </script>
612
-
613
- <button on:click={logout}>Logout</button>
614
459
  `,
615
460
  ],
616
461
  // Task module
@@ -45,15 +45,10 @@ export declare const withChangeLog: <entityType>(options?: EntityOptions<entityT
45
45
  entityRefInit?: ((ref: import("remult").EntityRef<entityType>, row: entityType) => void) | undefined;
46
46
  apiRequireId?: import("remult").Allowed;
47
47
  dataProvider?: ((defaultDataProvider: import("remult").DataProvider) => import("remult").DataProvider | Promise<import("remult").DataProvider> | undefined | null) | undefined;
48
+ changeLog?: false | ColumnDeciderArgs<entityType> | undefined;
48
49
  ui?: {
49
50
  getLayout?: import("../svelte/customField").getLayout<entityType> | undefined;
50
51
  } | undefined;
51
52
  searchableFind?: ((str: string) => import("remult").FindOptionsBase<entityType>) | undefined;
52
53
  displayValue?: ((item: entityType) => import("../internals").BaseItem) | undefined;
53
- permissionApiCrud?: import("../internals").BaseEnum[] | import("../internals").BaseEnum;
54
- permissionApiDelete?: import("../internals").BaseEnum[] | import("../internals").BaseEnum;
55
- permissionApiInsert?: import("../internals").BaseEnum[] | import("../internals").BaseEnum;
56
- permissionApiRead?: import("../internals").BaseEnum[] | import("../internals").BaseEnum;
57
- permissionApiUpdate?: import("../internals").BaseEnum[] | import("../internals").BaseEnum;
58
- changeLog?: false | ColumnDeciderArgs<entityType> | undefined;
59
54
  };
@@ -25,11 +25,15 @@ export declare class FeedbackController {
25
25
  highlight: any;
26
26
  title: any;
27
27
  }>;
28
- static createIssue(milestoneId: string, title: string, body: string, page: string): Promise<{
28
+ static createIssue(milestoneId: string, title: string, body: string, metadata: {
29
+ page: string;
30
+ }): Promise<{
29
31
  id: string;
30
32
  number: number;
31
33
  }>;
32
- static addCommentOnIssue(issueId: string, issueNumber: number, title: string, body: string, page: string, labels: {
34
+ static addCommentOnIssue(issueId: string, issueNumber: number, title: string, body: string, metadata: {
35
+ page: string;
36
+ }, labels: {
33
37
  id: string;
34
38
  name: string;
35
39
  }[]): Promise<string>;