@flusys/nestjs-form-builder 1.0.0-rc → 2.0.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 (44) hide show
  1. package/README.md +35 -8
  2. package/cjs/controllers/form-result.controller.js +8 -8
  3. package/cjs/docs/form-builder-swagger.config.js +6 -100
  4. package/cjs/dtos/form-result.dto.js +5 -53
  5. package/cjs/dtos/form.dto.js +20 -123
  6. package/cjs/entities/form-with-company.entity.js +12 -2
  7. package/cjs/entities/form.entity.js +103 -3
  8. package/cjs/entities/index.js +28 -16
  9. package/cjs/interfaces/form-result.interface.js +1 -6
  10. package/cjs/modules/form-builder.module.js +57 -83
  11. package/cjs/services/form-builder-config.service.js +2 -2
  12. package/cjs/services/form-builder-datasource.provider.js +11 -26
  13. package/cjs/services/form-result.service.js +81 -122
  14. package/cjs/services/form.service.js +33 -50
  15. package/cjs/utils/computed-field.utils.js +17 -29
  16. package/dtos/form-result.dto.d.ts +2 -8
  17. package/dtos/form.dto.d.ts +6 -21
  18. package/entities/form-with-company.entity.d.ts +2 -2
  19. package/entities/form.entity.d.ts +12 -2
  20. package/entities/index.d.ts +7 -2
  21. package/fesm/controllers/form-result.controller.js +9 -9
  22. package/fesm/docs/form-builder-swagger.config.js +6 -100
  23. package/fesm/dtos/form-result.dto.js +5 -53
  24. package/fesm/dtos/form.dto.js +21 -124
  25. package/fesm/entities/form-with-company.entity.js +12 -2
  26. package/fesm/entities/form.entity.js +104 -4
  27. package/fesm/entities/index.js +18 -24
  28. package/fesm/modules/form-builder.module.js +57 -83
  29. package/fesm/services/form-builder-config.service.js +2 -2
  30. package/fesm/services/form-builder-datasource.provider.js +11 -26
  31. package/fesm/services/form-result.service.js +81 -122
  32. package/fesm/services/form.service.js +33 -50
  33. package/fesm/utils/computed-field.utils.js +17 -29
  34. package/interfaces/form-result.interface.d.ts +2 -8
  35. package/interfaces/form.interface.d.ts +2 -8
  36. package/modules/form-builder.module.d.ts +4 -3
  37. package/package.json +3 -3
  38. package/services/form-builder-config.service.d.ts +2 -2
  39. package/services/form-builder-datasource.provider.d.ts +3 -6
  40. package/services/form-result.service.d.ts +4 -0
  41. package/services/form.service.d.ts +12 -10
  42. package/cjs/entities/form-base.entity.js +0 -113
  43. package/entities/form-base.entity.d.ts +0 -13
  44. package/fesm/entities/form-base.entity.js +0 -106
@@ -149,27 +149,35 @@ export class FormService extends RequestScopedApiService {
149
149
  deletedById: entity.deletedById
150
150
  };
151
151
  }
