@luca-financial/luca-schema 1.0.6 → 1.0.7-beta.3

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/dist/cjs/index.js CHANGED
@@ -3,19 +3,26 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- Object.defineProperty(exports, "schemas", {
6
+ Object.defineProperty(exports, "constants", {
7
7
  enumerable: true,
8
8
  get: function get() {
9
- return _schemas["default"];
9
+ return _constants["default"];
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "lucaValidator", {
13
+ enumerable: true,
14
+ get: function get() {
15
+ return _lucaValidator["default"];
10
16
  }
11
17
  });
12
- Object.defineProperty(exports, "validators", {
18
+ Object.defineProperty(exports, "schemas", {
13
19
  enumerable: true,
14
20
  get: function get() {
15
- return _validators["default"];
21
+ return _schemas["default"];
16
22
  }
17
23
  });
24
+ var _constants = _interopRequireDefault(require("./constants"));
25
+ var _lucaValidator = _interopRequireDefault(require("./lucaValidator"));
18
26
  var _schemas = _interopRequireDefault(require("./schemas"));
19
- var _validators = _interopRequireDefault(require("./validators"));
20
27
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
21
28
  //# sourceMappingURL=index.js.map
package/dist/esm/index.js CHANGED
@@ -1,4 +1,5 @@
1
+ import constants from './constants';
2
+ import lucaValidator from './lucaValidator';
1
3
  import schemas from './schemas';
2
- import validators from './validators';
3
4
 
4
- export { schemas, validators };
5
+ export { constants,lucaValidator, schemas };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luca-financial/luca-schema",
3
- "version": "1.0.6",
3
+ "version": "1.0.7-beta.3",
4
4
  "description": "Schemas for the Luca Ledger application",
5
5
  "author": "Johnathan Aspinwall",
6
6
  "main": "dist/index.js",
@@ -1,40 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports["default"] = void 0;
7
- var _ = _interopRequireDefault(require("ajv/dist/2020"));
8
- var _ajvFormats = _interopRequireDefault(require("ajv-formats"));
9
- var _schemas = _interopRequireDefault(require("./schemas"));
10
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
11
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
12
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
13
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
14
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
15
- function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
16
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
17
- var ajv = new _["default"]();
18
- (0, _ajvFormats["default"])(ajv);
19
- Object.entries(_schemas["default"]).forEach(function (_ref) {
20
- var _ref2 = _slicedToArray(_ref, 2),
21
- key = _ref2[0],
22
- schema = _ref2[1];
23
- if (!ajv.validateSchema(schema)) {
24
- console.error("Invalid schema: ".concat(key));
25
- console.error(ajv.errors);
26
- } else {
27
- ajv.addSchema(schema, key);
28
- }
29
- });
30
- var validators = {
31
- validateCategory: ajv.getSchema('category'),
32
- validateEntity: ajv.getSchema('entity'),
33
- validateLucaSchema: ajv.getSchema('lucaSchema'),
34
- validateRecurringTransaction: ajv.getSchema('recurringTransaction'),
35
- validateRecurringTransactionEvent: ajv.getSchema('recurringTransactionEvent'),
36
- validateSchema: ajv.getSchema('schema'),
37
- validateTransaction: ajv.getSchema('transaction')
38
- };
39
- var _default = exports["default"] = validators;
40
- //# sourceMappingURL=validators.js.map
@@ -1,28 +0,0 @@
1
- import Ajv2020 from 'ajv/dist/2020';
2
- import addFormats from 'ajv-formats';
3
-
4
- import schemas from './schemas';
5
-
6
- const ajv = new Ajv2020();
7
- addFormats(ajv);
8
-
9
- Object.entries(schemas).forEach(([key, schema]) => {
10
- if (!ajv.validateSchema(schema)) {
11
- console.error(`Invalid schema: ${key}`);
12
- console.error(ajv.errors);
13
- } else {
14
- ajv.addSchema(schema, key);
15
- }
16
- });
17
-
18
- const validators = {
19
- validateCategory: ajv.getSchema('category'),
20
- validateEntity: ajv.getSchema('entity'),
21
- validateLucaSchema: ajv.getSchema('lucaSchema'),
22
- validateRecurringTransaction: ajv.getSchema('recurringTransaction'),
23
- validateRecurringTransactionEvent: ajv.getSchema('recurringTransactionEvent'),
24
- validateSchema: ajv.getSchema('schema'),
25
- validateTransaction: ajv.getSchema('transaction')
26
- };
27
-
28
- export default validators;