Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@aws-amplify/api-graphql

Package Overview
Dependencies
Maintainers
9
Versions
1740
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aws-amplify/api-graphql - npm Package Compare versions

Comparing version 4.6.7-graphql-multi-client.4f8e7a9.0 to 4.6.7-graphql-multi-client.7f6a612.0

2

dist/esm/internals/generateClient.d.ts

@@ -12,2 +12,2 @@ import { V6Client } from '../types';

*/
export declare function generateClient<T extends Record<any, any> = never, WithCustomEndpoint extends boolean = false, WithApiKey extends boolean = false>(params: ClientGenerationParams<WithCustomEndpoint, WithApiKey>): V6Client<T, WithCustomEndpoint, WithApiKey>;
export declare function generateClient<T extends Record<any, any> = never, Options extends ClientGenerationParams = ClientGenerationParams>(params: Options): V6Client<T, Options>;
export { InternalGraphQLAPI, InternalGraphQLAPIClass, } from './InternalGraphQLAPI';
export { graphql, cancel, isCancelError } from './v6';
export { generateClient } from './generateClient';
export { CommonPublicClientOptions } from './types';
export { CommonPublicClientOptions, DefaultCommonClientOptions } from './types';

@@ -13,2 +13,2 @@ import { CommonPublicClientOptions, ServerClientGenerationParams, V6ClientSSRCookies, V6ClientSSRRequest } from '../../types';

*/
export declare function generateClientWithAmplifyInstance<T extends Record<any, any> = never, ClientType extends V6ClientSSRRequest<T, any, any> | V6ClientSSRCookies<T, any, any> = V6ClientSSRCookies<T, any, any>>(params: ServerClientGenerationParams & CommonPublicClientOptions<any, any>): ClientType;
export declare function generateClientWithAmplifyInstance<T extends Record<any, any> = never, ClientType extends V6ClientSSRRequest<T> | V6ClientSSRCookies<T> = V6ClientSSRCookies<T>>(params: ServerClientGenerationParams & CommonPublicClientOptions): ClientType;

@@ -9,9 +9,16 @@ import { AmplifyClassV6 } from '@aws-amplify/core';

