@perspect3vism/ad4m
Advanced tools
Comparing version 0.1.29 to 0.1.30
@@ -148,2 +148,14 @@ "use strict"; | ||
}); | ||
it('requestCapability() smoke tests', async () => { | ||
const requestId = await ad4mClient.agent.requestCapability("demo-app", "demo-desc", "https://demo-link", '[{"with":{"domain":"agent","pointers":["*"]},"can":["QUERY"]}]'); | ||
expect(requestId).toBe("test-request-id"); | ||
}); | ||
it('agentPermitCapability() smoke tests', async () => { | ||
const rand = await ad4mClient.agent.permitCapability('{"requestId":"4f30e2e2-d307-4f2b-b0a0-6dac4ca4af26","auth":{"appName":"demo-app","appDesc":"demo-desc","appUrl":"demo-url","capabilities":[{"with":{"domain":"agent","pointers":["*"]},"can":["QUERY"]}]}}'); | ||
expect(rand).toBe("123"); | ||
}); | ||
it('agentGenerateJwt() smoke tests', async () => { | ||
const jwt = await ad4mClient.agent.generateJwt("test-request-id", "123"); | ||
expect(jwt).toBe("test-jwt"); | ||
}); | ||
}); | ||
@@ -150,0 +162,0 @@ describe('.expression', () => { |
@@ -40,2 +40,5 @@ import { ApolloClient } from "@apollo/client"; | ||
addUpdatedListener(listener: any): void; | ||
requestCapability(appName: string, appDesc: string, appUrl: string, capabilities: string): Promise<string>; | ||
permitCapability(auth: string): Promise<string>; | ||
generateJwt(requestId: string, rand: string): Promise<string>; | ||
} |
@@ -42,2 +42,3 @@ "use strict"; | ||
didDocument | ||
error | ||
`; | ||
@@ -239,4 +240,31 @@ const ENTANGLEMENT_PROOF_FIELDS = ` | ||
} | ||
async requestCapability(appName, appDesc, appUrl, capabilities) { | ||
const { agentRequestCapability } = (0, unwrapApolloResult_1.default)(await __classPrivateFieldGet(this, _AgentClient_apolloClient, "f").mutate({ | ||
mutation: (0, client_1.gql) `mutation agentRequestCapability($appName: String!, $appDesc: String!, $appUrl: String!, $capabilities: String!) { | ||
agentRequestCapability(appName: $appName, appDesc: $appDesc, appUrl: $appUrl, capabilities: $capabilities) | ||
}`, | ||
variables: { appName, appDesc, appUrl, capabilities } | ||
})); | ||
return agentRequestCapability; | ||
} | ||
async permitCapability(auth) { | ||
const { agentPermitCapability } = (0, unwrapApolloResult_1.default)(await __classPrivateFieldGet(this, _AgentClient_apolloClient, "f").mutate({ | ||
mutation: (0, client_1.gql) `mutation agentPermitCapability($auth: String!) { | ||
agentPermitCapability(auth: $auth) | ||
}`, | ||
variables: { auth } | ||
})); | ||
return agentPermitCapability; | ||
} | ||
async generateJwt(requestId, rand) { | ||
const { agentGenerateJwt } = (0, unwrapApolloResult_1.default)(await __classPrivateFieldGet(this, _AgentClient_apolloClient, "f").mutate({ | ||
mutation: (0, client_1.gql) `mutation agentGenerateJwt($requestId: String!, $rand: String!) { | ||
agentGenerateJwt(requestId: $requestId, rand: $rand) | ||
}`, | ||
variables: { requestId, rand } | ||
})); | ||
return agentGenerateJwt; | ||
} | ||
} | ||
exports.default = AgentClient; | ||
_AgentClient_apolloClient = new WeakMap(), _AgentClient_updatedCallbacks = new WeakMap(); |
@@ -19,2 +19,5 @@ import { PerspectiveInput } from "../perspectives/Perspective"; | ||
agentEntanglementProofPreFlight(deviceKey: string, deviceKeyType: string): EntanglementProof; | ||
agentRequestCapability(appName: string, appDesc: string, appUrl: string, capabilities: string): String; | ||
agentPermitCapability(auth: string): String; | ||
agentGenerateJwt(requestId: string, rand: string): String; | ||
} |
@@ -66,2 +66,11 @@ "use strict"; | ||
} | ||
agentRequestCapability(appName, appDesc, appUrl, capabilities) { | ||
return "test-request-id"; | ||
} | ||
agentPermitCapability(auth) { | ||
return "123"; | ||
} | ||
agentGenerateJwt(requestId, rand) { | ||
return "test-jwt"; | ||
} | ||
}; | ||
@@ -166,2 +175,27 @@ __decorate([ | ||
], AgentResolver.prototype, "agentEntanglementProofPreFlight", null); | ||
__decorate([ | ||
(0, type_graphql_1.Mutation)(returns => String), | ||
__param(0, (0, type_graphql_1.Arg)('appName')), | ||
__param(1, (0, type_graphql_1.Arg)('appDesc')), | ||
__param(2, (0, type_graphql_1.Arg)('appUrl')), | ||
__param(3, (0, type_graphql_1.Arg)('capabilities')), | ||
__metadata("design:type", Function), | ||
__metadata("design:paramtypes", [String, String, String, String]), | ||
__metadata("design:returntype", String) | ||
], AgentResolver.prototype, "agentRequestCapability", null); | ||
__decorate([ | ||
(0, type_graphql_1.Mutation)(returns => String), | ||
__param(0, (0, type_graphql_1.Arg)('auth')), | ||
__metadata("design:type", Function), | ||
__metadata("design:paramtypes", [String]), | ||
__metadata("design:returntype", String) | ||
], AgentResolver.prototype, "agentPermitCapability", null); | ||
__decorate([ | ||
(0, type_graphql_1.Mutation)(returns => String), | ||
__param(0, (0, type_graphql_1.Arg)('requestId')), | ||
__param(1, (0, type_graphql_1.Arg)('rand')), | ||
__metadata("design:type", Function), | ||
__metadata("design:paramtypes", [String, String]), | ||
__metadata("design:returntype", String) | ||
], AgentResolver.prototype, "agentGenerateJwt", null); | ||
AgentResolver = __decorate([ | ||
@@ -168,0 +202,0 @@ (0, type_graphql_1.Resolver)() |
export declare enum ExceptionType { | ||
LanguageIsNotLoaded = 0, | ||
ExpressionIsNotVerified = 1, | ||
AgentIsUntrusted = 2 | ||
AgentIsUntrusted = 2, | ||
CapabilityRequested = 3 | ||
} |
@@ -9,2 +9,3 @@ "use strict"; | ||
ExceptionType[ExceptionType["AgentIsUntrusted"] = 2] = "AgentIsUntrusted"; | ||
ExceptionType[ExceptionType["CapabilityRequested"] = 3] = "CapabilityRequested"; | ||
})(ExceptionType = exports.ExceptionType || (exports.ExceptionType = {})); |
@@ -40,2 +40,5 @@ import { ApolloClient } from "@apollo/client"; | ||
addUpdatedListener(listener: any): void; | ||
requestCapability(appName: string, appDesc: string, appUrl: string, capabilities: string): Promise<string>; | ||
permitCapability(auth: string): Promise<string>; | ||
generateJwt(requestId: string, rand: string): Promise<string>; | ||
} |
@@ -42,2 +42,3 @@ "use strict"; | ||
didDocument | ||
error | ||
`; | ||
@@ -239,4 +240,31 @@ const ENTANGLEMENT_PROOF_FIELDS = ` | ||
} | ||
async requestCapability(appName, appDesc, appUrl, capabilities) { | ||
const { agentRequestCapability } = (0, unwrapApolloResult_1.default)(await __classPrivateFieldGet(this, _AgentClient_apolloClient, "f").mutate({ | ||
mutation: (0, client_1.gql) `mutation agentRequestCapability($appName: String!, $appDesc: String!, $appUrl: String!, $capabilities: String!) { | ||
agentRequestCapability(appName: $appName, appDesc: $appDesc, appUrl: $appUrl, capabilities: $capabilities) | ||
}`, | ||
variables: { appName, appDesc, appUrl, capabilities } | ||
})); | ||
return agentRequestCapability; | ||
} | ||
async permitCapability(auth) { | ||
const { agentPermitCapability } = (0, unwrapApolloResult_1.default)(await __classPrivateFieldGet(this, _AgentClient_apolloClient, "f").mutate({ | ||
mutation: (0, client_1.gql) `mutation agentPermitCapability($auth: String!) { | ||
agentPermitCapability(auth: $auth) | ||
}`, | ||
variables: { auth } | ||
})); | ||
return agentPermitCapability; | ||
} | ||
async generateJwt(requestId, rand) { | ||
const { agentGenerateJwt } = (0, unwrapApolloResult_1.default)(await __classPrivateFieldGet(this, _AgentClient_apolloClient, "f").mutate({ | ||
mutation: (0, client_1.gql) `mutation agentGenerateJwt($requestId: String!, $rand: String!) { | ||
agentGenerateJwt(requestId: $requestId, rand: $rand) | ||
}`, | ||
variables: { requestId, rand } | ||
})); | ||
return agentGenerateJwt; | ||
} | ||
} | ||
exports.default = AgentClient; | ||
_AgentClient_apolloClient = new WeakMap(), _AgentClient_updatedCallbacks = new WeakMap(); |
@@ -19,2 +19,5 @@ import { PerspectiveInput } from "../perspectives/Perspective"; | ||
agentEntanglementProofPreFlight(deviceKey: string, deviceKeyType: string): EntanglementProof; | ||
agentRequestCapability(appName: string, appDesc: string, appUrl: string, capabilities: string): String; | ||
agentPermitCapability(auth: string): String; | ||
agentGenerateJwt(requestId: string, rand: string): String; | ||
} |
@@ -66,2 +66,11 @@ "use strict"; | ||
} | ||
agentRequestCapability(appName, appDesc, appUrl, capabilities) { | ||
return "test-request-id"; | ||
} | ||
agentPermitCapability(auth) { | ||
return "123"; | ||
} | ||
agentGenerateJwt(requestId, rand) { | ||
return "test-jwt"; | ||
} | ||
}; | ||
@@ -166,2 +175,27 @@ __decorate([ | ||
], AgentResolver.prototype, "agentEntanglementProofPreFlight", null); | ||
__decorate([ | ||
(0, type_graphql_1.Mutation)(returns => String), | ||
__param(0, (0, type_graphql_1.Arg)('appName')), | ||
__param(1, (0, type_graphql_1.Arg)('appDesc')), | ||
__param(2, (0, type_graphql_1.Arg)('appUrl')), | ||
__param(3, (0, type_graphql_1.Arg)('capabilities')), | ||
__metadata("design:type", Function), | ||
__metadata("design:paramtypes", [String, String, String, String]), | ||
__metadata("design:returntype", String) | ||
], AgentResolver.prototype, "agentRequestCapability", null); | ||
__decorate([ | ||
(0, type_graphql_1.Mutation)(returns => String), | ||
__param(0, (0, type_graphql_1.Arg)('auth')), | ||
__metadata("design:type", Function), | ||
__metadata("design:paramtypes", [String]), | ||
__metadata("design:returntype", String) | ||
], AgentResolver.prototype, "agentPermitCapability", null); | ||
__decorate([ | ||
(0, type_graphql_1.Mutation)(returns => String), | ||
__param(0, (0, type_graphql_1.Arg)('requestId')), | ||
__param(1, (0, type_graphql_1.Arg)('rand')), | ||
__metadata("design:type", Function), | ||
__metadata("design:paramtypes", [String, String]), | ||
__metadata("design:returntype", String) | ||
], AgentResolver.prototype, "agentGenerateJwt", null); | ||
AgentResolver = __decorate([ | ||
@@ -168,0 +202,0 @@ (0, type_graphql_1.Resolver)() |
export declare enum ExceptionType { | ||
LanguageIsNotLoaded = 0, | ||
ExpressionIsNotVerified = 1, | ||
AgentIsUntrusted = 2 | ||
AgentIsUntrusted = 2, | ||
CapabilityRequested = 3 | ||
} |
@@ -9,2 +9,3 @@ "use strict"; | ||
ExceptionType[ExceptionType["AgentIsUntrusted"] = 2] = "AgentIsUntrusted"; | ||
ExceptionType[ExceptionType["CapabilityRequested"] = 3] = "CapabilityRequested"; | ||
})(ExceptionType = exports.ExceptionType || (exports.ExceptionType = {})); |
@@ -161,4 +161,7 @@ | ||
agentGenerate(passphrase: String!): AgentStatus! | ||
agentGenerateJwt(rand: String!, requestId: String!): String! | ||
agentImport(did: String!, didDocument: String!, keystore: String!, passphrase: String!): AgentStatus! | ||
agentLock(passphrase: String!): AgentStatus! | ||
agentPermitCapability(auth: String!): String! | ||
agentRequestCapability(appDesc: String!, appName: String!, appUrl: String!, capabilities: String!): String! | ||
agentUnlock(passphrase: String!): AgentStatus! | ||
@@ -165,0 +168,0 @@ agentUpdateDirectMessageLanguage(directMessageLanguage: String!): Agent! |
@@ -161,4 +161,7 @@ | ||
agentGenerate(passphrase: String!): AgentStatus! | ||
agentGenerateJwt(rand: String!, requestId: String!): String! | ||
agentImport(did: String!, didDocument: String!, keystore: String!, passphrase: String!): AgentStatus! | ||
agentLock(passphrase: String!): AgentStatus! | ||
agentPermitCapability(auth: String!): String! | ||
agentRequestCapability(appDesc: String!, appName: String!, appUrl: String!, capabilities: String!): String! | ||
agentUnlock(passphrase: String!): AgentStatus! | ||
@@ -165,0 +168,0 @@ agentUpdateDirectMessageLanguage(directMessageLanguage: String!): Agent! |
{ | ||
"name": "@perspect3vism/ad4m", | ||
"version": "0.1.29", | ||
"version": "0.1.30", | ||
"description": "*The Agent-Centric Distributed Application Meta-ontology* or just: *Agent-Centric DApp Meta-ontology* * A new meta-ontology for interoperable, decentralized application design * A spanning-layer to enable seamless integration between Holochain DNAs, blockchains, linked-data structures/ontologies and centralized back-ends * The basis for turning distinct, monolithic and siloed apps into a global, open and interoperable sense-making network", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -167,2 +167,17 @@ import { buildSchema } from "type-graphql" | ||
}) | ||
it('requestCapability() smoke tests', async () => { | ||
const requestId = await ad4mClient.agent.requestCapability("demo-app", "demo-desc", "https://demo-link", '[{"with":{"domain":"agent","pointers":["*"]},"can":["QUERY"]}]') | ||
expect(requestId).toBe("test-request-id") | ||
}) | ||
it('agentPermitCapability() smoke tests', async () => { | ||
const rand = await ad4mClient.agent.permitCapability('{"requestId":"4f30e2e2-d307-4f2b-b0a0-6dac4ca4af26","auth":{"appName":"demo-app","appDesc":"demo-desc","appUrl":"demo-url","capabilities":[{"with":{"domain":"agent","pointers":["*"]},"can":["QUERY"]}]}}') | ||
expect(rand).toBe("123") | ||
}) | ||
it('agentGenerateJwt() smoke tests', async () => { | ||
const jwt = await ad4mClient.agent.generateJwt("test-request-id", "123") | ||
expect(jwt).toBe("test-jwt") | ||
}) | ||
}) | ||
@@ -169,0 +184,0 @@ |
@@ -28,2 +28,3 @@ import { ApolloClient, gql } from "@apollo/client"; | ||
didDocument | ||
error | ||
` | ||
@@ -252,2 +253,32 @@ | ||
} | ||
} | ||
async requestCapability(appName: string, appDesc: string, appUrl: string, capabilities: string): Promise<string> { | ||
const { agentRequestCapability } = unwrapApolloResult(await this.#apolloClient.mutate({ | ||
mutation: gql`mutation agentRequestCapability($appName: String!, $appDesc: String!, $appUrl: String!, $capabilities: String!) { | ||
agentRequestCapability(appName: $appName, appDesc: $appDesc, appUrl: $appUrl, capabilities: $capabilities) | ||
}`, | ||
variables: { appName, appDesc, appUrl, capabilities } | ||
})) | ||
return agentRequestCapability | ||
} | ||
async permitCapability(auth: string): Promise<string> { | ||
const { agentPermitCapability } = unwrapApolloResult(await this.#apolloClient.mutate({ | ||
mutation: gql`mutation agentPermitCapability($auth: String!) { | ||
agentPermitCapability(auth: $auth) | ||
}`, | ||
variables: { auth } | ||
})) | ||
return agentPermitCapability | ||
} | ||
async generateJwt(requestId: string, rand: string): Promise<string> { | ||
const { agentGenerateJwt } = unwrapApolloResult(await this.#apolloClient.mutate({ | ||
mutation: gql`mutation agentGenerateJwt($requestId: String!, $rand: String!) { | ||
agentGenerateJwt(requestId: $requestId, rand: $rand) | ||
}`, | ||
variables: { requestId, rand } | ||
})) | ||
return agentGenerateJwt | ||
} | ||
} |
@@ -94,2 +94,22 @@ import { Arg, Mutation, Query, Resolver, Subscription } from "type-graphql"; | ||
} | ||
@Mutation(returns => String) | ||
agentRequestCapability( | ||
@Arg('appName') appName: string, | ||
@Arg('appDesc') appDesc: string, | ||
@Arg('appUrl') appUrl: string, | ||
@Arg('capabilities') capabilities: string | ||
): String { | ||
return "test-request-id" | ||
} | ||
@Mutation(returns => String) | ||
agentPermitCapability(@Arg('auth') auth: string): String { | ||
return "123" | ||
} | ||
@Mutation(returns => String) | ||
agentGenerateJwt(@Arg('requestId') requestId: string, @Arg('rand') rand: string): String { | ||
return "test-jwt" | ||
} | ||
} |
@@ -5,2 +5,3 @@ export enum ExceptionType { | ||
AgentIsUntrusted, | ||
CapabilityRequested, | ||
} |
Sorry, the diff of this file is too big to display
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
1251391
28902
207