onecore 0.5.15 → 0.5.17

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/lib/index.js CHANGED
@@ -1,115 +1,84 @@
1
- "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- extendStatics(d, b);
11
- function __() { this.constructor = d; }
12
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13
- };
14
- })();
15
- Object.defineProperty(exports, "__esModule", { value: true });
16
- var SearchUseCase = (function () {
17
- function SearchUseCase(repository) {
1
+ export class SearchUseCase {
2
+ constructor(repository) {
18
3
  this.repository = repository;
19
4
  this.search = this.search.bind(this);
20
5
  }
21
- SearchUseCase.prototype.search = function (s, limit, page, fields) {
6
+ search(s, limit, page, fields) {
22
7
  return this.repository.search(s, limit, page, fields);
23
- };
24
- return SearchUseCase;
25
- }());
26
- exports.SearchUseCase = SearchUseCase;
27
- exports.SearchManager = SearchUseCase;
28
- var Writer = (function () {
29
- function Writer(repository) {
8
+ }
9
+ }
10
+ export const SearchManager = SearchUseCase;
11
+ export class Writer {
12
+ constructor(repository) {
30
13
  this.repository = repository;
31
14
  this.create = this.create.bind(this);
32
15
  this.update = this.update.bind(this);
33
16
  this.patch = this.patch.bind(this);
34
17
  }
35
- Writer.prototype.create = function (obj) {
18
+ create(obj) {
36
19
  return this.repository.create(obj);
37
- };
38
- Writer.prototype.update = function (obj) {
20
+ }
21
+ update(obj) {
39
22
  return this.repository.update(obj);
40
- };
41
- Writer.prototype.patch = function (obj) {
23
+ }
24
+ patch(obj) {
42
25
  return (this.repository.patch ? this.repository.patch(obj) : Promise.resolve(-1));
43
- };
44
- return Writer;
45
- }());
46
- exports.Writer = Writer;
47
- var SearchWriter = (function (_super) {
48
- __extends(SearchWriter, _super);
49
- function SearchWriter(repository) {
50
- var _this = _super.call(this, repository) || this;
51
- _this.repository = repository;
52
- _this.search = _this.search.bind(_this);
53
- return _this;
54
- }
55
- SearchWriter.prototype.search = function (s, limit, page, fields) {
26
+ }
27
+ }
28
+ export class SearchWriter extends Writer {
29
+ constructor(repository) {
30
+ super(repository);
31
+ this.repository = repository;
32
+ this.search = this.search.bind(this);
33
+ }
34
+ search(s, limit, page, fields) {
56
35
  return this.repository.search(s, limit, page, fields);
57
- };
58
- return SearchWriter;
59
- }(Writer));
60
- exports.SearchWriter = SearchWriter;
61
- var UseCase = (function (_super) {
62
- __extends(UseCase, _super);
63
- function UseCase(repository) {
64
- var _this = _super.call(this, repository) || this;
65
- _this.repository = repository;
66
- _this.metadata = _this.metadata.bind(_this);
67
- _this.keys = _this.keys.bind(_this);
68
- _this.load = _this.load.bind(_this);
69
- _this.delete = _this.delete.bind(_this);
70
- return _this;
71
- }
72
- UseCase.prototype.metadata = function () {
36
+ }
37
+ }
38
+ export class UseCase extends SearchWriter {
39
+ constructor(repository) {
40
+ super(repository);
41
+ this.repository = repository;
42
+ this.metadata = this.metadata.bind(this);
43
+ this.keys = this.keys.bind(this);
44
+ this.load = this.load.bind(this);
45
+ this.delete = this.delete.bind(this);
46
+ }
47
+ metadata() {
73
48
  return (this.repository.metadata ? this.repository.metadata() : undefined);
74
- };
75
- UseCase.prototype.keys = function () {
49
+ }
50
+ keys() {
76
51
  return (this.repository.keys ? this.repository.keys() : []);
77
- };
78
- UseCase.prototype.load = function (id) {
52
+ }
53
+ load(id) {
79
54
  return this.repository.load(id);
80
- };
81
- UseCase.prototype.delete = function (id) {
55
+ }
56
+ delete(id) {
82
57
  return this.repository.delete(id);
83
- };
84
- return UseCase;
85
- }(SearchWriter));
86
- exports.UseCase = UseCase;
87
- var GenericUseCase = (function (_super) {
88
- __extends(GenericUseCase, _super);
89
- function GenericUseCase(repository) {
90
- var _this = _super.call(this, repository) || this;
91
- _this.repository = repository;
92
- _this.metadata = _this.metadata.bind(_this);
93
- _this.keys = _this.keys.bind(_this);
94
- _this.load = _this.load.bind(_this);
95
- _this.delete = _this.delete.bind(_this);
96
- return _this;
97
- }
98
- GenericUseCase.prototype.metadata = function () {
58
+ }
59
+ }
60
+ export class GenericUseCase extends Writer {
61
+ constructor(repository) {
62
+ super(repository);
63
+ this.repository = repository;
64
+ this.metadata = this.metadata.bind(this);
65
+ this.keys = this.keys.bind(this);
66
+ this.load = this.load.bind(this);
67
+ this.delete = this.delete.bind(this);
68
+ }
69
+ metadata() {
99
70
  return (this.repository.metadata ? this.repository.metadata() : undefined);
100
- };
101
- GenericUseCase.prototype.keys = function () {
71
+ }
72
+ keys() {
102
73
  return (this.repository.keys ? this.repository.keys() : []);
103
- };
104
- GenericUseCase.prototype.load = function (id) {
74
+ }
75
+ load(id) {
105
76
  return this.repository.load(id);
106
- };
107
- GenericUseCase.prototype.delete = function (id) {
77
+ }
78
+ delete(id) {
108
79
  return this.repository.delete(id);
109
- };
110
- return GenericUseCase;
111
- }(Writer));
112
- exports.GenericUseCase = GenericUseCase;
113
- exports.CRUDUseCase = GenericUseCase;
114
- exports.GenericManager = GenericUseCase;
115
- exports.CRUDManager = GenericUseCase;
80
+ }
81
+ }
82
+ export const CRUDUseCase = GenericUseCase;
83
+ export const GenericManager = GenericUseCase;
84
+ export const CRUDManager = GenericUseCase;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "onecore",
3
- "version": "0.5.15",
3
+ "version": "0.5.17",
4
4
  "description": "onecore",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./src/index.ts",
package/src/metadata.ts CHANGED
@@ -59,3 +59,9 @@ export interface Attribute {
59
59
  export interface Attributes {
60
60
  [key: string]: Attribute;
61
61
  }
62
+ export interface FixedLengthAttribute extends Attribute {
63
+ length: number
64
+ }
65
+ export interface FixedLengthAttributes {
66
+ [key: string]: FixedLengthAttribute
67
+ }
package/tsconfig.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "compileOnSave": true,
3
3
  "compilerOptions": {
4
- "target": "es5",
5
- "baseUrl": "./src",
4
+ "target": "es6",
5
+ "rootDir": "./src",
6
6
  "outDir": "./lib",
7
- "module": "commonjs",
8
- "moduleResolution": "node",
7
+ "module": "node16",
8
+ "moduleResolution": "node16",
9
9
  "strict": true,
10
10
  "pretty": true,
11
11
  "sourceMap": false,