Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@codex-data/sdk",
"version": "2.3.2",
"version": "2.3.3",
"engines": {
"node": ">=17.5.0"
},
Expand Down
222 changes: 0 additions & 222 deletions src/overrides/mutations/CreateWebhooks.graphql
Original file line number Diff line number Diff line change
@@ -1,162 +1,11 @@
mutation CreateWebhooks($input: CreateWebhooksInput!) {
createWebhooks(input: $input) {
nftEventWebhooks {
alertRecurrence
bucketId
bucketSortkey
callbackUrl
conditions {
... on NftEventWebhookCondition {
contractAddress {
eq
}
eventType {
eq
}
exchangeAddress {
eq
}
fillSource {
oneOf
}
ignoreTransfers
individualBaseTokenPrice {
eq
gt
gte
lt
lte
}
maker {
eq
}
networkId {
oneOf
}
nftTokenAddress: tokenAddress {
eq
}
tokenId {
eq
}
}
... on PriceEventWebhookCondition {
priceNetworkId: networkId {
eq
}
priceUsd {
eq
gt
gte
lt
lte
}
priceTokenAddress: tokenAddress {
eq
}
}
... on RawTransactionWebhookCondition {
from {
eq
}
ignoreNftEvents
ignoreTokenPairEvents
input {
contains
notContains
}
networkId {
oneOf
}
to {
eq
}
toOrFrom {
eq
}
}
... on TokenPairEventWebhookCondition {
eventType {
oneOf
}
exchangeAddress {
eq
}
maker {
eq
}
networkId {
oneOf
}
pairAddress {
eq
}
swapValue {
eq
gt
gte
lt
lte
}
tokenAddress {
eq
}
}
}
created
groupId
id
name
publishingType
retrySettings {
maxRetries
maxRetryDelay
maxTimeElapsed
minRetryDelay
}
status
webhookType
}
priceWebhooks {
alertRecurrence
bucketId
bucketSortkey
callbackUrl
conditions {
... on NftEventWebhookCondition {
contractAddress {
eq
}
eventType {
eq
}
exchangeAddress {
eq
}
fillSource {
oneOf
}
ignoreTransfers
individualBaseTokenPrice {
eq
gt
gte
lt
lte
}
maker {
eq
}
networkId {
oneOf
}
nftTokenAddress: tokenAddress {
eq
}
tokenId {
eq
}
}
... on PriceEventWebhookCondition {
priceNetworkId: networkId {
eq
Expand All @@ -176,7 +25,6 @@ mutation CreateWebhooks($input: CreateWebhooksInput!) {
from {
eq
}
ignoreNftEvents
ignoreTokenPairEvents
input {
contains
Expand Down Expand Up @@ -240,40 +88,6 @@ mutation CreateWebhooks($input: CreateWebhooksInput!) {
bucketSortkey
callbackUrl
conditions {
... on NftEventWebhookCondition {
contractAddress {
eq
}
eventType {
eq
}
exchangeAddress {
eq
}
fillSource {
oneOf
}
ignoreTransfers
individualBaseTokenPrice {
eq
gt
gte
lt
lte
}
maker {
eq
}
networkId {
oneOf
}
tokenAddress {
eq
}
tokenId {
eq
}
}
... on PriceEventWebhookCondition {
priceEventNetworkId: networkId {
eq
Expand All @@ -293,7 +107,6 @@ mutation CreateWebhooks($input: CreateWebhooksInput!) {
from {
eq
}
ignoreNftEvents
ignoreTokenPairEvents
input {
contains
Expand Down Expand Up @@ -357,40 +170,6 @@ mutation CreateWebhooks($input: CreateWebhooksInput!) {
bucketSortkey
callbackUrl
conditions {
... on NftEventWebhookCondition {
contractAddress {
eq
}
eventType {
eq
}
exchangeAddress {
eq
}
fillSource {
oneOf
}
ignoreTransfers
individualBaseTokenPrice {
eq
gt
gte
lt
lte
}
maker {
eq
}
networkId {
oneOf
}
tokenAddress {
eq
}
tokenId {
eq
}
}
... on PriceEventWebhookCondition {
priceEventNetworkId: networkId {
eq
Expand All @@ -410,7 +189,6 @@ mutation CreateWebhooks($input: CreateWebhooksInput!) {
from {
eq
}
ignoreNftEvents
ignoreTokenPairEvents
input {
contains
Expand Down
35 changes: 0 additions & 35 deletions src/overrides/queries/GetWebhooks.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -19,40 +19,6 @@ query GetWebhooks(
bucketSortkey
callbackUrl
conditions {
... on NftEventWebhookCondition {
contractAddress {
eq
}
eventType {
eq
}
exchangeAddress {
eq
}
fillSource {
oneOf
}
ignoreTransfers
individualBaseTokenPrice {
eq
gt
gte
lt
lte
}
maker {
eq
}
networkId {
oneOf
}
tokenAddress {
eq
}
tokenId {
eq
}
}
... on PriceEventWebhookCondition {
priceNetworkId: networkId {
eq
Expand All @@ -72,7 +38,6 @@ query GetWebhooks(
from {
eq
}
ignoreNftEvents
ignoreTokenPairEvents
input {
contains
Expand Down
13 changes: 13 additions & 0 deletions src/scripts/generateGraphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ export const getLeafType = (
getLeafType(f.type, allTypes, [], f.name, level + 1),
)
.flat();
// An object whose subfields all got cut off (by the depth limit or because
// the type is fully recursive) would emit `field { }` — an empty selection
// set, which is invalid GraphQL. Drop the field instead. This bubbles up:
// a parent whose only children are such objects becomes empty and is
// dropped too.
if (level !== 0 && subTypeLeaves.length === 0) return result;
return [
...result,
...(level === 0 ? subTypeLeaves : [{ [currentName]: subTypeLeaves }]),
Expand Down Expand Up @@ -168,6 +174,13 @@ async function run() {
const schemaJson = await res.json();
fetchSpinner.succeed(`Fetched schema from ${brand("graph.codex.io")}`);

// Clear previously generated operations so that anything removed from the
// schema doesn't linger as an orphaned .graphql file and break codegen.
const generatedRoot = path.join(__dirname, "..", "resources", "generated");
for (const dir of ["mutations", "subscriptions", "queries"]) {
fs.rmSync(path.join(generatedRoot, dir), { recursive: true, force: true });
}

const types = schemaJson.__schema.types;
const mutationType = types.find(
(type: SchemaType) => type.name === "Mutation",
Expand Down
Loading
Loading