@fraym/projections 0.15.0 → 0.17.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.
- package/dist/delivery/auth.d.ts +1 -1
- package/dist/delivery/client.d.ts +2 -1
- package/dist/delivery/client.js +4 -4
- package/dist/delivery/delete.d.ts +2 -2
- package/dist/delivery/filter.d.ts +1 -1
- package/dist/delivery/getData.d.ts +3 -2
- package/dist/delivery/getData.js +3 -1
- package/dist/delivery/getDataList.d.ts +2 -2
- package/dist/delivery/order.d.ts +1 -1
- package/dist/delivery/upsert.d.ts +2 -2
- package/dist/delivery/wait.d.ts +7 -0
- package/dist/delivery/wait.js +15 -0
- package/package.json +16 -13
package/dist/delivery/auth.d.ts
CHANGED
|
@@ -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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.newDeliveryClient = void 0;
|
|
4
|
-
const
|
|
4
|
+
const delivery_1 = require("@fraym/proto/freym/projections/delivery");
|
|
5
5
|
const grpc_js_1 = require("@grpc/grpc-js");
|
|
6
6
|
const config_1 = require("../config/config");
|
|
7
7
|
const getData_1 = require("./getData");
|
|
@@ -10,13 +10,13 @@ const upsert_1 = require("./upsert");
|
|
|
10
10
|
const delete_1 = require("./delete");
|
|
11
11
|
const newDeliveryClient = async (config) => {
|
|
12
12
|
config = (0, config_1.useDeliveryConfigDefaults)(config);
|
|
13
|
-
const serviceClient = new
|
|
13
|
+
const serviceClient = new delivery_1.ServiceClient(config.serverAddress, grpc_js_1.credentials.createInsecure(), {
|
|
14
14
|
"grpc.keepalive_time_ms": config.keepaliveInterval,
|
|
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,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ServiceClient } from "@fraym/proto/freym/projections/delivery";
|
|
2
2
|
import { AuthData } from "./auth";
|
|
3
3
|
import { EventMetadata } from "./eventMetadata";
|
|
4
4
|
import { Filter } from "./filter";
|
|
5
|
-
export declare const deleteProjectionData: (projection: string, auth: AuthData, dataId: string, filter: Filter, eventMetadata: EventMetadata, serviceClient:
|
|
5
|
+
export declare const deleteProjectionData: (projection: string, auth: AuthData, dataId: string, filter: Filter, eventMetadata: EventMetadata, serviceClient: ServiceClient) => Promise<number>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ServiceClient } from "@fraym/proto/freym/projections/delivery";
|
|
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: ServiceClient, 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);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ServiceClient } from "@fraym/proto/freym/projections/delivery";
|
|
2
2
|
import { AuthData } from "./auth";
|
|
3
3
|
import { Filter } from "./filter";
|
|
4
4
|
import { Order } from "./order";
|
|
@@ -8,4 +8,4 @@ export interface GetProjectionDataList<T extends {}> {
|
|
|
8
8
|
total: number;
|
|
9
9
|
data: T[];
|
|
10
10
|
}
|
|
11
|
-
export declare const getProjectionDataList: <T extends {}>(projection: string, auth: AuthData, limit: number, page: number, filter: Filter, order: Order[], serviceClient:
|
|
11
|
+
export declare const getProjectionDataList: <T extends {}>(projection: string, auth: AuthData, limit: number, page: number, filter: Filter, order: Order[], serviceClient: ServiceClient) => Promise<GetProjectionDataList<T> | null>;
|
package/dist/delivery/order.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ServiceClient } from "@fraym/proto/freym/projections/delivery";
|
|
2
2
|
import { AuthData } from "./auth";
|
|
3
3
|
import { EventMetadata } from "./eventMetadata";
|
|
4
4
|
export type UpsertResponse<T extends {}> = UpsertSuccessResponse<T> | UpsertValidationResponse;
|
|
@@ -12,4 +12,4 @@ export interface UpsertValidationResponse {
|
|
|
12
12
|
}
|
|
13
13
|
export declare const isUpsertSuccessResponse: <T extends {}>(response: UpsertResponse<T>) => response is UpsertSuccessResponse<T>;
|
|
14
14
|
export declare const isUpsertValidationResponse: <T extends {}>(response: UpsertResponse<T>) => response is UpsertValidationResponse;
|
|
15
|
-
export declare const upsertProjectionData: <T extends {}>(projection: string, auth: AuthData, dataId: string, payload: Record<string, any>, eventMetadata: EventMetadata, serviceClient:
|
|
15
|
+
export declare const upsertProjectionData: <T extends {}>(projection: string, auth: AuthData, dataId: string, payload: Record<string, any>, eventMetadata: EventMetadata, serviceClient: ServiceClient) => Promise<UpsertResponse<T>>;
|
|
@@ -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.17.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"homepage": "https://github.com/fraym/projections-nodejs",
|
|
6
6
|
"repository": {
|
|
@@ -20,24 +20,27 @@
|
|
|
20
20
|
"files": [
|
|
21
21
|
"dist/**/*"
|
|
22
22
|
],
|
|
23
|
+
"engines": {
|
|
24
|
+
"node": ">=16"
|
|
25
|
+
},
|
|
23
26
|
"main": "dist/index.js",
|
|
24
27
|
"types": "dist/index.d.ts",
|
|
25
28
|
"dependencies": {
|
|
26
|
-
"@fraym/
|
|
27
|
-
"@graphql-tools/graphql-file-loader": "^7.5.
|
|
28
|
-
"@graphql-tools/load": "^7.8.
|
|
29
|
-
"@grpc/grpc-js": "^1.
|
|
30
|
-
"dotenv": "^16.
|
|
31
|
-
"graphql": "^16.
|
|
32
|
-
"yargs": "^17.7.
|
|
29
|
+
"@fraym/proto": "^0.3.0",
|
|
30
|
+
"@graphql-tools/graphql-file-loader": "^7.5.17",
|
|
31
|
+
"@graphql-tools/load": "^7.8.14",
|
|
32
|
+
"@grpc/grpc-js": "^1.9.7",
|
|
33
|
+
"dotenv": "^16.3.1",
|
|
34
|
+
"graphql": "^16.8.1",
|
|
35
|
+
"yargs": "^17.7.2"
|
|
33
36
|
},
|
|
34
37
|
"devDependencies": {
|
|
35
38
|
"@becklyn/prettier": "^1.0.2",
|
|
36
|
-
"@types/uuid": "^9.0.
|
|
37
|
-
"@types/yargs": "^17.0.
|
|
38
|
-
"prettier": "^2.8.
|
|
39
|
-
"typescript": "^5.
|
|
40
|
-
"uuid": "^9.0.
|
|
39
|
+
"@types/uuid": "^9.0.6",
|
|
40
|
+
"@types/yargs": "^17.0.29",
|
|
41
|
+
"prettier": "^2.8.8",
|
|
42
|
+
"typescript": "^5.2.2",
|
|
43
|
+
"uuid": "^9.0.1"
|
|
41
44
|
},
|
|
42
45
|
"prettier": "@becklyn/prettier"
|
|
43
46
|
}
|