@fraym/projections 0.15.0 → 0.16.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.
|
@@ -5,8 +5,9 @@ import { Order } from "./order";
|
|
|
5
5
|
import { AuthData } from "./auth";
|
|
6
6
|
import { UpsertResponse } from "./upsert";
|
|
7
7
|
import { EventMetadata } from "./eventMetadata";
|
|
8
|
+
import { Wait } from "./wait";
|
|
8
9
|
export interface DeliveryClient {
|
|
9
|
-
getData: <T extends {}>(projection: string, authData: AuthData, id: string, filter?: Filter, returnEmptyDataIfNotFound?: boolean) => Promise<T | null>;
|
|
10
|
+
getData: <T extends {}>(projection: string, authData: AuthData, id: string, filter?: Filter, returnEmptyDataIfNotFound?: boolean, wait?: Wait) => Promise<T | null>;
|
|
10
11
|
getDataList: <T extends {}>(projection: string, authData: AuthData, limit?: number, page?: number, filter?: Filter, order?: Order[]) => Promise<GetProjectionDataList<T> | null>;
|
|
11
12
|
upsertData: <T extends {}>(projection: string, authData: AuthData, dataId: string, payload: Record<string, any>, eventMetadata?: EventMetadata) => Promise<UpsertResponse<T>>;
|
|
12
13
|
deleteDataById: (projection: string, authData: AuthData, dataId: string, eventMetadata?: EventMetadata) => Promise<number>;
|
package/dist/delivery/client.js
CHANGED
|
@@ -15,8 +15,8 @@ const newDeliveryClient = async (config) => {
|
|
|
15
15
|
"grpc.keepalive_timeout_ms": config.keepaliveTimeout,
|
|
16
16
|
"grpc.keepalive_permit_without_calls": 1,
|
|
17
17
|
});
|
|
18
|
-
const getData = async (projection, auth, id, filter = { fields: {}, and: [], or: [] }, returnEmptyDataIfNotFound = false) => {
|
|
19
|
-
return await (0, getData_1.getProjectionData)(projection, auth, id, filter, returnEmptyDataIfNotFound, serviceClient);
|
|
18
|
+
const getData = async (projection, auth, id, filter = { fields: {}, and: [], or: [] }, returnEmptyDataIfNotFound = false, wait) => {
|
|
19
|
+
return await (0, getData_1.getProjectionData)(projection, auth, id, filter, returnEmptyDataIfNotFound, serviceClient, wait);
|
|
20
20
|
};
|
|
21
21
|
const getDataList = async (projection, auth, limit = 0, page = 1, filter = { fields: {}, and: [], or: [] }, order = []) => {
|
|
22
22
|
return await (0, getDataList_1.getProjectionDataList)(projection, auth, limit, page, filter, order, serviceClient);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DeliveryServiceClient } from "@fraym/projections-proto";
|
|
2
2
|
import { AuthData } from "./auth";
|
|
3
3
|
import { Filter } from "./filter";
|
|
4
|
-
|
|
4
|
+
import { Wait } from "./wait";
|
|
5
|
+
export declare const getProjectionData: <T extends {}>(projection: string, auth: AuthData, dataId: string, filter: Filter, returnEmptyDataIfNotFound: boolean, serviceClient: DeliveryServiceClient, wait?: Wait) => Promise<T | null>;
|
package/dist/delivery/getData.js
CHANGED
|
@@ -3,7 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getProjectionData = void 0;
|
|
4
4
|
const auth_1 = require("./auth");
|
|
5
5
|
const filter_1 = require("./filter");
|
|
6
|
-
const
|
|
6
|
+
const wait_1 = require("./wait");
|
|
7
|
+
const getProjectionData = async (projection, auth, dataId, filter, returnEmptyDataIfNotFound, serviceClient, wait) => {
|
|
7
8
|
return new Promise((resolve, reject) => {
|
|
8
9
|
serviceClient.getData({
|
|
9
10
|
projection,
|
|
@@ -11,6 +12,7 @@ const getProjectionData = async (projection, auth, dataId, filter, returnEmptyDa
|
|
|
11
12
|
dataId,
|
|
12
13
|
filter: (0, filter_1.getProtobufDataFilter)(filter),
|
|
13
14
|
returnEmptyDataIfNotFound,
|
|
15
|
+
wait: (0, wait_1.getProtobufDataWait)(wait),
|
|
14
16
|
}, (error, response) => {
|
|
15
17
|
if (error) {
|
|
16
18
|
reject(error.message);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getProtobufDataWait = void 0;
|
|
4
|
+
const filter_1 = require("./filter");
|
|
5
|
+
const getProtobufDataWait = (wait) => {
|
|
6
|
+
var _a;
|
|
7
|
+
if (!wait) {
|
|
8
|
+
return undefined;
|
|
9
|
+
}
|
|
10
|
+
return {
|
|
11
|
+
conditionFilter: (0, filter_1.getProtobufDataFilter)(wait.conditionFilter),
|
|
12
|
+
timeout: (_a = wait.timeout) !== null && _a !== void 0 ? _a : 0,
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
exports.getProtobufDataWait = getProtobufDataWait;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fraym/projections",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"homepage": "https://github.com/fraym/projections-nodejs",
|
|
6
6
|
"repository": {
|
|
@@ -23,20 +23,20 @@
|
|
|
23
23
|
"main": "dist/index.js",
|
|
24
24
|
"types": "dist/index.d.ts",
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@fraym/projections-proto": "^1.0.0
|
|
27
|
-
"@graphql-tools/graphql-file-loader": "^7.5.
|
|
28
|
-
"@graphql-tools/load": "^7.8.
|
|
29
|
-
"@grpc/grpc-js": "^1.8.
|
|
30
|
-
"dotenv": "^16.
|
|
31
|
-
"graphql": "^16.
|
|
32
|
-
"yargs": "^17.7.
|
|
26
|
+
"@fraym/projections-proto": "^1.0.0",
|
|
27
|
+
"@graphql-tools/graphql-file-loader": "^7.5.17",
|
|
28
|
+
"@graphql-tools/load": "^7.8.14",
|
|
29
|
+
"@grpc/grpc-js": "^1.8.18",
|
|
30
|
+
"dotenv": "^16.3.1",
|
|
31
|
+
"graphql": "^16.7.1",
|
|
32
|
+
"yargs": "^17.7.2"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@becklyn/prettier": "^1.0.2",
|
|
36
|
-
"@types/uuid": "^9.0.
|
|
36
|
+
"@types/uuid": "^9.0.2",
|
|
37
37
|
"@types/yargs": "^17.0.24",
|
|
38
|
-
"prettier": "^2.8.
|
|
39
|
-
"typescript": "^5.
|
|
38
|
+
"prettier": "^2.8.8",
|
|
39
|
+
"typescript": "^5.1.6",
|
|
40
40
|
"uuid": "^9.0.0"
|
|
41
41
|
},
|
|
42
42
|
"prettier": "@becklyn/prettier"
|