@dsnp/graph-sdk
Advanced tools
Comparing version 0.0.0-a2963e to 0.0.0-a55c8a
@@ -0,9 +1,29 @@ | ||
import { Native } from "./index"; | ||
import { ImportBundle, Update, DsnpGraphEdge, Action, DsnpPublicKey, DsnpKeys } from "./models"; | ||
import { Config } from "./models/config"; | ||
import { EnvironmentInterface } from "./models/environment"; | ||
export declare class Graph { | ||
export declare class Graph implements Native { | ||
private handle; | ||
constructor(environment: EnvironmentInterface, capacity?: number); | ||
getGraphConfig(environment: EnvironmentInterface): Config; | ||
initializeGraphState(environment: EnvironmentInterface): number; | ||
initializeGraphStateWithCapacity(environment: EnvironmentInterface, capacity: number): number; | ||
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>; | ||
getGraphConfig(environment: EnvironmentInterface): Promise<Config>; | ||
printHelloGraph(): void; | ||
} | ||
//# sourceMappingURL=graph.d.ts.map |
@@ -14,2 +14,56 @@ "use strict"; | ||
} | ||
initializeGraphState(environment) { | ||
throw new Error("Method not implemented."); | ||
} | ||
initializeGraphStateWithCapacity(environment, capacity) { | ||
throw new Error("Method not implemented."); | ||
} | ||
getGraphCapacity(handle) { | ||
throw new Error("Method not implemented."); | ||
} | ||
getGraphSize(handle) { | ||
throw new Error("Method not implemented."); | ||
} | ||
containsUserGraph(handle, dsnpUserId) { | ||
throw new Error("Method not implemented."); | ||
} | ||
getGraphUsersCount(handle) { | ||
throw new Error("Method not implemented."); | ||
} | ||
removeUserGraph(handle, dsnpUserId) { | ||
throw new Error("Method not implemented."); | ||
} | ||
importUserData(handle, payload) { | ||
throw new Error("Method not implemented."); | ||
} | ||
exportUpdates(handle) { | ||
throw new Error("Method not implemented."); | ||
} | ||
getConnectionsForUserGraphUpdates(handle, dsnpUserId, schemaId, includePending) { | ||
throw new Error("Method not implemented."); | ||
} | ||
applyActions(handle, actions) { | ||
throw new Error("Method not implemented."); | ||
} | ||
forceCalculateGraphs(handle, dsnpUserId) { | ||
throw new Error("Method not implemented."); | ||
} | ||
getConnectionsWithoutKeys(handle) { | ||
throw new Error("Method not implemented."); | ||
} | ||
getOneSidedPrivateFriendshipConnections(handle, dsnpUserId) { | ||
throw new Error("Method not implemented."); | ||
} | ||
getPublicKeys(handle, dsnpUserId) { | ||
throw new Error("Method not implemented."); | ||
} | ||
deserializeDsnpKeys(keys) { | ||
throw new Error("Method not implemented."); | ||
} | ||
freeGraphState(handle) { | ||
throw new Error("Method not implemented."); | ||
} | ||
freeAllGraphStates() { | ||
throw new Error("Method not implemented."); | ||
} | ||
getGraphConfig(environment) { | ||
@@ -16,0 +70,0 @@ return index_1.graphsdkModule.getGraphConfig(environment); |
@@ -5,3 +5,3 @@ "use strict"; | ||
const environment_1 = require("./models/environment"); | ||
test('printHelloGraph should print "Hello, Graph!"', () => { | ||
test('printHelloGraph should print "Hello, Graph!"', async () => { | ||
// Mock the console.log function | ||
@@ -11,11 +11,26 @@ const consoleLogMock = jest.spyOn(console, 'log').mockImplementation(); | ||
const graph = new graph_1.Graph(environment); | ||
graph.printHelloGraph(); | ||
await graph.printHelloGraph(); | ||
expect(consoleLogMock).toHaveBeenCalledWith('Hello, Graph!'); | ||
}); | ||
test('getGraphConfig should return the graph config', () => { | ||
test('getGraphConfig should return the graph config', async () => { | ||
const environment = { environmentType: environment_1.EnvironmentType.Dev, config: {} }; | ||
const graph = new graph_1.Graph(environment); | ||
const config = graph.getGraphConfig(environment); | ||
const config = await graph.getGraphConfig(environment); | ||
expect(config).toBeDefined(); | ||
expect(config.sdkMaxUsersGraphSize).toEqual(1000); | ||
}); | ||
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); | ||
}); | ||
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); | ||
}); | ||
//# sourceMappingURL=graph.test.js.map |
@@ -1,23 +0,25 @@ | ||
import { EnvironmentInterface } from "./models/environment"; | ||
import { Config } from "./models/config"; | ||
import { Action, Config, DsnpGraphEdge, DsnpKeys, DsnpPublicKey, EnvironmentInterface, ImportBundle, Update } from "./models"; | ||
export interface Native { | ||
printHelloGraph(): void; | ||
getGraphConfig(environment: EnvironmentInterface): Config; | ||
initializeGraphState(environment: EnvironmentInterface): number; | ||
initializeGraphStateWithCapacity(environment: EnvironmentInterface, capacity: number): number; | ||
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; | ||
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>; | ||
} | ||
export declare const graphsdkModule: Native; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -17,6 +17,4 @@ "use strict"; | ||
} | ||
const graphsdk = loadNativeModule(); | ||
console.log("Loaded graphsdk.node bindings"); | ||
// Export the graphsdk module | ||
exports.graphsdkModule = graphsdk; | ||
exports.graphsdkModule = loadNativeModule(); | ||
//# sourceMappingURL=index.js.map |
@@ -5,3 +5,3 @@ "use strict"; | ||
const environment_1 = require("./models/environment"); | ||
test('printHelloGraph should print "Hello, Graph!"', () => { | ||
test('printHelloGraph should print "Hello, Graph!"', async () => { | ||
// Mock the console.log function | ||
@@ -11,5 +11,5 @@ const consoleLogMock = jest.spyOn(console, 'log').mockImplementation(); | ||
const graph = new graph_1.Graph(environment); | ||
graph.printHelloGraph(); | ||
await graph.printHelloGraph(); | ||
expect(consoleLogMock).toHaveBeenCalledWith('Hello, Graph!'); | ||
}); | ||
//# sourceMappingURL=index.test.js.map |
@@ -8,18 +8,23 @@ declare enum DsnpVersion { | ||
} | ||
declare enum PrivacyType { | ||
Public = "public", | ||
Private = "private" | ||
} | ||
interface SchemaConfig { | ||
dsnp_version: DsnpVersion; | ||
connection_type: ConnectionType; | ||
dsnpVersion: DsnpVersion; | ||
connectionType: ConnectionType; | ||
privacyType: PrivacyType; | ||
} | ||
interface Config { | ||
sdk_max_users_graph_size: number; | ||
sdk_max_stale_friendship_days: number; | ||
max_graph_page_size_bytes: number; | ||
max_page_id: number; | ||
sdkMaxUsersGraphSize: number; | ||
sdkMaxStaleFriendshipDays: number; | ||
maxGraphPageSizeBytes: number; | ||
maxPageId: number; | ||
max_key_page_size_bytes: number; | ||
schema_map: { | ||
schemaMap: { | ||
[key: string]: SchemaConfig; | ||
}; | ||
dsnp_versions: DsnpVersion[]; | ||
dsnpVersions: DsnpVersion[]; | ||
} | ||
export { Config, ConnectionType, DsnpVersion, SchemaConfig }; | ||
//# sourceMappingURL=config.d.ts.map |
@@ -13,2 +13,7 @@ "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-a2963e", | ||
"version": "0.0.0-a55c8a", | ||
"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
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
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
4469462
55
397
1
1
2