@neogroup/neorm 0.0.1 → 0.0.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.
Files changed (225) hide show
  1. package/README.md +1 -0
  2. package/dist/database/Connection.d.ts +10 -0
  3. package/dist/database/Connection.js +3 -0
  4. package/dist/database/Connection.js.map +1 -0
  5. package/dist/database/DB.d.ts +58 -0
  6. package/dist/database/DB.js +229 -0
  7. package/dist/database/DB.js.map +1 -0
  8. package/dist/database/DataConnection.d.ts +24 -0
  9. package/dist/database/DataConnection.js +99 -0
  10. package/dist/database/DataConnection.js.map +1 -0
  11. package/dist/database/DataSet.d.ts +3 -0
  12. package/dist/database/DataSet.js +3 -0
  13. package/dist/database/DataSet.js.map +1 -0
  14. package/dist/database/DataSource.d.ts +23 -0
  15. package/dist/database/DataSource.js +56 -0
  16. package/dist/database/DataSource.js.map +1 -0
  17. package/dist/database/DataTable.d.ts +19 -0
  18. package/dist/database/DataTable.js +75 -0
  19. package/dist/database/DataTable.js.map +1 -0
  20. package/dist/database/index.d.ts +7 -0
  21. package/dist/database/index.js +24 -0
  22. package/dist/database/index.js.map +1 -0
  23. package/dist/database/sources/index.d.ts +3 -0
  24. package/dist/database/sources/index.js +20 -0
  25. package/dist/database/sources/index.js.map +1 -0
  26. package/dist/database/sources/mysql/MysqlConnection.d.ts +14 -0
  27. package/dist/database/sources/mysql/MysqlConnection.js +36 -0
  28. package/dist/database/sources/mysql/MysqlConnection.js.map +1 -0
  29. package/dist/database/sources/mysql/MysqlDataSource.d.ts +24 -0
  30. package/dist/database/sources/mysql/MysqlDataSource.js +72 -0
  31. package/dist/database/sources/mysql/MysqlDataSource.js.map +1 -0
  32. package/dist/database/sources/mysql/MysqlQueryBuilder.d.ts +6 -0
  33. package/dist/database/sources/mysql/MysqlQueryBuilder.js +28 -0
  34. package/dist/database/sources/mysql/MysqlQueryBuilder.js.map +1 -0
  35. package/dist/database/sources/mysql/index.d.ts +3 -0
  36. package/dist/database/sources/mysql/index.js +20 -0
  37. package/dist/database/sources/mysql/index.js.map +1 -0
  38. package/dist/database/sources/postgres/PostgresConnection.d.ts +13 -0
  39. package/dist/database/sources/postgres/PostgresConnection.js +40 -0
  40. package/dist/database/sources/postgres/PostgresConnection.js.map +1 -0
  41. package/dist/database/sources/postgres/PostgresDataSource.d.ts +24 -0
  42. package/dist/database/sources/postgres/PostgresDataSource.js +73 -0
  43. package/dist/database/sources/postgres/PostgresDataSource.js.map +1 -0
  44. package/dist/database/sources/postgres/PostgresQueryBuilder.d.ts +5 -0
  45. package/dist/database/sources/postgres/PostgresQueryBuilder.js +13 -0
  46. package/dist/database/sources/postgres/PostgresQueryBuilder.js.map +1 -0
  47. package/dist/database/sources/postgres/index.d.ts +2 -0
  48. package/dist/database/sources/postgres/index.js +19 -0
  49. package/dist/database/sources/postgres/index.js.map +1 -0
  50. package/dist/database/sources/sqlite/SqliteConnection.d.ts +14 -0
  51. package/dist/database/sources/sqlite/SqliteConnection.js +37 -0
  52. package/dist/database/sources/sqlite/SqliteConnection.js.map +1 -0
  53. package/dist/database/sources/sqlite/SqliteDataSource.d.ts +11 -0
  54. package/dist/database/sources/sqlite/SqliteDataSource.js +34 -0
  55. package/dist/database/sources/sqlite/SqliteDataSource.js.map +1 -0
  56. package/dist/database/sources/sqlite/SqliteQueryBuilder.d.ts +6 -0
  57. package/dist/database/sources/sqlite/SqliteQueryBuilder.js +23 -0
  58. package/dist/database/sources/sqlite/SqliteQueryBuilder.js.map +1 -0
  59. package/dist/database/sources/sqlite/index.d.ts +3 -0
  60. package/dist/database/sources/sqlite/index.js +20 -0
  61. package/dist/database/sources/sqlite/index.js.map +1 -0
  62. package/dist/entities/CastType.d.ts +1 -0
  63. package/dist/entities/CastType.js +3 -0
  64. package/dist/entities/CastType.js.map +1 -0
  65. package/dist/entities/Entities.d.ts +14 -0
  66. package/dist/entities/Entities.js +85 -0
  67. package/dist/entities/Entities.js.map +1 -0
  68. package/dist/entities/EntityQuery.d.ts +60 -0
  69. package/dist/entities/EntityQuery.js +305 -0
  70. package/dist/entities/EntityQuery.js.map +1 -0
  71. package/dist/entities/RelationshipType.d.ts +1 -0
  72. package/dist/entities/RelationshipType.js +3 -0
  73. package/dist/entities/RelationshipType.js.map +1 -0
  74. package/dist/entities/decorators/BelongsTo.d.ts +2 -0
  75. package/dist/entities/decorators/BelongsTo.js +16 -0
  76. package/dist/entities/decorators/BelongsTo.js.map +1 -0
  77. package/dist/entities/decorators/Column.d.ts +13 -0
  78. package/dist/entities/decorators/Column.js +13 -0
  79. package/dist/entities/decorators/Column.js.map +1 -0
  80. package/dist/entities/decorators/Entity.d.ts +15 -0
  81. package/dist/entities/decorators/Entity.js +170 -0
  82. package/dist/entities/decorators/Entity.js.map +1 -0
  83. package/dist/entities/decorators/HasMany.d.ts +2 -0
  84. package/dist/entities/decorators/HasMany.js +16 -0
  85. package/dist/entities/decorators/HasMany.js.map +1 -0
  86. package/dist/entities/decorators/HasManyThrough.d.ts +2 -0
  87. package/dist/entities/decorators/HasManyThrough.js +24 -0
  88. package/dist/entities/decorators/HasManyThrough.js.map +1 -0
  89. package/dist/entities/decorators/HasOne.d.ts +2 -0
  90. package/dist/entities/decorators/HasOne.js +13 -0
  91. package/dist/entities/decorators/HasOne.js.map +1 -0
  92. package/dist/entities/decorators/HasOneThrough.d.ts +2 -0
  93. package/dist/entities/decorators/HasOneThrough.js +24 -0
  94. package/dist/entities/decorators/HasOneThrough.js.map +1 -0
  95. package/dist/entities/decorators/casts.d.ts +3 -0
  96. package/dist/entities/decorators/casts.js +39 -0
  97. package/dist/entities/decorators/casts.js.map +1 -0
  98. package/dist/entities/decorators/index.d.ts +7 -0
  99. package/dist/entities/decorators/index.js +24 -0
  100. package/dist/entities/decorators/index.js.map +1 -0
  101. package/dist/entities/decorators/metadata.d.ts +19 -0
  102. package/dist/entities/decorators/metadata.js +12 -0
  103. package/dist/entities/decorators/metadata.js.map +1 -0
  104. package/dist/entities/index.d.ts +5 -3
  105. package/dist/entities/index.js +5 -2
  106. package/dist/entities/index.js.map +1 -1
  107. package/dist/entities/relationship.d.ts +1 -6
  108. package/dist/entities/relationship.js +1 -22
  109. package/dist/entities/relationship.js.map +1 -1
  110. package/dist/index.d.ts +2 -9
  111. package/dist/index.js +2 -14
  112. package/dist/index.js.map +1 -1
  113. package/dist/query/DeleteQuery.d.ts +8 -0
  114. package/dist/query/DeleteQuery.js +17 -0
  115. package/dist/query/DeleteQuery.js.map +1 -0
  116. package/dist/query/InsertQuery.d.ts +8 -0
  117. package/dist/query/InsertQuery.js +17 -0
  118. package/dist/query/InsertQuery.js.map +1 -0
  119. package/dist/query/QueryTable.d.ts +7 -0
  120. package/dist/query/QueryTable.js +3 -0
  121. package/dist/query/QueryTable.js.map +1 -0
  122. package/dist/query/SelectQuery.d.ts +9 -0
  123. package/dist/query/SelectQuery.js +33 -0
  124. package/dist/query/SelectQuery.js.map +1 -0
  125. package/dist/query/UpdateQuery.d.ts +8 -0
  126. package/dist/query/UpdateQuery.js +17 -0
  127. package/dist/query/UpdateQuery.js.map +1 -0
  128. package/dist/query/builders/DefaultQueryBuilder.d.ts +87 -0
  129. package/dist/query/builders/DefaultQueryBuilder.js +524 -0
  130. package/dist/query/builders/DefaultQueryBuilder.js.map +1 -0
  131. package/dist/query/builders/QueryBuilder.d.ts +5 -0
  132. package/dist/query/builders/QueryBuilder.js +7 -0
  133. package/dist/query/builders/QueryBuilder.js.map +1 -0
  134. package/dist/query/builders/index.d.ts +2 -2
  135. package/dist/query/builders/index.js +2 -2
  136. package/dist/query/builders/index.js.map +1 -1
  137. package/dist/query/conditions/BasicCondition.d.ts +6 -0
  138. package/dist/query/conditions/BasicCondition.js +3 -0
  139. package/dist/query/conditions/BasicCondition.js.map +1 -0
  140. package/dist/query/conditions/ColumnCondition.d.ts +6 -0
  141. package/dist/query/conditions/ColumnCondition.js +3 -0
  142. package/dist/query/conditions/ColumnCondition.js.map +1 -0
  143. package/dist/query/conditions/Condition.d.ts +5 -0
  144. package/dist/query/conditions/Condition.js +3 -0
  145. package/dist/query/conditions/Condition.js.map +1 -0
  146. package/dist/query/conditions/ConditionConnector.d.ts +4 -0
  147. package/dist/query/conditions/ConditionConnector.js +9 -0
  148. package/dist/query/conditions/ConditionConnector.js.map +1 -0
  149. package/dist/query/conditions/ConditionGroup.d.ts +40 -0
  150. package/dist/query/conditions/ConditionGroup.js +138 -0
  151. package/dist/query/conditions/ConditionGroup.js.map +1 -0
  152. package/dist/query/conditions/ConnectedCondition.d.ts +6 -0
  153. package/dist/query/conditions/ConnectedCondition.js +3 -0
  154. package/dist/query/conditions/ConnectedCondition.js.map +1 -0
  155. package/dist/query/conditions/RawCondition.d.ts +4 -0
  156. package/dist/query/conditions/RawCondition.js +3 -0
  157. package/dist/query/conditions/RawCondition.js.map +1 -0
  158. package/dist/query/conditions/index.d.ts +7 -0
  159. package/dist/query/conditions/index.js +24 -0
  160. package/dist/query/conditions/index.js.map +1 -0
  161. package/dist/query/features/HasAlias.d.ts +6 -0
  162. package/dist/query/features/HasAlias.js +17 -0
  163. package/dist/query/features/HasAlias.js.map +1 -0
  164. package/dist/query/features/HasDistinct.d.ts +6 -0
  165. package/dist/query/features/HasDistinct.js +20 -0
  166. package/dist/query/features/HasDistinct.js.map +1 -0
  167. package/dist/query/features/HasFieldValues.d.ts +9 -0
  168. package/dist/query/features/HasFieldValues.js +27 -0
  169. package/dist/query/features/HasFieldValues.js.map +1 -0
  170. package/dist/query/features/HasGroupByFields.d.ts +7 -0
  171. package/dist/query/features/HasGroupByFields.js +21 -0
  172. package/dist/query/features/HasGroupByFields.js.map +1 -0
  173. package/dist/query/features/HasHavingConditions.d.ts +13 -0
  174. package/dist/query/features/HasHavingConditions.js +28 -0
  175. package/dist/query/features/HasHavingConditions.js.map +1 -0
  176. package/dist/query/features/HasJoins.d.ts +41 -0
  177. package/dist/query/features/HasJoins.js +66 -0
  178. package/dist/query/features/HasJoins.js.map +1 -0
  179. package/dist/query/features/HasLimit.d.ts +6 -0
  180. package/dist/query/features/HasLimit.js +20 -0
  181. package/dist/query/features/HasLimit.js.map +1 -0
  182. package/dist/query/features/HasOffset.d.ts +6 -0
  183. package/dist/query/features/HasOffset.js +20 -0
  184. package/dist/query/features/HasOffset.js.map +1 -0
  185. package/dist/query/features/HasOrderByFields.d.ts +15 -0
  186. package/dist/query/features/HasOrderByFields.js +38 -0
  187. package/dist/query/features/HasOrderByFields.js.map +1 -0
  188. package/dist/query/features/HasSelectFields.d.ts +11 -0
  189. package/dist/query/features/HasSelectFields.js +21 -0
  190. package/dist/query/features/HasSelectFields.js.map +1 -0
  191. package/dist/query/features/HasTable.d.ts +7 -0
  192. package/dist/query/features/HasTable.js +20 -0
  193. package/dist/query/features/HasTable.js.map +1 -0
  194. package/dist/query/features/HasUnions.d.ts +13 -0
  195. package/dist/query/features/HasUnions.js +21 -0
  196. package/dist/query/features/HasUnions.js.map +1 -0
  197. package/dist/query/features/HasWhen.d.ts +3 -0
  198. package/dist/query/features/HasWhen.js +13 -0
  199. package/dist/query/features/HasWhen.js.map +1 -0
  200. package/dist/query/features/HasWhereConditions.d.ts +35 -0
  201. package/dist/query/features/HasWhereConditions.js +92 -0
  202. package/dist/query/features/HasWhereConditions.js.map +1 -0
  203. package/dist/query/features/index.d.ts +14 -14
  204. package/dist/query/features/index.js +14 -14
  205. package/dist/query/features/index.js.map +1 -1
  206. package/dist/query/fields/BasicField.d.ts +5 -0
  207. package/dist/query/fields/BasicField.js +3 -0
  208. package/dist/query/fields/BasicField.js.map +1 -0
  209. package/dist/query/fields/Field.d.ts +3 -0
  210. package/dist/query/fields/Field.js +3 -0
  211. package/dist/query/fields/Field.js.map +1 -0
  212. package/dist/query/fields/RawField.d.ts +1 -0
  213. package/dist/query/fields/RawField.js +3 -0
  214. package/dist/query/fields/RawField.js.map +1 -0
  215. package/dist/query/fields/index.d.ts +3 -0
  216. package/dist/query/fields/index.js +20 -0
  217. package/dist/query/fields/index.js.map +1 -0
  218. package/dist/query/index.d.ts +7 -7
  219. package/dist/query/index.js +7 -7
  220. package/dist/query/index.js.map +1 -1
  221. package/dist/query/query.js +1 -1
  222. package/dist/query/query.js.map +1 -1
  223. package/dist/query/statement.js +1 -1
  224. package/dist/query/statement.js.map +1 -1
  225. package/package.json +14 -9
