manifest 4.10.1 → 4.11.0

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 (144) hide show
  1. package/dist/common/src/Helpers.d.ts +16 -0
  2. package/dist/common/src/base-classes/BaseSdk.d.ts +14 -0
  3. package/dist/common/src/base-classes/index.d.ts +1 -0
  4. package/dist/common/src/index.d.ts +2 -0
  5. package/dist/json-schema/src/index.d.ts +98 -0
  6. package/dist/manifest/src/app.module.d.ts +7 -0
  7. package/dist/manifest/src/app.module.js +15 -7
  8. package/dist/manifest/src/auth/auth.controller.d.ts +21 -0
  9. package/dist/manifest/src/auth/auth.module.d.ts +2 -0
  10. package/dist/manifest/src/auth/auth.service.d.ts +31 -0
  11. package/dist/manifest/src/auth/dtos/signup-authenticable-entity.dto.d.ts +4 -0
  12. package/dist/manifest/src/auth/guards/is-admin.guard.d.ts +7 -0
  13. package/dist/manifest/src/auth/guards/is-db-empty.guard.d.ts +7 -0
  14. package/dist/manifest/src/config/database.d.ts +11 -0
  15. package/dist/manifest/src/config/database.js +47 -22
  16. package/dist/manifest/src/config/general.d.ts +8 -0
  17. package/dist/manifest/src/config/paths.d.ts +9 -0
  18. package/dist/manifest/src/config/storage.d.ts +10 -0
  19. package/dist/manifest/src/constants.d.ts +25 -0
  20. package/dist/manifest/src/crud/controllers/collection.controller.d.ts +22 -0
  21. package/dist/manifest/src/crud/controllers/database.controller.d.ts +8 -0
  22. package/dist/manifest/src/crud/controllers/single.controller.d.ts +12 -0
  23. package/dist/manifest/src/crud/crud.module.d.ts +2 -0
  24. package/dist/manifest/src/crud/guards/is-collection.guard.d.ts +7 -0
  25. package/dist/manifest/src/crud/guards/is-single.guard.d.ts +7 -0
  26. package/dist/manifest/src/crud/services/crud.service.d.ts +54 -0
  27. package/dist/manifest/src/crud/services/database.service.d.ts +8 -0
  28. package/dist/manifest/src/crud/services/pagination.service.d.ts +9 -0
  29. package/dist/manifest/src/endpoint/endpoint.controller.d.ts +12 -0
  30. package/dist/manifest/src/endpoint/endpoint.module.d.ts +4 -0
  31. package/dist/manifest/src/endpoint/endpoint.service.d.ts +17 -0
  32. package/dist/manifest/src/endpoint/middlewares/match-endpoint.middleware.d.ts +10 -0
  33. package/dist/manifest/src/entity/columns/mysql-prop-type-column-types.d.ts +3 -0
  34. package/dist/manifest/src/entity/columns/mysql-prop-type-column-types.js +21 -0
  35. package/dist/manifest/src/entity/columns/postgres-prop-type-column-types copy.d.ts +3 -0
  36. package/dist/manifest/src/entity/columns/sqlite-prop-type-column-types.d.ts +3 -0
  37. package/dist/manifest/src/entity/entity.module.d.ts +2 -0
  38. package/dist/manifest/src/entity/entity.module.js +7 -1
  39. package/dist/manifest/src/entity/services/column.service.d.ts +6 -0
  40. package/dist/manifest/src/entity/services/column.service.js +37 -0
  41. package/dist/manifest/src/entity/services/entity-loader.service.d.ts +16 -0
  42. package/dist/manifest/src/entity/services/entity-loader.service.js +74 -18
  43. package/dist/manifest/src/entity/services/entity.service.d.ts +18 -0
  44. package/dist/manifest/src/entity/services/relationship.service.d.ts +22 -0
  45. package/dist/manifest/src/entity/transformers/boolean-transformer.d.ts +8 -0
  46. package/dist/manifest/src/entity/transformers/boolean-transformer.js +21 -0
  47. package/dist/manifest/src/entity/transformers/number-transformer.d.ts +5 -0
  48. package/dist/manifest/src/entity/transformers/number-transformer.js +12 -0
  49. package/dist/manifest/src/entity/transformers/timestamp-transformer.d.ts +5 -0
  50. package/dist/manifest/src/entity/transformers/timestamp-transformer.js +12 -0
  51. package/dist/manifest/src/event/crud-events.d.ts +8 -0
  52. package/dist/manifest/src/event/event.module.d.ts +2 -0
  53. package/dist/manifest/src/event/event.service.d.ts +6 -0
  54. package/dist/manifest/src/handler/handler.module.d.ts +2 -0
  55. package/dist/manifest/src/handler/handler.service.d.ts +15 -0
  56. package/dist/manifest/src/health/health.controller.d.ts +5 -0
  57. package/dist/manifest/src/health/health.module.d.ts +2 -0
  58. package/dist/manifest/src/hook/hook.interceptor.d.ts +12 -0
  59. package/dist/manifest/src/hook/hook.module.d.ts +2 -0
  60. package/dist/manifest/src/hook/hook.service.d.ts +5 -0
  61. package/dist/manifest/src/logger/logger.module.d.ts +2 -0
  62. package/dist/manifest/src/logger/logger.service.d.ts +6 -0
  63. package/dist/manifest/src/main.d.ts +1 -0
  64. package/dist/manifest/src/manifest/controllers/manifest.controller.d.ts +13 -0
  65. package/dist/manifest/src/manifest/manifest.module.d.ts +2 -0
  66. package/dist/manifest/src/manifest/services/entity-manifest.service.d.ts +29 -0
  67. package/dist/manifest/src/manifest/services/manifest.service.d.ts +20 -0
  68. package/dist/manifest/src/manifest/services/relationship-manifest.service.d.ts +6 -0
  69. package/dist/manifest/src/manifest/services/schema.service.d.ts +6 -0
  70. package/dist/manifest/src/manifest/services/yaml.service.d.ts +7 -0
  71. package/dist/manifest/src/middleware/middleware.interceptor.d.ts +12 -0
  72. package/dist/manifest/src/middleware/middleware.module.d.ts +2 -0
  73. package/dist/manifest/src/open-api/open-api.module.d.ts +2 -0
  74. package/dist/manifest/src/open-api/services/open-api-auth.service.d.ts +6 -0
  75. package/dist/manifest/src/open-api/services/open-api-crud.service.d.ts +12 -0
  76. package/dist/manifest/src/open-api/services/open-api-manifest.service.d.ts +6 -0
  77. package/dist/manifest/src/open-api/services/open-api.endpoint.service.d.ts +7 -0
  78. package/dist/manifest/src/open-api/services/open-api.service.d.ts +15 -0
  79. package/dist/manifest/src/open-api/utils/common-response.utils.d.ts +26 -0
  80. package/dist/manifest/src/policy/decorators/rule.decorator.d.ts +2 -0
  81. package/dist/manifest/src/policy/policies.d.ts +4 -0
  82. package/dist/manifest/src/policy/policy.guard.d.ts +12 -0
  83. package/dist/manifest/src/policy/policy.module.d.ts +2 -0
  84. package/dist/manifest/src/policy/policy.service.d.ts +4 -0
  85. package/dist/manifest/src/policy/types/rule.type.d.ts +1 -0
  86. package/dist/manifest/src/sdk/backend-sdk.d.ts +33 -0
  87. package/dist/manifest/src/sdk/sdk.module.d.ts +2 -0
  88. package/dist/manifest/src/seed/scripts/seed.d.ts +1 -0
  89. package/dist/manifest/src/seed/seed.module.d.ts +2 -0
  90. package/dist/manifest/src/seed/services/seeder.service.d.ts +30 -0
  91. package/dist/manifest/src/seed/services/seeder.service.js +92 -94
  92. package/dist/manifest/src/storage/services/storage.service.d.ts +27 -0
  93. package/dist/manifest/src/storage/storage.module.d.ts +2 -0
  94. package/dist/manifest/src/upload/controllers/upload.controller.d.ts +11 -0
  95. package/dist/manifest/src/upload/services/upload.service.d.ts +25 -0
  96. package/dist/manifest/src/upload/upload.module.d.ts +2 -0
  97. package/dist/manifest/src/validation/records/custom-validators.d.ts +2 -0
  98. package/dist/manifest/src/validation/records/type-validators.d.ts +2 -0
  99. package/dist/manifest/src/validation/services/validation.service.d.ts +8 -0
  100. package/dist/manifest/src/validation/validation.module.d.ts +2 -0
  101. package/dist/types/src/common/HttpMethod.d.ts +1 -0
  102. package/dist/types/src/common/index.d.ts +1 -0
  103. package/dist/types/src/config/DatabaseConnection.d.ts +1 -0
  104. package/dist/types/src/config/DatabaseConnection.js +2 -0
  105. package/dist/types/src/config/index.d.ts +1 -0
  106. package/dist/types/src/config/index.js +17 -0
  107. package/dist/types/src/crud/AccessPolicy.d.ts +1 -0
  108. package/dist/types/src/crud/AuthenticableEntity.d.ts +5 -0
  109. package/dist/types/src/crud/BaseEntity.d.ts +6 -0
  110. package/dist/types/src/crud/CrudEventName.d.ts +2 -0
  111. package/dist/types/src/crud/Paginator.d.ts +9 -0
  112. package/dist/types/src/crud/PropType.d.ts +17 -0
  113. package/dist/types/src/crud/SelectOption.d.ts +5 -0
  114. package/dist/types/src/crud/index.d.ts +7 -0
  115. package/dist/types/src/endpoints/EndpointManifest.d.ts +10 -0
  116. package/dist/types/src/endpoints/index.d.ts +1 -0
  117. package/dist/types/src/hooks/HookManifest.d.ts +12 -0
  118. package/dist/types/src/hooks/HookType.d.ts +1 -0
  119. package/dist/types/src/hooks/WebhookPayload.d.ts +7 -0
  120. package/dist/types/src/hooks/index.d.ts +3 -0
  121. package/dist/types/src/index.d.ts +9 -0
  122. package/dist/types/src/index.js +1 -0
  123. package/dist/types/src/manifests/AppManifest.d.ts +11 -0
  124. package/dist/types/src/manifests/EntityManifest.d.ts +40 -0
  125. package/dist/types/src/manifests/EntityManifestCommonFields.d.ts +3 -0
  126. package/dist/types/src/manifests/ManifestSchema.d.ts +150 -0
  127. package/dist/types/src/manifests/PolicyManifest.d.ts +5 -0
  128. package/dist/types/src/manifests/PropertyManifest.d.ts +10 -0
  129. package/dist/types/src/manifests/RelationshipManifest.d.ts +8 -0
  130. package/dist/types/src/manifests/ValidationManifest.d.ts +4 -0
  131. package/dist/types/src/manifests/index.d.ts +8 -0
  132. package/dist/types/src/middlewares/MiddlewareManifest.d.ts +3 -0
  133. package/dist/types/src/middlewares/index.d.ts +1 -0
  134. package/dist/types/src/props/ImageSizesObject.d.ts +7 -0
  135. package/dist/types/src/props/index.d.ts +1 -0
  136. package/dist/types/src/queries/WhereKeySuffix.d.ts +10 -0
  137. package/dist/types/src/queries/WhereOperator.d.ts +10 -0
  138. package/dist/types/src/queries/WhereOperatorKeySuffixRecord.d.ts +3 -0
  139. package/dist/types/src/queries/index.d.ts +3 -0
  140. package/package.json +6 -1
  141. package/dist/manifest/src/entity/core-entities/base-authenticable-entity.js +0 -14
  142. package/dist/manifest/src/entity/core-entities/base-entity.js +0 -22
  143. /package/dist/manifest/src/entity/{records → columns}/postgres-prop-type-column-types copy.js +0 -0
  144. /package/dist/manifest/src/entity/{records → columns}/sqlite-prop-type-column-types.js +0 -0
