{"_id":"@caruuto/api-filestore","name":"@caruuto/api-filestore","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@caruuto/api-filestore","version":"1.0.0","description":"A JSON datastore adapter for API","keywords":["api","connector","json","filestore","api-connector"],"main":"index.js","scripts":{"test":"eslint . && prettier --check **/*.js && env NODE_ENV=test ./node_modules/.bin/nyc --reporter=lcov ./node_modules/mocha/bin/_mocha test && ./node_modules/.bin/nyc report","posttest":"./scripts/coverage.js"},"author":{"name":"James Lambie","email":"jameslambie@gmail.com"},"license":"ISC","dependencies":{"@caruuto/api-metadata":"^2.0.0","convict":"^6.2.3","debug":"4.3.1","lokijs":"1.5.6","mkdirp":"1.0.4","uuid":"^7.0.0"},"repository":{"type":"git","url":"git+https://github.com/caruuto/api-filestore.git"},"devDependencies":{"colors":"^1.1.2","coveralls":"^3.0.1","env-test":"^1.0.0","eslint":"8.5.0","eslint-plugin-prettier":"^4.0.0","husky":"^3.0.9","mocha":"8.0.0","nyc":"^14.1.0","prettier":"2.0.1","should":"^10.0.0","js-promise-queue":"^1.1.0","lint-staged":"^12.4.2","sinon":"^1.17.5"},"husky":{"hooks":{"pre-commit":"lint-staged"}},"lint-staged":{"*.{js,jsx,md,html}":["prettier --write","git add"]},"bugs":{"url":"https://github.com/caruuto/api-filestore/issues"},"homepage":"https://github.com/caruuto/api-filestore#readme","_id":"@caruuto/api-filestore@1.0.0","_nodeVersion":"12.22.0","_npmVersion":"6.14.11","dist":{"integrity":"sha512-adDfoDHxjP5xagxTCIWDVmDSfQaXNICoqiGOH0fQBzxna/aomcOh0zTx1WhSJ/LAE007EvnqyH9XdzQkuGqysA==","shasum":"5c7ea40da6494a3531494b5c7a079f7ed77202b1","tarball":"https://registry.npmjs.org/@caruuto/api-filestore/-/api-filestore-1.0.0.tgz","fileCount":11,"unpackedSize":26017,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCj9DYkcWCebJsJyDwvzaYH4t7BqAHF5MPP2aeDhFjJkgIhAPoXleDW8klbvynjF4neFARC8ouDcZhaTDJXezbLkxBt"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiwTSeACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrJXxAAn/03dT8arB1vrl4Rt5xgzhGkutzKz0RYsvTxjL6wfk4lkYjl\r\nA/28a5vbgEEqcH0LKrwBpPG6cpToA5dUyRPT5JiDjpCs0A0/hpzmAn2rbAXV\r\nixBLkXcZpjhT6KBT44vmPY9VFEs0cAru+Maa9eU2X7oR8+YW6z6+VZAGoVym\r\nPJm9BceLzIpWGS8N1ZirMQj/UxLG+5izRpYgW0DavC/NCDsGnqFkbQEWLK4o\r\nMvDmhMJMt6RAEr6GEwLv/ZojYqvKkfXXk6c3TyKd6mSTNkflYXs5WJUK/fyH\r\n1wwYlfuYXV/XQANkNtGxZd0h+SmKbwJ9A7LTsXSltK0yA5sEWzeWSG/7v/Sq\r\nUc8thxwcuEvBlVtY3mtRPhEdLIIWb6TtjuIrFqgevhRdfIg/1Xx9hrf+qnrm\r\nFOSEaDDtbVDkdhebU2aPiF6yZDS3Umqo3kjyM+In2B2/Eps1NyS7Z+DsGF+i\r\nEWQFiZNChP6VoD+MGHs9QP0v3YuGiCVSfAdBp/ka4qDDSut8/gFj9mIWK2Ko\r\nNLJdhoADVnFNI9pfYuTnL14lEEaLIPtCvq1Mg82iCM9yYDScF6bNJFmTMNlC\r\n01LKTpjv+L43HcXR8O0jWnAOoCxOuaA/64yEYZkTR7HHLZbT43fUuIyNYztc\r\n6cnVd2myq/Va0tiaz7tyH1j8/ndd+P1kFFI=\r\n=mmIo\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"jimlambie","email":"jameslambie@gmail.com"},"directories":{},"maintainers":[{"name":"woogz","email":"jayraydon@gmail.com"},{"name":"jimlambie","email":"jameslambie@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/api-filestore_1.0.0_1656829086205_0.2305341385546038"},"_hasShrinkwrap":false}},"time":{"created":"2022-07-03T06:18:06.128Z","1.0.0":"2022-07-03T06:18:06.390Z","modified":"2022-07-03T06:18:06.551Z"},"maintainers":[{"name":"woogz","email":"jayraydon@gmail.com"},{"name":"jimlambie","email":"jameslambie@gmail.com"}],"description":"A JSON datastore adapter for API","homepage":"https://github.com/caruuto/api-filestore#readme","keywords":["api","connector","json","filestore","api-connector"],"repository":{"type":"git","url":"git+https://github.com/caruuto/api-filestore.git"},"author":{"name":"James Lambie","email":"jameslambie@gmail.com"},"bugs":{"url":"https://github.com/caruuto/api-filestore/issues"},"license":"ISC","readme":"# API FileStore Adapter\n\n## Requirements\n\n- API Version 3.0.0 or greater\n\n## Install\n\nTo use this adapter with your API installation, you'll need to add it to your API's dependencies:\n\n```bash\n$ npm install @caruuto/api-filestore\n```\n\n## Configure\n\n### Configuration Files\n\nConfiguration settings are defined in JSON files within a `/config` directory at the root of your API application. API has provision for multiple configuration files, one for each environment that your API is expected to run under, for example `development` and `production`.\n\nA post-install script ran when you installed the package from NPM, creating a development configuration file for you at `config/filestore.development.json`.\n\nThe naming convention for `@caruuto/api-filestore` configuration files follows the format `filestore.<environment>.json`\n\nFor example:\n\n```\nfilestore.development.json\nfilestore.production.json\n```\n\n### Application Anatomy\n\n```sh\nmy-api/\n  config/            # contains environment-specific configuration properties\n    config.development.json\n    config.production.json\n    filestore.development.json\n    filestore.production.json\n\n  main.js            # the entry point of the app\n  package.json\n  workspace/\n    collections/     # collection schema files\n    endpoints/       # custom Javascript endpoints\n\n```\n\n### Configuration\n\nThe contents of the configuration file should be similar to the following:\n\n```json\n{\n  \"database\": {\n    \"path\": \"path/to/your/database\",\n    \"autosaveInterval\": 10000,\n    \"serializationMethod\": \"pretty\"\n  }\n}\n```\n\n| Property            | Description                                                                                                     | Default          |\n| :------------------ | :-------------------------------------------------------------------------------------------------------------- | :--------------- |\n| path                | The relative or absolute path to where your database files will be stored                                       | none             |\n| autosaveInterval    | The interval, in milliseconds, between database writes to disk                                                  | 5000 (5 seconds) |\n| serializationMethod | The format of the database file on disk. `normal` is a condensed version of the JSON, `pretty` is more readable | `normal`         |\n\n### Querying Collections\n\n#### \\$eq\n\n```js\n// explicit\n{'Name': { '$eq' : 'Odin' }}\n\n// implicit (assumes equality operator)\n{'Name': 'Odin'}\n```\n\n#### \\$ne\n\nnot equal test\n\n```js\n{'legs': { '$ne' : 8 }}\n```\n\n#### \\$regex\n\n```js\n// pass in raw regex\nvar results = coll.find({Name: {$regex: /din/}})\n\n// or pass in string pattern only\nresults = coll.find({Name: {$regex: 'din'}})\n\n// or pass in [pattern, options] string array\nresults = coll.find({Name: {$regex: ['din', 'i']}})\n```\n\nIf using regex operator within a named transform or dynamic view filter, it is best to use the latter two examples since raw regex does not seem to serialize/deserialize well.\n\n#### \\$in\n\n```js\nvar users = db.addCollection(\"users\");\nusers.insert({ name : 'odin' });\nusers.insert({ name : 'thor' });\nusers.insert({ name : 'svafrlami' });\n\n// match users with name in array set ['odin' or 'thor']\n{ 'name' : { '$in' : ['odin', 'thor'] } }\n```\n\n#### \\$between\n\n```js\n// match users with count value between 50 and 75\n{ count : { '$between': [50, 75] } }\n```\n\n#### $contains / $containsAny / \\$containsNone\n\n```js\nvar users = db.addCollection(\"users\");\nusers.insert({ name : 'odin', weapons : ['gungnir', 'draupnir']});\nusers.insert({ name : 'thor', weapons : ['mjolnir']});\nusers.insert({ name : 'svafrlami', weapons : ['tyrfing']});\nusers.insert({ name : 'arngrim', weapons : ['tyrfing']});\n\n// returns 'svafrlami' and 'arngrim' documents\n{ 'weapons' : { '$contains' : 'tyrfing' } }\n\n// returns 'svafrlami', 'arngrim', and 'thor' documents\n{ 'weapons' : { '$containsAny' : ['tyrfing', 'mjolnir'] } }\n\n// returns 'svafrlami' and 'arngrim'\n{ 'weapons' : { '$containsNone' : ['gungnir', 'mjolnir'] } }\n\n```\n\n### Composing Nested Queries\n\n#### \\$and\n\nfetch documents matching both sub-expressions\n\n```js\n{\n  '$and': [{\n      'Age' : {\n        '$gt': 30\n      }\n    },{\n      'Name' : 'Thor'\n    }]\n}\n```\n\n#### \\$or\n\nfetch documents matching any of the sub-expressions\n\n```js\n{\n  '$or': [{\n      'Age' : {\n        '$gte': '40'\n      }\n    },{\n      'Name' : 'Thor'\n    }]\n}\n```\n","readmeFilename":"README.md"}