@modular-rest/server 1.12.2 → 1.13.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.
@@ -23,7 +23,7 @@ interface CollectionDefinitionOptions {
23
23
  * @type {Schema}
24
24
  * @see https://mongoosejs.com/docs/5.x/docs/guide.html
25
25
  */
26
- schema: Schema;
26
+ schema: Schema<any>;
27
27
  }
28
28
  /**
29
29
  * To have define any collection in your database you haveto use below method in your `db.[js|ts]` file and export an array of CollectionDefinition instances.
@@ -94,7 +94,7 @@ export declare class CollectionDefinition {
94
94
  /** @readonly The name of the collection */
95
95
  collection: string;
96
96
  /** @readonly Mongoose schema definition */
97
- schema: Schema;
97
+ schema: Schema<any>;
98
98
  /** @readonly List of permissions for the collection */
99
99
  permissions: Permission[];
100
100
  /** @readonly Optional database triggers */
@@ -102,7 +102,7 @@ class User {
102
102
  static loadFromModel(model) {
103
103
  return new Promise((done, reject) => {
104
104
  // check required fields
105
- const isValidData = (0, validator_1.validator)(model, 'fullname email password permission');
105
+ const isValidData = (0, validator_1.validator)(model, '_id permissionGroup');
106
106
  if (!isValidData.isValid) {
107
107
  return reject(User.notValid(model));
108
108
  }
package/dist/config.d.ts CHANGED
@@ -8,7 +8,7 @@ import { Options as KoaStaticOptionsBase } from 'koa-static';
8
8
  /**
9
9
  * The options for the static file server, it's a combination of modular-rest and [koa-static options](https://github.com/koajs/static?tab=readme-ov-file#options)
10
10
  */
11
- export interface StaticPathOptions extends KoaStaticOptionsBase {
11
+ export type StaticPathOptions = KoaStaticOptionsBase & {
12
12
  /**
13
13
  * The actual path of the static files on your server
14
14
  */
@@ -17,7 +17,7 @@ export interface StaticPathOptions extends KoaStaticOptionsBase {
17
17
  * The path you want to serve the static files from
18
18
  */
19
19
  path: string;
20
- }
20
+ };
21
21
  /**
22
22
  * JWT keypair configuration
23
23
  * @interface KeyPair
@@ -33,12 +33,10 @@ interface KeyPair {
33
33
  * @interface MongoOptions
34
34
  * @property {string} dbPrefix - Prefix for database names
35
35
  * @property {string} mongoBaseAddress - MongoDB connection URL
36
- * @property {string} [addressMap] - Optional address mapping configuration
37
36
  */
38
37
  interface MongoOptions {
39
38
  dbPrefix: string;
40
39
  mongoBaseAddress: string;
41
- addressMap?: string;
42
40
  }
43
41
  /**
44
42
  * Admin user configuration
@@ -1,2 +1,2 @@
1
- import { PermissionGroup } from './index';
1
+ import { PermissionGroup } from './class/security';
2
2
  export declare const permissionGroups: PermissionGroup[];
@@ -1,14 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.permissionGroups = void 0;
4
- const index_1 = require("./index");
4
+ const security_1 = require("./class/security");
5
5
  exports.permissionGroups = [
6
- new index_1.PermissionGroup({
6
+ new security_1.PermissionGroup({
7
7
  title: 'anonymous',
8
8
  isAnonymous: true,
9
9
  allowedAccessTypes: ['anonymous_access'],
10
10
  }),
11
- new index_1.PermissionGroup({
11
+ new security_1.PermissionGroup({
12
12
  title: 'end-user',
13
13
  isDefault: true,
14
14
  allowedAccessTypes: [
@@ -18,7 +18,7 @@ exports.permissionGroups = [
18
18
  'remove_file_access',
19
19
  ],
20
20
  }),
21
- new index_1.PermissionGroup({
21
+ new security_1.PermissionGroup({
22
22
  title: 'administrator',
23
23
  allowedAccessTypes: [
24
24
  'user_access',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modular-rest/server",
3
- "version": "1.12.2",
3
+ "version": "1.13.1",
4
4
  "description": "TypeScript version of a nodejs module based on KOAJS for developing Rest-APIs in a modular solution.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -25,7 +25,7 @@ interface CollectionDefinitionOptions {
25
25
  * @type {Schema}
26
26
  * @see https://mongoosejs.com/docs/5.x/docs/guide.html
27
27
  */
28
- schema: Schema;
28
+ schema: Schema<any>;
29
29
  }
30
30
 
31
31
  /**
@@ -102,7 +102,7 @@ export class CollectionDefinition {
102
102
  collection: string;
103
103
 
104
104
  /** @readonly Mongoose schema definition */
105
- schema: Schema;
105
+ schema: Schema<any>;
106
106
 
107
107
  /** @readonly List of permissions for the collection */
108
108
  permissions: Permission[];
package/src/class/user.ts CHANGED
@@ -146,7 +146,7 @@ export class User {
146
146
  static loadFromModel(model: any): Promise<User> {
147
147
  return new Promise((done, reject) => {
148
148
  // check required fields
149
- const isValidData = validateObject(model, 'fullname email password permission');
149
+ const isValidData = validateObject(model, '_id permissionGroup');
150
150
 
151
151
  if (!isValidData.isValid) {
152
152
  return reject(User.notValid(model));
package/src/config.ts CHANGED
@@ -10,7 +10,7 @@ import { Options as KoaStaticOptionsBase } from 'koa-static';
10
10
  /**
11
11
  * The options for the static file server, it's a combination of modular-rest and [koa-static options](https://github.com/koajs/static?tab=readme-ov-file#options)
12
12
  */
13
- export interface StaticPathOptions extends KoaStaticOptionsBase {
13
+ export type StaticPathOptions = KoaStaticOptionsBase & {
14
14
  /**
15
15
  * The actual path of the static files on your server
16
16
  */
@@ -19,7 +19,7 @@ export interface StaticPathOptions extends KoaStaticOptionsBase {
19
19
  * The path you want to serve the static files from
20
20
  */
21
21
  path: string;
22
- }
22
+ };
23
23
 
24
24
  /**
25
25
  * JWT keypair configuration
@@ -37,12 +37,10 @@ interface KeyPair {
37
37
  * @interface MongoOptions
38
38
  * @property {string} dbPrefix - Prefix for database names
39
39
  * @property {string} mongoBaseAddress - MongoDB connection URL
40
- * @property {string} [addressMap] - Optional address mapping configuration
41
40
  */
42
41
  interface MongoOptions {
43
42
  dbPrefix: string;
44
43
  mongoBaseAddress: string;
45
- addressMap?: string;
46
44
  }
47
45
 
48
46
  /**
@@ -1,4 +1,4 @@
1
- import { PermissionGroup } from './index';
1
+ import { PermissionGroup } from './class/security';
2
2
 
3
3
  export const permissionGroups = [
4
4
  new PermissionGroup({
package/typedoc.mjs CHANGED
@@ -3,8 +3,8 @@ export default {
3
3
 
4
4
  disableSources: true,
5
5
  excludeProtected: true,
6
- excludeInternal: true,
7
- excludePrivate: true,
6
+ excludeInternal: false,
7
+ excludePrivate: false,
8
8
  excludeExternals: true,
9
9
 
10
10
  //