remult 0.20.0 → 0.20.1-exp.1
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/SseSubscriptionServer.d.ts +2 -0
- package/SseSubscriptionServer.js +3 -1
- package/esm/SseSubscriptionServer.d.ts +2 -0
- package/esm/SseSubscriptionServer.js +3 -1
- package/esm/server/expressBridge.js +1 -1
- package/esm/src/data-providers/rest-data-provider.js +7 -1
- package/package.json +1 -1
- package/server/expressBridge.js +1 -1
- package/src/data-providers/rest-data-provider.js +7 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
1
2
|
import { GenericResponse } from './server/index';
|
|
2
3
|
import { Remult } from './src/context';
|
|
3
4
|
import { SubscriptionServer } from './src/live-query/SubscriptionServer';
|
|
@@ -14,6 +15,7 @@ export interface ResponseRequiredForSSE {
|
|
|
14
15
|
export declare class clientConnection {
|
|
15
16
|
response: GenericResponse & ResponseRequiredForSSE;
|
|
16
17
|
channels: Record<string, boolean>;
|
|
18
|
+
timeOutRef: NodeJS.Timeout;
|
|
17
19
|
close(): void;
|
|
18
20
|
closed: boolean;
|
|
19
21
|
write(eventData: string, eventType?: string): void;
|
package/SseSubscriptionServer.js
CHANGED
|
@@ -118,6 +118,8 @@ var clientConnection = /** @class */ (function () {
|
|
|
118
118
|
this.sendLiveMessage();
|
|
119
119
|
}
|
|
120
120
|
clientConnection.prototype.close = function () {
|
|
121
|
+
if (this.timeOutRef)
|
|
122
|
+
clearTimeout(this.timeOutRef);
|
|
121
123
|
this.closed = true;
|
|
122
124
|
};
|
|
123
125
|
clientConnection.prototype.write = function (eventData, eventType) {
|
|
@@ -134,7 +136,7 @@ var clientConnection = /** @class */ (function () {
|
|
|
134
136
|
if (this.closed)
|
|
135
137
|
return;
|
|
136
138
|
this.write("", "keep-alive");
|
|
137
|
-
setTimeout(function () {
|
|
139
|
+
this.timeOutRef = setTimeout(function () {
|
|
138
140
|
_this.sendLiveMessage();
|
|
139
141
|
}, 45000);
|
|
140
142
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
1
2
|
import { GenericResponse } from './server/index';
|
|
2
3
|
import { Remult } from './src/context';
|
|
3
4
|
import { SubscriptionServer } from './src/live-query/SubscriptionServer';
|
|
@@ -14,6 +15,7 @@ export interface ResponseRequiredForSSE {
|
|
|
14
15
|
export declare class clientConnection {
|
|
15
16
|
response: GenericResponse & ResponseRequiredForSSE;
|
|
16
17
|
channels: Record<string, boolean>;
|
|
18
|
+
timeOutRef: NodeJS.Timeout;
|
|
17
19
|
close(): void;
|
|
18
20
|
closed: boolean;
|
|
19
21
|
write(eventData: string, eventType?: string): void;
|
|
@@ -81,6 +81,8 @@ export class clientConnection {
|
|
|
81
81
|
this.sendLiveMessage();
|
|
82
82
|
}
|
|
83
83
|
close() {
|
|
84
|
+
if (this.timeOutRef)
|
|
85
|
+
clearTimeout(this.timeOutRef);
|
|
84
86
|
this.closed = true;
|
|
85
87
|
}
|
|
86
88
|
write(eventData, eventType = "message") {
|
|
@@ -95,7 +97,7 @@ export class clientConnection {
|
|
|
95
97
|
if (this.closed)
|
|
96
98
|
return;
|
|
97
99
|
this.write("", "keep-alive");
|
|
98
|
-
setTimeout(() => {
|
|
100
|
+
this.timeOutRef = setTimeout(() => {
|
|
99
101
|
this.sendLiveMessage();
|
|
100
102
|
}, 45000);
|
|
101
103
|
}
|
|
@@ -740,7 +740,7 @@ export class EntityQueueStorage {
|
|
|
740
740
|
return this.sync = this.sync.then(() => what());
|
|
741
741
|
}
|
|
742
742
|
async getJobInfo(queuedJobId) {
|
|
743
|
-
let q = await this.repo.findId(queuedJobId);
|
|
743
|
+
let q = await this.repo.findId(queuedJobId, { useCache: false });
|
|
744
744
|
let lastProgress = undefined;
|
|
745
745
|
return {
|
|
746
746
|
userId: q.userId,
|
|
@@ -23,10 +23,13 @@ export class RestDataProvider {
|
|
|
23
23
|
}
|
|
24
24
|
//@internal
|
|
25
25
|
export function findOptionsToJson(options, meta) {
|
|
26
|
-
|
|
26
|
+
const r = {
|
|
27
27
|
...options,
|
|
28
28
|
where: Filter.entityFilterToJson(meta, options.where),
|
|
29
29
|
};
|
|
30
|
+
if (options.load)
|
|
31
|
+
r.load = options.load(meta.fields).map(y => y.key);
|
|
32
|
+
return r;
|
|
30
33
|
}
|
|
31
34
|
//@internal
|
|
32
35
|
export function findOptionsFromJson(json, meta) {
|
|
@@ -40,6 +43,9 @@ export function findOptionsFromJson(json, meta) {
|
|
|
40
43
|
r[key] = json[key];
|
|
41
44
|
}
|
|
42
45
|
}
|
|
46
|
+
if (json.load) {
|
|
47
|
+
r.load = (z) => json.load.map(y => z.find(y));
|
|
48
|
+
}
|
|
43
49
|
return r;
|
|
44
50
|
}
|
|
45
51
|
export class RestEntityDataProvider {
|
package/package.json
CHANGED
package/server/expressBridge.js
CHANGED
|
@@ -1099,7 +1099,7 @@ var EntityQueueStorage = /** @class */ (function () {
|
|
|
1099
1099
|
var _this = this;
|
|
1100
1100
|
return tslib_1.__generator(this, function (_a) {
|
|
1101
1101
|
switch (_a.label) {
|
|
1102
|
-
case 0: return [4 /*yield*/, this.repo.findId(queuedJobId)];
|
|
1102
|
+
case 0: return [4 /*yield*/, this.repo.findId(queuedJobId, { useCache: false })];
|
|
1103
1103
|
case 1:
|
|
1104
1104
|
q = _a.sent();
|
|
1105
1105
|
lastProgress = undefined;
|
|
@@ -35,7 +35,10 @@ var RestDataProvider = /** @class */ (function () {
|
|
|
35
35
|
exports.RestDataProvider = RestDataProvider;
|
|
36
36
|
//@internal
|
|
37
37
|
function findOptionsToJson(options, meta) {
|
|
38
|
-
|
|
38
|
+
var r = tslib_1.__assign(tslib_1.__assign({}, options), { where: filter_interfaces_1.Filter.entityFilterToJson(meta, options.where) });
|
|
39
|
+
if (options.load)
|
|
40
|
+
r.load = options.load(meta.fields).map(function (y) { return y.key; });
|
|
41
|
+
return r;
|
|
39
42
|
}
|
|
40
43
|
exports.findOptionsToJson = findOptionsToJson;
|
|
41
44
|
//@internal
|
|
@@ -61,6 +64,9 @@ function findOptionsFromJson(json, meta) {
|
|
|
61
64
|
}
|
|
62
65
|
finally { if (e_1) throw e_1.error; }
|
|
63
66
|
}
|
|
67
|
+
if (json.load) {
|
|
68
|
+
r.load = function (z) { return json.load.map(function (y) { return z.find(y); }); };
|
|
69
|
+
}
|
|
64
70
|
return r;
|
|
65
71
|
}
|
|
66
72
|
exports.findOptionsFromJson = findOptionsFromJson;
|