Skip to content

Commit

Permalink
Merge pull request #409 from polywrap/prealpha-dev
Browse files Browse the repository at this point in the history
Prep 0.0.1-prealpha.29
  • Loading branch information
dOrgJelli authored Jul 13, 2021
2 parents de612ce + a707176 commit e431647
Show file tree
Hide file tree
Showing 173 changed files with 6,038 additions and 2,295 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# Web3API 0.0.1-prealpha.29
## Feature
* Web3API Interfaces are now fully supported in the tool-chain.
* GraphQL schema comments are now retained, and will show up in the build folder.
* `@web3api/parse`: Reference types definitions are now differentiated from the root definitions the reference.

## Bugs
* `@web3api/cli`: Fix MacOS specific issue w/ PATH not being retained.
* The `config` property in `web3api.build.yaml` is now optional.

# Web3API 0.0.1-prealpha.28
## Bugs
* Fixed API template project
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.0.1-prealpha.28
0.0.1-prealpha.29
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
},
"scripts": {
"reset": "yarn clean && yarn && yarn build",
"clean": "npx rimraf ./**/node_modules ./**/build ./**/coverage",
"clean": "npx rimraf ./**/node_modules ./**/build ./**/coverage ./**/.w3",
"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",
"lint": "lerna run lint",
"lint:fix": "lerna run lint -- --fix",
Expand Down
12 changes: 6 additions & 6 deletions packages/apis/console/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Console Web3API

Calls log on logger plugin at uri `w3://w3/logger`. Default logger logs to console, but can be overridden with redirect to custom logger web3api implementation.
Calls log on logger plugin at uri `w3://ens/logger.core.web3api.eth`. Default logger logs to console, but can be overridden with redirect to custom logger web3api implementation.

### Log levels
### Log Methods

- DEBUG
- INFO
- WARN
- ERROR
- debug
- info
- warn
- error

## Example

Expand Down
2 changes: 1 addition & 1 deletion packages/apis/console/recipes/e2e.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[
{
"api": "ens/console.eth",
"api": "ens/testnet/console.eth",
"constants": "./constants.json"
},
{
Expand Down
10 changes: 5 additions & 5 deletions packages/apis/console/src/query/index.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
import { Input_info, Logger_Query, Logger_LogLevel } from "./w3";
import { Input_info, Logger_Query, Logger_Logger_LogLevel } from "./w3";

export function debug(input: Input_info): bool {
return Logger_Query.log({
message: input.message,
level: Logger_LogLevel.DEBUG
level: Logger_Logger_LogLevel.DEBUG
});
}

export function info(input: Input_info): bool {
return Logger_Query.log({
message: input.message,
level: Logger_LogLevel.INFO
level: Logger_Logger_LogLevel.INFO
});
}

export function warn(input: Input_info): bool {
return Logger_Query.log({
message: input.message,
level: Logger_LogLevel.WARN
level: Logger_Logger_LogLevel.WARN
});
}

export function error(input: Input_info): bool {
return Logger_Query.log({
message: input.message,
level: Logger_LogLevel.ERROR
level: Logger_Logger_LogLevel.ERROR
});
}
2 changes: 1 addition & 1 deletion packages/apis/console/src/query/schema.graphql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#import { Query, LogLevel } into Logger from "w3://w3/logger"
#import { Query } into Logger from "w3://ens/js-logger.web3api.eth"

type Query {
debug(
Expand Down
3 changes: 0 additions & 3 deletions packages/apis/console/web3api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,3 @@ query:
module:
language: wasm/assemblyscript
file: ./src/query/index.ts
import_redirects:
- uri: w3://w3/logger
schema: ../../core-apis/logger/schema.graphql
5 changes: 4 additions & 1 deletion packages/cli/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@
"lib_compiler_compileWarning": "Warnings while compiling Web3API",
"lib_compiler_failedSchemaReturn": "Schema composer failed to return a combined schema.",
"lib_compiler_noModulesToBuild": "No modules to build declared.",
"lib_compiler_missingDefinition": "Missing schema definition for the module {name}",
"lib_compiler_missingSchema": "Missing schema definition for the module {name}",
"lib_compiler_missingModule": "Missing module definition for the module {name}",
"lib_compiler_noInterfaceModule": "Interfaces cannot have implementation modules, see module {name}",
"lib_compiler_step": "Compiling WASM module",
"lib_compiler_noNodeModules": "could not locate {folder} in parent directories of web3api manifest",
"lib_compiler_noInit": "WASM module is missing the _w3_init export. This should never happen...",
Expand Down Expand Up @@ -126,6 +128,7 @@
"lib_helpers_parameters_unexpectedValue": "Unexpected value provided for one or more of {options}. See --help for more information.",
"lib_publishers_ipfsPublisher_urlMalformed": "IPFS URL Malformed",
"lib_project_invalid_build_language": "Unrecognized build language {language}. No default manifest found at {defaultPath}",
"lib_project_language_not_found": "Build language not found. Please include the `language` property in the manifest file.",
"lib_watcher_alreadyWatching": "Watcher session is already in progress. Directory: {dir}",
"lib_docker_invalidImageId": "Invalid docker image ID returned: {imageId}"
}
5 changes: 4 additions & 1 deletion packages/cli/lang/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@
"lib_compiler_compileWarning": "Warnings while compiling Web3API",
"lib_compiler_failedSchemaReturn": "Schema composer failed to return a combined schema.",
"lib_compiler_noModulesToBuild": "No modules to build declared.",
"lib_compiler_missingDefinition": "Missing schema definition for the module {name}",
"lib_compiler_missingSchema": "Missing schema definition for the module {name}",
"lib_compiler_missingModule": "Missing module definition for the module {name}",
"lib_compiler_noInterfaceModule": "Interfaces cannot have implementation modules, see module {name}",
"lib_compiler_step": "Compiling WASM module",
"lib_compiler_noNodeModules": "could not locate {folder} in parent directories of web3api manifest",
"lib_compiler_noInit": "WASM module is missing the _w3_init export. This should never happen...",
Expand Down Expand Up @@ -126,6 +128,7 @@
"lib_helpers_parameters_unexpectedValue": "Unexpected value provided for one or more of {options}. See --help for more information.",
"lib_publishers_ipfsPublisher_urlMalformed": "IPFS URL Malformed",
"lib_project_invalid_build_language": "Unrecognized build language {language}. No default manifest found at {defaultPath}",
"lib_project_language_not_found": "Build language not found. Please include the `language` property in the manifest file.",
"lib_watcher_alreadyWatching": "Watcher session is already in progress. Directory: {dir}",
"lib_docker_invalidImageId": "Invalid docker image ID returned: {imageId}"
}
13 changes: 0 additions & 13 deletions packages/cli/src/__tests__/e2e/build.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,17 +137,4 @@ ${HELP}`);
expect(sanitizedOutput).toContain("Manifest written to ./build/web3api.yaml");
expect(sanitizedOutput).toContain(manifestPath);
});

test("Errors when dockerfile config property is missing", async () => {
const { exitCode: code, stdout: output } = await runCLI({
args: ["build", "web3api.wrong-config.yaml", "-v"],
cwd: projectRoot
}, w3Cli);

const sanitizedOutput = clearStyle(output);

expect(code).toEqual(1);
expect(sanitizedOutput).toContain("Validation errors encountered while sanitizing BuildManifest");
expect(sanitizedOutput).toContain("instance.config requires property \"include\"");
});
});
10 changes: 8 additions & 2 deletions packages/cli/src/__tests__/project/sample.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,9 @@ type Ethereum_TxReceipt @imported(
blockHash: String!
confirmations: UInt32!
cumulativeGasUsed: BigInt!
effectiveGasPrice: BigInt!
byzantium: Boolean!
type: UInt32!
status: UInt32
}
Expand Down Expand Up @@ -370,7 +372,7 @@ type Ethereum_TxResponse @imported(
from: String!
nonce: UInt32!
gasLimit: BigInt!
gasPrice: BigInt!
gasPrice: BigInt
data: String!
value: BigInt!
chainId: UInt32!
Expand Down Expand Up @@ -413,7 +415,9 @@ type Ethereum_TxReceipt @imported(
blockHash: String!
confirmations: UInt32!
cumulativeGasUsed: BigInt!
effectiveGasPrice: BigInt!
byzantium: Boolean!
type: UInt32!
status: UInt32
}
Expand Down Expand Up @@ -729,7 +733,9 @@ type Ethereum_TxReceipt @imported(
blockHash: String!
confirmations: UInt32!
cumulativeGasUsed: BigInt!
effectiveGasPrice: BigInt!
byzantium: Boolean!
type: UInt32!
status: UInt32
}
Expand Down Expand Up @@ -769,7 +775,7 @@ type Ethereum_TxResponse @imported(
from: String!
nonce: UInt32!
gasLimit: BigInt!
gasPrice: BigInt!
gasPrice: BigInt
data: String!
value: BigInt!
chainId: UInt32!
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const createPluginStr = intlMsg.commands_create_options_createPlugin();
const pathStr = intlMsg.commands_create_options_o_path();

export const supportedLangs: { [key: string]: string[] } = {
api: ["assemblyscript"],
api: ["assemblyscript", "interface"],
app: ["react"],
plugin: ["typescript"],
};
Expand Down
18 changes: 9 additions & 9 deletions packages/cli/src/commands/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import chalk from "chalk";
import { GluegunToolbox } from "gluegun";
import gql from "graphql-tag";
import path from "path";
import { UriRedirect, Web3ApiClient } from "@web3api/client-js";
import { PluginRegistration, Web3ApiClient } from "@web3api/client-js";
import { ensPlugin } from "@web3api/ens-plugin-js";
import { ethereumPlugin } from "@web3api/ethereum-plugin-js";
import { ipfsPlugin } from "@web3api/ipfs-plugin-js";
Expand Down Expand Up @@ -79,10 +79,10 @@ export default {

// TODO: move this into its own package, since it's being used everywhere?
// maybe have it exported from test-env.
const redirects: UriRedirect[] = [
const plugins: PluginRegistration[] = [
{
from: "w3://ens/ethereum.web3api.eth",
to: ethereumPlugin({
uri: "w3://ens/ethereum.web3api.eth",
plugin: ethereumPlugin({
networks: {
testnet: {
provider: ethereumProvider,
Expand All @@ -95,23 +95,23 @@ export default {
}),
},
{
from: "w3://ens/ipfs.web3api.eth",
to: ipfsPlugin({
uri: "w3://ens/ipfs.web3api.eth",
plugin: ipfsPlugin({
provider: ipfsProvider,
fallbackProviders: ["https://ipfs.io"],
}),
},
{
from: "w3://ens/ens.web3api.eth",
to: ensPlugin({
uri: "w3://ens/ens.web3api.eth",
plugin: ensPlugin({
addresses: {
testnet: ensAddress,
},
}),
},
];

const client = new Web3ApiClient({ redirects });
const client = new Web3ApiClient({ plugins });

const recipe = JSON.parse(filesystem.read(recipePath) as string);
const dir = path.dirname(recipePath);
Expand Down
Loading

0 comments on commit e431647

Please sign in to comment.