@@ -0,0 +1,15 @@
1
+ import { DataSource } from '../../database/DataSource';
2
+ export interface EntityOptions {
3
+ /** Database table name. Defaults to lowercase class name + 's'. */
4
+ table?: string;
5
+ /** Primary key column name. Defaults to 'id'. */
6
+ primaryKey?: string;
7
+ /** DataSource to use. Defaults to DB.getActiveSource(). */
8
+ source?: DataSource | null;
9
+ }
10
+ /**
11
+ * Marks a class as an Active Record entity.
12
+ * Injects static query methods (find, where, get, with, …) — no base class required.
13
+ * Use saveEntity() and deleteEntity() for persistence.
14
+ */
15
+ export declare function Entity(options?: EntityOptions): <T extends new (...args: any[]) => {}>(BaseClass: T) => T;
@@ -0,0 +1,170 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Entity = void 0;
4
+ const DB_1 = require("../../database/DB");
5
+ const EntityQuery_1 = require("../EntityQuery");
6
+ const casts_1 = require("./casts");
7
+ const metadata_1 = require("./metadata");
8
+ /**
9
+ * Marks a class as an Active Record entity.
10
+ * Injects static query methods (find, where, get, with, …) — no base class required.
11
+ * Use saveEntity() and deleteEntity() for persistence.
12
+ */
13
+ function Entity(options) {
14
+ return function (BaseClass) {
15
+ var _a, _b, _c, _d, _e, _f;
16
+ // Read metadata accumulated by property decorators on BaseClass.prototype.
17
+ const originalName = BaseClass.name;
18
+ const meta = (_a = metadata_1.registry.get(BaseClass.prototype)) !== null && _a !== void 0 ? _a : { columns: [], relationships: [] };
19
+ const tableName = (_b = options === null || options === void 0 ? void 0 : options.table) !== null && _b !== void 0 ? _b : originalName.toLowerCase() + 's';
20
+ const primaryKeyMeta = meta.columns.find((c) => c.primaryKey);
21
+ const primaryKeyCol = (_e = (_d = (primaryKeyMeta && ((_c = primaryKeyMeta.columnName) !== null && _c !== void 0 ? _c : primaryKeyMeta.name))) !== null && _d !== void 0 ? _d : options === null || options === void 0 ? void 0 : options.primaryKey) !== null && _e !== void 0 ? _e : 'id';
22
+ const fieldNames = meta.columns.map((c) => c.name);
23
+ // Property name → database column name (defaults to the property name)
24
+ const columnsMap = {};
25
+ meta.columns.forEach((c) => {
26
+ var _a;
27
+ columnsMap[c.name] = (_a = c.columnName) !== null && _a !== void 0 ? _a : c.name;
28
+ });
29
+ const autoGeneratedFields = meta.columns.filter((c) => c.autoGenerated).map((c) => c.name);
30
+ const castsMap = {};
31
+ meta.columns.forEach((c) => {
32
+ if (c.cast) {
33
+ castsMap[c.name] = c.cast;
34
+ }
35
+ });
36
+ const relsMap = {};
37
+ meta.relationships.forEach((r) => {
38
+ relsMap[r.name] = r.relationship;
39
+ });
40
+ const configuredSource = (_f = options === null || options === void 0 ? void 0 : options.source) !== null && _f !== void 0 ? _f : null;
41
+ // ── Closures shared by static methods ────────────────────────────────
42
+ function resolveSource() {
43
+ return configuredSource !== null && configuredSource !== void 0 ? configuredSource : DB_1.DB.getActiveSource();
44
+ }
45
+ function hydrateRow(row) {
46
+ var _a;
47
+ const instance = new Enhanced();
48
+ const cols = fieldNames.length > 0 ? fieldNames : Object.keys(row);
49
+ for (const prop of cols) {
50
+ const col = (_a = columnsMap[prop]) !== null && _a !== void 0 ? _a : prop;
51
+ if (!(col in row)) {
52
+ continue;
53
+ }
54
+ const cast = castsMap[prop];
55
+ instance[prop] = cast ? (0, casts_1.applyCast)(row[col], cast) : row[col];
56
+ }
57
+ return instance;
58
+ }
59
+ function buildQuery() {
60
+ return new EntityQuery_1.EntityQuery(Enhanced, resolveSource().table(tableName));
61
+ }
62
+ // ── Enhanced class — wraps BaseClass and injects all methods ──────────
63
+ class Enhanced extends BaseClass {
64
+ static fromRow(row) {
65
+ return hydrateRow(row);
66
+ }
67
+ toJSON() {
68
+ const result = {};
69
+ // Own enumerable properties — column values set by hydrateRow
70
+ for (const key of Object.keys(this)) {
71
+ result[key] = this[key];
72
+ }
73
+ // Getters defined on the user's class prototype (computed attributes)
74
+ for (const key of Object.getOwnPropertyNames(BaseClass.prototype)) {
75
+ if (key === 'constructor' || key in result) {
76
+ continue;
77
+ }
78
+ const descriptor = Object.getOwnPropertyDescriptor(BaseClass.prototype, key);
79
+ if (descriptor && typeof descriptor.get === 'function') {
80
+ try {
81
+ result[key] = this[key];
82
+ }
83
+ catch (_a) {
84
+ // skip getters that throw (e.g. unloaded relationships)
85
+ }
86
+ }
87
+ }
88
+ return result;
89
+ }
90
+ // ── Static query methods ───────────────────────────────────────────
91
+ static async find(id) {
92
+ return buildQuery().find(id);
93
+ }
94
+ static async get() {
95
+ return buildQuery().get();
96
+ }
97
+ static async first() {
98
+ return buildQuery().first();
99
+ }
100
+ static where(...args) {
101
+ return buildQuery().where(...args);
102
+ }
103
+ static whereIn(field, values) {
104
+ return buildQuery().whereIn(field, values);
105
+ }
106
+ static whereNotIn(field, values) {
107
+ return buildQuery().whereNotIn(field, values);
108
+ }
109
+ static whereBetween(field, range) {
110
+ return buildQuery().whereBetween(field, range);
111
+ }
112
+ static whereNotBetween(field, range) {
113
+ return buildQuery().whereNotBetween(field, range);
114
+ }
115
+ static whereNull(field) {
116
+ return buildQuery().whereNull(field);
117
+ }
118
+ static whereNotNull(field) {
119
+ return buildQuery().whereNotNull(field);
120
+ }
121
+ static whereLike(field, pattern) {
122
+ return buildQuery().whereLike(field, pattern);
123
+ }
124
+ static whereNotLike(field, pattern) {
125
+ return buildQuery().whereNotLike(field, pattern);
126
+ }
127
+ static whereColumn(...args) {
128
+ return buildQuery().whereColumn(...args);
129
+ }
130
+ static orderBy(field, direction) {
131
+ return buildQuery().orderBy(field, direction);
132
+ }
133
+ static limit(value) {
134
+ return buildQuery().limit(value);
135
+ }
136
+ static offset(value) {
137
+ return buildQuery().offset(value);
138
+ }
139
+ static select(...args) {
140
+ return buildQuery().select(...args);
141
+ }
142
+ static with(relations, ...rest) {
143
+ return buildQuery().with(relations, ...rest);
144
+ }
145
+ static joinRelationship(name) {
146
+ return buildQuery().joinRelationship(name);
147
+ }
148
+ static innerJoinRelationship(name) {
149
+ return buildQuery().innerJoinRelationship(name);
150
+ }
151
+ static leftJoinRelationship(name) {
152
+ return buildQuery().leftJoinRelationship(name);
153
+ }
154
+ }
155
+ // Static metadata (also used by EntityQuery internals)
156
+ Enhanced.table = tableName;
157
+ Enhanced.primaryKey = primaryKeyCol;
158
+ Enhanced.fields = fieldNames;
159
+ Enhanced.columnsMap = columnsMap;
160
+ Enhanced.autoGeneratedFields = autoGeneratedFields;
161
+ Enhanced.casts = castsMap;
162
+ Enhanced.relationships = relsMap;
163
+ Enhanced.source = configuredSource;
164
+ // Preserve the original class name so default table names and stack traces stay clean.
165
+ Object.defineProperty(Enhanced, 'name', { value: originalName });
166
+ return Enhanced;
167
+ };
168
+ }
169
+ exports.Entity = Entity;
170
+ //# sourceMappingURL=Entity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Entity.js","sourceRoot":"","sources":["../../../src/entities/decorators/Entity.ts"],"names":[],"mappings":";;;AACA,0CAAsC;AAKtC,gDAA4C;AAE5C,mCAAmC;AACnC,yCAAqC;AAWrC;;;;GAIG;AACH,SAAgB,MAAM,CAAC,OAAuB;IAC5C,OAAO,UAAkD,SAAY;;QACnE,2EAA2E;QAC3E,MAAM,YAAY,GAAG,SAAS,CAAC,IAAI,CAAA;QACnC,MAAM,IAAI,GAAG,MAAA,mBAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,SAAS,CAAC,mCAAI,EAAE,OAAO,EAAE,EAAE,EAAE,aAAa,EAAE,EAAE,EAAE,CAAA;QACpF,MAAM,SAAS,GAAG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,mCAAI,YAAY,CAAC,WAAW,EAAE,GAAG,GAAG,CAAA;QACpE,MAAM,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,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A1MD,wBA0MC"}
@@ -0,0 +1,2 @@
1
+ /** One-to-many: this model's primary key appears as foreignKey on the related model. */
2
+ export declare function HasMany(related: () => any, foreignKey: string, localKey?: string): PropertyDecorator;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HasMany = void 0;
4
+ const metadata_1 = require("./metadata");
5
+ /** One-to-many: this model's primary key appears as foreignKey on the related model. */
6
+ function HasMany(related, foreignKey, localKey = 'id') {
7
+ return (target, propertyKey) => {
8
+ const m = (0, metadata_1.getOrCreate)(target);
9
+ m.relationships.push({
10
+ name: String(propertyKey),
11
+ relationship: { type: 'hasMany', related, foreignKey, localKey }
12
+ });
13
+ };
14
+ }
15
+ exports.HasMany = HasMany;
16
+ //# sourceMappingURL=HasMany.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HasMany.js","sourceRoot":"","sources":["../../../src/entities/decorators/HasMany.ts"],"names":[],"mappings":";;;AAAA,yCAAwC;AAExC,wFAAwF;AACxF,SAAgB,OAAO,CAAC,OAAkB,EAAE,UAAkB,EAAE,QAAQ,GAAG,IAAI;IAC7E,OAAO,CAAC,MAAM,EAAE,WAAW,EAAE,EAAE;QAC7B,MAAM,CAAC,GAAG,IAAA,sBAAW,EAAC,MAAgB,CAAC,CAAA;QAEvC,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC;YACnB,IAAI,EAAE,MAAM,CAAC,WAAW,CAAC;YACzB,YAAY,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE;SACjE,CAAC,CAAA;IACJ,CAAC,CAAA;AACH,CAAC;AATD,0BASC"}
@@ -0,0 +1,2 @@
1
+ /** Has-many through an intermediate model. */
2
+ export declare function HasManyThrough(related: () => any, through: () => any, foreignKey: string, throughForeignKey: string, localKey?: string, throughLocalKey?: string): PropertyDecorator;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HasManyThrough = void 0;
4
+ const metadata_1 = require("./metadata");
5
+ /** Has-many through an intermediate model. */
6
+ function HasManyThrough(related, through, foreignKey, throughForeignKey, localKey = 'id', throughLocalKey = 'id') {
7
+ return (target, propertyKey) => {
8
+ const m = (0, metadata_1.getOrCreate)(target);
9
+ m.relationships.push({
10
+ name: String(propertyKey),
11
+ relationship: {
12
+ type: 'hasManyThrough',
13
+ related,
14
+ through,
15
+ foreignKey,
16
+ throughForeignKey,
17
+ localKey,
18
+ throughLocalKey
19
+ }
20
+ });
21
+ };
22
+ }
23
+ exports.HasManyThrough = HasManyThrough;
24
+ //# sourceMappingURL=HasManyThrough.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HasManyThrough.js","sourceRoot":"","sources":["../../../src/entities/decorators/HasManyThrough.ts"],"names":[],"mappings":";;;AAAA,yCAAwC;AAExC,8CAA8C;AAC9C,SAAgB,cAAc,CAC5B,OAAkB,EAClB,OAAkB,EAClB,UAAkB,EAClB,iBAAyB,EACzB,QAAQ,GAAG,IAAI,EACf,eAAe,GAAG,IAAI;IAEtB,OAAO,CAAC,MAAM,EAAE,WAAW,EAAE,EAAE;QAC7B,MAAM,CAAC,GAAG,IAAA,sBAAW,EAAC,MAAgB,CAAC,CAAA;QAEvC,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC;YACnB,IAAI,EAAE,MAAM,CAAC,WAAW,CAAC;YACzB,YAAY,EAAE;gBACZ,IAAI,EAAE,gBAAgB;gBACtB,OAAO;gBACP,OAAO;gBACP,UAAU;gBACV,iBAAiB;gBACjB,QAAQ;gBACR,eAAe;aAChB;SACF,CAAC,CAAA;IACJ,CAAC,CAAA;AACH,CAAC;AAxBD,wCAwBC"}
@@ -0,0 +1,2 @@
1
+ /** One-to-one: this model's primary key appears as foreignKey on the related model. */
2
+ export declare function HasOne(related: () => any, foreignKey: string, localKey?: string): PropertyDecorator;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HasOne = void 0;
4
+ const metadata_1 = require("./metadata");
5
+ /** One-to-one: this model's primary key appears as foreignKey on the related model. */
6
+ function HasOne(related, foreignKey, localKey = 'id') {
7
+ return (target, propertyKey) => {
8
+ const m = (0, metadata_1.getOrCreate)(target);
9
+ m.relationships.push({ name: String(propertyKey), relationship: { type: 'hasOne', related, foreignKey, localKey } });
10
+ };
11
+ }
12
+ exports.HasOne = HasOne;
13
+ //# sourceMappingURL=HasOne.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HasOne.js","sourceRoot":"","sources":["../../../src/entities/decorators/HasOne.ts"],"names":[],"mappings":";;;AAAA,yCAAwC;AAExC,uFAAuF;AACvF,SAAgB,MAAM,CAAC,OAAkB,EAAE,UAAkB,EAAE,QAAQ,GAAG,IAAI;IAC5E,OAAO,CAAC,MAAM,EAAE,WAAW,EAAE,EAAE;QAC7B,MAAM,CAAC,GAAG,IAAA,sBAAW,EAAC,MAAgB,CAAC,CAAA;QAEvC,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,WAAW,CAAC,EAAE,YAAY,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAA;IACtH,CAAC,CAAA;AACH,CAAC;AAND,wBAMC"}
@@ -0,0 +1,2 @@
1
+ /** Has-one through an intermediate model. */
2
+ export declare function HasOneThrough(related: () => any, through: () => any, foreignKey: string, throughForeignKey: string, localKey?: string, throughLocalKey?: string): PropertyDecorator;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HasOneThrough = void 0;
4
+ const metadata_1 = require("./metadata");
5
+ /** Has-one through an intermediate model. */
6
+ function HasOneThrough(related, through, foreignKey, throughForeignKey, localKey = 'id', throughLocalKey = 'id') {
7
+ return (target, propertyKey) => {
8
+ const m = (0, metadata_1.getOrCreate)(target);
9
+ m.relationships.push({
10
+ name: String(propertyKey),
11
+ relationship: {
12
+ type: 'hasOneThrough',
13
+ related,
14
+ through,
15
+ foreignKey,
16
+ throughForeignKey,
17
+ localKey,
18
+ throughLocalKey
19
+ }
20
+ });
21
+ };
22
+ }
23
+ exports.HasOneThrough = HasOneThrough;
24
+ //# sourceMappingURL=HasOneThrough.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HasOneThrough.js","sourceRoot":"","sources":["../../../src/entities/decorators/HasOneThrough.ts"],"names":[],"mappings":";;;AAAA,yCAAwC;AAExC,6CAA6C;AAC7C,SAAgB,aAAa,CAC3B,OAAkB,EAClB,OAAkB,EAClB,UAAkB,EAClB,iBAAyB,EACzB,QAAQ,GAAG,IAAI,EACf,eAAe,GAAG,IAAI;IAEtB,OAAO,CAAC,MAAM,EAAE,WAAW,EAAE,EAAE;QAC7B,MAAM,CAAC,GAAG,IAAA,sBAAW,EAAC,MAAgB,CAAC,CAAA;QAEvC,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC;YACnB,IAAI,EAAE,MAAM,CAAC,WAAW,CAAC;YACzB,YAAY,EAAE;gBACZ,IAAI,EAAE,eAAe;gBACrB,OAAO;gBACP,OAAO;gBACP,UAAU;gBACV,iBAAiB;gBACjB,QAAQ;gBACR,eAAe;aAChB;SACF,CAAC,CAAA;IACJ,CAAC,CAAA;AACH,CAAC;AAxBD,sCAwBC"}
@@ -0,0 +1,3 @@
1
+ import { CastType } from '../CastType';
2
+ export declare function applyCast(value: any, type: CastType): any;
3
+ export declare function applyCastForStorage(value: any, type: CastType): any;
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.applyCastForStorage = exports.applyCast = void 0;
4
+ // ── Cast helpers ──────────────────────────────────────────────────────────────
5
+ function applyCast(value, type) {
6
+ if (value == null) {
7
+ return null;
8
+ }
9
+ switch (type) {
10
+ case 'number':
11
+ return Number(value);
12
+ case 'boolean':
13
+ return value === true || value === 1 || value === '1' || value === 'true';
14
+ case 'string':
15
+ return String(value);
16
+ case 'json':
17
+ return typeof value === 'string' ? JSON.parse(value) : value;
18
+ case 'date':
19
+ return value instanceof Date ? value : new Date(value);
20
+ }
21
+ }
22
+ exports.applyCast = applyCast;
23
+ function applyCastForStorage(value, type) {
24
+ if (value == null) {
25
+ return null;
26
+ }
27
+ switch (type) {
28
+ case 'boolean':
29
+ return value ? 1 : 0;
30
+ case 'json':
31
+ return typeof value === 'string' ? value : JSON.stringify(value);
32
+ case 'date':
33
+ return value instanceof Date ? value.toISOString() : value;
34
+ default:
35
+ return value;
36
+ }
37
+ }
38
+ exports.applyCastForStorage = applyCastForStorage;
39
+ //# sourceMappingURL=casts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"casts.js","sourceRoot":"","sources":["../../../src/entities/decorators/casts.ts"],"names":[],"mappings":";;;AAEA,iFAAiF;AAEjF,SAAgB,SAAS,CAAC,KAAU,EAAE,IAAc;IAClD,IAAI,KAAK,IAAI,IAAI,EAAE;QACjB,OAAO,IAAI,CAAA;KACZ;IAED,QAAQ,IAAI,EAAE;QACZ,KAAK,QAAQ;YACX,OAAO,MAAM,CAAC,KAAK,CAAC,CAAA;QACtB,KAAK,SAAS;YACZ,OAAO,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,CAAC,IAAI,KAAK,KAAK,GAAG,IAAI,KAAK,KAAK,MAAM,CAAA;QAC3E,KAAK,QAAQ;YACX,OAAO,MAAM,CAAC,KAAK,CAAC,CAAA;QACtB,KAAK,MAAM;YACT,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAA;QAC9D,KAAK,MAAM;YACT,OAAO,KAAK,YAAY,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,CAAA;KACzD;AACH,CAAC;AAjBD,8BAiBC;AAED,SAAgB,mBAAmB,CAAC,KAAU,EAAE,IAAc;IAC5D,IAAI,KAAK,IAAI,IAAI,EAAE;QACjB,OAAO,IAAI,CAAA;KACZ;IAED,QAAQ,IAAI,EAAE;QACZ,KAAK,SAAS;YACZ,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;QACtB,KAAK,MAAM;YACT,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;QAClE,KAAK,MAAM;YACT,OAAO,KAAK,YAAY,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,KAAK,CAAA;QAC5D;YACE,OAAO,KAAK,CAAA;KACf;AACH,CAAC;AAfD,kDAeC"}
@@ -0,0 +1,7 @@
1
+ export * from './BelongsTo';
2
+ export * from './Column';
3
+ export * from './Entity';
4
+ export * from './HasMany';
5
+ export * from './HasManyThrough';
6
+ export * from './HasOne';
7
+ export * from './HasOneThrough';
@@ -0,0 +1,24 @@
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
+ __exportStar(require("./BelongsTo"), exports);
18
+ __exportStar(require("./Column"), exports);
19
+ __exportStar(require("./Entity"), exports);
20
+ __exportStar(require("./HasMany"), exports);
21
+ __exportStar(require("./HasManyThrough"), exports);
22
+ __exportStar(require("./HasOne"), exports);
23
+ __exportStar(require("./HasOneThrough"), exports);
24
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/entities/decorators/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA2B;AAC3B,2CAAwB;AACxB,2CAAwB;AACxB,4CAAyB;AACzB,mDAAgC;AAChC,2CAAwB;AACxB,kDAA+B"}
@@ -0,0 +1,19 @@
1
+ import { CastType } from '../CastType';
2
+ import { Relationship } from '../Relationship';
3
+ export interface ColumnMeta {
4
+ name: string;
5
+ columnName?: string;
6
+ cast?: CastType;
7
+ primaryKey?: boolean;
8
+ autoGenerated?: boolean;
9
+ }
10
+ export interface RelationshipMeta {
11
+ name: string;
12
+ relationship: Relationship;
13
+ }
14
+ export interface PrototypeMeta {
15
+ columns: ColumnMeta[];
16
+ relationships: RelationshipMeta[];
17
+ }
18
+ export declare const registry: WeakMap<object, PrototypeMeta>;
19
+ export declare function getOrCreate(proto: object): PrototypeMeta;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getOrCreate = exports.registry = void 0;
4
+ exports.registry = new WeakMap();
5
+ function getOrCreate(proto) {
6
+ if (!exports.registry.has(proto)) {
7
+ exports.registry.set(proto, { columns: [], relationships: [] });
8
+ }
9
+ return exports.registry.get(proto);
10
+ }
11
+ exports.getOrCreate = getOrCreate;
12
+ //# sourceMappingURL=metadata.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metadata.js","sourceRoot":"","sources":["../../../src/entities/decorators/metadata.ts"],"names":[],"mappings":";;;AAyBa,QAAA,QAAQ,GAAG,IAAI,OAAO,EAAyB,CAAA;AAE5D,SAAgB,WAAW,CAAC,KAAa;IACvC,IAAI,CAAC,gBAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;QACxB,gBAAQ,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,aAAa,EAAE,EAAE,EAAE,CAAC,CAAA;KACxD;IAED,OAAO,gBAAQ,CAAC,GAAG,CAAC,KAAK,CAAE,CAAA;AAC7B,CAAC;AAND,kCAMC"}
@@ -1,4 +1,6 @@
1
- export * from './relationship';
2
- export * from './entity-query';
3
- export type { CastType } from './entity';
1
+ export * from './CastType';
4
2
  export * from './decorators';
