@sava-info-systems/api-maker-with-extensions 1.14.0 → 1.15.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.
@@ -256,6 +256,7 @@ export enum EErrorType {
256
256
  schemaNotFound = 'schemaNotFound',
257
257
  emailNotValid = 'emailNotValid',
258
258
  enumValidation = 'enumValidation',
259
+ virtualFieldUsedInFind = 'virtualFieldUsedInFind',
259
260
  }
260
261
 
261
262
  // Main interfaces
@@ -284,8 +285,25 @@ export interface ISchemaProperty { // Add new schema property in ValidateDBSchem
284
285
  collection?: string; // used as strings in _.get
285
286
  table?: string;
286
287
 
287
- // this column value will be return after nested save.
288
- column?: string; // user can define column of target collection here. so no need to define t_key in deep property. Used in getDataForDeep // used as strings in _.get
288
+ /**
289
+ * user can define column of target collection here. so no need to define t_key in deep property.
290
+ * this column value will be return after nested save.
291
+ * */
292
+ column?: string;
293
+
294
+ /**
295
+ * Used in virtual field deep populate.<br/>
296
+ * Current table's which column is used to generate this virtual field.
297
+ * */
298
+ s_columnVirtualLinker?: string;
299
+
300
+ /**
301
+ * Used for columns where isVirtualField is true.
302
+ * Need to place column name of target table which holds primary key value of this table.
303
+ * It is optional when target table has only one column, in which `collection/table` value is this collection/table name.
304
+ * */
305
+ t_columnVirtualLinker?: string;
306
+
289
307
  isPrimaryKey?: boolean;
290
308
 
291
309
  /** Database will take care of assigning incremental value for this field. */
@@ -312,6 +330,12 @@ export interface ISchemaProperty { // Add new schema property in ValidateDBSchem
312
330
  * By using optimistic concurrency control, you can ensure that updates are not overwritten by concurrent modifications, maintaining data integrity.<br/>
313
331
  * */
314
332
  isConcurrencyControlField?: boolean;
333
+
334
+ /**
335
+ * If true, means it is not actual field in database and just field in schema.
336
+ * Means we want it to use in deep populate and master save to get & store data in one API call.
337
+ * */
338
+ isVirtualField?: boolean;
315
339
  }
316
340
 
317
341
  export interface IIsAutoIncrementByAM {
@@ -343,7 +367,7 @@ export interface IPropertyConversion {
343
367
  * This default value will be converted to that type and applied.<br/>
344
368
  * Empty string and null values will be treated based on configuration.
345
369
  * */
346
- defaults?: IPropertyConversionDefaults
370
+ defaults?: IPropertyConversionDefaults;
347
371
 
348
372
  /** enable encryption for this property */
349
373
  encryption?: boolean | IEncryptionDescription;
@@ -590,11 +614,20 @@ export interface IQueryFormat {
590
614
 
591
615
  export interface IApiParamsDeepFormat {
592
616
  s_key: string;
617
+ /**
618
+ * Used in virtual field deep populate.<br/>
619
+ * Value of which key is used to compare with value of t_keyColumnVirtualLinker in target collection(t_col).
620
+ * */
621
+ s_keyColumnVirtualLinker?: string;
622
+
593
623
  // t_apiPath?: string;
594
624
  t_instance?: string;
595
625
  t_db?: string;
596
626
  t_col?: string;
627
+ /** Primary key of target collection/table */
597
628
  t_key?: string;
629
+ /** Column of target table which holds data to link to current table */
630
+ t_keyColumnVirtualLinker?: string;
598
631
  deep?: IApiParamsDeepFormat[] | string[] | string;
599
632
  select?: any;
600
633
 
@@ -607,6 +640,21 @@ export interface IApiParamsDeepFormat {
607
640
  // We process skip & limit while setting multiple data.
608
641
  skip?: number;
609
642
  limit?: number;
643
+
644
+ /**
645
+ * Can be used for fields having `isVirtualField: true` in schema.
646
+ * chunk = System will get data in chunks from database. It is default method with chunk size = 1000. <br/>
647
+ * one_by_one = System will get nested data one by one for each object. It should be used when we are using limit & skip for target table and it has large amount of data.<br/>
648
+ * */
649
+ fetchingTechnique?: 'chunk' | 'one_by_one';
650
+
651
+ /**
652
+ * Can be used for fields having `isVirtualField: true` in schema.
653
+ * */
654
+ fetchingTechniqueSettings?: {
655
+ /** Default : 1000 */
656
+ chunkSize?: number;
657
+ }
610
658
  }
611
659
 
612
660
  export interface IDeepFormat extends IApiParamsDeepFormat {
@@ -689,7 +737,7 @@ export interface IArrayOperationBody {
689
737
  export interface IArrayOperation {
690
738
  operation?: EArrayOperation;
691
739
  path?: string;
692
- dataToPush?: any[]; // $push, used for push operation. Array/Object of data to pushe in array.
740
+ dataToPush?: any[]; // $push, used for push operation. Array/Object of data to push in array.
693
741
  queryToRemove?: any; // $pull, query to remove docs from array.
694
742
  dataToPull?: any[]; // $pullAll, array of items which will be removed from array.
695
743
  direction?: -1 | 1; // $pop, -1 remove first, 1 remove last.
@@ -740,20 +788,55 @@ export interface ICustomApiSettingsTypes extends IAuthTokenInfoCommon {
740
788
  reqQueryParametersSchema?: ISchemaType;
741
789
 
742
790
  /**
743
- * 👉 If true, code will execute on original Node.js process and not in sandbox.<br/>
744
- * 👉 It makes code execution fast, Do not use it if you don't know what you are doing.<br/>
745
- * 👉 Bad code can make entire server freeze and give weird behaviour.<br/>
746
- * 👉 So, it can not use sandbox packages.<br/>
747
- * 👉 It can use Node.js inbuilt packages.<br/>
748
- * 👉 It can use packages from package.json of api_maker_be.<br/>
749
- * 👉 You can use all features of global variable 'g'.<br/>
791
+ * - If true, code will execute on original Node.js process and not in sandbox.<br/>
792
+ * - It makes code execution fast, Do not use it if you don't know what you are doing.<br/>
793
+ * - Bad code can make entire server freeze and give weird behaviour.<br/>
794
+ * - So, it can not use sandbox packages.<br/>
795
+ * - It can use Node.js inbuilt packages.<br/>
796
+ * - It can use packages from package.json of api_maker_be.<br/>
797
+ * - You can use all features of global variable 'g'.<br/>
750
798
  */
751
799
  runOnNativeProcess?: boolean;
752
800
 
753
- // calculated property
754
- errorList: string[]; // list of all errors thrown by this API.
755
- pathAndRequestMethod?: string;
801
+ /** list of all errors thrown by this API. */
802
+ errorList: string[];
756
803
  swaggerDocs?: ISwaggerDocsObj;
804
+
805
+ /** if runOnNativeProcess is true, these settings will have no effect. "Automatic Sandbox Restart In Seconds" will have no effect when this setting is provided. */
806
+ separateSandboxSettings?: ISeparateSandboxSettings;
807
+ }
808
+
809
+ export interface ISeparateSandboxSettings {
810
+ /**
811
+ * ex: Sandbox_Group_1, system will create separate sandbox for this particular entity and "Automatic Sandbox Restart In Seconds" will have no effect on this sandbox.
812
+ * All the packages of custom APIs having value "Sandbox_Group_1" will be available during execution.
813
+ * */
814
+ enableSeparateSandboxForThis?: string;
815
+
816
+ /**
817
+ * If any "separateSandboxSettings" has value in this, it will be used instead of "Sandbox Settings" DockerFile
818
+ * */
819
+ dockerFileOfSandbox?: string;
820
+
821
+ /** It works when we have enableSeparateSandboxForThis as true. */
822
+ packages?: {
823
+ /** If true, this sandbox will have all the packages of admin. */
824
+ allowAllPackagesOfAdmin?: boolean;
825
+
826
+ /** If allowAllPackagesOfAdmin == false, then this settings will be applicable and these packages will be installed on this particular sandbox. */
827
+ sandboxPackages?: {
828
+ name: string;
829
+ version: string;
830
+ }[];
831
+ }
832
+
833
+ /** Sandbox will be restarted automatically based on these settings without failing any request. */
834
+ autoRestart?: {
835
+ /**
836
+ * - It will work when enableSeparateSandboxForThis is true. <br/>
837
+ * - Sandbox will be restarted after it passes these much of time, after its creation. */
838
+ afterTheseMuchSeconds?: number;
839
+ }
757
840
  }
758
841
 
759
842
  export interface ISwaggerDocsObj {
@@ -776,7 +859,7 @@ export interface ISwaggerParametersEntity {
776
859
  example?: any,
777
860
  default?: any;
778
861
  enum?: any[];
779
- }
862
+ };
780
863
  }
781
864
 
782
865
  export enum ESwaggerParamInType {
@@ -1270,6 +1353,8 @@ export interface ICodeRunByResponse {
1270
1353
  workerId: string;
1271
1354
  port: number;
1272
1355
  publishToRedis?: boolean; // true = if request received by redis.
1356
+ enableSeparateSandboxForThis: string;
1357
+ allowAllPackagesOfAdmin: boolean;
1273
1358
  }
1274
1359
 
1275
1360
  export interface IAPIAccessGroupMeta {
@@ -27,5 +27,5 @@
27
27
  </style><link rel="stylesheet" href="styles-2H2JU2BI.css" media="print" onload="this.media='all'"><noscript><link rel="stylesheet" href="styles-2H2JU2BI.css"></noscript><link rel="modulepreload" href="chunk-MON7YFGF.js"></head>
28
28
  <body>
29
29
  <app-root></app-root>
30
- <script src="polyfills-6EAL64PA.js" type="module"></script><script src="main-TYGVEM3B.js" type="module"></script></body>
30
+ <script src="polyfills-6EAL64PA.js" type="module"></script><script src="main-CEUXXN7K.js" type="module"></script></body>
31
31
  </html>