@dsnp/graph-sdk
Advanced tools
Comparing version 0.0.0-ab5a34 to 0.0.0-c347d7
@@ -1,2 +0,2 @@ | ||
import { ImportBundle, Update, DsnpGraphEdge, Action, DsnpPublicKey, DsnpKeys, Config } from "./models"; | ||
import { Config } from "./models/config"; | ||
import { EnvironmentInterface } from "./models/environment"; | ||
@@ -6,21 +6,5 @@ export declare class Graph { | ||
constructor(environment: EnvironmentInterface, capacity?: number); | ||
getGraphHandle(): number; | ||
getGraphConfig(environment: EnvironmentInterface): Promise<Config>; | ||
getGraphCapacity(): Promise<number>; | ||
getGraphSize(): Promise<number>; | ||
containsUserGraph(dsnpUserId: number): Promise<boolean>; | ||
getGraphUsersCount(): Promise<number>; | ||
removeUserGraph(dsnpUserId: number): Promise<void>; | ||
importUserData(payload: [ImportBundle]): Promise<void>; | ||
exportUpdates(): Promise<Update>; | ||
getConnectionsForUserGraphUpdates(dsnpUserId: number, schemaId: string, includePending: boolean): Promise<[DsnpGraphEdge]>; | ||
applyActions(actions: [Action]): Promise<void>; | ||
forceCalculateGraphs(dsnpUserId: number): Promise<Update>; | ||
getConnectionsWithoutKeys(): Promise<[number]>; | ||
getOneSidedPrivateFriendshipConnections(dsnpUserId: number): Promise<[DsnpGraphEdge]>; | ||
getPublicKeys(dsnpUserId: number): Promise<[DsnpPublicKey]>; | ||
deserializeDsnpKeys(keys: DsnpKeys): Promise<[DsnpPublicKey]>; | ||
freeGraphState(): Promise<void>; | ||
getGraphConfig(environment: EnvironmentInterface): Config; | ||
printHelloGraph(): void; | ||
} | ||
//# sourceMappingURL=graph.d.ts.map |
@@ -14,53 +14,5 @@ "use strict"; | ||
} | ||
getGraphHandle() { | ||
return this.handle; | ||
} | ||
getGraphConfig(environment) { | ||
return index_1.graphsdkModule.getGraphConfig(environment); | ||
} | ||
getGraphCapacity() { | ||
return index_1.graphsdkModule.getGraphCapacity(this.handle); | ||
} | ||
getGraphSize() { | ||
return index_1.graphsdkModule.getGraphSize(this.handle); | ||
} | ||
containsUserGraph(dsnpUserId) { | ||
return index_1.graphsdkModule.containsUserGraph(this.handle, dsnpUserId); | ||
} | ||
getGraphUsersCount() { | ||
return index_1.graphsdkModule.getGraphUsersCount(this.handle); | ||
} | ||
removeUserGraph(dsnpUserId) { | ||
return index_1.graphsdkModule.removeUserGraph(this.handle, dsnpUserId); | ||
} | ||
importUserData(payload) { | ||
return index_1.graphsdkModule.importUserData(this.handle, payload); | ||
} | ||
exportUpdates() { | ||
return index_1.graphsdkModule.exportUpdates(this.handle); | ||
} | ||
getConnectionsForUserGraphUpdates(dsnpUserId, schemaId, includePending) { | ||
return index_1.graphsdkModule.getConnectionsForUserGraphUpdates(this.handle, dsnpUserId, schemaId, includePending); | ||
} | ||
applyActions(actions) { | ||
return index_1.graphsdkModule.applyActions(this.handle, actions); | ||
} | ||
forceCalculateGraphs(dsnpUserId) { | ||
return index_1.graphsdkModule.forceCalculateGraphs(this.handle, dsnpUserId); | ||
} | ||
getConnectionsWithoutKeys() { | ||
return index_1.graphsdkModule.getConnectionsWithoutKeys(this.handle); | ||
} | ||
getOneSidedPrivateFriendshipConnections(dsnpUserId) { | ||
return index_1.graphsdkModule.getOneSidedPrivateFriendshipConnections(this.handle, dsnpUserId); | ||
} | ||
getPublicKeys(dsnpUserId) { | ||
return index_1.graphsdkModule.getPublicKeys(this.handle, dsnpUserId); | ||
} | ||
deserializeDsnpKeys(keys) { | ||
return index_1.graphsdkModule.deserializeDsnpKeys(keys); | ||
} | ||
freeGraphState() { | ||
return index_1.graphsdkModule.freeGraphState(this.handle); | ||
} | ||
printHelloGraph() { | ||
@@ -67,0 +19,0 @@ console.log(index_1.graphsdkModule.printHelloGraph()); |
@@ -5,3 +5,3 @@ "use strict"; | ||
const environment_1 = require("./models/environment"); | ||
test('printHelloGraph should print "Hello, Graph!"', async () => { | ||
test('printHelloGraph should print "Hello, Graph!"', () => { | ||
// Mock the console.log function | ||
@@ -11,39 +11,11 @@ const consoleLogMock = jest.spyOn(console, 'log').mockImplementation(); | ||
const graph = new graph_1.Graph(environment); | ||
await graph.printHelloGraph(); | ||
graph.printHelloGraph(); | ||
expect(consoleLogMock).toHaveBeenCalledWith('Hello, Graph!'); | ||
await graph.freeGraphState(); | ||
}); | ||
test('getGraphConfig should return the graph config', async () => { | ||
test('getGraphConfig should return the graph config', () => { | ||
const environment = { environmentType: environment_1.EnvironmentType.Dev, config: {} }; | ||
const graph = new graph_1.Graph(environment); | ||
const config = await graph.getGraphConfig(environment); | ||
const config = graph.getGraphConfig(environment); | ||
expect(config).toBeDefined(); | ||
expect(config.sdkMaxUsersGraphSize).toEqual(1000); | ||
await graph.freeGraphState(); | ||
}); | ||
test('getGraphConfig with Mainnet environment should return the graph config', async () => { | ||
const environment = { environmentType: environment_1.EnvironmentType.Mainnet }; | ||
const graph = new graph_1.Graph(environment); | ||
const config = await graph.getGraphConfig(environment); | ||
expect(config).toBeDefined(); | ||
expect(config.sdkMaxUsersGraphSize).toEqual(1000); | ||
await graph.freeGraphState(); | ||
}); | ||
test('getGraphConfig with Rococo environment should return the graph config', async () => { | ||
const environment = { environmentType: environment_1.EnvironmentType.Rococo }; | ||
const graph = new graph_1.Graph(environment); | ||
const config = await graph.getGraphConfig(environment); | ||
expect(config).toBeDefined(); | ||
expect(config.sdkMaxUsersGraphSize).toEqual(1000); | ||
await graph.freeGraphState(); | ||
}); | ||
test('initialize graph with low capacity of 100 should return the same capacity', async () => { | ||
const environment = { environmentType: environment_1.EnvironmentType.Dev, config: {} }; | ||
const graph = new graph_1.Graph(environment, 100); | ||
const handle = graph.getGraphHandle(); | ||
expect(handle).toBeDefined(); | ||
const capacity = await graph.getGraphCapacity(); | ||
expect(capacity).toEqual(100); | ||
await graph.freeGraphState(); | ||
}); | ||
//# sourceMappingURL=graph.test.js.map |
@@ -1,25 +0,23 @@ | ||
import { Action, Config, DsnpGraphEdge, DsnpKeys, DsnpPublicKey, EnvironmentInterface, ImportBundle, Update } from "./models"; | ||
import { EnvironmentInterface } from "./models/environment"; | ||
import { Config } from "./models/config"; | ||
export interface Native { | ||
printHelloGraph(): void; | ||
getGraphConfig(environment: EnvironmentInterface): Config; | ||
initializeGraphState(environment: EnvironmentInterface): number; | ||
initializeGraphStateWithCapacity(environment: EnvironmentInterface, capacity: number): number; | ||
getGraphConfig(environment: EnvironmentInterface): Promise<Config>; | ||
getGraphCapacity(handle: number): Promise<number>; | ||
getGraphSize(handle: number): Promise<number>; | ||
containsUserGraph(handle: number, dsnpUserId: number): Promise<boolean>; | ||
getGraphUsersCount(handle: number): Promise<number>; | ||
removeUserGraph(handle: number, dsnpUserId: number): Promise<void>; | ||
importUserData(handle: number, payload: [ImportBundle]): Promise<void>; | ||
exportUpdates(handle: number): Promise<Update>; | ||
getConnectionsForUserGraphUpdates(handle: number, dsnpUserId: number, schemaId: string, includePending: boolean): Promise<[DsnpGraphEdge]>; | ||
applyActions(handle: number, actions: [Action]): Promise<void>; | ||
forceCalculateGraphs(handle: number, dsnpUserId: number): Promise<Update>; | ||
getConnectionsWithoutKeys(handle: number): Promise<[number]>; | ||
getOneSidedPrivateFriendshipConnections(handle: number, dsnpUserId: number): Promise<[DsnpGraphEdge]>; | ||
getPublicKeys(handle: number, dsnpUserId: number): Promise<[DsnpPublicKey]>; | ||
deserializeDsnpKeys(keys: DsnpKeys): Promise<[DsnpPublicKey]>; | ||
freeGraphState(handle: number): Promise<void>; | ||
freeAllGraphStates(): Promise<void>; | ||
containsUserGraph(handle: number, dsnpUserId: number): boolean; | ||
getGraphUsersLength(handle: number): number; | ||
removeUserGraph(handle: number, dsnpUserId: number): void; | ||
importUserData(handle: number, data: any): void; | ||
exportUpdates(handle: number): any; | ||
applyActions(handle: number, actions: any): void; | ||
forceCalculateGraphs(handle: number, dsnpUserId: number): any; | ||
getConnectionsForUserGraph(handle: number, dsnpUserId: number, schemaId: string, includePending: boolean): any; | ||
getUsersWithoutKeys(handle: number): any; | ||
getOneSidedPrivateFriendshipConnections(handle: number, dsnpUserId: number): any; | ||
getPublicKeys(handle: number, dsnpUserId: number): any; | ||
deserializeDsnpKeys(keys: any): any; | ||
freeGraphState(handle: number): void; | ||
} | ||
export declare const graphsdkModule: Native; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -17,4 +17,6 @@ "use strict"; | ||
} | ||
const graphsdk = loadNativeModule(); | ||
console.log("Loaded graphsdk.node bindings"); | ||
// Export the graphsdk module | ||
exports.graphsdkModule = loadNativeModule(); | ||
exports.graphsdkModule = graphsdk; | ||
//# sourceMappingURL=index.js.map |
@@ -5,3 +5,3 @@ "use strict"; | ||
const environment_1 = require("./models/environment"); | ||
test('printHelloGraph should print "Hello, Graph!"', async () => { | ||
test('printHelloGraph should print "Hello, Graph!"', () => { | ||
// Mock the console.log function | ||
@@ -11,6 +11,5 @@ const consoleLogMock = jest.spyOn(console, 'log').mockImplementation(); | ||
const graph = new graph_1.Graph(environment); | ||
await graph.printHelloGraph(); | ||
graph.printHelloGraph(); | ||
expect(consoleLogMock).toHaveBeenCalledWith('Hello, Graph!'); | ||
await graph.freeGraphState(); | ||
}); | ||
//# sourceMappingURL=index.test.js.map |
@@ -8,23 +8,18 @@ declare enum DsnpVersion { | ||
} | ||
declare enum PrivacyType { | ||
Public = "public", | ||
Private = "private" | ||
} | ||
interface SchemaConfig { | ||
dsnpVersion: DsnpVersion; | ||
connectionType: ConnectionType; | ||
privacyType: PrivacyType; | ||
dsnp_version: DsnpVersion; | ||
connection_type: ConnectionType; | ||
} | ||
interface Config { | ||
sdkMaxUsersGraphSize: number; | ||
sdkMaxStaleFriendshipDays: number; | ||
maxGraphPageSizeBytes: number; | ||
maxPageId: number; | ||
maxKeyPageSizeBytes: number; | ||
schemaMap: { | ||
sdk_max_users_graph_size: number; | ||
sdk_max_stale_friendship_days: number; | ||
max_graph_page_size_bytes: number; | ||
max_page_id: number; | ||
max_key_page_size_bytes: number; | ||
schema_map: { | ||
[key: string]: SchemaConfig; | ||
}; | ||
dsnpVersions: DsnpVersion[]; | ||
dsnp_versions: DsnpVersion[]; | ||
} | ||
export { Config, ConnectionType, DsnpVersion, SchemaConfig }; | ||
//# sourceMappingURL=config.d.ts.map |
@@ -13,7 +13,2 @@ "use strict"; | ||
})(ConnectionType || (exports.ConnectionType = ConnectionType = {})); | ||
var PrivacyType; | ||
(function (PrivacyType) { | ||
PrivacyType["Public"] = "public"; | ||
PrivacyType["Private"] = "private"; | ||
})(PrivacyType || (PrivacyType = {})); | ||
//# sourceMappingURL=config.js.map |
{ | ||
"name": "@dsnp/graph-sdk", | ||
"version": "0.0.0-ab5a34", | ||
"version": "0.0.0-c347d7", | ||
"author": "Amplica Labs", | ||
@@ -5,0 +5,0 @@ "license": "ISC", |
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
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
4454666
27
165
1
2