3
+ export * from './Entities';
4
+ export * from './EntityQuery';
5
+ export * from './Relationship';
6
+ export * from './RelationshipType';
@@ -14,7 +14,10 @@ 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("./relationship"), exports);
18
- __exportStar(require("./entity-query"), exports);
17
+ __exportStar(require("./CastType"), exports);
19
18
  __exportStar(require("./decorators"), exports);
19
+ __exportStar(require("./Entities"), exports);
20
+ __exportStar(require("./EntityQuery"), exports);
21
+ __exportStar(require("./Relationship"), exports);
22
+ __exportStar(require("./RelationshipType"), exports);
20
23
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/entities/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA8B;AAC9B,iDAA8B;AAE9B,+CAA4B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/entities/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA0B;AAC1B,+CAA4B;AAC5B,6CAA0B;AAC1B,gDAA6B;AAC7B,iDAA8B;AAC9B,qDAAkC"}
@@ -1,4 +1,4 @@
1
- export type RelationshipType = 'hasOne' | 'hasMany' | 'belongsTo' | 'hasOneThrough' | 'hasManyThrough';
1
+ import { RelationshipType } from './RelationshipType';
2
2
  export interface Relationship {
3
3
  type: RelationshipType;
4
4
  related: () => any;
@@ -8,8 +8,3 @@ export interface Relationship {
8
8
  throughForeignKey?: string;
9
9
  throughLocalKey?: string;
10
10
  }
11
- export declare function hasOne(related: () => any, foreignKey: string, localKey?: string): Relationship;
12
- export declare function hasMany(related: () => any, foreignKey: string, localKey?: string): Relationship;
13
- export declare function belongsTo(related: () => any, foreignKey: string, localKey?: string): Relationship;
14
- export declare function hasOneThrough(related: () => any, through: () => any, foreignKey: string, throughForeignKey: string, localKey?: string, throughLocalKey?: string): Relationship;
15
- export declare function hasManyThrough(related: () => any, through: () => any, foreignKey: string, throughForeignKey: string, localKey?: string, throughLocalKey?: string): Relationship;
@@ -1,24 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.hasManyThrough = exports.hasOneThrough = exports.belongsTo = exports.hasMany = exports.hasOne = void 0;
4
- function hasOne(related, foreignKey, localKey = 'id') {
5
- return { type: 'hasOne', related, foreignKey, localKey };
6
- }
7
- exports.hasOne = hasOne;
8
- function hasMany(related, foreignKey, localKey = 'id') {
9
- return { type: 'hasMany', related, foreignKey, localKey };
10
- }
11
- exports.hasMany = hasMany;
12
- function belongsTo(related, foreignKey, localKey = 'id') {
13
- return { type: 'belongsTo', related, foreignKey, localKey };
14
- }
15
- exports.belongsTo = belongsTo;
16
- function hasOneThrough(related, through, foreignKey, throughForeignKey, localKey = 'id', throughLocalKey = 'id') {
17
- return { type: 'hasOneThrough', related, through, foreignKey, localKey, throughForeignKey, throughLocalKey };
18
- }
19
- exports.hasOneThrough = hasOneThrough;
20
- function hasManyThrough(related, through, foreignKey, throughForeignKey, localKey = 'id', throughLocalKey = 'id') {
21
- return { type: 'hasManyThrough', related, through, foreignKey, localKey, throughForeignKey, throughLocalKey };
22
- }
23
- exports.hasManyThrough = hasManyThrough;
24
- //# sourceMappingURL=relationship.js.map
3
+ //# sourceMappingURL=Relationship.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"relationship.js","sourceRoot":"","sources":["../../src/entities/relationship.ts"],"names":[],"mappings":";;;AAYA,SAAgB,MAAM,CAAC,OAAkB,EAAE,UAAkB,EAAE,WAAmB,IAAI;IACpF,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAA;AAC1D,CAAC;AAFD,wBAEC;AAED,SAAgB,OAAO,CAAC,OAAkB,EAAE,UAAkB,EAAE,WAAmB,IAAI;IACrF,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAA;AAC3D,CAAC;AAFD,0BAEC;AAED,SAAgB,SAAS,CAAC,OAAkB,EAAE,UAAkB,EAAE,WAAmB,IAAI;IACvF,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAA;AAC7D,CAAC;AAFD,8BAEC;AAED,SAAgB,aAAa,CAC3B,OAAkB,EAClB,OAAkB,EAClB,UAAkB,EAClB,iBAAyB,EACzB,WAAmB,IAAI,EACvB,kBAA0B,IAAI;IAE9B,OAAO,EAAE,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,iBAAiB,EAAE,eAAe,EAAE,CAAA;AAC9G,CAAC;AATD,sCASC;AAED,SAAgB,cAAc,CAC5B,OAAkB,EAClB,OAAkB,EAClB,UAAkB,EAClB,iBAAyB,EACzB,WAAmB,IAAI,EACvB,kBAA0B,IAAI;IAE9B,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,iBAAiB,EAAE,eAAe,EAAE,CAAA;AAC/G,CAAC;AATD,wCASC"}
1
+ {"version":3,"file":"Relationship.js","sourceRoot":"","sources":["../../src/entities/Relationship.ts"],"names":[],"mappings":""}
package/dist/index.d.ts CHANGED
@@ -1,10 +1,3 @@
1
- export * from './connection';
2
- export * from './data-set';
3
- export * from './data-source';
4
- export * from './data-table';
5
- export * from './db';
6
- export * from './query';
1
+ export * from './database';
7
2
  export * from './entities';
8
- export * from './sources/postgres';
9
- export * from './sources/sqlite';
10
- export * from './sources/mysql';
3
+ export * from './query';
package/dist/index.js CHANGED
@@ -14,19 +14,7 @@ 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("./connection"), exports);
18
- __exportStar(require("./data-set"), exports);
19
- __exportStar(require("./data-source"), exports);
20
- __exportStar(require("./data-table"), exports);
21
- __exportStar(require("./db"), exports);
22
- //Queries
23
- __exportStar(require("./query"), exports);
24
- //Entities
17
+ __exportStar(require("./database"), exports);
25
18
  __exportStar(require("./entities"), exports);
