@ignisia/sql 0.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.
- package/README.md +113 -0
- package/dist/chunk-4DQRB5XS.js +94 -0
- package/dist/chunk-CIWX3UCZ.js +51 -0
- package/dist/chunk-D2ASIT4Q.js +44 -0
- package/dist/chunk-FYSNJAGD.js +19 -0
- package/dist/chunk-G3LSCLIQ.js +104 -0
- package/dist/chunk-GLOHF5CP.js +9 -0
- package/dist/chunk-GY7R637S.js +113 -0
- package/dist/chunk-HKTHKQLK.js +98 -0
- package/dist/chunk-JF7OSNH4.js +40 -0
- package/dist/chunk-MG2S4V4N.js +60 -0
- package/dist/chunk-TQ2GXAE7.js +663 -0
- package/dist/chunk-V4OMHVJN.js +96 -0
- package/dist/chunk-W2DR3ZVK.js +59 -0
- package/dist/chunk-WVJGTZFI.js +60 -0
- package/dist/chunk-Y7FSRHH3.js +22 -0
- package/dist/column/constants.d.ts +97 -0
- package/dist/column/constants.js +9 -0
- package/dist/column/index.d.ts +42 -0
- package/dist/column/index.js +8 -0
- package/dist/column/types.d.ts +43 -0
- package/dist/column/types.js +2 -0
- package/dist/database/alter.d.ts +52 -0
- package/dist/database/alter.js +15 -0
- package/dist/database/column.d.ts +24 -0
- package/dist/database/column.js +11 -0
- package/dist/database/contract.d.ts +8 -0
- package/dist/database/contract.js +0 -0
- package/dist/database/index.d.ts +8 -0
- package/dist/database/index.js +19 -0
- package/dist/database/table.d.ts +21 -0
- package/dist/database/table.js +19 -0
- package/dist/database/types.d.ts +7 -0
- package/dist/database/types.js +0 -0
- package/dist/database/wrapper.d.ts +36 -0
- package/dist/database/wrapper.js +9 -0
- package/dist/index-DJhQVUY3.d.ts +344 -0
- package/dist/index-Dcm5xIpR.d.ts +99 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +32 -0
- package/dist/migration/index.d.ts +30 -0
- package/dist/migration/index.js +6 -0
- package/dist/migration/runner.d.ts +3 -0
- package/dist/migration/runner.js +69 -0
- package/dist/migration/type.d.ts +19 -0
- package/dist/migration/type.js +0 -0
- package/dist/query/builder.d.ts +14 -0
- package/dist/query/builder.js +16 -0
- package/dist/query/condition.d.ts +7 -0
- package/dist/query/condition.js +24 -0
- package/dist/query/constants.d.ts +58 -0
- package/dist/query/constants.js +18 -0
- package/dist/query/contract.d.ts +7 -0
- package/dist/query/contract.js +0 -0
- package/dist/query/helper.d.ts +7 -0
- package/dist/query/helper.js +18 -0
- package/dist/query/index.d.ts +7 -0
- package/dist/query/index.js +10 -0
- package/dist/query/join.d.ts +16 -0
- package/dist/query/join.js +6 -0
- package/dist/query/sql.d.ts +17 -0
- package/dist/query/sql.js +16 -0
- package/dist/query/types.d.ts +7 -0
- package/dist/query/types.js +0 -0
- package/dist/query/utilities.d.ts +34 -0
- package/dist/query/utilities.js +24 -0
- package/dist/table/constants.d.ts +7 -0
- package/dist/table/constants.js +6 -0
- package/dist/table/index.d.ts +7 -0
- package/dist/table/index.js +14 -0
- package/dist/table/types.d.ts +7 -0
- package/dist/table/types.js +0 -0
- package/dist/table/utilities.d.ts +7 -0
- package/dist/table/utilities.js +15 -0
- package/dist/types.d.ts +3 -0
- package/dist/types.js +0 -0
- package/dist/utilities.d.ts +4 -0
- package/dist/utilities.js +8 -0
- package/package.json +20 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Table
|
|
3
|
+
} from "../chunk-W2DR3ZVK.js";
|
|
4
|
+
import "../chunk-TQ2GXAE7.js";
|
|
5
|
+
import "../chunk-MG2S4V4N.js";
|
|
6
|
+
import "../chunk-FYSNJAGD.js";
|
|
7
|
+
import "../chunk-WVJGTZFI.js";
|
|
8
|
+
import {
|
|
9
|
+
Column
|
|
10
|
+
} from "../chunk-GY7R637S.js";
|
|
11
|
+
import "../chunk-G3LSCLIQ.js";
|
|
12
|
+
import "../chunk-Y7FSRHH3.js";
|
|
13
|
+
import "../chunk-GLOHF5CP.js";
|
|
14
|
+
|
|
15
|
+
// src/migration/runner.ts
|
|
16
|
+
var nameColumn = Column.define({
|
|
17
|
+
type: "TEXT",
|
|
18
|
+
length: 255
|
|
19
|
+
}).primaryKey().notNull();
|
|
20
|
+
var runAtColumn = Column.define({
|
|
21
|
+
type: "DATETIME"
|
|
22
|
+
}).notNull();
|
|
23
|
+
var migrationTable = null;
|
|
24
|
+
async function runMigration(filePath, direction) {
|
|
25
|
+
const migrationFile = await import(filePath);
|
|
26
|
+
const fileName = filePath.split("/").pop();
|
|
27
|
+
if (!migrationFile || !migrationFile.migration) {
|
|
28
|
+
throw new Error(
|
|
29
|
+
'Invalid migration file! A migration file must export a migration as "migration"'
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
const { migration } = migrationFile;
|
|
33
|
+
if (!migrationTable) {
|
|
34
|
+
migrationTable = Table.define({
|
|
35
|
+
name: "ignisia_migration",
|
|
36
|
+
columns: {
|
|
37
|
+
name: nameColumn,
|
|
38
|
+
runAt: runAtColumn
|
|
39
|
+
},
|
|
40
|
+
dialect: migration.db.dialect
|
|
41
|
+
});
|
|
42
|
+
migrationTable.database = migration.db.client;
|
|
43
|
+
await migrationTable.create();
|
|
44
|
+
}
|
|
45
|
+
const fn = migration[direction];
|
|
46
|
+
if (!fn)
|
|
47
|
+
throw new Error("No migration function found for direction: " + direction);
|
|
48
|
+
const [lastRun] = await migrationTable.query().select("ignisia_migration.*").limit(1).where('ignisia_migration."name"', "eq", fileName).exec();
|
|
49
|
+
if (lastRun) {
|
|
50
|
+
console.log("Migration already run!");
|
|
51
|
+
console.log("Run At : " + new Date(lastRun.runAt).toDateString());
|
|
52
|
+
console.log("Name : " + fileName);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
const query = migrationTable.query();
|
|
56
|
+
await migration.db.client.transaction(async () => {
|
|
57
|
+
await fn();
|
|
58
|
+
if (direction === "up") {
|
|
59
|
+
return query.insert({
|
|
60
|
+
name: fileName,
|
|
61
|
+
runAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
62
|
+
}).exec();
|
|
63
|
+
}
|
|
64
|
+
return query.delete().where('ignisia_migration."name"', "eq", fileName).exec();
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
export {
|
|
68
|
+
runMigration
|
|
69
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Column } from '../column/index.js';
|
|
2
|
+
import { D as Database } from '../index-Dcm5xIpR.js';
|
|
3
|
+
import { T as Table } from '../index-DJhQVUY3.js';
|
|
4
|
+
import { Dialect } from '../table/constants.js';
|
|
5
|
+
import '../column/constants.js';
|
|
6
|
+
import '../column/types.js';
|
|
7
|
+
import '../types.js';
|
|
8
|
+
import '../query/constants.js';
|
|
9
|
+
|
|
10
|
+
interface MigrationOptions<DbDialect extends Dialect, Tables extends Record<string, Table<string, Record<string, Column>>>> {
|
|
11
|
+
db: Database<DbDialect, Tables>;
|
|
12
|
+
up: (() => Promise<void>) | null;
|
|
13
|
+
down: (() => Promise<void>) | null;
|
|
14
|
+
}
|
|
15
|
+
interface MigrationFn<DbDialect extends Dialect, Tables extends Record<string, Table<string, Record<string, Column>>>> {
|
|
16
|
+
(db: Database<DbDialect, Tables>): Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export type { MigrationFn, MigrationOptions };
|
|
File without changes
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { T as Table, Q as QueryDefinition, C as ColumnSelector, c as StrictColumnSelector, d as QueryBuilder } from '../index-DJhQVUY3.js';
|
|
2
|
+
import { Column } from '../column/index.js';
|
|
3
|
+
import '../column/constants.js';
|
|
4
|
+
import '../types.js';
|
|
5
|
+
import './constants.js';
|
|
6
|
+
import '../table/constants.js';
|
|
7
|
+
import '../column/types.js';
|
|
8
|
+
|
|
9
|
+
declare function buildSelectQuery<Alias extends string, TableRef extends Table<string, Record<string, Column>>, JoinedTables extends Record<string, Table<string, Record<string, Column>>>, Definition extends Partial<QueryDefinition<Alias, TableRef, JoinedTables>>, AllowedColumn extends ColumnSelector<Alias, TableRef, JoinedTables>, StrictAllowedColumn extends StrictColumnSelector<Alias, TableRef, JoinedTables>>(q: QueryBuilder<Alias, TableRef, JoinedTables, Definition, AllowedColumn, StrictAllowedColumn>): string;
|
|
10
|
+
declare function buildInsertQuery<Alias extends string, TableRef extends Table<string, Record<string, Column>>, JoinedTables extends Record<string, Table<string, Record<string, Column>>>, Definition extends Partial<QueryDefinition<Alias, TableRef, JoinedTables>>, AllowedColumn extends ColumnSelector<Alias, TableRef, JoinedTables>, StrictAllowedColumn extends StrictColumnSelector<Alias, TableRef, JoinedTables>>(q: QueryBuilder<Alias, TableRef, JoinedTables, Definition, AllowedColumn, StrictAllowedColumn>): string;
|
|
11
|
+
declare function buildUpdateQuery<Alias extends string, TableRef extends Table<string, Record<string, Column>>, JoinedTables extends Record<string, Table<string, Record<string, Column>>>, Definition extends Partial<QueryDefinition<Alias, TableRef, JoinedTables>>, AllowedColumn extends ColumnSelector<Alias, TableRef, JoinedTables>, StrictAllowedColumn extends StrictColumnSelector<Alias, TableRef, JoinedTables>>(q: QueryBuilder<Alias, TableRef, JoinedTables, Definition, AllowedColumn, StrictAllowedColumn>): string;
|
|
12
|
+
declare function buildDeleteQuery<Alias extends string, TableRef extends Table<string, Record<string, Column>>, JoinedTables extends Record<string, Table<string, Record<string, Column>>>, Definition extends Partial<QueryDefinition<Alias, TableRef, JoinedTables>>, AllowedColumn extends ColumnSelector<Alias, TableRef, JoinedTables>, StrictAllowedColumn extends StrictColumnSelector<Alias, TableRef, JoinedTables>>(q: QueryBuilder<Alias, TableRef, JoinedTables, Definition, AllowedColumn, StrictAllowedColumn>): string;
|
|
13
|
+
|
|
14
|
+
export { buildDeleteQuery, buildInsertQuery, buildSelectQuery, buildUpdateQuery };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {
|
|
2
|
+
buildDeleteQuery,
|
|
3
|
+
buildInsertQuery,
|
|
4
|
+
buildSelectQuery,
|
|
5
|
+
buildUpdateQuery
|
|
6
|
+
} from "../chunk-TQ2GXAE7.js";
|
|
7
|
+
import "../chunk-MG2S4V4N.js";
|
|
8
|
+
import "../chunk-FYSNJAGD.js";
|
|
9
|
+
import "../chunk-Y7FSRHH3.js";
|
|
10
|
+
import "../chunk-GLOHF5CP.js";
|
|
11
|
+
export {
|
|
12
|
+
buildDeleteQuery,
|
|
13
|
+
buildInsertQuery,
|
|
14
|
+
buildSelectQuery,
|
|
15
|
+
buildUpdateQuery
|
|
16
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { E as addCondition, x as addRawCondition, H as having, G as or, B as rawHaving, z as rawOr, y as rawWhere, F as where } from '../index-DJhQVUY3.js';
|
|
2
|
+
import '../column/index.js';
|
|
3
|
+
import './constants.js';
|
|
4
|
+
import '../column/constants.js';
|
|
5
|
+
import '../types.js';
|
|
6
|
+
import '../table/constants.js';
|
|
7
|
+
import '../column/types.js';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import {
|
|
2
|
+
addCondition,
|
|
3
|
+
addRawCondition,
|
|
4
|
+
having,
|
|
5
|
+
or,
|
|
6
|
+
rawHaving,
|
|
7
|
+
rawOr,
|
|
8
|
+
rawWhere,
|
|
9
|
+
where
|
|
10
|
+
} from "../chunk-TQ2GXAE7.js";
|
|
11
|
+
import "../chunk-MG2S4V4N.js";
|
|
12
|
+
import "../chunk-FYSNJAGD.js";
|
|
13
|
+
import "../chunk-Y7FSRHH3.js";
|
|
14
|
+
import "../chunk-GLOHF5CP.js";
|
|
15
|
+
export {
|
|
16
|
+
addCondition,
|
|
17
|
+
addRawCondition,
|
|
18
|
+
having,
|
|
19
|
+
or,
|
|
20
|
+
rawHaving,
|
|
21
|
+
rawOr,
|
|
22
|
+
rawWhere,
|
|
23
|
+
where
|
|
24
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
declare const LogicalOperator: {
|
|
2
|
+
readonly AND: "AND";
|
|
3
|
+
readonly OR: "OR";
|
|
4
|
+
};
|
|
5
|
+
type LogicalOperator = (typeof LogicalOperator)[keyof typeof LogicalOperator];
|
|
6
|
+
declare const ConditionClause: {
|
|
7
|
+
readonly WHERE: "WHERE";
|
|
8
|
+
readonly HAVING: "HAVING";
|
|
9
|
+
};
|
|
10
|
+
type ConditionClause = (typeof ConditionClause)[keyof typeof ConditionClause];
|
|
11
|
+
declare const AcceptedOperator: {
|
|
12
|
+
readonly EQ: "eq";
|
|
13
|
+
readonly NE: "ne";
|
|
14
|
+
readonly GT: "gt";
|
|
15
|
+
readonly LT: "lt";
|
|
16
|
+
readonly GTE: "gte";
|
|
17
|
+
readonly LTE: "lte";
|
|
18
|
+
readonly IN: "in";
|
|
19
|
+
readonly NOT_IN: "notIn";
|
|
20
|
+
readonly LIKE: "like";
|
|
21
|
+
readonly NOT_LIKE: "notLike";
|
|
22
|
+
readonly ILIKE: "ilike";
|
|
23
|
+
readonly NOT_ILIKE: "notILike";
|
|
24
|
+
readonly IS_NULL: "isNull";
|
|
25
|
+
readonly IS_NOT_NULL: "isNotNull";
|
|
26
|
+
readonly BETWEEN: "between";
|
|
27
|
+
readonly NOT_BETWEEN: "notBetween";
|
|
28
|
+
};
|
|
29
|
+
type AcceptedOperator = (typeof AcceptedOperator)[keyof typeof AcceptedOperator];
|
|
30
|
+
declare const QueryType: {
|
|
31
|
+
readonly SELECT: "SELECT";
|
|
32
|
+
readonly INSERT: "INSERT";
|
|
33
|
+
readonly UPDATE: "UPDATE";
|
|
34
|
+
readonly DELETE: "DELETE";
|
|
35
|
+
};
|
|
36
|
+
type QueryType = (typeof QueryType)[keyof typeof QueryType];
|
|
37
|
+
declare const OrderBy: {
|
|
38
|
+
readonly ASC: "ASC";
|
|
39
|
+
readonly DESC: "DESC";
|
|
40
|
+
};
|
|
41
|
+
type OrderBy = (typeof OrderBy)[keyof typeof OrderBy];
|
|
42
|
+
declare const AggregationFunction: {
|
|
43
|
+
readonly COUNT: "COUNT";
|
|
44
|
+
readonly SUM: "SUM";
|
|
45
|
+
readonly MIN: "MIN";
|
|
46
|
+
readonly MAX: "MAX";
|
|
47
|
+
readonly AVG: "AVG";
|
|
48
|
+
};
|
|
49
|
+
type AggregationFunction = (typeof AggregationFunction)[keyof typeof AggregationFunction];
|
|
50
|
+
declare const AcceptedJoin: {
|
|
51
|
+
readonly INNER: "INNER";
|
|
52
|
+
readonly LEFT: "LEFT";
|
|
53
|
+
readonly RIGHT: "RIGHT";
|
|
54
|
+
readonly NATURAL: "NATURAL";
|
|
55
|
+
};
|
|
56
|
+
type AcceptedJoin = (typeof AcceptedJoin)[keyof typeof AcceptedJoin];
|
|
57
|
+
|
|
58
|
+
export { AcceptedJoin, AcceptedOperator, AggregationFunction, ConditionClause, LogicalOperator, OrderBy, QueryType };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AcceptedJoin,
|
|
3
|
+
AcceptedOperator,
|
|
4
|
+
AggregationFunction,
|
|
5
|
+
ConditionClause,
|
|
6
|
+
LogicalOperator,
|
|
7
|
+
OrderBy,
|
|
8
|
+
QueryType
|
|
9
|
+
} from "../chunk-MG2S4V4N.js";
|
|
10
|
+
export {
|
|
11
|
+
AcceptedJoin,
|
|
12
|
+
AcceptedOperator,
|
|
13
|
+
AggregationFunction,
|
|
14
|
+
ConditionClause,
|
|
15
|
+
LogicalOperator,
|
|
16
|
+
OrderBy,
|
|
17
|
+
QueryType
|
|
18
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { J as QueryConditionContract, I as QueryTransformerContract } from '../index-DJhQVUY3.js';
|
|
2
|
+
import '../column/index.js';
|
|
3
|
+
import './constants.js';
|
|
4
|
+
import '../column/constants.js';
|
|
5
|
+
import '../types.js';
|
|
6
|
+
import '../table/constants.js';
|
|
7
|
+
import '../column/types.js';
|
|
File without changes
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { w as aggregateCol, r as alias, s as clone, v as col, t as rawCol } from '../index-DJhQVUY3.js';
|
|
2
|
+
import '../column/index.js';
|
|
3
|
+
import './constants.js';
|
|
4
|
+
import '../column/constants.js';
|
|
5
|
+
import '../types.js';
|
|
6
|
+
import '../table/constants.js';
|
|
7
|
+
import '../column/types.js';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {
|
|
2
|
+
aggregateCol,
|
|
3
|
+
alias,
|
|
4
|
+
clone,
|
|
5
|
+
col,
|
|
6
|
+
rawCol
|
|
7
|
+
} from "../chunk-TQ2GXAE7.js";
|
|
8
|
+
import "../chunk-MG2S4V4N.js";
|
|
9
|
+
import "../chunk-FYSNJAGD.js";
|
|
10
|
+
import "../chunk-Y7FSRHH3.js";
|
|
11
|
+
import "../chunk-GLOHF5CP.js";
|
|
12
|
+
export {
|
|
13
|
+
aggregateCol,
|
|
14
|
+
alias,
|
|
15
|
+
clone,
|
|
16
|
+
col,
|
|
17
|
+
rawCol
|
|
18
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { T as Table, Q as QueryDefinition, C as ColumnSelector, c as StrictColumnSelector, d as QueryBuilder } from '../index-DJhQVUY3.js';
|
|
2
|
+
import { Column } from '../column/index.js';
|
|
3
|
+
import { AcceptedJoin } from './constants.js';
|
|
4
|
+
import '../column/constants.js';
|
|
5
|
+
import '../types.js';
|
|
6
|
+
import '../table/constants.js';
|
|
7
|
+
import '../column/types.js';
|
|
8
|
+
|
|
9
|
+
declare function addJoin<Alias extends string, TableRef extends Table<string, Record<string, Column>>, JoinedTables extends Record<string, Table<string, Record<string, Column>>>, Definition extends Partial<QueryDefinition<Alias, TableRef, JoinedTables>>, AllowedColumn extends ColumnSelector<Alias, TableRef, JoinedTables>, StrictAllowedColumn extends StrictColumnSelector<Alias, TableRef, JoinedTables>, JoinType extends AcceptedJoin, JoinTable extends Table<string, Record<string, Column>>, JoinAlias extends string, BaseColName extends `${Alias}."${keyof TableRef['columns'] & string}"`, JoinColName extends `${JoinAlias}."${keyof JoinTable['columns'] & string}"`, FinalJoinedTables extends JoinedTables & {
|
|
10
|
+
[K in JoinAlias]: JoinTable;
|
|
11
|
+
}>(query: QueryBuilder<Alias, TableRef, JoinedTables, Definition, AllowedColumn, StrictAllowedColumn>, joinType: JoinType, alias: JoinAlias, joinTable: JoinTable, baseColumn: BaseColName, joinColumn: JoinColName): QueryBuilder<Alias, TableRef, FinalJoinedTables, Omit<Definition, "joins" | "joinedTables"> & {
|
|
12
|
+
joins: string[];
|
|
13
|
+
joinedTables: FinalJoinedTables;
|
|
14
|
+
}>;
|
|
15
|
+
|
|
16
|
+
export { addJoin };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { T as Table, Q as QueryDefinition, C as ColumnSelector, c as StrictColumnSelector, d as QueryBuilder } from '../index-DJhQVUY3.js';
|
|
2
|
+
import { Column } from '../column/index.js';
|
|
3
|
+
import '../column/constants.js';
|
|
4
|
+
import '../types.js';
|
|
5
|
+
import './constants.js';
|
|
6
|
+
import '../table/constants.js';
|
|
7
|
+
import '../column/types.js';
|
|
8
|
+
|
|
9
|
+
declare function buildQuery(query: string): string;
|
|
10
|
+
declare function toQuery<Alias extends string, TableRef extends Table<string, Record<string, Column>>, JoinedTables extends Record<string, Table<string, Record<string, Column>>>, Definition extends Partial<QueryDefinition<Alias, TableRef, JoinedTables>>, AllowedColumn extends ColumnSelector<Alias, TableRef, JoinedTables>, StrictAllowedColumn extends StrictColumnSelector<Alias, TableRef, JoinedTables>, Query extends QueryBuilder<Alias, TableRef, JoinedTables, Definition, AllowedColumn, StrictAllowedColumn>>(this: Query): {
|
|
11
|
+
query: string;
|
|
12
|
+
params: unknown[] | null | undefined;
|
|
13
|
+
};
|
|
14
|
+
declare function toString<Alias extends string, TableRef extends Table<string, Record<string, Column>>, JoinedTables extends Record<string, Table<string, Record<string, Column>>>, Definition extends Partial<QueryDefinition<Alias, TableRef, JoinedTables>>, AllowedColumn extends ColumnSelector<Alias, TableRef, JoinedTables>, StrictAllowedColumn extends StrictColumnSelector<Alias, TableRef, JoinedTables>, Query extends QueryBuilder<Alias, TableRef, JoinedTables, Definition, AllowedColumn, StrictAllowedColumn>>(this: Query): string;
|
|
15
|
+
declare function exec<Alias extends string, TableRef extends Table<string, Record<string, Column>>, JoinedTables extends Record<string, Table<string, Record<string, Column>>>, Definition extends Partial<QueryDefinition<Alias, TableRef, JoinedTables>>, AllowedColumn extends ColumnSelector<Alias, TableRef, JoinedTables>, StrictAllowedColumn extends StrictColumnSelector<Alias, TableRef, JoinedTables>, Query extends QueryBuilder<Alias, TableRef, JoinedTables, Definition, AllowedColumn, StrictAllowedColumn>, Output extends Query['_output'] = Query['_output']>(this: Query): Promise<Output>;
|
|
16
|
+
|
|
17
|
+
export { buildQuery, exec, toQuery, toString };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {
|
|
2
|
+
buildQuery,
|
|
3
|
+
exec,
|
|
4
|
+
toQuery,
|
|
5
|
+
toString
|
|
6
|
+
} from "../chunk-TQ2GXAE7.js";
|
|
7
|
+
import "../chunk-MG2S4V4N.js";
|
|
8
|
+
import "../chunk-FYSNJAGD.js";
|
|
9
|
+
import "../chunk-Y7FSRHH3.js";
|
|
10
|
+
import "../chunk-GLOHF5CP.js";
|
|
11
|
+
export {
|
|
12
|
+
buildQuery,
|
|
13
|
+
exec,
|
|
14
|
+
toQuery,
|
|
15
|
+
toString
|
|
16
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import '../column/index.js';
|
|
2
|
+
import '../column/constants.js';
|
|
3
|
+
export { h as AcceptedInsertValues, g as AcceptedOrderBy, i as AcceptedUpdateValues, j as AggregateColumn, A as AliasedColumn, C as ColumnSelector, Q as QueryDefinition, l as QueryOutput, R as RawColumn, k as SelectQueryOutput, e as SelectableColumn, c as StrictColumnSelector, W as WhereValue } from '../index-DJhQVUY3.js';
|
|
4
|
+
import '../types.js';
|
|
5
|
+
import './constants.js';
|
|
6
|
+
import '../table/constants.js';
|
|
7
|
+
import '../column/types.js';
|
|
File without changes
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { T as Table, W as WhereValue, Q as QueryDefinition, C as ColumnSelector, c as StrictColumnSelector, d as QueryBuilder, A as AliasedColumn, e as SelectableColumn } from '../index-DJhQVUY3.js';
|
|
2
|
+
import { Column } from '../column/index.js';
|
|
3
|
+
import { Dialect } from '../table/constants.js';
|
|
4
|
+
import { AcceptedOperator } from './constants.js';
|
|
5
|
+
import '../column/constants.js';
|
|
6
|
+
import '../types.js';
|
|
7
|
+
import '../column/types.js';
|
|
8
|
+
|
|
9
|
+
declare function getTableColumnNames<ColName extends string, BaseAlias extends string, BaseTable extends Table<string, Record<string, Column>>, JoinedTables extends Record<string, Table<string, Record<string, Column>>>>(column: ColName, baseAlias: BaseAlias, baseTable: BaseTable, joinedTables: JoinedTables): {
|
|
10
|
+
from: string;
|
|
11
|
+
columns: string[];
|
|
12
|
+
};
|
|
13
|
+
declare function getCondition<DbDialect extends Dialect, ColName extends string, Operator extends AcceptedOperator, Value extends WhereValue<Column>[Operator]>(dialect: DbDialect, column: ColName, operator: Operator, value: Value): string;
|
|
14
|
+
declare function getTimestamp<TableRef extends Table<string, Record<string, Column>>>(table: TableRef): {
|
|
15
|
+
isWithTimestamp: boolean;
|
|
16
|
+
timestamp: Date;
|
|
17
|
+
createdAt: string;
|
|
18
|
+
updatedAt: string;
|
|
19
|
+
};
|
|
20
|
+
declare function getParanoid<TableRef extends Table<string, Record<string, Column>>>(table: TableRef): {
|
|
21
|
+
isWithParanoid: boolean;
|
|
22
|
+
timestamp: Date;
|
|
23
|
+
deletedAt: string;
|
|
24
|
+
};
|
|
25
|
+
declare function getWhereConditions<Alias extends string, TableRef extends Table<string, Record<string, Column>>, JoinedTables extends Record<string, Table<string, Record<string, Column>>>, Definition extends Partial<QueryDefinition<Alias, TableRef, JoinedTables>>, AllowedColumn extends ColumnSelector<Alias, TableRef, JoinedTables>, StrictAllowedColumn extends StrictColumnSelector<Alias, TableRef, JoinedTables>, Query extends QueryBuilder<Alias, TableRef, JoinedTables, Definition, AllowedColumn, StrictAllowedColumn>>(q: Query): string[];
|
|
26
|
+
declare function getGroupByConditions<Alias extends string, TableRef extends Table<string, Record<string, Column>>, JoinedTables extends Record<string, Table<string, Record<string, Column>>>, Definition extends Partial<QueryDefinition<Alias, TableRef, JoinedTables>>, AllowedColumn extends ColumnSelector<Alias, TableRef, JoinedTables>, StrictAllowedColumn extends StrictColumnSelector<Alias, TableRef, JoinedTables>, Query extends QueryBuilder<Alias, TableRef, JoinedTables, Definition, AllowedColumn, StrictAllowedColumn>>(q: Query): (string | AliasedColumn<ColumnSelector<Alias, TableRef, JoinedTables>, string>)[];
|
|
27
|
+
declare function getTableSelectName<Alias extends string, TableRef extends Table<string, Record<string, Column>>, JoinedTables extends Record<string, Table<string, Record<string, Column>>>, Definition extends Partial<QueryDefinition<Alias, TableRef, JoinedTables>>, AllowedColumn extends ColumnSelector<Alias, TableRef, JoinedTables>, StrictAllowedColumn extends StrictColumnSelector<Alias, TableRef, JoinedTables>, Query extends QueryBuilder<Alias, TableRef, JoinedTables, Definition, AllowedColumn, StrictAllowedColumn>>(q: Query): string;
|
|
28
|
+
declare function parseAliasedRow({ row, selects, root, }: {
|
|
29
|
+
row: Record<string, unknown>;
|
|
30
|
+
selects: SelectableColumn<string>[];
|
|
31
|
+
root?: string | null;
|
|
32
|
+
}): Record<string, any>;
|
|
33
|
+
|
|
34
|
+
export { getCondition, getGroupByConditions, getParanoid, getTableColumnNames, getTableSelectName, getTimestamp, getWhereConditions, parseAliasedRow };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getCondition,
|
|
3
|
+
getGroupByConditions,
|
|
4
|
+
getParanoid,
|
|
5
|
+
getTableColumnNames,
|
|
6
|
+
getTableSelectName,
|
|
7
|
+
getTimestamp,
|
|
8
|
+
getWhereConditions,
|
|
9
|
+
parseAliasedRow
|
|
10
|
+
} from "../chunk-TQ2GXAE7.js";
|
|
11
|
+
import "../chunk-MG2S4V4N.js";
|
|
12
|
+
import "../chunk-FYSNJAGD.js";
|
|
13
|
+
import "../chunk-Y7FSRHH3.js";
|
|
14
|
+
import "../chunk-GLOHF5CP.js";
|
|
15
|
+
export {
|
|
16
|
+
getCondition,
|
|
17
|
+
getGroupByConditions,
|
|
18
|
+
getParanoid,
|
|
19
|
+
getTableColumnNames,
|
|
20
|
+
getTableSelectName,
|
|
21
|
+
getTimestamp,
|
|
22
|
+
getWhereConditions,
|
|
23
|
+
parseAliasedRow
|
|
24
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Table
|
|
3
|
+
} from "../chunk-W2DR3ZVK.js";
|
|
4
|
+
import "../chunk-TQ2GXAE7.js";
|
|
5
|
+
import "../chunk-MG2S4V4N.js";
|
|
6
|
+
import "../chunk-FYSNJAGD.js";
|
|
7
|
+
import "../chunk-WVJGTZFI.js";
|
|
8
|
+
import "../chunk-GY7R637S.js";
|
|
9
|
+
import "../chunk-G3LSCLIQ.js";
|
|
10
|
+
import "../chunk-Y7FSRHH3.js";
|
|
11
|
+
import "../chunk-GLOHF5CP.js";
|
|
12
|
+
export {
|
|
13
|
+
Table
|
|
14
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { M as MergeTimestampParanoid, p as TableOptions, q as TableOutput, a as TimestampOptions } from '../index-DJhQVUY3.js';
|
|
2
|
+
import '../column/index.js';
|
|
3
|
+
import './constants.js';
|
|
4
|
+
import '../column/constants.js';
|
|
5
|
+
import '../types.js';
|
|
6
|
+
import '../query/constants.js';
|
|
7
|
+
import '../column/types.js';
|
|
File without changes
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import '../column/constants.js';
|
|
2
|
+
import '../column/index.js';
|
|
3
|
+
import './constants.js';
|
|
4
|
+
export { m as createdAt, o as defineColumns, n as deletedAt, u as updatedAt } from '../index-DJhQVUY3.js';
|
|
5
|
+
import '../column/types.js';
|
|
6
|
+
import '../types.js';
|
|
7
|
+
import '../query/constants.js';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createdAt,
|
|
3
|
+
defineColumns,
|
|
4
|
+
deletedAt,
|
|
5
|
+
updatedAt
|
|
6
|
+
} from "../chunk-WVJGTZFI.js";
|
|
7
|
+
import "../chunk-GY7R637S.js";
|
|
8
|
+
import "../chunk-G3LSCLIQ.js";
|
|
9
|
+
import "../chunk-GLOHF5CP.js";
|
|
10
|
+
export {
|
|
11
|
+
createdAt,
|
|
12
|
+
defineColumns,
|
|
13
|
+
deletedAt,
|
|
14
|
+
updatedAt
|
|
15
|
+
};
|
package/dist/types.d.ts
ADDED
package/dist/types.js
ADDED
|
File without changes
|
package/package.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ignisia/sql",
|
|
3
|
+
"module": "dist/index.js",
|
|
4
|
+
"types": "./dist/index.d.ts",
|
|
5
|
+
"version": "0.1.0",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "bun run build.ts"
|
|
9
|
+
},
|
|
10
|
+
"devDependencies": {
|
|
11
|
+
"@ignisia/utils": "0.1.0",
|
|
12
|
+
"@types/bun": "latest"
|
|
13
|
+
},
|
|
14
|
+
"peerDependencies": {
|
|
15
|
+
"typescript": "^5"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist"
|
|
19
|
+
]
|
|
20
|
+
}
|