@infrab4a/connect 1.0.0-beta.15 → 1.0.0-beta.17
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 +307 -138
- package/bundles/infrab4a-connect.umd.js.map +1 -1
- 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 +3 -0
- package/domain/generic/repository/types/repository-find-filters.type.d.ts +3 -3
- 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/generic/repository/types/repository-find-filters.type.js +1 -1
- package/esm2015/infra/firebase/firestore/mixins/with-find-firestore.mixin.js +2 -2
- package/esm2015/infra/firebase/firestore/mixins/with-firestore.mixin.js +2 -3
- package/esm2015/infra/hasura-graphql/index.js +3 -2
- package/esm2015/infra/hasura-graphql/mixins/helpers/attribute-option.helper.js +2 -3
- package/esm2015/infra/hasura-graphql/mixins/helpers/graphql-field.helper.js +8 -10
- package/esm2015/infra/hasura-graphql/mixins/with-create-hasura-graphql.mixin.js +1 -1
- package/esm2015/infra/hasura-graphql/mixins/with-find-hasura-graphql.mixin.js +3 -3
- package/esm2015/infra/hasura-graphql/mixins/with-hasura-graphql.mixin.js +2 -2
- package/esm2015/infra/hasura-graphql/mixins/with-update-hasura-graphql.mixin.js +6 -3
- package/esm2015/infra/hasura-graphql/models/index.js +2 -1
- package/esm2015/infra/hasura-graphql/models/kit-product-hasura-graphql.js +15 -0
- package/esm2015/infra/hasura-graphql/models/product-hasura-graphql.js +8 -1
- package/esm2015/infra/hasura-graphql/repositories/catalog/product-hasura-graphql.repository.js +109 -68
- package/esm2015/infra/hasura-graphql/types/hasura-graphql-fields.type.js +1 -1
- package/esm2015/infra/index.js +2 -1
- package/esm2015/infra/millenium/index.js +2 -0
- package/esm2015/infra/millenium/millenium.js +42 -0
- package/fesm2015/infrab4a-connect.js +215 -104
- package/fesm2015/infrab4a-connect.js.map +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/hasura-graphql/index.d.ts +2 -1
- package/infra/hasura-graphql/mixins/helpers/attribute-option.helper.d.ts +1 -5
- 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 +2 -2
- package/infra/hasura-graphql/mixins/with-hasura-graphql.mixin.d.ts +2 -2
- package/infra/hasura-graphql/models/index.d.ts +1 -0
- package/infra/hasura-graphql/models/kit-product-hasura-graphql.d.ts +6 -0
- package/infra/hasura-graphql/models/product-hasura-graphql.d.ts +2 -0
- package/infra/hasura-graphql/repositories/catalog/product-hasura-graphql.repository.d.ts +1 -0
- package/infra/hasura-graphql/types/hasura-graphql-fields.type.d.ts +8 -14
- package/infra/index.d.ts +1 -0
- package/infra/millenium/index.d.ts +1 -0
- package/infra/millenium/millenium.d.ts +25 -0
- package/package.json +1 -1
|
@@ -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,16 +1,12 @@
|
|
|
1
1
|
import { ModelBaseStructure, NonFunctionAndIdentifierPropertyNames } from '../../../../domain';
|
|
2
|
-
import {
|
|
2
|
+
import { ColumnOptions, HasuraGraphQLFields } from '../../types';
|
|
3
3
|
declare type FindByAttributeResult<MBase extends ModelBaseStructure<MBase>, Attribute extends NonFunctionAndIdentifierPropertyNames<MBase>> = ColumnOptions<MBase[Attribute], MBase> & {
|
|
4
4
|
attributeName: Attribute;
|
|
5
5
|
};
|
|
6
6
|
export declare class AttributeOptionHelper {
|
|
7
7
|
static FindByAttribute: <MBase extends ModelBaseStructure<any, any>, Attribute extends NonFunctionAndIdentifierPropertyNames<MBase>>(attributeName: Attribute, fields: HasuraGraphQLFields<MBase>) => FindByAttributeResult<MBase, Attribute>;
|
|
8
|
-
static CheckIsColumnModelOption: <Model extends ModelBaseStructure<any, any>, ParentModel extends ModelBaseStructure<any, any>>(fieldValue: ColumnModelOptions<Model, ParentModel>) => fieldValue is ColumnModelOptions<Model, ParentModel>;
|
|
9
8
|
static CheckIsColumnOption: <Model extends ModelBaseStructure<any, any>, ParentModel extends ModelBaseStructure<any, any>>(fieldValue: ColumnOptions<Model, ParentModel, string | number | boolean | Record<string, any>>) => fieldValue is ColumnOptions<Model, ParentModel, string | number | boolean | Record<string, any>>;
|
|
10
9
|
static FindColumnOptionFromList: <Model extends ModelBaseStructure<any, any>, ParentModel extends ModelBaseStructure<any, any>>(columnName: string, fields: HasuraGraphQLFields<ParentModel>) => ColumnOptions<Model, ParentModel, string | number | boolean | Record<string, any>> & {
|
|
11
|
-
fields?: HasuraGraphQLFields<Model>;
|
|
12
|
-
foreignKeyColumn?: { [key in NonFunctionAndIdentifierPropertyNames<Model>]?: string; };
|
|
13
|
-
} & {
|
|
14
10
|
attributeName: NonFunctionAndIdentifierPropertyNames<ParentModel>;
|
|
15
11
|
};
|
|
16
12
|
}
|
|
@@ -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,7 +1,7 @@
|
|
|
1
1
|
import { ModelBaseStructure, NonFunctionAndIdentifierPropertyNames, NonFunctionPropertyNames, RepositoryFindFielters, RepositoryFindFieltersOptions, RepositoryFindResult, RepositoryLimitOptions, RepositoryOrderBy } from '../../../domain';
|
|
2
|
-
import { ColumnOptions, GraphQLRepository, HasuraGraphQLFields, 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?: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { GraphQLRepository, HasuraGraphQLAuthOptions, HasuraGraphQLFields } 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>;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { Product } from '../../../domain';
|
|
2
|
+
import { KitProductHasuraGraphQL } from './kit-product-hasura-graphql';
|
|
2
3
|
export declare class ProductHasuraGraphQL extends Product {
|
|
3
4
|
firestoreId?: string;
|
|
4
5
|
fullPrice?: number;
|
|
5
6
|
subscriberDiscountPercentage?: number;
|
|
6
7
|
subscriberPrice?: number;
|
|
8
|
+
kitProducts?: KitProductHasuraGraphQL[];
|
|
7
9
|
}
|
|
@@ -10,6 +10,7 @@ export declare class ProductHasuraGraphQLRepository extends ProductHasuraGraphQL
|
|
|
10
10
|
getBySlug(slug: string, shop: Shops): Promise<ProductHasuraGraphQL>;
|
|
11
11
|
update(params: UpdateRepositoryParams<ProductHasuraGraphQL>): Promise<ProductHasuraGraphQL>;
|
|
12
12
|
private updateCategories;
|
|
13
|
+
private updateKitProducts;
|
|
13
14
|
private getId;
|
|
14
15
|
}
|
|
15
16
|
export {};
|
|
@@ -1,27 +1,21 @@
|
|
|
1
1
|
import { ModelBaseStructure, NonFunctionAndIdentifierPropertyNames, RepositoryFindField } from '../../../domain';
|
|
2
2
|
import { PropType } from '../../../utils';
|
|
3
3
|
import { HasuraGraphQLColumnType } from '../enums';
|
|
4
|
-
export declare type ColumnOptions<FieldType, Model
|
|
4
|
+
export declare type ColumnOptions<FieldType, Model, ValueFrom = string | number | boolean | Record<string, 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
11
|
bindFindFilter?: (sentence: RepositoryFindField<Model, keyof Model>) => Record<string, RepositoryFindField<any, any> | ValueFrom> | RepositoryFindField<any, any> | ValueFrom;
|
|
12
12
|
bindPersistData?: (value: FieldType, instance?: Model) => Record<string, ValueFrom>;
|
|
13
13
|
};
|
|
14
|
-
export declare type ColumnModelOptions<Model extends ModelBaseStructure, ParentModel extends ModelBaseStructure> = ColumnOptions<Model, ParentModel> & {
|
|
15
|
-
fields?: HasuraGraphQLFields<Model>;
|
|
16
|
-
foreignKeyColumn?: {
|
|
17
|
-
[key in NonFunctionAndIdentifierPropertyNames<Model>]?: string;
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
14
|
export declare type AggregateOptionNames = 'avg' | 'count' | 'max' | 'min' | 'stddev' | 'stddev_pop' | 'stddev_samp' | 'sum' | 'var_pop' | 'var_samp' | 'variance';
|
|
21
|
-
export declare type AggregateOptionFields<Model
|
|
15
|
+
export declare type AggregateOptionFields<Model, Type, Properties extends keyof Model = keyof Model> = {
|
|
22
16
|
[K in Properties]: PropType<Model, K> extends Type ? K : never;
|
|
23
17
|
}[Properties];
|
|
24
|
-
export declare type AggregateOptions<Model
|
|
18
|
+
export declare type AggregateOptions<Model> = {
|
|
25
19
|
avg?: Array<AggregateOptionFields<Model, number>>;
|
|
26
20
|
max?: Array<AggregateOptionFields<Model, number | Date>>;
|
|
27
21
|
min?: Array<AggregateOptionFields<Model, number | Date>>;
|
|
@@ -33,10 +27,10 @@ export declare type AggregateOptions<Model extends ModelBaseStructure> = {
|
|
|
33
27
|
var_samp?: Array<AggregateOptionFields<Model, number>>;
|
|
34
28
|
variance?: Array<AggregateOptionFields<Model, number>>;
|
|
35
29
|
};
|
|
36
|
-
export declare type HasuraGraphQLFields<Model extends ModelBaseStructure
|
|
30
|
+
export declare type HasuraGraphQLFields<Model> = ((Model extends ModelBaseStructure ? NonFunctionAndIdentifierPropertyNames<Model> | {
|
|
37
31
|
[key in NonFunctionAndIdentifierPropertyNames<Model>]?: PropType<Model, key> extends ModelBaseStructure ? HasuraGraphQLFields<PropType<Model, key>> : never;
|
|
38
32
|
} | {
|
|
39
|
-
[key in NonFunctionAndIdentifierPropertyNames<Model>]?: key extends 'aggregate' ? never : PropType<Model, key> extends ModelBaseStructure ?
|
|
40
|
-
} | {
|
|
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) | {
|
|
41
35
|
aggregate: Array<AggregateOptions<Model> | 'count'>;
|
|
42
36
|
} | 'affected_rows')[];
|
package/infra/index.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './millenium';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { BaseModel, CrudRepository, Product } from '../../domain';
|
|
2
|
+
import { HasuraGraphQLAuthOptions, ProductHasuraGraphQL, ProductHasuraGraphQLRepository } from '../hasura-graphql';
|
|
3
|
+
declare type MilleniumProductIdentifier = 'id' | 'productId';
|
|
4
|
+
export declare class MilleniumProduct extends BaseModel<MilleniumProduct> {
|
|
5
|
+
id: number;
|
|
6
|
+
productId: string;
|
|
7
|
+
internalId: string;
|
|
8
|
+
codProduct: string;
|
|
9
|
+
createdAt: Date;
|
|
10
|
+
updatedAt?: Date;
|
|
11
|
+
product: Product;
|
|
12
|
+
static get identifiersFields(): MilleniumProductIdentifier[];
|
|
13
|
+
}
|
|
14
|
+
export declare class MilleniumProductHasuraGraphQL extends MilleniumProduct {
|
|
15
|
+
product: ProductHasuraGraphQL;
|
|
16
|
+
}
|
|
17
|
+
declare const MilleniumProductHasuraGraphQLRepository_base: import("../../utils").MixinCtor<import("../hasura-graphql").GraphQLRepository<MilleniumProductHasuraGraphQL> & CrudRepository<MilleniumProductHasuraGraphQL, import("../../domain").CrudParams<MilleniumProductHasuraGraphQL>> & import("../../domain").UpdateRepository<MilleniumProductHasuraGraphQL, import("../../domain").RepositoryUpdateParams<MilleniumProductHasuraGraphQL>> & {
|
|
18
|
+
paramsToPlain(params: import("../../domain").RepositoryUpdateParams<MilleniumProductHasuraGraphQL>): Partial<MilleniumProductHasuraGraphQL>;
|
|
19
|
+
}, [import("../hasura-graphql").ConstructorParams<MilleniumProductHasuraGraphQL> & import("../hasura-graphql").CreateConstructorParams & import("../hasura-graphql").DeleteConstructorParams & import("../hasura-graphql").GetConstructorParams & import("../hasura-graphql").UpdateConstructorParams, ...any[]]>;
|
|
20
|
+
export declare class MilleniumProductHasuraGraphQLRepository extends MilleniumProductHasuraGraphQLRepository_base implements MilleniumProductRepository {
|
|
21
|
+
constructor(endpoint: string, authOptions: HasuraGraphQLAuthOptions, productRepository: ProductHasuraGraphQLRepository);
|
|
22
|
+
}
|
|
23
|
+
export interface MilleniumProductRepository extends CrudRepository<MilleniumProduct> {
|
|
24
|
+
}
|
|
25
|
+
export {};
|