nuxt-users 1.1.1 → 1.1.3

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 (46) hide show
  1. package/.vscode/settings.json +18 -0
  2. package/CHANGELOG.md +112 -0
  3. package/dist/chunks/better-sqlite3.mjs +45 -0
  4. package/dist/chunks/mysql2.mjs +49 -0
  5. package/dist/chunks/postgresql.mjs +58 -0
  6. package/dist/cli.d.mts +1 -0
  7. package/dist/cli.d.ts +1 -0
  8. package/dist/cli.mjs +587 -0
  9. package/dist/module.d.mts +6 -0
  10. package/dist/module.d.ts +55 -0
  11. package/dist/module.json +1 -1
  12. package/dist/module.mjs +12 -40
  13. package/dist/runtime/assets/colors.css +1 -0
  14. package/dist/runtime/components/ForgotPasswordForm.vue +1 -1
  15. package/dist/runtime/components/LoginForm.vue +1 -1
  16. package/dist/runtime/components/ResetPasswordForm.vue +1 -1
  17. package/dist/runtime/plugin.js +13 -3
  18. package/dist/runtime/server/api/login.post.js +1 -1
  19. package/dist/runtime/server/services/password.js +2 -2
  20. package/dist/shared/nuxt-users.C9d5M6B1.mjs +31 -0
  21. package/package.json +28 -10
  22. package/dist/runtime/server/utils/create-migrations-table.d.ts +0 -2
  23. package/dist/runtime/server/utils/create-migrations-table.js +0 -35
  24. package/dist/runtime/server/utils/create-password-reset-tokens-table.d.ts +0 -2
  25. package/dist/runtime/server/utils/create-password-reset-tokens-table.js +0 -40
  26. package/dist/runtime/server/utils/create-personal-access-tokens-table.d.ts +0 -2
  27. package/dist/runtime/server/utils/create-personal-access-tokens-table.js +0 -56
  28. package/dist/runtime/server/utils/create-user.d.ts +0 -1
  29. package/dist/runtime/server/utils/create-user.js +0 -1
  30. package/dist/runtime/server/utils/create-users-table.d.ts +0 -2
  31. package/dist/runtime/server/utils/create-users-table.js +0 -44
  32. package/dist/runtime/server/utils/db.d.ts +0 -8
  33. package/dist/runtime/server/utils/db.js +0 -49
  34. package/dist/runtime/server/utils/migrate.d.ts +0 -4
  35. package/dist/runtime/server/utils/migrate.js +0 -63
  36. package/dist/runtime/server/utils/user.d.ts +0 -21
  37. package/dist/runtime/server/utils/user.js +0 -50
  38. package/src/cli/create-migrations-table.ts +0 -24
  39. package/src/cli/create-password-reset-tokens-table.ts +0 -24
  40. package/src/cli/create-personal-access-tokens-table.ts +0 -24
  41. package/src/cli/create-user.ts +0 -40
  42. package/src/cli/create-users-table.ts +0 -24
  43. package/src/cli/main.ts +0 -28
  44. package/src/cli/migrate.ts +0 -24
  45. package/src/cli/project-info.ts +0 -45
  46. package/src/cli/utils.ts +0 -70
