@infrab4a/connect 4.29.0 → 4.29.1-alpha.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.
- package/index.cjs.js +3817 -2863
- package/index.esm.js +3815 -2862
- package/package.json +2 -2
- package/src/domain/catalog/repositories/category.repository.d.ts +22 -9
- package/src/domain/catalog/repositories/filter-option.repository.d.ts +1 -1
- package/src/domain/catalog/repositories/filter.repository.d.ts +1 -1
- package/src/domain/catalog/repositories/product-stock-notification.repository.d.ts +8 -1
- package/src/domain/catalog/repositories/wishlist.repository.d.ts +1 -1
- package/src/domain/shopping/models/campaign-dashboard.d.ts +1 -1
- package/src/domain/shopping/models/campaign-hashtag.d.ts +1 -1
- package/src/domain/shopping/repositories/order-blocked.repository.d.ts +9 -1
- package/src/domain/shopping/services/antifraud-card.service.d.ts +17 -0
- package/src/domain/shopping/services/antifraud-glampoints.service.d.ts +1 -1
- package/src/domain/shopping/services/antifraud-pix.service.d.ts +1 -1
- package/src/infra/adyen/adapters/adyen-card-payment-axios.adapter.d.ts +6 -4
- package/src/infra/adyen/helpers/adyen-blocked-order.helper.d.ts +13 -0
- package/src/infra/adyen/helpers/adyen-payment-factory.helper.d.ts +6 -0
- package/src/infra/adyen/helpers/adyen-payment-operations.helper.d.ts +31 -0
- package/src/infra/adyen/helpers/index.d.ts +3 -0
- package/src/infra/elasticsearch/helpers/elasticsearch-fields.helper.d.ts +8 -0
- package/src/infra/elasticsearch/helpers/elasticsearch-query-builder.helper.d.ts +16 -0
- package/src/infra/elasticsearch/helpers/elasticsearch-result-processor.helper.d.ts +8 -0
- package/src/infra/elasticsearch/helpers/elasticsearch-search-operations.helper.d.ts +11 -0
- package/src/infra/elasticsearch/helpers/index.d.ts +4 -0
- package/src/infra/elasticsearch/indexes/products-index.d.ts +1 -39
- package/src/infra/firebase/firestore/mixins/helpers/firestore-cache.helper.d.ts +41 -0
- package/src/infra/firebase/firestore/mixins/helpers/firestore-data-converter.helper.d.ts +7 -0
- package/src/infra/firebase/firestore/mixins/helpers/firestore-model-converter.helper.d.ts +14 -0
- package/src/infra/firebase/firestore/mixins/helpers/firestore-operations.helper.d.ts +24 -0
- package/src/infra/firebase/firestore/mixins/helpers/firestore-query-builder.helper.d.ts +37 -0
- package/src/infra/firebase/firestore/mixins/helpers/index.d.ts +3 -0
- package/src/infra/firebase/firestore/mixins/with-sub-collection.mixin.d.ts +1 -1
- package/src/infra/firebase/firestore/repositories/catalog/category-firestore.repository.d.ts +21 -9
- package/src/infra/firebase/firestore/repositories/catalog/product-firestore.repository.d.ts +1 -1
- package/src/infra/firebase/firestore/repositories/shopping/order-blocked-firestore.repository.d.ts +8 -1
- package/src/infra/hasura-graphql/mixins/factories/create-hasura-class.factory.d.ts +30 -0
- package/src/infra/hasura-graphql/mixins/factories/delete-hasura-class.factory.d.ts +26 -0
- package/src/infra/hasura-graphql/mixins/factories/find-hasura-class.factory.d.ts +31 -0
- package/src/infra/hasura-graphql/mixins/factories/get-hasura-class.factory.d.ts +29 -0
- package/src/infra/hasura-graphql/mixins/factories/hasura-graphql-class.factory.d.ts +40 -0
- package/src/infra/hasura-graphql/mixins/factories/index.d.ts +6 -0
- package/src/infra/hasura-graphql/mixins/factories/update-hasura-class.factory.d.ts +36 -0
- package/src/infra/hasura-graphql/mixins/helpers/create/hasura-column.helper.d.ts +7 -0
- package/src/infra/hasura-graphql/mixins/helpers/create/hasura-create-operations.helper.d.ts +16 -0
- package/src/infra/hasura-graphql/mixins/helpers/create/index.d.ts +2 -0
- package/src/infra/hasura-graphql/mixins/helpers/delete/hasura-cache-operations.helper.d.ts +9 -0
- package/src/infra/hasura-graphql/mixins/helpers/delete/hasura-delete-operations.helper.d.ts +15 -0
- package/src/infra/hasura-graphql/mixins/helpers/delete/hasura-delete-variables.helper.d.ts +10 -0
- package/src/infra/hasura-graphql/mixins/helpers/delete/index.d.ts +3 -0
- package/src/infra/hasura-graphql/mixins/helpers/find/hasura-find-binding.helper.d.ts +18 -0
- package/src/infra/hasura-graphql/mixins/helpers/find/hasura-find-cache.helper.d.ts +25 -0
- package/src/infra/hasura-graphql/mixins/helpers/find/hasura-find-operations.helper.d.ts +20 -0
- package/src/infra/hasura-graphql/mixins/helpers/find/hasura-find-query-builder.helper.d.ts +14 -0
- package/src/infra/hasura-graphql/mixins/helpers/find/hasura-find-result.helper.d.ts +26 -0
- package/src/infra/hasura-graphql/mixins/helpers/find/hasura-find-variables.helper.d.ts +21 -0
- package/src/infra/hasura-graphql/mixins/helpers/find/index.d.ts +6 -0
- package/src/infra/hasura-graphql/mixins/helpers/get/hasura-get-cache.helper.d.ts +21 -0
- package/src/infra/hasura-graphql/mixins/helpers/get/hasura-get-operations.helper.d.ts +18 -0
- package/src/infra/hasura-graphql/mixins/helpers/get/hasura-get-variables.helper.d.ts +9 -0
- package/src/infra/hasura-graphql/mixins/helpers/get/index.d.ts +3 -0
- package/src/infra/hasura-graphql/mixins/helpers/hasura-auth.helper.d.ts +4 -0
- package/src/infra/hasura-graphql/mixins/helpers/hasura-data-converter.helper.d.ts +8 -0
- package/src/infra/hasura-graphql/mixins/helpers/hasura-graphql-operations.helper.d.ts +32 -0
- package/src/infra/hasura-graphql/mixins/helpers/hasura-query-builder.helper.d.ts +23 -0
- package/src/infra/hasura-graphql/mixins/helpers/hasura-request.helper.d.ts +11 -0
- package/src/infra/hasura-graphql/mixins/helpers/index.d.ts +11 -1
- package/src/infra/hasura-graphql/mixins/helpers/update/hasura-update-data.helper.d.ts +6 -0
- package/src/infra/hasura-graphql/mixins/helpers/update/hasura-update-operations.helper.d.ts +18 -0
- package/src/infra/hasura-graphql/mixins/helpers/update/hasura-update-variables.helper.d.ts +25 -0
- package/src/infra/hasura-graphql/mixins/helpers/update/index.d.ts +3 -0
- package/src/infra/hasura-graphql/mixins/with-create-hasura-graphql.mixin.d.ts +3 -7
- package/src/infra/hasura-graphql/mixins/with-crud-hasura-graphql.mixin.d.ts +2 -6
- package/src/infra/hasura-graphql/mixins/with-delete-hasura-graphql.mixin.d.ts +3 -5
- package/src/infra/hasura-graphql/mixins/with-find-hasura-graphql.mixin.d.ts +4 -54
- package/src/infra/hasura-graphql/mixins/with-get-hasura-graphql.mixin.d.ts +4 -28
- package/src/infra/hasura-graphql/mixins/with-hasura-graphql.mixin.d.ts +4 -22
- package/src/infra/hasura-graphql/mixins/with-update-hasura-graphql.mixin.d.ts +4 -12
- package/src/infra/hasura-graphql/repositories/catalog/category-collection-children-hasura-graphql.repository.d.ts +1 -3
- package/src/infra/hasura-graphql/repositories/catalog/category-filter-hasura-graphql.repository.d.ts +1 -3
- package/src/infra/hasura-graphql/repositories/catalog/category-hasura-graphql.repository.d.ts +4 -15
- package/src/infra/hasura-graphql/repositories/catalog/category-product-hasura-graphql.repository.d.ts +1 -3
- package/src/infra/hasura-graphql/repositories/catalog/filter-hasura-graphql.repository.d.ts +2 -4
- package/src/infra/hasura-graphql/repositories/catalog/filter-option-hasura-graphql.repository.d.ts +1 -3
- package/src/infra/hasura-graphql/repositories/catalog/helpers/category-cache-operations.helper.d.ts +31 -0
- package/src/infra/hasura-graphql/repositories/catalog/helpers/category-filter-operations.helper.d.ts +17 -0
- package/src/infra/hasura-graphql/repositories/catalog/helpers/category-home-operations.helper.d.ts +32 -0
- package/src/infra/hasura-graphql/repositories/catalog/helpers/category-mount-operations.helper.d.ts +19 -0
- package/src/infra/hasura-graphql/repositories/catalog/helpers/category-product-operations.helper.d.ts +62 -0
- package/src/infra/hasura-graphql/repositories/catalog/helpers/index.d.ts +10 -0
- package/src/infra/hasura-graphql/repositories/catalog/helpers/product-fetch-reviews.helper.d.ts +17 -0
- package/src/infra/hasura-graphql/repositories/catalog/helpers/product-review-cache.helper.d.ts +28 -0
- package/src/infra/hasura-graphql/repositories/catalog/helpers/product-review-operations.helper.d.ts +20 -0
- package/src/infra/hasura-graphql/repositories/catalog/helpers/product-review-update.helper.d.ts +20 -0
- package/src/infra/hasura-graphql/repositories/catalog/helpers/product-variant-report.helper.d.ts +9 -0
- package/src/infra/hasura-graphql/repositories/catalog/product-errors-hasura-graphql.repository.d.ts +1 -3
- package/src/infra/hasura-graphql/repositories/catalog/product-hasura-graphql.repository.d.ts +1 -3
- package/src/infra/hasura-graphql/repositories/catalog/product-review-hasura-graphql.repository.d.ts +1 -3
- package/src/infra/hasura-graphql/repositories/catalog/product-stock-notification-hasura-graphql.repository.d.ts +8 -4
- package/src/infra/hasura-graphql/repositories/catalog/variant-hasura-graphql.repository.d.ts +1 -3
- package/src/infra/hasura-graphql/repositories/catalog/wishlist-hasura-graphql.repository.d.ts +8 -10
- package/src/infra/pagarme/adapters/helpers/index.d.ts +3 -0
- package/src/infra/pagarme/adapters/helpers/pagarme-blocked-order.helper.d.ts +14 -0
- package/src/infra/pagarme/adapters/helpers/pagarme-payment-factory.helper.d.ts +11 -0
- package/src/infra/pagarme/adapters/helpers/pagarme-payment-operations.helper.d.ts +12 -0
- package/src/infra/vertex-ai/adapters/vertex-axios.adapter.d.ts +1 -1
- package/src/utils/circular-dependencies.d.ts +0 -4
- package/src/utils/helpers/debug.helper.d.ts +8 -8
- package/src/utils/helpers/reflect.helper.d.ts +1 -1
- package/src/utils/index.d.ts +1 -0
- package/src/utils/obs-emitter.d.ts +15 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { DeleteRepositoryParams, ModelBaseStructure } from '../../../../domain';
|
|
2
|
+
import { MixinCtor } from '../../../../utils';
|
|
3
|
+
import { GraphQLRepository } from '../../types';
|
|
4
|
+
export type DeleteConstructorParams = {
|
|
5
|
+
deleteGraphQLOperation?: string;
|
|
6
|
+
};
|
|
7
|
+
export declare function createDeleteHasuraGraphQLClass<MBase extends ModelBaseStructure<MBase, MBase['identifiersFields'][number]>, TMixinBase extends MixinCtor<GraphQLRepository<MBase>>>(MixinBase: MixinCtor<GraphQLRepository<MBase>> & TMixinBase): {
|
|
8
|
+
new (...params: any[]): {
|
|
9
|
+
deleteGraphQLOperation: string;
|
|
10
|
+
delete(identifiers: DeleteRepositoryParams<MBase>): Promise<void>;
|
|
11
|
+
tableName: string;
|
|
12
|
+
model: import("../../../../domain").BaseModelBuilder<MBase, any, MBase & {
|
|
13
|
+
prototype: unknown;
|
|
14
|
+
}>;
|
|
15
|
+
fields: import("../../types").HasuraGraphQLFields<MBase>;
|
|
16
|
+
endpoint: string;
|
|
17
|
+
authOptions: import("../../types").HasuraGraphQLAuthOptions;
|
|
18
|
+
logger: import("../../../../utils").DebugHelper;
|
|
19
|
+
cache?: import("../../../../domain").CacheConfig;
|
|
20
|
+
mutation: <ReturnFields = any>(operation: string | import("gql-query-builder/build/IQueryBuilderOptions").IOperation, fields?: import("../../types").HasuraGraphQLFields<MBase> | string[], variables?: import("../../types").VariableOptions) => Promise<ReturnFields>;
|
|
21
|
+
query: <ReturnFields_1 = any>(operation: string | import("gql-query-builder/build/IQueryBuilderOptions").IOperation | import("../../types").GraphQLParams<MBase>[], fields?: import("../../types").HasuraGraphQLFields<MBase> | string[], variables?: import("../../types").VariableOptions) => Promise<ReturnFields_1>;
|
|
22
|
+
getAttributeGraphQLTypeOf: <FieldValue>(value: FieldValue) => string;
|
|
23
|
+
convertDataFromHasura(data: Record<string, string | number>, fields?: import("../../types").HasuraGraphQLFields<MBase> | string[]): MBase;
|
|
24
|
+
convertDataToHasura(instance: MBase, update?: boolean): Record<string, string | number>;
|
|
25
|
+
};
|
|
26
|
+
} & TMixinBase;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { BaseModelBuilder, FindRepositoryParams, ModelBaseStructure, RepositoryCacheOptions, RepositoryFindResult } from '../../../../domain';
|
|
2
|
+
import { MixinCtor } from '../../../../utils';
|
|
3
|
+
import { GraphQLRepository } from '../../types';
|
|
4
|
+
import { HasuraFindBindingHelper } from '../helpers';
|
|
5
|
+
export declare function createFindHasuraGraphQLClass<MBase extends ModelBaseStructure<MBase, MBase['identifiersFields'][number]>, TMixinBase extends MixinCtor<GraphQLRepository<MBase>>>(MixinBase: MixinCtor<GraphQLRepository<MBase>> & TMixinBase): {
|
|
6
|
+
new (...args: any[]): {
|
|
7
|
+
lastDistinct: Record<string, any>;
|
|
8
|
+
bindOrderByAttributes: typeof HasuraFindBindingHelper.bindOrderByAttributes;
|
|
9
|
+
bindAggregateAttributes: typeof HasuraFindBindingHelper.bindAggregateAttributes;
|
|
10
|
+
bindDistinctAttributes: typeof HasuraFindBindingHelper.bindDistinctAttributes;
|
|
11
|
+
bindAttributesToColumns: typeof HasuraFindBindingHelper.bindAttributesToColumns;
|
|
12
|
+
getColumnName: typeof HasuraFindBindingHelper.getColumnName;
|
|
13
|
+
find(params?: FindRepositoryParams<MBase>, options?: {
|
|
14
|
+
cache?: RepositoryCacheOptions;
|
|
15
|
+
}): Promise<RepositoryFindResult<MBase>>;
|
|
16
|
+
tableName: string;
|
|
17
|
+
model: BaseModelBuilder<MBase, any, MBase & {
|
|
18
|
+
prototype: unknown;
|
|
19
|
+
}>;
|
|
20
|
+
fields: import("../../types").HasuraGraphQLFields<MBase>;
|
|
21
|
+
endpoint: string;
|
|
22
|
+
authOptions: import("../../types").HasuraGraphQLAuthOptions;
|
|
23
|
+
logger: import("../../../../utils").DebugHelper;
|
|
24
|
+
cache?: import("../../../../domain").CacheConfig;
|
|
25
|
+
mutation: <ReturnFields = any>(operation: string | import("gql-query-builder/build/IQueryBuilderOptions").IOperation, fields?: import("../../types").HasuraGraphQLFields<MBase> | string[], variables?: import("../../types").VariableOptions) => Promise<ReturnFields>;
|
|
26
|
+
query: <ReturnFields_1 = any>(operation: string | import("gql-query-builder/build/IQueryBuilderOptions").IOperation | import("../../types").GraphQLParams<MBase>[], fields?: import("../../types").HasuraGraphQLFields<MBase> | string[], variables?: import("../../types").VariableOptions) => Promise<ReturnFields_1>;
|
|
27
|
+
getAttributeGraphQLTypeOf: <FieldValue>(value: FieldValue) => string;
|
|
28
|
+
convertDataFromHasura(data: Record<string, string | number>, fields?: import("../../types").HasuraGraphQLFields<MBase> | string[]): MBase;
|
|
29
|
+
convertDataToHasura(instance: MBase, update?: boolean): Record<string, string | number>;
|
|
30
|
+
};
|
|
31
|
+
} & TMixinBase;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { GetRepositoryParams, ModelBaseStructure, RepositoryCacheOptions } from '../../../../domain';
|
|
2
|
+
import { MixinCtor } from '../../../../utils';
|
|
3
|
+
import { GraphQLRepository } from '../../types';
|
|
4
|
+
export type GetConstructorParams = {
|
|
5
|
+
getGraphQLOperation?: string;
|
|
6
|
+
};
|
|
7
|
+
export declare function createGetHasuraGraphQLClass<MBase extends ModelBaseStructure<MBase, MBase['identifiersFields'][number]>, TMixinBase extends MixinCtor<GraphQLRepository<MBase>>>(MixinBase: MixinCtor<GraphQLRepository<MBase>> & TMixinBase): {
|
|
8
|
+
new (...params: any[]): {
|
|
9
|
+
getGraphQLOperation: string;
|
|
10
|
+
generateCacheKey(identifiers: GetRepositoryParams<MBase>): string;
|
|
11
|
+
get(identifiers: GetRepositoryParams<MBase>, options?: {
|
|
12
|
+
cache?: RepositoryCacheOptions;
|
|
13
|
+
}): Promise<MBase>;
|
|
14
|
+
tableName: string;
|
|
15
|
+
model: import("../../../../domain").BaseModelBuilder<MBase, any, MBase & {
|
|
16
|
+
prototype: unknown;
|
|
17
|
+
}>;
|
|
18
|
+
fields: import("../../types").HasuraGraphQLFields<MBase>;
|
|
19
|
+
endpoint: string;
|
|
20
|
+
authOptions: import("../../types").HasuraGraphQLAuthOptions;
|
|
21
|
+
logger: import("../../../../utils").DebugHelper;
|
|
22
|
+
cache?: import("../../../../domain").CacheConfig;
|
|
23
|
+
mutation: <ReturnFields = any>(operation: string | import("gql-query-builder/build/IQueryBuilderOptions").IOperation, fields?: import("../../types").HasuraGraphQLFields<MBase> | string[], variables?: import("../../types").VariableOptions) => Promise<ReturnFields>;
|
|
24
|
+
query: <ReturnFields_1 = any>(operation: string | import("gql-query-builder/build/IQueryBuilderOptions").IOperation | import("../../types").GraphQLParams<MBase>[], fields?: import("../../types").HasuraGraphQLFields<MBase> | string[], variables?: import("../../types").VariableOptions) => Promise<ReturnFields_1>;
|
|
25
|
+
getAttributeGraphQLTypeOf: <FieldValue>(value: FieldValue) => string;
|
|
26
|
+
convertDataFromHasura(data: Record<string, string | number>, fields?: import("../../types").HasuraGraphQLFields<MBase> | string[]): MBase;
|
|
27
|
+
convertDataToHasura(instance: MBase, update?: boolean): Record<string, string | number>;
|
|
28
|
+
};
|
|
29
|
+
} & TMixinBase;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { IOperation } from 'gql-query-builder/build/IQueryBuilderOptions';
|
|
2
|
+
import { BaseModelBuilder, CacheConfig, ModelBaseStructure } from '../../../../domain';
|
|
3
|
+
import { DebugHelper, MixinCtor } from '../../../../utils';
|
|
4
|
+
import { GraphQLParams, HasuraGraphQLAuthOptions, HasuraGraphQLFields, VariableOptions } from '../../types';
|
|
5
|
+
import { GraphQLOperationParams, HasuraDataConverterHelper, HasuraQueryBuilderHelper, QueryBuilderOptions } from '../helpers';
|
|
6
|
+
export interface HasuraGraphQLInterceptors<P = QueryBuilderOptions | QueryBuilderOptions[]> {
|
|
7
|
+
request?: <R>(request: P) => Promise<P & R>;
|
|
8
|
+
response?: <R>(response: R, request: P) => Promise<R>;
|
|
9
|
+
}
|
|
10
|
+
export interface HasuraConstructorParams<Model extends ModelBaseStructure<Model, Model['identifiersFields'][number]>> {
|
|
11
|
+
tableName: string;
|
|
12
|
+
model: BaseModelBuilder<Model>;
|
|
13
|
+
fields: HasuraGraphQLFields<Model>;
|
|
14
|
+
endpoint: string;
|
|
15
|
+
interceptors?: HasuraGraphQLInterceptors;
|
|
16
|
+
authOptions: HasuraGraphQLAuthOptions;
|
|
17
|
+
cache?: CacheConfig;
|
|
18
|
+
}
|
|
19
|
+
export declare function createHasuraGraphQLClass<MBase extends ModelBaseStructure<MBase, MBase['identifiersFields'][number]>, T extends MixinCtor = MixinCtor>(MixinBase: T): {
|
|
20
|
+
new (...params: any[]): {
|
|
21
|
+
[x: string]: any;
|
|
22
|
+
tableName: string;
|
|
23
|
+
endpoint: string;
|
|
24
|
+
authOptions: HasuraGraphQLAuthOptions;
|
|
25
|
+
interceptors: HasuraGraphQLInterceptors;
|
|
26
|
+
model: BaseModelBuilder<MBase>;
|
|
27
|
+
fields: HasuraGraphQLFields<MBase>;
|
|
28
|
+
logger: DebugHelper;
|
|
29
|
+
cache?: CacheConfig;
|
|
30
|
+
getAttributeGraphQLTypeOf: typeof HasuraDataConverterHelper.getAttributeGraphQLTypeOf;
|
|
31
|
+
checkIfIsDateTimeAndParse: typeof HasuraDataConverterHelper.checkIfIsDateTimeAndParse;
|
|
32
|
+
buildHasuraQueryFields: typeof HasuraQueryBuilderHelper.buildHasuraQueryFields;
|
|
33
|
+
readonly headers: import("../../types").HasuraGraphQLHeaders;
|
|
34
|
+
mutation<ReturnFields = any>(operation: string | IOperation, fields?: string[] | HasuraGraphQLFields<MBase>, variables?: VariableOptions): Promise<ReturnFields>;
|
|
35
|
+
query<ReturnFields_1 = any>(operation: string | IOperation | GraphQLParams<MBase>[], fields?: string[] | HasuraGraphQLFields<MBase>, variables?: VariableOptions): Promise<ReturnFields_1>;
|
|
36
|
+
convertDataFromHasura(data: Record<string, string | number>, fields?: string[] | HasuraGraphQLFields<MBase>): MBase;
|
|
37
|
+
convertDataToHasura(instance: MBase, update?: boolean): Record<string, string | number>;
|
|
38
|
+
getOperationParams(): GraphQLOperationParams<MBase>;
|
|
39
|
+
};
|
|
40
|
+
} & T;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from './create-hasura-class.factory';
|
|
2
|
+
export * from './delete-hasura-class.factory';
|
|
3
|
+
export * from './find-hasura-class.factory';
|
|
4
|
+
export * from './get-hasura-class.factory';
|
|
5
|
+
export * from './hasura-graphql-class.factory';
|
|
6
|
+
export * from './update-hasura-class.factory';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ModelBaseStructure, NonFunctionAndIdentifierProperties, RepositoryUpdateParams, UpdateRepository } from '../../../../domain';
|
|
2
|
+
import { MixinCtor } from '../../../../utils';
|
|
3
|
+
import { GraphQLRepository } from '../../types';
|
|
4
|
+
export interface UpdateConstructorParams {
|
|
5
|
+
updateGraphQLOperation?: string;
|
|
6
|
+
updateGraphQLObjectType?: string;
|
|
7
|
+
updateGraphQLPKType?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface UpdateHasuraGraphQLRepositoryType<MBase extends ModelBaseStructure<MBase, MBase['identifiersFields'][number]>> extends UpdateRepository<MBase> {
|
|
10
|
+
paramsToPlain(params: RepositoryUpdateParams<MBase>): Partial<MBase>;
|
|
11
|
+
}
|
|
12
|
+
export declare function createUpdateHasuraGraphQLClass<MBase extends ModelBaseStructure<MBase>, TMixinBase extends MixinCtor<GraphQLRepository<MBase>>>(MixinBase: MixinCtor<GraphQLRepository<MBase>> & TMixinBase): {
|
|
13
|
+
new (...params: any[]): {
|
|
14
|
+
updateGraphQLOperation: string;
|
|
15
|
+
updateGraphQLObjectType: string;
|
|
16
|
+
updateGraphQLPKType: string;
|
|
17
|
+
getIdentifiersFromData(data: Partial<MBase>): Record<string, any>;
|
|
18
|
+
update(data: RepositoryUpdateParams<MBase>): Promise<MBase>;
|
|
19
|
+
paramsToPlain(params: RepositoryUpdateParams<MBase>): Partial<MBase>;
|
|
20
|
+
getUpdateModelKeys(data: Partial<MBase>): NonFunctionAndIdentifierProperties<MBase>;
|
|
21
|
+
tableName: string;
|
|
22
|
+
model: import("../../../../domain").BaseModelBuilder<MBase, any, MBase & {
|
|
23
|
+
prototype: unknown;
|
|
24
|
+
}>;
|
|
25
|
+
fields: import("../../types").HasuraGraphQLFields<MBase>;
|
|
26
|
+
endpoint: string;
|
|
27
|
+
authOptions: import("../../types").HasuraGraphQLAuthOptions;
|
|
28
|
+
logger: import("../../../../utils").DebugHelper;
|
|
29
|
+
cache?: import("../../../../domain").CacheConfig;
|
|
30
|
+
mutation: <ReturnFields = any>(operation: string | import("gql-query-builder/build/IQueryBuilderOptions").IOperation, fields?: import("../../types").HasuraGraphQLFields<MBase> | string[], variables?: import("../../types").VariableOptions) => Promise<ReturnFields>;
|
|
31
|
+
query: <ReturnFields_1 = any>(operation: string | import("gql-query-builder/build/IQueryBuilderOptions").IOperation | import("../../types").GraphQLParams<MBase>[], fields?: import("../../types").HasuraGraphQLFields<MBase> | string[], variables?: import("../../types").VariableOptions) => Promise<ReturnFields_1>;
|
|
32
|
+
getAttributeGraphQLTypeOf: <FieldValue>(value: FieldValue) => string;
|
|
33
|
+
convertDataFromHasura(data: Record<string, string | number>, fields?: import("../../types").HasuraGraphQLFields<MBase> | string[]): MBase;
|
|
34
|
+
convertDataToHasura(instance: MBase, update?: boolean): Record<string, string | number>;
|
|
35
|
+
};
|
|
36
|
+
} & TMixinBase;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ModelBaseStructure } from '../../../../../domain';
|
|
2
|
+
import { HasuraGraphQLFields } from '../../../types';
|
|
3
|
+
export declare class HasuraColumnHelper {
|
|
4
|
+
static extractPrimaryKeyColumns<MBase extends ModelBaseStructure<MBase>>(model: any, fields: HasuraGraphQLFields<MBase>): HasuraGraphQLFields<MBase>;
|
|
5
|
+
static extractForeignKeyColumns<MBase extends ModelBaseStructure<MBase>>(fields: HasuraGraphQLFields<MBase>): any[];
|
|
6
|
+
static buildQueryColumns<MBase extends ModelBaseStructure<MBase>>(model: any, fields: HasuraGraphQLFields<MBase>): HasuraGraphQLFields<MBase>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BaseModelBuilder, CreateRepositoryParams, ModelBaseStructure } from '../../../../../domain';
|
|
2
|
+
import { GraphQLRepository, HasuraGraphQLFields } from '../../../types';
|
|
3
|
+
export type ExecuteCreateParams<MBase extends ModelBaseStructure<MBase>> = {
|
|
4
|
+
data: MBase;
|
|
5
|
+
repository: GraphQLRepository<MBase>;
|
|
6
|
+
insertGraphQLOperation: string;
|
|
7
|
+
insertGraphQLObjectType: string;
|
|
8
|
+
fields: HasuraGraphQLFields<MBase>;
|
|
9
|
+
model: BaseModelBuilder<MBase>;
|
|
10
|
+
};
|
|
11
|
+
export declare class HasuraCreateOperationsHelper {
|
|
12
|
+
static buildInsertOperationName(tableName: string, customOperation?: string): string;
|
|
13
|
+
static buildInsertObjectType(tableName: string, customObjectType?: string): string;
|
|
14
|
+
static executeCreate<MBase extends ModelBaseStructure<MBase>>(data: CreateRepositoryParams<MBase>, params: Omit<ExecuteCreateParams<MBase>, 'data'>): Promise<MBase>;
|
|
15
|
+
static executeSave<MBase extends ModelBaseStructure<MBase>>(params: ExecuteCreateParams<MBase>): Promise<Partial<MBase>>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CacheConfig, ModelBaseStructure } from '../../../../../domain';
|
|
2
|
+
import { DebugHelper } from '../../../../../utils';
|
|
3
|
+
export declare class HasuraCacheOperationsHelper {
|
|
4
|
+
static removeCacheData<MBase extends ModelBaseStructure<MBase>>(cache: CacheConfig | undefined, params: {
|
|
5
|
+
model: any;
|
|
6
|
+
identifiers: any;
|
|
7
|
+
logger: DebugHelper;
|
|
8
|
+
}): Promise<void>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { CacheConfig, DeleteRepositoryParams, ModelBaseStructure } from '../../../../../domain';
|
|
2
|
+
import { GraphQLRepository, HasuraGraphQLFields } from '../../../types';
|
|
3
|
+
export type ExecuteDeleteParams<MBase extends ModelBaseStructure<MBase>> = {
|
|
4
|
+
identifiers: DeleteRepositoryParams<MBase>;
|
|
5
|
+
repository: GraphQLRepository<MBase>;
|
|
6
|
+
deleteGraphQLOperation: string;
|
|
7
|
+
fields: HasuraGraphQLFields<MBase>;
|
|
8
|
+
model: any;
|
|
9
|
+
cache?: CacheConfig;
|
|
10
|
+
};
|
|
11
|
+
export declare class HasuraDeleteOperationsHelper {
|
|
12
|
+
static buildDeleteOperationName(tableName: string, customOperation?: string): string;
|
|
13
|
+
static executeDelete<MBase extends ModelBaseStructure<MBase>>(params: ExecuteDeleteParams<MBase>): Promise<void>;
|
|
14
|
+
private static handleCacheRemoval;
|
|
15
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DeleteRepositoryParams, ModelBaseStructure } from '../../../../../domain';
|
|
2
|
+
import { GraphQLRepository, HasuraGraphQLFields } from '../../../types';
|
|
3
|
+
export declare class HasuraDeleteVariablesHelper {
|
|
4
|
+
static buildDeleteIdentifierColumns<MBase extends ModelBaseStructure<MBase>>(model: any, fields: HasuraGraphQLFields<MBase>): HasuraGraphQLFields<MBase>;
|
|
5
|
+
static buildDeleteVariables<MBase extends ModelBaseStructure<MBase>>(identifiers: DeleteRepositoryParams<MBase>, params: {
|
|
6
|
+
model: any;
|
|
7
|
+
fields: HasuraGraphQLFields<MBase>;
|
|
8
|
+
repository: GraphQLRepository<MBase>;
|
|
9
|
+
}): Record<string, any>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { FindRepositoryParams, ModelBaseStructure, NonFunctionAndIdentifierPropertyNames, RepositoryOrderBy } from '../../../../../domain';
|
|
2
|
+
import { HasuraGraphQLFields } from '../../../types';
|
|
3
|
+
export declare class HasuraFindBindingHelper {
|
|
4
|
+
static bindOrderByAttributes<MBase extends ModelBaseStructure<MBase>>(orderBy: RepositoryOrderBy<MBase>, fields: HasuraGraphQLFields<MBase>): any[];
|
|
5
|
+
static bindAggregateAttributes<MBase extends ModelBaseStructure<MBase>>(aggregates: {
|
|
6
|
+
minimal?: FindRepositoryParams<MBase>['options']['minimal'];
|
|
7
|
+
maximum?: FindRepositoryParams<MBase>['options']['maximum'];
|
|
8
|
+
}, fields: HasuraGraphQLFields<MBase>): ({
|
|
9
|
+
min: any[];
|
|
10
|
+
max?: undefined;
|
|
11
|
+
} | {
|
|
12
|
+
max: any[];
|
|
13
|
+
min?: undefined;
|
|
14
|
+
})[];
|
|
15
|
+
static bindDistinctAttributes<MBase extends ModelBaseStructure<MBase>>(distinct: FindRepositoryParams<MBase>['options']['distinct'], fields: HasuraGraphQLFields<MBase>): any[];
|
|
16
|
+
static bindAttributesToColumns<MBase extends ModelBaseStructure<MBase>>(attributes: Array<NonFunctionAndIdentifierPropertyNames<MBase> | any>, fields: HasuraGraphQLFields<MBase>): any[];
|
|
17
|
+
static getColumnName<MBase extends ModelBaseStructure<MBase>>(attributeName: NonFunctionAndIdentifierPropertyNames<MBase>, fields: HasuraGraphQLFields<MBase>): string;
|
|
18
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { BaseModelBuilder, CacheConfig, FindRepositoryParams, ModelBaseStructure, RepositoryCacheOptions } from '../../../../../domain';
|
|
2
|
+
export declare class HasuraFindCacheHelper {
|
|
3
|
+
static generateCacheKey<MBase extends ModelBaseStructure<MBase>>(model: BaseModelBuilder<MBase, any, MBase & {
|
|
4
|
+
prototype: unknown;
|
|
5
|
+
}>, params?: FindRepositoryParams<MBase>): string;
|
|
6
|
+
static getCachedResult<MBase extends ModelBaseStructure<MBase>>(params: {
|
|
7
|
+
cache?: CacheConfig;
|
|
8
|
+
model: BaseModelBuilder<MBase, any, MBase & {
|
|
9
|
+
prototype: unknown;
|
|
10
|
+
}>;
|
|
11
|
+
findParams?: FindRepositoryParams<MBase>;
|
|
12
|
+
cacheOptions?: RepositoryCacheOptions;
|
|
13
|
+
logger?: any;
|
|
14
|
+
}): Promise<any | null>;
|
|
15
|
+
static setCachedResult<MBase extends ModelBaseStructure<MBase>>(params: {
|
|
16
|
+
cache?: CacheConfig;
|
|
17
|
+
model: BaseModelBuilder<MBase, any, MBase & {
|
|
18
|
+
prototype: unknown;
|
|
19
|
+
}>;
|
|
20
|
+
findParams?: FindRepositoryParams<MBase>;
|
|
21
|
+
cacheOptions?: RepositoryCacheOptions;
|
|
22
|
+
result: any;
|
|
23
|
+
logger?: any;
|
|
24
|
+
}): Promise<void>;
|
|
25
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { BaseModelBuilder, FindRepositoryParams, ModelBaseStructure, RepositoryCacheOptions, RepositoryFindResult } from '../../../../../domain';
|
|
2
|
+
import { GraphQLParams, HasuraGraphQLFields } from '../../../types';
|
|
3
|
+
export interface ExecuteFindParams<MBase extends ModelBaseStructure<MBase>> {
|
|
4
|
+
params?: FindRepositoryParams<MBase>;
|
|
5
|
+
cacheOptions?: {
|
|
6
|
+
cache?: RepositoryCacheOptions;
|
|
7
|
+
};
|
|
8
|
+
model: BaseModelBuilder<MBase, any, MBase & {
|
|
9
|
+
prototype: unknown;
|
|
10
|
+
}>;
|
|
11
|
+
tableName: string;
|
|
12
|
+
fields: HasuraGraphQLFields<MBase>;
|
|
13
|
+
cache?: any;
|
|
14
|
+
query: (queries: GraphQLParams<MBase>[]) => Promise<any>;
|
|
15
|
+
convertDataFromHasura: (data: any) => MBase;
|
|
16
|
+
lastDistinct: Record<string, any>;
|
|
17
|
+
}
|
|
18
|
+
export declare class HasuraFindOperationsHelper {
|
|
19
|
+
static executeFindOperation<MBase extends ModelBaseStructure<MBase>>(operationParams: ExecuteFindParams<MBase>): Promise<RepositoryFindResult<MBase>>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FindRepositoryParams, ModelBaseStructure } from '../../../../../domain';
|
|
2
|
+
import { GraphQLParams, HasuraGraphQLFields } from '../../../types';
|
|
3
|
+
export interface BuildQueryParams<MBase extends ModelBaseStructure<MBase>> {
|
|
4
|
+
tableName: string;
|
|
5
|
+
fields: HasuraGraphQLFields<MBase>;
|
|
6
|
+
params?: FindRepositoryParams<MBase>;
|
|
7
|
+
lastDistinct: Record<string, any>;
|
|
8
|
+
}
|
|
9
|
+
export declare class HasuraFindQueryBuilderHelper {
|
|
10
|
+
static buildCompleteQuery<MBase extends ModelBaseStructure<MBase>>(queryParams: BuildQueryParams<MBase>): GraphQLParams<MBase>[];
|
|
11
|
+
private static buildMainQuery;
|
|
12
|
+
private static buildAggregateQuery;
|
|
13
|
+
private static buildDistinctQueries;
|
|
14
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { FindRepositoryParams, ModelBaseStructure, RepositoryFindResult } from '../../../../../domain';
|
|
2
|
+
import { HasuraGraphQLFields } from '../../../types';
|
|
3
|
+
export interface ProcessResultParams<MBase extends ModelBaseStructure<MBase>> {
|
|
4
|
+
result: any;
|
|
5
|
+
tableName: string;
|
|
6
|
+
enableCount: boolean;
|
|
7
|
+
findOptions: FindRepositoryParams<MBase>['options'];
|
|
8
|
+
tableFiltersNamed: string;
|
|
9
|
+
fields: HasuraGraphQLFields<MBase>;
|
|
10
|
+
convertDataFromHasura: (data: any) => MBase;
|
|
11
|
+
lastDistinct: Record<string, any>;
|
|
12
|
+
}
|
|
13
|
+
export declare class HasuraFindResultHelper {
|
|
14
|
+
static processResult<MBase extends ModelBaseStructure<MBase>>(params: ProcessResultParams<MBase>): RepositoryFindResult<MBase>;
|
|
15
|
+
static bindAggregateAttributes<MBase extends ModelBaseStructure<MBase>>(params: {
|
|
16
|
+
aggregates: {
|
|
17
|
+
minimal?: FindRepositoryParams<MBase>['options']['minimal'];
|
|
18
|
+
maximum?: FindRepositoryParams<MBase>['options']['maximum'];
|
|
19
|
+
};
|
|
20
|
+
fields: HasuraGraphQLFields<MBase>;
|
|
21
|
+
}): Array<any>;
|
|
22
|
+
private static processMinimalAggregates;
|
|
23
|
+
private static processMaximumAggregates;
|
|
24
|
+
private static processDistinctResults;
|
|
25
|
+
private static bindAttributesToColumns;
|
|
26
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { FindRepositoryParams, ModelBaseStructure, RepositoryOrderBy } from '../../../../../domain';
|
|
2
|
+
import { HasuraGraphQLFields } from '../../../types';
|
|
3
|
+
export declare class HasuraFindVariablesHelper {
|
|
4
|
+
static buildFiltersVariables<MBase extends ModelBaseStructure<MBase>>(params: {
|
|
5
|
+
filters: FindRepositoryParams<MBase>['filters'];
|
|
6
|
+
tableName: string;
|
|
7
|
+
fields: HasuraGraphQLFields<MBase>;
|
|
8
|
+
}): Record<string, any>;
|
|
9
|
+
static buildOrderByVariables<MBase extends ModelBaseStructure<MBase>>(params: {
|
|
10
|
+
orderBy: RepositoryOrderBy<MBase>;
|
|
11
|
+
tableName: string;
|
|
12
|
+
fields: HasuraGraphQLFields<MBase>;
|
|
13
|
+
}): Record<string, any>;
|
|
14
|
+
static buildDistinctVariables<MBase extends ModelBaseStructure<MBase>>(params: {
|
|
15
|
+
distinct: string;
|
|
16
|
+
tableName: string;
|
|
17
|
+
fields: HasuraGraphQLFields<MBase>;
|
|
18
|
+
filtersVariables: Record<string, any>;
|
|
19
|
+
}): Record<string, any>;
|
|
20
|
+
private static bindOrderByAttributes;
|
|
21
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { HasuraFindBindingHelper } from './hasura-find-binding.helper';
|
|
2
|
+
export { HasuraFindCacheHelper } from './hasura-find-cache.helper';
|
|
3
|
+
export { ExecuteFindParams, HasuraFindOperationsHelper } from './hasura-find-operations.helper';
|
|
4
|
+
export { BuildQueryParams, HasuraFindQueryBuilderHelper } from './hasura-find-query-builder.helper';
|
|
5
|
+
export { HasuraFindResultHelper, ProcessResultParams } from './hasura-find-result.helper';
|
|
6
|
+
export { HasuraFindVariablesHelper } from './hasura-find-variables.helper';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { CacheConfig, GetRepositoryParams, ModelBaseStructure, RepositoryCacheOptions } from '../../../../../domain';
|
|
2
|
+
import { DebugHelper } from '../../../../../utils';
|
|
3
|
+
export declare class HasuraGetCacheHelper {
|
|
4
|
+
static generateCacheKey<MBase extends ModelBaseStructure<MBase>>(model: any, identifiers: GetRepositoryParams<MBase>): string;
|
|
5
|
+
static getCachedData<MBase extends ModelBaseStructure<MBase>>(cache: CacheConfig | undefined, params: {
|
|
6
|
+
identifiers: GetRepositoryParams<MBase>;
|
|
7
|
+
options?: {
|
|
8
|
+
cache?: RepositoryCacheOptions;
|
|
9
|
+
};
|
|
10
|
+
model: any;
|
|
11
|
+
logger: DebugHelper;
|
|
12
|
+
}): Promise<MBase | null>;
|
|
13
|
+
static saveCacheData<MBase extends ModelBaseStructure<MBase>>(cache: CacheConfig | undefined, params: {
|
|
14
|
+
identifiers: GetRepositoryParams<MBase>;
|
|
15
|
+
options?: {
|
|
16
|
+
cache?: RepositoryCacheOptions;
|
|
17
|
+
};
|
|
18
|
+
data: MBase;
|
|
19
|
+
logger: DebugHelper;
|
|
20
|
+
}): Promise<void>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { CacheConfig, GetRepositoryParams, ModelBaseStructure, RepositoryCacheOptions } from '../../../../../domain';
|
|
2
|
+
import { GraphQLRepository, HasuraGraphQLFields } from '../../../types';
|
|
3
|
+
export type ExecuteGetParams<MBase extends ModelBaseStructure<MBase>> = {
|
|
4
|
+
identifiers: GetRepositoryParams<MBase>;
|
|
5
|
+
options?: {
|
|
6
|
+
cache?: RepositoryCacheOptions;
|
|
7
|
+
};
|
|
8
|
+
repository: GraphQLRepository<MBase>;
|
|
9
|
+
getGraphQLOperation: string;
|
|
10
|
+
fields: HasuraGraphQLFields<MBase>;
|
|
11
|
+
model: any;
|
|
12
|
+
cache?: CacheConfig;
|
|
13
|
+
};
|
|
14
|
+
export declare class HasuraGetOperationsHelper {
|
|
15
|
+
static buildGetOperationName(tableName: string, customOperation?: string): string;
|
|
16
|
+
static executeGet<MBase extends ModelBaseStructure<MBase>>(params: ExecuteGetParams<MBase>): Promise<MBase>;
|
|
17
|
+
private static executeQuery;
|
|
18
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { GetRepositoryParams, ModelBaseStructure } from '../../../../../domain';
|
|
2
|
+
import { GraphQLRepository, HasuraGraphQLFields } from '../../../types';
|
|
3
|
+
export declare class HasuraGetVariablesHelper {
|
|
4
|
+
static buildGetVariables<MBase extends ModelBaseStructure<MBase>>(identifiers: GetRepositoryParams<MBase>, params: {
|
|
5
|
+
model: any;
|
|
6
|
+
fields: HasuraGraphQLFields<MBase>;
|
|
7
|
+
repository: GraphQLRepository<MBase>;
|
|
8
|
+
}): Record<string, any>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ModelBaseStructure } from '../../../../domain';
|
|
2
|
+
import { HasuraGraphQLFields } from '../../types';
|
|
3
|
+
export declare class HasuraDataConverterHelper {
|
|
4
|
+
static getAttributeGraphQLTypeOf<FieldType>(value: FieldType): string;
|
|
5
|
+
static checkIfIsDateTimeAndParse(value: string): Date | string;
|
|
6
|
+
static convertDataFromHasura<MBase extends ModelBaseStructure<MBase>>(data: Record<string, string | number>, fields: HasuraGraphQLFields<MBase>, model: any): MBase;
|
|
7
|
+
static convertDataToHasura<MBase extends ModelBaseStructure<MBase>>(instance: MBase, fields: HasuraGraphQLFields<MBase>, update?: boolean): Record<string, string | number>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { IOperation } from 'gql-query-builder/build/IQueryBuilderOptions';
|
|
2
|
+
import { ModelBaseStructure } from '../../../../domain';
|
|
3
|
+
import { DebugHelper } from '../../../../utils';
|
|
4
|
+
import { GraphQLParams, HasuraGraphQLAuthOptions, HasuraGraphQLFields, VariableOptions } from '../../types';
|
|
5
|
+
import { QueryBuilderOptions } from './hasura-query-builder.helper';
|
|
6
|
+
export interface GraphQLOperationParams<MBase extends ModelBaseStructure<MBase>> {
|
|
7
|
+
endpoint: string;
|
|
8
|
+
authOptions: HasuraGraphQLAuthOptions;
|
|
9
|
+
fields: HasuraGraphQLFields<MBase>;
|
|
10
|
+
interceptors?: any;
|
|
11
|
+
logger: DebugHelper;
|
|
12
|
+
}
|
|
13
|
+
export declare class HasuraGraphQLOperationsHelper {
|
|
14
|
+
static executeMutation<MBase extends ModelBaseStructure<MBase>, ReturnFields = any>(params: {
|
|
15
|
+
operation: string | IOperation;
|
|
16
|
+
fields?: string[] | HasuraGraphQLFields<MBase>;
|
|
17
|
+
variables?: VariableOptions;
|
|
18
|
+
operationParams: GraphQLOperationParams<MBase>;
|
|
19
|
+
}): Promise<ReturnFields>;
|
|
20
|
+
static executeQuery<MBase extends ModelBaseStructure<MBase>, ReturnFields = any>(params: {
|
|
21
|
+
operation: string | IOperation | GraphQLParams<MBase>[];
|
|
22
|
+
fields?: string[] | HasuraGraphQLFields<MBase>;
|
|
23
|
+
variables?: VariableOptions;
|
|
24
|
+
operationParams: GraphQLOperationParams<MBase>;
|
|
25
|
+
buildHasuraQueryFields: (params: {
|
|
26
|
+
operation: string | IOperation | GraphQLParams<MBase>[];
|
|
27
|
+
fields?: string[] | HasuraGraphQLFields<MBase>;
|
|
28
|
+
variables?: VariableOptions;
|
|
29
|
+
}) => QueryBuilderOptions | QueryBuilderOptions[];
|
|
30
|
+
}): Promise<ReturnFields>;
|
|
31
|
+
private static executeFetch;
|
|
32
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { IOperation } from 'gql-query-builder/build/IQueryBuilderOptions';
|
|
2
|
+
import { ModelBaseStructure } from '../../../../domain';
|
|
3
|
+
import { Fields, GraphQLParams, HasuraGraphQLFields, VariableOptions } from '../../types';
|
|
4
|
+
export type QueryBuilderOptions = {
|
|
5
|
+
operation: string | IOperation;
|
|
6
|
+
fields: Fields;
|
|
7
|
+
variables?: VariableOptions;
|
|
8
|
+
};
|
|
9
|
+
export declare class HasuraQueryBuilderHelper {
|
|
10
|
+
static buildMutation<MBase extends ModelBaseStructure<MBase>>(operation: string | IOperation, fields?: string[] | HasuraGraphQLFields<MBase>, variables?: VariableOptions): {
|
|
11
|
+
variables: any;
|
|
12
|
+
query: string;
|
|
13
|
+
};
|
|
14
|
+
static buildQuery<MBase extends ModelBaseStructure<MBase>>(params: QueryBuilderOptions | QueryBuilderOptions[]): {
|
|
15
|
+
variables: any;
|
|
16
|
+
query: string;
|
|
17
|
+
};
|
|
18
|
+
static buildHasuraQueryFields<MBase extends ModelBaseStructure<MBase>>(params: {
|
|
19
|
+
operation: string | IOperation | GraphQLParams<MBase>[];
|
|
20
|
+
fields?: string[] | HasuraGraphQLFields<MBase>;
|
|
21
|
+
variables?: VariableOptions;
|
|
22
|
+
}): QueryBuilderOptions | QueryBuilderOptions[];
|
|
23
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { DebugHelper } from '../../../../utils';
|
|
2
|
+
import { HasuraGraphQLHeaders } from '../../types';
|
|
3
|
+
export declare class HasuraRequestHelper {
|
|
4
|
+
static fetch<ReturnFields = any>(params: {
|
|
5
|
+
variables: any;
|
|
6
|
+
query: string;
|
|
7
|
+
endpoint: string;
|
|
8
|
+
headers: HasuraGraphQLHeaders;
|
|
9
|
+
logger: DebugHelper;
|
|
10
|
+
}): Promise<ReturnFields>;
|
|
11
|
+
}
|
|
@@ -2,5 +2,15 @@ export * from './attribute-option.helper';
|
|
|
2
2
|
export * from './bind-filter-query.helper';
|
|
3
3
|
export * from './cache-key-generator.helper';
|
|
4
4
|
export * from './filter-option.helper';
|
|
5
|
-
export
|
|
5
|
+
export { GraphQLFieldHelper } from './graphql-field.helper';
|
|
6
6
|
export * from './md5-generator.helper';
|
|
7
|
+
export { HasuraAuthHelper } from './hasura-auth.helper';
|
|
8
|
+
export { HasuraDataConverterHelper } from './hasura-data-converter.helper';
|
|
9
|
+
export { GraphQLOperationParams, HasuraGraphQLOperationsHelper } from './hasura-graphql-operations.helper';
|
|
10
|
+
export { HasuraQueryBuilderHelper, QueryBuilderOptions } from './hasura-query-builder.helper';
|
|
11
|
+
export { HasuraRequestHelper } from './hasura-request.helper';
|
|
12
|
+
export * from './create';
|
|
13
|
+
export * from './delete';
|
|
14
|
+
export * from './find';
|
|
15
|
+
export * from './get';
|
|
16
|
+
export * from './update';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { BaseModelBuilder, ModelBaseStructure, RepositoryUpdateParams, UpdateOptions } from '../../../../../domain';
|
|
2
|
+
export declare class HasuraUpdateDataHelper {
|
|
3
|
+
static getValueByAction<MBase extends ModelBaseStructure<MBase>>(options: UpdateOptions<MBase>): unknown;
|
|
4
|
+
static paramsToPlain<MBase extends ModelBaseStructure<MBase>>(params: RepositoryUpdateParams<MBase>, model: BaseModelBuilder<MBase>): Partial<MBase>;
|
|
5
|
+
static getIdentifiersFromData<MBase extends ModelBaseStructure<MBase>>(data: Partial<MBase>, model: any): Record<string, any>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ModelBaseStructure, RepositoryUpdateParams } from '../../../../../domain';
|
|
2
|
+
import { HasuraGraphQLFields } from '../../../types';
|
|
3
|
+
export interface UpdateOperationsParams<MBase extends ModelBaseStructure<MBase>> {
|
|
4
|
+
data: RepositoryUpdateParams<MBase>;
|
|
5
|
+
updateGraphQLOperation: string;
|
|
6
|
+
updateGraphQLObjectType: string;
|
|
7
|
+
updateGraphQLPKType: string;
|
|
8
|
+
model: any;
|
|
9
|
+
fields: any;
|
|
10
|
+
cache?: any;
|
|
11
|
+
logger?: any;
|
|
12
|
+
mutation: (operation: string, fields: HasuraGraphQLFields<MBase>, variables: any) => Promise<any>;
|
|
13
|
+
convertDataToHasura: (data: any, isUpdate?: boolean) => any;
|
|
14
|
+
}
|
|
15
|
+
export declare class HasuraUpdateOperationsHelper {
|
|
16
|
+
static executeUpdateOperation<MBase extends ModelBaseStructure<MBase>>(params: UpdateOperationsParams<MBase>): Promise<MBase>;
|
|
17
|
+
private static handleCacheRemoval;
|
|
18
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ModelBaseStructure, NonFunctionAndIdentifierProperties } from '../../../../../domain';
|
|
2
|
+
import { HasuraGraphQLFields } from '../../../types';
|
|
3
|
+
export declare class HasuraUpdateVariablesHelper {
|
|
4
|
+
static getUpdateModelKeys<MBase extends ModelBaseStructure<MBase>>(data: Partial<MBase>, model: any, fields: any): NonFunctionAndIdentifierProperties<MBase>;
|
|
5
|
+
static getIdentifierFields<MBase extends ModelBaseStructure<MBase>>(model: any, fields: any): HasuraGraphQLFields<MBase>;
|
|
6
|
+
static buildMutationVariables<MBase extends ModelBaseStructure<MBase>>(params: {
|
|
7
|
+
plainData: Partial<MBase>;
|
|
8
|
+
updateGraphQLObjectType: string;
|
|
9
|
+
updateGraphQLPKType: string;
|
|
10
|
+
convertDataToHasura: (data: any, isUpdate?: boolean) => any;
|
|
11
|
+
getUpdateModelKeys: (data: Partial<MBase>) => NonFunctionAndIdentifierProperties<MBase>;
|
|
12
|
+
model: any;
|
|
13
|
+
}): {
|
|
14
|
+
_set: {
|
|
15
|
+
type: string;
|
|
16
|
+
value: any;
|
|
17
|
+
required: boolean;
|
|
18
|
+
};
|
|
19
|
+
pk_columns: {
|
|
20
|
+
type: string;
|
|
21
|
+
value: NonFunctionAndIdentifierProperties<MBase>;
|
|
22
|
+
required: boolean;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
}
|