From 1d417bcb67e954a0896065e8a4d4a0f5ff059619 Mon Sep 17 00:00:00 2001 From: Alexander Date: Wed, 13 Sep 2023 00:52:25 -0400 Subject: [PATCH] Flatten sections --- docs/src/SUMMARY.md | 43 ++++++------ .../api-server.md | 0 .../directives.md | 0 .../{graphql => designing-a-schema}/index.md | 0 .../relationships.md | 0 .../scalars.md | 0 docs/src/designing-a-schema/types.md | 7 ++ docs/src/graphql/types/enums.md | 27 ------- docs/src/graphql/types/index.md | 5 -- docs/src/graphql/types/objects.md | 28 -------- docs/src/graphql/types/unions.md | 70 ------------------- .../index.md | 0 .../blocks.md | 0 .../index.md | 0 .../receipts.md | 0 .../transactions.md | 0 .../queries.md => querying/basic-queries.md} | 0 .../queries => querying}/full-example.md | 0 .../{graphql/queries => querying}/index.md | 0 .../queries => querying}/pagination.md | 0 .../queries => querying}/playground.md | 0 .../search-and-filtering.md} | 0 22 files changed, 28 insertions(+), 152 deletions(-) rename docs/src/{graphql => designing-a-schema}/api-server.md (100%) rename docs/src/{graphql => designing-a-schema}/directives.md (100%) rename docs/src/{graphql => designing-a-schema}/index.md (100%) rename docs/src/{graphql => designing-a-schema}/relationships.md (100%) rename docs/src/{graphql => designing-a-schema}/scalars.md (100%) create mode 100644 docs/src/designing-a-schema/types.md delete mode 100644 docs/src/graphql/types/enums.md delete mode 100644 docs/src/graphql/types/index.md delete mode 100644 docs/src/graphql/types/objects.md delete mode 100644 docs/src/graphql/types/unions.md rename docs/src/{indexing/custom-types => indexing-custom-types}/index.md (100%) rename docs/src/{indexing/fuel-types => indexing-fuel-types}/blocks.md (100%) rename docs/src/{indexing/fuel-types => indexing-fuel-types}/index.md (100%) rename docs/src/{indexing/fuel-types => indexing-fuel-types}/receipts.md (100%) rename docs/src/{indexing/fuel-types => indexing-fuel-types}/transactions.md (100%) rename docs/src/{graphql/queries/queries.md => querying/basic-queries.md} (100%) rename docs/src/{graphql/queries => querying}/full-example.md (100%) rename docs/src/{graphql/queries => querying}/index.md (100%) rename docs/src/{graphql/queries => querying}/pagination.md (100%) rename docs/src/{graphql/queries => querying}/playground.md (100%) rename docs/src/{graphql/queries/search-filtering.md => querying/search-and-filtering.md} (100%) diff --git a/docs/src/SUMMARY.md b/docs/src/SUMMARY.md index 45ec58219..7f85492aa 100644 --- a/docs/src/SUMMARY.md +++ b/docs/src/SUMMARY.md @@ -7,7 +7,7 @@ - [Dependencies](./getting-started/dependencies.md) - [Service Infrastructure](./getting-started/starting-the-fuel-indexer.md) -- [How it compares](./getting-started/how-it-compares.md) +- [How it Compares](./getting-started/how-it-compares.md) - [Quickstart](./getting-started/quickstart.md) # Reference Guide @@ -16,28 +16,27 @@ - [Manifest](./project-components/manifest.md) - [Schema](./project-components/schema.md) - [Module](./project-components/module.md) -- [Indexing Fuel Types](./indexing/fuel-types/index.md) - - [Blocks](./indexing/fuel-types/blocks.md) - - [Transactions](./indexing/fuel-types/transactions.md) - - [Receipts](./indexing/fuel-types/receipts.md) -- [Indexing Custom Types](./indexing/custom-types/index.md) -- [Authentication](./authentication/index.md) -- [GraphQL](./graphql/index.md) - - [Types](./graphql/types/index.md) - - [Objects](./graphql/types/objects.md) - - [Enums](./graphql/types/enums.md) - - [Union](./graphql/types/unions.md) - - [Scalars](./graphql/scalars.md) - - [Directives](./graphql/directives.md) - - [Relationships](./graphql/relationships.md) - - [API Server](./graphql/api-server.md) - - [Queries](./graphql/queries/index.md) - - [Playground](./graphql/queries/playground.md) - - [Basic Queries](./graphql/queries/queries.md) - - [Search and Filtering](./graphql/queries/search-filtering.md) - - [Pagination](./graphql/queries/pagination.md) - - [A Full Example](./graphql/queries/full-example.md) +- [Designing a Schema](./designing-a-schema/index.md) + - [Types](./designing-a-schema/types.md) + - [Scalars](./designing-a-schema/scalars.md) + - [Directives](./designing-a-schema/directives.md) + - [Relationships](./designing-a-schema/relationships.md) + - [API Server](./designing-a-schema/api-server.md) +- [Indexing Fuel Types](./indexing-fuel-types/index.md) + - [Blocks](./indexing-fuel-types/blocks.md) + - [Transactions](./indexing-fuel-types/transactions.md) + - [Receipts](./indexing-fuel-types/receipts.md) +- [Indexing Custom Types](./indexing-custom-types/index.md) - [Storing Info in a Database](./database/index.md) +- [Querying](./querying/index.md) + - [Basic Queries](./querying/basic-queries.md) + - [Playground](./querying/playground.md) + - [Search and Filtering](./querying/search-and-filtering.md) + - [Pagination](./querying/pagination.md) + - [A Full Example](./querying/full-example.md) +- [Authentication](./authentication/index.md) +- [forc index](./forc-index/index.md) +- [forc postgres](./forc-postgres/index.md) # For Contributors diff --git a/docs/src/graphql/api-server.md b/docs/src/designing-a-schema/api-server.md similarity index 100% rename from docs/src/graphql/api-server.md rename to docs/src/designing-a-schema/api-server.md diff --git a/docs/src/graphql/directives.md b/docs/src/designing-a-schema/directives.md similarity index 100% rename from docs/src/graphql/directives.md rename to docs/src/designing-a-schema/directives.md diff --git a/docs/src/graphql/index.md b/docs/src/designing-a-schema/index.md similarity index 100% rename from docs/src/graphql/index.md rename to docs/src/designing-a-schema/index.md diff --git a/docs/src/graphql/relationships.md b/docs/src/designing-a-schema/relationships.md similarity index 100% rename from docs/src/graphql/relationships.md rename to docs/src/designing-a-schema/relationships.md diff --git a/docs/src/graphql/scalars.md b/docs/src/designing-a-schema/scalars.md similarity index 100% rename from docs/src/graphql/scalars.md rename to docs/src/designing-a-schema/scalars.md diff --git a/docs/src/designing-a-schema/types.md b/docs/src/designing-a-schema/types.md new file mode 100644 index 000000000..738b789f3 --- /dev/null +++ b/docs/src/designing-a-schema/types.md @@ -0,0 +1,7 @@ +# Types + +## Objects + +## Enums + +## Unions \ No newline at end of file diff --git a/docs/src/graphql/types/enums.md b/docs/src/graphql/types/enums.md deleted file mode 100644 index 1dd544354..000000000 --- a/docs/src/graphql/types/enums.md +++ /dev/null @@ -1,27 +0,0 @@ -# Enum Types - -Enum types are simply implemented as String types. - -```graphql -enum SignatureLabel { - Multi - Single -} -``` - -> Enum types in relation to Fuel indexer's implementation are just `String` types used primarily to label object types. There is no other way that `enum` types should be used at this time. - -This `SignatureLabel` object type from the GraphQL schema, might be used in an indexer module like so: - -```rust, ignore -extern crate alloc; -use fuel_indexer_utils::prelude::*; - -#[indexer(manifest = "indexer.manifest.yaml")] -mod indexer_mod { - fn handle_event(event: Event) { - let label = SignatureLabel::Multi; - assert_eq!(label.to_string(), "SignatureLabel::Multi".to_string()); - } -} -``` \ No newline at end of file diff --git a/docs/src/graphql/types/index.md b/docs/src/graphql/types/index.md deleted file mode 100644 index b725ebef8..000000000 --- a/docs/src/graphql/types/index.md +++ /dev/null @@ -1,5 +0,0 @@ -# Types - -- [Object types](./objects.md) -- [Enum types](./enums.md) -- [Union types](./unions.md) \ No newline at end of file diff --git a/docs/src/graphql/types/objects.md b/docs/src/graphql/types/objects.md deleted file mode 100644 index 7aba74ec5..000000000 --- a/docs/src/graphql/types/objects.md +++ /dev/null @@ -1,28 +0,0 @@ -# Object types - -Object types are the most commonly used type in indexer GraphQL schema. Each object type marked with an `@entity` directive will be converted into a SQL table. - -```graphql -type Account @entity { - id: ID! - address: Address! - balance: UInt8! -} -``` - -This `Account` object type from the GraphQL schema, might be used in an indexer module like so: - -```rust, ignore -extern crate alloc; -use fuel_indexer_utils::prelude::*; - -#[indexer(manifest = "indexer.manifest.yaml")] -mod indexer_mod { - fn handle_event(event: Event) { - let address = Address::default(); - let balance = 0; - let account = Account::new(address, balance); - account.save(); - } -} -``` \ No newline at end of file diff --git a/docs/src/graphql/types/unions.md b/docs/src/graphql/types/unions.md deleted file mode 100644 index b4b633edb..000000000 --- a/docs/src/graphql/types/unions.md +++ /dev/null @@ -1,70 +0,0 @@ -# Union Types - -Union types are unique in that any type marked as a `union` will be converted into an Object type, who's fields are the unique set of fields over all members of the union. - -```graphql -enum TransactionLabel { - Create - Script - Mint -} - -type CreateTransaction @entity { - id: ID! - bytecode_length: UInt8! - contract_id: ContractId! - label: TransactionLabel! -} - -type ScriptTransaction @entity { - id: ID! - maturity: UInt8! - label: TransactionLabel! -} - -type MintTransaction @entity { - id: ID! - metadata: Json - label: TransactionLabel! -} - -union Transaction = CreateTransaction | ScriptTransaction | MintTransaction -``` - -The `Transaction` union type above, will internally produce the following object type: - -```graphql -type Transaction @entity { - id: ID! - bytecode_length: UInt8! - contract_id: ContractId! - label: TransactionLabel! - maturity: UInt8! - metadata: Json -} -``` - -> IMPORTANT: Note the order of the fields in the derived `Transaction` object type: the fields are ordered according to the unique set of fields from each of the union's members. -> -> The `id`, `bytecode_length`, `contract_id`, and `label` fields come first, from the `CreateTransaction` object type. Next comes the `maturity` field from the `ScriptTransaction` object - because the `ScriptTransaction`'s `id` and `label` fiels are already a part of the derived `Transaction` object, courtesy of the `CreateTransaction` object type. Finally, comes the `metadata` field, as part of the `MintTransaction` object type. - -This `Transaction` union type from the GraphQL schema, might be used in an indexer module like so: - -```rust, ignore -extern crate alloc; -use fuel_indexer_utils::prelude::*; - -#[indexer(manifest = "indexer.manifest.yaml")] -mod indexer_mod { - fn handle_event(event: Event) { - let bytecode_length = 1024; - let contract_id = ContractId::default(); - let label = TransactionLabel::Create; - let maturity = 10000000; - let metadata = None; - - let transaction = Transaction::new(bytecode_length, contract_id, label, maturity, metadata); - transaction.save(); - } -} -``` \ No newline at end of file diff --git a/docs/src/indexing/custom-types/index.md b/docs/src/indexing-custom-types/index.md similarity index 100% rename from docs/src/indexing/custom-types/index.md rename to docs/src/indexing-custom-types/index.md diff --git a/docs/src/indexing/fuel-types/blocks.md b/docs/src/indexing-fuel-types/blocks.md similarity index 100% rename from docs/src/indexing/fuel-types/blocks.md rename to docs/src/indexing-fuel-types/blocks.md diff --git a/docs/src/indexing/fuel-types/index.md b/docs/src/indexing-fuel-types/index.md similarity index 100% rename from docs/src/indexing/fuel-types/index.md rename to docs/src/indexing-fuel-types/index.md diff --git a/docs/src/indexing/fuel-types/receipts.md b/docs/src/indexing-fuel-types/receipts.md similarity index 100% rename from docs/src/indexing/fuel-types/receipts.md rename to docs/src/indexing-fuel-types/receipts.md diff --git a/docs/src/indexing/fuel-types/transactions.md b/docs/src/indexing-fuel-types/transactions.md similarity index 100% rename from docs/src/indexing/fuel-types/transactions.md rename to docs/src/indexing-fuel-types/transactions.md diff --git a/docs/src/graphql/queries/queries.md b/docs/src/querying/basic-queries.md similarity index 100% rename from docs/src/graphql/queries/queries.md rename to docs/src/querying/basic-queries.md diff --git a/docs/src/graphql/queries/full-example.md b/docs/src/querying/full-example.md similarity index 100% rename from docs/src/graphql/queries/full-example.md rename to docs/src/querying/full-example.md diff --git a/docs/src/graphql/queries/index.md b/docs/src/querying/index.md similarity index 100% rename from docs/src/graphql/queries/index.md rename to docs/src/querying/index.md diff --git a/docs/src/graphql/queries/pagination.md b/docs/src/querying/pagination.md similarity index 100% rename from docs/src/graphql/queries/pagination.md rename to docs/src/querying/pagination.md diff --git a/docs/src/graphql/queries/playground.md b/docs/src/querying/playground.md similarity index 100% rename from docs/src/graphql/queries/playground.md rename to docs/src/querying/playground.md diff --git a/docs/src/graphql/queries/search-filtering.md b/docs/src/querying/search-and-filtering.md similarity index 100% rename from docs/src/graphql/queries/search-filtering.md rename to docs/src/querying/search-and-filtering.md