@@ -0,0 +1,18 @@
1
+ {
2
+ "eslint.experimental.useFlatConfig": true,
3
+ "editor.formatOnSave": true,
4
+ "editor.defaultFormatter": "dbaeumer.vscode-eslint",
5
+ "editor.codeActionsOnSave": {
6
+ "source.fixAll.eslint": "explicit"
7
+ },
8
+ "[javascript]": {
9
+ "editor.defaultFormatter": "dbaeumer.vscode-eslint"
10
+ },
11
+ "[typescript]": {
12
+ "editor.defaultFormatter": "dbaeumer.vscode-eslint"
13
+ },
14
+ "[vue]": {
15
+ "editor.defaultFormatter": "dbaeumer.vscode-eslint"
16
+ },
17
+ "eslint.validate": ["javascript", "typescript", "vue"]
18
+ }
package/CHANGELOG.md ADDED
@@ -0,0 +1,112 @@
1
+ # Changelog
2
+
3
+
4
+ ## v1.1.3
5
+
6
+ [compare changes](https://github.com/rrd108/nuxt-users/compare/v1.1.0...v1.1.3)
7
+
8
+ ### 🩹 Fixes
9
+
10
+ - CLI tool for database management ([0a4793f](https://github.com/rrd108/nuxt-users/commit/0a4793f))
11
+ - Handling cli commands ([120c396](https://github.com/rrd108/nuxt-users/commit/120c396))
12
+ - Database handling and setup ([11ddc20](https://github.com/rrd108/nuxt-users/commit/11ddc20))
13
+ - Proper check for migrations table ([08701a1](https://github.com/rrd108/nuxt-users/commit/08701a1))
14
+ - Migration command in warning message ([1a62e50](https://github.com/rrd108/nuxt-users/commit/1a62e50))
15
+
16
+ ### 💅 Refactors
17
+
18
+ - CLI commands to use environment variables ([3fc6c9f](https://github.com/rrd108/nuxt-users/commit/3fc6c9f))
19
+ - Remove unused types ([06b5e9f](https://github.com/rrd108/nuxt-users/commit/06b5e9f))
20
+ - Database connection logic ([f5baadf](https://github.com/rrd108/nuxt-users/commit/f5baadf))
21
+ - Moves user existence check to user utils ([62cc871](https://github.com/rrd108/nuxt-users/commit/62cc871))
22
+ - Remove unused options ([b391013](https://github.com/rrd108/nuxt-users/commit/b391013))
23
+ - Adds a color palette and styles login forms ([d3bffab](https://github.com/rrd108/nuxt-users/commit/d3bffab))
24
+ - Adds color palette and improves styling ([7cfab67](https://github.com/rrd108/nuxt-users/commit/7cfab67))
25
+ - Db check to plugin ([d466e2f](https://github.com/rrd108/nuxt-users/commit/d466e2f))
26
+ - Consolidates utils and CLI build ([21e9f3c](https://github.com/rrd108/nuxt-users/commit/21e9f3c))
27
+ - Remove unused option ([d9e3525](https://github.com/rrd108/nuxt-users/commit/d9e3525))
28
+
29
+ ### 🏡 Chore
30
+
31
+ - **release:** V1.1.0 ([bfc24f6](https://github.com/rrd108/nuxt-users/commit/bfc24f6))
32
+ - Adds script to deploy documentation to server ([81f7f74](https://github.com/rrd108/nuxt-users/commit/81f7f74))
33
+ - Adds script to deploy documentation ([7e2f642](https://github.com/rrd108/nuxt-users/commit/7e2f642))
34
+ - **release:** V1.1.1 ([e3bda8a](https://github.com/rrd108/nuxt-users/commit/e3bda8a))
35
+ - **release:** V1.1.2 ([3a2d2ae](https://github.com/rrd108/nuxt-users/commit/3a2d2ae))
36
+
37
+ ### ❤️ Contributors
38
+
39
+ - Rrd108 ([@rrd108](https://github.com/rrd108))
40
+
41
+ ## v1.1.2
42
+
43
+ [compare changes](https://github.com/rrd108/nuxt-users/compare/v1.1.0...v1.1.2)
44
+
45
+ ### 🩹 Fixes
46
+
47
+ - CLI tool for database management ([0a4793f](https://github.com/rrd108/nuxt-users/commit/0a4793f))
48
+ - Handling cli commands ([120c396](https://github.com/rrd108/nuxt-users/commit/120c396))
49
+ - Database handling and setup ([11ddc20](https://github.com/rrd108/nuxt-users/commit/11ddc20))
50
+
51
+ ### 💅 Refactors
52
+
53
+ - CLI commands to use environment variables ([3fc6c9f](https://github.com/rrd108/nuxt-users/commit/3fc6c9f))
54
+ - Remove unused types ([06b5e9f](https://github.com/rrd108/nuxt-users/commit/06b5e9f))
55
+ - Database connection logic ([f5baadf](https://github.com/rrd108/nuxt-users/commit/f5baadf))
56
+
57
+ ### 🏡 Chore
58
+
59
+ - **release:** V1.1.0 ([bfc24f6](https://github.com/rrd108/nuxt-users/commit/bfc24f6))
60
+ - Adds script to deploy documentation to server ([81f7f74](https://github.com/rrd108/nuxt-users/commit/81f7f74))
61
+ - Adds script to deploy documentation ([7e2f642](https://github.com/rrd108/nuxt-users/commit/7e2f642))
62
+ - **release:** V1.1.1 ([e3bda8a](https://github.com/rrd108/nuxt-users/commit/e3bda8a))
63
+
64
+ ### ❤️ Contributors
65
+
66
+ - Rrd108 ([@rrd108](https://github.com/rrd108))
67
+
68
+ ## v1.1.1
69
+
70
+ [compare changes](https://github.com/rrd108/nuxt-users/compare/v1.1.0...v1.1.1)
71
+
72
+ ### 🩹 Fixes
73
+
74
+ - CLI tool for database management ([0a4793f](https://github.com/rrd108/nuxt-users/commit/0a4793f))
75
+ - Handling cli commands ([120c396](https://github.com/rrd108/nuxt-users/commit/120c396))
76
+
77
+ ### 💅 Refactors
78
+
79
+ - CLI commands to use environment variables ([3fc6c9f](https://github.com/rrd108/nuxt-users/commit/3fc6c9f))
80
+ - Remove unused types ([06b5e9f](https://github.com/rrd108/nuxt-users/commit/06b5e9f))
81
+ - Database connection logic ([f5baadf](https://github.com/rrd108/nuxt-users/commit/f5baadf))
82
+
83
+ ### 🏡 Chore
84
+
85
+ - **release:** V1.1.0 ([bfc24f6](https://github.com/rrd108/nuxt-users/commit/bfc24f6))
86
+ - Adds script to deploy documentation to server ([81f7f74](https://github.com/rrd108/nuxt-users/commit/81f7f74))
87
+ - Adds script to deploy documentation ([7e2f642](https://github.com/rrd108/nuxt-users/commit/7e2f642))
88
+
89
+ ### ❤️ Contributors
90
+
91
+ - Rrd108 ([@rrd108](https://github.com/rrd108))
92
+
93
+ ## v1.1.0
94
+
95
+
96
+ ### 🚀 Enhancements
97
+
98
+ - Implement Sanctum-style token authentication ([8b6d1d3](https://github.com/rrd108/nuxt-users/commit/8b6d1d3))
99
+ - Create and save token ([063cabf](https://github.com/rrd108/nuxt-users/commit/063cabf))
100
+ - Implement password reset functionality ([bf9d2bc](https://github.com/rrd108/nuxt-users/commit/bf9d2bc))
101
+ - Implement password reset functionality with FormKit forms ([c025be2](https://github.com/rrd108/nuxt-users/commit/c025be2))
102
+ - Make database table names customizable ([6db3c28](https://github.com/rrd108/nuxt-users/commit/6db3c28))
103
+
104
+ ### 🩹 Fixes
105
+
106
+ - **ci:** Switch to mariadb for mysql tests ([8ddc60b](https://github.com/rrd108/nuxt-users/commit/8ddc60b))
107
+ - **deps:** Update nuxtjs monorepo to v3.17.7 ([89e3d3d](https://github.com/rrd108/nuxt-users/commit/89e3d3d))
108
+
109
+ ### ❤️ Contributors
110
+
111
+ - Rrd108 ([@rrd108](https://github.com/rrd108))
112
+
@@ -0,0 +1,45 @@
1
+ import { resolve, dirname } from 'node:path';
2
+ import { mkdirSync } from 'node:fs';
3
+ import Database from 'better-sqlite3';
4
+ import { B as BoundableStatement } from '../shared/nuxt-users.C9d5M6B1.mjs';
5
+
6
+ function sqliteConnector(opts) {
7
+ let _db;
8
+ const getDB = () => {
9
+ if (_db) {
10
+ return _db;
11
+ }
12
+ if (opts.name === ":memory:") {
13
+ _db = new Database(":memory:");
14
+ return _db;
15
+ }
16
+ const filePath = resolve(
17
+ opts.cwd || ".",
18
+ opts.path || `.data/${opts.name || "db"}.sqlite3`
19
+ );
20
+ mkdirSync(dirname(filePath), { recursive: true });
21
+ _db = new Database(filePath);
22
+ return _db;
23
+ };
24
+ return {
25
+ name: "sqlite",
26
+ dialect: "sqlite",
27
+ getInstance: () => getDB(),
28
+ exec: (sql) => getDB().exec(sql),
29
+ prepare: (sql) => new StatementWrapper(() => getDB().prepare(sql))
30
+ };
31
+ }
32
+ class StatementWrapper extends BoundableStatement {
33
+ async all(...params) {
34
+ return this._statement().all(...params);
35
+ }
36
+ async run(...params) {
37
+ const res = this._statement().run(...params);
38
+ return { success: res.changes > 0, ...res };
39
+ }
40
+ async get(...params) {
41
+ return this._statement().get(...params);
42
+ }
43
+ }
44
+
45
+ export { sqliteConnector as default };
@@ -0,0 +1,49 @@
1
+ import mysql from 'mysql2/promise';
2
+ import { B as BoundableStatement } from '../shared/nuxt-users.C9d5M6B1.mjs';
3
+
4
+ function mysqlConnector(opts) {
5
+ let _connection;
6
+ const getConnection = async () => {
7
+ if (_connection) {
8
+ return _connection;
9
+ }
10
+ _connection = await mysql.createConnection({
11
+ ...opts
12
+ });
13
+ return _connection;
14
+ };
15
+ const query = (sql, params) => getConnection().then((c) => c.query(sql, params)).then((res) => res[0]);
16
+ return {
17
+ name: "mysql",
18
+ dialect: "mysql",
19
+ getInstance: () => getConnection(),
20
+ exec: (sql) => query(sql),
21
+ prepare: (sql) => new StatementWrapper(sql, query)
22
+ };
23
+ }
24
+ class StatementWrapper extends BoundableStatement {
25
+ #query;
26
+ #sql;
27
+ constructor(sql, query) {
28
+ super();
29
+ this.#sql = sql;
30
+ this.#query = query;
31
+ }
32
+ async all(...params) {
33
+ const res = await this.#query(this.#sql, params);
34
+ return res;
35
+ }
36
+ async run(...params) {
37
+ const res = await this.#query(this.#sql, params);
38
+ return {
39
+ success: true,
40
+ ...res
41
+ };
42
+ }
43
+ async get(...params) {
44
+ const res = await this.#query(this.#sql, params);
45
+ return res[0];
46
+ }
47
+ }
48
+
49
+ export { mysqlConnector as default };
@@ -0,0 +1,58 @@
1
+ import pg from 'pg';
2
+ import { B as BoundableStatement } from '../shared/nuxt-users.C9d5M6B1.mjs';
3
+
4
+ function postgresqlConnector(opts) {
5
+ let _client;
6
+ function getClient() {
7
+ if (_client) {
8
+ return _client;
9
+ }
10
+ const client = new pg.Client("url" in opts ? opts.url : opts);
11
+ _client = client.connect().then(() => {
12
+ _client = client;
13
+ return _client;
14
+ });
15
+ return _client;
16
+ }
17
+ const query = async (sql, params) => {
18
+ const client = await getClient();
19
+ return client.query(normalizeParams(sql), params);
20
+ };
21
+ return {
22
+ name: "postgresql",
23
+ dialect: "postgresql",
24
+ getInstance: () => getClient(),
25
+ exec: (sql) => query(sql),
26
+ prepare: (sql) => new StatementWrapper(sql, query)
27
+ };
28
+ }
29
+ function normalizeParams(sql) {
30
+ let i = 0;
31
+ return sql.replace(/\?/g, () => `$${++i}`);
32
+ }
33
+ class StatementWrapper extends BoundableStatement {
34
+ #query;
35
+ #sql;
36
+ constructor(sql, query) {
37
+ super();
38
+ this.#sql = sql;
39
+ this.#query = query;
40
+ }
41
+ async all(...params) {
42
+ const res = await this.#query(this.#sql, params);
43
+ return res.rows;
44
+ }
45
+ async run(...params) {
46
+ const res = await this.#query(this.#sql, params);
47
+ return {
48
+ success: true,
49
+ ...res
50
+ };
51
+ }
52
+ async get(...params) {
53
+ const res = await this.#query(this.#sql, params);
54
+ return res.rows[0];
55
+ }
56
+ }
57
+
58
+ export { postgresqlConnector as default };
package/dist/cli.d.mts ADDED
@@ -0,0 +1 @@
1
+
package/dist/cli.d.ts ADDED
@@ -0,0 +1 @@
1
+