mintly-lib 1.0.1 → 1.1.0

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.
Files changed (83) hide show
  1. package/build/core/data/person/index.d.ts +1 -1
  2. package/build/core/data/person/index.d.ts.map +1 -1
  3. package/build/core/data/person/index.js +3 -3
  4. package/build/core/data/person/index.js.map +1 -1
  5. package/build/core/data/person/person-entity.d.ts +3 -2
  6. package/build/core/data/person/person-entity.d.ts.map +1 -1
  7. package/build/core/data/person/person-schema.d.ts +11 -0
  8. package/build/core/data/person/person-schema.d.ts.map +1 -0
  9. package/build/core/data/person/person-schema.js +10 -0
  10. package/build/core/data/person/person-schema.js.map +1 -0
  11. package/build/index.d.ts +0 -1
  12. package/build/index.d.ts.map +1 -1
  13. package/build/index.js +0 -1
  14. package/build/index.js.map +1 -1
  15. package/package.json +2 -1
  16. package/build/aurora/core/array.d.ts +0 -18
  17. package/build/aurora/core/array.d.ts.map +0 -1
  18. package/build/aurora/core/array.js +0 -63
  19. package/build/aurora/core/array.js.map +0 -1
  20. package/build/aurora/core/boolean.d.ts +0 -14
  21. package/build/aurora/core/boolean.d.ts.map +0 -1
  22. package/build/aurora/core/boolean.js +0 -36
  23. package/build/aurora/core/boolean.js.map +0 -1
  24. package/build/aurora/core/date.d.ts +0 -14
  25. package/build/aurora/core/date.d.ts.map +0 -1
  26. package/build/aurora/core/date.js +0 -43
  27. package/build/aurora/core/date.js.map +0 -1
  28. package/build/aurora/core/index.d.ts +0 -9
  29. package/build/aurora/core/index.d.ts.map +0 -1
  30. package/build/aurora/core/index.js +0 -20
  31. package/build/aurora/core/index.js.map +0 -1
  32. package/build/aurora/core/number.d.ts +0 -15
  33. package/build/aurora/core/number.d.ts.map +0 -1
  34. package/build/aurora/core/number.js +0 -37
  35. package/build/aurora/core/number.js.map +0 -1
  36. package/build/aurora/core/object.d.ts +0 -17
  37. package/build/aurora/core/object.d.ts.map +0 -1
  38. package/build/aurora/core/object.js +0 -53
  39. package/build/aurora/core/object.js.map +0 -1
  40. package/build/aurora/core/string.d.ts +0 -16
  41. package/build/aurora/core/string.d.ts.map +0 -1
  42. package/build/aurora/core/string.js +0 -52
  43. package/build/aurora/core/string.js.map +0 -1
  44. package/build/aurora/core/type.d.ts +0 -11
  45. package/build/aurora/core/type.d.ts.map +0 -1
  46. package/build/aurora/core/type.js +0 -21
  47. package/build/aurora/core/type.js.map +0 -1
  48. package/build/aurora/core/union.d.ts +0 -16
  49. package/build/aurora/core/union.d.ts.map +0 -1
  50. package/build/aurora/core/union.js +0 -38
  51. package/build/aurora/core/union.js.map +0 -1
  52. package/build/aurora/index.d.ts +0 -6
  53. package/build/aurora/index.d.ts.map +0 -1
  54. package/build/aurora/index.js +0 -25
  55. package/build/aurora/index.js.map +0 -1
  56. package/build/aurora/interfaces/field.d.ts +0 -9
  57. package/build/aurora/interfaces/field.d.ts.map +0 -1
  58. package/build/aurora/interfaces/field.js +0 -3
  59. package/build/aurora/interfaces/field.js.map +0 -1
  60. package/build/aurora/lib/aurora.d.ts +0 -22
  61. package/build/aurora/lib/aurora.d.ts.map +0 -1
  62. package/build/aurora/lib/aurora.js +0 -155
  63. package/build/aurora/lib/aurora.js.map +0 -1
  64. package/build/aurora/lib/validation-error.d.ts +0 -5
  65. package/build/aurora/lib/validation-error.d.ts.map +0 -1
  66. package/build/aurora/lib/validation-error.js +0 -12
  67. package/build/aurora/lib/validation-error.js.map +0 -1
  68. package/build/aurora/types/index.d.ts +0 -3
  69. package/build/aurora/types/index.d.ts.map +0 -1
  70. package/build/aurora/types/index.js +0 -6
  71. package/build/aurora/types/index.js.map +0 -1
  72. package/build/aurora/types/infer-type.d.ts +0 -13
  73. package/build/aurora/types/infer-type.d.ts.map +0 -1
  74. package/build/aurora/types/infer-type.js +0 -3
  75. package/build/aurora/types/infer-type.js.map +0 -1
  76. package/build/aurora/types/orm.d.ts +0 -4
  77. package/build/aurora/types/orm.d.ts.map +0 -1
  78. package/build/aurora/types/orm.js +0 -8
  79. package/build/aurora/types/orm.js.map +0 -1
  80. package/build/core/data/person/person-orm.d.ts +0 -5
  81. package/build/core/data/person/person-orm.d.ts.map +0 -1
  82. package/build/core/data/person/person-orm.js +0 -10
  83. package/build/core/data/person/person-orm.js.map +0 -1
@@ -1,3 +1,3 @@
1
1
  export { Person } from './person-entity';
2
- export { personOrm } from './person-orm';
2
+ export { personSchema } from './person-schema';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/data/person/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/data/person/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.personOrm = void 0;
4
- var person_orm_1 = require("./person-orm");
5
- Object.defineProperty(exports, "personOrm", { enumerable: true, get: function () { return person_orm_1.personOrm; } });
3
+ exports.personSchema = void 0;
4
+ var person_schema_1 = require("./person-schema");
5
+ Object.defineProperty(exports, "personSchema", { enumerable: true, get: function () { return person_schema_1.personSchema; } });
6
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/core/data/person/index.ts"],"names":[],"mappings":";;;AACA,2CAAwC;AAA/B,uGAAA,SAAS,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/core/data/person/index.ts"],"names":[],"mappings":";;;AACA,iDAA8C;AAArC,6GAAA,YAAY,OAAA"}
@@ -1,4 +1,5 @@
1
+ import type { Infer } from '@ascendance-hub/sapphire-core';
1
2
  import { Entity } from '../api/entity';
2
- import { personOrm } from './person-orm';
3
- export type Person = ReturnType<typeof personOrm.getType> & Entity;
3
+ import { personSchema } from './person-schema';
4
+ export type Person = Infer<typeof personSchema> & Entity;
4
5
  //# sourceMappingURL=person-entity.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"person-entity.d.ts","sourceRoot":"","sources":["../../../../src/core/data/person/person-entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAExC,MAAM,MAAM,MAAM,GAAG,UAAU,CAAC,OAAO,SAAS,CAAC,OAAO,CAAC,GAAG,MAAM,CAAA"}
