@livequery/nestjs 1.0.33 → 1.0.34
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/build/index.d.ts +1 -1
- package/build/index.js +1 -1
- package/build/src/LivequeryInterceptor.d.ts +2 -0
- package/build/src/LivequeryInterceptor.js +3 -3
- package/build/src/LivequeryRequest.d.ts +0 -1
- package/build/src/LivequeryRequest.js +2 -3
- package/build/src/LivequeryResponse.d.ts +6 -2
- package/build/src/LivequeryResponse.js +2 -14
- package/package.json +1 -1
package/build/index.d.ts
CHANGED
package/build/index.js
CHANGED
|
@@ -11,7 +11,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
__exportStar(require("./src/LivequeryRequest"), exports);
|
|
14
|
+
__exportStar(require("./src/LivequeryResponse"), exports);
|
|
14
15
|
__exportStar(require("./src/LivequeryInterceptor"), exports);
|
|
15
16
|
__exportStar(require("./src/LivequeryWebsocketSync"), exports);
|
|
16
17
|
__exportStar(require("./src/PathHelper"), exports);
|
|
17
|
-
__exportStar(require("./src/UseDatasource"), exports);
|
|
@@ -5,6 +5,8 @@ export declare class LivequeryInterceptor implements NestInterceptor {
|
|
|
5
5
|
constructor(LivequeryWebsocketSync?: LivequeryWebsocketSync);
|
|
6
6
|
intercept(context: ExecutionContext, next: CallHandler): import("rxjs").Observable<{
|
|
7
7
|
data: any;
|
|
8
|
+
} | {
|
|
9
|
+
error: any;
|
|
8
10
|
}>;
|
|
9
11
|
}
|
|
10
12
|
export declare const UseLivequeryInterceptor: () => MethodDecorator & ClassDecorator;
|
|
@@ -15,8 +15,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
15
15
|
exports.UseLivequeryInterceptor = exports.LivequeryInterceptor = void 0;
|
|
16
16
|
const common_1 = require("@nestjs/common");
|
|
17
17
|
const LivequeryWebsocketSync_1 = require("./LivequeryWebsocketSync");
|
|
18
|
+
const rxjs_1 = require("rxjs");
|
|
18
19
|
const operators_1 = require("rxjs/operators");
|
|
19
|
-
const LivequeryRequest_1 = require("./LivequeryRequest");
|
|
20
20
|
const PathHelper_1 = require("./PathHelper");
|
|
21
21
|
let LivequeryInterceptor = class LivequeryInterceptor {
|
|
22
22
|
LivequeryWebsocketSync;
|
|
@@ -39,7 +39,7 @@ let LivequeryInterceptor = class LivequeryInterceptor {
|
|
|
39
39
|
});
|
|
40
40
|
const { ref, is_collection, collection_ref, doc_id, } = PathHelper_1.PathHelper.livequeryPathExtractor(req._parsedUrl.pathname);
|
|
41
41
|
const { collection_ref: schema_collection_ref } = PathHelper_1.PathHelper.livequeryPathExtractor(req.route.path);
|
|
42
|
-
req
|
|
42
|
+
req.livequery = {
|
|
43
43
|
ref,
|
|
44
44
|
collection_ref,
|
|
45
45
|
schema_collection_ref,
|
|
@@ -59,7 +59,7 @@ let LivequeryInterceptor = class LivequeryInterceptor {
|
|
|
59
59
|
};
|
|
60
60
|
const socket_id = req.headers.socket_id;
|
|
61
61
|
socket_id && this.LivequeryWebsocketSync?.listen(socket_id, collection_ref, doc_id);
|
|
62
|
-
return next.handle().pipe((0, operators_1.map)(data => ({ data })));
|
|
62
|
+
return next.handle().pipe((0, operators_1.map)(data => ({ data })), (0, operators_1.catchError)(error => (0, rxjs_1.of)({ error })));
|
|
63
63
|
}
|
|
64
64
|
};
|
|
65
65
|
LivequeryInterceptor = __decorate([
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LivequeryRequest =
|
|
3
|
+
exports.LivequeryRequest = void 0;
|
|
4
4
|
const common_1 = require("@nestjs/common");
|
|
5
|
-
exports.LivequeryRequestKey = Symbol();
|
|
6
5
|
exports.LivequeryRequest = (0, common_1.createParamDecorator)((data, ctx) => {
|
|
7
6
|
const request = ctx.switchToHttp().getRequest();
|
|
8
|
-
return request
|
|
7
|
+
return request.livequery;
|
|
9
8
|
});
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
export declare type LivequeryResponse<T = any> = {
|
|
2
|
+
items: T[];
|
|
3
|
+
page_info?: {
|
|
4
|
+
has_more: boolean;
|
|
5
|
+
};
|
|
6
|
+
};
|
|
2
7
|
export declare const LivequeryResponse: (...dataOrPipes: unknown[]) => ParameterDecorator;
|
|
3
|
-
export declare const createLivequeryResponse: <T>(items: T[]) => QueryData<T>;
|
|
@@ -1,17 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.LivequeryResponse = void 0;
|
|
4
4
|
const common_1 = require("@nestjs/common");
|
|
5
|
-
exports.LivequeryResponse = common_1.createParamDecorator((data, ctx) =>
|
|
6
|
-
const request = ctx.switchToHttp().getRequest();
|
|
7
|
-
return request.__livequery_response;
|
|
8
|
-
});
|
|
9
|
-
const createLivequeryResponse = (items) => {
|
|
10
|
-
return {
|
|
11
|
-
data: {
|
|
12
|
-
items
|
|
13
|
-
},
|
|
14
|
-
error: null
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
exports.createLivequeryResponse = createLivequeryResponse;
|
|
5
|
+
exports.LivequeryResponse = (0, common_1.createParamDecorator)((data, ctx) => ctx.switchToHttp().getRequest().livequery_response);
|