remult 0.27.0 → 0.27.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.
@@ -303,6 +303,7 @@ export class RemultServerImplementation {
303
303
  else
304
304
  await this.runWithRemult(async (remult) => {
305
305
  if (req) {
306
+ remult.context.request = req;
306
307
  remultStatic.asyncContext.setInInitRequest(true);
307
308
  try {
308
309
  let user;
@@ -3,9 +3,10 @@ export const flags = {
3
3
  };
4
4
  /*y1 - https://github.com/remult/remult/discussions/438
5
5
  - https://github.com/remult/remult/blob/query-argumets/projects/tests/dbs/test-sql-database.spec.ts#L100-L128
6
+ //p2 - allow preprocess to replace filter values - for example replace $contains on a specific field, with specific other sql - useful for full text search and other scenarios
7
+ //y1 - consider sql expression gets a dbnames of it's own (that already has the "tableName" defined correctly) maybe also the filter translator
8
+ //y2 - soft-delete-discussion https://discord.com/channels/975754286384418847/1230386433093533698/1230386433093533698
6
9
  */
7
- //y1 - consider sql expression gets a dbnames of it's own (that already has the "tableName" defined correctly) maybe also the filter translator
8
- //y2 - soft-delete-discussion https://discord.com/channels/975754286384418847/1230386433093533698/1230386433093533698
9
10
  //p1 - fix query docs to also explain how it can be used for infinite scroll and pagination.
10
11
  //y1 - 'test expression columns without aliases'
11
12
  //y1 - live query update waits for last
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "remult",
3
- "version": "0.27.0",
3
+ "version": "0.27.1",
4
4
  "description": "A CRUD framework for full-stack TypeScript",
5
5
  "homepage": "https://remult.dev",
6
6
  "repository": {
@@ -590,6 +590,7 @@ var RemultServerImplementation = /** @class */ (function () {
590
590
  switch (_a.label) {
591
591
  case 0:
592
592
  if (!req) return [3 /*break*/, 8];
593
+ remult.context.request = req;
593
594
  remult_static_js_1.remultStatic.asyncContext.setInInitRequest(true);
594
595
  _a.label = 1;
595
596
  case 1:
package/src/context.d.ts CHANGED
@@ -83,7 +83,24 @@ export declare class Remult {
83
83
  apiClient: ApiClient;
84
84
  }
85
85
  export type GetArguments<T> = T extends (...args: infer FirstArgument) => any ? FirstArgument : never;
86
+ /**
87
+ * This type represents the context object available through `remult.context`
88
+ * It can be used to store custom information that will be available throughout the request lifecycle.
89
+ * @example
90
+ * remult.context.myCustomData = 'hello'
91
+ */
86
92
  export interface RemultContext {
93
+ /** When running on the backend as part of a request, will have the request object.
94
+ * You can type it to your specific type
95
+ * @example
96
+ * import type express from 'express'
97
+ * declare module 'remult' {
98
+ * export interface RemultContext {
99
+ * request?: express.Request
100
+ * }
101
+ * }
102
+ * */
103
+ request?: any;
87
104
  }
88
105
  /**
89
106
  * Interface for configuring the API client used by Remult to perform HTTP calls to the backend.
@@ -6,9 +6,10 @@ exports.flags = {
6
6
  };
7
7
  /*y1 - https://github.com/remult/remult/discussions/438
8
8
  - https://github.com/remult/remult/blob/query-argumets/projects/tests/dbs/test-sql-database.spec.ts#L100-L128
9
+ //p2 - allow preprocess to replace filter values - for example replace $contains on a specific field, with specific other sql - useful for full text search and other scenarios
10
+ //y1 - consider sql expression gets a dbnames of it's own (that already has the "tableName" defined correctly) maybe also the filter translator
11
+ //y2 - soft-delete-discussion https://discord.com/channels/975754286384418847/1230386433093533698/1230386433093533698
9
12
  */
10
- //y1 - consider sql expression gets a dbnames of it's own (that already has the "tableName" defined correctly) maybe also the filter translator
11
- //y2 - soft-delete-discussion https://discord.com/channels/975754286384418847/1230386433093533698/1230386433093533698
12
13
  //p1 - fix query docs to also explain how it can be used for infinite scroll and pagination.
13
14
  //y1 - 'test expression columns without aliases'
14
15
  //y1 - live query update waits for last