{"_id":"@autotelic/fastify-cloudprnt","_rev":"5-fd5fb175fd4fc75e87dc56a3e625ca9e","name":"@autotelic/fastify-cloudprnt","dist-tags":{"latest":"0.5.0","rc":"0.3.2-rc.1"},"versions":{"0.1.0":{"name":"@autotelic/fastify-cloudprnt","version":"0.1.0","description":"Fastify plugin to run a server following the Star Micronics CloudPRNT protocol.","keywords":["fastify","cloudprnt","cloud-prnt","star-micronics"],"homepage":"https://github.com/autotelic/fastify-cloudprnt#readme","bugs":{"url":"https://github.com/autotelic/fastify-cloudprnt/issues"},"repository":{"type":"git","url":"git+https://github.com/autotelic/fastify-cloudprnt.git"},"license":"MIT","author":{"name":"Autotelic Development Ltd","email":"info@autotelic.com"},"main":"index.js","scripts":{"example:basic":"docker compose -f docker-compose.basic-example.yaml up","example:basic:start":"fastify start -w -l info -P -o examples/basic/index.js","example:redis":"docker compose -f docker-compose.redis-example.yaml up","example:redis:start":"fastify start -w -l info -P -o examples/redis/index.js","fix":"standard --fix","lint":"standard","test":"c8 --100 ava","test:docker":"docker compose -f docker-compose.test.yaml up","validate":"npm run lint && npm run test"},"lint-staged":{"*.{js,jsx}":["npm run fix"]},"dependencies":{"fastify-plugin":"^3.0.0"},"devDependencies":{"ava":"^5.2.0","c8":"^7.10.0","fastify":"^3.0.0","fastify-cli":"^3.0.0","husky":"^8.0.1","lint-staged":"^13.0.3","node-cache":"^5.1.2","nunjucks":"^3.2.3","point-of-view":"^4.16.0","redis":"^4.5.1","sinon":"^15.0.1","standard":"^17.0.0"},"peerDependencies":{"point-of-view":"^4.16.0"},"engines":{"node":">=12.x"},"gitHead":"6ffc3bda35f4d9ba4162d25e954bb061f5c67e37","_id":"@autotelic/fastify-cloudprnt@0.1.0","_nodeVersion":"18.14.0","_npmVersion":"9.3.1","dist":{"integrity":"sha512-7f4JYYBEQxf9e6HGNbCbcRBtLBFqUTzvkW4MEl0NnxqKHxAgaijMjbA3ppViRUNPL1iYq1HkquE8kGMArHVk4w==","shasum":"f8ab952bf8cc84a595f01a2e85b50f717f090df1","tarball":"https://registry.npmjs.org/@autotelic/fastify-cloudprnt/-/fastify-cloudprnt-0.1.0.tgz","fileCount":8,"unpackedSize":12400,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCMPMEWsRzOB2PtPllstlSQ4npJYHoD4s7zUVG+Fl9/UAIgEce535pVK2IiZE78xBEzAxWvzfEOTl7vysyIqCBfYs8="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj7reyACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqdLQ//XQxeg14tyQBPdDTiF9qTPs6+WWrHBiIxHheB3VB0d7YqFR5/\r\n1OzT5nUhyFKIuGYKH3Zz0WyuMfngIOPbqDOXfrsxmIQrUebtRu1nld2BaLMc\r\nS3nOXaszDzZPP0/pY1CE2ov2vTDWO82V6dOcgbz+jNuPeix6az5XGnEuc4lV\r\nHpXN0q09ctJpMES++sypLvE708p1dEmzPYJbXo8oW6f7/b2cwn9qymzNljNp\r\n19FHls0b/PxwAca+odnFEWary17PUtSqjCoEsqD4epWHJYpWBjJSAz9ftOGN\r\nyx5K5bVta7jeI4sKnSZ8knepzZHB3UMdGVtSJab7VG+eOK3kd8C74qmoySwS\r\nMi803Hl60UD9XsSI7UZdQHicLpz/HCKYhZPHC69OxxSKjB7UBvvKIfUu0Buo\r\n2O+VjEYQBGS3rzOUaNiT8IksX9P4CmIEzZGc7/lxPRPZWyI36RnCGYMq8Kz+\r\n3NZADwOQ54cqG+mUI0N9oEFQY/d8wTY6ii+iz/+WlaP07NMpIZikzH+gygaq\r\ny8AV0Wgn2eO0H8FWEFef3qTzBdaw3Nj/zKcqrMLGqhWgzodL1/ot3xMs1Hnt\r\nXaFxdybU/dIgrq5Zw9AjPVKzkNTRv1y7orgzCHwTN/hHrKmTd0pJwK1OiR8o\r\nJDfDwwM3IHPX1zBH3lL42gaWwey2QokCr5I=\r\n=4idt\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"autotelic","email":"info+npm@autotelic.com"},"directories":{},"maintainers":[{"name":"autotelic","email":"info+npm@autotelic.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/fastify-cloudprnt_0.1.0_1676588978156_0.39965245184892884"},"_hasShrinkwrap":false},"0.3.0":{"name":"@autotelic/fastify-cloudprnt","version":"0.3.0","description":"Fastify plugin to run a server following the Star Micronics CloudPRNT protocol.","keywords":["fastify","cloudprnt","cloud-prnt","star-micronics"],"homepage":"https://github.com/autotelic/fastify-cloudprnt#readme","bugs":{"url":"https://github.com/autotelic/fastify-cloudprnt/issues"},"repository":{"type":"git","url":"git+https://github.com/autotelic/fastify-cloudprnt.git"},"license":"MIT","author":{"name":"Autotelic Development Ltd","email":"info@autotelic.com"},"main":"index.js","scripts":{"example:basic":"docker compose -f docker-compose.basic-example.yaml up","example:basic:start":"fastify start -w -l info -P -o examples/basic/index.js","example:redis":"docker compose -f docker-compose.redis-example.yaml up","example:redis:start":"fastify start -w -l info -P -o examples/redis/index.js","fix":"standard --fix","lint":"standard","test":"c8 --100 ava","test:docker":"docker compose -f docker-compose.test.yaml up","validate":"npm run lint && npm run test"},"lint-staged":{"*.{js,jsx}":["npm run fix"]},"dependencies":{"fastify-plugin":"^3.0.0"},"devDependencies":{"ava":"^5.2.0","c8":"^7.10.0","fastify":"^3.0.0","fastify-cli":"^3.0.0","husky":"^8.0.1","lint-staged":"^13.0.3","node-cache":"^5.1.2","nunjucks":"^3.2.3","point-of-view":"^4.16.0","redis":"^4.5.1","sinon":"^15.0.1","standard":"^17.0.0"},"peerDependencies":{"point-of-view":"^4.16.0"},"engines":{"node":">=12.x"},"gitHead":"ee49f080cc447ca647a6ddfbbac85ff0081827c6","_id":"@autotelic/fastify-cloudprnt@0.3.0","_nodeVersion":"18.14.0","_npmVersion":"9.3.1","dist":{"integrity":"sha512-AKq6K8FSPzOGNjX70tHhGPF3Mi8yIwx6Rhx9bgZ6m82hY97XVpo2paKsLjrd5MV18pgzP+0qjoOmoxprjpuPoQ==","shasum":"454bc41158530df0b02ca4b0bd09188fca9b25d2","tarball":"https://registry.npmjs.org/@autotelic/fastify-cloudprnt/-/fastify-cloudprnt-0.3.0.tgz","fileCount":8,"unpackedSize":12269,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDfvPotGX5ZOp6DKf6zB0gIpcfXbOZe12Lx2HZdAxFTNgIhAL0CyRlCjULgu2C9RYO40EGun+k2bVqdCr3Vh2E5/q+y"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj8CQgACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpmSw/+J1oLQ8Y3zCzVa7F2KcQNhRzKqC+c1uUjIvR4Zt4ZDi3Lroqk\r\nwSW5gHd2m6f9/AAv9XnBjRViI9XG9OnaWCkl/KyOdla7/IVbu2yjvS+cPG6a\r\nDUSKBakEHsh7K4Zf/z8oj0UGPxQ4+zXxGCX9BsZyyPbI8eCZVihkN9Zba+7i\r\nTmUkuZdtuCV5mc4Nm73FtweFl/GwnfAmL+Ts87tZPIkACTcbdOTSDzMeuxX4\r\nJ3JYuIsuhMHVhe1P0mtAyhba3YZYTo7OjVAfVTKgS8/8AS3e/OTLrE1hf+yH\r\nu06PizmSQlzqEtJjv4LwrOfcHH3M1uVjcSbwHddJxglYBdn0fm6dzDyTGZpP\r\n4AJeiEyUGVl+5kcL1lFI1OkAfxpzDnhaz4vQs1g1ied+r1CtUwB6xcUBW4b5\r\nQ7pCAQ3EdJ+IyVpGcEX68iUbdUqodbv0xQFOc67ZEMZpOLZVvk7Y4eB04heF\r\nzckFCi5GWtJpQUleLG5+VVUfdPKWf202jW/W3aymSvZMhdonlApsP+uQlaEc\r\nIq9oxkADIGGzlWr67xrcT2N6um+GP75xhwFQjM7hWr+U4i4ZcfH2PMo7yZWy\r\n/B+E8Db9tk/yDmRwhWdGsZYpJ325QglBVIDosuMRsu33Si9dHFefCi9BPNpq\r\nJ09GlfPr1I57Tf0FJyWT+o0DOrOZ2UHwOc8=\r\n=tptz\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"autotelic","email":"info+npm@autotelic.com"},"directories":{},"maintainers":[{"name":"autotelic","email":"info+npm@autotelic.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/fastify-cloudprnt_0.3.0_1676682272715_0.05231592736901525"},"_hasShrinkwrap":false},"0.3.1":{"name":"@autotelic/fastify-cloudprnt","version":"0.3.1","description":"Fastify plugin to run a server following the Star Micronics CloudPRNT protocol.","keywords":["fastify","cloudprnt","cloud-prnt","star-micronics"],"homepage":"https://github.com/autotelic/fastify-cloudprnt#readme","bugs":{"url":"https://github.com/autotelic/fastify-cloudprnt/issues"},"repository":{"type":"git","url":"git+https://github.com/autotelic/fastify-cloudprnt.git"},"license":"MIT","author":{"name":"Autotelic Development Ltd","email":"info@autotelic.com"},"main":"index.js","scripts":{"example:basic":"docker compose -f docker-compose.basic-example.yaml up","example:basic:start":"fastify start -w -l info -P -o examples/basic/index.js","example:redis":"docker compose -f docker-compose.redis-example.yaml up","example:redis:start":"fastify start -w -l info -P -o examples/redis/index.js","fix":"standard --fix","lint":"standard","test":"c8 --100 ava","test:docker":"docker compose -f docker-compose.test.yaml up","validate":"npm run lint && npm run test"},"lint-staged":{"*.{js,jsx}":["npm run fix"]},"dependencies":{"fastify-plugin":"^3.0.0"},"devDependencies":{"ava":"^5.2.0","c8":"^7.10.0","fastify":"^3.0.0","fastify-cli":"^3.0.0","husky":"^8.0.1","lint-staged":"^13.0.3","node-cache":"^5.1.2","nunjucks":"^3.2.3","point-of-view":"^4.16.0","redis":"^4.5.1","sinon":"^15.0.1","standard":"^17.0.0"},"peerDependencies":{"point-of-view":"^4.16.0"},"engines":{"node":">=12.x"},"gitHead":"35b70f255b8b3fa02f93a926f38c2c44de6d2407","_id":"@autotelic/fastify-cloudprnt@0.3.1","_nodeVersion":"18.14.1","_npmVersion":"9.3.1","dist":{"integrity":"sha512-GMlnDaqrdIPH8oAT6dkUizeyO3+EtnXYA3tNC7P+AwEA63b0IJFXD3f0E9WAOYOKcAhbs1GybhM4adIphVIlCA==","shasum":"a4846647193e51e56ad7f7bcb26c24cc0eef353c","tarball":"https://registry.npmjs.org/@autotelic/fastify-cloudprnt/-/fastify-cloudprnt-0.3.1.tgz","fileCount":10,"unpackedSize":13987,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCm1B0gYzQ1eT4tnlzdl/FUINCfdnCQyx/N3DRO1FCtxwIgY9tyl4vFfFSJ/2RnYdtyLK7Yn0C1fxzw2Q4rPxKSg+I="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj/XlVACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmogcBAAmA1hpMKGqIIPFKXwUtYOMwY9+Nniupy3bvRcNJoinIl7tjiG\r\ncmomplGMB1VeHzhtKlnewZmuY4FRFOm5PoarIsytDJAWnhqr8kTKB81DLWpp\r\nK7ktWj9quBpaACj4mAI7aaW+RyAfMkQI0h7DKekolWdmq1F1vX0MkvEIsBSY\r\nM6MtdpdJO06pYE3eYDPn8BYs6zo/CJctIEzERsA3ED+x1aUmrQoj8LWTmpjM\r\n4lPq0gkHaaf3RobeXMKh/HqBLvTSgCKuSKvkKYJj2IMkhNoRArJE5t4gh++A\r\nDJnBUxZSWFjYey8bDsP31UnjoY5WGXpGrwHPYd3irBT2Qgwika/hhuSeC9Ns\r\nNIRA66zqERKix38slZnKaFJXioVJwdYeA3hl4a0GRD7EWypg5Q7827eTksAo\r\nGnjD1LUFofMMn/XAH1HLPjlpNrBO8GS1toM7fP4TPMh4QpOL7ISvQkzblO3c\r\n6KVHdkKAFkg5bUZPJPcZczucf5ZAaX+zVe7p1qDZLj0NsJCvvgLR/gFBabuu\r\nAGfJKXVMBYHGSEr0lw4dBuIsQsrWuycG6U8g4Id62s6vRZwic00O3peuAxt4\r\nkNg9+Ai16T70d649d6JxhQIef62ctIo4WTQ1Tu00DFH2zalpIdVNS4hFCkp1\r\nDwVlB6LrJ1pcv4+GYVUZ72zsG/AOgpnzZwE=\r\n=9Ecr\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"autotelic","email":"info+npm@autotelic.com"},"directories":{},"maintainers":[{"name":"autotelic","email":"info+npm@autotelic.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/fastify-cloudprnt_0.3.1_1677556052994_0.6347582635562086"},"_hasShrinkwrap":false},"0.3.2-rc.1":{"name":"@autotelic/fastify-cloudprnt","version":"0.3.2-rc.1","description":"Fastify plugin to run a server following the Star Micronics CloudPRNT protocol.","keywords":["fastify","cloudprnt","cloud-prnt","star-micronics"],"homepage":"https://github.com/autotelic/fastify-cloudprnt#readme","bugs":{"url":"https://github.com/autotelic/fastify-cloudprnt/issues"},"repository":{"type":"git","url":"git+https://github.com/autotelic/fastify-cloudprnt.git"},"license":"MIT","author":{"name":"Autotelic Development Ltd","email":"info@autotelic.com"},"main":"index.js","scripts":{"example:basic":"docker compose -f docker-compose.basic-example.yaml up","example:basic:start":"fastify start -w -l debug -P -o examples/basic/index.js","example:redis":"docker compose -f docker-compose.redis-example.yaml up","example:redis:start":"fastify start -w -l debug -P -o examples/redis/index.js","fix":"standard --fix","lint":"standard","test":"c8 --100 ava","test:docker":"docker compose -f docker-compose.test.yaml up","validate":"npm run lint && npm run test"},"lint-staged":{"*.{js,jsx}":["npm run fix"]},"dependencies":{"fast-querystring":"^1.1.1","fastify-plugin":"^3.0.0"},"devDependencies":{"ava":"^5.2.0","c8":"^7.10.0","fastify":"^3.0.0","fastify-cli":"^3.0.0","husky":"^8.0.1","lint-staged":"^13.0.3","node-cache":"^5.1.2","nunjucks":"^3.2.3","point-of-view":"^4.16.0","redis":"^4.5.1","sinon":"^15.0.1","standard":"^17.0.0"},"peerDependencies":{"point-of-view":"^4.16.0"},"engines":{"node":">=12.x"},"readme":"# fastify-cloudprnt\n\nA fastify plugin to run a server that follows the [Star Micronics CloudPRNT protocol](https://www.star-m.jp/products/s_print/CloudPRNTSDK/Documentation/en/developerguide/introduction.html).\n\n## Commit linting with Husky\n\nThe npm postinstall script has been removed as it fails on the GH action runner. If you would like lint-staged to run on each commit, run `husky install` manually.\n\n## Usage\n\n```js\nimport fastifyCloudPrnt from '@autotelic/fastify-cloudprnt'\nimport view from '@fastify/point-of-view'\n\nexport default async function basic (fastify, options) {\n  // point-of-view must be registered and available before fastify-cloudprnt\n  await fastify.register(view, viewConfig)\n\n  await fastify.register(fastifyCloudPrnt, config)\n}\n```\n\nOnce the plugin is registered it exposes the CloudPRNT Protocol endpoints:\n\n* [`POST /`](https://star-m.jp/products/s_print/CloudPRNTSDK/Documentation/en/developerguide/pollingserver/post_overview.html)\n* [`GET /`](https://star-m.jp/products/s_print/CloudPRNTSDK/Documentation/en/developerguide/printjobrequests/get_overview.html)\n* [`DELETE /`](https://star-m.jp/products/s_print/CloudPRNTSDK/Documentation/en/developerguide/printjobconfirmation/delete_overview.html)\n\nIn addition it exposes:\n\n* `POST /job` to queue print jobs. Body:\n\n```json\n{\n  \"token\": <string>,\n  \"jobData\": <object>\n}\n```\n\nReturns `201 Created` and echos the token back `{ \"token\": <string> }`. The token should be a unique identifier for the print job - e.g. the order id if printing a receipt.\n\nSee [API](#API) for config options.\n\nSee [examples](examples/) for working examples.\n\n### Template Rendering\n\nTemplates should be in [Star Document Markup](https://star-m.jp/products/s_print/CloudPRNTSDK/Documentation/en/articles/markup/markupintro.html), and template rendering requires [`cputil`](https://star-m.jp/products/s_print/CloudPRNTSDK/Documentation/en/articles/cputil/cputil.html) to be in the path. The provided [Dockerfile](Dockerfile) builds a container with the app and `cputil` in. Additionally, [@fastify/view](https://github.com/fastify/point-of-view) must be registered to fastify before fastify-cloudprnt.\n\nStar Micronics provides a [Star Document Markup Designer](https://star-document-markup-designer.smcs.site/) web app.\n\n## API\n\n_@autotelic/fastify-cloudprnt_ exports a fastify plugin. When registered the plugin expects a configuration object:\n\n* `queueJob: (token, jobData) => any`: method that takes a url-safe string `token` and an object of data `jobData`, to be passed to [point-of-view](https://github.com/fastify/point-of-view#quick-start) for template rendering, and adds the job to the print queue.\n* `getJob: () => token`: method that returns the url-safe string `token` for the next available print job on the queue.\n* `getJobData: (token) => object`: method that returns the data object for the job enqueued with the url-safe string `token`.\n* `deleteJob: (token) => any`: method that deletes the job enqueued with the url-safe string `token` from the print queue.\n* `routePrefix: string`: string which will configure a prefix for all cloudprnt routes.\n* `defaultTemplate`: string which will configure the default template to be joined with `templatesDir` and used by [`@fastify/point-of-view`](https://github.com/fastify/point-of-view/tree/v3.x) to render the template (default to `receipt.stm`). If `jobData` contains a `template` value, it will be used instead of the `defaultTemplate`.\n* `templatesDir`: string which will configure the directory to be joined with either the `defaultTemplate` or `jobData.template` and used by [`@fastify/point-of-view`](https://github.com/fastify/point-of-view/tree/v3.x) to render the template (default to an empty string).\n* `routeOptions: object`: object which will apply the configured [fastify router options](https://www.fastify.io/docs/v3.29.x/Reference/Routes/#routes-options) to all cloudprnt routes. Note: `method`, `url`, `schema` and `handler` cannot be configured through `routeOptions`.\n* `formatPrntCommandData: (renderedReceipt) => `: method that accepts the receipt rendered by [`@fastify/point-of-view`](https://github.com/fastify/point-of-view/tree/v3.x) and returns [star PRNT Core](https://www.star-m.jp/products/s_print/CloudPRNTSDK/Documentation/en/developerguide/contentmediatypes/contentmediatypes_overview.html) command data. if configured, the `formatPrntCommandData` method will bypass the use of the [cputil](https://star-m.jp/products/s_print/CloudPRNTSDK/Documentation/en/articles/cputil/cputil.html) to encode receipt data in the [star PRNT Core](https://www.star-m.jp/products/s_print/CloudPRNTSDK/Documentation/en/developerguide/contentmediatypes/contentmediatypes_overview.html) format.\n## Examples\n\n### Basic\nAn [example](./examples/basic/) fastify app using [node-cache](https://github.com/node-cache/node-cache). To run the basic example, use the following command:\n```sh\n  npm run example:basic\n```\n\n### Redis\nAn [example](./examples/redis/) fastify app using [redis](https://www.npmjs.com/package/redis). To run the redis example, use the following command:\n```sh\n  npm run example:redis\n```","readmeFilename":"README.md","gitHead":"cc8be78d31a218d351c5f8cd17ceac6e4fa5a558","_id":"@autotelic/fastify-cloudprnt@0.3.2-rc.1","_nodeVersion":"16.15.0","_npmVersion":"8.5.5","dist":{"integrity":"sha512-iG90bbGy+g8gTL7tPPz6HPFsni/oUp1Q3kepCg03W68VjDTf57/dRhWVyX43ucrUH2cANFRbOcFpJB5CNzVcUw==","shasum":"66d8fcfa0b760e256facf51449935386c28552d8","tarball":"https://registry.npmjs.org/@autotelic/fastify-cloudprnt/-/fastify-cloudprnt-0.3.2-rc.1.tgz","fileCount":10,"unpackedSize":14776,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCSOayBaItEAUHjhAz9kccOFcZryMoajGr6F0E7YK5t1QIhANcWsXS2u9E1+fjLa/bMcBjVbNsIglEChIxKFsxj+gqj"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkCNznACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrS7Q//aMB+vaVUdRyCfXo/b4qP6Qh9T4YBpa0hRkz7o84TXQGCOIVa\r\nqdatVi6GHv70iSpPNKJdXDUaNUCe+Sw29lDIth3nIt8Mww51ZnS5O+qnZo6U\r\n36ZK2J4wbCrkNJDZBRLrRw6s/MVQzuwWvS0kWNFwcml9RFsB0aCoId/djOKb\r\n1+A4SlNO48wWu93vZxcmApOvDAqXsQI2wv5YQBRayFRetGLKAw6M/8FlDsJx\r\nwEBDHVtf39NmtCIzLjOuU8TE6nGWl8a8uhBgTTrllEAmAvPhVKHKcQayMzAy\r\nDf/x0OD957t4znOS1Efs9X0D/uVA4MEvA0z9QAkzH8Q9O7DoigyfdXWcTq06\r\n6XwC2W5KCAeXg8rVIb1I5r+BOX+aDd9d9Uvlz0MWDBvEuTb+H0MS6k1jxYQt\r\nUJe25+A501VkbhETV4fkEoTu1LYlaODW78z8jFQyFMeMY9lrZ87EXtjzE2mI\r\n0f4nq5GwUKHZa8LVVJ8QK2ZfWs2Ydgfdzk20mY/TLFLOK2bam0EG9lt+hIEi\r\nWf45rIygM2yBETp4gBUXPOQZUByHJewOAvNGSNyJsd9R+K+sM/w2r/vko27e\r\ngPl/Ow+HYvvyswxV/wrvyR6OuGghP4btt0a3tfDD4pLLHeYXvLg+dpAgpOeK\r\n7SR9SHKCfbBzUATOI7BPuRlDXUsRpPjciVw=\r\n=VUZ+\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"autotelic","email":"info+npm@autotelic.com"},"directories":{},"maintainers":[{"name":"autotelic","email":"info+npm@autotelic.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/fastify-cloudprnt_0.3.2-rc.1_1678302438834_0.5642261072571704"},"_hasShrinkwrap":false},"0.4.0":{"name":"@autotelic/fastify-cloudprnt","version":"0.4.0","description":"Fastify plugin to run a server following the Star Micronics CloudPRNT protocol.","keywords":["fastify","cloudprnt","cloud-prnt","star-micronics"],"homepage":"https://github.com/autotelic/fastify-cloudprnt#readme","bugs":{"url":"https://github.com/autotelic/fastify-cloudprnt/issues"},"repository":{"type":"git","url":"git+https://github.com/autotelic/fastify-cloudprnt.git"},"license":"MIT","author":{"name":"Autotelic Development Ltd","email":"info@autotelic.com"},"main":"index.js","scripts":{"example:basic":"docker compose -f docker-compose.basic-example.yaml up","example:basic:start":"fastify start -w -l debug -P -o examples/basic/index.js","example:redis":"docker compose -f docker-compose.redis-example.yaml up","example:redis:start":"fastify start -w -l debug -P -o examples/redis/index.js","fix":"standard --fix","lint":"standard","test":"c8 --100 ava","test:docker":"docker compose -f docker-compose.test.yaml up","validate":"npm run lint && npm run test"},"lint-staged":{"*.{js,jsx}":["npm run fix"]},"dependencies":{"fast-querystring":"^1.1.1","fastify-plugin":"^3.0.0"},"devDependencies":{"ava":"^5.2.0","c8":"^8.0.1","fastify":"^3.0.0","fastify-cli":"^5.8.0","husky":"^8.0.1","lint-staged":"^14.0.1","node-cache":"^5.1.2","nunjucks":"^3.2.3","point-of-view":"^4.16.0","redis":"^4.5.1","sinon":"^15.0.1","standard":"^17.0.0"},"peerDependencies":{"point-of-view":"^4.16.0"},"engines":{"node":">=12.x"},"_id":"@autotelic/fastify-cloudprnt@0.4.0","gitHead":"82face3dc64d6242f0880ac574418768c3bcaea1","_nodeVersion":"18.18.2","_npmVersion":"9.8.1","dist":{"integrity":"sha512-GBvoO5cq/rmCEJjgoS0zJK3XONPKqGEhCPHVPebwLLrCCWtlAVfJAiLEje+W4IpbYV1TVX9Z4mG73+3GyilqEA==","shasum":"587a33d7f03ae5ce61491a214e827f98e60442e4","tarball":"https://registry.npmjs.org/@autotelic/fastify-cloudprnt/-/fastify-cloudprnt-0.4.0.tgz","fileCount":10,"unpackedSize":14944,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDVh7tprrhYS1v7pUyBhfsZ2Ch4jKFkNzaEZb5szBVyKQIgD1RD05YcMtIbpxrzMx/oQE82PQtYYmbg5SxeMXauD4c="}]},"_npmUser":{"name":"autotelic","email":"info+npm@autotelic.com"},"directories":{},"maintainers":[{"name":"autotelic","email":"info+npm@autotelic.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/fastify-cloudprnt_0.4.0_1698164383697_0.17361488567874916"},"_hasShrinkwrap":false},"0.5.0":{"name":"@autotelic/fastify-cloudprnt","version":"0.5.0","description":"Fastify plugin to run a server following the Star Micronics CloudPRNT protocol.","keywords":["fastify","cloudprnt","cloud-prnt","star-micronics"],"homepage":"https://github.com/autotelic/fastify-cloudprnt#readme","bugs":{"url":"https://github.com/autotelic/fastify-cloudprnt/issues"},"repository":{"type":"git","url":"git+https://github.com/autotelic/fastify-cloudprnt.git"},"license":"MIT","author":{"name":"Autotelic Development Ltd","email":"info@autotelic.com"},"main":"index.js","scripts":{"example:basic":"docker compose -f docker-compose.basic-example.yaml up","example:basic:start":"fastify start -w -l debug -P -o examples/basic/index.js","example:redis":"docker compose -f docker-compose.redis-example.yaml up","example:redis:start":"fastify start -w -l debug -P -o examples/redis/index.js","fix":"standard --fix","lint":"standard","test":"c8 --100 ava","test:docker":"docker compose -f docker-compose.test.yaml up","validate":"npm run lint && npm run test"},"lint-staged":{"*.{js,jsx}":["npm run fix"]},"dependencies":{"fast-querystring":"^1.1.1","fastify-plugin":"^3.0.0"},"devDependencies":{"ava":"^5.2.0","c8":"^8.0.1","fastify":"^4.25.1","fastify-cli":"^5.8.0","husky":"^8.0.1","lint-staged":"^14.0.1","node-cache":"^5.1.2","nunjucks":"^3.2.3","@fastify/view":"^8.2.0","redis":"^4.5.1","sinon":"^15.0.1","standard":"^17.0.0"},"peerDependencies":{"@fastify/view":"^8.2.0"},"engines":{"node":">=12.x"},"gitHead":"e6353281b94911c726ce8973c7231e006928f246","_id":"@autotelic/fastify-cloudprnt@0.5.0","_nodeVersion":"16.13.0","_npmVersion":"8.1.0","dist":{"integrity":"sha512-54fgmPNswEGQ8Ly8HGTthAPGE5kc1o//MGfs4LyAOVYaxfKYq1KKgBjeSOrOIKkRWUFsztJV8382+DUhuVyQQA==","shasum":"a4e6f4608ba5b6823b2590868075b431529bd110","tarball":"https://registry.npmjs.org/@autotelic/fastify-cloudprnt/-/fastify-cloudprnt-0.5.0.tgz","fileCount":10,"unpackedSize":14943,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCCfpjHk0OXXnzgDP36SGGLnddzhDyJEe5mEjD336ioiwIgZteC0w5Sm6uvKm3clXF1wBbsUrsEHeZdkMP5OCLbA54="}]},"_npmUser":{"name":"autotelic","email":"info+npm@autotelic.com"},"directories":{},"maintainers":[{"name":"autotelic","email":"info+npm@autotelic.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/fastify-cloudprnt_0.5.0_1703112150525_0.38826412067840077"},"_hasShrinkwrap":false}},"time":{"created":"2023-02-16T23:09:38.089Z","0.1.0":"2023-02-16T23:09:38.355Z","modified":"2023-12-20T22:42:30.924Z","0.3.0":"2023-02-18T01:04:32.903Z","0.3.1":"2023-02-28T03:47:33.119Z","0.3.2-rc.1":"2023-03-08T19:07:18.983Z","0.4.0":"2023-10-24T16:19:43.892Z","0.5.0":"2023-12-20T22:42:30.740Z"},"maintainers":[{"name":"autotelic","email":"info+npm@autotelic.com"}],"description":"Fastify plugin to run a server following the Star Micronics CloudPRNT protocol.","homepage":"https://github.com/autotelic/fastify-cloudprnt#readme","keywords":["fastify","cloudprnt","cloud-prnt","star-micronics"],"repository":{"type":"git","url":"git+https://github.com/autotelic/fastify-cloudprnt.git"},"author":{"name":"Autotelic Development Ltd","email":"info@autotelic.com"},"bugs":{"url":"https://github.com/autotelic/fastify-cloudprnt/issues"},"license":"MIT","readme":"# fastify-cloudprnt\n\nA fastify plugin to run a server that follows the [Star Micronics CloudPRNT protocol](https://www.star-m.jp/products/s_print/CloudPRNTSDK/Documentation/en/developerguide/introduction.html).\n\n## Commit linting with Husky\n\nThe npm postinstall script has been removed as it fails on the GH action runner. If you would like lint-staged to run on each commit, run `husky install` manually.\n\n## Usage\n\n```js\nimport fastifyCloudPrnt from '@autotelic/fastify-cloudprnt'\nimport view from '@fastify/point-of-view'\n\nexport default async function basic (fastify, options) {\n  // point-of-view must be registered and available before fastify-cloudprnt\n  await fastify.register(view, viewConfig)\n\n  await fastify.register(fastifyCloudPrnt, config)\n}\n```\n\nOnce the plugin is registered it exposes the CloudPRNT Protocol endpoints:\n\n* [`POST /`](https://star-m.jp/products/s_print/CloudPRNTSDK/Documentation/en/developerguide/pollingserver/post_overview.html)\n* [`GET /`](https://star-m.jp/products/s_print/CloudPRNTSDK/Documentation/en/developerguide/printjobrequests/get_overview.html)\n* [`DELETE /`](https://star-m.jp/products/s_print/CloudPRNTSDK/Documentation/en/developerguide/printjobconfirmation/delete_overview.html)\n\nIn addition it exposes:\n\n* `POST /job` to queue print jobs. Body:\n\n```json\n{\n  \"token\": <string>,\n  \"jobData\": <object>\n}\n```\n\nReturns `201 Created` and echos the token back `{ \"token\": <string> }`. The token should be a unique identifier for the print job - e.g. the order id if printing a receipt.\n\nSee [API](#API) for config options.\n\nSee [examples](examples/) for working examples.\n\n### Template Rendering\n\nTemplates should be in [Star Document Markup](https://star-m.jp/products/s_print/CloudPRNTSDK/Documentation/en/articles/markup/markupintro.html), and template rendering requires [`cputil`](https://star-m.jp/products/s_print/CloudPRNTSDK/Documentation/en/articles/cputil/cputil.html) to be in the path. The provided [Dockerfile](Dockerfile) builds a container with the app and `cputil` in. Additionally, [@fastify/view](https://github.com/fastify/point-of-view) must be registered to fastify before fastify-cloudprnt.\n\nStar Micronics provides a [Star Document Markup Designer](https://star-document-markup-designer.smcs.site/) web app.\n\n## API\n\n_@autotelic/fastify-cloudprnt_ exports a fastify plugin. When registered the plugin expects a configuration object:\n\n* `queueJob: (token, jobData) => any`: method that takes a url-safe string `token` and an object of data `jobData`, to be passed to [point-of-view](https://github.com/fastify/point-of-view#quick-start) for template rendering, and adds the job to the print queue.\n* `getJob: (request) => token`: method that returns the url-safe string `token` for the next available print job on the queue. `request` is the fastify request object.\n* `getJobData: (token, request) => object`: method that returns the data object for the job enqueued with the url-safe string `token`. `request` is the fastify request object.\n* `deleteJob: (token, request) => any`: method that deletes the job enqueued with the url-safe string `token` from the print queue. `request` is the fastify request object.\n* `routePrefix: string`: string which will configure a prefix for all cloudprnt routes.\n* `defaultTemplate`: string which will configure the default template to be joined with `templatesDir` and used by [`@fastify/point-of-view`](https://github.com/fastify/point-of-view/tree/v3.x) to render the template (default to `receipt.stm`). If `jobData` contains a `template` value, it will be used instead of the `defaultTemplate`.\n* `templatesDir`: string which will configure the directory to be joined with either the `defaultTemplate` or `jobData.template` and used by [`@fastify/point-of-view`](https://github.com/fastify/point-of-view/tree/v3.x) to render the template (default to an empty string).\n* `routeOptions: object`: object which will apply the configured [fastify router options](https://www.fastify.io/docs/v3.29.x/Reference/Routes/#routes-options) to all cloudprnt routes. Note: `method`, `url`, `schema` and `handler` cannot be configured through `routeOptions`.\n* `formatPrntCommandData: (renderedReceipt) => `: method that accepts the receipt rendered by [`@fastify/point-of-view`](https://github.com/fastify/point-of-view/tree/v3.x) and returns [star PRNT Core](https://www.star-m.jp/products/s_print/CloudPRNTSDK/Documentation/en/developerguide/contentmediatypes/contentmediatypes_overview.html) command data. if configured, the `formatPrntCommandData` method will bypass the use of the [cputil](https://star-m.jp/products/s_print/CloudPRNTSDK/Documentation/en/articles/cputil/cputil.html) to encode receipt data in the [star PRNT Core](https://www.star-m.jp/products/s_print/CloudPRNTSDK/Documentation/en/developerguide/contentmediatypes/contentmediatypes_overview.html) format.\n## Examples\n\n### Basic\nAn [example](./examples/basic/) fastify app using [node-cache](https://github.com/node-cache/node-cache). To run the basic example, use the following command:\n```sh\n  npm run example:basic\n```\n\n### Redis\nAn [example](./examples/redis/) fastify app using [redis](https://www.npmjs.com/package/redis). To run the redis example, use the following command:\n```sh\n  npm run example:redis\n```\n","readmeFilename":"README.md"}