@8ms/helpers 2.3.18 → 2.3.19

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.
Binary file
@@ -1,20 +1,22 @@
1
1
  import { t as BaseNamespace } from "../../index-DwB8X1lz.mjs";
2
+ import { defineRelations } from "drizzle-orm";
2
3
 
3
4
  //#region src/drizzle/server/DrizzleNamespace.d.ts
4
- declare class DrizzleNamespace extends BaseNamespace {
5
- client: any;
5
+ declare class DrizzleNamespace<TClient = any> extends BaseNamespace {
6
+ client: TClient;
6
7
  config: DrizzleConfig;
7
8
  ensureInit: () => Promise<void>;
8
9
  }
9
10
  //#endregion
10
11
  //#region src/drizzle/server/drizzle.d.ts
11
12
  type DrizzleConfig = {
13
+ relations?: ReturnType<typeof defineRelations>;
12
14
  url: string;
13
15
  isDebug: boolean;
14
16
  isPlanetScale: boolean;
15
17
  isMysql: boolean;
16
18
  isPostgres: boolean;
17
19
  };
18
- declare const drizzleClient: (key?: string, config?: DrizzleConfig) => Promise<DrizzleNamespace>;
20
+ declare const drizzleClient: <TClient = any>(key?: string, config?: DrizzleConfig) => Promise<DrizzleNamespace<TClient>>;
19
21
  //#endregion
20
22
  export { DrizzleConfig, DrizzleNamespace, drizzleClient };
@@ -14,6 +14,7 @@ var DrizzleNamespace = class extends BaseNamespace {
14
14
  const { drizzle } = await import("drizzle-orm/planetscale-serverless");
15
15
  this.client = drizzle({
16
16
  connection: { url: this.config.url },
17
+ relations: this.config?.relations,
17
18
  logger
18
19
  });
19
20
  } catch (e) {
@@ -23,6 +24,7 @@ var DrizzleNamespace = class extends BaseNamespace {
23
24
  const { drizzle } = await import("drizzle-orm/mysql2");
24
25
  this.client = drizzle({
25
26
  connection: this.config.url,
27
+ relations: this.config?.relations,
26
28
  logger
27
29
  });
28
30
  } catch (e) {
@@ -32,6 +34,7 @@ var DrizzleNamespace = class extends BaseNamespace {
32
34
  const { drizzle } = await import("drizzle-orm/node-postgres");
33
35
  this.client = drizzle({
34
36
  connection: this.config.url,
37
+ relations: this.config?.relations,
35
38
  logger
36
39
  });
37
40
  } catch (e) {
@@ -48,6 +51,7 @@ const drizzleNamespaces = /* @__PURE__ */ new Map();
48
51
  const drizzleClient = async (key = "default", config) => {
49
52
  if (drizzleNamespaces.has(key)) return drizzleNamespaces.get(key);
50
53
  if (!config) if (key === "default") config = {
54
+ relations: void 0,
51
55
  url: process.env.DATABASE_URL,
52
56
  isDebug: "true" === process.env.DATABASE_IS_DEBUG,
53
57
  isPlanetScale: "true" === process.env.DATABASE_IS_PLANETSCALE,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@8ms/helpers",
3
3
  "license": "UNLICENSED",
4
- "version": "2.3.18",
4
+ "version": "2.3.19",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/8millionstories-organisation/8ms-helpers-ts.git"
@@ -41,7 +41,7 @@
41
41
  "@prisma/adapter-pg": "^7.0.0",
42
42
  "@prisma/adapter-planetscale": "^7.0.0",
43
43
  "@prisma/client": "^7.0.0",
44
- "drizzle-orm": "^0.45.1",
44
+ "drizzle-orm": "*",
45
45
  "fs-extra": "^11.0.0",
46
46
  "google-ads-api": "^23.0.0",
47
47
  "googleapis-common": "^8.0.0",
@@ -174,7 +174,7 @@
174
174
  "@types/react": "^19.2.14",
175
175
  "babel-jest": "30.2.0",
176
176
  "dotenv": "^17.3.1",
177
- "drizzle-orm": "^0.45.1",
177
+ "drizzle-orm": "beta",
178
178
  "fs-extra": "11.3.3",
179
179
  "google-ads-api": "^23.0.0",
180
180
  "googleapis-common": "^8.0.0",