152
- // Public Form Access
153
- async getPublicForm(formId) {
152
+ toPublicForm(form) {
153
+ return {
154
+ id: form.id,
155
+ name: form.name,
156
+ description: form.description,
157
+ schema: form.schema,
158
+ schemaVersion: form.schemaVersion
159
+ };
160
+ }
161
+ async findPublicActiveForm(where) {
154
162
  await this.ensureRepositoryInitialized();
155
- const form = await this.repository.findOne({
163
+ return this.repository.findOne({
156
164
  where: {
157
- id: formId,
165
+ ...where,
158
166
  accessType: FormAccessType.PUBLIC,
159
167
  isActive: true,
160
168
  deletedAt: IsNull()
161
169
  }
162
170
  });
171
+ }
172
+ // Public Form Access
173
+ async getPublicForm(formId) {
174
+ const form = await this.findPublicActiveForm({
175
+ id: formId
176
+ });
163
177
  if (!form) {
164
178
  throw new NotFoundException('Form not found or not available for public access');
165
179
  }
166
- return {
167
- id: form.id,
168
- name: form.name,
169
- description: form.description,
170
- schema: form.schema,
171
- schemaVersion: form.schemaVersion
172
- };
180
+ return this.toPublicForm(form);
173
181
  }
174
182
  async getFormForSubmission(formId, user) {
175
183
  await this.ensureRepositoryInitialized();
@@ -184,23 +192,17 @@ export class FormService extends RequestScopedApiService {
184
192
  throw new NotFoundException('Form not found or inactive');
185
193
  }
186
194
  // Access validation based on accessType
187
- switch(form.accessType){
188
- case FormAccessType.PUBLIC:
189
- return form; // Anyone can access
190
- case FormAccessType.AUTHENTICATED:
191
- if (!user) {
192
- throw new UnauthorizedException('Authentication required to submit this form');
193
- }
194
- return form;
195
- case FormAccessType.ACTION_GROUP:
196
- if (!user) {
197
- throw new UnauthorizedException('Authentication required to submit this form');
198
- }
199
- // Permission check is handled by the controller/guard
200
- return form;
201
- default:
202
- throw new BadRequestException('Invalid access type');
195
+ if (form.accessType === FormAccessType.PUBLIC) {
196
+ return form; // Anyone can access
203
197
  }
198
+ // All non-public forms require authentication
199
+ if (!user) {
200
+ throw new UnauthorizedException('Authentication required to submit this form');
201
+ }
202
+ if (form.accessType === FormAccessType.AUTHENTICATED || form.accessType === FormAccessType.ACTION_GROUP) {
203
+ return form; // Permission check for ACTION_GROUP is handled by the controller/guard
204
+ }
205
+ throw new BadRequestException('Invalid access type');
204
206
  }
205
207
  async getBySlug(slug) {
206
208
  await this.ensureRepositoryInitialized();
@@ -216,23 +218,10 @@ export class FormService extends RequestScopedApiService {
216
218
  * Get public form by slug (no authentication required)
217
219
  * Returns null if form doesn't exist, is not public, or is inactive
218
220
  */ async getPublicFormBySlug(slug) {
219
- await this.ensureRepositoryInitialized();
220
- const form = await this.repository.findOne({
221
- where: {
222
- slug,
223
- accessType: FormAccessType.PUBLIC,
224
- isActive: true,
225
- deletedAt: IsNull()
226
- }
221
+ const form = await this.findPublicActiveForm({
222
+ slug
227
223
  });
228
- if (!form) return null;
229
- return {
230
- id: form.id,
231
- name: form.name,
232
- description: form.description,
233
- schema: form.schema,
234
- schemaVersion: form.schemaVersion
235
- };
224
+ return form ? this.toPublicForm(form) : null;
236
225
  }
237
226
  async getFormAccessInfo(formId) {
238
227
  await this.ensureRepositoryInitialized();
@@ -271,13 +260,7 @@ export class FormService extends RequestScopedApiService {
271
260
  throw new ForbiddenException('You do not have permission to access this form');
272
261
  }
273
262
  }
274
- return {
275
- id: form.id,
276
- name: form.name,
277
- description: form.description,
278
- schema: form.schema,
279
- schemaVersion: form.schemaVersion
280
- };
263
+ return this.toPublicForm(form);
281
264
  }
282
265
  constructor(cacheManager, utilsService, formBuilderConfig, dataSourceProvider){
283
266
  super('form', null, cacheManager, utilsService, FormService.name, true), _define_property(this, "cacheManager", void 0), _define_property(this, "utilsService", void 0), _define_property(this, "formBuilderConfig", void 0), _define_property(this, "dataSourceProvider", void 0), this.cacheManager = cacheManager, this.utilsService = utilsService, this.formBuilderConfig = formBuilderConfig, this.dataSourceProvider = dataSourceProvider;
@@ -13,16 +13,22 @@
13
13
  // Type Definitions
14
14
  // ============================================================================
15
15
  // ============================================================================
16
- // Type Guards
16
+ // Type Guards & Helpers
17
17
  // ============================================================================
18
+ function isObject(value) {
19
+ return typeof value === 'object' && value !== null;
20
+ }
18
21
  function isDirectValueConfig(config) {
19
- return typeof config === 'object' && config !== null && config.type === 'direct' && 'value' in config;
22
+ return isObject(config) && config.type === 'direct' && 'value' in config;
20
23
  }
21
24
  function isFieldReferenceConfig(config) {
22
- return typeof config === 'object' && config !== null && config.type === 'field_reference' && 'fieldId' in config;
25
+ return isObject(config) && config.type === 'field_reference' && 'fieldId' in config;
23
26
  }
24
27
  function isArithmeticConfig(config) {
25
- return typeof config === 'object' && config !== null && config.type === 'arithmetic' && 'operation' in config && 'operands' in config && Array.isArray(config.operands);
28
+ return isObject(config) && config.type === 'arithmetic' && 'operation' in config && 'operands' in config && Array.isArray(config.operands);
29
+ }
30
+ function isEmptyValue(value) {
31
+ return value === null || value === undefined || value === '' || Array.isArray(value) && value.length === 0;
26
32
  }
27
33
  /**
28
34
  * Normalize operator to uppercase string (handles both enum and string values)
@@ -91,9 +97,9 @@ function isArithmeticConfig(config) {
91
97
  case 'not_equals':
92
98
  return fieldValue !== compareValue && String(fieldValue) !== String(compareValue);
93
99
  case 'is_empty':
94
- return fieldValue === null || fieldValue === undefined || fieldValue === '' || Array.isArray(fieldValue) && fieldValue.length === 0;
100
+ return isEmptyValue(fieldValue);
95
101
  case 'is_not_empty':
96
- return fieldValue !== null && fieldValue !== undefined && fieldValue !== '' && !(Array.isArray(fieldValue) && fieldValue.length === 0);
102
+ return !isEmptyValue(fieldValue);
97
103
  case 'contains':
98
104
  return String(fieldValue).includes(String(compareValue));
99
105
  case 'not_contains':
@@ -119,25 +125,11 @@ function isArithmeticConfig(config) {
119
125
  case 'is_not_checked':
120
126
  return fieldValue === false || fieldValue === 'false' || fieldValue === 0 || !fieldValue;
121
127
  case 'is_any_of':
122
- if (Array.isArray(compareValue)) {
123
- return compareValue.includes(fieldValue);
124
- }
125
- return false;
126
- case 'is_none_of':
127
- if (Array.isArray(compareValue)) {
128
- return !compareValue.includes(fieldValue);
129
- }
130
- return true;
131
128
  case 'in':
132
- if (Array.isArray(compareValue)) {
133
- return compareValue.includes(fieldValue);
134
- }
135
- return false;
129
+ return Array.isArray(compareValue) && compareValue.includes(fieldValue);
130
+ case 'is_none_of':
136
131
  case 'not_in':
137
- if (Array.isArray(compareValue)) {
138
- return !compareValue.includes(fieldValue);
139
- }
140
- return true;
132
+ return !Array.isArray(compareValue) || !compareValue.includes(fieldValue);
141
133
  default:
142
134
  return false;
143
135
  }
@@ -179,8 +171,10 @@ function isArithmeticConfig(config) {
179
171
  }
180
172
  switch(config.operation){
181
173
  case 'sum':
174
+ case 'increment':
182
175
  return values.reduce((acc, val)=>acc + val, 0);
183
176
  case 'subtract':
177
+ case 'decrement':
184
178
  return values.reduce((acc, val, idx)=>idx === 0 ? val : acc - val, 0);
185
179
  case 'multiply':
186
180
  return values.reduce((acc, val)=>acc * val, 1);
@@ -195,12 +189,6 @@ function isArithmeticConfig(config) {
195
189
  return Math.min(...values);
196
190
  case 'max':
197
191
  return Math.max(...values);
198
- case 'increment':
199
- // First value is the base, rest are increments
200
- return values.reduce((acc, val)=>acc + val, 0);
201
- case 'decrement':
202
- // First value is the base, rest are decrements
203
- return values.reduce((acc, val, idx)=>idx === 0 ? val : acc - val, 0);
204
192
  default:
205
193
  return null;
206
194
  }
@@ -1,5 +1,5 @@
1
- export interface IFormResult {
2
- id: string;
1
+ import { IIdentity } from '@flusys/nestjs-shared/interfaces';
2
+ export interface IFormResult extends IIdentity {
3
3
  formId: string;
4
4
  schemaVersionSnapshot: Record<string, unknown>;
5
5
  schemaVersion: number;
@@ -8,10 +8,4 @@ export interface IFormResult {
8
8
  submittedAt: Date;
9
9
  isDraft: boolean;
10
10
  metadata: Record<string, unknown> | null;
11
- createdAt: Date;
12
- updatedAt: Date;
13
- deletedAt: Date | null;
14
- createdById: string | null;
15
- updatedById: string | null;
16
- deletedById: string | null;
17
11
  }
@@ -1,6 +1,6 @@
1
+ import { IIdentity } from '@flusys/nestjs-shared/interfaces';
1
2
  import { FormAccessType } from '../enums/form-access-type.enum';
2
- export interface IForm {
3
- id: string;
3
+ export interface IForm extends IIdentity {
4
4
  name: string;
5
5
  description: string | null;
6
6
  slug: string | null;
@@ -11,12 +11,6 @@ export interface IForm {
11
11
  isActive: boolean;
12
12
  companyId: string | null;
13
13
  metadata: Record<string, unknown> | null;
14
- createdAt: Date;
15
- updatedAt: Date;
16
- deletedAt: Date | null;
17
- createdById: string | null;
18
- updatedById: string | null;
19
- deletedById: string | null;
20
14
  }
21
15
  export interface IPublicForm {
22
16
  id: string;
@@ -1,9 +1,10 @@
1
1
  import { DynamicModule } from '@nestjs/common';
2
2
  import { FormBuilderModuleOptions, FormBuilderModuleAsyncOptions } from '../interfaces/form-builder-module.interface';
3
3
  export declare class FormBuilderModule {
4
+ private static readonly CONTROLLERS;
5
+ private static readonly EXPORTS;
4
6
  static forRoot(options: FormBuilderModuleOptions): DynamicModule;
5
7
  static forRootAsync(options: FormBuilderModuleAsyncOptions): DynamicModule;
6
- private static getControllers;
7
- private static getProviders;
8
- private static createAsyncProviders;
8
+ private static buildProviders;
9
+ private static buildAsyncProviders;
9
10
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flusys/nestjs-form-builder",
3
- "version": "1.0.0-rc",
3
+ "version": "2.0.0",
4
4
  "description": "Dynamic form builder module with schema versioning and access control",
5
5
  "main": "cjs/index.js",
6
6
  "module": "fesm/index.js",
@@ -83,7 +83,7 @@
83
83
  "typeorm": "^0.3.0"
84
84
  },
85
85
  "dependencies": {
86
- "@flusys/nestjs-core": "1.0.0-rc",
87
- "@flusys/nestjs-shared": "1.0.0-rc"
86
+ "@flusys/nestjs-core": "2.0.0",
87
+ "@flusys/nestjs-shared": "2.0.0"
88
88
  }
89
89
  }
@@ -1,10 +1,10 @@
1
- import { DatabaseMode } from '@flusys/nestjs-core';
1
+ import { DatabaseMode, ITenantDatabaseConfig } from '@flusys/nestjs-core';
2
2
  import { IModuleConfigService } from '@flusys/nestjs-shared/interfaces';
3
3
  import { FormBuilderModuleOptions } from '../interfaces/form-builder-module.interface';
4
4
  export declare class FormBuilderConfigService implements IModuleConfigService {
5
5
  private readonly options;
6
6
  constructor(options: FormBuilderModuleOptions);
7
- isCompanyFeatureEnabled(): boolean;
7
+ isCompanyFeatureEnabled(tenant?: ITenantDatabaseConfig): boolean;
8
8
  getDatabaseMode(): DatabaseMode;
9
9
  isMultiTenant(): boolean;
10
10
  getOptions(): FormBuilderModuleOptions;
@@ -3,9 +3,9 @@ import { IDatabaseConfig, ITenantDatabaseConfig } from '@flusys/nestjs-core';
3
3
  import { Logger } from '@nestjs/common';
4
4
  import { Request } from 'express';
5
5
  import { DataSource } from 'typeorm';
6
- import { FormBuilderModuleOptions } from '../interfaces';
6
+ import { FormBuilderConfigService } from './form-builder-config.service';
7
7
  export declare class FormBuilderDataSourceProvider extends MultiTenantDataSourceService {
8
- private readonly formBuilderOptions;
8
+ private readonly configService;
9
9
  protected readonly logger: Logger;
10
10
  protected static readonly tenantConnections: Map<string, DataSource>;
11
11
  protected static singleDataSource: DataSource | null;
@@ -13,11 +13,8 @@ export declare class FormBuilderDataSourceProvider extends MultiTenantDataSource
13
13
  protected static initialized: boolean;
14
14
  protected static readonly connectionLocks: Map<string, Promise<DataSource>>;
15
15
  protected static singleConnectionLock: Promise<DataSource> | null;
16
- constructor(formBuilderOptions: FormBuilderModuleOptions, request?: Request);
16
+ constructor(configService: FormBuilderConfigService, request?: Request);
17
17
  private static buildParentOptions;
18
- getEnableCompanyFeature(): boolean;
19
- getEnableCompanyFeatureForTenant(tenant?: ITenantDatabaseConfig): boolean;
20
- getEnableCompanyFeatureForCurrentTenant(): boolean;
21
18
  getFormBuilderEntities(enableCompanyFeature?: boolean): Promise<any[]>;
22
19
  protected createDataSourceFromConfig(config: IDatabaseConfig): Promise<DataSource>;
23
20
  protected getSingleDataSource(): Promise<DataSource>;
@@ -18,6 +18,10 @@ export declare class FormResultService extends RequestScopedApiService<CreateFor
18
18
  protected resolveEntity(): EntityTarget<FormResult>;
19
19
  protected getDataSourceProvider(): FormBuilderDataSourceProvider;
20
20
  private ensureFormRepositoryInitialized;
21
+ private getActiveForm;
22
+ private applyCompanyFilterToQuery;
23
+ private validateSubmissionAccess;
24
+ private buildUserDraftWhere;
21
25
  getSelectQuery(query: SelectQueryBuilder<FormResult>, _user: ILoggedUserInfo | null, select?: string[]): Promise<{
22
26
  query: SelectQueryBuilder<FormResult>;
23
27
  isRaw: boolean;
@@ -5,30 +5,32 @@ import { UtilsService } from '@flusys/nestjs-shared/modules';
5
5
  import { EntityTarget, Repository, SelectQueryBuilder } from 'typeorm';
6
6
  import { FormBuilderConfigService } from './form-builder-config.service';
7
7
  import { CreateFormDto, UpdateFormDto } from '../dtos/form.dto';
8
- import { FormBase } from '../entities';
8
+ import { Form } from '../entities';
9
9
  import { FormAccessType } from '../enums/form-access-type.enum';
10
10
  import { IForm, IPublicForm } from '../interfaces/form.interface';
11
11
  import { FormBuilderDataSourceProvider } from './form-builder-datasource.provider';
12
- export declare class FormService extends RequestScopedApiService<CreateFormDto, UpdateFormDto, IForm, FormBase, Repository<FormBase>> {
12
+ export declare class FormService extends RequestScopedApiService<CreateFormDto, UpdateFormDto, IForm, Form, Repository<Form>> {
13
13
  protected cacheManager: HybridCache;
14
14
  protected utilsService: UtilsService;
15
15
  private readonly formBuilderConfig;
16
16
  private readonly dataSourceProvider;
17
17
  constructor(cacheManager: HybridCache, utilsService: UtilsService, formBuilderConfig: FormBuilderConfigService, dataSourceProvider: FormBuilderDataSourceProvider);
18
- protected resolveEntity(): EntityTarget<FormBase>;
18
+ protected resolveEntity(): EntityTarget<Form>;
19
19
  protected getDataSourceProvider(): FormBuilderDataSourceProvider;
20
- convertSingleDtoToEntity(dto: CreateFormDto | UpdateFormDto, user: ILoggedUserInfo | null): Promise<FormBase>;
21
- getSelectQuery(query: SelectQueryBuilder<FormBase>, _user: ILoggedUserInfo | null, select?: string[]): Promise<{
22
- query: SelectQueryBuilder<FormBase>;
20
+ convertSingleDtoToEntity(dto: CreateFormDto | UpdateFormDto, user: ILoggedUserInfo | null): Promise<Form>;
21
+ getSelectQuery(query: SelectQueryBuilder<Form>, _user: ILoggedUserInfo | null, select?: string[]): Promise<{
22
+ query: SelectQueryBuilder<Form>;
23
23
  isRaw: boolean;
24
24
  }>;
25
- protected getExtraManipulateQuery(query: SelectQueryBuilder<FormBase>, filterDto: FilterAndPaginationDto, user: ILoggedUserInfo | null): Promise<{
26
- query: SelectQueryBuilder<FormBase>;
25
+ protected getExtraManipulateQuery(query: SelectQueryBuilder<Form>, filterDto: FilterAndPaginationDto, user: ILoggedUserInfo | null): Promise<{
26
+ query: SelectQueryBuilder<Form>;
27
27
  isRaw: boolean;
28
28
  }>;
29
- protected convertEntityToResponseDto(entity: FormBase, _isRaw: boolean): IForm;
29
+ protected convertEntityToResponseDto(entity: Form, _isRaw: boolean): IForm;
30
+ private toPublicForm;
31
+ private findPublicActiveForm;
30
32
  getPublicForm(formId: string): Promise<IPublicForm>;
31
- getFormForSubmission(formId: string, user: ILoggedUserInfo | null): Promise<FormBase>;
33
+ getFormForSubmission(formId: string, user: ILoggedUserInfo | null): Promise<Form>;
32
34
  getBySlug(slug: string): Promise<IForm | null>;
33
35
  getPublicFormBySlug(slug: string): Promise<IPublicForm | null>;
34
36
  getFormAccessInfo(formId: string): Promise<{
@@ -1,113 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "FormBase", {
6
- enumerable: true,
7
- get: function() {
8
- return FormBase;
9
- }
10
- });
11
- const _nestjsshared = require("@flusys/nestjs-shared");
12
- const _typeorm = require("typeorm");
13
- const _formaccesstypeenum = require("../enums/form-access-type.enum");
14
- function _define_property(obj, key, value) {
15
- if (key in obj) {
16
- Object.defineProperty(obj, key, {
17
- value: value,
18
- enumerable: true,
19
- configurable: true,
20
- writable: true
21
- });
22
- } else {
23
- obj[key] = value;
24
- }
25
- return obj;
26
- }
27
- function _ts_decorate(decorators, target, key, desc) {
28
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
29
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
30
- else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
31
- return c > 3 && r && Object.defineProperty(target, key, r), r;
32
- }
33
- function _ts_metadata(k, v) {
34
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
35
- }
36
- let FormBase = class FormBase extends _nestjsshared.Identity {
37
- constructor(...args){
38
- super(...args), _define_property(this, "name", void 0), _define_property(this, "description", void 0), _define_property(this, "slug", void 0), _define_property(this, "schema", void 0), _define_property(this, "schemaVersion", void 0), _define_property(this, "accessType", void 0), _define_property(this, "actionGroups", void 0), _define_property(this, "isActive", void 0), _define_property(this, "metadata", void 0);
39
- }
40
- };
41
- _ts_decorate([
42
- (0, _typeorm.Column)({
43
- type: 'varchar',
44
- length: 255,
45
- nullable: false
46
- }),
47
- _ts_metadata("design:type", String)
48
- ], FormBase.prototype, "name", void 0);
49
- _ts_decorate([
50
- (0, _typeorm.Column)({
51
- type: 'varchar',
52
- length: 500,
53
- nullable: true
54
- }),
55
- _ts_metadata("design:type", Object)
56
- ], FormBase.prototype, "description", void 0);
57
- _ts_decorate([
58
- (0, _typeorm.Column)({
59
- type: 'varchar',
60
- length: 255,
61
- nullable: true,
62
- unique: true
63
- }),
64
- _ts_metadata("design:type", Object)
65
- ], FormBase.prototype, "slug", void 0);
66
- _ts_decorate([
67
- (0, _typeorm.Column)({
68
- type: 'json',
69
- nullable: false
70
- }),
71
- _ts_metadata("design:type", typeof Record === "undefined" ? Object : Record)
72
- ], FormBase.prototype, "schema", void 0);
73
- _ts_decorate([
74
- (0, _typeorm.Column)({
75
- type: 'int',
76
- nullable: false,
77
- default: 1,
78
- name: 'schema_version'
79
- }),
80
- _ts_metadata("design:type", Number)
81
- ], FormBase.prototype, "schemaVersion", void 0);
82
- _ts_decorate([
83
- (0, _typeorm.Column)({
84
- type: 'enum',
85
- enum: _formaccesstypeenum.FormAccessType,
86
- default: _formaccesstypeenum.FormAccessType.AUTHENTICATED,
87
- name: 'access_type'
88
- }),
89
- _ts_metadata("design:type", typeof _formaccesstypeenum.FormAccessType === "undefined" ? Object : _formaccesstypeenum.FormAccessType)
90
- ], FormBase.prototype, "accessType", void 0);
91
- _ts_decorate([
92
- (0, _typeorm.Column)({
93
- type: 'simple-array',
94
- nullable: true,
95
- name: 'action_groups'
96
- }),
97
- _ts_metadata("design:type", Object)
98
- ], FormBase.prototype, "actionGroups", void 0);
99
- _ts_decorate([
100
- (0, _typeorm.Column)({
101
- type: 'boolean',
102
- nullable: false,
103
- default: true,
104
- name: 'is_active'
105
- }),
106
- _ts_metadata("design:type", Boolean)
107
- ], FormBase.prototype, "isActive", void 0);
108
- _ts_decorate([
109
- (0, _typeorm.Column)('simple-json', {
110
- nullable: true
111
- }),
112
- _ts_metadata("design:type", Object)
113
- ], FormBase.prototype, "metadata", void 0);
@@ -1,13 +0,0 @@
1
- import { Identity } from '@flusys/nestjs-shared';
2
- import { FormAccessType } from '../enums/form-access-type.enum';
3
- export declare abstract class FormBase extends Identity {
4
- name: string;
5
- description: string | null;
6
- slug: string | null;
7
- schema: Record<string, unknown>;
8
- schemaVersion: number;
9
- accessType: FormAccessType;
10
- actionGroups: string[] | null;
11
- isActive: boolean;
12
- metadata: Record<string, unknown> | null;
13
- }
@@ -1,106 +0,0 @@
1
- function _define_property(obj, key, value) {
2
- if (key in obj) {
3
- Object.defineProperty(obj, key, {
4
- value: value,
5
- enumerable: true,
6
- configurable: true,
7
- writable: true
8
- });
9
- } else {
10
- obj[key] = value;
11
- }
12
- return obj;
13
- }
14
- function _ts_decorate(decorators, target, key, desc) {
15
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
16
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
17
- else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
18
- return c > 3 && r && Object.defineProperty(target, key, r), r;
19
- }
20
- function _ts_metadata(k, v) {
21
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
22
- }
23
- import { Identity } from '@flusys/nestjs-shared';
24
- import { Column } from 'typeorm';
25
- import { FormAccessType } from '../enums/form-access-type.enum';
26
- /**
27
- * Form Base Entity
28
- * Core form fields - always included regardless of company feature
29
- */ export class FormBase extends Identity {
30
- constructor(...args){
31
- super(...args), _define_property(this, "name", void 0), _define_property(this, "description", void 0), _define_property(this, "slug", void 0), _define_property(this, "schema", void 0), _define_property(this, "schemaVersion", void 0), _define_property(this, "accessType", void 0), _define_property(this, "actionGroups", void 0), _define_property(this, "isActive", void 0), _define_property(this, "metadata", void 0);
32
- }
33
- }
34
- _ts_decorate([
35
- Column({
36
- type: 'varchar',
37
- length: 255,
38
- nullable: false
39
- }),
40
- _ts_metadata("design:type", String)
41
- ], FormBase.prototype, "name", void 0);
42
- _ts_decorate([
43
- Column({
44
- type: 'varchar',
45
- length: 500,
46
- nullable: true
47
- }),
48
- _ts_metadata("design:type", Object)
49
- ], FormBase.prototype, "description", void 0);
50
- _ts_decorate([
51
- Column({
52
- type: 'varchar',
53
- length: 255,
54
- nullable: true,
55
- unique: true
56
- }),
57
- _ts_metadata("design:type", Object)
58
- ], FormBase.prototype, "slug", void 0);
59
- _ts_decorate([
60
- Column({
61
- type: 'json',
62
- nullable: false
63
- }),
64
- _ts_metadata("design:type", typeof Record === "undefined" ? Object : Record)
65
- ], FormBase.prototype, "schema", void 0);
66
- _ts_decorate([
67
- Column({
68
- type: 'int',
69
- nullable: false,
70
- default: 1,
71
- name: 'schema_version'
72
- }),
73
- _ts_metadata("design:type", Number)
74
- ], FormBase.prototype, "schemaVersion", void 0);
75
- _ts_decorate([
76
- Column({
77
- type: 'enum',
78
- enum: FormAccessType,
79
- default: FormAccessType.AUTHENTICATED,
80
- name: 'access_type'
81
- }),
82
- _ts_metadata("design:type", typeof FormAccessType === "undefined" ? Object : FormAccessType)
83
- ], FormBase.prototype, "accessType", void 0);
84
- _ts_decorate([
85
- Column({
86
- type: 'simple-array',
87
- nullable: true,
88
- name: 'action_groups'
89
- }),
90
- _ts_metadata("design:type", Object)
91
- ], FormBase.prototype, "actionGroups", void 0);
92
- _ts_decorate([
93
- Column({
94
- type: 'boolean',
95
- nullable: false,
96
- default: true,
97
- name: 'is_active'
98
- }),
99
- _ts_metadata("design:type", Boolean)
100
- ], FormBase.prototype, "isActive", void 0);
101
- _ts_decorate([
102
- Column('simple-json', {
103
- nullable: true
104
- }),
105
- _ts_metadata("design:type", Object)
106
- ], FormBase.prototype, "metadata", void 0);