{"_id":"type-l","_rev":"30-738566c8733707ac2e21f74575dc54f3","name":"type-l","description":"This project only exists because and is entirely based on projects like:","dist-tags":{"latest":"1.2.8"},"versions":{"1.3.0":{"name":"type-l","version":"1.3.0","description":"This project only exists because and is entirely based on projects like:","main":"lib/index.js","directories":{"test":"test"},"scripts":{"build":"./scripts/build.sh","test":"npm run build && node build-test-schema.js && karma start --single-run"},"author":{"name":"Victor Queiroz","email":"victorcqueirozg@gmail.com"},"license":"MIT","devDependencies":{"babel":"^6.5.2","babel-cli":"^6.18.0","babel-core":"^6.18.2","babel-loader":"^6.2.7","babel-plugin-add-module-exports":"^0.2.1","babel-plugin-transform-es2015-modules-commonjs":"^6.18.0","babel-preset-es2015":"^6.18.0","babel-preset-stage-0":"^6.16.0","babel-preset-stage-1":"^6.16.0","babel-preset-stage-2":"^6.18.0","babel-preset-stage-3":"^6.17.0","brfs":"^1.4.3","json-loader":"^0.5.4","karma":"^1.3.0","karma-mocha":"^1.3.0","karma-phantomjs-launcher":"^1.0.2","karma-sourcemap-loader":"^0.3.7","karma-webpack":"^1.8.0","mocha":"^3.1.2","raw-loader":"^0.5.1","transform-loader":"^0.2.3","webpack":"^1.13.3"},"dependencies":{"jsbn":"^0.1.0","mkdirp":"^0.5.1","nunjucks":"^3.0.0"},"gitHead":"0638d60d1f16f9353126b81e073c76130da900ef","_id":"type-l@1.3.0","_shasum":"65d451e17cbdaa840ba38f1b3ce2119ab521219b","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.7.2","_npmUser":{"name":"victorqueiroz","email":"victorcqueirozg@gmail.com"},"dist":{"shasum":"65d451e17cbdaa840ba38f1b3ce2119ab521219b","tarball":"https://registry.npmjs.org/type-l/-/type-l-1.3.0.tgz","integrity":"sha512-WVRASjq9AimavPJwbwAt0wS4bfhztejmlYlV3iAIWBP0x3zYrTQHtxTnkzYD+jNS7px49zOXGrtvDlbE+6+Duw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAysPwN6zuyvLKJmIGNWh1Knph95IzEX6zIK2N94rydkAiEAlbGcuSDLdGxeUZMoIzRkpyFsXxc/Q/da7oLZbjxD5gk="}]},"maintainers":[{"name":"victorqueiroz","email":"victorcqueirozg@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/type-l-1.3.0.tgz_1489506218641_0.9028494795784354"}},"1.2.8":{"name":"type-l","version":"1.2.8","description":"This project only exists because and is entirely based on projects like:","main":"lib/index.js","directories":{"test":"test"},"scripts":{"test":"make test"},"author":{"name":"Victor Queiroz","email":"victorcqueirozg@gmail.com"},"license":"MIT","devDependencies":{"babel":"^6.5.2","babel-cli":"^6.18.0","babel-core":"^6.18.2","babel-loader":"^6.2.7","babel-plugin-add-module-exports":"^0.2.1","babel-plugin-transform-es2015-modules-commonjs":"^6.18.0","babel-preset-es2015":"^6.18.0","babel-preset-stage-0":"^6.16.0","babel-preset-stage-1":"^6.16.0","babel-preset-stage-2":"^6.18.0","babel-preset-stage-3":"^6.17.0","brfs":"^1.4.3","gaze":"^1.1.2","json-loader":"^0.5.4","karma":"^1.3.0","karma-mocha":"^1.3.0","karma-phantomjs-launcher":"^1.0.2","karma-sourcemap-loader":"^0.3.7","karma-webpack":"^1.8.0","mocha":"^3.1.2","raw-loader":"^0.5.1","shelljs":"^0.7.6","transform-loader":"^0.2.3","webpack":"^1.13.3"},"dependencies":{"buffer":"^5.0.1","decimal.js":"^7.1.0","jsbn":"^1.1.0","lodash":"^4.17.2","long":"^3.2.0","mathjs":"^3.8.0","mkdirp":"^0.5.1","nunjucks":"^3.0.0"},"gitHead":"c51ec6c4857d1ae31c1bb8eedfe2f572992c88c4","_id":"type-l@1.2.8","_shasum":"7c5d4648f1ff5441b30886273e779545ef53428b","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.7.1","_npmUser":{"name":"victorqueiroz","email":"victorcqueirozg@gmail.com"},"dist":{"shasum":"7c5d4648f1ff5441b30886273e779545ef53428b","tarball":"https://registry.npmjs.org/type-l/-/type-l-1.2.8.tgz","integrity":"sha512-zUOAbqw8m+LWTunrEKpzlHF1CEOXw3+BLB3SEAluHVl5ZwUlWdAC2SRihPf1JjgYq0nW82xenFkniBrZr+ds/w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGpNSUSCCOKIDc89Q+7wKfpSu+Mv8IBXyxZgGJ9q502wAiEAmiPL2FpavOmAE0usQYP8Vxyh5aVQg+P3+dleM9XAmAw="}]},"maintainers":[{"name":"victorqueiroz","email":"victorcqueirozg@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/type-l-1.2.8.tgz_1506958033617_0.9038854704704136"}}},"readme":"# type-l\n\nThis project only exists because and is entirely based on projects like:\n\n- [telegram-mt-node](https://github.com/enricostara/telegram-mt-node)\n- [telegram-tl-node](https://github.com/enricostara/telegram-tl-node)\n- [webogram](https://github.com/zhukov/webogram/tree/master/app/js)\n\n## Building schema\n\n```js\nconst tl = require('type-l');\nconst gulp = require('gulp');\n\ngulp.task('build-schemas', function() {\n    const builder = new tl.SchemaBuilder({\n        schemas: [{\n            prefix: 'mtproto', // Prefix and ES6 import id\n            methods: require('./test/schema/mt-schema.json').methods,\n            predicates: require('./test/schema/mt-schema.json').predicates\n        }, {\n            prefix: 'TL', // Prefix and ES6 import id\n            methods: require('./test/schema/api-schema.json').methods,\n            predicates: require('./test/schema/api-schema.json').predicates\n        }],\n        nunjucks: require('nunjucks')\n    });\n\n    const destFolder = path.resolve(__dirname, 'src/schema');\n\n    builder.build().forEach(file => {\n        const fullPath = path.resolve(destFolder, file.filePath);\n\n        console.log('Creating', fullPath);\n\n        mkdirp.sync(path.dirname(fullPath));\n        fs.writeFileSync(fullPath, transform(file));\n    });\n\n    function transform() {\n        // do some Babel transformation?\n    }\n});\n```\n\n## Dynamically Built Types usage\n```js\n// Of course you can use a better approach like `mtproto/index.js` or something like that\nimport { TypeVector, tl, mtproto } from './mtproto/__do_not_edit__/schema';\n\nclass MakeADifference extends TypeVector {\n    constructor(options) {\n        super(options);\n    }\n}\n\nconst msgContainer = new mtproto.MsgContainer({\n    props: {\n        msgs: new MakeADifference({\n            type: 'mtproto.msg',\n            list: [\n                new mtproto.Msg({\n                    props: {\n                        msgId: '0x' + crypto.randomBytes(8).toString('hex'),\n                        body: new mtproto.NiceTypeThatBETeamCreated({\n                            props: {\n                                pain: crypto.randomBytes(2048)\n                            }\n                        }).serialize()\n                    }\n                })\n            ]\n        })\n    }\n});\n\nconst buffer = msgContainer.serialize();\n```\n\nIf you want to build your type files dynamically. Check our example on [build-test-schema.js](https://github.com/VictorQueiroz/type-l/blob/master/build-test-schema.js).\n\nLooking for usage example? Check it out [test/SchemaBuilder.js](https://github.com/VictorQueiroz/type-l/blob/master/test/SchemaBuilder.js)\n\n## Running tests\n\nFirst the basics\n\n```\ngit clone https://github.com/VictorQueiroz/type-l\ncd type-l\n```\n\nExecuting the tests is pretty much like:\n\n```\nnpm install\nnpm test\n```\n","maintainers":[{"email":"victorcqueirozg@gmail.com","name":"vqueiroz"}],"time":{"modified":"2022-06-28T00:43:42.971Z","created":"2016-11-29T00:46:57.222Z","1.0.0":"2016-11-29T00:46:57.222Z","1.0.1":"2016-11-30T17:45:56.772Z","1.0.5":"2016-11-30T22:41:33.991Z","1.0.6":"2016-12-01T02:29:32.614Z","1.1.0":"2016-12-08T04:41:21.072Z","1.1.2":"2016-12-09T20:02:27.610Z","1.1.3":"2016-12-16T03:00:29.411Z","1.1.4":"2016-12-18T01:19:21.375Z","1.1.5":"2016-12-21T21:12:46.080Z","1.1.6":"2016-12-21T21:33:32.097Z","1.2.0":"2017-03-02T19:35:00.400Z","1.2.1":"2017-03-04T02:52:05.832Z","1.2.2":"2017-03-08T22:15:51.435Z","1.3.0":"2017-03-14T15:43:40.734Z","1.2.8":"2017-10-02T15:27:14.716Z"},"author":{"name":"Victor Queiroz","email":"victorcqueirozg@gmail.com"},"license":"MIT","readmeFilename":"README.md"}