Skip to content

Commit 33f6b05

Browse files
authored
Merge pull request #267 from Web3-API/prealpha-dev
Prep 0.0.1-prealpha.12
2 parents 81d1113 + 6665815 commit 33f6b05

26 files changed

Lines changed: 211 additions & 41 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# Web3API 0.0.1-prealpha.12
2+
## Bug Fixes
3+
* Added schemas to plugin manifest modules, removing the need for `import_redirects`.
4+
* Fixed the IpfsPlugin's `addFile` method.
5+
* Improved the api/assemblyscript template project.
6+
17
# Web3API 0.0.1-prealpha.11
28
## Bug Fixes
39
* `@web3api/cli`: Include the internationalization JSON files in the published package.

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.0.1-prealpha.11
1+
0.0.1-prealpha.12

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"build": "lerna run build --no-private --ignore @web3api/cli* --ignore @web3api/react && lerna run build --scope @web3api/client-js --scope @web3api/react && lerna run build --scope @web3api/cli",
1919
"lint": "lerna run lint",
2020
"lint:fix": "lerna run lint -- --fix",
21-
"lint:ci": "lerna run lint --parallel",
21+
"lint:ci": "lerna run lint",
2222
"test": "lerna run test --no-private --ignore @web3api/client-js && lerna run test --scope @web3api/client-js",
2323
"test:ci": "lerna run test:ci --no-private --ignore @web3api/client-js && lerna run test:ci --scope @web3api/client-js",
2424
"version:apply": "npx lerna version $(cat VERSION) --exact --no-git-tag-version --yes",

packages/js/plugins/ens/src/manifest.ts

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,27 @@ import { PluginManifest, Uri } from "@web3api/core-js";
33
export const manifest: PluginManifest = {
44
// TODO: use the schema.graphql
55
// https://github.com/web3-api/monorepo/issues/101
6-
schema: "type Query { dummy: String }",
6+
schema: `
7+
# TODO: should import and "implements" the api-resolver core-api schema
8+
# https://github.com/Web3-API/monorepo/issues/75
9+
10+
type Query {
11+
tryResolveUri(
12+
authority: String!
13+
path: String!
14+
): ApiResolver_MaybeUriOrManifest
15+
16+
getFile(
17+
path: String!
18+
): Bytes
19+
}
20+
21+
# TODO: should get replaced with an import
22+
# https://github.com/Web3-API/monorepo/issues/75
23+
type ApiResolver_MaybeUriOrManifest {
24+
uri: String
25+
manifest: String
26+
}`,
727
implemented: [new Uri("w3/api-resolver")],
828
imported: [new Uri("ens/ethereum.web3api.eth")],
929
};

packages/js/plugins/ethereum/src/manifest.ts

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,27 @@ import { PluginManifest } from "@web3api/core-js";
33
export const manifest: PluginManifest = {
44
// TODO: use the schema.graphql
55
// https://github.com/web3-api/monorepo/issues/101
6-
schema: "type Query { dummy: String }",
6+
schema: `
7+
type Query {
8+
callView(
9+
address: String!
10+
method: String!
11+
args: [String!]!
12+
): String!
13+
}
14+
15+
type Mutation {
16+
sendTransaction(
17+
address: String!
18+
method: String!
19+
args: [String!]!
20+
): String!
21+
22+
deployContract(
23+
abi: String!
24+
bytecode: String!
25+
): String!
26+
}`,
727
implemented: [],
828
imported: [],
929
};

packages/js/plugins/graph-node/src/manifest.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,15 @@ import { PluginManifest } from "@web3api/core-js";
33
export const manifest: PluginManifest = {
44
// TODO: use the schema.graphql
55
// https://github.com/web3-api/monorepo/issues/101
6-
schema: "type Query { dummy: String }",
6+
schema: `
7+
type Query {
8+
querySubgraph(
9+
subgraphId: String!
10+
query: String!
11+
): String! """JSON!"""
12+
"""TODO: support JSON type as base type?"""
13+
"""I think this would be helpful for dynamic data"""
14+
}`,
715
implemented: [],
816
imported: [],
917
};

