Merge pull request 'fix: resolve tsc --build type errors' (#20) from fix/build-type-errors into main
This commit is contained in:
@@ -114,7 +114,9 @@ function mapUrlToPermission(method: string, url: string): PermissionCheck {
|
|||||||
const nameMatch = url.match(/^\/api\/v1\/[a-z-]+\/([^/?]+)/);
|
const nameMatch = url.match(/^\/api\/v1\/[a-z-]+\/([^/?]+)/);
|
||||||
const resourceName = nameMatch?.[1];
|
const resourceName = nameMatch?.[1];
|
||||||
|
|
||||||
return { kind: 'resource', resource, action, resourceName };
|
const check: PermissionCheck = { kind: 'resource', resource, action };
|
||||||
|
if (resourceName !== undefined) (check as { resourceName: string }).resourceName = resourceName;
|
||||||
|
return check;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function main(): Promise<void> {
|
async function main(): Promise<void> {
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import type { IProjectRepository } from '../../repositories/project.repository.j
|
|||||||
import type { IUserRepository } from '../../repositories/user.repository.js';
|
import type { IUserRepository } from '../../repositories/user.repository.js';
|
||||||
import type { IGroupRepository } from '../../repositories/group.repository.js';
|
import type { IGroupRepository } from '../../repositories/group.repository.js';
|
||||||
import type { IRbacDefinitionRepository } from '../../repositories/rbac-definition.repository.js';
|
import type { IRbacDefinitionRepository } from '../../repositories/rbac-definition.repository.js';
|
||||||
|
import type { RbacRoleBinding } from '../../validation/rbac-definition.schema.js';
|
||||||
import { decrypt } from './crypto.js';
|
import { decrypt } from './crypto.js';
|
||||||
import type { BackupBundle } from './backup-service.js';
|
import type { BackupBundle } from './backup-service.js';
|
||||||
|
|
||||||
@@ -317,7 +318,7 @@ export class RestoreService {
|
|||||||
// overwrite
|
// overwrite
|
||||||
await this.rbacRepo.update(existing.id, {
|
await this.rbacRepo.update(existing.id, {
|
||||||
subjects: rbac.subjects as Array<{ kind: 'User' | 'Group'; name: string }>,
|
subjects: rbac.subjects as Array<{ kind: 'User' | 'Group'; name: string }>,
|
||||||
roleBindings: rbac.roleBindings as Array<{ role: string; resource: string } | { role: 'run'; action: string }>,
|
roleBindings: rbac.roleBindings as RbacRoleBinding[],
|
||||||
});
|
});
|
||||||
result.rbacCreated++;
|
result.rbacCreated++;
|
||||||
continue;
|
continue;
|
||||||
@@ -326,7 +327,7 @@ export class RestoreService {
|
|||||||
await this.rbacRepo.create({
|
await this.rbacRepo.create({
|
||||||
name: rbac.name,
|
name: rbac.name,
|
||||||
subjects: rbac.subjects as Array<{ kind: 'User' | 'Group'; name: string }>,
|
subjects: rbac.subjects as Array<{ kind: 'User' | 'Group'; name: string }>,
|
||||||
roleBindings: rbac.roleBindings as Array<{ role: string; resource: string } | { role: 'run'; action: string }>,
|
roleBindings: rbac.roleBindings as RbacRoleBinding[],
|
||||||
});
|
});
|
||||||
result.rbacCreated++;
|
result.rbacCreated++;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
export { CreateMcpServerSchema, UpdateMcpServerSchema } from './mcp-server.schema.js';
|
export { CreateMcpServerSchema, UpdateMcpServerSchema } from './mcp-server.schema.js';
|
||||||
export type { CreateMcpServerInput, UpdateMcpServerInput } from './mcp-server.schema.js';
|
export type { CreateMcpServerInput, UpdateMcpServerInput } from './mcp-server.schema.js';
|
||||||
export { CreateProjectSchema, UpdateProjectSchema } from './project.schema.js';
|
export { CreateProjectSchema, UpdateProjectSchema } from './project.schema.js';
|
||||||
export type { CreateProjectInput, UpdateProjectInput, ProjectMemberInput } from './project.schema.js';
|
export type { CreateProjectInput, UpdateProjectInput } from './project.schema.js';
|
||||||
export { CreateRbacDefinitionSchema, UpdateRbacDefinitionSchema, RbacSubjectSchema, RbacRoleBindingSchema, RBAC_ROLES, RBAC_RESOURCES } from './rbac-definition.schema.js';
|
export { CreateRbacDefinitionSchema, UpdateRbacDefinitionSchema, RbacSubjectSchema, RbacRoleBindingSchema, RBAC_ROLES, RBAC_RESOURCES } from './rbac-definition.schema.js';
|
||||||
export type { CreateRbacDefinitionInput, UpdateRbacDefinitionInput, RbacSubject, RbacRoleBinding } from './rbac-definition.schema.js';
|
export type { CreateRbacDefinitionInput, UpdateRbacDefinitionInput, RbacSubject, RbacRoleBinding } from './rbac-definition.schema.js';
|
||||||
|
|||||||
Reference in New Issue
Block a user