@team-plain/graphql 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,6 @@
1
+ import { PlainSdk } from "./_generated_sdk.js";
2
+ import type { PlainClientOptions } from "./types.js";
3
+ export declare class PlainClient extends PlainSdk {
4
+ constructor(options: PlainClientOptions);
5
+ }
6
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAErD,qBAAa,WAAY,SAAQ,QAAQ;gBAC3B,OAAO,EAAE,kBAAkB;CAOxC"}
package/dist/client.js ADDED
@@ -0,0 +1,12 @@
1
+ import { PlainSdk } from "./_generated_sdk.js";
2
+ import { PlainGraphQLClient } from "./graphql-client.js";
3
+ export class PlainClient extends PlainSdk {
4
+ constructor(options) {
5
+ const graphqlClient = new PlainGraphQLClient({
6
+ apiKey: options.apiKey,
7
+ apiUrl: options.apiUrl,
8
+ });
9
+ super(graphqlClient);
10
+ }
11
+ }
12
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAGzD,MAAM,OAAO,WAAY,SAAQ,QAAQ;IACvC,YAAY,OAA2B;QACrC,MAAM,aAAa,GAAG,IAAI,kBAAkB,CAAC;YAC3C,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,MAAM,EAAE,OAAO,CAAC,MAAM;SACvB,CAAC,CAAC;QACH,KAAK,CAAC,aAAa,CAAC,CAAC;IACvB,CAAC;CACF"}
@@ -0,0 +1,27 @@
1
+ export interface PageInfoData {
2
+ hasNextPage: boolean;
3
+ hasPreviousPage: boolean;
4
+ startCursor?: string | null;
5
+ endCursor?: string | null;
6
+ }
7
+ export interface PlainConnectionConfig<N> {
8
+ nodes: N[];
9
+ pageInfo: PageInfoData;
10
+ totalCount?: number;
11
+ fetch: (cursor: {
12
+ after?: string;
13
+ before?: string;
14
+ }) => Promise<PlainConnection<N>>;
15
+ }
16
+ export declare class PlainConnection<N> {
17
+ readonly nodes: N[];
18
+ readonly pageInfo: PageInfoData;
19
+ readonly totalCount?: number;
20
+ private _fetch;
21
+ constructor(config: PlainConnectionConfig<N>);
22
+ get hasNextPage(): boolean;
23
+ get hasPreviousPage(): boolean;
24
+ fetchNext(): Promise<PlainConnection<N> | undefined>;
25
+ fetchPrevious(): Promise<PlainConnection<N> | undefined>;
26
+ }
27
+ //# sourceMappingURL=connection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../src/connection.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,WAAW,EAAE,OAAO,CAAC;IACrB,eAAe,EAAE,OAAO,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAED,MAAM,WAAW,qBAAqB,CAAC,CAAC;IACtC,KAAK,EAAE,CAAC,EAAE,CAAC;IACX,QAAQ,EAAE,YAAY,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,CAAC,MAAM,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC;CACrF;AAED,qBAAa,eAAe,CAAC,CAAC;IAC5B,SAAgB,KAAK,EAAE,CAAC,EAAE,CAAC;IAC3B,SAAgB,QAAQ,EAAE,YAAY,CAAC;IACvC,SAAgB,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpC,OAAO,CAAC,MAAM,CAA+E;gBAEjF,MAAM,EAAE,qBAAqB,CAAC,CAAC,CAAC;IAY5C,IAAI,WAAW,IAAI,OAAO,CAEzB;IAED,IAAI,eAAe,IAAI,OAAO,CAE7B;IAEK,SAAS,IAAI,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;IAKpD,aAAa,IAAI,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;CAI/D"}
@@ -0,0 +1,34 @@
1
+ export class PlainConnection {
2
+ nodes;
3
+ pageInfo;
4
+ totalCount;
5
+ _fetch;
6
+ constructor(config) {
7
+ this.nodes = config.nodes;
8
+ this.pageInfo = {
9
+ hasNextPage: config.pageInfo.hasNextPage,
10
+ hasPreviousPage: config.pageInfo.hasPreviousPage,
11
+ startCursor: config.pageInfo.startCursor ?? null,
12
+ endCursor: config.pageInfo.endCursor ?? null,
13
+ };
14
+ this.totalCount = config.totalCount;
15
+ this._fetch = config.fetch;
16
+ }
17
+ get hasNextPage() {
18
+ return this.pageInfo.hasNextPage;
19
+ }
20
+ get hasPreviousPage() {
21
+ return this.pageInfo.hasPreviousPage;
22
+ }
23
+ async fetchNext() {
24
+ if (!this.pageInfo.hasNextPage || !this.pageInfo.endCursor)
25
+ return undefined;
26
+ return this._fetch({ after: this.pageInfo.endCursor });
27
+ }
28
+ async fetchPrevious() {
29
+ if (!this.pageInfo.hasPreviousPage || !this.pageInfo.startCursor)
30
+ return undefined;
31
+ return this._fetch({ before: this.pageInfo.startCursor });
32
+ }
33
+ }
34
+ //# sourceMappingURL=connection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connection.js","sourceRoot":"","sources":["../src/connection.ts"],"names":[],"mappings":"AAcA,MAAM,OAAO,eAAe;IACV,KAAK,CAAM;IACX,QAAQ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message: string);
3
+ }
4
+ export declare class AuthenticationError extends PlainError {
5
+ constructor(message: string);
6
+ }
7
+ export declare class ForbiddenError extends PlainError {
8
+ constructor(message: string);
9
+ }
10
+ export declare class NetworkError extends PlainError {
11
+ constructor(message: string);
12
+ }
13
+ export declare class RateLimitError extends PlainError {
14
+ constructor(message: string);
15
+ }
16
+ export declare class InternalError extends PlainError {
17
+ constructor(message: string);
18
+ }
19
+ export interface GraphQLErrorEntry {
20
+ message: string;
21
+ extensions?: {
22
+ code?: string;
23
+ [key: string]: unknown;
24
+ };
25
+ [key: string]: unknown;
26
+ }
27
+ export declare class PlainGraphQLError extends PlainError {
28
+ readonly errors: GraphQLErrorEntry[];
29
+ constructor(errors: GraphQLErrorEntry[]);
30
+ }
31
+ //# sourceMappingURL=error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":"AAAA,qBAAa,UAAW,SAAQ,KAAK;gBACvB,OAAO,EAAE,MAAM;CAI5B;AAED,qBAAa,mBAAoB,SAAQ,UAAU;gBACrC,OAAO,EAAE,MAAM;CAI5B;AAED,qBAAa,cAAe,SAAQ,UAAU;gBAChC,OAAO,EAAE,MAAM;CAI5B;AAED,qBAAa,YAAa,SAAQ,UAAU;gBAC9B,OAAO,EAAE,MAAM;CAI5B;AAED,qBAAa,cAAe,SAAQ,UAAU;gBAChC,OAAO,EAAE,MAAM;CAI5B;AAED,qBAAa,aAAc,SAAQ,UAAU;gBAC/B,OAAO,EAAE,MAAM;CAI5B;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE;QACX,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;KACxB,CAAC;IACF,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,qBAAa,iBAAkB,SAAQ,UAAU;IAC/C,SAAgB,MAAM,EAAE,iBAAiB,EAAE,CAAC;gBAEhC,MAAM,EAAE,iBAAiB,EAAE;CAMxC"}
package/dist/error.js ADDED
@@ -0,0 +1,46 @@
1
+ export class PlainError extends Error {
2
+ constructor(message) {
3
+ super(message);
4
+ this.name = "PlainError";
5
+ }
6
+ }
7
+ export class AuthenticationError extends PlainError {
8
+ constructor(message) {
9
+ super(message);
10
+ this.name = "AuthenticationError";
11
+ }
12
+ }
13
+ export class ForbiddenError extends PlainError {
14
+ constructor(message) {
15
+ super(message);
16
+ this.name = "ForbiddenError";
17
+ }
18
+ }
19
+ export class NetworkError extends PlainError {
20
+ constructor(message) {
21
+ super(message);
22
+ this.name = "NetworkError";
23
+ }
24
+ }
25
+ export class RateLimitError extends PlainError {
26
+ constructor(message) {
27
+ super(message);
28
+ this.name = "RateLimitError";
29
+ }
30
+ }
31
+ export class InternalError extends PlainError {
32
+ constructor(message) {
33
+ super(message);
34
+ this.name = "InternalError";
35
+ }
36
+ }
37
+ export class PlainGraphQLError extends PlainError {
38
+ errors;
39
+ constructor(errors) {
40
+ const message = errors.map((e) => e.message).join("; ");
41
+ super(message);
42
+ this.name = "PlainGraphQLError";
43
+ this.errors = errors;
44
+ }
45
+ }
46
+ //# sourceMappingURL=error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error.js","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,UAAW,SAAQ,KAAK;IACnC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC;IAC3B,CAAC;CACF;AAED,MAAM,OAAO,mBAAoB,SAAQ,UAAU;IACjD,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;IACpC,CAAC;CACF;AAED,MAAM,OAAO,cAAe,SAAQ,UAAU;IAC5C,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;IAC/B,CAAC;CACF;AAED,MAAM,OAAO,YAAa,SAAQ,UAAU;IAC1C,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;IAC7B,CAAC;CACF;AAED,MAAM,OAAO,cAAe,SAAQ,UAAU;IAC5C,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;IAC/B,CAAC;CACF;AAED,MAAM,OAAO,aAAc,SAAQ,UAAU;IAC3C,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;IAC9B,CAAC;CACF;AAWD,MAAM,OAAO,iBAAkB,SAAQ,UAAU;IAC/B,MAAM,CAAsB;IAE5C,YAAY,MAA2B;QACrC,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACxD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;QAChC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;CACF"}
@@ -0,0 +1,24 @@
1
+ import type { TypedDocumentNode } from "@graphql-typed-document-node/core";
2
+ export interface GraphQLResponse<TData> {
3
+ data?: TData;
4
+ errors?: Array<{
5
+ message: string;
6
+ extensions?: {
7
+ code?: string;
8
+ [key: string]: unknown;
9
+ };
10
+ [key: string]: unknown;
11
+ }>;
12
+ }
13
+ export interface PlainGraphQLClientOptions {
14
+ apiKey: string;
15
+ apiUrl?: string;
16
+ }
17
+ export declare class PlainGraphQLClient {
18
+ private apiKey;
19
+ private apiUrl;
20
+ constructor(options: PlainGraphQLClientOptions);
21
+ request<TData, TVariables extends Record<string, unknown>>(document: TypedDocumentNode<TData, TVariables>, variables?: TVariables): Promise<TData>;
22
+ private extractErrorMessage;
23
+ }
24
+ //# sourceMappingURL=graphql-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graphql-client.d.ts","sourceRoot":"","sources":["../src/graphql-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAY3E,MAAM,WAAW,eAAe,CAAC,KAAK;IACpC,IAAI,CAAC,EAAE,KAAK,CAAC;IACb,MAAM,CAAC,EAAE,KAAK,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,UAAU,CAAC,EAAE;YACX,IAAI,CAAC,EAAE,MAAM,CAAC;YACd,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;SACxB,CAAC;QACF,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;KACxB,CAAC,CAAC;CACJ;AAED,MAAM,WAAW,yBAAyB;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,MAAM,CAAS;gBAEX,OAAO,EAAE,yBAAyB;IAKxC,OAAO,CAAC,KAAK,EAAE,UAAU,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7D,QAAQ,EAAE,iBAAiB,CAAC,KAAK,EAAE,UAAU,CAAC,EAC9C,SAAS,CAAC,EAAE,UAAU,GACrB,OAAO,CAAC,KAAK,CAAC;YAsDH,mBAAmB;CAWlC"}
@@ -0,0 +1,61 @@
1
+ import { print } from "graphql";
2
+ import { AuthenticationError, ForbiddenError, NetworkError, PlainError, PlainGraphQLError, RateLimitError, } from "./error.js";
3
+ export class PlainGraphQLClient {
4
+ apiKey;
5
+ apiUrl;
6
+ constructor(options) {
7
+ this.apiKey = options.apiKey;
8
+ this.apiUrl = options.apiUrl ?? "https://core-api.uk.plain.com/graphql/v1";
9
+ }
10
+ async request(document, variables) {
11
+ const body = JSON.stringify({
12
+ query: print(document),
13
+ variables: variables ?? undefined,
14
+ });
15
+ const response = await fetch(this.apiUrl, {
16
+ method: "POST",
17
+ headers: {
18
+ "Content-Type": "application/json",
19
+ Authorization: `Bearer ${this.apiKey}`,
20
+ "User-Agent": `@team-plain/graphql`,
21
+ },
22
+ body,
23
+ });
24
+ if (!response.ok) {
25
+ const errorDetail = await this.extractErrorMessage(response);
26
+ if (response.status === 401) {
27
+ throw new AuthenticationError(errorDetail ? `Authentication error: ${errorDetail}` : "Authentication error");
28
+ }
29
+ if (response.status === 403) {
30
+ throw new ForbiddenError(errorDetail ? `Insufficient permissions: ${errorDetail}` : "Insufficient permissions");
31
+ }
32
+ if (response.status === 429) {
33
+ throw new RateLimitError(errorDetail ? `Rate limit exceeded: ${errorDetail}` : "Rate limit exceeded");
34
+ }
35
+ throw new NetworkError(errorDetail
36
+ ? `HTTP ${response.status}: ${response.statusText}: ${errorDetail}`
37
+ : `HTTP ${response.status}: ${response.statusText}`);
38
+ }
39
+ const json = (await response.json());
40
+ if (json.errors && json.errors.length > 0) {
41
+ throw new PlainGraphQLError(json.errors);
42
+ }
43
+ if (!json.data) {
44
+ throw new PlainError("No data in response");
45
+ }
46
+ return json.data;
47
+ }
48
+ async extractErrorMessage(response) {
49
+ try {
50
+ const json = (await response.json());
51
+ if (json.errors && json.errors.length > 0) {
52
+ return json.errors.map((e) => e.message).join("; ");
53
+ }
54
+ }
55
+ catch {
56
+ // Response body wasn't valid JSON — fall back to default message
57
+ }
58
+ return undefined;
59
+ }
60
+ }
61
+ //# sourceMappingURL=graphql-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graphql-client.js","sourceRoot":"","sources":["../src/graphql-client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM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ACH,CAAC;QAAC,MAAM,CAAC;YACP,iEAAiE;QACnE,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;CACF"}
@@ -0,0 +1,13 @@
1
+ export * from "./_generated_documents.js";
2
+ export type { PlainSdkMutations, PlainSdkQueries } from "./_generated_sdk.js";
3
+ export * from "./_generated_sdk.js";
4
+ export { PlainSdk } from "./_generated_sdk.js";
5
+ export { PlainClient } from "./client.js";
6
+ export type { PageInfoData, PlainConnectionConfig } from "./connection.js";
7
+ export { PlainConnection } from "./connection.js";
8
+ export type { GraphQLErrorEntry } from "./error.js";
9
+ export { AuthenticationError, ForbiddenError, InternalError, NetworkError, PlainError, PlainGraphQLError, RateLimitError, } from "./error.js";
10
+ export type { GraphQLResponse, PlainGraphQLClientOptions } from "./graphql-client.js";
11
+ export { PlainGraphQLClient } from "./graphql-client.js";
12
+ export type { PlainClientOptions } from "./types.js";
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,YAAY,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC9E,cAAc,qBAAqB,CAAC;AAEpC,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,YAAY,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,YAAY,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EACL,mBAAmB,EACnB,cAAc,EACd,aAAa,EACb,YAAY,EACZ,UAAU,EACV,iBAAiB,EACjB,cAAc,GACf,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,eAAe,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AACtF,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,YAAY,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,9 @@
1
+ export * from "./_generated_documents.js";
2
+ export * from "./_generated_sdk.js";
3
+ // Re-export generated SDK and types
4
+ export { PlainSdk } from "./_generated_sdk.js";
5
+ export { PlainClient } from "./client.js";
6
+ export { PlainConnection } from "./connection.js";
7
+ export { AuthenticationError, ForbiddenError, InternalError, NetworkError, PlainError, PlainGraphQLError, RateLimitError, } from "./error.js";
8
+ export { PlainGraphQLClient } from "./graphql-client.js";
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAE1C,cAAc,qBAAqB,CAAC;AACpC,oCAAoC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,EACL,mBAAmB,EACnB,cAAc,EACd,aAAa,EACb,YAAY,EACZ,UAAU,EACV,iBAAiB,EACjB,cAAc,GACf,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1,5 @@
1
+ export interface PlainClientOptions {
2
+ apiKey: string;
3
+ apiUrl?: string;
4
+ }
5
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "@team-plain/graphql",
3
+ "version": "1.0.0",
4
+ "type": "module",
5
+ "main": "./dist/index.js",
6
+ "types": "./dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "import": "./dist/index.js",
10
+ "types": "./dist/index.d.ts"
11
+ }
12
+ },
13
+ "publishConfig": {
14
+ "access": "public"
15
+ },
16
+ "files": [
17
+ "dist"
18
+ ],
19
+ "scripts": {
20
+ "generate-documents": "tsx src/generate-documents.ts",
21
+ "download-schema": "tsx scripts/download-schema.ts",
22
+ "codegen": "pnpm download-schema && tsx src/generate-documents.ts && graphql-codegen --config codegen.yml",
23
+ "build": "tsc",
24
+ "prepublishOnly": "npm run build",
25
+ "test": "vitest run"
26
+ },
27
+ "dependencies": {
28
+ "@graphql-typed-document-node/core": "^3.2.0",
29
+ "graphql": "^16.9.0"
30
+ },
31
+ "devDependencies": {
32
+ "@graphql-codegen/cli": "^5.0.3",
33
+ "@graphql-codegen/typed-document-node": "^5.0.12",
34
+ "@graphql-codegen/typescript": "^4.1.2",
35
+ "@graphql-codegen/typescript-operations": "^4.3.2",
36
+ "@team-plain/graphql-codegen-plugin": "workspace:*",
37
+ "tsx": "^4.21.0",
38
+ "typescript": "^5.7.0"
39
+ }
40
+ }