@infrab4a/connect 1.0.0-beta.9 → 1.0.1-beta.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/bundles/infrab4a-connect.umd.js +1297 -321
- package/bundles/infrab4a-connect.umd.js.map +1 -1
- package/domain/catalog/models/category.d.ts +2 -2
- package/domain/catalog/models/index.d.ts +3 -2
- package/domain/catalog/models/kit-product.d.ts +12 -0
- package/domain/catalog/models/product.d.ts +6 -2
- package/domain/catalog/models/types/product-review.type.d.ts +10 -8
- package/domain/catalog/models/variant.d.ts +3 -1
- package/domain/catalog/repositories/product.repository.d.ts +9 -2
- package/domain/generic/model/base.model.d.ts +1 -1
- package/domain/generic/model/types/base-model-builder.type.d.ts +1 -1
- package/domain/generic/model/types/non-function-property-name.type.d.ts +1 -1
- package/domain/generic/repository/create.repository.d.ts +2 -2
- package/domain/generic/repository/delete.repository.d.ts +3 -1
- package/domain/generic/repository/find.repository.d.ts +2 -1
- package/domain/generic/repository/types/repository-find-filters.type.d.ts +4 -4
- package/domain/generic/repository/types/repository-update-params.type.d.ts +4 -4
- package/domain/users/errors/unauthorized.error.d.ts +2 -1
- package/domain/users/errors/user-already-registered.error.d.ts +2 -1
- package/domain/users/errors/weak-password.error.d.ts +2 -1
- package/domain/users/models/user.d.ts +2 -0
- package/errors/duplicated-results.error.d.ts +2 -1
- package/errors/invalid-argument.error.d.ts +2 -1
- package/errors/not-found.error.d.ts +2 -1
- package/errors/required-argument.error.d.ts +2 -1
- package/esm2015/domain/catalog/models/category.js +1 -1
- package/esm2015/domain/catalog/models/index.js +4 -3
- package/esm2015/domain/catalog/models/kit-product.js +18 -0
- package/esm2015/domain/catalog/models/product.js +8 -1
- package/esm2015/domain/catalog/models/types/product-review.type.js +1 -1
- package/esm2015/domain/catalog/models/variant.js +1 -1
- package/esm2015/domain/catalog/repositories/product.repository.js +1 -1
- package/esm2015/domain/generic/model/base.model.js +4 -4
- package/esm2015/domain/generic/model/types/base-model-builder.type.js +1 -1
- package/esm2015/domain/generic/model/types/non-function-property-name.type.js +1 -1
- package/esm2015/domain/generic/repository/create.repository.js +1 -1
- package/esm2015/domain/generic/repository/delete.repository.js +1 -1
- package/esm2015/domain/generic/repository/find.repository.js +1 -1
- package/esm2015/domain/generic/repository/types/repository-find-filters.type.js +1 -1
- package/esm2015/domain/generic/repository/types/repository-update-params.type.js +1 -1
- package/esm2015/domain/users/errors/unauthorized.error.js +3 -2
- package/esm2015/domain/users/errors/user-already-registered.error.js +3 -2
- package/esm2015/domain/users/errors/weak-password.error.js +3 -2
- package/esm2015/domain/users/models/user.js +1 -1
- package/esm2015/errors/duplicated-results.error.js +3 -2
- package/esm2015/errors/invalid-argument.error.js +3 -2
- package/esm2015/errors/not-found.error.js +3 -2
- package/esm2015/errors/required-argument.error.js +3 -2
- package/esm2015/infra/elasticsearch/adapters/axios.adapter.js +36 -1
- package/esm2015/infra/elasticsearch/adapters/elastic-search.adapter.js +1 -1
- package/esm2015/infra/elasticsearch/indexes/products-index.js +35 -1
- package/esm2015/infra/firebase/auth/authentication-firebase-auth.service.js +2 -2
- package/esm2015/infra/firebase/auth/register-firebase-auth.service.js +1 -1
- package/esm2015/infra/firebase/firestore/mixins/with-find-firestore.mixin.js +11 -5
- package/esm2015/infra/firebase/firestore/mixins/with-firestore.mixin.js +2 -3
- package/esm2015/infra/firebase/firestore/mixins/with-helpers.mixin.js +1 -1
- package/esm2015/infra/firebase/firestore/repositories/catalog/category-firestore.repository.js +4 -2
- package/esm2015/infra/firebase/firestore/repositories/catalog/product-firestore.repository.js +32 -5
- package/esm2015/infra/hasura-graphql/index.js +3 -2
- package/esm2015/infra/hasura-graphql/mixins/helpers/attribute-option.helper.js +18 -2
- package/esm2015/infra/hasura-graphql/mixins/helpers/filter-option.helper.js +20 -0
- package/esm2015/infra/hasura-graphql/mixins/helpers/graphql-field.helper.js +72 -0
- package/esm2015/infra/hasura-graphql/mixins/helpers/index.js +3 -1
- package/esm2015/infra/hasura-graphql/mixins/with-create-hasura-graphql.mixin.js +21 -2
- package/esm2015/infra/hasura-graphql/mixins/with-delete-hasura-graphql.mixin.js +14 -6
- package/esm2015/infra/hasura-graphql/mixins/with-find-hasura-graphql.mixin.js +24 -26
- package/esm2015/infra/hasura-graphql/mixins/with-get-hasura-graphql.mixin.js +14 -10
- package/esm2015/infra/hasura-graphql/mixins/with-hasura-graphql.mixin.js +10 -84
- package/esm2015/infra/hasura-graphql/mixins/with-update-hasura-graphql.mixin.js +18 -7
- package/esm2015/infra/hasura-graphql/models/category-hasura-graphql.js +1 -1
- package/esm2015/infra/hasura-graphql/models/index.js +4 -1
- package/esm2015/infra/hasura-graphql/models/kit-product-hasura-graphql.js +15 -0
- package/esm2015/infra/hasura-graphql/models/product-hasura-graphql.js +11 -0
- package/esm2015/infra/hasura-graphql/models/variant-hasura-graphql.js +9 -0
- package/esm2015/infra/hasura-graphql/repositories/catalog/category-hasura-graphql.repository.js +47 -15
- package/esm2015/infra/hasura-graphql/repositories/catalog/index.js +2 -1
- package/esm2015/infra/hasura-graphql/repositories/catalog/product-hasura-graphql.repository.js +362 -63
- package/esm2015/infra/hasura-graphql/repositories/catalog/variant-hasura-graphql.repository.js +116 -0
- package/esm2015/infra/hasura-graphql/types/graphql.repository.type.js +1 -1
- package/esm2015/infra/hasura-graphql/types/hasura-graphql-fields.type.js +1 -1
- package/esm2015/infra/hasura-graphql/types/hasura-graphql-headers.type.js +2 -0
- package/esm2015/infra/hasura-graphql/types/index.js +2 -1
- package/fesm2015/infrab4a-connect.js +870 -219
- package/fesm2015/infrab4a-connect.js.map +1 -1
- package/infra/elasticsearch/adapters/axios.adapter.d.ts +3 -0
- package/infra/elasticsearch/adapters/elastic-search.adapter.d.ts +3 -0
- package/infra/elasticsearch/indexes/products-index.d.ts +5 -1
- package/infra/firebase/auth/authentication-firebase-auth.service.d.ts +1 -1
- package/infra/firebase/auth/register-firebase-auth.service.d.ts +1 -1
- package/infra/firebase/firestore/mixins/with-find-firestore.mixin.d.ts +1 -1
- package/infra/firebase/firestore/mixins/with-firestore.mixin.d.ts +1 -1
- package/infra/firebase/firestore/repositories/catalog/product-firestore.repository.d.ts +4 -2
- package/infra/hasura-graphql/index.d.ts +2 -1
- package/infra/hasura-graphql/mixins/helpers/attribute-option.helper.d.ts +9 -6
- package/infra/hasura-graphql/mixins/helpers/filter-option.helper.d.ts +6 -0
- package/infra/hasura-graphql/mixins/helpers/graphql-field.helper.d.ts +8 -0
- package/infra/hasura-graphql/mixins/helpers/index.d.ts +2 -0
- package/infra/hasura-graphql/mixins/with-create-hasura-graphql.mixin.d.ts +1 -1
- package/infra/hasura-graphql/mixins/with-find-hasura-graphql.mixin.d.ts +8 -7
- package/infra/hasura-graphql/mixins/with-get-hasura-graphql.mixin.d.ts +5 -5
- package/infra/hasura-graphql/mixins/with-hasura-graphql.mixin.d.ts +3 -3
- package/infra/hasura-graphql/mixins/with-update-hasura-graphql.mixin.d.ts +1 -1
- package/infra/hasura-graphql/models/category-hasura-graphql.d.ts +3 -1
- package/infra/hasura-graphql/models/index.d.ts +3 -0
- package/infra/hasura-graphql/models/kit-product-hasura-graphql.d.ts +6 -0
- package/infra/hasura-graphql/models/product-hasura-graphql.d.ts +10 -0
- package/infra/hasura-graphql/models/variant-hasura-graphql.d.ts +9 -0
- package/infra/hasura-graphql/repositories/catalog/index.d.ts +1 -0
- package/infra/hasura-graphql/repositories/catalog/product-hasura-graphql.repository.d.ts +22 -5
- package/infra/hasura-graphql/repositories/catalog/variant-hasura-graphql.repository.d.ts +14 -0
- package/infra/hasura-graphql/types/graphql.repository.type.d.ts +5 -5
- package/infra/hasura-graphql/types/hasura-graphql-fields.type.d.ts +15 -19
- package/infra/hasura-graphql/types/hasura-graphql-headers.type.d.ts +7 -0
- package/infra/hasura-graphql/types/index.d.ts +1 -0
- package/package.json +4 -3
|
@@ -7,5 +7,8 @@ export declare type AxiosElasticSearchConfig = {
|
|
|
7
7
|
export declare class AxiosAdapter<T extends BaseModel<T>> {
|
|
8
8
|
private readonly config;
|
|
9
9
|
constructor(config: AxiosElasticSearchConfig);
|
|
10
|
+
get(index: string): Promise<Partial<T>>;
|
|
10
11
|
query(index: string, query: any): Promise<ElasticSearchResult<Partial<T>>>;
|
|
12
|
+
save(index: string, data: Partial<T>): Promise<void>;
|
|
13
|
+
delete(index: string): Promise<void>;
|
|
11
14
|
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { ElasticSearchResult } from '../types/elastic-search-result';
|
|
2
2
|
export interface ElasticSearchAdapter<T = any> {
|
|
3
|
+
get(index: string): Promise<T>;
|
|
3
4
|
query(index: string, query: any): Promise<ElasticSearchResult<T>>;
|
|
5
|
+
save(index: string, data: Partial<T>): Promise<void>;
|
|
6
|
+
delete(index: string): Promise<void>;
|
|
4
7
|
}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import { AxiosAdapter } from '../adapters';
|
|
2
1
|
import { Product, Shops } from '../../../domain';
|
|
2
|
+
import { ProductHasuraGraphQL } from '../../hasura-graphql';
|
|
3
|
+
import { AxiosAdapter } from '../adapters';
|
|
3
4
|
export declare class ProductsIndex {
|
|
4
5
|
private readonly adapter;
|
|
5
6
|
constructor(adapter: AxiosAdapter<Product>);
|
|
7
|
+
get(id: any): Promise<Product>;
|
|
6
8
|
findById(ids: string[], options?: {
|
|
7
9
|
hasStock: boolean;
|
|
8
10
|
size: number;
|
|
9
11
|
shop: Shops;
|
|
10
12
|
}): Promise<Product[]>;
|
|
13
|
+
save(product: ProductHasuraGraphQL): Promise<void>;
|
|
14
|
+
delete(product: ProductHasuraGraphQL): Promise<void>;
|
|
11
15
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import firebase from 'firebase
|
|
1
|
+
import firebase from 'firebase';
|
|
2
2
|
import { AuthenticationService, BasicUserData, LoginAndPasswordParams } from '../../../domain';
|
|
3
3
|
import { FirebaseUserWithId } from './types/firebase-user-with-id.type';
|
|
4
4
|
export declare class AuthenticationFirebaseAuthService implements AuthenticationService {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import firebase from 'firebase
|
|
1
|
+
import firebase from 'firebase';
|
|
2
2
|
import { RegisterParams, RegisterService } from '../../../domain';
|
|
3
3
|
import { FirebaseUserWithId } from './types/firebase-user-with-id.type';
|
|
4
4
|
export declare class RegisterFirebaseAuthService implements RegisterService {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { FindRepository, ModelBaseStructure } from '../../../../domain';
|
|
2
|
-
import { FirestoreHelpers, FirestoreRepository } from '../types';
|
|
3
2
|
import { MergeConstructorParams, MixinCtor } from '../../../../utils';
|
|
3
|
+
import { FirestoreHelpers, FirestoreRepository } from '../types';
|
|
4
4
|
export declare const withFindFirestore: <TBase extends ModelBaseStructure<any, any>, TMixinBase extends MixinCtor<FirestoreRepository<TBase>, any[]>>(MixinBase: MixinCtor<FirestoreRepository<TBase> & FirestoreHelpers, any[]> & TMixinBase) => MixinCtor<FirestoreRepository<TBase> & InstanceType<TMixinBase> & FindRepository<TBase, import("../../../../domain").FindRepositoryParams<TBase>> & FirestoreHelpers, MergeConstructorParams<{}, ConstructorParameters<TMixinBase>>>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ModelBaseStructure } from '../../../../domain';
|
|
2
|
-
import { FirestoreRepository } from '../types';
|
|
3
2
|
import { MixinCtor } from '../../../../utils';
|
|
3
|
+
import { FirestoreRepository } from '../types';
|
|
4
4
|
export declare const withFirestore: <TBase extends ModelBaseStructure<any, any>, T extends MixinCtor<any, any[]> = MixinCtor<any, any[]>>(MixinBase: T) => MixinCtor<FirestoreRepository<TBase>, never>;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { FirebaseFirestore } from '@firebase/firestore-types';
|
|
2
|
-
import { Product, ProductRepository,
|
|
2
|
+
import { Product, ProductRepository, ReviewStatusParams, ReviewWithProductData } from '../../../../../domain';
|
|
3
3
|
declare const ProductFirestoreRepository_base: import("../../../../../utils").MixinCtor<import("@infrab4a/connect").FirestoreRepository<Product> & import("../../../../../domain").CrudRepository<Product, import("../../../../../domain").CrudParams<Product>> & import("@infrab4a/connect").FirestoreHelpers, never>;
|
|
4
4
|
export declare class ProductFirestoreRepository extends ProductFirestoreRepository_base implements ProductRepository {
|
|
5
5
|
readonly firestore: FirebaseFirestore;
|
|
6
|
+
private reviews;
|
|
6
7
|
constructor(firestore: FirebaseFirestore);
|
|
7
|
-
getBySlug(slug: string
|
|
8
|
+
getBySlug(slug: string): Promise<Product>;
|
|
9
|
+
fetchReviews(status: ReviewStatusParams): Promise<ReviewWithProductData[]>;
|
|
8
10
|
}
|
|
9
11
|
export {};
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { ModelBaseStructure, NonFunctionAndIdentifierPropertyNames } from '../../../../domain';
|
|
2
|
-
import {
|
|
2
|
+
import { ColumnOptions, HasuraGraphQLFields } from '../../types';
|
|
3
|
+
declare type FindByAttributeResult<MBase extends ModelBaseStructure<MBase>, Attribute extends NonFunctionAndIdentifierPropertyNames<MBase>> = ColumnOptions<MBase[Attribute], MBase> & {
|
|
4
|
+
attributeName: Attribute;
|
|
5
|
+
};
|
|
3
6
|
export declare class AttributeOptionHelper {
|
|
4
|
-
static
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
attributeName: NonFunctionAndIdentifierPropertyNames<MBase>;
|
|
7
|
+
static FindByAttribute: <MBase extends ModelBaseStructure<any, any>, Attribute extends NonFunctionAndIdentifierPropertyNames<MBase>>(attributeName: Attribute, fields: HasuraGraphQLFields<MBase>) => FindByAttributeResult<MBase, Attribute>;
|
|
8
|
+
static CheckIsColumnOption: <Model extends ModelBaseStructure<any, any>, ParentModel extends ModelBaseStructure<any, any>>(fieldValue: ColumnOptions<Model, ParentModel, any>) => fieldValue is ColumnOptions<Model, ParentModel, any>;
|
|
9
|
+
static FindColumnOptionFromList: <Model extends ModelBaseStructure<any, any>, ParentModel extends ModelBaseStructure<any, any>>(columnName: string, fields: HasuraGraphQLFields<ParentModel>) => ColumnOptions<Model, ParentModel, any> & {
|
|
10
|
+
attributeName: NonFunctionAndIdentifierPropertyNames<ParentModel>;
|
|
9
11
|
};
|
|
10
12
|
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ModelBaseStructure, RepositoryFindFieltersOptions } from '../../../../domain';
|
|
2
|
+
import { ColumnOptions } from '../../types';
|
|
3
|
+
export declare class FilterOptionHelper {
|
|
4
|
+
static CheckIfIsFilterOption: <Model extends ModelBaseStructure<any, any>>(filter: any) => filter is RepositoryFindFieltersOptions<Model, any>;
|
|
5
|
+
static GetValueFromFilter: <Model extends ModelBaseStructure<any, any>>(filter: RepositoryFindFieltersOptions<Model, any>, fieldOption: ColumnOptions<any, any>) => any;
|
|
6
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ModelBaseStructure, NonFunctionProperties } from '../../../../domain';
|
|
2
|
+
import { Fields, GraphQLParams, HasuraGraphQLFields } from '../../types';
|
|
3
|
+
export declare class GraphQLFieldHelper {
|
|
4
|
+
static CheckIsGraphQLParams: <Model extends ModelBaseStructure<any, any>>(params: string | GraphQLParams<Model>[]) => params is GraphQLParams<Model>[];
|
|
5
|
+
static ConvertModelFieldsToGraphQLFields: <Model extends ModelBaseStructure<any, any>>(fields: HasuraGraphQLFields<Model>) => Fields;
|
|
6
|
+
static ConvertFieldValueFrom: <Model extends ModelBaseStructure<any, any>, DataType extends Record<string, string | number | Date | DataType>>(data: string | number | Date | DataType, fields: HasuraGraphQLFields<Model>) => Partial<NonFunctionProperties<Model>>;
|
|
7
|
+
static ConvertFieldValueTo: <Model extends ModelBaseStructure<any, any>, DataType extends Record<string, string | number | Date | DataType>>(instance: Model, fields: HasuraGraphQLFields<Model>, update?: boolean) => DataType;
|
|
8
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CreateRepository, CreateRepositoryParams, ModelBaseStructure } from '../../../domain';
|
|
2
|
-
import { GraphQLRepository } from '../types';
|
|
3
2
|
import { MergeConstructorParams, MixinCtor } from '../../../utils';
|
|
3
|
+
import { GraphQLRepository } from '../types';
|
|
4
4
|
export declare type CreateConstructorParams = {
|
|
5
5
|
insertGraphQLOperation?: string;
|
|
6
6
|
insertGraphQLObjectType?: string;
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { ModelBaseStructure, NonFunctionAndIdentifierPropertyNames, NonFunctionPropertyNames, RepositoryFindFielters, RepositoryFindFieltersOptions, RepositoryFindResult, RepositoryLimitOptions, RepositoryOrderBy } from '../../../domain';
|
|
2
|
-
import { ColumnOptions, GraphQLRepository, HasuraGrahphQLFields, VariableOptions } from '../types';
|
|
3
|
-
import { HasuraGraphQLWhere } from '../enums';
|
|
4
2
|
import { MixinCtor } from '../../../utils';
|
|
3
|
+
import { HasuraGraphQLWhere } from '../enums';
|
|
4
|
+
import { ColumnOptions, GraphQLRepository, HasuraGraphQLFields, VariableOptions } from '../types';
|
|
5
5
|
export declare const withFindHasuraGraphQL: <MBase extends ModelBaseStructure<any, any>, TMixinBase extends MixinCtor<GraphQLRepository<MBase>, any[]>>(MixinBase: MixinCtor<GraphQLRepository<MBase>, any[]> & TMixinBase) => {
|
|
6
6
|
new (...args: any[]): {
|
|
7
7
|
find(options?: {
|
|
8
8
|
filters?: RepositoryFindFielters<MBase>;
|
|
9
|
+
fields?: NonFunctionPropertyNames<MBase, keyof MBase>[];
|
|
9
10
|
limits?: RepositoryLimitOptions<MBase>;
|
|
10
11
|
orderBy?: RepositoryOrderBy<MBase>;
|
|
11
12
|
}): Promise<RepositoryFindResult<MBase>>;
|
|
12
|
-
makeGraphQLWhere: (filter: RepositoryFindFielters<MBase>, fields:
|
|
13
|
-
buildWhereSentence: (field: NonFunctionAndIdentifierPropertyNames<MBase>, options: RepositoryFindFieltersOptions<MBase, NonFunctionPropertyNames<MBase, keyof MBase>>, fields:
|
|
13
|
+
makeGraphQLWhere: (filter: RepositoryFindFielters<MBase>, fields: HasuraGraphQLFields<MBase>) => VariableOptions;
|
|
14
|
+
buildWhereSentence: (field: NonFunctionAndIdentifierPropertyNames<MBase>, options: RepositoryFindFieltersOptions<MBase, NonFunctionPropertyNames<MBase, keyof MBase>>, fields: HasuraGraphQLFields<MBase>) => VariableOptions;
|
|
14
15
|
buildOperatorSentence: (options: RepositoryFindFieltersOptions<MBase, any>, fieldOption: ColumnOptions<any, any>) => VariableOptions;
|
|
15
16
|
getHasuraOperator: (options: RepositoryFindFieltersOptions<MBase, NonFunctionPropertyNames<MBase, keyof MBase>>, fieldOption: ColumnOptions<any, any>) => HasuraGraphQLWhere;
|
|
16
17
|
getHasuraJsonbOperator: (options: RepositoryFindFieltersOptions<MBase, NonFunctionPropertyNames<MBase, keyof MBase>>) => HasuraGraphQLWhere;
|
|
@@ -18,11 +19,11 @@ export declare const withFindHasuraGraphQL: <MBase extends ModelBaseStructure<an
|
|
|
18
19
|
model: import("../../../domain").BaseModelBuilder<MBase, NonFunctionAndIdentifierPropertyNames<MBase>, MBase & {
|
|
19
20
|
prototype: unknown;
|
|
20
21
|
}>;
|
|
21
|
-
fields:
|
|
22
|
+
fields: HasuraGraphQLFields<MBase>;
|
|
22
23
|
endpoint: string;
|
|
23
24
|
authOptions: import("../types").HasuraGraphQLAuthOptions;
|
|
24
|
-
mutation: <ReturnFields = any>(operation: string, fields?:
|
|
25
|
-
query: <ReturnFields_1 = any>(operation: string | import("../types").GraphQLParams<MBase>[], fields?:
|
|
25
|
+
mutation: <ReturnFields = any>(operation: string, fields?: string[] | HasuraGraphQLFields<MBase>, variables?: VariableOptions) => Promise<ReturnFields>;
|
|
26
|
+
query: <ReturnFields_1 = any>(operation: string | import("../types").GraphQLParams<MBase>[], fields?: string[] | HasuraGraphQLFields<MBase>, variables?: VariableOptions) => Promise<ReturnFields_1>;
|
|
26
27
|
getAttributeGraphQLTypeOf: <FieldValue>(value: FieldValue) => string;
|
|
27
28
|
convertDataFromHasura: (data: Record<string, string | number>) => MBase;
|
|
28
29
|
convertDataToHasura(instance: MBase, update?: boolean): Record<string, string | number>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { GraphQLRepository } from '../types';
|
|
1
|
+
import { GetRepositoryParams, ModelBaseStructure } from '../../../domain';
|
|
3
2
|
import { MixinCtor } from '../../../utils';
|
|
3
|
+
import { GraphQLRepository } from '../types';
|
|
4
4
|
export declare type GetConstructorParams = {
|
|
5
5
|
getGraphQLOperation?: string;
|
|
6
6
|
};
|
|
@@ -12,11 +12,11 @@ export declare const withGetHasuraGraphQL: <MBase extends ModelBaseStructure<any
|
|
|
12
12
|
model: import("../../../domain").BaseModelBuilder<MBase, import("../../../domain").NonFunctionAndIdentifierPropertyNames<MBase>, MBase & {
|
|
13
13
|
prototype: unknown;
|
|
14
14
|
}>;
|
|
15
|
-
fields: import("../types").
|
|
15
|
+
fields: import("../types").HasuraGraphQLFields<MBase>;
|
|
16
16
|
endpoint: string;
|
|
17
17
|
authOptions: import("../types").HasuraGraphQLAuthOptions;
|
|
18
|
-
mutation: <ReturnFields = any>(operation: string, fields?: import("../types").
|
|
19
|
-
query: <ReturnFields_1 = any>(operation: string | import("../types").GraphQLParams<MBase>[], fields?: import("../types").
|
|
18
|
+
mutation: <ReturnFields = any>(operation: string, fields?: string[] | import("../types").HasuraGraphQLFields<MBase>, variables?: import("../types").VariableOptions) => Promise<ReturnFields>;
|
|
19
|
+
query: <ReturnFields_1 = any>(operation: string | import("../types").GraphQLParams<MBase>[], fields?: string[] | import("../types").HasuraGraphQLFields<MBase>, variables?: import("../types").VariableOptions) => Promise<ReturnFields_1>;
|
|
20
20
|
getAttributeGraphQLTypeOf: <FieldValue>(value: FieldValue) => string;
|
|
21
21
|
convertDataFromHasura: (data: Record<string, string | number>) => MBase;
|
|
22
22
|
convertDataToHasura(instance: MBase, update?: boolean): Record<string, string | number>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { GraphQLRepository, HasuraGraphQLAuthOptions, HasuraGrahphQLFields } from '../types';
|
|
2
|
-
import { MergeConstructorParams, MixinCtor } from '../../../utils';
|
|
3
1
|
import { BaseModelBuilder, ModelBaseStructure } from '../../../domain';
|
|
2
|
+
import { MergeConstructorParams, MixinCtor } from '../../../utils';
|
|
3
|
+
import { GraphQLRepository, HasuraGraphQLAuthOptions, HasuraGraphQLFields } from '../types';
|
|
4
4
|
export declare type ConstructorParams<Model extends ModelBaseStructure> = {
|
|
5
5
|
tableName: string;
|
|
6
6
|
model: BaseModelBuilder<Model>;
|
|
7
|
-
fields:
|
|
7
|
+
fields: HasuraGraphQLFields<Model>;
|
|
8
8
|
endpoint: string;
|
|
9
9
|
authOptions: HasuraGraphQLAuthOptions;
|
|
10
10
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ModelBaseStructure, RepositoryUpdateParams, UpdateRepository } from '../../../domain';
|
|
2
|
-
import { GraphQLRepository } from '../types';
|
|
3
2
|
import { MergeConstructorParams, MixinCtor } from '../../../utils';
|
|
3
|
+
import { GraphQLRepository } from '../types';
|
|
4
4
|
export declare type UpdateHasuraGraphQLRepositoryType<MBase extends ModelBaseStructure> = UpdateRepository<MBase> & {
|
|
5
5
|
paramsToPlain(params: RepositoryUpdateParams<MBase>): Partial<MBase>;
|
|
6
6
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Product } from '../../../domain';
|
|
2
|
+
import { KitProductHasuraGraphQL } from './kit-product-hasura-graphql';
|
|
3
|
+
export declare class ProductHasuraGraphQL extends Product {
|
|
4
|
+
firestoreId?: string;
|
|
5
|
+
fullPrice?: number;
|
|
6
|
+
subscriberDiscountPercentage?: number;
|
|
7
|
+
subscriberPrice?: number;
|
|
8
|
+
productId?: number;
|
|
9
|
+
kitProducts?: KitProductHasuraGraphQL[];
|
|
10
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Variant } from '../../../domain';
|
|
2
|
+
export declare class VariantHasuraGraphQL extends Variant {
|
|
3
|
+
firestoreId?: string;
|
|
4
|
+
fullPrice?: number;
|
|
5
|
+
subscriberDiscountPercentage?: number;
|
|
6
|
+
subscriberPrice?: number;
|
|
7
|
+
name?: string;
|
|
8
|
+
hasVariants?: boolean;
|
|
9
|
+
}
|
|
@@ -1,10 +1,27 @@
|
|
|
1
|
+
import { CreateRepositoryParams, FindRepositoryParams, GetRepositoryParams, ProductRepository, RepositoryFindResult, ReviewStatusParams, ReviewWithProductData, UpdateRepositoryParams } from '../../../../domain';
|
|
2
|
+
import { ProductHasuraGraphQL } from '../../models';
|
|
1
3
|
import { HasuraGraphQLAuthOptions } from '../../types';
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}, [import("../../mixins").ConstructorParams<Product> & import("../../mixins").CreateConstructorParams & import("../../mixins").DeleteConstructorParams & import("../../mixins").GetConstructorParams & import("../../mixins").UpdateConstructorParams, ...any[]]>;
|
|
4
|
+
declare const ProductHasuraGraphQLRepository_base: import("../../../../utils").MixinCtor<import("../../types").GraphQLRepository<ProductHasuraGraphQL> & import("../../../../domain").CrudRepository<ProductHasuraGraphQL, import("../../../../domain").CrudParams<ProductHasuraGraphQL>> & import("../../../../domain").UpdateRepository<ProductHasuraGraphQL, import("../../../../domain").RepositoryUpdateParams<ProductHasuraGraphQL>> & {
|
|
5
|
+
paramsToPlain(params: import("../../../../domain").RepositoryUpdateParams<ProductHasuraGraphQL>): Partial<ProductHasuraGraphQL>;
|
|
6
|
+
}, [import("../../mixins").ConstructorParams<ProductHasuraGraphQL> & import("../../mixins").CreateConstructorParams & import("../../mixins").DeleteConstructorParams & import("../../mixins").GetConstructorParams & import("../../mixins").UpdateConstructorParams, ...any[]]>;
|
|
6
7
|
export declare class ProductHasuraGraphQLRepository extends ProductHasuraGraphQLRepository_base implements ProductRepository {
|
|
8
|
+
private get reviewsFields();
|
|
7
9
|
constructor(endpoint: string, authOptions: HasuraGraphQLAuthOptions);
|
|
8
|
-
|
|
10
|
+
create(data: CreateRepositoryParams<ProductHasuraGraphQL>): Promise<ProductHasuraGraphQL>;
|
|
11
|
+
get(identifiers: GetRepositoryParams<ProductHasuraGraphQL>): Promise<ProductHasuraGraphQL>;
|
|
12
|
+
find(params?: FindRepositoryParams<ProductHasuraGraphQL>): Promise<RepositoryFindResult<ProductHasuraGraphQL>>;
|
|
13
|
+
getBySlug(slug: string): Promise<ProductHasuraGraphQL>;
|
|
14
|
+
update(params: UpdateRepositoryParams<ProductHasuraGraphQL>): Promise<ProductHasuraGraphQL>;
|
|
15
|
+
fetchReviews(status: ReviewStatusParams): Promise<ReviewWithProductData[]>;
|
|
16
|
+
private updateCategories;
|
|
17
|
+
private updateKitProducts;
|
|
18
|
+
private updateReviews;
|
|
19
|
+
private getId;
|
|
20
|
+
private findReviewsByProduct;
|
|
21
|
+
private findReview;
|
|
22
|
+
private getReviewByPersonId;
|
|
23
|
+
private getReviewByAuthorAndEmail;
|
|
24
|
+
private bindReviewToModel;
|
|
25
|
+
private bindReviewToHasura;
|
|
9
26
|
}
|
|
10
27
|
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FindRepositoryParams, GetRepositoryParams, RepositoryFindResult, UpdateRepositoryParams, VariantRepository } from '../../../../domain';
|
|
2
|
+
import { VariantHasuraGraphQL } from '../../models';
|
|
3
|
+
import { HasuraGraphQLAuthOptions } from '../../types';
|
|
4
|
+
declare const VariantHasuraGraphQLRepository_base: import("../../../../utils").MixinCtor<import("../../types").GraphQLRepository<VariantHasuraGraphQL> & import("../../../../domain").CrudRepository<VariantHasuraGraphQL, import("../../../../domain").CrudParams<VariantHasuraGraphQL>> & import("../../../../domain").UpdateRepository<VariantHasuraGraphQL, import("../../../../domain").RepositoryUpdateParams<VariantHasuraGraphQL>> & {
|
|
5
|
+
paramsToPlain(params: import("../../../../domain").RepositoryUpdateParams<VariantHasuraGraphQL>): Partial<VariantHasuraGraphQL>;
|
|
6
|
+
}, [import("../../mixins").ConstructorParams<VariantHasuraGraphQL> & import("../../mixins").CreateConstructorParams & import("../../mixins").DeleteConstructorParams & import("../../mixins").GetConstructorParams & import("../../mixins").UpdateConstructorParams, ...any[]]>;
|
|
7
|
+
export declare class VariantHasuraGraphQLRepository extends VariantHasuraGraphQLRepository_base implements VariantRepository {
|
|
8
|
+
constructor(endpoint: string, authOptions: HasuraGraphQLAuthOptions);
|
|
9
|
+
get(identifiers: GetRepositoryParams<VariantHasuraGraphQL>): Promise<VariantHasuraGraphQL>;
|
|
10
|
+
find(params?: FindRepositoryParams<VariantHasuraGraphQL>): Promise<RepositoryFindResult<VariantHasuraGraphQL>>;
|
|
11
|
+
update(params: UpdateRepositoryParams<VariantHasuraGraphQL>): Promise<VariantHasuraGraphQL>;
|
|
12
|
+
private getId;
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { BaseModelBuilder, ModelBaseStructure } from '../../../domain';
|
|
2
2
|
import { HasuraGraphQLAuthOptions } from './hasura-graphql-auth-options.type';
|
|
3
|
-
import {
|
|
3
|
+
import { HasuraGraphQLFields } from './hasura-graphql-fields.type';
|
|
4
4
|
import { VariableOptions } from './variable-options.type';
|
|
5
5
|
export declare type GraphQLParams<Model extends ModelBaseStructure> = {
|
|
6
6
|
operation: string;
|
|
7
|
-
fields?:
|
|
7
|
+
fields?: HasuraGraphQLFields<Model>;
|
|
8
8
|
variables?: VariableOptions;
|
|
9
9
|
};
|
|
10
10
|
export declare type GraphQLRepository<Model extends ModelBaseStructure> = {
|
|
11
11
|
tableName: string;
|
|
12
12
|
model: BaseModelBuilder<Model>;
|
|
13
|
-
fields:
|
|
13
|
+
fields: HasuraGraphQLFields<Model>;
|
|
14
14
|
endpoint: string;
|
|
15
15
|
authOptions: HasuraGraphQLAuthOptions;
|
|
16
|
-
mutation: <ReturnFields = any>(operation: string, fields?:
|
|
17
|
-
query: <ReturnFields = any>(operation: string | GraphQLParams<Model>[], fields?:
|
|
16
|
+
mutation: <ReturnFields = any>(operation: string, fields?: string[] | HasuraGraphQLFields<Model>, variables?: VariableOptions) => Promise<ReturnFields>;
|
|
17
|
+
query: <ReturnFields = any>(operation: string | GraphQLParams<Model>[], fields?: string[] | HasuraGraphQLFields<Model>, variables?: VariableOptions) => Promise<ReturnFields>;
|
|
18
18
|
getAttributeGraphQLTypeOf: <FieldValue>(value: FieldValue) => string;
|
|
19
19
|
convertDataFromHasura: (data: Record<string, string | number>) => Model;
|
|
20
20
|
convertDataToHasura(instance: Model, update?: boolean): Record<string, string | number>;
|
|
@@ -1,25 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ModelBaseStructure, NonFunctionAndIdentifierPropertyNames } from '../../../domain';
|
|
1
|
+
import { ModelBaseStructure, NonFunctionAndIdentifierPropertyNames, RepositoryFindField } from '../../../domain';
|
|
3
2
|
import { PropType } from '../../../utils';
|
|
4
|
-
|
|
3
|
+
import { HasuraGraphQLColumnType } from '../enums';
|
|
4
|
+
export declare type ColumnOptions<FieldType, Model, ValueFrom = any> = {
|
|
5
5
|
type?: HasuraGraphQLColumnType;
|
|
6
6
|
columnName?: string;
|
|
7
|
-
fields?: any[]
|
|
8
|
-
foreignKeyColumn?: any
|
|
7
|
+
fields?: HasuraGraphQLFields<FieldType extends any[] ? FieldType[number] : FieldType>;
|
|
8
|
+
foreignKeyColumn?: Partial<Record<NonFunctionAndIdentifierPropertyNames<FieldType extends any[] ? FieldType[number] : FieldType>, NonFunctionAndIdentifierPropertyNames<Model> | string>>;
|
|
9
9
|
from?: (value: ValueFrom | ValueFrom[], data?: any) => FieldType;
|
|
10
10
|
to?: (value: FieldType, instance?: Model) => ValueFrom;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
fields?: HasuraGrahphQLFields<Model>;
|
|
14
|
-
foreignKeyColumn?: {
|
|
15
|
-
[key in NonFunctionAndIdentifierPropertyNames<Model>]?: string;
|
|
16
|
-
};
|
|
11
|
+
bindFindFilter?: (sentence: RepositoryFindField<Model, keyof Model>) => Record<string, RepositoryFindField<any, any> | ValueFrom> | RepositoryFindField<any, any> | ValueFrom;
|
|
12
|
+
bindPersistData?: (value: FieldType, instance?: Model) => Record<string, ValueFrom>;
|
|
17
13
|
};
|
|
18
14
|
export declare type AggregateOptionNames = 'avg' | 'count' | 'max' | 'min' | 'stddev' | 'stddev_pop' | 'stddev_samp' | 'sum' | 'var_pop' | 'var_samp' | 'variance';
|
|
19
|
-
export declare type AggregateOptionFields<Model
|
|
15
|
+
export declare type AggregateOptionFields<Model, Type, Properties extends keyof Model = keyof Model> = {
|
|
20
16
|
[K in Properties]: PropType<Model, K> extends Type ? K : never;
|
|
21
|
-
}[Properties];
|
|
22
|
-
export declare type AggregateOptions<Model
|
|
17
|
+
}[Properties] | string;
|
|
18
|
+
export declare type AggregateOptions<Model> = {
|
|
23
19
|
avg?: Array<AggregateOptionFields<Model, number>>;
|
|
24
20
|
max?: Array<AggregateOptionFields<Model, number | Date>>;
|
|
25
21
|
min?: Array<AggregateOptionFields<Model, number | Date>>;
|
|
@@ -31,10 +27,10 @@ export declare type AggregateOptions<Model extends ModelBaseStructure> = {
|
|
|
31
27
|
var_samp?: Array<AggregateOptionFields<Model, number>>;
|
|
32
28
|
variance?: Array<AggregateOptionFields<Model, number>>;
|
|
33
29
|
};
|
|
34
|
-
export declare type
|
|
35
|
-
[key in NonFunctionAndIdentifierPropertyNames<Model>]?: PropType<Model, key> extends ModelBaseStructure ?
|
|
36
|
-
} | {
|
|
37
|
-
[key in NonFunctionAndIdentifierPropertyNames<Model>]?: key extends 'aggregate' ? never : PropType<Model, key> extends ModelBaseStructure ? ColumnModelOptions<PropType<Model, key>, Model> : ColumnOptions<PropType<Model, key>, Model>;
|
|
30
|
+
export declare type HasuraGraphQLFields<Model> = ((Model extends ModelBaseStructure ? NonFunctionAndIdentifierPropertyNames<Model> | {
|
|
31
|
+
[key in NonFunctionAndIdentifierPropertyNames<Model>]?: PropType<Model, key> extends ModelBaseStructure ? HasuraGraphQLFields<PropType<Model, key>> : PropType<Model, key> extends any[] ? PropType<Model, key>[] extends ModelBaseStructure[] ? HasuraGraphQLFields<PropType<Model, key>[]> : never : never;
|
|
38
32
|
} | {
|
|
33
|
+
[key in NonFunctionAndIdentifierPropertyNames<Model>]?: key extends 'aggregate' ? never : PropType<Model, key> extends ModelBaseStructure ? ColumnOptions<PropType<Model, key>, Model> : ColumnOptions<PropType<Model, key>, Model>;
|
|
34
|
+
} : string) | {
|
|
39
35
|
aggregate: Array<AggregateOptions<Model> | 'count'>;
|
|
40
|
-
})[];
|
|
36
|
+
} | 'affected_rows')[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@infrab4a/connect",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1-beta.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"registry": "https://registry.npmjs.org"
|
|
6
6
|
},
|
|
@@ -10,14 +10,15 @@
|
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"axios": "^0.27.2",
|
|
13
|
-
"class-transformer": "^0.
|
|
13
|
+
"class-transformer": "^0.5.1",
|
|
14
14
|
"date-fns": "^2.28.0",
|
|
15
15
|
"firebase": "7.24.0",
|
|
16
16
|
"gql-query-builder": "^3.7.0",
|
|
17
17
|
"lodash": "^4.17.21",
|
|
18
18
|
"reflect-metadata": "^0.1.13",
|
|
19
|
+
"ts-custom-error": "3.2.2",
|
|
19
20
|
"ts-md5": "^1.2.9",
|
|
20
|
-
"tslib": "^2.
|
|
21
|
+
"tslib": "^2.4.0"
|
|
21
22
|
},
|
|
22
23
|
"main": "bundles/infrab4a-connect.umd.js",
|
|
23
24
|
"module": "fesm2015/infrab4a-connect.js",
|