@ignisia/sql 0.2.0 → 0.2.1

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 (46) hide show
  1. package/dist/column/constants.js +97 -8
  2. package/dist/column/index.js +105 -8
  3. package/dist/column/types.js +1 -2
  4. package/dist/database/alter.js +87 -15
  5. package/dist/database/column.js +33 -11
  6. package/dist/database/contract.js +1 -0
  7. package/dist/database/index.js +92 -19
  8. package/dist/database/table.js +37 -19
  9. package/dist/database/types.js +1 -0
  10. package/dist/database/wrapper.js +92 -9
  11. package/dist/index.js +5 -32
  12. package/dist/migration/index.js +48 -6
  13. package/dist/migration/runner.js +7 -20
  14. package/dist/migration/type.js +1 -0
  15. package/dist/query/builder.js +66 -16
  16. package/dist/query/condition.js +97 -24
  17. package/dist/query/constants.js +54 -19
  18. package/dist/query/contract.js +1 -0
  19. package/dist/query/helper.js +30 -18
  20. package/dist/query/index.js +195 -10
  21. package/dist/query/join.js +16 -6
  22. package/dist/query/sql.js +99 -16
  23. package/dist/query/types.js +1 -0
  24. package/dist/query/utilities.js +175 -24
  25. package/dist/table/constants.js +5 -5
  26. package/dist/table/index.js +52 -14
  27. package/dist/table/types.js +1 -0
  28. package/dist/table/utilities.js +50 -15
  29. package/dist/types.js +1 -0
  30. package/dist/utilities.js +18 -8
  31. package/package.json +37 -2
  32. package/dist/chunk-62FKD35V.js +0 -65
  33. package/dist/chunk-CIWX3UCZ.js +0 -51
  34. package/dist/chunk-EIUC7HJS.js +0 -686
  35. package/dist/chunk-FYSNJAGD.js +0 -19
  36. package/dist/chunk-G3LSCLIQ.js +0 -104
  37. package/dist/chunk-GLOHF5CP.js +0 -9
  38. package/dist/chunk-GY7R637S.js +0 -113
  39. package/dist/chunk-HKTHKQLK.js +0 -98
  40. package/dist/chunk-JF7OSNH4.js +0 -40
  41. package/dist/chunk-KVCIOW7L.js +0 -59
  42. package/dist/chunk-OYM2PNYZ.js +0 -44
  43. package/dist/chunk-UI7U54OT.js +0 -112
  44. package/dist/chunk-V4OMHVJN.js +0 -96
  45. package/dist/chunk-WVJGTZFI.js +0 -60
  46. package/dist/chunk-Y7FSRHH3.js +0 -22
@@ -1,60 +0,0 @@
1
- import {
2
- Column
3
- } from "./chunk-GY7R637S.js";
4
-
5
- // src/table/utilities.ts
6
- var createdAt = Column.define({
7
- type: "DATETIME"
8
- }).default("CURRENT_TIMESTAMP");
9
- var updatedAt = Column.define({
10
- type: "DATETIME"
11
- });
12
- var deletedAt = Column.define({
13
- type: "DATETIME"
14
- });
15
- function defineColumns(options) {
16
- const columns = {
17
- ...options.columns
18
- };
19
- const tracker = {
20
- createdAt: "createdAt",
21
- updatedAt: "updatedAt",
22
- deletedAt: "deletedAt"
23
- };
24
- if (options.timestamp) {
25
- const timestamp = {
26
- createdAt: "createdAt",
27
- updatedAt: "updatedAt"
28
- };
29
- if (typeof options.timestamp === "object") {
30
- if (typeof options.timestamp.createdAt === "string") {
31
- timestamp.createdAt = options.timestamp.createdAt;
32
- }
33
- if (typeof options.timestamp.updatedAt === "string") {
34
- timestamp.updatedAt = options.timestamp.updatedAt;
35
- }
36
- }
37
- if (!columns[timestamp.createdAt]) {
38
- columns[timestamp.createdAt] = createdAt;
39
- }
40
- if (!columns[timestamp.updatedAt]) {
41
- columns[timestamp.updatedAt] = updatedAt;
42
- }
43
- }
44
- if (options.paranoid) {
45
- if (typeof options.paranoid !== "boolean") {
46
- tracker.deletedAt = options.paranoid;
47
- }
48
- if (!columns[tracker.deletedAt]) {
49
- columns[tracker.deletedAt] = deletedAt;
50
- }
51
- }
52
- return columns;
53
- }
54
-
55
- export {
56
- createdAt,
57
- updatedAt,
58
- deletedAt,
59
- defineColumns
60
- };
@@ -1,22 +0,0 @@
1
- // src/utilities.ts
2
- function deepClone(obj) {
3
- if (Array.isArray(obj)) {
4
- return obj.map((item) => deepClone(item));
5
- }
6
- if (obj && typeof obj === "object") {
7
- const clonedObj = {};
8
- for (const key in obj) {
9
- clonedObj[key] = deepClone(obj[key]);
10
- }
11
- return clonedObj;
12
- }
13
- return obj;
14
- }
15
- function quoteIdentifier(identifier) {
16
- return `"${identifier.replace(/"/g, '""')}"`;
17
- }
18
-
19
- export {
20
- deepClone,
21
- quoteIdentifier
22
- };