{"_id":"@amn31/convert2sequelize","_rev":"3-d9d5cfc66b292e0c78afef4412ed8a17","name":"@amn31/convert2sequelize","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.0":{"name":"@amn31/convert2sequelize","version":"1.0.0","description":"Permet la conversion d'une requête SQL vers sequelize pour les methode find({where: xxx}), findAndCountAll(),etc ...","main":"index.js","scripts":{"check":"ts-node test\\test-convert.ts","build":"tsc","node":"node server.js","test":"echo \"Error: no test specified\" && exit 1"},"author":{"name":"Morillon Alain","url":"amn31t@gmail.com"},"license":"ISC","repository":{"type":"git","url":"git+https://github.com/amn31/convert2sequelize.git"},"keywords":["convert","query","sequelize","sql"],"bugs":{"url":"https://github.com/amn31/convert2sequelize/issues"},"homepage":"https://github.com/amn31/convert2sequelize#readme","dependencies":{"sequelize":"^6.3.5"},"devDependencies":{"ts-node":"~8.3.0","tslint":"~6.1.0","typescript":"~4.0.2"},"gitHead":"fd8745358fbacf443dce9a8427fbe3f826bd6e32","_id":"@amn31/convert2sequelize@1.0.0","_nodeVersion":"12.16.3","_npmVersion":"6.14.4","dist":{"integrity":"sha512-gb3/5Ntd2l6wEM9lJrDzbdB12LwK0G5/gGBRkeCfz0uiVejQvEJQkx1ISKtW+ItiObPr9LYcG7/Q/dHrRsxqKQ==","shasum":"7bc59f3533fd820de6299c8e6a45f48c53cf6fbb","tarball":"https://registry.npmjs.org/@amn31/convert2sequelize/-/convert2sequelize-1.0.0.tgz","fileCount":9,"unpackedSize":41582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf+vVLCRA9TVsSAnZWagAA+98QAJ6s0Fq6NABg0pnYjtZI\nBu5/EVSVAvPZBwZtYLJ/E3OKUjmUJ1kcQwS+T9kpxithvPLvCPPvRr/PB/eP\nJdyuyVEChe7y+vPtrYBX8ed0JLojxiY76ga+FMk567JCg7Bm6WPTUU3YHdGd\nJAaU2PaoQraIY9CSM6Bj1SLHGzL5u2BPCez/PBH4Veoth+QHUTawc3LAKZ26\nf2VOCDx/rCYIB7Qmtsb1vBms7uFO7/ov+2Mebhmke4FEl7avEKPT2ULXolWe\nTCSUqnxGGXFQMoIk3LtnhU2rbCh2JTx4ILhd/QvUGgq4TtBnPuJY8JBYM24R\naul4wEEmNYg8y++BSaGDKJCM+2o6f9moOYA5xAP/9ZqmNJMU5uyJQ4YCLk3r\nt1pXvwB1uZ4ld51QHhO+tBaxF2NL5L5TyJVpzZRtuKS9yOdyEEUSEbElo4vd\ntuzMKEyl9a7Ts4IHCdZ69sa/bfxRDzKplaHsM/5NPBGypBhUTyw9Bhcxp8ef\nIigOIu7X3H885rzKHmRHBEdg132BVkvu7RgDTqvsPmRjjGtmCzsYWO09hGsf\n2E9k7acGRPJbl9lRwYgIFVw5ZjwxgGK+rzTcbWJFYBCXW9SvbBxdPpT0Ahp3\nbdcdoGOqCITaB9XmgXPonR/rRyrRFUxabR1ej/m5V4Us38uPWk7MilEgOvQU\n+j+E\r\n=4uJ9\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIENMlFngqTKdpSBkw7/mouwn+Aqw58hVTR3VkgTESNc7AiEAtb262pBKGzmVGbbvgu/74522Y0zFX4DJodAIeKUnuTs="}]},"_npmUser":{"name":"amn31t","email":"amn31t@gmail.com"},"directories":{},"maintainers":[{"name":"amn31t","email":"amn31t@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/convert2sequelize_1.0.0_1610282314509_0.27346905432248936"},"_hasShrinkwrap":false},"1.0.1":{"name":"@amn31/convert2sequelize","version":"1.0.1","description":"Send your Sequelize queries from frontend (client side like Angular) to the backend (NodeJS) for methods: find({where: xxx}), findAndCountAll(),etc ...","main":"dist/lib/db-convert.js","types":"dist/lib/db-convert.d.ts","scripts":{"check":"ts-node test\\test-convert.ts","build":"tsc","node":"node server.js","test":"echo \"Error: no test specified\" && exit 1"},"author":{"name":"Morillon Alain","url":"amn31t@gmail.com"},"license":"ISC","repository":{"type":"git","url":"git+https://github.com/amn31/convert2sequelize.git"},"keywords":["convert","query","sequelize","sql"],"bugs":{"url":"https://github.com/amn31/convert2sequelize/issues"},"homepage":"https://github.com/amn31/convert2sequelize#readme","dependencies":{"sequelize":"^6.3.5"},"devDependencies":{"ts-node":"~8.3.0","tslint":"~6.1.0","typescript":"~4.0.2"},"directories":{"lib":"lib","test":"test"},"gitHead":"b8234496f332383faea00b3dbefc70f8da909c07","_id":"@amn31/convert2sequelize@1.0.1","_nodeVersion":"12.16.3","_npmVersion":"6.14.4","dist":{"integrity":"sha512-Fl+PqMmlVWBFJFhFwZzI7KJhsrmOYE4wCe16EElAhZgbvDT8U7Efm0AyJBcJcpA7Q3TNM1phR5WL3AcRz4zWHQ==","shasum":"d5d1ab0830170881c9ecf0962d96ce44017aacd8","tarball":"https://registry.npmjs.org/@amn31/convert2sequelize/-/convert2sequelize-1.0.1.tgz","fileCount":9,"unpackedSize":43346,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf+/uzCRA9TVsSAnZWagAAiosQAIv84yvpDqUnVDzSPn2f\niC5N53xPk9yASq7LLN4OxHQ59jBcF8G+21dRHzMrz+TX2Q6m2uNounU63MWy\n89bEOa/KVSD5EU9Zgy3xIgTJdAb5bN/xfwKLygnOieabQHeKc3PjZDtkqqF0\nf3KUYgmxOCVi435IsBMl6O9/wFHREmz5ZX7t5BY4EwsckfeYNoc6L+oqeGuD\nKaZyPmXfOlmspsMLkgFksHfPJAgxbzRjTVmCUtxhXQLrJBb4MddveEb/GGSf\npUniLQD9CGWcQ9Cz7NGkGlg83pP0TGhIKjce1qKn870d3c8nC3qhDMe7mY+/\nevvvjP0jUTmJSCWDV/owo6OXkLFSvVUgMLdZWWg4Ma8eZyTCkHChxxv80zpR\nF2C2S2psLN2/hBjJKxnhGcw1NwF0HK1wWyATE+rsiRk8U66XJUSxAy4OVwz/\noPCRMWvqXvs1RoqddSM6Q+6qmRV2/W5FzDo6/Ixpb9ahQ7ErA43fWnlQb5Lr\nJbJmf0FtGrRTvNhxyJMXf6/VSrTqSO7Wsl+jRbosoDz9DEVCv/QrGsLy9yXn\nF0+EhnkbXiZGc5Rj6A3nJ9SbR9C9eF4xkyhJebVGvpLSU59sX+Oe8V37xi89\nEXseuGDb7cF6UlRImOMRrt0QdhjrI9x9K2Hfb69b/bh+hfKnCWwGEJk4ae39\n+JzB\r\n=//Y5\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHH18V6Gh8KchemlmFHyg1ags6L6FrfmhUBhDjXFKyxsAiATSzD1ta3LoyQuEli07+eKaxuu/n+i6vFchdFlao86Xw=="}]},"_npmUser":{"name":"amn31t","email":"amn31t@gmail.com"},"maintainers":[{"name":"amn31t","email":"amn31t@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/convert2sequelize_1.0.1_1610349491326_0.11571774709925209"},"_hasShrinkwrap":false},"1.0.2":{"name":"@amn31/convert2sequelize","version":"1.0.2","description":"Send your Sequelize queries from frontend (client side like Angular) to the backend (NodeJS) for methods: find({where: xxx}), findAndCountAll(),etc ...","main":"dist/lib/db-convert.js","types":"dist/lib/db-convert.d.ts","scripts":{"check":"ts-node test\\test-convert.ts","build":"tsc","node":"node server.js","test":"echo \"Error: no test specified\" && exit 1"},"author":{"name":"Morillon Alain","url":"amn31t@gmail.com"},"license":"ISC","repository":{"type":"git","url":"git+https://github.com/amn31/convert2sequelize.git"},"keywords":["convert","query","sequelize","sql"],"bugs":{"url":"https://github.com/amn31/convert2sequelize/issues"},"homepage":"https://github.com/amn31/convert2sequelize#readme","dependencies":{"sequelize":"^6.3.5"},"devDependencies":{"ts-node":"~8.3.0","tslint":"~6.1.0","typescript":"~4.0.2"},"directories":{"lib":"lib","test":"test"},"gitHead":"287b65c56b06f5399c11bcc5bbd3675344abd8e7","_id":"@amn31/convert2sequelize@1.0.2","_nodeVersion":"12.16.3","_npmVersion":"6.14.4","dist":{"integrity":"sha512-u6ol8wbscOxtm/NpgR/SqxqnSkHFt7NF+pRq6oQcWo9AgxNMcQ5dW806HsvrIc3y87lttBrlWEuIXAEuws67Og==","shasum":"24f5d8770efc1ecfa86195875e248eec4f83b649","tarball":"https://registry.npmjs.org/@amn31/convert2sequelize/-/convert2sequelize-1.0.2.tgz","fileCount":9,"unpackedSize":43336,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf+/2DCRA9TVsSAnZWagAATJ8P/joBVCzZWsTLydpzo58P\nXYklTBv1Re0hRK4xuOI61ypwpfJLalgGbmWRtHTKytrb5JR4DfyA7gzdpb5W\nWNoyf1Nq1QigThQvq10HhsNfHWcXwvmVpmmmMR2GdiCT0JZAS1Ib+a3ilb0P\n1LZT+EsSdM44COsAWon329g3U16eyhFT5rBWYJegL9TtivupFeDvHyR8lHee\nOV77iLwkJe8cQvgcn3gno5p1o+QYwkEZ02pRsaKXALUTdBO+d2G81i/PqxXs\nJy1Td5bLlQ5rETToJIXq/jxU7NzgsxJcgDbpgOwBBx1sm8GGNNOiQc9Kbba6\n6UtfdZLTK2Ml2KQkQF8ft5OQVXkAvIIXSV4LSULCtQeXuO+HaixyZMzbtJwS\nMOUikxMtSK7yvwV4Axk5KeEl9E+dDHNT4jvPZeMopeWDZYoEuT1s54zuBoVw\nhwEMeLk0+Xg6k+89X4anwBoJDqsQ7+pWZ7rWe6CAiWorwFwgFpWlieDiI2cw\nlBB7Kx7O1Gp1Z5vPe4F7B4qPqpabdG7UWPY0SRTc9ltFRhRVU/H4NPsJvq42\nUusijOVeQ8b9D29c9XvJ0M8Sh+xobWO6RNue+Iz0VT+NSI1UX92VSyEcqEI7\nMiwDmBr+wVeBvVdVJDwe23PPkqpb3RL+EnsRhp68F3sJTkJj4Xau//0jqBs5\ng06i\r\n=0Smd\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC6pmKvUQr/16E2W5oATpaGB5sdTTsDszWuwYTFfF8PrQIgavelBld3/6Ib1BjHAGn40HAii+fTZ2ox39VHcx5IkqQ="}]},"_npmUser":{"name":"amn31t","email":"amn31t@gmail.com"},"maintainers":[{"name":"amn31t","email":"amn31t@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/convert2sequelize_1.0.2_1610349955304_0.9239383443755602"},"_hasShrinkwrap":false}},"time":{"created":"2021-01-10T12:38:34.282Z","1.0.0":"2021-01-10T12:38:34.705Z","modified":"2022-04-04T13:50:16.309Z","1.0.1":"2021-01-11T07:18:11.509Z","1.0.2":"2021-01-11T07:25:55.428Z"},"maintainers":[{"name":"amn31t","email":"amn31t@gmail.com"}],"description":"Send your Sequelize queries from frontend (client side like Angular) to the backend (NodeJS) for methods: find({where: xxx}), findAndCountAll(),etc ...","homepage":"https://github.com/amn31/convert2sequelize#readme","keywords":["convert","query","sequelize","sql"],"repository":{"type":"git","url":"git+https://github.com/amn31/convert2sequelize.git"},"author":{"name":"Morillon Alain","url":"amn31t@gmail.com"},"bugs":{"url":"https://github.com/amn31/convert2sequelize/issues"},"license":"ISC","readme":"\r\n# Send your Sequelize queries from frontend to the backend \r\n\r\nOn the Backend side, [Sequelize](https://sequelize.org) allows you to create database query requests from a \r\n[specific model](https://sequelize.org/master/manual/model-querying-basics.html).\r\n\r\nTo send querying from a client like [Angular](https://angular.io/), a JSON can be sent to the backend\r\nand can be converted by the Convert2Sequelize module in order to create the final Sequelize query.\r\n\r\nSequelize also offers to perform raw queries using SQL queries .\r\nConvert2Sequelize module converts the JSON to generate the SQL query.\r\n\r\n\r\n# Frontend: Define request from Angular Client or other\r\n\r\n```ts\r\n\r\n    // Example of request \r\n    let whereJSON = [ \r\n            [\r\n                \"Imei\",\r\n                \"not like\",\r\n                \"'%33680090%'\"\r\n            ],\r\n            \"and\",\r\n            [\r\n                [\r\n                    \"EnrollmentStatus\",\r\n                    \"=\",\r\n                    \"Unnrolled\"\r\n                ],\r\n                \"or\",\r\n                [\r\n                    \"EnrollmentStatus\",\r\n                    \"=\",\r\n                    \"Enrolled\"\r\n                ],\r\n            ]\r\n        ]\r\n```\r\n\r\n# Backend: Installation\r\n\r\n$ npm install @amn31/convert2sequelize\r\n\r\n\r\n# Backend: Convert JSON to Sequelize\r\n\r\nHow use Convert2Sequelize ?\r\n\r\n```ts\r\n  \r\n   import { CompleteConditions , Convert2Sequelize} from \"@amn31/convert2sequelize\"\r\n\r\n    // Create instance\r\n    const convert = new Convert2Sequelize();\r\n\r\n    /* Example: 1 */\r\n    // Convert JSON \r\n    let whereSequelize = convert.convertToSequelize(whereJSON);\r\n    // Example with findAndCountAll \r\n    dataModel.findAndCountAll( {\r\n        // the where has been converted\r\n        where: whereSequelize,\r\n\r\n        attributes: [\r\n            [Sequelize.fn('DISTINCT', Sequelize.col('isLeasing')), 'distinct_Leasing']\r\n        ]\r\n    });\r\n\r\n    /* Example: 2 */\r\n    // Convert JSON to SQL :\r\n    // ( Imei not like '%33680090%' ) and (  ( EnrollmentStatus = 'Enrolled' ) or ( EnrollmentStatus = 'Unenrolled' )  \r\n\r\n    // Sequelize can be used for Raw Queries \r\n    let SQLquery = 'SELECT * From Users WHERE ' + convert.convertToSQL(conditions);\r\n    const { QueryTypes } = require('sequelize');\r\n\r\n    const users = await sequelize.query(SQLquery, { type: QueryTypes.SELECT });\r\n```\r\n\r\n### Operators \r\n\r\n```sql\r\n    and\r\n    or\r\n    '='\r\n    '!='\r\n    '>'\r\n    '<'\r\n    '>='\r\n    '<='\r\n    like\r\n    'not like'\r\n    ilike\r\n    'not ilike'\r\n    regex\r\n    notRegexp\r\n    iregex\r\n    'not iregex'\r\n    startswith\r\n    endswith\r\n    contains\r\n    isnull\r\n    isnotnull\r\n```\r\n\r\n## License\r\n\r\n[MIT](LICENSE)\r\n\r\n[Angular](https://angular.io/)\r\n\r\n[Sequelize](https://sequelize.org/master/manual/model-querying-basics.html)\r\n\r\n","readmeFilename":"README.md"}