remult 2.7.29 → 2.7.30

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.
@@ -3,9 +3,11 @@ import { Filter } from '../src/filter/filter-interfaces.js';
3
3
  import { getHtml } from './get-remult-admin-html.js';
4
4
  import { getValueList } from '../src/remult3/RepositoryImplementation.js';
5
5
  export default function remultAdminHtml(options) {
6
- let { remult, entities, ...optionsFromServer } = { ...options };
7
- return getHtml().replace('<!--PLACE_HERE-->', `<script>
8
- const optionsFromServer = ${JSON.stringify(optionsFromServer)}
6
+ const { rootPath, head } = options;
7
+ return getHtml()
8
+ .replace('<!--PLACE_HERE_HEAD-->', head)
9
+ .replace('<!--PLACE_HERE_BODY-->', `<script>
10
+ window.optionsFromServer = ${JSON.stringify({ rootPath })}
9
11
  </script>`);
10
12
  }
11
13
  export function buildEntityInfo(options) {
@@ -59,6 +61,8 @@ export function buildEntityInfo(options) {
59
61
  ...relInfo,
60
62
  where,
61
63
  entityKey: relRepo.metadata.key,
64
+ key: x.key,
65
+ caption: x.caption,
62
66
  });
63
67
  }
64
68
  continue;
@@ -204,7 +204,10 @@ export class RemultServerImplementation {
204
204
  }, r);
205
205
  if (this.options.admin !== undefined && this.options.admin !== false) {
206
206
  const admin = () => this.process(async (remult, req, res, orig, origResponse) => {
207
- if (remult.isAllowed(this.options.admin)) {
207
+ const allowed = isOfType(this.options.admin, 'allow')
208
+ ? this.options.admin.allow
209
+ : this.options.admin;
210
+ if (remult.isAllowed(allowed)) {
208
211
  if (orig?.params?.id === '__entities-metadata') {
209
212
  res.success(buildEntityInfo({
210
213
  remult,
@@ -212,10 +215,14 @@ export class RemultServerImplementation {
212
215
  }));
213
216
  }
214
217
  else {
218
+ let head = '<title>Admin</title>';
219
+ if (isOfType(this.options.admin, 'allow') &&
220
+ this.options.admin.customHtmlHead) {
221
+ head = this.options.admin.customHtmlHead(remult);
222
+ }
215
223
  origResponse.send(remultAdminHtml({
216
- remult: remult,
217
- entities: this.options.entities,
218
- baseUrl: this.options.rootPath + '/admin',
224
+ rootPath: this.options.rootPath ?? '/api',
225
+ head,
219
226
  }));
220
227
  }
221
228
  }
@@ -720,8 +720,13 @@ export function buildFilterFromRequestParameters(entity, filterInfo) {
720
720
  }),
721
721
  });
722
722
  }
723
- if (not.length == 1 && !where.$not) {
724
- where = not[0];
723
+ if (not.length == 1) {
724
+ if (!where.$not) {
725
+ where.$not = not[0].$not;
726
+ }
727
+ else {
728
+ where.$not.push(not[0].$not);
729
+ }
725
730
  }
726
731
  else {
727
732
  addAnd({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "remult",
3
- "version": "2.7.29",
3
+ "version": "2.7.30",
4
4
  "description": "A CRUD framework for full-stack TypeScript",
5
5
  "homepage": "https://remult.dev",
6
6
  "repository": {