@dsnp/graph-sdk
Advanced tools
Comparing version 0.0.0-63c2b1 to 0.0.0-6bbde0
@@ -11,13 +11,13 @@ import { ImportBundle, Update, DsnpGraphEdge, Action, DsnpPublicKey, DsnpKeys, Config, ConnectionType, PrivacyType, GraphKeyPair } from "./models"; | ||
getGraphStatesCount(): Promise<number>; | ||
containsUserGraph(dsnpUserId: number): Promise<boolean>; | ||
containsUserGraph(dsnpUserId: string): Promise<boolean>; | ||
getGraphUsersCount(): Promise<number>; | ||
removeUserGraph(dsnpUserId: number): Promise<boolean>; | ||
removeUserGraph(dsnpUserId: string): Promise<boolean>; | ||
importUserData(payload: ImportBundle[]): Promise<boolean>; | ||
exportUpdates(): Promise<Update[]>; | ||
getConnectionsForUserGraph(dsnpUserId: number, schemaId: number, includePending: boolean): Promise<DsnpGraphEdge[]>; | ||
getConnectionsForUserGraph(dsnpUserId: string, schemaId: number, includePending: boolean): Promise<DsnpGraphEdge[]>; | ||
applyActions(actions: Action[]): Promise<boolean>; | ||
forceCalculateGraphs(dsnpUserId: number): Promise<Update[]>; | ||
forceCalculateGraphs(dsnpUserId: string): Promise<Update[]>; | ||
getConnectionsWithoutKeys(): Promise<number[]>; | ||
getOneSidedPrivateFriendshipConnections(dsnpUserId: number): Promise<DsnpGraphEdge[]>; | ||
getPublicKeys(dsnpUserId: number): Promise<DsnpPublicKey[]>; | ||
getOneSidedPrivateFriendshipConnections(dsnpUserId: string): Promise<DsnpGraphEdge[]>; | ||
getPublicKeys(dsnpUserId: string): Promise<DsnpPublicKey[]>; | ||
static deserializeDsnpKeys(keys: DsnpKeys): Promise<DsnpPublicKey[]>; | ||
@@ -24,0 +24,0 @@ static generateKeyPair(keyType: number): Promise<GraphKeyPair>; |
@@ -107,3 +107,3 @@ "use strict"; | ||
expect(handle).toBeDefined(); | ||
const contains = await graph.containsUserGraph(1); | ||
const contains = await graph.containsUserGraph("1"); | ||
expect(contains).toEqual(false); | ||
@@ -118,3 +118,3 @@ await graph.freeGraphState(); | ||
expect(handle).toBeDefined(); | ||
const removed = await graph.removeUserGraph(1); | ||
const removed = await graph.removeUserGraph("1"); | ||
expect(removed).toEqual(true); | ||
@@ -139,3 +139,3 @@ await graph.freeGraphState(); | ||
const dsnpKeys1 = { | ||
dsnpUserId: dsnpUserId1, | ||
dsnpUserId: dsnpUserId1.toString(), | ||
keysHash: 100, | ||
@@ -145,3 +145,3 @@ keys: [], | ||
const dsnpKeys2 = { | ||
dsnpUserId: dsnpUserId2, | ||
dsnpUserId: dsnpUserId2.toString(), | ||
keysHash: 100, | ||
@@ -151,3 +151,3 @@ keys: [], | ||
const importBundle1 = { | ||
dsnpUserId: dsnpUserId1, | ||
dsnpUserId: dsnpUserId1.toString(), | ||
schemaId: 1, | ||
@@ -159,3 +159,3 @@ keyPairs: keyPairs1, | ||
const importBundle2 = { | ||
dsnpUserId: dsnpUserId2, | ||
dsnpUserId: dsnpUserId2.toString(), | ||
schemaId: 1, | ||
@@ -192,9 +192,9 @@ keyPairs: keyPairs2, | ||
type: "Connect", | ||
ownerDsnpUserId: 1, | ||
ownerDsnpUserId: "1", | ||
connection: { | ||
dsnpUserId: 2, | ||
dsnpUserId: "2", | ||
schemaId: 1, | ||
}, | ||
dsnpKeys: { | ||
dsnpUserId: 2, | ||
dsnpUserId: "2", | ||
keysHash: 100, | ||
@@ -222,9 +222,9 @@ keys: [], | ||
type: "Connect", | ||
ownerDsnpUserId: 1, | ||
ownerDsnpUserId: "1", | ||
connection: { | ||
dsnpUserId: 2, | ||
dsnpUserId: "2", | ||
schemaId: 1, | ||
}, | ||
dsnpKeys: { | ||
dsnpUserId: 2, | ||
dsnpUserId: "2", | ||
keysHash: 100, | ||
@@ -237,6 +237,6 @@ keys: [], | ||
expect(applied).toEqual(true); | ||
const connections = await graph.getConnectionsForUserGraph(1, 1, true); | ||
const connections = await graph.getConnectionsForUserGraph("1", 1, true); | ||
expect(connections).toBeDefined(); | ||
expect(connections.length).toEqual(1); | ||
const forceCalculateGraphs = await graph.forceCalculateGraphs(1); | ||
const forceCalculateGraphs = await graph.forceCalculateGraphs("1"); | ||
expect(forceCalculateGraphs).toBeDefined(); | ||
@@ -255,3 +255,3 @@ expect(forceCalculateGraphs.length).toEqual(0); | ||
expect(async () => { | ||
await graph.getOneSidedPrivateFriendshipConnections(1); | ||
await graph.getOneSidedPrivateFriendshipConnections("1"); | ||
}).rejects.toThrow('User graph for 1 is not imported'); | ||
@@ -265,5 +265,5 @@ await graph.freeGraphState(); | ||
expect(handle).toBeDefined(); | ||
const connections = await graph.getPublicKeys(1); | ||
expect(connections).toBeDefined(); | ||
expect(connections.length).toEqual(0); | ||
const keys = await graph.getPublicKeys("1"); | ||
expect(keys).toBeDefined(); | ||
expect(keys.length).toEqual(0); | ||
await graph.freeGraphState(); | ||
@@ -277,9 +277,9 @@ }); | ||
const keys = { | ||
dsnpUserId: 2, | ||
dsnpUserId: "2", | ||
keysHash: 100, | ||
keys: [], | ||
}; | ||
const connections = await graph_1.Graph.deserializeDsnpKeys(keys); | ||
expect(connections).toBeDefined(); | ||
expect(connections.length).toEqual(0); | ||
const des_keys = await graph_1.Graph.deserializeDsnpKeys(keys); | ||
expect(des_keys).toBeDefined(); | ||
expect(des_keys.length).toEqual(0); | ||
await graph.freeGraphState(); | ||
@@ -293,9 +293,9 @@ }); | ||
type: "Connect", | ||
ownerDsnpUserId: 1, | ||
ownerDsnpUserId: "1", | ||
connection: { | ||
dsnpUserId: 2, | ||
dsnpUserId: "2", | ||
schemaId: public_follow_graph_schema_id, | ||
}, | ||
dsnpKeys: { | ||
dsnpUserId: 2, | ||
dsnpUserId: "2", | ||
keysHash: 100, | ||
@@ -309,3 +309,3 @@ keys: [], | ||
expect(applied).toEqual(true); | ||
let connections_including_pending = await graph.getConnectionsForUserGraph(1, public_follow_graph_schema_id, true); | ||
let connections_including_pending = await graph.getConnectionsForUserGraph("1", public_follow_graph_schema_id, true); | ||
expect(connections_including_pending).toBeDefined(); | ||
@@ -327,3 +327,3 @@ expect(connections_including_pending.length).toEqual(1); | ||
type: "AddGraphKey", | ||
ownerDsnpUserId: dsnpOwnerId, | ||
ownerDsnpUserId: dsnpOwnerId.toString(), | ||
newPublicKey: new Uint8Array(x25519_public_key), | ||
@@ -347,3 +347,3 @@ }; | ||
let dsnp_keys = { | ||
dsnpUserId: dsnp_key_owner, | ||
dsnpUserId: dsnp_key_owner.toString(), | ||
keysHash: 100, | ||
@@ -350,0 +350,0 @@ keys: [ |
@@ -11,12 +11,12 @@ import { Action, Config, ConnectionType, DsnpGraphEdge, DsnpKeys, DsnpPublicKey, EnvironmentInterface, GraphKeyPair, GraphKeyType, ImportBundle, PrivacyType, Update } from "./models"; | ||
getGraphUsersCount(handle: number): Promise<number>; | ||
containsUserGraph(handle: number, dsnpUserId: number): Promise<boolean>; | ||
removeUserGraph(handle: number, dsnpUserId: number): Promise<boolean>; | ||
containsUserGraph(handle: number, dsnpUserId: string): Promise<boolean>; | ||
removeUserGraph(handle: number, dsnpUserId: string): Promise<boolean>; | ||
importUserData(handle: number, payload: ImportBundle[]): Promise<boolean>; | ||
applyActions(handle: number, actions: Action[]): Promise<boolean>; | ||
exportUpdates(handle: number): Promise<Update[]>; | ||
getConnectionsForUserGraph(handle: number, dsnpUserId: number, schemaId: number, includePending: boolean): Promise<DsnpGraphEdge[]>; | ||
forceCalculateGraphs(handle: number, dsnpUserId: number): Promise<Update[]>; | ||
getConnectionsForUserGraph(handle: number, dsnpUserId: string, schemaId: number, includePending: boolean): Promise<DsnpGraphEdge[]>; | ||
forceCalculateGraphs(handle: number, dsnpUserId: string): Promise<Update[]>; | ||
getConnectionsWithoutKeys(handle: number): Promise<number[]>; | ||
getOneSidedPrivateFriendshipConnections(handle: number, dsnpUserId: number): Promise<DsnpGraphEdge[]>; | ||
getPublicKeys(handle: number, dsnpUserId: number): Promise<DsnpPublicKey[]>; | ||
getOneSidedPrivateFriendshipConnections(handle: number, dsnpUserId: string): Promise<DsnpGraphEdge[]>; | ||
getPublicKeys(handle: number, dsnpUserId: string): Promise<DsnpPublicKey[]>; | ||
deserializeDsnpKeys(keys: DsnpKeys): Promise<DsnpPublicKey[]>; | ||
@@ -27,2 +27,4 @@ generateKeyPair(keyType: GraphKeyType): Promise<GraphKeyPair>; | ||
export declare const graphsdkModule: Native; | ||
export * from "./models"; | ||
export * from "./graph"; | ||
//# sourceMappingURL=index.d.ts.map |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -19,2 +33,5 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
exports.graphsdkModule = loadNativeModule(); | ||
// Export the models | ||
__exportStar(require("./models"), exports); | ||
__exportStar(require("./graph"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -5,3 +5,3 @@ import { Connection } from "./connection"; | ||
type: "Connect"; | ||
ownerDsnpUserId: number; | ||
ownerDsnpUserId: string; | ||
connection: Connection; | ||
@@ -12,3 +12,3 @@ dsnpKeys?: DsnpKeys; | ||
type: "Disconnect"; | ||
ownerDsnpUserId: number; | ||
ownerDsnpUserId: string; | ||
connection: Connection; | ||
@@ -18,3 +18,3 @@ } | ||
type: "AddGraphKey"; | ||
ownerDsnpUserId: number; | ||
ownerDsnpUserId: string; | ||
newPublicKey: Uint8Array; | ||
@@ -21,0 +21,0 @@ } |
export interface Connection { | ||
dsnpUserId: number; | ||
dsnpUserId: string; | ||
schemaId: number; | ||
} | ||
//# sourceMappingURL=connection.d.ts.map |
export interface DsnpGraphEdge { | ||
userId: number; | ||
userId: string; | ||
since: number; | ||
} | ||
//# sourceMappingURL=graph_edge.d.ts.map |
@@ -6,3 +6,3 @@ export interface KeyData { | ||
export interface DsnpKeys { | ||
dsnpUserId: number; | ||
dsnpUserId: string; | ||
keysHash: number; | ||
@@ -25,3 +25,3 @@ keys: KeyData[]; | ||
export interface ImportBundle { | ||
dsnpUserId: number; | ||
dsnpUserId: string; | ||
schemaId: number; | ||
@@ -28,0 +28,0 @@ keyPairs: GraphKeyPair[]; |
export interface DsnpPublicKey { | ||
key: Uint8Array; | ||
keyId?: Uint8Array; | ||
keyId?: string; | ||
} | ||
//# sourceMappingURL=public_keys.d.ts.map |
export interface PersistPageUpdate { | ||
type: "PersistPage"; | ||
ownerDsnpUserId: number; | ||
ownerDsnpUserId: string; | ||
schemaId: number; | ||
@@ -11,3 +11,3 @@ pageId: number; | ||
type: "DeletePage"; | ||
ownerDsnpUserId: number; | ||
ownerDsnpUserId: string; | ||
schemaId: number; | ||
@@ -19,3 +19,3 @@ pageId: number; | ||
type: "AddKey"; | ||
ownerDsnpUserId: number; | ||
ownerDsnpUserId: string; | ||
prevHash: number; | ||
@@ -22,0 +22,0 @@ payload: Uint8Array; |
@@ -10,3 +10,3 @@ # DSNP Graph SDK | ||
```bash | ||
npm install @dsnp/graph-sdk | ||
npm install @dsnp/graph-sdk@latest | ||
``` | ||
@@ -13,0 +13,0 @@ |
{ | ||
"name": "@dsnp/graph-sdk", | ||
"version": "0.0.0-63c2b1", | ||
"version": "0.0.0-6bbde0", | ||
"author": "Amplica Labs", | ||
@@ -5,0 +5,0 @@ "license": "ISC", |
@@ -10,3 +10,3 @@ # DSNP Graph SDK | ||
```bash | ||
npm install @dsnp/graph-sdk | ||
npm install @dsnp/graph-sdk@latest | ||
``` | ||
@@ -13,0 +13,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6378539
750