*/
export type ClientGenerationParams<WithCustomEndpoint extends boolean, WithApiKey extends boolean> = {
export type ClientGenerationParams = {
amplify: AmplifyClassV6;
} & CommonPublicClientOptions<WithCustomEndpoint, WithApiKey>;
} & CommonPublicClientOptions;
export interface DefaultCommonClientOptions {
endpoint?: never;
authMode?: GraphQLAuthMode;
apiKey?: string;
authToken?: string;
headers?: CustomHeaders;
}
/**
* Common options that can be used on public `generateClient()` interfaces.
*/
export type CommonPublicClientOptions<WithCustomEndpoint extends boolean, WithApiKey extends boolean> = WithCustomEndpoint extends true ? WithApiKey extends true ? {
export type CommonPublicClientOptions = DefaultCommonClientOptions | {
endpoint: string;

@@ -24,17 +31,6 @@ authMode: 'apiKey';

endpoint: string;
apiKey: string;
authMode: Exclude<GraphQLAuthMode, 'apiKey'>;
apiKey?: string;
authToken?: string;
headers?: CustomHeaders;
} : {
endpoint: string;
authMode: Exclude<GraphQLAuthMode, 'apiKey'>;
apiKey?: never;
authToken?: string;
headers?: CustomHeaders;
} : {
endpoint?: never;
authMode?: GraphQLAuthMode;
authToken?: string;
headers?: CustomHeaders;
};
import { CustomHeaders } from '@aws-amplify/data-schema/runtime';
import { GraphQLOptionsV6, GraphQLResponseV6, V6Client } from '../types';
import { CommonPublicClientOptions, GraphQLOptionsV6, GraphQLResponseV6, V6Client } from '../types';
/**

@@ -87,3 +87,3 @@ * Invokes graphql operations against a graphql service, providing correct input and

*/
export declare function graphql<FALLBACK_TYPES = unknown, TYPED_GQL_STRING extends string = string>(this: V6Client, options: GraphQLOptionsV6<FALLBACK_TYPES, TYPED_GQL_STRING>, additionalHeaders?: CustomHeaders): GraphQLResponseV6<FALLBACK_TYPES, TYPED_GQL_STRING>;
export declare function graphql<FALLBACK_TYPES = unknown, TYPED_GQL_STRING extends string = string, Options extends CommonPublicClientOptions = object>(this: V6Client, options: GraphQLOptionsV6<FALLBACK_TYPES, TYPED_GQL_STRING, Options>, additionalHeaders?: CustomHeaders): GraphQLResponseV6<FALLBACK_TYPES, TYPED_GQL_STRING>;
/**

@@ -90,0 +90,0 @@ * Cancels an inflight request. Only applicable for graphql queries and mutations

@@ -0,1 +1,2 @@

import { ResourcesConfig } from '@aws-amplify/core';
import { GenerateServerClientParams, V6ClientSSRRequest } from '../types';

@@ -18,2 +19,4 @@ /**

*/
export declare function generateClient<T extends Record<any, any> = never, WithCustomEndpoint extends boolean = false, WithApiKey extends boolean = false>(options: GenerateServerClientParams<WithCustomEndpoint, WithApiKey>): V6ClientSSRRequest<T, WithCustomEndpoint, WithApiKey>;
export declare function generateClient<T extends Record<any, any> = never, Options extends GenerateServerClientParams = {
config: ResourcesConfig;
}>(options: Options): V6ClientSSRRequest<T, Options>;

@@ -168,3 +168,3 @@ import { AmplifyClassV6, ResourcesConfig } from '@aws-amplify/core';

*/
export type GraphQLOptionsV6<FALLBACK_TYPES = unknown, TYPED_GQL_STRING extends string = string, WithCustomEndpoint extends boolean = false, WithApiKey extends boolean = false> = WithCustomEndpoint extends true ? WithApiKey extends true ? {
export type GraphQLOptionsV6<FALLBACK_TYPES = unknown, TYPED_GQL_STRING extends string = string, Options extends CommonPublicClientOptions = object> = Options['endpoint'] extends string ? Options['apiKey'] extends string ? {
query: TYPED_GQL_STRING | DocumentNode;

@@ -328,19 +328,19 @@ variables?: GraphQLVariablesV6<FALLBACK_TYPES, TYPED_GQL_STRING>;

export type ClientWithModels = V6Client | V6ClientSSRRequest | V6ClientSSRCookies;
export type V6Client<T extends Record<any, any> = never, WithCustomEndpoint extends boolean = false, WithApiKey extends boolean = false> = {
graphql: GraphQLMethod<WithCustomEndpoint, WithApiKey>;
export type V6Client<T extends Record<any, any> = never, Options extends CommonPublicClientOptions = object> = {
graphql: GraphQLMethod<Options>;
cancel(promise: Promise<any>, message?: string): boolean;
isCancelError(error: any): boolean;
} & ClientExtensions<T>;
export type V6ClientSSRRequest<T extends Record<any, any> = never, WithCustomEndpoint extends boolean = false, WithApiKey extends boolean = false> = {
graphql: GraphQLMethodSSR<WithCustomEndpoint, WithApiKey>;
export type V6ClientSSRRequest<T extends Record<any, any> = never, Options extends CommonPublicClientOptions = object> = {
graphql: GraphQLMethodSSR<Options>;
cancel(promise: Promise<any>, message?: string): boolean;
isCancelError(error: any): boolean;
} & ClientExtensionsSSRRequest<T>;
export type V6ClientSSRCookies<T extends Record<any, any> = never, WithCustomEndpoint extends boolean = false, WithApiKey extends boolean = false> = {
graphql: GraphQLMethod<WithCustomEndpoint, WithApiKey>;
export type V6ClientSSRCookies<T extends Record<any, any> = never, Options extends CommonPublicClientOptions = object> = {
graphql: GraphQLMethod<Options>;
cancel(promise: Promise<any>, message?: string): boolean;
isCancelError(error: any): boolean;
} & ClientExtensionsSSRCookies<T>;
export type GraphQLMethod<WithCustomEndpoint extends boolean, WithApiKey extends boolean> = <FALLBACK_TYPES = unknown, TYPED_GQL_STRING extends string = string>(options: GraphQLOptionsV6<FALLBACK_TYPES, TYPED_GQL_STRING, WithCustomEndpoint, WithApiKey>, additionalHeaders?: CustomHeaders | undefined) => GraphQLResponseV6<FALLBACK_TYPES, TYPED_GQL_STRING>;
export type GraphQLMethodSSR<WithCustomEndpoint extends boolean, WithApiKey extends boolean> = <FALLBACK_TYPES = unknown, TYPED_GQL_STRING extends string = string>(contextSpec: AmplifyServer.ContextSpec, options: GraphQLOptionsV6<FALLBACK_TYPES, TYPED_GQL_STRING, WithCustomEndpoint, WithApiKey>, additionalHeaders?: CustomHeaders | undefined) => GraphQLResponseV6<FALLBACK_TYPES, TYPED_GQL_STRING>;
export type GraphQLMethod<Options extends CommonPublicClientOptions> = <FALLBACK_TYPES = unknown, TYPED_GQL_STRING extends string = string>(options: GraphQLOptionsV6<FALLBACK_TYPES, TYPED_GQL_STRING, Options>, additionalHeaders?: CustomHeaders | undefined) => GraphQLResponseV6<FALLBACK_TYPES, TYPED_GQL_STRING>;
export type GraphQLMethodSSR<Options extends CommonPublicClientOptions> = <FALLBACK_TYPES = unknown, TYPED_GQL_STRING extends string = string>(contextSpec: AmplifyServer.ContextSpec, options: GraphQLOptionsV6<FALLBACK_TYPES, TYPED_GQL_STRING, Options>, additionalHeaders?: CustomHeaders | undefined) => GraphQLResponseV6<FALLBACK_TYPES, TYPED_GQL_STRING>;
/**

@@ -366,4 +366,4 @@ * @private

}
export type GenerateServerClientParams<WithCustomEndpoint extends boolean, WithApiKey extends boolean> = {
export type GenerateServerClientParams = {
config: ResourcesConfig;
} & CommonPublicClientOptions<WithCustomEndpoint, WithApiKey>;
} & CommonPublicClientOptions;
{
"name": "@aws-amplify/api-graphql",
"version": "4.6.7-graphql-multi-client.4f8e7a9.0+4f8e7a9",
"version": "4.6.7-graphql-multi-client.7f6a612.0+7f6a612",
"description": "Api-graphql category of aws-amplify",

@@ -87,4 +87,4 @@ "main": "./dist/cjs/index.js",

"dependencies": {
"@aws-amplify/api-rest": "4.0.64-graphql-multi-client.4f8e7a9.0+4f8e7a9",
"@aws-amplify/core": "6.7.4-graphql-multi-client.4f8e7a9.0+4f8e7a9",
"@aws-amplify/api-rest": "4.0.64-graphql-multi-client.7f6a612.0+7f6a612",
"@aws-amplify/core": "6.7.4-graphql-multi-client.7f6a612.0+7f6a612",
"@aws-amplify/data-schema": "^1.7.0",

@@ -105,3 +105,3 @@ "@aws-sdk/types": "3.387.0",

],
"gitHead": "4f8e7a94a1c2540baa7eda530787b248b0fb237a"
"gitHead": "7f6a612ad5441525bf5f9a2bded0487643d9fe62"
}

@@ -40,7 +40,4 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.

T extends Record<any, any> = never,
WithCustomEndpoint extends boolean = false,
WithApiKey extends boolean = false,
>(
params: ClientGenerationParams<WithCustomEndpoint, WithApiKey>,
): V6Client<T, WithCustomEndpoint, WithApiKey> {
Options extends ClientGenerationParams = ClientGenerationParams,
>(params: Options): V6Client<T, Options> {
const client = {

@@ -47,0 +44,0 @@ [__amplify]: params.amplify,

@@ -10,2 +10,2 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.

export { generateClient } from './generateClient';
export { CommonPublicClientOptions } from './types';
export { CommonPublicClientOptions, DefaultCommonClientOptions } from './types';

@@ -36,6 +36,6 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.

ClientType extends
| V6ClientSSRRequest<T, any, any>
| V6ClientSSRCookies<T, any, any> = V6ClientSSRCookies<T, any, any>,
| V6ClientSSRRequest<T>
| V6ClientSSRCookies<T> = V6ClientSSRCookies<T>,
>(
params: ServerClientGenerationParams & CommonPublicClientOptions<any, any>,
params: ServerClientGenerationParams & CommonPublicClientOptions,
): ClientType {

@@ -42,0 +42,0 @@ const client = {

@@ -12,44 +12,32 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.

*/
export type ClientGenerationParams<
WithCustomEndpoint extends boolean,
WithApiKey extends boolean,
> = {
export type ClientGenerationParams = {
amplify: AmplifyClassV6;
} & CommonPublicClientOptions<WithCustomEndpoint, WithApiKey>;
} & CommonPublicClientOptions;
export interface DefaultCommonClientOptions {
endpoint?: never;
authMode?: GraphQLAuthMode;
apiKey?: string;
authToken?: string;
headers?: CustomHeaders;
}
/**
* Common options that can be used on public `generateClient()` interfaces.
*/
export type CommonPublicClientOptions<
WithCustomEndpoint extends boolean,
WithApiKey extends boolean,
> = WithCustomEndpoint extends true
? WithApiKey extends true
?
| {
endpoint: string;
authMode: 'apiKey';
apiKey: string;
authToken?: string;
headers?: CustomHeaders;
}
| {
endpoint: string;
apiKey: string;
authMode: Exclude<GraphQLAuthMode, 'apiKey'>;
authToken?: string;
headers?: CustomHeaders;
}
: {
endpoint: string;
authMode: Exclude<GraphQLAuthMode, 'apiKey'>;
apiKey?: never;
authToken?: string;
headers?: CustomHeaders;
}
: {
endpoint?: never;
authMode?: GraphQLAuthMode;
export type CommonPublicClientOptions =
| DefaultCommonClientOptions
| {
endpoint: string;
authMode: 'apiKey';
apiKey: string;
authToken?: string;
headers?: CustomHeaders;
};
}
| {
endpoint: string;
authMode: Exclude<GraphQLAuthMode, 'apiKey'>;
apiKey?: string;
authToken?: string;
headers?: CustomHeaders;
};

@@ -7,2 +7,3 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.

import {
CommonPublicClientOptions,
GraphQLOptionsV6,

@@ -101,5 +102,6 @@ GraphQLResponseV6,

TYPED_GQL_STRING extends string = string,
Options extends CommonPublicClientOptions = object,
>(
this: V6Client,
options: GraphQLOptionsV6<FALLBACK_TYPES, TYPED_GQL_STRING>,
options: GraphQLOptionsV6<FALLBACK_TYPES, TYPED_GQL_STRING, Options>,
additionalHeaders?: CustomHeaders,

@@ -159,3 +161,3 @@ ): GraphQLResponseV6<FALLBACK_TYPES, TYPED_GQL_STRING> {

endpoint: clientEndpoint,
},
} as any,
headers,

@@ -162,0 +164,0 @@ );

@@ -8,2 +8,3 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.

} from '@aws-amplify/core/internals/adapter-core';
import { ResourcesConfig } from '@aws-amplify/core';
import { CustomHeaders } from '@aws-amplify/data-schema/runtime';

@@ -39,13 +40,7 @@

T extends Record<any, any> = never,
WithCustomEndpoint extends boolean = false,
WithApiKey extends boolean = false,
>(
options: GenerateServerClientParams<WithCustomEndpoint, WithApiKey>,
): V6ClientSSRRequest<T, WithCustomEndpoint, WithApiKey> {
Options extends GenerateServerClientParams = { config: ResourcesConfig },
>(options: Options): V6ClientSSRRequest<T, Options> {
// passing `null` instance because each (future model) method must retrieve a valid instance
// from server context
const client = generateClientWithAmplifyInstance<
T,
V6ClientSSRRequest<T, any, any>
>({
const client = generateClientWithAmplifyInstance<T, V6ClientSSRRequest<T>>({
amplify: null,

@@ -56,6 +51,3 @@ ...options,

// TODO: improve this and the next type
const prevGraphql = client.graphql as unknown as GraphQLMethod<
WithCustomEndpoint,
WithApiKey
>;
const prevGraphql = client.graphql as unknown as GraphQLMethod<Options>;

@@ -76,8 +68,5 @@ const wrappedGraphql = (

client.graphql = wrappedGraphql as unknown as GraphQLMethodSSR<
WithCustomEndpoint,
WithApiKey
>;
client.graphql = wrappedGraphql as unknown as GraphQLMethodSSR<Options>;
return client;
}

@@ -219,6 +219,5 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.

TYPED_GQL_STRING extends string = string,
WithCustomEndpoint extends boolean = false,
WithApiKey extends boolean = false, // i.e., The client already has apiKey configured.
> = WithCustomEndpoint extends true
? WithApiKey extends true
Options extends CommonPublicClientOptions = object,
> = Options['endpoint'] extends string
? Options['apiKey'] extends string
? {

@@ -451,6 +450,5 @@ query: TYPED_GQL_STRING | DocumentNode;

T extends Record<any, any> = never,
WithCustomEndpoint extends boolean = false,
WithApiKey extends boolean = false,
Options extends CommonPublicClientOptions = object,
> = {
graphql: GraphQLMethod<WithCustomEndpoint, WithApiKey>;
graphql: GraphQLMethod<Options>;
cancel(promise: Promise<any>, message?: string): boolean;

@@ -462,6 +460,5 @@ isCancelError(error: any): boolean;

T extends Record<any, any> = never,
WithCustomEndpoint extends boolean = false,
WithApiKey extends boolean = false,
Options extends CommonPublicClientOptions = object,
> = {
graphql: GraphQLMethodSSR<WithCustomEndpoint, WithApiKey>;
graphql: GraphQLMethodSSR<Options>;
cancel(promise: Promise<any>, message?: string): boolean;

@@ -473,6 +470,5 @@ isCancelError(error: any): boolean;

T extends Record<any, any> = never,
WithCustomEndpoint extends boolean = false,
WithApiKey extends boolean = false,
Options extends CommonPublicClientOptions = object,
> = {
graphql: GraphQLMethod<WithCustomEndpoint, WithApiKey>;
graphql: GraphQLMethod<Options>;
cancel(promise: Promise<any>, message?: string): boolean;

@@ -482,26 +478,16 @@ isCancelError(error: any): boolean;

export type GraphQLMethod<
WithCustomEndpoint extends boolean,
WithApiKey extends boolean,
> = <FALLBACK_TYPES = unknown, TYPED_GQL_STRING extends string = string>(
options: GraphQLOptionsV6<
FALLBACK_TYPES,
TYPED_GQL_STRING,
WithCustomEndpoint,
WithApiKey
>,
export type GraphQLMethod<Options extends CommonPublicClientOptions> = <
FALLBACK_TYPES = unknown,
TYPED_GQL_STRING extends string = string,
>(
options: GraphQLOptionsV6<FALLBACK_TYPES, TYPED_GQL_STRING, Options>,
additionalHeaders?: CustomHeaders | undefined,
) => GraphQLResponseV6<FALLBACK_TYPES, TYPED_GQL_STRING>;
export type GraphQLMethodSSR<
WithCustomEndpoint extends boolean,
WithApiKey extends boolean,
> = <FALLBACK_TYPES = unknown, TYPED_GQL_STRING extends string = string>(
export type GraphQLMethodSSR<Options extends CommonPublicClientOptions> = <
FALLBACK_TYPES = unknown,
TYPED_GQL_STRING extends string = string,
>(
contextSpec: AmplifyServer.ContextSpec,
options: GraphQLOptionsV6<
FALLBACK_TYPES,
TYPED_GQL_STRING,
WithCustomEndpoint,
WithApiKey
>,
options: GraphQLOptionsV6<FALLBACK_TYPES, TYPED_GQL_STRING, Options>,
additionalHeaders?: CustomHeaders | undefined,

@@ -538,7 +524,4 @@ ) => GraphQLResponseV6<FALLBACK_TYPES, TYPED_GQL_STRING>;

export type GenerateServerClientParams<
WithCustomEndpoint extends boolean,
WithApiKey extends boolean,
> = {
export type GenerateServerClientParams = {
config: ResourcesConfig;
} & CommonPublicClientOptions<WithCustomEndpoint, WithApiKey>;
} & CommonPublicClientOptions;
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc