@hiliosai/sdk 0.1.6 → 0.1.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hiliosai/sdk",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./src/index.ts"
@@ -4,22 +4,14 @@ import type {AppContext} from '../types/context';
4
4
  import {AbstractDatasource} from './base.datasource';
5
5
 
6
6
  // Generic Prisma Client interface - will be provided by generated client
7
+ // Made very permissive to work with any generated Prisma client
7
8
  interface PrismaClientLike {
8
9
  $connect(): Promise<void>;
9
10
  $disconnect(): Promise<void>;
10
- $queryRaw(
11
- query: TemplateStringsArray,
12
- ...values: unknown[]
13
- ): Promise<unknown>;
14
- $transaction<T>(
15
- fn: (client: PrismaClientLike) => Promise<T>,
16
- options?: {
17
- maxWait?: number;
18
- timeout?: number;
19
- }
20
- ): Promise<T>;
21
- $extends<T>(extension: T): PrismaClientLike & T;
22
- [key: string]: unknown;
11
+ $queryRaw: any;
12
+ $transaction: any;
13
+ $extends: any;
14
+ [key: string]: any;
23
15
  }
24
16
 
25
17
  // Extension interfaces for common production patterns
@@ -266,7 +258,7 @@ export class PrismaDatasource<
266
258
  ): Promise<T> {
267
259
  try {
268
260
  return await this.client.$transaction(
269
- (tx) => fn(tx as TPrismaClient),
261
+ (tx: any) => fn(tx as TPrismaClient),
270
262
  options
271
263
  );
272
264
  } catch (error) {
package/src/index.ts CHANGED
@@ -4,3 +4,5 @@ export * from './service/define-integration';
4
4
  export * from './types';
5
5
  export * from './configs';
6
6
  export * from './env';
7
+ export * from './datasources';
8
+ export * from './mixins';
@@ -1,23 +1,11 @@
1
1
  /* eslint-disable @typescript-eslint/no-explicit-any */
2
2
  import type {ServiceSchema} from 'moleculer';
3
- import type {BaseDatasource} from '../datasources';
3
+ import type {
4
+ DatasourceConstructorRegistry,
5
+ DatasourceInstanceRegistry,
6
+ } from '../middlewares/datasource.middleware';
4
7
  import type {AppContext} from '../types/context';
5
8
 
6
- /**
7
- * Datasource constructor registry type
8
- * All datasources should implement BaseDatasource interface
9
- */
10
- export interface DatasourceConstructorRegistry {
11
- [key: string]: new () => BaseDatasource | object;
12
- }
13
-
14
- /**
15
- * Datasource instance registry type
16
- */
17
- export interface DatasourceInstanceRegistry {
18
- [key: string]: object;
19
- }
20
-
21
9
  /**
22
10
  * Creates a Moleculer mixin for datasource injection
23
11
  * Simple mixin that just instantiates datasources and injects them into context
@@ -121,10 +109,3 @@ export function DatasourceMixin(
121
109
  },
122
110
  };
123
111
  }
124
-
125
- /**
126
- * Type helper for services that use the datasource mixin
127
- */
128
- export type ServiceWithDatasources<T extends DatasourceInstanceRegistry> = {
129
- datasources: T;
130
- };