@perspect3vism/ad4m
Advanced tools
Comparing version 0.1.10 to 0.1.11
@@ -124,2 +124,10 @@ "use strict"; | ||
}); | ||
it('getMany() smoke test', async () => { | ||
const getMany = await ad4mClient.expression.getMany(["hash1", "hash2"]); | ||
console.warn("got result", getMany); | ||
expect(getMany.length).toBe(2); | ||
expect(getMany[0].author).toBe('did:ad4m:test'); | ||
expect(getMany[0].data).toBe("{\"type\":\"test expression\",\"content\":\"test\"}"); | ||
expect(getMany[1]).toBeNull(); | ||
}); | ||
it('getRaw() smoke test', async () => { | ||
@@ -126,0 +134,0 @@ const nonExisting = await ad4mClient.expression.getRaw("wrong address"); |
@@ -7,4 +7,5 @@ import { ApolloClient } from "@apollo/client"; | ||
get(url: string): Promise<ExpressionRendered>; | ||
getMany(urls: string[]): Promise<ExpressionRendered[]>; | ||
getRaw(url: string): Promise<string>; | ||
create(content: any, languageAddress: string): Promise<string>; | ||
} |
@@ -45,2 +45,22 @@ "use strict"; | ||
} | ||
async getMany(urls) { | ||
const { expressionMany } = (0, unwrapApolloResult_1.default)(await __classPrivateFieldGet(this, _ExpressionClient_apolloClient, "f").query({ | ||
query: (0, client_1.gql) `query expressionMany($urls: [String!]!) { | ||
expressionMany(urls: $urls) { | ||
author | ||
timestamp | ||
data | ||
language { | ||
address | ||
} | ||
proof { | ||
valid | ||
invalid | ||
} | ||
} | ||
}`, | ||
variables: { urls } | ||
})); | ||
return expressionMany; | ||
} | ||
async getRaw(url) { | ||
@@ -47,0 +67,0 @@ const { expressionRaw } = (0, unwrapApolloResult_1.default)(await __classPrivateFieldGet(this, _ExpressionClient_apolloClient, "f").query({ |
import { ExpressionRendered } from "./Expression"; | ||
export default class ExpressionResolver { | ||
expression(url: string): ExpressionRendered; | ||
expressionMany(urls: string[]): (ExpressionRendered | null)[]; | ||
expressionRaw(url: string): string; | ||
expressionCreate(content: string, languageAddress: string): string; | ||
} |
@@ -34,2 +34,5 @@ "use strict"; | ||
} | ||
expressionMany(urls) { | ||
return [testExpression, null]; | ||
} | ||
expressionRaw(url) { | ||
@@ -55,2 +58,9 @@ if (url === 'neighbourhood://Qm123') { | ||
__decorate([ | ||
(0, type_graphql_1.Query)(returns => [Expression_1.ExpressionRendered], { nullable: "items" }), | ||
__param(0, (0, type_graphql_1.Arg)('urls', type => [String])), | ||
__metadata("design:type", Function), | ||
__metadata("design:paramtypes", [Array]), | ||
__metadata("design:returntype", Array) | ||
], ExpressionResolver.prototype, "expressionMany", null); | ||
__decorate([ | ||
(0, type_graphql_1.Query)(returns => String, { nullable: true }), | ||
@@ -57,0 +67,0 @@ __param(0, (0, type_graphql_1.Arg)('url')), |
@@ -7,4 +7,5 @@ import { ApolloClient } from "@apollo/client"; | ||
get(url: string): Promise<ExpressionRendered>; | ||
getMany(urls: string[]): Promise<ExpressionRendered[]>; | ||
getRaw(url: string): Promise<string>; | ||
create(content: any, languageAddress: string): Promise<string>; | ||
} |
@@ -45,2 +45,22 @@ "use strict"; | ||
} | ||
async getMany(urls) { | ||
const { expressionMany } = (0, unwrapApolloResult_1.default)(await __classPrivateFieldGet(this, _ExpressionClient_apolloClient, "f").query({ | ||
query: (0, client_1.gql) `query expressionMany($urls: [String!]!) { | ||
expressionMany(urls: $urls) { | ||
author | ||
timestamp | ||
data | ||
language { | ||
address | ||
} | ||
proof { | ||
valid | ||
invalid | ||
} | ||
} | ||
}`, | ||
variables: { urls } | ||
})); | ||
return expressionMany; | ||
} | ||
async getRaw(url) { | ||
@@ -47,0 +67,0 @@ const { expressionRaw } = (0, unwrapApolloResult_1.default)(await __classPrivateFieldGet(this, _ExpressionClient_apolloClient, "f").query({ |
import { ExpressionRendered } from "./Expression"; | ||
export default class ExpressionResolver { | ||
expression(url: string): ExpressionRendered; | ||
expressionMany(urls: string[]): (ExpressionRendered | null)[]; | ||
expressionRaw(url: string): string; | ||
expressionCreate(content: string, languageAddress: string): string; | ||
} |
@@ -34,2 +34,5 @@ "use strict"; | ||
} | ||
expressionMany(urls) { | ||
return [testExpression, null]; | ||
} | ||
expressionRaw(url) { | ||
@@ -55,2 +58,9 @@ if (url === 'neighbourhood://Qm123') { | ||
__decorate([ | ||
(0, type_graphql_1.Query)(returns => [Expression_1.ExpressionRendered], { nullable: "items" }), | ||
__param(0, (0, type_graphql_1.Arg)('urls', type => [String])), | ||
__metadata("design:type", Function), | ||
__metadata("design:paramtypes", [Array]), | ||
__metadata("design:returntype", Array) | ||
], ExpressionResolver.prototype, "expressionMany", null); | ||
__decorate([ | ||
(0, type_graphql_1.Query)(returns => String, { nullable: true }), | ||
@@ -57,0 +67,0 @@ __param(0, (0, type_graphql_1.Arg)('url')), |
@@ -141,2 +141,3 @@ | ||
expression(url: String!): ExpressionRendered | ||
expressionMany(urls: [String!]!): [ExpressionRendered]! | ||
expressionRaw(url: String!): String | ||
@@ -143,0 +144,0 @@ language(address: String!): LanguageHandle |
{ | ||
"name": "@perspect3vism/ad4m", | ||
"version": "0.1.10", | ||
"version": "0.1.11", | ||
"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", |
@@ -142,2 +142,11 @@ import { buildSchema } from "type-graphql" | ||
it('getMany() smoke test', async () => { | ||
const getMany = await ad4mClient.expression.getMany(["hash1", "hash2"]); | ||
console.warn("got result", getMany); | ||
expect(getMany.length).toBe(2); | ||
expect(getMany[0].author).toBe('did:ad4m:test'); | ||
expect(getMany[0].data).toBe("{\"type\":\"test expression\",\"content\":\"test\"}"); | ||
expect(getMany[1]).toBeNull(); | ||
}) | ||
it('getRaw() smoke test', async () => { | ||
@@ -144,0 +153,0 @@ const nonExisting = await ad4mClient.expression.getRaw("wrong address") |
@@ -33,2 +33,23 @@ import { ApolloClient, gql } from "@apollo/client"; | ||
async getMany(urls: string[]): Promise<ExpressionRendered[]> { | ||
const { expressionMany } = unwrapApolloResult(await this.#apolloClient.query({ | ||
query: gql`query expressionMany($urls: [String!]!) { | ||
expressionMany(urls: $urls) { | ||
author | ||
timestamp | ||
data | ||
language { | ||
address | ||
} | ||
proof { | ||
valid | ||
invalid | ||
} | ||
} | ||
}`, | ||
variables: { urls } | ||
})) | ||
return expressionMany | ||
} | ||
async getRaw(url: string): Promise<string> { | ||
@@ -35,0 +56,0 @@ const { expressionRaw } = unwrapApolloResult(await this.#apolloClient.query({ |
@@ -24,2 +24,7 @@ import { Arg, Mutation, Query, Resolver } from "type-graphql"; | ||
@Query(returns => [ExpressionRendered], {nullable: "items"}) | ||
expressionMany(@Arg('urls', type => [String]) urls: string[]): (ExpressionRendered | null)[] { | ||
return [testExpression, null] | ||
} | ||
@Query(returns => String, {nullable: true}) | ||
@@ -26,0 +31,0 @@ expressionRaw(@Arg('url') url: string): string { |
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
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
961544
190
22972
3