Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: improve plugin development experience #620

Merged
merged 31 commits into from
Apr 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
ba35279
WIP: module wise codegen is working
Niraj-Kamdar Jan 20, 2022
ec4737f
WIP: initial working prototype
Niraj-Kamdar Jan 24, 2022
dc51d4f
feat: make meta manifest optional for plugins
Niraj-Kamdar Jan 25, 2022
6dd6165
lint fixes and few changes
Niraj-Kamdar Jan 25, 2022
8a4a950
refactor: createPluginContext
Niraj-Kamdar Jan 25, 2022
7930a0c
fix(core-js): PluginWeb3Api
Niraj-Kamdar Jan 25, 2022
1dff4a4
fix: schema-bind tests
Niraj-Kamdar Jan 26, 2022
3ccf803
Merge remote-tracking branch 'upstream/prealpha-dev' into nk/plugin-m…
Niraj-Kamdar Jan 27, 2022
ff2d13d
refactor: remove generateName from plugin bindgen
Niraj-Kamdar Jan 27, 2022
b087f72
refactor: remove debug leftovers
Niraj-Kamdar Jan 27, 2022
825349f
refactor: lint fixes
Niraj-Kamdar Jan 27, 2022
a2b4090
merge prealpha-dev + schema-bind-modules
dOrgJelli Mar 21, 2022
94e17c2
fix plugin templates
dOrgJelli Mar 22, 2022
4ce3742
init plugin-ts rework
dOrgJelli Mar 22, 2022
80c46fd
schema packages updated + CLI test-case updated
dOrgJelli Apr 12, 2022
8bf0551
manually updating plugins to solve circ dep
dOrgJelli Apr 16, 2022
7321aff
filesystem + graph-node + http
dOrgJelli Apr 16, 2022
2684cde
update ipfs plugin
dOrgJelli Apr 18, 2022
06ab6cd
update logger & sha3
dOrgJelli Apr 18, 2022
8d3c0cb
convert uts46
dOrgJelli Apr 18, 2022
f50e3d5
all building
dOrgJelli Apr 19, 2022
bf9964b
merge prealpha-dev
dOrgJelli Apr 19, 2022
1b456c6
lint + build fixes
dOrgJelli Apr 19, 2022
c672b11
tests pass
dOrgJelli Apr 19, 2022
624cea8
lint fix
dOrgJelli Apr 19, 2022
1ff96f3
update TODOs
dOrgJelli Apr 19, 2022
fd8b1a9
fix tests
dOrgJelli Apr 20, 2022
6ac38fc
update template + fix tests
dOrgJelli Apr 20, 2022
4b42bd4
Merge pull request #816 from polywrap/dorgjelli/plugin-modules-merge
dOrgJelli Apr 20, 2022
2183fe7
minor cleanup
dOrgJelli Apr 20, 2022
f696344
merge prealpha-dev
dOrgJelli Apr 21, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 0 additions & 38 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,44 +132,6 @@ module.exports = {
{
files: ["*.json"],
extends: ["plugin:json/recommended"],
},
{
files: ["*.graphql"],
plugins: ["@graphql-eslint"],
parser: "@graphql-eslint/eslint-plugin",
rules: {
"function-call-argument-newline": ["error"],
"@graphql-eslint/avoid-typename-prefix": ["warn"],
"@graphql-eslint/no-hashtag-description": ["off"],
"@graphql-eslint/require-deprecation-reason": ["error"],
"@graphql-eslint/no-case-insensitive-enum-values-duplicates": ["error"],
"@graphql-eslint/description-style": ["warn", {"style":"inline"}],
"@graphql-eslint/avoid-duplicate-fields": ["error"],
"@graphql-eslint/naming-convention": ["error",
{
"FieldDefinition":"camelCase",
"InputObjectTypeDefinition":"PascalCase",
"EnumValueDefinition":"UPPER_CASE",
"InputValueDefinition":"camelCase",
"ObjectTypeDefinition":"PascalCase",
"InterfaceTypeDefinition":"PascalCase",
"EnumTypeDefinition":"PascalCase",
"UnionTypeDefinition":"PascalCase",
"ScalarTypeDefinition":"PascalCase",
"OperationDefinition":"PascalCase",
"FragmentDefinition":"PascalCase",
"QueryDefinition":"camelCase",
"leadingUnderscore":"forbid",
"trailingUnderscore":"forbid"
}],
"@graphql-eslint/possible-type-extension": ["error"],
"@graphql-eslint/unique-operation-name": ["error"],
"@graphql-eslint/unique-directive-names": ["error"],
"@graphql-eslint/unique-enum-value-names": ["error"],
"@graphql-eslint/unique-field-definition-names": ["error"],
"@graphql-eslint/unique-input-field-names": ["error"],
"@graphql-eslint/unique-type-names": ["error"],
}
}
]
};
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@
"clean": "npx rimraf ./**/node_modules ./**/yarn.lock ./**/build ./**/coverage ./**/.w3",
"install:dependencies": "cd dependencies && yarn",
"preinstall": "yarn install:dependencies",
"build": "yarn build:core && yarn build:plugins && yarn build:client && yarn build:cli",
"build": "yarn build:core && yarn build:plugins && yarn build:client && yarn build:cli && yarn build:plugins:migrate",
"build:core": "lerna run build --no-private --ignore @web3api/*-plugin-js --ignore @web3api/cli* --ignore @web3api/react",
"build:plugins": "lerna run build --scope @web3api/*-plugin-js --concurrency 1",
"build:plugins:migrate": "lerna run build:migrate --scope @web3api/*-plugin-js --concurrency 1",
"build:client": "lerna run build --scope @web3api/client-js --scope @web3api/react",
"build:cli": "lerna run build --scope @web3api/cli",
"lint": "lerna run lint",
Expand All @@ -51,7 +52,6 @@
"eslint-plugin-prettier": "3.4.0",
"prettier": "2.2.1",
"graphql": "15.5.0",
"@graphql-eslint/eslint-plugin": "1.0.1",
"eslint-plugin-json": "3.0.0"
},
"resolutions": {
Expand Down
3 changes: 1 addition & 2 deletions packages/cli/src/__tests__/e2e/plugin.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,10 @@ ${HELP}`);
`);

