@tailor-platform/create-sdk 1.7.0 → 1.8.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/CHANGELOG.md +2 -0
- package/package.json +1 -1
- package/templates/hello-world/package.json +1 -1
- package/templates/inventory-management/package.json +1 -1
- package/templates/inventory-management/src/generated/kysely-tailordb.ts +34 -1
- package/templates/multi-application/package.json +1 -1
- package/templates/testing/package.json +1 -1
- package/templates/testing/src/generated/db.ts +34 -1
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
type ColumnType,
|
|
3
|
+
Kysely,
|
|
4
|
+
type KyselyConfig,
|
|
5
|
+
type Transaction as KyselyTransaction,
|
|
6
|
+
type Insertable as KyselyInsertable,
|
|
7
|
+
type Selectable as KyselySelectable,
|
|
8
|
+
type Updateable as KyselyUpdateable,
|
|
9
|
+
} from "kysely";
|
|
2
10
|
import { TailordbDialect } from "@tailor-platform/function-kysely-tailordb";
|
|
3
11
|
|
|
4
12
|
type Timestamp = ColumnType<Date, Date | string, Date | string>;
|
|
@@ -95,3 +103,28 @@ export function getDB<const N extends keyof Namespace>(
|
|
|
95
103
|
}
|
|
96
104
|
|
|
97
105
|
export type DB<N extends keyof Namespace = keyof Namespace> = ReturnType<typeof getDB<N>>;
|
|
106
|
+
|
|
107
|
+
export type Transaction<K extends keyof Namespace | DB = keyof Namespace> =
|
|
108
|
+
K extends DB<infer N>
|
|
109
|
+
? KyselyTransaction<Namespace[N]>
|
|
110
|
+
: K extends keyof Namespace
|
|
111
|
+
? KyselyTransaction<Namespace[K]>
|
|
112
|
+
: never;
|
|
113
|
+
|
|
114
|
+
type TableName = {
|
|
115
|
+
[N in keyof Namespace]: keyof Namespace[N];
|
|
116
|
+
}[keyof Namespace];
|
|
117
|
+
export type Table<T extends TableName> = {
|
|
118
|
+
[N in keyof Namespace]: T extends keyof Namespace[N] ? Namespace[N][T]
|
|
119
|
+
: never;
|
|
120
|
+
}[keyof Namespace];
|
|
121
|
+
|
|
122
|
+
export type Insertable<T extends keyof Namespace[keyof Namespace]> = KyselyInsertable<
|
|
123
|
+
Table<T>
|
|
124
|
+
>;
|
|
125
|
+
export type Selectable<T extends keyof Namespace[keyof Namespace]> = KyselySelectable<
|
|
126
|
+
Table<T>
|
|
127
|
+
>;
|
|
128
|
+
export type Updateable<T extends keyof Namespace[keyof Namespace]> = KyselyUpdateable<
|
|
129
|
+
Table<T>
|
|
130
|
+
>;
|
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
type ColumnType,
|
|
3
|
+
Kysely,
|
|
4
|
+
type KyselyConfig,
|
|
5
|
+
type Transaction as KyselyTransaction,
|
|
6
|
+
type Insertable as KyselyInsertable,
|
|
7
|
+
type Selectable as KyselySelectable,
|
|
8
|
+
type Updateable as KyselyUpdateable,
|
|
9
|
+
} from "kysely";
|
|
2
10
|
import { TailordbDialect } from "@tailor-platform/function-kysely-tailordb";
|
|
3
11
|
|
|
4
12
|
type Timestamp = ColumnType<Date, Date | string, Date | string>;
|
|
@@ -31,3 +39,28 @@ export function getDB<const N extends keyof Namespace>(
|
|
|
31
39
|
}
|
|
32
40
|
|
|
33
41
|
export type DB<N extends keyof Namespace = keyof Namespace> = ReturnType<typeof getDB<N>>;
|
|
42
|
+
|
|
43
|
+
export type Transaction<K extends keyof Namespace | DB = keyof Namespace> =
|
|
44
|
+
K extends DB<infer N>
|
|
45
|
+
? KyselyTransaction<Namespace[N]>
|
|
46
|
+
: K extends keyof Namespace
|
|
47
|
+
? KyselyTransaction<Namespace[K]>
|
|
48
|
+
: never;
|
|
49
|
+
|
|
50
|
+
type TableName = {
|
|
51
|
+
[N in keyof Namespace]: keyof Namespace[N];
|
|
52
|
+
}[keyof Namespace];
|
|
53
|
+
export type Table<T extends TableName> = {
|
|
54
|
+
[N in keyof Namespace]: T extends keyof Namespace[N] ? Namespace[N][T]
|
|
55
|
+
: never;
|
|
56
|
+
}[keyof Namespace];
|
|
57
|
+
|
|
58
|
+
export type Insertable<T extends keyof Namespace[keyof Namespace]> = KyselyInsertable<
|
|
59
|
+
Table<T>
|
|
60
|
+
>;
|
|
61
|
+
export type Selectable<T extends keyof Namespace[keyof Namespace]> = KyselySelectable<
|
|
62
|
+
Table<T>
|
|
63
|
+
>;
|
|
64
|
+
export type Updateable<T extends keyof Namespace[keyof Namespace]> = KyselyUpdateable<
|
|
65
|
+
Table<T>
|
|
66
|
+
>;
|