@e22m4u/js-repository 0.1.23 → 0.1.25

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e22m4u/js-repository",
3
- "version": "0.1.23",
3
+ "version": "0.1.25",
4
4
  "description": "Модуль для работы с базами данных для Node.js",
5
5
  "type": "module",
6
6
  "types": "./src/index.d.ts",
@@ -55,12 +55,7 @@ function findAdapterCtorInModule(module) {
55
55
  if (!module || typeof module !== 'object' || Array.isArray(module)) return;
56
56
  for (const ctor of Object.values(module)) {
57
57
  console.log(ctor);
58
- if (
59
- typeof ctor === 'function' &&
60
- ctor.prototype &&
61
- typeof ctor.prototype === 'object' &&
62
- ctor.prototype.kind === Adapter.name
63
- ) {
58
+ if (typeof ctor === 'function' && ctor.kind === Adapter.name) {
64
59
  adapterCtor = ctor;
65
60
  break;
66
61
  }
@@ -11,6 +11,13 @@ import {ServiceContainer} from '@e22m4u/js-service';
11
11
  * Adapter.
12
12
  */
13
13
  export declare class Adapter extends Service {
14
+ /**
15
+ * Kind.
16
+ *
17
+ * @type {string}
18
+ */
19
+ static kind: string;
20
+
14
21
  /**
15
22
  * Settings.
16
23
  */
@@ -19,9 +19,7 @@ export class Adapter extends Service {
19
19
  *
20
20
  * @type {string}
21
21
  */
22
- get kind() {
23
- return Adapter.name;
24
- }
22
+ static kind = 'Adapter';
25
23
 
26
24
  /**
27
25
  * Settings.
@@ -15,10 +15,12 @@ import {PropertyUniquenessDecorator} from './decorator/index.js';
15
15
  const sandbox = chai.spy.sandbox();
16
16
 
17
17
  describe('Adapter', function () {
18
- it('exposes kind getter', function () {
19
- const adapter = new Adapter();
20
- expect(adapter.kind).to.be.eq('Adapter');
21
- expect(Adapter.prototype.kind).to.be.eq('Adapter');
18
+ it('exposes static property "kind"', function () {
19
+ expect(Adapter.kind).to.be.eq(Adapter.name);
20
+ const MyAdapter1 = class extends Adapter {};
21
+ expect(MyAdapter1.kind).to.be.eq(Adapter.name);
22
+ class MyAdapter2 extends Adapter {}
23
+ expect(MyAdapter2.kind).to.be.eq(Adapter.name);
22
24
  });
23
25
 
24
26
  describe('constructor', function () {