@constructive-sdk/cli 0.21.7 → 0.21.9

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.
Files changed (67) hide show
  1. package/admin/cli/executor.js +2 -2
  2. package/admin/orm/select-types.d.ts +1 -1
  3. package/auth/cli/executor.js +2 -2
  4. package/auth/orm/select-types.d.ts +1 -1
  5. package/esm/admin/cli/executor.js +2 -2
  6. package/esm/admin/orm/select-types.d.ts +1 -1
  7. package/esm/auth/cli/executor.js +2 -2
  8. package/esm/auth/orm/select-types.d.ts +1 -1
  9. package/esm/objects/cli/executor.js +2 -2
  10. package/esm/objects/orm/select-types.d.ts +1 -1
  11. package/esm/public/cli/commands/api-setting.js +22 -0
  12. package/esm/public/cli/commands/database-setting.js +22 -0
  13. package/esm/public/cli/commands.js +3 -3
  14. package/esm/public/cli/executor.d.ts +1 -1
  15. package/esm/public/cli/executor.js +2 -2
  16. package/esm/public/orm/index.d.ts +2 -2
  17. package/esm/public/orm/index.js +2 -2
  18. package/esm/public/orm/input-types.d.ts +204 -186
  19. package/esm/public/orm/models/index.d.ts +1 -1
  20. package/esm/public/orm/models/index.js +1 -1
  21. package/esm/public/orm/select-types.d.ts +1 -1
  22. package/objects/cli/executor.js +2 -2
  23. package/objects/orm/select-types.d.ts +1 -1
  24. package/package.json +4 -4
  25. package/public/cli/commands/api-setting.js +22 -0
  26. package/public/cli/commands/database-setting.js +22 -0
  27. package/public/cli/commands.js +3 -3
  28. package/public/cli/executor.d.ts +1 -1
  29. package/public/cli/executor.js +2 -2
  30. package/public/orm/index.d.ts +2 -2
  31. package/public/orm/index.js +2 -2
  32. package/public/orm/input-types.d.ts +204 -186
  33. package/public/orm/models/index.d.ts +1 -1
  34. package/public/orm/models/index.js +3 -3
  35. package/public/orm/select-types.d.ts +1 -1
  36. package/admin/cli/node-fetch.d.ts +0 -26
  37. package/admin/cli/node-fetch.js +0 -129
  38. package/admin/orm/node-fetch.d.ts +0 -26
  39. package/admin/orm/node-fetch.js +0 -129
  40. package/auth/cli/node-fetch.d.ts +0 -26
  41. package/auth/cli/node-fetch.js +0 -129
  42. package/auth/orm/node-fetch.d.ts +0 -26
  43. package/auth/orm/node-fetch.js +0 -129
  44. package/esm/admin/cli/node-fetch.d.ts +0 -26
  45. package/esm/admin/cli/node-fetch.js +0 -122
  46. package/esm/admin/orm/node-fetch.d.ts +0 -26
  47. package/esm/admin/orm/node-fetch.js +0 -122
  48. package/esm/auth/cli/node-fetch.d.ts +0 -26
  49. package/esm/auth/cli/node-fetch.js +0 -122
  50. package/esm/auth/orm/node-fetch.d.ts +0 -26
  51. package/esm/auth/orm/node-fetch.js +0 -122
  52. package/esm/objects/cli/node-fetch.d.ts +0 -26
  53. package/esm/objects/cli/node-fetch.js +0 -122
  54. package/esm/objects/orm/node-fetch.d.ts +0 -26
  55. package/esm/objects/orm/node-fetch.js +0 -122
  56. package/esm/public/cli/node-fetch.d.ts +0 -26
  57. package/esm/public/cli/node-fetch.js +0 -122
  58. package/esm/public/orm/node-fetch.d.ts +0 -26
  59. package/esm/public/orm/node-fetch.js +0 -122
  60. package/objects/cli/node-fetch.d.ts +0 -26
  61. package/objects/cli/node-fetch.js +0 -129
  62. package/objects/orm/node-fetch.d.ts +0 -26
  63. package/objects/orm/node-fetch.js +0 -129
  64. package/public/cli/node-fetch.d.ts +0 -26
  65. package/public/cli/node-fetch.js +0 -129
  66. package/public/orm/node-fetch.d.ts +0 -26
  67. package/public/orm/node-fetch.js +0 -129