1
+ {"version":3,"file":"person-entity.d.ts","sourceRoot":"","sources":["../../../../src/core/data/person/person-entity.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAA;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAE9C,MAAM,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,YAAY,CAAC,GAAG,MAAM,CAAA"}
@@ -0,0 +1,11 @@
1
+ export declare const personSchema: import("@ascendance-hub/sapphire-core").ObjectField<{
2
+ name: import("@ascendance-hub/sapphire-core").StringField<string, string>;
3
+ age: import("@ascendance-hub/sapphire-core").NumberField<number, number>;
4
+ }, import("@ascendance-hub/sapphire-core").ObjectOutput<{
5
+ name: import("@ascendance-hub/sapphire-core").StringField<string, string>;
6
+ age: import("@ascendance-hub/sapphire-core").NumberField<number, number>;
7
+ }>, import("@ascendance-hub/sapphire-core").ObjectInput<{
8
+ name: import("@ascendance-hub/sapphire-core").StringField<string, string>;
9
+ age: import("@ascendance-hub/sapphire-core").NumberField<number, number>;
10
+ }>>;
11
+ //# sourceMappingURL=person-schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"person-schema.d.ts","sourceRoot":"","sources":["../../../../src/core/data/person/person-schema.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,YAAY;;;;;;;;;GAGvB,CAAA"}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.personSchema = void 0;
4
+ const sapphire_core_1 = require("@ascendance-hub/sapphire-core");
5
+ const s = new sapphire_core_1.Sapphire();
6
+ exports.personSchema = s.object({
7
+ name: s.string(),
8
+ age: s.number(),
9
+ });
10
+ //# sourceMappingURL=person-schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"person-schema.js","sourceRoot":"","sources":["../../../../src/core/data/person/person-schema.ts"],"names":[],"mappings":";;;AAAA,iEAAwD;AAExD,MAAM,CAAC,GAAG,IAAI,wBAAQ,EAAE,CAAA;AAEX,QAAA,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IACnC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;CAChB,CAAC,CAAA"}
package/build/index.d.ts CHANGED
@@ -1,3 +1,2 @@
1
- export * from './aurora';
2
1
  export * from './core';
3
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,QAAQ,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAA"}
package/build/index.js CHANGED
@@ -14,6 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./aurora"), exports);
18
17
  __exportStar(require("./core"), exports);
19
18
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAwB;AACxB,yCAAsB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAsB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mintly-lib",
3
- "version": "1.0.1",
3
+ "version": "1.1.0",
4
4
  "description": "Mintly Library",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -40,6 +40,7 @@
40
40
  "author": "",
41
41
  "license": "ISC",
42
42
  "dependencies": {
43
+ "@ascendance-hub/sapphire-core": "^1.2.0",
43
44
  "axios": "^1.13.5",
44
45
  "http-status-codes": "^2.3.0"
45
46
  },
@@ -1,18 +0,0 @@
1
- import { Field, ValidationResult } from '../interfaces/field';
2
- import { InferSchema, ORM } from '../types';
3
- export declare class ArrayField<T extends Array<Field>, IsOptional extends boolean = false> implements Field {
4
- private readonly orm;
5
- private readonly arr;
6
- constructor(orm: ORM, arr: T);
7
- private readonly schema;
8
- private required;
9
- getSchema(): {
10
- type: string;
11
- required: boolean;
12
- properties: Field[];
13
- };
14
- getType(): InferSchema<T>;
15
- optional(): ArrayField<T, true>;
16
- validate(value: any): ValidationResult;
17
- }
18
- //# sourceMappingURL=array.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"array.d.ts","sourceRoot":"","sources":["../../../src/aurora/core/array.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAC7D,OAAO,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAI3C,qBAAa,UAAU,CACrB,CAAC,SAAS,KAAK,CAAC,KAAK,CAAC,EAGtB,UAAU,SAAS,OAAO,GAAG,KAAK,CAClC,YAAW,KAAK;IAGd,OAAO,CAAC,QAAQ,CAAC,GAAG;IACpB,OAAO,CAAC,QAAQ,CAAC,GAAG;gBADH,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,CAAC;IAGzB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAmB;IAC1C,OAAO,CAAC,QAAQ,CAAgB;IAEhC,SAAS;;;;;IAWT,OAAO,IAAK,WAAW,CAAC,CAAC,CAAC;IAI1B,QAAQ,IAAK,UAAU,CAAC,CAAC,EAAE,IAAI,CAAC;IAKhC,QAAQ,CAAE,KAAK,EAAE,GAAG,GAAG,gBAAgB;CA0BxC"}
@@ -1,63 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ArrayField = void 0;
4
- // @ts-ignore
5
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
6
- class ArrayField {
7
- constructor(
8
- // @ts-ignore
9
- orm, arr) {
10
- this.orm = orm;
11
- this.arr = arr;
12
- this.schema = [];
13
- this.required = true;
14
- }
15
- getSchema() {
16
- for (const item of this.arr) {
17
- if (typeof item.getSchema === 'function') {
18
- this.schema.push(item.getSchema());
19
- }
20
- else {
21
- this.schema.push(item);
22
- }
23
- }
24
- return { type: 'array', required: this.required, properties: this.schema };
25
- }
26
- getType() {
27
- return null;
28
- }
29
- optional() {
30
- this.required = false;
31
- return this;
32
- }
33
- validate(value) {
34
- const required = this.required;
35
- if (value === undefined || value === null) {
36
- if (required)
37
- return { value, error: 'Field is required' };
38
- return { value };
39
- }
40
- if (!Array.isArray(value)) {
41
- return { value, error: 'Expected array' };
42
- }
43
- const errors = {};
44
- const validated = [];
45
- for (let i = 0; i < this.arr.length; i++) {
46
- const field = this.arr[i];
47
- if (!field)
48
- continue;
49
- const result = typeof field.validate === 'function'
50
- ? field.validate(value[i])
51
- : { value: value[i] };
52
- validated[i] = result.value;
53
- if (result.error)
54
- errors[i] = result.error;
55
- }
56
- if (Object.keys(errors).length > 0) {
57
- return { value: validated, error: JSON.stringify(errors) };
58
- }
59
- return { value: validated };
60
- }
61
- }
62
- exports.ArrayField = ArrayField;
63
- //# sourceMappingURL=array.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"array.js","sourceRoot":"","sources":["../../../src/aurora/core/array.ts"],"names":[],"mappings":";;;AAGA,aAAa;AACb,6DAA6D;AAC7D,MAAa,UAAU;IAMrB;IACE,aAAa;IACI,GAAQ,EACR,GAAM;QADN,QAAG,GAAH,GAAG,CAAK;QACR,QAAG,GAAH,GAAG,CAAG;QAGR,WAAM,GAAiB,EAAE,CAAA;QAClC,aAAQ,GAAY,IAAI,CAAA;IAH5B,CAAC;IAKL,SAAS;QACP,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;YAC5B,IAAI,OAAO,IAAI,CAAC,SAAS,KAAK,UAAU,EAAE,CAAC;gBACzC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,CAAA;YACpC,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;YACxB,CAAC;QACH,CAAC;QACD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,UAAU,EAAE,IAAI,CAAC,MAAM,EAAE,CAAA;IAC5E,CAAC;IAED,OAAO;QACL,OAAO,IAAW,CAAA;IACpB,CAAC;IAED,QAAQ;QACN,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAA;QACrB,OAAO,IAAsC,CAAA;IAC/C,CAAC;IAED,QAAQ,CAAE,KAAU;QAClB,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAA;QAC9B,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;YAC1C,IAAI,QAAQ;gBAAE,OAAO,EAAE,KA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
2
- import { ORM } from '../types';
3
- export declare class BooleanField<IsOptional extends boolean = false> implements Field {
4
- private readonly orm;
5
- constructor(orm: ORM);
6
- private readonly schema;
7
- getSchema(): {
8
- type: BooleanConstructor;
9
- required: boolean;
10
- };
11
- optional(): BooleanField<true>;
12
- validate(value: any): ValidationResult;
13
- }
14
- //# sourceMappingURL=boolean.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"boolean.d.ts","sourceRoot":"","sources":["../../../src/aurora/core/boolean.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAC7D,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAI9B,qBAAa,YAAY,CAAC,UAAU,SAAS,OAAO,GAAG,KAAK,CAAE,YAAW,KAAK;IAC/D,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAAH,GAAG,EAAE,GAAG;IACtC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA0B;IAEjD,SAAS;;;;IAOT,QAAQ,IAAK,YAAY,CAAC,IAAI,CAAC;IAK/B,QAAQ,CAAE,KAAK,EAAE,GAAG,GAAG,gBAAgB;CAWxC"}
@@ -1,36 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BooleanField = void 0;
4
- const types_1 = require("../types");
5
- // @ts-ignore
6
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
7
- class BooleanField {
8
- constructor(orm) {
9
- this.orm = orm;
10
- this.schema = {};
11
- }
12
- getSchema() {
13
- if (this.orm === types_1.ORM.MONGO) {
14
- return { type: Boolean, required: true, ...this.schema };
15
- }
16
- throw new Error('not supported ORM');
17
- }
18
- optional() {
19
- this.schema.required = false;
20
- return this;
21
- }
22
- validate(value) {
23
- const required = this.schema.required !== false;
24
- if (value === undefined || value === null) {
25
- if (required)
26
- return { value, error: 'Field is required' };
27
- return { value };
28
- }
29
- if (typeof value !== 'boolean') {
30
- return { value, error: 'Expected boolean' };
31
- }
32
- return { value };
33
- }
34
- }
35
- exports.BooleanField = BooleanField;
36
- //# sourceMappingURL=boolean.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"boolean.js","sourceRoot":"","sources":["../../../src/aurora/core/boolean.ts"],"names":[],"mappings":";;;AACA,oCAA8B;AAE9B,aAAa;AACb,6DAA6D;AAC7D,MAAa,YAAY;IACvB,YAA8B,GAAQ;QAAR,QAAG,GAAH,GAAG,CAAK;QACrB,WAAM,GAAwB,EAAE,CAAA;IADR,CAAC;IAG1C,SAAS;QACP,IAAI,IAAI,CAAC,GAAG,KAAK,WAAG,CAAC,KAAK,EAAE,CAAC;YAC3B,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,CAAA;QAC1D,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAA;IACtC,CAAC;IAED,QAAQ;QACN,IAAI,CAAC,MAAM,CAAC,QAAQ,GAAG,KAAK,CAAA;QAC5B,OAAO,IAAqC,CAAA;IAC9C,CAAC;IAED,QAAQ,CAAE,KAAU;QAClB,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,KAAK,KAAK,CAAA;QAC/C,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;YAC1C,IAAI,QAAQ;gBAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,mBAAmB,EAAE,CAAA;YAC1D,OAAO,EAAE,KAAK,EAAE,CAAA;QAClB,CAAC;QACD,IAAI,OAAO,KAAK,KAAK,SAAS,EAAE,CAAC;YAC/B,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,kBAAkB,EAAE,CAAA;QAC7C,CAAC;QACD,OAAO,EAAE,KAAK,EAAE,CAAA;IAClB,CAAC;CACF;AA3BD,oCA2BC"}
@@ -1,14 +0,0 @@
1
- import { Field, ValidationResult } from '../interfaces/field';
2
- import { ORM } from '../types';
3
- export declare class DateField<IsOptional extends boolean = false> implements Field {
4
- private readonly orm;
5
- constructor(orm: ORM);
6
- private readonly schema;
7
- getSchema(): {
8
- type: DateConstructor;
9
- required: boolean;
10
- };
11
- optional(): DateField<true>;
12
- validate(value: any): ValidationResult;
13
- }
14
- //# sourceMappingURL=date.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"date.d.ts","sourceRoot":"","sources":["../../../src/aurora/core/date.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAC7D,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAI9B,qBAAa,SAAS,CAAC,UAAU,SAAS,OAAO,GAAG,KAAK,CAAE,YAAW,KAAK;IAC5D,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAAH,GAAG,EAAE,GAAG;IACtC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA0B;IAEjD,SAAS;;;;IAOT,QAAQ,IAAK,SAAS,CAAC,IAAI,CAAC;IAK5B,QAAQ,CAAE,KAAK,EAAE,GAAG,GAAG,gBAAgB;CAiBxC"}
@@ -1,43 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DateField = void 0;
4
- const types_1 = require("../types");
5
- // @ts-ignore
6
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
7
- class DateField {
8
- constructor(orm) {
9
- this.orm = orm;
10
- this.schema = {};
11
- }
12
- getSchema() {
13
- if (this.orm === types_1.ORM.MONGO) {
14
- return { type: Date, required: true, ...this.schema };
15
- }
16
- throw new Error('not supported ORM');
17
- }
18
- optional() {
19
- this.schema.required = false;
20
- return this;
21
- }
22
- validate(value) {
23
- const required = this.schema.required !== false;
24
- if (value === undefined || value === null) {
25
- if (required)
26
- return { value, error: 'Field is required' };
27
- return { value };
28
- }
29
- if (!(value instanceof Date) && typeof value !== 'string') {
30
- return { value, error: 'Expected date or date string' };
31
- }
32
- // Essa parte eu valido se a String é uma data válida (Pensando em compatibilidade com outros ORM`s, talvez seja necessário alterar isso no futuro)
33
- if (typeof value === 'string') {
34
- const d = new Date(value);
35
- if (isNaN(d.getTime()))
36
- return { value, error: 'Invalid date string' };
37
- return { value: d };
38
- }
39
- return { value };
40
- }
41
- }
42
- exports.DateField = DateField;
43
- //# sourceMappingURL=date.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"date.js","sourceRoot":"","sources":["../../../src/aurora/core/date.ts"],"names":[],"mappings":";;;AACA,oCAA8B;AAE9B,aAAa;AACb,6DAA6D;AAC7D,MAAa,SAAS;IACpB,YAA8B,GAAQ;QAAR,QAAG,GAAH,GAAG,CAAK;QACrB,WAAM,GAAwB,EAAE,CAAA;IADR,CAAC;IAG1C,SAAS;QACP,IAAI,IAAI,CAAC,GAAG,KAAK,WAAG,CAAC,KAAK,EAAE,CAAC;YAC3B,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,CAAA;QACvD,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAA;IACtC,CAAC;IAED,QAAQ;QACN,IAAI,CAAC,MAAM,CAAC,QAAQ,GAAG,KAAK,CAAA;QAC5B,OAAO,IAAkC,CAAA;IAC3C,CAAC;IAED,QAAQ,CAAE,KAAU;QAClB,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,KAAK,KAAK,CAAA;QAC/C,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;YAC1C,IAAI,QAAQ;gBAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,mBAAmB,EAAE,CAAA;YAC1D,OAAO,EAAE,KAAK,EAAE,CAAA;QAClB,CAAC;QACD,IAAI,CAAC,CAAC,KAAK,YAAY,IAAI,CAAC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAC1D,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,8BAA8B,EAAE,CAAA;QACzD,CAAC;QACD,mJAAmJ;QACnJ,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAC9B,MAAM,CAAC,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,CAAA;YACzB,IAAI,KAAK,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;gBAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,qBAAqB,EAAE,CAAA;YACtE,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,CAAA;QACrB,CAAC;QACD,OAAO,EAAE,KAAK,EAAE,CAAA;IAClB,CAAC;CACF;AAjCD,8BAiCC"}
@@ -1,9 +0,0 @@
1
- export { ArrayField } from './array';
2
- export { BooleanField } from './boolean';
3
- export { DateField } from './date';
4
- export { NumberField } from './number';
5
- export { ObjectField } from './object';
6
- export { StringField } from './string';
7
- export { TypeField } from './type';
8
- export { UnionField } from './union';
9
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/aurora/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA"}
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UnionField = exports.TypeField = exports.StringField = exports.ObjectField = exports.NumberField = exports.DateField = exports.BooleanField = exports.ArrayField = void 0;
4
- var array_1 = require("./array");
5
- Object.defineProperty(exports, "ArrayField", { enumerable: true, get: function () { return array_1.ArrayField; } });
6
- var boolean_1 = require("./boolean");
7
- Object.defineProperty(exports, "BooleanField", { enumerable: true, get: function () { return boolean_1.BooleanField; } });
8
- var date_1 = require("./date");
9
- Object.defineProperty(exports, "DateField", { enumerable: true, get: function () { return date_1.DateField; } });
10
- var number_1 = require("./number");
11
- Object.defineProperty(exports, "NumberField", { enumerable: true, get: function () { return number_1.NumberField; } });
12
- var object_1 = require("./object");
13
- Object.defineProperty(exports, "ObjectField", { enumerable: true, get: function () { return object_1.ObjectField; } });
14
- var string_1 = require("./string");
15
- Object.defineProperty(exports, "StringField", { enumerable: true, get: function () { return string_1.StringField; } });
16
- var type_1 = require("./type");
17
- Object.defineProperty(exports, "TypeField", { enumerable: true, get: function () { return type_1.TypeField; } });
18
- var union_1 = require("./union");
19
- Object.defineProperty(exports, "UnionField", { enumerable: true, get: function () { return union_1.UnionField; } });
20
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/aurora/core/index.ts"],"names":[],"mappings":";;;AAAA,iCAAoC;AAA3B,mGAAA,UAAU,OAAA;AACnB,qCAAwC;AAA/B,uGAAA,YAAY,OAAA;AACrB,+BAAkC;AAAzB,iGAAA,SAAS,OAAA;AAClB,mCAAsC;AAA7B,qGAAA,WAAW,OAAA;AACpB,mCAAsC;AAA7B,qGAAA,WAAW,OAAA;AACpB,mCAAsC;AAA7B,qGAAA,WAAW,OAAA;AACpB,+BAAkC;AAAzB,iGAAA,SAAS,OAAA;AAClB,iCAAoC;AAA3B,mGAAA,UAAU,OAAA"}
@@ -1,15 +0,0 @@
1
- import { Field, ValidationResult } from '../interfaces/field';
2
- import { ORM } from '../types';
3
- export declare class NumberField<IsOptional extends boolean = false> implements Field {
4
- private readonly orm;
5
- constructor(orm: ORM);
6
- private readonly schema;
7
- required: boolean;
8
- getSchema(): {
9
- type: NumberConstructor;
10
- required: boolean;
11
- };
12
- optional(): NumberField<true>;
13
- validate(value: any): ValidationResult;
14
- }
15
- //# sourceMappingURL=number.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"number.d.ts","sourceRoot":"","sources":["../../../src/aurora/core/number.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAC7D,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAI9B,qBAAa,WAAW,CAAC,UAAU,SAAS,OAAO,GAAG,KAAK,CAAE,YAAW,KAAK;IAC9D,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAAH,GAAG,EAAE,GAAG;IACtC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA0B;IAE1C,QAAQ,EAAE,OAAO,CAAO;IAC/B,SAAS;;;;IAOT,QAAQ,IAAK,WAAW,CAAC,IAAI,CAAC;IAK9B,QAAQ,CAAE,KAAK,EAAE,GAAG,GAAG,gBAAgB;CAWxC"}
@@ -1,37 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NumberField = void 0;
4
- const types_1 = require("../types");
5
- // @ts-ignore
6
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
7
- class NumberField {
8
- constructor(orm) {
9
- this.orm = orm;
10
- this.schema = {};
11
- this.required = true;
12
- }
13
- getSchema() {
14
- if (this.orm === types_1.ORM.MONGO) {
15
- return { type: Number, required: true, ...this.schema };
16
- }
17
- throw new Error('not supported ORM');
18
- }
19
- optional() {
20
- this.schema.required = false;
21
- return this;
22
- }
23
- validate(value) {
24
- const required = this.schema.required !== false;
25
- if (value === undefined || value === null) {
26
- if (required)
27
- return { value, error: 'Field is required' };
28
- return { value };
29
- }
30
- if (typeof value !== 'number') {
31
- return { value, error: 'Expected number' };
32
- }
33
- return { value };
34
- }
35
- }
36
- exports.NumberField = NumberField;
37
- //# sourceMappingURL=number.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"number.js","sourceRoot":"","sources":["../../../src/aurora/core/number.ts"],"names":[],"mappings":";;;AACA,oCAA8B;AAE9B,aAAa;AACb,6DAA6D;AAC7D,MAAa,WAAW;IACtB,YAA8B,GAAQ;QAAR,QAAG,GAAH,GAAG,CAAK;QACrB,WAAM,GAAwB,EAAE,CAAA;QAE1C,aAAQ,GAAY,IAAI,CAAA;IAHU,CAAC;IAI1C,SAAS;QACP,IAAI,IAAI,CAAC,GAAG,KAAK,WAAG,CAAC,KAAK,EAAE,CAAC;YAC3B,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,CAAA;QACzD,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAA;IACtC,CAAC;IAED,QAAQ;QACN,IAAI,CAAC,MAAM,CAAC,QAAQ,GAAG,KAAK,CAAA;QAC5B,OAAO,IAAoC,CAAA;IAC7C,CAAC;IAED,QAAQ,CAAE,KAAU;QAClB,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,KAAK,KAAK,CAAA;QAC/C,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;YAC1C,IAAI,QAAQ;gBAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,mBAAmB,EAAE,CAAA;YAC1D,OAAO,EAAE,KAAK,EAAE,CAAA;QAClB,CAAC;QACD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAC9B,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,iBAAiB,EAAE,CAAA;QAC5C,CAAC;QACD,OAAO,EAAE,KAAK,EAAE,CAAA;IAClB,CAAC;CACF;AA5BD,kCA4BC"}
@@ -1,17 +0,0 @@
1
- import { Field, ValidationResult } from '../interfaces/field';
2
- import { InferSchema, ORM } from '../types';
3
- export declare class ObjectField<T extends Record<string, Field>, IsOptional extends boolean = false> implements Field {
4
- private readonly orm;
5
- readonly obj: T;
6
- constructor(orm: ORM, obj: T);
7
- private readonly schema;
8
- getSchema(): {
9
- type: string;
10
- required: boolean;
11
- properties: Record<string, any>;
12
- };
13
- getType(): InferSchema<T>;
14
- optional(): ObjectField<T, true>;
15
- validate(value: any): ValidationResult;
16
- }
17
- //# sourceMappingURL=object.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"object.d.ts","sourceRoot":"","sources":["../../../src/aurora/core/object.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAC7D,OAAO,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAI3C,qBAAa,WAAW,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,UAAU,SAAS,OAAO,GAAG,KAAK,CAAE,YAAW,KAAK;IAG1G,OAAO,CAAC,QAAQ,CAAC,GAAG;IACpB,QAAQ,CAAC,GAAG,EAAE,CAAC;gBADE,GAAG,EAAE,GAAG,EAChB,GAAG,EAAE,CAAC;IAGjB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA0B;IAEjD,SAAS;;;;;IAOT,OAAO,IAAK,WAAW,CAAC,CAAC,CAAC;IAI1B,QAAQ,IAAK,WAAW,CAAC,CAAC,EAAE,IAAI,CAAC;IAKjC,QAAQ,CAAE,KAAK,EAAE,GAAG,GAAG,gBAAgB;CAsBxC"}
@@ -1,53 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ObjectField = void 0;
4
- // @ts-ignore
5
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
6
- class ObjectField {
7
- constructor(
8
- // @ts-ignore
9
- orm, obj) {
10
- this.orm = orm;
11
- this.obj = obj;
12
- this.schema = {};
13
- }
14
- getSchema() {
15
- for (const [key, value] of Object.entries(this.obj)) {
16
- this.schema[key] = typeof value.getSchema === 'function' ? value.getSchema() : value;
17
- }
18
- return { type: 'object', required: true, properties: this.schema };
19
- }
20
- getType() {
21
- return null;
22
- }
23
- optional() {
24
- this.schema.required = false;
25
- return this;
26
- }
27
- validate(value) {
28
- const required = true;
29
- if (value === undefined || value === null) {
30
- if (required)
31
- return { value, error: 'Field is required' };
32
- return { value };
33
- }
34
- if (typeof value !== 'object' || Array.isArray(value)) {
35
- return { value, error: 'Expected object' };
36
- }
37
- const errors = {};
38
- const validated = {};
39
- // Valida cada campo no objeto e coleta erros (É um capricho, mas é necessário para garantir que todos os campos internos sejam validados, talvez tenha maneiras melhores de fazer isso)
40
- for (const [key, field] of Object.entries(this.obj)) {
41
- const result = field.validate(value[key]);
42
- validated[key] = result.value;
43
- if (result.error)
44
- errors[key] = result.error;
45
- }
46
- if (Object.keys(errors).length > 0) {
47
- return { value: validated, error: JSON.stringify(errors) };
48
- }
49
- return { value: validated };
50
- }
51
- }
52
- exports.ObjectField = ObjectField;
53
- //# sourceMappingURL=object.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"object.js","sourceRoot":"","sources":["../../../src/aurora/core/object.ts"],"names":[],"mappings":";;;AAGA,aAAa;AACb,6DAA6D;AAC7D,MAAa,WAAW;IACtB;IACE,aAAa;IACI,GAAQ,EAChB,GAAM;QADE,QAAG,GAAH,GAAG,CAAK;QAChB,QAAG,GAAH,GAAG,CAAG;QAGA,WAAM,GAAwB,EAAE,CAAA;IAF9C,CAAC;IAIJ,SAAS;QACP,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;YACpD,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,OAAO,KAAK,CAAC,SAAS,KAAK,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,EAAE,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AM,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACnC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAA;QAC5D,CAAC;QACD,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,CAAA;IAC7B,CAAC;CACF;AA/CD,kCA+CC"}
@@ -1,16 +0,0 @@
1
- import { Field, ValidationResult } from '../interfaces/field';
2
- import { ORM } from '../types';
3
- export declare class StringField<IsOptional extends boolean = false> implements Field {
4
- private readonly orm;
5
- constructor(orm: ORM);
6
- private readonly schema;
7
- private readonly validation;
8
- getSchema(): {
9
- type: StringConstructor;
10
- required: boolean;
11
- };
12
- optional(): StringField<true>;
13
- validate(value: any): ValidationResult;
14
- min(number: number): StringField<any>;
15
- }
16
- //# sourceMappingURL=string.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../../../src/aurora/core/string.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAC7D,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAI9B,qBAAa,WAAW,CAAC,UAAU,SAAS,OAAO,GAAG,KAAK,CAAE,YAAW,KAAK;IAC9D,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAAH,GAAG,EAAE,GAAG;IACtC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA0B;IACjD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA+B;IAE1D,SAAS;;;;IAOT,QAAQ,IAAK,WAAW,CAAC,IAAI,CAAC;IAK9B,QAAQ,CAAE,KAAK,EAAE,GAAG,GAAG,gBAAgB;IAoBvC,GAAG,CAAE,MAAM,EAAE,MAAM,GAOS,WAAW,CAAC,GAAG,CAAC;CAE7C"}
@@ -1,52 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.StringField = void 0;
4
- const types_1 = require("../types");
5
- // @ts-ignore
6
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
7
- class StringField {
8
- constructor(orm) {
9
- this.orm = orm;
10
- this.schema = {};
11
- this.validation = {};
12
- }
13
- getSchema() {
14
- if (this.orm === types_1.ORM.MONGO) {
15
- return { type: String, required: true, ...this.schema };
16
- }
17
- throw new Error('not supported ORM');
18
- }
19
- optional() {
20
- this.schema.required = false;
21
- return this;
22
- }
23
- validate(value) {
24
- const required = this.schema.required !== false;
25
- Object.keys(this.validation).forEach((key) => {
26
- const validator = this.validation[key];
27
- if (typeof validator === 'function') {
28
- validator(this.validation[key]);
29
- }
30
- });
31
- if (value === undefined || value === null) {
32
- if (required)
33
- return { value, error: 'Field is required' };
34
- return { value };
35
- }
36
- if (typeof value !== 'string') {
37
- return { value, error: 'Expected string' };
38
- }
39
- return { value };
40
- }
41
- min(number) {
42
- this.validation.min = (number) => {
43
- if (typeof number !== 'number' || number < 0) {
44
- throw new Error('min must be a positive number');
45
- }
46
- };
47
- this.schema.min = { value: number };
48
- return this;
49
- }
50
- }
51
- exports.StringField = StringField;
52
- //# sourceMappingURL=string.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"string.js","sourceRoot":"","sources":["../../../src/aurora/core/string.ts"],"names":[],"mappings":";;;AACA,oCAA8B;AAE9B,aAAa;AACb,6DAA6D;AAC7D,MAAa,WAAW;IACtB,YAA8B,GAAQ;QAAR,QAAG,GAAH,GAAG,CAAK;QACrB,WAAM,GAAwB,EAAE,CAAA;QAChC,eAAU,GAA6B,EAAE,CAAA;IAFjB,CAAC;IAI1C,SAAS;QACP,IAAI,IAAI,CAAC,GAAG,KAAK,WAAG,CAAC,KAAK,EAAE,CAAC;YAC3B,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,CAAA;QACzD,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,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,EAAE,CAAA;QACnC,OAAO,IAAmC,CAAA;IAC5C,CAAC;CACF;AA9CD,kCA8CC"}
@@ -1,11 +0,0 @@
1
- import { Field } from '../interfaces/field';
2
- import { ORM } from '../types';
3
- import { ObjectField } from './object';
4
- import { UnionField } from './union';
5
- export declare class TypeField<IsOptional extends boolean = false> {
6
- private readonly orm;
7
- constructor(orm: ORM);
8
- union<Fields extends Field[]>(fields: Fields): UnionField<Fields, false>;
9
- pick<T extends Record<string, any>, K extends readonly (keyof T)[]>(objectField: ObjectField<T, any>, keys: K): ObjectField<Pick<T, K[number]>, false>;
10
- }
11
- //# sourceMappingURL=type.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../../src/aurora/core/type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAC3C,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAC9B,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAIpC,qBAAa,SAAS,CAAC,UAAU,SAAS,OAAO,GAAG,KAAK;IAC1C,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAAH,GAAG,EAAE,GAAG;IAEtC,KAAK,CAAC,MAAM,SAAS,KAAK,EAAE,EAAG,MAAM,EAAE,MAAM,GAAG,UAAU,CAAC,MAAM,EAAE,KAAK,CAAC;IAIzE,IAAI,CACF,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC7B,CAAC,SAAS,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,EAE9B,WAAW,EAAE,WAAW,CAAC,CAAC,EAAE,GAAG,CAAC,EAChC,IAAI,EAAE,CAAC,GACN,WAAW,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC;CAM1C"}
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TypeField = void 0;
4
- const object_1 = require("./object");
5
- const union_1 = require("./union");
6
- // @ts-ignore
7
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
8
- class TypeField {
9
- constructor(orm) {
10
- this.orm = orm;
11
- }
12
- union(fields) {
13
- return new union_1.UnionField(this.orm, fields);
14
- }
15
- pick(objectField, keys) {
16
- const pickedObj = Object.fromEntries(keys.map((key) => [key, objectField.obj[key]]));
17
- return new object_1.ObjectField(this.orm, pickedObj);
18
- }
19
- }
20
- exports.TypeField = TypeField;
21
- //# sourceMappingURL=type.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"type.js","sourceRoot":"","sources":["../../../src/aurora/core/type.ts"],"names":[],"mappings":";;;AAEA,qCAAsC;AACtC,mCAAoC;AAEpC,aAAa;AACb,6DAA6D;AAC7D,MAAa,SAAS;IACpB,YAA8B,GAAQ;QAAR,QAAG,GAAH,GAAG,CAAK;IAAI,CAAC;IAE3C,KAAK,CAA0B,MAAc;QAC3C,OAAO,IAAI,kBAAU,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC,CAAA;IACzC,CAAC;IAED,IAAI,CAIF,WAAgC,EAChC,IAAO;QAEP,MAAM,SAAS,GAAG,MAAM,CAAC,WAAW,CAClC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CACzB,CAAA;QACvB,OAAO,IAAI,oBAAW,CAAC,IAAI,CAAC,GAAG,EAAE,SAAS,CAAC,CAAA;IAC7C,CAAC;CACF;AAnBD,8BAmBC"}
@@ -1,16 +0,0 @@
1
- import { Field, ValidationResult } from '../interfaces/field';
2
- import { ORM } from '../types';
3
- export declare class UnionField<Fields extends Field[], IsOptional extends boolean = false> implements Field {
4
- private readonly orm;
5
- private readonly fields;
6
- constructor(orm: ORM, fields: Fields);
7
- private readonly schema;
8
- getSchema(): {
9
- type: string;
10
- required: boolean;
11
- properties: any[];
12
- };
13
- optional(): UnionField<Fields, true>;
14
- validate(value: any): ValidationResult;
15
- }
16
- //# sourceMappingURL=union.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"union.d.ts","sourceRoot":"","sources":["../../../src/aurora/core/union.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAC7D,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAI9B,qBAAa,UAAU,CAAC,MAAM,SAAS,KAAK,EAAE,EAAE,UAAU,SAAS,OAAO,GAAG,KAAK,CAAE,YAAW,KAAK;IAEhG,OAAO,CAAC,QAAQ,CAAC,GAAG;IACpB,OAAO,CAAC,QAAQ,CAAC,MAAM;gBADN,GAAG,EAAE,GAAG,EACR,MAAM,EAAE,MAAM;IAGjC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA0B;IAEjD,SAAS;;;;;IAYT,QAAQ,IAAK,UAAU,CAAC,MAAM,EAAE,IAAI,CAAC;IAKrC,QAAQ,CAAE,KAAK,EAAE,GAAG,GAAG,gBAAgB;CAOxC"}
@@ -1,38 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UnionField = void 0;
4
- const types_1 = require("../types");
5
- // @ts-ignore
6
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
7
- class UnionField {
8
- constructor(orm, fields) {
9
- this.orm = orm;
10
- this.fields = fields;
11
- this.schema = {};
12
- }
13
- getSchema() {
14
- if (this.orm === types_1.ORM.MONGO) {
15
- return {
16
- type: 'mixed',
17
- required: true,
18
- properties: this.fields.map(f => typeof f.getSchema === 'function' ? f.getSchema() : f),
19
- ...this.schema,
20
- };
21
- }
22
- throw new Error('not supported ORM');
23
- }
24
- optional() {
25
- this.schema.required = false;
26
- return this;
27
- }
28
- validate(value) {
29
- for (const field of this.fields) {
30
- const result = field.validate(value);
31
- if (!result.error)
32
- return { value: result.value };
33
- }
34
- return { value, error: 'Value does not match any allowed type' };
35
- }
36
- }
37
- exports.UnionField = UnionField;
38
- //# sourceMappingURL=union.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"union.js","sourceRoot":"","sources":["../../../src/aurora/core/union.ts"],"names":[],"mappings":";;;AACA,oCAA8B;AAE9B,aAAa;AACb,6DAA6D;AAC7D,MAAa,UAAU;IACrB,YACmB,GAAQ,EACR,MAAc;QADd,QAAG,GAAH,GAAG,CAAK;QACR,WAAM,GAAN,MAAM,CAAQ;QAGhB,WAAM,GAAwB,EAAE,CAAA;IAF7C,CAAC;IAIL,SAAS;QACP,IAAI,IAAI,CAAC,GAAG,KAAK,WAAG,CAAC,KAAK,EAAE,CAAC;YAC3B,OAAO;gBACL,IAAI,EAAE,OAAO;gBACb,QAAQ,EAAE,IAAI;gBACd,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,SAAS,KAAK,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;gBACvF,GAAG,IAAI,CAAC,MAAM;aACf,CAAA;QACH,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAA;IACtC,CAAC;IAED,QAAQ;QACN,IAAI,CAAC,MAAM,CAAC,QAAQ,GAAG,KAAK,CAAA;QAC5B,OAAO,IAA2C,CAAA;IACpD,CAAC;IAED,QAAQ,CAAE,KAAU;QAClB,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChC,MAAM,MAAM,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;YACpC,IAAI,CAAC,MAAM,CAAC,KAAK;gBAAE,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAA;QACnD,CAAC;QACD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,uCAAuC,EAAE,CAAA;IAClE,CAAC;CACF;AAhCD,gCAgCC"}
@@ -1,6 +0,0 @@
1
- export * from './core';
2
- export * from './interfaces/field';
3
- export { Aurora } from './lib/aurora';
4
- export { AuroraValidationError } from './lib/validation-error';
5
- export * from './types';
6
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/aurora/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAA;AACtB,cAAc,oBAAoB,CAAA;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACrC,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAA;AAC9D,cAAc,SAAS,CAAA"}
@@ -1,25 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.AuroraValidationError = exports.Aurora = void 0;
18
- __exportStar(require("./core"), exports);
19
- __exportStar(require("./interfaces/field"), exports);
20
- var aurora_1 = require("./lib/aurora");
21
- Object.defineProperty(exports, "Aurora", { enumerable: true, get: function () { return aurora_1.Aurora; } });
22
- var validation_error_1 = require("./lib/validation-error");
23
- Object.defineProperty(exports, "AuroraValidationError", { enumerable: true, get: function () { return validation_error_1.AuroraValidationError; } });
24
- __exportStar(require("./types"), exports);
25
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/aurora/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,yCAAsB;AACtB,qDAAkC;AAClC,uCAAqC;AAA5B,gGAAA,MAAM,OAAA;AACf,2DAA8D;AAArD,yHAAA,qBAAqB,OAAA;AAC9B,0CAAuB"}
@@ -1,9 +0,0 @@
1
- export interface ValidationResult {
2
- value: any;
3
- error?: string;
4
- }
5
- export interface Field {
6
- getSchema(): any;
7
- validate(value: any): ValidationResult;
8
- }
9
- //# sourceMappingURL=field.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"field.d.ts","sourceRoot":"","sources":["../../../src/aurora/interfaces/field.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,GAAG,CAAA;IACV,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,KAAK;IACpB,SAAS,IAAI,GAAG,CAAA;IAChB,QAAQ,CAAC,KAAK,EAAE,GAAG,GAAG,gBAAgB,CAAA;CACvC"}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=field.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"field.js","sourceRoot":"","sources":["../../../src/aurora/interfaces/field.ts"],"names":[],"mappings":""}
@@ -1,22 +0,0 @@
1
- import { ArrayField, BooleanField, DateField, NumberField, ObjectField, StringField, TypeField } from '../core';
2
- import { Field, ValidationResult } from '../interfaces/field';
3
- import { InferSchema, ORM } from '../types';
4
- export declare class Aurora<T extends Record<string, Field> = {}> {
5
- private readonly orm;
6
- private readonly obj?;
7
- private readonly schema;
8
- constructor(orm: ORM, obj?: T | undefined);
9
- string(): StringField;
10
- number(): NumberField;
11
- boolean(): BooleanField;
12
- date(): DateField;
13
- array<Arr extends Array<Field>>(arr: Arr): ArrayField<Arr>;
14
- object<Obj extends Record<string, Field>>(obj: Obj): ObjectField<Obj>;
15
- type(): TypeField;
16
- getSchema(): {
17
- [key: string]: any;
18
- };
19
- getType(): InferSchema<T>;
20
- validate(obj: any): ValidationResult;
21
- }
22
- //# sourceMappingURL=aurora.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"aurora.d.ts","sourceRoot":"","sources":["../../../src/aurora/lib/aurora.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAC/G,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAC7D,OAAO,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAK3C,qBAAa,MAAM,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,EAAE;IAIpD,OAAO,CAAC,QAAQ,CAAC,GAAG;IACpB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC;IAJvB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAwB;gBAG5B,GAAG,EAAE,GAAG,EACR,GAAG,CAAC,EAAE,CAAC,YAAA;IAc1B,MAAM,IAAK,WAAW;IAItB,MAAM,IAAK,WAAW;IAItB,OAAO,IAAK,YAAY;IAIxB,IAAI,IAAK,SAAS;IAIlB,KAAK,CAAC,GAAG,SAAS,KAAK,CAAC,KAAK,CAAC,EAAG,GAAG,EAAE,GAAG,GAAG,UAAU,CAAC,GAAG,CAAC;IAI3D,MAAM,CAAC,GAAG,SAAS,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EAAG,GAAG,EAAE,GAAG,GAAG,WAAW,CAAC,GAAG,CAAC;IAItE,IAAI,IAAK,SAAS;IAIlB,SAAS;;;IAIT,OAAO,IAAK,WAAW,CAAC,CAAC,CAAC;IAI1B,QAAQ,CAAE,GAAG,EAAE,GAAG,GAAG,gBAAgB;CAetC"}
@@ -1,155 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Aurora = void 0;
4
- const core_1 = require("../core");
5
- const validation_error_1 = require("./validation-error");
6
- // A Aurora só está aqui para validação de objetos e criação de types, não use ela para criar schemas de banco de dados, pois está incompleta
7
- class Aurora {
8
- constructor(orm, obj) {
9
- this.orm = orm;
10
- this.obj = obj;
11
- this.schema = {};
12
- if (this.obj) {
13
- for (const [key, value] of Object.entries(this.obj)) {
14
- if (typeof value.getSchema === 'function') {
15
- this.schema[key] = value.getSchema();
16
- }
17
- else {
18
- this.schema[key] = value;
19
- }
20
- }
21
- }
22
- }
23
- string() {
24
- return new core_1.StringField(this.orm);
25
- }
26
- number() {
27
- return new core_1.NumberField(this.orm);
28
- }
29
- boolean() {
30
- return new core_1.BooleanField(this.orm);
31
- }
32
- date() {
33
- return new core_1.DateField(this.orm);
34
- }
35
- array(arr) {
36
- return new core_1.ArrayField(this.orm, arr);
37
- }
38
- object(obj) {
39
- return new core_1.ObjectField(this.orm, obj);
40
- }
41
- type() {
42
- return new core_1.TypeField(this.orm);
43
- }
44
- getSchema() {
45
- return this.schema;
46
- }
47
- getType() {
48
- return null;
49
- }
50
- validate(obj) {
51
- const errors = {};
52
- const validated = {};
53
- for (const [key, field] of Object.entries(this.obj ?? {})) {
54
- if (typeof field.validate === 'function') {
55
- const result = field.validate(obj?.[key]);
56
- validated[key] = result.value;
57
- if (result.error)
58
- errors[key] = result.error;
59
- }
60
- }
61
- if (Object.keys(errors).length > 0) {
62
- throw new validation_error_1.AuroraValidationError(errors);
63
- }
64
- return { value: validated };
65
- }
66
- }
67
- exports.Aurora = Aurora;
68
- // const a = new Aurora(ORM.MONGO)
69
- // const userOrm = a.object({
70
- // name: a.string(),
71
- // age: a.number().optional(),
72
- // job: a.object({
73
- // name: a.string(),
74
- // salary: a.number(),
75
- // company: a.object({
76
- // name: a.string(),
77
- // }).optional()
78
- // }),
79
- // birthDate: a.date().optional(),
80
- // deathDate: a.type().union([a.date(), a.string()]),
81
- // isIncomeTaxed: a.boolean().optional(),
82
- // // TODO: see if this use case is necessary
83
- // // tags: a.array([a.string(), a.number()]).optional(),
84
- // employmentHistory: a.array([
85
- // a.object({
86
- // name: a.string(),
87
- // salary: a.number(),
88
- // company: a.string(),
89
- // }),
90
- // ])
91
- // })
92
- // export type UserType = ReturnType<typeof userOrm.getType>
93
- // export const user: UserType = {
94
- // name: 'ale',
95
- // job: {
96
- // name: 'dev',
97
- // salary: 5000,
98
- // company: {
99
- // name: 'company',
100
- // },
101
- // },
102
- // birthDate: new Date(),
103
- // deathDate: true ? '3000-07-01' : new Date(),
104
- // isIncomeTaxed: true,
105
- // employmentHistory: [
106
- // {
107
- // name: 'dev',
108
- // salary: 5000,
109
- // company: 'company',
110
- // },
111
- // {
112
- // name: 'po',
113
- // salary: 5000,
114
- // company: 'company'
115
- // }
116
- // ],
117
- // // tags: ['tag1', 123],
118
- // }
119
- // console.log(userOrm.getSchema())
120
- // // Teste de validação com objeto válido
121
- // try {
122
- // const result = userOrm.validate(user)
123
- // console.log('Validação bem-sucedida:', result)
124
- // } catch (e) {
125
- // console.error('Erro de validação (válido):', e)
126
- // }
127
- // // Teste de validação com array inválido (campo faltando e tipo errado)
128
- // const userInvalido = {
129
- // ...user,
130
- // employmentHistory: [
131
- // {
132
- // name: 'dev',
133
- // salary: 'não é número', // tipo errado
134
- // // company: 'company', // campo faltando
135
- // },
136
- // ],
137
- // }
138
- // try {
139
- // const result = userOrm.validate(userInvalido)
140
- // console.log('Validação inesperadamente bem-sucedida:', result)
141
- // } catch (e) {
142
- // console.error('Erro de validação (inválido):', e)
143
- // }
144
- // const b = new Aurora(ORM.MONGO)
145
- // const test = b.object({
146
- // name: b.string(),
147
- // age: b.number()
148
- // })
149
- // const c = new Aurora(ORM.MONGO)
150
- // const test2 = c.type().pick(test, ['name', 'age'])
151
- // export type A = ReturnType<typeof test2.getType>
152
- // // ver questão do ObjectId no schema
153
- // // ver formas de metrificar os ganhos da ferramenta
154
- // // ver como é q fica a questão do extended reference
155
- //# sourceMappingURL=aurora.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"aurora.js","sourceRoot":"","sources":["../../../src/aurora/lib/aurora.ts"],"names":[],"mappings":";;;AAAA,kCAA+G;AAG/G,yDAA0D;AAE1D,6IAA6I;AAE7I,MAAa,MAAM;IAGjB,YACmB,GAAQ,EACR,GAAO;QADP,QAAG,GAAH,GAAG,CAAK;QACR,QAAG,GAAH,GAAG,CAAI;QAExB,IAAI,CAAC,MAAM,GAAG,EAAE,CAAA;QAChB,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;YACb,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;gBACpD,IAAI,OAAO,KAAK,CAAC,SAAS,KAAK,UAAU,EAAE,CAAC;oBAC1C,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,SAAS,EAAE,CAAA;gBACtC,CAAC;qBAAM,CAAC;oBACN,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;gBAC1B,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,kBAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IAClC,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,kBAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IAClC,CAAC;IAED,OAAO;QACL,OAAO,IAAI,mBAAY,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IACnC,CAAC;IAED,IAAI;QACF,OAAO,IAAI,gBAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IAChC,CAAC;IAED,KAAK,CAA4B,GAAQ;Q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oBAAoB;AACpB,wBAAwB;AACxB,0BAA0B;AAC1B,0BAA0B;AAC1B,0BAA0B;AAC1B,oBAAoB;AACpB,QAAQ;AACR,oCAAoC;AACpC,uDAAuD;AACvD,2CAA2C;AAC3C,+CAA+C;AAC/C,2DAA2D;AAC3D,iCAAiC;AACjC,iBAAiB;AACjB,0BAA0B;AAC1B,4BAA4B;AAC5B,6BAA6B;AAC7B,UAAU;AACV,OAAO;AACP,KAAK;AAEL,4DAA4D;AAE5D,kCAAkC;AAClC,iBAAiB;AACjB,WAAW;AACX,mBAAmB;AACnB,oBAAoB;AACpB,iBAAiB;AACjB,yBAAyB;AACzB,SAAS;AACT,OAAO;AACP,2BAA2B;AAC3B,iDAAiD;AACjD,yBAAyB;AACzB,yBAAyB;AACzB,QAAQ;AACR,qBAAqB;AACrB,sBAAsB;AACtB,4BAA4B;AAC5B,SAAS;AACT,QAAQ;AACR,oBAAoB;AACpB,sBAAsB;AACtB,2BAA2B;AAC3B,QAAQ;AACR,OAAO;AACP,4BAA4B;AAC5B,IAAI;AAEJ,mCAAmC;AAEnC,0CAA0C;AAC1C,QAAQ;AACR,0CAA0C;AAC1C,mDAAmD;AACnD,gBAAgB;AAChB,oDAAoD;AACpD,IAAI;AAEJ,0EAA0E;AAC1E,yBAAyB;AACzB,aAAa;AACb,yBAAyB;AACzB,QAAQ;AACR,qBAAqB;AACrB,+CAA+C;AAC/C,iDAAiD;AACjD,SAAS;AACT,OAAO;AACP,IAAI;AAEJ,QAAQ;AACR,kDAAkD;AAClD,mEAAmE;AACnE,gBAAgB;AAChB,sDAAsD;AACtD,IAAI;AAEJ,kCAAkC;AAClC,0BAA0B;AAC1B,sBAAsB;AACtB,oBAAoB;AACpB,KAAK;AAEL,kCAAkC;AAClC,qDAAqD;AAErD,mDAAmD;AAEnD,uCAAuC;AACvC,sDAAsD;AACtD,uDAAuD"}
@@ -1,5 +0,0 @@
1
- export declare class AuroraValidationError extends Error {
2
- readonly details: Record<string, string>;
3
- constructor(details: Record<string, string>);
4
- }
5
- //# sourceMappingURL=validation-error.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validation-error.d.ts","sourceRoot":"","sources":["../../../src/aurora/lib/validation-error.ts"],"names":[],"mappings":"AAAA,qBAAa,qBAAsB,SAAQ,KAAK;IAC9C,SAAgB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;gBAClC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;CAK7C"}
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AuroraValidationError = void 0;
4
- class AuroraValidationError extends Error {
5
- constructor(details) {
6
- super('Validation failed');
7
- this.details = details;
8
- this.name = 'AuroraValidationError';
9
- }
10
- }
11
- exports.AuroraValidationError = AuroraValidationError;
12
- //# sourceMappingURL=validation-error.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validation-error.js","sourceRoot":"","sources":["../../../src/aurora/lib/validation-error.ts"],"names":[],"mappings":";;;AAAA,MAAa,qBAAsB,SAAQ,KAAK;IAE9C,YAAa,OAA+B;QAC1C,KAAK,CAAC,mBAAmB,CAAC,CAAA;QAC1B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAA;IACrC,CAAC;CACF;AAPD,sDAOC"}
@@ -1,3 +0,0 @@
1
- export { InferSchema } from './infer-type';
2
- export { ORM } from './orm';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/aurora/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA"}
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ORM = void 0;
4
- var orm_1 = require("./orm");
5
- Object.defineProperty(exports, "ORM", { enumerable: true, get: function () { return orm_1.ORM; } });
6
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/aurora/types/index.ts"],"names":[],"mappings":";;;AACA,6BAA2B;AAAlB,0FAAA,GAAG,OAAA"}
@@ -1,13 +0,0 @@
1
- import { ArrayField, BooleanField, DateField, NumberField, ObjectField, StringField, UnionField } from '../core';
2
- import { TypeField } from '../core/type';
3
- import { Field } from '../interfaces/field';
4
- type InferArraySchema<T extends Array<any>> = T extends (infer U)[] ? U extends Record<string, Field> ? InferSchema<U>[] : U extends Field ? InferFieldType<U>[] : never : never;
5
- type InferFieldType<F> = F extends StringField<infer IsOpt extends boolean> ? IsOpt extends true ? string | undefined : string : F extends NumberField<infer IsOpt extends boolean> ? IsOpt extends true ? number | undefined : number : F extends BooleanField<infer IsOpt extends boolean> ? IsOpt extends true ? boolean | undefined : boolean : F extends DateField<infer IsOpt extends boolean> ? IsOpt extends true ? Date | undefined : Date : F extends TypeField<infer IsOpt extends boolean> ? IsOpt extends true ? any | undefined : any : F extends ArrayField<infer Arr, infer IsOpt extends boolean> ? IsOpt extends true ? InferArraySchema<Arr> | undefined : InferArraySchema<Arr> : F extends ObjectField<infer Obj, infer IsOpt extends boolean> ? IsOpt extends true ? InferSchema<Obj> | undefined : InferSchema<Obj> : F extends UnionField<infer Fields extends Field[], infer IsOpt extends boolean> ? IsOpt extends true ? InferFieldType<Fields[number]> | undefined : InferFieldType<Fields[number]> : never;
6
- type IsOptionalField<F> = F extends StringField<infer O> ? O extends true ? true : false : F extends NumberField<infer O> ? O extends true ? true : false : F extends BooleanField<infer O> ? O extends true ? true : false : F extends DateField<infer O> ? O extends true ? true : false : F extends TypeField<infer O> ? O extends true ? true : false : F extends ArrayField<any, infer O> ? O extends true ? true : false : F extends ObjectField<any, infer O> ? O extends true ? true : false : F extends UnionField<any, infer O> ? O extends true ? true : false : false;
7
- export type InferSchema<T> = {
8
- [K in keyof T as IsOptionalField<T[K]> extends true ? K : never]?: InferFieldType<T[K]>;
9
- } & {
10
- [K in keyof T as IsOptionalField<T[K]> extends false ? K : never]: InferFieldType<T[K]>;
11
- };
12
- export {};
13
- //# sourceMappingURL=infer-type.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"infer-type.d.ts","sourceRoot":"","sources":["../../../src/aurora/types/infer-type.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAChH,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAE3C,KAAK,gBAAgB,CAAC,CAAC,SAAS,KAAK,CAAC,GAAG,CAAC,IAC1C,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,GACnB,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,GACzB,WAAW,CAAC,CAAC,CAAC,EAAE,GAChB,CAAC,SAAS,KAAK,GACb,cAAc,CAAC,CAAC,CAAC,EAAE,GACnB,KAAK,GACT,KAAK,CAAA;AAEX,KAAK,cAAc,CAAC,CAAC,IACnB,CAAC,SAAS,WAAW,CAAC,MAAM,KAAK,SAAS,OAAO,CAAC,GAC9C,KAAK,SAAS,IAAI,GAChB,MAAM,GAAG,SAAS,GAClB,MAAM,GACR,CAAC,SAAS,WAAW,CAAC,MAAM,KAAK,SAAS,OAAO,CAAC,GAChD,KAAK,SAAS,IAAI,GAChB,MAAM,GAAG,SAAS,GAClB,MAAM,GACV,CAAC,SAAS,YAAY,CAAC,MAAM,KAAK,SAAS,OAAO,CAAC,GACjD,KAAK,SAAS,IAAI,GAChB,OAAO,GAAG,SAAS,GACnB,OAAO,GACX,CAAC,SAAS,SAAS,CAAC,MAAM,KAAK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SAAS,SAAS,CAAC,MAAM,CAAC,CAAC,GAC1B,CAAC,SAAS,IAAI,GACZ,IAAI,GACJ,KAAK,GACT,CAAC,SAAS,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,GAChC,CAAC,SAAS,IAAI,GACZ,IAAI,GACJ,KAAK,GACT,CAAC,SAAS,WAAW,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,GACjC,CAAC,SAAS,IAAI,GACZ,IAAI,GACJ,KAAK,GACT,CAAC,SAAS,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,GAChC,CAAC,SAAS,IAAI,GACZ,IAAI,GACJ,KAAK,GACT,KAAK,CAAA;AAEX,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI;KAC1B,CAAC,IAAI,MAAM,CAAC,IAAI,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,IAAI,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CACxF,GAAG;KACD,CAAC,IAAI,MAAM,CAAC,IAAI,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,KAAK,GAAG,CAAC,GAAG,KAAK,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CACxF,CAAA"}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=infer-type.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"infer-type.js","sourceRoot":"","sources":["../../../src/aurora/types/infer-type.ts"],"names":[],"mappings":""}
@@ -1,4 +0,0 @@
1
- export declare enum ORM {
2
- MONGO = "mongo"
3
- }
4
- //# sourceMappingURL=orm.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"orm.d.ts","sourceRoot":"","sources":["../../../src/aurora/types/orm.ts"],"names":[],"mappings":"AAAA,oBAAY,GAAG;IACb,KAAK,UAAU;CAChB"}
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ORM = void 0;
4
- var ORM;
5
- (function (ORM) {
6
- ORM["MONGO"] = "mongo";
7
- })(ORM || (exports.ORM = ORM = {}));
8
- //# sourceMappingURL=orm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"orm.js","sourceRoot":"","sources":["../../../src/aurora/types/orm.ts"],"names":[],"mappings":";;;AAAA,IAAY,GAEX;AAFD,WAAY,GAAG;IACb,sBAAe,CAAA;AACjB,CAAC,EAFW,GAAG,mBAAH,GAAG,QAEd"}
@@ -1,5 +0,0 @@
1
- export declare const personOrm: import("../../../aurora").ObjectField<{
2
- name: import("../../../aurora").StringField<false>;
3
- age: import("../../../aurora").NumberField<false>;
4
- }, false>;
5
- //# sourceMappingURL=person-orm.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"person-orm.d.ts","sourceRoot":"","sources":["../../../../src/core/data/person/person-orm.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,SAAS;;;SAGpB,CAAA"}
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.personOrm = void 0;
4
- const aurora_1 = require("../../../aurora");
5
- const aurora = new aurora_1.Aurora(aurora_1.ORM.MONGO);
6
- exports.personOrm = aurora.object({
7
- name: aurora.string(),
8
- age: aurora.number(),
9
- });
10
- //# sourceMappingURL=person-orm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"person-orm.js","sourceRoot":"","sources":["../../../../src/core/data/person/person-orm.ts"],"names":[],"mappings":";;;AAAA,4CAA6C;AAE7C,MAAM,MAAM,GAAG,IAAI,eAAM,CAAC,YAAG,CAAC,KAAK,CAAC,CAAA;AAEvB,QAAA,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC;IACrC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE;IACrB,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE;CACrB,CAAC,CAAA"}