{"id":17677971,"url":"https://github.com/astrohelm/metaforge","last_synced_at":"2025-06-15T21:42:47.314Z","repository":{"id":199747016,"uuid":"702660333","full_name":"astrohelm/metaforge","owner":"astrohelm","description":"Library 📝 that allow you to describe data structures by subset of JavaScript syntax and validate them at runtime","archived":false,"fork":false,"pushed_at":"2024-05-24T12:26:38.000Z","size":342,"stargazers_count":3,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-04T06:03:27.310Z","etag":null,"topics":["astrohelm","checker","dsl","generator","javascript","json","json-schema","lightweight","metadata","metalanguage","modular","modular-design","modules-architecture","nodejs","runtime-verification","schema","testing","types","validation","zero-dependencies"],"latest_commit_sha":null,"homepage":"https://astrohelm.ru","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/astrohelm.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-10-09T18:38:42.000Z","updated_at":"2023-12-04T23:39:48.000Z","dependencies_parsed_at":"2024-10-23T06:02:37.923Z","dependency_job_id":null,"html_url":"https://github.com/astrohelm/metaforge","commit_stats":{"total_commits":30,"total_committers":1,"mean_commits":30.0,"dds":0.0,"last_synced_commit":"0c684925bfc8ffc5fd29a0c7950e2abfe8b7f7ee"},"previous_names":["astrohelm/astroplan","astrohelm/metaforge"],"tags_count":9,"template":false,"template_full_name":"astrohelm/node-workspace","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astrohelm%2Fmetaforge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astrohelm%2Fmetaforge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astrohelm%2Fmetaforge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astrohelm%2Fmetaforge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/astrohelm","download_url":"https://codeload.github.com/astrohelm/metaforge/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253830910,"owners_count":21971001,"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":["astrohelm","checker","dsl","generator","javascript","json","json-schema","lightweight","metadata","metalanguage","modular","modular-design","modules-architecture","nodejs","runtime-verification","schema","testing","types","validation","zero-dependencies"],"created_at":"2024-10-24T08:03:16.899Z","updated_at":"2025-05-12T21:58:01.349Z","avatar_url":"https://github.com/astrohelm.png","language":"JavaScript","readme":"\u003ch1 align=\"center\"\u003eMetaForge v1.0.0 🕵️\u003c/h1\u003e\n\n## Describe your data structures by subset of JavaScript and:\n\n- 📝 Generate data relational structures (types, jsdoc, diagrams, migrations, etc.)\n- 🔎 Validate it in runtime with strict \u0026 partial validations\n- 👀 Send it to other server to validate data consistency\n- 🛠️ Handle it with custom modules\n- 💉 Calculate fields\n\n## Installation\n\n```bash\nnpm i metaforge --save\n```\n\n## Usage example\n\n```js\nconst userSchema = new Schema({\n  $id: 'userSchema',\n  $meta: { '@name': 'User', '@description': 'Schema for user testing' }, //? JSDOC\n  phone: { $type: 'union', types: ['number', 'string'] }, //? number or string\n  name: { $type: 'set', items: ['string', '?string'] }, //? set tuple\n  phrase: (sample, parent, root) =\u003e 'Hello ' + [...parent.name].join(' ') + ' !', // Calculated fields\n  mask: { $type: 'array', items: 'string' }, //? array of strings\n  ip: {\n    $meta: { '@description': 'User ip adress' },\n    $type: 'array',\n    $required: false,\n    $rules: [ip =\u003e ip[0] === '192'], //? custom rules\n    items: {\n      $type: 'union',\n      types: ['string', 'number', 'null'], // Array\u003cstring | null | number\u003e\n      condition: 'oneof',\n      $required: true,\n    },\n  },\n  type: ['elite', 'member', 'guest'], //? enum\n  '/[a-Z]+Id/': { $type: '?number', isPattern: true }, // pattern fields\n  address: 'string',\n  secondAddress: '?string', // optional fields\n  options: { notifications: 'boolean', lvls: ['number', 'string'] },\n});\n\nconst systemSchema = new Schema({ $type: 'array', items: userSchema });\n\nconst sample = [\n  {\n    myId: 1,\n    phone: '7(***)...',\n    ip: ['192', 168, '1', null],\n    type: 'elite',\n    mask: ['255', '255', '255', '0'],\n    name: new Set(['Alexander', undefined]),\n    options: { notifications: true, lvls: [2, '[\"admin\", \"user\"]'] },\n    address: 'Pushkin street',\n  },\n  //...\n];\n\nsystemSchema.warnings; // Inspect warnings after build\nsystemSchema.calculate(sample); // Will assign calculated fields\nsystemSchema.test(sample); // Schema validation\nsystemSchema.dts('SystemInterface'); // Typescript generation\nsystemSchema.pull('userSchema').test(sample[0]); // Subschema validation\nsystemSchema.pull('userSchema').test({ phone: 123 }, 'root', true); // Partial validation\nsystemSchema.pull('userSchema'); // Metadata: {..., name: 'user', description: 'schema for users testing'}\n```\n\n## Docs\n\n- ### [About modules / plugins](./docs/modules.md#modules-or-another-words-plugins)\n  - [Writing custom modules](./docs/modules.md#writing-custom-modules)\n  - [Metatype](./modules/types/README.md) | generate type annotations from schema\n  - [Handyman](./modules/handyman/README.md) | quality of life module\n  - [Metatest](./modules/test/README.md) | adds prototype testing\n- ### [About prototypes](./docs/prototypes.md#readme-map)\n  - [How to build custom prototype](./docs/prototypes.md#writing-custom-prototypes)\n  - [Contracts](./docs/prototypes.md#schemas-contracts)\n\n\u003ch2 align=\"center\"\u003eCopyright \u0026 contributors\u003c/h2\u003e\n\n\u003cp align=\"center\"\u003e\nCopyright © 2023 \u003ca href=\"https://github.com/astrohelm/metaforge/graphs/contributors\"\u003eAstrohelm contributors\u003c/a\u003e.\nThis library is \u003ca href=\"./LICENSE\"\u003eMIT licensed\u003c/a\u003e.\u003cbr/\u003e\nAnd it is part of \u003ca href=\"https://github.com/astrohelm\"\u003eAstrohelm ecosystem\u003c/a\u003e.\n\u003c/p\u003e\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fastrohelm%2Fmetaforge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fastrohelm%2Fmetaforge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fastrohelm%2Fmetaforge/lists"}