forge-sql-orm 1.0.31 → 1.1.31

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 (37) hide show
  1. package/README.md +216 -695
  2. package/dist/ForgeSQLORM.js +538 -567
  3. package/dist/ForgeSQLORM.js.map +1 -1
  4. package/dist/ForgeSQLORM.mjs +536 -554
  5. package/dist/ForgeSQLORM.mjs.map +1 -1
  6. package/dist/core/ForgeSQLCrudOperations.d.ts +101 -130
  7. package/dist/core/ForgeSQLCrudOperations.d.ts.map +1 -1
  8. package/dist/core/ForgeSQLORM.d.ts +11 -10
  9. package/dist/core/ForgeSQLORM.d.ts.map +1 -1
  10. package/dist/core/ForgeSQLQueryBuilder.d.ts +271 -113
  11. package/dist/core/ForgeSQLQueryBuilder.d.ts.map +1 -1
  12. package/dist/core/ForgeSQLSelectOperations.d.ts +65 -22
  13. package/dist/core/ForgeSQLSelectOperations.d.ts.map +1 -1
  14. package/dist/core/SystemTables.d.ts +59 -0
  15. package/dist/core/SystemTables.d.ts.map +1 -0
  16. package/dist/index.d.ts +1 -2
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/utils/sqlUtils.d.ts +53 -6
  19. package/dist/utils/sqlUtils.d.ts.map +1 -1
  20. package/dist-cli/cli.js +471 -397
  21. package/dist-cli/cli.js.map +1 -1
  22. package/dist-cli/cli.mjs +471 -397
  23. package/dist-cli/cli.mjs.map +1 -1
  24. package/package.json +21 -22
  25. package/src/core/ForgeSQLCrudOperations.ts +360 -473
  26. package/src/core/ForgeSQLORM.ts +38 -79
  27. package/src/core/ForgeSQLQueryBuilder.ts +250 -133
  28. package/src/core/ForgeSQLSelectOperations.ts +182 -72
  29. package/src/core/SystemTables.ts +7 -0
  30. package/src/index.ts +1 -2
  31. package/src/utils/sqlUtils.ts +155 -23
  32. package/dist/core/ComplexQuerySchemaBuilder.d.ts +0 -38
  33. package/dist/core/ComplexQuerySchemaBuilder.d.ts.map +0 -1
  34. package/dist/knex/index.d.ts +0 -4
  35. package/dist/knex/index.d.ts.map +0 -1
  36. package/src/core/ComplexQuerySchemaBuilder.ts +0 -63
  37. package/src/knex/index.ts +0 -4
package/dist/index.d.ts CHANGED
@@ -2,7 +2,6 @@ import ForgeSQLORM from "./core/ForgeSQLORM";
2
2
  export * from "./core/ForgeSQLQueryBuilder";
3
3
  export * from "./core/ForgeSQLCrudOperations";
4
4
  export * from "./core/ForgeSQLSelectOperations";
5
- export * from "@mikro-orm/mysql";
6
- export * from "@mikro-orm/entity-generator";
5
+ export * from "./utils/sqlUtils";
7
6
  export default ForgeSQLORM;
