Skip to content

Commit

Permalink
update types
Browse files Browse the repository at this point in the history
  • Loading branch information
trungnotchung committed Dec 17, 2024
1 parent ae2e1a8 commit b6cba37
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
3 changes: 2 additions & 1 deletion packages/blueprints/src/AccessControl/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {
type ACL,
ActionType,
type DRP,
type ResolveConflictsType,
SemanticsType,
type Vertex,
Expand All @@ -11,7 +12,7 @@ export enum AccessControlConflictResolution {
RevokeWins = 1,
}

export class AccessControl implements ACL {
export class AccessControl implements ACL, DRP {
operations: string[] = ["grant", "revoke"];
semanticsType = SemanticsType.pair;
peerKeyStore = new Map<string, string>();
Expand Down
2 changes: 1 addition & 1 deletion packages/blueprints/src/AddWinsSetWithACL/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { AccessControl } from "../AccessControl/index.js";
export class AddWinsSetWithACL<T> implements DRP {
operations: string[] = ["add", "remove"];
state: Map<T, boolean>;
acl?: ACL;
acl?: ACL & DRP;
semanticsType = SemanticsType.pair;

constructor(admins: Map<string, string>) {
Expand Down
6 changes: 1 addition & 5 deletions packages/object/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ export * as ObjectPb from "./proto/drp/object/v1/object_pb.js";
export * from "./hashgraph/index.js";

export interface ACL {
operations: string[];
semanticsType: SemanticsType;
peerKeyStore: Map<string, string>;
resolveConflicts: (vertices: Vertex[]) => ResolveConflictsType;
isWriter: (peerId: string) => boolean;
isAdmin: (peerId: string) => boolean;
grant: (peerId: string, publicKey: string) => void;
Expand All @@ -30,7 +26,7 @@ export interface DRP {
operations: string[];
semanticsType: SemanticsType;
resolveConflicts: (vertices: Vertex[]) => ResolveConflictsType;
acl?: ACL;
acl?: ACL & DRP;
// biome-ignore lint: attributes can be anything
[key: string]: any;
}
Expand Down

0 comments on commit b6cba37

Please sign in to comment.