hazo_auth 1.2.0 → 1.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/package.json +2 -2
- package/scripts/init_users.ts +9 -9
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hazo_auth",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"files": [
|
|
5
5
|
"src/**/*",
|
|
6
6
|
"public/file.svg",
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
"better-sqlite3": "^12.4.1",
|
|
104
104
|
"cross-env": "^10.1.0",
|
|
105
105
|
"eslint": "^8.57.0",
|
|
106
|
-
"eslint-config-next": "^
|
|
106
|
+
"eslint-config-next": "^16.0.4",
|
|
107
107
|
"eslint-plugin-storybook": "^10.0.6",
|
|
108
108
|
"jest": "^30.2.0",
|
|
109
109
|
"jest-environment-jsdom": "^29.7.0",
|
package/scripts/init_users.ts
CHANGED
|
@@ -16,7 +16,7 @@ type InitSummary = {
|
|
|
16
16
|
role: {
|
|
17
17
|
inserted: boolean;
|
|
18
18
|
existing: boolean;
|
|
19
|
-
role_id:
|
|
19
|
+
role_id: string | null;
|
|
20
20
|
};
|
|
21
21
|
role_permissions: {
|
|
22
22
|
inserted: number;
|
|
@@ -115,7 +115,7 @@ async function init_users(): Promise<void> {
|
|
|
115
115
|
console.log();
|
|
116
116
|
|
|
117
117
|
// 2. Add permissions to hazo_permissions table
|
|
118
|
-
const permission_id_map: Record<string,
|
|
118
|
+
const permission_id_map: Record<string, string> = {};
|
|
119
119
|
const now = new Date().toISOString();
|
|
120
120
|
|
|
121
121
|
for (const permission_name of permission_names) {
|
|
@@ -129,7 +129,7 @@ async function init_users(): Promise<void> {
|
|
|
129
129
|
|
|
130
130
|
if (Array.isArray(existing_permissions) && existing_permissions.length > 0) {
|
|
131
131
|
const existing_permission = existing_permissions[0];
|
|
132
|
-
const perm_id = existing_permission.id as
|
|
132
|
+
const perm_id = existing_permission.id as string;
|
|
133
133
|
permission_id_map[trimmed_name] = perm_id;
|
|
134
134
|
summary.permissions.existing.push(trimmed_name);
|
|
135
135
|
console.log(`✓ Permission already exists: ${trimmed_name} (ID: ${perm_id})`);
|
|
@@ -143,8 +143,8 @@ async function init_users(): Promise<void> {
|
|
|
143
143
|
});
|
|
144
144
|
|
|
145
145
|
const perm_id = Array.isArray(new_permission)
|
|
146
|
-
? (new_permission[0] as { id:
|
|
147
|
-
: (new_permission as { id:
|
|
146
|
+
? (new_permission[0] as { id: string }).id
|
|
147
|
+
: (new_permission as { id: string }).id;
|
|
148
148
|
permission_id_map[trimmed_name] = perm_id;
|
|
149
149
|
summary.permissions.inserted.push(trimmed_name);
|
|
150
150
|
console.log(`✓ Inserted permission: ${trimmed_name} (ID: ${perm_id})`);
|
|
@@ -159,9 +159,9 @@ async function init_users(): Promise<void> {
|
|
|
159
159
|
role_name,
|
|
160
160
|
});
|
|
161
161
|
|
|
162
|
-
let role_id:
|
|
162
|
+
let role_id: string;
|
|
163
163
|
if (Array.isArray(existing_roles) && existing_roles.length > 0) {
|
|
164
|
-
role_id = existing_roles[0].id as
|
|
164
|
+
role_id = existing_roles[0].id as string;
|
|
165
165
|
summary.role.existing = true;
|
|
166
166
|
summary.role.role_id = role_id;
|
|
167
167
|
console.log(`✓ Role already exists: ${role_name} (ID: ${role_id})`);
|
|
@@ -173,8 +173,8 @@ async function init_users(): Promise<void> {
|
|
|
173
173
|
});
|
|
174
174
|
|
|
175
175
|
role_id = Array.isArray(new_role)
|
|
176
|
-
? (new_role[0] as { id:
|
|
177
|
-
: (new_role as { id:
|
|
176
|
+
? (new_role[0] as { id: string }).id
|
|
177
|
+
: (new_role as { id: string }).id;
|
|
178
178
|
summary.role.inserted = true;
|
|
179
179
|
summary.role.role_id = role_id;
|
|
180
180
|
console.log(`✓ Created role: ${role_name} (ID: ${role_id})`);
|