{"id":16440813,"url":"https://github.com/idevelopthings/surrealdb-schema","last_synced_at":"2025-10-27T03:31:17.100Z","repository":{"id":64969517,"uuid":"580096933","full_name":"iDevelopThings/surrealdb-schema","owner":"iDevelopThings","description":"This package provides functionality for parsing SurrealDB schema information from the database API, it then proves classes/structure for those parsed definitions.","archived":false,"fork":false,"pushed_at":"2023-01-21T20:05:30.000Z","size":61,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-04-23T23:47:01.356Z","etag":null,"topics":["database","schema","surrealdb","typescript"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/surrealdb.schema","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iDevelopThings.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-12-19T17:57:35.000Z","updated_at":"2023-08-20T22:05:30.000Z","dependencies_parsed_at":"2023-02-12T12:16:01.879Z","dependency_job_id":null,"html_url":"https://github.com/iDevelopThings/surrealdb-schema","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iDevelopThings%2Fsurrealdb-schema","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iDevelopThings%2Fsurrealdb-schema/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iDevelopThings%2Fsurrealdb-schema/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iDevelopThings%2Fsurrealdb-schema/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iDevelopThings","download_url":"https://codeload.github.com/iDevelopThings/surrealdb-schema/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219861915,"owners_count":16555980,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["database","schema","surrealdb","typescript"],"created_at":"2024-10-11T09:13:07.443Z","updated_at":"2025-10-27T03:31:16.776Z","avatar_url":"https://github.com/iDevelopThings.png","language":"TypeScript","readme":"\u003cbr\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://surrealdb.com#gh-dark-mode-only\" target=\"_blank\"\u003e\n        \u003cimg width=\"300\" src=\"https://raw.githubusercontent.com/surrealdb/surrealdb/bcac94f9d6ee154fd6ec2b5c0c910525b0c23b7a/img/white/logo.svg\" alt=\"SurrealDB Logo\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://surrealdb.com#gh-light-mode-only\" target=\"_blank\"\u003e\n        \u003cimg width=\"300\" src=\"https://raw.githubusercontent.com/surrealdb/surrealdb/bcac94f9d6ee154fd6ec2b5c0c910525b0c23b7a/img/black/logo.svg\" alt=\"SurrealDB Logo\"\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\n\n\n\u003ch2\u003eSurrealDB Schema\u003c/h2\u003e\n\n## Description\nThis package provides functionality for parsing SurrealDB schema information from the database API, it then proves classes/structure for those parsed definitions.\n\n## Installation\nTo install this package, run the following command in your project directory:\n```bash\nnpm install surrealdb.schema\nyarn add surrealdb.schema\n```\n\n## Usage\nHere is an example of how to use this package to parse your database schema:\n\n```typescript\nimport {SurrealSchema} from 'surreal.schema';\n\nconst surrealSchema = SurrealSchema.init({\n\thost      : \"http://127.0.0.1:8000\",\n\tuser      : \"root\",\n\tpass      : \"secret\",\n\tnamespace : \"test\",\n\tdatabase  : \"test\",\n});\n\nawait surrealSchema.getSchema(); // Returns `Schema` instance\n\n// There is also:\nawait surrealSchema.getDbInfo();\nawait surrealSchema.getTableInfo(\"table name\");\nawait surrealSchema.getTablesInfo([\"one\", \"two\"]);\n```\n\n### Schema:\n\n```typescript\ninterface ISchema {\n\ttables: { [name: string]: SchemaTable };\n\thasTable(name: string): boolean;\n\tgetTable(name: string): SchemaTable;\n\tgetTables(): SchemaTable[];\n\tgetTableNames(): string[];\n\tgetFullSchema(): string;\n}\n```\n\n### Table\n```typescript\ninterface ISchemaTable {\n\toriginalString: string;\n\tname: string;\n\ttitle: string;\n\tfields: { [name: string]: SchemaField };\n\thasField(name: string): boolean;\n\tgetField(name: string): SchemaField;\n\tgetFieldNames(): string[];\n\tgetFields(): SchemaField[];\n\tgetFullSchema(): string;\n}\n```\n\n### Field\n```typescript\ninterface ISchemaField {\n\toriginalString: string;\n\tname: string;\n\ttitle: string;\n\ttable: string;\n\ttype: string;\n\trecord: string;\n\tassert: string;\n\tchild: SchemaField;\n\tisArrayChild: boolean;\n}\n```\n\n## Contributing\nWe welcome contributions to this package! If you have an idea for a new feature or a bug fix, please open an issue or submit a pull request.\n\n## License\nThis package is licensed under the [MIT License](https://github.com/git/git-scm.com/blob/main/MIT-LICENSE.txt).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fidevelopthings%2Fsurrealdb-schema","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fidevelopthings%2Fsurrealdb-schema","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fidevelopthings%2Fsurrealdb-schema/lists"}