diff --git a/packages/node/src/version.ts b/packages/node/src/version.ts index 86305dfd..4cae557f 100644 --- a/packages/node/src/version.ts +++ b/packages/node/src/version.ts @@ -1 +1 @@ -export const VERSION = "0.4.4"; +export const VERSION = "0.5.0"; diff --git a/packages/object/src/index.ts b/packages/object/src/index.ts index a2ea323a..899a1e82 100644 --- a/packages/object/src/index.ts +++ b/packages/object/src/index.ts @@ -151,6 +151,9 @@ export class DRPObject implements IDRPObject { ?.split("\n")[2] ?.trim() .split(" ")[1]; + if (callerName?.startsWith("DRPObject.resolveConflicts")) { + return Reflect.apply(applyTarget, thisArg, args); + } if (!callerName?.startsWith("Proxy.")) obj.callFn( fullPropKey, @@ -285,7 +288,7 @@ export class DRPObject implements IDRPObject { // check if the given peer has write permission private _checkWriterPermission(peerId: string): boolean { - return this.acl ? (this.acl as IACL).query_isAdmin(peerId) : true; + return this.acl ? (this.acl as IACL).query_isWriter(peerId) : true; } // apply the operation to the DRP diff --git a/packages/object/tests/hashgraph.test.ts b/packages/object/tests/hashgraph.test.ts index 3f6d9219..17f98839 100644 --- a/packages/object/tests/hashgraph.test.ts +++ b/packages/object/tests/hashgraph.test.ts @@ -166,7 +166,7 @@ describe("HashGraph for AddWinSet tests", () => { const linearOps = obj1.hashGraph.linearizeOperations(); const expectedOps: Operation[] = [ { type: "add", value: 1, vertexType: "drp" }, - { type: "add", value: 1, vertexType: "drp" }, + { type: "remove", value: 1, vertexType: "drp" }, ]; expect(linearOps).toEqual(expectedOps); }); @@ -743,7 +743,7 @@ describe("Writer permission tests", () => { obj2.merge(obj1.hashGraph.getAllVertices()); expect(drp2.query_contains(1)).toBe(true); - expect(acl2.query_isAdmin("peer2")).toBe(true); + expect(acl2.query_isWriter("peer2")).toBe(true); drp2.add(4); obj1.merge(obj2.hashGraph.getAllVertices()); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index cba94e64..3bc36095 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -54,10 +54,10 @@ importers: examples/canvas: dependencies: '@ts-drp/node': - specifier: 0.4.4 + specifier: 0.5.0 version: link:../../packages/node '@ts-drp/object': - specifier: 0.4.4 + specifier: 0.5.0 version: link:../../packages/object devDependencies: '@types/node': @@ -76,10 +76,10 @@ importers: examples/chat: dependencies: '@ts-drp/node': - specifier: 0.4.4 + specifier: 0.5.0 version: link:../../packages/node '@ts-drp/object': - specifier: 0.4.4 + specifier: 0.5.0 version: link:../../packages/object devDependencies: '@types/node': @@ -98,10 +98,10 @@ importers: examples/grid: dependencies: '@ts-drp/node': - specifier: 0.4.4 + specifier: 0.5.0 version: link:../../packages/node '@ts-drp/object': - specifier: 0.4.4 + specifier: 0.5.0 version: link:../../packages/object devDependencies: '@types/node': @@ -120,7 +120,7 @@ importers: examples/local-bootstrap: dependencies: '@ts-drp/node': - specifier: 0.4.4 + specifier: 0.5.0 version: link:../../packages/node devDependencies: '@types/node': @@ -143,7 +143,7 @@ importers: version: 4.1.5 devDependencies: '@ts-drp/object': - specifier: 0.4.4 + specifier: 0.5.0 version: link:../object packages/logger: @@ -209,7 +209,7 @@ importers: specifier: ^12.3.1 version: 12.3.4 '@ts-drp/logger': - specifier: ^0.4.4 + specifier: ^0.5.0 version: link:../logger it-length-prefixed: specifier: ^9.1.0 @@ -249,16 +249,16 @@ importers: specifier: ^2.1.3 version: 2.3.0 '@ts-drp/blueprints': - specifier: 0.4.4 + specifier: 0.5.0 version: link:../blueprints '@ts-drp/logger': - specifier: 0.4.4 + specifier: 0.5.0 version: link:../logger '@ts-drp/network': - specifier: 0.4.4 + specifier: 0.5.0 version: link:../network '@ts-drp/object': - specifier: 0.4.4 + specifier: 0.5.0 version: link:../object commander: specifier: ^13.0.0 @@ -289,7 +289,7 @@ importers: packages/object: dependencies: '@ts-drp/logger': - specifier: ^0.4.4 + specifier: ^0.5.0 version: link:../logger fast-deep-equal: specifier: ^3.1.3