@perspect3vism/ad4m
Advanced tools
Comparing version 0.1.32 to 0.1.33
@@ -12,2 +12,3 @@ import { ApolloClient } from "@apollo/client"; | ||
export declare type AgentUpdatedCallback = (agent: Agent) => null; | ||
export declare type AgentStatusChangedCallback = (agent: Agent) => null; | ||
/** | ||
@@ -41,2 +42,3 @@ * Provides access to all functions regarding the local agent, | ||
addUpdatedListener(listener: any): void; | ||
addAgentStatusChangedListener(listener: any): void; | ||
requestCapability(appName: string, appDesc: string, appUrl: string, capabilities: string): Promise<string>; | ||
@@ -43,0 +45,0 @@ permitCapability(auth: string): Promise<string>; |
@@ -16,3 +16,3 @@ "use strict"; | ||
}; | ||
var _AgentClient_apolloClient, _AgentClient_updatedCallbacks; | ||
var _AgentClient_apolloClient, _AgentClient_updatedCallbacks, _AgentClient_agentStatusChangedCallbacks; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -62,4 +62,6 @@ const client_1 = require("@apollo/client"); | ||
_AgentClient_updatedCallbacks.set(this, void 0); | ||
_AgentClient_agentStatusChangedCallbacks.set(this, void 0); | ||
__classPrivateFieldSet(this, _AgentClient_apolloClient, client, "f"); | ||
__classPrivateFieldSet(this, _AgentClient_updatedCallbacks, [], "f"); | ||
__classPrivateFieldSet(this, _AgentClient_agentStatusChangedCallbacks, [], "f"); | ||
__classPrivateFieldGet(this, _AgentClient_apolloClient, "f").subscribe({ | ||
@@ -79,2 +81,17 @@ query: (0, client_1.gql) ` subscription { | ||
}); | ||
__classPrivateFieldGet(this, _AgentClient_apolloClient, "f").subscribe({ | ||
query: (0, client_1.gql) ` subscription { | ||
agentStatusChanged { ${AGENT_STATUS_FIELDS} } | ||
} | ||
` | ||
}).subscribe({ | ||
next: result => { | ||
const agent = result.data.agentStatusChanged; | ||
__classPrivateFieldGet(this, _AgentClient_agentStatusChangedCallbacks, "f").forEach(cb => { | ||
console.log("Agent status changed: ", agent); | ||
cb(agent); | ||
}); | ||
}, | ||
error: (e) => console.error(e) | ||
}); | ||
} | ||
@@ -242,2 +259,5 @@ /** | ||
} | ||
addAgentStatusChangedListener(listener) { | ||
__classPrivateFieldGet(this, _AgentClient_agentStatusChangedCallbacks, "f").push(listener); | ||
} | ||
async requestCapability(appName, appDesc, appUrl, capabilities) { | ||
@@ -272,2 +292,2 @@ const { agentRequestCapability } = (0, unwrapApolloResult_1.default)(await __classPrivateFieldGet(this, _AgentClient_apolloClient, "f").mutate({ | ||
exports.default = AgentClient; | ||
_AgentClient_apolloClient = new WeakMap(), _AgentClient_updatedCallbacks = new WeakMap(); | ||
_AgentClient_apolloClient = new WeakMap(), _AgentClient_updatedCallbacks = new WeakMap(), _AgentClient_agentStatusChangedCallbacks = new WeakMap(); |
@@ -15,2 +15,3 @@ import { PerspectiveInput } from "../perspectives/Perspective"; | ||
agentUpdated(): Agent; | ||
agentStatusChanged(): AgentStatus; | ||
agentAddEntanglementProofs(proofs: EntanglementProofInput[]): EntanglementProof[]; | ||
@@ -17,0 +18,0 @@ agentDeleteEntanglementProofs(proofs: EntanglementProofInput[]): EntanglementProof[]; |
@@ -54,2 +54,5 @@ "use strict"; | ||
} | ||
agentStatusChanged() { | ||
return new AgentStatus_1.AgentStatus({ isInitialized: true, did: TEST_AGENT_DID }); | ||
} | ||
agentAddEntanglementProofs(proofs) { | ||
@@ -148,2 +151,8 @@ return [new Agent_1.EntanglementProof("did:key:hash", "did-key-id", "ethereum", "ethAddr", "sig", "sig2")]; | ||
__decorate([ | ||
(0, type_graphql_1.Subscription)({ topics: "", nullable: true }), | ||
__metadata("design:type", Function), | ||
__metadata("design:paramtypes", []), | ||
__metadata("design:returntype", AgentStatus_1.AgentStatus) | ||
], AgentResolver.prototype, "agentStatusChanged", null); | ||
__decorate([ | ||
(0, type_graphql_1.Mutation)(returns => [Agent_1.EntanglementProof]), | ||
@@ -150,0 +159,0 @@ __param(0, (0, type_graphql_1.Arg)('proofs', type => [Agent_1.EntanglementProofInput])), |
@@ -12,2 +12,3 @@ import { ApolloClient } from "@apollo/client"; | ||
export declare type AgentUpdatedCallback = (agent: Agent) => null; | ||
export declare type AgentStatusChangedCallback = (agent: Agent) => null; | ||
/** | ||
@@ -41,2 +42,3 @@ * Provides access to all functions regarding the local agent, | ||
addUpdatedListener(listener: any): void; | ||
addAgentStatusChangedListener(listener: any): void; | ||
requestCapability(appName: string, appDesc: string, appUrl: string, capabilities: string): Promise<string>; | ||
@@ -43,0 +45,0 @@ permitCapability(auth: string): Promise<string>; |
@@ -16,3 +16,3 @@ "use strict"; | ||
}; | ||
var _AgentClient_apolloClient, _AgentClient_updatedCallbacks; | ||
var _AgentClient_apolloClient, _AgentClient_updatedCallbacks, _AgentClient_agentStatusChangedCallbacks; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -62,4 +62,6 @@ const client_1 = require("@apollo/client"); | ||
_AgentClient_updatedCallbacks.set(this, void 0); | ||
_AgentClient_agentStatusChangedCallbacks.set(this, void 0); | ||
__classPrivateFieldSet(this, _AgentClient_apolloClient, client, "f"); | ||
__classPrivateFieldSet(this, _AgentClient_updatedCallbacks, [], "f"); | ||
__classPrivateFieldSet(this, _AgentClient_agentStatusChangedCallbacks, [], "f"); | ||
__classPrivateFieldGet(this, _AgentClient_apolloClient, "f").subscribe({ | ||
@@ -79,2 +81,17 @@ query: (0, client_1.gql) ` subscription { | ||
}); | ||
__classPrivateFieldGet(this, _AgentClient_apolloClient, "f").subscribe({ | ||
query: (0, client_1.gql) ` subscription { | ||
agentStatusChanged { ${AGENT_STATUS_FIELDS} } | ||
} | ||
` | ||
}).subscribe({ | ||
next: result => { | ||
const agent = result.data.agentStatusChanged; | ||
__classPrivateFieldGet(this, _AgentClient_agentStatusChangedCallbacks, "f").forEach(cb => { | ||
console.log("Agent status changed: ", agent); | ||
cb(agent); | ||
}); | ||
}, | ||
error: (e) => console.error(e) | ||
}); | ||
} | ||
@@ -242,2 +259,5 @@ /** | ||
} | ||
addAgentStatusChangedListener(listener) { | ||
__classPrivateFieldGet(this, _AgentClient_agentStatusChangedCallbacks, "f").push(listener); | ||
} | ||
async requestCapability(appName, appDesc, appUrl, capabilities) { | ||
@@ -272,2 +292,2 @@ const { agentRequestCapability } = (0, unwrapApolloResult_1.default)(await __classPrivateFieldGet(this, _AgentClient_apolloClient, "f").mutate({ | ||
exports.default = AgentClient; | ||
_AgentClient_apolloClient = new WeakMap(), _AgentClient_updatedCallbacks = new WeakMap(); | ||
_AgentClient_apolloClient = new WeakMap(), _AgentClient_updatedCallbacks = new WeakMap(), _AgentClient_agentStatusChangedCallbacks = new WeakMap(); |
@@ -15,2 +15,3 @@ import { PerspectiveInput } from "../perspectives/Perspective"; | ||
agentUpdated(): Agent; | ||
agentStatusChanged(): AgentStatus; | ||
agentAddEntanglementProofs(proofs: EntanglementProofInput[]): EntanglementProof[]; | ||
@@ -17,0 +18,0 @@ agentDeleteEntanglementProofs(proofs: EntanglementProofInput[]): EntanglementProof[]; |
@@ -54,2 +54,5 @@ "use strict"; | ||
} | ||
agentStatusChanged() { | ||
return new AgentStatus_1.AgentStatus({ isInitialized: true, did: TEST_AGENT_DID }); | ||
} | ||
agentAddEntanglementProofs(proofs) { | ||
@@ -148,2 +151,8 @@ return [new Agent_1.EntanglementProof("did:key:hash", "did-key-id", "ethereum", "ethAddr", "sig", "sig2")]; | ||
__decorate([ | ||
(0, type_graphql_1.Subscription)({ topics: "", nullable: true }), | ||
__metadata("design:type", Function), | ||
__metadata("design:paramtypes", []), | ||
__metadata("design:returntype", AgentStatus_1.AgentStatus) | ||
], AgentResolver.prototype, "agentStatusChanged", null); | ||
__decorate([ | ||
(0, type_graphql_1.Mutation)(returns => [Agent_1.EntanglementProof]), | ||
@@ -150,0 +159,0 @@ __param(0, (0, type_graphql_1.Arg)('proofs', type => [Agent_1.EntanglementProofInput])), |
@@ -261,2 +261,3 @@ | ||
type Subscription { | ||
agentStatusChanged: AgentStatus | ||
agentUpdated: Agent | ||
@@ -263,0 +264,0 @@ exceptionOccurred: ExceptionInfo |
@@ -261,2 +261,3 @@ | ||
type Subscription { | ||
agentStatusChanged: AgentStatus | ||
agentUpdated: Agent | ||
@@ -263,0 +264,0 @@ exceptionOccurred: ExceptionInfo |
{ | ||
"name": "@perspect3vism/ad4m", | ||
"version": "0.1.32", | ||
"version": "0.1.33", | ||
"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", |
@@ -48,2 +48,3 @@ import { ApolloClient, gql } from "@apollo/client"; | ||
export type AgentUpdatedCallback = (agent: Agent) => null | ||
export type AgentStatusChangedCallback = (agent: Agent) => null | ||
/** | ||
@@ -57,2 +58,3 @@ * Provides access to all functions regarding the local agent, | ||
#updatedCallbacks: AgentUpdatedCallback[] | ||
#agentStatusChangedCallbacks: AgentStatusChangedCallback[] | ||
@@ -62,2 +64,3 @@ constructor(client: ApolloClient<any>) { | ||
this.#updatedCallbacks = [] | ||
this.#agentStatusChangedCallbacks = [] | ||
@@ -77,2 +80,17 @@ this.#apolloClient.subscribe({ | ||
}) | ||
this.#apolloClient.subscribe({ | ||
query: gql` subscription { | ||
agentStatusChanged { ${AGENT_STATUS_FIELDS} } | ||
} | ||
`}).subscribe({ | ||
next: result => { | ||
const agent = result.data.agentStatusChanged | ||
this.#agentStatusChangedCallbacks.forEach(cb => { | ||
console.log("Agent status changed: ", agent) | ||
cb(agent) | ||
}) | ||
}, | ||
error: (e) => console.error(e) | ||
}) | ||
} | ||
@@ -257,2 +275,6 @@ | ||
addAgentStatusChangedListener(listener) { | ||
this.#agentStatusChangedCallbacks.push(listener) | ||
} | ||
async requestCapability(appName: string, appDesc: string, appUrl: string, capabilities: string): Promise<string> { | ||
@@ -259,0 +281,0 @@ const { agentRequestCapability } = unwrapApolloResult(await this.#apolloClient.mutate({ |
@@ -75,2 +75,7 @@ import { Arg, Mutation, Query, Resolver, Subscription } from "type-graphql"; | ||
@Subscription({topics: "", nullable: true}) | ||
agentStatusChanged(): AgentStatus { | ||
return new AgentStatus({isInitialized: true, did: TEST_AGENT_DID}) | ||
} | ||
@Mutation(returns => [EntanglementProof]) | ||
@@ -77,0 +82,0 @@ agentAddEntanglementProofs(@Arg('proofs', type => [EntanglementProofInput]) proofs: EntanglementProofInput[]): EntanglementProof[] { |
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
1287490
29650