@naturalcycles/firestore-lib 1.4.3 → 1.4.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,16 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.unescapeDocId = exports.escapeDocId = void 0;
4
- const js_lib_1 = require("@naturalcycles/js-lib");
5
4
  const SLASH = '_SLASH_';
6
5
  function escapeDocId(docId) {
7
6
  if (typeof docId === 'number')
8
7
  return String(docId);
9
- return (0, js_lib_1._replaceAll)(docId, '/', SLASH);
8
+ return docId.replaceAll('/', SLASH);
10
9
  }
11
10
  exports.escapeDocId = escapeDocId;
12
11
  function unescapeDocId(docId) {
13
12
  // if (typeof docId === 'number') return docId
14
- return (0, js_lib_1._replaceAll)(docId, SLASH, '/');
13
+ return docId.replaceAll(SLASH, '/');
15
14
  }
16
15
  exports.unescapeDocId = unescapeDocId;
@@ -9,12 +9,12 @@ const OP_MAP = {
9
9
  };
10
10
  function dbQueryToFirestoreQuery(dbQuery, emptyQuery) {
11
11
  // filter
12
- // eslint-disable-next-line unicorn/no-array-reduce, unicorn/prefer-object-from-entries
12
+ // eslint-disable-next-line unicorn/no-array-reduce
13
13
  let q = dbQuery._filters.reduce((q, f) => {
14
14
  return q.where(f.name, OP_MAP[f.op] || f.op, f.val);
15
15
  }, emptyQuery);
16
16
  // order
17
- // eslint-disable-next-line unicorn/no-array-reduce, unicorn/prefer-object-from-entries
17
+ // eslint-disable-next-line unicorn/no-array-reduce
18
18
  q = dbQuery._orders.reduce((q, ord) => {
19
19
  return q.orderBy(ord.name, ord.descending ? 'desc' : 'asc');
20
20
  }, q);
package/package.json CHANGED
@@ -13,7 +13,7 @@
13
13
  "devDependencies": {
14
14
  "@naturalcycles/dev-lib": "^13.0.1",
15
15
  "@naturalcycles/test-lib": "^1.0.3",
16
- "@types/node": "^18.0.0",
16
+ "@types/node": "^20.1.2",
17
17
  "dotenv": "^16.0.0",
18
18
  "jest": "^29.1.2"
19
19
  },
@@ -35,9 +35,9 @@
35
35
  "url": "https://github.com/NaturalCycles/firestore-lib"
36
36
  },
37
37
  "engines": {
38
- "node": ">=14.15.0"
38
+ "node": ">=18.12.0"
39
39
  },
40
- "version": "1.4.3",
40
+ "version": "1.4.5",
41
41
  "description": "Firestore implementation of CommonDB interface",
42
42
  "author": "Natural Cycles Team",
43
43
  "license": "MIT"
@@ -1,13 +1,11 @@
1
- import { _replaceAll } from '@naturalcycles/js-lib'
2
-
3
1
  const SLASH = '_SLASH_'
4
2
 
5
3
  export function escapeDocId(docId: string | number): string {
6
4
  if (typeof docId === 'number') return String(docId)
7
- return _replaceAll(docId, '/', SLASH)
5
+ return docId.replaceAll('/', SLASH)
8
6
  }
9
7
 
10
8
  export function unescapeDocId(docId: string): string {
11
9
  // if (typeof docId === 'number') return docId
12
- return _replaceAll(docId, SLASH, '/')
10
+ return docId.replaceAll(SLASH, '/')
13
11
  }
package/src/query.util.ts CHANGED
@@ -14,13 +14,13 @@ export function dbQueryToFirestoreQuery<ROW extends ObjectWithId>(
14
14
  emptyQuery: Query,
15
15
  ): Query {
16
16
  // filter
17
- // eslint-disable-next-line unicorn/no-array-reduce, unicorn/prefer-object-from-entries
17
+ // eslint-disable-next-line unicorn/no-array-reduce
18
18
  let q = dbQuery._filters.reduce((q, f) => {
19
19
  return q.where(f.name as string, OP_MAP[f.op] || (f.op as WhereFilterOp), f.val)
20
20
  }, emptyQuery)
21
21
 
22
22
  // order
23
- // eslint-disable-next-line unicorn/no-array-reduce, unicorn/prefer-object-from-entries
23
+ // eslint-disable-next-line unicorn/no-array-reduce
24
24
  q = dbQuery._orders.reduce((q, ord) => {
25
25
  return q.orderBy(ord.name as string, ord.descending ? 'desc' : 'asc')
26
26
  }, q)