remult 0.25.5-exp.2 → 0.25.5-exp.21

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.
Files changed (46) hide show
  1. package/esm/graphql.js +87 -64
  2. package/esm/index.js +1 -0
  3. package/esm/package.json +1 -1
  4. package/esm/remult-fastify.js +3 -0
  5. package/esm/remult-hapi.js +3 -0
  6. package/esm/remult-knex/index.js +22 -5
  7. package/esm/remult-next.js +8 -0
  8. package/esm/remult-nuxt.js +3 -0
  9. package/esm/remult-sveltekit.js +63 -42
  10. package/esm/server/expressBridge.js +25 -0
  11. package/esm/server/get-remult-admin-html.js +3 -0
  12. package/esm/server/remult-admin.js +92 -0
  13. package/esm/src/remult-static.js +2 -1
  14. package/esm/src/remult3/Fields.js +7 -1
  15. package/esm/src/remult3/RepositoryImplementation.js +9 -5
  16. package/esm/src/remult3/remult3.js +47 -12
  17. package/esm/src/server-action.js +16 -11
  18. package/esm/src/sort.js +1 -1
  19. package/graphql.js +154 -99
  20. package/index.d.ts +1 -0
  21. package/index.js +3 -1
  22. package/internals.d.ts +1 -1
  23. package/package.json +1 -1
  24. package/remult-fastify.js +3 -0
  25. package/remult-hapi.js +3 -0
  26. package/remult-knex/index.js +73 -49
  27. package/remult-next.js +8 -0
  28. package/remult-nuxt.js +3 -0
  29. package/remult-sveltekit.d.ts +5 -1
  30. package/remult-sveltekit.js +85 -56
  31. package/server/expressBridge.d.ts +8 -0
  32. package/server/expressBridge.js +39 -0
  33. package/server/get-remult-admin-html.d.ts +1 -0
  34. package/server/get-remult-admin-html.js +7 -0
  35. package/server/remult-admin.d.ts +36 -0
  36. package/server/remult-admin.js +121 -0
  37. package/src/remult-static.js +2 -1
  38. package/src/remult3/Fields.d.ts +1 -0
  39. package/src/remult3/Fields.js +7 -1
  40. package/src/remult3/RepositoryImplementation.d.ts +9 -2
  41. package/src/remult3/RepositoryImplementation.js +9 -5
  42. package/src/remult3/remult3.js +47 -12
  43. package/src/remult3/repository-internals.d.ts +6 -0
  44. package/src/server-action.d.ts +2 -2
  45. package/src/server-action.js +16 -11
  46. package/src/sort.js +1 -1
@@ -15,6 +15,7 @@ var server_action_js_1 = require("../src/server-action.js");
15
15
  var server_action_info_js_1 = require("../src/server-action-info.js");
16
16
  var initDataProvider_js_1 = require("./initDataProvider.js");
17
17
  var remult_static_js_1 = require("../src/remult-static.js");
18
+ var remult_admin_js_1 = tslib_1.__importDefault(require("./remult-admin.js"));
18
19
  function createRemultServerCore(options, serverCoreOptions) {
19
20
  if (!options) {
20
21
  options = {};
@@ -328,6 +329,18 @@ var RemultServerImplementation = /** @class */ (function () {
328
329
  },
329
330
  doWork: undefined,
330
331
  }, r);
332
+ if (this.options.admin) {
333
+ r.route(this.options.rootPath + '/admin*').get(this.process(function (remult, req, res, orig, origResponse) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
334
+ return tslib_1.__generator(this, function (_a) {
335
+ origResponse.send((0, remult_admin_js_1.default)({
336
+ remult: remult,
337
+ entities: this.options.entities,
338
+ baseUrl: this.options.rootPath + '/admin',
339
+ }));
340
+ return [2 /*return*/];
341
+ });
342
+ }); }));
343
+ }
331
344
  if (this.options.subscriptionServer instanceof SseSubscriptionServer_js_1.SseSubscriptionServer) {
332
345
  var streamPath = this.options.rootPath + '/' + SubscriptionChannel_js_1.streamUrl;
333
346
  r.route(streamPath).get(this.process(function (remult, req, res, origReq, origRes) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
@@ -1212,6 +1225,7 @@ var RouteImplementation = /** @class */ (function () {
1212
1225
  function RouteImplementation(coreOptions) {
1213
1226
  this.coreOptions = coreOptions;
1214
1227
  this.map = new Map();
1228
+ this.starRoutes = [];
1215
1229
  }
1216
1230
  RouteImplementation.prototype.route = function (path) {
1217
1231
  //consider using:
@@ -1220,6 +1234,8 @@ var RouteImplementation = /** @class */ (function () {
1220
1234
  var r = path.toLowerCase();
1221
1235
  var m = new Map();
1222
1236
  this.map.set(r, m);
1237
+ if (path.endsWith('*'))
1238
+ this.starRoutes.push({ route: r.substring(0, r.length - 1), handler: m });
1223
1239
  var route = {
1224
1240
  get: function (h) {
1225
1241
  m.set('get', h);
@@ -1268,6 +1284,11 @@ var RouteImplementation = /** @class */ (function () {
1268
1284
  gRes.json(data);
1269
1285
  res({ statusCode: this.statusCode, data: data });
1270
1286
  };
1287
+ class_1.prototype.send = function (html) {
1288
+ if (gRes !== undefined)
1289
+ gRes.send(html);
1290
+ res({ statusCode: this.statusCode, html: html });
1291
+ };
1271
1292
  class_1.prototype.status = function (statusCode) {
1272
1293
  if (gRes !== undefined)
1273
1294
  gRes.status(statusCode);
@@ -1294,6 +1315,7 @@ var RouteImplementation = /** @class */ (function () {
1294
1315
  });
1295
1316
  };
1296
1317
  RouteImplementation.prototype.middleware = function (origReq, res, next) {
1318
+ var e_8, _a;
1297
1319
  var req = this.coreOptions.buildGenericRequestInfo(origReq);
1298
1320
  var theUrl = req.url;
1299
1321
  if (theUrl.startsWith('/'))
@@ -1320,6 +1342,23 @@ var RouteImplementation = /** @class */ (function () {
1320
1342
  }
1321
1343
  var lowerPath = path.toLowerCase();
1322
1344
  var m = this.map.get(lowerPath);
1345
+ if (!m)
1346
+ try {
1347
+ for (var _b = tslib_1.__values(this.starRoutes), _c = _b.next(); !_c.done; _c = _b.next()) {
1348
+ var route = _c.value;
1349
+ if (lowerPath.startsWith(route.route)) {
1350
+ m = route.handler;
1351
+ break;
1352
+ }
1353
+ }
1354
+ }
1355
+ catch (e_8_1) { e_8 = { error: e_8_1 }; }
1356
+ finally {
1357
+ try {
1358
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
1359
+ }
1360
+ finally { if (e_8) throw e_8.error; }
1361
+ }
1323
1362
  if (m) {
1324
1363
  var h = m.get(req.method.toLowerCase());
1325
1364
  if (h) {
@@ -0,0 +1 @@
1
+ export declare function getHtml(): string;