mocody 0.7.0 → 0.8.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.
package/dist/index.d.cts CHANGED
@@ -222,7 +222,9 @@ declare abstract class RepoModel<T> {
222
222
  abstract mocody_getManyWithRelationPaginate<TQuery = T, TData = T, TSortKeyField extends string | number = string>(paramOption: IMocodyQueryIndexOptions<TQuery, TSortKeyField>): Promise<IMocodyPagingResult<TData[]>>;
223
223
  }
224
224
 
225
- interface ITableOptions$2<T> {
225
+ type ISchemaMap = Joi.SchemaMap;
226
+
227
+ interface ITableOptions$3<T> {
226
228
  dynamoDb: () => MocodyInitializerDynamo;
227
229
  secondaryIndexOptions: IMocodyIndexDefinition<T>[];
228
230
  tableFullName: string;
@@ -235,7 +237,7 @@ declare class DynamoManageTable<T> {
235
237
  private readonly dynamoDb;
236
238
  private readonly tableFullName;
237
239
  private readonly secondaryIndexOptions;
238
- constructor({ dynamoDb, secondaryIndexOptions, tableFullName, partitionKeyFieldName, sortKeyFieldName }: ITableOptions$2<T>);
240
+ constructor({ dynamoDb, secondaryIndexOptions, tableFullName, partitionKeyFieldName, sortKeyFieldName }: ITableOptions$3<T>);
239
241
  private _tbl_getLocalVariables;
240
242
  private _tbl_dynamoDb;
241
243
  mocody_tbl_getListOfTablesNamesOnline(): Promise<string[] | undefined>;
@@ -252,8 +254,8 @@ declare class DynamoManageTable<T> {
252
254
  mocody_tbl_deleteGlobalSecondaryIndex(indexName: string): Promise<string | null | undefined>;
253
255
  }
254
256
 
255
- interface IOptions$3<T> {
256
- schemaDef: Joi.SchemaMap;
257
+ interface IOptions$5<T> {
258
+ schemaDef: ISchemaMap;
257
259
  dynamoDbInitializer: () => MocodyInitializerDynamo;
258
260
  dataKeyGenerator: () => string;
259
261
  featureEntityValue: string;
@@ -280,7 +282,7 @@ declare class DynamoDataOperation<T> extends RepoModel<T> implements RepoModel<T
280
282
  private readonly _mocody_entityFieldsKeySet;
281
283
  private readonly _mocody_fieldAliases;
282
284
  private _mocody_tableManager;
283
- constructor({ schemaDef, dynamoDbInitializer, secondaryIndexOptions, featureEntityValue, baseTableName, strictRequiredFields, dataKeyGenerator, fieldAliases, }: IOptions$3<T>);
285
+ constructor({ schemaDef, dynamoDbInitializer, secondaryIndexOptions, featureEntityValue, baseTableName, strictRequiredFields, dataKeyGenerator, fieldAliases, }: IOptions$5<T>);
284
286
  mocody_tableManager(): DynamoManageTable<T>;
285
287
  private _mocody_dynamoInit;
286
288
  private _mocody_generateDynamoTableKey;
@@ -339,7 +341,7 @@ declare class DynamoDataOperation<T> extends RepoModel<T> implements RepoModel<T
339
341
  }
340
342
 
341
343
  type IBaseDef<T> = Omit<T & IMocodyCoreEntityModel, "">;
342
- type IFindOptions = {
344
+ type IFindOptions$1 = {
343
345
  featureEntity: string;
344
346
  skip: number | undefined;
345
347
  limit: number | undefined;
@@ -398,12 +400,12 @@ interface IProxyOptions {
398
400
  fields: string[];
399
401
  }[];
400
402
  }
401
- type IOptions$2 = IProxyOptions | ICookieOptions | IBasisOptions;
403
+ type IOptions$4 = IProxyOptions | ICookieOptions | IBasisOptions;
402
404
  declare class MocodyInitializerCouch {
403
405
  private _databaseInstance;
404
406
  private _documentScope;
405
407
  private readonly baseConfig;
406
- constructor(baseConfig: IOptions$2);
408
+ constructor(baseConfig: IOptions$4);
407
409
  deleteIndex({ ddoc, name }: {
408
410
  ddoc: string;
409
411
  name: string;
@@ -423,7 +425,7 @@ declare class MocodyInitializerCouch {
423
425
  }[];
424
426
  total_rows: number;
425
427
  }>;
426
- findPartitionedDocs({ featureEntity, selector, fields, use_index, sort, limit, skip }: IFindOptions): Promise<Nano__default.MangoResponse<IBaseDef<unknown>>>;
428
+ findPartitionedDocs({ featureEntity, selector, fields, use_index, sort, limit, skip }: IFindOptions$1): Promise<Nano__default.MangoResponse<IBaseDef<unknown>>>;
427
429
  getById({ nativeId }: {
428
430
  nativeId: string;
429
431
  }): Promise<(Nano__default.DocumentGetResponse & IBaseDef<unknown>) | null>;
@@ -462,7 +464,7 @@ declare class MocodyInitializerCouch {
462
464
  private getInstanceBase;
463
465
  }
464
466
 
465
- interface ITableOptions$1<T> {
467
+ interface ITableOptions$2<T> {
466
468
  couchDb: () => MocodyInitializerCouch;
467
469
  secondaryIndexOptions: IMocodyIndexDefinition<T>[];
468
470
  tableFullName: string;
@@ -475,7 +477,7 @@ declare class CouchManageTable<T> {
475
477
  private readonly couchDb;
476
478
  private readonly tableFullName;
477
479
  private readonly secondaryIndexOptions;
478
- constructor({ couchDb, secondaryIndexOptions, tableFullName, partitionKeyFieldName, sortKeyFieldName }: ITableOptions$1<T>);
480
+ constructor({ couchDb, secondaryIndexOptions, tableFullName, partitionKeyFieldName, sortKeyFieldName }: ITableOptions$2<T>);
479
481
  private _trickLinter;
480
482
  private _mocody_getInstance;
481
483
  mocody_createIndex({ indexName, fields }: {
@@ -506,8 +508,8 @@ declare class CouchManageTable<T> {
506
508
  mocody_createDefinedIndexes(): Promise<string[]>;
507
509
  }
508
510
 
509
- interface IOptions$1<T> {
510
- schemaDef: Joi.SchemaMap;
511
+ interface IOptions$3<T> {
512
+ schemaDef: ISchemaMap;
511
513
  couchDbInitializer: () => MocodyInitializerCouch;
512
514
  dataKeyGenerator: () => string;
513
515
  featureEntityValue: string;
@@ -531,7 +533,7 @@ declare class CouchDataOperation<T> extends RepoModel<T> implements RepoModel<T>
531
533
  private readonly _mocody_filterQueryOperation;
532
534
  private readonly _mocody_fieldAliases;
533
535
  private _mocody_tableManager;
534
- constructor({ schemaDef, couchDbInitializer, secondaryIndexOptions, featureEntityValue, baseTableName, strictRequiredFields, dataKeyGenerator, fieldAliases, }: IOptions$1<T>);
536
+ constructor({ schemaDef, couchDbInitializer, secondaryIndexOptions, featureEntityValue, baseTableName, strictRequiredFields, dataKeyGenerator, fieldAliases, }: IOptions$3<T>);
535
537
  mocody_tableManager(): CouchManageTable<T>;
536
538
  private _mocody_generateDynamoTableKey;
537
539
  private _mocody_couchDbInstance;
@@ -607,7 +609,7 @@ declare class MocodyInitializerMongo {
607
609
  close(): Promise<void>;
608
610
  }
609
611
 
610
- interface ITableOptions<T> {
612
+ interface ITableOptions$1<T> {
611
613
  mongoDb: () => MocodyInitializerMongo;
612
614
  secondaryIndexOptions: IMocodyIndexDefinition<T>[];
613
615
  tableFullName: string;
@@ -620,7 +622,7 @@ declare class MongoManageTable<T> {
620
622
  private readonly mongoDb;
621
623
  private readonly tableFullName;
622
624
  private readonly secondaryIndexOptions;
623
- constructor({ mongoDb, secondaryIndexOptions, tableFullName, partitionKeyFieldName, sortKeyFieldName }: ITableOptions<T>);
625
+ constructor({ mongoDb, secondaryIndexOptions, tableFullName, partitionKeyFieldName, sortKeyFieldName }: ITableOptions$1<T>);
624
626
  private _trickLinter;
625
627
  private _mocody_getInstance;
626
628
  mocody_createIndex({ indexName, fields }: {
@@ -636,8 +638,8 @@ declare class MongoManageTable<T> {
636
638
  mocody_createDefinedIndexes(): Promise<string[]>;
637
639
  }
638
640
 
639
- interface IOptions<T> {
640
- schemaDef: Joi.SchemaMap;
641
+ interface IOptions$2<T> {
642
+ schemaDef: ISchemaMap;
641
643
  mongoDbInitializer: () => MocodyInitializerMongo;
642
644
  dataKeyGenerator: () => string;
643
645
  featureEntityValue: string;
@@ -661,7 +663,7 @@ declare class MongoDataOperation<T> extends RepoModel<T> implements RepoModel<T>
661
663
  private readonly _mocody_filterQueryOperation;
662
664
  private readonly _mocody_fieldAliases;
663
665
  private _mocody_tableManager;
664
- constructor({ schemaDef, mongoDbInitializer, secondaryIndexOptions, featureEntityValue, baseTableName, strictRequiredFields, dataKeyGenerator, fieldAliases, }: IOptions<T>);
666
+ constructor({ schemaDef, mongoDbInitializer, secondaryIndexOptions, featureEntityValue, baseTableName, strictRequiredFields, dataKeyGenerator, fieldAliases, }: IOptions$2<T>);
665
667
  mocody_tableManager(): MongoManageTable<T>;
666
668
  private _mocody_generateDynamoTableKey;
667
669
  private _mocody_getDbInstance;
@@ -720,4 +722,195 @@ declare class MongoDataOperation<T> extends RepoModel<T> implements RepoModel<T>
720
722
  }): Promise<T>;
721
723
  }
722
724
 
723
- export { CouchDataOperation, DynamoDataOperation, type IMocodyCoreEntityModel, type IMocodyFieldAliases, type IMocodyFieldCondition, type IMocodyIndexDefinition, type IMocodyKeyConditionParams, type IMocodyPagingParams, type IMocodyPagingResult, type IMocodyPreparedTransaction, type IMocodyQueryConditionParams, type IMocodyQueryDefinition, type IMocodyQueryIndexOptions, type IMocodyQueryIndexOptionsNoPaging, MocodyGenericError, MocodyInitializerCouch, MocodyInitializerDynamo, MocodyInitializerMongo, MocodyUtil, MongoDataOperation };
725
+ type IFindOptions = {
726
+ featureEntity: string;
727
+ skip: number | undefined;
728
+ limit: number | undefined;
729
+ selector: Nano__default.MangoSelector;
730
+ fields: string[] | undefined;
731
+ use_index: string;
732
+ sort?: {
733
+ [propName: string]: "asc" | "desc";
734
+ }[];
735
+ };
736
+ type IOptions$1 = {
737
+ connType: "LOCAL_FIRST" | "REMOTE_FIRST";
738
+ localSqliteDbFilePath?: string;
739
+ remoteConnectionUrl?: string;
740
+ liveSync?: boolean;
741
+ indexes?: {
742
+ indexName: string;
743
+ fields: string[];
744
+ }[];
745
+ };
746
+ declare class MocodyInitializerPouch<T extends IMocodyCoreEntityModel> {
747
+ private _pouchInstance;
748
+ private readonly _docMetaFieldsObJ;
749
+ private readonly baseConfig;
750
+ constructor(baseConfig: IOptions$1);
751
+ deleteIndex({ ddoc, name }: {
752
+ ddoc: string;
753
+ name: string;
754
+ }): Promise<PouchDB.Find.DeleteIndexResponse<T>>;
755
+ private pouch_deleteIndex;
756
+ getIndexes(): Promise<PouchDB.Find.GetIndexesResponse<T>>;
757
+ private pouch_getIndexes;
758
+ createIndex({ indexName, fields }: {
759
+ indexName: string;
760
+ fields: string[];
761
+ }): Promise<void>;
762
+ private pouch_createIndex;
763
+ getById({ nativeId }: {
764
+ nativeId: string;
765
+ }): Promise<T>;
766
+ pouch_getById({ nativeId }: {
767
+ nativeId: string;
768
+ }): Promise<T & PouchDB.Core.IdMeta & PouchDB.Core.GetMeta>;
769
+ getManyByIds({ nativeIds }: {
770
+ nativeIds: string[];
771
+ }): Promise<T[]>;
772
+ pouch_getManyByIds({ nativeIds }: {
773
+ nativeIds: string[];
774
+ }): Promise<PouchDB.Core.AllDocsWithKeysResponse<T>>;
775
+ createDoc({ validatedData }: {
776
+ validatedData: any;
777
+ }): Promise<PouchDB.Core.Response>;
778
+ private pouch_createDoc;
779
+ updateDoc({ docRev, validatedData }: {
780
+ docRev: string;
781
+ validatedData: any;
782
+ }): Promise<PouchDB.Core.Response>;
783
+ private pouch_updateDoc;
784
+ pouch_getList({ featureEntity, size, skip }: {
785
+ featureEntity: string;
786
+ size?: number | null;
787
+ skip?: number | null;
788
+ }): Promise<PouchDB.Core.AllDocsResponse<T>>;
789
+ findPartitionedDocs({ featureEntity, selector, fields, use_index, sort, limit, skip }: IFindOptions): Promise<PouchDB.Find.FindResponse<T>>;
790
+ private pouch_findPartitionedDocs;
791
+ deleteById({ nativeId }: {
792
+ nativeId: string;
793
+ }): Promise<PouchDB.Core.Response>;
794
+ pouch_deleteById({ nativeId }: {
795
+ nativeId: string;
796
+ }): Promise<PouchDB.Core.Response>;
797
+ pouch_getDbInstance(): Promise<PouchDB.Database<T>>;
798
+ private pouch_getDbInstanceBase;
799
+ private toBasicDoc_RemovePouchMeta;
800
+ private docMetaFieldsObject;
801
+ }
802
+
803
+ interface ITableOptions<T extends IMocodyCoreEntityModel> {
804
+ pouchDb: () => MocodyInitializerPouch<T>;
805
+ secondaryIndexOptions: IMocodyIndexDefinition<T>[];
806
+ tableFullName: string;
807
+ partitionKeyFieldName: string;
808
+ sortKeyFieldName: string;
809
+ }
810
+ declare class PouchManageTable<T extends IMocodyCoreEntityModel> {
811
+ private readonly partitionKeyFieldName;
812
+ private readonly sortKeyFieldName;
813
+ private readonly pouchDb;
814
+ private readonly tableFullName;
815
+ private readonly secondaryIndexOptions;
816
+ constructor({ pouchDb, secondaryIndexOptions, tableFullName, partitionKeyFieldName, sortKeyFieldName }: ITableOptions<T>);
817
+ private _trickLinter;
818
+ private _mocody_getInstance;
819
+ mocody_createIndex({ indexName, fields }: {
820
+ indexName: string;
821
+ fields: string[];
822
+ }): Promise<void>;
823
+ mocody_clearAllIndexes(): Promise<{
824
+ deletedIndexes: any[];
825
+ }>;
826
+ mocody_getIndexes(): Promise<PouchDB.Find.GetIndexesResponse<T>>;
827
+ mocody_createDefinedIndexes(): Promise<string[]>;
828
+ }
829
+
830
+ interface IOptions<T extends IMocodyCoreEntityModel> {
831
+ schemaDef: ISchemaMap;
832
+ pouchDbInitializer: () => MocodyInitializerPouch<T>;
833
+ dataKeyGenerator: () => string;
834
+ featureEntityValue: string;
835
+ secondaryIndexOptions: IMocodyIndexDefinition<T>[];
836
+ baseTableName: string;
837
+ strictRequiredFields: (keyof T)[] | string[];
838
+ fieldAliases?: IMocodyFieldAliases<T> | undefined | null;
839
+ }
840
+ declare class PouchDataOperation<T extends IMocodyCoreEntityModel> extends RepoModel<T> implements RepoModel<T> {
841
+ private readonly _mocody_partitionKeyFieldName;
842
+ private readonly _mocody_sortKeyFieldName;
843
+ private readonly _mocody_operationNotSuccessful;
844
+ private readonly _mocody_entityFieldsKeySet;
845
+ private readonly _mocody_pouchDb;
846
+ private readonly _mocody_dataKeyGenerator;
847
+ private readonly _mocody_schema;
848
+ private readonly _mocody_tableFullName;
849
+ private readonly _mocody_strictRequiredFields;
850
+ private readonly _mocody_featureEntityValue;
851
+ private readonly _mocody_secondaryIndexOptions;
852
+ private readonly _mocody_filterQueryOperation;
853
+ private readonly _mocody_fieldAliases;
854
+ private _mocody_tableManager;
855
+ constructor({ schemaDef, pouchDbInitializer, secondaryIndexOptions, featureEntityValue, baseTableName, strictRequiredFields, dataKeyGenerator, fieldAliases, }: IOptions<T>);
856
+ mocody_tableManager(): PouchManageTable<T>;
857
+ private _mocody_generateDynamoTableKey;
858
+ private _mocody_pouchDbInstance;
859
+ private _mocody_getLocalVariables;
860
+ private _mocody_getProjectionFields;
861
+ private _mocody_stripNonRequiredOutputData;
862
+ private _mocody_getNativePouchId;
863
+ private _mocody_getBaseObject;
864
+ private _mocody_withConditionPassed;
865
+ private _mocody_checkValidateMustBeAnObjectDataType;
866
+ private _mocody_checkValidateStrictRequiredFields;
867
+ private _mocody_removeDuplicateString;
868
+ private _mocody_allHelpValidateGetValue;
869
+ private _mocody_createGenericError;
870
+ mocody_createOne({ data }: {
871
+ data: T;
872
+ }): Promise<T>;
873
+ mocody_formatForDump({ dataList }: {
874
+ dataList: T[];
875
+ }): Promise<string[]>;
876
+ mocody_validateFormatData({ data }: {
877
+ data: T;
878
+ }): Promise<string>;
879
+ private _mocody_validateReady;
880
+ mocody_getAll({ size, skip }: {
881
+ size?: number | undefined | null;
882
+ skip?: number | undefined | null;
883
+ }): Promise<T[]>;
884
+ mocody_getOneById({ dataId, withCondition, }: {
885
+ dataId: string;
886
+ withCondition?: IMocodyFieldCondition<T> | undefined | null;
887
+ }): Promise<T | null>;
888
+ mocody_updateOne({ dataId, updateData, withCondition, }: {
889
+ dataId: string;
890
+ updateData: Partial<T>;
891
+ withCondition?: IMocodyFieldCondition<T> | undefined | null;
892
+ }): Promise<T>;
893
+ mocody_prepareTransaction({ transactPrepareInfo, }: {
894
+ transactPrepareInfo: IMocodyTransactionPrepare<T>[];
895
+ }): Promise<IMocodyPreparedTransaction[]>;
896
+ mocody_executeTransaction({ transactInfo }: {
897
+ transactInfo: IMocodyPreparedTransaction[];
898
+ }): Promise<void>;
899
+ mocody_getManyByIds({ dataIds, fields, excludeFields, withCondition, }: {
900
+ dataIds: string[];
901
+ fields?: (keyof T)[] | undefined | null;
902
+ excludeFields?: (keyof T)[] | undefined | null;
903
+ withCondition?: IMocodyFieldCondition<T> | undefined | null;
904
+ }): Promise<T[]>;
905
+ mocody_getManyByIndex<TData = T, TSortKeyField extends string | number = string>(paramOption: IMocodyQueryIndexOptionsNoPaging<TData, TSortKeyField>): Promise<TData[]>;
906
+ mocody_getManyByIndexPaginate<TData = T, TSortKeyField extends string | number = string>(paramOption: IMocodyQueryIndexOptions<TData, TSortKeyField>): Promise<IMocodyPagingResult<TData[]>>;
907
+ mocody_getManyWithRelation<TQuery = T, TData = T, TSortKeyField extends string | number = string>(paramOption: Omit<IMocodyQueryIndexOptions<TQuery, TSortKeyField>, "pagingParams"> & {}): Promise<TData[]>;
908
+ mocody_getManyWithRelationPaginate<TQuery = T, TData = T, TSortKeyField extends string | number = string>(paramOption: IMocodyQueryIndexOptions<TQuery, TSortKeyField>): Promise<IMocodyPagingResult<TData[]>>;
909
+ private _mocody_getManyBySecondaryIndexPaginateBase;
910
+ mocody_deleteById({ dataId, withCondition, }: {
911
+ dataId: string;
912
+ withCondition?: IMocodyFieldCondition<T> | undefined | null;
913
+ }): Promise<T>;
914
+ }
915
+
916
+ export { CouchDataOperation, DynamoDataOperation, type IMocodyCoreEntityModel, type IMocodyFieldAliases, type IMocodyFieldCondition, type IMocodyIndexDefinition, type IMocodyKeyConditionParams, type IMocodyPagingParams, type IMocodyPagingResult, type IMocodyPreparedTransaction, type IMocodyQueryConditionParams, type IMocodyQueryDefinition, type IMocodyQueryIndexOptions, type IMocodyQueryIndexOptionsNoPaging, MocodyGenericError, MocodyInitializerCouch, MocodyInitializerDynamo, MocodyInitializerMongo, MocodyInitializerPouch, MocodyUtil, MongoDataOperation, PouchDataOperation };
package/dist/index.d.ts CHANGED
@@ -222,7 +222,9 @@ declare abstract class RepoModel<T> {
222
222
  abstract mocody_getManyWithRelationPaginate<TQuery = T, TData = T, TSortKeyField extends string | number = string>(paramOption: IMocodyQueryIndexOptions<TQuery, TSortKeyField>): Promise<IMocodyPagingResult<TData[]>>;
223
223
  }
224
224
 
225
- interface ITableOptions$2<T> {
225
+ type ISchemaMap = Joi.SchemaMap;
226
+
227
+ interface ITableOptions$3<T> {
226
228
  dynamoDb: () => MocodyInitializerDynamo;
227
229
  secondaryIndexOptions: IMocodyIndexDefinition<T>[];
228
230
  tableFullName: string;
@@ -235,7 +237,7 @@ declare class DynamoManageTable<T> {
235
237
  private readonly dynamoDb;
236
238
  private readonly tableFullName;
237
239
  private readonly secondaryIndexOptions;
238
- constructor({ dynamoDb, secondaryIndexOptions, tableFullName, partitionKeyFieldName, sortKeyFieldName }: ITableOptions$2<T>);
240
+ constructor({ dynamoDb, secondaryIndexOptions, tableFullName, partitionKeyFieldName, sortKeyFieldName }: ITableOptions$3<T>);
239
241
  private _tbl_getLocalVariables;
240
242
  private _tbl_dynamoDb;
241
243
  mocody_tbl_getListOfTablesNamesOnline(): Promise<string[] | undefined>;
@@ -252,8 +254,8 @@ declare class DynamoManageTable<T> {
252
254
  mocody_tbl_deleteGlobalSecondaryIndex(indexName: string): Promise<string | null | undefined>;
253
255
  }
254
256
 
255
- interface IOptions$3<T> {
256
- schemaDef: Joi.SchemaMap;
257
+ interface IOptions$5<T> {
258
+ schemaDef: ISchemaMap;
257
259
  dynamoDbInitializer: () => MocodyInitializerDynamo;
258
260
  dataKeyGenerator: () => string;
259
261
  featureEntityValue: string;
@@ -280,7 +282,7 @@ declare class DynamoDataOperation<T> extends RepoModel<T> implements RepoModel<T
280
282
  private readonly _mocody_entityFieldsKeySet;
281
283
  private readonly _mocody_fieldAliases;
282
284
  private _mocody_tableManager;
283
- constructor({ schemaDef, dynamoDbInitializer, secondaryIndexOptions, featureEntityValue, baseTableName, strictRequiredFields, dataKeyGenerator, fieldAliases, }: IOptions$3<T>);
285
+ constructor({ schemaDef, dynamoDbInitializer, secondaryIndexOptions, featureEntityValue, baseTableName, strictRequiredFields, dataKeyGenerator, fieldAliases, }: IOptions$5<T>);
284
286
  mocody_tableManager(): DynamoManageTable<T>;
285
287
  private _mocody_dynamoInit;
286
288
  private _mocody_generateDynamoTableKey;
@@ -339,7 +341,7 @@ declare class DynamoDataOperation<T> extends RepoModel<T> implements RepoModel<T
339
341
  }
340
342
 
341
343
  type IBaseDef<T> = Omit<T & IMocodyCoreEntityModel, "">;
342
- type IFindOptions = {
344
+ type IFindOptions$1 = {
343
345
  featureEntity: string;
344
346
  skip: number | undefined;
345
347
  limit: number | undefined;
@@ -398,12 +400,12 @@ interface IProxyOptions {
398
400
  fields: string[];
399
401
  }[];
400
402
  }
401
- type IOptions$2 = IProxyOptions | ICookieOptions | IBasisOptions;
403
+ type IOptions$4 = IProxyOptions | ICookieOptions | IBasisOptions;
402
404
  declare class MocodyInitializerCouch {
403
405
  private _databaseInstance;
404
406
  private _documentScope;
405
407
  private readonly baseConfig;
406
- constructor(baseConfig: IOptions$2);
408
+ constructor(baseConfig: IOptions$4);
407
409
  deleteIndex({ ddoc, name }: {
408
410
  ddoc: string;
409
411
  name: string;
@@ -423,7 +425,7 @@ declare class MocodyInitializerCouch {
423
425
  }[];
424
426
  total_rows: number;
425
427
  }>;
426
- findPartitionedDocs({ featureEntity, selector, fields, use_index, sort, limit, skip }: IFindOptions): Promise<Nano__default.MangoResponse<IBaseDef<unknown>>>;
428
+ findPartitionedDocs({ featureEntity, selector, fields, use_index, sort, limit, skip }: IFindOptions$1): Promise<Nano__default.MangoResponse<IBaseDef<unknown>>>;
427
429
  getById({ nativeId }: {
428
430
  nativeId: string;
429
431
  }): Promise<(Nano__default.DocumentGetResponse & IBaseDef<unknown>) | null>;
@@ -462,7 +464,7 @@ declare class MocodyInitializerCouch {
462
464
  private getInstanceBase;
463
465
  }
464
466
 
465
- interface ITableOptions$1<T> {
467
+ interface ITableOptions$2<T> {
466
468
  couchDb: () => MocodyInitializerCouch;
467
469
  secondaryIndexOptions: IMocodyIndexDefinition<T>[];
468
470
  tableFullName: string;
@@ -475,7 +477,7 @@ declare class CouchManageTable<T> {
475
477
  private readonly couchDb;
476
478
  private readonly tableFullName;
477
479
  private readonly secondaryIndexOptions;
478
- constructor({ couchDb, secondaryIndexOptions, tableFullName, partitionKeyFieldName, sortKeyFieldName }: ITableOptions$1<T>);
480
+ constructor({ couchDb, secondaryIndexOptions, tableFullName, partitionKeyFieldName, sortKeyFieldName }: ITableOptions$2<T>);
479
481
  private _trickLinter;
480
482
  private _mocody_getInstance;
481
483
  mocody_createIndex({ indexName, fields }: {
@@ -506,8 +508,8 @@ declare class CouchManageTable<T> {
506
508
  mocody_createDefinedIndexes(): Promise<string[]>;
507
509
  }
508
510
 
509
- interface IOptions$1<T> {
510
- schemaDef: Joi.SchemaMap;
511
+ interface IOptions$3<T> {
512
+ schemaDef: ISchemaMap;
511
513
  couchDbInitializer: () => MocodyInitializerCouch;
512
514
  dataKeyGenerator: () => string;
513
515
  featureEntityValue: string;
@@ -531,7 +533,7 @@ declare class CouchDataOperation<T> extends RepoModel<T> implements RepoModel<T>
531
533
  private readonly _mocody_filterQueryOperation;
532
534
  private readonly _mocody_fieldAliases;
533
535
  private _mocody_tableManager;
534
- constructor({ schemaDef, couchDbInitializer, secondaryIndexOptions, featureEntityValue, baseTableName, strictRequiredFields, dataKeyGenerator, fieldAliases, }: IOptions$1<T>);
536
+ constructor({ schemaDef, couchDbInitializer, secondaryIndexOptions, featureEntityValue, baseTableName, strictRequiredFields, dataKeyGenerator, fieldAliases, }: IOptions$3<T>);
535
537
  mocody_tableManager(): CouchManageTable<T>;
536
538
  private _mocody_generateDynamoTableKey;
537
539
  private _mocody_couchDbInstance;
@@ -607,7 +609,7 @@ declare class MocodyInitializerMongo {
607
609
  close(): Promise<void>;
608
610
  }
609
611
 
610
- interface ITableOptions<T> {
612
+ interface ITableOptions$1<T> {
611
613
  mongoDb: () => MocodyInitializerMongo;
612
614
  secondaryIndexOptions: IMocodyIndexDefinition<T>[];
613
615
  tableFullName: string;
@@ -620,7 +622,7 @@ declare class MongoManageTable<T> {
620
622
  private readonly mongoDb;
621
623
  private readonly tableFullName;
622
624
  private readonly secondaryIndexOptions;
623
- constructor({ mongoDb, secondaryIndexOptions, tableFullName, partitionKeyFieldName, sortKeyFieldName }: ITableOptions<T>);
625
+ constructor({ mongoDb, secondaryIndexOptions, tableFullName, partitionKeyFieldName, sortKeyFieldName }: ITableOptions$1<T>);
624
626
  private _trickLinter;
625
627
  private _mocody_getInstance;
626
628
  mocody_createIndex({ indexName, fields }: {
@@ -636,8 +638,8 @@ declare class MongoManageTable<T> {
636
638
  mocody_createDefinedIndexes(): Promise<string[]>;
637
639
  }
638
640
 
639
- interface IOptions<T> {
640
- schemaDef: Joi.SchemaMap;
641
+ interface IOptions$2<T> {
642
+ schemaDef: ISchemaMap;
641
643
  mongoDbInitializer: () => MocodyInitializerMongo;
642
644
  dataKeyGenerator: () => string;
643
645
  featureEntityValue: string;
@@ -661,7 +663,7 @@ declare class MongoDataOperation<T> extends RepoModel<T> implements RepoModel<T>
661
663
  private readonly _mocody_filterQueryOperation;
662
664
  private readonly _mocody_fieldAliases;
663
665
  private _mocody_tableManager;
664
- constructor({ schemaDef, mongoDbInitializer, secondaryIndexOptions, featureEntityValue, baseTableName, strictRequiredFields, dataKeyGenerator, fieldAliases, }: IOptions<T>);
666
+ constructor({ schemaDef, mongoDbInitializer, secondaryIndexOptions, featureEntityValue, baseTableName, strictRequiredFields, dataKeyGenerator, fieldAliases, }: IOptions$2<T>);
665
667
  mocody_tableManager(): MongoManageTable<T>;
666
668
  private _mocody_generateDynamoTableKey;
667
669
  private _mocody_getDbInstance;
@@ -720,4 +722,195 @@ declare class MongoDataOperation<T> extends RepoModel<T> implements RepoModel<T>
720
722
  }): Promise<T>;
721
723
  }
722
724
 
723
- export { CouchDataOperation, DynamoDataOperation, type IMocodyCoreEntityModel, type IMocodyFieldAliases, type IMocodyFieldCondition, type IMocodyIndexDefinition, type IMocodyKeyConditionParams, type IMocodyPagingParams, type IMocodyPagingResult, type IMocodyPreparedTransaction, type IMocodyQueryConditionParams, type IMocodyQueryDefinition, type IMocodyQueryIndexOptions, type IMocodyQueryIndexOptionsNoPaging, MocodyGenericError, MocodyInitializerCouch, MocodyInitializerDynamo, MocodyInitializerMongo, MocodyUtil, MongoDataOperation };
725
+ type IFindOptions = {
726
+ featureEntity: string;
727
+ skip: number | undefined;
728
+ limit: number | undefined;
729
+ selector: Nano__default.MangoSelector;
730
+ fields: string[] | undefined;
731
+ use_index: string;
732
+ sort?: {
733
+ [propName: string]: "asc" | "desc";
734
+ }[];
735
+ };
736
+ type IOptions$1 = {
737
+ connType: "LOCAL_FIRST" | "REMOTE_FIRST";
738
+ localSqliteDbFilePath?: string;
739
+ remoteConnectionUrl?: string;
740
+ liveSync?: boolean;
741
+ indexes?: {
742
+ indexName: string;
743
+ fields: string[];
744
+ }[];
745
+ };
746
+ declare class MocodyInitializerPouch<T extends IMocodyCoreEntityModel> {
747
+ private _pouchInstance;
748
+ private readonly _docMetaFieldsObJ;
749
+ private readonly baseConfig;
750
+ constructor(baseConfig: IOptions$1);
751
+ deleteIndex({ ddoc, name }: {
752
+ ddoc: string;
753
+ name: string;
754
+ }): Promise<PouchDB.Find.DeleteIndexResponse<T>>;
755
+ private pouch_deleteIndex;
756
+ getIndexes(): Promise<PouchDB.Find.GetIndexesResponse<T>>;
757
+ private pouch_getIndexes;
758
+ createIndex({ indexName, fields }: {
759
+ indexName: string;
760
+ fields: string[];
761
+ }): Promise<void>;
762
+ private pouch_createIndex;
763
+ getById({ nativeId }: {
764
+ nativeId: string;
765
+ }): Promise<T>;
766
+ pouch_getById({ nativeId }: {
767
+ nativeId: string;
768
+ }): Promise<T & PouchDB.Core.IdMeta & PouchDB.Core.GetMeta>;
769
+ getManyByIds({ nativeIds }: {
770
+ nativeIds: string[];
771
+ }): Promise<T[]>;
772
+ pouch_getManyByIds({ nativeIds }: {
773
+ nativeIds: string[];
774
+ }): Promise<PouchDB.Core.AllDocsWithKeysResponse<T>>;
775
+ createDoc({ validatedData }: {
776
+ validatedData: any;
777
+ }): Promise<PouchDB.Core.Response>;
778
+ private pouch_createDoc;
779
+ updateDoc({ docRev, validatedData }: {
780
+ docRev: string;
781
+ validatedData: any;
782
+ }): Promise<PouchDB.Core.Response>;
783
+ private pouch_updateDoc;
784
+ pouch_getList({ featureEntity, size, skip }: {
785
+ featureEntity: string;
786
+ size?: number | null;
787
+ skip?: number | null;
788
+ }): Promise<PouchDB.Core.AllDocsResponse<T>>;
789
+ findPartitionedDocs({ featureEntity, selector, fields, use_index, sort, limit, skip }: IFindOptions): Promise<PouchDB.Find.FindResponse<T>>;
790
+ private pouch_findPartitionedDocs;
791
+ deleteById({ nativeId }: {
792
+ nativeId: string;
793
+ }): Promise<PouchDB.Core.Response>;
794
+ pouch_deleteById({ nativeId }: {
795
+ nativeId: string;
796
+ }): Promise<PouchDB.Core.Response>;
797
+ pouch_getDbInstance(): Promise<PouchDB.Database<T>>;
798
+ private pouch_getDbInstanceBase;
799
+ private toBasicDoc_RemovePouchMeta;
800
+ private docMetaFieldsObject;
801
+ }
802
+
803
+ interface ITableOptions<T extends IMocodyCoreEntityModel> {
804
+ pouchDb: () => MocodyInitializerPouch<T>;
805
+ secondaryIndexOptions: IMocodyIndexDefinition<T>[];
806
+ tableFullName: string;
807
+ partitionKeyFieldName: string;
808
+ sortKeyFieldName: string;
809
+ }
810
+ declare class PouchManageTable<T extends IMocodyCoreEntityModel> {
811
+ private readonly partitionKeyFieldName;
812
+ private readonly sortKeyFieldName;
813
+ private readonly pouchDb;
814
+ private readonly tableFullName;
815
+ private readonly secondaryIndexOptions;
816
+ constructor({ pouchDb, secondaryIndexOptions, tableFullName, partitionKeyFieldName, sortKeyFieldName }: ITableOptions<T>);
817
+ private _trickLinter;
818
+ private _mocody_getInstance;
819
+ mocody_createIndex({ indexName, fields }: {
820
+ indexName: string;
821
+ fields: string[];
822
+ }): Promise<void>;
823
+ mocody_clearAllIndexes(): Promise<{
824
+ deletedIndexes: any[];
825
+ }>;
826
+ mocody_getIndexes(): Promise<PouchDB.Find.GetIndexesResponse<T>>;
827
+ mocody_createDefinedIndexes(): Promise<string[]>;
828
+ }
829
+
830
+ interface IOptions<T extends IMocodyCoreEntityModel> {
831
+ schemaDef: ISchemaMap;
832
+ pouchDbInitializer: () => MocodyInitializerPouch<T>;
833
+ dataKeyGenerator: () => string;
834
+ featureEntityValue: string;
835
+ secondaryIndexOptions: IMocodyIndexDefinition<T>[];
836
+ baseTableName: string;
837
+ strictRequiredFields: (keyof T)[] | string[];
838
+ fieldAliases?: IMocodyFieldAliases<T> | undefined | null;
839
+ }
840
+ declare class PouchDataOperation<T extends IMocodyCoreEntityModel> extends RepoModel<T> implements RepoModel<T> {
841
+ private readonly _mocody_partitionKeyFieldName;
842
+ private readonly _mocody_sortKeyFieldName;
843
+ private readonly _mocody_operationNotSuccessful;
844
+ private readonly _mocody_entityFieldsKeySet;
845
+ private readonly _mocody_pouchDb;
846
+ private readonly _mocody_dataKeyGenerator;
847
+ private readonly _mocody_schema;
848
+ private readonly _mocody_tableFullName;
849
+ private readonly _mocody_strictRequiredFields;
850
+ private readonly _mocody_featureEntityValue;
851
+ private readonly _mocody_secondaryIndexOptions;
852
+ private readonly _mocody_filterQueryOperation;
853
+ private readonly _mocody_fieldAliases;
854
+ private _mocody_tableManager;
855
+ constructor({ schemaDef, pouchDbInitializer, secondaryIndexOptions, featureEntityValue, baseTableName, strictRequiredFields, dataKeyGenerator, fieldAliases, }: IOptions<T>);
856
+ mocody_tableManager(): PouchManageTable<T>;
857
+ private _mocody_generateDynamoTableKey;
858
+ private _mocody_pouchDbInstance;
859
+ private _mocody_getLocalVariables;
860
+ private _mocody_getProjectionFields;
861
+ private _mocody_stripNonRequiredOutputData;
862
+ private _mocody_getNativePouchId;
863
+ private _mocody_getBaseObject;
864
+ private _mocody_withConditionPassed;
865
+ private _mocody_checkValidateMustBeAnObjectDataType;
866
+ private _mocody_checkValidateStrictRequiredFields;
867
+ private _mocody_removeDuplicateString;
868
+ private _mocody_allHelpValidateGetValue;
869
+ private _mocody_createGenericError;
870
+ mocody_createOne({ data }: {
871
+ data: T;
872
+ }): Promise<T>;
873
+ mocody_formatForDump({ dataList }: {
874
+ dataList: T[];
875
+ }): Promise<string[]>;
876
+ mocody_validateFormatData({ data }: {
877
+ data: T;
878
+ }): Promise<string>;
879
+ private _mocody_validateReady;
880
+ mocody_getAll({ size, skip }: {
881
+ size?: number | undefined | null;
882
+ skip?: number | undefined | null;
883
+ }): Promise<T[]>;
884
+ mocody_getOneById({ dataId, withCondition, }: {
885
+ dataId: string;
886
+ withCondition?: IMocodyFieldCondition<T> | undefined | null;
887
+ }): Promise<T | null>;
888
+ mocody_updateOne({ dataId, updateData, withCondition, }: {
889
+ dataId: string;
890
+ updateData: Partial<T>;
891
+ withCondition?: IMocodyFieldCondition<T> | undefined | null;
892
+ }): Promise<T>;
893
+ mocody_prepareTransaction({ transactPrepareInfo, }: {
894
+ transactPrepareInfo: IMocodyTransactionPrepare<T>[];
895
+ }): Promise<IMocodyPreparedTransaction[]>;
896
+ mocody_executeTransaction({ transactInfo }: {
897
+ transactInfo: IMocodyPreparedTransaction[];
898
+ }): Promise<void>;
899
+ mocody_getManyByIds({ dataIds, fields, excludeFields, withCondition, }: {
900
+ dataIds: string[];
901
+ fields?: (keyof T)[] | undefined | null;
902
+ excludeFields?: (keyof T)[] | undefined | null;
903
+ withCondition?: IMocodyFieldCondition<T> | undefined | null;
904
+ }): Promise<T[]>;
905
+ mocody_getManyByIndex<TData = T, TSortKeyField extends string | number = string>(paramOption: IMocodyQueryIndexOptionsNoPaging<TData, TSortKeyField>): Promise<TData[]>;
906
+ mocody_getManyByIndexPaginate<TData = T, TSortKeyField extends string | number = string>(paramOption: IMocodyQueryIndexOptions<TData, TSortKeyField>): Promise<IMocodyPagingResult<TData[]>>;
907
+ mocody_getManyWithRelation<TQuery = T, TData = T, TSortKeyField extends string | number = string>(paramOption: Omit<IMocodyQueryIndexOptions<TQuery, TSortKeyField>, "pagingParams"> & {}): Promise<TData[]>;
908
+ mocody_getManyWithRelationPaginate<TQuery = T, TData = T, TSortKeyField extends string | number = string>(paramOption: IMocodyQueryIndexOptions<TQuery, TSortKeyField>): Promise<IMocodyPagingResult<TData[]>>;
909
+ private _mocody_getManyBySecondaryIndexPaginateBase;
910
+ mocody_deleteById({ dataId, withCondition, }: {
911
+ dataId: string;
912
+ withCondition?: IMocodyFieldCondition<T> | undefined | null;
913
+ }): Promise<T>;
914
+ }
915
+
916
+ export { CouchDataOperation, DynamoDataOperation, type IMocodyCoreEntityModel, type IMocodyFieldAliases, type IMocodyFieldCondition, type IMocodyIndexDefinition, type IMocodyKeyConditionParams, type IMocodyPagingParams, type IMocodyPagingResult, type IMocodyPreparedTransaction, type IMocodyQueryConditionParams, type IMocodyQueryDefinition, type IMocodyQueryIndexOptions, type IMocodyQueryIndexOptionsNoPaging, MocodyGenericError, MocodyInitializerCouch, MocodyInitializerDynamo, MocodyInitializerMongo, MocodyInitializerPouch, MocodyUtil, MongoDataOperation, PouchDataOperation };