entodicton 9.7.1-beta.0 → 9.7.1-beta.2

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.
package/client.js CHANGED
@@ -12,7 +12,7 @@ const _ = require('lodash')
12
12
  const stringify = require('json-stable-stringify')
13
13
  const Lines = require('./lines')
14
14
  const flattens = require('./src/flatten')
15
- const { sortJson, appendNoDups, InitCalls, updateQueries, safeNoDups, stableId, where, suggestAssociationsFix, suggestAssociationsFixFromSummaries, validProps } = require('./src/helpers')
15
+ const { sortJson, appendNoDups, InitCalls, updateQueries, safeNoDups, stableId, where, suggestAssociationsFix, suggestAssociationsFixFromSummaries, validProps, OverrideCheck, } = require('./src/helpers')
16
16
  const runtime = require('./runtime')
17
17
  const db = require('./src/debug')
18
18
 
@@ -2104,4 +2104,5 @@ module.exports = {
2104
2104
  writeTest,
2105
2105
  getConfigForTest,
2106
2106
  debug: db,
2107
+ OverrideCheck,
2107
2108
  }
package/package.json CHANGED
@@ -73,6 +73,6 @@
73
73
  "scriptjs": "^2.5.9",
74
74
  "uuid": "^8.3.2"
75
75
  },
76
- "version": "9.7.1-beta.0",
76
+ "version": "9.7.1-beta.2",
77
77
  "license": "UNLICENSED"
78
78
  }
package/src/helpers.js CHANGED
@@ -1,6 +1,23 @@
1
1
  const deepEqual = require('deep-equal')
2
2
  const stringify = require('json-stable-stringify')
3
3
 
4
+
5
+ // check if member function of a class have been overriden by an subclass
6
+ class OverrideCheck {
7
+ constructor(base, suffix='API') {
8
+ this.base = base
9
+ this.checks = Object.getOwnPropertyNames(base.prototype).filter(key => typeof base.prototype[key] === 'function' && key.endsWith(suffix));
10
+ }
11
+
12
+ check(obj) {
13
+ for (const check of this.checks) {
14
+ if (obj[check] == this.base.prototype[check]) {
15
+ throw new Error(`For ${obj.constructor.name} you need to override ${check}`)
16
+ }
17
+ }
18
+ }
19
+ }
20
+
4
21
  function pathEquals (p1, p2) {
5
22
  if (p1.length !== p2.length) {
6
23
  return false
@@ -611,4 +628,5 @@ module.exports = {
611
628
  assignAssumed,
612
629
  watchProperty,
613
630
  pathEquals,
631
+ OverrideCheck,
614
632
  }