@@ -1,129 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.NodeHttpAdapter = void 0;
7
- /**
8
- * Node HTTP adapter for localhost subdomain routing
9
- * @generated by @constructive-io/graphql-codegen
10
- * DO NOT EDIT - changes will be overwritten
11
- */
12
- const node_http_1 = __importDefault(require("node:http"));
13
- const node_https_1 = __importDefault(require("node:https"));
14
- /**
15
- * Check if a hostname is a localhost subdomain that needs special handling.
16
- * Returns true for *.localhost (e.g. auth.localhost) but not bare "localhost".
17
- */
18
- function isLocalhostSubdomain(hostname) {
19
- return hostname.endsWith('.localhost') && hostname !== 'localhost';
20
- }
21
- /**
22
- * Make an HTTP/HTTPS request using native Node modules.
23
- * Supports optional AbortSignal for request cancellation.
24
- */
25
- function makeRequest(url, options, body, signal) {
26
- return new Promise((resolve, reject) => {
27
- if (signal?.aborted) {
28
- reject(new Error('The operation was aborted'));
29
- return;
30
- }
31
- const protocol = url.protocol === 'https:' ? node_https_1.default : node_http_1.default;
32
- const req = protocol.request(url, options, (res) => {
33
- let data = '';
34
- res.setEncoding('utf8');
35
- res.on('data', (chunk) => {
36
- data += chunk;
37
- });
38
- res.on('end', () => {
39
- resolve({
40
- statusCode: res.statusCode || 0,
41
- statusMessage: res.statusMessage || '',
42
- data,
43
- });
44
- });
45
- });
46
- req.on('error', reject);
47
- if (signal) {
48
- const onAbort = () => {
49
- req.destroy(new Error('The operation was aborted'));
50
- };
51
- signal.addEventListener('abort', onAbort, { once: true });
52
- req.on('close', () => {
53
- signal.removeEventListener('abort', onAbort);
54
- });
55
- }
56
- req.write(body);
57
- req.end();
58
- });
59
- }
60
- /**
61
- * GraphQL adapter that uses node:http/node:https for requests.
62
- *
63
- * Handles *.localhost subdomains by rewriting the hostname to "localhost"
64
- * and injecting the original Host header for server-side subdomain routing.
65
- */
66
- class NodeHttpAdapter {
67
- endpoint;
68
- headers;
69
- url;
70
- constructor(endpoint, headers) {
71
- this.endpoint = endpoint;
72
- this.headers = headers ?? {};
73
- this.url = new URL(endpoint);
74
- }
75
- async execute(document, variables, options) {
76
- const requestUrl = new URL(this.url.href);
77
- const requestHeaders = {
78
- 'Content-Type': 'application/json',
79
- Accept: 'application/json',
80
- ...this.headers,
81
- ...options?.headers,
82
- };
83
- // For *.localhost subdomains, rewrite hostname and inject Host header
84
- if (isLocalhostSubdomain(requestUrl.hostname)) {
85
- requestHeaders['Host'] = requestUrl.host;
86
- requestUrl.hostname = 'localhost';
87
- }
88
- const body = JSON.stringify({
89
- query: document,
90
- variables: variables ?? {},
91
- });
92
- const requestOptions = {
93
- method: 'POST',
94
- headers: requestHeaders,
95
- };
96
- const response = await makeRequest(requestUrl, requestOptions, body, options?.signal);
97
- if (response.statusCode < 200 || response.statusCode >= 300) {
98
- return {
99
- ok: false,
100
- data: null,
101
- errors: [
102
- {
103
- message: `HTTP ${response.statusCode}: ${response.statusMessage}`,
104
- },
105
- ],
106
- };
107
- }
108
- const json = JSON.parse(response.data);
109
- if (json.errors && json.errors.length > 0) {
110
- return {
111
- ok: false,
112
- data: null,
113
- errors: json.errors,
114
- };
115
- }
116
- return {
117
- ok: true,
118
- data: json.data,
119
- errors: undefined,
120
- };
121
- }
122
- setHeaders(headers) {
123
- this.headers = { ...this.headers, ...headers };
124
- }
125
- getEndpoint() {
126
- return this.endpoint;
127
- }
128
- }
129
- exports.NodeHttpAdapter = NodeHttpAdapter;
@@ -1,26 +0,0 @@
1
- import type { GraphQLAdapter, QueryResult } from '@constructive-io/graphql-types';
2
- /**
3
- * Options for individual execute calls.
4
- * Allows per-request header overrides and request cancellation.
5
- */
6
- export interface NodeHttpExecuteOptions {
7
- /** Additional headers to include in this request only */
8
- headers?: Record<string, string>;
9
- /** AbortSignal for request cancellation */
10
- signal?: AbortSignal;
11
- }
12
- /**
13
- * GraphQL adapter that uses node:http/node:https for requests.
14
- *
15
- * Handles *.localhost subdomains by rewriting the hostname to "localhost"
16
- * and injecting the original Host header for server-side subdomain routing.
17
- */
18
- export declare class NodeHttpAdapter implements GraphQLAdapter {
19
- private endpoint;
20
- private headers;
21
- private url;
22
- constructor(endpoint: string, headers?: Record<string, string>);
23
- execute<T>(document: string, variables?: Record<string, unknown>, options?: NodeHttpExecuteOptions): Promise<QueryResult<T>>;
24
- setHeaders(headers: Record<string, string>): void;
25
- getEndpoint(): string;
26
- }
@@ -1,129 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.NodeHttpAdapter = void 0;
7
- /**
8
- * Node HTTP adapter for localhost subdomain routing
9
- * @generated by @constructive-io/graphql-codegen
10
- * DO NOT EDIT - changes will be overwritten
11
- */
12
- const node_http_1 = __importDefault(require("node:http"));
13
- const node_https_1 = __importDefault(require("node:https"));
14
- /**
15
- * Check if a hostname is a localhost subdomain that needs special handling.
16
- * Returns true for *.localhost (e.g. auth.localhost) but not bare "localhost".
17
- */
18
- function isLocalhostSubdomain(hostname) {
19
- return hostname.endsWith('.localhost') && hostname !== 'localhost';
20
- }
21
- /**
22
- * Make an HTTP/HTTPS request using native Node modules.
23
- * Supports optional AbortSignal for request cancellation.
24
- */
25
- function makeRequest(url, options, body, signal) {
26
- return new Promise((resolve, reject) => {
27
- if (signal?.aborted) {
28
- reject(new Error('The operation was aborted'));
29
- return;
30
- }
31
- const protocol = url.protocol === 'https:' ? node_https_1.default : node_http_1.default;
32
- const req = protocol.request(url, options, (res) => {
33
- let data = '';
34
- res.setEncoding('utf8');
35
- res.on('data', (chunk) => {
36
- data += chunk;
37
- });
38
- res.on('end', () => {
39
- resolve({
40
- statusCode: res.statusCode || 0,
41
- statusMessage: res.statusMessage || '',
42
- data,
43
- });
44
- });
45
- });
46
- req.on('error', reject);
47
- if (signal) {
48
- const onAbort = () => {
49
- req.destroy(new Error('The operation was aborted'));
50
- };
51
- signal.addEventListener('abort', onAbort, { once: true });
52
- req.on('close', () => {
53
- signal.removeEventListener('abort', onAbort);
54
- });
55
- }
56
- req.write(body);
57
- req.end();
58
- });
59
- }
60
- /**
61
- * GraphQL adapter that uses node:http/node:https for requests.
62
- *
63
- * Handles *.localhost subdomains by rewriting the hostname to "localhost"
64
- * and injecting the original Host header for server-side subdomain routing.
65
- */
66
- class NodeHttpAdapter {
67
- endpoint;
68
- headers;
69
- url;
70
- constructor(endpoint, headers) {
71
- this.endpoint = endpoint;
72
- this.headers = headers ?? {};
73
- this.url = new URL(endpoint);
74
- }
75
- async execute(document, variables, options) {
76
- const requestUrl = new URL(this.url.href);
77
- const requestHeaders = {
78
- 'Content-Type': 'application/json',
79
- Accept: 'application/json',
80
- ...this.headers,
81
- ...options?.headers,
82
- };
83
- // For *.localhost subdomains, rewrite hostname and inject Host header
84
- if (isLocalhostSubdomain(requestUrl.hostname)) {
85
- requestHeaders['Host'] = requestUrl.host;
86
- requestUrl.hostname = 'localhost';
87
- }
88
- const body = JSON.stringify({
89
- query: document,
90
- variables: variables ?? {},
91
- });
92
- const requestOptions = {
93
- method: 'POST',
94
- headers: requestHeaders,
95
- };
96
- const response = await makeRequest(requestUrl, requestOptions, body, options?.signal);
97
- if (response.statusCode < 200 || response.statusCode >= 300) {
98
- return {
99
- ok: false,
100
- data: null,
101
- errors: [
102
- {
103
- message: `HTTP ${response.statusCode}: ${response.statusMessage}`,
104
- },
105
- ],
106
- };
107
- }
108
- const json = JSON.parse(response.data);
109
- if (json.errors && json.errors.length > 0) {
110
- return {
111
- ok: false,
112
- data: null,
113
- errors: json.errors,
114
- };
115
- }
116
- return {
117
- ok: true,
118
- data: json.data,
119
- errors: undefined,
120
- };
121
- }
122
- setHeaders(headers) {
123
- this.headers = { ...this.headers, ...headers };
124
- }
125
- getEndpoint() {
126
- return this.endpoint;
127
- }
128
- }
129
- exports.NodeHttpAdapter = NodeHttpAdapter;
@@ -1,26 +0,0 @@
1
- import type { GraphQLAdapter, QueryResult } from '@constructive-io/graphql-types';
2
- /**
3
- * Options for individual execute calls.
4
- * Allows per-request header overrides and request cancellation.
5
- */
6
- export interface NodeHttpExecuteOptions {
7
- /** Additional headers to include in this request only */
8
- headers?: Record<string, string>;
9
- /** AbortSignal for request cancellation */
10
- signal?: AbortSignal;
11
- }
12
- /**
13
- * GraphQL adapter that uses node:http/node:https for requests.
14
- *
15
- * Handles *.localhost subdomains by rewriting the hostname to "localhost"
16
- * and injecting the original Host header for server-side subdomain routing.
17
- */
18
- export declare class NodeHttpAdapter implements GraphQLAdapter {
19
- private endpoint;
20
- private headers;
21
- private url;
22
- constructor(endpoint: string, headers?: Record<string, string>);
23
- execute<T>(document: string, variables?: Record<string, unknown>, options?: NodeHttpExecuteOptions): Promise<QueryResult<T>>;
24
- setHeaders(headers: Record<string, string>): void;
25
- getEndpoint(): string;
26
- }
@@ -1,129 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.NodeHttpAdapter = void 0;
7
- /**
8
- * Node HTTP adapter for localhost subdomain routing
9
- * @generated by @constructive-io/graphql-codegen
10
- * DO NOT EDIT - changes will be overwritten
11
- */
12
- const node_http_1 = __importDefault(require("node:http"));
13
- const node_https_1 = __importDefault(require("node:https"));
14
- /**
15
- * Check if a hostname is a localhost subdomain that needs special handling.
16
- * Returns true for *.localhost (e.g. auth.localhost) but not bare "localhost".
17
- */
18
- function isLocalhostSubdomain(hostname) {
19
- return hostname.endsWith('.localhost') && hostname !== 'localhost';
20
- }
21
- /**
22
- * Make an HTTP/HTTPS request using native Node modules.
23
- * Supports optional AbortSignal for request cancellation.
24
- */
25
- function makeRequest(url, options, body, signal) {
26
- return new Promise((resolve, reject) => {
27
- if (signal?.aborted) {
28
- reject(new Error('The operation was aborted'));
29
- return;
30
- }
31
- const protocol = url.protocol === 'https:' ? node_https_1.default : node_http_1.default;
32
- const req = protocol.request(url, options, (res) => {
33
- let data = '';
34
- res.setEncoding('utf8');
35
- res.on('data', (chunk) => {
36
- data += chunk;
37
- });
38
- res.on('end', () => {
39
- resolve({
40
- statusCode: res.statusCode || 0,
41
- statusMessage: res.statusMessage || '',
42
- data,
43
- });
44
- });
45
- });
46
- req.on('error', reject);
47
- if (signal) {
48
- const onAbort = () => {
49
- req.destroy(new Error('The operation was aborted'));
50
- };
51
- signal.addEventListener('abort', onAbort, { once: true });
52
- req.on('close', () => {
53
- signal.removeEventListener('abort', onAbort);
54
- });
55
- }
56
- req.write(body);
57
- req.end();
58
- });
59
- }
60
- /**
61
- * GraphQL adapter that uses node:http/node:https for requests.
62
- *
63
- * Handles *.localhost subdomains by rewriting the hostname to "localhost"
64
- * and injecting the original Host header for server-side subdomain routing.
65
- */
66
- class NodeHttpAdapter {
67
- endpoint;
68
- headers;
69
- url;
70
- constructor(endpoint, headers) {
71
- this.endpoint = endpoint;
72
- this.headers = headers ?? {};
73
- this.url = new URL(endpoint);
74
- }
75
- async execute(document, variables, options) {
76
- const requestUrl = new URL(this.url.href);
77
- const requestHeaders = {
78
- 'Content-Type': 'application/json',
79
- Accept: 'application/json',
80
- ...this.headers,
81
- ...options?.headers,
82
- };
83
- // For *.localhost subdomains, rewrite hostname and inject Host header
84
- if (isLocalhostSubdomain(requestUrl.hostname)) {
85
- requestHeaders['Host'] = requestUrl.host;
86
- requestUrl.hostname = 'localhost';
87
- }
88
- const body = JSON.stringify({
89
- query: document,
90
- variables: variables ?? {},
91
- });
92
- const requestOptions = {
93
- method: 'POST',
94
- headers: requestHeaders,
95
- };
96
- const response = await makeRequest(requestUrl, requestOptions, body, options?.signal);
97
- if (response.statusCode < 200 || response.statusCode >= 300) {
98
- return {
99
- ok: false,
100
- data: null,
101
- errors: [
102
- {
103
- message: `HTTP ${response.statusCode}: ${response.statusMessage}`,
104
- },
105
- ],
106
- };
107
- }
108
- const json = JSON.parse(response.data);
109
- if (json.errors && json.errors.length > 0) {
110
- return {
111
- ok: false,
112
- data: null,
113
- errors: json.errors,
114
- };
115
- }
116
- return {
117
- ok: true,
118
- data: json.data,
119
- errors: undefined,
120
- };
121
- }
122
- setHeaders(headers) {
123
- this.headers = { ...this.headers, ...headers };
124
- }
125
- getEndpoint() {
126
- return this.endpoint;
127
- }
128
- }
129
- exports.NodeHttpAdapter = NodeHttpAdapter;
@@ -1,26 +0,0 @@
1
- import type { GraphQLAdapter, QueryResult } from '@constructive-io/graphql-types';
2
- /**
3
- * Options for individual execute calls.
4
- * Allows per-request header overrides and request cancellation.
5
- */
6
- export interface NodeHttpExecuteOptions {
7
- /** Additional headers to include in this request only */
8
- headers?: Record<string, string>;
9
- /** AbortSignal for request cancellation */
10
- signal?: AbortSignal;
11
- }
12
- /**
13
- * GraphQL adapter that uses node:http/node:https for requests.
14
- *
15
- * Handles *.localhost subdomains by rewriting the hostname to "localhost"
16
- * and injecting the original Host header for server-side subdomain routing.
17
- */
18
- export declare class NodeHttpAdapter implements GraphQLAdapter {
19
- private endpoint;
20
- private headers;
21
- private url;
22
- constructor(endpoint: string, headers?: Record<string, string>);
23
- execute<T>(document: string, variables?: Record<string, unknown>, options?: NodeHttpExecuteOptions): Promise<QueryResult<T>>;
24
- setHeaders(headers: Record<string, string>): void;
25
- getEndpoint(): string;
26
- }
@@ -1,129 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.NodeHttpAdapter = void 0;
7
- /**
8
- * Node HTTP adapter for localhost subdomain routing
9
- * @generated by @constructive-io/graphql-codegen
10
- * DO NOT EDIT - changes will be overwritten
11
- */
12
- const node_http_1 = __importDefault(require("node:http"));
13
- const node_https_1 = __importDefault(require("node:https"));
14
- /**
15
- * Check if a hostname is a localhost subdomain that needs special handling.
16
- * Returns true for *.localhost (e.g. auth.localhost) but not bare "localhost".
17
- */
18
- function isLocalhostSubdomain(hostname) {
19
- return hostname.endsWith('.localhost') && hostname !== 'localhost';
20
- }
21
- /**
22
- * Make an HTTP/HTTPS request using native Node modules.
23
- * Supports optional AbortSignal for request cancellation.
24
- */
25
- function makeRequest(url, options, body, signal) {
26
- return new Promise((resolve, reject) => {
27
- if (signal?.aborted) {
28
- reject(new Error('The operation was aborted'));
29
- return;
30
- }
31
- const protocol = url.protocol === 'https:' ? node_https_1.default : node_http_1.default;
32
- const req = protocol.request(url, options, (res) => {
33
- let data = '';
34
- res.setEncoding('utf8');
35
- res.on('data', (chunk) => {
36
- data += chunk;
37
- });
38
- res.on('end', () => {
39
- resolve({
40
- statusCode: res.statusCode || 0,
41
- statusMessage: res.statusMessage || '',
42
- data,
43
- });
44
- });
45
- });
46
- req.on('error', reject);
47
- if (signal) {
48
- const onAbort = () => {
49
- req.destroy(new Error('The operation was aborted'));
50
- };
51
- signal.addEventListener('abort', onAbort, { once: true });
52
- req.on('close', () => {
53
- signal.removeEventListener('abort', onAbort);
54
- });
55
- }
56
- req.write(body);
57
- req.end();
58
- });
59
- }
60
- /**
61
- * GraphQL adapter that uses node:http/node:https for requests.
62
- *
63
- * Handles *.localhost subdomains by rewriting the hostname to "localhost"
64
- * and injecting the original Host header for server-side subdomain routing.
65
- */
66
- class NodeHttpAdapter {
67
- endpoint;
68
- headers;
69
- url;
70
- constructor(endpoint, headers) {
71
- this.endpoint = endpoint;
72
- this.headers = headers ?? {};
73
- this.url = new URL(endpoint);
74
- }
75
- async execute(document, variables, options) {
76
- const requestUrl = new URL(this.url.href);
77
- const requestHeaders = {
78
- 'Content-Type': 'application/json',
79
- Accept: 'application/json',
80
- ...this.headers,
81
- ...options?.headers,
82
- };
83
- // For *.localhost subdomains, rewrite hostname and inject Host header
84
- if (isLocalhostSubdomain(requestUrl.hostname)) {
85
- requestHeaders['Host'] = requestUrl.host;
86
- requestUrl.hostname = 'localhost';
87
- }
88
- const body = JSON.stringify({
89
- query: document,
90
- variables: variables ?? {},
91
- });
92
- const requestOptions = {
93
- method: 'POST',
94
- headers: requestHeaders,
95
- };
96
- const response = await makeRequest(requestUrl, requestOptions, body, options?.signal);
97
- if (response.statusCode < 200 || response.statusCode >= 300) {
98
- return {
99
- ok: false,
100
- data: null,
101
- errors: [
102
- {
103
- message: `HTTP ${response.statusCode}: ${response.statusMessage}`,
104
- },
105
- ],
106
- };
107
- }
108
- const json = JSON.parse(response.data);
109
- if (json.errors && json.errors.length > 0) {
110
- return {
111
- ok: false,
112
- data: null,
113
- errors: json.errors,
114
- };
115
- }
116
- return {
117
- ok: true,
118
- data: json.data,
119
- errors: undefined,
120
- };
121
- }
122
- setHeaders(headers) {
123
- this.headers = { ...this.headers, ...headers };
124
- }
125
- getEndpoint() {
126
- return this.endpoint;
127
- }
128
- }
129
- exports.NodeHttpAdapter = NodeHttpAdapter;
@@ -1,26 +0,0 @@
1
- import type { GraphQLAdapter, QueryResult } from '@constructive-io/graphql-types';
2
- /**
3
- * Options for individual execute calls.
4
- * Allows per-request header overrides and request cancellation.
5
- */
6
- export interface NodeHttpExecuteOptions {
7
- /** Additional headers to include in this request only */
8
- headers?: Record<string, string>;
9
- /** AbortSignal for request cancellation */
10
- signal?: AbortSignal;
11
- }
12
- /**
13
- * GraphQL adapter that uses node:http/node:https for requests.
14
- *
15
- * Handles *.localhost subdomains by rewriting the hostname to "localhost"
16
- * and injecting the original Host header for server-side subdomain routing.
17
- */
18
- export declare class NodeHttpAdapter implements GraphQLAdapter {
19
- private endpoint;
20
- private headers;
21
- private url;
22
- constructor(endpoint: string, headers?: Record<string, string>);
23
- execute<T>(document: string, variables?: Record<string, unknown>, options?: NodeHttpExecuteOptions): Promise<QueryResult<T>>;
24
- setHeaders(headers: Record<string, string>): void;
25
- getEndpoint(): string;
26
- }