MCPcopy Index your code
hub / github.com/YsarocK/fetch-appwrite-types

github.com/YsarocK/fetch-appwrite-types @v2.2.2

Chat with this repo
repository ↗ · DeepWiki ↗ · release v2.2.2 ↗ · + Follow
23 symbols 61 edges 18 files 1 documented · 4%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

fetch-appwrite-types banner

Generate Typesript types from Appwrite Databases

npm npm tests

Quick usage

Make sure ton add the following values to your .env : APPWRITE_ENDPOINT APPWRITE_PROJECT_ID APPWRITE_API_KEY

Then run the following command :

npx fetch-appwrite-types

Installation

# yarn
yarn add fetch-appwrite-types

# npm
npm install fetch-appwrite-types

Make sure ton add the following values to your .env : APPWRITE_ENDPOINT APPWRITE_PROJECT_ID APPWRITE_API_KEY

import { FetchNewTypes } from "fetch-appwrite-types/dist/main";

await FetchNewTypes();

Parameters

Name Default value Description
outDir "/types" The folder where the type file will be generated
outFileName "appwrite" The name of the generated type file
includeDBName false Add the collection name at start of types
hardTypes false Creates an Email type and an URL types. More.

Usage

CLI

Params can be passed as arguments in any order, except for the outDir which might be followed by the path.

npx fetch-appwrite-types includeDBName outDir /types outFileName appwrite hardTypes

Library

await FetchNewTypes({
    outDir: "/types",
    outFileName: "appwrite",
    includeDBName: true,
    hardTypes: true
})

Handled types

Appwrite type Generated type (simple) Generated type (hard)
String string string
Integer integer integer
Float integer integer
Boolean boolean boolean
DateTime string Date
Email string Email
IP string string
URL string URL
Enum Enum Enum
Relationship Reference to Type Reference to Type

Hard types

The hard types are types that are not native to typescript, but are often used in the context of a web application. They are generated as classes with methods to validate and parse the data.

Name Value
Email ${string}@${string}.${string}
URL ${string}://${string}.${string}

Extension points exported contracts — how you extend this code

registerRelationship (Interface)
* * @param attribute The attribute to find the type of * @param outDir The directory to output the types to * @param
src/utils/GenerateType.ts
FetchParameters (Interface)
(no doc)
src/types/FetchParameters.ts
BooksType (Interface)
(no doc)
tests/models/default.ts
BooksDocument (Interface)
(no doc)
tests/models/default.ts
OthersBooksType (Interface)
(no doc)
tests/models/default.ts
OthersBooksDocument (Interface)
(no doc)
tests/models/default.ts
LibraryBooksType (Interface)
(no doc)
tests/models/dbName.ts

Core symbols most depended-on inside this repo

normalizeContent
called by 16
tests/utils/normalizeContent.ts
cleanupFile
called by 11
tests/utils/cleanupFile.ts
FetchNewTypes
called by 7
src/main.ts
FormatCollectionName
called by 3
src/utils/FormatCollectionName.ts
GenerateType
called by 1
src/utils/GenerateType.ts
CreateHardFieldsTypes
called by 1
src/utils/CreateHardFieldsTypes.ts

Shape

Interface 14
Function 6
Enum 3

Languages

TypeScript100%

Modules by API surface

tests/models/hardTypes.ts5 symbols
tests/models/default.ts5 symbols
tests/models/dbName.ts5 symbols
src/utils/GenerateType.ts2 symbols
tests/utils/normalizeContent.ts1 symbols
tests/utils/cleanupFile.ts1 symbols
src/utils/FormatCollectionName.ts1 symbols
src/utils/CreateHardFieldsTypes.ts1 symbols
src/types/FetchParameters.ts1 symbols
src/main.ts1 symbols

For agents

$ claude mcp add fetch-appwrite-types \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page