@tailor-platform/create-sdk 1.0.0 → 1.1.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.
- package/CHANGELOG.md +4 -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 +9 -3
- package/templates/multi-application/package.json +1 -1
- package/templates/testing/package.json +1 -1
- package/templates/testing/src/generated/db.ts +9 -3
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ColumnType, Kysely } from "kysely";
|
|
1
|
+
import { type ColumnType, Kysely, type KyselyConfig } from "kysely";
|
|
2
2
|
import { TailordbDialect } from "@tailor-platform/function-kysely-tailordb";
|
|
3
3
|
|
|
4
4
|
type Timestamp = ColumnType<Date, Date | string, Date | string>;
|
|
@@ -83,9 +83,15 @@ export interface Namespace {
|
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
export function getDB<const N extends keyof Namespace>(
|
|
86
|
+
export function getDB<const N extends keyof Namespace>(
|
|
87
|
+
namespace: N,
|
|
88
|
+
kyselyConfig?: Omit<KyselyConfig, "dialect">,
|
|
89
|
+
): Kysely<Namespace[N]> {
|
|
87
90
|
const client = new tailordb.Client({ namespace });
|
|
88
|
-
return new Kysely<Namespace[N]>({
|
|
91
|
+
return new Kysely<Namespace[N]>({
|
|
92
|
+
dialect: new TailordbDialect(client),
|
|
93
|
+
...kyselyConfig,
|
|
94
|
+
});
|
|
89
95
|
}
|
|
90
96
|
|
|
91
97
|
export type DB<N extends keyof Namespace = keyof Namespace> = ReturnType<typeof getDB<N>>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ColumnType, Kysely } from "kysely";
|
|
1
|
+
import { type ColumnType, Kysely, type KyselyConfig } from "kysely";
|
|
2
2
|
import { TailordbDialect } from "@tailor-platform/function-kysely-tailordb";
|
|
3
3
|
|
|
4
4
|
type Timestamp = ColumnType<Date, Date | string, Date | string>;
|
|
@@ -19,9 +19,15 @@ export interface Namespace {
|
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
export function getDB<const N extends keyof Namespace>(
|
|
22
|
+
export function getDB<const N extends keyof Namespace>(
|
|
23
|
+
namespace: N,
|
|
24
|
+
kyselyConfig?: Omit<KyselyConfig, "dialect">,
|
|
25
|
+
): Kysely<Namespace[N]> {
|
|
23
26
|
const client = new tailordb.Client({ namespace });
|
|
24
|
-
return new Kysely<Namespace[N]>({
|
|
27
|
+
return new Kysely<Namespace[N]>({
|
|
28
|
+
dialect: new TailordbDialect(client),
|
|
29
|
+
...kyselyConfig,
|
|
30
|
+
});
|
|
25
31
|
}
|
|
26
32
|
|
|
27
33
|
export type DB<N extends keyof Namespace = keyof Namespace> = ReturnType<typeof getDB<N>>;
|