Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
node_modules
build
*.tsbuildinfo
lib
Binary file added bun.lockb
Binary file not shown.
15 changes: 15 additions & 0 deletions lib/GraphQLAdapter.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { BaseDatabase, BaseResource } from "adminjs";
import { GraphQLConnection } from "./index.js";
import { GraphQLResourceAdapter } from "./GraphQLResource.js";
declare class GraphQLDatabaseAdapter extends BaseDatabase {
readonly connection: GraphQLConnection;
constructor(connection: GraphQLConnection);
resources(): Array<BaseResource>;
static isAdapterFor(connection: GraphQLConnection): boolean;
}
export declare const GraphQLAdapter: {
Database: typeof GraphQLDatabaseAdapter;
Resource: typeof GraphQLResourceAdapter;
};
export {};
//# sourceMappingURL=GraphQLAdapter.d.ts.map
1 change: 1 addition & 0 deletions lib/GraphQLAdapter.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions lib/GraphQLAdapter.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lib/GraphQLAdapter.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions lib/GraphQLClient.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/// <reference types="node" resolution-mode="require"/>
import { GraphQLFormattedError } from "graphql";
import { AgentOptions } from "http";
/**
* A minimal GraphQL client.
*/
export declare class GraphQLClient {
private readonly axios;
constructor(endpoint: string, agentOptions?: AgentOptions);
request<T = Record<string, unknown>>(query: string, variables?: Record<string, unknown>, headers?: Record<string, string>): Promise<GraphQLClientResponse<T>>;
}
export interface GraphQLClientResponse<T> {
data: T;
errors: GraphQLFormattedError[];
}
//# sourceMappingURL=GraphQLClient.d.ts.map
1 change: 1 addition & 0 deletions lib/GraphQLClient.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions lib/GraphQLClient.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lib/GraphQLClient.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 42 additions & 0 deletions lib/GraphQLConnection.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/// <reference types="node" resolution-mode="require"/>
import { AgentOptions } from "http";
import { GraphQLFormattedError } from "graphql";
import { GraphQLClient } from "./GraphQLClient.js";
import { GraphQLResource } from "./GraphQLResource.js";
/**
* Options for the GraphQL connection.
* Use `headers` to set api key, et.c.
*/
export interface ConnectionOptions {
name?: string;
url?: string;
headers?: () => Record<string, string>;
agentOptions?: AgentOptions;
}
/**
* GraphQLConnection connects to a GraphQL API, and initializes a list of
* configured resources with data from the remote API schema, so that they
* can be used as AdminBro resources.
*/
export declare class GraphQLConnection {
readonly resources: GraphQLResource[];
private readonly onError?;
readonly tag = "GraphQLConnection";
readonly client: GraphQLClient;
readonly name: string;
private readonly headers?;
constructor(resources: GraphQLResource[], options?: ConnectionOptions, onError?: ((error: Error, originalErrors?: GraphQLFormattedError[]) => void) | undefined);
get r(): GraphQLResourceMap;
init(): Promise<void>;
private fetchSchema;
private static graphQLTypeToPropertyType;
private inflateResources;
private formatGraphQLErrors;
request<T = Record<string, unknown>>(document: string, variables?: Record<string, unknown>): Promise<T>;
reportAndThrow(error: Error, originalErrors?: GraphQLFormattedError[]): never;
}
interface GraphQLResourceMap {
[key: string]: GraphQLResource;
}
export {};
//# sourceMappingURL=GraphQLConnection.d.ts.map
1 change: 1 addition & 0 deletions lib/GraphQLConnection.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading