@infrab4a/connect 1.0.0-beta.16 → 1.0.0-beta.18

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.
Files changed (37) hide show
  1. package/bundles/infrab4a-connect.umd.js +254 -142
  2. package/bundles/infrab4a-connect.umd.js.map +1 -1
  3. package/domain/catalog/models/index.d.ts +3 -2
  4. package/domain/catalog/models/kit-product.d.ts +12 -0
  5. package/domain/catalog/models/product.d.ts +3 -0
  6. package/domain/generic/repository/types/repository-find-filters.type.d.ts +3 -3
  7. package/esm2015/domain/catalog/models/index.js +4 -3
  8. package/esm2015/domain/catalog/models/kit-product.js +18 -0
  9. package/esm2015/domain/catalog/models/product.js +8 -1
  10. package/esm2015/domain/generic/repository/types/repository-find-filters.type.js +1 -1
  11. package/esm2015/infra/firebase/auth/authentication-firebase-auth.service.js +2 -2
  12. package/esm2015/infra/firebase/auth/register-firebase-auth.service.js +1 -1
  13. package/esm2015/infra/hasura-graphql/index.js +3 -2
  14. package/esm2015/infra/hasura-graphql/mixins/helpers/attribute-option.helper.js +2 -3
  15. package/esm2015/infra/hasura-graphql/mixins/helpers/graphql-field.helper.js +8 -10
  16. package/esm2015/infra/hasura-graphql/mixins/with-find-hasura-graphql.mixin.js +3 -3
  17. package/esm2015/infra/hasura-graphql/mixins/with-hasura-graphql.mixin.js +2 -2
  18. package/esm2015/infra/hasura-graphql/mixins/with-update-hasura-graphql.mixin.js +6 -3
  19. package/esm2015/infra/hasura-graphql/models/index.js +2 -1
  20. package/esm2015/infra/hasura-graphql/models/kit-product-hasura-graphql.js +15 -0
  21. package/esm2015/infra/hasura-graphql/models/product-hasura-graphql.js +8 -1
  22. package/esm2015/infra/hasura-graphql/repositories/catalog/product-hasura-graphql.repository.js +109 -68
  23. package/esm2015/infra/hasura-graphql/types/hasura-graphql-fields.type.js +1 -1
  24. package/fesm2015/infrab4a-connect.js +177 -104
  25. package/fesm2015/infrab4a-connect.js.map +1 -1
  26. package/infra/firebase/auth/authentication-firebase-auth.service.d.ts +1 -1
  27. package/infra/firebase/auth/register-firebase-auth.service.d.ts +1 -1
  28. package/infra/hasura-graphql/index.d.ts +2 -1
  29. package/infra/hasura-graphql/mixins/helpers/attribute-option.helper.d.ts +1 -5
  30. package/infra/hasura-graphql/mixins/with-find-hasura-graphql.mixin.d.ts +2 -2
  31. package/infra/hasura-graphql/mixins/with-hasura-graphql.mixin.d.ts +2 -2
  32. package/infra/hasura-graphql/models/index.d.ts +1 -0
  33. package/infra/hasura-graphql/models/kit-product-hasura-graphql.d.ts +6 -0
  34. package/infra/hasura-graphql/models/product-hasura-graphql.d.ts +2 -0
  35. package/infra/hasura-graphql/repositories/catalog/product-hasura-graphql.repository.d.ts +1 -0
  36. package/infra/hasura-graphql/types/hasura-graphql-fields.type.d.ts +8 -14
  37. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import firebase from 'firebase/app';
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/app';
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,3 +1,4 @@
1
1
  export * from './mixins';
2
- export * from './types';
2
+ export * from './models';
3
3
  export * from './repositories';
4
+ export * from './types';
@@ -1,16 +1,12 @@
1
1
  import { ModelBaseStructure, NonFunctionAndIdentifierPropertyNames } from '../../../../domain';
2
- import { ColumnModelOptions, ColumnOptions, HasuraGraphQLFields } from '../../types';
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,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,3 +1,4 @@
1
1
  export * from './category-hasura-graphql';
2
+ export * from './kit-product-hasura-graphql';
2
3
  export * from './product-hasura-graphql';
3
4
  export * from './variant-hasura-graphql';
@@ -0,0 +1,6 @@
1
+ import { KitProduct } from '../../../domain';
2
+ import { ProductHasuraGraphQL } from './product-hasura-graphql';
3
+ export declare class KitProductHasuraGraphQL extends KitProduct {
4
+ kit: ProductHasuraGraphQL;
5
+ product: ProductHasuraGraphQL;
6
+ }
@@ -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 extends ModelBaseStructure, ValueFrom = string | number | boolean | Record<string, any>> = {
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 extends ModelBaseStructure, Type, Properties extends keyof Model = keyof 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 extends ModelBaseStructure> = {
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> = (NonFunctionAndIdentifierPropertyNames<Model> | {
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 ? ColumnModelOptions<PropType<Model, key>, Model> : ColumnOptions<PropType<Model, key>, Model>;
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infrab4a/connect",
3
- "version": "1.0.0-beta.16",
3
+ "version": "1.0.0-beta.18",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org"
6
6
  },