Skip to content

Commit

Permalink
update API config types
Browse files Browse the repository at this point in the history
  • Loading branch information
david-mcafee committed Sep 7, 2023
1 parent 9801391 commit 6cc2b99
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 17 deletions.
18 changes: 9 additions & 9 deletions packages/core/src/singleton/API/types.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
// TODO V6 - Ivan will own this
// TODO V6
/**
* exports file
* auth modes
* headers should be on second param
*/

// import { DocumentNode } from 'graphql';
// TODO: update as this no longer exists:
// import { GRAPHQL_AUTH_MODE } from '@aws-amplify/auth';

// See packages/api-graphql/src/types/index.ts
export type LibraryAPIGraphQLOptions = {
// custom headers, dynamic, etc.
export type LibraryAPIOptions = {
AppSync: {
// query: string | DocumentNode;
query: string;
Expand All @@ -19,13 +25,7 @@ export type LibraryAPIGraphQLOptions = {
*/
userAgentSuffix?: string; // TODO: remove in v6
};
};

// TODO: simple config:
export type APIGraphQLConfig = {
apiKey?: string;
region?: string;
authMode?: string;
customHeaders: Function; //
};

export type APIConfig = {
Expand Down
12 changes: 4 additions & 8 deletions packages/core/src/singleton/types.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

import {
APIConfig,
APIGraphQLConfig,
LibraryAPIGraphQLOptions,
} from './API/types';
import { APIConfig, LibraryAPIOptions } from './API/types';
import { AnalyticsConfig } from './Analytics/types';
import {
AuthConfig,
Expand All @@ -22,7 +18,6 @@ import {
StorageConfig,
} from './Storage/types';

// TODO V6: API types??
export type ResourcesConfig = {
API?: APIConfig;
Analytics?: AnalyticsConfig;
Expand All @@ -37,14 +32,15 @@ export type ResourcesConfig = {
ssr?: boolean;
};

// Dynamic config
export type LibraryOptions = {
APIGraphQL?: LibraryAPIGraphQLOptions;
API?: LibraryAPIOptions;
Auth?: LibraryAuthOptions;
Storage?: LibraryStorageOptions;
};

export {
APIGraphQLConfig,
APIConfig,
AuthConfig,
AuthUserPoolConfig,
AuthIdentityPoolConfig,
Expand Down

0 comments on commit 6cc2b99

Please sign in to comment.