@@ -0,0 +1,16 @@
1
+ import { ImageSizesObject, RelationshipManifest } from '@repo/types';
2
+ export declare function getRecordKeyByValue<T extends Record<string, string>, V extends T[keyof T]>(record: T, value: V): string | undefined;
3
+ export declare function camelize(str: string | string[]): string;
4
+ export declare function kebabize(str: string): string;
5
+ export declare function lowerCaseFirstLetter(str: string): string;
6
+ export declare function upperCaseFirstLetter(str: string): string;
7
+ export declare function getRandomIntExcluding({ min, max, exclude }: {
8
+ min: number;
9
+ max: number;
10
+ exclude?: number[];
11
+ }): number;
12
+ export declare function getDtoPropertyNameFromRelationship(relationship: RelationshipManifest): string;
13
+ export declare function getRelationshipNameFromDtoPropertyName(propertyName: string): string;
14
+ export declare function forceNumberArray(value: string | number | number[] | string[]): number[];
15
+ export declare function getSmallestImageSize(imageSizesObject: ImageSizesObject): string;
16
+ export declare function base64ToBlob(base64: string, contentType: string): Blob;
@@ -0,0 +1,14 @@
1
+ export declare class BaseSDK {
2
+ slug: string;
3
+ isSingleEntity: boolean;
4
+ queryParams: {
5
+ [key: string]: string;
6
+ };
7
+ from(slug: string): this;
8
+ where(whereClause: string): this;
9
+ andWhere(whereClause: string): this;
10
+ orderBy(propName: string, order?: {
11
+ desc: boolean;
12
+ }): this;
13
+ with(relations: string[]): this;
14
+ }
@@ -0,0 +1 @@
1
+ export * from './BaseSdk';
@@ -0,0 +1,2 @@
1
+ export * from './Helpers';
2
+ export * from './base-classes';
@@ -0,0 +1,98 @@
1
+ declare const _default: ({
2
+ $schema: string;
3
+ $id: string;
4
+ title: string;
5
+ description: string;
6
+ type: string;
7
+ properties: {};
8
+ } | {
9
+ $schema: string;
10
+ $id: string;
11
+ title: string;
12
+ description: string;
13
+ anyOf: ({
14
+ type: string;
15
+ properties: {
16
+ name: {
17
+ description: string;
18
+ type: string;
19
+ };
20
+ type: {
21
+ description: string;
22
+ type: string;
23
+ enum: string[];
24
+ };
25
+ validation: {
26
+ description: string;
27
+ $ref: string;
28
+ };
29
+ default: {
30
+ description: string;
31
+ type: string[];
32
+ };
33
+ hidden: {
34
+ description: string;
35
+ type: string;
36
+ };
37
+ options: {
38
+ allOf: {
39
+ $ref: string;
40
+ }[];
41
+ oneOf: {
42
+ if: {
43
+ type: string;
44
+ properties: {
45
+ type: {
46
+ const: string;
47
+ };
48
+ };
49
+ };
50
+ then: {
51
+ $ref: string;
52
+ };
53
+ }[];
54
+ };
55
+ };
56
+ required: string[];
57
+ additionalProperties: boolean;
58
+ description?: undefined;
59
+ } | {
60
+ type: string;
61
+ description: string;
62
+ properties?: undefined;
63
+ required?: undefined;
64
+ additionalProperties?: undefined;
65
+ })[];
66
+ } | {
67
+ $schema: string;
68
+ $id: string;
69
+ title: string;
70
+ description: string;
71
+ anyOf: ({
72
+ type: string;
73
+ properties: {
74
+ name: {
75
+ type: string;
76
+ description: string;
77
+ };
78
+ entity: {
79
+ type: string;
80
+ description: string;
81
+ };
82
+ eager: {
83
+ type: string;
84
+ description: string;
85
+ };
86
+ };
87
+ required: string[];
88
+ additionalProperties: boolean;
89
+ description?: undefined;
90
+ } | {
91
+ type: string;
92
+ description: string;
93
+ properties?: undefined;
94
+ required?: undefined;
95
+ additionalProperties?: undefined;
96
+ })[];
97
+ })[];
98
+ export default _default;
@@ -0,0 +1,7 @@
1
+ import { LoggerService } from './logger/logger.service';
2
+ export declare class AppModule {
3
+ private loggerService;
4
+ constructor(loggerService: LoggerService);
5
+ onModuleInit(): Promise<void>;
6
+ private init;
7
+ }
@@ -68,16 +68,24 @@ exports.AppModule = AppModule = __decorate([
68
68
  typeorm_1.TypeOrmModule.forRootAsync({
69
69
  imports: [config_1.ConfigModule, entity_module_1.EntityModule, manifest_module_1.ManifestModule],
70
70
  useFactory: async (configService, entityLoaderService, manifestService) => {
71
- const isPostgres = configService.get('DB_CONNECTION') === 'postgres';
71
+ let dbConnection;
72
72
  let databaseConfig;
73
- if (isPostgres) {
74
- databaseConfig = configService.get('database').postgres;
75
- }
76
- else {
77
- databaseConfig = configService.get('database').sqlite;
73
+ switch (configService.get('DB_CONNECTION')) {
74
+ case 'postgres':
75
+ dbConnection = 'postgres';
76
+ databaseConfig = configService.get('database').postgres;
77
+ break;
78
+ case 'mysql':
79
+ dbConnection = 'mysql';
80
+ databaseConfig = configService.get('database').mysql;
81
+ break;
82
+ default:
83
+ dbConnection = 'sqlite';
84
+ databaseConfig = configService.get('database').sqlite;
85
+ break;
78
86
  }
79
87
  await manifestService.loadManifest(configService.get('paths').manifestFile);
80
- const entities = entityLoaderService.loadEntities(isPostgres);
88
+ const entities = entityLoaderService.loadEntities(dbConnection);
81
89
  return Object.assign(databaseConfig, { entities });
82
90
  },
83
91
  inject: [config_1.ConfigService, entity_loader_service_1.EntityLoaderService, manifest_service_1.ManifestService]
@@ -0,0 +1,21 @@
1
+ import { AuthenticableEntity } from '@repo/types';
2
+ import { Request } from 'express';
3
+ import { AuthService } from './auth.service';
4
+ import { SignupAuthenticableEntityDto } from './dtos/signup-authenticable-entity.dto';
5
+ export declare class AuthController {
6
+ private readonly authService;
7
+ constructor(authService: AuthService);
8
+ getToken(entity: string, signupUserDto: SignupAuthenticableEntityDto): Promise<{
9
+ token: string;
10
+ }>;
11
+ signupAdmin(signupUserDto: SignupAuthenticableEntityDto): Promise<{
12
+ token: string;
13
+ }>;
14
+ signup(entity: string, signupUserDto: SignupAuthenticableEntityDto): Promise<{
15
+ token: string;
16
+ }>;
17
+ getCurrentUser(_entity: string, req: Request): Promise<AuthenticableEntity>;
18
+ isDefaultAdminExists(): Promise<{
19
+ exists: boolean;
20
+ }>;
21
+ }
@@ -0,0 +1,2 @@
1
+ export declare class AuthModule {
2
+ }
@@ -0,0 +1,31 @@
1
+ import { AuthenticableEntity } from '@repo/types';
2
+ import { ConfigService } from '@nestjs/config';
3
+ import { Request } from 'express';
4
+ import { EntityService } from '../entity/services/entity.service';
5
+ import { SignupAuthenticableEntityDto } from './dtos/signup-authenticable-entity.dto';
6
+ import { EntityManifestService } from '../manifest/services/entity-manifest.service';
7
+ export declare class AuthService {
8
+ private readonly configService;
9
+ private readonly entityService;
10
+ private readonly entityManifestService;
11
+ constructor(configService: ConfigService, entityService: EntityService, entityManifestService: EntityManifestService);
12
+ createToken(entitySlug: string, signupUserDto: SignupAuthenticableEntityDto): Promise<{
13
+ token: string;
14
+ }>;
15
+ signup(entitySlug: string, signupUserDto: SignupAuthenticableEntityDto, byPassAdminCheck?: boolean): Promise<{
16
+ token: string;
17
+ }>;
18
+ getUserFromToken(token: string): Promise<{
19
+ user: AuthenticableEntity;
20
+ entitySlug: string;
21
+ }>;
22
+ getUserFromRequest(req: Request): Promise<{
23
+ user: AuthenticableEntity;
24
+ entitySlug: string;
25
+ }>;
26
+ isReqUserAdmin(req: Request): Promise<boolean>;
27
+ isDefaultAdminExists(): Promise<{
28
+ exists: boolean;
29
+ }>;
30
+ findUserFromCredentials(entitySlug: string, email: string, password: string): Promise<AuthenticableEntity>;
31
+ }
@@ -0,0 +1,4 @@
1
+ export declare class SignupAuthenticableEntityDto {
2
+ email: string;
3
+ password: string;
4
+ }
@@ -0,0 +1,7 @@
1
+ import { CanActivate, ExecutionContext } from '@nestjs/common';
2
+ import { AuthService } from '../auth.service';
3
+ export declare class IsAdminGuard implements CanActivate {
4
+ private readonly authService;
5
+ constructor(authService: AuthService);
6
+ canActivate(context: ExecutionContext): Promise<boolean>;
7
+ }
@@ -0,0 +1,7 @@
1
+ import { CanActivate } from '@nestjs/common';
2
+ import { DatabaseService } from '../../crud/services/database.service';
3
+ export declare class IsDbEmptyGuard implements CanActivate {
4
+ private readonly databaseService;
5
+ constructor(databaseService: DatabaseService);
6
+ canActivate(): Promise<boolean>;
7
+ }
@@ -0,0 +1,11 @@
1
+ import { MysqlConnectionOptions } from 'typeorm/driver/mysql/MysqlConnectionOptions';
2
+ import { PostgresConnectionOptions } from 'typeorm/driver/postgres/PostgresConnectionOptions';
3
+ import { SqliteConnectionOptions } from 'typeorm/driver/sqlite/SqliteConnectionOptions';
4
+ declare const _default: () => {
5
+ database: {
6
+ sqlite: SqliteConnectionOptions;
7
+ postgres: PostgresConnectionOptions;
8
+ mysql: MysqlConnectionOptions;
9
+ };
10
+ };
11
+ export default _default;
@@ -3,28 +3,53 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.default = () => {
4
4
  return {
5
5
  database: {
6
- sqlite: {
7
- type: 'sqlite',
8
- database: process.env.DB_PATH || `${process.cwd()}/manifest/backend.db`,
9
- dropSchema: process.env.DB_DROP_SCHEMA === 'true' || false,
10
- synchronize: true
11
- },
12
- postgres: {
13
- type: 'postgres',
14
- host: process.env.DB_HOST || 'localhost',
15
- port: parseInt(process.env.DB_PORT, 10) || 5432,
16
- username: process.env.DB_USERNAME || 'postgres',
17
- password: process.env.DB_PASSWORD || 'postgres',
18
- database: process.env.DB_DATABASE || 'manifest',
19
- dropSchema: process.env.DB_DROP_SCHEMA === 'true' || false,
20
- ssl: process.env.DB_SSL === 'true'
21
- ? {
22
- rejectUnauthorized: false,
23
- requestCert: true
24
- }
25
- : false,
26
- synchronize: true
27
- }
6
+ sqlite: getSqliteConnectionOptions(),
7
+ postgres: getPostgresConnectionOptions(),
8
+ mysql: getMysqlConnectionOptions()
28
9
  }
29
10
  };
30
11
  };
12
+ function getSqliteConnectionOptions() {
13
+ return {
14
+ type: 'sqlite',
15
+ database: process.env.DB_PATH || `${process.cwd()}/manifest/backend.db`,
16
+ dropSchema: process.env.DB_DROP_SCHEMA === 'true' || false,
17
+ synchronize: true
18
+ };
19
+ }
20
+ function getPostgresConnectionOptions() {
21
+ return {
22
+ type: 'postgres',
23
+ host: process.env.DB_HOST || 'localhost',
24
+ port: parseInt(process.env.DB_PORT, 10) || 5432,
25
+ username: process.env.DB_USERNAME || 'postgres',
26
+ password: process.env.DB_PASSWORD || 'postgres',
27
+ database: process.env.DB_DATABASE || 'manifest',
28
+ dropSchema: process.env.DB_DROP_SCHEMA === 'true' || false,
29
+ ssl: process.env.DB_SSL === 'true'
30
+ ? {
31
+ rejectUnauthorized: false,
32
+ requestCert: true
33
+ }
34
+ : false,
35
+ synchronize: true
36
+ };
37
+ }
38
+ function getMysqlConnectionOptions() {
39
+ return {
40
+ type: 'mysql',
41
+ host: process.env.DB_HOST || 'localhost',
42
+ port: parseInt(process.env.DB_PORT, 10) || 3306,
43
+ username: process.env.DB_USERNAME || 'root',
44
+ password: process.env.DB_PASSWORD || 'password',
45
+ database: process.env.DB_DATABASE || 'manifest',
46
+ dropSchema: process.env.DB_DROP_SCHEMA === 'true' || false,
47
+ ssl: process.env.DB_SSL === 'true'
48
+ ? {
49
+ rejectUnauthorized: false,
50
+ requestCert: true
51
+ }
52
+ : false,
53
+ synchronize: true
54
+ };
55
+ }
@@ -0,0 +1,8 @@
1
+ declare const _default: () => {
2
+ port: number | string;
3
+ nodeEnv: string;
4
+ tokenSecretKey: string;
5
+ baseUrl: string;
6
+ showOpenApiDocs: boolean;
7
+ };
8
+ export default _default;
@@ -0,0 +1,9 @@
1
+ declare const _default: () => {
2
+ paths: {
3
+ adminPanelFolder: string;
4
+ publicFolder: string;
5
+ manifestFile: string;
6
+ handlersFolder: string;
7
+ };
8
+ };
9
+ export default _default;
@@ -0,0 +1,10 @@
1
+ declare const _default: () => {
2
+ storage: {
3
+ s3Bucket: string;
4
+ s3Endpoint: string;
5
+ s3Region: string;
6
+ s3AccessKeyId: string;
7
+ s3SecretAccessKey: string;
8
+ };
9
+ };
10
+ export default _default;
@@ -0,0 +1,25 @@
1
+ import { EntityManifest, PropertyManifest, ImageSizesObject, PolicyManifest } from '@repo/types';
2
+ export declare const STORAGE_PATH: string;
3
+ export declare const API_PATH: string;
4
+ export declare const COLLECTIONS_PATH: string;
5
+ export declare const SINGLES_PATH: string;
6
+ export declare const ENDPOINTS_PATH: string;
7
+ export declare const DEFAULT_PORT: number;
8
+ export declare const DEFAULT_RESULTS_PER_PAGE: number;
9
+ export declare const SALT_ROUNDS: number;
10
+ export declare const DEFAULT_SEED_COUNT: number;
11
+ export declare const DEFAULT_MAX_MANY_TO_MANY_RELATIONS: number;
12
+ export declare const DUMMY_FILE_NAME: string;
13
+ export declare const DUMMY_IMAGE_NAME: string;
14
+ export declare const DEFAULT_TOKEN_SECRET_KEY: string;
15
+ export declare const DEFAULT_IMAGE_SIZES: ImageSizesObject;
16
+ export declare const AUTHENTICABLE_PROPS: PropertyManifest[];
17
+ export declare const DEFAULT_ADMIN_CREDENTIALS: {
18
+ email: string;
19
+ password: string;
20
+ };
21
+ export declare const ADMIN_ENTITY_MANIFEST: EntityManifest;
22
+ export declare const QUERY_PARAMS_RESERVED_WORDS: string[];
23
+ export declare const ADMIN_ACCESS_POLICY: PolicyManifest;
24
+ export declare const PUBLIC_ACCESS_POLICY: PolicyManifest;
25
+ export declare const FORBIDDEN_ACCESS_POLICY: PolicyManifest;
@@ -0,0 +1,22 @@
1
+ import { BaseEntity, Paginator, SelectOption } from '@repo/types';
2
+ import { CrudService } from '../services/crud.service';
3
+ import { AuthService } from '../../auth/auth.service';
4
+ import { Request } from 'express';
5
+ export declare class CollectionController {
6
+ private readonly crudService;
7
+ private readonly authService;
8
+ constructor(crudService: CrudService, authService: AuthService);
9
+ findAll(entitySlug: string, queryParams: {
10
+ [key: string]: string | string[];
11
+ }, req: Request): Promise<Paginator<BaseEntity>>;
12
+ findSelectOptions(entitySlug: string, queryParams: {
13
+ [key: string]: string | string[];
14
+ }): Promise<SelectOption[]>;
15
+ findOne(entitySlug: string, id: number, queryParams: {
16
+ [key: string]: string | string[];
17
+ }, req: Request): Promise<BaseEntity>;
18
+ store(entity: string, entityDto: Partial<BaseEntity>): Promise<BaseEntity>;
19
+ put(entitySlug: string, id: number, itemDto: Partial<BaseEntity>): Promise<BaseEntity>;
20
+ patch(entitySlug: string, id: number, itemDto: Partial<BaseEntity>): Promise<BaseEntity>;
21
+ delete(entity: string, id: number): Promise<BaseEntity>;
22
+ }
@@ -0,0 +1,8 @@
1
+ import { DatabaseService } from '../services/database.service';
2
+ export declare class DatabaseController {
3
+ private readonly databaseService;
4
+ constructor(databaseService: DatabaseService);
5
+ isDbEmpty(): Promise<{
6
+ empty: boolean;
7
+ }>;
8
+ }
@@ -0,0 +1,12 @@
1
+ import { AuthService } from '../../auth/auth.service';
2
+ import { Request } from 'express';
3
+ import { CrudService } from '../services/crud.service';
4
+ import { BaseEntity } from '@repo/types';
5
+ export declare class SingleController {
6
+ private readonly authService;
7
+ private readonly crudService;
8
+ constructor(authService: AuthService, crudService: CrudService);
9
+ findOne(entitySlug: string, req: Request): Promise<BaseEntity>;
10
+ put(entitySlug: string, itemDto: Partial<BaseEntity>): Promise<BaseEntity>;
11
+ patch(entitySlug: string, itemDto: Partial<BaseEntity>): Promise<BaseEntity>;
12
+ }
@@ -0,0 +1,2 @@
1
+ export declare class CrudModule {
2
+ }
@@ -0,0 +1,7 @@
1
+ import { CanActivate, ExecutionContext } from '@nestjs/common';
2
+ import { EntityManifestService } from '../../manifest/services/entity-manifest.service';
3
+ export declare class IsCollectionGuard implements CanActivate {
4
+ private readonly entityManifestService;
5
+ constructor(entityManifestService: EntityManifestService);
6
+ canActivate(context: ExecutionContext): boolean;
7
+ }
@@ -0,0 +1,7 @@
1
+ import { CanActivate, ExecutionContext } from '@nestjs/common';
2
+ import { EntityManifestService } from '../../manifest/services/entity-manifest.service';
3
+ export declare class IsSingleGuard implements CanActivate {
4
+ private readonly entityManifestService;
5
+ constructor(entityManifestService: EntityManifestService);
6
+ canActivate(context: ExecutionContext): boolean;
7
+ }
@@ -0,0 +1,54 @@
1
+ import { Repository } from 'typeorm';
2
+ import { BaseEntity } from '@repo/types';
3
+ import { EntityService } from '../../entity/services/entity.service';
4
+ import { EntityManifest, Paginator, SelectOption } from '@repo/types';
5
+ import { PaginationService } from './pagination.service';
6
+ import { ValidationService } from '../../validation/services/validation.service';
7
+ import { RelationshipService } from '../../entity/services/relationship.service';
8
+ import { EntityManifestService } from '../../manifest/services/entity-manifest.service';
9
+ export declare class CrudService {
10
+ private readonly entityService;
11
+ private readonly entityManifestService;
12
+ private readonly paginationService;
13
+ private readonly validationService;
14
+ private readonly relationshipService;
15
+ constructor(entityService: EntityService, entityManifestService: EntityManifestService, paginationService: PaginationService, validationService: ValidationService, relationshipService: RelationshipService);
16
+ findAll({ entitySlug, queryParams, fullVersion }: {
17
+ entitySlug: string;
18
+ queryParams?: {
19
+ [key: string]: string | string[];
20
+ };
21
+ fullVersion?: boolean;
22
+ }): Promise<Paginator<BaseEntity>>;
23
+ findSelectOptions({ entitySlug, queryParams }: {
24
+ entitySlug: string;
25
+ queryParams?: {
26
+ [key: string]: string | string[];
27
+ };
28
+ }): Promise<SelectOption[]>;
29
+ findOne({ entitySlug, id, queryParams, fullVersion }: {
30
+ entitySlug: string;
31
+ id: number;
32
+ queryParams?: {
33
+ [key: string]: string | string[];
34
+ };
35
+ fullVersion?: boolean;
36
+ }): Promise<BaseEntity>;
37
+ store(entitySlug: string, itemDto: Partial<BaseEntity>): Promise<BaseEntity>;
38
+ storeEmpty(entitySlug: string): Promise<BaseEntity>;
39
+ update({ entitySlug, id, itemDto, partialReplacement }: {
40
+ entitySlug: string;
41
+ id: number;
42
+ itemDto: Partial<BaseEntity>;
43
+ partialReplacement?: boolean;
44
+ }): Promise<BaseEntity>;
45
+ delete(entitySlug: string, id: number): Promise<BaseEntity>;
46
+ createWithDefaults({ repository, entityManifest, itemDto }: {
47
+ repository: Repository<BaseEntity>;
48
+ entityManifest: EntityManifest;
49
+ itemDto: Partial<BaseEntity>;
50
+ }): BaseEntity;
51
+ private getVisibleProps;
52
+ private loadRelations;
53
+ private filterQuery;
54
+ }
@@ -0,0 +1,8 @@
1
+ import { ManifestService } from '../../manifest/services/manifest.service';
2
+ import { EntityService } from '../../entity/services/entity.service';
3
+ export declare class DatabaseService {
4
+ private manifestService;
5
+ private entityService;
6
+ constructor(manifestService: ManifestService, entityService: EntityService);
7
+ isDbEmpty(): Promise<boolean>;
8
+ }
@@ -0,0 +1,9 @@
1
+ import { BaseEntity, Paginator } from '@repo/types';
2
+ import { SelectQueryBuilder } from 'typeorm';
3
+ export declare class PaginationService {
4
+ paginate({ query, resultsPerPage, currentPage }: {
5
+ query?: SelectQueryBuilder<BaseEntity>;
6
+ currentPage: number;
7
+ resultsPerPage?: number;
8
+ }): Promise<Paginator<BaseEntity>>;
9
+ }
@@ -0,0 +1,12 @@
1
+ import { Request, Response } from 'express';
2
+ import { HandlerService } from '../handler/handler.service';
3
+ export declare class EndpointController {
4
+ private readonly handlerService;
5
+ constructor(handlerService: HandlerService);
6
+ triggerGetEndpoint(req: Request, res: Response): Promise<unknown>;
7
+ triggerPostEndpoint(req: Request, res: Response): Promise<unknown>;
8
+ triggerPutEndpoint(req: Request, res: Response): Promise<unknown>;
9
+ triggerPatchEndpoint(req: Request, res: Response): Promise<unknown>;
10
+ triggerDeleteEndpoint(req: Request, res: Response): Promise<unknown>;
11
+ private handleRoute;
12
+ }
@@ -0,0 +1,4 @@
1
+ import { MiddlewareConsumer } from '@nestjs/common';
2
+ export declare class EndpointModule {
3
+ configure(consumer: MiddlewareConsumer): void;
4
+ }
@@ -0,0 +1,17 @@
1
+ import { EndpointSchema, EndpointManifest, HttpMethod } from '@repo/types';
2
+ import { PolicyService } from '../policy/policy.service';
3
+ export declare class EndpointService {
4
+ private readonly policyService;
5
+ constructor(policyService: PolicyService);
6
+ transformEndpointsSchemaObject(endpointSchemaObject: {
7
+ [k: string]: EndpointSchema;
8
+ }): EndpointManifest[];
9
+ matchRoutePath({ path, method, endpoints }: {
10
+ path: string;
11
+ method: HttpMethod;
12
+ endpoints: EndpointManifest[];
13
+ }): {
14
+ endpoint: EndpointManifest;
15
+ params: object;
16
+ };
17
+ }
@@ -0,0 +1,10 @@
1
+ import { NestMiddleware } from '@nestjs/common';
2
+ import { Request, Response } from 'express';
3
+ import { EndpointService } from '../endpoint.service';
4
+ import { ManifestService } from '../../manifest/services/manifest.service';
5
+ export declare class MatchEndpointMiddleware implements NestMiddleware {
6
+ private readonly endpointService;
7
+ private readonly manifestService;
8
+ constructor(endpointService: EndpointService, manifestService: ManifestService);
9
+ use(req: Request, res: Response, next: () => void): void;
10
+ }
@@ -0,0 +1,3 @@
1
+ import { PropType } from '@repo/types';
2
+ import { ColumnType } from 'typeorm';
3
+ export declare const mysqlPropTypeColumnTypes: Record<PropType, ColumnType>;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mysqlPropTypeColumnTypes = void 0;
4
+ const types_1 = require("../../../../types/src");
5
+ exports.mysqlPropTypeColumnTypes = {
6
+ [types_1.PropType.String]: 'varchar',
7
+ [types_1.PropType.Number]: 'decimal',
8
+ [types_1.PropType.Link]: 'varchar',
9
+ [types_1.PropType.Text]: 'text',
10
+ [types_1.PropType.RichText]: 'text',
11
+ [types_1.PropType.Money]: 'decimal',
12
+ [types_1.PropType.Date]: 'date',
13
+ [types_1.PropType.Timestamp]: 'datetime',
14
+ [types_1.PropType.Email]: 'varchar',
15
+ [types_1.PropType.Boolean]: 'tinyint',
16
+ [types_1.PropType.Password]: 'varchar',
17
+ [types_1.PropType.Choice]: 'varchar',
18
+ [types_1.PropType.Location]: 'json',
19
+ [types_1.PropType.File]: 'varchar',
20
+ [types_1.PropType.Image]: 'json'
21
+ };
@@ -0,0 +1,3 @@
1
+ import { PropType } from '@repo/types';
2
+ import { ColumnType } from 'typeorm';
3
+ export declare const postgresPropTypeColumnTypes: Record<PropType, ColumnType>;
@@ -0,0 +1,3 @@
1
+ import { PropType } from '@repo/types';
2
+ import { ColumnType } from 'typeorm';
3
+ export declare const sqlitePropTypeColumnTypes: Record<PropType, ColumnType>;
@@ -0,0 +1,2 @@
1
+ export declare class EntityModule {
2
+ }