const expectedTypesResult = compareSync(
`${projectRoot}/src/w3`,
`${projectRoot}/src`,
`${projectRoot}/expected-types`,
{ compareContent: true }
);

expect(expectedTypesResult.differences).toBe(0);

const expectedBuildResult = compareSync(
Expand Down
3 changes: 3 additions & 0 deletions packages/cli/src/__tests__/plugin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
!expected-types/w3
!expected-types/query/w3
!expected-types/mutation/w3
233 changes: 115 additions & 118 deletions packages/cli/src/__tests__/plugin/expected-build/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -35,29 +35,24 @@ directive @annotate(type: String!) on FIELD

### Web3API Header END ###

type Query @imports(
type Mutation @imports(
types: [
"Ethereum_Query",
"Ethereum_Mutation",
"Ethereum_Connection",
"Ethereum_TxOverrides",
"Ethereum_StaticTxResult",
"Ethereum_TxRequest",
"Ethereum_TxResponse",
"Ethereum_Access",
"Ethereum_TxReceipt",
"Ethereum_Log",
"Ethereum_EventNotification",
"Ethereum_Network",
"Ethereum_Mutation",
"Ethereum_TxResponse",
"Ethereum_Access"
"Ethereum_TxRequest"
]
) {
method(
str: String!
optStr: String
): Object!
arg: UInt32!
): String!
}

type Mutation @imports(
type Query @imports(
types: [
"Ethereum_Query",
"Ethereum_Connection",
Expand All @@ -67,15 +62,17 @@ type Mutation @imports(
"Ethereum_TxReceipt",
"Ethereum_Log",
"Ethereum_EventNotification",
"Ethereum_Network",
"Ethereum_Mutation",
"Ethereum_TxResponse",
"Ethereum_Access"
"Ethereum_Network"
]
) {
method(
arg: UInt32!
): String!
str: String!
optStr: String
): Object!
}

type QueryEnv {
arg1: String!
}

type Object {
Expand All @@ -86,6 +83,56 @@ type Object {

### Imported Queries START ###

type Ethereum_Mutation @imported(
uri: "ens/ethereum.web3api.eth",
namespace: "Ethereum",
nativeType: "Mutation"
) {
callContractMethod(
address: String!
method: String!
args: [String!]
connection: Ethereum_Connection
txOverrides: Ethereum_TxOverrides
): Ethereum_TxResponse!

callContractMethodAndWait(
address: String!
method: String!
args: [String!]
connection: Ethereum_Connection
txOverrides: Ethereum_TxOverrides
): Ethereum_TxReceipt!

sendTransaction(
tx: Ethereum_TxRequest!
connection: Ethereum_Connection
): Ethereum_TxResponse!

sendTransactionAndWait(
tx: Ethereum_TxRequest!
connection: Ethereum_Connection
): Ethereum_TxReceipt!

deployContract(
abi: String!
bytecode: String!
args: [String!]
connection: Ethereum_Connection
): String!

signMessage(
message: String!
connection: Ethereum_Connection
): String!

sendRPC(
method: String!
params: [String!]!
connection: Ethereum_Connection
): String
}

type Ethereum_Query @imported(
uri: "ens/ethereum.web3api.eth",
namespace: "Ethereum",
Expand Down Expand Up @@ -200,56 +247,6 @@ type Ethereum_Query @imported(
): Ethereum_Network!
}

type Ethereum_Mutation @imported(
uri: "ens/ethereum.web3api.eth",
namespace: "Ethereum",
nativeType: "Mutation"
) {
callContractMethod(
address: String!
method: String!
args: [String!]
connection: Ethereum_Connection
txOverrides: Ethereum_TxOverrides
): Ethereum_TxResponse!

callContractMethodAndWait(
address: String!
method: String!
args: [String!]
connection: Ethereum_Connection
txOverrides: Ethereum_TxOverrides
): Ethereum_TxReceipt!

sendTransaction(
tx: Ethereum_TxRequest!
connection: Ethereum_Connection
): Ethereum_TxResponse!

sendTransactionAndWait(
tx: Ethereum_TxRequest!
connection: Ethereum_Connection
): Ethereum_TxReceipt!

deployContract(
abi: String!
bytecode: String!
args: [String!]
connection: Ethereum_Connection
): String!

signMessage(
message: String!
connection: Ethereum_Connection
): String!

sendRPC(
method: String!
params: [String!]!
connection: Ethereum_Connection
): String
}

### Imported Queries END ###

### Imported Objects START ###
Expand All @@ -273,29 +270,39 @@ type Ethereum_TxOverrides @imported(
value: BigInt
}

type Ethereum_StaticTxResult @imported(
type Ethereum_TxResponse @imported(
uri: "ens/ethereum.web3api.eth",
namespace: "Ethereum",
nativeType: "StaticTxResult"
nativeType: "TxResponse"
) {
result: String!
error: Boolean!
hash: String!
to: String
from: String!
nonce: UInt32!
gasLimit: BigInt!
gasPrice: BigInt
data: String!
value: BigInt!
chainId: BigInt!
blockNumber: BigInt
blockHash: String
timestamp: UInt32
confirmations: UInt32!
raw: String
r: String
s: String
v: UInt32
type: UInt32
accessList: [Ethereum_Access!]
}

type Ethereum_TxRequest @imported(
type Ethereum_Access @imported(
uri: "ens/ethereum.web3api.eth",
namespace: "Ethereum",
nativeType: "TxRequest"
nativeType: "Access"
) {
to: String
from: String
nonce: UInt32
gasLimit: BigInt
gasPrice: BigInt
data: String
value: BigInt
chainId: BigInt
type: UInt32
address: String!
storageKeys: [String!]!
}

type Ethereum_TxReceipt @imported(
Expand Down Expand Up @@ -338,59 +345,49 @@ type Ethereum_Log @imported(
logIndex: UInt32!
}

type Ethereum_EventNotification @imported(
type Ethereum_TxRequest @imported(
uri: "ens/ethereum.web3api.eth",
namespace: "Ethereum",
nativeType: "EventNotification"
nativeType: "TxRequest"
) {
data: String!
address: String!
log: Ethereum_Log!
to: String
from: String
nonce: UInt32
gasLimit: BigInt
gasPrice: BigInt
data: String
value: BigInt
chainId: BigInt
type: UInt32
}

type Ethereum_Network @imported(
type Ethereum_StaticTxResult @imported(
uri: "ens/ethereum.web3api.eth",
namespace: "Ethereum",
nativeType: "Network"
nativeType: "StaticTxResult"
) {
name: String!
chainId: BigInt!
ensAddress: String
result: String!
error: Boolean!
}

type Ethereum_TxResponse @imported(
type Ethereum_EventNotification @imported(
uri: "ens/ethereum.web3api.eth",
namespace: "Ethereum",
nativeType: "TxResponse"
nativeType: "EventNotification"
) {
hash: String!
to: String
from: String!
nonce: UInt32!
gasLimit: BigInt!
gasPrice: BigInt
data: String!
value: BigInt!
chainId: BigInt!
blockNumber: BigInt
blockHash: String
timestamp: UInt32
confirmations: UInt32!
raw: String
r: String
s: String
v: UInt32
type: UInt32
accessList: [Ethereum_Access!]
address: String!
log: Ethereum_Log!
}

type Ethereum_Access @imported(
type Ethereum_Network @imported(
uri: "ens/ethereum.web3api.eth",
namespace: "Ethereum",
nativeType: "Access"
nativeType: "Network"
) {
address: String!
storageKeys: [String!]!
name: String!
chainId: BigInt!
ensAddress: String
}

### Imported Objects END ###
Loading