@fraym/projections 0.4.1 → 0.5.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.
@@ -1,9 +1,8 @@
1
1
  import { ClientConfig } from "../config/config";
2
- import { GetProjectionData } from "./getData";
3
2
  import { Filter, GetProjectionDataList } from "./getDataList";
4
3
  export interface DeliveryClient {
5
- getData: (tenantId: string, type: string, id: string, returnEmptyDataIfNotFound?: boolean) => Promise<GetProjectionData | null>;
6
- getDataList: (tenantId: string, type: string, limit?: number, page?: number, filter?: Filter) => Promise<GetProjectionDataList | null>;
4
+ getData: <T extends {}>(tenantId: string, type: string, id: string, returnEmptyDataIfNotFound?: boolean) => Promise<T | null>;
5
+ getDataList: <T extends {}>(tenantId: string, type: string, limit?: number, page?: number, filter?: Filter) => Promise<GetProjectionDataList<T> | null>;
7
6
  close: () => Promise<void>;
8
7
  }
9
8
  export declare const newDeliveryClient: (config?: ClientConfig) => Promise<DeliveryClient>;
@@ -1,3 +1,2 @@
1
1
  import { DeliveryServiceClient } from "@fraym/projections-proto";
2
- export declare type GetProjectionData = Record<string, any>;
3
- export declare const getProjectionData: (tenantId: string, projection: string, dataId: string, returnEmptyDataIfNotFound: boolean, serviceClient: DeliveryServiceClient) => Promise<GetProjectionData | null>;
2
+ export declare const getProjectionData: <T extends {}>(tenantId: string, projection: string, dataId: string, returnEmptyDataIfNotFound: boolean, serviceClient: DeliveryServiceClient) => Promise<T | null>;
@@ -1,8 +1,8 @@
1
1
  import { DeliveryServiceClient } from "@fraym/projections-proto";
2
- export interface GetProjectionDataList {
2
+ export interface GetProjectionDataList<T extends {}> {
3
3
  limit: number;
4
4
  page: number;
5
- data: Record<string, any>[];
5
+ data: T[];
6
6
  }
7
7
  export interface Filter {
8
8
  fields: Record<string, FieldFilter>;
@@ -14,4 +14,4 @@ export interface FieldFilter {
14
14
  operation: string;
15
15
  value: any;
16
16
  }
17
- export declare const getProjectionDataList: (tenantId: string, projection: string, limit: number, page: number, filter: Filter, serviceClient: DeliveryServiceClient) => Promise<GetProjectionDataList | null>;
17
+ export declare const getProjectionDataList: <T extends {}>(tenantId: string, projection: string, limit: number, page: number, filter: Filter, serviceClient: DeliveryServiceClient) => Promise<GetProjectionDataList<T> | null>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fraym/projections",
3
- "version": "0.4.1",
3
+ "version": "0.5.0",
4
4
  "license": "UNLICENSED",
5
5
  "homepage": "https://github.com/fraym/projections-nodejs",
6
6
  "repository": {