{"id":22800027,"url":"https://github.com/dadi/api-filestore","last_synced_at":"2025-08-10T08:44:07.204Z","repository":{"id":17516951,"uuid":"82038724","full_name":"dadi/api-filestore","owner":"dadi","description":"A JSON datastore adapter for DADI API","archived":false,"fork":false,"pushed_at":"2023-01-10T22:19:35.000Z","size":1074,"stargazers_count":2,"open_issues_count":11,"forks_count":3,"subscribers_count":5,"default_branch":"develop","last_synced_at":"2025-07-09T23:29:44.282Z","etag":null,"topics":["api","dadi","dadi-api","database","json"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dadi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-15T08:41:19.000Z","updated_at":"2020-11-25T10:25:49.000Z","dependencies_parsed_at":"2023-01-13T19:22:19.969Z","dependency_job_id":null,"html_url":"https://github.com/dadi/api-filestore","commit_stats":null,"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"purl":"pkg:github/dadi/api-filestore","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dadi%2Fapi-filestore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dadi%2Fapi-filestore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dadi%2Fapi-filestore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dadi%2Fapi-filestore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dadi","download_url":"https://codeload.github.com/dadi/api-filestore/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dadi%2Fapi-filestore/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269440314,"owners_count":24417402,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-08T02:00:09.200Z","response_time":72,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","dadi","dadi-api","database","json"],"created_at":"2024-12-12T07:10:51.892Z","updated_at":"2025-08-10T08:44:07.168Z","avatar_url":"https://github.com/dadi.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# API FileStore Adapter\n\n[![npm (scoped)](https://img.shields.io/npm/v/@dadi/api-filestore.svg?maxAge=10800\u0026style=flat-square)](https://www.npmjs.com/package/@dadi/api-filestore)\n[![Coverage Status](https://coveralls.io/repos/github/dadi/api-filestore/badge.svg?branch=master)](https://coveralls.io/github/dadi/api-filestore?branch=master)\n[![Build Status](https://travis-ci.org/dadi/api-filestore.svg?branch=master)](https://travis-ci.org/dadi/api-filestore)\n[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](http://standardjs.com/)\n\n## Requirements\n\n* [DADI API](https://www.npmjs.com/package/@dadi/api) Version 3.0.0 or greater\n\n## Install\n\nTo use this adapter with your DADI API installation, you'll need to add it to your API's dependencies:\n\n```bash\n$ npm install @dadi/api-filestore --save\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. DADI 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 `@dadi/api-filestore` configuration files follows the format `filestore.\u003cenvironment\u003e.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\nProperty | Description | Default\n:--------|:------------|:-------\npath | The relative or absolute path to where your database files will be stored | none\nautosaveInterval | The interval, in milliseconds, between database writes to disk | 5000 (5 seconds)\nserializationMethod | 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\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\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```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdadi%2Fapi-filestore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdadi%2Fapi-filestore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdadi%2Fapi-filestore/lists"}