@shopify/react-graphql
Advanced tools
Comparing version 5.2.0-beta.3 to 5.2.0-beta.4
@@ -5,6 +5,7 @@ export { DeferTiming } from '@shopify/async'; | ||
export { createAsyncQueryComponent } from './async'; | ||
export { AsyncQueryComponentType, GraphQLData, GraphQLVariables, GraphQLDeepPartial, QueryProps, } from './types'; | ||
export { AsyncQueryComponentType, GraphQLData, GraphQLVariables, GraphQLDeepPartial, QueryProps, GraphQLOperationDetails, } from './types'; | ||
export { ApolloProvider } from './ApolloProvider'; | ||
export { GraphQLOperationsContext } from './graphql-operations-context'; | ||
export * from './hooks'; | ||
export * from './links'; | ||
export * from './utilities'; |
@@ -14,4 +14,6 @@ "use strict"; | ||
exports.ApolloProvider = ApolloProvider_1.ApolloProvider; | ||
var graphql_operations_context_1 = require("./graphql-operations-context"); | ||
exports.GraphQLOperationsContext = graphql_operations_context_1.GraphQLOperationsContext; | ||
tslib_1.__exportStar(require("./hooks"), exports); | ||
tslib_1.__exportStar(require("./links"), exports); | ||
tslib_1.__exportStar(require("./utilities"), exports); |
import { ApolloLink } from 'apollo-link'; | ||
export interface GraphQLOperation { | ||
name: string; | ||
duration: number; | ||
start: number; | ||
end: number; | ||
success: boolean; | ||
errors?: { | ||
message: string; | ||
path?: string; | ||
}[]; | ||
url?: string; | ||
status?: number; | ||
requestId?: string; | ||
} | ||
import { GraphQLOperationDetails } from '../types'; | ||
export interface Options { | ||
requestIdHeader?: string; | ||
onOperation(operation: GraphQLOperation): void; | ||
onOperation(operation: GraphQLOperationDetails): void; | ||
} | ||
export declare function createOperationDetailsLink({ onOperation, requestIdHeader, }: Options): ApolloLink; | ||
export declare function createOperationDetailsLink({ onOperation }: Options): ApolloLink; |
@@ -5,4 +5,5 @@ "use strict"; | ||
var performance_1 = require("@shopify/performance"); | ||
var network_1 = require("@shopify/network"); | ||
function createOperationDetailsLink(_a) { | ||
var onOperation = _a.onOperation, requestIdHeader = _a.requestIdHeader; | ||
var onOperation = _a.onOperation; | ||
return new apollo_link_1.ApolloLink(function (operation, forward) { | ||
@@ -28,4 +29,3 @@ if (forward == null) { | ||
var requestId = response instanceof Response | ||
? (requestIdHeader && response.headers.get(requestIdHeader)) || | ||
undefined | ||
? response.headers.get(network_1.Header.RequestId) || undefined | ||
: undefined; | ||
@@ -32,0 +32,0 @@ var status = response instanceof Response ? response.status : undefined; |
@@ -33,1 +33,15 @@ import React from 'react'; | ||
} | ||
export interface GraphQLOperationDetails { | ||
name: string; | ||
duration: number; | ||
start: number; | ||
end: number; | ||
success: boolean; | ||
errors?: { | ||
message: string; | ||
path?: string; | ||
}[]; | ||
url?: string; | ||
status?: number; | ||
requestId?: string; | ||
} |
@@ -1,15 +0,2 @@ | ||
export interface GraphQLOperationDetails { | ||
name: string; | ||
duration: number; | ||
start: number; | ||
end: number; | ||
success: boolean; | ||
errors?: { | ||
message: string; | ||
path?: string; | ||
}[]; | ||
url?: string; | ||
status?: number; | ||
requestId?: string; | ||
} | ||
import { GraphQLOperationDetails } from '../types'; | ||
export declare function totalGraphQLTime(operations: GraphQLOperationDetails[]): number; |
{ | ||
"name": "@shopify/react-graphql", | ||
"version": "5.2.0-beta.3", | ||
"version": "5.2.0-beta.4", | ||
"license": "MIT", | ||
@@ -31,3 +31,2 @@ "description": "Tools for creating type-safe and asynchronous GraphQL components for React.", | ||
"@shopify/react-hooks": "^1.2.3", | ||
"@shopify/react-network": "^3.2.2", | ||
"@shopify/useful-types": "^2.0.1", | ||
@@ -34,0 +33,0 @@ "apollo-cache-inmemory": "^1.6.2", |
@@ -130,3 +130,3 @@ # `@shopify/react-graphql` | ||
Using Apollo Hooks assume the usage of [`react-apollo`](https://github.com/apollographql/react-apollo)) | ||
Using Apollo Hooks assume the usage of [`react-apollo`](https://github.com/apollographql/react-apollo) | ||
@@ -359,1 +359,22 @@ ### `ApolloProvider` | ||
``` | ||
## `createOperationDetailsLink` Apollo Link | ||
This library also provides a custom Apollo Link, `createOperationDetailsLink`. This link takes in an `onOperation` function callback which called with a GraphQL operation of type `GraphQLOperation`. | ||
```tsx | ||
import import { | ||
createOperationDetailsLink, | ||
GraphQLOperationDetails, | ||
} from '@shopify/react-graphql'; | ||
const link = createOperationDetailsLink({ | ||
onOperation(operation: GraphQLOperationDetails) { | ||
console.log('Look, a GraphQL operation: ', operation); | ||
}, | ||
}); | ||
// create ApolloClient using this link | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
67607
11
61
379
926
- Removed@shopify/react-network@^3.2.2
- Removed@shopify/network@1.6.4(transitive)
- Removed@shopify/react-html@10.2.11(transitive)
- Removed@shopify/react-network@3.6.12(transitive)
- Removed@shopify/react-universal-provider@1.2.12(transitive)
- Removed@types/accept-language-parser@1.5.0(transitive)
- Removed@types/accepts@1.3.7(transitive)
- Removed@types/body-parser@1.19.5(transitive)
- Removed@types/connect@3.4.38(transitive)
- Removed@types/content-disposition@0.5.8(transitive)
- Removed@types/cookie@0.3.3(transitive)
- Removed@types/cookies@0.9.0(transitive)
- Removed@types/express@5.0.0(transitive)
- Removed@types/express-serve-static-core@5.0.2(transitive)
- Removed@types/http-assert@1.5.6(transitive)
- Removed@types/http-errors@2.0.4(transitive)
- Removed@types/keygrip@1.0.6(transitive)
- Removed@types/koa@2.15.0(transitive)
- Removed@types/koa-compose@3.2.8(transitive)
- Removed@types/mime@1.3.5(transitive)
- Removed@types/multistream@2.1.2(transitive)
- Removed@types/qs@6.9.17(transitive)
- Removed@types/range-parser@1.2.7(transitive)
- Removed@types/send@0.17.4(transitive)
- Removed@types/serve-static@1.15.7(transitive)
- Removedaccept-language-parser@1.5.0(transitive)
- Removedaccepts@1.3.8(transitive)
- Removedcache-content-type@1.0.1(transitive)
- Removedco@4.6.0(transitive)
- Removedcontent-disposition@0.5.4(transitive)
- Removedcontent-type@1.0.5(transitive)
- Removedcookie@0.4.2(transitive)
- Removedcookies@0.9.1(transitive)
- Removedcore-util-is@1.0.3(transitive)
- Removeddebug@4.4.0(transitive)
- Removeddeep-equal@1.0.1(transitive)
- Removeddelegates@1.0.0(transitive)
- Removeddepd@1.1.22.0.0(transitive)
- Removeddestroy@1.2.0(transitive)
- Removedee-first@1.1.1(transitive)
- Removedencodeurl@1.0.2(transitive)
- Removedescape-html@1.0.3(transitive)
- Removedfresh@0.5.2(transitive)
- Removedhas-symbols@1.1.0(transitive)
- Removedhas-tostringtag@1.0.2(transitive)
- Removedhttp-assert@1.5.0(transitive)
- Removedhttp-errors@1.8.1(transitive)
- Removedinherits@2.0.4(transitive)
- Removedis-generator-function@1.0.10(transitive)
- Removedisarray@1.0.0(transitive)
- Removedkeygrip@1.1.0(transitive)
- Removedkoa@2.15.3(transitive)
- Removedkoa-compose@4.2.0(transitive)
- Removedkoa-convert@2.0.0(transitive)
- Removedmedia-typer@0.3.0(transitive)
- Removedmime-db@1.52.0(transitive)
- Removedmime-types@2.1.35(transitive)
- Removedms@2.1.3(transitive)
- Removedmultistream@2.1.1(transitive)
- Removednegotiator@0.6.3(transitive)
- Removedon-finished@2.4.1(transitive)
- Removedonly@0.0.2(transitive)
- Removedparseurl@1.3.3(transitive)
- Removedprocess-nextick-args@2.0.1(transitive)
- Removedrandombytes@2.1.0(transitive)
- Removedreadable-stream@2.3.8(transitive)
- Removedsafe-buffer@5.1.25.2.1(transitive)
- Removedserialize-javascript@3.1.0(transitive)
- Removedsetprototypeof@1.2.0(transitive)
- Removedstatuses@1.5.0(transitive)
- Removedstring_decoder@1.1.1(transitive)
- Removedtoidentifier@1.0.1(transitive)
- Removedtsscmp@1.0.6(transitive)
- Removedtype-is@1.6.18(transitive)
- Removedutil-deprecate@1.0.2(transitive)
- Removedvary@1.1.2(transitive)
- Removedylru@1.4.0(transitive)