@solomonai/stripe-sync-graphql-sdk 0.0.1

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.
package/README.md ADDED
@@ -0,0 +1,71 @@
1
+ # @solomonai/stripe-sync-graphql-sdk
2
+
3
+ Type-safe GraphQL SDK for the Stripe Sync Engine API.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @solomonai/stripe-sync-graphql-sdk
9
+ # or
10
+ bun add @solomonai/stripe-sync-graphql-sdk
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ```typescript
16
+ import { createClient } from '@solomonai/stripe-sync-graphql-sdk'
17
+ import { gql } from 'graphql-request'
18
+
19
+ // Create client with your API endpoint and credentials
20
+ const client = createClient({
21
+ endpoint: 'https://your-api.com/graphql',
22
+ headers: {
23
+ 'x-tenant-id': 'your-tenant-id',
24
+ 'x-api-key': 'your-api-key',
25
+ },
26
+ })
27
+
28
+ // Query customers
29
+ const query = gql`
30
+ query GetCustomers($first: Int!) {
31
+ customers(first: $first) {
32
+ edges {
33
+ node {
34
+ id
35
+ email
36
+ name
37
+ totalSpend
38
+ }
39
+ }
40
+ pageInfo {
41
+ hasNextPage
42
+ endCursor
43
+ }
44
+ }
45
+ }
46
+ `
47
+
48
+ const data = await client.request(query, { first: 10 })
49
+ console.log(data.customers)
50
+ ```
51
+
52
+ ## Available Types
53
+
54
+ The SDK exports all GraphQL types for type-safe queries:
55
+
56
+ ```typescript
57
+ import type { Customer, Subscription, Invoice } from '@solomonai/stripe-sync-graphql-sdk'
58
+ ```
59
+
60
+ ## Regenerating Types
61
+
62
+ Types are auto-generated from the GraphQL schema. To regenerate:
63
+
64
+ ```bash
65
+ cd packages/fastify-app
66
+ bun run graphql:generate
67
+ ```
68
+
69
+ ## License
70
+
71
+ MIT
@@ -0,0 +1,69 @@
1
+ import { GraphQLClient } from 'graphql-request';
2
+ import { TypedDocumentNode } from '@graphql-typed-document-node/core';
3
+
4
+ /**
5
+ * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
6
+ *
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * const query = graphql(`query GetUser($id: ID!) { user(id: $id) { name } }`);
11
+ * ```
12
+ *
13
+ * The query argument is unknown!
14
+ * Please regenerate the types.
15
+ */
16
+ declare function graphql(source: string): unknown;
17
+ type DocumentType<TDocumentNode extends TypedDocumentNode<any, any>> = TDocumentNode extends TypedDocumentNode<infer TType, any> ? TType : never;
18
+
19
+ /**
20
+ * Stripe Sync GraphQL SDK
21
+ *
22
+ * Type-safe GraphQL client for the Stripe Sync Engine API.
23
+ *
24
+ * @example
25
+ * ```typescript
26
+ * import { createClient } from '@solomonai/stripe-sync-graphql-sdk'
27
+ *
28
+ * const client = createClient({
29
+ * endpoint: 'https://api.example.com/graphql',
30
+ * headers: {
31
+ * 'x-tenant-id': 'your-tenant-id',
32
+ * 'x-api-key': 'your-api-key',
33
+ * }
34
+ * })
35
+ *
36
+ * const { customers } = await client.getCustomers({ first: 10 })
37
+ * ```
38
+ */
39
+
40
+ /**
41
+ * SDK client configuration options
42
+ */
43
+ interface ClientOptions {
44
+ /** GraphQL endpoint URL */
45
+ endpoint: string;
46
+ /** HTTP headers to include with every request */
47
+ headers?: Record<string, string>;
48
+ /** Request timeout in milliseconds */
49
+ timeout?: number;
50
+ }
51
+ /**
52
+ * Creates a GraphQL client instance for the Stripe Sync API
53
+ *
54
+ * @param options - Client configuration options
55
+ * @returns Configured GraphQLClient instance
56
+ *
57
+ * @example
58
+ * ```typescript
59
+ * const client = createClient({
60
+ * endpoint: 'https://api.example.com/graphql',
61
+ * headers: {
62
+ * 'x-tenant-id': 'tenant-123',
63
+ * }
64
+ * })
65
+ * ```
66
+ */
67
+ declare function createClient(options: ClientOptions): GraphQLClient;
68
+
69
+ export { type ClientOptions, type DocumentType, createClient, createClient as default, graphql };
@@ -0,0 +1,69 @@
1
+ import { GraphQLClient } from 'graphql-request';
2
+ import { TypedDocumentNode } from '@graphql-typed-document-node/core';
3
+
4
+ /**
5
+ * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
6
+ *
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * const query = graphql(`query GetUser($id: ID!) { user(id: $id) { name } }`);
11
+ * ```
12
+ *
13
+ * The query argument is unknown!
14
+ * Please regenerate the types.
15
+ */
16
+ declare function graphql(source: string): unknown;
17
+ type DocumentType<TDocumentNode extends TypedDocumentNode<any, any>> = TDocumentNode extends TypedDocumentNode<infer TType, any> ? TType : never;
18
+
19
+ /**
20
+ * Stripe Sync GraphQL SDK
21
+ *
22
+ * Type-safe GraphQL client for the Stripe Sync Engine API.
23
+ *
24
+ * @example
25
+ * ```typescript
26
+ * import { createClient } from '@solomonai/stripe-sync-graphql-sdk'
27
+ *
28
+ * const client = createClient({
29
+ * endpoint: 'https://api.example.com/graphql',
30
+ * headers: {
31
+ * 'x-tenant-id': 'your-tenant-id',
32
+ * 'x-api-key': 'your-api-key',
33
+ * }
34
+ * })
35
+ *
36
+ * const { customers } = await client.getCustomers({ first: 10 })
37
+ * ```
38
+ */
39
+
40
+ /**
41
+ * SDK client configuration options
42
+ */
43
+ interface ClientOptions {
44
+ /** GraphQL endpoint URL */
45
+ endpoint: string;
46
+ /** HTTP headers to include with every request */
47
+ headers?: Record<string, string>;
48
+ /** Request timeout in milliseconds */
49
+ timeout?: number;
50
+ }
51
+ /**
52
+ * Creates a GraphQL client instance for the Stripe Sync API
53
+ *
54
+ * @param options - Client configuration options
55
+ * @returns Configured GraphQLClient instance
56
+ *
57
+ * @example
58
+ * ```typescript
59
+ * const client = createClient({
60
+ * endpoint: 'https://api.example.com/graphql',
61
+ * headers: {
62
+ * 'x-tenant-id': 'tenant-123',
63
+ * }
64
+ * })
65
+ * ```
66
+ */
67
+ declare function createClient(options: ClientOptions): GraphQLClient;
68
+
69
+ export { type ClientOptions, type DocumentType, createClient, createClient as default, graphql };
package/dist/index.js ADDED
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ createClient: () => createClient,
24
+ default: () => index_default,
25
+ graphql: () => graphql
26
+ });
27
+ module.exports = __toCommonJS(index_exports);
28
+ var import_graphql_request = require("graphql-request");
29
+
30
+ // src/generated/gql.ts
31
+ var documents = [];
32
+ function graphql(source) {
33
+ return documents[source] ?? {};
34
+ }
35
+
36
+ // src/index.ts
37
+ function createClient(options) {
38
+ const config = {};
39
+ if (options.headers) {
40
+ config.headers = options.headers;
41
+ }
42
+ if (options.timeout) {
43
+ }
44
+ const client = new import_graphql_request.GraphQLClient(options.endpoint, config);
45
+ return client;
46
+ }
47
+ var index_default = createClient;
48
+ // Annotate the CommonJS export names for ESM import in node:
49
+ 0 && (module.exports = {
50
+ createClient,
51
+ graphql
52
+ });
package/dist/index.mjs ADDED
@@ -0,0 +1,26 @@
1
+ // src/index.ts
2
+ import { GraphQLClient } from "graphql-request";
3
+
4
+ // src/generated/gql.ts
5
+ var documents = [];
6
+ function graphql(source) {
7
+ return documents[source] ?? {};
8
+ }
9
+
10
+ // src/index.ts
11
+ function createClient(options) {
12
+ const config = {};
13
+ if (options.headers) {
14
+ config.headers = options.headers;
15
+ }
16
+ if (options.timeout) {
17
+ }
18
+ const client = new GraphQLClient(options.endpoint, config);
19
+ return client;
20
+ }
21
+ var index_default = createClient;
22
+ export {
23
+ createClient,
24
+ index_default as default,
25
+ graphql
26
+ };
package/package.json ADDED
@@ -0,0 +1,51 @@
1
+ {
2
+ "name": "@solomonai/stripe-sync-graphql-sdk",
3
+ "version": "0.0.1",
4
+ "description": "Type-safe GraphQL SDK for the Stripe Sync Engine API",
5
+ "main": "./dist/index.js",
6
+ "types": "./dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "import": "./dist/index.js",
11
+ "require": "./dist/index.cjs"
12
+ }
13
+ },
14
+ "scripts": {
15
+ "build": "tsup src/index.ts --format esm,cjs --dts",
16
+ "clean": "rimraf dist",
17
+ "typecheck": "tsc --noEmit",
18
+ "test": "vitest run",
19
+ "test:watch": "vitest"
20
+ },
21
+ "files": [
22
+ "dist",
23
+ "src"
24
+ ],
25
+ "dependencies": {
26
+ "graphql": "^16.8.1",
27
+ "graphql-request": "^7.1.2"
28
+ },
29
+ "devDependencies": {
30
+ "@graphql-typed-document-node/core": "^3.2.0",
31
+ "tsup": "^8.5.0",
32
+ "typescript": "^5.8.3",
33
+ "vitest": "^2.1.6"
34
+ },
35
+ "peerDependencies": {
36
+ "graphql": "^16.0.0"
37
+ },
38
+ "repository": {
39
+ "type": "git",
40
+ "url": "https://github.com/Oppulence-Engineering/oppulence-sync-engine.git"
41
+ },
42
+ "keywords": [
43
+ "stripe",
44
+ "graphql",
45
+ "sdk",
46
+ "typescript",
47
+ "client"
48
+ ],
49
+ "author": "Oppulence Engineering",
50
+ "license": "MIT"
51
+ }