{"_id":"@agilearchitects/dooter","_rev":"2-e0ba3dd553c2bd63c21dafeb06aa09c0","name":"@agilearchitects/dooter","dist-tags":{"latest":"0.1.2"},"versions":{"0.1.0":{"name":"@agilearchitects/dooter","version":"0.1.0","main":"lib/index.js","author":{"name":"Agile Architects AB","email":"contact@agilearchitects.se"},"license":"MIT","scripts":{"build":"tsc","watch":"tsc --watch","test":"jest","lint":"eslint src/**/*.ts","prepublishOnly":"yarn test && yarn lint && yarn build"},"dependencies":{"typescript":"^4.8.3"},"devDependencies":{"@jest/globals":"^29.0.3","@types/jest":"^29.0.3","@typescript-eslint/eslint-plugin":"^5.38.0","@typescript-eslint/parser":"^5.38.0","eslint":"^8.23.1","eslint-plugin-import":"^2.26.0","jest":"^29.0.3","ts-jest":"^29.0.1","ts-node":"^10.9.1"},"_id":"@agilearchitects/dooter@0.1.0","dist":{"shasum":"c2fcfff444dcea41ed57bc24a1211d2820c58765","integrity":"sha512-6LlN2UouEbEuu2k3apP3sOvc6y/k+/yccybYv/WHFRwRY4q4L6t8cn/C17nC3YeQ/n1/jPF6ZW5O824td92s7g==","tarball":"https://registry.npmjs.org/@agilearchitects/dooter/-/dooter-0.1.0.tgz","fileCount":15,"unpackedSize":31513,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHeCnE4BXGBP6SAf6w+fX/o+dRtNHoxp6Np0lLU7wqf+AiEA4T+yvPck7hOfNUX3SybCybHG86+DSpaz3rwP7LQkGgw="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjKaLhACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqfqQ//ZsZLw6PybW765j+Cu9SjpjXAqcGbmmqetvdWppZstyaska18\r\n24jdq1OjbNm2a+Pkc6rXTh+B+l4LhN04iqGm3cQymW/67zi37Ux/tjkcEUga\r\n2/2sjvRC2Rcr/8e1j8T94eqgG+zkNpx/RKF9E3hv/nOgmLkmfDaW4iMUT0QE\r\nC0j9pTstXYcpG0W3AITqhG9QeZ8HPURIzxwirs1fysPBaNe5WdTcfJ4abF00\r\n8uMZuIR1pcGItzEEFlJt/YF3S5bf42zMrxLcY4BPRNnr7QUIHwTjcHRaYAq1\r\nrcQzPm5HnbDjDbvV/eS9Any4IYtmqtWGVN8dDpS3+RvySJoqFat49whelYSF\r\nHH9N5t2UXljAZmit48ng9axxwa/KhD2ScWOnkihHyPNFLeFjzYUa9udI1alK\r\nOHmMw9ouPlgCy6AiI1wQggczy8bQ1lwo9cHiA6csUrrWv8eUzKCqRNjtAHwi\r\nSBhpDxLxAN0AK1bj5tXJHUx+yrocCsGb11pfbU6NUZSEBObzA3O4kKc9KejX\r\n2YaaN/hey2foYTttXhDqnYAOGcaDUuWZGX0RTEN2OJZUAAKtU6iZaIaCmjRZ\r\nrEjVmK28QL25VM7V0rJV5znVg5cxUDprovnNL9DBjTFp95xKYzKBmsCzEuqA\r\nUaUw8AHE64ghOO9uFlZ1rbK0AGJvo91fD2M=\r\n=Scvt\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"hannesdahlberg","email":"hannes@dwik.se"},"directories":{},"maintainers":[{"name":"hannesdahlberg","email":"hannes@dwik.se"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/dooter_0.1.0_1663673057339_0.819585396422428"},"_hasShrinkwrap":false},"0.1.1":{"name":"@agilearchitects/dooter","version":"0.1.1","main":"lib/index.js","author":{"name":"Agile Architects AB","email":"contact@agilearchitects.se"},"license":"MIT","scripts":{"build":"tsc","watch":"tsc --watch","test":"jest","lint":"eslint src/**/*.ts","prepublishOnly":"yarn test && yarn lint && yarn build"},"dependencies":{"typescript":"^4.8.3"},"devDependencies":{"@jest/globals":"^29.0.3","@types/jest":"^29.0.3","@typescript-eslint/eslint-plugin":"^5.38.0","@typescript-eslint/parser":"^5.38.0","eslint":"^8.23.1","eslint-plugin-import":"^2.26.0","jest":"^29.0.3","ts-jest":"^29.0.1","ts-node":"^10.9.1"},"description":"Library for creating descriptive schemas from typescript interfaces and validating JSON object according to same type of schemas","_id":"@agilearchitects/dooter@0.1.1","dist":{"shasum":"de98f3a5ad93d63ba0ab82b6ed32245ee4e40b17","integrity":"sha512-o4Szt+SL4oOl/zO7BV2E4JDut7yUz8XW0HzMqj4TgKIohhKlM2iDAoEZOwgqr80UB8x+aWMxZRiOKn4KUNZ/Fw==","tarball":"https://registry.npmjs.org/@agilearchitects/dooter/-/dooter-0.1.1.tgz","fileCount":16,"unpackedSize":35645,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDz+kBC+O5L2dTuNUstUdGkdh3L8kz90k3Huk6n+GW9BAIhALtfxv+7/KFNSZ5v4moxT1T5XFkRTf6oE1OS/Mfj5s9a"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjKcFTACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqIgg//R/oRkqp3cKxtTgdFobHz3kdd3uZjs6TtGQNcwRGIeWjDRExa\r\nG6FcDgPQN+iq/ubOR/Rh1EG6AwKjrC7tzd8ANaZkDEhvLFv0ptqcWsmhUw0X\r\n0Roq9XQIn+KudA9wYIXnioK9nOczqM9lxNjAH50ZdpcyWG6sQw8cOWmC4pW6\r\no3WRkX9DzjdBMQEQEERn+pxMK0cNboQ0FNhGp5hKb/dlYBzJj2zUqIxvI/r2\r\nKtQlUxz3ouJhtQNFCXsl/OwF37FK2mdeDDne4ynFO7RcqL6D5xqk7rBZPPjH\r\niiMHgOi0thU0eggwvQfda5DwQMoTOJVTlvkqFaKd8qXV0lBzH3pps70bFhro\r\n8WVM67P5h8gI6rCuH5jG8A3ZbbWixuRt1oBVIh7ngyG3jexHUFUXIrYNbEl/\r\nsC0l+fZVEoJfeG3hINo0WfveaU6QWo99Coj8nK9nQmJ6A2QG9faBT2CJxgqW\r\ndQ8nwK0kOwWDEIcaDy8mSlMqyr0gHKaz28GjnYYl59dgqgc7VK6+uT5O50XC\r\npNzXZHhthMgdZax1kIpihRZqAGo5P2ST1uko+XWIn+i/rm6rdkV1bY7wDXYe\r\nRQF1uobV+AM65LWN4Z9b+3+85CMLlqnpwXmShU6ZKjeruHqhnNwSYJUkAV3V\r\ncqZPm1piFF/HC+vHvgTAw2taBN8zGRfc6OQ=\r\n=Tm6P\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"hannesdahlberg","email":"hannes@dwik.se"},"directories":{},"maintainers":[{"name":"hannesdahlberg","email":"hannes@dwik.se"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/dooter_0.1.1_1663680851565_0.40473279951380414"},"_hasShrinkwrap":false},"0.1.2":{"name":"@agilearchitects/dooter","version":"0.1.2","main":"lib/index.js","author":{"name":"Agile Architects AB","email":"contact@agilearchitects.se"},"license":"MIT","scripts":{"build":"tsc","watch":"tsc --watch","test":"jest","lint":"eslint src/**/*.ts","prepublishOnly":"yarn test && yarn lint && yarn build"},"dependencies":{"typescript":"^4.8.3"},"devDependencies":{"@jest/globals":"^29.0.3","@types/jest":"^29.0.3","@typescript-eslint/eslint-plugin":"^5.38.0","@typescript-eslint/parser":"^5.38.0","eslint":"^8.23.1","eslint-plugin-import":"^2.26.0","jest":"^29.0.3","ts-jest":"^29.0.1","ts-node":"^10.9.1"},"description":"Library for creating descriptive schemas from typescript interfaces and validating JSON object according to same type of schemas","_id":"@agilearchitects/dooter@0.1.2","dist":{"shasum":"f7181d0b50de34e7248839e199fd436efb9b571b","integrity":"sha512-Elfg12zIk0QcDCq/ZvVGJSmMdWVKwYnBHqwFL2GyU06Hka3XthV0Zi16OaFEcCu7nGKIJ4quxL3S3fMLA5DdZQ==","tarball":"https://registry.npmjs.org/@agilearchitects/dooter/-/dooter-0.1.2.tgz","fileCount":16,"unpackedSize":35687,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCjZ4+xmaKxQ6YQbVaAkwA6/l0jLlN99emOd28c4A9ETQIgUYA1s/1mWgrzqzb0ioUJWMpDe7VX1SMnL6dg04NjOKA="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjKcYaACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqVWBAAhiYWeTqDgwoj7lOvj+/MuYbvaGBkbaMFyjL9L4HuEXpmoCAY\r\ntUcBtfq6qK3E24Tv5QyfAcHyovrhYT5TLapR/PfyYSDf2pfaZ6VbVbnobM01\r\n5APgNZqprCuKgl/4Q4RJJoG3ZRZvDI1KVy7wOpKsQUVPF3ZXSoCftAquWUJ/\r\nFg0tKxiA8imOjRSU6a6To1yJP83smpIS3W6BljKdLLomzVW05sUqYxVx6XsU\r\nGcrnarbOtYE3GicLU2cptqj4fPykOmFVA+PC2SHSdKXCelWOlGjCBcYz9LV0\r\nAenQg1s5kA+mhcgogG0d2Iqw0P9ZGVCK6phBZQn10sJ+rlecseZF0mn9IKIb\r\nxsCZjBWsmNLKO/q75z6IwNZYUwSSnNVQhk5IYPz/Yf6y3FI3Kvd/hKFG7jc3\r\nG8bz2m6pz2+lJADGMs3FkLdYu1/mMikwHbJ17F4DH4+Y/atsrdxLHZU3aT/C\r\nVv+aThPD29bY5zJ0vdDKON8LPhriFDZoBJUfkRqJ1yn52Yy9a8bVAt+pzXtY\r\nyDuGRcOJ2kMj5ClQJiUFoSuqUaoEwuouYEl/V6lDAmGRmaRX4Oi+Yvq+w34c\r\nGdk9uQS19pnUsPeyRM8dElLQRTEs8MBLEV0mBVAofzlyGgvPpwz+CHcBj8yl\r\nIEgZwB5KDbTPRl3RybT9y99Eiq1/E23zCVM=\r\n=1Dc2\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"hannesdahlberg","email":"hannes@dwik.se"},"directories":{},"maintainers":[{"name":"hannesdahlberg","email":"hannes@dwik.se"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/dooter_0.1.2_1663682074240_0.2976487196146649"},"_hasShrinkwrap":false}},"time":{"created":"2022-09-20T11:24:17.284Z","0.1.0":"2022-09-20T11:24:17.718Z","modified":"2022-09-20T13:54:34.500Z","0.1.1":"2022-09-20T13:34:11.794Z","0.1.2":"2022-09-20T13:54:34.406Z"},"maintainers":[{"name":"hannesdahlberg","email":"hannes@dwik.se"}],"author":{"name":"Agile Architects AB","email":"contact@agilearchitects.se"},"license":"MIT","readme":"# Dooter\nLibrary for creating descriptive schemas from typescript interfaces and validating JSON object according to same type of schemas\n\n## Restrictions\n**!!!INTERFACES MUST BE NAMED WITH PREFIXED \"I\", NAME IN PASCAL CASE AND SUFFIXED \"DTO\" EG: \"book\" = \"IBookDTO\"!!!**\n\n**!!!INTERFACE FILES MUST BE NAMED IN KEBAB CASE PREFIXED WITH \".dto\". EG: \"bookStore\" = \"book-store.dto.ts\"!!!**\n\nThis will most likely be updated with custom naming overide possibilities \n\n## Examples\n\n### Create schema from interface\n`// test/dto/author.dto.ts`\n```ts\n// Swedish authors\nexport interface IAuthorDTO {\n  // Authors lastname\n  lastname: string;\n  // Authors firstname (if exists)\n  firstname?: string;\n}\n````\n\nWith typescript:\n```ts\nimport { fileToSchema } from \"@agilearchitects/dooter\";\nconst schema = fileToSchema(\"./test/dto/author.dto.ts\", \"IAuthorDTO\");\nconsole.log(JSON.stringify(schema, null, 2))\n```\nOutputs:\n```json\n{\n  \"name\": \"author\",\n  \"description\": \"Swedish authors\",\n  \"properties\": {\n    \"lastname\": {\n      \"type\": \"string\",\n      \"description\": \"Authors lastname\"\n    },\n    \"firstname\": {\n      \"type\": \"string\",\n      \"description\": \"Authors firstname (if exists)\",\n      \"optional\": true\n    }\n  }\n}\n```\n*Comments on the line right before a schema or prop definition maps to corresponding description in schema*\n\nOr with multiple files\n```ts\nimport { filesToSchemas } from \"@agilearchitects/dooter\";\nconst schemas = filesToSchemas(\"./test/dto\", [\"book\", \"author\"]);\nconsole.log(JSON.stringify(schemas, null, 2))\n```\n\nOutputs:\n```json\n{\n  \"book\": {\n    \"description\": \"Swedish books\",\n    \"properties\": {\n      \"title\": \"string\",\n      \"author\": {\n        \"type\": \"author[]\",\n        \"description\": \"Book title\"\n      },\n      \"store\": {\n        \"type\": \"string | string[]\",\n        \"description\": \"Book author\"\n      },\n      \"binding\": {\n        \"type\": \"'hardcover' | 'spiral'\",\n        \"description\": \"Book store name(s)\",\n        \"optional\": true\n      }\n    }\n  },\n  \"author\": {\n    \"description\": \"Swedish authors\",\n    \"properties\": {\n      \"lastname\": {\n        \"type\": \"string\",\n        \"description\": \"Authors lastname\"\n      },\n      \"firstname\": {\n        \"type\": \"string\",\n        \"description\": \"Authors firstname (if exists)\",\n        \"optional\": true\n      }\n    }\n  }\n}\n```\n### Parse object\nThe `parseObject` allows validation of an object as type\n\nSimple validation of object and type\n```ts\nimport { parseObject } from \"@agilearchitects/dooter\";\nconst obj = \"hello world\";\nconst type = \"string\";\nparseObject(obj, type));\n```\n`parseObject` will either return the object itself or throw an error if not valid\n\nUnion type is also acceptable\n```ts\nimport { parseObject } from \"@agilearchitects/dooter\";\nconst obj1 = \"hello world\";\nconst obj2 = 2;\nconst type = \"string | number\";\nparseObject(obj1, type));\nparseObject(obj2, type));\n```\n\nAs well as array type\n```ts\nimport { parseObject } from \"@agilearchitects/dooter\";\nconst obj = [\"hello\", \"world\"];\nconst type = \"string[]\";\nparseObject(obj, type));\n```\n\nUnion type IS NOT allowed. Eg. `\"(string, number)[]\"`\n\nAllowed types are: `string`, `number`, `boolean`, `null`, `undefined`, `true` and `false`. String and numeric literals are also allowed for enum behavior.\n\n```ts\nimport { parseObject } from \"@agilearchitects/dooter\";\nconst type = \"'blue' | 'green' | 'yellow'\";\nparseObject(\"blue\", type));\nparseObject(\"green\", type));\nparseObject(\"brown\", type)); // Will throw error\n```\nString literals are encased with single quotes\n\n### Parse schema\n`parseObject` also allowes schema input for parsing nested objects mapping to schema names\n\n```ts\nimport { filesToSchemas, parseObject } from \"@agilearchitects/dooter\";\n\nconst schemas = filesToSchemas(\"./test/dto\", [\"book\", \"author\"]);\nconst author = {\n    firstName: \"Jon\"\n    lastName: \"Doe\",\n  };\nconst book = [{\n  title: \"My Book\",\n  author: [author, {\n    lastName: \"Walker\"\n  }],\n  store: \"The bookStore\",\n  binding: \"hardcover\"\n}, {\n  title: \"My Second Book\",\n  author: [author],\n  store: [\"The Bookstore\", \"Amazing\"]\n}]\nparseObject(books, \"book\", schemas);\nparseObject(author, \"author\", schemas);\n```","readmeFilename":"README.md","description":"Library for creating descriptive schemas from typescript interfaces and validating JSON object according to same type of schemas"}