packages/js/plugins/http/src/manifest.ts

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,46 @@ import { PluginManifest } from "@web3api/core-js";
33
export const manifest: PluginManifest = {
44
// TODO: use the schema.graphql
55
// https://github.com/web3-api/monorepo/issues/101
6-
schema: "type Query { dummy: String }",
6+
schema: `
7+
type Header {
8+
key: String!
9+
value: String!
10+
}
11+
12+
type UrlParam {
13+
key: String!
14+
value: String!
15+
}
16+
17+
type Response {
18+
status: Int!
19+
statusText: String!
20+
headers: [Header!]
21+
body: String
22+
}
23+
24+
type Request {
25+
headers: [Header!]
26+
urlParams: [UrlParam!]
27+
responseType: String! # "TEXT" || "BINARY"
28+
body: String
29+
}
30+
31+
# Enum types curently not supported
32+
#
33+
# enum ResponseType {
34+
# TEXT
35+
# BINARY
36+
# }
37+
38+
type Query {
39+
get(url: String!, request: Request): Response
40+
}
41+
42+
type Mutation {
43+
post(url: String!, request: Request): Response
44+
}
45+
`,
746
implemented: [],
847
imported: [],
948
};

packages/js/plugins/ipfs/schema.graphql

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,7 @@ type Query {
1717
type Mutation {
1818
# TODO: Allow for custom type CID
1919
# https://github.com/web3-api/monorepo/issues/103
20-
addFile(data: Bytes!): AddResult!
21-
}
22-
23-
type AddResult {
24-
path: String!
25-
cid: String!
20+
addFile(data: Bytes!): String!
2621
}
2722

2823
# TODO: should get replaced with an import

packages/js/plugins/ipfs/src/index.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,18 @@ export class IpfsPlugin extends Plugin {
5454
public async add(
5555
data: Uint8Array
5656
): Promise<{
57-
path: string;
58-
cid: CID;
57+
name: string;
58+
hash: CID;
5959
}> {
60-
return await this._ipfs.add(data);
60+
const result = await this._ipfs.add(data);
61+
62+
if (result.length === 0) {
63+
throw Error(
64+
`IpfsPlugin:add failed to add contents. Result of length 0 returned.`
65+
);
66+
}
67+
68+
return result[0];
6169
}
6270

6371
public async cat(cid: string): Promise<Buffer> {

packages/js/plugins/ipfs/src/manifest.ts

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,35 @@ import { PluginManifest, Uri } from "@web3api/core-js";
33
export const manifest: PluginManifest = {
44
// TODO: use the schema.graphql
55
// https://github.com/web3-api/monorepo/issues/101
6-
schema: "type Query { dummy: String }",
6+
schema: `
7+
# TODO: should import and "implements" the api-resolver core-api schema
8+
# https://github.com/Web3-API/monorepo/issues/75
9+
10+
type Query {
11+
catFile(cid: String!): Bytes!
12+
13+
tryResolveUri(
14+
authority: String!
15+
path: String!
16+
): ApiResolver_MaybeUriOrManifest
17+
18+
getFile(
19+
path: String!
20+
): Bytes
21+
}
22+
23+
type Mutation {
24+
# TODO: Allow for custom type CID
25+
# https://github.com/web3-api/monorepo/issues/103
26+
addFile(data: Bytes!): String!
27+
}
28+
29+
# TODO: should get replaced with an import
30+
# https://github.com/Web3-API/monorepo/issues/75
31+
type ApiResolver_MaybeUriOrManifest {
32+
uri: String
33+
manifest: String
34+
}`,
735
implemented: [new Uri("w3/api-resolver")],
836
imported: [],
937
};

0 commit comments

Comments
 (0)