@daffodil/core 0.92.3 → 0.93.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.
@@ -1,9 +1,10 @@
1
1
  import { DocumentNode } from 'graphql';
2
- import { MutationOptions, FetchResult, ApolloLink, ApolloQueryResult, RequestHandler } from '@apollo/client/core';
3
2
  import { Apollo } from 'apollo-angular';
4
3
  import { Observable } from 'rxjs';
5
4
  import * as _angular_core from '@angular/core';
6
5
  import { EnvironmentProviders } from '@angular/core';
6
+ import { ApolloLink } from '@apollo/client';
7
+ import { HttpHeaders } from '@angular/common/http';
7
8
 
8
9
  /**
9
10
  * Builds a string of fragment names that can be interpolated into a GraphQL query.
@@ -42,7 +43,7 @@ declare class DaffQueuedApollo {
42
43
  *
43
44
  * @param options Mutation options.
44
45
  */
45
- mutate<T, V = Record<string, any>>(options: MutationOptions<T, V>): Observable<FetchResult<T>>;
46
+ mutate<T, V = Record<string, any>>(options: Apollo.MutateOptions<T, V>): Observable<Apollo.MutateResult<T>>;
46
47
  private addRequestToQueue;
47
48
  private finishRequestSubscription;
48
49
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<DaffQueuedApollo, never>;
@@ -53,28 +54,33 @@ interface DaffApolloLinkGenerator {
53
54
  getLink(): ApolloLink;
54
55
  }
55
56
 
57
+ type ValidatedResponse<T, Shape> = {
58
+ [K in keyof T]: K extends keyof Shape ? Shape[K] extends true ? NonNullable<T[K]> : ValidatedResponse<NonNullable<T[K]>, Shape[K]> : T[K];
59
+ };
56
60
  /**
57
61
  * A validator for a GraphQL Apollo response.
58
62
  * Throws errors to indicate that the response is not valid.
59
63
  * Returns the response and throws no errors to indicate that the response
60
64
  * is valid as far as this particular validator is concerned.
61
65
  */
62
- type GraphQlApolloValidator<T> = (response: ApolloQueryResult<T>) => ApolloQueryResult<T>;
66
+ type GraphQlApolloValidator<T, Shape> = (response: Apollo.QueryResult<T>) => ValidatedResponse<Apollo.QueryResult<T>, Shape>;
63
67
 
64
68
  /**
65
- * A function that returns a dict of headers to set on the Apollo GraphQL request.
69
+ * A function that returns headers to set on the Apollo GraphQL request.
66
70
  * This function is run in an injection context.
67
71
  */
68
- type DaffApolloHeaderProvider = () => Record<string, string>;
72
+ type DaffApolloHeaderProvider = () => HttpHeaders;
69
73
 
70
74
  /**
71
75
  * Provider function for {@link DaffApolloHeaderProvider}s.
72
76
  */
73
77
  declare const provideDaffApolloHeaderProviders: (...providers: Array<DaffApolloHeaderProvider>) => EnvironmentProviders;
74
78
 
75
- declare const DAFF_APOLLO_REQUEST_HANDLERS: _angular_core.InjectionToken<RequestHandler[]>;
76
- declare const provideDaffApolloRequestHandlers: <R extends RequestHandler = RequestHandler>(...values: R[]) => Array<_angular_core.ValueProvider>;
77
- declare const provideDaffApolloRequestHandlerFactories: <R extends RequestHandler = RequestHandler>(...factories: (() => R)[]) => Array<_angular_core.FactoryProvider>;
79
+ declare function getApolloOperationHeaders(operation: ApolloLink.Operation): HttpHeaders;
78
80
 
79
- export { DAFF_APOLLO_REQUEST_HANDLERS, DaffQueuedApollo, daffBuildFragmentDefinition, daffBuildFragmentNameSpread, provideDaffApolloHeaderProviders, provideDaffApolloRequestHandlerFactories, provideDaffApolloRequestHandlers };
80
- export type { DaffApolloHeaderProvider, DaffApolloLinkGenerator, GraphQlApolloValidator };
81
+ declare const DAFF_APOLLO_REQUEST_HANDLERS: _angular_core.InjectionToken<ApolloLink.RequestHandler[]>;
82
+ declare const provideDaffApolloRequestHandlers: <R extends ApolloLink.RequestHandler = ApolloLink.RequestHandler>(...values: R[]) => Array<_angular_core.ValueProvider>;
83
+ declare const provideDaffApolloRequestHandlerFactories: <R extends ApolloLink.RequestHandler = ApolloLink.RequestHandler>(...factories: (() => R)[]) => Array<_angular_core.FactoryProvider>;
84
+
85
+ export { DAFF_APOLLO_REQUEST_HANDLERS, DaffQueuedApollo, daffBuildFragmentDefinition, daffBuildFragmentNameSpread, getApolloOperationHeaders, provideDaffApolloHeaderProviders, provideDaffApolloRequestHandlerFactories, provideDaffApolloRequestHandlers };
86
+ export type { DaffApolloHeaderProvider, DaffApolloLinkGenerator, GraphQlApolloValidator, ValidatedResponse };
@@ -1,9 +1,9 @@
1
1
  import { Action, MemoizedSelector, Store, Selector, ActionReducer } from '@ngrx/store';
2
- import { DaffCollectionMetadata, DaffFilterRequest, DaffFilterToggleRequest, DaffCollectionRequest, DaffFilters, DaffSortOption, DaffSortDirectionEnum, DaffError, DaffIdentifiable } from '@daffodil/core';
2
+ import { DaffFilterRequest, DaffCollectionMetadata, DaffFilterToggleRequest, DaffCollectionRequest, DaffFilters, DaffSortOption, DaffSortDirectionEnum, DaffError, DaffIdentifiable } from '@daffodil/core';
3
3
  import * as rxjs from 'rxjs';
4
4
  import { Observable } from 'rxjs';
5
+ import * as _ngrx_entity from '@ngrx/entity';
5
6
  import { EntityAdapter, EntityState } from '@ngrx/entity';
6
- import * as node_modules__ngrx_entity_src_models from 'node_modules/@ngrx/entity/src/models';
7
7
 
8
8
  /**
9
9
  * An error object that can be serialized in state.
@@ -492,7 +492,7 @@ type DaffOperationEntity<T extends DaffIdentifiable = DaffIdentifiable> = DaffSt
492
492
  daffTemp: boolean;
493
493
  };
494
494
 
495
- declare const giveMeType: <T, V>(adapter: EntityAdapter<T>) => node_modules__ngrx_entity_src_models.MemoizedEntitySelectors<T, V>;
495
+ declare const giveMeType: <T, V>(adapter: EntityAdapter<T>) => _ngrx_entity.MemoizedEntitySelectors<T, V>;
496
496
  type EntitySelectors<T, V> = ReturnType<typeof giveMeType<T, V>>;
497
497
  /**
498
498
  * Selectors for an operation state.
File without changes