@ownzones/connect-sdk 0.1.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,18 @@
1
+ /**
2
+ * STUB — This file is replaced by `pnpm genql` (genql code generation).
3
+ *
4
+ * Run `pnpm genql` with GRAPHQL_ENDPOINT set to generate real types
5
+ * from your Connect GraphQL Gateway.
6
+ */
7
+ export interface Client {
8
+ query: (request: any) => Promise<any>;
9
+ mutation: (request: any) => Promise<any>;
10
+ chain: any;
11
+ }
12
+ export interface ClientOptions {
13
+ fetcher?: any;
14
+ [key: string]: any;
15
+ }
16
+ export declare function createClient(options?: ClientOptions): Client;
17
+ export declare function everything(): {};
18
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../sdk/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,MAAM,WAAW,MAAM;IACrB,KAAK,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;IACtC,QAAQ,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;IACzC,KAAK,EAAE,GAAG,CAAC;CACZ;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,wBAAgB,YAAY,CAAC,OAAO,CAAC,EAAE,aAAa,GAAG,MAAM,CAI5D;AAED,wBAAgB,UAAU,OAEzB"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * STUB — This file is replaced by `pnpm genql` (genql code generation).
3
+ *
4
+ * Run `pnpm genql` with GRAPHQL_ENDPOINT set to generate real types
5
+ * from your Connect GraphQL Gateway.
6
+ */
7
+ export function createClient(options) {
8
+ throw new Error('SDK not generated. Run `pnpm genql` with GRAPHQL_ENDPOINT to generate the typed SDK.');
9
+ }
10
+ export function everything() {
11
+ return {};
12
+ }
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../sdk/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAeH,MAAM,UAAU,YAAY,CAAC,OAAuB;IAClD,MAAM,IAAI,KAAK,CACb,sFAAsF,CACvF,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,UAAU;IACxB,OAAO,EAAW,CAAC;AACrB,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * STUB — Replaced by `pnpm genql`.
3
+ */
4
+ export interface GraphqlOperation {
5
+ query: string;
6
+ variables?: Record<string, unknown>;
7
+ }
8
+ //# sourceMappingURL=generateGraphqlOperation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generateGraphqlOperation.d.ts","sourceRoot":"","sources":["../../../sdk/runtime/generateGraphqlOperation.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACrC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=generateGraphqlOperation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generateGraphqlOperation.js","sourceRoot":"","sources":["../../../sdk/runtime/generateGraphqlOperation.ts"],"names":[],"mappings":""}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * STUB — Replaced by `pnpm genql`.
3
+ */
4
+ export interface ExecutionResult {
5
+ data?: Record<string, unknown>;
6
+ errors?: Array<{
7
+ message: string;
8
+ [key: string]: unknown;
9
+ }>;
10
+ }
11
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../sdk/runtime/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,MAAM,CAAC,EAAE,KAAK,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC,CAAC;CAC7D"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../sdk/runtime/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Connect client with HMAC API key authentication.
3
+ * Used for backend/server-side calls where API keys are available.
4
+ * NOT recommended for plugin frontend code — use JWT (createConnectClient) instead.
5
+ */
6
+ import type { Client } from '../../sdk/index.js';
7
+ export interface ApiKeyClientOptions {
8
+ url: string;
9
+ orgSlug: string;
10
+ publicKey: string;
11
+ secretKey: string;
12
+ }
13
+ export declare function createConnectClientApiKey(options: ApiKeyClientOptions): Client;
14
+ //# sourceMappingURL=connect-client-api-key.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connect-client-api-key.d.ts","sourceRoot":"","sources":["../../../src/helpers/connect-client-api-key.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAIjD,MAAM,WAAW,mBAAmB;IAClC,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAoBD,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,mBAAmB,GAC3B,MAAM,CAiDR"}
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Connect client with HMAC API key authentication.
3
+ * Used for backend/server-side calls where API keys are available.
4
+ * NOT recommended for plugin frontend code — use JWT (createConnectClient) instead.
5
+ */
6
+ import { createHmac } from 'node:crypto';
7
+ import { createClient } from '../../sdk/index.js';
8
+ function sign(body, endpoint, orgSlug, secretKey) {
9
+ const payload = {
10
+ url: endpoint,
11
+ body,
12
+ organization_slug: orgSlug,
13
+ };
14
+ const hmac = createHmac('sha256', secretKey);
15
+ hmac.write(JSON.stringify(payload));
16
+ hmac.end();
17
+ return hmac.read().toString('hex');
18
+ }
19
+ export function createConnectClientApiKey(options) {
20
+ const endpointWithoutProtocol = options.url.replace(/^https?:\/\//, '');
21
+ return createClient({
22
+ fetcher: async (operation) => {
23
+ const { query, variables } = Array.isArray(operation)
24
+ ? operation[0]
25
+ : operation;
26
+ const body = JSON.stringify([
27
+ {
28
+ query: query.replaceAll(/[\s,]+/g, ' ')?.trim(),
29
+ variables,
30
+ },
31
+ ]);
32
+ const signature = sign(body, endpointWithoutProtocol, options.orgSlug, options.secretKey);
33
+ const response = await fetch(options.url, {
34
+ method: 'POST',
35
+ headers: {
36
+ 'Content-Type': 'application/json',
37
+ 'X-Organization-Slug': options.orgSlug,
38
+ 'oz-key-id': options.publicKey,
39
+ 'oz-signature': signature,
40
+ },
41
+ body,
42
+ });
43
+ if (!response.ok) {
44
+ throw new Error(`${response.status}: ${response.statusText}`);
45
+ }
46
+ const gqlResponse = (await response.json());
47
+ if (gqlResponse.length > 0) {
48
+ return gqlResponse[0];
49
+ }
50
+ throw new Error('Empty response from server');
51
+ },
52
+ });
53
+ }
54
+ //# sourceMappingURL=connect-client-api-key.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connect-client-api-key.js","sourceRoot":"","sources":["../../../src/helpers/connect-client-api-key.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAYlD,SAAS,IAAI,CACX,IAAY,EACZ,QAAgB,EAChB,OAAe,EACf,SAAiB;IAEjB,MAAM,OAAO,G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c,EAAE,SAAS;iBAC1B;gBACD,IAAI;aACL,CAAC,CAAC;YAEH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;gBACjB,MAAM,IAAI,KAAK,CAAC,GAAG,QAAQ,CAAC,MAAM,KAAK,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC;YAChE,CAAC;YAED,MAAM,WAAW,GAAG,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAsB,CAAC;YAEjE,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC3B,OAAO,WAAW,CAAC,CAAC,CAAC,CAAC;YACxB,CAAC;YAED,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;QAChD,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Connect client with static Bearer token.
3
+ * Useful for backend-to-backend calls or testing where you have a pre-obtained JWT.
4
+ */
5
+ import type { Client } from '../../sdk/index.js';
6
+ export interface TokenClientOptions {
7
+ url: string;
8
+ orgSlug: string;
9
+ token: string;
10
+ }
11
+ export declare function createConnectClientToken(options: TokenClientOptions): Client;
12
+ //# sourceMappingURL=connect-client-token.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connect-client-token.d.ts","sourceRoot":"","sources":["../../../src/helpers/connect-client-token.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAIjD,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,kBAAkB,GAAG,MAAM,CAuC5E"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Connect client with static Bearer token.
3
+ * Useful for backend-to-backend calls or testing where you have a pre-obtained JWT.
4
+ */
5
+ import { createClient } from '../../sdk/index.js';
6
+ export function createConnectClientToken(options) {
7
+ return createClient({
8
+ fetcher: async (operation) => {
9
+ const { query, variables } = Array.isArray(operation)
10
+ ? operation[0]
11
+ : operation;
12
+ const body = JSON.stringify([
13
+ {
14
+ query: query.replaceAll(/[\s,]+/g, ' ')?.trim(),
15
+ variables,
16
+ },
17
+ ]);
18
+ const response = await fetch(options.url, {
19
+ method: 'POST',
20
+ headers: {
21
+ 'Content-Type': 'application/json',
22
+ 'X-Organization-Slug': options.orgSlug,
23
+ Authorization: `Bearer ${options.token}`,
24
+ },
25
+ body,
26
+ });
27
+ if (!response.ok) {
28
+ throw new Error(`${response.status}: ${response.statusText}`);
29
+ }
30
+ const gqlResponse = (await response.json());
31
+ if (gqlResponse.length > 0) {
32
+ return gqlResponse[0];
33
+ }
34
+ throw new Error('Empty response from server');
35
+ },
36
+ });
37
+ }
38
+ //# sourceMappingURL=connect-client-token.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connect-client-token.js","sourceRoot":"","sources":["../../../src/helpers/connect-client-token.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAWlD,MAAM,UAAU,wBAAwB,CAAC,OAA2B;IAClE,OAAO,YAAY,CAAC;QAClB,OAAO,EAAE,KAAK,EACZ,SAAgD,EACtB,EAAE;YAC5B,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC;gBACnD,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;gBACd,CAAC,CAAC,SAAS,CAAC;YAEd,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC;gBAC1B;oBACE,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,SAAS,EAAE,GAAG,CAAC,EAAE,IAAI,EAAE;oBAC/C,SAAS;iBACV;aACF,CAAC,CAAC;YAEH,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE;gBACxC,MAAM,EAAE,MAAM;gBACd,OAAO,EAAE;oBACP,cAAc,EAAE,kBAAkB;oBAClC,qBAAqB,EAAE,OAAO,CAAC,OAAO;oBACtC,aAAa,EAAE,UAAU,OAAO,CAAC,KAAK,EAAE;iBACzC;gBACD,IAAI;aACL,CAAC,CAAC;YAEH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;gBACjB,MAAM,IAAI,KAAK,CAAC,GAAG,QAAQ,CAAC,MAAM,KAAK,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC;YAChE,CAAC;YAED,MAAM,WAAW,GAAG,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAsB,CAAC;YAEjE,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC3B,OAAO,WAAW,CAAC,CAAC,CAAC,CAAC;YACxB,CAAC;YAED,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;QAChD,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Primary Connect client factory for Connect Studio.
3
+ * Uses JWT Bearer token authentication (Cognito).
4
+ *
5
+ * This is the recommended client for all plugin frontend usage.
6
+ * The shell passes the JWT token via the Studio context, and plugins
7
+ * use this client (via studio-core hooks) to query the Connect API.
8
+ */
9
+ import type { Client } from '../../sdk/index.js';
10
+ export interface ConnectClientOptions {
11
+ /** GraphQL Gateway URL */
12
+ url: string;
13
+ /** Organization slug for multi-tenancy */
14
+ orgSlug: string;
15
+ /** Function that returns the current JWT token */
16
+ getToken: () => string | null | Promise<string | null>;
17
+ }
18
+ export declare function createConnectClient(options: ConnectClientOptions): Client;
19
+ //# sourceMappingURL=connect-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connect-client.d.ts","sourceRoot":"","sources":["../../../src/helpers/connect-client.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAIjD,MAAM,WAAW,oBAAoB;IACnC,0BAA0B;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,0CAA0C;IAC1C,OAAO,EAAE,MAAM,CAAC;IAChB,kDAAkD;IAClD,QAAQ,EAAE,MAAM,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;CACxD;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,oBAAoB,GAAG,MAAM,CA8CzE"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Primary Connect client factory for Connect Studio.
3
+ * Uses JWT Bearer token authentication (Cognito).
4
+ *
5
+ * This is the recommended client for all plugin frontend usage.
6
+ * The shell passes the JWT token via the Studio context, and plugins
7
+ * use this client (via studio-core hooks) to query the Connect API.
8
+ */
9
+ import { createClient } from '../../sdk/index.js';
10
+ export function createConnectClient(options) {
11
+ return createClient({
12
+ fetcher: async (operation) => {
13
+ const { query, variables } = Array.isArray(operation)
14
+ ? operation[0]
15
+ : operation;
16
+ const token = await options.getToken();
17
+ if (!token) {
18
+ throw new Error('No authentication token available');
19
+ }
20
+ // Connect API expects array-wrapped requests
21
+ const body = JSON.stringify([
22
+ {
23
+ query: query.replaceAll(/[\s,]+/g, ' ')?.trim(),
24
+ variables,
25
+ },
26
+ ]);
27
+ const response = await fetch(options.url, {
28
+ method: 'POST',
29
+ headers: {
30
+ 'Content-Type': 'application/json',
31
+ 'X-Organization-Slug': options.orgSlug,
32
+ Authorization: `Bearer ${token}`,
33
+ },
34
+ body,
35
+ });
36
+ if (!response.ok) {
37
+ throw new Error(`${response.status}: ${response.statusText}`);
38
+ }
39
+ // Connect API returns array of responses
40
+ const gqlResponse = (await response.json());
41
+ if (gqlResponse.length > 0) {
42
+ return gqlResponse[0];
43
+ }
44
+ throw new Error('Empty response from server');
45
+ },
46
+ });
47
+ }
48
+ //# sourceMappingURL=connect-client.js.map
@@ -0,0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C,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAsB,CAAC;YAEjE,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC3B,OAAO,WAAW,CAAC,CAAC,CAAC,CAAC;YACxB,CAAC;YAED,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;QAChD,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * @ownzones/connect-sdk
3
+ *
4
+ * Type-safe GraphQL client for Ateliere Connect API.
5
+ *
6
+ * Usage with JWT (recommended for Connect Studio plugins):
7
+ * ```ts
8
+ * import { createConnectClient } from '@ownzones/connect-sdk';
9
+ *
10
+ * const client = createConnectClient({
11
+ * url: 'https://api.connect.ateliere.com/graphql',
12
+ * orgSlug: 'my-org',
13
+ * getToken: () => authContext.getJwtToken(),
14
+ * });
15
+ *
16
+ * const { files } = await client.query({ files: { edges: { node: { id: true, filename: true } } } });
17
+ * ```
18
+ */
19
+ export { createConnectClient, type ConnectClientOptions } from './helpers/connect-client.js';
20
+ export { createConnectClientToken, type TokenClientOptions, } from './helpers/connect-client-token.js';
21
+ export { createConnectClientApiKey, type ApiKeyClientOptions, } from './helpers/connect-client-api-key.js';
22
+ export * from '../sdk/index.js';
23
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,mBAAmB,EAAE,KAAK,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAC7F,OAAO,EACL,wBAAwB,EACxB,KAAK,kBAAkB,GACxB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,yBAAyB,EACzB,KAAK,mBAAmB,GACzB,MAAM,qCAAqC,CAAC;AAG7C,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * @ownzones/connect-sdk
3
+ *
4
+ * Type-safe GraphQL client for Ateliere Connect API.
5
+ *
6
+ * Usage with JWT (recommended for Connect Studio plugins):
7
+ * ```ts
8
+ * import { createConnectClient } from '@ownzones/connect-sdk';
9
+ *
10
+ * const client = createConnectClient({
11
+ * url: 'https://api.connect.ateliere.com/graphql',
12
+ * orgSlug: 'my-org',
13
+ * getToken: () => authContext.getJwtToken(),
14
+ * });
15
+ *
16
+ * const { files } = await client.query({ files: { edges: { node: { id: true, filename: true } } } });
17
+ * ```
18
+ */
19
+ export { createConnectClient } from './helpers/connect-client.js';
20
+ export { createConnectClientToken, } from './helpers/connect-client-token.js';
21
+ export { createConnectClientApiKey, } from './helpers/connect-client-api-key.js';
22
+ // Re-export everything from generated SDK
23
+ export * from '../sdk/index.js';
24
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,mBAAmB,EAA6B,MAAM,6BAA6B,CAAC;AAC7F,OAAO,EACL,wBAAwB,GAEzB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,yBAAyB,GAE1B,MAAM,qCAAqC,CAAC;AAE7C,0CAA0C;AAC1C,cAAc,iBAAiB,CAAC"}
package/package.json ADDED
@@ -0,0 +1,42 @@
1
+ {
2
+ "name": "@ownzones/connect-sdk",
3
+ "version": "0.1.0",
4
+ "description": "Type-safe GraphQL client for Ateliere Connect API",
5
+ "type": "module",
6
+ "main": "./dist/src/index.js",
7
+ "types": "./dist/src/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/src/index.d.ts",
11
+ "import": "./dist/src/index.js"
12
+ }
13
+ },
14
+ "files": [
15
+ "dist"
16
+ ],
17
+ "scripts": {
18
+ "_genql": "graphql-inspector introspect $GRAPHQL_ENDPOINT --write schema.graphql && genql --schema schema.graphql --output ./sdk",
19
+ "genql": "rm -f schema.graphql && rm -rf sdk && dotenv -- pnpm _genql",
20
+ "build": "pnpm genql && rm -rf dist && tsc -p tsconfig.lib.json",
21
+ "build:no-genql": "rm -rf dist && tsc -p tsconfig.lib.json",
22
+ "type-check": "tsc -p tsconfig.lib.json --noEmit"
23
+ },
24
+ "dependencies": {
25
+ "@genql/cli": "^6.3.3"
26
+ },
27
+ "devDependencies": {
28
+ "@graphql-inspector/cli": "^5.0.5",
29
+ "@types/node": "^20.19.33",
30
+ "dotenv-cli": "^7.4.2",
31
+ "graphql": "^16.8.1",
32
+ "typescript": "~5.7.0"
33
+ },
34
+ "peerDependencies": {
35
+ "amazon-cognito-identity-js": "^6.0.0"
36
+ },
37
+ "peerDependenciesMeta": {
38
+ "amazon-cognito-identity-js": {
39
+ "optional": true
40
+ }
41
+ }
42
+ }