26
- //Postgres
27
- __exportStar(require("./sources/postgres"), exports);
28
- //Sqlite
29
- __exportStar(require("./sources/sqlite"), exports);
30
- //MySQL
31
- __exportStar(require("./sources/mysql"), exports);
19
+ __exportStar(require("./query"), exports);
32
20
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA4B;AAC5B,6CAA0B;AAC1B,gDAA6B;AAC7B,+CAA4B;AAC5B,uCAAoB;AACpB,SAAS;AACT,0CAAuB;AACvB,UAAU;AACV,6CAA0B;AAC1B,UAAU;AACV,qDAAkC;AAClC,QAAQ;AACR,mDAAgC;AAChC,OAAO;AACP,kDAA+B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA0B;AAC1B,6CAA0B;AAC1B,0CAAuB"}
@@ -0,0 +1,8 @@
1
+ import { HasTable, HasWhereConditions } from './features';
2
+ import { Query } from './Query';
3
+ import { QueryTable } from './QueryTable';
4
+ export declare class DeleteQuery extends Query {
5
+ constructor(table?: QueryTable);
6
+ }
7
+ export interface DeleteQuery extends HasTable<DeleteQuery>, HasWhereConditions<DeleteQuery> {
8
+ }
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DeleteQuery = void 0;
4
+ const utilities_1 = require("../utilities");
5
+ const features_1 = require("./features");
6
+ const Query_1 = require("./Query");
7
+ class DeleteQuery extends Query_1.Query {
8
+ constructor(table) {
9
+ super();
10
+ if (table) {
11
+ this.setTable(table);
12
+ }
13
+ }
14
+ }
15
+ exports.DeleteQuery = DeleteQuery;
16
+ (0, utilities_1.applyMixins)(DeleteQuery, [features_1.HasTable, features_1.HasWhereConditions]);
17
+ //# sourceMappingURL=DeleteQuery.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DeleteQuery.js","sourceRoot":"","sources":["../../src/query/DeleteQuery.ts"],"names":[],"mappings":";;;AAAA,4CAA0C;AAC1C,yCAAyD;AACzD,mCAA+B;AAG/B,MAAa,WAAY,SAAQ,aAAK;IACpC,YAAY,KAAkB;QAC5B,KAAK,EAAE,CAAA;QAEP,IAAI,KAAK,EAAE;YACT,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;SACrB;IACH,CAAC;CACF;AARD,kCAQC;AAGD,IAAA,uBAAW,EAAC,WAAW,EAAE,CAAC,mBAAQ,EAAE,6BAAkB,CAAC,CAAC,CAAA"}
@@ -0,0 +1,8 @@
1
+ import { HasFieldValues, HasTable } from './features';
2
+ import { Query } from './Query';
3
+ import { QueryTable } from './QueryTable';
4
+ export declare class InsertQuery extends Query {
5
+ constructor(table?: QueryTable);
6
+ }
7
+ export interface InsertQuery extends HasTable<InsertQuery>, HasFieldValues<InsertQuery> {
8
+ }
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.InsertQuery = void 0;
4
+ const utilities_1 = require("../utilities");
5
+ const features_1 = require("./features");
6
+ const Query_1 = require("./Query");
7
+ class InsertQuery extends Query_1.Query {
8
+ constructor(table) {
9
+ super();
10
+ if (table) {
11
+ this.setTable(table);
12
+ }
13
+ }
14
+ }
15
+ exports.InsertQuery = InsertQuery;
16
+ (0, utilities_1.applyMixins)(InsertQuery, [features_1.HasTable, features_1.HasFieldValues]);
17
+ //# sourceMappingURL=InsertQuery.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InsertQuery.js","sourceRoot":"","sources":["../../src/query/InsertQuery.ts"],"names":[],"mappings":";;;AAAA,4CAA0C;AAC1C,yCAAqD;AACrD,mCAA+B;AAG/B,MAAa,WAAY,SAAQ,aAAK;IACpC,YAAY,KAAkB;QAC5B,KAAK,EAAE,CAAA;QAEP,IAAI,KAAK,EAAE;YACT,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;SACrB;IACH,CAAC;CACF;AARD,kCAQC;AAGD,IAAA,uBAAW,EAAC,WAAW,EAAE,CAAC,mBAAQ,EAAE,yBAAc,CAAC,CAAC,CAAA"}