remult 0.18.1-exp.13 → 0.18.1-exp.15

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,8 +1,8 @@
1
1
  /// <reference types="node" />
2
- import type { GetServerSideProps, NextApiRequest, PreviewData } from 'next';
3
- import type { ParsedUrlQuery } from 'querystring';
4
- import { RemultServer, RemultServerOptions } from './server';
5
- export declare function remultNext(options?: RemultServerOptions<NextApiRequest>): RemultServer & {
2
+ import type { GetServerSideProps, NextApiRequest, PreviewData, NextApiHandler } from "next";
3
+ import type { ParsedUrlQuery } from "querystring";
4
+ import { RemultServer, RemultServerOptions } from "./server";
5
+ export declare function remultNext(options?: RemultServerOptions<NextApiRequest>): RemultServer & NextApiHandler & {
6
6
  getServerSideProps<P extends {
7
7
  [key: string]: any;
8
8
  } = {
@@ -1,8 +1,8 @@
1
- import { createRemultServer } from './server';
1
+ import { createRemultServer } from "./server";
2
2
  export function remultNext(options) {
3
3
  let result = createRemultServer(options);
4
- return Object.assign(result, {
5
- getServerSideProps: getServerPropsFunction => {
4
+ return Object.assign((req, res) => result.handle(req, res), result, {
5
+ getServerSideProps: (getServerPropsFunction) => {
6
6
  return (context) => {
7
7
  return new Promise((res, err) => {
8
8
  result.withRemult(context, undefined, async () => {
@@ -16,6 +16,6 @@ export function remultNext(options) {
16
16
  });
17
17
  });
18
18
  };
19
- },
19
+ }
20
20
  });
21
21
  }
@@ -54,7 +54,8 @@ export class LiveQueryPublisher {
54
54
  });
55
55
  query.lastIds = currentIds;
56
56
  await setData(query);
57
- this.subscriptionServer().publishMessage(q.id, messages);
57
+ if (messages.length > 0)
58
+ this.subscriptionServer().publishMessage(q.id, messages);
58
59
  });
59
60
  }));
60
61
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "remult",
3
- "version": "0.18.1-exp.13",
3
+ "version": "0.18.1-exp.15",
4
4
  "description": "A CRUD framework for full-stack TypeScript",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
package/remult-next.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  /// <reference types="node" />
2
- import type { GetServerSideProps, NextApiRequest, PreviewData } from 'next';
3
- import type { ParsedUrlQuery } from 'querystring';
4
- import { RemultServer, RemultServerOptions } from './server';
5
- export declare function remultNext(options?: RemultServerOptions<NextApiRequest>): RemultServer & {
2
+ import type { GetServerSideProps, NextApiRequest, PreviewData, NextApiHandler } from "next";
3
+ import type { ParsedUrlQuery } from "querystring";
4
+ import { RemultServer, RemultServerOptions } from "./server";
5
+ export declare function remultNext(options?: RemultServerOptions<NextApiRequest>): RemultServer & NextApiHandler & {
6
6
  getServerSideProps<P extends {
7
7
  [key: string]: any;
8
8
  } = {
package/remult-next.js CHANGED
@@ -6,7 +6,7 @@ var server_1 = require("./server");
6
6
  function remultNext(options) {
7
7
  var _this = this;
8
8
  var result = server_1.createRemultServer(options);
9
- return Object.assign(result, {
9
+ return Object.assign(function (req, res) { return result.handle(req, res); }, result, {
10
10
  getServerSideProps: function (getServerPropsFunction) {
11
11
  return function (context) {
12
12
  return new Promise(function (res, err) {
@@ -31,7 +31,7 @@ function remultNext(options) {
31
31
  }); });
32
32
  });
33
33
  };
34
- },
34
+ }
35
35
  });
36
36
  }
37
37
  exports.remultNext = remultNext;
@@ -101,7 +101,8 @@ var LiveQueryPublisher = /** @class */ (function () {
101
101
  return [4 /*yield*/, setData(query)];
102
102
  case 2:
103
103
  _e.sent();
104
- this.subscriptionServer().publishMessage(q.id, messages);
104
+ if (messages.length > 0)
105
+ this.subscriptionServer().publishMessage(q.id, messages);
105
106
  return [2 /*return*/];
106
107
  }
107
108
  });