@apollo/explorer
Advanced tools
Comparing version 3.1.1 to 3.2.0
{ | ||
"name": "@apollo/explorer", | ||
"version": "3.1.1", | ||
"version": "3.2.0", | ||
"author": "packages@apollographql.com", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -81,4 +81,4 @@ # Apollo Studio Embeddable Explorer | ||
- [Embedding a registered public graph](./src/embeddableExplorer/examples/graphRef.html) | ||
- [Usage by directly passing in schema](./src/embeddableExplorer/examples/manualSchema.html) | ||
- [Embedding a registered public graph](./src/examples/graphRef.html) | ||
- [Usage by directly passing in schema](./src/examples/manualSchema.html) | ||
@@ -85,0 +85,0 @@ ## Developing embedded Explorer |
import type { IntrospectionQuery } from 'graphql'; | ||
import { HandleRequest } from './helpers/postMessageRelayHelpers'; | ||
import type { JSONObject } from './helpers/types'; | ||
declare type InitialState = { | ||
type InitialState = { | ||
displayOptions?: { | ||
@@ -61,4 +61,4 @@ docsPanelState?: 'open' | 'closed'; | ||
} | ||
export declare type EmbeddableExplorerOptions = EmbeddableExplorerOptionsWithSchema | EmbeddableExplorerOptionsWithGraphRef; | ||
declare type InternalEmbeddableExplorerOptions = EmbeddableExplorerOptions & { | ||
export type EmbeddableExplorerOptions = EmbeddableExplorerOptionsWithSchema | EmbeddableExplorerOptionsWithGraphRef; | ||
type InternalEmbeddableExplorerOptions = EmbeddableExplorerOptions & { | ||
__testLocal__?: boolean; | ||
@@ -65,0 +65,0 @@ runtime?: string; |
@@ -21,2 +21,3 @@ export declare const EMBEDDABLE_EXPLORER_URL: (__testLocal__?: boolean) => "https://embed.apollo.local:3000" | "https://explorer.embed.apollographql.com"; | ||
export declare const PARTIAL_AUTHENTICATION_TOKEN_RESPONSE = "PartialAuthenticationTokenResponse"; | ||
export declare const INTROSPECTION_QUERY_WITH_HEADERS = "IntrospectionQueryWithHeaders"; | ||
export declare const PARENT_LOGOUT_SUCCESS = "ParentLogoutSuccess"; |
import type { ExecutionResult, GraphQLError, IntrospectionQuery } from 'graphql'; | ||
import { PARTIAL_AUTHENTICATION_TOKEN_RESPONSE, EXPLORER_QUERY_MUTATION_RESPONSE, HANDSHAKE_RESPONSE, SCHEMA_RESPONSE, SET_PARTIAL_AUTHENTICATION_TOKEN_FOR_PARENT, EXPLORER_LISTENING_FOR_PARTIAL_TOKEN, PARENT_LOGOUT_SUCCESS, TRIGGER_LOGOUT_IN_PARENT, EXPLORER_SUBSCRIPTION_RESPONSE, EXPLORER_SET_SOCKET_ERROR, EXPLORER_SET_SOCKET_STATUS, TRACE_KEY, EXPLORER_LISTENING_FOR_HANDSHAKE, EXPLORER_QUERY_MUTATION_REQUEST, EXPLORER_SUBSCRIPTION_REQUEST, EXPLORER_SUBSCRIPTION_TERMINATION, EXPLORER_LISTENING_FOR_SCHEMA } from './constants'; | ||
import type { JSONValue } from './types'; | ||
import type { JSONObject, JSONValue } from './types'; | ||
import type { ObjMap } from 'graphql/jsutils/ObjMap'; | ||
import type { GraphQLSubscriptionLibrary } from './subscriptionPostMessageRelayHelpers'; | ||
export declare type HandleRequest = (endpointUrl: string, options: Omit<RequestInit, 'headers'> & { | ||
import type { GraphQLSubscriptionLibrary, HTTPMultipartClient } from './subscriptionPostMessageRelayHelpers'; | ||
export type HandleRequest = (endpointUrl: string, options: Omit<RequestInit, 'headers'> & { | ||
headers: Record<string, string>; | ||
}) => Promise<Response>; | ||
export type SocketStatus = 'disconnected' | 'connecting' | 'connected'; | ||
export declare function sendPostMessageToEmbed({ message, embeddedIFrameElement, embedUrl, }: { | ||
@@ -14,11 +15,10 @@ message: OutgoingEmbedMessage; | ||
}): void; | ||
export declare type ResponseError = { | ||
export type ResponseError = { | ||
message: string; | ||
stack?: string; | ||
}; | ||
export declare type SocketStatus = 'disconnected' | 'connecting' | 'connected'; | ||
interface ResponseData { | ||
export interface ResponseData { | ||
data?: Record<string, unknown> | JSONValue | ObjMap<unknown>; | ||
path?: Array<string | number>; | ||
errors?: Array<GraphQLError>; | ||
errors?: readonly GraphQLError[]; | ||
extensions?: { | ||
@@ -28,16 +28,37 @@ [TRACE_KEY]?: string; | ||
} | ||
declare type ExplorerResponse = ResponseData & { | ||
type ExplorerResponse = ResponseData & { | ||
incremental?: Array<ResponseData & { | ||
path: NonNullable<ResponseData['path']>; | ||
}>; | ||
error?: { | ||
message: string; | ||
stack?: string; | ||
}; | ||
error?: ResponseError; | ||
status?: number; | ||
headers?: Record<string, string> | [Record<string, string>, ...Record<string, string>[]]; | ||
headers?: Record<string, string> | Record<string, string>[]; | ||
hasNext?: boolean; | ||
size?: number; | ||
}; | ||
export declare type OutgoingEmbedMessage = { | ||
export interface MultipartSubscriptionResponse { | ||
data: { | ||
errors?: Array<GraphQLError>; | ||
payload: (ResponseData & { | ||
error?: { | ||
message: string; | ||
stack?: string; | ||
}; | ||
}) | null; | ||
}; | ||
headers?: Record<string, string> | Record<string, string>[]; | ||
size: number; | ||
status?: number; | ||
} | ||
export type ExplorerSubscriptionResponse = { | ||
data?: ExecutionResult<JSONObject>; | ||
error?: Error; | ||
errors?: GraphQLError[]; | ||
} | MultipartSubscriptionResponse | { | ||
data: null; | ||
error?: ResponseError; | ||
status?: number; | ||
headers?: Record<string, string> | Record<string, string>[]; | ||
}; | ||
export type OutgoingEmbedMessage = { | ||
name: typeof SCHEMA_RESPONSE; | ||
@@ -61,7 +82,3 @@ schema: IntrospectionQuery | string | undefined; | ||
operationId: string; | ||
response: { | ||
data?: ExecutionResult<JSONValue | ObjMap<unknown>>; | ||
error?: Error; | ||
errors?: [Error]; | ||
}; | ||
response: ExplorerSubscriptionResponse; | ||
} | { | ||
@@ -76,3 +93,3 @@ name: typeof EXPLORER_SET_SOCKET_ERROR; | ||
}; | ||
export declare type IncomingEmbedMessage = MessageEvent<{ | ||
export type IncomingEmbedMessage = MessageEvent<{ | ||
name: typeof EXPLORER_LISTENING_FOR_HANDSHAKE; | ||
@@ -87,3 +104,3 @@ }> | MessageEvent<{ | ||
includeCookies?: boolean; | ||
endpointUrl?: string; | ||
endpointUrl: string; | ||
}> | MessageEvent<{ | ||
@@ -98,2 +115,5 @@ name: typeof EXPLORER_SUBSCRIPTION_REQUEST; | ||
protocol: GraphQLSubscriptionLibrary; | ||
httpMultipartParams: { | ||
includeCookies: boolean | undefined; | ||
}; | ||
}> | MessageEvent<{ | ||
@@ -115,3 +135,3 @@ name: typeof EXPLORER_SUBSCRIPTION_TERMINATION; | ||
}>; | ||
export declare function executeOperation({ endpointUrl, handleRequest, operation, operationName, variables, headers, includeCookies, embeddedIFrameElement, operationId, embedUrl, }: { | ||
export declare function executeOperation({ endpointUrl, handleRequest, operation, operationName, variables, headers, includeCookies, embeddedIFrameElement, operationId, embedUrl, isMultipartSubscription, multipartSubscriptionClient, }: { | ||
endpointUrl: string; | ||
@@ -127,2 +147,4 @@ handleRequest: HandleRequest; | ||
embedUrl: string; | ||
isMultipartSubscription: boolean; | ||
multipartSubscriptionClient?: HTTPMultipartClient; | ||
}): Promise<void>; | ||
@@ -129,0 +151,0 @@ export declare const handleAuthenticationPostMessage: ({ event, embeddedIFrameElement, embedUrl, }: { |
/// <reference types="zen-observable" /> | ||
import { Observable } from 'zen-observable-ts'; | ||
import type { GraphQLError } from 'graphql'; | ||
import type { JSONValue } from './types'; | ||
import type { TRACE_KEY } from './constants'; | ||
import type MIMEType from 'whatwg-mimetype'; | ||
interface ResponseData { | ||
data: Record<string, unknown> | JSONValue | undefined; | ||
path?: Array<string | number>; | ||
errors?: Array<GraphQLError>; | ||
extensions?: { | ||
[TRACE_KEY]?: string; | ||
}; | ||
} | ||
import type { ResponseData } from './postMessageRelayHelpers'; | ||
export interface MultipartResponse { | ||
@@ -26,6 +17,22 @@ data: ResponseData & { | ||
}; | ||
headers?: Record<string, string>; | ||
headers?: Record<string, string> | Record<string, string>[]; | ||
size: number; | ||
} | ||
export declare function readMultipartWebStream(response: Response, mimeType: MIMEType): Observable<MultipartResponse>; | ||
export {}; | ||
export interface MultipartSubscriptionResponse { | ||
data: { | ||
errors?: Array<GraphQLError>; | ||
payload: (ResponseData & { | ||
error?: { | ||
message: string; | ||
stack?: string; | ||
}; | ||
}) | null; | ||
}; | ||
headers?: Record<string, string> | Record<string, string>[]; | ||
size: number; | ||
shouldTerminate?: boolean; | ||
} | ||
export declare function readMultipartWebStream(response: Response, mimeType: MIMEType): { | ||
closeReadableStream: () => Promise<void>; | ||
observable: Observable<MultipartResponse | MultipartSubscriptionResponse>; | ||
}; |
@@ -1,3 +0,11 @@ | ||
import type { JSONObject } from './types'; | ||
export declare type GraphQLSubscriptionLibrary = 'subscriptions-transport-ws' | 'graphql-ws'; | ||
import EventEmitter from 'eventemitter3'; | ||
import { HandleRequest } from './postMessageRelayHelpers'; | ||
export type GraphQLSubscriptionLibrary = 'subscriptions-transport-ws' | 'graphql-ws' | 'http-multipart'; | ||
type HTTPMultipartParams = { | ||
includeCookies?: boolean; | ||
handleRequest: HandleRequest; | ||
}; | ||
export type HTTPMultipartClient = EventEmitter<'connected' | 'error' | 'disconnected'> & { | ||
stopListeningCallback: (() => void) | undefined; | ||
}; | ||
export declare function setParentSocketError({ error, embeddedIFrameElement, embedUrl, }: { | ||
@@ -8,3 +16,3 @@ error: Error | undefined; | ||
}): void; | ||
export declare function executeSubscription({ operation, operationName, variables, headers, embeddedIFrameElement, operationId, embedUrl, subscriptionUrl, protocol, }: { | ||
export declare function executeSubscription({ operation, operationName, variables, headers, embeddedIFrameElement, operationId, embedUrl, subscriptionUrl, protocol, httpMultipartParams, }: { | ||
operation: string; | ||
@@ -14,3 +22,3 @@ operationId: string; | ||
operationName: string | undefined; | ||
variables?: JSONObject; | ||
variables?: Record<string, string>; | ||
headers?: Record<string, string>; | ||
@@ -20,2 +28,6 @@ embedUrl: string; | ||
protocol: GraphQLSubscriptionLibrary; | ||
}): void; | ||
httpMultipartParams: HTTPMultipartParams; | ||
}): { | ||
dispose: () => void; | ||
}; | ||
export {}; |
@@ -1,5 +0,5 @@ | ||
export declare type JSONPrimitive = boolean | null | string | number; | ||
export declare type JSONObject = { | ||
export type JSONPrimitive = boolean | null | string | number; | ||
export type JSONObject = { | ||
[key in string]?: JSONValue; | ||
}; | ||
export declare type JSONValue = JSONPrimitive | JSONValue[] | JSONObject; | ||
export type JSONValue = JSONPrimitive | JSONValue[] | JSONObject; |
@@ -14,3 +14,3 @@ /// <reference types="react" /> | ||
} | ||
export declare type EmbeddableExplorerOptions = EmbeddableExplorerOptionsWithSchema | EmbeddableExplorerOptionsWithGraphRef; | ||
export type EmbeddableExplorerOptions = EmbeddableExplorerOptionsWithSchema | EmbeddableExplorerOptionsWithGraphRef; | ||
export declare function ApolloExplorerReact(props: EmbeddableExplorerOptions & { | ||
@@ -17,0 +17,0 @@ className?: string; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
168682
3910