{"_id":"@azimutt/serde-aml","_rev":"1-a6339630e23fab64f48aa22c6f05a682","name":"@azimutt/serde-aml","dist-tags":{"latest":"0.1.1"},"versions":{"0.1.0":{"name":"@azimutt/serde-aml","version":"0.1.0","description":"Parse and Generate AML.","keywords":[],"homepage":"https://azimutt.app","author":{"name":"Loïc Knuchel","email":"loicknuchel@gmail.com","url":"https://loicknuchel.fr"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/azimuttapp/azimutt.git","directory":"libs/serde-aml"},"main":"./out/index.js","types":"./out/index.d.ts","scripts":{"setup":"npm install && npm run build","test":"jest","build":"rm -rf ./out && tsc","update":"npm update --save-dev && npm update --save && npm install","dry-publish":"npm run build && npm test && npm pack"},"dependencies":{"@azimutt/models":"^0.1.0","@azimutt/utils":"^0.1.0","chevrotain":"10.5.0"},"devDependencies":{"@chevrotain/types":"^10.5.0","@jest/globals":"^29.7.0","@types/jest":"^29.5.12","jest":"^29.7.0","ts-jest":"^29.1.2","typescript":"^5.4.5"},"_id":"@azimutt/serde-aml@0.1.0","gitHead":"f26972d7a89701d8606311768a16d0f45b9bbef2","bugs":{"url":"https://github.com/azimuttapp/azimutt/issues"},"_nodeVersion":"21.6.0","_npmVersion":"10.3.0","dist":{"integrity":"sha512-gwLvTmlfnGJa/6cX0dJK8J/gWvgIl+j2Yeg3ONSn9cQ+FoxRcs9FKKEwvjCysxhjNIlTZ9WbNwtka4EX3Ny3YA==","shasum":"7558ff4acfa9068009e506e5953e2da3cae40653","tarball":"https://registry.npmjs.org/@azimutt/serde-aml/-/serde-aml-0.1.0.tgz","fileCount":27,"unpackedSize":105902,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCOSeNMKR6CRr3xgSJKWmAWTMWN0F80ZiPgA6LSmVqnzQIgdfqvC3WNIRr/ToKYYJwh5zL4PpGyvgbILLOnzMSGCtU="}]},"_npmUser":{"name":"loicknuchel","email":"loicknuchel@gmail.com"},"directories":{},"maintainers":[{"name":"sbouaked","email":"sbouaked@pm.me"},{"name":"loicknuchel","email":"loicknuchel@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/serde-aml_0.1.0_1713992378697_0.018298235197017787"},"_hasShrinkwrap":false},"0.1.1":{"name":"@azimutt/serde-aml","version":"0.1.1","description":"Parse and Generate AML.","keywords":[],"homepage":"https://azimutt.app","author":{"name":"Loïc Knuchel","email":"loicknuchel@gmail.com","url":"https://loicknuchel.fr"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/azimuttapp/azimutt.git","directory":"libs/serde-aml"},"main":"./out/index.js","types":"./out/index.d.ts","scripts":{"setup":"npm install && npm run build","test":"jest","build":"rm -rf ./out && tsc","update":"npm update --save-dev && npm update --save && npm install","dry-publish":"npm run build && npm test && npm pack"},"dependencies":{"@azimutt/models":"^0.1.4","@azimutt/utils":"^0.1.1","chevrotain":"10.5.0"},"devDependencies":{"@chevrotain/types":"^10.5.0","@jest/globals":"^29.7.0","@types/jest":"^29.5.12","jest":"^29.7.0","ts-jest":"^29.1.2","typescript":"^5.4.5"},"_id":"@azimutt/serde-aml@0.1.1","gitHead":"2ff38bf9096e42c3ea09da9ffced55283ad0d438","bugs":{"url":"https://github.com/azimuttapp/azimutt/issues"},"_nodeVersion":"21.6.0","_npmVersion":"10.3.0","dist":{"integrity":"sha512-nLs/A+myweV33OZazZM87fJQ6Lx4CXE7rKuGGS9OlnWHm2cQQMSGKCbI1jsvwKkFaNFaY7gCov1wmAmRY4wlaw==","shasum":"cfc42e2f20c86e8c418d85a694f6fdc670d05e8c","tarball":"https://registry.npmjs.org/@azimutt/serde-aml/-/serde-aml-0.1.1.tgz","fileCount":27,"unpackedSize":105902,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEEQotI6HLQdlA962UxgFLIAX+tLYjrrXURPif7ZHAmSAiBUlY+nDQYKiO2OjRhLTAVftKM+tKJVGJbtedrba9JO+g=="}]},"_npmUser":{"name":"loicknuchel","email":"loicknuchel@gmail.com"},"directories":{},"maintainers":[{"name":"sbouaked","email":"sbouaked@pm.me"},{"name":"loicknuchel","email":"loicknuchel@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/serde-aml_0.1.1_1715701246245_0.3071080128779111"},"_hasShrinkwrap":false}},"time":{"created":"2024-04-24T20:59:38.597Z","0.1.0":"2024-04-24T20:59:38.880Z","modified":"2024-05-14T15:40:46.667Z","0.1.1":"2024-05-14T15:40:46.471Z"},"maintainers":[{"name":"sbouaked","email":"sbouaked@pm.me"},{"name":"loicknuchel","email":"loicknuchel@gmail.com"}],"description":"Parse and Generate AML.","homepage":"https://azimutt.app","keywords":[],"repository":{"type":"git","url":"git+https://github.com/azimuttapp/azimutt.git","directory":"libs/serde-aml"},"author":{"name":"Loïc Knuchel","email":"loicknuchel@gmail.com","url":"https://loicknuchel.fr"},"bugs":{"url":"https://github.com/azimuttapp/azimutt/issues"},"license":"MIT","readme":"# @azimutt/serde-aml\n\n**Work In Progress**\n\nThis is a module to validate, parse and generate AML. And also provide syntax highlighter for it.\n\nRead the full [AML documentation](./docs/README.md).\n\nAML syntax ideas:\n```aml\n# define a global namespace for the definitions\n# each top level is optional (valid ones: \"schema\", \"catalog.schema\", \"database.catalog.schema\")\n# it can be overriden by each declaration if specified, ex: pg.sales.public.usrers table will not be in database.catalog.schema namespace\nnamespace database.catalog.schema\n\n# properties are the default ones but can be changed in each layout\nusers {color: red, tags: [auth, common]}\n  id uuid pk {autoincrement: true}\n  name varchar\n  email varchar unique\n  description text nullable\n  created_at timestamp=`now()`\n\nroles\n  id uuid pk\n  name varchar unique\n  priority int=0\n\nuser_roles\n  user_id uuid pk\n  role_id uuid pk\n\nuser_roles_ext\n  user_id uuid pk\n  role_id uuid pk\n  details json\n\nevents\n  id uuid pk\n  item_kind varchar\n  item_id uuid\n\nbooks\n  id uuid pk\n  title varchar\n  authors uuid[] >- users.id\n\nbook_details\n  book_id uuid pk\n  details json\n    isbn varchar\n    price json\n      currency varchar\n      value float8\n\n# basic relation, with properties\nrel user_roles(user_id) >- users(id) {delete: cascade, update: no action}\n\n# composite relation\nrel user_roles_ext(user_id, role_id) >- user_roles(user_id, role_id)\n\n# polymorphic relation\nrel events(item_id) >item_kind=User- users(id)\nrel events(item_id) -item_kind=Role> roles(id)\n\n# many-to-many relation\nrel books(id) <> users(id)\n\n# one-to-one relation\nrel book_details(book_id) -- books(id)\n\nbugs |||\n  This is a multiline note fot the table\n  It can be used to describe the table or the relation\n|||\n  id uuid |||\n    a multiline note for a column\n  |||\n  name varchar |||\n    a multiline note for a column\n  |||\n  status bug_status |||\n    💸 1 = processing, \n    ✔️ 2 = shipped, \n    ❌ 3 = cancelled,\n    😔 4 = refunded\n  |||\n\ntype bug_status enum(new, in progress, done) {...props} | note # comment\n```\n\nRelationships:\n- one-to-many: normal foreign keys: `rel user_roles.user_id >- users.id` or inline in column: `  user_id >- users.id`\n- many-to-one: reverse foreign keys: `rel users.id -< user_roles.user_id` but not inline in column => useless, not implemented\n- many-to-many: native in db, junction table or array column: `rel books.id >< users.id`, `  authors uuid[] >< users.id` or with junction table\n- one-to-one: foreign key with unique constraint `fk book_details.book_id -- books.id` or inline in column: `  book_id unique -- books.id`\n- zero-to-many: foreign key from nullable column\none-to-one and many-to-many relations can be \"manually\" specified without the schema constraints to be present (unique or junction table)\nInteresting discussion: https://community.dbdiagram.io/t/tutorial-many-to-many-relationships/412\n\nOther concepts:\n- multiline notes: `|||`, remove the leading spaces of the first line, for all the lines\n- custom types: `type $name $definition`, definition is optional and can be parsed more...\n  - `type bug_status enum(new, in progress, done)`\n  - `type bug_value range(subtype = float8, subtype_diff = float8mi)`\n  - `type address {number: int, street: varchar}`\n- if a fk column don't have a type, it takes the type of the referenced column\n\n## Publish\n\n- update `package.json` version\n- update lib versions (`npm run update` + manual) & run `npm install`\n- test with `npm run dry-publish` and check `azimutt-serde-aml-x.y.z.tgz` content\n- launch `npm publish --access public`\n\nView it on [npm](https://www.npmjs.com/package/@azimutt/serde-aml).\n","readmeFilename":"README.md"}