8
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,oBAAoB,CAAC;AAE7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC;AAChD,cAAc,kBAAkB,CAAC;AACjC,cAAc,6BAA6B,CAAC;AAE5C,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,oBAAoB,CAAC;AAE7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC;AAChD,cAAc,kBAAkB,CAAC;AAEjC,eAAe,WAAW,CAAC"}
@@ -1,8 +1,55 @@
1
- import { AnyString } from "@mikro-orm/core/typings";
2
- import { types } from "..";
3
- export declare const transformValue: <U>(value: {
4
- type: keyof typeof types | AnyString;
5
- value: U;
6
- }, wrapValue?: boolean) => U;
1
+ import { AnyColumn } from "drizzle-orm";
2
+ import { AnyMySqlTable } from "drizzle-orm/mysql-core/index";
3
+ import { PrimaryKeyBuilder } from "drizzle-orm/mysql-core/primary-keys";
4
+ import { AnyIndexBuilder } from "drizzle-orm/mysql-core/indexes";
5
+ import { CheckBuilder } from "drizzle-orm/mysql-core/checks";
6
+ import { ForeignKeyBuilder } from "drizzle-orm/mysql-core/foreign-keys";
7
+ import { UniqueConstraintBuilder } from "drizzle-orm/mysql-core/unique-constraint";
8
+ /**
9
+ * Interface representing table metadata information
10
+ */
11
+ export interface MetadataInfo {
12
+ /** The name of the table */
13
+ tableName: string;
14
+ /** Record of column names and their corresponding column definitions */
15
+ columns: Record<string, AnyColumn>;
16
+ /** Array of index builders */
17
+ indexes: AnyIndexBuilder[];
18
+ /** Array of check constraint builders */
19
+ checks: CheckBuilder[];
20
+ /** Array of foreign key builders */
21
+ foreignKeys: ForeignKeyBuilder[];
22
+ /** Array of primary key builders */
23
+ primaryKeys: PrimaryKeyBuilder[];
24
+ /** Array of unique constraint builders */
25
+ uniqueConstraints: UniqueConstraintBuilder[];
26
+ /** Array of all extra builders */
27
+ extras: any[];
28
+ }
29
+ /**
30
+ * Parses a date string into a Date object using the specified format
31
+ * @param value - The date string to parse
32
+ * @param format - The format to use for parsing
33
+ * @returns Date object
34
+ */
7
35
  export declare const parseDateTime: (value: string, format: string) => Date;
36
+ /**
37
+ * Extracts the alias from a SQL query
38
+ * @param query - The SQL query to extract the alias from
39
+ * @returns The extracted alias or the original query if no alias found
40
+ */
41
+ export declare function extractAlias(query: string): string;
42
+ /**
43
+ * Gets primary keys from the schema.
44
+ * @template T - The type of the table schema
45
+ * @param {T} table - The table schema
46
+ * @returns {[string, AnyColumn][] | undefined} Array of primary key name and column pairs or undefined if no primary keys found
47
+ */
48
+ export declare function getPrimaryKeys<T extends AnyMySqlTable>(table: T): [string, AnyColumn][] | undefined;
49
+ /**
50
+ * Extracts table metadata from the schema.
51
+ * @param {AnyMySqlTable} table - The table schema
52
+ * @returns {MetadataInfo} Object containing table metadata
53
+ */
54
+ export declare function getTableMetadata(table: AnyMySqlTable): MetadataInfo;
8
55
  //# sourceMappingURL=sqlUtils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sqlUtils.d.ts","sourceRoot":"","sources":["../../src/utils/sqlUtils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAC,KAAK,EAAC,MAAM,IAAI,CAAC;AAMzB,eAAO,MAAM,cAAc,GAAI,CAAC,EAAE,OAAO;IACvC,IAAI,EAAE,MAAM,OAAO,KAAK,GAAG,SAAS,CAAC;IACrC,KAAK,EAAE,CAAC,CAAC;CACV,EAAE,YAAW,OAAe,KAAG,CAc/B,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,OAAO,MAAM,EAAE,QAAQ,MAAM,KAAG,IAM7D,CAAC"}
1
+ {"version":3,"file":"sqlUtils.d.ts","sourceRoot":"","sources":["../../src/utils/sqlUtils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAAE,eAAe,EAAgB,MAAM,gCAAgC,CAAC;AAC/E,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAC;AAEnF;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,4BAA4B;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,wEAAwE;IACxE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IACnC,8BAA8B;IAC9B,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,yCAAyC;IACzC,MAAM,EAAE,YAAY,EAAE,CAAC;IACvB,oCAAoC;IACpC,WAAW,EAAE,iBAAiB,EAAE,CAAC;IACjC,oCAAoC;IACpC,WAAW,EAAE,iBAAiB,EAAE,CAAC;IACjC,0CAA0C;IAC1C,iBAAiB,EAAE,uBAAuB,EAAE,CAAC;IAC7C,kCAAkC;IAClC,MAAM,EAAE,GAAG,EAAE,CAAC;CACf;AAED;;;;;GAKG;AACH,eAAO,MAAM,aAAa,GAAI,OAAO,MAAM,EAAE,QAAQ,MAAM,KAAG,IAM7D,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAGlD;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,aAAa,EACpD,KAAK,EAAE,CAAC,GACP,CAAC,MAAM,EAAE,SAAS,CAAC,EAAE,GAAG,SAAS,CAmCnC;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,aAAa,GAAG,YAAY,CA4DnE"}