Skip to content

Commit

Permalink
ESM support, support for COUNT(*) selects
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthewCallis committed Jan 17, 2021
1 parent 754ba64 commit b065461
Show file tree
Hide file tree
Showing 14 changed files with 1,454 additions and 1,537 deletions.
11 changes: 4 additions & 7 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"plugin:optimize-regex/all",
"plugin:ramda/recommended",
"plugin:security/recommended",
"plugin:sonarjs/recommended",
"plugin:unicorn/recommended"
],
"plugins": [
Expand All @@ -17,21 +18,17 @@
"optimize-regex",
"ramda",
"security",
"sonarjs",
"unicorn",
"xss"
],
"env": {
"es6": true,
"browser": true,
"mocha": true
},
"globals": {
"sinon": false,
"mocha": true,
"expect": true
},
"globals": {},
"parserOptions": {
"ecmaVersion": 2020
"ecmaVersion": 2021
},
"rules": {
"ava/no-only-test": 0,
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/).

## [4.0.0](https://github.com/uttori/uttori-storage-provider-json-file/compare/v3.4.3...v4.0.0) - 2021-01-16

- 🧰 Add ESM Support
- 🧰 Add explicit exports
- 🧰 Add support for `COUNT(*)` as stand alone `SELECT` field for returning counts.
- 🎁 Update dev dependencies

## [3.4.3](https://github.com/uttori/uttori-storage-provider-json-file/compare/v3.4.2...v3.4.3) - 2020-11-15

- 🧰 Make `debug` an optional dependency
Expand Down
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@ npm install --save @uttori/storage-provider-json-file
# Example

```js
// When part of UttoriWiki:
import { Plugin as StorageProviderJSON } from '@uttori/storage-provider-json-file';
// or
const { Plugin: StorageProviderJSON } = require('@uttori/storage-provider-json-file');

// When stand alone:
import StorageProvider from '@uttori/storage-provider-json-file';
// or
const { StorageProvider } = require('@uttori/storage-provider-json-file');
const s = new StorageProvider({
content_directory: 'example/content',
Expand All @@ -76,6 +84,8 @@ const results = await s.getQuery('SELECT tags FROM documents WHERE slug IS_NOT_N
➜ results === [
{ tags: ['Example Tag'] },
]
const results = s.getQuery('SELECT COUNT(*) FROM documents WHERE slug IS_NOT_NULL ORDER BY RANDOM ASC LIMIT -1');
➜ results === 1
```

# API Reference
Expand Down Expand Up @@ -291,7 +301,6 @@ Updates History for a given slug, renaming the store file and history folder as
| [createDate] | <code>number</code> \| <code>Date</code> | | The creation date of the document. |
| [updateDate] | <code>number</code> \| <code>Date</code> | | The last date the document was updated. |
| [tags] | <code>Array.&lt;string&gt;</code> | <code>[]</code> | The unique identifier for the document. |
| [customData] | <code>object</code> | <code>{}</code> | Any extra meta data for the document. |


* * *
Expand Down
1 change: 0 additions & 1 deletion docs/storage-provider.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,5 +209,4 @@ Updates History for a given slug, renaming the store file and history folder as
| [createDate] | <code>number</code> \| <code>Date</code> | | The creation date of the document. |
| [updateDate] | <code>number</code> \| <code>Date</code> | | The last date the document was updated. |
| [tags] | <code>Array.&lt;string&gt;</code> | <code>[]</code> | The unique identifier for the document. |
| [customData] | <code>object</code> | <code>{}</code> | Any extra meta data for the document. |

8 changes: 8 additions & 0 deletions esm/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/* eslint-disable node/no-unpublished-import, node/no-unsupported-features/es-syntax, import/extensions */

import StorageProvider from '../src/storage-provider.js';

export default StorageProvider;

export { default as StorageProvider } from '../src/storage-provider.js';
export { default as Plugin } from '../src/plugin.js';
1 change: 1 addition & 0 deletions esm/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ "type": "module" }
Loading

0 comments on commit b065461

Please sign in to comment.